aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/README18
-rw-r--r--tests/auto/auto.pro9
-rw-r--r--tests/auto/bic/data/QtQml.5.0.0.linux-gcc-ia32.txt4617
-rw-r--r--tests/auto/cmake/CMakeLists.txt15
-rw-r--r--tests/auto/cmake/cmake.pro7
-rw-r--r--tests/auto/compilerwarnings/data/test_cpp.txt51
-rw-r--r--tests/auto/headersclean/headersclean.pro2
-rw-r--r--tests/auto/particles/particles.pro30
-rw-r--r--tests/auto/particles/qquickage/data/jump.qml70
-rw-r--r--tests/auto/particles/qquickage/data/kill.qml66
-rw-r--r--tests/auto/particles/qquickage/data/onceoff.qml69
-rw-r--r--tests/auto/particles/qquickage/data/sustained.qml69
-rw-r--r--tests/auto/particles/qquickage/qquickage.pro11
-rw-r--r--tests/auto/particles/qquickage/tst_qquickage.cpp174
-rw-r--r--tests/auto/particles/qquickangleddirection/data/basic.qml68
-rw-r--r--tests/auto/particles/qquickangleddirection/qquickangleddirection.pro11
-rw-r--r--tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp97
-rw-r--r--tests/auto/particles/qquickcumulativedirection/data/basic.qml74
-rw-r--r--tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro11
-rw-r--r--tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp93
-rw-r--r--tests/auto/particles/qquickcustomaffector/data/affectedSignal.qml90
-rw-r--r--tests/auto/particles/qquickcustomaffector/data/basic.qml89
-rw-r--r--tests/auto/particles/qquickcustomaffector/data/move.qml74
-rw-r--r--tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro11
-rw-r--r--tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp143
-rw-r--r--tests/auto/particles/qquickcustomparticle/data/basic.qml71
-rw-r--r--tests/auto/particles/qquickcustomparticle/data/deleteSourceItem.qml81
-rw-r--r--tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro12
-rw-r--r--tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp114
-rw-r--r--tests/auto/particles/qquickellipseextruder/data/basic.qml77
-rw-r--r--tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro11
-rw-r--r--tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp126
-rw-r--r--tests/auto/particles/qquickfriction/data/basic.qml87
-rw-r--r--tests/auto/particles/qquickfriction/data/threshold.qml73
-rw-r--r--tests/auto/particles/qquickfriction/qquickfriction.pro11
-rw-r--r--tests/auto/particles/qquickfriction/tst_qquickfriction.cpp140
-rw-r--r--tests/auto/particles/qquickgravity/data/basic.qml70
-rw-r--r--tests/auto/particles/qquickgravity/qquickgravity.pro11
-rw-r--r--tests/auto/particles/qquickgravity/tst_qquickgravity.cpp91
-rw-r--r--tests/auto/particles/qquickgroupgoal/data/basic.qml73
-rw-r--r--tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro11
-rw-r--r--tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp94
-rw-r--r--tests/auto/particles/qquickimageparticle/data/basic.qml66
-rw-r--r--tests/auto/particles/qquickimageparticle/data/colorVariance.qml72
-rw-r--r--tests/auto/particles/qquickimageparticle/data/colored.qml68
-rw-r--r--tests/auto/particles/qquickimageparticle/data/deformed.qml71
-rw-r--r--tests/auto/particles/qquickimageparticle/data/sprite.qml71
-rw-r--r--tests/auto/particles/qquickimageparticle/data/tabled.qml69
-rw-r--r--tests/auto/particles/qquickimageparticle/qquickimageparticle.pro10
-rw-r--r--tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp348
-rw-r--r--tests/auto/particles/qquickitemparticle/data/basic.qml66
-rw-r--r--tests/auto/particles/qquickitemparticle/qquickitemparticle.pro12
-rw-r--r--tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp100
-rw-r--r--tests/auto/particles/qquicklineextruder/data/basic.qml76
-rw-r--r--tests/auto/particles/qquicklineextruder/qquicklineextruder.pro11
-rw-r--r--tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp108
-rw-r--r--tests/auto/particles/qquickmaskextruder/data/basic.qml68
-rw-r--r--tests/auto/particles/qquickmaskextruder/data/smallmask.pngbin0 -> 719 bytes
-rw-r--r--tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro11
-rw-r--r--tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp93
-rw-r--r--tests/auto/particles/qquickparticlegroup/data/basic.qml73
-rw-r--r--tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro11
-rw-r--r--tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp94
-rw-r--r--tests/auto/particles/qquickparticlesystem/data/basic.qml66
-rw-r--r--tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro11
-rw-r--r--tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp97
-rw-r--r--tests/auto/particles/qquickpointattractor/data/basic.qml73
-rw-r--r--tests/auto/particles/qquickpointattractor/qquickpointattractor.pro11
-rw-r--r--tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp94
-rw-r--r--tests/auto/particles/qquickpointdirection/data/basic.qml68
-rw-r--r--tests/auto/particles/qquickpointdirection/qquickpointdirection.pro11
-rw-r--r--tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp95
-rw-r--r--tests/auto/particles/qquickrectangleextruder/data/basic.qml78
-rw-r--r--tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro11
-rw-r--r--tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp118
-rw-r--r--tests/auto/particles/qquickspritegoal/data/basic.qml81
-rw-r--r--tests/auto/particles/qquickspritegoal/qquickspritegoal.pro11
-rw-r--r--tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp85
-rw-r--r--tests/auto/particles/qquicktargetdirection/data/basic.qml67
-rw-r--r--tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro11
-rw-r--r--tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp93
-rw-r--r--tests/auto/particles/qquicktrailemitter/data/basic.qml77
-rw-r--r--tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro11
-rw-r--r--tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp110
-rw-r--r--tests/auto/particles/qquickturbulence/data/basic.qml73
-rw-r--r--tests/auto/particles/qquickturbulence/qquickturbulence.pro11
-rw-r--r--tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp91
-rw-r--r--tests/auto/particles/qquickwander/data/basic.qml72
-rw-r--r--tests/auto/particles/qquickwander/qquickwander.pro11
-rw-r--r--tests/auto/particles/qquickwander/tst_qquickwander.cpp99
-rw-r--r--tests/auto/particles/shared/particlestestsshared.h90
-rw-r--r--tests/auto/particles/shared/squarefacesprite.pngbin0 -> 496 bytes
-rw-r--r--tests/auto/particles/shared/star.pngbin0 -> 1550 bytes
-rw-r--r--tests/auto/particles/shared/table.pngbin0 -> 704 bytes
-rw-r--r--tests/auto/qml/animation/animation.pro7
-rw-r--r--tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro6
-rw-r--r--tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp229
-rw-r--r--tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro6
-rw-r--r--tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp310
-rw-r--r--tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro7
-rw-r--r--tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp931
-rw-r--r--tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro7
-rw-r--r--tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp470
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro6
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp1617
-rw-r--r--tests/auto/qml/debugger/debugger.pro21
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/data/test.qml51
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro15
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp246
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro12
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp263
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro18
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp195
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml55
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml60
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/condition.qml54
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml54
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/exception.qml51
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml48
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml53
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml57
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/test.js53
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/test.qml60
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/timer.qml52
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro24
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp1801
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/data/test.qml60
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro22
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp300
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml5
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro16
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp200
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro16
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp1204
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/changes.txt8
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml5
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/data/window.qml7
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro15
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp191
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml9
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml5
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro14
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp342
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/data/console.qml14
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/data/exit.qml11
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/data/test.qml5
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro16
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp334
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp214
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.pri8
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h118
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp447
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h114
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp71
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugtestservice.h66
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp533
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.h247
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri3
-rw-r--r--tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp81
-rw-r--r--tests/auto/qml/debugger/shared/qqmlinspectorclient.h79
-rw-r--r--tests/auto/qml/debugger/shared/qqmlinspectorclient.pri3
-rw-r--r--tests/auto/qml/parserstress/parserstress.pro12
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4-1.js135
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4-2.js114
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.1.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.2.js162
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.3.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.js132
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-1.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-2.js101
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-3.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-1.js183
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-2.js118
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.3.js101
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.1-2.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.2.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.1.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.2.js120
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.3-1.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-1.js294
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-2.js169
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-1.js225
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-2.js227
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-3.js182
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-1.js170
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-2.js152
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-1.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-2.js127
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Array/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.1.js96
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.2.js161
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-1.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-2.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-3.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-4.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4-1.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.1.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-1.js97
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-2.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-3.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-4-n.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-1.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-2.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-3.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-4-n.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.js80
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Boolean/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-1.js96
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-2.js91
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma/Date/15.9.1.13-1.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.1.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-1.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-2.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-3.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-4.js68
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-5.js68
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-6.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-1.js239
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-2.js152
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-3.js141
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-4.js151
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-5.js140
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-1.js151
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-2.js142
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-3.js146
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-4.js143
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-5.js140
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-1.js155
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-2.js153
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-3.js160
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-4.js161
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-5.js161
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2-1.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2.js191
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.3.js186
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.1.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-1.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-10.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-11.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-12.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-13.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-2.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-3.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-4.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-5.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-6.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-7.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-8.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-9.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-1.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-2.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-3.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-4.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-5.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-6.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-7.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-1.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-2.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-3.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-4.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-5.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-6.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-7.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-8.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-1.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-2.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-3.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-4.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-5.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-6.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-7.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-8.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.14.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.15.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.16.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.17.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.18.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.19.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-1.js151
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-2-n.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2.js151
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.20.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-1.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-3.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-4.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-5.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-6.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-7.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-8.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-1.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-2.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-3.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-4.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-5.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-6.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-7.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-8.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-1.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-10.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-11.js140
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-12.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-13.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-14.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-15.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-16.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-17.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-18.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-2.js109
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-3-n.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-4.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-5.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-6.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-7.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-8.js103
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-9.js103
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-1.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-2.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-3.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-4.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-5.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-6.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-7.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-8.js133
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.25-1.js174
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.26-1.js183
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.27-1.js183
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.28-1.js196
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.29-1.js191
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-1-n.js80
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-2.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.30-1.js192
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.31-1.js221
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.32-1.js141
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.33-1.js145
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.34-1.js182
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.35-1.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-1.js165
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-2.js164
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-3.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-4.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-5.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-6.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-7.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-1.js173
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-2.js161
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-3.js164
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-4.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-5.js159
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-1.js93
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-2-n.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.5.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.6.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.7.js105
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.8.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.9.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Date/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-1.js107
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-2.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3.js170
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-1.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-10.js105
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-2.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-3.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-4.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-5.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-6.js100
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-7.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-8.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-1.js118
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-2.js100
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-3.js130
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-4.js91
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-2.js120
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-3.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.1.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-1.js122
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-2.js133
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-1.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-2.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.1.1.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-1.js270
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-2.js269
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-3.js268
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-1.js110
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-2-n.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-3.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-4.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.1.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-1.js231
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-2.js253
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-3.js300
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-4.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-5.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.14-1.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-1.js272
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-2.js128
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-3-n.js128
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-4-n.js128
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-5.js128
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1-n.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1.js100
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-10-n.js102
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-11.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-2-n.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-3-n.js100
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-4-n.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-5-n.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-6-n.js103
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-7-n.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-8-n.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-9-n.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-1.js125
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-2-n.js94
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-3-n.js91
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-4-n.js91
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-5.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.1.js153
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.2.js153
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.1.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.2.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.3.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.4.js156
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.5.js154
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.6.js299
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-01.js299
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-02.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.8.js215
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.9.js94
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.1.js115
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.2.js154
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.3.js161
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-1.js160
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-2.js164
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-3.js150
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.2-1.js165
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.3.js115
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.1.js228
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.2.js246
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.3.js230
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.1.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.2.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.3.js120
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.4.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.1.js159
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.2.js159
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.3.js159
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Expressions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-1.js136
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-2.js183
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-3.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-1.js132
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-2.js107
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-3.js95
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-3.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-4.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.2.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4-1.js94
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.1.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-1.js117
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-2.js90
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.1.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.3.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/FunctionObjects/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-1-n.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-2-n.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.1.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.2.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.1-2.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js372
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-2.js238
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js410
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js269
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.4.js205
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-1.js206
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-2.js183
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-3.js207
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js122
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js127
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/GlobalObject/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-1.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-2.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-3.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-1.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-2-n.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-3-n.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-4-n.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-5-n.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-6.js68
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-1.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-10.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-11.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-12.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-13-n.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-2.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-3.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-4.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-5.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-6.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-7.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-8.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-9.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-1-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-2-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-3-n.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-1-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-10-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-11-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-12-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-13-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-14-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-15-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-16-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-2-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-3-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-4-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-5-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-6-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-7-n.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-8-n.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-9-n.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-1-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-10-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-11-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-12-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-13-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-14-n.js97
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-15-n.js97
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-16-n.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-2-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-3-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-4-n.js96
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-5-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-6-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-7-n.js97
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-8-n.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-9-n.js98
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-1.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-10-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-2-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-3-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-4-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-5-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-6.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-7.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-8-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-9-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.6.js313
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.1.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.2.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js188
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js313
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js220
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.8.2-n.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/LexicalConventions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8-2-n.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8-3-n.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-1.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-2.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-1.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-1.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-2.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-1.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-2.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-1.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-1.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-1.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-1.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-2.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-3.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.js149
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js221
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.10.js153
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.11.js200
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.12.js177
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.13.js385
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.14.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.15.js202
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.16.js132
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.17.js217
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.18.js165
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.2.js151
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.3.js158
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.4.js156
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.5.js244
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.6.js232
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.7.js283
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.8.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.9.js191
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Math/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/NativeObjects/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/NativeObjects/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.1.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.2.js168
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-1.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-2.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-3.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-1.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-3.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-4.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-1.js68
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-2.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-3.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-4.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-1.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-2.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-3.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-4.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-1.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-3.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-4.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-1.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-2.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-3.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-4.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4-1.js60
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.1.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-1.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-2-n.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-3-n.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-4.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-1.js97
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-2.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-3-n.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Number/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.1.js146
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.2.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.1.js138
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.2.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3-1.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-1.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-3.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-4.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.1.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.2.js130
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.3.js117
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/ObjectObjects/shell.js1
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma/README1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/SourceText/6-1.js128
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/SourceText/6-2.js131
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/SourceText/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/SourceText/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.10-1.js151
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.10.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.2-1.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.5-1.js102
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.5-2.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.1-1.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-1.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-2.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-3.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-4.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-5.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-6.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-7.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-8.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-9-n.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-1.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-10.js115
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-11.js98
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-12.js103
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-19.js117
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-2.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-3.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-4.js202
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-5-n.js110
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-6-n.js109
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-7-n.js110
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-8-n.js110
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-9-n.js109
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.7-1-n.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.8-1-n.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/12.9-1-n.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Statements/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.1.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.2.js110
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-1.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-2.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-3.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-4.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-1.js190
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-2.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-3.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.3.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.1.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.10-1.js217
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-1.js518
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-2.js515
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-3.js514
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-4.js507
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-5.js520
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-6.js516
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-1.js520
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-2.js518
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-3.js559
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-4.js515
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-5.js515
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-1.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-2-n.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-3.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-1.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-2.js90
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-3-n.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-1.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-2.js136
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-3.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-4.js124
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-1.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-2.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-3.js131
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-4.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-5.js106
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-1.js155
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-2.js259
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-1.js219
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-2.js217
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-1.js232
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-2.js247
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-3.js204
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.9-1.js202
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.4.js108
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/15.5.5.1.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/String/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.2.js138
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3-1.js100
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-1.js323
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-2.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js733
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-1.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-2.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.5-2.js173
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.6.js140
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.7.js160
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.8.1.js167
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.9-1.js119
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/TypeConversion/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Types/8.1.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Types/8.4.js130
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Types/8.6.2.1-1.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Types/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/Types/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/browser.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/10.1.4-9.js110
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/10.1.6.js127
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/10.1.8-1.js135
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-1.js145
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-2.js136
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-3.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/11.6.2-1.js124
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15-1.js94
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15-2.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.1.2.1-1.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.2.1.1.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.2.3-1.js64
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.2.4.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-1.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-2.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-1.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-2.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.3.3.1-1.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.4.3.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.5.3.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.2.js59
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.4-4.js107
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.5-6.js94
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.7-3.js161
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.1-5.js58
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.6.4-2.js66
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.7.3.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.7.4.js90
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.8-1.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/15.9.5.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/8.6.2.1-1.js98
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/9.9-1.js102
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/extensions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/jsref.js634
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/shell.js577
-rw-r--r--tests/auto/qml/parserstress/tests/ecma/template.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-001.js80
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-002.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-001.js93
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-002.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-003.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-004.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-001.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-002.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-003.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-004.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-005.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-006.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-007.js90
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-008.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-009.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-010-n.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-011-n.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-001.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-002.js93
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-003.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-004.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-005.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-006.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-007.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-008.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-009.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-010.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-011.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-012.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-013.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-014.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-015.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-016.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-017.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-019.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/function-001.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-001.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-002.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-001.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-002.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-003.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-004.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-005.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-006.js91
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-007.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-008.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-009.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-010.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-011.js95
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-012.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-013.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-014.js95
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-015.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-016.js95
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-017.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-018.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-019.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-020.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-021.js95
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-022.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-023.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-024.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-025.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-026.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-027.js94
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-028.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-029.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-030.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-031.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-032.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-033.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-034.js91
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-035.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-036.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-037.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-038.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-039.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-040.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-041.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-042.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-047.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-048.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-049.js82
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-050.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-051.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-052.js80
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-053.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-054.js79
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-001.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-002.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-003.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-001.js80
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-002.js102
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-003.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-004.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-005.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-006.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-007.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-008.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-009.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-001.js86
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-002.js85
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Expressions/StrictEquality-001.js106
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Expressions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Expressions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/apply-001-n.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/call-1.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/keywords-001.js81
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-001.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-002.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/shell.js1
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/README1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js221
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js105
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js101
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js126
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js120
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js124
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js162
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js78
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-001.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-002.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-003.js96
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-004.js100
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-005.js106
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-006.js122
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-007.js130
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-001.js330
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-002.js109
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/if-001.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/label-001.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/label-002.js89
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-001.js98
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-002.js96
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-003.js90
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-004.js127
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-001.js118
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-003.js115
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-004.js87
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-005.js90
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-006.js120
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-007.js125
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-008.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-009.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-010.js106
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/try-012.js128
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/while-001.js75
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/while-002.js119
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/while-003.js120
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/Statements/while-004.js250
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/match-001.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/match-002.js207
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/match-003.js165
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/match-004.js206
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/replace-001.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/split-001.js145
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/split-002.js303
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/String/split-003.js156
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/browser.js37
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/extensions/browser.js0
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/constructor-001.js74
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/function-001.js74
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-001.js144
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-002.js160
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-003-n.js121
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-004-n.js121
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-005-n.js122
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-006.js119
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/extensions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/instanceof/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-001.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-002.js84
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-003.js98
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/instanceof/regress-7635.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/instanceof/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/jsref.js591
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/shell.js51
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_2/template.js57
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.11-01.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.3-1.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.4-001.js153
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/15.4.5.1-01.js93
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Array/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Array/regress-101488.js172
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Array/regress-130451.js219
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-01.js73
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-02.js65
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-03.js73
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-04.js71
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/regress-387501.js94
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/regress-421325.js67
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Array/regress-430717.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Array/shell.js1
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Date/15.9.1.2-01.js62
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Date/15.9.3.2-1.js91
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Date/15.9.4.3.js233
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.3.js152
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.4.js185
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5-02.js88
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5.js144
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.6.js153
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.7.js142
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Date/browser.js37
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Date/shell.js564
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.1.1.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.4.4-1.js174
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-001.js130
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-002.js132
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-003.js132
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/binding-001.js128
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181654.js155
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181914.js194
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-58946.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-95101.js118
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Exceptions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-1.js201
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-2.js70
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.4-1.js85
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.6.1-01.js136
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-23346.js71
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-448595-01.js91
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/shell.js1
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-01.js76
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-02.js76
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-03.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.6.1-1.js176
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.1-01.js76
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.2-01.js76
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.3-01.js76
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.9.6-1.js213
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Expressions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Expressions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/FunExpr/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001-n.js58
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001.js57
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-002.js61
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/FunExpr/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.3-1.js210
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.4-1.js185
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/arguments-001.js169
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Function/arguments-002.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/call-001.js153
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-131964.js196
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-137181.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-193555.js136
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Function/regress-313570.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-49286.js137
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-58274.js226
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-85880.js173
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-94506.js163
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/regress-97921.js152
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/scope-001.js265
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/scope-002.js245
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Function/shell.js1
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/7.9.1.js157
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.2-01.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-01.js69
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-02.js53
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.5-1.js145
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.6-1.js134
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-1.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-2.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/browser.js0
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Number/regress-442242-01.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Number/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/tostring-001.js60
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Object/8.6.1-01.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/8.6.2.6-001.js113
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/browser.js7
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/class-001.js156
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/class-002.js146
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/class-003.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/class-004.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/class-005.js124
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Object/regress-361274.js66
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Object/regress-385393-07.js67
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/regress-72773.js97
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/regress-79129-001.js80
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Object/shell.js105
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-001.js152
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-002.js57
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-001.js120
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-002.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Operators/browser.js0
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Operators/order-01.js108
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Operators/shell.js1
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/README1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2-1.js181
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2.12.js63
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-1.js136
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-2.js144
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-1.js127
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-2.js133
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-3.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-4.js146
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-5-n.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-1.js140
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-2.js367
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-001.js136
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js154
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-001.js3230
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-002.js1842
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-100199.js307
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-105972.js157
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-119909.js92
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-122076.js110
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-123437.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-165353.js122
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169497.js105
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169534.js95
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-187133.js142
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-188206.js219
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-191479.js198
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-202564.js101
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209067.js1106
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209919.js174
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-216591.js117
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-220367-001.js104
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223273.js279
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223535.js133
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-224676.js232
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225289.js176
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225343.js125
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-24712.js59
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-285219.js51
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-28686.js57
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-289669.js88
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-307456.js54
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-309840.js58
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-311414.js101
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-312351.js50
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-31316.js96
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-330684.js53
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-334158.js58
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-346090.js63
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-367888.js62
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375642.js61
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375711.js118
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-01-n.js63
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-02.js60
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-03.js60
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-04.js68
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57572.js150
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57631.js152
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-67773.js211
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-72964.js121
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-76683.js114
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-78156.js123
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js276
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-87231.js145
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-98306.js99
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/RegExp/shell.js266
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Regress/browser.js0
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Regress/regress-385393-04.js66
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Regress/regress-419152.js90
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420087.js64
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420610.js50
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js73
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Regress/shell.js1
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Statements/12.6.3.js80
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-121744.js217
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-131348.js184
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-157509.js111
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-194364.js152
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-226517.js112
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Statements/regress-302439.js1368
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Statements/regress-324650.js5461
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-001.js139
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-002.js9097
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-003.js9099
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-001.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-002.js74
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Statements/switch-001.js143
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.11.js532
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.14.js50
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/String/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/String/regress-104375.js116
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/String/regress-189898.js157
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/String/regress-304376.js68
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/String/regress-313567.js56
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js77
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/String/regress-83293.js216
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/String/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/browser.js0
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-01.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/shell.js1
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001-n.js62
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001.js56
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002-n.js55
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002.js60
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-003.js71
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-004.js65
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-005.js276
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/browser.js36
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/10.1.3-2.js162
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/7.9.1.js83
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/extensions/browser.js0
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-103087.js178
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-01.js108
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-02.js158
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-220367-002.js112
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-228087.js352
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/regress-274152.js83
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/regress-320854.js53
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/regress-327170.js58
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/regress-368516.js78
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/regress-385393-03.js63
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/regress-429248.js67
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/extensions/regress-430740.js72
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/extensions/shell.js266
-rw-r--r--tests/auto/qml/parserstress/tests/ecma_3/shell.js40
-rwxr-xr-xtests/auto/qml/parserstress/tests/ecma_3/template.js59
-rw-r--r--tests/auto/qml/parserstress/tests/shell.js886
-rw-r--r--tests/auto/qml/parserstress/tst_parserstress.cpp155
-rw-r--r--tests/auto/qml/qjsengine/qjsengine.pro9
-rw-r--r--tests/auto/qml/qjsengine/script/com/__init__.js9
-rw-r--r--tests/auto/qml/qjsengine/script/com/trolltech/__init__.js9
-rw-r--r--tests/auto/qml/qjsengine/script/com/trolltech/recursive/__init__.js1
-rw-r--r--tests/auto/qml/qjsengine/script/com/trolltech/syntaxerror/__init__.js5
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp2829
-rw-r--r--tests/auto/qml/qjsonbinding/data/array.0.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/array.1.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/array.2.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/array.3.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/array.4.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/empty.json0
-rw-r--r--tests/auto/qml/qjsonbinding/data/false.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/null.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/number.0.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/number.1.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/object.0.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/object.1.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/object.2.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/object.3.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/object.4.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/string.0.json1
-rw-r--r--tests/auto/qml/qjsonbinding/data/true.json1
-rw-r--r--tests/auto/qml/qjsonbinding/qjsonbinding.pro17
-rw-r--r--tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp532
-rw-r--r--tests/auto/qml/qjsvalue/qjsvalue.pro8
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.cpp2572
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.h167
-rw-r--r--tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro9
-rw-r--r--tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp520
-rw-r--r--tests/auto/qml/qml.pro71
-rw-r--r--tests/auto/qml/qmlmin/qmlmin.pro12
-rw-r--r--tests/auto/qml/qmlmin/tst_qmlmin.cpp218
-rw-r--r--tests/auto/qml/qmlplugindump/qmlplugindump.pro8
-rw-r--r--tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp117
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/TestItem.qml4
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml14
-rw-r--r--tests/auto/qml/qqmlapplicationengine/data/basicTest.qml5
-rw-r--r--tests/auto/qml/qqmlapplicationengine/qqmlapplicationengine.pro3
-rw-r--r--tests/auto/qml/qqmlapplicationengine/testapp/main.cpp50
-rw-r--r--tests/auto/qml/qqmlapplicationengine/testapp/main.qml11
-rw-r--r--tests/auto/qml/qqmlapplicationengine/testapp/main.qrc5
-rw-r--r--tests/auto/qml/qqmlapplicationengine/testapp/testapp.pro11
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp162
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro10
-rw-r--r--tests/auto/qml/qqmlbinding/data/deletedObject.qml24
-rw-r--r--tests/auto/qml/qqmlbinding/data/restoreBinding.qml26
-rw-r--r--tests/auto/qml/qqmlbinding/data/restoreBindingWithLoop.qml23
-rw-r--r--tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml28
-rw-r--r--tests/auto/qml/qqmlbinding/data/test-binding.qml16
-rw-r--r--tests/auto/qml/qqmlbinding/data/test-binding2.qml16
-rw-r--r--tests/auto/qml/qqmlbinding/qqmlbinding.pro14
-rw-r--r--tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp237
-rw-r--r--tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.1.qml4
-rw-r--r--tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.2.qml4
-rw-r--r--tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/MyType.qml6
-rw-r--r--tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/subdir/MySubType.qml7
-rw-r--r--tests/auto/qml/qqmlbundle/data/componentFromBundle/bundledata/test.qml6
-rw-r--r--tests/auto/qml/qqmlbundle/data/import.qml4
-rw-r--r--tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/qmldir2
-rw-r--r--tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/subdir/qmldir1
-rw-r--r--tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin.cpp81
-rw-r--r--tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro7
-rw-r--r--tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/qmldir1
-rw-r--r--tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/st.qml6
-rw-r--r--tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/test.qml4
-rw-r--r--tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/MyType.qml6
-rw-r--r--tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/test.qml4
-rw-r--r--tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/MyType.qml6
-rw-r--r--tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/test.qml4
-rw-r--r--tests/auto/qml/qqmlbundle/qqmlbundle.pro2
-rw-r--r--tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp260
-rw-r--r--tests/auto/qml/qqmlbundle/tst_qqmlbundle.pro16
-rw-r--r--tests/auto/qml/qqmlchangeset/qqmlchangeset.pro10
-rw-r--r--tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp1574
-rw-r--r--tests/auto/qml/qqmlcomponent/data/NestedDirectories/NDTLC.qml23
-rw-r--r--tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NDComponentOne.qml9
-rw-r--r--tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/NDComponentTwo.qml6
-rw-r--r--tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/qmldir1
-rw-r--r--tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/qmldir1
-rw-r--r--tests/auto/qml/qqmlcomponent/data/NestedDirectories/qmldir1
-rw-r--r--tests/auto/qml/qqmlcomponent/data/OtherComponent/OtherComponent.qml6
-rw-r--r--tests/auto/qml/qqmlcomponent/data/OtherComponent/qmldir1
-rw-r--r--tests/auto/qml/qqmlcomponent/data/RecursiveComponent.qml10
-rw-r--r--tests/auto/qml/qqmlcomponent/data/SpecificComponent/SpecificComponent.qml7
-rw-r--r--tests/auto/qml/qqmlcomponent/data/SpecificComponent/qmldir1
-rw-r--r--tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml591
-rw-r--r--tests/auto/qml/qqmlcomponent/data/TestComponent.qml534
-rw-r--r--tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml24
-rw-r--r--tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.3.qml53
-rw-r--r--tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.4.qml28
-rw-r--r--tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.5.qml4
-rw-r--r--tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.qml31
-rw-r--r--tests/auto/qml/qqmlcomponent/data/createObject.qml13
-rw-r--r--tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml43
-rw-r--r--tests/auto/qml/qqmlcomponent/data/createParentReference.qml12
-rw-r--r--tests/auto/qml/qqmlcomponent/data/incubateObject.qml36
-rw-r--r--tests/auto/qml/qqmlcomponent/data/onDestructionCount.qml16
-rw-r--r--tests/auto/qml/qqmlcomponent/data/onDestructionLookup.qml25
-rw-r--r--tests/auto/qml/qqmlcomponent/data/recursion.qml12
-rw-r--r--tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml16
-rw-r--r--tests/auto/qml/qqmlcomponent/qqmlcomponent.pro16
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp437
-rw-r--r--tests/auto/qml/qqmlconnections/data/connection-targetchange.qml25
-rw-r--r--tests/auto/qml/qqmlconnections/data/connection-unknownsignals-ignored.qml8
-rw-r--r--tests/auto/qml/qqmlconnections/data/connection-unknownsignals-notarget.qml5
-rw-r--r--tests/auto/qml/qqmlconnections/data/connection-unknownsignals-parent.qml5
-rw-r--r--tests/auto/qml/qqmlconnections/data/connection-unknownsignals.qml7
-rw-r--r--tests/auto/qml/qqmlconnections/data/error-object.qml5
-rw-r--r--tests/auto/qml/qqmlconnections/data/error-property.qml3
-rw-r--r--tests/auto/qml/qqmlconnections/data/error-property2.qml3
-rw-r--r--tests/auto/qml/qqmlconnections/data/error-syntax.qml7
-rw-r--r--tests/auto/qml/qqmlconnections/data/rewriteError-global.qml8
-rw-r--r--tests/auto/qml/qqmlconnections/data/rewriteError-unnamed.qml8
-rw-r--r--tests/auto/qml/qqmlconnections/data/singletontype-target.qml22
-rw-r--r--tests/auto/qml/qqmlconnections/data/test-connection.qml10
-rw-r--r--tests/auto/qml/qqmlconnections/data/test-connection2.qml3
-rw-r--r--tests/auto/qml/qqmlconnections/data/test-connection3.qml3
-rw-r--r--tests/auto/qml/qqmlconnections/data/trimming.qml10
-rw-r--r--tests/auto/qml/qqmlconnections/qqmlconnections.pro14
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp343
-rw-r--r--tests/auto/qml/qqmlconsole/data/assert.qml62
-rw-r--r--tests/auto/qml/qqmlconsole/data/exception.qml58
-rw-r--r--tests/auto/qml/qqmlconsole/data/logging.qml91
-rw-r--r--tests/auto/qml/qqmlconsole/data/profiling.qml51
-rw-r--r--tests/auto/qml/qqmlconsole/data/tracing.qml56
-rw-r--r--tests/auto/qml/qqmlconsole/qqmlconsole.pro14
-rw-r--r--tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp171
-rw-r--r--tests/auto/qml/qqmlcontext/data/ContainerComponent.qml5
-rw-r--r--tests/auto/qml/qqmlcontext/data/ContentComponent.qml10
-rw-r--r--tests/auto/qml/qqmlcontext/data/Object_22535.qml8
-rw-r--r--tests/auto/qml/qqmlcontext/data/RefreshExpressionsType.qml5
-rw-r--r--tests/auto/qml/qqmlcontext/data/evalAfterInvalidate.qml14
-rw-r--r--tests/auto/qml/qqmlcontext/data/qtbug_22535.qml10
-rw-r--r--tests/auto/qml/qqmlcontext/data/refreshExpressions.qml6
-rw-r--r--tests/auto/qml/qqmlcontext/data/refreshExpressionsRootContext.qml6
-rw-r--r--tests/auto/qml/qqmlcontext/qqmlcontext.pro14
-rw-r--r--tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp664
-rw-r--r--tests/auto/qml/qqmlcpputils/qqmlcpputils.pro10
-rw-r--r--tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp126
-rw-r--r--tests/auto/qml/qqmldirparser/data/empty/qmldir0
-rw-r--r--tests/auto/qml/qqmldirparser/data/excessive-module/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/excessive-plugin/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/four-sections/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/incomplete-module/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/incomplete-plugin/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/invalid-versioned-component/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/multiple/qmldir15
-rw-r--r--tests/auto/qml/qqmldirparser/data/name-path-plugin/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/name-plugin/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/no-content/qmldir4
-rw-r--r--tests/auto/qml/qqmldirparser/data/non-first-module/qmldir2
-rw-r--r--tests/auto/qml/qqmldirparser/data/one-section/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/repeated-module/qmldir2
-rw-r--r--tests/auto/qml/qqmldirparser/data/unversioned-component/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/versioned-component/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/data/versioned-script/qmldir1
-rw-r--r--tests/auto/qml/qqmldirparser/qqmldirparser.pro11
-rw-r--r--tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp288
-rw-r--r--tests/auto/qml/qqmlecmascript/data/AliasBindingsAssignCorrectlyType.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType3.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType1.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType2.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/BaseComponent.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml34
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ConstantsOverrideBindings.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ContainerComponent.qml4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ContentComponent.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/CustomObject.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentDerived.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ElementAssignType.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/HRMDPComponent.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/InnerObject.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/MethodsObject.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/NestedTypeTransientErrors.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/OnDestructionComponent.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/OuterObject.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyQJSValueBaseItem.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarBaseItem.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent2.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent3.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent4.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent5.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarInheritanceComponent.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/PropertyVarOwnershipComponent.qml37
-rw-r--r--tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Base.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Derived.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/RootObject.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVar.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVariant.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ScarceResourceVarComponent.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/Scope6Nested.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ScopeObject.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/SequenceConversionComponent.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/SignalEmittedComponent.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/SpuriousWarning.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/TypeForDynamicCreation.qml2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml59
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.2.qml29
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasToCompositeElement.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.2.qml29
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.3.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasreset/AliasPropertyComponent.qml17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.1.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.2.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.3.qml31
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.4.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.5.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.error.1.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml30
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignDate.1.qml35
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignDate.2.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignDate.3.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignDate.4.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignDate.5.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignDate.6.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignDate.qml35
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.1.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.2.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.3.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.4.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.5.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.6.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.7.qml42
-rw-r--r--tests/auto/qml/qqmlecmascript/data/attachedProperty.2.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/attachedProperty.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/attachedPropertyScope.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/automaticSemicolon.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/bindingLoop.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/bindingSuppression.qml17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/blank.js0
-rw-r--r--tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/booleanConversion.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/bug.1.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.1.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.2.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.1.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.2.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.3.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.4.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlots.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/compiled.qml48
-rw-r--r--tests/auto/qml/qqmlecmascript/data/componentCreation.qml52
-rw-r--r--tests/auto/qml/qqmlecmascript/data/compositePropertyType.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/concatenatedStringPropertyAccess.qml127
-rw-r--r--tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.1.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.3.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deferredProperties.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deferredPropertiesErrors.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deleteLater.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deleteLaterObjectMethodCall.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.2.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deleteWhileBindingRunning.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deletedEngine.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/deletedObject.qml25
-rw-r--r--tests/auto/qml/qqmlecmascript/data/destroyedSignal.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/doubleEvaluate.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicCreation.helper.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicCreation.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicCreationOwnership.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml30
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicDeletion.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/dynamicString.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/data/elementAssign.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/enums.1.qml38
-rw-r--r--tests/auto/qml/qqmlecmascript/data/enums.2.qml37
-rw-r--r--tests/auto/qml/qqmlecmascript/data/enums.3.qml51
-rw-r--r--tests/auto/qml/qqmlecmascript/data/eval.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exception.js1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exceptionClearsOnReeval.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning2.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.2.qml33
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.3.qml39
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.4.qml39
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.5.qml39
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.6.qml39
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.7.qml39
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.8.qml39
-rw-r--r--tests/auto/qml/qqmlecmascript/data/exportDate.qml33
-rw-r--r--tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup2.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/extensionObjects.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/extensionObjectsPropertyOverride.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.1.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.3.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.4.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.5.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.6.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/forInLoop.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/function.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/functionAssignment.1.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/functionAssignment.2.qml73
-rw-r--r--tests/auto/qml/qqmlecmascript/data/functionAssignment.3.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/functionAssignment.js17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/functionErrors.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/getSet.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.2.qml31
-rw-r--r--tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.3.qml34
-rw-r--r--tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.qml31
-rw-r--r--tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.1.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.2.qml25
-rw-r--r--tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.1.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.2.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.1.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/importScope.1.js1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/importScope.2.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/importScope.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/in.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include.js8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_callback.js11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_callback.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_pragma.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_pragma_inner.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_pragma_outer.js6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_remote.js26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_remote.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_remote_missing.js13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_remote_missing.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_shared.js12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/include_shared.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml47
-rw-r--r--tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/invokableEnumRet.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/invokableObjectArg.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/invokableObjectRet.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/js/include2.js4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/js/include3.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsObject.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsOwnedObjectsDeletedOnEngineDestroy.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleOne.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleTwo.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importFive.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importFour.js9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importOne.js13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibrary.js9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithImports.js9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithPragmaLibraryImports.js11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importSingletonType.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importThree.js9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importTwo.js10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/importWithNoImports.js11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testImport.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibrary.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithImports.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithPragmaLibraryImports.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testImportScoping.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testImportSingletonType.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testJsImport.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleImport.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleRemoteImport.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testJsRemoteImport.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testModuleImport.js8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimport/testScriptImport.js11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/failFive.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/failFour.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/failOne.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/failThree.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/failTwo.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/importOne.js7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/importPragmaLibrary.js11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/importWithImports.js13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/testImportPragmaLibrary.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/testModuleImport.js8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/jsimportfail/testScriptImport.js11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/ScriptAPI.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/qmldir1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.js6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/listAssignment.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/listProperties.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/listToVariant.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevision.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevision2.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevision3.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevision4.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors2.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors3.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/methods.1.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/methods.2.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/methods.3.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/methods.4.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/methods.5.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/multiEngineObject.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.2.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/nonExistentAttachedObject.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/nonNotifyable.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/nonscriptable.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/nullObjectBinding.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberAssignment.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing.1.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing.2.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing.3.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing.4.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing.5.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing.6.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing.7.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/objectConversion.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/data/objectName.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/objectNameChangedSignal.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/objectsCompareAsEqual.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/objectsPassThroughSignals.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/onDestruction.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/overrideDataAssert.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ownership.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ownershipConsistency.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/ownershipRootObject.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyAssignmentErrors.qml29
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyOverride.qml104
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.1.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.10.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.11.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.13.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.14.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.15.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.16.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.2.qml25
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.3.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.4.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.5.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.6.qml31
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.7.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.8.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.9.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.bindingreset.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyQJSValue.reset.qml17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertySplicing.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.1.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.10.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.11.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.12.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.13.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.14.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.15.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.16.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.3.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.4.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.5.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.6.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.7.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.8.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.9.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.circular.2.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.circular.qml44
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.inherit.qml34
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVar.reparent.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarCpp.qml17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarImplicitOwnership.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml31
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.type.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.qml25
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type1.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type2.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qlistqobjectMethods.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qmlHasOwnProperty.qml72
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qmlToString.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qobjectConnectionListExceptionHandling.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qobjectDerivedArgument.qml17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.2.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_10696.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_11600.js1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_11600.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_11606.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_20344.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_21580.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_21864.js2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_21864.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_22464.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_22679.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_22843.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_22843.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_24448.js6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_9792.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtcreatorbug_1289.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/readonlyDeclaration.qml45
-rw-r--r--tests/auto/qml/qqmlecmascript/data/realToInt.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/regExp.2.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/regExp.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/registeredFlagMethod.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/ScriptAPI.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/qmldir1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/remote_file.js2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/replaceBinding.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings.qml35
-rw-r--r--tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings_crlf.1.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.var.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.variant.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.var.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.variant.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.js25
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.js25
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.js19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.qml22
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.js19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.js19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.js15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.js15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.var.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.variant.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.var.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.variant.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.var.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.variant.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.var.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.variant.qml23
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.js14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.js15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameWithBinding.var.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceObjectGc.var.qml30
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.var.qml29
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.variant.qml29
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.js48
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.js48
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.var.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.variant.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.var.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.variant.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scope.2.qml40
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scope.3.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scope.4.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scope.5.qml27
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scope.6.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scope.qml44
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.1.js4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.2.js5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.6.js3
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.js6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptErrors.js4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/scriptErrors.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/secondAlias.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml193
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.error.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.qml28
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml183
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml75
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.error.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.qml105
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.threads.qml74
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.qml109
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceSort.qml95
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sharedAttachedObject.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/data/shutdownErrors.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalArguments.1.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalArguments.2.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalAssignment.3.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalAssignment.4.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalEmitted.2.qml29
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalEmitted.3.qml33
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml36
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalHandlers.qml60
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml18
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml20
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalWithJSValueInVariant.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalWithQJSValue.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalWithUnknownTypes.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonType.qml24
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeCaching.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeEnums.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeNoQualifier.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml30
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonType.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeCaching.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeNoQualifier.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeWriting.qml32
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeImportOrder.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMajorVersionFail.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMinorVersionFail.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMultiple.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeResolution.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/data/strictlyEquals.qml17
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringArg.qml49
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/switchStatement.1.qml33
-rw-r--r--tests/auto/qml/qqmlecmascript/data/switchStatement.2.qml33
-rw-r--r--tests/auto/qml/qqmlecmascript/data/switchStatement.3.qml33
-rw-r--r--tests/auto/qml/qqmlecmascript/data/switchStatement.4.qml31
-rw-r--r--tests/auto/qml/qqmlecmascript/data/switchStatement.5.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/switchStatement.6.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/threadScript.js4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/threadSignal.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/data/transientErrors.2.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/transientErrors.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/tryStatement.1.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/tryStatement.2.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/tryStatement.3.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/data/tryStatement.4.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/data/typeOf.js25
-rw-r--r--tests/auto/qml/qqmlecmascript/data/typeOf.qml26
-rw-r--r--tests/auto/qml/qqmlecmascript/data/unaryExpression.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.2.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/data/urlListProperty.qml41
-rw-r--r--tests/auto/qml/qqmlecmascript/data/urlProperty.1.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/urlProperty.2.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/v8bindingException.qml21
-rw-r--r--tests/auto/qml/qqmlecmascript/data/v8functionException.qml15
-rw-r--r--tests/auto/qml/qqmlecmascript/data/valueTypeFunctions.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/varAlias.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/variantsAssignedUndefined.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/withStatement.1.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/data/writeAttachedProperty.qml6
-rw-r--r--tests/auto/qml/qqmlecmascript/data/writeRemovesBinding.qml46
-rw-r--r--tests/auto/qml/qqmlecmascript/qqmlecmascript.pro22
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.cpp329
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h1657
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp7397
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/ScriptComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/TopLevelComponent.qml6
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml8
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml8
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml7
-rw-r--r--tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml7
-rw-r--r--tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml15
-rw-r--r--tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml15
-rw-r--r--tests/auto/qml/qqmlengine/data/failedCompilation.1.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.1.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.2.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.3.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml4
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml8
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.6.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.7.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.8.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.9.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/repeatedCompilation.qml9
-rw-r--r--tests/auto/qml/qqmlengine/data/script.js1
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml38
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml34
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml36
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml38
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml51
-rw-r--r--tests/auto/qml/qqmlengine/data/testLoaderComponent.qml62
-rw-r--r--tests/auto/qml/qqmlengine/data/testReloadComponent.qml52
-rw-r--r--tests/auto/qml/qqmlengine/data/testScriptComponent.qml43
-rw-r--r--tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml50
-rw-r--r--tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml34
-rw-r--r--tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml36
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml34
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml36
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml39
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml42
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml40
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml44
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml41
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml45
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml41
-rw-r--r--tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml45
-rw-r--r--tests/auto/qml/qqmlengine/qqmlengine.pro10
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp679
-rw-r--r--tests/auto/qml/qqmlerror/.gitattributes1
-rw-r--r--tests/auto/qml/qqmlerror/data/test.txt3
-rw-r--r--tests/auto/qml/qqmlerror/qqmlerror.pro14
-rw-r--r--tests/auto/qml/qqmlerror/tst_qqmlerror.cpp243
-rw-r--r--tests/auto/qml/qqmlexpression/data/scriptString.qml9
-rw-r--r--tests/auto/qml/qqmlexpression/qqmlexpression.pro14
-rw-r--r--tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp121
-rw-r--r--tests/auto/qml/qqmlglobal/qqmlglobal.pro8
-rw-r--r--tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp78
-rw-r--r--tests/auto/qml/qqmlincubator/data/AsynchronousIfNestedType.qml7
-rw-r--r--tests/auto/qml/qqmlincubator/data/asynchronousIfNested.1.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/data/asynchronousIfNested.2.qml6
-rw-r--r--tests/auto/qml/qqmlincubator/data/asynchronousIfNested.3.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/data/chainInCompletion.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/data/chainedAsynchronousIfNested.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/data/clear.qml8
-rw-r--r--tests/auto/qml/qqmlincubator/data/clearDuringCompletion.qml6
-rw-r--r--tests/auto/qml/qqmlincubator/data/contextDelete.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/data/forceCompletion.qml9
-rw-r--r--tests/auto/qml/qqmlincubator/data/nestedComponent.js1
-rw-r--r--tests/auto/qml/qqmlincubator/data/nestedComponent.qml10
-rw-r--r--tests/auto/qml/qqmlincubator/data/noIncubationController.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/data/objectDeleted.errors.txt1
-rw-r--r--tests/auto/qml/qqmlincubator/data/objectDeleted.qml8
-rw-r--r--tests/auto/qml/qqmlincubator/data/recursiveClear.1.qml9
-rw-r--r--tests/auto/qml/qqmlincubator/data/recursiveClear.2.qml8
-rw-r--r--tests/auto/qml/qqmlincubator/data/selfDelete.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/data/setInitialState.qml17
-rw-r--r--tests/auto/qml/qqmlincubator/data/statusChanged.nested.qml12
-rw-r--r--tests/auto/qml/qqmlincubator/data/statusChanged.qml5
-rw-r--r--tests/auto/qml/qqmlincubator/qqmlincubator.pro17
-rw-r--r--tests/auto/qml/qqmlincubator/testtypes.cpp137
-rw-r--r--tests/auto/qml/qqmlincubator/testtypes.h125
-rw-r--r--tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp1147
-rw-r--r--tests/auto/qml/qqmlinfo/data/NestedComponent.qml23
-rw-r--r--tests/auto/qml/qqmlinfo/data/NestedObject.qml8
-rw-r--r--tests/auto/qml/qqmlinfo/data/nestedQmlObject.qml8
-rw-r--r--tests/auto/qml/qqmlinfo/data/qmlObject.qml8
-rw-r--r--tests/auto/qml/qqmlinfo/qqmlinfo.pro13
-rw-r--r--tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp221
-rw-r--r--tests/auto/qml/qqmlinstantiator/data/createMultiple.qml9
-rw-r--r--tests/auto/qml/qqmlinstantiator/data/createNone.qml12
-rw-r--r--tests/auto/qml/qqmlinstantiator/data/createSingle.qml8
-rw-r--r--tests/auto/qml/qqmlinstantiator/data/inactive.qml9
-rw-r--r--tests/auto/qml/qqmlinstantiator/data/stringModel.qml9
-rw-r--r--tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro12
-rw-r--r--tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp198
-rw-r--r--tests/auto/qml/qqmlinstruction/qqmlinstruction.pro11
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp709
-rw-r--r--tests/auto/qml/qqmllanguage/data/Alias.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/Alias2.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/Alias3.qml12
-rw-r--r--tests/auto/qml/qqmllanguage/data/Alias4.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/AliasPropertyChangeSignalsType.qml20
-rw-r--r--tests/auto/qml/qqmllanguage/data/ComponentComposite.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/CompositeType.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/CompositeType2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/CompositeType3.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/CompositeType4.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/CompositeType5.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/CompositeType6.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/DontDoubleCallClassBeginItem.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/DynamicPropertiesNestedType.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/HelperAlias.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/I18n.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/I18nType30.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/LocalLast.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/LocalLast2.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml24
-rw-r--r--tests/auto/qml/qqmllanguage/data/MyComponent.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/MyCompositeValueSource.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/MyContainerComponent.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/NestedAlias.qml14
-rw-r--r--tests/auto/qml/qqmllanguage/data/NestedComponentRoot.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/NestedErrorsType.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/OnCompletedType.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/OnDestructionType.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/OtherSignalParam.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/OverrideSignalComponent.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/ReadOnlyType.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/SignalEmitter.qml25
-rw-r--r--tests/auto/qml/qqmllanguage/data/SignalParam.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.1.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.10.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.11.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.2.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.3.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.4.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.5.qml13
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.6.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.7.qml14
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.8.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/alias.9.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/aliasPropertiesAndSignals.qml14
-rw-r--r--tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.2.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.qml16
-rw-r--r--tests/auto/qml/qqmllanguage/data/allowedRevisionOverloads.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml39
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml26
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignLiteralSignalProperty.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignLiteralToJSValue.qml109
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignLiteralToVar.qml32
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignLiteralToVariant.qml17
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignObjectToSignal.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignObjectToVariant.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignQmlComponent.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignSignal.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignToNamespace.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignToNamespace.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignTypeExtremes.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignValueToSignal.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/assignValueToSignal.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/attachedProperties.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/autoComponentCreation.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/autoNotifyConnection.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/bindTypeToJSValue.qml60
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.1.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.2.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.3.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.4.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.5.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.6.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.7.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.8.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.8.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.9.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/component.9.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/componentCompositeType.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/cppnamespace.2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/cppnamespace.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/crash2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/customOnProperty.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/customParserTypes.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/customVariantTypes.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/declaredPropertyValues.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/defaultGrouped.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/defaultGrouped.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml29
-rw-r--r--tests/auto/qml/qqmllanguage/data/destroyedSignal.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/destroyedSignal.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/dontDoubleCallClassBegin.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/doubleSignal.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/doubleSignal.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/duplicateIDs.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/duplicateIDs.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.1.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.3.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.4.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicMeta.5.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicObject.1.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml11
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml13
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicProperties.qml13
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicPropertiesNested.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/dynamicSignalsAndSlots.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/empty.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/empty.qml0
-rw-r--r--tests/auto/qml/qqmllanguage/data/emptySignal.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/emptySignal.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/enumTypes.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/enumTypes.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/failingComponent.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/failingComponentTest.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/fakeDotProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/fakeDotProperty.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/finalOverride.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/finalOverride.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/globalEnums.qml55
-rw-r--r--tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyNames.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyUse.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/i18nNameSpace.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/i18nScript.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/i18nStrings.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/i18nType.qml1
-rw-r--r--tests/auto/qml/qqmllanguage/data/idProperty.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/importFile.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importFile.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/importIncorrectCase.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.1.errors.txt0
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.1.qml12
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.10.errors.txt0
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.10.qml16
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.2.errors.txt0
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.2.qml12
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.3.errors.txt0
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.3.qml16
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.4.errors.txt0
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.4.qml15
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.5.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.6.qml13
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.7.qml13
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.8.errors.txt0
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.8.qml15
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.9.errors.txt0
-rw-r--r--tests/auto/qml/qqmllanguage/data/importJs.9.qml19
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNamespaceConflict.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNamespaceConflict.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNewerVersion.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNewerVersion.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNonExist.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNonExist.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNonExistOlder.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importNonExistOlder.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/importscript.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/importscript.1.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/incorrectCase.errors.insensitive.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/incorrectCase.errors.sensitive.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/incorrectCase.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/incorrectCaseType.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/inlineAssignmentsOverrideBindings.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/inlineQmlComponents.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/interfaceProperty.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/interfaceQList.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.1.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.10.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.3.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.4.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.5.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.6.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.7.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.8.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAlias.9.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.2.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.3.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.4.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.5.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.6.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.7.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.8.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.8.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.9.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.9.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidImportID.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidImportID.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidOn.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidOn.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidProperty.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.2.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.3.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidRoot.4.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.1.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.3.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidTypeName.4.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.1.6.js5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.js5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/SecondAPI.js5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/qmldir3
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/FirstAPI.js5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/SecondAPI.js5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/qmldir2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/SomeAPI.js5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/qmldir1
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest2.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/LocalLast.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/PrivateType.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/qmldir4
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest2.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/qmldir2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test1.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test2.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/qmldir2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/qmldir2
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test1.js1
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test2.js1
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/testModule/Test.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib/testModule/qmldir1
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib2/testModule/Test.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib2/testModule/qmldir1
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/Test.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/qmldir1
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib3/testModule.1/Test.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib3/testModule.1/qmldir1
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib4/testModule.1/Test.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/lib4/testModule.1/qmldir1
-rw-r--r--tests/auto/qml/qqmllanguage/data/listAssignment.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/listAssignment.1.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/listAssignment.2.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/listAssignment.2.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/listAssignment.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/listAssignment.3.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/listItemDeleteSelf.qml38
-rw-r--r--tests/auto/qml/qqmllanguage/data/listProperties.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/literals.qml25
-rw-r--r--tests/auto/qml/qqmllanguage/data/localOrderTest.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/majorVersionIsolation.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/majorVersionIsolation.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.qml9
-rw-r--r--tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/method.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/method.1.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingObject.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingObject.qml1
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingSignal.2.qml11
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingSignal.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingSignal.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.1.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.10.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.10.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.11.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.11.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.2.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.3.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.4.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.5.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.6.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.7.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.8.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.8.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.9.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/multiSet.9.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/nestedComponentRoots.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/nestedErrors.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/nestedErrors.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/noCreation.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/noCreation.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonScriptableProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonScriptableProperty.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/notAvailable.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/notAvailable.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullDotProperty.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml37
-rw-r--r--tests/auto/qml/qqmllanguage/data/objectDeletionNotify.2.qml37
-rw-r--r--tests/auto/qml/qqmllanguage/data/objectDeletionNotify.3.qml37
-rw-r--r--tests/auto/qml/qqmllanguage/data/objectDeletionNotify.4.qml48
-rw-r--r--tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/onCompleted.qml17
-rw-r--r--tests/auto/qml/qqmllanguage/data/onDestruction.qml17
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.1.qml26
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.2.qml26
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.3.qml32
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.4.qml32
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.5.qml32
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/overrideSignal.6.qml23
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.1.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.3.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.4.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.6.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/property.7.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/propertyInit.1.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/propertyInit.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/propertyValueSource.2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/propertyValueSource.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/LocalInternal.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/Test.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestLocal.qml1
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestNamed.qml1
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestSubDir.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/UndeclaredLocal.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/WrongTestLocal.qml1
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/noqmldir/Test.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/pics/blue.pngbin0 -> 84 bytes
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/qmldir5
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/SubTest.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/qmldir1
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.1.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.2.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.3.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.4.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/readOnly.5.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/readonly.qml17
-rw-r--r--tests/auto/qml/qqmllanguage/data/receivers.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/registeredCompositeType.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/registrationOrder.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/remoteLoadCrash.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/data/revisions11.qml10
-rw-r--r--tests/auto/qml/qqmllanguage/data/revisionsbasesub11.qml16
-rw-r--r--tests/auto/qml/qqmllanguage/data/revisionssub11.qml12
-rw-r--r--tests/auto/qml/qqmllanguage/data/rootAsQmlComponent.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/scopedProperties.qml24
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString.1.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString2.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString3.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString4.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString5.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/scriptString6.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.1.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.2.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.3.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.4.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.5.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/signal.6.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/signalParameterTypes.1.qml44
-rw-r--r--tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml48
-rw-r--r--tests/auto/qml/qqmllanguage/data/signalWithDefaultArg.qml23
-rw-r--r--tests/auto/qml/qqmllanguage/data/simpleBindings.qml18
-rw-r--r--tests/auto/qml/qqmllanguage/data/simpleContainer.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/simpleObject.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/singularProperty.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/singularProperty.2.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/data/singularProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/singularProperty.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/subdir/Test.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/subdir/subsubdir/SubTest.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/test.js0
-rw-r--r--tests/auto/qml/qqmllanguage/data/test2.js0
-rw-r--r--tests/auto/qml/qqmllanguage/data/unregisteredObject.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/unregisteredObject.qml2
-rw-r--r--tests/auto/qml/qqmllanguage/data/unsupportedProperty.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/unsupportedProperty.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/valueTypes.qml13
-rw-r--r--tests/auto/qml/qqmllanguage/data/variantNotify.qml13
-rw-r--r--tests/auto/qml/qqmllanguage/data/versionedbase.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.1.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.10.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.10.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.11.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.11.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.12.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.12.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.13.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.13.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.14.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.14.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.15.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.15.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.16.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.17.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.17.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.2.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.3.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.4.qml4
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.5.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.5.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.6.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.6.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.7.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.7.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.8.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.8.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.9.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.9.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/qqmllanguage.pro18
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.cpp99
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.h1075
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp3178
-rw-r--r--tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro10
-rw-r--r--tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp1740
-rw-r--r--tests/auto/qml/qqmllistmodel/data/enumerate.qml24
-rw-r--r--tests/auto/qml/qqmllistmodel/data/multipleroles.qml25
-rw-r--r--tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml20
-rw-r--r--tests/auto/qml/qqmllistmodel/data/signalhandlers.qml8
-rw-r--r--tests/auto/qml/qqmllistmodel/qqmllistmodel.pro14
-rw-r--r--tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp1258
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/model.qml26
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/script.js13
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js8
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml33
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js9
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml33
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js8
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml32
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro12
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp859
-rw-r--r--tests/auto/qml/qqmllistreference/data/MyType.qml5
-rw-r--r--tests/auto/qml/qqmllistreference/data/engineTypes.qml9
-rw-r--r--tests/auto/qml/qqmllistreference/data/variantToList.qml10
-rw-r--r--tests/auto/qml/qqmllistreference/qqmllistreference.pro14
-rw-r--r--tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp636
-rw-r--r--tests/auto/qml/qqmllocale/data/date.qml45
-rw-r--r--tests/auto/qml/qqmllocale/data/functions.qml65
-rw-r--r--tests/auto/qml/qqmllocale/data/localeCompare.qml7
-rw-r--r--tests/auto/qml/qqmllocale/data/number.qml30
-rw-r--r--tests/auto/qml/qqmllocale/data/properties.qml27
-rw-r--r--tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml55
-rw-r--r--tests/auto/qml/qqmllocale/qqmllocale.pro14
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp1288
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/method.1.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/method.2.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/method.3.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.MyQmlObject.qml6
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.QtObject.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.alias.2.qml6
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.alias.3.qml7
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.alias.qml7
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.bool.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.color.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.date.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.double.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.int.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.list.MyQmlObject.qml6
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.list.QtObject.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.real.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.string.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.url.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.var.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/property.variant.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/signal.1.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/signal.2.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/signal.3.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/signal.4.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/signal.5.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/data/signal.6.qml5
-rw-r--r--tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro13
-rw-r--r--tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp401
-rw-r--r--tests/auto/qml/qqmlmetatype/data/CompositeType.qml5
-rw-r--r--tests/auto/qml/qqmlmetatype/data/ImplicitType.qml5
-rw-r--r--tests/auto/qml/qqmlmetatype/data/testImplicitComposite.qml3
-rw-r--r--tests/auto/qml/qqmlmetatype/qqmlmetatype.pro11
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp289
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/.gitignore2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/implicit1/implicitQmldir.errors.txt1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/implicit1/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/implicit1/temptest.qml14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/implicit2/Test.qml5
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/implicit2/implicitQmldir.2.errors.txt4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/implicit2/qmldir3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/implicit2/temptest2.qml10
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml21
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml5
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml5
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.errors.txt1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml5
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.0.qml6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.1.qml6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.2.0.qml6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/localModule/qmldir3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml5
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml6
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/works.qml3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/works2.qml3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/works21.qml3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml4
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/qmldir3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp69
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp69
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp69
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp89
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp71
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nonstrictModule/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp84
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2.1/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp84
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin.2/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp83
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/plugin/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/Foo.qml5
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp73
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginMixed/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp73
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginVersion/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/MyQmlFile.qml3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp58
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/qmldir3
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp83
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro14
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp69
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp72
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/preemptiveModule/qmldir1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro25
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp69
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir2
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro13
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp543
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro14
-rw-r--r--tests/auto/qml/qqmlnotifier/data/connectnotify.qml73
-rw-r--r--tests/auto/qml/qqmlnotifier/qqmlnotifier.pro11
-rw-r--r--tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp324
-rw-r--r--tests/auto/qml/qqmlparser/qqmlparser.pro12
-rw-r--r--tests/auto/qml/qqmlparser/tst_qqmlparser.cpp210
-rw-r--r--tests/auto/qml/qqmlproperty/data/NoContextTypeA.qml5
-rw-r--r--tests/auto/qml/qqmlproperty/data/NoContextTypeB.qml5
-rw-r--r--tests/auto/qml/qqmlproperty/data/SecondComponent.qml6
-rw-r--r--tests/auto/qml/qqmlproperty/data/TestType.qml6
-rw-r--r--tests/auto/qml/qqmlproperty/data/aliasPropertyBindings.qml19
-rw-r--r--tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml5
-rw-r--r--tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml5
-rw-r--r--tests/auto/qml/qqmlproperty/data/invalidBinding.qml16
-rw-r--r--tests/auto/qml/qqmlproperty/data/readSynthesizedObject.qml9
-rw-r--r--tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml32
-rw-r--r--tests/auto/qml/qqmlproperty/qqmlproperty.pro14
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp1878
-rw-r--r--tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro9
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp283
-rw-r--r--tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro12
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp317
-rw-r--r--tests/auto/qml/qqmlqt/data/TestComponent.2.qml592
-rw-r--r--tests/auto/qml/qqmlqt/data/TestComponent.3.qml89
-rw-r--r--tests/auto/qml/qqmlqt/data/TestComponent.qml534
-rw-r--r--tests/auto/qml/qqmlqt/data/atob.qml7
-rw-r--r--tests/auto/qml/qqmlqt/data/btoa.qml6
-rw-r--r--tests/auto/qml/qqmlqt/data/colorEqual.qml81
-rw-r--r--tests/auto/qml/qqmlqt/data/createComponent.2.qml27
-rw-r--r--tests/auto/qml/qqmlqt/data/createComponent.qml33
-rw-r--r--tests/auto/qml/qqmlqt/data/createComponentData.qml5
-rw-r--r--tests/auto/qml/qqmlqt/data/createComponent_lib.js11
-rw-r--r--tests/auto/qml/qqmlqt/data/createComponent_lib.qml12
-rw-r--r--tests/auto/qml/qqmlqt/data/createQmlObject.qml31
-rw-r--r--tests/auto/qml/qqmlqt/data/darker.qml12
-rw-r--r--tests/auto/qml/qqmlqt/data/dateTimeConversion.qml20
-rw-r--r--tests/auto/qml/qqmlqt/data/enums.qml9
-rw-r--r--tests/auto/qml/qqmlqt/data/font.qml8
-rw-r--r--tests/auto/qml/qqmlqt/data/fontFamilies.qml6
-rw-r--r--tests/auto/qml/qqmlqt/data/formatting.qml44
-rw-r--r--tests/auto/qml/qqmlqt/data/hsla.qml11
-rw-r--r--tests/auto/qml/qqmlqt/data/isQtObject.qml14
-rw-r--r--tests/auto/qml/qqmlqt/data/lighter.qml11
-rw-r--r--tests/auto/qml/qqmlqt/data/matrix4x4.qml9
-rw-r--r--tests/auto/qml/qqmlqt/data/md5.qml6
-rw-r--r--tests/auto/qml/qqmlqt/data/openUrlExternally.qml8
-rw-r--r--tests/auto/qml/qqmlqt/data/openUrlExternally_lib.js9
-rw-r--r--tests/auto/qml/qqmlqt/data/openUrlExternally_lib.qml9
-rw-r--r--tests/auto/qml/qqmlqt/data/point.qml9
-rw-r--r--tests/auto/qml/qqmlqt/data/quaternion.qml8
-rw-r--r--tests/auto/qml/qqmlqt/data/quit.qml5
-rw-r--r--tests/auto/qml/qqmlqt/data/rect.qml9
-rw-r--r--tests/auto/qml/qqmlqt/data/resolvedUrl.qml13
-rw-r--r--tests/auto/qml/qqmlqt/data/rgba.qml10
-rw-r--r--tests/auto/qml/qqmlqt/data/size.qml11
-rw-r--r--tests/auto/qml/qqmlqt/data/tint.qml9
-rw-r--r--tests/auto/qml/qqmlqt/data/vector.qml8
-rw-r--r--tests/auto/qml/qqmlqt/data/vector2.qml8
-rw-r--r--tests/auto/qml/qqmlqt/data/vector4.qml8
-rw-r--r--tests/auto/qml/qqmlqt/qqmlqt.pro12
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp929
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/README3
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/changeversion.js55
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/creation-a.js20
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/creation.js15
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/error-a.js22
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/error-b.js15
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/error-creation.js16
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/error-notransaction.js17
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/error-outsidetransaction.js19
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/iteration-forwardonly.js31
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/iteration.js30
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/readonly-error.js29
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/readonly.js26
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/reopen1.js16
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/reopen2.js18
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/selection-bindnames.js28
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/selection.js46
-rw-r--r--tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro12
-rw-r--r--tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp259
-rw-r--r--tests/auto/qml/qqmltimer/qqmltimer.pro9
-rw-r--r--tests/auto/qml/qqmltimer/tst_qqmltimer.cpp409
-rw-r--r--tests/auto/qml/qqmltranslation/data/idtranslation.qml8
-rw-r--r--tests/auto/qml/qqmltranslation/data/qml_fr.qmbin0 -> 374 bytes
-rw-r--r--tests/auto/qml/qqmltranslation/data/qml_fr.ts43
-rw-r--r--tests/auto/qml/qqmltranslation/data/qmlid_fr.qmbin0 -> 119 bytes
-rw-r--r--tests/auto/qml/qqmltranslation/data/qmlid_fr.ts13
-rw-r--r--tests/auto/qml/qqmltranslation/data/translation.qml21
-rw-r--r--tests/auto/qml/qqmltranslation/data/translation.qrc6
-rw-r--r--tests/auto/qml/qqmltranslation/qqmltranslation.pro15
-rw-r--r--tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp137
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/comparisonSemantics.qml95
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/cppIntegration.qml98
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/invokableFunctions.qml52
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/jsObjectConversion.qml48
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/qtqmlValueTypes.qml48
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml119
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml88
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro17
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/testtypes.cpp46
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/testtypes.h195
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp305
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType4.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType5.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.2.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.3.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.2.qml12
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml12
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingConflict.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingRead.qml5
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingVariantCopy.qml13
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.1.qml29
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.2.qml31
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.3.qml36
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.4.qml27
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.5.qml27
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/color_compare.qml37
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/color_read.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/color_write.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml42
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml42
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml42
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/deletedObject.js13
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/deletedObject.qml11
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/enums.1.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/enums.2.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/enums.3.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/enums.4.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/enums.5.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_compare.qml31
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_read.qml18
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_write.2.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_write.3.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_write.4.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_write.5.qml14
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_write.qml16
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_component.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_ignore.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_value.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/initializeByWrite.qml27
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/matrix4x4_compare.qml35
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/matrix4x4_invokables.qml31
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/matrix4x4_read.qml22
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/matrix4x4_write.qml21
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/nonValueTypeComparison.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/point_compare.qml22
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/point_read.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/point_write.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/pointf_compare.qml22
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/pointf_read.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/pointf_write.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/quaternion_compare.qml23
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/quaternion_read.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/quaternion_write.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/rect_compare.qml25
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/rect_read.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/rect_write.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/rectf_compare.qml25
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/rectf_read.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/rectf_write.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/returnValues.qml17
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/scriptAccess.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/scriptVariantCopy.qml14
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/size_compare.qml23
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/size_read.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/size_write.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizef_compare.qml24
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizef_read.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizef_write.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizereadonly_read.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror.qml6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror2.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror3.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror4.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/staticAssignment.qml5
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/valueInterceptors.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/valueSources.qml5
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/varAssignment.qml14
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/variant_read.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml25
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/variant_write.2.qml40
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector2d_compare.qml21
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector2d_invokables.qml23
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector2d_read.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector2d_write.qml7
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector3d_compare.qml23
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector3d_invokables.qml25
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector3d_read.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector3d_write.qml8
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector4d_compare.qml23
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector4d_invokables.qml25
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector4d_read.qml10
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/vector4d_write.qml9
-rw-r--r--tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro17
-rw-r--r--tests/auto/qml/qqmlvaluetypes/testtypes.cpp52
-rw-r--r--tests/auto/qml/qqmlvaluetypes/testtypes.h279
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp1456
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/.gitattributes3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/TestComponent.qml23
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/TestComponent2.qml7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/TestComponent3.qml6
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/abort.expect10
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/abort.qml44
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/abort.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml60
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml55
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/attr.qml78
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/attr.xml1
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/callbackException.qml25
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/cdata.qml133
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/cdata.xml2
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/constructor.qml14
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/defaultState.qml30
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/document.qml56
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/document.xml3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/domExceptionCodes.qml60
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/element.qml145
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/element.xml1
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml66
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_args.qml23
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_sent.qml20
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_unsent.qml16
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.expect7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml76
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.reply8
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_args.qml23
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_sent.qml20
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_unsent.qml16
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/instanceStateValues.qml33
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml148
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open.qml54
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.1.qml18
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.2.qml18
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_invalid_method.qml16
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_network.expect7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_network.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_network.wait0
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_sync.qml17
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_user.qml54
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/open_username.qml54
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml23
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml23
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml22
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/redirecttarget.html1
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/responseText.qml54
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/responseXML_invalid.qml24
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/seconddocument.html1
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml28
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.expect10
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.qml22
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.2.qml24
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.3.qml24
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.expect10
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.qml24
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.5.qml24
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.expect10
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.qml22
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.7.qml24
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_data.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.qml27
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_DELETE.expect7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_GET.expect7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_HEAD.expect7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/send_unsent.qml16
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.expect9
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.qml29
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_args.qml18
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_caseInsensitive.qml30
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_illegalName.qml58
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_sent.qml32
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_unsent.qml17
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/stateChangeCallingContext.qml63
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/staticStateValues.qml24
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/status.200.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/status.400.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/status.404.reply3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/status.expect7
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/status.qml75
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml75
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/testdocument.html1
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/testlist3
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/text.qml129
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/text.xml1
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/utf16.html1
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/utf16.qml29
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/data/utf16.xmlbin0 -> 154 bytes
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro18
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp1183
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/basic.qml5
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/dummy.qml1
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/resetFiltering.qml5
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/innerdir/test2.txt1
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/test.txt1
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro13
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp232
-rw-r--r--tests/auto/qml/qquickworkerscript/data/BaseWorker.qml24
-rw-r--r--tests/auto/qml/qquickworkerscript/data/Global.js1
-rw-r--r--tests/auto/qml/qquickworkerscript/data/externalObjectWorker.qml14
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script.js4
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script_error_onCall.js6
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js5
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script_fixed_return.js4
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script_include.js5
-rw-r--r--tests/auto/qml/qquickworkerscript/data/script_pragma.js6
-rw-r--r--tests/auto/qml/qquickworkerscript/data/stressDispose.js6
-rw-r--r--tests/auto/qml/qquickworkerscript/data/stressDispose.qml13
-rw-r--r--tests/auto/qml/qquickworkerscript/data/worker.qml5
-rw-r--r--tests/auto/qml/qquickworkerscript/data/worker_error_onCall.qml6
-rw-r--r--tests/auto/qml/qquickworkerscript/data/worker_error_onLoad.qml7
-rw-r--r--tests/auto/qml/qquickworkerscript/data/worker_include.qml5
-rw-r--r--tests/auto/qml/qquickworkerscript/data/worker_pragma.qml6
-rw-r--r--tests/auto/qml/qquickworkerscript/qquickworkerscript.pro14
-rw-r--r--tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp300
-rw-r--r--tests/auto/qml/qrcqml/data/SameDir.qml5
-rw-r--r--tests/auto/qml/qrcqml/data/SameDir2.qml5
-rw-r--r--tests/auto/qml/qrcqml/data/SameDir3.qml5
-rw-r--r--tests/auto/qml/qrcqml/data/SubDir.qml3
-rw-r--r--tests/auto/qml/qrcqml/data/imports/QrcImport/Imported.qml5
-rw-r--r--tests/auto/qml/qrcqml/data/imports/QrcImport/qmldir1
-rw-r--r--tests/auto/qml/qrcqml/data/importtest.qml5
-rw-r--r--tests/auto/qml/qrcqml/data/main.qml6
-rw-r--r--tests/auto/qml/qrcqml/data/main2.qml6
-rw-r--r--tests/auto/qml/qrcqml/data/main3.qml6
-rw-r--r--tests/auto/qml/qrcqml/qrcqml.pro10
-rw-r--r--tests/auto/qml/qrcqml/qrcqml.qrc21
-rw-r--r--tests/auto/qml/qrcqml/tst_qrcqml.cpp137
-rw-r--r--tests/auto/qml/qtqmlmodules/data/base.qml14
-rw-r--r--tests/auto/qml/qtqmlmodules/data/models.qml15
-rw-r--r--tests/auto/qml/qtqmlmodules/data/unavailable.qml35
-rw-r--r--tests/auto/qml/qtqmlmodules/qtqmlmodules.pro12
-rw-r--r--tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp95
-rw-r--r--tests/auto/qml/runall.sh100
-rw-r--r--tests/auto/qml/v4/data/colorType.qml18
-rw-r--r--tests/auto/qml/v4/data/conditionalExpr.qml8
-rw-r--r--tests/auto/qml/v4/data/conversions.1.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.2.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.3.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.4.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.5.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.6.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.7.qml13
-rw-r--r--tests/auto/qml/v4/data/conversions.8.qml13
-rw-r--r--tests/auto/qml/v4/data/doubleBoolJump.qml18
-rw-r--r--tests/auto/qml/v4/data/equals.qml51
-rw-r--r--tests/auto/qml/v4/data/fetchException.qml6
-rw-r--r--tests/auto/qml/v4/data/integerOperations.qml59
-rw-r--r--tests/auto/qml/v4/data/jsvalueHandling.qml69
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.2.qml6
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.3.qml8
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.4.qml8
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.5.qml7
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.6.qml9
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.7.qml9
-rw-r--r--tests/auto/qml/v4/data/logicalAnd.qml6
-rw-r--r--tests/auto/qml/v4/data/logicalOr.2.qml6
-rw-r--r--tests/auto/qml/v4/data/logicalOr.qml6
-rw-r--r--tests/auto/qml/v4/data/mathAbs.qml42
-rw-r--r--tests/auto/qml/v4/data/mathCeil.qml41
-rw-r--r--tests/auto/qml/v4/data/mathCos.qml41
-rw-r--r--tests/auto/qml/v4/data/mathFloor.qml37
-rw-r--r--tests/auto/qml/v4/data/mathMax.qml45
-rw-r--r--tests/auto/qml/v4/data/mathMin.qml45
-rw-r--r--tests/auto/qml/v4/data/mathSin.qml41
-rw-r--r--tests/auto/qml/v4/data/nestedLogicalAnd.qml14
-rw-r--r--tests/auto/qml/v4/data/nestedLogicalOr.qml14
-rw-r--r--tests/auto/qml/v4/data/nestedObjectAccess.qml5
-rw-r--r--tests/auto/qml/v4/data/nestedObjectAccess2.qml5
-rw-r--r--tests/auto/qml/v4/data/nullQObject.qml7
-rw-r--r--tests/auto/qml/v4/data/objectToBool.qml16
-rw-r--r--tests/auto/qml/v4/data/qrealToIntRounding.qml10
-rw-r--r--tests/auto/qml/v4/data/qtbug_21883.qml5
-rw-r--r--tests/auto/qml/v4/data/qtbug_22816.qml18
-rw-r--r--tests/auto/qml/v4/data/singletonType.qml12
-rw-r--r--tests/auto/qml/v4/data/strictEquals.qml53
-rw-r--r--tests/auto/qml/v4/data/stringComparison.qml41
-rw-r--r--tests/auto/qml/v4/data/subscriptions.1.qml16
-rw-r--r--tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml11
-rw-r--r--tests/auto/qml/v4/data/unaryMinus.qml24
-rw-r--r--tests/auto/qml/v4/data/unaryPlus.qml24
-rw-r--r--tests/auto/qml/v4/data/unnecessaryReeval.qml7
-rw-r--r--tests/auto/qml/v4/data/varHandling.qml67
-rw-r--r--tests/auto/qml/v4/data/variantHandling.qml67
-rw-r--r--tests/auto/qml/v4/testtypes.cpp51
-rw-r--r--tests/auto/qml/v4/testtypes.h216
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp1125
-rw-r--r--tests/auto/qml/v4/v4.pro16
-rw-r--r--tests/auto/qmldevtools/compile/compile.pro12
-rw-r--r--tests/auto/qmldevtools/compile/tst_compile.cpp53
-rw-r--r--tests/auto/qmldevtools/qmldevtools.pro6
-rw-r--r--tests/auto/qmltest/animatedimage/stickman.gifbin0 -> 164923 bytes
-rw-r--r--tests/auto/qmltest/animatedimage/tst_animatedimage.qml220
-rw-r--r--tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml73
-rw-r--r--tests/auto/qmltest/borderimage/InvalidSciFile.qml48
-rw-r--r--tests/auto/qmltest/borderimage/colors-round.sci7
-rw-r--r--tests/auto/qmltest/borderimage/colors.pngbin0 -> 1655 bytes
-rw-r--r--tests/auto/qmltest/borderimage/invalid.sci7
-rw-r--r--tests/auto/qmltest/borderimage/remote.sci7
-rw-r--r--tests/auto/qmltest/borderimage/tst_borderimage.qml285
-rw-r--r--tests/auto/qmltest/buttonclick/Button.qml74
-rw-r--r--tests/auto/qmltest/buttonclick/tst_buttonclick.qml78
-rw-r--r--tests/auto/qmltest/createbenchmark/item.qml75
-rw-r--r--tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml55
-rw-r--r--tests/auto/qmltest/events/tst_drag.qml180
-rw-r--r--tests/auto/qmltest/events/tst_events.qml87
-rw-r--r--tests/auto/qmltest/events/tst_wheel.qml88
-rw-r--r--tests/auto/qmltest/fontloader/dummy.ttf0
-rw-r--r--tests/auto/qmltest/fontloader/tarzeau_ocr_a.ttfbin0 -> 24544 bytes
-rw-r--r--tests/auto/qmltest/fontloader/tst_fontloader.qml97
-rw-r--r--tests/auto/qmltest/gradient/tst_gradient.qml119
-rw-r--r--tests/auto/qmltest/image/logo.pngbin0 -> 1478 bytes
-rw-r--r--tests/auto/qmltest/image/tst_image.qml216
-rw-r--r--tests/auto/qmltest/listmodel/tst_listmodel.qml132
-rw-r--r--tests/auto/qmltest/listview/tst_listview.qml175
-rw-r--r--tests/auto/qmltest/pixel/tst_pixel.qml78
-rw-r--r--tests/auto/qmltest/qmltest.pro13
-rw-r--r--tests/auto/qmltest/qqmlbinding/tst_binding.qml75
-rw-r--r--tests/auto/qmltest/qqmlbinding/tst_binding2.qml70
-rw-r--r--tests/auto/qmltest/rectangle/tst_rectangle.qml137
-rw-r--r--tests/auto/qmltest/selftests/tst_compare.qml1391
-rw-r--r--tests/auto/qmltest/selftests/tst_compare_quickobjects.qml81
-rw-r--r--tests/auto/qmltest/selftests/tst_datadriven.qml78
-rw-r--r--tests/auto/qmltest/selftests/tst_selftests.qml289
-rw-r--r--tests/auto/qmltest/text/tst_text.qml121
-rw-r--r--tests/auto/qmltest/textedit/tst_textedit.qml189
-rw-r--r--tests/auto/qmltest/textinput/tst_textinput.qml286
-rw-r--r--tests/auto/qmltest/tst_qmltest.cpp43
-rw-r--r--tests/auto/quick/dialogs/data/RectWithFileDialog.qml33
-rw-r--r--tests/auto/quick/dialogs/dialogs.pro19
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp157
-rw-r--r--tests/auto/quick/examples/data/dummytest.qml6
-rw-r--r--tests/auto/quick/examples/data/webbrowser/webbrowser.qml6
-rw-r--r--tests/auto/quick/examples/examples.pro12
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp331
-rw-r--r--tests/auto/quick/geometry/geometry.pro10
-rw-r--r--tests/auto/quick/geometry/tst_geometry.cpp181
-rw-r--r--tests/auto/quick/nodes/nodes.pro10
-rw-r--r--tests/auto/quick/nodes/tst_nodestest.cpp354
-rw-r--r--tests/auto/quick/qquickaccessible/data/checkbuttons.qml47
-rw-r--r--tests/auto/quick/qquickaccessible/data/hittest.qml176
-rw-r--r--tests/auto/quick/qquickaccessible/data/pushbutton.qml15
-rw-r--r--tests/auto/quick/qquickaccessible/data/statictext.qml29
-rw-r--r--tests/auto/quick/qquickaccessible/data/widgets/TextRect.qml26
-rw-r--r--tests/auto/quick/qquickaccessible/qquickaccessible.pro26
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp418
-rw-r--r--tests/auto/quick/qquickanchors/data/anchors.qml162
-rw-r--r--tests/auto/quick/qquickanchors/data/baselineOffset.qml15
-rw-r--r--tests/auto/quick/qquickanchors/data/centerin.qml25
-rw-r--r--tests/auto/quick/qquickanchors/data/centerinRotation.qml18
-rw-r--r--tests/auto/quick/qquickanchors/data/crash1.qml11
-rw-r--r--tests/auto/quick/qquickanchors/data/fill.qml14
-rw-r--r--tests/auto/quick/qquickanchors/data/hvCenter.qml11
-rw-r--r--tests/auto/quick/qquickanchors/data/individualMargins.qml16
-rw-r--r--tests/auto/quick/qquickanchors/data/loop1.qml8
-rw-r--r--tests/auto/quick/qquickanchors/data/loop2.qml20
-rw-r--r--tests/auto/quick/qquickanchors/data/margins.qml13
-rw-r--r--tests/auto/quick/qquickanchors/data/stretch.qml39
-rw-r--r--tests/auto/quick/qquickanchors/qquickanchors.pro15
-rw-r--r--tests/auto/quick/qquickanchors/tst_qquickanchors.cpp820
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/colors.gifbin0 -> 505 bytes
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/colors.qml5
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/green.pngbin0 -> 314 bytes
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/hearts.gifbin0 -> 6524 bytes
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/hearts.qml6
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/hearts_copy.gifbin0 -> 6524 bytes
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/qmldir1
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/qtbug-16520.qml17
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/stickman.gifbin0 -> 164923 bytes
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/stickman.qml5
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/stickmanerror1.qml6
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/stickmanpause.qml7
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/stickmanscaled.qml7
-rw-r--r--tests/auto/quick/qquickanimatedimage/data/stickmanstopped.qml6
-rw-r--r--tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro14
-rw-r--r--tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp535
-rw-r--r--tests/auto/quick/qquickanimatedsprite/data/basic.qml58
-rw-r--r--tests/auto/quick/qquickanimatedsprite/data/frameChange.qml59
-rw-r--r--tests/auto/quick/qquickanimatedsprite/data/squarefacesprite.pngbin0 -> 496 bytes
-rw-r--r--tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro14
-rw-r--r--tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp117
-rwxr-xr-xtests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml38
-rwxr-xr-xtests/auto/quick/qquickanimationcontroller/data/tst_completion.qml45
-rw-r--r--tests/auto/quick/qquickanimationcontroller/data/tst_numberanimation.qml38
-rw-r--r--tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml63
-rw-r--r--tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml65
-rw-r--r--tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro10
-rw-r--r--tests/auto/quick/qquickanimationcontroller/tst_qquickanimationcontroller.cpp42
-rw-r--r--tests/auto/quick/qquickanimations/data/Double.qml14
-rw-r--r--tests/auto/quick/qquickanimations/data/attached.qml34
-rw-r--r--tests/auto/quick/qquickanimations/data/badproperty1.qml21
-rw-r--r--tests/auto/quick/qquickanimations/data/badproperty2.qml21
-rw-r--r--tests/auto/quick/qquickanimations/data/badtype1.qml12
-rw-r--r--tests/auto/quick/qquickanimations/data/badtype2.qml12
-rw-r--r--tests/auto/quick/qquickanimations/data/badtype3.qml12
-rw-r--r--tests/auto/quick/qquickanimations/data/badtype4.qml27
-rw-r--r--tests/auto/quick/qquickanimations/data/disabledTransition.qml30
-rw-r--r--tests/auto/quick/qquickanimations/data/dontAutoStart.qml18
-rw-r--r--tests/auto/quick/qquickanimations/data/dontStart.qml19
-rw-r--r--tests/auto/quick/qquickanimations/data/dontStart2.qml19
-rw-r--r--tests/auto/quick/qquickanimations/data/dotproperty.qml24
-rw-r--r--tests/auto/quick/qquickanimations/data/doubleRegistrationBug.qml8
-rw-r--r--tests/auto/quick/qquickanimations/data/looping.qml16
-rw-r--r--tests/auto/quick/qquickanimations/data/mixedtype1.qml25
-rw-r--r--tests/auto/quick/qquickanimations/data/mixedtype2.qml25
-rw-r--r--tests/auto/quick/qquickanimations/data/nonTransitionBug.qml30
-rw-r--r--tests/auto/quick/qquickanimations/data/pathAnimation.qml27
-rw-r--r--tests/auto/quick/qquickanimations/data/pathAnimation2.qml26
-rw-r--r--tests/auto/quick/qquickanimations/data/pathAnimationInOutBackCrash.qml26
-rw-r--r--tests/auto/quick/qquickanimations/data/pathAnimationNoStart.qml27
-rw-r--r--tests/auto/quick/qquickanimations/data/pathInterpolator.qml13
-rw-r--r--tests/auto/quick/qquickanimations/data/pathInterpolatorBack.qml11
-rw-r--r--tests/auto/quick/qquickanimations/data/pathInterpolatorBack2.qml10
-rw-r--r--tests/auto/quick/qquickanimations/data/pathTransition.qml41
-rw-r--r--tests/auto/quick/qquickanimations/data/pauseBindingBug.qml17
-rw-r--r--tests/auto/quick/qquickanimations/data/pauseBug.qml7
-rw-r--r--tests/auto/quick/qquickanimations/data/properties.qml14
-rw-r--r--tests/auto/quick/qquickanimations/data/properties2.qml14
-rw-r--r--tests/auto/quick/qquickanimations/data/properties3.qml14
-rw-r--r--tests/auto/quick/qquickanimations/data/properties4.qml14
-rw-r--r--tests/auto/quick/qquickanimations/data/properties5.qml14
-rw-r--r--tests/auto/quick/qquickanimations/data/propertiesTransition.qml29
-rw-r--r--tests/auto/quick/qquickanimations/data/propertiesTransition2.qml29
-rw-r--r--tests/auto/quick/qquickanimations/data/propertiesTransition3.qml29
-rw-r--r--tests/auto/quick/qquickanimations/data/propertiesTransition4.qml29
-rw-r--r--tests/auto/quick/qquickanimations/data/propertiesTransition5.qml29
-rw-r--r--tests/auto/quick/qquickanimations/data/propertiesTransition6.qml29
-rw-r--r--tests/auto/quick/qquickanimations/data/propertiesTransition7.qml29
-rw-r--r--tests/auto/quick/qquickanimations/data/reanchor.qml46
-rw-r--r--tests/auto/quick/qquickanimations/data/registrationBug.qml18
-rw-r--r--tests/auto/quick/qquickanimations/data/reparent.qml56
-rw-r--r--tests/auto/quick/qquickanimations/data/rotation.qml48
-rw-r--r--tests/auto/quick/qquickanimations/data/runningTrueBug.qml30
-rw-r--r--tests/auto/quick/qquickanimations/data/scriptActionBug.qml17
-rw-r--r--tests/auto/quick/qquickanimations/data/signals.qml30
-rw-r--r--tests/auto/quick/qquickanimations/data/transitionAssignmentBug.qml12
-rw-r--r--tests/auto/quick/qquickanimations/data/valuesource.qml14
-rw-r--r--tests/auto/quick/qquickanimations/data/valuesource2.qml14
-rw-r--r--tests/auto/quick/qquickanimations/qquickanimations.pro15
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp1455
-rw-r--r--tests/auto/quick/qquickapplication/qquickapplication.pro9
-rw-r--r--tests/auto/quick/qquickapplication/tst_qquickapplication.cpp146
-rw-r--r--tests/auto/quick/qquickbehaviors/data/binding.qml26
-rw-r--r--tests/auto/quick/qquickbehaviors/data/color.qml24
-rw-r--r--tests/auto/quick/qquickbehaviors/data/cpptrigger.qml11
-rw-r--r--tests/auto/quick/qquickbehaviors/data/delayedRegistration.qml25
-rw-r--r--tests/auto/quick/qquickbehaviors/data/disabled.qml27
-rw-r--r--tests/auto/quick/qquickbehaviors/data/dontStart.qml18
-rw-r--r--tests/auto/quick/qquickbehaviors/data/empty.qml23
-rw-r--r--tests/auto/quick/qquickbehaviors/data/explicit.qml26
-rw-r--r--tests/auto/quick/qquickbehaviors/data/groupProperty.qml23
-rw-r--r--tests/auto/quick/qquickbehaviors/data/groupProperty2.qml23
-rw-r--r--tests/auto/quick/qquickbehaviors/data/groupedPropertyCrash.qml10
-rw-r--r--tests/auto/quick/qquickbehaviors/data/loop.qml19
-rw-r--r--tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml19
-rw-r--r--tests/auto/quick/qquickbehaviors/data/nonSelecting2.qml26
-rw-r--r--tests/auto/quick/qquickbehaviors/data/parent.qml28
-rw-r--r--tests/auto/quick/qquickbehaviors/data/qtbug12295.qml17
-rw-r--r--tests/auto/quick/qquickbehaviors/data/reassignedAnimation.qml32
-rw-r--r--tests/auto/quick/qquickbehaviors/data/runningTrue.qml20
-rw-r--r--tests/auto/quick/qquickbehaviors/data/scripttrigger.qml16
-rw-r--r--tests/auto/quick/qquickbehaviors/data/simple.qml26
-rw-r--r--tests/auto/quick/qquickbehaviors/data/startOnCompleted.qml15
-rw-r--r--tests/auto/quick/qquickbehaviors/data/startup.qml17
-rw-r--r--tests/auto/quick/qquickbehaviors/data/startup2.qml16
-rw-r--r--tests/auto/quick/qquickbehaviors/data/valueType.qml13
-rw-r--r--tests/auto/quick/qquickbehaviors/qquickbehaviors.pro14
-rw-r--r--tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp500
-rw-r--r--tests/auto/quick/qquickborderimage/data/colors-mirror.pngbin0 -> 5554 bytes
-rw-r--r--tests/auto/quick/qquickborderimage/data/colors-round-quotes.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/data/colors-round-remote.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/data/colors-round.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/data/colors.pngbin0 -> 1655 bytes
-rw-r--r--tests/auto/quick/qquickborderimage/data/heart200.pngbin0 -> 7943 bytes
-rw-r--r--tests/auto/quick/qquickborderimage/data/heart200_copy.pngbin0 -> 7943 bytes
-rw-r--r--tests/auto/quick/qquickborderimage/data/invalid.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/data/mirror.qml7
-rw-r--r--tests/auto/quick/qquickborderimage/data/valid1.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/data/valid2.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/data/valid3.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/data/valid4.sci7
-rw-r--r--tests/auto/quick/qquickborderimage/qquickborderimage.pro14
-rw-r--r--tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp589
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml31
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml45
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/anim-gr.gifbin0 -> 241 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/anim-gr.pngbin0 -> 460 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/anim-poster-gr.pngbin0 -> 422 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/background.pngbin0 -> 86 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/broken.pngbin0 -> 87 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/ggrr-256x256.pngbin0 -> 120 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/green-16x16.pngbin0 -> 92 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/green-1x1.pngbin0 -> 82 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/green-256x256.pngbin0 -> 103 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/green-2x2.pngbin0 -> 118 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/green.pngbin0 -> 87 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/grgr-256x256.pngbin0 -> 130 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/red-16x16.pngbin0 -> 130 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/red.pngbin0 -> 87 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/redtransparent.pngbin0 -> 109 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/rgrg-256x256.pngbin0 -> 131 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/rrgg-256x256.pngbin0 -> 120 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/transparent.pngbin0 -> 100 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/transparent50.pngbin0 -> 155 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_arc.qml525
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml417
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml234
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_composite.qml388
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_context.qml73
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml117
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml21
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml986
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_image.qml707
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_line.qml838
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_path.qml1468
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml43
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml45
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml77
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_state.qml408
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml49
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_svgpath.qml58
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_text.qml44
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_transform.qml492
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/yellow.pngbin0 -> 95 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/yellow75.pngbin0 -> 150 bytes
-rw-r--r--tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro32
-rw-r--r--tests/auto/quick/qquickcanvasitem/tst_qquickcanvasitem.cpp42
-rw-r--r--tests/auto/quick/qquickdrag/qquickdrag.pro10
-rw-r--r--tests/auto/quick/qquickdrag/tst_qquickdrag.cpp1233
-rw-r--r--tests/auto/quick/qquickdroparea/qquickdroparea.pro10
-rw-r--r--tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp1122
-rw-r--r--tests/auto/quick/qquickdynamicpropertyanimation/data/MyItem.qml13
-rw-r--r--tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro14
-rw-r--r--tests/auto/quick/qquickdynamicpropertyanimation/tst_qquickdynamicpropertyanimation.cpp138
-rw-r--r--tests/auto/quick/qquickflickable/data/cancel.qml15
-rw-r--r--tests/auto/quick/qquickflickable/data/disabled.qml30
-rw-r--r--tests/auto/quick/qquickflickable/data/flickable01.qml4
-rw-r--r--tests/auto/quick/qquickflickable/data/flickable02.qml14
-rw-r--r--tests/auto/quick/qquickflickable/data/flickable03.qml28
-rw-r--r--tests/auto/quick/qquickflickable/data/flickable04.qml22
-rw-r--r--tests/auto/quick/qquickflickable/data/flickableqgraphicswidget.qml7
-rw-r--r--tests/auto/quick/qquickflickable/data/longList.qml22
-rw-r--r--tests/auto/quick/qquickflickable/data/margins.qml19
-rw-r--r--tests/auto/quick/qquickflickable/data/nestedPressDelay.qml39
-rw-r--r--tests/auto/quick/qquickflickable/data/nestedStopAtBounds.qml37
-rw-r--r--tests/auto/quick/qquickflickable/data/pressDelay.qml32
-rw-r--r--tests/auto/quick/qquickflickable/data/rebound.qml41
-rw-r--r--tests/auto/quick/qquickflickable/data/resize.qml37
-rw-r--r--tests/auto/quick/qquickflickable/data/transformedFlickable.qml43
-rw-r--r--tests/auto/quick/qquickflickable/data/wheel.qml25
-rw-r--r--tests/auto/quick/qquickflickable/qquickflickable.pro14
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp1366
-rw-r--r--tests/auto/quick/qquickflipable/data/crash.qml9
-rw-r--r--tests/auto/quick/qquickflipable/data/flip-flipable.qml28
-rw-r--r--tests/auto/quick/qquickflipable/data/flipable-abort.qml10
-rw-r--r--tests/auto/quick/qquickflipable/data/test-flipable.qml9
-rw-r--r--tests/auto/quick/qquickflipable/qquickflipable.pro14
-rw-r--r--tests/auto/quick/qquickflipable/tst_qquickflipable.cpp149
-rw-r--r--tests/auto/quick/qquickfocusscope/data/canvasFocus.qml22
-rw-r--r--tests/auto/quick/qquickfocusscope/data/chain.qml28
-rw-r--r--tests/auto/quick/qquickfocusscope/data/forceActiveFocus.qml26
-rw-r--r--tests/auto/quick/qquickfocusscope/data/forcefocus.qml81
-rw-r--r--tests/auto/quick/qquickfocusscope/data/qtBug13380.qml24
-rw-r--r--tests/auto/quick/qquickfocusscope/data/signalEmission.qml33
-rw-r--r--tests/auto/quick/qquickfocusscope/data/test.qml77
-rw-r--r--tests/auto/quick/qquickfocusscope/data/test2.qml39
-rw-r--r--tests/auto/quick/qquickfocusscope/data/test3.qml52
-rw-r--r--tests/auto/quick/qquickfocusscope/data/test4.qml76
-rw-r--r--tests/auto/quick/qquickfocusscope/data/test5.qml84
-rw-r--r--tests/auto/quick/qquickfocusscope/qquickfocusscope.pro13
-rw-r--r--tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp635
-rw-r--r--tests/auto/quick/qquickfontloader/data/daniel.ttfbin0 -> 51984 bytes
-rw-r--r--tests/auto/quick/qquickfontloader/data/dummy.ttf0
-rw-r--r--tests/auto/quick/qquickfontloader/data/qtbug-20268.qml27
-rw-r--r--tests/auto/quick/qquickfontloader/data/tarzeau_ocr_a.ttfbin0 -> 24544 bytes
-rw-r--r--tests/auto/quick/qquickfontloader/qquickfontloader.pro14
-rw-r--r--tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp256
-rw-r--r--tests/auto/quick/qquickgridview/data/ComponentView.qml14
-rw-r--r--tests/auto/quick/qquickgridview/data/addTransitions.qml130
-rw-r--r--tests/auto/quick/qquickgridview/data/asyncloader.qml36
-rw-r--r--tests/auto/quick/qquickgridview/data/attachedSignals.qml27
-rw-r--r--tests/auto/quick/qquickgridview/data/creationContext.qml5
-rw-r--r--tests/auto/quick/qquickgridview/data/displacedTransitions.qml175
-rw-r--r--tests/auto/quick/qquickgridview/data/displaygrid.qml39
-rw-r--r--tests/auto/quick/qquickgridview/data/footer.qml48
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml58
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml67
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview-noCurrent.qml53
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview1.qml72
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview2.qml26
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview3.qml6
-rw-r--r--tests/auto/quick/qquickgridview/data/gridview4.qml11
-rw-r--r--tests/auto/quick/qquickgridview/data/header.qml40
-rw-r--r--tests/auto/quick/qquickgridview/data/headerfooter.qml32
-rw-r--r--tests/auto/quick/qquickgridview/data/initialZValues.qml35
-rw-r--r--tests/auto/quick/qquickgridview/data/layouts.qml67
-rw-r--r--tests/auto/quick/qquickgridview/data/manual-highlight.qml48
-rw-r--r--tests/auto/quick/qquickgridview/data/margins.qml56
-rw-r--r--tests/auto/quick/qquickgridview/data/mirroring.qml43
-rw-r--r--tests/auto/quick/qquickgridview/data/moveTransitions.qml144
-rw-r--r--tests/auto/quick/qquickgridview/data/multipleDisplaced.qml82
-rw-r--r--tests/auto/quick/qquickgridview/data/multipleTransitions.qml156
-rw-r--r--tests/auto/quick/qquickgridview/data/populateTransitions.qml104
-rw-r--r--tests/auto/quick/qquickgridview/data/propertychangestest.qml69
-rw-r--r--tests/auto/quick/qquickgridview/data/removeTransitions.qml147
-rw-r--r--tests/auto/quick/qquickgridview/data/resizegrid.qml51
-rw-r--r--tests/auto/quick/qquickgridview/data/resizeview.qml26
-rw-r--r--tests/auto/quick/qquickgridview/data/setindex.qml29
-rw-r--r--tests/auto/quick/qquickgridview/data/snapOneRow.qml49
-rw-r--r--tests/auto/quick/qquickgridview/data/snapToRow.qml49
-rw-r--r--tests/auto/quick/qquickgridview/data/unaligned.qml15
-rw-r--r--tests/auto/quick/qquickgridview/data/unrequestedItems.qml73
-rw-r--r--tests/auto/quick/qquickgridview/qquickgridview.pro16
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp6292
-rw-r--r--tests/auto/quick/qquickimage/data/aspectratio.qml6
-rw-r--r--tests/auto/quick/qquickimage/data/big.jpegbin0 -> 1700081 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/big256.pngbin0 -> 3566 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/colors.pngbin0 -> 1655 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/colors1.pngbin0 -> 1655 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/correctStatus.qml26
-rw-r--r--tests/auto/quick/qquickimage/data/green.pngbin0 -> 314 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/heart-win32.pngbin0 -> 12621 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/heart.pngbin0 -> 12577 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/heart.svg55
-rw-r--r--tests/auto/quick/qquickimage/data/heart.svgzbin0 -> 1505 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/heart200-win32.pngbin0 -> 8062 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/heart200.pngbin0 -> 8063 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/heart_copy.pngbin0 -> 12577 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/htiling.qml11
-rw-r--r--tests/auto/quick/qquickimage/data/mirror.qml12
-rw-r--r--tests/auto/quick/qquickimage/data/nullpixmap.qml6
-rw-r--r--tests/auto/quick/qquickimage/data/pattern.pngbin0 -> 1371 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/qtbug_16389.qml30
-rw-r--r--tests/auto/quick/qquickimage/data/qtbug_22125.qml44
-rw-r--r--tests/auto/quick/qquickimage/data/rect.pngbin0 -> 171 bytes
-rw-r--r--tests/auto/quick/qquickimage/data/sourceSize.qml7
-rw-r--r--tests/auto/quick/qquickimage/data/vtiling.qml11
-rw-r--r--tests/auto/quick/qquickimage/qquickimage.pro15
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp922
-rw-r--r--tests/auto/quick/qquickimageprovider/qquickimageprovider.pro10
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp443
-rw-r--r--tests/auto/quick/qquickitem/data/focusSubItemInNonFocusScope.qml23
-rw-r--r--tests/auto/quick/qquickitem/data/multipleFocusClears.qml18
-rw-r--r--tests/auto/quick/qquickitem/data/order.1.qml7
-rw-r--r--tests/auto/quick/qquickitem/data/order.2.qml7
-rw-r--r--tests/auto/quick/qquickitem/data/polishOnCompleted.qml11
-rw-r--r--tests/auto/quick/qquickitem/qquickitem.pro12
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp1728
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml136
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml250
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml56
-rw-r--r--tests/auto/quick/qquickitem2/data/childrenProperty.qml14
-rw-r--r--tests/auto/quick/qquickitem2/data/childrenRect.qml27
-rw-r--r--tests/auto/quick/qquickitem2/data/childrenRectBug.qml23
-rw-r--r--tests/auto/quick/qquickitem2/data/childrenRectBug2.qml53
-rw-r--r--tests/auto/quick/qquickitem2/data/childrenRectBug3.qml15
-rw-r--r--tests/auto/quick/qquickitem2/data/hollowTestItem.qml38
-rw-r--r--tests/auto/quick/qquickitem2/data/implicitsize.qml34
-rw-r--r--tests/auto/quick/qquickitem2/data/keynavigationtest.qml87
-rw-r--r--tests/auto/quick/qquickitem2/data/keynavigationtest_implicit.qml68
-rw-r--r--tests/auto/quick/qquickitem2/data/keysim.qml11
-rw-r--r--tests/auto/quick/qquickitem2/data/keyspriority.qml11
-rw-r--r--tests/auto/quick/qquickitem2/data/keystest.qml25
-rw-r--r--tests/auto/quick/qquickitem2/data/layoutmirroring.qml54
-rw-r--r--tests/auto/quick/qquickitem2/data/mapCoordinates.qml84
-rw-r--r--tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml85
-rw-r--r--tests/auto/quick/qquickitem2/data/parentLoop.qml14
-rw-r--r--tests/auto/quick/qquickitem2/data/propertychanges.qml10
-rw-r--r--tests/auto/quick/qquickitem2/data/qtbug_16871.qml5
-rw-r--r--tests/auto/quick/qquickitem2/data/resourcesProperty.qml21
-rw-r--r--tests/auto/quick/qquickitem2/data/transformCrash.qml13
-rw-r--r--tests/auto/quick/qquickitem2/data/visiblechildren.qml143
-rw-r--r--tests/auto/quick/qquickitem2/qquickitem2.pro12
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp2135
-rw-r--r--tests/auto/quick/qquickitemlayer/data/DisableLayer.qml18
-rw-r--r--tests/auto/quick/qquickitemlayer/data/Effect.qml34
-rw-r--r--tests/auto/quick/qquickitemlayer/data/Enabled.qml25
-rw-r--r--tests/auto/quick/qquickitemlayer/data/ItemEffect.qml23
-rw-r--r--tests/auto/quick/qquickitemlayer/data/Mipmap.qml30
-rw-r--r--tests/auto/quick/qquickitemlayer/data/RectangleEffect.qml22
-rw-r--r--tests/auto/quick/qquickitemlayer/data/SamplerNameChange.qml18
-rw-r--r--tests/auto/quick/qquickitemlayer/data/Smooth.qml23
-rw-r--r--tests/auto/quick/qquickitemlayer/data/SourceRect.qml33
-rw-r--r--tests/auto/quick/qquickitemlayer/data/TextureProvider.qml40
-rw-r--r--tests/auto/quick/qquickitemlayer/data/ToggleLayerAndEffect.qml23
-rw-r--r--tests/auto/quick/qquickitemlayer/data/Visible.qml56
-rw-r--r--tests/auto/quick/qquickitemlayer/data/ZOrder.qml52
-rw-r--r--tests/auto/quick/qquickitemlayer/data/ZOrderChange.qml50
-rw-r--r--tests/auto/quick/qquickitemlayer/qquickitemlayer.pro29
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp436
-rw-r--r--tests/auto/quick/qquicklistview/data/ComponentView.qml16
-rw-r--r--tests/auto/quick/qquicklistview/data/Page.qml10
-rw-r--r--tests/auto/quick/qquicklistview/data/addTransitions.qml135
-rw-r--r--tests/auto/quick/qquicklistview/data/asyncloader.qml36
-rw-r--r--tests/auto/quick/qquicklistview/data/attachedSignals.qml24
-rw-r--r--tests/auto/quick/qquicklistview/data/creationContext.qml5
-rw-r--r--tests/auto/quick/qquicklistview/data/destroyItemOnCreation.qml37
-rw-r--r--tests/auto/quick/qquicklistview/data/displacedTransitions.qml164
-rw-r--r--tests/auto/quick/qquicklistview/data/displaylist.qml50
-rw-r--r--tests/auto/quick/qquicklistview/data/emptymodel.qml23
-rw-r--r--tests/auto/quick/qquicklistview/data/fillModelOnComponentCompleted.qml36
-rw-r--r--tests/auto/quick/qquicklistview/data/flickBeyondBoundsBug.qml43
-rw-r--r--tests/auto/quick/qquicklistview/data/footer.qml46
-rw-r--r--tests/auto/quick/qquicklistview/data/header.qml40
-rw-r--r--tests/auto/quick/qquicklistview/data/headerfooter.qml29
-rw-r--r--tests/auto/quick/qquicklistview/data/initialZValues.qml35
-rw-r--r--tests/auto/quick/qquicklistview/data/itemlist-flicker.qml46
-rw-r--r--tests/auto/quick/qquicklistview/data/itemlist.qml46
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-enforcerange-nohighlight.qml61
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-enforcerange.qml56
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-initCurrent.qml64
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-noCurrent.qml51
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-sections-package.qml73
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-sections.qml64
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-sections_delegate.qml72
-rw-r--r--tests/auto/quick/qquicklistview/data/listviewtest-package.qml145
-rw-r--r--tests/auto/quick/qquicklistview/data/listviewtest.qml137
-rw-r--r--tests/auto/quick/qquicklistview/data/manual-highlight.qml47
-rw-r--r--tests/auto/quick/qquicklistview/data/margins.qml48
-rw-r--r--tests/auto/quick/qquicklistview/data/margins2.qml29
-rw-r--r--tests/auto/quick/qquicklistview/data/moveTransitions.qml142
-rw-r--r--tests/auto/quick/qquicklistview/data/multipleDisplaced.qml79
-rw-r--r--tests/auto/quick/qquicklistview/data/multipleTransitions.qml155
-rw-r--r--tests/auto/quick/qquicklistview/data/parentBinding.qml17
-rw-r--r--tests/auto/quick/qquicklistview/data/populateTransitions.qml103
-rw-r--r--tests/auto/quick/qquicklistview/data/propertychangestest.qml71
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug-21742.qml36
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug14821.qml31
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug16037.qml37
-rw-r--r--tests/auto/quick/qquicklistview/data/removeTransitions.qml145
-rw-r--r--tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml53
-rw-r--r--tests/auto/quick/qquicklistview/data/resizeview.qml26
-rw-r--r--tests/auto/quick/qquicklistview/data/rightToLeft.qml42
-rw-r--r--tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml61
-rw-r--r--tests/auto/quick/qquicklistview/data/sectionpropertychange.qml95
-rw-r--r--tests/auto/quick/qquicklistview/data/sizelessthan1.qml26
-rw-r--r--tests/auto/quick/qquicklistview/data/snapOneItem.qml49
-rw-r--r--tests/auto/quick/qquicklistview/data/snapToItem.qml49
-rw-r--r--tests/auto/quick/qquicklistview/data/strictlyenforcerange.qml29
-rw-r--r--tests/auto/quick/qquicklistview/data/unrequestedItems.qml65
-rw-r--r--tests/auto/quick/qquicklistview/incrementalmodel.cpp89
-rw-r--r--tests/auto/quick/qquicklistview/incrementalmodel.h68
-rw-r--r--tests/auto/quick/qquicklistview/qquicklistview.pro18
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp6837
-rw-r--r--tests/auto/quick/qquickloader/data/ActiveComponent.qml11
-rw-r--r--tests/auto/quick/qquickloader/data/AnchoredLoader.qml14
-rw-r--r--tests/auto/quick/qquickloader/data/BigComponent.qml6
-rw-r--r--tests/auto/quick/qquickloader/data/BlueRect.qml8
-rw-r--r--tests/auto/quick/qquickloader/data/CreationContextLoader.qml15
-rw-r--r--tests/auto/quick/qquickloader/data/GraphicsWidget250x250.qml5
-rw-r--r--tests/auto/quick/qquickloader/data/GreenRect.qml7
-rw-r--r--tests/auto/quick/qquickloader/data/InitialPropertyValuesComponent.qml11
-rw-r--r--tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml5
-rw-r--r--tests/auto/quick/qquickloader/data/NoResize.qml8
-rw-r--r--tests/auto/quick/qquickloader/data/NoResizeGraphicsWidget.qml9
-rw-r--r--tests/auto/quick/qquickloader/data/QTBUG_16928.qml23
-rw-r--r--tests/auto/quick/qquickloader/data/QTBUG_17114.qml18
-rw-r--r--tests/auto/quick/qquickloader/data/QTBUG_30183.qml12
-rw-r--r--tests/auto/quick/qquickloader/data/Rect120x60.qml6
-rw-r--r--tests/auto/quick/qquickloader/data/RedRect.qml8
-rw-r--r--tests/auto/quick/qquickloader/data/SetSourceComponent.qml9
-rw-r--r--tests/auto/quick/qquickloader/data/SizeGraphicsWidgetToLoader.qml7
-rw-r--r--tests/auto/quick/qquickloader/data/SizeLoaderToGraphicsWidget.qml5
-rw-r--r--tests/auto/quick/qquickloader/data/SizeToItem.qml5
-rw-r--r--tests/auto/quick/qquickloader/data/SizeToLoader.qml6
-rw-r--r--tests/auto/quick/qquickloader/data/TestComponent.2.qml592
-rw-r--r--tests/auto/quick/qquickloader/data/TestComponent.qml89
-rw-r--r--tests/auto/quick/qquickloader/data/VmeError.qml7
-rw-r--r--tests/auto/quick/qquickloader/data/active.1.qml31
-rw-r--r--tests/auto/quick/qquickloader/data/active.2.qml18
-rw-r--r--tests/auto/quick/qquickloader/data/active.3.qml18
-rw-r--r--tests/auto/quick/qquickloader/data/active.4.qml26
-rw-r--r--tests/auto/quick/qquickloader/data/active.5.qml18
-rw-r--r--tests/auto/quick/qquickloader/data/active.6.qml21
-rw-r--r--tests/auto/quick/qquickloader/data/active.7.qml14
-rw-r--r--tests/auto/quick/qquickloader/data/active.8.qml13
-rw-r--r--tests/auto/quick/qquickloader/data/asynchronous.qml16
-rw-r--r--tests/auto/quick/qquickloader/data/crash.qml14
-rw-r--r--tests/auto/quick/qquickloader/data/creationContext.qml8
-rw-r--r--tests/auto/quick/qquickloader/data/differentorigin.qml3
-rw-r--r--tests/auto/quick/qquickloader/data/implicitSize.qml33
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.1.qml22
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.2.qml20
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.3.qml18
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.4.qml22
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.5.qml20
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.6.qml25
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.7.qml29
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.8.qml20
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.binding.qml21
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.error.1.qml14
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.error.2.qml14
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.error.3.qml14
-rw-r--r--tests/auto/quick/qquickloader/data/initialPropertyValues.error.4.qml15
-rw-r--r--tests/auto/quick/qquickloader/data/loadedSignal.2.qml31
-rw-r--r--tests/auto/quick/qquickloader/data/loadedSignal.qml48
-rw-r--r--tests/auto/quick/qquickloader/data/nonItem.qml5
-rw-r--r--tests/auto/quick/qquickloader/data/parented.qml21
-rw-r--r--tests/auto/quick/qquickloader/data/qmldir1
-rw-r--r--tests/auto/quick/qquickloader/data/sameorigin-load.qml3
-rw-r--r--tests/auto/quick/qquickloader/data/sameorigin.qml3
-rw-r--r--tests/auto/quick/qquickloader/data/simultaneous.qml22
-rw-r--r--tests/auto/quick/qquickloader/data/sizebound.qml30
-rw-r--r--tests/auto/quick/qquickloader/data/subdir/Test.qml5
-rw-r--r--tests/auto/quick/qquickloader/data/vmeErrors.qml6
-rw-r--r--tests/auto/quick/qquickloader/qquickloader.pro16
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp1149
-rw-r--r--tests/auto/quick/qquickmousearea/data/changeAxis.qml22
-rw-r--r--tests/auto/quick/qquickmousearea/data/clickThrough.qml25
-rw-r--r--tests/auto/quick/qquickmousearea/data/clickThrough2.qml35
-rw-r--r--tests/auto/quick/qquickmousearea/data/clickandhold.qml13
-rw-r--r--tests/auto/quick/qquickmousearea/data/clicktwice.qml17
-rw-r--r--tests/auto/quick/qquickmousearea/data/doubleclick.qml17
-rw-r--r--tests/auto/quick/qquickmousearea/data/dragging.qml28
-rw-r--r--tests/auto/quick/qquickmousearea/data/dragproperties.qml28
-rw-r--r--tests/auto/quick/qquickmousearea/data/dragreset.qml28
-rw-r--r--tests/auto/quick/qquickmousearea/data/hoverPosition.qml17
-rw-r--r--tests/auto/quick/qquickmousearea/data/hoverPropagation.qml54
-rw-r--r--tests/auto/quick/qquickmousearea/data/hoverVisible.qml15
-rw-r--r--tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml14
-rw-r--r--tests/auto/quick/qquickmousearea/data/nestedStopAtBounds.qml44
-rw-r--r--tests/auto/quick/qquickmousearea/data/noclickandhold.qml11
-rw-r--r--tests/auto/quick/qquickmousearea/data/pressedCanceled.qml25
-rw-r--r--tests/auto/quick/qquickmousearea/data/pressedOrdering.qml28
-rw-r--r--tests/auto/quick/qquickmousearea/data/preventstealing.qml24
-rw-r--r--tests/auto/quick/qquickmousearea/data/rejectEvent.qml28
-rw-r--r--tests/auto/quick/qquickmousearea/data/setDragOnPressed.qml18
-rw-r--r--tests/auto/quick/qquickmousearea/data/simple.qml12
-rw-r--r--tests/auto/quick/qquickmousearea/data/transformedMouseArea.qml21
-rw-r--r--tests/auto/quick/qquickmousearea/data/updateMousePosOnClick.qml20
-rw-r--r--tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml43
-rw-r--r--tests/auto/quick/qquickmousearea/data/wheel.qml24
-rw-r--r--tests/auto/quick/qquickmousearea/qquickmousearea.pro14
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp1496
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/basic.qml15
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml31
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml30
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/nested.qml27
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml32
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/properties.qml15
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml30
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml26
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro13
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp861
-rw-r--r--tests/auto/quick/qquickpainteditem/qquickpainteditem.pro10
-rw-r--r--tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp491
-rw-r--r--tests/auto/quick/qquickpath/data/arc.qml11
-rw-r--r--tests/auto/quick/qquickpath/data/closedcurve.qml9
-rw-r--r--tests/auto/quick/qquickpath/data/curve.qml9
-rw-r--r--tests/auto/quick/qquickpath/data/svg.qml5
-rw-r--r--tests/auto/quick/qquickpath/qquickpath.pro14
-rw-r--r--tests/auto/quick/qquickpath/tst_qquickpath.cpp237
-rw-r--r--tests/auto/quick/qquickpathview/data/ComponentView.qml17
-rw-r--r--tests/auto/quick/qquickpathview/data/asyncloader.qml71
-rw-r--r--tests/auto/quick/qquickpathview/data/closedPath.qml24
-rw-r--r--tests/auto/quick/qquickpathview/data/creationContext.qml5
-rw-r--r--tests/auto/quick/qquickpathview/data/datamodel.qml38
-rw-r--r--tests/auto/quick/qquickpathview/data/displaypath.qml59
-rw-r--r--tests/auto/quick/qquickpathview/data/dragpath.qml20
-rw-r--r--tests/auto/quick/qquickpathview/data/emptymodel.qml5
-rw-r--r--tests/auto/quick/qquickpathview/data/emptypath.qml6
-rw-r--r--tests/auto/quick/qquickpathview/data/initialCurrentIndex.qml60
-rw-r--r--tests/auto/quick/qquickpathview/data/missingPercent.qml9
-rw-r--r--tests/auto/quick/qquickpathview/data/openPath.qml10
-rw-r--r--tests/auto/quick/qquickpathview/data/panels.qml44
-rw-r--r--tests/auto/quick/qquickpathview/data/pathUpdate.qml18
-rw-r--r--tests/auto/quick/qquickpathview/data/pathUpdateOnStartChanged.qml38
-rw-r--r--tests/auto/quick/qquickpathview/data/pathline.qml48
-rw-r--r--tests/auto/quick/qquickpathview/data/pathtest.qml14
-rw-r--r--tests/auto/quick/qquickpathview/data/pathview0.qml85
-rw-r--r--tests/auto/quick/qquickpathview/data/pathview1.qml4
-rw-r--r--tests/auto/quick/qquickpathview/data/pathview2.qml57
-rw-r--r--tests/auto/quick/qquickpathview/data/pathview3.qml69
-rw-r--r--tests/auto/quick/qquickpathview/data/pathview_package.qml88
-rw-r--r--tests/auto/quick/qquickpathview/data/propertychanges.qml116
-rw-r--r--tests/auto/quick/qquickpathview/data/treemodel.qml19
-rw-r--r--tests/auto/quick/qquickpathview/data/undefinedpath.qml17
-rw-r--r--tests/auto/quick/qquickpathview/data/vdm.qml28
-rw-r--r--tests/auto/quick/qquickpathview/qquickpathview.pro14
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp2088
-rw-r--r--tests/auto/quick/qquickpincharea/data/pinchproperties.qml53
-rw-r--r--tests/auto/quick/qquickpincharea/data/transformedPinchArea.qml33
-rw-r--r--tests/auto/quick/qquickpincharea/qquickpincharea.pro13
-rw-r--r--tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp481
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/dataLeak.qml18
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/exists1.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/exists2.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists1.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists2.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists3.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists4.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists5.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists6.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists7.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/http/exists8.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/data/massive.pngbin0 -> 31834 bytes
-rw-r--r--tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro18
-rw-r--r--tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp531
-rw-r--r--tests/auto/quick/qquickpositioners/data/allInvisible.qml44
-rw-r--r--tests/auto/quick/qquickpositioners/data/attachedproperties-column.qml50
-rw-r--r--tests/auto/quick/qquickpositioners/data/attachedproperties-dynamic.qml44
-rw-r--r--tests/auto/quick/qquickpositioners/data/attachedproperties-flow.qml50
-rw-r--r--tests/auto/quick/qquickpositioners/data/attachedproperties-grid.qml50
-rw-r--r--tests/auto/quick/qquickpositioners/data/attachedproperties-row.qml50
-rw-r--r--tests/auto/quick/qquickpositioners/data/flow-testimplicitsize.qml19
-rw-r--r--tests/auto/quick/qquickpositioners/data/flowtest-toptobottom.qml44
-rw-r--r--tests/auto/quick/qquickpositioners/data/flowtest.qml43
-rw-r--r--tests/auto/quick/qquickpositioners/data/grid-animated.qml69
-rw-r--r--tests/auto/quick/qquickpositioners/data/grid-row-column-spacing.qml43
-rw-r--r--tests/auto/quick/qquickpositioners/data/grid-spacing.qml41
-rw-r--r--tests/auto/quick/qquickpositioners/data/grid-toptobottom.qml41
-rw-r--r--tests/auto/quick/qquickpositioners/data/gridtest.qml46
-rw-r--r--tests/auto/quick/qquickpositioners/data/gridzerocolumns.qml40
-rw-r--r--tests/auto/quick/qquickpositioners/data/horizontal-animated-disabled.qml40
-rw-r--r--tests/auto/quick/qquickpositioners/data/horizontal-animated.qml53
-rw-r--r--tests/auto/quick/qquickpositioners/data/horizontal-spacing.qml31
-rw-r--r--tests/auto/quick/qquickpositioners/data/horizontal.qml29
-rw-r--r--tests/auto/quick/qquickpositioners/data/propertychangestest.qml39
-rw-r--r--tests/auto/quick/qquickpositioners/data/rectangleComponent.qml11
-rw-r--r--tests/auto/quick/qquickpositioners/data/repeatertest.qml38
-rw-r--r--tests/auto/quick/qquickpositioners/data/transitions.qml235
-rw-r--r--tests/auto/quick/qquickpositioners/data/vertical-animated.qml46
-rw-r--r--tests/auto/quick/qquickpositioners/data/vertical-spacing.qml28
-rw-r--r--tests/auto/quick/qquickpositioners/data/vertical.qml27
-rw-r--r--tests/auto/quick/qquickpositioners/qquickpositioners.pro14
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp2159
-rw-r--r--tests/auto/quick/qquickrectangle/data/gradient.qml14
-rw-r--r--tests/auto/quick/qquickrectangle/qquickrectangle.pro13
-rw-r--r--tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp93
-rw-r--r--tests/auto/quick/qquickrepeater/data/asyncloader.qml32
-rw-r--r--tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml20
-rw-r--r--tests/auto/quick/qquickrepeater/data/initparent.qml12
-rw-r--r--tests/auto/quick/qquickrepeater/data/intmodel.qml29
-rw-r--r--tests/auto/quick/qquickrepeater/data/itemlist.qml68
-rw-r--r--tests/auto/quick/qquickrepeater/data/modelChanged.qml26
-rw-r--r--tests/auto/quick/qquickrepeater/data/objlist.qml21
-rw-r--r--tests/auto/quick/qquickrepeater/data/properties.qml11
-rw-r--r--tests/auto/quick/qquickrepeater/data/repeater1.qml30
-rw-r--r--tests/auto/quick/qquickrepeater/data/repeater2.qml36
-rw-r--r--tests/auto/quick/qquickrepeater/qquickrepeater.pro14
-rw-r--r--tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp737
-rw-r--r--tests/auto/quick/qquickscreen/data/screen.qml11
-rw-r--r--tests/auto/quick/qquickscreen/qquickscreen.pro11
-rw-r--r--tests/auto/quick/qquickscreen/tst_qquickscreen.cpp77
-rw-r--r--tests/auto/quick/qquickshadereffect/data/deleteShaderEffectSource.qml74
-rw-r--r--tests/auto/quick/qquickshadereffect/data/deleteSourceItem.qml75
-rw-r--r--tests/auto/quick/qquickshadereffect/data/star.pngbin0 -> 1550 bytes
-rw-r--r--tests/auto/quick/qquickshadereffect/qquickshadereffect.pro10
-rw-r--r--tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp320
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/deleteOnUpdate.qml27
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/simpleanimation.qml12
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation1.qml3
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation2.qml5
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation3.qml6
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationBehavior.qml24
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationValueSource.qml13
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationZeroDuration.qml12
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro14
-rw-r--r--tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp265
-rw-r--r--tests/auto/quick/qquickspringanimation/data/springanimation1.qml4
-rw-r--r--tests/auto/quick/qquickspringanimation/data/springanimation2.qml16
-rw-r--r--tests/auto/quick/qquickspringanimation/data/springanimation3.qml8
-rw-r--r--tests/auto/quick/qquickspringanimation/qquickspringanimation.pro14
-rw-r--r--tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp133
-rw-r--r--tests/auto/quick/qquickspritesequence/data/advance.qml66
-rw-r--r--tests/auto/quick/qquickspritesequence/data/basic.qml60
-rw-r--r--tests/auto/quick/qquickspritesequence/data/crashonstart.qml74
-rw-r--r--tests/auto/quick/qquickspritesequence/data/huge.pngbin0 -> 2245 bytes
-rw-r--r--tests/auto/quick/qquickspritesequence/data/huge.qml60
-rw-r--r--tests/auto/quick/qquickspritesequence/data/squarefacesprite.pngbin0 -> 496 bytes
-rw-r--r--tests/auto/quick/qquickspritesequence/qquickspritesequence.pro14
-rw-r--r--tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp132
-rw-r--r--tests/auto/quick/qquickstates/data/ExtendedRectangle.qml19
-rw-r--r--tests/auto/quick/qquickstates/data/Implementation/MyType.qml32
-rw-r--r--tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--tests/auto/quick/qquickstates/data/QTBUG-14830.qml29
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges1.qml23
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges2.qml21
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges3.qml29
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges4.qml22
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChanges5.qml22
-rw-r--r--tests/auto/quick/qquickstates/data/anchorChangesCrash.qml14
-rw-r--r--tests/auto/quick/qquickstates/data/anchorRewindBug.qml37
-rw-r--r--tests/auto/quick/qquickstates/data/anchorRewindBug2.qml25
-rw-r--r--tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml20
-rw-r--r--tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml18
-rw-r--r--tests/auto/quick/qquickstates/data/avoidFastForward.qml17
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding2.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding3.qml13
-rw-r--r--tests/auto/quick/qquickstates/data/basicBinding4.qml17
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges.qml10
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges2.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges3.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/basicChanges4.qml19
-rw-r--r--tests/auto/quick/qquickstates/data/basicExtension.qml16
-rw-r--r--tests/auto/quick/qquickstates/data/deleting.qml11
-rw-r--r--tests/auto/quick/qquickstates/data/deletingState.qml13
-rw-r--r--tests/auto/quick/qquickstates/data/editProperties.qml34
-rw-r--r--tests/auto/quick/qquickstates/data/explicit.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/extendsBug.qml26
-rw-r--r--tests/auto/quick/qquickstates/data/fakeExtension.qml16
-rw-r--r--tests/auto/quick/qquickstates/data/illegalObj.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/illegalTempState.qml21
-rw-r--r--tests/auto/quick/qquickstates/data/image.pngbin0 -> 173 bytes
-rw-r--r--tests/auto/quick/qquickstates/data/legalTempState.qml23
-rw-r--r--tests/auto/quick/qquickstates/data/nonExistantProp.qml11
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange1.qml37
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange2.qml31
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange3.qml42
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange4.qml30
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange5.qml30
-rw-r--r--tests/auto/quick/qquickstates/data/parentChange6.qml30
-rw-r--r--tests/auto/quick/qquickstates/data/propertyErrors.qml10
-rw-r--r--tests/auto/quick/qquickstates/data/reset.qml19
-rw-r--r--tests/auto/quick/qquickstates/data/restoreEntryValues.qml14
-rw-r--r--tests/auto/quick/qquickstates/data/returnToBase.qml21
-rw-r--r--tests/auto/quick/qquickstates/data/revertListBug.qml47
-rw-r--r--tests/auto/quick/qquickstates/data/script.qml10
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverride.qml18
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverride2.qml9
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverrideCrash.qml15
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml24
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml27
-rw-r--r--tests/auto/quick/qquickstates/data/signalOverrideCrash4.qml22
-rw-r--r--tests/auto/quick/qquickstates/data/unnamedWhen.qml14
-rw-r--r--tests/auto/quick/qquickstates/data/urlResolution.qml12
-rw-r--r--tests/auto/quick/qquickstates/data/whenOrdering.qml11
-rw-r--r--tests/auto/quick/qquickstates/qquickstates.pro13
-rw-r--r--tests/auto/quick/qquickstates/tst_qquickstates.cpp1631
-rw-r--r--tests/auto/quick/qquickstyledtext/qquickstyledtext.pro9
-rw-r--r--tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp253
-rw-r--r--tests/auto/quick/qquicksystempalette/qquicksystempalette.pro10
-rw-r--r--tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp189
-rw-r--r--tests/auto/quick/qquicktext/data/embeddedImagesLocal.qml6
-rw-r--r--tests/auto/quick/qquicktext/data/embeddedImagesLocalError.qml6
-rw-r--r--tests/auto/quick/qquicktext/data/embeddedImagesLocalRelative.qml7
-rw-r--r--tests/auto/quick/qquicktext/data/embeddedImagesRemote.qml6
-rw-r--r--tests/auto/quick/qquicktext/data/embeddedImagesRemoteError.qml6
-rw-r--r--tests/auto/quick/qquicktext/data/embeddedImagesRemoteRelative.qml7
-rw-r--r--tests/auto/quick/qquicktext/data/fontSizeMode.qml22
-rw-r--r--tests/auto/quick/qquicktext/data/hAlignImplicitWidth.qml13
-rw-r--r--tests/auto/quick/qquicktext/data/horizontalAlignment_RightToLeft.qml23
-rw-r--r--tests/auto/quick/qquicktext/data/htmlLists.qml12
-rw-r--r--tests/auto/quick/qquicktext/data/http/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquicktext/data/images/face-sad.pngbin0 -> 6148 bytes
-rw-r--r--tests/auto/quick/qquicktext/data/images/heart200.pngbin0 -> 8248 bytes
-rw-r--r--tests/auto/quick/qquicktext/data/images/starfish_2.pngbin0 -> 18243 bytes
-rw-r--r--tests/auto/quick/qquicktext/data/imgTagsElide.qml24
-rw-r--r--tests/auto/quick/qquicktext/data/imgTagsUpdates.qml12
-rw-r--r--tests/auto/quick/qquicktext/data/lineCount.qml15
-rw-r--r--tests/auto/quick/qquicktext/data/lineHeight.qml15
-rw-r--r--tests/auto/quick/qquicktext/data/lineLayout.qml35
-rw-r--r--tests/auto/quick/qquicktext/data/lineLayoutRelayout.qml45
-rw-r--r--tests/auto/quick/qquicktext/data/multilengthStrings.qml14
-rw-r--r--tests/auto/quick/qquicktext/data/multilengthStringsWrapped.qml16
-rw-r--r--tests/auto/quick/qquicktext/data/multilineelide.qml10
-rw-r--r--tests/auto/quick/qquicktext/data/overline.qml15
-rw-r--r--tests/auto/quick/qquicktext/data/pixelFontSizes.qml21
-rw-r--r--tests/auto/quick/qquicktext/data/pointFontSizes.qml21
-rw-r--r--tests/auto/quick/qquicktext/data/qtbug_14734.qml10
-rw-r--r--tests/auto/quick/qquicktext/data/rotated.qml18
-rw-r--r--tests/auto/quick/qquicktext/data/strikeout.qml15
-rw-r--r--tests/auto/quick/qquicktext/data/underline.qml15
-rw-r--r--tests/auto/quick/qquicktext/qquicktext.pro18
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp3643
-rw-r--r--tests/auto/quick/qquicktextdocument/data/text.qml6
-rw-r--r--tests/auto/quick/qquicktextdocument/qquicktextdocument.pro15
-rw-r--r--tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp87
-rw-r--r--tests/auto/quick/qquicktextedit/data/Cursor.qml5
-rw-r--r--tests/auto/quick/qquicktextedit/data/CursorRect.qml8
-rw-r--r--tests/auto/quick/qquicktextedit/data/RemoteCursor.qml5
-rw-r--r--tests/auto/quick/qquicktextedit/data/cursorTest.qml10
-rw-r--r--tests/auto/quick/qquicktextedit/data/cursorTestExternal.qml17
-rw-r--r--tests/auto/quick/qquicktextedit/data/cursorTestInline.qml17
-rw-r--r--tests/auto/quick/qquicktextedit/data/cursorTestRemote.qml13
-rw-r--r--tests/auto/quick/qquicktextedit/data/cursorVisible.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/embeddedImagesLocal.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/embeddedImagesLocalError.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/embeddedImagesLocalRelative.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/embeddedImagesRemote.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteError.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteRelative.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/focusOutSelection.qml35
-rw-r--r--tests/auto/quick/qquicktextedit/data/geometrySignals.qml12
-rw-r--r--tests/auto/quick/qquicktextedit/data/hAlignVisual.qml13
-rw-r--r--tests/auto/quick/qquicktextedit/data/horizontalAlignment_RightToLeft.qml41
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/ErrItem.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/NormItem.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml26
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml21
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml21
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml20
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/quick/qquicktextedit/data/http/qmldir4
-rw-r--r--tests/auto/quick/qquicktextedit/data/httpfail/FailItem.qml5
-rw-r--r--tests/auto/quick/qquicktextedit/data/httpslow/WaitItem.qml5
-rw-r--r--tests/auto/quick/qquicktextedit/data/inputContext.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/inputMethodEvent.qml10
-rw-r--r--tests/auto/quick/qquicktextedit/data/inputmethodhints.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/linkActivated.qml6
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_align_bl.qml14
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_align_center.qml14
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_align_tr.qml14
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_default.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_false.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_false_words.qml8
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_true.qml11
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselection_true_words.qml8
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselectionmode_characters.qml8
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselectionmode_default.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/mouseselectionmode_words.qml8
-rw-r--r--tests/auto/quick/qquicktextedit/data/navigation.qml24
-rw-r--r--tests/auto/quick/qquicktextedit/data/openInputPanel.qml7
-rw-r--r--tests/auto/quick/qquicktextedit/data/persistentSelection.qml8
-rw-r--r--tests/auto/quick/qquicktextedit/data/positionAt.qml10
-rw-r--r--tests/auto/quick/qquicktextedit/data/qtbug-22058.qml39
-rw-r--r--tests/auto/quick/qquicktextedit/data/readOnly.qml12
-rw-r--r--tests/auto/quick/qquicktextedit/qquicktextedit.pro18
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp5010
-rw-r--r--tests/auto/quick/qquicktextinput/data/Cursor.qml5
-rw-r--r--tests/auto/quick/qquicktextinput/data/RemoteCursor.qml5
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorTest.qml10
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml17
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorTestInline.qml17
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorTestRemote.qml12
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorVisible.qml6
-rw-r--r--tests/auto/quick/qquicktextinput/data/echoMode.qml15
-rw-r--r--tests/auto/quick/qquicktextinput/data/geometrySignals.qml12
-rw-r--r--tests/auto/quick/qquicktextinput/data/horizontalAlignment.qml23
-rw-r--r--tests/auto/quick/qquicktextinput/data/horizontalAlignment_RightToLeft.qml28
-rw-r--r--tests/auto/quick/qquicktextinput/data/inputContext.qml8
-rw-r--r--tests/auto/quick/qquicktextinput/data/inputMethodEvent.qml9
-rw-r--r--tests/auto/quick/qquicktextinput/data/inputmethods.qml7
-rw-r--r--tests/auto/quick/qquicktextinput/data/masks.qml7
-rw-r--r--tests/auto/quick/qquicktextinput/data/maxLength.qml7
-rw-r--r--tests/auto/quick/qquicktextinput/data/mouseselection_true.qml7
-rw-r--r--tests/auto/quick/qquicktextinput/data/mouseselectionmode_characters.qml8
-rw-r--r--tests/auto/quick/qquicktextinput/data/mouseselectionmode_default.qml7
-rw-r--r--tests/auto/quick/qquicktextinput/data/mouseselectionmode_words.qml8
-rw-r--r--tests/auto/quick/qquicktextinput/data/navigation.qml24
-rw-r--r--tests/auto/quick/qquicktextinput/data/negativeDimensions.qml19
-rw-r--r--tests/auto/quick/qquicktextinput/data/openInputPanel.qml7
-rw-r--r--tests/auto/quick/qquicktextinput/data/persistentSelection.qml8
-rw-r--r--tests/auto/quick/qquicktextinput/data/positionAt.qml9
-rw-r--r--tests/auto/quick/qquicktextinput/data/preeditAutoScroll.qml7
-rw-r--r--tests/auto/quick/qquicktextinput/data/qtbug-19956double.qml15
-rw-r--r--tests/auto/quick/qquicktextinput/data/qtbug-19956int.qml15
-rw-r--r--tests/auto/quick/qquicktextinput/data/qtbug-19956regexp.qml13
-rw-r--r--tests/auto/quick/qquicktextinput/data/readOnly.qml12
-rw-r--r--tests/auto/quick/qquicktextinput/data/validators.qml29
-rw-r--r--tests/auto/quick/qquicktextinput/qquicktextinput.pro16
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp6253
-rw-r--r--tests/auto/quick/qquickview/data/error1.qml5
-rw-r--r--tests/auto/quick/qquickview/data/resizemodeitem.qml5
-rw-r--r--tests/auto/quick/qquickview/qquickview.pro13
-rw-r--r--tests/auto/quick/qquickview/tst_qquickview.cpp243
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/create.qml22
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml20
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/datalist.qml18
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml14
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml52
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/groups.qml46
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml19
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_listView.qml13
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml42
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_pathView.qml18
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_repeater.qml15
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml51
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml45
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/modelproperties.qml21
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/modelproperties2.qml21
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml46
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml41
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/objectlist.qml23
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml48
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml43
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml87
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/packageView.qml65
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/singlerole1.qml10
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/singlerole2.qml10
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml47
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml41
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml45
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml40
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml12
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro16
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp4241
-rw-r--r--tests/auto/quick/qquickwindow/data/AnimationsWhileHidden.qml17
-rw-r--r--tests/auto/quick/qquickwindow/data/Headless.qml32
-rw-r--r--tests/auto/quick/qquickwindow/data/colors.pngbin0 -> 1655 bytes
-rw-r--r--tests/auto/quick/qquickwindow/data/focus.qml15
-rw-r--r--tests/auto/quick/qquickwindow/data/ownershipRootItem.qml15
-rw-r--r--tests/auto/quick/qquickwindow/data/showHideAnimate.qml5
-rw-r--r--tests/auto/quick/qquickwindow/data/window.qml9
-rw-r--r--tests/auto/quick/qquickwindow/qquickwindow.pro18
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp1405
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/empty.xml0
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/get.qml61
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/model.qml11
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/model.xml54
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/model2.xml14
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/propertychanges.qml11
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/recipes.qml11
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/recipes.xml90
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/roleCrash.qml8
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/roleErrors.qml11
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/roleKeys.qml13
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/testtypes.qml8
-rw-r--r--tests/auto/quick/qquickxmllistmodel/data/unique.qml9
-rw-r--r--tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro14
-rw-r--r--tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp978
-rw-r--r--tests/auto/quick/quick.pro82
-rw-r--r--tests/auto/quick/rendernode/data/MessUpState.qml33
-rw-r--r--tests/auto/quick/rendernode/data/RenderOrder.qml53
-rw-r--r--tests/auto/quick/rendernode/rendernode.pro18
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp242
-rw-r--r--tests/auto/quick/shared/util.pri9
-rw-r--r--tests/auto/quick/shared/viewtestutil.cpp319
-rw-r--r--tests/auto/quick/shared/viewtestutil.h172
-rw-r--r--tests/auto/quick/shared/visualtestutil.cpp76
-rw-r--r--tests/auto/quick/shared/visualtestutil.h117
-rw-r--r--tests/auto/quick/touchmouse/data/buttononflickable.qml42
-rw-r--r--tests/auto/quick/touchmouse/data/buttonontouch.qml100
-rw-r--r--tests/auto/quick/touchmouse/data/flickableonpinch.qml37
-rw-r--r--tests/auto/quick/touchmouse/data/mouseonflickableonpinch.qml47
-rw-r--r--tests/auto/quick/touchmouse/data/pinchonflickable.qml35
-rw-r--r--tests/auto/quick/touchmouse/data/singleitem.qml18
-rw-r--r--tests/auto/quick/touchmouse/data/twoMouseAreas.qml33
-rw-r--r--tests/auto/quick/touchmouse/data/twoitems.qml22
-rw-r--r--tests/auto/quick/touchmouse/touchmouse.pro20
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp972
-rw-r--r--tests/auto/shared/imports.pri7
-rw-r--r--tests/auto/shared/platforminputcontext.h116
-rw-r--r--tests/auto/shared/platformquirks.h69
-rw-r--r--tests/auto/shared/testhttpserver.cpp329
-rw-r--r--tests/auto/shared/testhttpserver.h96
-rw-r--r--tests/auto/shared/util.cpp138
-rw-r--r--tests/auto/shared/util.h111
-rw-r--r--tests/auto/shared/util.pri5
-rw-r--r--tests/benchmarks/particles/affectors/affectors.pro11
-rw-r--r--tests/benchmarks/particles/affectors/data/basic.qml74
-rw-r--r--tests/benchmarks/particles/affectors/data/filtered.qml81
-rw-r--r--tests/benchmarks/particles/affectors/tst_affectors.cpp164
-rw-r--r--tests/benchmarks/particles/emission/data/basic.qml67
-rw-r--r--tests/benchmarks/particles/emission/emission.pro11
-rw-r--r--tests/benchmarks/particles/emission/tst_emission.cpp118
-rw-r--r--tests/benchmarks/particles/particles.pro5
-rw-r--r--tests/benchmarks/qml/animation/animation.pro11
-rw-r--r--tests/benchmarks/qml/animation/data/animation.qml75
-rw-r--r--tests/benchmarks/qml/animation/tst_animation.cpp204
-rw-r--r--tests/benchmarks/qml/binding/binding.pro12
-rw-r--r--tests/benchmarks/qml/binding/data/creation.txt9
-rw-r--r--tests/benchmarks/qml/binding/data/idproperty.txt9
-rw-r--r--tests/benchmarks/qml/binding/data/localproperty.txt5
-rw-r--r--tests/benchmarks/qml/binding/data/objectproperty.txt8
-rw-r--r--tests/benchmarks/qml/binding/testtypes.cpp46
-rw-r--r--tests/benchmarks/qml/binding/testtypes.h83
-rw-r--r--tests/benchmarks/qml/binding/tst_binding.cpp188
-rw-r--r--tests/benchmarks/qml/compilation/compilation.pro12
-rw-r--r--tests/benchmarks/qml/compilation/data/BoomBlock.qml106
-rw-r--r--tests/benchmarks/qml/compilation/tst_compilation.cpp160
-rw-r--r--tests/benchmarks/qml/creation/creation.pro11
-rw-r--r--tests/benchmarks/qml/creation/data/CustomItem.qml46
-rw-r--r--tests/benchmarks/qml/creation/data/emptyCustomItem.qml46
-rw-r--r--tests/benchmarks/qml/creation/data/emptyItem.qml46
-rw-r--r--tests/benchmarks/qml/creation/data/item.qml75
-rw-r--r--tests/benchmarks/qml/creation/data/itemUsingOnComponentCompleted.qml46
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithAnchoredChild.qml51
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithChildBindedToSize.qml52
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithProperties.qml49
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest1.qml56
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest2.qml56
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest3.qml57
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest4.qml59
-rw-r--r--tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest5.qml57
-rw-r--r--tests/benchmarks/qml/creation/data/qobject.qml45
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp397
-rw-r--r--tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicFour.qml78
-rw-r--r--tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicOne.qml56
-rw-r--r--tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicThree.qml61
-rw-r--r--tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicTwo.qml68
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Mlbsi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Mldsi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Mlsi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/ModuleBm.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Msbsi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Msdsi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Mssi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/PragmaBm.qml55
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/PragmaModuleBm.qml51
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Slsi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/Sssi.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi.js133
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi1.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi10.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi11.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi12.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi13.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi14.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi15.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi2.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi3.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi4.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi5.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi6.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi7.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi8.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlbsi9.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi.js105
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi1.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi10.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi11.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi12.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi13.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi14.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi15.js104
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi2.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi3.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi4.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi5.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi6.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi7.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi8.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mldsi9.js107
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mlsi.js138
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/moduleBm.js109
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi.js79
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi1.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi10.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi11.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi12.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi13.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi14.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi15.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi2.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi3.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi4.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi5.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi6.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi7.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi8.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msbsi9.js53
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi.js51
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi1.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi10.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi11.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi12.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi13.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi14.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi15.js49
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi2.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi3.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi4.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi5.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi6.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi7.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi8.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/msdsi9.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/mssi.js84
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/pragmaBmOne.js50
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/pragmaBmTwo.js50
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/pragmaLib.js119
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/pragmaModuleBm.js57
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/slsi.js108
-rw-r--r--tests/benchmarks/qml/holistic/data/jsImports/sssi.js52
-rw-r--r--tests/benchmarks/qml/holistic/data/jsTargets/JsOne.qml61
-rw-r--r--tests/benchmarks/qml/holistic/data/jsTargets/JsTwo.qml118
-rw-r--r--tests/benchmarks/qml/holistic/data/largeTargets/gridview-example.qml91
-rw-r--r--tests/benchmarks/qml/holistic/data/largeTargets/layoutdirection.qml151
-rw-r--r--tests/benchmarks/qml/holistic/data/largeTargets/mousearea-example.qml112
-rw-r--r--tests/benchmarks/qml/holistic/data/resolutionTargets/ResolveOne.qml111
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/CppToJs.qml52
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/CppToQml.qml48
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEight.qml54
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEleven.qml57
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFive.qml54
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFour.qml55
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppNine.qml56
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppOne.qml55
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSeven.qml54
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSix.qml54
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTen.qml56
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppThree.qml55
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTwo.qml55
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceOne.qml57
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceTwo.qml52
-rw-r--r--tests/benchmarks/qml/holistic/data/scopeSwitching/cppToJs.js49
-rw-r--r--tests/benchmarks/qml/holistic/data/smallTargets/SmallFour.qml49
-rw-r--r--tests/benchmarks/qml/holistic/data/smallTargets/SmallOne.qml51
-rw-r--r--tests/benchmarks/qml/holistic/data/smallTargets/SmallThree.qml51
-rw-r--r--tests/benchmarks/qml/holistic/data/smallTargets/SmallTwo.qml51
-rw-r--r--tests/benchmarks/qml/holistic/holistic.pro14
-rw-r--r--tests/benchmarks/qml/holistic/testtypes.cpp94
-rw-r--r--tests/benchmarks/qml/holistic/testtypes.h355
-rw-r--r--tests/benchmarks/qml/holistic/tst_holistic.cpp607
-rw-r--r--tests/benchmarks/qml/javascript/data/NestedIdObject.qml9
-rw-r--r--tests/benchmarks/qml/javascript/data/intQObjectProperty.qml13
-rw-r--r--tests/benchmarks/qml/javascript/data/localId.qml13
-rw-r--r--tests/benchmarks/qml/javascript/data/nestedId.qml13
-rw-r--r--tests/benchmarks/qml/javascript/data/stringQObjectProperty.qml14
-rw-r--r--tests/benchmarks/qml/javascript/javascript.pro12
-rw-r--r--tests/benchmarks/qml/javascript/testtypes.cpp48
-rw-r--r--tests/benchmarks/qml/javascript/testtypes.h65
-rw-r--r--tests/benchmarks/qml/javascript/tst_javascript.cpp123
-rw-r--r--tests/benchmarks/qml/js/js.pro10
-rw-r--r--tests/benchmarks/qml/js/qjsengine/qjsengine.pro8
-rw-r--r--tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp588
-rw-r--r--tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro8
-rw-r--r--tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp977
-rw-r--r--tests/benchmarks/qml/js/qjsvalueiterator/qjsvalueiterator.pro8
-rw-r--r--tests/benchmarks/qml/js/qjsvalueiterator/tst_qjsvalueiterator.cpp309
-rw-r--r--tests/benchmarks/qml/painting/data/63x63.pngbin0 -> 3077 bytes
-rw-r--r--tests/benchmarks/qml/painting/data/63x63_opaque.pngbin0 -> 3440 bytes
-rw-r--r--tests/benchmarks/qml/painting/data/64x64.pngbin0 -> 3101 bytes
-rw-r--r--tests/benchmarks/qml/painting/data/64x64_opaque.pngbin0 -> 3588 bytes
-rw-r--r--tests/benchmarks/qml/painting/paintbenchmark.cpp417
-rw-r--r--tests/benchmarks/qml/painting/painting.pro8
-rw-r--r--tests/benchmarks/qml/pointers/pointers.pro9
-rw-r--r--tests/benchmarks/qml/pointers/tst_pointers.cpp77
-rw-r--r--tests/benchmarks/qml/qml.pro19
-rw-r--r--tests/benchmarks/qml/qmltime/example.qml55
-rw-r--r--tests/benchmarks/qml/qmltime/linelaidout.qml62
-rw-r--r--tests/benchmarks/qml/qmltime/qmltime.cpp283
-rw-r--r--tests/benchmarks/qml/qmltime/qmltime.pro9
-rw-r--r--tests/benchmarks/qml/qmltime/tests/anchors/empty.qml75
-rw-r--r--tests/benchmarks/qml/qmltime/tests/anchors/fill.qml82
-rw-r--r--tests/benchmarks/qml/qmltime/tests/anchors/null.qml68
-rw-r--r--tests/benchmarks/qml/qmltime/tests/animation/large.qml82
-rw-r--r--tests/benchmarks/qml/qmltime/tests/animation/largeNoProps.qml82
-rw-r--r--tests/benchmarks/qml/qmltime/tests/item_creation/children.qml75
-rw-r--r--tests/benchmarks/qml/qmltime/tests/item_creation/data.qml75
-rw-r--r--tests/benchmarks/qml/qmltime/tests/item_creation/no_creation.qml53
-rw-r--r--tests/benchmarks/qml/qmltime/tests/item_creation/resources.qml75
-rw-r--r--tests/benchmarks/qml/qmltime/tests/loader/Loaded.qml48
-rw-r--r--tests/benchmarks/qml/qmltime/tests/loader/component_loader.qml57
-rw-r--r--tests/benchmarks/qml/qmltime/tests/loader/empty_loader.qml56
-rw-r--r--tests/benchmarks/qml/qmltime/tests/loader/no_loader.qml55
-rw-r--r--tests/benchmarks/qml/qmltime/tests/loader/source_loader.qml57
-rw-r--r--tests/benchmarks/qml/qmltime/tests/positioner_creation/no_positioner.qml78
-rw-r--r--tests/benchmarks/qml/qmltime/tests/positioner_creation/null_positioner.qml75
-rw-r--r--tests/benchmarks/qml/qmltime/tests/positioner_creation/positioner.qml78
-rw-r--r--tests/benchmarks/qml/qmltime/tests/vmemetaobject/null.qml54
-rw-r--r--tests/benchmarks/qml/qmltime/tests/vmemetaobject/property.qml59
-rw-r--r--tests/benchmarks/qml/qmltime/textingrid.qml73
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/myqmlobject.qml44
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/myqmlobject_binding.qml47
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/object.qml44
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/object_id.qml47
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/samegame/BoomBlock.qml112
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/blueStone.pngbin0 -> 3054 bytes
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/greenStone.pngbin0 -> 2932 bytes
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/redStone.pngbin0 -> 2902 bytes
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/yellowStone.pngbin0 -> 3056 bytes
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.2.qml56
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.qml46
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/qqmlcomponent.pro12
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/testtypes.cpp46
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/testtypes.h83
-rw-r--r--tests/benchmarks/qml/qqmlcomponent/tst_qqmlcomponent.cpp116
-rw-r--r--tests/benchmarks/qml/qqmldebugtrace/qqmldebugtrace.pro9
-rw-r--r--tests/benchmarks/qml/qqmldebugtrace/tst_qqmldebugtrace.cpp100
-rw-r--r--tests/benchmarks/qml/qqmlimage/image.pngbin0 -> 611 bytes
-rw-r--r--tests/benchmarks/qml/qqmlimage/qqmlimage.pro12
-rw-r--r--tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp108
-rw-r--r--tests/benchmarks/qml/qqmlmetaproperty/data/object.qml44
-rw-r--r--tests/benchmarks/qml/qqmlmetaproperty/data/synthesized_object.qml47
-rw-r--r--tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro11
-rw-r--r--tests/benchmarks/qml/qqmlmetaproperty/tst_qqmlmetaproperty.cpp110
-rw-r--r--tests/benchmarks/qml/qquickwindow/qquickwindow.pro11
-rw-r--r--tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp91
-rw-r--r--tests/benchmarks/qml/script/data/CustomObject.qml48
-rw-r--r--tests/benchmarks/qml/script/data/block.qml75
-rw-r--r--tests/benchmarks/qml/script/data/enums.qml51
-rw-r--r--tests/benchmarks/qml/script/data/global.js54
-rw-r--r--tests/benchmarks/qml/script/data/global_prop.qml53
-rw-r--r--tests/benchmarks/qml/script/data/namespacedEnums.qml52
-rw-r--r--tests/benchmarks/qml/script/data/script.js1
-rw-r--r--tests/benchmarks/qml/script/data/script2.js2
-rw-r--r--tests/benchmarks/qml/script/data/scriptCall.qml54
-rw-r--r--tests/benchmarks/qml/script/data/signal_args.qml47
-rw-r--r--tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml51
-rw-r--r--tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml54
-rw-r--r--tests/benchmarks/qml/script/data/signal_qml.qml47
-rw-r--r--tests/benchmarks/qml/script/data/signal_unconnected.qml45
-rw-r--r--tests/benchmarks/qml/script/data/signal_unusedArgs.qml47
-rw-r--r--tests/benchmarks/qml/script/data/slot_complex.qml57
-rw-r--r--tests/benchmarks/qml/script/data/slot_complex_js.js8
-rw-r--r--tests/benchmarks/qml/script/data/slot_complex_js.qml49
-rw-r--r--tests/benchmarks/qml/script/data/slot_simple.qml50
-rw-r--r--tests/benchmarks/qml/script/data/slot_simple_js.js3
-rw-r--r--tests/benchmarks/qml/script/data/slot_simple_js.qml48
-rw-r--r--tests/benchmarks/qml/script/script.pro12
-rw-r--r--tests/benchmarks/qml/script/tst_script.cpp852
-rw-r--r--tests/benchmarks/qml/typeimports/data/QmlTestType1.qml43
-rw-r--r--tests/benchmarks/qml/typeimports/data/QmlTestType2.qml43
-rw-r--r--tests/benchmarks/qml/typeimports/data/QmlTestType3.qml43
-rw-r--r--tests/benchmarks/qml/typeimports/data/QmlTestType4.qml43
-rw-r--r--tests/benchmarks/qml/typeimports/data/cpp.qml56
-rw-r--r--tests/benchmarks/qml/typeimports/data/qml.qml54
-rw-r--r--tests/benchmarks/qml/typeimports/tst_typeimports.cpp135
-rw-r--r--tests/benchmarks/qml/typeimports/typeimports.pro10
-rw-r--r--tests/benchmarks/script/qjsvalue/qjsvalue.pro11
-rw-r--r--tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp189
-rw-r--r--tests/benchmarks/script/script.pro4
-rw-r--r--tests/global/.gitignore2
-rw-r--r--tests/global/global.cfg5
-rw-r--r--tests/manual/accessibility/animation.qml135
-rw-r--r--tests/manual/accessibility/behavior.qml67
-rw-r--r--tests/manual/accessibility/flickable.qml53
-rw-r--r--tests/manual/accessibility/hittest.qml164
-rw-r--r--tests/manual/accessibility/numberanimation.qml76
-rw-r--r--tests/manual/accessibility/qmltestfiles.qmlproject16
-rw-r--r--tests/manual/accessibility/textandbuttons.qml94
-rw-r--r--tests/manual/accessibility/transition.qml73
-rw-r--r--tests/manual/scenegraph_lancelot/data/Ignore8
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/SimpleBorderImage.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/SimpleNoBorder.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/borderimage.qml182
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/borderimage_no_border.qml191
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/borderimage_smoothed.qml175
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_horizontal.qml76
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_vertical.qml76
-rw-r--r--tests/manual/scenegraph_lancelot/data/borderimages/borderimage_unsmoothed.qml178
-rw-r--r--tests/manual/scenegraph_lancelot/data/gradients/gradients.qml219
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/fill_mode.qml165
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/images_1.qml124
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/images_2.qml124
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/jpeg_full.qml12
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/jpeg_scaled.qml38
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_1.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_2.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_3.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_4.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_5.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_6.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_7.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_8.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_9.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/linear_smooth_1_0.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/overlap.qml58
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/tiling.qml102
-rw-r--r--tests/manual/scenegraph_lancelot/data/images/transform.qml36
-rw-r--r--tests/manual/scenegraph_lancelot/data/opacity/opacity.qml191
-rw-r--r--tests/manual/scenegraph_lancelot/data/rectangles/rectangles.qml490
-rw-r--r--tests/manual/scenegraph_lancelot/data/rectangles/rectangles_smoothed.qml586
-rw-r--r--tests/manual/scenegraph_lancelot/data/rectangles/rectangles_unsmoothed.qml586
-rw-r--r--tests/manual/scenegraph_lancelot/data/rectangles/test-rectangles.qml81
-rw-r--r--tests/manual/scenegraph_lancelot/data/rotation/rotation.qml172
-rw-r--r--tests/manual/scenegraph_lancelot/data/rotation/rotation_2.qml69
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml35
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml17
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml104
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml103
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml65
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml60
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml60
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml60
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml60
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml60
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml64
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml65
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml64
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml66
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/image/async.qml28
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/image/face-smile.pngbin0 -> 15408 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/image/source.qml26
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml44
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml44
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml68
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml68
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml53
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_1.qml31
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_2.qml31
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_3.qml30
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_4.qml30
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/nesting/nesting.qml28
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_1.qml28
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_2.qml28
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml35
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml54
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml61
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml61
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml61
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml57
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml40
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml40
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml46
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_1.qml32
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_2.qml32
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml68
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/blue_72x96.pngbin0 -> 20990 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/bw_1535x2244.jpgbin0 -> 378635 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/col320x480.jpgbin0 -> 33957 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/cyan_72x96.pngbin0 -> 20990 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/green_72x96.pngbin0 -> 20990 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/orange_72x96.pngbin0 -> 20990 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/red_72x96.pngbin0 -> 20990 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/sample_1.pngbin0 -> 28405 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/tile.pngbin0 -> 189 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/violet_72x96.pngbin0 -> 20990 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/winter.pngbin0 -> 399996 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/world.pngbin0 -> 14818 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/shared/yellow_72x96.pngbin0 -> 20990 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/data/logo.pngbin0 -> 1478 bytes
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/element_sizes.qml31
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/scale_smoothed.qml79
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_1000_chinese_characters.qml20
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_2500_chinese_characters.qml35
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_arabic.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_background_color.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_background_color_styledtext.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bengali.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bidi.qml17
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_left_elide.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_right_elide.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bidi_left_elide.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bidi_right_elide.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_bidi_underline.qml18
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_capitalization.qml47
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_chinese.qml13
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_colored_text.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_cyrillic.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_devanagari.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_floating_image_left.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_floating_image_right.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_fonts.qml104
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_georgian.qml17
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_hebrew.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml35
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_inline_image.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_italic_bold.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_italic_bold_chinese.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_khmer.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_circle.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_inline_image.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_ordered.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_alpha.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_roman.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_alpha.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_roman.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_list_square.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_multiline.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_multiline_overline.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_multiline_partial_underline.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_multiline_strikeout.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_multiline_underline.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_multiparagraph.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_overline_multisize.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_partially_colored_ligature.qml17
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_resize_glyph_cache.qml13
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_rotation_smoothed.qml144
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_rotation_unsmoothed.qml144
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_scale_unsmoothed.qml79
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_strikeout_multisize.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_style.qml56
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_style_color.qml60
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_table.qml20
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_table_inline_image.qml20
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_table_selected.qml25
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_tamil.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_thai.qml18
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_underline_merged.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_underline_merged_colored.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_underline_multisize.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_weight.qml104
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_wrap_elide.qml104
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_arabic.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_background_color.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_bidi.qml17
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_bidi_selected.qml17
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_capitalization.qml47
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_chinese.qml13
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_devanagari.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_left.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_right.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_hebrew.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_list_circle.qml14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_list_selected.qml19
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned.qml18
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected_eol.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline.qml19
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline_selected.qml23
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_hebrew_selected.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_partial_underline.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned.qml18
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned_selected.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_eol.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_long.qml21
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_overline.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_partial_underline.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_selected.qml20
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_strikeout.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_underline.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_overline_multisize.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_resize_glyph_cache.qml13
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_selected_inline_image.qml20
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_selected_ligature.qml18
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_selected_space.qml19
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_selected_space_at_eol.qml20
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_selection_color.qml22
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_strikeout_multisize.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_underline_multisize.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textedit_weight.qml104
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_arabic.qml13
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_bidi_selected.qml17
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_capitalization.qml47
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_chinese.qml15
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_cyrillic.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_devanagari.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_echomodes.qml42
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_hebrew.qml16
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_resize_glyph_cache.qml13
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_selected_ligature.qml18
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_selected_space.qml19
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/textinput_weight.qml104
-rw-r--r--tests/manual/scenegraph_lancelot/hostinfo.sh90
-rw-r--r--tests/manual/scenegraph_lancelot/scenegrabber/main.cpp203
-rw-r--r--tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro8
-rw-r--r--tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro11
-rw-r--r--tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp271
-rw-r--r--tests/manual/scenegraph_lancelot/scenegraph_lancelot.pro3
-rw-r--r--tests/manual/v4/TestExpectations (renamed from tests/TestExpectations)0
-rw-r--r--tests/manual/v4/accessors.js (renamed from tests/accessors.js)0
-rw-r--r--tests/manual/v4/array.1.js (renamed from tests/array.1.js)0
-rw-r--r--tests/manual/v4/auto/auto.pro4
-rw-r--r--tests/manual/v4/auto/executableallocator/executableallocator.pro (renamed from tests/auto/executableallocator/executableallocator.pro)0
-rw-r--r--tests/manual/v4/auto/executableallocator/tst_executableallocator.cpp (renamed from tests/auto/executableallocator/tst_executableallocator.cpp)0
-rw-r--r--tests/manual/v4/crypto.js (renamed from tests/crypto.js)0
-rw-r--r--tests/manual/v4/exceptions.1.js (renamed from tests/exceptions.1.js)0
-rw-r--r--tests/manual/v4/exceptions.2.js (renamed from tests/exceptions.2.js)0
-rw-r--r--tests/manual/v4/fact.2.js (renamed from tests/fact.2.js)0
-rw-r--r--tests/manual/v4/fact.js (renamed from tests/fact.js)0
-rw-r--r--tests/manual/v4/for/for.1.js (renamed from tests/for/for.1.js)0
-rw-r--r--tests/manual/v4/for/for.2.js (renamed from tests/for/for.2.js)0
-rw-r--r--tests/manual/v4/for/for.3.js (renamed from tests/for/for.3.js)0
-rw-r--r--tests/manual/v4/for/for.4.js (renamed from tests/for/for.4.js)0
-rw-r--r--tests/manual/v4/fun.1.js (renamed from tests/fun.1.js)0
-rw-r--r--tests/manual/v4/fun.2.js (renamed from tests/fun.2.js)0
-rw-r--r--tests/manual/v4/fun.3.js (renamed from tests/fun.3.js)0
-rw-r--r--tests/manual/v4/fun.4.js (renamed from tests/fun.4.js)0
-rw-r--r--tests/manual/v4/instanceof.1.js (renamed from tests/instanceof.1.js)0
-rw-r--r--tests/manual/v4/label.1.js (renamed from tests/label.1.js)0
-rw-r--r--tests/manual/v4/label.2.js (renamed from tests/label.2.js)0
-rw-r--r--tests/manual/v4/label.3.js (renamed from tests/label.3.js)0
-rw-r--r--tests/manual/v4/obj.1.js (renamed from tests/obj.1.js)0
-rw-r--r--tests/manual/v4/obj.2.js (renamed from tests/obj.2.js)0
-rw-r--r--tests/manual/v4/property_lookup.js (renamed from tests/property_lookup.js)0
-rw-r--r--tests/manual/v4/prototype.1.js (renamed from tests/prototype.1.js)0
-rw-r--r--tests/manual/v4/prototype.2.js (renamed from tests/prototype.2.js)0
-rw-r--r--tests/manual/v4/prototype.3.js (renamed from tests/prototype.3.js)0
-rw-r--r--tests/manual/v4/prototype.4.js (renamed from tests/prototype.4.js)0
-rw-r--r--tests/manual/v4/regexp.1.js (renamed from tests/regexp.1.js)0
-rw-r--r--tests/manual/v4/simple.2.js (renamed from tests/simple.2.js)0
-rw-r--r--tests/manual/v4/simple.js (renamed from tests/simple.js)0
-rw-r--r--tests/manual/v4/string.1.js (renamed from tests/string.1.js)0
-rw-r--r--tests/manual/v4/switch.1.js (renamed from tests/switch.1.js)0
-rw-r--r--tests/manual/v4/switch.2.js (renamed from tests/switch.2.js)0
m---------tests/manual/v4/test262 (renamed from tests/test262)0
-rwxr-xr-xtests/manual/v4/test262.py (renamed from tests/test262.py)0
-rw-r--r--tests/manual/v4/tests.pro2
-rw-r--r--tests/manual/v4/typeof.1.js (renamed from tests/typeof.1.js)0
-rw-r--r--tests/manual/v4/v8-bench.js (renamed from tests/v8-bench.js)0
-rw-r--r--tests/manual/v4/with.js (renamed from tests/with.js)0
-rw-r--r--tests/system/sys_animatedsprite.qtt122
-rw-r--r--tests/system/sys_elements.qtt118
-rw-r--r--tests/system/sys_listview.qtt289
-rw-r--r--tests/system/sys_text.qtt145
-rw-r--r--tests/system/sys_textedit.qtt218
-rw-r--r--tests/system/sys_textinput.qtt197
-rw-r--r--tests/testapplications/animatedsprite/animatedsprite.qml130
-rw-r--r--tests/testapplications/animatedsprite/animatedspriteadvance.qml201
-rw-r--r--tests/testapplications/animatedsprite/bear_black.pngbin0 -> 22508 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_brown.pngbin0 -> 22447 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_eyes_blue.pngbin0 -> 21859 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_eyes_brown.pngbin0 -> 22078 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_eyes_green.pngbin0 -> 21897 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_fur_gray.pngbin0 -> 19994 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_fur_orange.pngbin0 -> 19973 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_fur_pink.pngbin0 -> 20032 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_polar.pngbin0 -> 22272 bytes
-rw-r--r--tests/testapplications/animatedsprite/bear_tiles.pngbin0 -> 40349 bytes
-rw-r--r--tests/testapplications/elements/content/AffectorElement.qml184
-rw-r--r--tests/testapplications/elements/content/AnimatedImageElement.qml113
-rw-r--r--tests/testapplications/elements/content/AppContainer.qml71
-rw-r--r--tests/testapplications/elements/content/BorderImageElement.qml99
-rw-r--r--tests/testapplications/elements/content/BugPanel.qml57
-rw-r--r--tests/testapplications/elements/content/ColumnElement.qml88
-rw-r--r--tests/testapplications/elements/content/DirectionElement.qml127
-rw-r--r--tests/testapplications/elements/content/DoubleValidatorElement.qml126
-rw-r--r--tests/testapplications/elements/content/EmitterElement.qml107
-rw-r--r--tests/testapplications/elements/content/FlickableElement.qml137
-rw-r--r--tests/testapplications/elements/content/FlipableElement.qml107
-rw-r--r--tests/testapplications/elements/content/FlowElement.qml108
-rw-r--r--tests/testapplications/elements/content/FocusScopeElement.qml71
-rw-r--r--tests/testapplications/elements/content/FontLoaderElement.qml99
-rw-r--r--tests/testapplications/elements/content/GradientElement.qml62
-rw-r--r--tests/testapplications/elements/content/GridElement.qml97
-rw-r--r--tests/testapplications/elements/content/GridViewElement.qml128
-rw-r--r--tests/testapplications/elements/content/Help.qml52
-rw-r--r--tests/testapplications/elements/content/HelpDesk.qml58
-rw-r--r--tests/testapplications/elements/content/ImageElement.qml118
-rw-r--r--tests/testapplications/elements/content/ImageParticleElement.qml100
-rw-r--r--tests/testapplications/elements/content/IntValidatorElement.qml122
-rw-r--r--tests/testapplications/elements/content/KeysElement.qml114
-rw-r--r--tests/testapplications/elements/content/ListViewElement.qml173
-rw-r--r--tests/testapplications/elements/content/MouseAreaElement.qml154
-rw-r--r--tests/testapplications/elements/content/ParallelAnimationElement.qml100
-rw-r--r--tests/testapplications/elements/content/ParticleSystemElement.qml97
-rw-r--r--tests/testapplications/elements/content/RectangleElement.qml95
-rw-r--r--tests/testapplications/elements/content/RegExpValidatorElement.qml115
-rw-r--r--tests/testapplications/elements/content/RepeaterElement.qml99
-rw-r--r--tests/testapplications/elements/content/RowElement.qml88
-rw-r--r--tests/testapplications/elements/content/ScaleElement.qml96
-rw-r--r--tests/testapplications/elements/content/SequentialAnimationElement.qml100
-rw-r--r--tests/testapplications/elements/content/ShapeElement.qml149
-rw-r--r--tests/testapplications/elements/content/SpriteSequenceElement.qml145
-rw-r--r--tests/testapplications/elements/content/SystemPaletteElement.qml92
-rw-r--r--tests/testapplications/elements/content/SystemTestHelp.qml74
-rw-r--r--tests/testapplications/elements/content/TextEditElement.qml146
-rw-r--r--tests/testapplications/elements/content/TextElement.qml103
-rw-r--r--tests/testapplications/elements/content/TextInputElement.qml141
-rw-r--r--tests/testapplications/elements/content/TrailEmitterElement.qml165
-rw-r--r--tests/testapplications/elements/content/XmlListModelElement.qml155
-rw-r--r--tests/testapplications/elements/content/cookbook.xml62
-rw-r--r--tests/testapplications/elements/content/elements.js56
-rw-r--r--tests/testapplications/elements/content/font/Vera.ttfbin0 -> 65932 bytes
-rw-r--r--tests/testapplications/elements/content/pics/animatednokialogo.gifbin0 -> 151202 bytes
-rw-r--r--tests/testapplications/elements/content/pics/arrow.pngbin0 -> 43908 bytes
-rw-r--r--tests/testapplications/elements/content/pics/cat.gifbin0 -> 27392 bytes
-rw-r--r--tests/testapplications/elements/content/pics/logo-hollowed.pngbin0 -> 637 bytes
-rw-r--r--tests/testapplications/elements/content/pics/logo.pngbin0 -> 1478 bytes
-rw-r--r--tests/testapplications/elements/content/pics/nokialogo.gifbin0 -> 1785 bytes
-rw-r--r--tests/testapplications/elements/content/pics/qml-borderimage.pngbin0 -> 5580 bytes
-rw-r--r--tests/testapplications/elements/content/pics/smile.pngbin0 -> 15408 bytes
-rw-r--r--tests/testapplications/elements/content/pics/speech-bubble.pngbin0 -> 1864 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacesprite.pngbin0 -> 496 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacesprite2.pngbin0 -> 459 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacesprite3.pngbin0 -> 476 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacesprite4.pngbin0 -> 553 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacesprite5.pngbin0 -> 623 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacesprite6.pngbin0 -> 615 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacesprite7.pngbin0 -> 581 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacespriteX.pngbin0 -> 474 bytes
-rw-r--r--tests/testapplications/elements/content/pics/squarefacespriteXX.pngbin0 -> 255 bytes
-rw-r--r--tests/testapplications/elements/content/pics/star.pngbin0 -> 1550 bytes
-rw-r--r--tests/testapplications/elements/elements.qml72
-rw-r--r--tests/testapplications/listview/alteredViews.qml153
-rw-r--r--tests/testapplications/listview/onRemove.qml156
-rw-r--r--tests/testapplications/listview/sections.qml197
-rw-r--r--tests/testapplications/listview/star.pngbin0 -> 1550 bytes
-rw-r--r--tests/testapplications/listview/viewTransitions.qml479
-rw-r--r--tests/testapplications/qsgimage/ImageNG.qml60
-rw-r--r--tests/testapplications/qsgimage/img-align.qml133
-rw-r--r--tests/testapplications/qsgimage/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--tests/testapplications/text/Button.qml59
-rw-r--r--tests/testapplications/text/ControlView.qml65
-rw-r--r--tests/testapplications/text/text.qml310
-rw-r--r--tests/testapplications/text/textedit.qml273
-rw-r--r--tests/testapplications/text/textinput.qml345
-rw-r--r--tests/testapplications/textlayout/styledtext-layout.qml109
4747 files changed, 385985 insertions, 1 deletions
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000000..f94d5a2f13
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,18 @@
+This directory contains autotests and benchmarks based on QTestlib. In order
+to run the autotests reliably, you need to configure a desktop to match the
+test environment that these tests are written for.
+
+Linux X11:
+
+ * The user must be logged in to an active desktop; you can't run the
+ autotests without a valid DISPLAY that allows X11 connections.
+
+ * The tests are run against a KDE3 or KDE4 desktop.
+
+ * Window manager uses "click to focus", and not "focus follows mouse". Many
+ tests move the mouse cursor around and expect this to not affect focus
+ and activation.
+
+ * Disable "click to activate", i.e., when a window is opened, the window
+ manager should automatically activate it (give it input focus) and not
+ wait for the user to click the window.
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 3b189275b9..7f9281c70f 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,4 +1,11 @@
TEMPLATE=subdirs
SUBDIRS=\
- executableallocator
+ qml \
+ quick \
+ headersclean \
+ particles \
+ qmltest \
+ qmldevtools \
+ cmake
+testcocoon: SUBDIRS -= headersclean
diff --git a/tests/auto/bic/data/QtQml.5.0.0.linux-gcc-ia32.txt b/tests/auto/bic/data/QtQml.5.0.0.linux-gcc-ia32.txt
new file mode 100644
index 0000000000..a4af2ac5b2
--- /dev/null
+++ b/tests/auto/bic/data/QtQml.5.0.0.linux-gcc-ia32.txt
@@ -0,0 +1,4617 @@
+Class std::__true_type
+ size=1 align=1
+ base size=0 base align=1
+std::__true_type (0xb71e2690) 0 empty
+
+Class std::__false_type
+ size=1 align=1
+ base size=0 base align=1
+std::__false_type (0xb71e26c8) 0 empty
+
+Class std::input_iterator_tag
+ size=1 align=1
+ base size=0 base align=1
+std::input_iterator_tag (0xb5f28738) 0 empty
+
+Class std::output_iterator_tag
+ size=1 align=1
+ base size=0 base align=1
+std::output_iterator_tag (0xb5f28770) 0 empty
+
+Class std::forward_iterator_tag
+ size=1 align=1
+ base size=1 base align=1
+std::forward_iterator_tag (0xb7114b04) 0 empty
+ std::input_iterator_tag (0xb5f287a8) 0 empty
+
+Class std::bidirectional_iterator_tag
+ size=1 align=1
+ base size=1 base align=1
+std::bidirectional_iterator_tag (0xb7114b40) 0 empty
+ std::forward_iterator_tag (0xb7114b7c) 0 empty
+ std::input_iterator_tag (0xb5f287e0) 0 empty
+
+Class std::random_access_iterator_tag
+ size=1 align=1
+ base size=1 base align=1
+std::random_access_iterator_tag (0xb7114bb8) 0 empty
+ std::bidirectional_iterator_tag (0xb7114bf4) 0 empty
+ std::forward_iterator_tag (0xb7114c30) 0 empty
+ std::input_iterator_tag (0xb5f28818) 0 empty
+
+Class wait
+ size=4 align=4
+ base size=4 base align=4
+wait (0xb5f8be38) 0
+
+Class __locale_struct
+ size=116 align=4
+ base size=116 base align=4
+__locale_struct (0xb5f8bf88) 0
+
+Class timespec
+ size=8 align=4
+ base size=8 base align=4
+timespec (0xb5fd7000) 0
+
+Class timeval
+ size=8 align=4
+ base size=8 base align=4
+timeval (0xb5fd7038) 0
+
+Class __pthread_internal_slist
+ size=4 align=4
+ base size=4 base align=4
+__pthread_internal_slist (0xb5fd70e0) 0
+
+Class random_data
+ size=28 align=4
+ base size=28 base align=4
+random_data (0xb5fd73f0) 0
+
+Class drand48_data
+ size=24 align=4
+ base size=24 base align=4
+drand48_data (0xb5fd7428) 0
+
+Vtable for std::exception
+std::exception::_ZTVSt9exception: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTISt9exception)
+8 (int (*)(...))std::exception::~exception
+12 (int (*)(...))std::exception::~exception
+16 (int (*)(...))std::exception::what
+
+Class std::exception
+ size=4 align=4
+ base size=4 base align=4
+std::exception (0xb5fd7b60) 0 nearly-empty
+ vptr=((& std::exception::_ZTVSt9exception) + 8u)
+
+Vtable for std::bad_exception
+std::bad_exception::_ZTVSt13bad_exception: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTISt13bad_exception)
+8 (int (*)(...))std::bad_exception::~bad_exception
+12 (int (*)(...))std::bad_exception::~bad_exception
+16 (int (*)(...))std::bad_exception::what
+
+Class std::bad_exception
+ size=4 align=4
+ base size=4 base align=4
+std::bad_exception (0xb7114e4c) 0 nearly-empty
+ vptr=((& std::bad_exception::_ZTVSt13bad_exception) + 8u)
+ std::exception (0xb5fd7d90) 0 nearly-empty
+ primary-for std::bad_exception (0xb7114e4c)
+
+Vtable for std::bad_alloc
+std::bad_alloc::_ZTVSt9bad_alloc: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTISt9bad_alloc)
+8 (int (*)(...))std::bad_alloc::~bad_alloc
+12 (int (*)(...))std::bad_alloc::~bad_alloc
+16 (int (*)(...))std::bad_alloc::what
+
+Class std::bad_alloc
+ size=4 align=4
+ base size=4 base align=4
+std::bad_alloc (0xb7114e88) 0 nearly-empty
+ vptr=((& std::bad_alloc::_ZTVSt9bad_alloc) + 8u)
+ std::exception (0xb5fd7fc0) 0 nearly-empty
+ primary-for std::bad_alloc (0xb7114e88)
+
+Class std::nothrow_t
+ size=1 align=1
+ base size=0 base align=1
+std::nothrow_t (0xb5e55188) 0 empty
+
+Class qIsNull(double)::U
+ size=8 align=4
+ base size=8 base align=4
+qIsNull(double)::U (0xb5d36a48) 0
+
+Class qIsNull(float)::U
+ size=4 align=4
+ base size=4 base align=4
+qIsNull(float)::U (0xb5d36af0) 0
+
+Class QMessageLogContext
+ size=20 align=4
+ base size=20 base align=4
+QMessageLogContext (0xb5d36d90) 0
+
+Class QMessageLogger
+ size=20 align=4
+ base size=20 base align=4
+QMessageLogger (0xb5d52578) 0
+
+Class QtPrivate::big_
+ size=2 align=1
+ base size=2 base align=1
+QtPrivate::big_ (0xb5d69ab8) 0
+
+Class QFlag
+ size=4 align=4
+ base size=4 base align=4
+QFlag (0xb5dcd428) 0
+
+Class QIncompatibleFlag
+ size=4 align=4
+ base size=4 base align=4
+QIncompatibleFlag (0xb5dcd7a8) 0
+
+Class QSysInfo
+ size=1 align=1
+ base size=0 base align=1
+QSysInfo (0xb5dcdfc0) 0 empty
+
+Class QInternal
+ size=1 align=1
+ base size=0 base align=1
+QInternal (0xb5b16a80) 0 empty
+
+Class QGenericArgument
+ size=8 align=4
+ base size=8 base align=4
+QGenericArgument (0xb5b893f0) 0
+
+Class QGenericReturnArgument
+ size=8 align=4
+ base size=8 base align=4
+QGenericReturnArgument (0xb5b510f0) 0
+ QGenericArgument (0xb5b897e0) 0
+
+Class QMetaObject
+ size=24 align=4
+ base size=24 base align=4
+QMetaObject (0xb5b89bd0) 0
+
+Class QMetaObject::Connection
+ size=4 align=4
+ base size=4 base align=4
+QMetaObject::Connection (0xb5bacd20) 0
+
+Class QLatin1Char
+ size=1 align=1
+ base size=1 base align=1
+QLatin1Char (0xb5bb26c8) 0
+
+Class QChar
+ size=2 align=2
+ base size=2 base align=2
+QChar (0xb5bb2af0) 0
+
+Class QAtomicInt
+ size=4 align=4
+ base size=4 base align=4
+QAtomicInt (0xb5b513fc) 0
+ QBasicAtomicInteger<int> (0xb5a98a48) 0
+
+Class QtPrivate::RefCount
+ size=4 align=4
+ base size=4 base align=4
+QtPrivate::RefCount (0xb5ab2498) 0
+
+Class QArrayData
+ size=16 align=4
+ base size=16 base align=4
+QArrayData (0xb5ab2ee0) 0
+
+Class QByteArrayDataPtr
+ size=4 align=4
+ base size=4 base align=4
+QByteArrayDataPtr (0xb5ae6e70) 0
+
+Class QByteArray
+ size=4 align=4
+ base size=4 base align=4
+QByteArray (0xb5ae6ea8) 0
+
+Class QByteRef
+ size=8 align=4
+ base size=8 base align=4
+QByteRef (0xb5944658) 0
+
+Class lconv
+ size=56 align=4
+ base size=56 base align=4
+lconv (0xb59bbb60) 0
+
+Vtable for __cxxabiv1::__forced_unwind
+__cxxabiv1::__forced_unwind::_ZTVN10__cxxabiv115__forced_unwindE: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTIN10__cxxabiv115__forced_unwindE)
+8 (int (*)(...))__cxxabiv1::__forced_unwind::~__forced_unwind
+12 (int (*)(...))__cxxabiv1::__forced_unwind::~__forced_unwind
+16 (int (*)(...))__cxa_pure_virtual
+
+Class __cxxabiv1::__forced_unwind
+ size=4 align=4
+ base size=4 base align=4
+__cxxabiv1::__forced_unwind (0xb59bbc08) 0 nearly-empty
+ vptr=((& __cxxabiv1::__forced_unwind::_ZTVN10__cxxabiv115__forced_unwindE) + 8u)
+
+Class sched_param
+ size=4 align=4
+ base size=4 base align=4
+sched_param (0xb583ab98) 0
+
+Class __sched_param
+ size=4 align=4
+ base size=4 base align=4
+__sched_param (0xb583abd0) 0
+
+Class tm
+ size=44 align=4
+ base size=44 base align=4
+tm (0xb583ac78) 0
+
+Class itimerspec
+ size=16 align=4
+ base size=16 base align=4
+itimerspec (0xb583ace8) 0
+
+Class _pthread_cleanup_buffer
+ size=16 align=4
+ base size=16 base align=4
+_pthread_cleanup_buffer (0xb583ad20) 0
+
+Class __pthread_cleanup_frame
+ size=16 align=4
+ base size=16 base align=4
+__pthread_cleanup_frame (0xb583adc8) 0
+
+Class __pthread_cleanup_class
+ size=16 align=4
+ base size=16 base align=4
+__pthread_cleanup_class (0xb583ae00) 0
+
+Class QLatin1String
+ size=8 align=4
+ base size=8 base align=4
+QLatin1String (0xb577b578) 0
+
+Class QStringDataPtr
+ size=4 align=4
+ base size=4 base align=4
+QStringDataPtr (0xb560c000) 0
+
+Class QString::Null
+ size=1 align=1
+ base size=0 base align=1
+QString::Null (0xb5657e70) 0 empty
+
+Class QString
+ size=4 align=4
+ base size=4 base align=4
+QString (0xb560c038) 0
+
+Class QCharRef
+ size=8 align=4
+ base size=8 base align=4
+QCharRef (0xb56c3770) 0
+
+Class QStringRef
+ size=12 align=4
+ base size=12 base align=4
+QStringRef (0xb554a540) 0
+
+Class std::locale
+ size=4 align=4
+ base size=4 base align=4
+std::locale (0xb559c700) 0
+
+Vtable for std::locale::facet
+std::locale::facet::_ZTVNSt6locale5facetE: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTINSt6locale5facetE)
+8 (int (*)(...))std::locale::facet::~facet
+12 (int (*)(...))std::locale::facet::~facet
+
+Class std::locale::facet
+ size=8 align=4
+ base size=8 base align=4
+std::locale::facet (0xb55bda48) 0
+ vptr=((& std::locale::facet::_ZTVNSt6locale5facetE) + 8u)
+
+Class std::locale::id
+ size=4 align=4
+ base size=4 base align=4
+std::locale::id (0xb55c90e0) 0
+
+Class std::locale::_Impl
+ size=20 align=4
+ base size=20 base align=4
+std::locale::_Impl (0xb55c93f0) 0
+
+Vtable for std::ios_base::failure
+std::ios_base::failure::_ZTVNSt8ios_base7failureE: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTINSt8ios_base7failureE)
+8 (int (*)(...))std::ios_base::failure::~failure
+12 (int (*)(...))std::ios_base::failure::~failure
+16 (int (*)(...))std::ios_base::failure::what
+
+Class std::ios_base::failure
+ size=8 align=4
+ base size=8 base align=4
+std::ios_base::failure (0xb57c64ec) 0
+ vptr=((& std::ios_base::failure::_ZTVNSt8ios_base7failureE) + 8u)
+ std::exception (0xb54019a0) 0 nearly-empty
+ primary-for std::ios_base::failure (0xb57c64ec)
+
+Class std::ios_base::_Callback_list
+ size=16 align=4
+ base size=16 base align=4
+std::ios_base::_Callback_list (0xb5413a48) 0
+
+Class std::ios_base::_Words
+ size=8 align=4
+ base size=8 base align=4
+std::ios_base::_Words (0xb5413f88) 0
+
+Class std::ios_base::Init
+ size=1 align=1
+ base size=0 base align=1
+std::ios_base::Init (0xb5419310) 0 empty
+
+Vtable for std::ios_base
+std::ios_base::_ZTVSt8ios_base: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTISt8ios_base)
+8 (int (*)(...))std::ios_base::~ios_base
+12 (int (*)(...))std::ios_base::~ios_base
+
+Class std::ios_base
+ size=112 align=4
+ base size=112 base align=4
+std::ios_base (0xb5401968) 0
+ vptr=((& std::ios_base::_ZTVSt8ios_base) + 8u)
+
+Class std::ctype_base
+ size=1 align=1
+ base size=0 base align=1
+std::ctype_base (0xb544eb60) 0 empty
+
+Class std::__num_base
+ size=1 align=1
+ base size=0 base align=1
+std::__num_base (0xb54ef8c0) 0 empty
+
+VTT for std::basic_ostream<char>
+std::basic_ostream<char>::_ZTTSo: 2u entries
+0 ((& std::basic_ostream<char>::_ZTVSo) + 12u)
+4 ((& std::basic_ostream<char>::_ZTVSo) + 32u)
+
+VTT for std::basic_ostream<wchar_t>
+std::basic_ostream<wchar_t>::_ZTTSt13basic_ostreamIwSt11char_traitsIwEE: 2u entries
+0 ((& std::basic_ostream<wchar_t>::_ZTVSt13basic_ostreamIwSt11char_traitsIwEE) + 12u)
+4 ((& std::basic_ostream<wchar_t>::_ZTVSt13basic_ostreamIwSt11char_traitsIwEE) + 32u)
+
+VTT for std::basic_istream<char>
+std::basic_istream<char>::_ZTTSi: 2u entries
+0 ((& std::basic_istream<char>::_ZTVSi) + 12u)
+4 ((& std::basic_istream<char>::_ZTVSi) + 32u)
+
+VTT for std::basic_istream<wchar_t>
+std::basic_istream<wchar_t>::_ZTTSt13basic_istreamIwSt11char_traitsIwEE: 2u entries
+0 ((& std::basic_istream<wchar_t>::_ZTVSt13basic_istreamIwSt11char_traitsIwEE) + 12u)
+4 ((& std::basic_istream<wchar_t>::_ZTVSt13basic_istreamIwSt11char_traitsIwEE) + 32u)
+
+Construction vtable for std::basic_istream<char> (0xb5256078 instance) in std::basic_iostream<char>
+std::basic_iostream<char>::_ZTCSd0_Si: 10u entries
+0 12u
+4 (int (*)(...))0
+8 (int (*)(...))(& _ZTISi)
+12 (int (*)(...))std::basic_istream<_CharT, _Traits>::~basic_istream [with _CharT = char, _Traits = std::char_traits<char>]
+16 (int (*)(...))std::basic_istream<_CharT, _Traits>::~basic_istream [with _CharT = char, _Traits = std::char_traits<char>]
+20 4294967284u
+24 (int (*)(...))-0x0000000000000000c
+28 (int (*)(...))(& _ZTISi)
+32 (int (*)(...))std::basic_istream<char>::_ZTv0_n12_NSiD1Ev
+36 (int (*)(...))std::basic_istream<char>::_ZTv0_n12_NSiD0Ev
+
+Construction vtable for std::basic_ostream<char> (0xb52560f0 instance) in std::basic_iostream<char>
+std::basic_iostream<char>::_ZTCSd8_So: 10u entries
+0 4u
+4 (int (*)(...))0
+8 (int (*)(...))(& _ZTISo)
+12 (int (*)(...))std::basic_ostream<_CharT, _Traits>::~basic_ostream [with _CharT = char, _Traits = std::char_traits<char>]
+16 (int (*)(...))std::basic_ostream<_CharT, _Traits>::~basic_ostream [with _CharT = char, _Traits = std::char_traits<char>]
+20 4294967292u
+24 (int (*)(...))-0x00000000000000004
+28 (int (*)(...))(& _ZTISo)
+32 (int (*)(...))std::basic_ostream<char>::_ZTv0_n12_NSoD1Ev
+36 (int (*)(...))std::basic_ostream<char>::_ZTv0_n12_NSoD0Ev
+
+VTT for std::basic_iostream<char>
+std::basic_iostream<char>::_ZTTSd: 7u entries
+0 ((& std::basic_iostream<char>::_ZTVSd) + 12u)
+4 ((& std::basic_iostream<char>::_ZTCSd0_Si) + 12u)
+8 ((& std::basic_iostream<char>::_ZTCSd0_Si) + 32u)
+12 ((& std::basic_iostream<char>::_ZTCSd8_So) + 12u)
+16 ((& std::basic_iostream<char>::_ZTCSd8_So) + 32u)
+20 ((& std::basic_iostream<char>::_ZTVSd) + 52u)
+24 ((& std::basic_iostream<char>::_ZTVSd) + 32u)
+
+Construction vtable for std::basic_istream<wchar_t> (0xb525612c instance) in std::basic_iostream<wchar_t>
+std::basic_iostream<wchar_t>::_ZTCSt14basic_iostreamIwSt11char_traitsIwEE0_St13basic_istreamIwS1_E: 10u entries
+0 12u
+4 (int (*)(...))0
+8 (int (*)(...))(& _ZTISt13basic_istreamIwSt11char_traitsIwEE)
+12 (int (*)(...))std::basic_istream<_CharT, _Traits>::~basic_istream [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
+16 (int (*)(...))std::basic_istream<_CharT, _Traits>::~basic_istream [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
+20 4294967284u
+24 (int (*)(...))-0x0000000000000000c
+28 (int (*)(...))(& _ZTISt13basic_istreamIwSt11char_traitsIwEE)
+32 (int (*)(...))std::basic_istream<wchar_t>::_ZTv0_n12_NSt13basic_istreamIwSt11char_traitsIwEED1Ev
+36 (int (*)(...))std::basic_istream<wchar_t>::_ZTv0_n12_NSt13basic_istreamIwSt11char_traitsIwEED0Ev
+
+Construction vtable for std::basic_ostream<wchar_t> (0xb52561a4 instance) in std::basic_iostream<wchar_t>
+std::basic_iostream<wchar_t>::_ZTCSt14basic_iostreamIwSt11char_traitsIwEE8_St13basic_ostreamIwS1_E: 10u entries
+0 4u
+4 (int (*)(...))0
+8 (int (*)(...))(& _ZTISt13basic_ostreamIwSt11char_traitsIwEE)
+12 (int (*)(...))std::basic_ostream<_CharT, _Traits>::~basic_ostream [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
+16 (int (*)(...))std::basic_ostream<_CharT, _Traits>::~basic_ostream [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
+20 4294967292u
+24 (int (*)(...))-0x00000000000000004
+28 (int (*)(...))(& _ZTISt13basic_ostreamIwSt11char_traitsIwEE)
+32 (int (*)(...))std::basic_ostream<wchar_t>::_ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED1Ev
+36 (int (*)(...))std::basic_ostream<wchar_t>::_ZTv0_n12_NSt13basic_ostreamIwSt11char_traitsIwEED0Ev
+
+VTT for std::basic_iostream<wchar_t>
+std::basic_iostream<wchar_t>::_ZTTSt14basic_iostreamIwSt11char_traitsIwEE: 7u entries
+0 ((& std::basic_iostream<wchar_t>::_ZTVSt14basic_iostreamIwSt11char_traitsIwEE) + 12u)
+4 ((& std::basic_iostream<wchar_t>::_ZTCSt14basic_iostreamIwSt11char_traitsIwEE0_St13basic_istreamIwS1_E) + 12u)
+8 ((& std::basic_iostream<wchar_t>::_ZTCSt14basic_iostreamIwSt11char_traitsIwEE0_St13basic_istreamIwS1_E) + 32u)
+12 ((& std::basic_iostream<wchar_t>::_ZTCSt14basic_iostreamIwSt11char_traitsIwEE8_St13basic_ostreamIwS1_E) + 12u)
+16 ((& std::basic_iostream<wchar_t>::_ZTCSt14basic_iostreamIwSt11char_traitsIwEE8_St13basic_ostreamIwS1_E) + 32u)
+20 ((& std::basic_iostream<wchar_t>::_ZTVSt14basic_iostreamIwSt11char_traitsIwEE) + 52u)
+24 ((& std::basic_iostream<wchar_t>::_ZTVSt14basic_iostreamIwSt11char_traitsIwEE) + 32u)
+
+Class std::__detail::_List_node_base
+ size=8 align=4
+ base size=8 base align=4
+std::__detail::_List_node_base (0xb52d90e0) 0
+
+Class QListData::Data
+ size=20 align=4
+ base size=20 base align=4
+QListData::Data (0xb510db98) 0
+
+Class QListData
+ size=4 align=4
+ base size=4 base align=4
+QListData (0xb510db60) 0
+
+Class QScopedPointerPodDeleter
+ size=1 align=1
+ base size=0 base align=1
+QScopedPointerPodDeleter (0xb518dea8) 0 empty
+
+Class QMetaType
+ size=48 align=4
+ base size=48 base align=4
+QMetaType (0xb5007150) 0
+
+Class QtPrivate::QSlotObjectBase
+ size=8 align=4
+ base size=8 base align=4
+QtPrivate::QSlotObjectBase (0xb4f13578) 0
+
+Vtable for QObjectData
+QObjectData::_ZTV11QObjectData: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QObjectData)
+8 (int (*)(...))__cxa_pure_virtual
+12 (int (*)(...))__cxa_pure_virtual
+
+Class QObjectData
+ size=28 align=4
+ base size=28 base align=4
+QObjectData (0xb4f2d4d0) 0
+ vptr=((& QObjectData::_ZTV11QObjectData) + 8u)
+
+Class QObject::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QObject::QPrivateSignal (0xb4f2d738) 0 empty
+
+Vtable for QObject
+QObject::_ZTV7QObject: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI7QObject)
+8 (int (*)(...))QObject::metaObject
+12 (int (*)(...))QObject::qt_metacast
+16 (int (*)(...))QObject::qt_metacall
+20 (int (*)(...))QObject::~QObject
+24 (int (*)(...))QObject::~QObject
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QObject
+ size=8 align=4
+ base size=8 base align=4
+QObject (0xb4f2d658) 0
+ vptr=((& QObject::_ZTV7QObject) + 8u)
+
+Vtable for QObjectUserData
+QObjectUserData::_ZTV15QObjectUserData: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI15QObjectUserData)
+8 (int (*)(...))QObjectUserData::~QObjectUserData
+12 (int (*)(...))QObjectUserData::~QObjectUserData
+
+Class QObjectUserData
+ size=4 align=4
+ base size=4 base align=4
+QObjectUserData (0xb4f77850) 0 nearly-empty
+ vptr=((& QObjectUserData::_ZTV15QObjectUserData) + 8u)
+
+Class QAbstractAnimation::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractAnimation::QPrivateSignal (0xb4f77b60) 0 empty
+
+Vtable for QAbstractAnimation
+QAbstractAnimation::_ZTV18QAbstractAnimation: 18u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI18QAbstractAnimation)
+8 (int (*)(...))QAbstractAnimation::metaObject
+12 (int (*)(...))QAbstractAnimation::qt_metacast
+16 (int (*)(...))QAbstractAnimation::qt_metacall
+20 (int (*)(...))QAbstractAnimation::~QAbstractAnimation
+24 (int (*)(...))QAbstractAnimation::~QAbstractAnimation
+28 (int (*)(...))QAbstractAnimation::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+64 (int (*)(...))QAbstractAnimation::updateState
+68 (int (*)(...))QAbstractAnimation::updateDirection
+
+Class QAbstractAnimation
+ size=8 align=4
+ base size=8 base align=4
+QAbstractAnimation (0xb5256708) 0
+ vptr=((& QAbstractAnimation::_ZTV18QAbstractAnimation) + 8u)
+ QObject (0xb4f77a80) 0
+ primary-for QAbstractAnimation (0xb5256708)
+
+Class QAnimationDriver::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAnimationDriver::QPrivateSignal (0xb4f94a48) 0 empty
+
+Vtable for QAnimationDriver
+QAnimationDriver::_ZTV16QAnimationDriver: 18u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI16QAnimationDriver)
+8 (int (*)(...))QAnimationDriver::metaObject
+12 (int (*)(...))QAnimationDriver::qt_metacast
+16 (int (*)(...))QAnimationDriver::qt_metacall
+20 (int (*)(...))QAnimationDriver::~QAnimationDriver
+24 (int (*)(...))QAnimationDriver::~QAnimationDriver
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAnimationDriver::advance
+60 (int (*)(...))QAnimationDriver::elapsed
+64 (int (*)(...))QAnimationDriver::start
+68 (int (*)(...))QAnimationDriver::stop
+
+Class QAnimationDriver
+ size=8 align=4
+ base size=8 base align=4
+QAnimationDriver (0xb5256744) 0
+ vptr=((& QAnimationDriver::_ZTV16QAnimationDriver) + 8u)
+ QObject (0xb4f94968) 0
+ primary-for QAnimationDriver (0xb5256744)
+
+Class QAnimationGroup::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAnimationGroup::QPrivateSignal (0xb4faa038) 0 empty
+
+Vtable for QAnimationGroup
+QAnimationGroup::_ZTV15QAnimationGroup: 18u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI15QAnimationGroup)
+8 (int (*)(...))QAnimationGroup::metaObject
+12 (int (*)(...))QAnimationGroup::qt_metacast
+16 (int (*)(...))QAnimationGroup::qt_metacall
+20 (int (*)(...))QAnimationGroup::~QAnimationGroup
+24 (int (*)(...))QAnimationGroup::~QAnimationGroup
+28 (int (*)(...))QAnimationGroup::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+64 (int (*)(...))QAbstractAnimation::updateState
+68 (int (*)(...))QAbstractAnimation::updateDirection
+
+Class QAnimationGroup
+ size=8 align=4
+ base size=8 base align=4
+QAnimationGroup (0xb5256780) 0
+ vptr=((& QAnimationGroup::_ZTV15QAnimationGroup) + 8u)
+ QAbstractAnimation (0xb52567bc) 0
+ primary-for QAnimationGroup (0xb5256780)
+ QObject (0xb4f94fc0) 0
+ primary-for QAbstractAnimation (0xb52567bc)
+
+Class QParallelAnimationGroup::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QParallelAnimationGroup::QPrivateSignal (0xb4faaaf0) 0 empty
+
+Vtable for QParallelAnimationGroup
+QParallelAnimationGroup::_ZTV23QParallelAnimationGroup: 18u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI23QParallelAnimationGroup)
+8 (int (*)(...))QParallelAnimationGroup::metaObject
+12 (int (*)(...))QParallelAnimationGroup::qt_metacast
+16 (int (*)(...))QParallelAnimationGroup::qt_metacall
+20 (int (*)(...))QParallelAnimationGroup::~QParallelAnimationGroup
+24 (int (*)(...))QParallelAnimationGroup::~QParallelAnimationGroup
+28 (int (*)(...))QParallelAnimationGroup::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QParallelAnimationGroup::duration
+60 (int (*)(...))QParallelAnimationGroup::updateCurrentTime
+64 (int (*)(...))QParallelAnimationGroup::updateState
+68 (int (*)(...))QParallelAnimationGroup::updateDirection
+
+Class QParallelAnimationGroup
+ size=8 align=4
+ base size=8 base align=4
+QParallelAnimationGroup (0xb52567f8) 0
+ vptr=((& QParallelAnimationGroup::_ZTV23QParallelAnimationGroup) + 8u)
+ QAnimationGroup (0xb5256834) 0
+ primary-for QParallelAnimationGroup (0xb52567f8)
+ QAbstractAnimation (0xb5256870) 0
+ primary-for QAnimationGroup (0xb5256834)
+ QObject (0xb4faaa10) 0
+ primary-for QAbstractAnimation (0xb5256870)
+
+Class QPauseAnimation::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QPauseAnimation::QPrivateSignal (0xb4fb6540) 0 empty
+
+Vtable for QPauseAnimation
+QPauseAnimation::_ZTV15QPauseAnimation: 18u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI15QPauseAnimation)
+8 (int (*)(...))QPauseAnimation::metaObject
+12 (int (*)(...))QPauseAnimation::qt_metacast
+16 (int (*)(...))QPauseAnimation::qt_metacall
+20 (int (*)(...))QPauseAnimation::~QPauseAnimation
+24 (int (*)(...))QPauseAnimation::~QPauseAnimation
+28 (int (*)(...))QPauseAnimation::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QPauseAnimation::duration
+60 (int (*)(...))QPauseAnimation::updateCurrentTime
+64 (int (*)(...))QAbstractAnimation::updateState
+68 (int (*)(...))QAbstractAnimation::updateDirection
+
+Class QPauseAnimation
+ size=8 align=4
+ base size=8 base align=4
+QPauseAnimation (0xb52568ac) 0
+ vptr=((& QPauseAnimation::_ZTV15QPauseAnimation) + 8u)
+ QAbstractAnimation (0xb52568e8) 0
+ primary-for QPauseAnimation (0xb52568ac)
+ QObject (0xb4fb6460) 0
+ primary-for QAbstractAnimation (0xb52568e8)
+
+Class std::_Bit_reference
+ size=8 align=4
+ base size=8 base align=4
+std::_Bit_reference (0xb4e0c1f8) 0
+
+Class std::_Bit_iterator_base
+ size=8 align=4
+ base size=8 base align=4
+std::_Bit_iterator_base (0xb525699c) 0
+ std::iterator<std::random_access_iterator_tag, bool> (0xb4e1b0a8) 0 empty
+
+Class std::_Bit_iterator
+ size=8 align=4
+ base size=8 base align=4
+std::_Bit_iterator (0xb5256a8c) 0
+ std::_Bit_iterator_base (0xb5256ac8) 0
+ std::iterator<std::random_access_iterator_tag, bool> (0xb4e26738) 0 empty
+
+Class std::_Bit_const_iterator
+ size=8 align=4
+ base size=8 base align=4
+std::_Bit_const_iterator (0xb5256b04) 0
+ std::_Bit_iterator_base (0xb5256b40) 0
+ std::iterator<std::random_access_iterator_tag, bool> (0xb4e35118) 0 empty
+
+Class QEasingCurve
+ size=4 align=4
+ base size=4 base align=4
+QEasingCurve (0xb4ed1f18) 0
+
+Class std::_Rb_tree_node_base
+ size=16 align=4
+ base size=16 base align=4
+std::_Rb_tree_node_base (0xb4d15e38) 0
+
+Class QMapNodeBase
+ size=12 align=4
+ base size=12 base align=4
+QMapNodeBase (0xb4be0700) 0
+
+Class QMapDataBase
+ size=24 align=4
+ base size=24 base align=4
+QMapDataBase (0xb4bf3fc0) 0
+
+Class QHashData::Node
+ size=8 align=4
+ base size=8 base align=4
+QHashData::Node (0xb4c7c968) 0
+
+Class QHashData
+ size=36 align=4
+ base size=36 base align=4
+QHashData (0xb4c7c930) 0
+
+Class QHashDummyValue
+ size=1 align=1
+ base size=0 base align=1
+QHashDummyValue (0xb4c8ed90) 0 empty
+
+Class QVariant::PrivateShared
+ size=8 align=4
+ base size=8 base align=4
+QVariant::PrivateShared (0xb4b2a540) 0
+
+Class QVariant::Private::Data
+ size=8 align=4
+ base size=8 base align=4
+QVariant::Private::Data (0xb4b2a700) 0
+
+Class QVariant::Private
+ size=12 align=4
+ base size=12 base align=4
+QVariant::Private (0xb4b2a5b0) 0
+
+Class QVariant::Handler
+ size=36 align=4
+ base size=36 base align=4
+QVariant::Handler (0xb4b2ace8) 0
+
+Class QVariant
+ size=12 align=4
+ base size=12 base align=4
+QVariant (0xb4b0f1c0) 0
+
+Class QVariantComparisonHelper
+ size=4 align=4
+ base size=4 base align=4
+QVariantComparisonHelper (0xb4b821f8) 0
+
+Class QVariantAnimation::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QVariantAnimation::QPrivateSignal (0xb4b82a80) 0 empty
+
+Vtable for QVariantAnimation
+QVariantAnimation::_ZTV17QVariantAnimation: 20u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI17QVariantAnimation)
+8 (int (*)(...))QVariantAnimation::metaObject
+12 (int (*)(...))QVariantAnimation::qt_metacast
+16 (int (*)(...))QVariantAnimation::qt_metacall
+20 (int (*)(...))QVariantAnimation::~QVariantAnimation
+24 (int (*)(...))QVariantAnimation::~QVariantAnimation
+28 (int (*)(...))QVariantAnimation::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QVariantAnimation::duration
+60 (int (*)(...))QVariantAnimation::updateCurrentTime
+64 (int (*)(...))QVariantAnimation::updateState
+68 (int (*)(...))QAbstractAnimation::updateDirection
+72 (int (*)(...))QVariantAnimation::updateCurrentValue
+76 (int (*)(...))QVariantAnimation::interpolated
+
+Class QVariantAnimation
+ size=8 align=4
+ base size=8 base align=4
+QVariantAnimation (0xb5256fb4) 0
+ vptr=((& QVariantAnimation::_ZTV17QVariantAnimation) + 8u)
+ QAbstractAnimation (0xb4b92000) 0
+ primary-for QVariantAnimation (0xb5256fb4)
+ QObject (0xb4b829a0) 0
+ primary-for QAbstractAnimation (0xb4b92000)
+
+Class QPropertyAnimation::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QPropertyAnimation::QPrivateSignal (0xb4b9d770) 0 empty
+
+Vtable for QPropertyAnimation
+QPropertyAnimation::_ZTV18QPropertyAnimation: 20u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI18QPropertyAnimation)
+8 (int (*)(...))QPropertyAnimation::metaObject
+12 (int (*)(...))QPropertyAnimation::qt_metacast
+16 (int (*)(...))QPropertyAnimation::qt_metacall
+20 (int (*)(...))QPropertyAnimation::~QPropertyAnimation
+24 (int (*)(...))QPropertyAnimation::~QPropertyAnimation
+28 (int (*)(...))QPropertyAnimation::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QVariantAnimation::duration
+60 (int (*)(...))QVariantAnimation::updateCurrentTime
+64 (int (*)(...))QPropertyAnimation::updateState
+68 (int (*)(...))QAbstractAnimation::updateDirection
+72 (int (*)(...))QPropertyAnimation::updateCurrentValue
+76 (int (*)(...))QVariantAnimation::interpolated
+
+Class QPropertyAnimation
+ size=8 align=4
+ base size=8 base align=4
+QPropertyAnimation (0xb4b9203c) 0
+ vptr=((& QPropertyAnimation::_ZTV18QPropertyAnimation) + 8u)
+ QVariantAnimation (0xb4b92078) 0
+ primary-for QPropertyAnimation (0xb4b9203c)
+ QAbstractAnimation (0xb4b920b4) 0
+ primary-for QVariantAnimation (0xb4b92078)
+ QObject (0xb4b9d690) 0
+ primary-for QAbstractAnimation (0xb4b920b4)
+
+Class QSequentialAnimationGroup::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSequentialAnimationGroup::QPrivateSignal (0xb4ba8230) 0 empty
+
+Vtable for QSequentialAnimationGroup
+QSequentialAnimationGroup::_ZTV25QSequentialAnimationGroup: 18u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI25QSequentialAnimationGroup)
+8 (int (*)(...))QSequentialAnimationGroup::metaObject
+12 (int (*)(...))QSequentialAnimationGroup::qt_metacast
+16 (int (*)(...))QSequentialAnimationGroup::qt_metacall
+20 (int (*)(...))QSequentialAnimationGroup::~QSequentialAnimationGroup
+24 (int (*)(...))QSequentialAnimationGroup::~QSequentialAnimationGroup
+28 (int (*)(...))QSequentialAnimationGroup::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QSequentialAnimationGroup::duration
+60 (int (*)(...))QSequentialAnimationGroup::updateCurrentTime
+64 (int (*)(...))QSequentialAnimationGroup::updateState
+68 (int (*)(...))QSequentialAnimationGroup::updateDirection
+
+Class QSequentialAnimationGroup
+ size=8 align=4
+ base size=8 base align=4
+QSequentialAnimationGroup (0xb4b920f0) 0
+ vptr=((& QSequentialAnimationGroup::_ZTV25QSequentialAnimationGroup) + 8u)
+ QAnimationGroup (0xb4b9212c) 0
+ primary-for QSequentialAnimationGroup (0xb4b920f0)
+ QAbstractAnimation (0xb4b92168) 0
+ primary-for QAnimationGroup (0xb4b9212c)
+ QObject (0xb4ba8150) 0
+ primary-for QAbstractAnimation (0xb4b92168)
+
+Class QTextCodec::ConverterState
+ size=28 align=4
+ base size=28 base align=4
+QTextCodec::ConverterState (0xb4bb7658) 0
+
+Vtable for QTextCodec
+QTextCodec::_ZTV10QTextCodec: 9u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QTextCodec)
+8 (int (*)(...))__cxa_pure_virtual
+12 (int (*)(...))QTextCodec::aliases
+16 (int (*)(...))__cxa_pure_virtual
+20 (int (*)(...))__cxa_pure_virtual
+24 (int (*)(...))__cxa_pure_virtual
+28 (int (*)(...))QTextCodec::~QTextCodec
+32 (int (*)(...))QTextCodec::~QTextCodec
+
+Class QTextCodec
+ size=4 align=4
+ base size=4 base align=4
+QTextCodec (0xb4ba8cb0) 0 nearly-empty
+ vptr=((& QTextCodec::_ZTV10QTextCodec) + 8u)
+
+Class QTextEncoder
+ size=32 align=4
+ base size=32 base align=4
+QTextEncoder (0xb4bd81f8) 0
+
+Class QTextDecoder
+ size=32 align=4
+ base size=32 base align=4
+QTextDecoder (0xb4bd8738) 0
+
+Class QSharedData
+ size=4 align=4
+ base size=4 base align=4
+QSharedData (0xb49e9968) 0
+
+Class QtSharedPointer::NormalDeleter
+ size=1 align=1
+ base size=0 base align=1
+QtSharedPointer::NormalDeleter (0xb4a02c40) 0 empty
+
+Class QtSharedPointer::ExternalRefCountData
+ size=12 align=4
+ base size=12 base align=4
+QtSharedPointer::ExternalRefCountData (0xb4a02d20) 0
+
+Class std::__numeric_limits_base
+ size=1 align=1
+ base size=0 base align=1
+std::__numeric_limits_base (0xb4a74508) 0 empty
+
+Class QDate
+ size=8 align=4
+ base size=8 base align=4
+QDate (0xb4acf7e0) 0
+
+Class QTime
+ size=4 align=4
+ base size=4 base align=4
+QTime (0xb48c53f0) 0
+
+Class QDateTime
+ size=4 align=4
+ base size=4 base align=4
+QDateTime (0xb48d27a8) 0
+
+Class QLibraryInfo
+ size=1 align=1
+ base size=0 base align=1
+QLibraryInfo (0xb48dd9d8) 0 empty
+
+Class QIODevice::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QIODevice::QPrivateSignal (0xb48f8150) 0 empty
+
+Vtable for QIODevice
+QIODevice::_ZTV9QIODevice: 30u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI9QIODevice)
+8 (int (*)(...))QIODevice::metaObject
+12 (int (*)(...))QIODevice::qt_metacast
+16 (int (*)(...))QIODevice::qt_metacall
+20 (int (*)(...))QIODevice::~QIODevice
+24 (int (*)(...))QIODevice::~QIODevice
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QIODevice::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QIODevice::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QIODevice::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QIODevice::bytesAvailable
+92 (int (*)(...))QIODevice::bytesToWrite
+96 (int (*)(...))QIODevice::canReadLine
+100 (int (*)(...))QIODevice::waitForReadyRead
+104 (int (*)(...))QIODevice::waitForBytesWritten
+108 (int (*)(...))__cxa_pure_virtual
+112 (int (*)(...))QIODevice::readLineData
+116 (int (*)(...))__cxa_pure_virtual
+
+Class QIODevice
+ size=8 align=4
+ base size=8 base align=4
+QIODevice (0xb4b92294) 0
+ vptr=((& QIODevice::_ZTV9QIODevice) + 8u)
+ QObject (0xb48f8070) 0
+ primary-for QIODevice (0xb4b92294)
+
+Class QBuffer::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QBuffer::QPrivateSignal (0xb4913bd0) 0 empty
+
+Vtable for QBuffer
+QBuffer::_ZTV7QBuffer: 30u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI7QBuffer)
+8 (int (*)(...))QBuffer::metaObject
+12 (int (*)(...))QBuffer::qt_metacast
+16 (int (*)(...))QBuffer::qt_metacall
+20 (int (*)(...))QBuffer::~QBuffer
+24 (int (*)(...))QBuffer::~QBuffer
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QBuffer::connectNotify
+52 (int (*)(...))QBuffer::disconnectNotify
+56 (int (*)(...))QIODevice::isSequential
+60 (int (*)(...))QBuffer::open
+64 (int (*)(...))QBuffer::close
+68 (int (*)(...))QBuffer::pos
+72 (int (*)(...))QBuffer::size
+76 (int (*)(...))QBuffer::seek
+80 (int (*)(...))QBuffer::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QIODevice::bytesAvailable
+92 (int (*)(...))QIODevice::bytesToWrite
+96 (int (*)(...))QBuffer::canReadLine
+100 (int (*)(...))QIODevice::waitForReadyRead
+104 (int (*)(...))QIODevice::waitForBytesWritten
+108 (int (*)(...))QBuffer::readData
+112 (int (*)(...))QIODevice::readLineData
+116 (int (*)(...))QBuffer::writeData
+
+Class QBuffer
+ size=8 align=4
+ base size=8 base align=4
+QBuffer (0xb4b9230c) 0
+ vptr=((& QBuffer::_ZTV7QBuffer) + 8u)
+ QIODevice (0xb4b92348) 0
+ primary-for QBuffer (0xb4b9230c)
+ QObject (0xb4913af0) 0
+ primary-for QIODevice (0xb4b92348)
+
+Class QDataStream
+ size=24 align=4
+ base size=24 base align=4
+QDataStream (0xb4927428) 0
+
+Class QLocale
+ size=4 align=4
+ base size=4 base align=4
+QLocale (0xb4944b28) 0
+
+Class _IO_marker
+ size=12 align=4
+ base size=12 base align=4
+_IO_marker (0xb49adab8) 0
+
+Class _IO_FILE
+ size=148 align=4
+ base size=148 base align=4
+_IO_FILE (0xb49adaf0) 0
+
+Vtable for QTextStream
+QTextStream::_ZTV11QTextStream: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QTextStream)
+8 (int (*)(...))QTextStream::~QTextStream
+12 (int (*)(...))QTextStream::~QTextStream
+
+Class QTextStream
+ size=8 align=4
+ base size=8 base align=4
+QTextStream (0xb49adb60) 0
+ vptr=((& QTextStream::_ZTV11QTextStream) + 8u)
+
+Class QTextStreamManipulator
+ size=24 align=4
+ base size=22 base align=4
+QTextStreamManipulator (0xb47ebd90) 0
+
+Class QContiguousCacheData
+ size=24 align=4
+ base size=24 base align=4
+QContiguousCacheData (0xb483b7e0) 0
+
+Class QDebug::Stream
+ size=44 align=4
+ base size=44 base align=4
+QDebug::Stream (0xb4869428) 0
+
+Class QDebug
+ size=4 align=4
+ base size=4 base align=4
+QDebug (0xb48693f0) 0
+
+Class QNoDebug
+ size=1 align=1
+ base size=0 base align=1
+QNoDebug (0xb46b2b98) 0 empty
+
+Class QFileDevice::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QFileDevice::QPrivateSignal (0xb46c56c8) 0 empty
+
+Vtable for QFileDevice
+QFileDevice::_ZTV11QFileDevice: 34u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QFileDevice)
+8 (int (*)(...))QFileDevice::metaObject
+12 (int (*)(...))QFileDevice::qt_metacast
+16 (int (*)(...))QFileDevice::qt_metacall
+20 (int (*)(...))QFileDevice::~QFileDevice
+24 (int (*)(...))QFileDevice::~QFileDevice
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QFileDevice::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QFileDevice::close
+68 (int (*)(...))QFileDevice::pos
+72 (int (*)(...))QFileDevice::size
+76 (int (*)(...))QFileDevice::seek
+80 (int (*)(...))QFileDevice::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QIODevice::bytesAvailable
+92 (int (*)(...))QIODevice::bytesToWrite
+96 (int (*)(...))QIODevice::canReadLine
+100 (int (*)(...))QIODevice::waitForReadyRead
+104 (int (*)(...))QIODevice::waitForBytesWritten
+108 (int (*)(...))QFileDevice::readData
+112 (int (*)(...))QFileDevice::readLineData
+116 (int (*)(...))QFileDevice::writeData
+120 (int (*)(...))QFileDevice::fileName
+124 (int (*)(...))QFileDevice::resize
+128 (int (*)(...))QFileDevice::permissions
+132 (int (*)(...))QFileDevice::setPermissions
+
+Class QFileDevice
+ size=8 align=4
+ base size=8 base align=4
+QFileDevice (0xb4b924ec) 0
+ vptr=((& QFileDevice::_ZTV11QFileDevice) + 8u)
+ QIODevice (0xb4b92528) 0
+ primary-for QFileDevice (0xb4b924ec)
+ QObject (0xb46c55e8) 0
+ primary-for QIODevice (0xb4b92528)
+
+Class QFile::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QFile::QPrivateSignal (0xb46ff1f8) 0 empty
+
+Vtable for QFile
+QFile::_ZTV5QFile: 34u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI5QFile)
+8 (int (*)(...))QFile::metaObject
+12 (int (*)(...))QFile::qt_metacast
+16 (int (*)(...))QFile::qt_metacall
+20 (int (*)(...))QFile::~QFile
+24 (int (*)(...))QFile::~QFile
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QFileDevice::isSequential
+60 (int (*)(...))QFile::open
+64 (int (*)(...))QFileDevice::close
+68 (int (*)(...))QFileDevice::pos
+72 (int (*)(...))QFile::size
+76 (int (*)(...))QFileDevice::seek
+80 (int (*)(...))QFileDevice::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QIODevice::bytesAvailable
+92 (int (*)(...))QIODevice::bytesToWrite
+96 (int (*)(...))QIODevice::canReadLine
+100 (int (*)(...))QIODevice::waitForReadyRead
+104 (int (*)(...))QIODevice::waitForBytesWritten
+108 (int (*)(...))QFileDevice::readData
+112 (int (*)(...))QFileDevice::readLineData
+116 (int (*)(...))QFileDevice::writeData
+120 (int (*)(...))QFile::fileName
+124 (int (*)(...))QFile::resize
+128 (int (*)(...))QFile::permissions
+132 (int (*)(...))QFile::setPermissions
+
+Class QFile
+ size=8 align=4
+ base size=8 base align=4
+QFile (0xb4b925a0) 0
+ vptr=((& QFile::_ZTV5QFile) + 8u)
+ QFileDevice (0xb4b925dc) 0
+ primary-for QFile (0xb4b925a0)
+ QIODevice (0xb4b92618) 0
+ primary-for QFileDevice (0xb4b925dc)
+ QObject (0xb46ff118) 0
+ primary-for QIODevice (0xb4b92618)
+
+Class QFileInfo
+ size=4 align=4
+ base size=4 base align=4
+QFileInfo (0xb4718150) 0
+
+Class QRegExp
+ size=4 align=4
+ base size=4 base align=4
+QRegExp (0xb4718f50) 0
+
+Class QStringMatcher::Data
+ size=264 align=4
+ base size=264 base align=4
+QStringMatcher::Data (0xb473cb60) 0
+
+Class QStringMatcher
+ size=1036 align=4
+ base size=1036 base align=4
+QStringMatcher (0xb473c850) 0
+
+Class QStringList
+ size=4 align=4
+ base size=4 base align=4
+QStringList (0xb4b926cc) 0
+ QList<QString> (0xb473ce00) 0
+
+Class QDir
+ size=4 align=4
+ base size=4 base align=4
+QDir (0xb476f9a0) 0
+
+Class QDirIterator
+ size=4 align=4
+ base size=4 base align=4
+QDirIterator (0xb45c5658) 0
+
+Class QFileSystemWatcher::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QFileSystemWatcher::QPrivateSignal (0xb45dad58) 0 empty
+
+Vtable for QFileSystemWatcher
+QFileSystemWatcher::_ZTV18QFileSystemWatcher: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI18QFileSystemWatcher)
+8 (int (*)(...))QFileSystemWatcher::metaObject
+12 (int (*)(...))QFileSystemWatcher::qt_metacast
+16 (int (*)(...))QFileSystemWatcher::qt_metacall
+20 (int (*)(...))QFileSystemWatcher::~QFileSystemWatcher
+24 (int (*)(...))QFileSystemWatcher::~QFileSystemWatcher
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QFileSystemWatcher
+ size=8 align=4
+ base size=8 base align=4
+QFileSystemWatcher (0xb4b92834) 0
+ vptr=((& QFileSystemWatcher::_ZTV18QFileSystemWatcher) + 8u)
+ QObject (0xb45dac78) 0
+ primary-for QFileSystemWatcher (0xb4b92834)
+
+Class QProcessEnvironment
+ size=4 align=4
+ base size=4 base align=4
+QProcessEnvironment (0xb45ed310) 0
+
+Class QProcess::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QProcess::QPrivateSignal (0xb45edcb0) 0 empty
+
+Vtable for QProcess
+QProcess::_ZTV8QProcess: 31u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI8QProcess)
+8 (int (*)(...))QProcess::metaObject
+12 (int (*)(...))QProcess::qt_metacast
+16 (int (*)(...))QProcess::qt_metacall
+20 (int (*)(...))QProcess::~QProcess
+24 (int (*)(...))QProcess::~QProcess
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QProcess::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QProcess::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QProcess::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QProcess::bytesAvailable
+92 (int (*)(...))QProcess::bytesToWrite
+96 (int (*)(...))QProcess::canReadLine
+100 (int (*)(...))QProcess::waitForReadyRead
+104 (int (*)(...))QProcess::waitForBytesWritten
+108 (int (*)(...))QProcess::readData
+112 (int (*)(...))QIODevice::readLineData
+116 (int (*)(...))QProcess::writeData
+120 (int (*)(...))QProcess::setupChildProcess
+
+Class QProcess
+ size=8 align=4
+ base size=8 base align=4
+QProcess (0xb4b92870) 0
+ vptr=((& QProcess::_ZTV8QProcess) + 8u)
+ QIODevice (0xb4b928ac) 0
+ primary-for QProcess (0xb4b92870)
+ QObject (0xb45edbd0) 0
+ primary-for QIODevice (0xb4b928ac)
+
+Class QResource
+ size=4 align=4
+ base size=4 base align=4
+QResource (0xb4619230) 0
+
+Class QSettings::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSettings::QPrivateSignal (0xb46198c0) 0 empty
+
+Vtable for QSettings
+QSettings::_ZTV9QSettings: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI9QSettings)
+8 (int (*)(...))QSettings::metaObject
+12 (int (*)(...))QSettings::qt_metacast
+16 (int (*)(...))QSettings::qt_metacall
+20 (int (*)(...))QSettings::~QSettings
+24 (int (*)(...))QSettings::~QSettings
+28 (int (*)(...))QSettings::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QSettings
+ size=8 align=4
+ base size=8 base align=4
+QSettings (0xb4b928e8) 0
+ vptr=((& QSettings::_ZTV9QSettings) + 8u)
+ QObject (0xb46197e0) 0
+ primary-for QSettings (0xb4b928e8)
+
+Class QStandardPaths
+ size=1 align=1
+ base size=0 base align=1
+QStandardPaths (0xb46348c0) 0 empty
+
+Class QTemporaryDir
+ size=4 align=4
+ base size=4 base align=4
+QTemporaryDir (0xb4634e70) 0
+
+Class QTemporaryFile::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QTemporaryFile::QPrivateSignal (0xb464d1f8) 0 empty
+
+Vtable for QTemporaryFile
+QTemporaryFile::_ZTV14QTemporaryFile: 34u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI14QTemporaryFile)
+8 (int (*)(...))QTemporaryFile::metaObject
+12 (int (*)(...))QTemporaryFile::qt_metacast
+16 (int (*)(...))QTemporaryFile::qt_metacall
+20 (int (*)(...))QTemporaryFile::~QTemporaryFile
+24 (int (*)(...))QTemporaryFile::~QTemporaryFile
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QFileDevice::isSequential
+60 (int (*)(...))QTemporaryFile::open
+64 (int (*)(...))QFileDevice::close
+68 (int (*)(...))QFileDevice::pos
+72 (int (*)(...))QFile::size
+76 (int (*)(...))QFileDevice::seek
+80 (int (*)(...))QFileDevice::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QIODevice::bytesAvailable
+92 (int (*)(...))QIODevice::bytesToWrite
+96 (int (*)(...))QIODevice::canReadLine
+100 (int (*)(...))QIODevice::waitForReadyRead
+104 (int (*)(...))QIODevice::waitForBytesWritten
+108 (int (*)(...))QFileDevice::readData
+112 (int (*)(...))QFileDevice::readLineData
+116 (int (*)(...))QFileDevice::writeData
+120 (int (*)(...))QTemporaryFile::fileName
+124 (int (*)(...))QFile::resize
+128 (int (*)(...))QFile::permissions
+132 (int (*)(...))QFile::setPermissions
+
+Class QTemporaryFile
+ size=8 align=4
+ base size=8 base align=4
+QTemporaryFile (0xb4b92960) 0
+ vptr=((& QTemporaryFile::_ZTV14QTemporaryFile) + 8u)
+ QFile (0xb4b9299c) 0
+ primary-for QTemporaryFile (0xb4b92960)
+ QFileDevice (0xb4b929d8) 0
+ primary-for QFile (0xb4b9299c)
+ QIODevice (0xb4b92a14) 0
+ primary-for QFileDevice (0xb4b929d8)
+ QObject (0xb464d118) 0
+ primary-for QIODevice (0xb4b92a14)
+
+Class QUrl
+ size=4 align=4
+ base size=4 base align=4
+QUrl (0xb4659850) 0
+
+Class QUrlQuery
+ size=4 align=4
+ base size=4 base align=4
+QUrlQuery (0xb44c0578) 0
+
+Class QModelIndex
+ size=16 align=4
+ base size=16 base align=4
+QModelIndex (0xb44ea428) 0
+
+Class QPersistentModelIndex
+ size=4 align=4
+ base size=4 base align=4
+QPersistentModelIndex (0xb44fd658) 0
+
+Class QAbstractItemModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractItemModel::QPrivateSignal (0xb450c1c0) 0 empty
+
+Vtable for QAbstractItemModel
+QAbstractItemModel::_ZTV18QAbstractItemModel: 48u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI18QAbstractItemModel)
+8 (int (*)(...))QAbstractItemModel::metaObject
+12 (int (*)(...))QAbstractItemModel::qt_metacast
+16 (int (*)(...))QAbstractItemModel::qt_metacall
+20 (int (*)(...))QAbstractItemModel::~QAbstractItemModel
+24 (int (*)(...))QAbstractItemModel::~QAbstractItemModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+64 (int (*)(...))QAbstractItemModel::sibling
+68 (int (*)(...))__cxa_pure_virtual
+72 (int (*)(...))__cxa_pure_virtual
+76 (int (*)(...))QAbstractItemModel::hasChildren
+80 (int (*)(...))__cxa_pure_virtual
+84 (int (*)(...))QAbstractItemModel::setData
+88 (int (*)(...))QAbstractItemModel::headerData
+92 (int (*)(...))QAbstractItemModel::setHeaderData
+96 (int (*)(...))QAbstractItemModel::itemData
+100 (int (*)(...))QAbstractItemModel::setItemData
+104 (int (*)(...))QAbstractItemModel::mimeTypes
+108 (int (*)(...))QAbstractItemModel::mimeData
+112 (int (*)(...))QAbstractItemModel::canDropMimeData
+116 (int (*)(...))QAbstractItemModel::dropMimeData
+120 (int (*)(...))QAbstractItemModel::supportedDropActions
+124 (int (*)(...))QAbstractItemModel::supportedDragActions
+128 (int (*)(...))QAbstractItemModel::insertRows
+132 (int (*)(...))QAbstractItemModel::insertColumns
+136 (int (*)(...))QAbstractItemModel::removeRows
+140 (int (*)(...))QAbstractItemModel::removeColumns
+144 (int (*)(...))QAbstractItemModel::moveRows
+148 (int (*)(...))QAbstractItemModel::moveColumns
+152 (int (*)(...))QAbstractItemModel::fetchMore
+156 (int (*)(...))QAbstractItemModel::canFetchMore
+160 (int (*)(...))QAbstractItemModel::flags
+164 (int (*)(...))QAbstractItemModel::sort
+168 (int (*)(...))QAbstractItemModel::buddy
+172 (int (*)(...))QAbstractItemModel::match
+176 (int (*)(...))QAbstractItemModel::span
+180 (int (*)(...))QAbstractItemModel::roleNames
+184 (int (*)(...))QAbstractItemModel::submit
+188 (int (*)(...))QAbstractItemModel::revert
+
+Class QAbstractItemModel
+ size=8 align=4
+ base size=8 base align=4
+QAbstractItemModel (0xb4b92b04) 0
+ vptr=((& QAbstractItemModel::_ZTV18QAbstractItemModel) + 8u)
+ QObject (0xb450c0e0) 0
+ primary-for QAbstractItemModel (0xb4b92b04)
+
+Class QAbstractTableModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractTableModel::QPrivateSignal (0xb455ae38) 0 empty
+
+Vtable for QAbstractTableModel
+QAbstractTableModel::_ZTV19QAbstractTableModel: 48u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI19QAbstractTableModel)
+8 (int (*)(...))QAbstractTableModel::metaObject
+12 (int (*)(...))QAbstractTableModel::qt_metacast
+16 (int (*)(...))QAbstractTableModel::qt_metacall
+20 (int (*)(...))QAbstractTableModel::~QAbstractTableModel
+24 (int (*)(...))QAbstractTableModel::~QAbstractTableModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAbstractTableModel::index
+60 (int (*)(...))QAbstractTableModel::parent
+64 (int (*)(...))QAbstractItemModel::sibling
+68 (int (*)(...))__cxa_pure_virtual
+72 (int (*)(...))__cxa_pure_virtual
+76 (int (*)(...))QAbstractTableModel::hasChildren
+80 (int (*)(...))__cxa_pure_virtual
+84 (int (*)(...))QAbstractItemModel::setData
+88 (int (*)(...))QAbstractItemModel::headerData
+92 (int (*)(...))QAbstractItemModel::setHeaderData
+96 (int (*)(...))QAbstractItemModel::itemData
+100 (int (*)(...))QAbstractItemModel::setItemData
+104 (int (*)(...))QAbstractItemModel::mimeTypes
+108 (int (*)(...))QAbstractItemModel::mimeData
+112 (int (*)(...))QAbstractItemModel::canDropMimeData
+116 (int (*)(...))QAbstractTableModel::dropMimeData
+120 (int (*)(...))QAbstractItemModel::supportedDropActions
+124 (int (*)(...))QAbstractItemModel::supportedDragActions
+128 (int (*)(...))QAbstractItemModel::insertRows
+132 (int (*)(...))QAbstractItemModel::insertColumns
+136 (int (*)(...))QAbstractItemModel::removeRows
+140 (int (*)(...))QAbstractItemModel::removeColumns
+144 (int (*)(...))QAbstractItemModel::moveRows
+148 (int (*)(...))QAbstractItemModel::moveColumns
+152 (int (*)(...))QAbstractItemModel::fetchMore
+156 (int (*)(...))QAbstractItemModel::canFetchMore
+160 (int (*)(...))QAbstractItemModel::flags
+164 (int (*)(...))QAbstractItemModel::sort
+168 (int (*)(...))QAbstractItemModel::buddy
+172 (int (*)(...))QAbstractItemModel::match
+176 (int (*)(...))QAbstractItemModel::span
+180 (int (*)(...))QAbstractItemModel::roleNames
+184 (int (*)(...))QAbstractItemModel::submit
+188 (int (*)(...))QAbstractItemModel::revert
+
+Class QAbstractTableModel
+ size=8 align=4
+ base size=8 base align=4
+QAbstractTableModel (0xb4b92c30) 0
+ vptr=((& QAbstractTableModel::_ZTV19QAbstractTableModel) + 8u)
+ QAbstractItemModel (0xb4b92c6c) 0
+ primary-for QAbstractTableModel (0xb4b92c30)
+ QObject (0xb455ad58) 0
+ primary-for QAbstractItemModel (0xb4b92c6c)
+
+Class QAbstractListModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractListModel::QPrivateSignal (0xb4568540) 0 empty
+
+Vtable for QAbstractListModel
+QAbstractListModel::_ZTV18QAbstractListModel: 48u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI18QAbstractListModel)
+8 (int (*)(...))QAbstractListModel::metaObject
+12 (int (*)(...))QAbstractListModel::qt_metacast
+16 (int (*)(...))QAbstractListModel::qt_metacall
+20 (int (*)(...))QAbstractListModel::~QAbstractListModel
+24 (int (*)(...))QAbstractListModel::~QAbstractListModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAbstractListModel::index
+60 (int (*)(...))QAbstractListModel::parent
+64 (int (*)(...))QAbstractItemModel::sibling
+68 (int (*)(...))__cxa_pure_virtual
+72 (int (*)(...))QAbstractListModel::columnCount
+76 (int (*)(...))QAbstractListModel::hasChildren
+80 (int (*)(...))__cxa_pure_virtual
+84 (int (*)(...))QAbstractItemModel::setData
+88 (int (*)(...))QAbstractItemModel::headerData
+92 (int (*)(...))QAbstractItemModel::setHeaderData
+96 (int (*)(...))QAbstractItemModel::itemData
+100 (int (*)(...))QAbstractItemModel::setItemData
+104 (int (*)(...))QAbstractItemModel::mimeTypes
+108 (int (*)(...))QAbstractItemModel::mimeData
+112 (int (*)(...))QAbstractItemModel::canDropMimeData
+116 (int (*)(...))QAbstractListModel::dropMimeData
+120 (int (*)(...))QAbstractItemModel::supportedDropActions
+124 (int (*)(...))QAbstractItemModel::supportedDragActions
+128 (int (*)(...))QAbstractItemModel::insertRows
+132 (int (*)(...))QAbstractItemModel::insertColumns
+136 (int (*)(...))QAbstractItemModel::removeRows
+140 (int (*)(...))QAbstractItemModel::removeColumns
+144 (int (*)(...))QAbstractItemModel::moveRows
+148 (int (*)(...))QAbstractItemModel::moveColumns
+152 (int (*)(...))QAbstractItemModel::fetchMore
+156 (int (*)(...))QAbstractItemModel::canFetchMore
+160 (int (*)(...))QAbstractItemModel::flags
+164 (int (*)(...))QAbstractItemModel::sort
+168 (int (*)(...))QAbstractItemModel::buddy
+172 (int (*)(...))QAbstractItemModel::match
+176 (int (*)(...))QAbstractItemModel::span
+180 (int (*)(...))QAbstractItemModel::roleNames
+184 (int (*)(...))QAbstractItemModel::submit
+188 (int (*)(...))QAbstractItemModel::revert
+
+Class QAbstractListModel
+ size=8 align=4
+ base size=8 base align=4
+QAbstractListModel (0xb4b92ca8) 0
+ vptr=((& QAbstractListModel::_ZTV18QAbstractListModel) + 8u)
+ QAbstractItemModel (0xb4b92ce4) 0
+ primary-for QAbstractListModel (0xb4b92ca8)
+ QObject (0xb4568460) 0
+ primary-for QAbstractItemModel (0xb4b92ce4)
+
+Class QAbstractProxyModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractProxyModel::QPrivateSignal (0xb457a690) 0 empty
+
+Vtable for QAbstractProxyModel
+QAbstractProxyModel::_ZTV19QAbstractProxyModel: 53u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI19QAbstractProxyModel)
+8 (int (*)(...))QAbstractProxyModel::metaObject
+12 (int (*)(...))QAbstractProxyModel::qt_metacast
+16 (int (*)(...))QAbstractProxyModel::qt_metacall
+20 (int (*)(...))QAbstractProxyModel::~QAbstractProxyModel
+24 (int (*)(...))QAbstractProxyModel::~QAbstractProxyModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+64 (int (*)(...))QAbstractProxyModel::sibling
+68 (int (*)(...))__cxa_pure_virtual
+72 (int (*)(...))__cxa_pure_virtual
+76 (int (*)(...))QAbstractProxyModel::hasChildren
+80 (int (*)(...))QAbstractProxyModel::data
+84 (int (*)(...))QAbstractProxyModel::setData
+88 (int (*)(...))QAbstractProxyModel::headerData
+92 (int (*)(...))QAbstractProxyModel::setHeaderData
+96 (int (*)(...))QAbstractProxyModel::itemData
+100 (int (*)(...))QAbstractProxyModel::setItemData
+104 (int (*)(...))QAbstractProxyModel::mimeTypes
+108 (int (*)(...))QAbstractProxyModel::mimeData
+112 (int (*)(...))QAbstractItemModel::canDropMimeData
+116 (int (*)(...))QAbstractItemModel::dropMimeData
+120 (int (*)(...))QAbstractProxyModel::supportedDropActions
+124 (int (*)(...))QAbstractItemModel::supportedDragActions
+128 (int (*)(...))QAbstractItemModel::insertRows
+132 (int (*)(...))QAbstractItemModel::insertColumns
+136 (int (*)(...))QAbstractItemModel::removeRows
+140 (int (*)(...))QAbstractItemModel::removeColumns
+144 (int (*)(...))QAbstractItemModel::moveRows
+148 (int (*)(...))QAbstractItemModel::moveColumns
+152 (int (*)(...))QAbstractProxyModel::fetchMore
+156 (int (*)(...))QAbstractProxyModel::canFetchMore
+160 (int (*)(...))QAbstractProxyModel::flags
+164 (int (*)(...))QAbstractProxyModel::sort
+168 (int (*)(...))QAbstractProxyModel::buddy
+172 (int (*)(...))QAbstractItemModel::match
+176 (int (*)(...))QAbstractProxyModel::span
+180 (int (*)(...))QAbstractItemModel::roleNames
+184 (int (*)(...))QAbstractProxyModel::submit
+188 (int (*)(...))QAbstractProxyModel::revert
+192 (int (*)(...))QAbstractProxyModel::setSourceModel
+196 (int (*)(...))__cxa_pure_virtual
+200 (int (*)(...))__cxa_pure_virtual
+204 (int (*)(...))QAbstractProxyModel::mapSelectionToSource
+208 (int (*)(...))QAbstractProxyModel::mapSelectionFromSource
+
+Class QAbstractProxyModel
+ size=8 align=4
+ base size=8 base align=4
+QAbstractProxyModel (0xb4b92d20) 0
+ vptr=((& QAbstractProxyModel::_ZTV19QAbstractProxyModel) + 8u)
+ QAbstractItemModel (0xb4b92d5c) 0
+ primary-for QAbstractProxyModel (0xb4b92d20)
+ QObject (0xb457a5b0) 0
+ primary-for QAbstractItemModel (0xb4b92d5c)
+
+Class QIdentityProxyModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QIdentityProxyModel::QPrivateSignal (0xb4591038) 0 empty
+
+Vtable for QIdentityProxyModel
+QIdentityProxyModel::_ZTV19QIdentityProxyModel: 53u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI19QIdentityProxyModel)
+8 (int (*)(...))QIdentityProxyModel::metaObject
+12 (int (*)(...))QIdentityProxyModel::qt_metacast
+16 (int (*)(...))QIdentityProxyModel::qt_metacall
+20 (int (*)(...))QIdentityProxyModel::~QIdentityProxyModel
+24 (int (*)(...))QIdentityProxyModel::~QIdentityProxyModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QIdentityProxyModel::index
+60 (int (*)(...))QIdentityProxyModel::parent
+64 (int (*)(...))QIdentityProxyModel::sibling
+68 (int (*)(...))QIdentityProxyModel::rowCount
+72 (int (*)(...))QIdentityProxyModel::columnCount
+76 (int (*)(...))QAbstractProxyModel::hasChildren
+80 (int (*)(...))QAbstractProxyModel::data
+84 (int (*)(...))QAbstractProxyModel::setData
+88 (int (*)(...))QIdentityProxyModel::headerData
+92 (int (*)(...))QAbstractProxyModel::setHeaderData
+96 (int (*)(...))QAbstractProxyModel::itemData
+100 (int (*)(...))QAbstractProxyModel::setItemData
+104 (int (*)(...))QAbstractProxyModel::mimeTypes
+108 (int (*)(...))QAbstractProxyModel::mimeData
+112 (int (*)(...))QAbstractItemModel::canDropMimeData
+116 (int (*)(...))QIdentityProxyModel::dropMimeData
+120 (int (*)(...))QAbstractProxyModel::supportedDropActions
+124 (int (*)(...))QAbstractItemModel::supportedDragActions
+128 (int (*)(...))QIdentityProxyModel::insertRows
+132 (int (*)(...))QIdentityProxyModel::insertColumns
+136 (int (*)(...))QIdentityProxyModel::removeRows
+140 (int (*)(...))QIdentityProxyModel::removeColumns
+144 (int (*)(...))QAbstractItemModel::moveRows
+148 (int (*)(...))QAbstractItemModel::moveColumns
+152 (int (*)(...))QAbstractProxyModel::fetchMore
+156 (int (*)(...))QAbstractProxyModel::canFetchMore
+160 (int (*)(...))QAbstractProxyModel::flags
+164 (int (*)(...))QAbstractProxyModel::sort
+168 (int (*)(...))QAbstractProxyModel::buddy
+172 (int (*)(...))QIdentityProxyModel::match
+176 (int (*)(...))QAbstractProxyModel::span
+180 (int (*)(...))QAbstractItemModel::roleNames
+184 (int (*)(...))QAbstractProxyModel::submit
+188 (int (*)(...))QAbstractProxyModel::revert
+192 (int (*)(...))QIdentityProxyModel::setSourceModel
+196 (int (*)(...))QIdentityProxyModel::mapToSource
+200 (int (*)(...))QIdentityProxyModel::mapFromSource
+204 (int (*)(...))QIdentityProxyModel::mapSelectionToSource
+208 (int (*)(...))QIdentityProxyModel::mapSelectionFromSource
+
+Class QIdentityProxyModel
+ size=8 align=4
+ base size=8 base align=4
+QIdentityProxyModel (0xb4b92d98) 0
+ vptr=((& QIdentityProxyModel::_ZTV19QIdentityProxyModel) + 8u)
+ QAbstractProxyModel (0xb4b92dd4) 0
+ primary-for QIdentityProxyModel (0xb4b92d98)
+ QAbstractItemModel (0xb4b92e10) 0
+ primary-for QAbstractProxyModel (0xb4b92dd4)
+ QObject (0xb457af88) 0
+ primary-for QAbstractItemModel (0xb4b92e10)
+
+Class QItemSelectionRange
+ size=8 align=4
+ base size=8 base align=4
+QItemSelectionRange (0xb45919d8) 0
+
+Class QItemSelectionModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QItemSelectionModel::QPrivateSignal (0xb43ba690) 0 empty
+
+Vtable for QItemSelectionModel
+QItemSelectionModel::_ZTV19QItemSelectionModel: 20u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI19QItemSelectionModel)
+8 (int (*)(...))QItemSelectionModel::metaObject
+12 (int (*)(...))QItemSelectionModel::qt_metacast
+16 (int (*)(...))QItemSelectionModel::qt_metacall
+20 (int (*)(...))QItemSelectionModel::~QItemSelectionModel
+24 (int (*)(...))QItemSelectionModel::~QItemSelectionModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QItemSelectionModel::setCurrentIndex
+60 (int (*)(...))QItemSelectionModel::select
+64 (int (*)(...))QItemSelectionModel::select
+68 (int (*)(...))QItemSelectionModel::clear
+72 (int (*)(...))QItemSelectionModel::reset
+76 (int (*)(...))QItemSelectionModel::clearCurrentIndex
+
+Class QItemSelectionModel
+ size=8 align=4
+ base size=8 base align=4
+QItemSelectionModel (0xb4b92e4c) 0
+ vptr=((& QItemSelectionModel::_ZTV19QItemSelectionModel) + 8u)
+ QObject (0xb43ba5b0) 0
+ primary-for QItemSelectionModel (0xb4b92e4c)
+
+Class QItemSelection
+ size=4 align=4
+ base size=4 base align=4
+QItemSelection (0xb4b92ec4) 0
+ QList<QItemSelectionRange> (0xb43e12a0) 0
+
+Class QSortFilterProxyModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSortFilterProxyModel::QPrivateSignal (0xb43e1658) 0 empty
+
+Vtable for QSortFilterProxyModel
+QSortFilterProxyModel::_ZTV21QSortFilterProxyModel: 56u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI21QSortFilterProxyModel)
+8 (int (*)(...))QSortFilterProxyModel::metaObject
+12 (int (*)(...))QSortFilterProxyModel::qt_metacast
+16 (int (*)(...))QSortFilterProxyModel::qt_metacall
+20 (int (*)(...))QSortFilterProxyModel::~QSortFilterProxyModel
+24 (int (*)(...))QSortFilterProxyModel::~QSortFilterProxyModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QSortFilterProxyModel::index
+60 (int (*)(...))QSortFilterProxyModel::parent
+64 (int (*)(...))QSortFilterProxyModel::sibling
+68 (int (*)(...))QSortFilterProxyModel::rowCount
+72 (int (*)(...))QSortFilterProxyModel::columnCount
+76 (int (*)(...))QSortFilterProxyModel::hasChildren
+80 (int (*)(...))QSortFilterProxyModel::data
+84 (int (*)(...))QSortFilterProxyModel::setData
+88 (int (*)(...))QSortFilterProxyModel::headerData
+92 (int (*)(...))QSortFilterProxyModel::setHeaderData
+96 (int (*)(...))QAbstractProxyModel::itemData
+100 (int (*)(...))QAbstractProxyModel::setItemData
+104 (int (*)(...))QSortFilterProxyModel::mimeTypes
+108 (int (*)(...))QSortFilterProxyModel::mimeData
+112 (int (*)(...))QAbstractItemModel::canDropMimeData
+116 (int (*)(...))QSortFilterProxyModel::dropMimeData
+120 (int (*)(...))QSortFilterProxyModel::supportedDropActions
+124 (int (*)(...))QAbstractItemModel::supportedDragActions
+128 (int (*)(...))QSortFilterProxyModel::insertRows
+132 (int (*)(...))QSortFilterProxyModel::insertColumns
+136 (int (*)(...))QSortFilterProxyModel::removeRows
+140 (int (*)(...))QSortFilterProxyModel::removeColumns
+144 (int (*)(...))QAbstractItemModel::moveRows
+148 (int (*)(...))QAbstractItemModel::moveColumns
+152 (int (*)(...))QSortFilterProxyModel::fetchMore
+156 (int (*)(...))QSortFilterProxyModel::canFetchMore
+160 (int (*)(...))QSortFilterProxyModel::flags
+164 (int (*)(...))QSortFilterProxyModel::sort
+168 (int (*)(...))QSortFilterProxyModel::buddy
+172 (int (*)(...))QSortFilterProxyModel::match
+176 (int (*)(...))QSortFilterProxyModel::span
+180 (int (*)(...))QAbstractItemModel::roleNames
+184 (int (*)(...))QAbstractProxyModel::submit
+188 (int (*)(...))QAbstractProxyModel::revert
+192 (int (*)(...))QSortFilterProxyModel::setSourceModel
+196 (int (*)(...))QSortFilterProxyModel::mapToSource
+200 (int (*)(...))QSortFilterProxyModel::mapFromSource
+204 (int (*)(...))QSortFilterProxyModel::mapSelectionToSource
+208 (int (*)(...))QSortFilterProxyModel::mapSelectionFromSource
+212 (int (*)(...))QSortFilterProxyModel::filterAcceptsRow
+216 (int (*)(...))QSortFilterProxyModel::filterAcceptsColumn
+220 (int (*)(...))QSortFilterProxyModel::lessThan
+
+Class QSortFilterProxyModel
+ size=8 align=4
+ base size=8 base align=4
+QSortFilterProxyModel (0xb4b92f00) 0
+ vptr=((& QSortFilterProxyModel::_ZTV21QSortFilterProxyModel) + 8u)
+ QAbstractProxyModel (0xb4b92f3c) 0
+ primary-for QSortFilterProxyModel (0xb4b92f00)
+ QAbstractItemModel (0xb4b92f78) 0
+ primary-for QAbstractProxyModel (0xb4b92f3c)
+ QObject (0xb43e1578) 0
+ primary-for QAbstractItemModel (0xb4b92f78)
+
+Class QStringListModel::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QStringListModel::QPrivateSignal (0xb44110e0) 0 empty
+
+Vtable for QStringListModel
+QStringListModel::_ZTV16QStringListModel: 48u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI16QStringListModel)
+8 (int (*)(...))QStringListModel::metaObject
+12 (int (*)(...))QStringListModel::qt_metacast
+16 (int (*)(...))QStringListModel::qt_metacall
+20 (int (*)(...))QStringListModel::~QStringListModel
+24 (int (*)(...))QStringListModel::~QStringListModel
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAbstractListModel::index
+60 (int (*)(...))QAbstractListModel::parent
+64 (int (*)(...))QStringListModel::sibling
+68 (int (*)(...))QStringListModel::rowCount
+72 (int (*)(...))QAbstractListModel::columnCount
+76 (int (*)(...))QAbstractListModel::hasChildren
+80 (int (*)(...))QStringListModel::data
+84 (int (*)(...))QStringListModel::setData
+88 (int (*)(...))QAbstractItemModel::headerData
+92 (int (*)(...))QAbstractItemModel::setHeaderData
+96 (int (*)(...))QAbstractItemModel::itemData
+100 (int (*)(...))QAbstractItemModel::setItemData
+104 (int (*)(...))QAbstractItemModel::mimeTypes
+108 (int (*)(...))QAbstractItemModel::mimeData
+112 (int (*)(...))QAbstractItemModel::canDropMimeData
+116 (int (*)(...))QAbstractListModel::dropMimeData
+120 (int (*)(...))QStringListModel::supportedDropActions
+124 (int (*)(...))QAbstractItemModel::supportedDragActions
+128 (int (*)(...))QStringListModel::insertRows
+132 (int (*)(...))QAbstractItemModel::insertColumns
+136 (int (*)(...))QStringListModel::removeRows
+140 (int (*)(...))QAbstractItemModel::removeColumns
+144 (int (*)(...))QAbstractItemModel::moveRows
+148 (int (*)(...))QAbstractItemModel::moveColumns
+152 (int (*)(...))QAbstractItemModel::fetchMore
+156 (int (*)(...))QAbstractItemModel::canFetchMore
+160 (int (*)(...))QStringListModel::flags
+164 (int (*)(...))QStringListModel::sort
+168 (int (*)(...))QAbstractItemModel::buddy
+172 (int (*)(...))QAbstractItemModel::match
+176 (int (*)(...))QAbstractItemModel::span
+180 (int (*)(...))QAbstractItemModel::roleNames
+184 (int (*)(...))QAbstractItemModel::submit
+188 (int (*)(...))QAbstractItemModel::revert
+
+Class QStringListModel
+ size=12 align=4
+ base size=12 base align=4
+QStringListModel (0xb4b92fb4) 0
+ vptr=((& QStringListModel::_ZTV16QStringListModel) + 8u)
+ QAbstractListModel (0xb4410000) 0
+ primary-for QStringListModel (0xb4b92fb4)
+ QAbstractItemModel (0xb441003c) 0
+ primary-for QAbstractListModel (0xb4410000)
+ QObject (0xb4411000) 0
+ primary-for QAbstractItemModel (0xb441003c)
+
+Class QJsonValue
+ size=16 align=4
+ base size=16 base align=4
+QJsonValue (0xb4411738) 0
+
+Class QJsonValueRef
+ size=8 align=4
+ base size=8 base align=4
+QJsonValueRef (0xb4429ab8) 0
+
+Class QJsonArray::iterator
+ size=8 align=4
+ base size=8 base align=4
+QJsonArray::iterator (0xb4445690) 0
+
+Class QJsonArray::const_iterator
+ size=8 align=4
+ base size=8 base align=4
+QJsonArray::const_iterator (0xb4451578) 0
+
+Class QJsonArray
+ size=8 align=4
+ base size=8 base align=4
+QJsonArray (0xb4445188) 0
+
+Class QJsonParseError
+ size=8 align=4
+ base size=8 base align=4
+QJsonParseError (0xb447b930) 0
+
+Class QJsonDocument
+ size=4 align=4
+ base size=4 base align=4
+QJsonDocument (0xb447ba10) 0
+
+Class QJsonObject::iterator
+ size=8 align=4
+ base size=8 base align=4
+QJsonObject::iterator (0xb44837a8) 0
+
+Class QJsonObject::const_iterator
+ size=8 align=4
+ base size=8 base align=4
+QJsonObject::const_iterator (0xb448f188) 0
+
+Class QJsonObject
+ size=8 align=4
+ base size=8 base align=4
+QJsonObject (0xb4483348) 0
+
+Class QEventLoop::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QEventLoop::QPrivateSignal (0xb42b2c40) 0 empty
+
+Vtable for QEventLoop
+QEventLoop::_ZTV10QEventLoop: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QEventLoop)
+8 (int (*)(...))QEventLoop::metaObject
+12 (int (*)(...))QEventLoop::qt_metacast
+16 (int (*)(...))QEventLoop::qt_metacall
+20 (int (*)(...))QEventLoop::~QEventLoop
+24 (int (*)(...))QEventLoop::~QEventLoop
+28 (int (*)(...))QEventLoop::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QEventLoop
+ size=8 align=4
+ base size=8 base align=4
+QEventLoop (0xb4410078) 0
+ vptr=((& QEventLoop::_ZTV10QEventLoop) + 8u)
+ QObject (0xb42b2b60) 0
+ primary-for QEventLoop (0xb4410078)
+
+Class QEventLoopLocker
+ size=4 align=4
+ base size=4 base align=4
+QEventLoopLocker (0xb42d31c0) 0
+
+Class QAbstractEventDispatcher::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractEventDispatcher::QPrivateSignal (0xb42d35b0) 0 empty
+
+Class QAbstractEventDispatcher::TimerInfo
+ size=12 align=4
+ base size=12 base align=4
+QAbstractEventDispatcher::TimerInfo (0xb42d35e8) 0
+
+Vtable for QAbstractEventDispatcher
+QAbstractEventDispatcher::_ZTV24QAbstractEventDispatcher: 28u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI24QAbstractEventDispatcher)
+8 (int (*)(...))QAbstractEventDispatcher::metaObject
+12 (int (*)(...))QAbstractEventDispatcher::qt_metacast
+16 (int (*)(...))QAbstractEventDispatcher::qt_metacall
+20 (int (*)(...))QAbstractEventDispatcher::~QAbstractEventDispatcher
+24 (int (*)(...))QAbstractEventDispatcher::~QAbstractEventDispatcher
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+64 (int (*)(...))__cxa_pure_virtual
+68 (int (*)(...))__cxa_pure_virtual
+72 (int (*)(...))__cxa_pure_virtual
+76 (int (*)(...))__cxa_pure_virtual
+80 (int (*)(...))__cxa_pure_virtual
+84 (int (*)(...))__cxa_pure_virtual
+88 (int (*)(...))__cxa_pure_virtual
+92 (int (*)(...))__cxa_pure_virtual
+96 (int (*)(...))__cxa_pure_virtual
+100 (int (*)(...))__cxa_pure_virtual
+104 (int (*)(...))QAbstractEventDispatcher::startingUp
+108 (int (*)(...))QAbstractEventDispatcher::closingDown
+
+Class QAbstractEventDispatcher
+ size=8 align=4
+ base size=8 base align=4
+QAbstractEventDispatcher (0xb441012c) 0
+ vptr=((& QAbstractEventDispatcher::_ZTV24QAbstractEventDispatcher) + 8u)
+ QObject (0xb42d34d0) 0
+ primary-for QAbstractEventDispatcher (0xb441012c)
+
+Vtable for QAbstractNativeEventFilter
+QAbstractNativeEventFilter::_ZTV26QAbstractNativeEventFilter: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI26QAbstractNativeEventFilter)
+8 (int (*)(...))QAbstractNativeEventFilter::~QAbstractNativeEventFilter
+12 (int (*)(...))QAbstractNativeEventFilter::~QAbstractNativeEventFilter
+16 (int (*)(...))__cxa_pure_virtual
+
+Class QAbstractNativeEventFilter
+ size=8 align=4
+ base size=8 base align=4
+QAbstractNativeEventFilter (0xb42e4118) 0
+ vptr=((& QAbstractNativeEventFilter::_ZTV26QAbstractNativeEventFilter) + 8u)
+
+Class QBasicTimer
+ size=4 align=4
+ base size=4 base align=4
+QBasicTimer (0xb42e43f0) 0
+
+Vtable for QEvent
+QEvent::_ZTV6QEvent: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI6QEvent)
+8 (int (*)(...))QEvent::~QEvent
+12 (int (*)(...))QEvent::~QEvent
+
+Class QEvent
+ size=12 align=4
+ base size=12 base align=4
+QEvent (0xb42e4b98) 0
+ vptr=((& QEvent::_ZTV6QEvent) + 8u)
+
+Vtable for QTimerEvent
+QTimerEvent::_ZTV11QTimerEvent: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QTimerEvent)
+8 (int (*)(...))QTimerEvent::~QTimerEvent
+12 (int (*)(...))QTimerEvent::~QTimerEvent
+
+Class QTimerEvent
+ size=16 align=4
+ base size=16 base align=4
+QTimerEvent (0xb441021c) 0
+ vptr=((& QTimerEvent::_ZTV11QTimerEvent) + 8u)
+ QEvent (0xb42f8738) 0
+ primary-for QTimerEvent (0xb441021c)
+
+Vtable for QChildEvent
+QChildEvent::_ZTV11QChildEvent: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QChildEvent)
+8 (int (*)(...))QChildEvent::~QChildEvent
+12 (int (*)(...))QChildEvent::~QChildEvent
+
+Class QChildEvent
+ size=16 align=4
+ base size=16 base align=4
+QChildEvent (0xb4410258) 0
+ vptr=((& QChildEvent::_ZTV11QChildEvent) + 8u)
+ QEvent (0xb42f88f8) 0
+ primary-for QChildEvent (0xb4410258)
+
+Vtable for QDynamicPropertyChangeEvent
+QDynamicPropertyChangeEvent::_ZTV27QDynamicPropertyChangeEvent: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI27QDynamicPropertyChangeEvent)
+8 (int (*)(...))QDynamicPropertyChangeEvent::~QDynamicPropertyChangeEvent
+12 (int (*)(...))QDynamicPropertyChangeEvent::~QDynamicPropertyChangeEvent
+
+Class QDynamicPropertyChangeEvent
+ size=16 align=4
+ base size=16 base align=4
+QDynamicPropertyChangeEvent (0xb4410294) 0
+ vptr=((& QDynamicPropertyChangeEvent::_ZTV27QDynamicPropertyChangeEvent) + 8u)
+ QEvent (0xb42f8f18) 0
+ primary-for QDynamicPropertyChangeEvent (0xb4410294)
+
+Vtable for QDeferredDeleteEvent
+QDeferredDeleteEvent::_ZTV20QDeferredDeleteEvent: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI20QDeferredDeleteEvent)
+8 (int (*)(...))QDeferredDeleteEvent::~QDeferredDeleteEvent
+12 (int (*)(...))QDeferredDeleteEvent::~QDeferredDeleteEvent
+
+Class QDeferredDeleteEvent
+ size=16 align=4
+ base size=16 base align=4
+QDeferredDeleteEvent (0xb44102d0) 0
+ vptr=((& QDeferredDeleteEvent::_ZTV20QDeferredDeleteEvent) + 8u)
+ QEvent (0xb4308000) 0
+ primary-for QDeferredDeleteEvent (0xb44102d0)
+
+Class QCoreApplication::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QCoreApplication::QPrivateSignal (0xb43082a0) 0 empty
+
+Vtable for QCoreApplication
+QCoreApplication::_ZTV16QCoreApplication: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI16QCoreApplication)
+8 (int (*)(...))QCoreApplication::metaObject
+12 (int (*)(...))QCoreApplication::qt_metacast
+16 (int (*)(...))QCoreApplication::qt_metacall
+20 (int (*)(...))QCoreApplication::~QCoreApplication
+24 (int (*)(...))QCoreApplication::~QCoreApplication
+28 (int (*)(...))QCoreApplication::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QCoreApplication::notify
+60 (int (*)(...))QCoreApplication::compressEvent
+
+Class QCoreApplication
+ size=8 align=4
+ base size=8 base align=4
+QCoreApplication (0xb441030c) 0
+ vptr=((& QCoreApplication::_ZTV16QCoreApplication) + 8u)
+ QObject (0xb43081c0) 0
+ primary-for QCoreApplication (0xb441030c)
+
+Class __exception
+ size=32 align=4
+ base size=32 base align=4
+__exception (0xb431d2d8) 0
+
+Class QMetaMethod
+ size=8 align=4
+ base size=8 base align=4
+QMetaMethod (0xb431da10) 0
+
+Class QMetaEnum
+ size=8 align=4
+ base size=8 base align=4
+QMetaEnum (0xb4364e00) 0
+
+Class QMetaProperty
+ size=20 align=4
+ base size=20 base align=4
+QMetaProperty (0xb436f2a0) 0
+
+Class QMetaClassInfo
+ size=8 align=4
+ base size=8 base align=4
+QMetaClassInfo (0xb436f540) 0
+
+Class QMimeData::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QMimeData::QPrivateSignal (0xb436f9d8) 0 empty
+
+Vtable for QMimeData
+QMimeData::_ZTV9QMimeData: 17u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI9QMimeData)
+8 (int (*)(...))QMimeData::metaObject
+12 (int (*)(...))QMimeData::qt_metacast
+16 (int (*)(...))QMimeData::qt_metacall
+20 (int (*)(...))QMimeData::~QMimeData
+24 (int (*)(...))QMimeData::~QMimeData
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QMimeData::hasFormat
+60 (int (*)(...))QMimeData::formats
+64 (int (*)(...))QMimeData::retrieveData
+
+Class QMimeData
+ size=8 align=4
+ base size=8 base align=4
+QMimeData (0xb4410348) 0
+ vptr=((& QMimeData::_ZTV9QMimeData) + 8u)
+ QObject (0xb436f8f8) 0
+ primary-for QMimeData (0xb4410348)
+
+Class QObjectCleanupHandler::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QObjectCleanupHandler::QPrivateSignal (0xb4387188) 0 empty
+
+Vtable for QObjectCleanupHandler
+QObjectCleanupHandler::_ZTV21QObjectCleanupHandler: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI21QObjectCleanupHandler)
+8 (int (*)(...))QObjectCleanupHandler::metaObject
+12 (int (*)(...))QObjectCleanupHandler::qt_metacast
+16 (int (*)(...))QObjectCleanupHandler::qt_metacall
+20 (int (*)(...))QObjectCleanupHandler::~QObjectCleanupHandler
+24 (int (*)(...))QObjectCleanupHandler::~QObjectCleanupHandler
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QObjectCleanupHandler
+ size=12 align=4
+ base size=12 base align=4
+QObjectCleanupHandler (0xb4410384) 0
+ vptr=((& QObjectCleanupHandler::_ZTV21QObjectCleanupHandler) + 8u)
+ QObject (0xb43870a8) 0
+ primary-for QObjectCleanupHandler (0xb4410384)
+
+Class QSharedMemory::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSharedMemory::QPrivateSignal (0xb43985e8) 0 empty
+
+Vtable for QSharedMemory
+QSharedMemory::_ZTV13QSharedMemory: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QSharedMemory)
+8 (int (*)(...))QSharedMemory::metaObject
+12 (int (*)(...))QSharedMemory::qt_metacast
+16 (int (*)(...))QSharedMemory::qt_metacall
+20 (int (*)(...))QSharedMemory::~QSharedMemory
+24 (int (*)(...))QSharedMemory::~QSharedMemory
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QSharedMemory
+ size=8 align=4
+ base size=8 base align=4
+QSharedMemory (0xb44103fc) 0
+ vptr=((& QSharedMemory::_ZTV13QSharedMemory) + 8u)
+ QObject (0xb4398508) 0
+ primary-for QSharedMemory (0xb44103fc)
+
+Class QSignalMapper::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSignalMapper::QPrivateSignal (0xb41b3038) 0 empty
+
+Vtable for QSignalMapper
+QSignalMapper::_ZTV13QSignalMapper: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QSignalMapper)
+8 (int (*)(...))QSignalMapper::metaObject
+12 (int (*)(...))QSignalMapper::qt_metacast
+16 (int (*)(...))QSignalMapper::qt_metacall
+20 (int (*)(...))QSignalMapper::~QSignalMapper
+24 (int (*)(...))QSignalMapper::~QSignalMapper
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QSignalMapper
+ size=8 align=4
+ base size=8 base align=4
+QSignalMapper (0xb4410438) 0
+ vptr=((& QSignalMapper::_ZTV13QSignalMapper) + 8u)
+ QObject (0xb4398f88) 0
+ primary-for QSignalMapper (0xb4410438)
+
+Class QSocketNotifier::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSocketNotifier::QPrivateSignal (0xb41b3d20) 0 empty
+
+Vtable for QSocketNotifier
+QSocketNotifier::_ZTV15QSocketNotifier: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI15QSocketNotifier)
+8 (int (*)(...))QSocketNotifier::metaObject
+12 (int (*)(...))QSocketNotifier::qt_metacast
+16 (int (*)(...))QSocketNotifier::qt_metacall
+20 (int (*)(...))QSocketNotifier::~QSocketNotifier
+24 (int (*)(...))QSocketNotifier::~QSocketNotifier
+28 (int (*)(...))QSocketNotifier::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QSocketNotifier
+ size=8 align=4
+ base size=8 base align=4
+QSocketNotifier (0xb4410474) 0
+ vptr=((& QSocketNotifier::_ZTV15QSocketNotifier) + 8u)
+ QObject (0xb41b3c40) 0
+ primary-for QSocketNotifier (0xb4410474)
+
+Class QSystemSemaphore
+ size=4 align=4
+ base size=4 base align=4
+QSystemSemaphore (0xb41c1508) 0
+
+Class QTimer::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QTimer::QPrivateSignal (0xb41c1af0) 0 empty
+
+Vtable for QTimer
+QTimer::_ZTV6QTimer: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI6QTimer)
+8 (int (*)(...))QTimer::metaObject
+12 (int (*)(...))QTimer::qt_metacast
+16 (int (*)(...))QTimer::qt_metacall
+20 (int (*)(...))QTimer::~QTimer
+24 (int (*)(...))QTimer::~QTimer
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QTimer::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QTimer
+ size=24 align=4
+ base size=21 base align=4
+QTimer (0xb44104ec) 0
+ vptr=((& QTimer::_ZTV6QTimer) + 8u)
+ QObject (0xb41c1a10) 0
+ primary-for QTimer (0xb44104ec)
+
+Class QTranslator::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QTranslator::QPrivateSignal (0xb41dc8f8) 0 empty
+
+Vtable for QTranslator
+QTranslator::_ZTV11QTranslator: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QTranslator)
+8 (int (*)(...))QTranslator::metaObject
+12 (int (*)(...))QTranslator::qt_metacast
+16 (int (*)(...))QTranslator::qt_metacall
+20 (int (*)(...))QTranslator::~QTranslator
+24 (int (*)(...))QTranslator::~QTranslator
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QTranslator::translate
+60 (int (*)(...))QTranslator::isEmpty
+
+Class QTranslator
+ size=8 align=4
+ base size=8 base align=4
+QTranslator (0xb4410528) 0
+ vptr=((& QTranslator::_ZTV11QTranslator) + 8u)
+ QObject (0xb41dc818) 0
+ primary-for QTranslator (0xb4410528)
+
+Class QMimeType
+ size=4 align=4
+ base size=4 base align=4
+QMimeType (0xb41e8188) 0
+
+Class QMimeDatabase
+ size=4 align=4
+ base size=4 base align=4
+QMimeDatabase (0xb41e8968) 0
+
+Vtable for QFactoryInterface
+QFactoryInterface::_ZTV17QFactoryInterface: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI17QFactoryInterface)
+8 (int (*)(...))QFactoryInterface::~QFactoryInterface
+12 (int (*)(...))QFactoryInterface::~QFactoryInterface
+16 (int (*)(...))__cxa_pure_virtual
+
+Class QFactoryInterface
+ size=4 align=4
+ base size=4 base align=4
+QFactoryInterface (0xb41e8d58) 0 nearly-empty
+ vptr=((& QFactoryInterface::_ZTV17QFactoryInterface) + 8u)
+
+Class QLibrary::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QLibrary::QPrivateSignal (0xb42071c0) 0 empty
+
+Vtable for QLibrary
+QLibrary::_ZTV8QLibrary: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI8QLibrary)
+8 (int (*)(...))QLibrary::metaObject
+12 (int (*)(...))QLibrary::qt_metacast
+16 (int (*)(...))QLibrary::qt_metacall
+20 (int (*)(...))QLibrary::~QLibrary
+24 (int (*)(...))QLibrary::~QLibrary
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QLibrary
+ size=16 align=4
+ base size=13 base align=4
+QLibrary (0xb4410618) 0
+ vptr=((& QLibrary::_ZTV8QLibrary) + 8u)
+ QObject (0xb42070e0) 0
+ primary-for QLibrary (0xb4410618)
+
+Class QStaticPlugin
+ size=8 align=4
+ base size=8 base align=4
+QStaticPlugin (0xb421a850) 0
+
+Class QPluginLoader::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QPluginLoader::QPrivateSignal (0xb421a968) 0 empty
+
+Vtable for QPluginLoader
+QPluginLoader::_ZTV13QPluginLoader: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QPluginLoader)
+8 (int (*)(...))QPluginLoader::metaObject
+12 (int (*)(...))QPluginLoader::qt_metacast
+16 (int (*)(...))QPluginLoader::qt_metacall
+20 (int (*)(...))QPluginLoader::~QPluginLoader
+24 (int (*)(...))QPluginLoader::~QPluginLoader
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QPluginLoader
+ size=16 align=4
+ base size=13 base align=4
+QPluginLoader (0xb4410690) 0
+ vptr=((& QPluginLoader::_ZTV13QPluginLoader) + 8u)
+ QObject (0xb421a888) 0
+ primary-for QPluginLoader (0xb4410690)
+
+Class QUuid
+ size=16 align=4
+ base size=16 base align=4
+QUuid (0xb4232070) 0
+
+Class QAbstractState::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractState::QPrivateSignal (0xb4242508) 0 empty
+
+Vtable for QAbstractState
+QAbstractState::_ZTV14QAbstractState: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI14QAbstractState)
+8 (int (*)(...))QAbstractState::metaObject
+12 (int (*)(...))QAbstractState::qt_metacast
+16 (int (*)(...))QAbstractState::qt_metacall
+20 (int (*)(...))QAbstractState::~QAbstractState
+24 (int (*)(...))QAbstractState::~QAbstractState
+28 (int (*)(...))QAbstractState::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+
+Class QAbstractState
+ size=8 align=4
+ base size=8 base align=4
+QAbstractState (0xb44106cc) 0
+ vptr=((& QAbstractState::_ZTV14QAbstractState) + 8u)
+ QObject (0xb4242428) 0
+ primary-for QAbstractState (0xb44106cc)
+
+Class QAbstractTransition::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractTransition::QPrivateSignal (0xb4242d58) 0 empty
+
+Vtable for QAbstractTransition
+QAbstractTransition::_ZTV19QAbstractTransition: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI19QAbstractTransition)
+8 (int (*)(...))QAbstractTransition::metaObject
+12 (int (*)(...))QAbstractTransition::qt_metacast
+16 (int (*)(...))QAbstractTransition::qt_metacall
+20 (int (*)(...))QAbstractTransition::~QAbstractTransition
+24 (int (*)(...))QAbstractTransition::~QAbstractTransition
+28 (int (*)(...))QAbstractTransition::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+
+Class QAbstractTransition
+ size=8 align=4
+ base size=8 base align=4
+QAbstractTransition (0xb4410708) 0
+ vptr=((& QAbstractTransition::_ZTV19QAbstractTransition) + 8u)
+ QObject (0xb4242c78) 0
+ primary-for QAbstractTransition (0xb4410708)
+
+Class QEventTransition::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QEventTransition::QPrivateSignal (0xb4257540) 0 empty
+
+Vtable for QEventTransition
+QEventTransition::_ZTV16QEventTransition: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI16QEventTransition)
+8 (int (*)(...))QEventTransition::metaObject
+12 (int (*)(...))QEventTransition::qt_metacast
+16 (int (*)(...))QEventTransition::qt_metacall
+20 (int (*)(...))QEventTransition::~QEventTransition
+24 (int (*)(...))QEventTransition::~QEventTransition
+28 (int (*)(...))QEventTransition::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QEventTransition::eventTest
+60 (int (*)(...))QEventTransition::onTransition
+
+Class QEventTransition
+ size=8 align=4
+ base size=8 base align=4
+QEventTransition (0xb4410744) 0
+ vptr=((& QEventTransition::_ZTV16QEventTransition) + 8u)
+ QAbstractTransition (0xb4410780) 0
+ primary-for QEventTransition (0xb4410744)
+ QObject (0xb4257460) 0
+ primary-for QAbstractTransition (0xb4410780)
+
+Class QFinalState::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QFinalState::QPrivateSignal (0xb4257b60) 0 empty
+
+Vtable for QFinalState
+QFinalState::_ZTV11QFinalState: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QFinalState)
+8 (int (*)(...))QFinalState::metaObject
+12 (int (*)(...))QFinalState::qt_metacast
+16 (int (*)(...))QFinalState::qt_metacall
+20 (int (*)(...))QFinalState::~QFinalState
+24 (int (*)(...))QFinalState::~QFinalState
+28 (int (*)(...))QFinalState::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QFinalState::onEntry
+60 (int (*)(...))QFinalState::onExit
+
+Class QFinalState
+ size=8 align=4
+ base size=8 base align=4
+QFinalState (0xb44107bc) 0
+ vptr=((& QFinalState::_ZTV11QFinalState) + 8u)
+ QAbstractState (0xb44107f8) 0
+ primary-for QFinalState (0xb44107bc)
+ QObject (0xb4257f50) 0
+ primary-for QAbstractState (0xb44107f8)
+
+Class QHistoryState::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QHistoryState::QPrivateSignal (0xb4269770) 0 empty
+
+Vtable for QHistoryState
+QHistoryState::_ZTV13QHistoryState: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QHistoryState)
+8 (int (*)(...))QHistoryState::metaObject
+12 (int (*)(...))QHistoryState::qt_metacast
+16 (int (*)(...))QHistoryState::qt_metacall
+20 (int (*)(...))QHistoryState::~QHistoryState
+24 (int (*)(...))QHistoryState::~QHistoryState
+28 (int (*)(...))QHistoryState::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QHistoryState::onEntry
+60 (int (*)(...))QHistoryState::onExit
+
+Class QHistoryState
+ size=8 align=4
+ base size=8 base align=4
+QHistoryState (0xb4410834) 0
+ vptr=((& QHistoryState::_ZTV13QHistoryState) + 8u)
+ QAbstractState (0xb4410870) 0
+ primary-for QHistoryState (0xb4410834)
+ QObject (0xb4269690) 0
+ primary-for QAbstractState (0xb4410870)
+
+Class QSignalTransition::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSignalTransition::QPrivateSignal (0xb427a118) 0 empty
+
+Vtable for QSignalTransition
+QSignalTransition::_ZTV17QSignalTransition: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI17QSignalTransition)
+8 (int (*)(...))QSignalTransition::metaObject
+12 (int (*)(...))QSignalTransition::qt_metacast
+16 (int (*)(...))QSignalTransition::qt_metacall
+20 (int (*)(...))QSignalTransition::~QSignalTransition
+24 (int (*)(...))QSignalTransition::~QSignalTransition
+28 (int (*)(...))QSignalTransition::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QSignalTransition::eventTest
+60 (int (*)(...))QSignalTransition::onTransition
+
+Class QSignalTransition
+ size=8 align=4
+ base size=8 base align=4
+QSignalTransition (0xb44108ac) 0
+ vptr=((& QSignalTransition::_ZTV17QSignalTransition) + 8u)
+ QAbstractTransition (0xb44108e8) 0
+ primary-for QSignalTransition (0xb44108ac)
+ QObject (0xb427a038) 0
+ primary-for QAbstractTransition (0xb44108e8)
+
+Class QState::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QState::QPrivateSignal (0xb427aa80) 0 empty
+
+Vtable for QState
+QState::_ZTV6QState: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI6QState)
+8 (int (*)(...))QState::metaObject
+12 (int (*)(...))QState::qt_metacast
+16 (int (*)(...))QState::qt_metacall
+20 (int (*)(...))QState::~QState
+24 (int (*)(...))QState::~QState
+28 (int (*)(...))QState::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QState::onEntry
+60 (int (*)(...))QState::onExit
+
+Class QState
+ size=8 align=4
+ base size=8 base align=4
+QState (0xb4410924) 0
+ vptr=((& QState::_ZTV6QState) + 8u)
+ QAbstractState (0xb4410960) 0
+ primary-for QState (0xb4410924)
+ QObject (0xb427a9a0) 0
+ primary-for QAbstractState (0xb4410960)
+
+Class QStateMachine::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QStateMachine::QPrivateSignal (0xb4289850) 0 empty
+
+Vtable for QStateMachine::SignalEvent
+QStateMachine::SignalEvent::_ZTVN13QStateMachine11SignalEventE: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTIN13QStateMachine11SignalEventE)
+8 (int (*)(...))QStateMachine::SignalEvent::~SignalEvent
+12 (int (*)(...))QStateMachine::SignalEvent::~SignalEvent
+
+Class QStateMachine::SignalEvent
+ size=24 align=4
+ base size=24 base align=4
+QStateMachine::SignalEvent (0xb4410a50) 0
+ vptr=((& QStateMachine::SignalEvent::_ZTVN13QStateMachine11SignalEventE) + 8u)
+ QEvent (0xb4289888) 0
+ primary-for QStateMachine::SignalEvent (0xb4410a50)
+
+Vtable for QStateMachine::WrappedEvent
+QStateMachine::WrappedEvent::_ZTVN13QStateMachine12WrappedEventE: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTIN13QStateMachine12WrappedEventE)
+8 (int (*)(...))QStateMachine::WrappedEvent::~WrappedEvent
+12 (int (*)(...))QStateMachine::WrappedEvent::~WrappedEvent
+
+Class QStateMachine::WrappedEvent
+ size=20 align=4
+ base size=20 base align=4
+QStateMachine::WrappedEvent (0xb4410a8c) 0
+ vptr=((& QStateMachine::WrappedEvent::_ZTVN13QStateMachine12WrappedEventE) + 8u)
+ QEvent (0xb4289b28) 0
+ primary-for QStateMachine::WrappedEvent (0xb4410a8c)
+
+Vtable for QStateMachine
+QStateMachine::_ZTV13QStateMachine: 20u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QStateMachine)
+8 (int (*)(...))QStateMachine::metaObject
+12 (int (*)(...))QStateMachine::qt_metacast
+16 (int (*)(...))QStateMachine::qt_metacall
+20 (int (*)(...))QStateMachine::~QStateMachine
+24 (int (*)(...))QStateMachine::~QStateMachine
+28 (int (*)(...))QStateMachine::event
+32 (int (*)(...))QStateMachine::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QStateMachine::onEntry
+60 (int (*)(...))QStateMachine::onExit
+64 (int (*)(...))QStateMachine::beginSelectTransitions
+68 (int (*)(...))QStateMachine::endSelectTransitions
+72 (int (*)(...))QStateMachine::beginMicrostep
+76 (int (*)(...))QStateMachine::endMicrostep
+
+Class QStateMachine
+ size=8 align=4
+ base size=8 base align=4
+QStateMachine (0xb441099c) 0
+ vptr=((& QStateMachine::_ZTV13QStateMachine) + 8u)
+ QState (0xb44109d8) 0
+ primary-for QStateMachine (0xb441099c)
+ QAbstractState (0xb4410a14) 0
+ primary-for QState (0xb44109d8)
+ QObject (0xb4289770) 0
+ primary-for QAbstractState (0xb4410a14)
+
+Vtable for QException
+QException::_ZTV10QException: 7u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QException)
+8 (int (*)(...))QException::~QException
+12 (int (*)(...))QException::~QException
+16 (int (*)(...))std::exception::what
+20 (int (*)(...))QException::raise
+24 (int (*)(...))QException::clone
+
+Class QException
+ size=4 align=4
+ base size=4 base align=4
+QException (0xb4410ac8) 0 nearly-empty
+ vptr=((& QException::_ZTV10QException) + 8u)
+ std::exception (0xb42a9348) 0 nearly-empty
+ primary-for QException (0xb4410ac8)
+
+Vtable for QUnhandledException
+QUnhandledException::_ZTV19QUnhandledException: 7u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI19QUnhandledException)
+8 (int (*)(...))QUnhandledException::~QUnhandledException
+12 (int (*)(...))QUnhandledException::~QUnhandledException
+16 (int (*)(...))std::exception::what
+20 (int (*)(...))QUnhandledException::raise
+24 (int (*)(...))QUnhandledException::clone
+
+Class QUnhandledException
+ size=4 align=4
+ base size=4 base align=4
+QUnhandledException (0xb4410b04) 0 nearly-empty
+ vptr=((& QUnhandledException::_ZTV19QUnhandledException) + 8u)
+ QException (0xb4410b40) 0 nearly-empty
+ primary-for QUnhandledException (0xb4410b04)
+ std::exception (0xb42a9460) 0 nearly-empty
+ primary-for QException (0xb4410b40)
+
+Class QtPrivate::ExceptionHolder
+ size=4 align=4
+ base size=4 base align=4
+QtPrivate::ExceptionHolder (0xb42a9578) 0
+
+Class QtPrivate::ExceptionStore
+ size=4 align=4
+ base size=4 base align=4
+QtPrivate::ExceptionStore (0xb42a97a8) 0
+
+Vtable for QRunnable
+QRunnable::_ZTV9QRunnable: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI9QRunnable)
+8 (int (*)(...))__cxa_pure_virtual
+12 (int (*)(...))QRunnable::~QRunnable
+16 (int (*)(...))QRunnable::~QRunnable
+
+Class QRunnable
+ size=8 align=4
+ base size=8 base align=4
+QRunnable (0xb42a97e0) 0
+ vptr=((& QRunnable::_ZTV9QRunnable) + 8u)
+
+Class QBasicMutex
+ size=4 align=4
+ base size=4 base align=4
+QBasicMutex (0xb42a9e38) 0
+
+Class QMutex
+ size=4 align=4
+ base size=4 base align=4
+QMutex (0xb4410bf4) 0
+ QBasicMutex (0xb40c6690) 0
+
+Class QMutexLocker
+ size=4 align=4
+ base size=4 base align=4
+QMutexLocker (0xb40c6ab8) 0
+
+Class QtPrivate::ResultItem
+ size=8 align=4
+ base size=8 base align=4
+QtPrivate::ResultItem (0xb40ceb60) 0
+
+Class QtPrivate::ResultIteratorBase
+ size=8 align=4
+ base size=8 base align=4
+QtPrivate::ResultIteratorBase (0xb40d6578) 0
+
+Vtable for QtPrivate::ResultStoreBase
+QtPrivate::ResultStoreBase::_ZTVN9QtPrivate15ResultStoreBaseE: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTIN9QtPrivate15ResultStoreBaseE)
+8 (int (*)(...))QtPrivate::ResultStoreBase::~ResultStoreBase
+12 (int (*)(...))QtPrivate::ResultStoreBase::~ResultStoreBase
+
+Class QtPrivate::ResultStoreBase
+ size=28 align=4
+ base size=28 base align=4
+QtPrivate::ResultStoreBase (0xb40d6ab8) 0
+ vptr=((& QtPrivate::ResultStoreBase::_ZTVN9QtPrivate15ResultStoreBaseE) + 8u)
+
+Vtable for QFutureInterfaceBase
+QFutureInterfaceBase::_ZTV20QFutureInterfaceBase: 4u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI20QFutureInterfaceBase)
+8 (int (*)(...))QFutureInterfaceBase::~QFutureInterfaceBase
+12 (int (*)(...))QFutureInterfaceBase::~QFutureInterfaceBase
+
+Class QFutureInterfaceBase
+ size=8 align=4
+ base size=8 base align=4
+QFutureInterfaceBase (0xb40fe188) 0
+ vptr=((& QFutureInterfaceBase::_ZTV20QFutureInterfaceBase) + 8u)
+
+Class QFutureWatcherBase::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QFutureWatcherBase::QPrivateSignal (0xb415bb60) 0 empty
+
+Vtable for QFutureWatcherBase
+QFutureWatcherBase::_ZTV18QFutureWatcherBase: 16u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI18QFutureWatcherBase)
+8 (int (*)(...))QFutureWatcherBase::metaObject
+12 (int (*)(...))QFutureWatcherBase::qt_metacast
+16 (int (*)(...))QFutureWatcherBase::qt_metacall
+20 (int (*)(...))QFutureWatcherBase::~QFutureWatcherBase
+24 (int (*)(...))QFutureWatcherBase::~QFutureWatcherBase
+28 (int (*)(...))QFutureWatcherBase::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QFutureWatcherBase::connectNotify
+52 (int (*)(...))QFutureWatcherBase::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+
+Class QFutureWatcherBase
+ size=8 align=4
+ base size=8 base align=4
+QFutureWatcherBase (0xb4410dd4) 0
+ vptr=((& QFutureWatcherBase::_ZTV18QFutureWatcherBase) + 8u)
+ QObject (0xb415ba80) 0
+ primary-for QFutureWatcherBase (0xb4410dd4)
+
+Class QReadWriteLock
+ size=4 align=4
+ base size=4 base align=4
+QReadWriteLock (0xb4181000) 0
+
+Class QReadLocker
+ size=4 align=4
+ base size=4 base align=4
+QReadLocker (0xb4181380) 0
+
+Class QWriteLocker
+ size=4 align=4
+ base size=4 base align=4
+QWriteLocker (0xb41895b0) 0
+
+Class QSemaphore
+ size=4 align=4
+ base size=4 base align=4
+QSemaphore (0xb41907e0) 0
+
+Class QThread::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QThread::QPrivateSignal (0xb4190b60) 0 empty
+
+Vtable for QThread
+QThread::_ZTV7QThread: 15u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI7QThread)
+8 (int (*)(...))QThread::metaObject
+12 (int (*)(...))QThread::qt_metacast
+16 (int (*)(...))QThread::qt_metacall
+20 (int (*)(...))QThread::~QThread
+24 (int (*)(...))QThread::~QThread
+28 (int (*)(...))QThread::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QThread::run
+
+Class QThread
+ size=8 align=4
+ base size=8 base align=4
+QThread (0xb4410f78) 0
+ vptr=((& QThread::_ZTV7QThread) + 8u)
+ QObject (0xb4190a80) 0
+ primary-for QThread (0xb4410f78)
+
+Class QThreadPool::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QThreadPool::QPrivateSignal (0xb41a3428) 0 empty
+
+Vtable for QThreadPool
+QThreadPool::_ZTV11QThreadPool: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QThreadPool)
+8 (int (*)(...))QThreadPool::metaObject
+12 (int (*)(...))QThreadPool::qt_metacast
+16 (int (*)(...))QThreadPool::qt_metacall
+20 (int (*)(...))QThreadPool::~QThreadPool
+24 (int (*)(...))QThreadPool::~QThreadPool
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QThreadPool
+ size=8 align=4
+ base size=8 base align=4
+QThreadPool (0xb41a5000) 0
+ vptr=((& QThreadPool::_ZTV11QThreadPool) + 8u)
+ QObject (0xb41a3348) 0
+ primary-for QThreadPool (0xb41a5000)
+
+Class QThreadStorageData
+ size=4 align=4
+ base size=4 base align=4
+QThreadStorageData (0xb41a39d8) 0
+
+Class QWaitCondition
+ size=4 align=4
+ base size=4 base align=4
+QWaitCondition (0xb41a3e00) 0
+
+Class QBitArray
+ size=4 align=4
+ base size=4 base align=4
+QBitArray (0xb3fb9d90) 0
+
+Class QBitRef
+ size=8 align=4
+ base size=8 base align=4
+QBitRef (0xb40088f8) 0
+
+Class QByteArrayMatcher::Data
+ size=264 align=4
+ base size=264 base align=4
+QByteArrayMatcher::Data (0xb4011968) 0
+
+Class QByteArrayMatcher
+ size=1032 align=4
+ base size=1032 base align=4
+QByteArrayMatcher (0xb4011658) 0
+
+Class QCryptographicHash
+ size=4 align=4
+ base size=4 base align=4
+QCryptographicHash (0xb4029230) 0
+
+Class QElapsedTimer
+ size=16 align=4
+ base size=16 base align=4
+QElapsedTimer (0xb4029578) 0
+
+Class QPoint
+ size=8 align=4
+ base size=8 base align=4
+QPoint (0xb4029af0) 0
+
+Class QPointF
+ size=16 align=4
+ base size=16 base align=4
+QPointF (0xb405d498) 0
+
+Class QLine
+ size=16 align=4
+ base size=16 base align=4
+QLine (0xb4078230) 0
+
+Class QLineF
+ size=32 align=4
+ base size=32 base align=4
+QLineF (0xb40943b8) 0
+
+Class QLinkedListData
+ size=20 align=4
+ base size=20 base align=4
+QLinkedListData (0xb3eb58c0) 0
+
+Class QMargins
+ size=16 align=4
+ base size=16 base align=4
+QMargins (0xb3f037a8) 0
+
+Class QSize
+ size=8 align=4
+ base size=8 base align=4
+QSize (0xb3f20cb0) 0
+
+Class QSizeF
+ size=16 align=4
+ base size=16 base align=4
+QSizeF (0xb3f47770) 0
+
+Class QRect
+ size=16 align=4
+ base size=16 base align=4
+QRect (0xb3f6a3b8) 0
+
+Class QRectF
+ size=32 align=4
+ base size=32 base align=4
+QRectF (0xb3fa79a0) 0
+
+Class QRegularExpression
+ size=4 align=4
+ base size=4 base align=4
+QRegularExpression (0xb3deba10) 0
+
+Class QRegularExpressionMatch
+ size=4 align=4
+ base size=4 base align=4
+QRegularExpressionMatch (0xb3e32508) 0
+
+Class QRegularExpressionMatchIterator
+ size=4 align=4
+ base size=4 base align=4
+QRegularExpressionMatchIterator (0xb3e32c08) 0
+
+Class QAbstractConcatenable
+ size=1 align=1
+ base size=0 base align=1
+QAbstractConcatenable (0xb3e515b0) 0 empty
+
+Class QTextBoundaryFinder
+ size=28 align=4
+ base size=28 base align=4
+QTextBoundaryFinder (0xb3ea10a8) 0
+
+Class QTimeLine::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QTimeLine::QPrivateSignal (0xb3cbc850) 0 empty
+
+Vtable for QTimeLine
+QTimeLine::_ZTV9QTimeLine: 15u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI9QTimeLine)
+8 (int (*)(...))QTimeLine::metaObject
+12 (int (*)(...))QTimeLine::qt_metacast
+16 (int (*)(...))QTimeLine::qt_metacall
+20 (int (*)(...))QTimeLine::~QTimeLine
+24 (int (*)(...))QTimeLine::~QTimeLine
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QTimeLine::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QTimeLine::valueForTime
+
+Class QTimeLine
+ size=8 align=4
+ base size=8 base align=4
+QTimeLine (0xb41a58e8) 0
+ vptr=((& QTimeLine::_ZTV9QTimeLine) + 8u)
+ QObject (0xb3cbc770) 0
+ primary-for QTimeLine (0xb41a58e8)
+
+Class QXmlStreamStringRef
+ size=12 align=4
+ base size=12 base align=4
+QXmlStreamStringRef (0xb3cd0310) 0
+
+Class QXmlStreamAttribute
+ size=56 align=4
+ base size=53 base align=4
+QXmlStreamAttribute (0xb3cdd268) 0
+
+Class QXmlStreamAttributes
+ size=4 align=4
+ base size=4 base align=4
+QXmlStreamAttributes (0xb41a5960) 0
+ QVector<QXmlStreamAttribute> (0xb3ce6540) 0
+
+Class QXmlStreamNamespaceDeclaration
+ size=28 align=4
+ base size=28 base align=4
+QXmlStreamNamespaceDeclaration (0xb3ce6888) 0
+
+Class QXmlStreamNotationDeclaration
+ size=40 align=4
+ base size=40 base align=4
+QXmlStreamNotationDeclaration (0xb3d121c0) 0
+
+Class QXmlStreamEntityDeclaration
+ size=64 align=4
+ base size=64 base align=4
+QXmlStreamEntityDeclaration (0xb3d12c08) 0
+
+Vtable for QXmlStreamEntityResolver
+QXmlStreamEntityResolver::_ZTV24QXmlStreamEntityResolver: 6u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI24QXmlStreamEntityResolver)
+8 (int (*)(...))QXmlStreamEntityResolver::~QXmlStreamEntityResolver
+12 (int (*)(...))QXmlStreamEntityResolver::~QXmlStreamEntityResolver
+16 (int (*)(...))QXmlStreamEntityResolver::resolveEntity
+20 (int (*)(...))QXmlStreamEntityResolver::resolveUndeclaredEntity
+
+Class QXmlStreamEntityResolver
+ size=4 align=4
+ base size=4 base align=4
+QXmlStreamEntityResolver (0xb3d228c0) 0 nearly-empty
+ vptr=((& QXmlStreamEntityResolver::_ZTV24QXmlStreamEntityResolver) + 8u)
+
+Class QXmlStreamReader
+ size=4 align=4
+ base size=4 base align=4
+QXmlStreamReader (0xb3d22968) 0
+
+Class QXmlStreamWriter
+ size=4 align=4
+ base size=4 base align=4
+QXmlStreamWriter (0xb3d46f50) 0
+
+Class QNetworkRequest
+ size=4 align=4
+ base size=4 base align=4
+QNetworkRequest (0xb3d575e8) 0
+
+Class QNetworkCacheMetaData
+ size=4 align=4
+ base size=4 base align=4
+QNetworkCacheMetaData (0xb3d801c0) 0
+
+Class QAbstractNetworkCache::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractNetworkCache::QPrivateSignal (0xb3d80ee0) 0 empty
+
+Vtable for QAbstractNetworkCache
+QAbstractNetworkCache::_ZTV21QAbstractNetworkCache: 22u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI21QAbstractNetworkCache)
+8 (int (*)(...))QAbstractNetworkCache::metaObject
+12 (int (*)(...))QAbstractNetworkCache::qt_metacast
+16 (int (*)(...))QAbstractNetworkCache::qt_metacall
+20 (int (*)(...))QAbstractNetworkCache::~QAbstractNetworkCache
+24 (int (*)(...))QAbstractNetworkCache::~QAbstractNetworkCache
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))__cxa_pure_virtual
+64 (int (*)(...))__cxa_pure_virtual
+68 (int (*)(...))__cxa_pure_virtual
+72 (int (*)(...))__cxa_pure_virtual
+76 (int (*)(...))__cxa_pure_virtual
+80 (int (*)(...))__cxa_pure_virtual
+84 (int (*)(...))__cxa_pure_virtual
+
+Class QAbstractNetworkCache
+ size=8 align=4
+ base size=8 base align=4
+QAbstractNetworkCache (0xb41a59d8) 0
+ vptr=((& QAbstractNetworkCache::_ZTV21QAbstractNetworkCache) + 8u)
+ QObject (0xb3d80e00) 0
+ primary-for QAbstractNetworkCache (0xb41a59d8)
+
+Class QHttpPart
+ size=4 align=4
+ base size=4 base align=4
+QHttpPart (0xb3d9a658) 0
+
+Class QHttpMultiPart::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QHttpMultiPart::QPrivateSignal (0xb3d9af18) 0 empty
+
+Vtable for QHttpMultiPart
+QHttpMultiPart::_ZTV14QHttpMultiPart: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI14QHttpMultiPart)
+8 (int (*)(...))QHttpMultiPart::metaObject
+12 (int (*)(...))QHttpMultiPart::qt_metacast
+16 (int (*)(...))QHttpMultiPart::qt_metacall
+20 (int (*)(...))QHttpMultiPart::~QHttpMultiPart
+24 (int (*)(...))QHttpMultiPart::~QHttpMultiPart
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QHttpMultiPart
+ size=8 align=4
+ base size=8 base align=4
+QHttpMultiPart (0xb41a5a14) 0
+ vptr=((& QHttpMultiPart::_ZTV14QHttpMultiPart) + 8u)
+ QObject (0xb3d9ae38) 0
+ primary-for QHttpMultiPart (0xb41a5a14)
+
+Class QNetworkAccessManager::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QNetworkAccessManager::QPrivateSignal (0xb3bb57e0) 0 empty
+
+Vtable for QNetworkAccessManager
+QNetworkAccessManager::_ZTV21QNetworkAccessManager: 15u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI21QNetworkAccessManager)
+8 (int (*)(...))QNetworkAccessManager::metaObject
+12 (int (*)(...))QNetworkAccessManager::qt_metacast
+16 (int (*)(...))QNetworkAccessManager::qt_metacall
+20 (int (*)(...))QNetworkAccessManager::~QNetworkAccessManager
+24 (int (*)(...))QNetworkAccessManager::~QNetworkAccessManager
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QNetworkAccessManager::createRequest
+
+Class QNetworkAccessManager
+ size=8 align=4
+ base size=8 base align=4
+QNetworkAccessManager (0xb41a5a50) 0
+ vptr=((& QNetworkAccessManager::_ZTV21QNetworkAccessManager) + 8u)
+ QObject (0xb3bb5700) 0
+ primary-for QNetworkAccessManager (0xb41a5a50)
+
+Class QNetworkCookie
+ size=4 align=4
+ base size=4 base align=4
+QNetworkCookie (0xb3bb5ee0) 0
+
+Class QNetworkCookieJar::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QNetworkCookieJar::QPrivateSignal (0xb3bcecb0) 0 empty
+
+Vtable for QNetworkCookieJar
+QNetworkCookieJar::_ZTV17QNetworkCookieJar: 20u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI17QNetworkCookieJar)
+8 (int (*)(...))QNetworkCookieJar::metaObject
+12 (int (*)(...))QNetworkCookieJar::qt_metacast
+16 (int (*)(...))QNetworkCookieJar::qt_metacall
+20 (int (*)(...))QNetworkCookieJar::~QNetworkCookieJar
+24 (int (*)(...))QNetworkCookieJar::~QNetworkCookieJar
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QNetworkCookieJar::cookiesForUrl
+60 (int (*)(...))QNetworkCookieJar::setCookiesFromUrl
+64 (int (*)(...))QNetworkCookieJar::insertCookie
+68 (int (*)(...))QNetworkCookieJar::updateCookie
+72 (int (*)(...))QNetworkCookieJar::deleteCookie
+76 (int (*)(...))QNetworkCookieJar::validateCookie
+
+Class QNetworkCookieJar
+ size=8 align=4
+ base size=8 base align=4
+QNetworkCookieJar (0xb41a5a8c) 0
+ vptr=((& QNetworkCookieJar::_ZTV17QNetworkCookieJar) + 8u)
+ QObject (0xb3bcebd0) 0
+ primary-for QNetworkCookieJar (0xb41a5a8c)
+
+Class QNetworkDiskCache::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QNetworkDiskCache::QPrivateSignal (0xb3bed460) 0 empty
+
+Vtable for QNetworkDiskCache
+QNetworkDiskCache::_ZTV17QNetworkDiskCache: 23u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI17QNetworkDiskCache)
+8 (int (*)(...))QNetworkDiskCache::metaObject
+12 (int (*)(...))QNetworkDiskCache::qt_metacast
+16 (int (*)(...))QNetworkDiskCache::qt_metacall
+20 (int (*)(...))QNetworkDiskCache::~QNetworkDiskCache
+24 (int (*)(...))QNetworkDiskCache::~QNetworkDiskCache
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QNetworkDiskCache::metaData
+60 (int (*)(...))QNetworkDiskCache::updateMetaData
+64 (int (*)(...))QNetworkDiskCache::data
+68 (int (*)(...))QNetworkDiskCache::remove
+72 (int (*)(...))QNetworkDiskCache::cacheSize
+76 (int (*)(...))QNetworkDiskCache::prepare
+80 (int (*)(...))QNetworkDiskCache::insert
+84 (int (*)(...))QNetworkDiskCache::clear
+88 (int (*)(...))QNetworkDiskCache::expire
+
+Class QNetworkDiskCache
+ size=8 align=4
+ base size=8 base align=4
+QNetworkDiskCache (0xb41a5ac8) 0
+ vptr=((& QNetworkDiskCache::_ZTV17QNetworkDiskCache) + 8u)
+ QAbstractNetworkCache (0xb41a5b04) 0
+ primary-for QNetworkDiskCache (0xb41a5ac8)
+ QObject (0xb3bed380) 0
+ primary-for QAbstractNetworkCache (0xb41a5b04)
+
+Class QNetworkReply::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QNetworkReply::QPrivateSignal (0xb3bedc78) 0 empty
+
+Vtable for QNetworkReply
+QNetworkReply::_ZTV13QNetworkReply: 36u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QNetworkReply)
+8 (int (*)(...))QNetworkReply::metaObject
+12 (int (*)(...))QNetworkReply::qt_metacast
+16 (int (*)(...))QNetworkReply::qt_metacall
+20 (int (*)(...))QNetworkReply::~QNetworkReply
+24 (int (*)(...))QNetworkReply::~QNetworkReply
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QNetworkReply::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QNetworkReply::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QIODevice::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QIODevice::bytesAvailable
+92 (int (*)(...))QIODevice::bytesToWrite
+96 (int (*)(...))QIODevice::canReadLine
+100 (int (*)(...))QIODevice::waitForReadyRead
+104 (int (*)(...))QIODevice::waitForBytesWritten
+108 (int (*)(...))__cxa_pure_virtual
+112 (int (*)(...))QIODevice::readLineData
+116 (int (*)(...))QNetworkReply::writeData
+120 (int (*)(...))QNetworkReply::setReadBufferSize
+124 (int (*)(...))__cxa_pure_virtual
+128 (int (*)(...))QNetworkReply::ignoreSslErrors
+132 (int (*)(...))QNetworkReply::sslConfigurationImplementation
+136 (int (*)(...))QNetworkReply::setSslConfigurationImplementation
+140 (int (*)(...))QNetworkReply::ignoreSslErrorsImplementation
+
+Class QNetworkReply
+ size=8 align=4
+ base size=8 base align=4
+QNetworkReply (0xb41a5b40) 0
+ vptr=((& QNetworkReply::_ZTV13QNetworkReply) + 8u)
+ QIODevice (0xb41a5b7c) 0
+ primary-for QNetworkReply (0xb41a5b40)
+ QObject (0xb3bedb98) 0
+ primary-for QIODevice (0xb41a5b7c)
+
+Class QNetworkConfiguration
+ size=4 align=4
+ base size=4 base align=4
+QNetworkConfiguration (0xb3c05a10) 0
+
+Class QNetworkConfigurationManager::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QNetworkConfigurationManager::QPrivateSignal (0xb3c19af0) 0 empty
+
+Vtable for QNetworkConfigurationManager
+QNetworkConfigurationManager::_ZTV28QNetworkConfigurationManager: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI28QNetworkConfigurationManager)
+8 (int (*)(...))QNetworkConfigurationManager::metaObject
+12 (int (*)(...))QNetworkConfigurationManager::qt_metacast
+16 (int (*)(...))QNetworkConfigurationManager::qt_metacall
+20 (int (*)(...))QNetworkConfigurationManager::~QNetworkConfigurationManager
+24 (int (*)(...))QNetworkConfigurationManager::~QNetworkConfigurationManager
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QNetworkConfigurationManager
+ size=8 align=4
+ base size=8 base align=4
+QNetworkConfigurationManager (0xb41a5bf4) 0
+ vptr=((& QNetworkConfigurationManager::_ZTV28QNetworkConfigurationManager) + 8u)
+ QObject (0xb3c19a10) 0
+ primary-for QNetworkConfigurationManager (0xb41a5bf4)
+
+Class QAbstractSocket::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QAbstractSocket::QPrivateSignal (0xb3c562a0) 0 empty
+
+Vtable for QAbstractSocket
+QAbstractSocket::_ZTV15QAbstractSocket: 41u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI15QAbstractSocket)
+8 (int (*)(...))QAbstractSocket::metaObject
+12 (int (*)(...))QAbstractSocket::qt_metacast
+16 (int (*)(...))QAbstractSocket::qt_metacall
+20 (int (*)(...))QAbstractSocket::~QAbstractSocket
+24 (int (*)(...))QAbstractSocket::~QAbstractSocket
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAbstractSocket::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QAbstractSocket::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QAbstractSocket::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QAbstractSocket::bytesAvailable
+92 (int (*)(...))QAbstractSocket::bytesToWrite
+96 (int (*)(...))QAbstractSocket::canReadLine
+100 (int (*)(...))QAbstractSocket::waitForReadyRead
+104 (int (*)(...))QAbstractSocket::waitForBytesWritten
+108 (int (*)(...))QAbstractSocket::readData
+112 (int (*)(...))QAbstractSocket::readLineData
+116 (int (*)(...))QAbstractSocket::writeData
+120 (int (*)(...))QAbstractSocket::resume
+124 (int (*)(...))QAbstractSocket::connectToHost
+128 (int (*)(...))QAbstractSocket::connectToHost
+132 (int (*)(...))QAbstractSocket::disconnectFromHost
+136 (int (*)(...))QAbstractSocket::setReadBufferSize
+140 (int (*)(...))QAbstractSocket::socketDescriptor
+144 (int (*)(...))QAbstractSocket::setSocketDescriptor
+148 (int (*)(...))QAbstractSocket::setSocketOption
+152 (int (*)(...))QAbstractSocket::socketOption
+156 (int (*)(...))QAbstractSocket::waitForConnected
+160 (int (*)(...))QAbstractSocket::waitForDisconnected
+
+Class QAbstractSocket
+ size=8 align=4
+ base size=8 base align=4
+QAbstractSocket (0xb41a5ce4) 0
+ vptr=((& QAbstractSocket::_ZTV15QAbstractSocket) + 8u)
+ QIODevice (0xb41a5d20) 0
+ primary-for QAbstractSocket (0xb41a5ce4)
+ QObject (0xb3c561c0) 0
+ primary-for QIODevice (0xb41a5d20)
+
+Class QIPv6Address
+ size=16 align=1
+ base size=16 base align=1
+QIPv6Address (0xb3c98c78) 0
+
+Class QHostAddress
+ size=4 align=4
+ base size=4 base align=4
+QHostAddress (0xb3c98ea8) 0
+
+Class QNetworkAddressEntry
+ size=4 align=4
+ base size=4 base align=4
+QNetworkAddressEntry (0xb3ab1ce8) 0
+
+Class QNetworkInterface
+ size=4 align=4
+ base size=4 base align=4
+QNetworkInterface (0xb3ac2460) 0
+
+Class QNetworkSession::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QNetworkSession::QPrivateSignal (0xb3ae4e38) 0 empty
+
+Vtable for QNetworkSession
+QNetworkSession::_ZTV15QNetworkSession: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI15QNetworkSession)
+8 (int (*)(...))QNetworkSession::metaObject
+12 (int (*)(...))QNetworkSession::qt_metacast
+16 (int (*)(...))QNetworkSession::qt_metacall
+20 (int (*)(...))QNetworkSession::~QNetworkSession
+24 (int (*)(...))QNetworkSession::~QNetworkSession
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QNetworkSession::connectNotify
+52 (int (*)(...))QNetworkSession::disconnectNotify
+
+Class QNetworkSession
+ size=12 align=4
+ base size=12 base align=4
+QNetworkSession (0xb41a5e10) 0
+ vptr=((& QNetworkSession::_ZTV15QNetworkSession) + 8u)
+ QObject (0xb3ae4d58) 0
+ primary-for QNetworkSession (0xb41a5e10)
+
+Class QAuthenticator
+ size=4 align=4
+ base size=4 base align=4
+QAuthenticator (0xb3b11690) 0
+
+Class QDnsDomainNameRecord
+ size=4 align=4
+ base size=4 base align=4
+QDnsDomainNameRecord (0xb3b11ab8) 0
+
+Class QDnsHostAddressRecord
+ size=4 align=4
+ base size=4 base align=4
+QDnsHostAddressRecord (0xb3b35070) 0
+
+Class QDnsMailExchangeRecord
+ size=4 align=4
+ base size=4 base align=4
+QDnsMailExchangeRecord (0xb3b35690) 0
+
+Class QDnsServiceRecord
+ size=4 align=4
+ base size=4 base align=4
+QDnsServiceRecord (0xb3b35cb0) 0
+
+Class QDnsTextRecord
+ size=4 align=4
+ base size=4 base align=4
+QDnsTextRecord (0xb3b5c230) 0
+
+Class QDnsLookup::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QDnsLookup::QPrivateSignal (0xb3b5c930) 0 empty
+
+Vtable for QDnsLookup
+QDnsLookup::_ZTV10QDnsLookup: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QDnsLookup)
+8 (int (*)(...))QDnsLookup::metaObject
+12 (int (*)(...))QDnsLookup::qt_metacast
+16 (int (*)(...))QDnsLookup::qt_metacall
+20 (int (*)(...))QDnsLookup::~QDnsLookup
+24 (int (*)(...))QDnsLookup::~QDnsLookup
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QDnsLookup
+ size=8 align=4
+ base size=8 base align=4
+QDnsLookup (0xb41a5e88) 0
+ vptr=((& QDnsLookup::_ZTV10QDnsLookup) + 8u)
+ QObject (0xb3b5c850) 0
+ primary-for QDnsLookup (0xb41a5e88)
+
+Class QHostInfo
+ size=4 align=4
+ base size=4 base align=4
+QHostInfo (0xb3b810e0) 0
+
+Class QNetworkProxyQuery
+ size=4 align=4
+ base size=4 base align=4
+QNetworkProxyQuery (0xb3b817a8) 0
+
+Class QNetworkProxy
+ size=4 align=4
+ base size=4 base align=4
+QNetworkProxy (0xb3b9c5b0) 0
+
+Vtable for QNetworkProxyFactory
+QNetworkProxyFactory::_ZTV20QNetworkProxyFactory: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI20QNetworkProxyFactory)
+8 (int (*)(...))QNetworkProxyFactory::~QNetworkProxyFactory
+12 (int (*)(...))QNetworkProxyFactory::~QNetworkProxyFactory
+16 (int (*)(...))__cxa_pure_virtual
+
+Class QNetworkProxyFactory
+ size=4 align=4
+ base size=4 base align=4
+QNetworkProxyFactory (0xb39ce230) 0 nearly-empty
+ vptr=((& QNetworkProxyFactory::_ZTV20QNetworkProxyFactory) + 8u)
+
+Class QLocalServer::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QLocalServer::QPrivateSignal (0xb39ce6c8) 0 empty
+
+Vtable for QLocalServer
+QLocalServer::_ZTV12QLocalServer: 17u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI12QLocalServer)
+8 (int (*)(...))QLocalServer::metaObject
+12 (int (*)(...))QLocalServer::qt_metacast
+16 (int (*)(...))QLocalServer::qt_metacall
+20 (int (*)(...))QLocalServer::~QLocalServer
+24 (int (*)(...))QLocalServer::~QLocalServer
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QLocalServer::hasPendingConnections
+60 (int (*)(...))QLocalServer::nextPendingConnection
+64 (int (*)(...))QLocalServer::incomingConnection
+
+Class QLocalServer
+ size=8 align=4
+ base size=8 base align=4
+QLocalServer (0xb41a5f00) 0
+ vptr=((& QLocalServer::_ZTV12QLocalServer) + 8u)
+ QObject (0xb39ce5e8) 0
+ primary-for QLocalServer (0xb41a5f00)
+
+Class QLocalSocket::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QLocalSocket::QPrivateSignal (0xb39ecee0) 0 empty
+
+Vtable for QLocalSocket
+QLocalSocket::_ZTV12QLocalSocket: 30u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI12QLocalSocket)
+8 (int (*)(...))QLocalSocket::metaObject
+12 (int (*)(...))QLocalSocket::qt_metacast
+16 (int (*)(...))QLocalSocket::qt_metacall
+20 (int (*)(...))QLocalSocket::~QLocalSocket
+24 (int (*)(...))QLocalSocket::~QLocalSocket
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QLocalSocket::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QLocalSocket::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QIODevice::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QLocalSocket::bytesAvailable
+92 (int (*)(...))QLocalSocket::bytesToWrite
+96 (int (*)(...))QLocalSocket::canReadLine
+100 (int (*)(...))QLocalSocket::waitForReadyRead
+104 (int (*)(...))QLocalSocket::waitForBytesWritten
+108 (int (*)(...))QLocalSocket::readData
+112 (int (*)(...))QIODevice::readLineData
+116 (int (*)(...))QLocalSocket::writeData
+
+Class QLocalSocket
+ size=8 align=4
+ base size=8 base align=4
+QLocalSocket (0xb41a5f78) 0
+ vptr=((& QLocalSocket::_ZTV12QLocalSocket) + 8u)
+ QIODevice (0xb41a5fb4) 0
+ primary-for QLocalSocket (0xb41a5f78)
+ QObject (0xb39ece00) 0
+ primary-for QIODevice (0xb41a5fb4)
+
+Class QTcpServer::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QTcpServer::QPrivateSignal (0xb3a13310) 0 empty
+
+Vtable for QTcpServer
+QTcpServer::_ZTV10QTcpServer: 17u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QTcpServer)
+8 (int (*)(...))QTcpServer::metaObject
+12 (int (*)(...))QTcpServer::qt_metacast
+16 (int (*)(...))QTcpServer::qt_metacall
+20 (int (*)(...))QTcpServer::~QTcpServer
+24 (int (*)(...))QTcpServer::~QTcpServer
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QTcpServer::hasPendingConnections
+60 (int (*)(...))QTcpServer::nextPendingConnection
+64 (int (*)(...))QTcpServer::incomingConnection
+
+Class QTcpServer
+ size=8 align=4
+ base size=8 base align=4
+QTcpServer (0xb3a17000) 0
+ vptr=((& QTcpServer::_ZTV10QTcpServer) + 8u)
+ QObject (0xb3a13230) 0
+ primary-for QTcpServer (0xb3a17000)
+
+Class QTcpSocket::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QTcpSocket::QPrivateSignal (0xb3a13c40) 0 empty
+
+Vtable for QTcpSocket
+QTcpSocket::_ZTV10QTcpSocket: 41u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QTcpSocket)
+8 (int (*)(...))QTcpSocket::metaObject
+12 (int (*)(...))QTcpSocket::qt_metacast
+16 (int (*)(...))QTcpSocket::qt_metacall
+20 (int (*)(...))QTcpSocket::~QTcpSocket
+24 (int (*)(...))QTcpSocket::~QTcpSocket
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAbstractSocket::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QAbstractSocket::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QAbstractSocket::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QAbstractSocket::bytesAvailable
+92 (int (*)(...))QAbstractSocket::bytesToWrite
+96 (int (*)(...))QAbstractSocket::canReadLine
+100 (int (*)(...))QAbstractSocket::waitForReadyRead
+104 (int (*)(...))QAbstractSocket::waitForBytesWritten
+108 (int (*)(...))QAbstractSocket::readData
+112 (int (*)(...))QAbstractSocket::readLineData
+116 (int (*)(...))QAbstractSocket::writeData
+120 (int (*)(...))QAbstractSocket::resume
+124 (int (*)(...))QAbstractSocket::connectToHost
+128 (int (*)(...))QAbstractSocket::connectToHost
+132 (int (*)(...))QAbstractSocket::disconnectFromHost
+136 (int (*)(...))QAbstractSocket::setReadBufferSize
+140 (int (*)(...))QAbstractSocket::socketDescriptor
+144 (int (*)(...))QAbstractSocket::setSocketDescriptor
+148 (int (*)(...))QAbstractSocket::setSocketOption
+152 (int (*)(...))QAbstractSocket::socketOption
+156 (int (*)(...))QAbstractSocket::waitForConnected
+160 (int (*)(...))QAbstractSocket::waitForDisconnected
+
+Class QTcpSocket
+ size=8 align=4
+ base size=8 base align=4
+QTcpSocket (0xb3a1703c) 0
+ vptr=((& QTcpSocket::_ZTV10QTcpSocket) + 8u)
+ QAbstractSocket (0xb3a17078) 0
+ primary-for QTcpSocket (0xb3a1703c)
+ QIODevice (0xb3a170b4) 0
+ primary-for QAbstractSocket (0xb3a17078)
+ QObject (0xb3a13b60) 0
+ primary-for QIODevice (0xb3a170b4)
+
+Class QUdpSocket::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QUdpSocket::QPrivateSignal (0xb3a2b460) 0 empty
+
+Vtable for QUdpSocket
+QUdpSocket::_ZTV10QUdpSocket: 41u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QUdpSocket)
+8 (int (*)(...))QUdpSocket::metaObject
+12 (int (*)(...))QUdpSocket::qt_metacast
+16 (int (*)(...))QUdpSocket::qt_metacall
+20 (int (*)(...))QUdpSocket::~QUdpSocket
+24 (int (*)(...))QUdpSocket::~QUdpSocket
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAbstractSocket::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QAbstractSocket::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QAbstractSocket::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QAbstractSocket::bytesAvailable
+92 (int (*)(...))QAbstractSocket::bytesToWrite
+96 (int (*)(...))QAbstractSocket::canReadLine
+100 (int (*)(...))QAbstractSocket::waitForReadyRead
+104 (int (*)(...))QAbstractSocket::waitForBytesWritten
+108 (int (*)(...))QAbstractSocket::readData
+112 (int (*)(...))QAbstractSocket::readLineData
+116 (int (*)(...))QAbstractSocket::writeData
+120 (int (*)(...))QAbstractSocket::resume
+124 (int (*)(...))QAbstractSocket::connectToHost
+128 (int (*)(...))QAbstractSocket::connectToHost
+132 (int (*)(...))QAbstractSocket::disconnectFromHost
+136 (int (*)(...))QAbstractSocket::setReadBufferSize
+140 (int (*)(...))QAbstractSocket::socketDescriptor
+144 (int (*)(...))QAbstractSocket::setSocketDescriptor
+148 (int (*)(...))QAbstractSocket::setSocketOption
+152 (int (*)(...))QAbstractSocket::socketOption
+156 (int (*)(...))QAbstractSocket::waitForConnected
+160 (int (*)(...))QAbstractSocket::waitForDisconnected
+
+Class QUdpSocket
+ size=8 align=4
+ base size=8 base align=4
+QUdpSocket (0xb3a170f0) 0
+ vptr=((& QUdpSocket::_ZTV10QUdpSocket) + 8u)
+ QAbstractSocket (0xb3a1712c) 0
+ primary-for QUdpSocket (0xb3a170f0)
+ QIODevice (0xb3a17168) 0
+ primary-for QAbstractSocket (0xb3a1712c)
+ QObject (0xb3a2b380) 0
+ primary-for QIODevice (0xb3a17168)
+
+Class QSslCertificate
+ size=4 align=4
+ base size=4 base align=4
+QSslCertificate (0xb3a44658) 0
+
+Class QSslCertificateExtension
+ size=4 align=4
+ base size=4 base align=4
+QSslCertificateExtension (0xb3a5cab8) 0
+
+Class QSslCipher
+ size=4 align=4
+ base size=4 base align=4
+QSslCipher (0xb3a82070) 0
+
+Class QSslError
+ size=4 align=4
+ base size=4 base align=4
+QSslError (0xb3a828c0) 0
+
+Class QSslSocket::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QSslSocket::QPrivateSignal (0xb3a9f3f0) 0 empty
+
+Vtable for QSslSocket
+QSslSocket::_ZTV10QSslSocket: 41u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QSslSocket)
+8 (int (*)(...))QSslSocket::metaObject
+12 (int (*)(...))QSslSocket::qt_metacast
+16 (int (*)(...))QSslSocket::qt_metacall
+20 (int (*)(...))QSslSocket::~QSslSocket
+24 (int (*)(...))QSslSocket::~QSslSocket
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QAbstractSocket::isSequential
+60 (int (*)(...))QIODevice::open
+64 (int (*)(...))QSslSocket::close
+68 (int (*)(...))QIODevice::pos
+72 (int (*)(...))QIODevice::size
+76 (int (*)(...))QIODevice::seek
+80 (int (*)(...))QSslSocket::atEnd
+84 (int (*)(...))QIODevice::reset
+88 (int (*)(...))QSslSocket::bytesAvailable
+92 (int (*)(...))QSslSocket::bytesToWrite
+96 (int (*)(...))QSslSocket::canReadLine
+100 (int (*)(...))QSslSocket::waitForReadyRead
+104 (int (*)(...))QSslSocket::waitForBytesWritten
+108 (int (*)(...))QSslSocket::readData
+112 (int (*)(...))QAbstractSocket::readLineData
+116 (int (*)(...))QSslSocket::writeData
+120 (int (*)(...))QSslSocket::resume
+124 (int (*)(...))QSslSocket::connectToHost
+128 (int (*)(...))QAbstractSocket::connectToHost
+132 (int (*)(...))QSslSocket::disconnectFromHost
+136 (int (*)(...))QSslSocket::setReadBufferSize
+140 (int (*)(...))QAbstractSocket::socketDescriptor
+144 (int (*)(...))QSslSocket::setSocketDescriptor
+148 (int (*)(...))QSslSocket::setSocketOption
+152 (int (*)(...))QSslSocket::socketOption
+156 (int (*)(...))QSslSocket::waitForConnected
+160 (int (*)(...))QSslSocket::waitForDisconnected
+
+Class QSslSocket
+ size=8 align=4
+ base size=8 base align=4
+QSslSocket (0xb3a171e0) 0
+ vptr=((& QSslSocket::_ZTV10QSslSocket) + 8u)
+ QTcpSocket (0xb3a1721c) 0
+ primary-for QSslSocket (0xb3a171e0)
+ QAbstractSocket (0xb3a17258) 0
+ primary-for QTcpSocket (0xb3a1721c)
+ QIODevice (0xb3a17294) 0
+ primary-for QAbstractSocket (0xb3a17258)
+ QObject (0xb3a9f310) 0
+ primary-for QIODevice (0xb3a17294)
+
+Class QSslConfiguration
+ size=4 align=4
+ base size=4 base align=4
+QSslConfiguration (0xb38bfab8) 0
+
+Class QSslKey
+ size=4 align=4
+ base size=4 base align=4
+QSslKey (0xb38e0690) 0
+
+Class QQmlDebuggingEnabler
+ size=1 align=1
+ base size=0 base align=1
+QQmlDebuggingEnabler (0xb38e0fc0) 0 empty
+
+Class QQmlPrivate::RegisterType
+ size=80 align=4
+ base size=80 base align=4
+QQmlPrivate::RegisterType (0xb390d508) 0
+
+Class QQmlPrivate::RegisterInterface
+ size=16 align=4
+ base size=16 base align=4
+QQmlPrivate::RegisterInterface (0xb390d540) 0
+
+Class QQmlPrivate::RegisterAutoParent
+ size=8 align=4
+ base size=8 base align=4
+QQmlPrivate::RegisterAutoParent (0xb390d578) 0
+
+Class QQmlPrivate::RegisterSingletonType
+ size=40 align=4
+ base size=40 base align=4
+QQmlPrivate::RegisterSingletonType (0xb390d5b0) 0
+
+Vtable for QQmlParserStatus
+QQmlParserStatus::_ZTV16QQmlParserStatus: 6u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI16QQmlParserStatus)
+8 (int (*)(...))QQmlParserStatus::~QQmlParserStatus
+12 (int (*)(...))QQmlParserStatus::~QQmlParserStatus
+16 (int (*)(...))__cxa_pure_virtual
+20 (int (*)(...))__cxa_pure_virtual
+
+Class QQmlParserStatus
+ size=8 align=4
+ base size=8 base align=4
+QQmlParserStatus (0xb390d5e8) 0
+ vptr=((& QQmlParserStatus::_ZTV16QQmlParserStatus) + 8u)
+
+Vtable for QQmlPropertyValueSource
+QQmlPropertyValueSource::_ZTV23QQmlPropertyValueSource: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI23QQmlPropertyValueSource)
+8 (int (*)(...))QQmlPropertyValueSource::~QQmlPropertyValueSource
+12 (int (*)(...))QQmlPropertyValueSource::~QQmlPropertyValueSource
+16 (int (*)(...))__cxa_pure_virtual
+
+Class QQmlPropertyValueSource
+ size=4 align=4
+ base size=4 base align=4
+QQmlPropertyValueSource (0xb390d9a0) 0 nearly-empty
+ vptr=((& QQmlPropertyValueSource::_ZTV23QQmlPropertyValueSource) + 8u)
+
+Class QQmlListReference
+ size=4 align=4
+ base size=4 base align=4
+QQmlListReference (0xb390de70) 0
+
+Class QQmlError
+ size=4 align=4
+ base size=4 base align=4
+QQmlError (0xb392ee38) 0
+
+Class QJSValue
+ size=4 align=4
+ base size=4 base align=4
+QJSValue (0xb398f0e0) 0
+
+Class QQmlComponent::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QQmlComponent::QPrivateSignal (0xb37bd3f0) 0 empty
+
+Vtable for QQmlComponent
+QQmlComponent::_ZTV13QQmlComponent: 17u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QQmlComponent)
+8 (int (*)(...))QQmlComponent::metaObject
+12 (int (*)(...))QQmlComponent::qt_metacast
+16 (int (*)(...))QQmlComponent::qt_metacall
+20 (int (*)(...))QQmlComponent::~QQmlComponent
+24 (int (*)(...))QQmlComponent::~QQmlComponent
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QQmlComponent::create
+60 (int (*)(...))QQmlComponent::beginCreate
+64 (int (*)(...))QQmlComponent::completeCreate
+
+Class QQmlComponent
+ size=8 align=4
+ base size=8 base align=4
+QQmlComponent (0xb3a173fc) 0
+ vptr=((& QQmlComponent::_ZTV13QQmlComponent) + 8u)
+ QObject (0xb37bd310) 0
+ primary-for QQmlComponent (0xb3a173fc)
+
+Class QQmlContext::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QQmlContext::QPrivateSignal (0xb37d5c40) 0 empty
+
+Vtable for QQmlContext
+QQmlContext::_ZTV11QQmlContext: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI11QQmlContext)
+8 (int (*)(...))QQmlContext::metaObject
+12 (int (*)(...))QQmlContext::qt_metacast
+16 (int (*)(...))QQmlContext::qt_metacall
+20 (int (*)(...))QQmlContext::~QQmlContext
+24 (int (*)(...))QQmlContext::~QQmlContext
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QQmlContext
+ size=8 align=4
+ base size=8 base align=4
+QQmlContext (0xb3a17474) 0
+ vptr=((& QQmlContext::_ZTV11QQmlContext) + 8u)
+ QObject (0xb37d5b60) 0
+ primary-for QQmlContext (0xb3a17474)
+
+Class QJSEngine::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QJSEngine::QPrivateSignal (0xb37f39d8) 0 empty
+
+Vtable for QJSEngine
+QJSEngine::_ZTV9QJSEngine: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI9QJSEngine)
+8 (int (*)(...))QJSEngine::metaObject
+12 (int (*)(...))QJSEngine::qt_metacast
+16 (int (*)(...))QJSEngine::qt_metacall
+20 (int (*)(...))QJSEngine::~QJSEngine
+24 (int (*)(...))QJSEngine::~QJSEngine
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QJSEngine
+ size=12 align=4
+ base size=12 base align=4
+QJSEngine (0xb3a174b0) 0
+ vptr=((& QJSEngine::_ZTV9QJSEngine) + 8u)
+ QObject (0xb37f38f8) 0
+ primary-for QJSEngine (0xb3a174b0)
+
+Vtable for QQmlImageProviderBase
+QQmlImageProviderBase::_ZTV21QQmlImageProviderBase: 6u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI21QQmlImageProviderBase)
+8 (int (*)(...))QQmlImageProviderBase::~QQmlImageProviderBase
+12 (int (*)(...))QQmlImageProviderBase::~QQmlImageProviderBase
+16 (int (*)(...))__cxa_pure_virtual
+20 (int (*)(...))__cxa_pure_virtual
+
+Class QQmlImageProviderBase
+ size=4 align=4
+ base size=4 base align=4
+QQmlImageProviderBase (0xb380b428) 0 nearly-empty
+ vptr=((& QQmlImageProviderBase::_ZTV21QQmlImageProviderBase) + 8u)
+
+Class QQmlEngine::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QQmlEngine::QPrivateSignal (0xb38245e8) 0 empty
+
+Vtable for QQmlEngine
+QQmlEngine::_ZTV10QQmlEngine: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI10QQmlEngine)
+8 (int (*)(...))QQmlEngine::metaObject
+12 (int (*)(...))QQmlEngine::qt_metacast
+16 (int (*)(...))QQmlEngine::qt_metacall
+20 (int (*)(...))QQmlEngine::~QQmlEngine
+24 (int (*)(...))QQmlEngine::~QQmlEngine
+28 (int (*)(...))QQmlEngine::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QQmlEngine
+ size=12 align=4
+ base size=12 base align=4
+QQmlEngine (0xb3a17528) 0
+ vptr=((& QQmlEngine::_ZTV10QQmlEngine) + 8u)
+ QJSEngine (0xb3a17564) 0
+ primary-for QQmlEngine (0xb3a17528)
+ QObject (0xb3824508) 0
+ primary-for QJSEngine (0xb3a17564)
+
+Class QQmlScriptString
+ size=4 align=4
+ base size=4 base align=4
+QQmlScriptString (0xb3824f50) 0
+
+Class QQmlExpression::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QQmlExpression::QPrivateSignal (0xb383c5b0) 0 empty
+
+Vtable for QQmlExpression
+QQmlExpression::_ZTV14QQmlExpression: 14u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI14QQmlExpression)
+8 (int (*)(...))QQmlExpression::metaObject
+12 (int (*)(...))QQmlExpression::qt_metacast
+16 (int (*)(...))QQmlExpression::qt_metacall
+20 (int (*)(...))QQmlExpression::~QQmlExpression
+24 (int (*)(...))QQmlExpression::~QQmlExpression
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+
+Class QQmlExpression
+ size=8 align=4
+ base size=8 base align=4
+QQmlExpression (0xb3a175a0) 0
+ vptr=((& QQmlExpression::_ZTV14QQmlExpression) + 8u)
+ QObject (0xb383c4d0) 0
+ primary-for QQmlExpression (0xb3a175a0)
+
+Vtable for QQmlTypesExtensionInterface
+QQmlTypesExtensionInterface::_ZTV27QQmlTypesExtensionInterface: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI27QQmlTypesExtensionInterface)
+8 (int (*)(...))QQmlTypesExtensionInterface::~QQmlTypesExtensionInterface
+12 (int (*)(...))QQmlTypesExtensionInterface::~QQmlTypesExtensionInterface
+16 (int (*)(...))__cxa_pure_virtual
+
+Class QQmlTypesExtensionInterface
+ size=4 align=4
+ base size=4 base align=4
+QQmlTypesExtensionInterface (0xb383cc40) 0 nearly-empty
+ vptr=((& QQmlTypesExtensionInterface::_ZTV27QQmlTypesExtensionInterface) + 8u)
+
+Vtable for QQmlExtensionInterface
+QQmlExtensionInterface::_ZTV22QQmlExtensionInterface: 6u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI22QQmlExtensionInterface)
+8 (int (*)(...))QQmlExtensionInterface::~QQmlExtensionInterface
+12 (int (*)(...))QQmlExtensionInterface::~QQmlExtensionInterface
+16 (int (*)(...))__cxa_pure_virtual
+20 (int (*)(...))__cxa_pure_virtual
+
+Class QQmlExtensionInterface
+ size=4 align=4
+ base size=4 base align=4
+QQmlExtensionInterface (0xb3a175dc) 0 nearly-empty
+ vptr=((& QQmlExtensionInterface::_ZTV22QQmlExtensionInterface) + 8u)
+ QQmlTypesExtensionInterface (0xb3858230) 0 nearly-empty
+ primary-for QQmlExtensionInterface (0xb3a175dc)
+
+Class QQmlExtensionPlugin::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QQmlExtensionPlugin::QPrivateSignal (0xb3858930) 0 empty
+
+Vtable for QQmlExtensionPlugin
+QQmlExtensionPlugin::_ZTV19QQmlExtensionPlugin: 22u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI19QQmlExtensionPlugin)
+8 (int (*)(...))QQmlExtensionPlugin::metaObject
+12 (int (*)(...))QQmlExtensionPlugin::qt_metacast
+16 (int (*)(...))QQmlExtensionPlugin::qt_metacall
+20 (int (*)(...))QQmlExtensionPlugin::~QQmlExtensionPlugin
+24 (int (*)(...))QQmlExtensionPlugin::~QQmlExtensionPlugin
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))__cxa_pure_virtual
+60 (int (*)(...))QQmlExtensionPlugin::initializeEngine
+64 (int (*)(...))-0x00000000000000008
+68 (int (*)(...))(& _ZTI19QQmlExtensionPlugin)
+72 (int (*)(...))QQmlExtensionPlugin::_ZThn8_N19QQmlExtensionPluginD1Ev
+76 (int (*)(...))QQmlExtensionPlugin::_ZThn8_N19QQmlExtensionPluginD0Ev
+80 (int (*)(...))__cxa_pure_virtual
+84 (int (*)(...))QQmlExtensionPlugin::_ZThn8_N19QQmlExtensionPlugin16initializeEngineEP10QQmlEnginePKc
+
+Class QQmlExtensionPlugin
+ size=12 align=4
+ base size=12 base align=4
+QQmlExtensionPlugin (0xb3825dc0) 0
+ vptr=((& QQmlExtensionPlugin::_ZTV19QQmlExtensionPlugin) + 8u)
+ QObject (0xb3858818) 0
+ primary-for QQmlExtensionPlugin (0xb3825dc0)
+ QQmlExtensionInterface (0xb3a17690) 8 nearly-empty
+ vptr=((& QQmlExtensionPlugin::_ZTV19QQmlExtensionPlugin) + 72u)
+ QQmlTypesExtensionInterface (0xb3858850) 8 nearly-empty
+ primary-for QQmlExtensionInterface (0xb3a17690)
+
+Class QQmlFile
+ size=4 align=4
+ base size=4 base align=4
+QQmlFile (0xb3858e70) 0
+
+Vtable for QQmlIncubator
+QQmlIncubator::_ZTV13QQmlIncubator: 6u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI13QQmlIncubator)
+8 (int (*)(...))QQmlIncubator::~QQmlIncubator
+12 (int (*)(...))QQmlIncubator::~QQmlIncubator
+16 (int (*)(...))QQmlIncubator::statusChanged
+20 (int (*)(...))QQmlIncubator::setInitialState
+
+Class QQmlIncubator
+ size=8 align=4
+ base size=8 base align=4
+QQmlIncubator (0xb3874188) 0
+ vptr=((& QQmlIncubator::_ZTV13QQmlIncubator) + 8u)
+
+Vtable for QQmlIncubationController
+QQmlIncubationController::_ZTV24QQmlIncubationController: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI24QQmlIncubationController)
+8 (int (*)(...))QQmlIncubationController::~QQmlIncubationController
+12 (int (*)(...))QQmlIncubationController::~QQmlIncubationController
+16 (int (*)(...))QQmlIncubationController::incubatingObjectCountChanged
+
+Class QQmlIncubationController
+ size=8 align=4
+ base size=8 base align=4
+QQmlIncubationController (0xb3874700) 0
+ vptr=((& QQmlIncubationController::_ZTV24QQmlIncubationController) + 8u)
+
+Class QQmlInfo
+ size=8 align=4
+ base size=8 base align=4
+QQmlInfo (0xb3a176cc) 0
+ QDebug (0xb38749d8) 0
+
+Vtable for QQmlNetworkAccessManagerFactory
+QQmlNetworkAccessManagerFactory::_ZTV31QQmlNetworkAccessManagerFactory: 5u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI31QQmlNetworkAccessManagerFactory)
+8 (int (*)(...))QQmlNetworkAccessManagerFactory::~QQmlNetworkAccessManagerFactory
+12 (int (*)(...))QQmlNetworkAccessManagerFactory::~QQmlNetworkAccessManagerFactory
+16 (int (*)(...))__cxa_pure_virtual
+
+Class QQmlNetworkAccessManagerFactory
+ size=4 align=4
+ base size=4 base align=4
+QQmlNetworkAccessManagerFactory (0xb388efc0) 0 nearly-empty
+ vptr=((& QQmlNetworkAccessManagerFactory::_ZTV31QQmlNetworkAccessManagerFactory) + 8u)
+
+Class QQmlProperty
+ size=4 align=4
+ base size=4 base align=4
+QQmlProperty (0xb3897070) 0
+
+Class QQmlPropertyMap::QPrivateSignal
+ size=1 align=1
+ base size=0 base align=1
+QQmlPropertyMap::QPrivateSignal (0xb3897888) 0 empty
+
+Vtable for QQmlPropertyMap
+QQmlPropertyMap::_ZTV15QQmlPropertyMap: 15u entries
+0 (int (*)(...))0
+4 (int (*)(...))(& _ZTI15QQmlPropertyMap)
+8 (int (*)(...))QQmlPropertyMap::metaObject
+12 (int (*)(...))QQmlPropertyMap::qt_metacast
+16 (int (*)(...))QQmlPropertyMap::qt_metacall
+20 (int (*)(...))QQmlPropertyMap::~QQmlPropertyMap
+24 (int (*)(...))QQmlPropertyMap::~QQmlPropertyMap
+28 (int (*)(...))QObject::event
+32 (int (*)(...))QObject::eventFilter
+36 (int (*)(...))QObject::timerEvent
+40 (int (*)(...))QObject::childEvent
+44 (int (*)(...))QObject::customEvent
+48 (int (*)(...))QObject::connectNotify
+52 (int (*)(...))QObject::disconnectNotify
+56 (int (*)(...))QQmlPropertyMap::updateValue
+
+Class QQmlPropertyMap
+ size=8 align=4
+ base size=8 base align=4
+QQmlPropertyMap (0xb3a17708) 0
+ vptr=((& QQmlPropertyMap::_ZTV15QQmlPropertyMap) + 8u)
+ QObject (0xb38977a8) 0
+ primary-for QQmlPropertyMap (0xb3a17708)
+
+Class QJSValueIterator
+ size=4 align=4
+ base size=4 base align=4
+QJSValueIterator (0xb36ae000) 0
+
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
new file mode 100644
index 0000000000..f62d2f3bdb
--- /dev/null
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(qmake_cmake_files)
+
+enable_testing()
+
+find_package(Qt5Core REQUIRED)
+
+include("${_Qt5CTestMacros}")
+
+test_module_includes(
+ Qml QQmlEngine
+ Quick QQuickWindow
+)
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
new file mode 100644
index 0000000000..0a5e7e75fc
--- /dev/null
+++ b/tests/auto/cmake/cmake.pro
@@ -0,0 +1,7 @@
+
+# Cause make to do nothing.
+TEMPLATE = subdirs
+
+CMAKE_QT_MODULES_UNDER_TEST = quick qml
+
+CONFIG += ctest_testcase
diff --git a/tests/auto/compilerwarnings/data/test_cpp.txt b/tests/auto/compilerwarnings/data/test_cpp.txt
new file mode 100644
index 0000000000..2924bb7bb0
--- /dev/null
+++ b/tests/auto/compilerwarnings/data/test_cpp.txt
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_NO_DECLARATIVE
+#include <QtQml/QtQml>
+#endif
+
+#ifndef Q_OS_MAC
+int main(int, char **)
+{
+ return 0;
+}
+#endif
diff --git a/tests/auto/headersclean/headersclean.pro b/tests/auto/headersclean/headersclean.pro
new file mode 100644
index 0000000000..2698d67124
--- /dev/null
+++ b/tests/auto/headersclean/headersclean.pro
@@ -0,0 +1,2 @@
+QT = qml quick qmltest
+load(qt_headersclean)
diff --git a/tests/auto/particles/particles.pro b/tests/auto/particles/particles.pro
new file mode 100644
index 0000000000..265a1eabc7
--- /dev/null
+++ b/tests/auto/particles/particles.pro
@@ -0,0 +1,30 @@
+TEMPLATE = subdirs
+
+PRIVATETESTS += \
+ qquickage \
+ qquickangleddirection \
+ qquickcumulativedirection \
+ qquickcustomaffector \
+ qquickcustomparticle \
+ qquickellipseextruder \
+ qquickgroupgoal \
+ qquickfriction \
+ qquickgravity \
+ qquickimageparticle \
+ qquickitemparticle \
+ qquicklineextruder \
+ qquickmaskextruder \
+ qquickparticlegroup \
+ qquickparticlesystem \
+ qquickpointattractor \
+ qquickpointdirection \
+ qquickrectangleextruder \
+ qquickspritegoal \
+ qquicktargetdirection \
+ qquicktrailemitter \
+ qquickturbulence \
+ qquickwander
+
+contains(QT_CONFIG, private_tests) {
+ SUBDIRS += $$PRIVATETESTS
+}
diff --git a/tests/auto/particles/qquickage/data/jump.qml b/tests/auto/particles/qquickage/data/jump.qml
new file mode 100644
index 0000000000..36520ba7ab
--- /dev/null
+++ b/tests/auto/particles/qquickage/data/jump.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ Age {
+ once: true
+ advancePosition: false
+ lifeLeft: 100
+ }
+
+ ImageParticle { source: "../../shared/star.png" }
+ Emitter {
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ velocity: PointDirection{ x: 500; y: 500 }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickage/data/kill.qml b/tests/auto/particles/qquickage/data/kill.qml
new file mode 100644
index 0000000000..4f3c62116a
--- /dev/null
+++ b/tests/auto/particles/qquickage/data/kill.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ Age {}
+
+ ImageParticle { source: "../../shared/star.png" }
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ velocity: PointDirection{ x: 1000; y: 1000 }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickage/data/onceoff.qml b/tests/auto/particles/qquickage/data/onceoff.qml
new file mode 100644
index 0000000000..8d70794967
--- /dev/null
+++ b/tests/auto/particles/qquickage/data/onceoff.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ Age {
+ once: true
+ lifeLeft: 100
+ }
+
+ ImageParticle { source: "../../shared/star.png" }
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ velocity: PointDirection{ x: 500; y: 500 }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickage/data/sustained.qml b/tests/auto/particles/qquickage/data/sustained.qml
new file mode 100644
index 0000000000..b7750409c9
--- /dev/null
+++ b/tests/auto/particles/qquickage/data/sustained.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ Age {
+ once: false
+ lifeLeft: 100
+ }
+
+ ImageParticle { source: "../../shared/star.png" }
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ velocity: PointDirection{ x: 500; y: 500 }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickage/qquickage.pro b/tests/auto/particles/qquickage/qquickage.pro
new file mode 100644
index 0000000000..1986e00818
--- /dev/null
+++ b/tests/auto/particles/qquickage/qquickage.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickage
+SOURCES += tst_qquickage.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickage/tst_qquickage.cpp b/tests/auto/particles/qquickage/tst_qquickage.cpp
new file mode 100644
index 0000000000..ec2146bc5a
--- /dev/null
+++ b/tests/auto/particles/qquickage/tst_qquickage.cpp
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickage : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickage() {}
+
+private slots:
+ void initTestCase();
+
+ void test_kill();
+ void test_jump();
+ void test_onceOff();
+ void test_sustained();
+};
+
+void tst_qquickage::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickage::test_kill()
+{
+ QQuickView* view = createView(testFileUrl("kill.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 1000.f);
+ QCOMPARE(d->vy, 1000.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(d->t <= ((qreal)system->timeInt/1000.0) - 0.5f + EPSILON);
+ }
+ delete view;
+}
+
+void tst_qquickage::test_jump()
+{
+ QQuickView* view = createView(testFileUrl("jump.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ //Allow for variance because jump is trying to simulate off wall time and things have emitted 'continuously' before first affect
+ QVERIFY(d->x <= -50.f);
+ QVERIFY(d->y <= -50.f);
+ QCOMPARE(d->vx, 500.f);
+ QCOMPARE(d->vy, 500.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(d->t <= ((qreal)system->timeInt/1000.0) - 0.4f + EPSILON);
+ }
+ delete view;
+}
+
+void tst_qquickage::test_onceOff()
+{
+ QQuickView* view = createView(testFileUrl("onceoff.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 500.f);
+ QCOMPARE(d->vy, 500.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(d->t <= ((qreal)system->timeInt/1000.0) - 0.4f + EPSILON);
+ }
+ delete view;
+}
+
+void tst_qquickage::test_sustained()
+{
+ QQuickView* view = createView(testFileUrl("sustained.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+ //TODO: Ensure some particles have lived to 0.4s point despite unified timer
+
+ //Can't verify size, because particles never die. It will constantly grow.
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 500.f);
+ QCOMPARE(d->vy, 500.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyCompare(d->t, ((qreal)system->timeInt/1000.0) - 0.4f));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickage);
+
+#include "tst_qquickage.moc"
diff --git a/tests/auto/particles/qquickangleddirection/data/basic.qml b/tests/auto/particles/qquickangleddirection/data/basic.qml
new file mode 100644
index 0000000000..576f5aef7d
--- /dev/null
+++ b/tests/auto/particles/qquickangleddirection/data/basic.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ velocity: AngleDirection { angle: 45; magnitude: 500 }
+ acceleration: AngleDirection { angle: 45; angleVariation: 22; magnitude: 250; magnitudeVariation: 249}
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro
new file mode 100644
index 0000000000..c1b853d323
--- /dev/null
+++ b/tests/auto/particles/qquickangleddirection/qquickangleddirection.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickangleddirection
+SOURCES += tst_qquickangleddirection.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp
new file mode 100644
index 0000000000..b2012e5d86
--- /dev/null
+++ b/tests/auto/particles/qquickangleddirection/tst_qquickangleddirection.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <qmath.h>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickangleddirection : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickangleddirection() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickangleddirection::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickangleddirection::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QVERIFY(qFuzzyCompare(d->vx, 353.55339f));
+ QVERIFY(qFuzzyCompare(d->vy, 353.55339f));
+ QVERIFY(d->ax > 0.f);
+ QVERIFY(d->ax < 500.f);
+ QVERIFY(d->ay > 0.f);
+ QVERIFY(d->ay < 500.f);
+ QVERIFY(qSqrt(d->ax*d->ax + d->ay*d->ay) < 500.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickangleddirection);
+
+#include "tst_qquickangleddirection.moc"
diff --git a/tests/auto/particles/qquickcumulativedirection/data/basic.qml b/tests/auto/particles/qquickcumulativedirection/data/basic.qml
new file mode 100644
index 0000000000..6ad55645dc
--- /dev/null
+++ b/tests/auto/particles/qquickcumulativedirection/data/basic.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ velocity: CumulativeDirection {
+ PointDirection { x: 100; y: -100 }
+ PointDirection { x: -100; y: 100 }
+ }
+ acceleration: CumulativeDirection {
+ AngleDirection { angle: 0; magnitude: 100 }
+ AngleDirection { angle: 180; magnitude: 100 }
+ }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro
new file mode 100644
index 0000000000..27d1f564fa
--- /dev/null
+++ b/tests/auto/particles/qquickcumulativedirection/qquickcumulativedirection.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickcumulativedirection
+SOURCES += tst_qquickcumulativedirection.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp
new file mode 100644
index 0000000000..989ee52a52
--- /dev/null
+++ b/tests/auto/particles/qquickcumulativedirection/tst_qquickcumulativedirection.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickcumulativedirection : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickcumulativedirection() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickcumulativedirection::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickcumulativedirection::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(myFuzzyCompare(d->x, 0.0f));
+ QVERIFY(myFuzzyCompare(d->y, 0.0f));
+ QVERIFY(myFuzzyCompare(d->vx, 0.0f));
+ QVERIFY(myFuzzyCompare(d->vy, 0.0f));
+ QVERIFY(myFuzzyCompare(d->ax, 0.0f));
+ QVERIFY(myFuzzyCompare(d->ay, 0.0f));
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickcumulativedirection);
+
+#include "tst_qquickcumulativedirection.moc"
diff --git a/tests/auto/particles/qquickcustomaffector/data/affectedSignal.qml b/tests/auto/particles/qquickcustomaffector/data/affectedSignal.qml
new file mode 100644
index 0000000000..04e84d4a1b
--- /dev/null
+++ b/tests/auto/particles/qquickcustomaffector/data/affectedSignal.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+ property real resultX1: 1234
+ property real resultY1: 1234
+ property real resultX2: 1234
+ property real resultY2: 1234
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ rotation: 90
+ }
+
+ Emitter{
+ //0,100 position
+ y: 100
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+
+ Affector {
+ once: true
+ onAffected: {//Does nothing else, so should be called for all particles
+ sys.resultX1 = x;
+ sys.resultY1 = y;
+ }
+ }
+
+ Affector {
+ once: true
+ relative: false
+ position: PointDirection { x: 0; y: 100; }
+ onAffected: {//Does something, so should only be called when it causes a change (it won't)
+ sys.resultX2 = x;
+ sys.resultY2 = y;
+ }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickcustomaffector/data/basic.qml b/tests/auto/particles/qquickcustomaffector/data/basic.qml
new file mode 100644
index 0000000000..5ea4fc19ef
--- /dev/null
+++ b/tests/auto/particles/qquickcustomaffector/data/basic.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ rotation: 90
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+
+ Affector {
+ once: true
+ onAffectParticles: {
+ for (var i=0; i<particles.length; i++) {
+ particles[i].initialX = 100;
+ particles[i].initialY = 100;
+ particles[i].initialVX = 100;
+ particles[i].initialVY = 100;
+ particles[i].initialAX = 100;
+ particles[i].initialAY = 100;
+ particles[i].startSize = 100;
+ particles[i].endSize = 100;
+ particles[i].autoRotate = true;
+ particles[i].update = true;
+ particles[i].red = 0;
+ particles[i].green = 1.0;
+ particles[i].blue = 0;
+ particles[i].alpha = 0;
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickcustomaffector/data/move.qml b/tests/auto/particles/qquickcustomaffector/data/move.qml
new file mode 100644
index 0000000000..a32d205dac
--- /dev/null
+++ b/tests/auto/particles/qquickcustomaffector/data/move.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+
+ Affector {
+ once: false
+ relative: false
+ position: PointDirection { x: 50; y: 50; }
+ velocity: PointDirection { x: 50; y: 50; }
+ acceleration: PointDirection { x: 50; y: 50; }
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro
new file mode 100644
index 0000000000..d6bc56d5a4
--- /dev/null
+++ b/tests/auto/particles/qquickcustomaffector/qquickcustomaffector.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickcustomaffector
+SOURCES += tst_qquickcustomaffector.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp
new file mode 100644
index 0000000000..b6b7125aef
--- /dev/null
+++ b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickcustomaffector : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickcustomaffector() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+ void test_move();
+ void test_affectedSignal();
+};
+
+void tst_qquickcustomaffector::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickcustomaffector::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+ //in CI the whole simulation often happens at once, so dead particles end up missing out
+ if (!d->stillAlive())
+ continue; //parameters no longer get set once you die
+
+ QCOMPARE(d->x, 100.f);
+ QCOMPARE(d->y, 100.f);
+ QCOMPARE(d->vx, 100.f);
+ QCOMPARE(d->vy, 100.f);
+ QCOMPARE(d->ax, 100.f);
+ QCOMPARE(d->ay, 100.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 100.f);
+ QCOMPARE(d->endSize, 100.f);
+ QCOMPARE(d->autoRotate, 1.f);
+ QCOMPARE(d->color.r, (uchar)0);
+ QCOMPARE(d->color.g, (uchar)255);
+ QCOMPARE(d->color.b, (uchar)0);
+ QCOMPARE(d->color.a, (uchar)0);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+void tst_qquickcustomaffector::test_move()
+{
+ QQuickView* view = createView(testFileUrl("move.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+ if (!d->stillAlive())
+ continue; //parameters no longer get set once you die
+
+ QVERIFY(myFuzzyCompare(d->curX(), 50.0));
+ QVERIFY(myFuzzyCompare(d->curY(), 50.0));
+ QVERIFY(myFuzzyCompare(d->curVX(), 50.0));
+ QVERIFY(myFuzzyCompare(d->curVY(), 50.0));
+ QVERIFY(myFuzzyCompare(d->curAX(), 50.0));
+ QVERIFY(myFuzzyCompare(d->curAY(), 50.0));
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+void tst_qquickcustomaffector::test_affectedSignal()
+{
+ QQuickView* view = createView(testFileUrl("affectedSignal.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QCOMPARE(system->property("resultX1").toInt(), 0);
+ QCOMPARE(system->property("resultY1").toInt(), 100);
+ QCOMPARE(system->property("resultX2").toInt(), 1234);
+ QCOMPARE(system->property("resultY2").toInt(), 1234);
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickcustomaffector);
+
+#include "tst_qquickcustomaffector.moc"
diff --git a/tests/auto/particles/qquickcustomparticle/data/basic.qml b/tests/auto/particles/qquickcustomparticle/data/basic.qml
new file mode 100644
index 0000000000..1e1a02ce4b
--- /dev/null
+++ b/tests/auto/particles/qquickcustomparticle/data/basic.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ CustomParticle {
+ property variant source: ShaderEffectSource {
+ hideSource: true
+ sourceItem: Image {
+ source: "../../shared/star.png"
+ }
+ }
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickcustomparticle/data/deleteSourceItem.qml b/tests/auto/particles/qquickcustomparticle/data/deleteSourceItem.qml
new file mode 100644
index 0000000000..90a98e4b53
--- /dev/null
+++ b/tests/auto/particles/qquickcustomparticle/data/deleteSourceItem.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ CustomParticle {
+ id: cp
+ property variant source
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+
+ ShaderEffectSource {
+ id: doomedses
+ hideSource: true
+ sourceItem: Image {
+ id: doomed
+ source: "../../shared/star.png"
+ }
+ }
+
+ function setDeletedSourceItem() {
+ doomed.destroy();
+ cp.source = doomedses;
+ }
+}
diff --git a/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro
new file mode 100644
index 0000000000..441cf7712f
--- /dev/null
+++ b/tests/auto/particles/qquickcustomparticle/qquickcustomparticle.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qquickcustomparticle
+SOURCES += tst_qquickcustomparticle.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp b/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp
new file mode 100644
index 0000000000..fe7632cbaa
--- /dev/null
+++ b/tests/auto/particles/qquickcustomparticle/tst_qquickcustomparticle.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickcustomparticle : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickcustomparticle() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+ void test_deleteSourceItem();
+};
+
+void tst_qquickcustomparticle::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickcustomparticle::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QVERIFY(view);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ bool oneNonZero = false;
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ QVERIFY(d->r >= 0.0 && d->r <= 1.0);
+ if (d->r != 0.0 )
+ oneNonZero = true;
+ }
+ delete view;
+ QVERIFY(oneNonZero);//Zero is a valid value, but it also needs to be set to a random number
+}
+
+void tst_qquickcustomparticle::test_deleteSourceItem()
+{
+ // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash
+ QQuickView* view = createView(testFileUrl("deleteSourceItem.qml"), 600);
+ QVERIFY(view);
+ QObject *obj = view->rootObject();
+ QVERIFY(obj);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(200, system->m_animation);
+ QMetaObject::invokeMethod(obj, "setDeletedSourceItem");
+ ensureAnimTime(200, system->m_animation);
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickcustomparticle);
+
+#include "tst_qquickcustomparticle.moc"
diff --git a/tests/auto/particles/qquickellipseextruder/data/basic.qml b/tests/auto/particles/qquickellipseextruder/data/basic.qml
new file mode 100644
index 0000000000..1a2b39d3a0
--- /dev/null
+++ b/tests/auto/particles/qquickellipseextruder/data/basic.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: ["", "nondefault"]
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ anchors.fill: parent
+ shape: EllipseShape{}
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+
+ Emitter{
+ group: "nondefault"
+ anchors.fill: parent
+ shape: EllipseShape{ fill: false }
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro
new file mode 100644
index 0000000000..3e7d9444cb
--- /dev/null
+++ b/tests/auto/particles/qquickellipseextruder/qquickellipseextruder.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickellipseextruder
+SOURCES += tst_qquickellipseextruder.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp
new file mode 100644
index 0000000000..ac228f331d
--- /dev/null
+++ b/tests/auto/particles/qquickellipseextruder/tst_qquickellipseextruder.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qmath.h>
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickellipseextruder : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickellipseextruder() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+private:
+ bool inCircle(qreal x, qreal y, qreal r, bool borderOnly=false);
+};
+
+void tst_qquickellipseextruder::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+bool tst_qquickellipseextruder::inCircle(qreal x, qreal y, qreal r, bool borderOnly)
+{
+ x -= r;
+ y -= r;
+ if (myFuzzyCompare(x,0) && myFuzzyCompare(y,0))
+ return !borderOnly;
+ qreal mag = qSqrt(x*x + y*y);
+ if (borderOnly)
+ return myFuzzyCompare(mag, r); //Need myFuzzyCompare for smaller Epsilon than qFuzzyCompare
+ else
+ return mag - EPSILON < r;
+}
+
+void tst_qquickellipseextruder::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ //Filled
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(inCircle(d->x, d->y, 160, false));
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+
+ //Just border
+ QCOMPARE(system->groupData[1]->size(), 500);
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(inCircle(d->x, d->y, 160, true));
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickellipseextruder);
+
+#include "tst_qquickellipseextruder.moc"
diff --git a/tests/auto/particles/qquickfriction/data/basic.qml b/tests/auto/particles/qquickfriction/data/basic.qml
new file mode 100644
index 0000000000..4ff7880618
--- /dev/null
+++ b/tests/auto/particles/qquickfriction/data/basic.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: ["","notdefault"]
+ source: "../../shared/star.png"
+ }
+
+ Friction {
+ factor: 0.2
+ }
+
+ Emitter{
+ //0,0 position
+ velocity: PointDirection{x:100}
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+
+ Friction {
+ groups: ["notdefault"]
+ factor: 1000.0
+ }
+
+ Emitter{
+ //0,0 position
+ group: "notdefault"
+ y:200
+ velocity: PointDirection{x:100}
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickfriction/data/threshold.qml b/tests/auto/particles/qquickfriction/data/threshold.qml
new file mode 100644
index 0000000000..b76ebe9ade
--- /dev/null
+++ b/tests/auto/particles/qquickfriction/data/threshold.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: ["","notdefault"]
+ source: "../../shared/star.png"
+ }
+
+ Friction {
+ factor: 1000 //velocity limit 50
+ threshold: 50
+ }
+
+ Emitter{
+ //0,0 position
+ velocity: PointDirection{x:1000}
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickfriction/qquickfriction.pro b/tests/auto/particles/qquickfriction/qquickfriction.pro
new file mode 100644
index 0000000000..f4ffa09b22
--- /dev/null
+++ b/tests/auto/particles/qquickfriction/qquickfriction.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickfriction
+SOURCES += tst_qquickfriction.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp
new file mode 100644
index 0000000000..4036add8f1
--- /dev/null
+++ b/tests/auto/particles/qquickfriction/tst_qquickfriction.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickfriction : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickfriction() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+ void test_threshold();
+};
+
+void tst_qquickfriction::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickfriction::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ //Default is just slowed a little
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(d->vx < 100.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+
+ //Nondefault comes to a complete stop within the first half of its life
+ QCOMPARE(system->groupData[1]->size(), 500);
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ if (d->t > ((qreal)system->timeInt/1000.0) - 0.25)
+ continue;
+ QVERIFY(myFuzzyCompare(d->vx, 0.f));
+ QCOMPARE(d->y, 200.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+void tst_qquickfriction::test_threshold()
+{
+ QQuickView* view = createView(testFileUrl("threshold.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ //Velocity capped at 50, but it might take a frame or two to get there
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1.0f)
+ continue; //Particle data unused
+ if (myFuzzyGEQ(d->t, ((qreal)system->timeInt/1000.0) - 0.1))
+ continue; //Particle data too young
+
+ QVERIFY(myFuzzyLEQ(d->vx, 50.f));
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickfriction);
+
+#include "tst_qquickfriction.moc"
diff --git a/tests/auto/particles/qquickgravity/data/basic.qml b/tests/auto/particles/qquickgravity/data/basic.qml
new file mode 100644
index 0000000000..74da6fc00b
--- /dev/null
+++ b/tests/auto/particles/qquickgravity/data/basic.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Gravity {
+ acceleration: 1000
+ angle: 45
+ }
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickgravity/qquickgravity.pro b/tests/auto/particles/qquickgravity/qquickgravity.pro
new file mode 100644
index 0000000000..574f914d3c
--- /dev/null
+++ b/tests/auto/particles/qquickgravity/qquickgravity.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickgravity
+SOURCES += tst_qquickgravity.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp
new file mode 100644
index 0000000000..755d79b5fa
--- /dev/null
+++ b/tests/auto/particles/qquickgravity/tst_qquickgravity.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickgravity : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickgravity() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickgravity::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickgravity::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ float mag = 707.10678f;
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1 || !d->stillAlive())
+ continue; //Particle data unused or dead
+
+ float t = ((qreal)system->timeInt/1000.0) - d->t;
+ QVERIFY(extremelyFuzzyCompare(d->vx, t*mag, 20.0f));
+ QVERIFY(extremelyFuzzyCompare(d->vy, t*mag, 20.0f));
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickgravity);
+
+#include "tst_qquickgravity.moc"
diff --git a/tests/auto/particles/qquickgroupgoal/data/basic.qml b/tests/auto/particles/qquickgroupgoal/data/basic.qml
new file mode 100644
index 0000000000..8e25a4dc3f
--- /dev/null
+++ b/tests/auto/particles/qquickgroupgoal/data/basic.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ GroupGoal {
+ groups: ["notdefault"]
+ goalState: ""
+ jump: true
+ }
+
+ Emitter {
+ //0,0 position
+ group: "notdefault"
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro
new file mode 100644
index 0000000000..c23b366d34
--- /dev/null
+++ b/tests/auto/particles/qquickgroupgoal/qquickgroupgoal.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickgroupgoal
+SOURCES += tst_qquickgroupgoal.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private testlib quick-private quickparticles-private
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp b/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp
new file mode 100644
index 0000000000..5416ae0609
--- /dev/null
+++ b/tests/auto/particles/qquickgroupgoal/tst_qquickgroupgoal.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickgroupgoal : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickgroupgoal() {}
+
+private slots:
+ void initTestCase();
+ void test_instantTransition();
+};
+
+void tst_qquickgroupgoal::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickgroupgoal::test_instantTransition()
+{
+ //Note: Does not go through sprite engine
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450);
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickgroupgoal);
+
+#include "tst_qquickgroupgoal.moc"
diff --git a/tests/auto/particles/qquickimageparticle/data/basic.qml b/tests/auto/particles/qquickimageparticle/data/basic.qml
new file mode 100644
index 0000000000..c9137588a2
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/data/basic.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickimageparticle/data/colorVariance.qml b/tests/auto/particles/qquickimageparticle/data/colorVariance.qml
new file mode 100644
index 0000000000..84a6e5bb71
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/data/colorVariance.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ alpha: 0.5
+ color: "#000000"
+ redVariation: 0.5
+ greenVariation: 0.25
+ blueVariation: 0.125
+ alphaVariation: 0.25
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickimageparticle/data/colored.qml b/tests/auto/particles/qquickimageparticle/data/colored.qml
new file mode 100644
index 0000000000..7db4bf6d54
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/data/colored.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ alpha: 0.5
+ color: "#030201"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickimageparticle/data/deformed.qml b/tests/auto/particles/qquickimageparticle/data/deformed.qml
new file mode 100644
index 0000000000..80a9184b23
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/data/deformed.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ rotation: 90
+ rotationVelocity: 90
+ autoRotation: true
+ yVector: PointDirection{x: 0.5; y: 0.5}
+ xVector: PointDirection{x: 0.5; y: 0.5}
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickimageparticle/data/sprite.qml b/tests/auto/particles/qquickimageparticle/data/sprite.qml
new file mode 100644
index 0000000000..0fd69632a7
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/data/sprite.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ sprites: Sprite {
+ name: "happy"
+ source: "../../shared/squarefacesprite.png"
+ frames: 6
+ frameDuration: 120
+ }
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickimageparticle/data/tabled.qml b/tests/auto/particles/qquickimageparticle/data/tabled.qml
new file mode 100644
index 0000000000..6e74feb9b5
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/data/tabled.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ sizeTable: "../../shared/table.png"
+ colorTable: "../../shared/table.png"
+ opacityTable: "../../shared/table.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro
new file mode 100644
index 0000000000..e07ac09fa0
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/qquickimageparticle.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qquickimageparticle
+SOURCES += tst_qquickimageparticle.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp
new file mode 100644
index 0000000000..27d4996089
--- /dev/null
+++ b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp
@@ -0,0 +1,348 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+const double CONV_FACTOR = 0.017453292519943295;//Degrees to radians
+
+class tst_qquickimageparticle : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickimageparticle() {}
+ ~tst_qquickimageparticle();
+
+private slots:
+ void initTestCase();
+ void test_basic();
+ void test_colored();
+ void test_colorVariance();
+ void test_deformed();
+ void test_tabled();
+ void test_sprite();
+};
+
+void tst_qquickimageparticle::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+ //QQuickImageParticle has several debug statements, with possible pointer dereferences
+ qputenv("QML_PARTICLES_DEBUG","please");
+}
+
+tst_qquickimageparticle::~tst_qquickimageparticle()
+{
+ qputenv("QML_PARTICLES_DEBUG","");
+}
+
+void tst_qquickimageparticle::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ QCOMPARE(d->color.r, (uchar)255);
+ QCOMPARE(d->color.g, (uchar)255);
+ QCOMPARE(d->color.b, (uchar)255);
+ QCOMPARE(d->color.a, (uchar)255);
+ QCOMPARE(d->xx, 1.0f);
+ QCOMPARE(d->xy, 0.0f);
+ QCOMPARE(d->yy, 1.0f);
+ QCOMPARE(d->yx, 0.0f);
+ QCOMPARE(d->rotation, 0.0f);
+ QCOMPARE(d->rotationVelocity, 0.0f);
+ QCOMPARE(d->autoRotate, 0.0f);
+ QCOMPARE(d->animX, 0.0f);
+ QCOMPARE(d->animY, 0.0f);
+ QCOMPARE(d->animWidth, 1.0f);
+ QCOMPARE(d->animHeight, 1.0f);
+ QCOMPARE(d->frameDuration, 1.0f);
+ QCOMPARE(d->frameCount, 1.0f);
+ QCOMPARE(d->animT, -1.0f);
+ }
+ delete view;
+}
+
+
+void tst_qquickimageparticle::test_colored()
+{
+ QQuickView* view = createView(testFileUrl("colored.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ QCOMPARE(d->color.r, (uchar)003);
+ QCOMPARE(d->color.g, (uchar)002);
+ QCOMPARE(d->color.b, (uchar)001);
+ QCOMPARE(d->color.a, (uchar)127);
+ QCOMPARE(d->xx, 1.0f);
+ QCOMPARE(d->xy, 0.0f);
+ QCOMPARE(d->yy, 1.0f);
+ QCOMPARE(d->yx, 0.0f);
+ QCOMPARE(d->rotation, 0.0f);
+ QCOMPARE(d->rotationVelocity, 0.0f);
+ QCOMPARE(d->autoRotate, 0.0f);
+ QCOMPARE(d->animX, 0.0f);
+ QCOMPARE(d->animY, 0.0f);
+ QCOMPARE(d->animWidth, 1.0f);
+ QCOMPARE(d->animHeight, 1.0f);
+ QCOMPARE(d->frameDuration, 1.0f);
+ QCOMPARE(d->frameCount, 1.0f);
+ QCOMPARE(d->animT, -1.0f);
+ }
+ delete view;
+}
+
+
+void tst_qquickimageparticle::test_colorVariance()
+{
+ QQuickView* view = createView(testFileUrl("colorVariance.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ QVERIFY(d->color.r < 128);
+ QVERIFY(d->color.g < 64);
+ QVERIFY(d->color.b < 32);
+ QVERIFY(d->color.a >= 64);
+ QVERIFY(d->color.a < 192);
+ QCOMPARE(d->xx, 1.0f);
+ QCOMPARE(d->xy, 0.0f);
+ QCOMPARE(d->yy, 1.0f);
+ QCOMPARE(d->yx, 0.0f);
+ QCOMPARE(d->rotation, 0.0f);
+ QCOMPARE(d->rotationVelocity, 0.0f);
+ QCOMPARE(d->autoRotate, 0.0f);
+ QCOMPARE(d->animX, 0.0f);
+ QCOMPARE(d->animY, 0.0f);
+ QCOMPARE(d->animWidth, 1.0f);
+ QCOMPARE(d->animHeight, 1.0f);
+ QCOMPARE(d->frameDuration, 1.0f);
+ QCOMPARE(d->frameCount, 1.0f);
+ QCOMPARE(d->animT, -1.0f);
+ }
+ delete view;
+}
+
+
+void tst_qquickimageparticle::test_deformed()
+{
+ QQuickView* view = createView(testFileUrl("deformed.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ QCOMPARE(d->color.r, (uchar)255);
+ QCOMPARE(d->color.g, (uchar)255);
+ QCOMPARE(d->color.b, (uchar)255);
+ QCOMPARE(d->color.a, (uchar)255);
+ QCOMPARE(d->xx, 0.5f);
+ QCOMPARE(d->xy, 0.5f);
+ QCOMPARE(d->yy, 0.5f);
+ QCOMPARE(d->yx, 0.5f);
+ QCOMPARE(d->rotation, 90.0f * (float)CONV_FACTOR);
+ QCOMPARE(d->rotationVelocity, 90.0f * (float)CONV_FACTOR);
+ QCOMPARE(d->autoRotate, 1.0f);
+ QCOMPARE(d->animX, 0.0f);
+ QCOMPARE(d->animY, 0.0f);
+ QCOMPARE(d->animWidth, 1.0f);
+ QCOMPARE(d->animHeight, 1.0f);
+ QCOMPARE(d->frameDuration, 1.0f);
+ QCOMPARE(d->frameCount, 1.0f);
+ QCOMPARE(d->animT, -1.0f);
+ }
+ delete view;
+}
+
+
+void tst_qquickimageparticle::test_tabled()
+{
+ QQuickView* view = createView(testFileUrl("tabled.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ QCOMPARE(d->color.r, (uchar)255);
+ QCOMPARE(d->color.g, (uchar)255);
+ QCOMPARE(d->color.b, (uchar)255);
+ QCOMPARE(d->color.a, (uchar)255);
+ QCOMPARE(d->xx, 1.0f);
+ QCOMPARE(d->xy, 0.0f);
+ QCOMPARE(d->yy, 1.0f);
+ QCOMPARE(d->yx, 0.0f);
+ QCOMPARE(d->rotation, 0.0f);
+ QCOMPARE(d->rotationVelocity, 0.0f);
+ QCOMPARE(d->autoRotate, 0.0f);
+ QCOMPARE(d->animX, 0.0f);
+ QCOMPARE(d->animY, 0.0f);
+ QCOMPARE(d->animWidth, 1.0f);
+ QCOMPARE(d->animHeight, 1.0f);
+ QCOMPARE(d->frameDuration, 1.0f);
+ QCOMPARE(d->frameCount, 1.0f);
+ QCOMPARE(d->animT, -1.0f);
+ //TODO: This performance level doesn't alter particleData, but goes straight to shaders. Find something to test
+ }
+ delete view;
+}
+
+
+void tst_qquickimageparticle::test_sprite()
+{
+ QQuickView* view = createView(testFileUrl("sprite.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ QCOMPARE(d->color.r, (uchar)255);
+ QCOMPARE(d->color.g, (uchar)255);
+ QCOMPARE(d->color.b, (uchar)255);
+ QCOMPARE(d->color.a, (uchar)255);
+ QCOMPARE(d->xx, 1.0f);
+ QCOMPARE(d->xy, 0.0f);
+ QCOMPARE(d->yy, 1.0f);
+ QCOMPARE(d->yx, 0.0f);
+ QCOMPARE(d->rotation, 0.0f);
+ QCOMPARE(d->rotationVelocity, 0.0f);
+ QCOMPARE(d->autoRotate, 0.0f);
+ QVERIFY(myFuzzyCompare(d->frameDuration, 120.f));
+ QCOMPARE(d->frameCount, 6.0f);
+ QVERIFY(d->animT > 0.0f);
+ QCOMPARE(d->animX, 0.0f);
+ QCOMPARE(d->animY, 0.0f);
+ QCOMPARE(d->animWidth, 31.0f);
+ QCOMPARE(d->animHeight, 30.0f);
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickimageparticle);
+
+#include "tst_qquickimageparticle.moc"
diff --git a/tests/auto/particles/qquickitemparticle/data/basic.qml b/tests/auto/particles/qquickitemparticle/data/basic.qml
new file mode 100644
index 0000000000..cf84e572f3
--- /dev/null
+++ b/tests/auto/particles/qquickitemparticle/data/basic.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ItemParticle {
+ delegate: Image{ source: "../../shared/star.png" }
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro
new file mode 100644
index 0000000000..7a0f8aa71e
--- /dev/null
+++ b/tests/auto/particles/qquickitemparticle/qquickitemparticle.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qquickitemparticle
+SOURCES += tst_qquickitemparticle.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp
new file mode 100644
index 0000000000..5227552079
--- /dev/null
+++ b/tests/auto/particles/qquickitemparticle/tst_qquickitemparticle.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qquickimage_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickitemparticle : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickitemparticle() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickitemparticle::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickitemparticle::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ if (d->t > ((qreal)system->timeInt/1000.0) - 0.05)//Delegates appear between frames, may miss the first couple
+ continue;
+ if (d->t < ((qreal)system->timeInt/1000.0) - 0.45)//Delegates cleared on death
+ continue;
+ QVERIFY(d->delegate);
+ QVERIFY(qobject_cast<QQuickImage*>(d->delegate));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickitemparticle);
+
+#include "tst_qquickitemparticle.moc"
diff --git a/tests/auto/particles/qquicklineextruder/data/basic.qml b/tests/auto/particles/qquicklineextruder/data/basic.qml
new file mode 100644
index 0000000000..41c0a56c01
--- /dev/null
+++ b/tests/auto/particles/qquicklineextruder/data/basic.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: ["", "notdefault"]
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ anchors.fill: parent
+ shape: LineShape{}
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ Emitter{
+ anchors.fill: parent
+ group: "notdefault"
+ shape: LineShape{mirrored: true}
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro
new file mode 100644
index 0000000000..eea00ecf06
--- /dev/null
+++ b/tests/auto/particles/qquicklineextruder/qquicklineextruder.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquicklineextruder
+SOURCES += tst_qquicklineextruder.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp
new file mode 100644
index 0000000000..8b3e63a97b
--- /dev/null
+++ b/tests/auto/particles/qquicklineextruder/tst_qquicklineextruder.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquicklineextruder : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquicklineextruder() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquicklineextruder::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquicklineextruder::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, d->y);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+
+ QCOMPARE(system->groupData[1]->size(), 500);
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x + d->y, 320.0f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquicklineextruder);
+
+#include "tst_qquicklineextruder.moc"
diff --git a/tests/auto/particles/qquickmaskextruder/data/basic.qml b/tests/auto/particles/qquickmaskextruder/data/basic.qml
new file mode 100644
index 0000000000..b981261078
--- /dev/null
+++ b/tests/auto/particles/qquickmaskextruder/data/basic.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //100,100 rect at 100,100
+ anchors.fill: parent
+ shape: MaskShape{source: "smallmask.png"}
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickmaskextruder/data/smallmask.png b/tests/auto/particles/qquickmaskextruder/data/smallmask.png
new file mode 100644
index 0000000000..e36fb9fe55
--- /dev/null
+++ b/tests/auto/particles/qquickmaskextruder/data/smallmask.png
Binary files differ
diff --git a/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro
new file mode 100644
index 0000000000..c9b217a7ab
--- /dev/null
+++ b/tests/auto/particles/qquickmaskextruder/qquickmaskextruder.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickmaskextruder
+SOURCES += tst_qquickmaskextruder.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp
new file mode 100644
index 0000000000..4660975e9b
--- /dev/null
+++ b/tests/auto/particles/qquickmaskextruder/tst_qquickmaskextruder.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickmaskextruder : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickmaskextruder() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickmaskextruder::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickmaskextruder::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(d->x >= 100.0f && d->x <= 200.0f);
+ QVERIFY(d->y >= 100.0f && d->y <= 200.0f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickmaskextruder);
+
+#include "tst_qquickmaskextruder.moc"
diff --git a/tests/auto/particles/qquickparticlegroup/data/basic.qml b/tests/auto/particles/qquickparticlegroup/data/basic.qml
new file mode 100644
index 0000000000..0c5849486c
--- /dev/null
+++ b/tests/auto/particles/qquickparticlegroup/data/basic.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ ParticleGroup {
+ name: "notdefault"
+ duration: 0
+ to: {"":1}
+ }
+
+ Emitter{
+ //0,0 position
+ group: "notdefault"
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro
new file mode 100644
index 0000000000..a1f30a079e
--- /dev/null
+++ b/tests/auto/particles/qquickparticlegroup/qquickparticlegroup.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickparticlegroup
+SOURCES += tst_qquickparticlegroup.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp b/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp
new file mode 100644
index 0000000000..c22c35b5ab
--- /dev/null
+++ b/tests/auto/particles/qquickparticlegroup/tst_qquickparticlegroup.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickparticlegroup : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickparticlegroup() {}
+
+private slots:
+ void initTestCase();
+ void test_instantTransition();
+};
+
+void tst_qquickparticlegroup::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickparticlegroup::test_instantTransition()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ //A frame or two worth of particles will be missed, the transition doesn't take effect on the frame it's spawned (QTBUG-21781)
+ QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450);
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickparticlegroup);
+
+#include "tst_qquickparticlegroup.moc"
diff --git a/tests/auto/particles/qquickparticlesystem/data/basic.qml b/tests/auto/particles/qquickparticlesystem/data/basic.qml
new file mode 100644
index 0000000000..c9137588a2
--- /dev/null
+++ b/tests/auto/particles/qquickparticlesystem/data/basic.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro
new file mode 100644
index 0000000000..d4cf1b4e5d
--- /dev/null
+++ b/tests/auto/particles/qquickparticlesystem/qquickparticlesystem.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickparticlesystem
+SOURCES += tst_qquickparticlesystem.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp
new file mode 100644
index 0000000000..87e4cb612a
--- /dev/null
+++ b/tests/auto/particles/qquickparticlesystem/tst_qquickparticlesystem.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickparticlesystem : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickparticlesystem() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickparticlesystem::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickparticlesystem::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ int stillAlive = 0;
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ if (d->stillAlive())
+ stillAlive++;
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+ QVERIFY(extremelyFuzzyCompare(stillAlive, 500, 5));//Small simulation variance is permissible.
+}
+
+QTEST_MAIN(tst_qquickparticlesystem);
+
+#include "tst_qquickparticlesystem.moc"
diff --git a/tests/auto/particles/qquickpointattractor/data/basic.qml b/tests/auto/particles/qquickpointattractor/data/basic.qml
new file mode 100644
index 0000000000..b37aab786b
--- /dev/null
+++ b/tests/auto/particles/qquickpointattractor/data/basic.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Attractor {
+ anchors.centerIn: parent
+ proportionalToDistance: Attractor.Constant
+ affectedParameter: Attractor.Position
+ strength: 100
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro
new file mode 100644
index 0000000000..c8a460c335
--- /dev/null
+++ b/tests/auto/particles/qquickpointattractor/qquickpointattractor.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickpointattractor
+SOURCES += tst_qquickpointattractor.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp
new file mode 100644
index 0000000000..c0aec23018
--- /dev/null
+++ b/tests/auto/particles/qquickpointattractor/tst_qquickpointattractor.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickpointattractor : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickpointattractor() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickpointattractor::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickpointattractor::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(d->x != 0.f);
+ QVERIFY(d->y != 0.f);
+ QVERIFY(d->x == d->y);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickpointattractor);
+
+#include "tst_qquickpointattractor.moc"
diff --git a/tests/auto/particles/qquickpointdirection/data/basic.qml b/tests/auto/particles/qquickpointdirection/data/basic.qml
new file mode 100644
index 0000000000..0e842558c3
--- /dev/null
+++ b/tests/auto/particles/qquickpointdirection/data/basic.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ velocity: PointDirection{ x: 100; y: 100 }
+ acceleration: PointDirection{ x: 100; xVariation: 100; y: 100; yVariation: 100 }
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro
new file mode 100644
index 0000000000..ecb171afac
--- /dev/null
+++ b/tests/auto/particles/qquickpointdirection/qquickpointdirection.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickpointdirection
+SOURCES += tst_qquickpointdirection.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp
new file mode 100644
index 0000000000..1a609614ed
--- /dev/null
+++ b/tests/auto/particles/qquickpointdirection/tst_qquickpointdirection.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickpointdirection : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickpointdirection() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickpointdirection::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickpointdirection::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 100.f);
+ QCOMPARE(d->vy, 100.f);
+ QVERIFY(d->ax >= 0.f);
+ QVERIFY(d->ax <= 200.f);
+ QVERIFY(d->ay >= 0.f);
+ QVERIFY(d->ay <= 200.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickpointdirection);
+
+#include "tst_qquickpointdirection.moc"
diff --git a/tests/auto/particles/qquickrectangleextruder/data/basic.qml b/tests/auto/particles/qquickrectangleextruder/data/basic.qml
new file mode 100644
index 0000000000..65e4e59bb6
--- /dev/null
+++ b/tests/auto/particles/qquickrectangleextruder/data/basic.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: ["", "notdefault"]
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ width: 100
+ height: 100
+ size: 32
+ shape: RectangleShape{}
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ Emitter{
+ width: 100
+ height: 100
+ group: "notdefault"
+ size: 32
+ shape: RectangleShape{fill: false}
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro
new file mode 100644
index 0000000000..54169bcdc9
--- /dev/null
+++ b/tests/auto/particles/qquickrectangleextruder/qquickrectangleextruder.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickrectangleextruder
+SOURCES += tst_qquickrectangleextruder.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp
new file mode 100644
index 0000000000..0891025bf1
--- /dev/null
+++ b/tests/auto/particles/qquickrectangleextruder/tst_qquickrectangleextruder.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickrectangleextruder : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickrectangleextruder() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickrectangleextruder::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickrectangleextruder::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(d->x >= 0.f);
+ QVERIFY(d->x <= 100.f);
+ QVERIFY(d->y >= 0.f);
+ QVERIFY(d->y <= 100.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+
+ QCOMPARE(system->groupData[1]->size(), 500);
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ if (!myFuzzyCompare(d->x, 0.f) && !myFuzzyCompare(d->x, 100.f)){
+ QVERIFY(d->x >= 0.f);
+ QVERIFY(d->x <= 100.f);
+ QVERIFY(myFuzzyCompare(d->y, 0.f) || myFuzzyCompare(d->y, 100.f));
+ } else {
+ QVERIFY(d->y >= 0.f);
+ QVERIFY(d->y <= 100.f);
+ }
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickrectangleextruder);
+
+#include "tst_qquickrectangleextruder.moc"
diff --git a/tests/auto/particles/qquickspritegoal/data/basic.qml b/tests/auto/particles/qquickspritegoal/data/basic.qml
new file mode 100644
index 0000000000..7b88e5c608
--- /dev/null
+++ b/tests/auto/particles/qquickspritegoal/data/basic.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ sprites: [Sprite {
+ name: "happy"
+ source: "../../shared/squarefacesprite.png"
+ frames: 6
+ frameDuration: 120
+ }, Sprite {
+ name: "twoHappy"
+ source: "../../shared/squarefacesprite.png"
+ frames: 3
+ frameDuration: 240
+ }]
+ }
+
+ SpriteGoal {
+ goalState: "twoHappy"
+ jump: true
+ }
+
+ Emitter {
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro
new file mode 100644
index 0000000000..3e53fae2e6
--- /dev/null
+++ b/tests/auto/particles/qquickspritegoal/qquickspritegoal.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickspritegoal
+SOURCES += tst_qquickspritegoal.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private testlib quick-private quickparticles-private
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp b/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp
new file mode 100644
index 0000000000..214263bdff
--- /dev/null
+++ b/tests/auto/particles/qquickspritegoal/tst_qquickspritegoal.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickspritegoal : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickspritegoal() {}
+
+private slots:
+ void initTestCase();
+ void test_instantTransition();
+};
+
+void tst_qquickspritegoal::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickspritegoal::test_instantTransition()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(system->groupData[0]->size() <= 500 && system->groupData[0]->size() >= 450);
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->animIdx, 1.f);//Spawns at 0, affector moves it.
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickspritegoal);
+
+#include "tst_qquickspritegoal.moc"
diff --git a/tests/auto/particles/qquicktargetdirection/data/basic.qml b/tests/auto/particles/qquicktargetdirection/data/basic.qml
new file mode 100644
index 0000000000..20ff1a7b82
--- /dev/null
+++ b/tests/auto/particles/qquicktargetdirection/data/basic.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ velocity: TargetDirection{ targetItem: sys; proportionalMagnitude: true; magnitude: 1 }
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro
new file mode 100644
index 0000000000..09511daca1
--- /dev/null
+++ b/tests/auto/particles/qquicktargetdirection/qquicktargetdirection.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquicktargetdirection
+SOURCES += tst_qquicktargetdirection.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp
new file mode 100644
index 0000000000..0424d10169
--- /dev/null
+++ b/tests/auto/particles/qquicktargetdirection/tst_qquicktargetdirection.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquicktargetdirection : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquicktargetdirection() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquicktargetdirection::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquicktargetdirection::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 160.f);
+ QCOMPARE(d->vy, 160.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquicktargetdirection);
+
+#include "tst_qquicktargetdirection.moc"
diff --git a/tests/auto/particles/qquicktrailemitter/data/basic.qml b/tests/auto/particles/qquicktrailemitter/data/basic.qml
new file mode 100644
index 0000000000..b25113bc6a
--- /dev/null
+++ b/tests/auto/particles/qquicktrailemitter/data/basic.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: ["","notdefault"]
+ source: "../../shared/star.png"
+ }
+
+
+ TrailEmitter {
+ group: "notdefault"
+ follow: ""
+ size: 32
+ emitRatePerParticle: 2
+ lifeSpan: 500
+ velocity: PointDirection{ x: 500; y: 500 }
+ }
+ Emitter{
+ x: 4
+ y: 4
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro
new file mode 100644
index 0000000000..28675e2695
--- /dev/null
+++ b/tests/auto/particles/qquicktrailemitter/qquicktrailemitter.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquicktrailemitter
+SOURCES += tst_qquicktrailemitter.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp
new file mode 100644
index 0000000000..98209e218c
--- /dev/null
+++ b/tests/auto/particles/qquicktrailemitter/tst_qquicktrailemitter.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquicktrailemitter : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquicktrailemitter() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquicktrailemitter::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquicktrailemitter::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 4.f);
+ QCOMPARE(d->y, 4.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+
+ QCOMPARE(system->groupData[1]->size(), 500);
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->x, 4.f);
+ QCOMPARE(d->y, 4.f);
+ QCOMPARE(d->vx, 500.f);
+ QCOMPARE(d->vy, 500.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquicktrailemitter);
+
+#include "tst_qquicktrailemitter.moc"
diff --git a/tests/auto/particles/qquickturbulence/data/basic.qml b/tests/auto/particles/qquickturbulence/data/basic.qml
new file mode 100644
index 0000000000..b07c8a3946
--- /dev/null
+++ b/tests/auto/particles/qquickturbulence/data/basic.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Turbulence {
+ anchors.fill: parent
+ strength: 1000
+ }
+
+ Emitter{
+ //100,100 position
+ x: 100
+ y: 100
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickturbulence/qquickturbulence.pro b/tests/auto/particles/qquickturbulence/qquickturbulence.pro
new file mode 100644
index 0000000000..08961f1dc2
--- /dev/null
+++ b/tests/auto/particles/qquickturbulence/qquickturbulence.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickturbulence
+SOURCES += tst_qquickturbulence.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp
new file mode 100644
index 0000000000..78cc9fe444
--- /dev/null
+++ b/tests/auto/particles/qquickturbulence/tst_qquickturbulence.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickturbulence : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickturbulence() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickturbulence::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickturbulence::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ //Note that the noise image built-in provides the 'randomness', so this test should be stable so long as it and the size
+ //of the Turbulence item remain the same
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QVERIFY(d->vx != 0.f);
+ QVERIFY(d->vy != 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickturbulence);
+
+#include "tst_qquickturbulence.moc"
diff --git a/tests/auto/particles/qquickwander/data/basic.qml b/tests/auto/particles/qquickwander/data/basic.qml
new file mode 100644
index 0000000000..ae5a9bc368
--- /dev/null
+++ b/tests/auto/particles/qquickwander/data/basic.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Wander {
+ pace: 400
+ xVariance: 100
+ yVariance: 100
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 1000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/auto/particles/qquickwander/qquickwander.pro b/tests/auto/particles/qquickwander/qquickwander.pro
new file mode 100644
index 0000000000..6678b49435
--- /dev/null
+++ b/tests/auto/particles/qquickwander/qquickwander.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickwander
+SOURCES += tst_qquickwander.cpp
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private quickparticles-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/particles/qquickwander/tst_qquickwander.cpp b/tests/auto/particles/qquickwander/tst_qquickwander.cpp
new file mode 100644
index 0000000000..437121ab85
--- /dev/null
+++ b/tests/auto/particles/qquickwander/tst_qquickwander.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+#include <private/qabstractanimation_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickwander : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickwander() {}
+
+private slots:
+ void initTestCase();
+ void test_basic();
+};
+
+void tst_qquickwander::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickwander::test_basic()
+{
+ QQuickView* view = createView(testFileUrl("basic.qml"), 600);
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ ensureAnimTime(600, system->m_animation);
+
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
+ //Since Wander is random perturbations, the compromise between stability and actual testing is to hope that one of
+ //the 500 was randomly changed from 0.0 in velocity
+ bool vxChanged = false;
+ bool vyChanged = false;
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ if (d->vx != 0.0f)
+ vxChanged = true;
+ if (d->vy != 0.0f)
+ vyChanged = true;
+ }
+ delete view;
+ QVERIFY(vxChanged);
+ QVERIFY(vyChanged);
+}
+
+QTEST_MAIN(tst_qquickwander);
+
+#include "tst_qquickwander.moc"
diff --git a/tests/auto/particles/shared/particlestestsshared.h b/tests/auto/particles/shared/particlestestsshared.h
new file mode 100644
index 0000000000..5a77eda948
--- /dev/null
+++ b/tests/auto/particles/shared/particlestestsshared.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PARTICLES_TESTS_SHARED
+#define PARTICLES_TESTS_SHARED
+#include <QtQuick/QQuickView>
+#include <QtTest>
+#include <QAbstractAnimation>
+const qreal EPSILON = 0.0001;
+
+bool extremelyFuzzyCompare(qreal a, qreal b, qreal e)//For cases which can have larger variances
+{
+ return (a + e >= b) && (a - e <= b);
+}
+
+bool myFuzzyCompare(qreal a, qreal b)//For cases which might be near 0 so qFuzzyCompare fails
+{
+ return (a + EPSILON > b) && (a - EPSILON < b);
+}
+
+bool myFuzzyLEQ(qreal a, qreal b)
+{
+ return (a - EPSILON < b);
+}
+
+bool myFuzzyGEQ(qreal a, qreal b)
+{
+ return (a + EPSILON > b);
+}
+
+QQuickView* createView(const QUrl &filename, int additionalWait=0)
+{
+ QQuickView *view = new QQuickView(0);
+
+ view->setSource(filename);
+ if (view->status() != QQuickView::Ready)
+ return 0;
+ view->show();
+ QTest::qWaitForWindowExposed(view);
+ if (additionalWait)
+ QTest::qWait(additionalWait);
+
+ return view;
+}
+
+void ensureAnimTime(int requiredTime, QAbstractAnimation* anim)//With consistentTiming, who knows how long an animation really takes...
+{
+ while (anim->currentTime() < requiredTime)
+ QTest::qWait(100);
+}
+
+#endif
diff --git a/tests/auto/particles/shared/squarefacesprite.png b/tests/auto/particles/shared/squarefacesprite.png
new file mode 100644
index 0000000000..f9a5d5fcce
--- /dev/null
+++ b/tests/auto/particles/shared/squarefacesprite.png
Binary files differ
diff --git a/tests/auto/particles/shared/star.png b/tests/auto/particles/shared/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/tests/auto/particles/shared/star.png
Binary files differ
diff --git a/tests/auto/particles/shared/table.png b/tests/auto/particles/shared/table.png
new file mode 100644
index 0000000000..a62ceeb4a0
--- /dev/null
+++ b/tests/auto/particles/shared/table.png
Binary files differ
diff --git a/tests/auto/qml/animation/animation.pro b/tests/auto/qml/animation/animation.pro
new file mode 100644
index 0000000000..a9c0cee309
--- /dev/null
+++ b/tests/auto/qml/animation/animation.pro
@@ -0,0 +1,7 @@
+TEMPLATE=subdirs
+SUBDIRS=\
+ qabstractanimationjob \
+ qanimationgroupjob \
+ qparallelanimationgroupjob \
+ qpauseanimationjob \
+ qsequentialanimationgroupjob
diff --git a/tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro b/tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro
new file mode 100644
index 0000000000..f63a437c54
--- /dev/null
+++ b/tests/auto/qml/animation/qabstractanimationjob/qabstractanimationjob.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase parallel_test
+macx:CONFIG -= app_bundle
+TARGET = tst_qabstractanimationjob
+QT = core-private qml-private testlib
+SOURCES = tst_qabstractanimationjob.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp
new file mode 100644
index 0000000000..edc946547e
--- /dev/null
+++ b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp
@@ -0,0 +1,229 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtQml/private/qabstractanimationjob_p.h>
+#include <QtQml/private/qanimationgroupjob_p.h>
+#include <QtTest>
+
+class tst_QAbstractAnimationJob : public QObject
+{
+ Q_OBJECT
+private slots:
+ void construction();
+ void destruction();
+ void currentLoop();
+ void currentLoopTime();
+ void currentTime();
+ void direction();
+ void group();
+ void loopCount();
+ void state();
+ void totalDuration();
+ void avoidJumpAtStart();
+ void avoidJumpAtStartWithStop();
+ void avoidJumpAtStartWithRunning();
+};
+
+class TestableQAbstractAnimation : public QAbstractAnimationJob
+{
+public:
+ TestableQAbstractAnimation() : m_duration(10) {}
+ virtual ~TestableQAbstractAnimation() {};
+
+ int duration() const { return m_duration; }
+ virtual void updateCurrentTime(int) {}
+
+ void setDuration(int duration) { m_duration = duration; }
+private:
+ int m_duration;
+};
+
+class DummyQAnimationGroup : public QAnimationGroupJob
+{
+public:
+ int duration() const { return 10; }
+ virtual void updateCurrentTime(int) {}
+};
+
+void tst_QAbstractAnimationJob::construction()
+{
+ TestableQAbstractAnimation anim;
+}
+
+void tst_QAbstractAnimationJob::destruction()
+{
+ TestableQAbstractAnimation *anim = new TestableQAbstractAnimation;
+ delete anim;
+}
+
+void tst_QAbstractAnimationJob::currentLoop()
+{
+ TestableQAbstractAnimation anim;
+ QCOMPARE(anim.currentLoop(), 0);
+}
+
+void tst_QAbstractAnimationJob::currentLoopTime()
+{
+ TestableQAbstractAnimation anim;
+ QCOMPARE(anim.currentLoopTime(), 0);
+}
+
+void tst_QAbstractAnimationJob::currentTime()
+{
+ TestableQAbstractAnimation anim;
+ QCOMPARE(anim.currentTime(), 0);
+ anim.setCurrentTime(10);
+ QCOMPARE(anim.currentTime(), 10);
+}
+
+void tst_QAbstractAnimationJob::direction()
+{
+ TestableQAbstractAnimation anim;
+ QCOMPARE(anim.direction(), QAbstractAnimationJob::Forward);
+ anim.setDirection(QAbstractAnimationJob::Backward);
+ QCOMPARE(anim.direction(), QAbstractAnimationJob::Backward);
+ anim.setDirection(QAbstractAnimationJob::Forward);
+ QCOMPARE(anim.direction(), QAbstractAnimationJob::Forward);
+}
+
+void tst_QAbstractAnimationJob::group()
+{
+ TestableQAbstractAnimation *anim = new TestableQAbstractAnimation;
+ DummyQAnimationGroup group;
+ group.appendAnimation(anim);
+ QCOMPARE(anim->group(), &group);
+}
+
+void tst_QAbstractAnimationJob::loopCount()
+{
+ TestableQAbstractAnimation anim;
+ QCOMPARE(anim.loopCount(), 1);
+ anim.setLoopCount(10);
+ QCOMPARE(anim.loopCount(), 10);
+}
+
+void tst_QAbstractAnimationJob::state()
+{
+ TestableQAbstractAnimation anim;
+ QCOMPARE(anim.state(), QAbstractAnimationJob::Stopped);
+}
+
+void tst_QAbstractAnimationJob::totalDuration()
+{
+ TestableQAbstractAnimation anim;
+ QCOMPARE(anim.duration(), 10);
+ anim.setLoopCount(5);
+ QCOMPARE(anim.totalDuration(), 50);
+}
+
+void tst_QAbstractAnimationJob::avoidJumpAtStart()
+{
+ TestableQAbstractAnimation anim;
+ anim.setDuration(1000);
+
+ /*
+ the timer shouldn't actually start until we hit the event loop,
+ so the sleep should have no effect
+ */
+ anim.start();
+ QTest::qSleep(300);
+ QCoreApplication::processEvents();
+ QVERIFY(anim.currentTime() < 50);
+}
+
+void tst_QAbstractAnimationJob::avoidJumpAtStartWithStop()
+{
+ TestableQAbstractAnimation anim;
+ anim.setDuration(1000);
+
+ TestableQAbstractAnimation anim2;
+ anim2.setDuration(1000);
+
+ TestableQAbstractAnimation anim3;
+ anim3.setDuration(1000);
+
+ anim.start();
+ QTest::qWait(300);
+ anim.stop();
+
+ /*
+ same test as avoidJumpAtStart, but after there is a
+ running animation that is stopped
+ */
+ anim2.start();
+ QTest::qSleep(300);
+ anim3.start();
+ QCoreApplication::processEvents();
+ QVERIFY(anim2.currentTime() < 50);
+ QVERIFY(anim3.currentTime() < 50);
+}
+
+void tst_QAbstractAnimationJob::avoidJumpAtStartWithRunning()
+{
+ TestableQAbstractAnimation anim;
+ anim.setDuration(2000);
+
+ TestableQAbstractAnimation anim2;
+ anim2.setDuration(1000);
+
+ TestableQAbstractAnimation anim3;
+ anim3.setDuration(1000);
+
+ anim.start();
+ QTest::qWait(300); //make sure timer has started
+
+ /*
+ same test as avoidJumpAtStart, but with an
+ existing running animation
+ */
+ anim2.start();
+ QTest::qSleep(300); //force large delta for next tick
+ anim3.start();
+ QCoreApplication::processEvents();
+ QVERIFY(anim2.currentTime() < 50);
+ QVERIFY(anim3.currentTime() < 50);
+}
+
+
+QTEST_MAIN(tst_QAbstractAnimationJob)
+
+#include "tst_qabstractanimationjob.moc"
diff --git a/tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro b/tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro
new file mode 100644
index 0000000000..136999ce13
--- /dev/null
+++ b/tests/auto/qml/animation/qanimationgroupjob/qanimationgroupjob.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase parallel_test
+macx:CONFIG -= app_bundle
+TARGET = tst_qanimationgroupjob
+QT = core-private qml-private testlib
+SOURCES = tst_qanimationgroupjob.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
new file mode 100644
index 0000000000..51429ecb74
--- /dev/null
+++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
@@ -0,0 +1,310 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QtQml/private/qanimationgroupjob_p.h>
+#include <QtQml/private/qsequentialanimationgroupjob_p.h>
+#include <QtQml/private/qparallelanimationgroupjob_p.h>
+
+Q_DECLARE_METATYPE(QAbstractAnimationJob::State)
+
+class tst_QAnimationGroupJob : public QObject
+{
+ Q_OBJECT
+public Q_SLOTS:
+ void initTestCase();
+
+private slots:
+ void construction();
+ void emptyGroup();
+ void setCurrentTime();
+ void addChildTwice();
+};
+
+void tst_QAnimationGroupJob::initTestCase()
+{
+ qRegisterMetaType<QAbstractAnimationJob::State>("QAbstractAnimationJob::State");
+}
+
+void tst_QAnimationGroupJob::construction()
+{
+ QSequentialAnimationGroupJob animationgroup;
+}
+
+class TestableGenericAnimation : public QAbstractAnimationJob
+{
+public:
+ TestableGenericAnimation(int duration = 250) : m_duration(duration) {}
+ int duration() const { return m_duration; }
+
+private:
+ int m_duration;
+};
+
+class UncontrolledAnimation : public QObject, public QAbstractAnimationJob
+{
+ Q_OBJECT
+public:
+ UncontrolledAnimation()
+ : id(0)
+ {
+ }
+
+ int duration() const { return -1; /* not time driven */ }
+
+protected:
+ void timerEvent(QTimerEvent *event)
+ {
+ if (event->timerId() == id)
+ stop();
+ }
+
+ void updateRunning(bool running)
+ {
+ if (running) {
+ id = startTimer(500);
+ } else {
+ killTimer(id);
+ id = 0;
+ }
+ }
+
+private:
+ int id;
+};
+
+class StateChangeListener: public QAnimationJobChangeListener
+{
+public:
+ virtual void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State)
+ {
+ states << newState;
+ }
+
+ int count()
+ {
+ return states.count();
+ }
+
+ QList<QAbstractAnimationJob::State> states;
+};
+
+void tst_QAnimationGroupJob::emptyGroup()
+{
+ QSequentialAnimationGroupJob group;
+ StateChangeListener groupStateChangedSpy;
+ group.addAnimationChangeListener(&groupStateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ group.start();
+
+ QCOMPARE(groupStateChangedSpy.count(), 2);
+
+ QCOMPARE(groupStateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(groupStateChangedSpy.states.at(1), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+
+ QTest::ignoreMessage(QtWarningMsg, "QAbstractAnimationJob::pause: Cannot pause a stopped animation");
+ group.pause();
+
+ QCOMPARE(groupStateChangedSpy.count(), 2);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+
+ group.start();
+
+ QCOMPARE(groupStateChangedSpy.states.at(2),
+ QAnimationGroupJob::Running);
+ QCOMPARE(groupStateChangedSpy.states.at(3),
+ QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+
+ group.stop();
+
+ QCOMPARE(groupStateChangedSpy.count(), 4);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QAnimationGroupJob::setCurrentTime()
+{
+ // was originally sequence operating on same object/property
+ QSequentialAnimationGroupJob *sequence = new QSequentialAnimationGroupJob();
+ QAbstractAnimationJob *a1_s_o1 = new TestableGenericAnimation;
+ QAbstractAnimationJob *a2_s_o1 = new TestableGenericAnimation;
+ QAbstractAnimationJob *a3_s_o1 = new TestableGenericAnimation;
+ a2_s_o1->setLoopCount(3);
+ sequence->appendAnimation(a1_s_o1);
+ sequence->appendAnimation(a2_s_o1);
+ sequence->appendAnimation(a3_s_o1);
+
+ // was originally sequence operating on different object/properties
+ QAnimationGroupJob *sequence2 = new QSequentialAnimationGroupJob();
+ QAbstractAnimationJob *a1_s_o2 = new TestableGenericAnimation;
+ QAbstractAnimationJob *a1_s_o3 = new TestableGenericAnimation;
+ sequence2->appendAnimation(a1_s_o2);
+ sequence2->appendAnimation(a1_s_o3);
+
+ // was originally parallel operating on different object/properties
+ QAnimationGroupJob *parallel = new QParallelAnimationGroupJob();
+ QAbstractAnimationJob *a1_p_o1 = new TestableGenericAnimation;
+ QAbstractAnimationJob *a1_p_o2 = new TestableGenericAnimation;
+ QAbstractAnimationJob *a1_p_o3 = new TestableGenericAnimation;
+ a1_p_o2->setLoopCount(3);
+ parallel->appendAnimation(a1_p_o1);
+ parallel->appendAnimation(a1_p_o2);
+ parallel->appendAnimation(a1_p_o3);
+
+ QAbstractAnimationJob *notTimeDriven = new UncontrolledAnimation;
+ QCOMPARE(notTimeDriven->totalDuration(), -1);
+
+ QAbstractAnimationJob *loopsForever = new TestableGenericAnimation;
+ loopsForever->setLoopCount(-1);
+ QCOMPARE(loopsForever->totalDuration(), -1);
+
+ QParallelAnimationGroupJob group;
+ group.appendAnimation(sequence);
+ group.appendAnimation(sequence2);
+ group.appendAnimation(parallel);
+ group.appendAnimation(notTimeDriven);
+ group.appendAnimation(loopsForever);
+
+ // Current time = 1
+ group.setCurrentTime(1);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(parallel->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_p_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_p_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_p_o3->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever->state(), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 1);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 1);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
+
+ // Current time = 250
+ group.setCurrentTime(250);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(sequence->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_p_o2->currentLoop(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoop(), 1);
+ QCOMPARE(sequence->currentAnimation(), a2_s_o1);
+
+ // Current time = 251
+ group.setCurrentTime(251);
+ QCOMPARE(group.currentLoopTime(), 251);
+ QCOMPARE(sequence->currentLoopTime(), 251);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoop(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 251);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o2->currentLoop(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 251);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
+ QCOMPARE(sequence->currentAnimation(), a2_s_o1);
+}
+
+void tst_QAnimationGroupJob::addChildTwice()
+{
+ QAbstractAnimationJob *subGroup;
+ QAbstractAnimationJob *subGroup2;
+ QAnimationGroupJob *parent = new QSequentialAnimationGroupJob();
+
+ subGroup = new QAbstractAnimationJob;
+ parent->appendAnimation(subGroup);
+ parent->appendAnimation(subGroup);
+ QVERIFY(parent->firstChild() && !parent->firstChild()->nextSibling());
+
+ parent->clear();
+
+ QVERIFY(!parent->firstChild());
+
+ // adding the same item twice to a group will remove the item from its current position
+ // and append it to the end
+ subGroup = new QAbstractAnimationJob;
+ parent->appendAnimation(subGroup);
+ subGroup2 = new QAbstractAnimationJob;
+ parent->appendAnimation(subGroup2);
+
+ QCOMPARE(parent->firstChild(), subGroup);
+ QCOMPARE(parent->lastChild(), subGroup2);
+
+ parent->appendAnimation(subGroup);
+
+ QCOMPARE(parent->firstChild(), subGroup2);
+ QCOMPARE(parent->lastChild(), subGroup);
+
+ delete parent;
+}
+
+QTEST_MAIN(tst_QAnimationGroupJob)
+#include "tst_qanimationgroupjob.moc"
diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro b/tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro
new file mode 100644
index 0000000000..2cc057cb90
--- /dev/null
+++ b/tests/auto/qml/animation/qparallelanimationgroupjob/qparallelanimationgroupjob.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase
+CONFIG += parallel_test
+macx:CONFIG -= app_bundle
+TARGET = tst_qparallelanimationgroupjob
+QT = core-private gui qml-private testlib gui-private
+SOURCES = tst_qparallelanimationgroupjob.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
new file mode 100644
index 0000000000..3fed59ea20
--- /dev/null
+++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
@@ -0,0 +1,931 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QtQml/private/qparallelanimationgroupjob_p.h>
+
+Q_DECLARE_METATYPE(QAbstractAnimationJob::State)
+
+class tst_QParallelAnimationGroupJob : public QObject
+{
+ Q_OBJECT
+public Q_SLOTS:
+ void initTestCase();
+
+private slots:
+ void construction();
+ void setCurrentTime();
+ void stateChanged();
+ void clearGroup();
+ void propagateGroupUpdateToChildren();
+ void updateChildrenWithRunningGroup();
+ void deleteChildrenWithRunningGroup();
+ void startChildrenWithStoppedGroup();
+ void stopGroupWithRunningChild();
+ void startGroupWithRunningChild();
+ void zeroDurationAnimation();
+ void stopUncontrolledAnimations();
+ void loopCount_data();
+ void loopCount();
+ void addAndRemoveDuration();
+ void pauseResume();
+
+ void crashWhenRemovingUncontrolledAnimation();
+};
+
+void tst_QParallelAnimationGroupJob::initTestCase()
+{
+ qRegisterMetaType<QAbstractAnimationJob::State>("QAbstractAnimationJob::State");
+#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+ // give the mac/wince app start event queue time to clear
+ QTest::qWait(1000);
+#endif
+}
+
+void tst_QParallelAnimationGroupJob::construction()
+{
+ QParallelAnimationGroupJob animationgroup;
+}
+
+class TestAnimation : public QAbstractAnimationJob
+{
+public:
+ TestAnimation(int duration = 250) : m_duration(duration) {}
+ int duration() const { return m_duration; }
+
+private:
+ int m_duration;
+};
+
+class UncontrolledAnimation : public QObject, public QAbstractAnimationJob
+{
+ Q_OBJECT
+public:
+ UncontrolledAnimation()
+ : id(0)
+ {
+ }
+
+ int duration() const { return -1; /* not time driven */ }
+
+protected:
+ void timerEvent(QTimerEvent *event)
+ {
+ if (event->timerId() == id)
+ stop();
+ }
+
+ void updateRunning(bool running)
+ {
+ if (running) {
+ id = startTimer(500);
+ } else {
+ killTimer(id);
+ id = 0;
+ }
+ }
+
+private:
+ int id;
+};
+
+class StateChangeListener: public QAnimationJobChangeListener
+{
+public:
+ virtual void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State)
+ {
+ states << newState;
+ }
+
+ void clear() { states.clear(); }
+ int count() { return states.count(); }
+
+ QList<QAbstractAnimationJob::State> states;
+};
+
+class FinishedListener: public QAnimationJobChangeListener
+{
+public:
+ FinishedListener() : m_count(0) {}
+
+ virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; }
+ void clear() { m_count = 0; }
+ int count() { return m_count; }
+
+private:
+ int m_count;
+};
+
+void tst_QParallelAnimationGroupJob::setCurrentTime()
+{
+ // originally was parallel operating on different object/properties
+ QAnimationGroupJob *parallel = new QParallelAnimationGroupJob();
+ TestAnimation *a1_p_o1 = new TestAnimation;
+ TestAnimation *a1_p_o2 = new TestAnimation;
+ TestAnimation *a1_p_o3 = new TestAnimation;
+ a1_p_o2->setLoopCount(3);
+ parallel->appendAnimation(a1_p_o1);
+ parallel->appendAnimation(a1_p_o2);
+ parallel->appendAnimation(a1_p_o3);
+
+ UncontrolledAnimation *notTimeDriven = new UncontrolledAnimation;
+ QCOMPARE(notTimeDriven->totalDuration(), -1);
+
+ TestAnimation *loopsForever = new TestAnimation;
+ loopsForever->setLoopCount(-1);
+ QCOMPARE(loopsForever->totalDuration(), -1);
+
+ QParallelAnimationGroupJob group;
+ group.appendAnimation(parallel);
+ group.appendAnimation(notTimeDriven);
+ group.appendAnimation(loopsForever);
+
+ // Current time = 1
+ group.setCurrentTime(1);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(parallel->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_p_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_p_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_p_o3->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever->state(), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 1);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 1);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
+
+ // Current time = 250
+ group.setCurrentTime(250);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_p_o2->currentLoop(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoop(), 1);
+
+ // Current time = 251
+ group.setCurrentTime(251);
+ QCOMPARE(group.currentLoopTime(), 251);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o2->currentLoop(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 251);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
+}
+
+void tst_QParallelAnimationGroupJob::stateChanged()
+{
+ //this ensures that the correct animations are started when starting the group
+ TestAnimation *anim1 = new TestAnimation(1000);
+ TestAnimation *anim2 = new TestAnimation(2000);
+ TestAnimation *anim3 = new TestAnimation(3000);
+ TestAnimation *anim4 = new TestAnimation(3000);
+
+ QParallelAnimationGroupJob group;
+ group.appendAnimation(anim1);
+ group.appendAnimation(anim2);
+ group.appendAnimation(anim3);
+ group.appendAnimation(anim4);
+
+ StateChangeListener spy1;
+ anim1->addAnimationChangeListener(&spy1, QAbstractAnimationJob::StateChange);
+ StateChangeListener spy2;
+ anim2->addAnimationChangeListener(&spy2, QAbstractAnimationJob::StateChange);
+ StateChangeListener spy3;
+ anim3->addAnimationChangeListener(&spy3, QAbstractAnimationJob::StateChange);
+ StateChangeListener spy4;
+ anim4->addAnimationChangeListener(&spy4, QAbstractAnimationJob::StateChange);
+
+ //first; let's start forward
+ group.start();
+ //all the animations should be started
+ QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy1.states.last(), TestAnimation::Running);
+ QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy2.states.last(), TestAnimation::Running);
+ QCOMPARE(spy3.count(), 1);
+ QCOMPARE(spy3.states.last(), TestAnimation::Running);
+ QCOMPARE(spy4.count(), 1);
+ QCOMPARE(spy4.states.last(), TestAnimation::Running);
+
+ group.setCurrentTime(1500); //anim1 should be finished
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(spy1.count(), 2);
+ QCOMPARE(spy1.states.last(), TestAnimation::Stopped);
+ QCOMPARE(spy2.count(), 1); //no change
+ QCOMPARE(spy3.count(), 1); //no change
+ QCOMPARE(spy4.count(), 1); //no change
+
+ group.setCurrentTime(2500); //anim2 should be finished
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(spy1.count(), 2); //no change
+ QCOMPARE(spy2.count(), 2);
+ QCOMPARE(spy2.states.last(), TestAnimation::Stopped);
+ QCOMPARE(spy3.count(), 1); //no change
+ QCOMPARE(spy4.count(), 1); //no change
+
+ group.setCurrentTime(3500); //everything should be finished
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(spy1.count(), 2); //no change
+ QCOMPARE(spy2.count(), 2); //no change
+ QCOMPARE(spy3.count(), 2);
+ QCOMPARE(spy3.states.last(), TestAnimation::Stopped);
+ QCOMPARE(spy4.count(), 2);
+ QCOMPARE(spy4.states.last(), TestAnimation::Stopped);
+
+ //cleanup
+ spy1.clear();
+ spy2.clear();
+ spy3.clear();
+ spy4.clear();
+
+ //now let's try to reverse that
+ group.setDirection(QAbstractAnimationJob::Backward);
+ group.start();
+
+ //only anim3 and anim4 should be started
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(spy1.count(), 0);
+ QCOMPARE(spy2.count(), 0);
+ QCOMPARE(spy3.count(), 1);
+ QCOMPARE(spy3.states.last(), TestAnimation::Running);
+ QCOMPARE(spy4.count(), 1);
+ QCOMPARE(spy4.states.last(), TestAnimation::Running);
+
+ group.setCurrentTime(1500); //anim2 should be started
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(spy1.count(), 0); //no change
+ QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy2.states.last(), TestAnimation::Running);
+ QCOMPARE(spy3.count(), 1); //no change
+ QCOMPARE(spy4.count(), 1); //no change
+
+ group.setCurrentTime(500); //anim1 is finally also started
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy1.states.last(), TestAnimation::Running);
+ QCOMPARE(spy2.count(), 1); //no change
+ QCOMPARE(spy3.count(), 1); //no change
+ QCOMPARE(spy4.count(), 1); //no change
+
+ group.setCurrentTime(0); //everything should be stopped
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(spy1.count(), 2);
+ QCOMPARE(spy1.states.last(), TestAnimation::Stopped);
+ QCOMPARE(spy2.count(), 2);
+ QCOMPARE(spy2.states.last(), TestAnimation::Stopped);
+ QCOMPARE(spy3.count(), 2);
+ QCOMPARE(spy3.states.last(), TestAnimation::Stopped);
+ QCOMPARE(spy4.count(), 2);
+ QCOMPARE(spy4.states.last(), TestAnimation::Stopped);
+}
+
+void tst_QParallelAnimationGroupJob::clearGroup()
+{
+ QParallelAnimationGroupJob group;
+ static const int animationCount = 10;
+
+ for (int i = 0; i < animationCount; ++i) {
+ group.appendAnimation(new QParallelAnimationGroupJob);
+ }
+
+ int count = 0;
+ for (QAbstractAnimationJob *anim = group.firstChild(); anim; anim = anim->nextSibling())
+ ++count;
+ QCOMPARE(count, animationCount);
+
+ group.clear();
+
+ QVERIFY(!group.firstChild() && !group.lastChild());
+ QCOMPARE(group.currentLoopTime(), 0);
+}
+
+void tst_QParallelAnimationGroupJob::propagateGroupUpdateToChildren()
+{
+ // this test verifies if group state changes are updating its children correctly
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim1(100);
+ TestAnimation anim2(200);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+
+ group.start();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Running);
+
+ group.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+
+ group.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QParallelAnimationGroupJob::updateChildrenWithRunningGroup()
+{
+ // assert that its possible to modify a child's state directly while their group is running
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim(200);
+
+ StateChangeListener groupStateChangedSpy;
+ group.addAnimationChangeListener(&groupStateChangedSpy, QAbstractAnimationJob::StateChange);
+ StateChangeListener childStateChangedSpy;
+ anim.addAnimationChangeListener(&childStateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ QCOMPARE(groupStateChangedSpy.count(), 0);
+ QCOMPARE(childStateChangedSpy.count(), 0);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim);
+
+ group.start();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Running);
+
+ QCOMPARE(groupStateChangedSpy.count(), 1);
+ QCOMPARE(childStateChangedSpy.count(), 1);
+
+ QCOMPARE(groupStateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(childStateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+
+ // starting directly a running child will not have any effect
+ anim.start();
+
+ QCOMPARE(groupStateChangedSpy.count(), 1);
+ QCOMPARE(childStateChangedSpy.count(), 1);
+
+ anim.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Paused);
+
+ // in the animation stops directly, the group will still be running
+ anim.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Stopped);
+
+ //cleanup
+ group.removeAnimationChangeListener(&groupStateChangedSpy, QAbstractAnimationJob::StateChange);
+ anim.removeAnimationChangeListener(&childStateChangedSpy, QAbstractAnimationJob::StateChange);
+}
+
+void tst_QParallelAnimationGroupJob::deleteChildrenWithRunningGroup()
+{
+ // test if children can be activated when their group is stopped
+ QParallelAnimationGroupJob group;
+
+ TestAnimation *anim1 = new TestAnimation(200);
+ group.appendAnimation(anim1);
+
+ QCOMPARE(group.duration(), anim1->duration());
+
+ group.start();
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Running);
+
+ QTest::qWait(80);
+ QVERIFY(group.currentLoopTime() > 0);
+
+ delete anim1;
+ QVERIFY(!group.firstChild());
+ QCOMPARE(group.duration(), 0);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(group.currentLoopTime(), 0); //that's the invariant
+}
+
+void tst_QParallelAnimationGroupJob::startChildrenWithStoppedGroup()
+{
+ // test if children can be activated when their group is stopped
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim1(200);
+ TestAnimation anim2(200);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+
+ group.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ anim1.start();
+ anim2.start();
+ anim2.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+}
+
+void tst_QParallelAnimationGroupJob::stopGroupWithRunningChild()
+{
+ // children that started independently will not be affected by a group stop
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim1(200);
+ TestAnimation anim2(200);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+
+ anim1.start();
+ anim2.start();
+ anim2.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+
+ group.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+
+ anim1.stop();
+ anim2.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QParallelAnimationGroupJob::startGroupWithRunningChild()
+{
+ // as the group has precedence over its children, starting a group will restart all the children
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim1(200);
+ TestAnimation anim2(200);
+
+ StateChangeListener stateChangedSpy1;
+ anim1.addAnimationChangeListener(&stateChangedSpy1, QAbstractAnimationJob::StateChange);
+ StateChangeListener stateChangedSpy2;
+ anim2.addAnimationChangeListener(&stateChangedSpy2, QAbstractAnimationJob::StateChange);
+
+ QCOMPARE(stateChangedSpy1.count(), 0);
+ QCOMPARE(stateChangedSpy2.count(), 0);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+
+ anim1.start();
+ anim2.start();
+ anim2.pause();
+
+ QCOMPARE(stateChangedSpy1.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(stateChangedSpy2.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(stateChangedSpy2.states.at(1), QAnimationGroupJob::Paused);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+
+ group.start();
+
+ QCOMPARE(stateChangedSpy1.count(), 3);
+ QCOMPARE(stateChangedSpy1.states.at(1), QAnimationGroupJob::Stopped);
+ QCOMPARE(stateChangedSpy1.states.at(2), QAnimationGroupJob::Running);
+
+ QCOMPARE(stateChangedSpy2.count(), 4);
+ QCOMPARE(stateChangedSpy2.states.at(2), QAnimationGroupJob::Stopped);
+ QCOMPARE(stateChangedSpy2.states.at(3), QAnimationGroupJob::Running);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Running);
+
+ //cleanup
+ anim1.removeAnimationChangeListener(&stateChangedSpy1, QAbstractAnimationJob::StateChange);
+ anim2.removeAnimationChangeListener(&stateChangedSpy2, QAbstractAnimationJob::StateChange);
+}
+
+void tst_QParallelAnimationGroupJob::zeroDurationAnimation()
+{
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim1(0);
+ TestAnimation anim2(100);
+ TestAnimation anim3(10);
+
+ StateChangeListener stateChangedSpy1;
+ anim1.addAnimationChangeListener(&stateChangedSpy1, QAbstractAnimationJob::StateChange);
+ FinishedListener finishedSpy1;
+ anim1.addAnimationChangeListener(&finishedSpy1, QAbstractAnimationJob::Completion);
+
+ StateChangeListener stateChangedSpy2;
+ anim2.addAnimationChangeListener(&stateChangedSpy2, QAbstractAnimationJob::StateChange);
+ FinishedListener finishedSpy2;
+ anim2.addAnimationChangeListener(&finishedSpy2, QAbstractAnimationJob::Completion);
+
+ StateChangeListener stateChangedSpy3;
+ anim3.addAnimationChangeListener(&stateChangedSpy3, QAbstractAnimationJob::StateChange);
+ FinishedListener finishedSpy3;
+ anim3.addAnimationChangeListener(&finishedSpy3, QAbstractAnimationJob::Completion);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+ group.appendAnimation(&anim3);
+ QCOMPARE(stateChangedSpy1.count(), 0);
+ group.start();
+ QCOMPARE(stateChangedSpy1.count(), 2);
+ QCOMPARE(finishedSpy1.count(), 1);
+ QCOMPARE(stateChangedSpy1.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(stateChangedSpy1.states.at(1), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(stateChangedSpy2.count(), 1);
+ QCOMPARE(finishedSpy2.count(), 0);
+ QCOMPARE(stateChangedSpy1.states.at(0), QAnimationGroupJob::Running);
+
+ QCOMPARE(stateChangedSpy3.count(), 1);
+ QCOMPARE(finishedSpy3.count(), 0);
+ QCOMPARE(stateChangedSpy3.states.at(0), QAnimationGroupJob::Running);
+
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim3.state(), QAnimationGroupJob::Running);
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+
+ group.stop();
+ group.setLoopCount(4);
+ stateChangedSpy1.clear();
+ stateChangedSpy2.clear();
+ stateChangedSpy3.clear();
+
+ group.start();
+ QCOMPARE(stateChangedSpy1.count(), 2);
+ QCOMPARE(stateChangedSpy2.count(), 1);
+ QCOMPARE(stateChangedSpy3.count(), 1);
+ group.setCurrentTime(50);
+ QCOMPARE(stateChangedSpy1.count(), 2);
+ QCOMPARE(stateChangedSpy2.count(), 1);
+ QCOMPARE(stateChangedSpy3.count(), 2);
+ group.setCurrentTime(150);
+ QCOMPARE(stateChangedSpy1.count(), 4);
+ QCOMPARE(stateChangedSpy2.count(), 3);
+ QCOMPARE(stateChangedSpy3.count(), 4);
+ group.setCurrentTime(50);
+ QCOMPARE(stateChangedSpy1.count(), 6);
+ QCOMPARE(stateChangedSpy2.count(), 5);
+ QCOMPARE(stateChangedSpy3.count(), 6);
+
+ //cleanup
+ anim1.removeAnimationChangeListener(&stateChangedSpy1, QAbstractAnimationJob::StateChange);
+ anim1.removeAnimationChangeListener(&finishedSpy1, QAbstractAnimationJob::Completion);
+ anim2.removeAnimationChangeListener(&stateChangedSpy2, QAbstractAnimationJob::StateChange);
+ anim2.removeAnimationChangeListener(&finishedSpy2, QAbstractAnimationJob::Completion);
+ anim3.removeAnimationChangeListener(&stateChangedSpy3, QAbstractAnimationJob::StateChange);
+ anim3.removeAnimationChangeListener(&finishedSpy3, QAbstractAnimationJob::Completion);
+}
+
+void tst_QParallelAnimationGroupJob::stopUncontrolledAnimations()
+{
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim1(0);
+
+ UncontrolledAnimation notTimeDriven;
+ QCOMPARE(notTimeDriven.totalDuration(), -1);
+
+ TestAnimation loopsForever(100);
+ loopsForever.setLoopCount(-1);
+
+ StateChangeListener stateChangedSpy;
+ anim1.addAnimationChangeListener(&stateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&notTimeDriven);
+ group.appendAnimation(&loopsForever);
+
+ group.start();
+
+ QCOMPARE(stateChangedSpy.count(), 2);
+ QCOMPARE(stateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(stateChangedSpy.states.at(1), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Running);
+ QCOMPARE(loopsForever.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+
+ notTimeDriven.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever.state(), QAnimationGroupJob::Running);
+
+ loopsForever.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever.state(), QAnimationGroupJob::Stopped);
+}
+
+struct AnimState {
+ AnimState(int time = -1) : time(time), state(-1) {}
+ AnimState(int time, int state) : time(time), state(state) {}
+ int time;
+ int state;
+};
+
+#define Running QAbstractAnimationJob::Running
+#define Stopped QAbstractAnimationJob::Stopped
+
+Q_DECLARE_METATYPE(AnimState)
+void tst_QParallelAnimationGroupJob::loopCount_data()
+{
+ QTest::addColumn<bool>("directionBackward");
+ QTest::addColumn<int>("setLoopCount");
+ QTest::addColumn<int>("initialGroupTime");
+ QTest::addColumn<int>("currentGroupTime");
+ QTest::addColumn<AnimState>("expected1");
+ QTest::addColumn<AnimState>("expected2");
+ QTest::addColumn<AnimState>("expected3");
+
+ // D U R A T I O N
+ // 100 60*2 0
+ // direction = Forward
+ QTest::newRow("50") << false << 3 << 0 << 50 << AnimState( 50, Running) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("100") << false << 3 << 0 << 100 << AnimState(100 ) << AnimState( 40, Running) << AnimState( 0, Stopped);
+ QTest::newRow("110") << false << 3 << 0 << 110 << AnimState(100, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("120") << false << 3 << 0 << 120 << AnimState( 0, Running) << AnimState( 0, Running) << AnimState( 0, Stopped);
+
+ QTest::newRow("170") << false << 3 << 0 << 170 << AnimState( 50, Running) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("220") << false << 3 << 0 << 220 << AnimState(100 ) << AnimState( 40, Running) << AnimState( 0, Stopped);
+ QTest::newRow("230") << false << 3 << 0 << 230 << AnimState(100, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("240") << false << 3 << 0 << 240 << AnimState( 0, Running) << AnimState( 0, Running) << AnimState( 0, Stopped);
+
+ QTest::newRow("290") << false << 3 << 0 << 290 << AnimState( 50, Running) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("340") << false << 3 << 0 << 340 << AnimState(100 ) << AnimState( 40, Running) << AnimState( 0, Stopped);
+ QTest::newRow("350") << false << 3 << 0 << 350 << AnimState(100, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("360") << false << 3 << 0 << 360 << AnimState(100, Stopped) << AnimState( 60 ) << AnimState( 0, Stopped);
+
+ QTest::newRow("410") << false << 3 << 0 << 410 << AnimState(100, Stopped) << AnimState( 60, Stopped) << AnimState( 0, Stopped);
+ QTest::newRow("460") << false << 3 << 0 << 460 << AnimState(100, Stopped) << AnimState( 60, Stopped) << AnimState( 0, Stopped);
+ QTest::newRow("470") << false << 3 << 0 << 470 << AnimState(100, Stopped) << AnimState( 60, Stopped) << AnimState( 0, Stopped);
+ QTest::newRow("480") << false << 3 << 0 << 480 << AnimState(100, Stopped) << AnimState( 60, Stopped) << AnimState( 0, Stopped);
+
+ // direction = Forward, rewind
+ QTest::newRow("120-110") << false << 3 << 120 << 110 << AnimState( 0, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("120-50") << false << 3 << 120 << 50 << AnimState( 50, Running) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("120-0") << false << 3 << 120 << 0 << AnimState( 0, Running) << AnimState( 0, Running) << AnimState( 0, Stopped);
+ QTest::newRow("300-110") << false << 3 << 300 << 110 << AnimState( 0, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("300-50") << false << 3 << 300 << 50 << AnimState( 50, Running) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("300-0") << false << 3 << 300 << 0 << AnimState( 0, Running) << AnimState( 0, Running) << AnimState( 0, Stopped);
+ QTest::newRow("115-105") << false << 3 << 115 << 105 << AnimState( 42, Stopped) << AnimState( 45, Running) << AnimState( 0, Stopped);
+
+ // direction = Backward
+ QTest::newRow("b120-120") << true << 3 << 120 << 120 << AnimState( 42, Stopped) << AnimState( 60, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b120-110") << true << 3 << 120 << 110 << AnimState( 42, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b120-100") << true << 3 << 120 << 100 << AnimState(100, Running) << AnimState( 40, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b120-50") << true << 3 << 120 << 50 << AnimState( 50, Running) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b120-0") << true << 3 << 120 << 0 << AnimState( 0, Stopped) << AnimState( 0, Stopped) << AnimState( 0, Stopped);
+ QTest::newRow("b360-170") << true << 3 << 360 << 170 << AnimState( 50, Running) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b360-220") << true << 3 << 360 << 220 << AnimState(100, Running) << AnimState( 40, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b360-210") << true << 3 << 360 << 210 << AnimState( 90, Running) << AnimState( 30, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b360-120") << true << 3 << 360 << 120 << AnimState( 0, Stopped) << AnimState( 60, Running) << AnimState( 0, Stopped);
+
+ // rewind, direction = Backward
+ QTest::newRow("b50-110") << true << 3 << 50 << 110 << AnimState(100, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b50-120") << true << 3 << 50 << 120 << AnimState(100, Stopped) << AnimState( 60, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b50-140") << true << 3 << 50 << 140 << AnimState( 20, Running) << AnimState( 20, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b50-240") << true << 3 << 50 << 240 << AnimState(100, Stopped) << AnimState( 60, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b50-260") << true << 3 << 50 << 260 << AnimState( 20, Running) << AnimState( 20, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b50-350") << true << 3 << 50 << 350 << AnimState(100, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+
+ // infinite looping
+ QTest::newRow("inf1220") << false << -1 << 0 << 1220 << AnimState( 20, Running) << AnimState( 20, Running) << AnimState( 0, Stopped);
+ QTest::newRow("inf1310") << false << -1 << 0 << 1310 << AnimState( 100, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+ // infinite looping, direction = Backward (will only loop once)
+ QTest::newRow("b.inf120-120") << true << -1 << 120 << 120 << AnimState( 42, Stopped) << AnimState( 60, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b.inf120-20") << true << -1 << 120 << 20 << AnimState( 20, Running) << AnimState( 20, Running) << AnimState( 0, Stopped);
+ QTest::newRow("b.inf120-110") << true << -1 << 120 << 110 << AnimState( 42, Stopped) << AnimState( 50, Running) << AnimState( 0, Stopped);
+
+
+}
+
+void tst_QParallelAnimationGroupJob::loopCount()
+{
+ QFETCH(bool, directionBackward);
+ QFETCH(int, setLoopCount);
+ QFETCH(int, initialGroupTime);
+ QFETCH(int, currentGroupTime);
+ QFETCH(AnimState, expected1);
+ QFETCH(AnimState, expected2);
+ QFETCH(AnimState, expected3);
+
+ QParallelAnimationGroupJob group;
+
+ TestAnimation anim1(100);
+ TestAnimation anim2(60); //total 120
+ anim2.setLoopCount(2);
+ TestAnimation anim3(0);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+ group.appendAnimation(&anim3);
+
+ group.setLoopCount(setLoopCount);
+ if (initialGroupTime >= 0)
+ group.setCurrentTime(initialGroupTime);
+ if (directionBackward)
+ group.setDirection(QAbstractAnimationJob::Backward);
+
+ group.start();
+ if (initialGroupTime >= 0)
+ group.setCurrentTime(initialGroupTime);
+
+ anim1.setCurrentTime(42); // 42 is "untouched"
+ anim2.setCurrentTime(42);
+
+ group.setCurrentTime(currentGroupTime);
+
+ QCOMPARE(anim1.currentLoopTime(), expected1.time);
+ QCOMPARE(anim2.currentLoopTime(), expected2.time);
+ QCOMPARE(anim3.currentLoopTime(), expected3.time);
+
+ if (expected1.state >=0)
+ QCOMPARE(int(anim1.state()), expected1.state);
+ if (expected2.state >=0)
+ QCOMPARE(int(anim2.state()), expected2.state);
+ if (expected3.state >=0)
+ QCOMPARE(int(anim3.state()), expected3.state);
+
+}
+
+void tst_QParallelAnimationGroupJob::addAndRemoveDuration()
+{
+ QParallelAnimationGroupJob group;
+ QCOMPARE(group.duration(), 0);
+ TestAnimation *test = new TestAnimation(250); // 0, duration = 250;
+ group.appendAnimation(test);
+ QCOMPARE(test->group(), static_cast<QAnimationGroupJob*>(&group));
+ QCOMPARE(test->duration(), 250);
+ QCOMPARE(group.duration(), 250);
+
+ TestAnimation *test2 = new TestAnimation(750); // 1
+ group.appendAnimation(test2);
+ QCOMPARE(test2->group(), static_cast<QAnimationGroupJob*>(&group));
+ QCOMPARE(group.duration(), 750);
+
+ TestAnimation *test3 = new TestAnimation(500); // 2
+ group.appendAnimation(test3);
+ QCOMPARE(test3->group(), static_cast<QAnimationGroupJob*>(&group));
+ QCOMPARE(group.duration(), 750);
+
+ group.removeAnimation(test2); // remove the one with duration = 750
+ delete test2;
+ QCOMPARE(group.duration(), 500);
+
+ group.removeAnimation(test3); // remove the one with duration = 500
+ delete test3;
+ QCOMPARE(group.duration(), 250);
+
+ group.removeAnimation(test); // remove the last one (with duration = 250)
+ QCOMPARE(test->group(), static_cast<QAnimationGroupJob*>(0));
+ QCOMPARE(group.duration(), 0);
+ delete test;
+}
+
+void tst_QParallelAnimationGroupJob::pauseResume()
+{
+ QParallelAnimationGroupJob group;
+ TestAnimation *anim = new TestAnimation(250); // 0, duration = 250;
+ group.appendAnimation(anim);
+ StateChangeListener spy;
+ anim->addAnimationChangeListener(&spy, QAbstractAnimationJob::StateChange);
+ QCOMPARE(group.duration(), 250);
+ group.start();
+ QTest::qWait(100);
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim->state(), QAnimationGroupJob::Running);
+ QCOMPARE(spy.count(), 1);
+ spy.clear();
+ const int currentTime = group.currentLoopTime();
+ QCOMPARE(anim->currentLoopTime(), currentTime);
+
+ group.pause();
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(group.currentLoopTime(), currentTime);
+ QCOMPARE(anim->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
+ QCOMPARE(spy.count(), 1);
+ spy.clear();
+
+ group.resume();
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(group.currentLoopTime(), currentTime);
+ QCOMPARE(anim->state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
+ QCOMPARE(spy.count(), 1);
+
+ group.stop();
+ spy.clear();
+ group.appendAnimation(new TestAnimation(500));
+ group.start();
+ QCOMPARE(spy.count(), 1); //the animation should have been started
+ QCOMPARE(spy.states.at(0), TestAnimation::Running);
+ group.setCurrentTime(250); //end of first animation
+ QCOMPARE(spy.count(), 2); //the animation should have been stopped
+ QCOMPARE(spy.states.at(1), TestAnimation::Stopped);
+ group.pause();
+ QCOMPARE(spy.count(), 2); //this shouldn't have changed
+ group.resume();
+ QCOMPARE(spy.count(), 2); //this shouldn't have changed
+}
+
+// This is a regression test for QTBUG-8910, where a crash occurred when the
+// last animation was removed from a group.
+void tst_QParallelAnimationGroupJob::crashWhenRemovingUncontrolledAnimation()
+{
+ QParallelAnimationGroupJob group;
+ TestAnimation *anim = new TestAnimation;
+ anim->setLoopCount(-1);
+ TestAnimation *anim2 = new TestAnimation;
+ anim2->setLoopCount(-1);
+ group.appendAnimation(anim);
+ group.appendAnimation(anim2);
+ group.start();
+ delete anim;
+ // it would crash here because the internals of the group would still have a reference to anim
+ delete anim2;
+}
+
+
+QTEST_MAIN(tst_QParallelAnimationGroupJob)
+#include "tst_qparallelanimationgroupjob.moc"
diff --git a/tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro b/tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro
new file mode 100644
index 0000000000..7102096384
--- /dev/null
+++ b/tests/auto/qml/animation/qpauseanimationjob/qpauseanimationjob.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase
+CONFIG += parallel_test
+macx:CONFIG -= app_bundle
+TARGET = tst_qpauseanimationjob
+QT = core-private gui-private qml-private testlib
+SOURCES = tst_qpauseanimationjob.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
new file mode 100644
index 0000000000..a832c58ae3
--- /dev/null
+++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp
@@ -0,0 +1,470 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QtQml/private/qpauseanimationjob_p.h>
+#include <QtQml/private/qsequentialanimationgroupjob_p.h>
+#include <QtQml/private/qparallelanimationgroupjob_p.h>
+
+#ifdef Q_OS_WIN
+static const char winTimerError[] = "On windows, consistent timing is not working properly due to bad timer resolution";
+#endif
+
+class TestablePauseAnimation : public QPauseAnimationJob
+{
+public:
+ TestablePauseAnimation()
+ : m_updateCurrentTimeCount(0)
+ {
+ }
+
+ TestablePauseAnimation(int duration)
+ : QPauseAnimationJob(duration), m_updateCurrentTimeCount(0)
+ {
+ }
+
+ int m_updateCurrentTimeCount;
+protected:
+ void updateCurrentTime(int currentTime)
+ {
+ QPauseAnimationJob::updateCurrentTime(currentTime);
+ ++m_updateCurrentTimeCount;
+ }
+};
+
+class TestableGenericAnimation : public QAbstractAnimationJob
+{
+public:
+ TestableGenericAnimation(int duration = 250) : m_duration(duration) {}
+ int duration() const { return m_duration; }
+
+private:
+ int m_duration;
+};
+
+class EnableConsistentTiming
+{
+public:
+ EnableConsistentTiming()
+ {
+ QUnifiedTimer *timer = QUnifiedTimer::instance();
+ timer->setConsistentTiming(true);
+ }
+ ~EnableConsistentTiming()
+ {
+ QUnifiedTimer *timer = QUnifiedTimer::instance();
+ timer->setConsistentTiming(false);
+ }
+};
+
+class tst_QPauseAnimationJob : public QObject
+{
+ Q_OBJECT
+public Q_SLOTS:
+ void initTestCase();
+
+private slots:
+ void changeDirectionWhileRunning();
+ void noTimerUpdates_data();
+ void noTimerUpdates();
+ void multiplePauseAnimations();
+ void pauseAndPropertyAnimations();
+ void pauseResume();
+ void sequentialPauseGroup();
+ void sequentialGroupWithPause();
+ void multipleSequentialGroups();
+ void zeroDuration();
+};
+
+void tst_QPauseAnimationJob::initTestCase()
+{
+// qRegisterMetaType<QAbstractAnimationJob::State>("QAbstractAnimationJob::State");
+}
+
+void tst_QPauseAnimationJob::changeDirectionWhileRunning()
+{
+ EnableConsistentTiming enabled;
+
+ TestablePauseAnimation animation;
+ animation.setDuration(400);
+ animation.start();
+ QTest::qWait(100);
+ QVERIFY(animation.state() == QAbstractAnimationJob::Running);
+ animation.setDirection(QAbstractAnimationJob::Backward);
+ QTest::qWait(animation.totalDuration() + 50);
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+}
+
+void tst_QPauseAnimationJob::noTimerUpdates_data()
+{
+ QTest::addColumn<int>("duration");
+ QTest::addColumn<int>("loopCount");
+
+ QTest::newRow("0") << 200 << 1;
+ QTest::newRow("1") << 160 << 1;
+ QTest::newRow("2") << 160 << 2;
+ QTest::newRow("3") << 200 << 3;
+}
+
+void tst_QPauseAnimationJob::noTimerUpdates()
+{
+ EnableConsistentTiming enabled;
+
+ QFETCH(int, duration);
+ QFETCH(int, loopCount);
+
+ TestablePauseAnimation animation;
+ animation.setDuration(duration);
+ animation.setLoopCount(loopCount);
+ animation.start();
+ QTest::qWait(animation.totalDuration() + 100);
+
+#ifdef Q_OS_WIN
+ if (animation.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+ const int expectedLoopCount = 1 + loopCount;
+
+#ifdef Q_OS_WIN
+ if (animation.m_updateCurrentTimeCount != expectedLoopCount)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QCOMPARE(animation.m_updateCurrentTimeCount, expectedLoopCount);
+}
+
+void tst_QPauseAnimationJob::multiplePauseAnimations()
+{
+ EnableConsistentTiming enabled;
+
+ TestablePauseAnimation animation;
+ animation.setDuration(200);
+
+ TestablePauseAnimation animation2;
+ animation2.setDuration(800);
+
+ animation.start();
+ animation2.start();
+ QTest::qWait(animation.totalDuration() + 100);
+
+#ifdef Q_OS_WIN
+ if (animation.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (animation2.state() != QAbstractAnimationJob::Running)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(animation2.state() == QAbstractAnimationJob::Running);
+
+#ifdef Q_OS_WIN
+ if (animation.m_updateCurrentTimeCount != 2)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QCOMPARE(animation.m_updateCurrentTimeCount, 2);
+
+#ifdef Q_OS_WIN
+ if (animation2.m_updateCurrentTimeCount != 2)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QCOMPARE(animation2.m_updateCurrentTimeCount, 2);
+
+ QTest::qWait(550);
+
+#ifdef Q_OS_WIN
+ if (animation2.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(animation2.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (animation2.m_updateCurrentTimeCount != 3)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QCOMPARE(animation2.m_updateCurrentTimeCount, 3);
+}
+
+void tst_QPauseAnimationJob::pauseAndPropertyAnimations()
+{
+ EnableConsistentTiming enabled;
+
+ TestablePauseAnimation pause;
+ pause.setDuration(200);
+
+ TestableGenericAnimation animation;
+
+ pause.start();
+
+ QTest::qWait(100);
+ animation.start();
+
+ QVERIFY(animation.state() == QAbstractAnimationJob::Running);
+ QVERIFY(pause.state() == QAbstractAnimationJob::Running);
+ QCOMPARE(pause.m_updateCurrentTimeCount, 2);
+
+ QTest::qWait(animation.totalDuration() + 100);
+
+#ifdef Q_OS_WIN
+ if (animation.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(pause.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(pause.m_updateCurrentTimeCount > 3);
+}
+
+void tst_QPauseAnimationJob::pauseResume()
+{
+ TestablePauseAnimation animation;
+ animation.setDuration(400);
+ animation.start();
+ QVERIFY(animation.state() == QAbstractAnimationJob::Running);
+ QTest::qWait(200);
+ animation.pause();
+ QVERIFY(animation.state() == QAbstractAnimationJob::Paused);
+ animation.start();
+ QTest::qWait(300);
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (animation.m_updateCurrentTimeCount != 3)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QCOMPARE(animation.m_updateCurrentTimeCount, 3);
+}
+
+void tst_QPauseAnimationJob::sequentialPauseGroup()
+{
+ QSequentialAnimationGroupJob group;
+
+ TestablePauseAnimation animation1(200);
+ group.appendAnimation(&animation1);
+ TestablePauseAnimation animation2(200);
+ group.appendAnimation(&animation2);
+ TestablePauseAnimation animation3(200);
+ group.appendAnimation(&animation3);
+
+ group.start();
+ QCOMPARE(animation1.m_updateCurrentTimeCount, 1);
+ QCOMPARE(animation2.m_updateCurrentTimeCount, 0);
+ QCOMPARE(animation3.m_updateCurrentTimeCount, 0);
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Running);
+ QVERIFY(animation1.state() == QAbstractAnimationJob::Running);
+ QVERIFY(animation2.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(animation3.state() == QAbstractAnimationJob::Stopped);
+
+ group.setCurrentTime(250);
+ QCOMPARE(animation1.m_updateCurrentTimeCount, 2);
+ QCOMPARE(animation2.m_updateCurrentTimeCount, 1);
+ QCOMPARE(animation3.m_updateCurrentTimeCount, 0);
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Running);
+ QVERIFY(animation1.state() == QAbstractAnimationJob::Stopped);
+ QCOMPARE((QAbstractAnimationJob*)&animation2, group.currentAnimation());
+ QVERIFY(animation2.state() == QAbstractAnimationJob::Running);
+ QVERIFY(animation3.state() == QAbstractAnimationJob::Stopped);
+
+ group.setCurrentTime(500);
+ QCOMPARE(animation1.m_updateCurrentTimeCount, 2);
+ QCOMPARE(animation2.m_updateCurrentTimeCount, 2);
+ QCOMPARE(animation3.m_updateCurrentTimeCount, 1);
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Running);
+ QVERIFY(animation1.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(animation2.state() == QAbstractAnimationJob::Stopped);
+ QCOMPARE((QAbstractAnimationJob*)&animation3, group.currentAnimation());
+ QVERIFY(animation3.state() == QAbstractAnimationJob::Running);
+
+ group.setCurrentTime(750);
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(animation1.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(animation2.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(animation3.state() == QAbstractAnimationJob::Stopped);
+
+ QCOMPARE(animation1.m_updateCurrentTimeCount, 2);
+ QCOMPARE(animation2.m_updateCurrentTimeCount, 2);
+ QCOMPARE(animation3.m_updateCurrentTimeCount, 2);
+}
+
+void tst_QPauseAnimationJob::sequentialGroupWithPause()
+{
+ QSequentialAnimationGroupJob group;
+
+ TestableGenericAnimation animation;
+ group.appendAnimation(&animation);
+
+ TestablePauseAnimation pause;
+ pause.setDuration(250);
+ group.appendAnimation(&pause);
+
+ group.start();
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Running);
+ QVERIFY(animation.state() == QAbstractAnimationJob::Running);
+ QVERIFY(pause.state() == QAbstractAnimationJob::Stopped);
+
+ group.setCurrentTime(300);
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Running);
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+ QCOMPARE((QAbstractAnimationJob*)&pause, group.currentAnimation());
+ QVERIFY(pause.state() == QAbstractAnimationJob::Running);
+
+ group.setCurrentTime(600);
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+ QVERIFY(pause.state() == QAbstractAnimationJob::Stopped);
+
+ QCOMPARE(pause.m_updateCurrentTimeCount, 2);
+}
+
+void tst_QPauseAnimationJob::multipleSequentialGroups()
+{
+ EnableConsistentTiming enabled;
+
+ QParallelAnimationGroupJob group;
+ group.setLoopCount(2);
+
+ QSequentialAnimationGroupJob subgroup1;
+ group.appendAnimation(&subgroup1);
+
+ TestableGenericAnimation animation(300);
+ subgroup1.appendAnimation(&animation);
+
+ TestablePauseAnimation pause(200);
+ subgroup1.appendAnimation(&pause);
+
+ QSequentialAnimationGroupJob subgroup2;
+ group.appendAnimation(&subgroup2);
+
+ TestableGenericAnimation animation2(200);
+ subgroup2.appendAnimation(&animation2);
+
+ TestablePauseAnimation pause2(250);
+ subgroup2.appendAnimation(&pause2);
+
+ QSequentialAnimationGroupJob subgroup3;
+ group.appendAnimation(&subgroup3);
+
+ TestablePauseAnimation pause3(400);
+ subgroup3.appendAnimation(&pause3);
+
+ TestableGenericAnimation animation3(200);
+ subgroup3.appendAnimation(&animation3);
+
+ QSequentialAnimationGroupJob subgroup4;
+ group.appendAnimation(&subgroup4);
+
+ TestablePauseAnimation pause4(310);
+ subgroup4.appendAnimation(&pause4);
+
+ TestablePauseAnimation pause5(60);
+ subgroup4.appendAnimation(&pause5);
+
+ group.start();
+
+ QVERIFY(group.state() == QAbstractAnimationJob::Running);
+ QVERIFY(subgroup1.state() == QAbstractAnimationJob::Running);
+ QVERIFY(subgroup2.state() == QAbstractAnimationJob::Running);
+ QVERIFY(subgroup3.state() == QAbstractAnimationJob::Running);
+ QVERIFY(subgroup4.state() == QAbstractAnimationJob::Running);
+
+ // This is a pretty long animation so it tends to get rather out of sync
+ // when using the consistent timer, so run for an extra half second for good
+ // measure...
+ QTest::qWait(group.totalDuration() + 500);
+
+#ifdef Q_OS_WIN
+ if (group.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(group.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup1.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(subgroup1.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup2.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(subgroup2.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup3.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(subgroup3.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (subgroup4.state() != QAbstractAnimationJob::Stopped)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QVERIFY(subgroup4.state() == QAbstractAnimationJob::Stopped);
+
+#ifdef Q_OS_WIN
+ if (pause5.m_updateCurrentTimeCount != 4)
+ QEXPECT_FAIL("", winTimerError, Abort);
+#endif
+ QCOMPARE(pause5.m_updateCurrentTimeCount, 4);
+}
+
+void tst_QPauseAnimationJob::zeroDuration()
+{
+ TestablePauseAnimation animation;
+ animation.setDuration(0);
+ animation.start();
+ QTest::qWait(animation.totalDuration() + 100);
+ QVERIFY(animation.state() == QAbstractAnimationJob::Stopped);
+ QCOMPARE(animation.m_updateCurrentTimeCount, 1);
+}
+
+QTEST_MAIN(tst_QPauseAnimationJob)
+#include "tst_qpauseanimationjob.moc"
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro b/tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro
new file mode 100644
index 0000000000..eda764cedd
--- /dev/null
+++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/qsequentialanimationgroupjob.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase parallel_test
+macx:CONFIG -= app_bundle
+TARGET = tst_qsequentialanimationgroupjob
+QT = core-private qml-private testlib
+SOURCES = tst_qsequentialanimationgroupjob.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
new file mode 100644
index 0000000000..bb626293aa
--- /dev/null
+++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp
@@ -0,0 +1,1617 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtQml/private/qsequentialanimationgroupjob_p.h>
+#include <QtQml/private/qparallelanimationgroupjob_p.h>
+#include <QtQml/private/qpauseanimationjob_p.h>
+
+Q_DECLARE_METATYPE(QAbstractAnimationJob::State)
+Q_DECLARE_METATYPE(QAbstractAnimationJob*)
+
+class tst_QSequentialAnimationGroupJob : public QObject
+{
+ Q_OBJECT
+public Q_SLOTS:
+ void initTestCase();
+
+private slots:
+ void construction();
+ void setCurrentTime();
+ void setCurrentTimeWithUncontrolledAnimation();
+ void seekingForwards();
+ void seekingBackwards();
+ void pauseAndResume();
+ void restart();
+ void looping();
+ void startDelay();
+ void clearGroup();
+ void groupWithZeroDurationAnimations();
+ void propagateGroupUpdateToChildren();
+ void updateChildrenWithRunningGroup();
+ void deleteChildrenWithRunningGroup();
+ void startChildrenWithStoppedGroup();
+ void stopGroupWithRunningChild();
+ void startGroupWithRunningChild();
+ void zeroDurationAnimation();
+ void stopUncontrolledAnimations();
+ void finishWithUncontrolledAnimation();
+ void addRemoveAnimation();
+ void currentAnimation();
+ void currentAnimationWithZeroDuration();
+ void insertAnimation();
+ void clear();
+ void pauseResume();
+};
+
+void tst_QSequentialAnimationGroupJob::initTestCase()
+{
+ qRegisterMetaType<QAbstractAnimationJob::State>("QAbstractAnimationJob::State");
+ qRegisterMetaType<QAbstractAnimationJob*>("QAbstractAnimationJob*");
+}
+
+void tst_QSequentialAnimationGroupJob::construction()
+{
+ QSequentialAnimationGroupJob animationgroup;
+}
+
+class TestAnimation : public QAbstractAnimationJob
+{
+public:
+ TestAnimation(int duration = 250) : m_duration(duration) {}
+ int duration() const { return m_duration; }
+
+private:
+ int m_duration;
+};
+
+class TestValueAnimation : public TestAnimation
+{
+public:
+ TestValueAnimation(int duration = 250)
+ : TestAnimation(duration), start(0), end(0), value(0) {}
+
+ void updateCurrentTime(int msecs)
+ {
+ if (msecs >= duration())
+ value = end;
+ else
+ value = start + (end - start) * (qreal(msecs) / duration());
+ }
+
+ qreal start, end;
+ qreal value;
+};
+
+class UncontrolledAnimation : public QObject, public QAbstractAnimationJob
+{
+ Q_OBJECT
+public:
+ int duration() const { return -1; /* not time driven */ }
+
+protected:
+ void updateCurrentTime(int currentTime)
+ {
+ if (currentTime >= 250)
+ stop();
+ }
+};
+
+class StateChangeListener: public QAnimationJobChangeListener
+{
+public:
+ virtual void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State)
+ {
+ states << newState;
+ }
+
+ void clear() { states.clear(); }
+ int count() const { return states.count(); }
+
+ QList<QAbstractAnimationJob::State> states;
+};
+
+class FinishedListener: public QAnimationJobChangeListener
+{
+public:
+ FinishedListener() : m_count(0) {}
+
+ virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; }
+ void clear() { m_count = 0; }
+ int count() { return m_count; }
+
+private:
+ int m_count;
+};
+
+void tst_QSequentialAnimationGroupJob::setCurrentTime()
+{
+ // sequence operating on same object/property
+ QAnimationGroupJob *sequence = new QSequentialAnimationGroupJob();
+ TestAnimation *a1_s_o1 = new TestAnimation;
+ TestAnimation *a2_s_o1 = new TestAnimation;
+ TestAnimation *a3_s_o1 = new TestAnimation;
+ a2_s_o1->setLoopCount(3);
+ sequence->appendAnimation(a1_s_o1);
+ sequence->appendAnimation(a2_s_o1);
+ sequence->appendAnimation(a3_s_o1);
+
+ // sequence operating on different object/properties
+ QAnimationGroupJob *sequence2 = new QSequentialAnimationGroupJob();
+ TestAnimation *a1_s_o2 = new TestAnimation;
+ TestAnimation *a1_s_o3 = new TestAnimation;
+ sequence2->appendAnimation(a1_s_o2);
+ sequence2->appendAnimation(a1_s_o3);
+
+ QSequentialAnimationGroupJob group;
+ group.appendAnimation(sequence);
+ group.appendAnimation(sequence2);
+
+ // Current time = 1
+ group.setCurrentTime(1);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 250
+ group.setCurrentTime(250);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(sequence->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 251
+ group.setCurrentTime(251);
+ QCOMPARE(group.currentLoopTime(), 251);
+ QCOMPARE(sequence->currentLoopTime(), 251);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoop(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 750
+ group.setCurrentTime(750);
+ QCOMPARE(group.currentLoopTime(), 750);
+ QCOMPARE(sequence->currentLoopTime(), 750);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 1000
+ group.setCurrentTime(1000);
+ QCOMPARE(group.currentLoopTime(), 1000);
+ QCOMPARE(sequence->currentLoopTime(), 1000);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 1010
+ group.setCurrentTime(1010);
+ QCOMPARE(group.currentLoopTime(), 1010);
+ QCOMPARE(sequence->currentLoopTime(), 1010);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 10);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 1250
+ group.setCurrentTime(1250);
+ QCOMPARE(group.currentLoopTime(), 1250);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 1500
+ group.setCurrentTime(1500);
+ QCOMPARE(group.currentLoopTime(), 1500);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 1750
+ group.setCurrentTime(1750);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
+
+ // Current time = 2000
+ group.setCurrentTime(2000);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
+}
+
+void tst_QSequentialAnimationGroupJob::setCurrentTimeWithUncontrolledAnimation()
+{
+ // sequence operating on different object/properties
+ QAnimationGroupJob *sequence = new QSequentialAnimationGroupJob();
+ TestAnimation *a1_s_o1 = new TestAnimation;
+ TestAnimation *a1_s_o2 = new TestAnimation;
+ sequence->appendAnimation(a1_s_o1);
+ sequence->appendAnimation(a1_s_o2);
+
+ UncontrolledAnimation *notTimeDriven = new UncontrolledAnimation;
+ QCOMPARE(notTimeDriven->totalDuration(), -1);
+
+ TestAnimation *loopsForever = new TestAnimation;
+ loopsForever->setLoopCount(-1);
+ QCOMPARE(loopsForever->totalDuration(), -1);
+
+ QSequentialAnimationGroupJob group;
+ group.appendAnimation(sequence);
+ group.appendAnimation(notTimeDriven);
+ group.appendAnimation(loopsForever);
+ group.start();
+ group.pause(); // this allows the group to listen for the finish signal of its children
+
+ // Current time = 1
+ group.setCurrentTime(1);
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever->state(), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
+
+ // Current time = 250
+ group.setCurrentTime(250);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(sequence->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
+
+ // Current time = 500
+ group.setCurrentTime(500);
+ QCOMPARE(group.currentLoopTime(), 500);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob *>(notTimeDriven));
+
+ // Current time = 505
+ group.setCurrentTime(505);
+ QCOMPARE(group.currentLoopTime(), 505);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 5);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob *>(notTimeDriven));
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(loopsForever->state(), QAnimationGroupJob::Stopped);
+
+ // Current time = 750 (end of notTimeDriven animation)
+ group.setCurrentTime(750);
+ QCOMPARE(group.currentLoopTime(), 750);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
+ QCOMPARE(group.currentAnimation(), loopsForever);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever->state(), QAnimationGroupJob::Paused);
+
+ // Current time = 800 (as notTimeDriven was finished at 750, loopsforever should still run)
+ group.setCurrentTime(800);
+ QCOMPARE(group.currentLoopTime(), 800);
+ QCOMPARE(group.currentAnimation(), loopsForever);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 50);
+
+ loopsForever->stop(); // this should stop the group
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever->state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QSequentialAnimationGroupJob::seekingForwards()
+{
+
+ // sequence operating on same object/property
+ QAnimationGroupJob *sequence = new QSequentialAnimationGroupJob;
+ TestAnimation *a1_s_o1 = new TestAnimation;
+ TestAnimation *a2_s_o1 = new TestAnimation;
+ TestAnimation *a3_s_o1 = new TestAnimation;
+ a2_s_o1->setLoopCount(3);
+ sequence->appendAnimation(a1_s_o1);
+ sequence->appendAnimation(a2_s_o1);
+ sequence->appendAnimation(a3_s_o1);
+
+ // sequence operating on different object/properties
+ QAnimationGroupJob *sequence2 = new QSequentialAnimationGroupJob;
+ TestAnimation *a1_s_o2 = new TestAnimation;
+ TestAnimation *a1_s_o3 = new TestAnimation;
+ sequence2->appendAnimation(a1_s_o2);
+ sequence2->appendAnimation(a1_s_o3);
+
+ QSequentialAnimationGroupJob group;
+ group.appendAnimation(sequence);
+ group.appendAnimation(sequence2);
+
+ // Current time = 1
+ group.setCurrentTime(1);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o3->state(), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // Current time = 1500
+ group.setCurrentTime(1500);
+ QCOMPARE(group.currentLoopTime(), 1500);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ // this will restart the group
+ group.start();
+ group.pause();
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(sequence2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o3->state(), QAnimationGroupJob::Stopped);
+
+ // Current time = 1750
+ group.setCurrentTime(1750);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
+}
+
+void tst_QSequentialAnimationGroupJob::seekingBackwards()
+{
+ // sequence operating on same object/property
+ QAnimationGroupJob *sequence = new QSequentialAnimationGroupJob();
+ TestAnimation *a1_s_o1 = new TestAnimation;
+ TestAnimation *a2_s_o1 = new TestAnimation;
+ TestAnimation *a3_s_o1 = new TestAnimation;
+ a2_s_o1->setLoopCount(3);
+ sequence->appendAnimation(a1_s_o1);
+ sequence->appendAnimation(a2_s_o1);
+ sequence->appendAnimation(a3_s_o1);
+
+ // sequence operating on different object/properties
+ QAnimationGroupJob *sequence2 = new QSequentialAnimationGroupJob();
+ TestAnimation *a1_s_o2 = new TestAnimation;
+ TestAnimation *a1_s_o3 = new TestAnimation;
+ sequence2->appendAnimation(a1_s_o2);
+ sequence2->appendAnimation(a1_s_o3);
+
+ QSequentialAnimationGroupJob group;
+ group.appendAnimation(sequence);
+ group.appendAnimation(sequence2);
+
+ group.start();
+
+ // Current time = 1600
+ group.setCurrentTime(1600);
+ QCOMPARE(group.currentLoopTime(), 1600);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 350);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 100);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence2->state(), QAnimationGroupJob::Running);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o3->state(), QAnimationGroupJob::Running);
+
+ // Seeking backwards, current time = 1
+ group.setCurrentTime(1);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+
+ QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children,"
+ "hence they don't reset from their current animation", Continue);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children,"
+ "hence they don't reset from their current animation", Continue);
+ QCOMPARE(a2_s_o1->currentLoop(), 0);
+ QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children,"
+ "hence they don't reset from their current animation", Continue);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Running);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Running);
+ QCOMPARE(sequence2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o3->state(), QAnimationGroupJob::Stopped);
+
+ // Current time = 2000
+ group.setCurrentTime(2000);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 2);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(sequence2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1_s_o3->state(), QAnimationGroupJob::Stopped);
+}
+
+typedef QList<QAbstractAnimationJob::State> StateList;
+
+static bool compareStates(const StateChangeListener& spy, const StateList &expectedStates)
+{
+ bool equals = true;
+ for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) {
+ if (i >= spy.count() || i >= expectedStates.count()) {
+ equals = false;
+ break;
+ }
+ QAbstractAnimationJob::State st = expectedStates.at(i);
+ QAbstractAnimationJob::State actual = spy.states.at(i);
+ if (equals && actual != st) {
+ equals = false;
+ break;
+ }
+ }
+ if (!equals) {
+ const char *stateStrings[] = {"Stopped", "Paused", "Running"};
+ QString e,a;
+ for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) {
+ if (i < expectedStates.count()) {
+ int exp = int(expectedStates.at(i));
+ if (!e.isEmpty())
+ e += QLatin1String(", ");
+ e += QLatin1String(stateStrings[exp]);
+ }
+ if (i < spy.count()) {
+ QAbstractAnimationJob::State actual = spy.states.at(i);
+ if (!a.isEmpty())
+ a += QLatin1String(", ");
+ if (int(actual) >= 0 && int(actual) <= 2) {
+ a += QLatin1String(stateStrings[int(actual)]);
+ } else {
+ a += QLatin1String("NaN");
+ }
+ }
+
+ }
+ qDebug("\n"
+ "expected (count == %d): %s\n"
+ "actual (count == %d): %s\n", expectedStates.count(), qPrintable(e), spy.count(), qPrintable(a));
+ }
+ return equals;
+}
+
+void tst_QSequentialAnimationGroupJob::pauseAndResume()
+{
+ // sequence operating on same object/property
+ QAnimationGroupJob *sequence = new QSequentialAnimationGroupJob();
+ TestAnimation *a1_s_o1 = new TestAnimation;
+ TestAnimation *a2_s_o1 = new TestAnimation;
+ TestAnimation *a3_s_o1 = new TestAnimation;
+ a2_s_o1->setLoopCount(2);
+ sequence->appendAnimation(a1_s_o1);
+ sequence->appendAnimation(a2_s_o1);
+ sequence->appendAnimation(a3_s_o1);
+ sequence->setLoopCount(2);
+
+ StateChangeListener a1StateChangedSpy;
+ a1_s_o1->addAnimationChangeListener(&a1StateChangedSpy, QAbstractAnimationJob::StateChange);
+ StateChangeListener seqStateChangedSpy;
+ sequence->addAnimationChangeListener(&seqStateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ QSequentialAnimationGroupJob group;
+ group.appendAnimation(sequence);
+
+ group.start();
+ group.pause();
+
+ // Current time = 1751
+ group.setCurrentTime(1751);
+ QCOMPARE(group.currentLoopTime(), 1751);
+ QCOMPARE(sequence->currentLoopTime(), 751);
+ QCOMPARE(sequence->currentLoop(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 1);
+ QCOMPARE(a3_s_o1->currentLoop(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 1);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a2_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a3_s_o1->state(), QAnimationGroupJob::Paused);
+
+ QCOMPARE(a1StateChangedSpy.count(), 5); // Running,Paused,Stopped,Running,Stopped
+ QCOMPARE(seqStateChangedSpy.count(), 2); // Running,Paused
+
+ QVERIFY(compareStates(a1StateChangedSpy, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused
+ << QAbstractAnimationJob::Stopped
+ << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Stopped)));
+
+ //### is this the same test as compareStates test above?
+ QCOMPARE(a1StateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(a1StateChangedSpy.states.at(1), QAnimationGroupJob::Paused);
+ QCOMPARE(a1StateChangedSpy.states.at(2), QAnimationGroupJob::Stopped);
+ QCOMPARE(a1StateChangedSpy.states.at(3), QAnimationGroupJob::Running);
+ QCOMPARE(a1StateChangedSpy.states.at(4), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(seqStateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(seqStateChangedSpy.states.at(1), QAnimationGroupJob::Paused);
+
+ group.resume();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Running);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a2_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a3_s_o1->state(), QAnimationGroupJob::Running);
+
+ QVERIFY(group.currentLoopTime() >= 1751);
+ QVERIFY(sequence->currentLoopTime() >= 751);
+ QCOMPARE(sequence->currentLoop(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 1);
+ QCOMPARE(a3_s_o1->currentLoop(), 0);
+ QVERIFY(a3_s_o1->currentLoopTime() >= 1);
+
+ QCOMPARE(seqStateChangedSpy.count(), 3); // Running,Paused,Running
+ QCOMPARE(seqStateChangedSpy.states.at(2), QAnimationGroupJob::Running);
+
+ group.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a2_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a3_s_o1->state(), QAnimationGroupJob::Paused);
+
+ QVERIFY(group.currentLoopTime() >= 1751);
+ QVERIFY(sequence->currentLoopTime() >= 751);
+ QCOMPARE(sequence->currentLoop(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 1);
+ QCOMPARE(a3_s_o1->currentLoop(), 0);
+ QVERIFY(a3_s_o1->currentLoopTime() >= 1);
+
+ QCOMPARE(seqStateChangedSpy.count(), 4); // Running,Paused,Running,Paused
+ QCOMPARE(seqStateChangedSpy.states.at(3), QAnimationGroupJob::Paused);
+
+ group.stop();
+
+ QCOMPARE(seqStateChangedSpy.count(), 5); // Running,Paused,Running,Paused,Stopped
+ QCOMPARE(seqStateChangedSpy.states.at(4), QAnimationGroupJob::Stopped);
+}
+
+void tst_QSequentialAnimationGroupJob::restart()
+{
+ // originally was sequence operating on same object/property
+ QAnimationGroupJob *sequence = new QSequentialAnimationGroupJob();
+ //### no equivilant signal
+ //QSignalSpy seqCurrentAnimChangedSpy(sequence, SIGNAL(currentAnimationChanged(QAbstractAnimationJob*)));
+
+ StateChangeListener seqStateChangedSpy;
+ sequence->addAnimationChangeListener(&seqStateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ TestAnimation *anims[3];
+ StateChangeListener *animsStateChanged[3];
+
+ for (int i = 0; i < 3; i++) {
+ anims[i] = new TestAnimation(100);
+ animsStateChanged[i] = new StateChangeListener;
+ anims[i]->addAnimationChangeListener(animsStateChanged[i], QAbstractAnimationJob::StateChange);
+ }
+
+ anims[1]->setLoopCount(2);
+ sequence->appendAnimation(anims[0]);
+ sequence->appendAnimation(anims[1]);
+ sequence->appendAnimation(anims[2]);
+ sequence->setLoopCount(2);
+
+ QSequentialAnimationGroupJob group;
+ group.appendAnimation(sequence);
+
+ group.start();
+
+ QTest::qWait(500);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+
+ QTest::qWait(300);
+ QTRY_COMPARE(group.state(), QAnimationGroupJob::Stopped);
+
+ for (int i = 0; i < 3; i++) {
+ QCOMPARE(animsStateChanged[i]->count(), 4);
+ QCOMPARE(animsStateChanged[i]->states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(animsStateChanged[i]->states.at(1), QAnimationGroupJob::Stopped);
+ QCOMPARE(animsStateChanged[i]->states.at(2), QAnimationGroupJob::Running);
+ QCOMPARE(animsStateChanged[i]->states.at(3), QAnimationGroupJob::Stopped);
+ }
+
+ QCOMPARE(seqStateChangedSpy.count(), 2);
+ QCOMPARE(seqStateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(seqStateChangedSpy.states.at(1), QAnimationGroupJob::Stopped);
+
+ //QCOMPARE(seqCurrentAnimChangedSpy.count(), 6);
+ //for(int i=0; i<seqCurrentAnimChangedSpy.count(); i++)
+ // QCOMPARE(static_cast<QAbstractAnimationJob*>(anims[i%3]), qVariantValue<QAbstractAnimationJob*>(seqCurrentAnimChangedSpy.at(i).at(0)));
+
+ group.start();
+
+ QCOMPARE(animsStateChanged[0]->count(), 5);
+ QCOMPARE(animsStateChanged[1]->count(), 4);
+ QCOMPARE(animsStateChanged[2]->count(), 4);
+ QCOMPARE(seqStateChangedSpy.count(), 3);
+}
+
+void tst_QSequentialAnimationGroupJob::looping()
+{
+ // originally was sequence operating on same object/property
+ QSequentialAnimationGroupJob *sequence = new QSequentialAnimationGroupJob();
+ QAbstractAnimationJob *a1_s_o1 = new TestAnimation;
+ QAbstractAnimationJob *a2_s_o1 = new TestAnimation;
+ QAbstractAnimationJob *a3_s_o1 = new TestAnimation;
+
+ StateChangeListener a1Spy;
+ a1_s_o1->addAnimationChangeListener(&a1Spy, QAbstractAnimationJob::StateChange);
+ StateChangeListener a2Spy;
+ a2_s_o1->addAnimationChangeListener(&a2Spy, QAbstractAnimationJob::StateChange);
+ StateChangeListener a3Spy;
+ a3_s_o1->addAnimationChangeListener(&a3Spy, QAbstractAnimationJob::StateChange);
+ StateChangeListener seqSpy;
+ sequence->addAnimationChangeListener(&seqSpy, QAbstractAnimationJob::StateChange);
+
+ a2_s_o1->setLoopCount(2);
+ sequence->appendAnimation(a1_s_o1);
+ sequence->appendAnimation(a2_s_o1);
+ sequence->appendAnimation(a3_s_o1);
+ sequence->setLoopCount(2);
+
+ QSequentialAnimationGroupJob group;
+ StateChangeListener groupSpy;
+ group.addAnimationChangeListener(&groupSpy, QAbstractAnimationJob::StateChange);
+
+ group.appendAnimation(sequence);
+ group.setLoopCount(2);
+
+ group.start();
+ group.pause();
+
+ // Current time = 1750
+ group.setCurrentTime(1750);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 750);
+ QCOMPARE(sequence->currentLoop(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 1);
+ // this animation is at the beginning because it is the current one inside sequence
+ QCOMPARE(a3_s_o1->currentLoop(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence->currentAnimation(), a3_s_o1);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a2_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a3_s_o1->state(), QAnimationGroupJob::Paused);
+
+ QCOMPARE(a1Spy.count(), 5); // Running,Paused,Stopped,Running,Stopped
+ QVERIFY(compareStates(a1Spy, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused
+ << QAbstractAnimationJob::Stopped
+ << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Stopped)));
+
+ QCOMPARE(a2Spy.count(), 4); // Running,Stopped,Running,Stopped
+ QVERIFY(compareStates(a3Spy, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Stopped
+ << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused)));
+
+ QCOMPARE(seqSpy.count(), 2); // Running,Paused
+ QCOMPARE(groupSpy.count(), 2); // Running,Paused
+
+ // Looping, current time = duration + 1
+ group.setCurrentTime(group.duration() + 1);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(group.currentLoop(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoop(), 0);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoop(), 1);
+ // this animation is at the end because it was run on the previous loop
+ QCOMPARE(a3_s_o1->currentLoop(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(sequence->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a1_s_o1->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(a2_s_o1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a3_s_o1->state(), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(a1Spy.count(), 7); // Running,Paused,Stopped,Running,Stopped,Running,Stopped
+ QCOMPARE(a2Spy.count(), 4); // Running, Stopped, Running, Stopped
+ QVERIFY(compareStates(a3Spy, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Stopped
+ << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused
+ << QAbstractAnimationJob::Stopped)));
+ QVERIFY(compareStates(seqSpy, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused
+ << QAbstractAnimationJob::Stopped
+ << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused)));
+ QCOMPARE(groupSpy.count(), 2);
+
+ //cleanup
+ a1_s_o1->removeAnimationChangeListener(&a1Spy, QAbstractAnimationJob::StateChange);
+ a2_s_o1->removeAnimationChangeListener(&a2Spy, QAbstractAnimationJob::StateChange);
+ a3_s_o1->removeAnimationChangeListener(&a3Spy, QAbstractAnimationJob::StateChange);
+ sequence->removeAnimationChangeListener(&seqSpy, QAbstractAnimationJob::StateChange);
+ group.removeAnimationChangeListener(&groupSpy, QAbstractAnimationJob::StateChange);
+}
+
+void tst_QSequentialAnimationGroupJob::startDelay()
+{
+ QSequentialAnimationGroupJob group;
+ group.appendAnimation(new QPauseAnimationJob(250));
+ group.appendAnimation(new QPauseAnimationJob(125));
+ QCOMPARE(group.totalDuration(), 375);
+
+ group.start();
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+
+ QTest::qWait(500);
+
+ QTRY_COMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QVERIFY(group.currentLoopTime() == 375);
+}
+
+void tst_QSequentialAnimationGroupJob::clearGroup()
+{
+ QSequentialAnimationGroupJob group;
+
+ static const int animationCount = 20;
+
+ for (int i = 0; i < animationCount/2; ++i) {
+ QSequentialAnimationGroupJob *subGroup = new QSequentialAnimationGroupJob;
+ group.appendAnimation(subGroup);
+ group.appendAnimation(new QPauseAnimationJob(100));
+ subGroup->appendAnimation(new QPauseAnimationJob(10));
+ }
+
+ int count = 0;
+ for (QAbstractAnimationJob *anim = group.firstChild(); anim; anim = anim->nextSibling())
+ ++count;
+ QCOMPARE(count, animationCount);
+
+ group.clear();
+
+ QVERIFY(!group.firstChild() && !group.lastChild());
+ QCOMPARE(group.currentLoopTime(), 0);
+}
+
+void tst_QSequentialAnimationGroupJob::groupWithZeroDurationAnimations()
+{
+ QSequentialAnimationGroupJob group;
+
+ TestValueAnimation *a1 = new TestValueAnimation(0);
+ a1->start = 42;
+ a1->end = 43;
+ group.appendAnimation(a1);
+
+ //this should just run fine and change nothing
+ group.setCurrentTime(0);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(a1));
+
+ TestValueAnimation *a2 = new TestValueAnimation(500);
+ a2->start = 13;
+ a2->end = 31;
+ group.appendAnimation(a2);
+
+ TestValueAnimation *a3 = new TestValueAnimation(0);
+ a3->start = 43;
+ a3->end = 44;
+ group.appendAnimation(a3);
+
+ TestValueAnimation *a4 = new TestValueAnimation(250);
+ a4->start = 13;
+ a4->end = 75;
+ group.appendAnimation(a4);
+
+ TestValueAnimation *a5 = new TestValueAnimation(0);
+ a5->start = 42;
+ a5->end = 12;
+ group.appendAnimation(a5);
+
+ QCOMPARE((int)a1->value, 43); //### is this actually the behavior we want?
+ QCOMPARE((int)a2->value, 0);
+ QCOMPARE((int)a3->value, 0);
+ QCOMPARE((int)a4->value, 0);
+ QCOMPARE((int)a5->value, 0);
+
+ group.start();
+
+ QCOMPARE((int)a1->value, 43); //### is this actually the behavior we want?
+ QCOMPARE((int)a2->value, 13);
+ QCOMPARE((int)a3->value, 0);
+ QCOMPARE((int)a4->value, 0);
+ QCOMPARE((int)a5->value, 0);
+
+ QTest::qWait(100);
+
+ QCOMPARE((int)a1->value, 43);
+ QVERIFY(a2->value > 13 && a2->value < 31);
+ QCOMPARE((int)a3->value, 0);
+ QCOMPARE((int)a4->value, 0);
+ QCOMPARE((int)a5->value, 0);
+
+ QTest::qWait(500);
+
+ QTRY_COMPARE((int)a3->value, 44);
+ QCOMPARE((int)a1->value, 43);
+ QCOMPARE((int)a2->value, 31);
+ //QCOMPARE((int)a4->value, 36);
+ QCOMPARE((int)a5->value, 0);
+ QCOMPARE(a1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a3->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a4->state(), QAnimationGroupJob::Running);
+ QCOMPARE(a5->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QTest::qWait(500);
+
+ QTRY_COMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE((int)a1->value, 43);
+ QCOMPARE((int)a2->value, 31);
+ QCOMPARE((int)a3->value, 44);
+ QCOMPARE((int)a4->value, 75);
+ QCOMPARE((int)a5->value, 12);
+ QCOMPARE(a1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a2->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a3->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a4->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(a5->state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QSequentialAnimationGroupJob::propagateGroupUpdateToChildren()
+{
+ // this test verifies if group state changes are updating its children correctly
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation anim1(100);
+ TestAnimation anim2(200);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+
+ group.start();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QSequentialAnimationGroupJob::updateChildrenWithRunningGroup()
+{
+ // assert that its possible to modify a child's state directly while their group is running
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation anim(200);
+
+ StateChangeListener groupStateChangedSpy;
+ group.addAnimationChangeListener(&groupStateChangedSpy, QAbstractAnimationJob::StateChange);
+ StateChangeListener childStateChangedSpy;
+ anim.addAnimationChangeListener(&childStateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ QCOMPARE(groupStateChangedSpy.count(), 0);
+ QCOMPARE(childStateChangedSpy.count(), 0);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim);
+
+ group.start();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Running);
+
+ QCOMPARE(groupStateChangedSpy.count(), 1);
+ QCOMPARE(childStateChangedSpy.count(), 1);
+
+ QCOMPARE(groupStateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(childStateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+
+ // starting directly a running child will not have any effect
+ anim.start();
+
+ QCOMPARE(groupStateChangedSpy.count(), 1);
+ QCOMPARE(childStateChangedSpy.count(), 1);
+
+ anim.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Paused);
+
+ // in the animation stops directly, the group will still be running
+ anim.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Stopped);
+
+ //cleanup
+ group.removeAnimationChangeListener(&groupStateChangedSpy, QAbstractAnimationJob::StateChange);
+ anim.removeAnimationChangeListener(&childStateChangedSpy, QAbstractAnimationJob::StateChange);
+}
+
+void tst_QSequentialAnimationGroupJob::deleteChildrenWithRunningGroup()
+{
+ // test if children can be activated when their group is stopped
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation *anim1 = new TestAnimation(200);
+ group.appendAnimation(anim1);
+
+ QCOMPARE(group.duration(), anim1->duration());
+
+ group.start();
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Running);
+
+ QTest::qWait(100);
+ QTRY_VERIFY(group.currentLoopTime() > 0);
+
+ delete anim1;
+ QVERIFY(!group.firstChild());
+ QCOMPARE(group.duration(), 0);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(group.currentLoopTime(), 0); //that's the invariant
+}
+
+void tst_QSequentialAnimationGroupJob::startChildrenWithStoppedGroup()
+{
+ // test if children can be activated when their group is stopped
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation anim1(200);
+ TestAnimation anim2(200);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+
+ group.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ anim1.start();
+ anim2.start();
+ anim2.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+}
+
+void tst_QSequentialAnimationGroupJob::stopGroupWithRunningChild()
+{
+ // children that started independently will not be affected by a group stop
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation anim1(200);
+ TestAnimation anim2(200);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(&anim1);
+ group.appendAnimation(&anim2);
+
+ anim1.start();
+ anim2.start();
+ anim2.pause();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+
+ group.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Paused);
+
+ anim1.stop();
+ anim2.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2.state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QSequentialAnimationGroupJob::startGroupWithRunningChild()
+{
+ // as the group has precedence over its children, starting a group will restart all the children
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation *anim1 = new TestAnimation(200);
+ TestAnimation *anim2 = new TestAnimation(200);
+
+ StateChangeListener stateChangedSpy1;
+ anim1->addAnimationChangeListener(&stateChangedSpy1, QAbstractAnimationJob::StateChange);
+ StateChangeListener stateChangedSpy2;
+ anim2->addAnimationChangeListener(&stateChangedSpy2, QAbstractAnimationJob::StateChange);
+
+ QCOMPARE(stateChangedSpy1.count(), 0);
+ QCOMPARE(stateChangedSpy2.count(), 0);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2->state(), QAnimationGroupJob::Stopped);
+
+ group.appendAnimation(anim1);
+ group.appendAnimation(anim2);
+
+ anim1->start();
+ anim2->start();
+ anim2->pause();
+
+ QVERIFY(compareStates(stateChangedSpy1, (StateList() << QAbstractAnimationJob::Running)));
+
+ QVERIFY(compareStates(stateChangedSpy2, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused)));
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2->state(), QAnimationGroupJob::Paused);
+
+ group.start();
+
+ QVERIFY(compareStates(stateChangedSpy1, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Stopped
+ << QAbstractAnimationJob::Running)));
+ QVERIFY(compareStates(stateChangedSpy2, (StateList() << QAbstractAnimationJob::Running
+ << QAbstractAnimationJob::Paused)));
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim2->state(), QAnimationGroupJob::Paused);
+
+ QTest::qWait(300);
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2->state(), QAnimationGroupJob::Running);
+
+ QCOMPARE(stateChangedSpy2.count(), 4);
+ QCOMPARE(stateChangedSpy2.states.at(2), QAnimationGroupJob::Stopped);
+ QCOMPARE(stateChangedSpy2.states.at(3), QAnimationGroupJob::Running);
+
+ group.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2->state(), QAnimationGroupJob::Stopped);
+
+ anim1->removeAnimationChangeListener(&stateChangedSpy1, QAbstractAnimationJob::StateChange);
+ anim2->removeAnimationChangeListener(&stateChangedSpy2, QAbstractAnimationJob::StateChange);
+}
+
+void tst_QSequentialAnimationGroupJob::zeroDurationAnimation()
+{
+ QSequentialAnimationGroupJob group;
+
+ TestAnimation *anim1 = new TestAnimation(0);
+ TestAnimation *anim2 = new TestAnimation(100);
+ TestValueAnimation *anim3 = new TestValueAnimation(0);
+ anim3->end = 100;
+
+ StateChangeListener stateChangedSpy;
+ anim1->addAnimationChangeListener(&stateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ group.appendAnimation(anim1);
+ group.appendAnimation(anim2);
+ group.appendAnimation(anim3);
+ group.setLoopCount(2);
+ group.start();
+
+ QCOMPARE(stateChangedSpy.count(), 2);
+ QCOMPARE(stateChangedSpy.states.at(0), QAnimationGroupJob::Running);
+ QCOMPARE(stateChangedSpy.states.at(1), QAnimationGroupJob::Stopped);
+
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2->state(), QAnimationGroupJob::Running);
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+
+ //now let's try to seek to the next loop
+ group.setCurrentTime(group.duration() + 1);
+ QCOMPARE(anim1->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim2->state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim3->state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ //TODO: test that anim3 was run
+ QCOMPARE(anim3->value, qreal(100)); //anim3 should have been run
+
+ anim1->removeAnimationChangeListener(&stateChangedSpy, QAbstractAnimationJob::StateChange);
+}
+
+void tst_QSequentialAnimationGroupJob::stopUncontrolledAnimations()
+{
+ QSequentialAnimationGroupJob group;
+
+ UncontrolledAnimation notTimeDriven;
+ QCOMPARE(notTimeDriven.totalDuration(), -1);
+
+ TestAnimation loopsForever(100);
+ loopsForever.setLoopCount(-1);
+
+ group.appendAnimation(&notTimeDriven);
+ group.appendAnimation(&loopsForever);
+
+ group.start();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Running);
+ QCOMPARE(loopsForever.state(), QAnimationGroupJob::Stopped);
+
+ notTimeDriven.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever.state(), QAnimationGroupJob::Running);
+
+ loopsForever.stop();
+
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(loopsForever.state(), QAnimationGroupJob::Stopped);
+}
+
+void tst_QSequentialAnimationGroupJob::finishWithUncontrolledAnimation()
+{
+ //1st case:
+ //first we test a group with one uncontrolled animation
+ QSequentialAnimationGroupJob group;
+ UncontrolledAnimation notTimeDriven;
+ group.appendAnimation(&notTimeDriven);
+ FinishedListener spy;
+ group.addAnimationChangeListener(&spy, QAbstractAnimationJob::Completion);
+
+ group.start();
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Running);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven.currentLoopTime(), 0);
+
+ QTest::qWait(300); //wait for the end of notTimeDriven
+ QTRY_COMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
+ const int actualDuration = notTimeDriven.currentLoopTime();
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(group.currentLoopTime(), actualDuration);
+ QCOMPARE(spy.count(), 1);
+
+ //2nd case:
+ // lets make sure the seeking will work again
+ spy.clear();
+ TestAnimation anim;
+ group.appendAnimation(&anim);
+ StateChangeListener animStateChangedSpy;
+ anim.addAnimationChangeListener(&animStateChangedSpy, QAbstractAnimationJob::StateChange);
+
+ group.setCurrentTime(300);
+ QCOMPARE(group.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(notTimeDriven.currentLoopTime(), actualDuration);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&anim));
+
+ //3rd case:
+ //now let's add a perfectly defined animation at the end
+ QCOMPARE(animStateChangedSpy.count(), 0);
+ group.start();
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(notTimeDriven.state(), QAnimationGroupJob::Running);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven.currentLoopTime(), 0);
+
+ QCOMPARE(animStateChangedSpy.count(), 0);
+
+ QTest::qWait(300); //wait for the end of notTimeDriven
+ QTRY_COMPARE(notTimeDriven.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim.state(), QAnimationGroupJob::Running);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&anim));
+ QCOMPARE(animStateChangedSpy.count(), 1);
+ QTest::qWait(300); //wait for the end of anim
+
+ QTRY_COMPARE(anim.state(), QAnimationGroupJob::Stopped);
+ QCOMPARE(anim.currentLoopTime(), anim.duration());
+
+ //we should simply be at the end
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(animStateChangedSpy.count(), 2);
+ QCOMPARE(group.currentLoopTime(), notTimeDriven.currentLoopTime() + anim.currentLoopTime());
+
+ //cleanup
+ group.removeAnimationChangeListener(&spy, QAbstractAnimationJob::Completion);
+ anim.removeAnimationChangeListener(&animStateChangedSpy, QAbstractAnimationJob::StateChange);
+}
+
+void tst_QSequentialAnimationGroupJob::addRemoveAnimation()
+{
+ //this test is specific to the sequential animation group
+ QSequentialAnimationGroupJob group;
+
+ QCOMPARE(group.duration(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QAbstractAnimationJob *anim1 = new TestAnimation;
+ group.appendAnimation(anim1);
+ QCOMPARE(group.duration(), 250);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QCOMPARE(group.currentAnimation(), anim1);
+
+ //let's append an animation
+ QAbstractAnimationJob *anim2 = new TestAnimation;
+ group.appendAnimation(anim2);
+ QCOMPARE(group.duration(), 500);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QCOMPARE(group.currentAnimation(), anim1);
+
+ //let's prepend an animation
+ QAbstractAnimationJob *anim0 = new TestAnimation;
+ group.prependAnimation(anim0);
+ QCOMPARE(group.duration(), 750);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QCOMPARE(group.currentAnimation(), anim0); //anim0 has become the new currentAnimation
+
+ group.setCurrentTime(300); //anim0 | anim1 | anim2
+ QCOMPARE(group.currentLoopTime(), 300);
+ QCOMPARE(group.currentAnimation(), anim1);
+ QCOMPARE(anim1->currentLoopTime(), 50);
+
+ group.removeAnimation(anim0); //anim1 | anim2
+ QCOMPARE(group.currentLoopTime(), 50);
+ QCOMPARE(group.currentAnimation(), anim1);
+ QCOMPARE(anim1->currentLoopTime(), 50);
+
+ group.setCurrentTime(0);
+ group.prependAnimation(anim0); //anim0 | anim1 | anim2
+ group.setCurrentTime(300);
+ QCOMPARE(group.currentLoopTime(), 300);
+ QCOMPARE(group.currentAnimation(), anim1);
+ QCOMPARE(anim1->currentLoopTime(), 50);
+
+ group.removeAnimation(anim1); //anim0 | anim2
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(group.currentAnimation(), anim2);
+ QCOMPARE(anim0->currentLoopTime(), 250);
+}
+
+void tst_QSequentialAnimationGroupJob::currentAnimation()
+{
+ QSequentialAnimationGroupJob group;
+ QVERIFY(group.currentAnimation() == 0);
+
+ TestAnimation anim(0);
+ group.appendAnimation(&anim);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&anim));
+}
+
+void tst_QSequentialAnimationGroupJob::currentAnimationWithZeroDuration()
+{
+ QSequentialAnimationGroupJob group;
+ QVERIFY(group.currentAnimation() == 0);
+
+ TestAnimation zero1(0);
+ TestAnimation zero2(0);
+
+ TestAnimation anim;
+
+ TestAnimation zero3(0);
+ TestAnimation zero4(0);
+
+ group.appendAnimation(&zero1);
+ group.appendAnimation(&zero2);
+ group.appendAnimation(&anim);
+ group.appendAnimation(&zero3);
+ group.appendAnimation(&zero4);
+
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&zero1));
+
+ group.setCurrentTime(0);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&anim));
+
+ group.setCurrentTime(group.duration());
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&zero4));
+
+ group.setDirection(QAbstractAnimationJob::Backward);
+
+ group.setCurrentTime(0);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&zero1));
+
+ group.setCurrentTime(group.duration());
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimationJob*>(&anim));
+}
+
+void tst_QSequentialAnimationGroupJob::insertAnimation()
+{
+ QSequentialAnimationGroupJob group;
+ group.setLoopCount(2);
+ TestAnimation *anim = new TestAnimation;
+ group.appendAnimation(anim);
+ QCOMPARE(group.duration(), anim->duration());
+ group.setCurrentTime(300);
+ QCOMPARE(group.currentLoop(), 1);
+
+ //this will crash if the sequential group calls duration on the created animation
+ group.appendAnimation(new TestAnimation);
+}
+
+class ClearFinishedListener: public QAnimationJobChangeListener
+{
+public:
+ ClearFinishedListener(QSequentialAnimationGroupJob *g) : group(g) {}
+
+ virtual void animationFinished(QAbstractAnimationJob *)
+ {
+ group->clear();
+ }
+
+ QSequentialAnimationGroupJob *group;
+};
+
+class RefillFinishedListener: public QAnimationJobChangeListener
+{
+public:
+ RefillFinishedListener(QSequentialAnimationGroupJob *g) : group(g) {}
+
+ virtual void animationFinished(QAbstractAnimationJob *)
+ {
+ group->stop();
+ group->clear();
+ group->appendAnimation(new TestAnimation);
+ group->start();
+ }
+
+ QSequentialAnimationGroupJob *group;
+};
+
+void tst_QSequentialAnimationGroupJob::clear()
+{
+ QSKIP("deleting an animation when finished is not currently supported");
+ QSequentialAnimationGroupJob group;
+ TestAnimation *anim1 = new TestAnimation;
+ group.appendAnimation(anim1);
+ ClearFinishedListener clearListener(&group);
+ anim1->addAnimationChangeListener(&clearListener, QAbstractAnimationJob::Completion);
+
+ TestAnimation *anim2 = new TestAnimation;
+ group.appendAnimation(anim2);
+ QCOMPARE(group.firstChild(), anim1);
+ QCOMPARE(group.lastChild(), anim2);
+
+ group.start();
+ QTest::qWait(anim1->duration() + 100);
+ QTRY_VERIFY(!group.firstChild());
+ QCOMPARE(group.state(), QAbstractAnimationJob::Stopped);
+ QCOMPARE(group.currentLoopTime(), 0);
+
+ anim1 = new TestAnimation;
+ group.appendAnimation(anim1);
+ RefillFinishedListener refillListener(&group);
+ anim1->addAnimationChangeListener(&refillListener, QAbstractAnimationJob::Completion);
+ group.start();
+ QTest::qWait(anim1->duration() + 100);
+ QTRY_COMPARE(group.state(), QAbstractAnimationJob::Running);
+}
+
+void tst_QSequentialAnimationGroupJob::pauseResume()
+{
+ QParallelAnimationGroupJob group;
+ TestAnimation *anim = new TestAnimation;
+ group.appendAnimation(anim);
+ StateChangeListener spy;
+ anim->addAnimationChangeListener(&spy, QAbstractAnimationJob::StateChange);
+ QCOMPARE(group.duration(), 250);
+ group.start();
+ QTest::qWait(100);
+ QTRY_COMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim->state(), QAnimationGroupJob::Running);
+ QCOMPARE(spy.count(), 1);
+ spy.clear();
+ const int currentTime = group.currentLoopTime();
+ QCOMPARE(anim->currentLoopTime(), currentTime);
+
+ group.pause();
+ QCOMPARE(group.state(), QAnimationGroupJob::Paused);
+ QCOMPARE(group.currentLoopTime(), currentTime);
+ QCOMPARE(anim->state(), QAnimationGroupJob::Paused);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
+ QCOMPARE(spy.count(), 1);
+ spy.clear();
+
+ group.resume();
+ QCOMPARE(group.state(), QAnimationGroupJob::Running);
+ QCOMPARE(group.currentLoopTime(), currentTime);
+ QCOMPARE(anim->state(), QAnimationGroupJob::Running);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
+ QCOMPARE(spy.count(), 1);
+
+ anim->removeAnimationChangeListener(&spy, QAbstractAnimationJob::StateChange);
+}
+
+QTEST_MAIN(tst_QSequentialAnimationGroupJob)
+#include "tst_qsequentialanimationgroupjob.moc"
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro
new file mode 100644
index 0000000000..8f90e4b4e9
--- /dev/null
+++ b/tests/auto/qml/debugger/debugger.pro
@@ -0,0 +1,21 @@
+TEMPLATE = subdirs
+
+PUBLICTESTS += \
+ qqmlenginedebugservice \
+ qqmldebugjs \
+ qqmlinspector \
+ qqmlprofilerservice \
+ qpacketprotocol \
+ qv8profilerservice \
+ qdebugmessageservice \
+ qqmlenginedebuginspectorintegrationtest
+
+PRIVATETESTS += \
+ qqmldebugclient \
+ qqmldebugservice
+
+SUBDIRS += $$PUBLICTESTS
+
+contains(QT_CONFIG, private_tests) {
+ SUBDIRS += $$PRIVATETESTS
+}
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/data/test.qml b/tests/auto/qml/debugger/qdebugmessageservice/data/test.qml
new file mode 100644
index 0000000000..02248eda64
--- /dev/null
+++ b/tests/auto/qml/debugger/qdebugmessageservice/data/test.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 360
+ height: 360
+ Component.onCompleted: {
+ console.log("console.log")
+ console.count("console.count");
+ }
+}
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
new file mode 100644
index 0000000000..3608375771
--- /dev/null
+++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
@@ -0,0 +1,15 @@
+CONFIG += testcase
+TARGET = tst_qdebugmessageservice
+QT += qml network testlib gui-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdebugmessageservice.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
+
+TESTDATA = data/*
+
+OTHER_FILES += data/test.qml
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
new file mode 100644
index 0000000000..363efeabbc
--- /dev/null
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmldebugclient.h"
+
+//QQmlDebugTest
+#include "debugutil_p.h"
+#include "../../../shared/util.h"
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+const char *NORMALMODE = "-qmljsdebugger=port:3777,block";
+const char *QMLFILE = "test.qml";
+
+class QQmlDebugMsgClient;
+class tst_QDebugMessageService : public QQmlDataTest
+{
+ Q_OBJECT
+
+public:
+ tst_QDebugMessageService();
+
+ void init();
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void cleanup();
+
+ void retrieveDebugOutput();
+
+private:
+ QQmlDebugProcess *m_process;
+ QQmlDebugMsgClient *m_client;
+ QQmlDebugConnection *m_connection;
+};
+
+struct LogEntry {
+ LogEntry(QtMsgType _type, QString _message)
+ : type(_type), message(_message) {}
+
+ QtMsgType type;
+ QString message;
+ int line;
+ QString file;
+ QString function;
+
+ QString toString() const { return QString::number(type) + ": " + message; }
+};
+
+bool operator==(const LogEntry &t1, const LogEntry &t2)
+{
+ return t1.type == t2.type && t1.message == t2.message
+ && t1.line == t2.line && t1.file == t2.file
+ && t1.function == t2.function;
+}
+
+class QQmlDebugMsgClient : public QQmlDebugClient
+{
+ Q_OBJECT
+public:
+ QQmlDebugMsgClient(QQmlDebugConnection *connection)
+ : QQmlDebugClient(QLatin1String("DebugMessages"), connection)
+ {
+ }
+
+ QList<LogEntry> logBuffer;
+
+protected:
+ //inherited from QQmlDebugClient
+ void stateChanged(State state);
+ void messageReceived(const QByteArray &data);
+
+signals:
+ void enabled();
+ void debugOutput();
+};
+
+void QQmlDebugMsgClient::stateChanged(State state)
+{
+ if (state == Enabled) {
+ emit enabled();
+ }
+}
+
+void QQmlDebugMsgClient::messageReceived(const QByteArray &data)
+{
+ QDataStream ds(data);
+ QByteArray command;
+ ds >> command;
+
+ if (command == "MESSAGE") {
+ int type;
+ QByteArray message;
+ QByteArray file;
+ QByteArray function;
+ int line;
+ ds >> type >> message >> file >> line >> function;
+ QVERIFY(ds.atEnd());
+
+ QVERIFY(type >= QtDebugMsg);
+ QVERIFY(type <= QtFatalMsg);
+
+ LogEntry entry((QtMsgType)type, QString::fromUtf8(message));
+ entry.line = line;
+ entry.file = QString::fromUtf8(file);
+ entry.function = QString::fromUtf8(function);
+ logBuffer << entry;
+ emit debugOutput();
+ } else {
+ QFAIL("Unknown message");
+ }
+}
+
+tst_QDebugMessageService::tst_QDebugMessageService()
+{
+}
+
+void tst_QDebugMessageService::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ m_process = 0;
+ m_client = 0;
+ m_connection = 0;
+}
+
+void tst_QDebugMessageService::cleanupTestCase()
+{
+ if (m_process)
+ delete m_process;
+
+ if (m_client)
+ delete m_client;
+
+ if (m_connection)
+ delete m_connection;
+}
+
+void tst_QDebugMessageService::init()
+{
+ m_connection = new QQmlDebugConnection();
+ m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+ m_client = new QQmlDebugMsgClient(m_connection);
+
+ m_process->start(QStringList() << QLatin1String(NORMALMODE) << QQmlDataTest::instance()->testFile(QMLFILE));
+ QVERIFY2(m_process->waitForSessionStart(),
+ "Could not launch application, or did not get 'Waiting for connection'.");
+
+ m_connection->connectToHost("127.0.0.1", 3777);
+ QVERIFY(m_connection->waitForConnected());
+
+ if (m_client->state() != QQmlDebugClient::Enabled)
+ QQmlDebugTest::waitForSignal(m_client, SIGNAL(enabled()));
+
+ QVERIFY(m_client->state() == QQmlDebugClient::Enabled);
+}
+
+void tst_QDebugMessageService::cleanup()
+{
+ if (QTest::currentTestFailed()) {
+ qDebug() << "Process State:" << m_process->state();
+ qDebug() << "Application Output:" << m_process->output();
+ }
+ if (m_process)
+ delete m_process;
+
+ if (m_client)
+ delete m_client;
+
+ if (m_connection)
+ delete m_connection;
+
+ m_process = 0;
+ m_client = 0;
+ m_connection = 0;
+}
+
+void tst_QDebugMessageService::retrieveDebugOutput()
+{
+ init();
+
+ int maxTries = 2;
+ while ((m_client->logBuffer.size() < 2)
+ || (maxTries-- > 0))
+ QQmlDebugTest::waitForSignal(m_client, SIGNAL(debugOutput()), 1000);
+
+ QVERIFY(m_client->logBuffer.size() >= 2);
+
+ const QString path =
+ QUrl::fromLocalFile(QQmlDataTest::instance()->testFile(QMLFILE)).toString();
+ LogEntry entry1(QtDebugMsg, QLatin1String("console.log"));
+ entry1.line = 48;
+ entry1.file = path;
+ entry1.function = QLatin1String("onCompleted");
+ LogEntry entry2(QtDebugMsg, QLatin1String("console.count: 1"));
+ entry2.line = 49;
+ entry2.file = path;
+ entry2.function = QLatin1String("onCompleted");
+
+ QVERIFY(m_client->logBuffer.contains(entry1));
+ QVERIFY(m_client->logBuffer.contains(entry2));
+}
+
+QTEST_MAIN(tst_QDebugMessageService)
+
+#include "tst_qdebugmessageservice.moc"
diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
new file mode 100644
index 0000000000..98c0fc2542
--- /dev/null
+++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qpacketprotocol
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qpacketprotocol.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
+
+CONFIG += parallel_test
+QT += qml network testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
new file mode 100644
index 0000000000..8dfd25b58b
--- /dev/null
+++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -0,0 +1,263 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QTimer>
+#include <QTcpSocket>
+#include <QTcpServer>
+#include <QDebug>
+#include <QBuffer>
+
+#include "../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h"
+
+#include "debugutil_p.h"
+
+class tst_QPacketProtocol : public QObject
+{
+ Q_OBJECT
+
+private:
+ QTcpServer *m_server;
+ QTcpSocket *m_client;
+ QTcpSocket *m_serverConn;
+
+private slots:
+ void init();
+ void cleanup();
+
+ void maximumPacketSize();
+ void setMaximumPacketSize();
+ void setMaximumPacketSize_data();
+ void send();
+ void send_data();
+ void packetsAvailable();
+ void packetsAvailable_data();
+ void clear();
+ void read();
+ void device();
+
+ void tst_QPacket_clear();
+};
+
+void tst_QPacketProtocol::init()
+{
+ m_server = new QTcpServer(this);
+ m_serverConn = 0;
+ QVERIFY(m_server->listen(QHostAddress("127.0.0.1")));
+
+ m_client = new QTcpSocket(this);
+ m_client->connectToHost(m_server->serverAddress(), m_server->serverPort());
+
+ QVERIFY(m_client->waitForConnected());
+ QVERIFY(m_server->waitForNewConnection(5000));
+ m_serverConn = m_server->nextPendingConnection();
+}
+
+void tst_QPacketProtocol::cleanup()
+{
+ delete m_client;
+ delete m_serverConn;
+ delete m_server;
+}
+
+void tst_QPacketProtocol::maximumPacketSize()
+{
+ QPacketProtocol p(m_client);
+ QCOMPARE(p.maximumPacketSize(), 0x7FFFFFFF);
+}
+
+void tst_QPacketProtocol::setMaximumPacketSize()
+{
+ QFETCH(qint32, size);
+ QFETCH(qint32, expected);
+
+ QPacketProtocol out(m_serverConn);
+ QCOMPARE(out.setMaximumPacketSize(size), expected);
+}
+
+void tst_QPacketProtocol::setMaximumPacketSize_data()
+{
+ QTest::addColumn<int>("size");
+ QTest::addColumn<int>("expected");
+
+ QTest::newRow("invalid") << qint32(sizeof(qint32) - 1) << qint32(0x7FFFFFFF);
+ QTest::newRow("still invalid") << qint32(sizeof(qint32)) << qint32(0x7FFFFFFF);
+ QTest::newRow("valid") << qint32(sizeof(qint32) + 1) << qint32(sizeof(qint32) + 1);
+}
+
+void tst_QPacketProtocol::send()
+{
+ QFETCH(bool, useAutoSend);
+
+ QPacketProtocol in(m_client);
+ QPacketProtocol out(m_serverConn);
+
+ QByteArray ba;
+ int num;
+
+ if (useAutoSend) {
+ out.send() << "Hello world" << 123;
+ } else {
+ QPacket packet;
+ packet << "Hello world" << 123;
+ out.send(packet);
+ }
+
+ QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead())));
+
+ QPacket p = in.read();
+ p >> ba >> num;
+ QCOMPARE(ba, QByteArray("Hello world") + '\0');
+ QCOMPARE(num, 123);
+}
+
+void tst_QPacketProtocol::send_data()
+{
+ QTest::addColumn<bool>("useAutoSend");
+
+ QTest::newRow("auto send") << true;
+ QTest::newRow("no auto send") << false;
+}
+
+void tst_QPacketProtocol::packetsAvailable()
+{
+ QFETCH(int, packetCount);
+
+ QPacketProtocol out(m_client);
+ QPacketProtocol in(m_serverConn);
+
+ QCOMPARE(out.packetsAvailable(), qint64(0));
+ QCOMPARE(in.packetsAvailable(), qint64(0));
+
+ for (int i=0; i<packetCount; i++)
+ out.send() << "Hello";
+
+ QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead())));
+ QCOMPARE(in.packetsAvailable(), qint64(packetCount));
+}
+
+void tst_QPacketProtocol::packetsAvailable_data()
+{
+ QTest::addColumn<int>("packetCount");
+
+ QTest::newRow("1") << 1;
+ QTest::newRow("2") << 2;
+ QTest::newRow("10") << 10;
+}
+
+void tst_QPacketProtocol::clear()
+{
+ QPacketProtocol in(m_client);
+ QPacketProtocol out(m_serverConn);
+
+ out.send() << 123;
+ out.send() << 456;
+ QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead())));
+
+ in.clear();
+ QVERIFY(in.read().isEmpty());
+}
+
+void tst_QPacketProtocol::read()
+{
+ QPacketProtocol in(m_client);
+ QPacketProtocol out(m_serverConn);
+
+ QVERIFY(in.read().isEmpty());
+
+ out.send() << 123;
+ out.send() << 456;
+ QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead())));
+
+ int num;
+
+ QPacket p1 = in.read();
+ QVERIFY(!p1.isEmpty());
+ p1 >> num;
+ QCOMPARE(num, 123);
+
+ QPacket p2 = in.read();
+ QVERIFY(!p2.isEmpty());
+ p2 >> num;
+ QCOMPARE(num, 456);
+
+ QVERIFY(in.read().isEmpty());
+}
+
+void tst_QPacketProtocol::device()
+{
+ QPacketProtocol p(m_client);
+ QVERIFY(p.device() == m_client);
+}
+
+void tst_QPacketProtocol::tst_QPacket_clear()
+{
+ QPacketProtocol protocol(m_client);
+
+ QPacket packet;
+
+ packet << "Hello world!" << 123;
+ protocol.send(packet);
+
+ packet.clear();
+ QVERIFY(packet.isEmpty());
+ packet << "Goodbyte world!" << 789;
+ protocol.send(packet);
+
+ QByteArray ba;
+ int num;
+ QPacketProtocol in(m_serverConn);
+ QVERIFY(QQmlDebugTest::waitForSignal(&in, SIGNAL(readyRead())));
+
+ QPacket p1 = in.read();
+ p1 >> ba >> num;
+ QCOMPARE(ba, QByteArray("Hello world!") + '\0');
+ QCOMPARE(num, 123);
+
+ QPacket p2 = in.read();
+ p2 >> ba >> num;
+ QCOMPARE(ba, QByteArray("Goodbyte world!") + '\0');
+ QCOMPARE(num, 789);
+}
+
+QTEST_MAIN(tst_QPacketProtocol)
+
+#include "tst_qpacketprotocol.moc"
diff --git a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
new file mode 100644
index 0000000000..38f78e8248
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_qqmldebugclient
+macx:CONFIG -= app_bundle
+
+HEADERS += ../shared/qqmldebugtestservice.h
+
+SOURCES += tst_qqmldebugclient.cpp \
+ ../shared/qqmldebugtestservice.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
+
+DEFINES += QT_QML_DEBUG_NO_WARNING
+
+CONFIG += qml_debug
+
+QT += qml-private testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
new file mode 100644
index 0000000000..bca40e9acd
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QTimer>
+#include <QHostAddress>
+#include <QDebug>
+#include <QThread>
+
+#include <QtQml/qqmlengine.h>
+
+#include "debugutil_p.h"
+#include "qqmldebugtestservice.h"
+
+#define PORT 13770
+#define STR_PORT "13770"
+
+class tst_QQmlDebugClient : public QObject
+{
+ Q_OBJECT
+
+private:
+ QQmlDebugConnection *m_conn;
+
+private slots:
+ void initTestCase();
+
+ void name();
+ void state();
+ void sendMessage();
+ void parallelConnect();
+ void sequentialConnect();
+};
+
+void tst_QQmlDebugClient::initTestCase()
+{
+ const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT);
+ QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData());
+ new QQmlEngine(this);
+
+ m_conn = new QQmlDebugConnection(this);
+
+ QQmlDebugTestClient client("tst_QQmlDebugClient::handshake()", m_conn);
+ QQmlDebugTestService service("tst_QQmlDebugClient::handshake()");
+
+ for (int i = 0; i < 50; ++i) {
+ // try for 5 seconds ...
+ m_conn->connectToHost("127.0.0.1", PORT);
+ if (m_conn->waitForConnected())
+ break;
+ QTest::qSleep(100);
+ }
+
+ QVERIFY(m_conn->isConnected());
+
+ QTRY_VERIFY(QQmlDebugService::hasDebuggingClient());
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
+}
+
+void tst_QQmlDebugClient::name()
+{
+ QString name = "tst_QQmlDebugClient::name()";
+
+ QQmlDebugClient client(name, m_conn);
+ QCOMPARE(client.name(), name);
+}
+
+void tst_QQmlDebugClient::state()
+{
+ {
+ QQmlDebugConnection dummyConn;
+ QQmlDebugClient client("tst_QQmlDebugClient::state()", &dummyConn);
+ QCOMPARE(client.state(), QQmlDebugClient::NotConnected);
+ QCOMPARE(client.serviceVersion(), -1.0f);
+ }
+
+ QQmlDebugTestClient client("tst_QQmlDebugClient::state()", m_conn);
+ QCOMPARE(client.state(), QQmlDebugClient::Unavailable);
+
+ {
+ QQmlDebugTestService service("tst_QQmlDebugClient::state()", 2);
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
+ QCOMPARE(client.serviceVersion(), 2.0f);
+ }
+
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Unavailable);
+
+ // duplicate plugin name
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\" ");
+ QQmlDebugClient client2("tst_QQmlDebugClient::state()", m_conn);
+ QCOMPARE(client2.state(), QQmlDebugClient::NotConnected);
+
+ QQmlDebugClient client3("tst_QQmlDebugClient::state3()", 0);
+ QCOMPARE(client3.state(), QQmlDebugClient::NotConnected);
+}
+
+void tst_QQmlDebugClient::sendMessage()
+{
+ QQmlDebugTestService service("tst_QQmlDebugClient::sendMessage()");
+ QQmlDebugTestClient client("tst_QQmlDebugClient::sendMessage()", m_conn);
+
+ QByteArray msg = "hello!";
+
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
+
+ client.sendMessage(msg);
+ QByteArray resp = client.waitForResponse();
+ QCOMPARE(resp, msg);
+}
+
+void tst_QQmlDebugClient::parallelConnect()
+{
+ QQmlDebugConnection connection2;
+
+ QTest::ignoreMessage(QtWarningMsg, "QML Debugger: Another client is already connected.");
+ // will connect & immediately disconnect
+ connection2.connectToHost("127.0.0.1", PORT);
+ QTRY_COMPARE(connection2.state(), QAbstractSocket::UnconnectedState);
+ QVERIFY(m_conn->isConnected());
+}
+
+void tst_QQmlDebugClient::sequentialConnect()
+{
+ QQmlDebugConnection connection2;
+ QQmlDebugTestClient client2("tst_QQmlDebugClient::handshake()", &connection2);
+ QQmlDebugTestService service("tst_QQmlDebugClient::handshake()");
+
+ m_conn->close();
+ QVERIFY(!m_conn->isConnected());
+ QCOMPARE(m_conn->state(), QAbstractSocket::UnconnectedState);
+
+ // Make sure that the disconnect is actually delivered to the server
+ QTest::qWait(100);
+
+ connection2.connectToHost("127.0.0.1", PORT);
+ QVERIFY(connection2.waitForConnected());
+ QVERIFY(connection2.isConnected());
+ QTRY_VERIFY(client2.state() == QQmlDebugClient::Enabled);
+}
+
+int main(int argc, char *argv[])
+{
+ int _argc = argc + 1;
+ char **_argv = new char*[_argc];
+ for (int i = 0; i < argc; ++i)
+ _argv[i] = argv[i];
+ char arg[] = "-qmljsdebugger=port:" STR_PORT;
+ _argv[_argc - 1] = arg;
+
+ QGuiApplication app(_argc, _argv);
+ tst_QQmlDebugClient tc;
+ return QTest::qExec(&tc, _argc, _argv);
+ delete _argv;
+}
+
+#include "tst_qqmldebugclient.moc"
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml b/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml
new file mode 100644
index 0000000000..d54b704da8
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ //Comment
+
+ var x = 6;
+ }
+
+ width : height + 2
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml b/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml
new file mode 100644
index 0000000000..440767b029
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: item
+ property int d: 0
+
+ function doSomething() {
+ var a = 5;
+ var b = 6;
+ }
+
+ Timer {
+ id: timer; interval: 1; running: true; repeat: true
+ onTriggered: doSomething();
+ }
+
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml b/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml
new file mode 100644
index 0000000000..2fb83143f6
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: item
+ property int a: 0
+ Timer {
+ id: timer; interval: 1; repeat: true; running: true
+ onTriggered: a++
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml b/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml
new file mode 100644
index 0000000000..bf3bf31a69
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+Item {
+ Component.onCompleted: {
+ var component = Qt.createComponent("oncompleted.qml")
+ if (component.status === Component.Ready) {
+ component.createObject();
+ }
+ }
+}
+
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml b/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml
new file mode 100644
index 0000000000..04999c0234
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: root
+
+ Component.onCompleted: dummy()
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml b/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml
new file mode 100644
index 0000000000..a2f868c95e
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "test.js" as Script
+
+//DO NOT CHANGE
+Item {
+ Component.onCompleted: Script.printMessage("onCompleted");
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml b/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml
new file mode 100644
index 0000000000..fa424039c1
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ console.log("Hello world")
+ }
+ id: root
+ property int a: 10
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml b/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml
new file mode 100644
index 0000000000..0cf566a936
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ id: item
+ property int d: 0
+
+ function doSomething() {
+ var a = 5;
+ var b = 6;
+ }
+
+ Component.onCompleted: doSomething()
+
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/test.js b/tests/auto/qml/debugger/qqmldebugjs/data/test.js
new file mode 100644
index 0000000000..ac42bfce01
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/test.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+function printMessage(msg)
+{
+ print(msg);
+}
+
+function add(a,b)
+{
+ //This is a comment and below is an empty line
+
+ var out = a + b;
+ return out;
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/test.qml b/tests/auto/qml/debugger/qqmldebugjs/data/test.qml
new file mode 100644
index 0000000000..e019ba8b17
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/test.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+ function foo() {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml b/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml
new file mode 100644
index 0000000000..927cfe805a
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+Item {
+ Timer {
+ id: timer; interval: 1; running: true; repeat: true; triggeredOnStart: true
+ onTriggered: {
+ console.log("timer");
+ }
+ }
+}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
new file mode 100644
index 0000000000..eb5f17a55d
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -0,0 +1,24 @@
+CONFIG += testcase
+TARGET = tst_qqmldebugjs
+QT += qml testlib gui-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmldebugjs.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
+
+TESTDATA = data/*
+
+OTHER_FILES += data/test.qml data/test.js \
+ data/timer.qml \
+ data/exception.qml \
+ data/oncompleted.qml \
+ data/loadjsfile.qml \
+ data/condition.qml \
+ data/changeBreakpoint.qml \
+ data/stepAction.qml \
+ data/breakpointRelocation.qml \
+ data/createComponent.qml
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
new file mode 100644
index 0000000000..9c2ba5bcde
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -0,0 +1,1801 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtCore/QProcess>
+#include <QtCore/QTimer>
+#include <QtCore/QFileInfo>
+#include <QtCore/QDir>
+#include <QtCore/QMutex>
+#include <QtCore/QLibraryInfo>
+#include <QtQml/QJSEngine>
+
+//QQmlDebugTest
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
+#include "../../../shared/util.h"
+
+const char *V8REQUEST = "v8request";
+const char *V8MESSAGE = "v8message";
+const char *SEQ = "seq";
+const char *TYPE = "type";
+const char *COMMAND = "command";
+const char *ARGUMENTS = "arguments";
+const char *STEPACTION = "stepaction";
+const char *STEPCOUNT = "stepcount";
+const char *EXPRESSION = "expression";
+const char *FRAME = "frame";
+const char *GLOBAL = "global";
+const char *DISABLEBREAK = "disable_break";
+const char *HANDLES = "handles";
+const char *INCLUDESOURCE = "includeSource";
+const char *FROMFRAME = "fromFrame";
+const char *TOFRAME = "toFrame";
+const char *BOTTOM = "bottom";
+const char *NUMBER = "number";
+const char *FRAMENUMBER = "frameNumber";
+const char *TYPES = "types";
+const char *IDS = "ids";
+const char *FILTER = "filter";
+const char *FROMLINE = "fromLine";
+const char *TOLINE = "toLine";
+const char *TARGET = "target";
+const char *LINE = "line";
+const char *COLUMN = "column";
+const char *ENABLED = "enabled";
+const char *CONDITION = "condition";
+const char *IGNORECOUNT = "ignoreCount";
+const char *BREAKPOINT = "breakpoint";
+const char *FLAGS = "flags";
+
+const char *CONTINEDEBUGGING = "continue";
+const char *EVALUATE = "evaluate";
+const char *LOOKUP = "lookup";
+const char *BACKTRACE = "backtrace";
+const char *SCOPE = "scope";
+const char *SCOPES = "scopes";
+const char *SCRIPTS = "scripts";
+const char *SOURCE = "source";
+const char *SETBREAKPOINT = "setbreakpoint";
+const char *CHANGEBREAKPOINT = "changebreakpoint";
+const char *CLEARBREAKPOINT = "clearbreakpoint";
+const char *SETEXCEPTIONBREAK = "setexceptionbreak";
+const char *V8FLAGS = "v8flags";
+const char *VERSION = "version";
+const char *DISCONNECT = "disconnect";
+const char *LISTBREAKPOINTS = "listbreakpoints";
+const char *GARBAGECOLLECTOR = "gc";
+//const char *PROFILE = "profile";
+
+const char *CONNECT = "connect";
+const char *INTERRUPT = "interrupt";
+
+const char *REQUEST = "request";
+const char *IN = "in";
+const char *NEXT = "next";
+const char *OUT = "out";
+
+const char *FUNCTION = "function";
+const char *SCRIPT = "script";
+const char *SCRIPTREGEXP = "scriptRegExp";
+const char *EVENT = "event";
+
+const char *ALL = "all";
+const char *UNCAUGHT = "uncaught";
+
+//const char *PAUSE = "pause";
+//const char *RESUME = "resume";
+
+const char *BLOCKMODE = "-qmljsdebugger=port:3771,3800,block";
+const char *NORMALMODE = "-qmljsdebugger=port:3771,3800";
+const char *TEST_QMLFILE = "test.qml";
+const char *TEST_JSFILE = "test.js";
+const char *TIMER_QMLFILE = "timer.qml";
+const char *LOADJSFILE_QMLFILE = "loadjsfile.qml";
+const char *EXCEPTION_QMLFILE = "exception.qml";
+const char *ONCOMPLETED_QMLFILE = "oncompleted.qml";
+const char *CREATECOMPONENT_QMLFILE = "createComponent.qml";
+const char *CONDITION_QMLFILE = "condition.qml";
+const char *CHANGEBREAKPOINT_QMLFILE = "changeBreakpoint.qml";
+const char *STEPACTION_QMLFILE = "stepAction.qml";
+const char *BREAKPOINTRELOCATION_QMLFILE = "breakpointRelocation.qml";
+
+#define VARIANTMAPINIT \
+ QString obj("{}"); \
+ QJSValue jsonVal = parser.call(QJSValueList() << obj); \
+ jsonVal.setProperty(SEQ,QJSValue(seq++)); \
+ jsonVal.setProperty(TYPE,REQUEST);
+
+
+#undef QVERIFY
+#define QVERIFY(statement) \
+do {\
+ if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) {\
+ if (QTest::currentTestFailed()) \
+ qDebug().nospace() << "\nDEBUGGEE OUTPUT:\n" << process->output();\
+ return;\
+ }\
+} while (0)
+
+
+class QJSDebugClient;
+
+class tst_QQmlDebugJS : public QQmlDataTest
+{
+ Q_OBJECT
+
+ bool init(const QString &qmlFile = QString(TEST_QMLFILE), bool blockMode = true);
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void cleanup();
+
+ void connect();
+ void interrupt();
+ void getVersion();
+// void getVersionWhenAttaching();
+
+ void applyV8Flags();
+
+ void disconnect();
+
+ void gc();
+
+ void listBreakpoints();
+
+ void setBreakpointInScriptOnCompleted();
+ void setBreakpointInScriptOnComponentCreated();
+ void setBreakpointInScriptOnTimerCallback();
+ void setBreakpointInScriptInDifferentFile();
+ void setBreakpointInScriptOnComment();
+ void setBreakpointInScriptOnEmptyLine();
+ void setBreakpointInScriptOnOptimizedBinding();
+ void setBreakpointInScriptWithCondition();
+ //void setBreakpointInFunction(); //NOT SUPPORTED
+ void setBreakpointOnEvent();
+// void setBreakpointWhenAttaching();
+
+ void changeBreakpoint();
+ void changeBreakpointOnCondition();
+
+ void clearBreakpoint();
+
+ void setExceptionBreak();
+
+ void stepNext();
+ void stepNextWithCount();
+ void stepIn();
+ void stepOut();
+ void continueDebugging();
+
+ void backtrace();
+
+ void getFrameDetails();
+
+ void getScopeDetails();
+
+ void evaluateInGlobalScope();
+ void evaluateInLocalScope();
+
+ void getScopes();
+
+ void getScripts();
+
+ void getSource();
+
+ // void profile(); //NOT SUPPORTED
+
+ // void verifyQMLOptimizerDisabled();
+
+private:
+ QQmlDebugProcess *process;
+ QJSDebugClient *client;
+ QQmlDebugConnection *connection;
+ QTime t;
+};
+
+class QJSDebugClient : public QQmlDebugClient
+{
+ Q_OBJECT
+public:
+ enum StepAction
+ {
+ Continue,
+ In,
+ Out,
+ Next
+ };
+
+ enum Exception
+ {
+ All,
+ Uncaught
+ };
+
+// enum ProfileCommand
+// {
+// Pause,
+// Resume
+// };
+
+ QJSDebugClient(QQmlDebugConnection *connection)
+ : QQmlDebugClient(QLatin1String("V8Debugger"), connection),
+ seq(0)
+ {
+ parser = jsEngine.evaluate(QLatin1String("JSON.parse"));
+ stringify = jsEngine.evaluate(QLatin1String("JSON.stringify"));
+ }
+
+ void connect();
+ void interrupt();
+
+ void continueDebugging(StepAction stepAction, int stepCount = 1);
+ void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
+ void lookup(QList<int> handles, bool includeSource = false);
+ void backtrace(int fromFrame = -1, int toFrame = -1, bool bottom = false);
+ void frame(int number = -1);
+ void scope(int number = -1, int frameNumber = -1);
+ void scopes(int frameNumber = -1);
+ void scripts(int types = 4, QList<int> ids = QList<int>(), bool includeSource = false, QVariant filter = QVariant());
+ void source(int frame = -1, int fromLine = -1, int toLine = -1);
+ void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = true, QString condition = QString(), int ignoreCount = -1);
+ void changeBreakpoint(int breakpoint, bool enabled = true, QString condition = QString(), int ignoreCount = -1);
+ void clearBreakpoint(int breakpoint);
+ void setExceptionBreak(Exception type, bool enabled = false);
+ void v8flags(QString flags);
+ void version();
+ //void profile(ProfileCommand command); //NOT SUPPORTED
+ void disconnect();
+ void gc();
+ void listBreakpoints();
+
+protected:
+ //inherited from QQmlDebugClient
+ void stateChanged(State state);
+ void messageReceived(const QByteArray &data);
+
+signals:
+ void enabled();
+ void connected();
+ void interruptRequested();
+ void result();
+ void stopped();
+ void scriptsResult();
+ void evaluateResult();
+
+private:
+ void sendMessage(const QByteArray &);
+ void flushSendBuffer();
+ QByteArray packMessage(const QByteArray &type, const QByteArray &message = QByteArray());
+
+private:
+ QJSEngine jsEngine;
+ int seq;
+
+ QList<QByteArray> sendBuffer;
+public:
+ QJSValue parser;
+ QJSValue stringify;
+ QByteArray response;
+
+};
+
+void QJSDebugClient::connect()
+{
+ sendMessage(packMessage(CONNECT));
+}
+
+void QJSDebugClient::interrupt()
+{
+ sendMessage(packMessage(INTERRUPT));
+}
+
+void QJSDebugClient::continueDebugging(StepAction action, int count)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "continue",
+ // "arguments" : { "stepaction" : <"in", "next" or "out">,
+ // "stepcount" : <number of steps (default 1)>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(CONTINEDEBUGGING)));
+
+ if (action != Continue) {
+ QJSValue args = parser.call(QJSValueList() << obj);
+ switch (action) {
+ case In: args.setProperty(QLatin1String(STEPACTION),QJSValue(QLatin1String(IN)));
+ break;
+ case Out: args.setProperty(QLatin1String(STEPACTION),QJSValue(QLatin1String(OUT)));
+ break;
+ case Next: args.setProperty(QLatin1String(STEPACTION),QJSValue(QLatin1String(NEXT)));
+ break;
+ default:break;
+ }
+ if (!args.isUndefined()) {
+ if (count != 1)
+ args.setProperty(QLatin1String(STEPCOUNT),QJSValue(count));
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+ }
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::evaluate(QString expr, bool global, bool disableBreak, int frame, const QVariantMap &/*addContext*/)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "evaluate",
+ // "arguments" : { "expression" : <expression to evaluate>,
+ // "frame" : <number>,
+ // "global" : <boolean>,
+ // "disable_break" : <boolean>,
+ // "additional_context" : [
+ // { "name" : <name1>, "handle" : <handle1> },
+ // { "name" : <name2>, "handle" : <handle2> },
+ // ...
+ // ]
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(EVALUATE)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+ args.setProperty(QLatin1String(EXPRESSION),QJSValue(expr));
+
+ if (frame != -1)
+ args.setProperty(QLatin1String(FRAME),QJSValue(frame));
+
+ if (global)
+ args.setProperty(QLatin1String(GLOBAL),QJSValue(global));
+
+ if (disableBreak)
+ args.setProperty(QLatin1String(DISABLEBREAK),QJSValue(disableBreak));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::lookup(QList<int> handles, bool includeSource)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "lookup",
+ // "arguments" : { "handles" : <array of handles>,
+ // "includeSource" : <boolean indicating whether the source will be included when script objects are returned>,
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(LOOKUP)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ QString arr("[]");
+ QJSValue array = parser.call(QJSValueList() << arr);
+ int index = 0;
+ foreach (int handle, handles) {
+ array.setProperty(index++,QJSValue(handle));
+ }
+ args.setProperty(QLatin1String(HANDLES),array);
+
+ if (includeSource)
+ args.setProperty(QLatin1String(INCLUDESOURCE),QJSValue(includeSource));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::backtrace(int fromFrame, int toFrame, bool bottom)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "backtrace",
+ // "arguments" : { "fromFrame" : <number>
+ // "toFrame" : <number>
+ // "bottom" : <boolean, set to true if the bottom of the stack is requested>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(BACKTRACE)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ if (fromFrame != -1)
+ args.setProperty(QLatin1String(FROMFRAME),QJSValue(fromFrame));
+
+ if (toFrame != -1)
+ args.setProperty(QLatin1String(TOFRAME),QJSValue(toFrame));
+
+ if (bottom)
+ args.setProperty(QLatin1String(BOTTOM),QJSValue(bottom));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::frame(int number)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "frame",
+ // "arguments" : { "number" : <frame number>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(FRAME)));
+
+ if (number != -1) {
+ QJSValue args = parser.call(QJSValueList() << obj);
+ args.setProperty(QLatin1String(NUMBER),QJSValue(number));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::scope(int number, int frameNumber)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "scope",
+ // "arguments" : { "number" : <scope number>
+ // "frameNumber" : <frame number, optional uses selected frame if missing>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SCOPE)));
+
+ if (number != -1) {
+ QJSValue args = parser.call(QJSValueList() << obj);
+ args.setProperty(QLatin1String(NUMBER),QJSValue(number));
+
+ if (frameNumber != -1)
+ args.setProperty(QLatin1String(FRAMENUMBER),QJSValue(frameNumber));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::scopes(int frameNumber)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "scopes",
+ // "arguments" : { "frameNumber" : <frame number, optional uses selected frame if missing>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SCOPES)));
+
+ if (frameNumber != -1) {
+ QJSValue args = parser.call(QJSValueList() << obj);
+ args.setProperty(QLatin1String(FRAMENUMBER),QJSValue(frameNumber));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::scripts(int types, QList<int> ids, bool includeSource, QVariant /*filter*/)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "scripts",
+ // "arguments" : { "types" : <types of scripts to retrieve
+ // set bit 0 for native scripts
+ // set bit 1 for extension scripts
+ // set bit 2 for normal scripts
+ // (default is 4 for normal scripts)>
+ // "ids" : <array of id's of scripts to return. If this is not specified all scripts are requrned>
+ // "includeSource" : <boolean indicating whether the source code should be included for the scripts returned>
+ // "filter" : <string or number: filter string or script id.
+ // If a number is specified, then only the script with the same number as its script id will be retrieved.
+ // If a string is specified, then only scripts whose names contain the filter string will be retrieved.>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SCRIPTS)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+ args.setProperty(QLatin1String(TYPES),QJSValue(types));
+
+ if (ids.count()) {
+ QString arr("[]");
+ QJSValue array = parser.call(QJSValueList() << arr);
+ int index = 0;
+ foreach (int id, ids) {
+ array.setProperty(index++,QJSValue(id));
+ }
+ args.setProperty(QLatin1String(IDS),array);
+ }
+
+ if (includeSource)
+ args.setProperty(QLatin1String(INCLUDESOURCE),QJSValue(includeSource));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::source(int frame, int fromLine, int toLine)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "source",
+ // "arguments" : { "frame" : <frame number (default selected frame)>
+ // "fromLine" : <from line within the source default is line 0>
+ // "toLine" : <to line within the source this line is not included in
+ // the result default is the number of lines in the script>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SOURCE)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ if (frame != -1)
+ args.setProperty(QLatin1String(FRAME),QJSValue(frame));
+
+ if (fromLine != -1)
+ args.setProperty(QLatin1String(FROMLINE),QJSValue(fromLine));
+
+ if (toLine != -1)
+ args.setProperty(QLatin1String(TOLINE),QJSValue(toLine));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::setBreakpoint(QString type, QString target, int line, int column, bool enabled, QString condition, int ignoreCount)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "setbreakpoint",
+ // "arguments" : { "type" : <"function" or "script" or "scriptId" or "scriptRegExp">
+ // "target" : <function expression or script identification>
+ // "line" : <line in script or function>
+ // "column" : <character position within the line>
+ // "enabled" : <initial enabled state. True or false, default is true>
+ // "condition" : <string with break point condition>
+ // "ignoreCount" : <number specifying the number of break point hits to ignore, default value is 0>
+ // }
+ // }
+
+ if (type == QLatin1String(EVENT)) {
+ QByteArray reply;
+ QDataStream rs(&reply, QIODevice::WriteOnly);
+ rs << target.toUtf8() << enabled;
+ sendMessage(packMessage(QByteArray("breakonsignal"), reply));
+
+ } else {
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SETBREAKPOINT)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ args.setProperty(QLatin1String(TYPE),QJSValue(type));
+ args.setProperty(QLatin1String(TARGET),QJSValue(target));
+
+ if (line != -1)
+ args.setProperty(QLatin1String(LINE),QJSValue(line));
+
+ if (column != -1)
+ args.setProperty(QLatin1String(COLUMN),QJSValue(column));
+
+ args.setProperty(QLatin1String(ENABLED),QJSValue(enabled));
+
+ if (!condition.isEmpty())
+ args.setProperty(QLatin1String(CONDITION),QJSValue(condition));
+
+ if (ignoreCount != -1)
+ args.setProperty(QLatin1String(IGNORECOUNT),QJSValue(ignoreCount));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+ }
+}
+
+void QJSDebugClient::changeBreakpoint(int breakpoint, bool enabled, QString condition, int ignoreCount)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "changebreakpoint",
+ // "arguments" : { "breakpoint" : <number of the break point to clear>
+ // "enabled" : <initial enabled state. True or false, default is true>
+ // "condition" : <string with break point condition>
+ // "ignoreCount" : <number specifying the number of break point hits }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(CHANGEBREAKPOINT)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ args.setProperty(QLatin1String(BREAKPOINT),QJSValue(breakpoint));
+
+ args.setProperty(QLatin1String(ENABLED),QJSValue(enabled));
+
+ if (!condition.isEmpty())
+ args.setProperty(QLatin1String(CONDITION),QJSValue(condition));
+
+ if (ignoreCount != -1)
+ args.setProperty(QLatin1String(IGNORECOUNT),QJSValue(ignoreCount));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::clearBreakpoint(int breakpoint)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "clearbreakpoint",
+ // "arguments" : { "breakpoint" : <number of the break point to clear>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(CLEARBREAKPOINT)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ args.setProperty(QLatin1String(BREAKPOINT),QJSValue(breakpoint));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::setExceptionBreak(Exception type, bool enabled)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "setexceptionbreak",
+ // "arguments" : { "type" : <string: "all", or "uncaught">,
+ // "enabled" : <optional bool: enables the break type if true>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(SETEXCEPTIONBREAK)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ if (type == All)
+ args.setProperty(QLatin1String(TYPE),QJSValue(QLatin1String(ALL)));
+ else if (type == Uncaught)
+ args.setProperty(QLatin1String(TYPE),QJSValue(QLatin1String(UNCAUGHT)));
+
+ if (enabled)
+ args.setProperty(QLatin1String(ENABLED),QJSValue(enabled));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::v8flags(QString flags)
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "v8flags",
+ // "arguments" : { "flags" : <string: a sequence of v8 flags just like those used on the command line>
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(V8FLAGS)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ args.setProperty(QLatin1String(FLAGS),QJSValue(flags));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::version()
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "version",
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(VERSION)));
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+//void QJSDebugClient::profile(ProfileCommand command)
+//{
+//// { "seq" : <number>,
+//// "type" : "request",
+//// "command" : "profile",
+//// "arguments" : { "command" : "resume" or "pause" }
+//// }
+// VARIANTMAPINIT;
+// jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(PROFILE)));
+
+// QJSValue args = parser.call(QJSValueList() << obj);
+
+// if (command == Resume)
+// args.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(RESUME)));
+// else
+// args.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(PAUSE)));
+
+// args.setProperty(QLatin1String("modules"),QJSValue(1));
+// if (!args.isUndefined()) {
+// jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+// }
+
+// QJSValue json = stringify.call(QJSValueList() << jsonVal);
+// sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+//}
+
+void QJSDebugClient::disconnect()
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "disconnect",
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(DISCONNECT)));
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(DISCONNECT, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::gc()
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "gc",
+ // "arguments" : { "type" : <string: "all">,
+ // }
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(GARBAGECOLLECTOR)));
+
+ QJSValue args = parser.call(QJSValueList() << obj);
+
+ args.setProperty(QLatin1String(TYPE),QJSValue(QLatin1String(ALL)));
+
+ if (!args.isUndefined()) {
+ jsonVal.setProperty(QLatin1String(ARGUMENTS),args);
+ }
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::listBreakpoints()
+{
+ // { "seq" : <number>,
+ // "type" : "request",
+ // "command" : "listbreakpoints",
+ // }
+ VARIANTMAPINIT;
+ jsonVal.setProperty(QLatin1String(COMMAND),QJSValue(QLatin1String(LISTBREAKPOINTS)));
+
+ QJSValue json = stringify.call(QJSValueList() << jsonVal);
+ sendMessage(packMessage(V8REQUEST, json.toString().toUtf8()));
+}
+
+void QJSDebugClient::stateChanged(State state)
+{
+ if (state == Enabled) {
+ flushSendBuffer();
+ emit enabled();
+ }
+}
+
+void QJSDebugClient::messageReceived(const QByteArray &data)
+{
+ QDataStream ds(data);
+ QByteArray command;
+ ds >> command;
+
+ if (command == "V8DEBUG") {
+ QByteArray type;
+ ds >> type >> response;
+
+ if (type == CONNECT) {
+ emit connected();
+
+ } else if (type == INTERRUPT) {
+ emit interruptRequested();
+
+ } else if (type == V8MESSAGE) {
+ QString jsonString(response);
+ QVariantMap value = parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+ QString type = value.value("type").toString();
+
+ if (type == "response") {
+
+ if (!value.value("success").toBool()) {
+// qDebug() << "Error: The test case will fail since no signal is emitted";
+ return;
+ }
+
+ QString debugCommand(value.value("command").toString());
+ if (debugCommand == "backtrace" ||
+ debugCommand == "lookup" ||
+ debugCommand == "setbreakpoint" ||
+ debugCommand == "evaluate" ||
+ debugCommand == "listbreakpoints" ||
+ debugCommand == "version" ||
+ debugCommand == "v8flags" ||
+ debugCommand == "disconnect" ||
+ debugCommand == "gc" ||
+ debugCommand == "changebreakpoint" ||
+ debugCommand == "clearbreakpoint" ||
+ debugCommand == "frame" ||
+ debugCommand == "scope" ||
+ debugCommand == "scopes" ||
+ debugCommand == "scripts" ||
+ debugCommand == "source" ||
+ debugCommand == "setexceptionbreak" /*||
+ debugCommand == "profile"*/) {
+ emit result();
+
+ } else {
+ // DO NOTHING
+ }
+ //Emit separate signals for scripts ane evaluate
+ //as the associated test cases are flaky
+ if (debugCommand == "scripts")
+ emit scriptsResult();
+ if (debugCommand == "evaluate")
+ emit evaluateResult();
+
+ } else if (type == QLatin1String(EVENT)) {
+ QString event(value.value(QLatin1String(EVENT)).toString());
+
+ if (event == "break" ||
+ event == "exception")
+ emit stopped();
+ }
+
+ }
+ }
+}
+
+void QJSDebugClient::sendMessage(const QByteArray &msg)
+{
+ if (state() == Enabled) {
+ QQmlDebugClient::sendMessage(msg);
+ } else {
+ sendBuffer.append(msg);
+ }
+}
+
+void QJSDebugClient::flushSendBuffer()
+{
+ foreach (const QByteArray &msg, sendBuffer)
+ QQmlDebugClient::sendMessage(msg);
+ sendBuffer.clear();
+}
+
+QByteArray QJSDebugClient::packMessage(const QByteArray &type, const QByteArray &message)
+{
+ QByteArray reply;
+ QDataStream rs(&reply, QIODevice::WriteOnly);
+ QByteArray cmd = "V8DEBUG";
+ rs << cmd << type << message;
+ return reply;
+}
+
+void tst_QQmlDebugJS::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ t.start();
+ process = 0;
+ client = 0;
+ connection = 0;
+}
+
+void tst_QQmlDebugJS::cleanupTestCase()
+{
+ if (process) {
+ process->stop();
+ delete process;
+ }
+
+ if (client)
+ delete client;
+
+ if (connection)
+ delete connection;
+
+// qDebug() << "Time Elapsed:" << t.elapsed();
+}
+
+bool tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode)
+{
+ connection = new QQmlDebugConnection();
+ process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+ client = new QJSDebugClient(connection);
+
+ if (blockMode)
+ process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(qmlFile));
+ else
+ process->start(QStringList() << QLatin1String(NORMALMODE) << testFile(qmlFile));
+
+ if (!process->waitForSessionStart()) {
+ qDebug() << "could not launch application, or did not get 'Waiting for connection'.";
+ return false;
+ }
+
+ const int port = process->debugPort();
+ connection->connectToHost("127.0.0.1", port);
+ if (!connection->waitForConnected()) {
+ qDebug() << "could not connect to host!";
+ return false;
+ }
+
+ if (client->state() == QQmlDebugClient::Enabled)
+ return true;
+
+ return QQmlDebugTest::waitForSignal(client, SIGNAL(enabled()));
+}
+
+void tst_QQmlDebugJS::cleanup()
+{
+ if (QTest::currentTestFailed()) {
+ qDebug() << "Process State:" << process->state();
+ qDebug() << "Application Output:" << process->output();
+ }
+
+ if (process) {
+ process->stop();
+ delete process;
+ }
+
+ if (client)
+ delete client;
+
+ if (connection)
+ delete connection;
+
+ process = 0;
+ client = 0;
+ connection = 0;
+}
+
+void tst_QQmlDebugJS::connect()
+{
+ //void connect()
+
+ QVERIFY(init());
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
+}
+
+void tst_QQmlDebugJS::interrupt()
+{
+ //void connect()
+
+ QVERIFY(init());
+ client->connect();
+
+ client->interrupt();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(interruptRequested())));
+}
+
+void tst_QQmlDebugJS::getVersion()
+{
+ //void version()
+
+ QVERIFY(init());
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(connected())));
+
+ client->version();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+/* TODO fails because of a race condition when starting up the engine before the view
+void tst_QQmlDebugJS::getVersionWhenAttaching()
+{
+ //void version()
+
+ QVERIFY(init(QLatin1String(TIMER_QMLFILE), false));
+ client->connect();
+
+ client->version();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+*/
+
+void tst_QQmlDebugJS::applyV8Flags()
+{
+ //void v8flags(QString flags)
+
+ QVERIFY(init());
+ client->connect();
+
+ client->v8flags(QString());
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+void tst_QQmlDebugJS::disconnect()
+{
+ //void disconnect()
+
+ QVERIFY(init());
+ client->connect();
+
+ client->disconnect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+void tst_QQmlDebugJS::gc()
+{
+ //void gc()
+
+ QVERIFY(init());
+ client->connect();
+
+ client->gc();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+void tst_QQmlDebugJS::listBreakpoints()
+{
+ //void listBreakpoints()
+
+ int sourceLine1 = 53;
+ int sourceLine2 = 54;
+ int sourceLine3 = 55;
+
+ QVERIFY(init());
+ client->connect();
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_QMLFILE), sourceLine1, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_QMLFILE), sourceLine2, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_QMLFILE), sourceLine3, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+ client->listBreakpoints();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QList<QVariant> breakpoints = value.value("body").toMap().value("breakpoints").toList();
+
+ QCOMPARE(breakpoints.count(), 3);
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptOnCompleted()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine = 47;
+ QVERIFY(init(ONCOMPLETED_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(ONCOMPLETED_QMLFILE));
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptOnComponentCreated()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine = 47;
+ QVERIFY(init(CREATECOMPONENT_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(ONCOMPLETED_QMLFILE));
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptOnTimerCallback()
+{
+ int sourceLine = 48;
+ QVERIFY(init(TIMER_QMLFILE));
+
+ client->connect();
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TIMER_QMLFILE), sourceLine, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(TIMER_QMLFILE));
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptInDifferentFile()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine = 43;
+ QVERIFY(init(LOADJSFILE_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TEST_JSFILE), sourceLine, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(TEST_JSFILE));
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptOnComment()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine = 47;
+ int actualLine = 49;
+ QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
+ QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()), 1));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), actualLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(BREAKPOINTRELOCATION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine = 48;
+ int actualLine = 49;
+ QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
+ QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()), 1));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), actualLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(BREAKPOINTRELOCATION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine = 52;
+ QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(BREAKPOINTRELOCATION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int out = 10;
+ int sourceLine = 50;
+ QVERIFY(init(CONDITION_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CONDITION_QMLFILE), sourceLine, 1, true, QLatin1String("a > 10"));
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ //Get the frame index
+ QString jsonString = client->response;
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ int frameIndex = body.value("index").toInt();
+
+ //Verify the value of 'result'
+ client->evaluate(QLatin1String("a"),frameIndex);
+
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+
+ jsonString = client->response;
+ value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ body = value.value("body").toMap();
+
+ QVERIFY(body.value("value").toInt() > out);
+}
+
+/* TODO fails because of a race condition when starting up the engine before the view
+void tst_QQmlDebugJS::setBreakpointWhenAttaching()
+{
+ int sourceLine = 49;
+ QVERIFY(init(QLatin1String(TIMER_QMLFILE), false));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(TIMER_QMLFILE), sourceLine);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+}
+*/
+
+//void tst_QQmlDebugJS::setBreakpointInFunction()
+//{
+// //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+// int actualLine = 31;
+
+// client->connect();
+// client->setBreakpoint(QLatin1String(FUNCTION), QLatin1String("doSomethingElse"), -1, -1, true);
+
+// QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+// QString jsonString(client->response);
+// QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+// QVariantMap body = value.value("body").toMap();
+
+// QCOMPARE(body.value("sourceLine").toInt(), actualLine);
+// QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(QMLFILE));
+//}
+
+void tst_QQmlDebugJS::setBreakpointOnEvent()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ QVERIFY(init(TIMER_QMLFILE));
+
+ client->connect();
+
+ client->setBreakpoint(QLatin1String(EVENT), QLatin1String("triggered"), -1, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(TIMER_QMLFILE));
+}
+
+
+void tst_QQmlDebugJS::changeBreakpoint()
+{
+ //void changeBreakpoint(int breakpoint, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine1 = 50;
+ int sourceLine2 = 51;
+ QVERIFY(init(CHANGEBREAKPOINT_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true);
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true);
+
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ //Will hit 1st brakpoint, change this breakpoint enable = false
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+ QList<QVariant> breakpointsHit = body.value("breakpoints").toList();
+
+ int breakpoint = breakpointsHit.at(0).toInt();
+ client->changeBreakpoint(breakpoint,false);
+
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+
+ //Continue with debugging
+ client->continueDebugging(QJSDebugClient::Continue);
+ //Hit 2nd breakpoint
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ //Continue with debugging
+ client->continueDebugging(QJSDebugClient::Continue);
+ //Should stop at 2nd breakpoint
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ jsonString = client->response;
+ value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine2);
+}
+
+void tst_QQmlDebugJS::changeBreakpointOnCondition()
+{
+ //void changeBreakpoint(int breakpoint, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine1 = 50;
+ int sourceLine2 = 51;
+
+ QVERIFY(init(CHANGEBREAKPOINT_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true);
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true);
+
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ //Will hit 1st brakpoint, change this breakpoint enable = false
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+ QList<QVariant> breakpointsHit = body.value("breakpoints").toList();
+
+ int breakpoint = breakpointsHit.at(0).toInt();
+ client->changeBreakpoint(breakpoint, false, QLatin1String("d == 0"));
+
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+
+ //Continue with debugging
+ client->continueDebugging(QJSDebugClient::Continue);
+ //Hit 2nd breakpoint
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ //Continue with debugging
+ client->continueDebugging(QJSDebugClient::Continue);
+ //Should stop at 2nd breakpoint
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ jsonString = client->response;
+ value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine2);
+
+}
+
+void tst_QQmlDebugJS::clearBreakpoint()
+{
+ //void clearBreakpoint(int breakpoint);
+
+ int sourceLine1 = 50;
+ int sourceLine2 = 51;
+ QVERIFY(init(CHANGEBREAKPOINT_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine1, -1, true);
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(CHANGEBREAKPOINT_QMLFILE), sourceLine2, -1, true);
+
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ //Will hit 1st brakpoint, change this breakpoint enable = false
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+ QList<QVariant> breakpointsHit = body.value("breakpoints").toList();
+
+ int breakpoint = breakpointsHit.at(0).toInt();
+ client->clearBreakpoint(breakpoint);
+
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+
+ //Continue with debugging
+ client->continueDebugging(QJSDebugClient::Continue);
+ //Hit 2nd breakpoint
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ //Continue with debugging
+ client->continueDebugging(QJSDebugClient::Continue);
+ //Should stop at 2nd breakpoint
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ jsonString = client->response;
+ value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine2);
+}
+
+void tst_QQmlDebugJS::setExceptionBreak()
+{
+ //void setExceptionBreak(QString type, bool enabled = false);
+
+ QVERIFY(init(EXCEPTION_QMLFILE));
+ client->setExceptionBreak(QJSDebugClient::All,true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+}
+
+void tst_QQmlDebugJS::stepNext()
+{
+ //void continueDebugging(StepAction stepAction, int stepCount = 1);
+
+ int sourceLine = 50;
+ QVERIFY(init(STEPACTION_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->continueDebugging(QJSDebugClient::Next);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine + 1);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(STEPACTION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::stepNextWithCount()
+{
+ //void continueDebugging(StepAction stepAction, int stepCount = 1);
+
+ int sourceLine = 50;
+ QVERIFY(init(STEPACTION_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->continueDebugging(QJSDebugClient::Next, 2);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine + 2);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(STEPACTION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::stepIn()
+{
+ //void continueDebugging(StepAction stepAction, int stepCount = 1);
+
+ int sourceLine = 54;
+ int actualLine = 50;
+ QVERIFY(init(STEPACTION_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, 1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->continueDebugging(QJSDebugClient::In);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), actualLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(STEPACTION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::stepOut()
+{
+ //void continueDebugging(StepAction stepAction, int stepCount = 1);
+
+ int sourceLine = 50;
+ int actualLine = 54;
+ QVERIFY(init(STEPACTION_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->continueDebugging(QJSDebugClient::Out);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), actualLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(STEPACTION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::continueDebugging()
+{
+ //void continueDebugging(StepAction stepAction, int stepCount = 1);
+
+ int sourceLine1 = 54;
+ int sourceLine2 = 51;
+ QVERIFY(init(STEPACTION_QMLFILE));
+
+ client->connect();
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine1, -1, true);
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(STEPACTION_QMLFILE), sourceLine2, -1, true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->continueDebugging(QJSDebugClient::Continue);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine2);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(STEPACTION_QMLFILE));
+}
+
+void tst_QQmlDebugJS::backtrace()
+{
+ //void backtrace(int fromFrame = -1, int toFrame = -1, bool bottom = false);
+
+ int sourceLine = 47;
+ QVERIFY(init(ONCOMPLETED_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->backtrace();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+void tst_QQmlDebugJS::getFrameDetails()
+{
+ //void frame(int number = -1);
+
+ int sourceLine = 47;
+ QVERIFY(init(ONCOMPLETED_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->frame();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+void tst_QQmlDebugJS::getScopeDetails()
+{
+ //void scope(int number = -1, int frameNumber = -1);
+
+ int sourceLine = 47;
+ QVERIFY(init(ONCOMPLETED_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->scope();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+void tst_QQmlDebugJS::evaluateInGlobalScope()
+{
+ //void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
+
+ QVERIFY(init());
+
+ client->connect();
+ client->evaluate(QLatin1String("console.log('Hello World')"), true);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));
+
+ //Verify the value of 'print'
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("text").toString(),QLatin1String("undefined"));
+}
+
+void tst_QQmlDebugJS::evaluateInLocalScope()
+{
+ //void evaluate(QString expr, bool global = false, bool disableBreak = false, int frame = -1, const QVariantMap &addContext = QVariantMap());
+
+ int sourceLine = 47;
+ QVERIFY(init(ONCOMPLETED_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->frame();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+
+ //Get the frame index
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ int frameIndex = body.value("index").toInt();
+
+ client->evaluate(QLatin1String("root.a"), frameIndex);
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(evaluateResult())));
+
+ //Verify the value of 'timer.interval'
+ jsonString = client->response;
+ value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ body = value.value("body").toMap();
+
+ QCOMPARE(body.value("value").toInt(),10);
+}
+
+void tst_QQmlDebugJS::getScopes()
+{
+ //void scopes(int frameNumber = -1);
+
+ int sourceLine = 47;
+ QVERIFY(init(ONCOMPLETED_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->scopes();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+void tst_QQmlDebugJS::getScripts()
+{
+ //void scripts(int types = -1, QList<int> ids = QList<int>(), bool includeSource = false, QVariant filter = QVariant());
+
+ QVERIFY(init());
+
+ client->connect();
+
+ client->scripts();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(scriptsResult())));
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList()
+ << QJSValue(jsonString)).toVariant().toMap();
+
+ QList<QVariant> scripts = value.value("body").toList();
+
+ QCOMPARE(scripts.count(), 3);
+}
+
+void tst_QQmlDebugJS::getSource()
+{
+ //void source(int frame = -1, int fromLine = -1, int toLine = -1);
+
+ int sourceLine = 47;
+ QVERIFY(init(ONCOMPLETED_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(ONCOMPLETED_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ client->source();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(result())));
+}
+
+QTEST_MAIN(tst_QQmlDebugJS)
+
+#include "tst_qqmldebugjs.moc"
+
diff --git a/tests/auto/qml/debugger/qqmldebugservice/data/test.qml b/tests/auto/qml/debugger/qqmldebugservice/data/test.qml
new file mode 100644
index 0000000000..e019ba8b17
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugservice/data/test.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//DO NOT CHANGE
+
+Item {
+ Component.onCompleted: {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+ function foo() {
+ var a = [1, 2]
+ var b = {a: "hello", d: 1 }
+ var c
+ var d = 12
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
new file mode 100644
index 0000000000..5879506a58
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
@@ -0,0 +1,22 @@
+CONFIG += testcase
+TARGET = tst_qqmldebugservice
+macx:CONFIG -= app_bundle
+
+HEADERS += ../shared/qqmldebugtestservice.h
+
+SOURCES += tst_qqmldebugservice.cpp \
+ ../shared/qqmldebugtestservice.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/test.qml
+
+DEFINES += QT_QML_DEBUG_NO_WARNING
+
+QT += qml-private testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
new file mode 100644
index 0000000000..dd4dd003ec
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -0,0 +1,300 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QTimer>
+#include <QHostAddress>
+#include <QDebug>
+#include <QThread>
+#include <QLibraryInfo>
+
+#include <QtQml/qqmlengine.h>
+
+#include "../../../shared/util.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
+#include "qqmldebugtestservice.h"
+
+#define PORT 3769
+#define STR_PORT "3769"
+
+class tst_QQmlDebugService : public QQmlDataTest
+{
+ Q_OBJECT
+private:
+ QQmlDebugConnection *m_conn;
+
+
+private slots:
+
+ void initTestCase();
+ void checkPortRange();
+ void name();
+ void version();
+ void state();
+ void sendMessage();
+ void idForObject();
+ void objectForId();
+ void objectToString();
+ void checkSupportForDataStreamVersion();
+ void checkSupportForOldDataStreamVersion();
+};
+
+void tst_QQmlDebugService::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT);
+ QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData());
+ new QQmlEngine(this);
+
+ m_conn = new QQmlDebugConnection(this);
+
+ for (int i = 0; i < 50; ++i) {
+ // try for 5 seconds ...
+ m_conn->connectToHost("127.0.0.1", PORT);
+ if (m_conn->waitForConnected())
+ break;
+ QTest::qSleep(100);
+ }
+ QVERIFY(m_conn->isConnected());
+
+ QTRY_VERIFY(QQmlDebugService::hasDebuggingClient());
+}
+
+void tst_QQmlDebugService::checkPortRange()
+{
+ QQmlDebugConnection *connection1 = new QQmlDebugConnection();
+ QQmlDebugProcess *process1 = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+
+ process1->start(QStringList() << QLatin1String("-qmljsdebugger=port:3772, 3774 ") << testFile("test.qml"));
+
+ if (!process1->waitForSessionStart())
+ QFAIL("could not launch application, or did not get 'Waiting for connection'.");
+
+ const int port1 = process1->debugPort();
+ connection1->connectToHost("127.0.0.1", port1);
+ if (!connection1->waitForConnected())
+ QFAIL("could not connect to host!");
+
+ // Second instance
+ QQmlDebugConnection *connection2 = new QQmlDebugConnection();
+ QQmlDebugProcess *process2 = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+
+ process2->start(QStringList() << QLatin1String("-qmljsdebugger=port:3772,3774") << testFile("test.qml"));
+
+ if (!process2->waitForSessionStart())
+ QFAIL("could not launch application, or did not get 'Waiting for connection'.");
+
+ const int port2 = process2->debugPort();
+ connection2->connectToHost("127.0.0.1", port2);
+ if (!connection2->waitForConnected())
+ QFAIL("could not connect to host!");
+
+ delete connection1;
+ delete process1;
+ delete connection2;
+ delete process2;
+}
+
+void tst_QQmlDebugService::name()
+{
+ QString name = "tst_QQmlDebugService::name()";
+
+ QQmlDebugService service(name, 1);
+ QCOMPARE(service.name(), name);
+}
+
+void tst_QQmlDebugService::version()
+{
+ QString name = "tst_QQmlDebugService::name()";
+
+ QQmlDebugService service(name, 2);
+ QCOMPARE(service.version(), 2.0f);
+}
+
+void tst_QQmlDebugService::state()
+{
+ QQmlDebugTestService service("tst_QQmlDebugService::state()");
+ QCOMPARE(service.state(), QQmlDebugService::Unavailable);
+
+ {
+ QQmlDebugTestClient client("tst_QQmlDebugService::state()", m_conn);
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
+ QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+ }
+
+
+ QTRY_COMPARE(service.state(), QQmlDebugService::Unavailable);
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\" ");
+ QQmlDebugTestService duplicate("tst_QQmlDebugService::state()");
+ QCOMPARE(duplicate.state(), QQmlDebugService::NotConnected);
+}
+
+void tst_QQmlDebugService::sendMessage()
+{
+ QQmlDebugTestService service("tst_QQmlDebugService::sendMessage()");
+ QQmlDebugTestClient client("tst_QQmlDebugService::sendMessage()", m_conn);
+
+ QByteArray msg = "hello!";
+
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
+ QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+
+ client.sendMessage(msg);
+ QByteArray resp = client.waitForResponse();
+ QCOMPARE(resp, msg);
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\" ");
+ QQmlDebugTestService duplicate("tst_QQmlDebugService::sendMessage()");
+ duplicate.sendMessage("msg");
+}
+
+void tst_QQmlDebugService::checkSupportForDataStreamVersion()
+{
+ QQmlDebugTestService service("tst_QQmlDebugService::sendMessage2()");
+ QQmlDebugTestClient client("tst_QQmlDebugService::sendMessage2()", m_conn);
+
+ QByteArray msg = "hello!";
+
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
+ QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+
+ client.sendMessage(msg);
+ QByteArray resp = client.waitForResponse();
+ QCOMPARE(resp, msg);
+ QCOMPARE(m_conn->dataStreamVersion(), int(QDataStream::Qt_5_0));
+}
+
+void tst_QQmlDebugService::idForObject()
+{
+ QCOMPARE(QQmlDebugService::idForObject(0), -1);
+
+ QObject *objA = new QObject;
+
+ int idA = QQmlDebugService::idForObject(objA);
+ QVERIFY(idA >= 0);
+ QCOMPARE(QQmlDebugService::objectForId(idA), objA);
+
+ int idAA = QQmlDebugService::idForObject(objA);
+ QCOMPARE(idAA, idA);
+
+ QObject *objB = new QObject;
+ int idB = QQmlDebugService::idForObject(objB);
+ QVERIFY(idB != idA);
+ QCOMPARE(QQmlDebugService::objectForId(idB), objB);
+
+ delete objA;
+ delete objB;
+}
+
+void tst_QQmlDebugService::objectForId()
+{
+ QCOMPARE(QQmlDebugService::objectForId(-1), static_cast<QObject*>(0));
+ QCOMPARE(QQmlDebugService::objectForId(1), static_cast<QObject*>(0));
+
+ QObject *obj = new QObject;
+ int id = QQmlDebugService::idForObject(obj);
+ QCOMPARE(QQmlDebugService::objectForId(id), obj);
+
+ delete obj;
+ QCOMPARE(QQmlDebugService::objectForId(id), static_cast<QObject*>(0));
+}
+
+void tst_QQmlDebugService::objectToString()
+{
+ QCOMPARE(QQmlDebugService::objectToString(0), QString("NULL"));
+
+ QObject *obj = new QObject;
+ QCOMPARE(QQmlDebugService::objectToString(obj), QString("QObject: <unnamed>"));
+
+ obj->setObjectName("Hello");
+ QCOMPARE(QQmlDebugService::objectToString(obj), QString("QObject: Hello"));
+ delete obj;
+}
+
+void tst_QQmlDebugService::checkSupportForOldDataStreamVersion()
+{
+ //create a new connection;
+ delete m_conn;
+ m_conn = new QQmlDebugConnection(this);
+ m_conn->setDataStreamVersion(QDataStream::Qt_4_7);
+ for (int i = 0; i < 50; ++i) {
+ // try for 5 seconds ...
+ m_conn->connectToHost("127.0.0.1", PORT);
+ if (m_conn->waitForConnected())
+ break;
+ QTest::qSleep(100);
+ }
+ QVERIFY(m_conn->isConnected());
+
+ QTRY_VERIFY(QQmlDebugService::hasDebuggingClient());
+ QQmlDebugTestService service("tst_QQmlDebugService::sendMessage2()");
+ QQmlDebugTestClient client("tst_QQmlDebugService::sendMessage2()", m_conn);
+
+ QByteArray msg = "hello!";
+
+ QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled);
+ QTRY_COMPARE(service.state(), QQmlDebugService::Enabled);
+
+ client.sendMessage(msg);
+ QByteArray resp = client.waitForResponse();
+ QCOMPARE(resp, msg);
+ QCOMPARE(m_conn->dataStreamVersion(), int(QDataStream::Qt_4_7));
+}
+
+
+int main(int argc, char *argv[])
+{
+ int _argc = argc + 1;
+ char **_argv = new char*[_argc];
+ for (int i = 0; i < argc; ++i)
+ _argv[i] = argv[i];
+ char arg[] = "-qmljsdebugger=port:" STR_PORT ",host:127.0.0.1";
+ _argv[_argc - 1] = arg;
+
+ QGuiApplication app(_argc, _argv);
+ tst_QQmlDebugService tc;
+ return QTest::qExec(&tc, _argc, _argv);
+ delete _argv;
+}
+
+#include "tst_qqmldebugservice.moc"
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml
new file mode 100644
index 0000000000..9c36e13c5b
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/data/qtquick2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
new file mode 100644
index 0000000000..9da6bda28e
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qqmlenginedebuginspectorintegration
+
+QT += qml testlib gui-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlenginedebuginspectorintegration.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/qqmlinspectorclient.pri)
+include(../shared/qqmlenginedebugclient.pri)
+include(../shared/debugutil.pri)
+
+TESTDATA = data/*
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
new file mode 100644
index 0000000000..6f99afd917
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QTimer>
+#include <QHostAddress>
+#include <QDebug>
+#include <QThread>
+#include <QtCore/QLibraryInfo>
+
+#include "../shared/debugutil_p.h"
+#include "../../../shared/util.h"
+#include "qqmlinspectorclient.h"
+#include "qqmlenginedebugclient.h"
+
+#define PORT 3776
+#define STR_PORT "3776"
+
+class tst_QQmlEngineDebugInspectorIntegration : public QQmlDataTest
+{
+ Q_OBJECT
+
+public:
+ tst_QQmlEngineDebugInspectorIntegration()
+ : m_process(0)
+ , m_connection(0)
+ , m_inspectorClient(0)
+ , m_engineDebugClient(0)
+ {
+ }
+
+
+private:
+ QmlDebugObjectReference findRootObject();
+
+ QQmlDebugProcess *m_process;
+ QQmlDebugConnection *m_connection;
+ QQmlInspectorClient *m_inspectorClient;
+ QQmlEngineDebugClient *m_engineDebugClient;
+
+private slots:
+ void init();
+ void cleanup();
+
+ void connect();
+ void clearObjectReferenceHashonReloadQml();
+};
+
+
+QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject()
+{
+ bool success = false;
+ m_engineDebugClient->queryAvailableEngines(&success);
+
+ QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()));
+
+ m_engineDebugClient->queryRootContexts(m_engineDebugClient->engines()[0].debugId, &success);
+ QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()));
+ int count = m_engineDebugClient->rootContext().contexts.count();
+ m_engineDebugClient->queryObject(
+ m_engineDebugClient->rootContext().contexts[count - 1].objects[0], &success);
+ QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()));
+ return m_engineDebugClient->object();
+}
+
+
+void tst_QQmlEngineDebugInspectorIntegration::init()
+{
+ const QString argument = "-qmljsdebugger=port:" STR_PORT ",block";
+
+ m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
+ + "/qmlscene", this);
+ m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
+ QVERIFY2(m_process->waitForSessionStart(),
+ "Could not launch application, or did not get 'Waiting for connection'.");
+
+ QQmlDebugConnection *m_connection = new QQmlDebugConnection(this);
+ m_inspectorClient = new QQmlInspectorClient(m_connection);
+ m_engineDebugClient = new QQmlEngineDebugClient(m_connection);
+
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), PORT);
+ bool ok = m_connection->waitForConnected();
+ QVERIFY(ok);
+}
+
+void tst_QQmlEngineDebugInspectorIntegration::cleanup()
+{
+ if (QTest::currentTestFailed()) {
+ qDebug() << "Process State:" << m_process->state();
+ qDebug() << "Application Output:" << m_process->output();
+ }
+ delete m_process;
+ delete m_engineDebugClient;
+ delete m_inspectorClient;
+}
+
+void tst_QQmlEngineDebugInspectorIntegration::connect()
+{
+ QTRY_COMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
+ QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
+}
+
+void tst_QQmlEngineDebugInspectorIntegration::clearObjectReferenceHashonReloadQml()
+{
+ QTRY_COMPARE(m_engineDebugClient->state(), QQmlDebugClient::Enabled);
+ bool success = false;
+ QmlDebugObjectReference rootObject = findRootObject();
+ const QString fileName = QFileInfo(rootObject.source.url.toString()).fileName();
+ int lineNumber = rootObject.source.lineNumber;
+ int columnNumber = rootObject.source.columnNumber;
+ m_engineDebugClient->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
+
+ foreach (QmlDebugObjectReference child, rootObject.children) {
+ success = false;
+ lineNumber = child.source.lineNumber;
+ columnNumber = child.source.columnNumber;
+ m_engineDebugClient->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
+ }
+
+ QTRY_COMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled);
+
+ QByteArray contents;
+ contents.append("import QtQuick 2.0\n"
+ "Text {"
+ "y: 10\n"
+ "text: \"test\"\n"
+ "}");
+
+ QHash<QString, QByteArray> changesHash;
+ changesHash.insert("test.qml", contents);
+ m_inspectorClient->reloadQml(changesHash);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_inspectorClient, SIGNAL(responseReceived())));
+
+ lineNumber = rootObject.source.lineNumber;
+ columnNumber = rootObject.source.columnNumber;
+ success = false;
+ m_engineDebugClient->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
+
+ foreach (QmlDebugObjectReference child, rootObject.children) {
+ success = false;
+ lineNumber = child.source.lineNumber;
+ columnNumber = child.source.columnNumber;
+ m_engineDebugClient->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result())));
+ }
+}
+
+QTEST_MAIN(tst_QQmlEngineDebugInspectorIntegration)
+
+#include "tst_qqmlenginedebuginspectorintegration.moc"
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
new file mode 100644
index 0000000000..305f8f2509
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qqmlenginedebugservice
+macx:CONFIG -= app_bundle
+
+SOURCES += \
+ tst_qqmlenginedebugservice.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/qqmlenginedebugclient.pri)
+include(../shared/debugutil.pri)
+
+DEFINES += QT_QML_DEBUG_NO_WARNING
+
+QT += core-private qml-private quick-private v8-private testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
new file mode 100644
index 0000000000..421d4f0795
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -0,0 +1,1204 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QTimer>
+#include <QHostAddress>
+#include <QDebug>
+#include <QThread>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlproperty.h>
+#include <QtQuick/qquickitem.h>
+
+#include <private/qqmlbinding_p.h>
+#include <private/qqmlboundsignal_p.h>
+#include <private/qqmldebugservice_p.h>
+#include <private/qqmlmetatype_p.h>
+#include <private/qqmlproperty_p.h>
+
+#include "debugutil_p.h"
+#include "qqmlenginedebugclient.h"
+
+#include "../../../shared/util.h"
+
+#define QVERIFYOBJECT(statement) \
+ do {\
+ if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) {\
+ return QmlDebugObjectReference();\
+ }\
+ } while (0)
+
+class NonScriptProperty : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(int nonScriptProp READ nonScriptProp WRITE setNonScriptProp NOTIFY nonScriptPropChanged SCRIPTABLE false)
+public:
+ int nonScriptProp() const { return 0; }
+ void setNonScriptProp(int) {}
+signals:
+ void nonScriptPropChanged();
+};
+QML_DECLARE_TYPE(NonScriptProperty)
+
+class tst_QQmlEngineDebugService : public QObject
+{
+ Q_OBJECT
+
+private:
+ QmlDebugObjectReference findRootObject(int context = 0,
+ bool recursive = false);
+ QmlDebugPropertyReference findProperty(
+ const QList<QmlDebugPropertyReference> &props,
+ const QString &name) const;
+
+ void recursiveObjectTest(QObject *o,
+ const QmlDebugObjectReference &oref,
+ bool recursive) const;
+
+ QQmlDebugConnection *m_conn;
+ QQmlEngineDebugClient *m_dbg;
+ QQmlEngine *m_engine;
+ QQuickItem *m_rootItem;
+
+ QObjectList m_components;
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void watch_property();
+ void watch_object();
+ void watch_expression();
+ void watch_expression_data();
+ void watch_context();
+ void watch_file();
+
+ void queryAvailableEngines();
+ void queryRootContexts();
+ void queryObject();
+ void queryObject_data();
+ void queryObjectsForLocation();
+ void queryObjectsForLocation_data();
+ void queryExpressionResult();
+ void queryExpressionResult_data();
+ void queryExpressionResultInRootContext();
+ void queryExpressionResultBC();
+ void queryExpressionResultBC_data();
+
+ void setBindingForObject();
+ void resetBindingForObject();
+ void setMethodBody();
+ void queryObjectTree();
+ void setBindingInStates();
+
+ void regression_QTCREATORBUG_7451();
+};
+
+QmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(
+ int context, bool recursive)
+{
+ bool success = false;
+ m_dbg->queryAvailableEngines(&success);
+ QVERIFYOBJECT(success);
+ QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QVERIFYOBJECT(m_dbg->engines().count());
+ m_dbg->queryRootContexts(m_dbg->engines()[0].debugId, &success);
+ QVERIFYOBJECT(success);
+ QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QVERIFYOBJECT(m_dbg->rootContext().contexts.count());
+ QVERIFYOBJECT(m_dbg->rootContext().contexts.last().objects.count());
+ int count = m_dbg->rootContext().contexts.count();
+ recursive ? m_dbg->queryObjectRecursive(m_dbg->rootContext().contexts[count - context - 1].objects[0],
+ &success) :
+ m_dbg->queryObject(m_dbg->rootContext().contexts[count - context - 1].objects[0], &success);
+ QVERIFYOBJECT(success);
+ QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ return m_dbg->object();
+}
+
+QmlDebugPropertyReference tst_QQmlEngineDebugService::findProperty(
+ const QList<QmlDebugPropertyReference> &props, const QString &name) const
+{
+ foreach (const QmlDebugPropertyReference &p, props) {
+ if (p.name == name)
+ return p;
+ }
+ return QmlDebugPropertyReference();
+}
+
+void tst_QQmlEngineDebugService::recursiveObjectTest(
+ QObject *o, const QmlDebugObjectReference &oref, bool recursive) const
+{
+ const QMetaObject *meta = o->metaObject();
+
+ QQmlType *type = QQmlMetaType::qmlType(meta);
+ QString className = type ? QString(type->qmlTypeName())
+ : QString(meta->className());
+ className = className.mid(className.lastIndexOf(QLatin1Char('/'))+1);
+
+ QCOMPARE(oref.debugId, QQmlDebugService::idForObject(o));
+ QCOMPARE(oref.name, o->objectName());
+ QCOMPARE(oref.className, className);
+ QCOMPARE(oref.contextDebugId, QQmlDebugService::idForObject(
+ qmlContext(o)));
+
+ const QObjectList &children = o->children();
+ for (int i=0; i<children.count(); i++) {
+ QObject *child = children[i];
+ if (!qmlContext(child))
+ continue;
+ int debugId = QQmlDebugService::idForObject(child);
+ QVERIFY(debugId >= 0);
+
+ QmlDebugObjectReference cref;
+ foreach (const QmlDebugObjectReference &ref, oref.children) {
+ if (ref.debugId == debugId) {
+ cref = ref;
+ break;
+ }
+ }
+ QVERIFY(cref.debugId >= 0);
+
+ if (recursive)
+ recursiveObjectTest(child, cref, true);
+ }
+
+ foreach (const QmlDebugPropertyReference &p, oref.properties) {
+ QCOMPARE(p.objectDebugId, QQmlDebugService::idForObject(o));
+
+ // signal properties are fake - they are generated from QQmlAbstractBoundSignal children
+ if (p.name.startsWith("on") && p.name.length() > 2 && p.name[2].isUpper()) {
+ QString signal = p.value.toString();
+ QQmlBoundSignalExpression *expr = QQmlPropertyPrivate::signalExpression(QQmlProperty(o, p.name));
+ QVERIFY(expr && expr->expression() == signal);
+ QVERIFY(p.valueTypeName.isEmpty());
+ QVERIFY(p.binding.isEmpty());
+ QVERIFY(!p.hasNotifySignal);
+ continue;
+ }
+
+ QMetaProperty pmeta = meta->property(meta->indexOfProperty(p.name.toUtf8().constData()));
+
+ QCOMPARE(p.name, QString::fromUtf8(pmeta.name()));
+
+ if (pmeta.type() < QVariant::UserType && pmeta.userType() !=
+ QMetaType::QVariant) // TODO test complex types
+ QCOMPARE(p.value , pmeta.read(o));
+
+ if (p.name == "parent")
+ QVERIFY(p.valueTypeName == "QGraphicsObject*" ||
+ p.valueTypeName == "QQuickItem*");
+ else
+ QCOMPARE(p.valueTypeName, QString::fromUtf8(pmeta.typeName()));
+
+ QQmlAbstractBinding *binding =
+ QQmlPropertyPrivate::binding(
+ QQmlProperty(o, p.name));
+ if (binding)
+ QCOMPARE(binding->expression(), p.binding);
+
+ QCOMPARE(p.hasNotifySignal, pmeta.hasNotifySignal());
+
+ QVERIFY(pmeta.isValid());
+ }
+}
+
+void tst_QQmlEngineDebugService::initTestCase()
+{
+ qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement");
+
+ QTest::ignoreMessage(QtDebugMsg, "QML Debugger: Waiting for connection on port 3768...");
+ m_engine = new QQmlEngine(this);
+
+ QList<QByteArray> qml;
+ qml << "import QtQuick 2.0\n"
+ "import Test 1.0\n"
+ "Item {"
+ "id: root\n"
+ "width: 10; height: 20; scale: blueRect.scale;"
+ "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
+ "Text { font.bold: true; color: blueRect.color; }"
+ "MouseArea {"
+ "onEntered: { console.log('hello') }"
+ "}"
+ "property variant varObj\n"
+ "property variant varObjList: []\n"
+ "property variant varObjMap\n"
+ "property variant simpleVar: 10.05\n"
+ "Component.onCompleted: {\n"
+ "varObj = blueRect;\n"
+ "var list = varObjList;\n"
+ "list[0] = blueRect;\n"
+ "varObjList = list;\n"
+ "var map = new Object;\n"
+ "map.rect = blueRect;\n"
+ "varObjMap = map;\n"
+ "}\n"
+ "NonScriptPropertyElement {\n"
+ "}\n"
+ "}";
+
+ // add second component to test multiple root contexts
+ qml << "import QtQuick 2.0\n"
+ "Item {}";
+
+ // and a third to test methods
+ qml << "import QtQuick 2.0\n"
+ "Item {"
+ "function myMethodNoArgs() { return 3; }\n"
+ "function myMethod(a) { return a + 9; }\n"
+ "function myMethodIndirect() { myMethod(3); }\n"
+ "}";
+
+ // and a fourth to test states
+ qml << "import QtQuick 2.0\n"
+ "Rectangle {\n"
+ "id:rootRect\n"
+ "width:100\n"
+ "states: [\n"
+ "State {\n"
+ "name:\"state1\"\n"
+ "PropertyChanges {\n"
+ "target:rootRect\n"
+ "width:200\n"
+ "}\n"
+ "}\n"
+ "]\n"
+ "transitions: [\n"
+ "Transition {\n"
+ "from:\"*\"\n"
+ "to:\"state1\"\n"
+ "PropertyAnimation {\n"
+ "target:rootRect\n"
+ "property:\"width\"\n"
+ "duration:100\n"
+ "}\n"
+ "}\n"
+ "]\n"
+ "}\n"
+ ;
+
+ for (int i=0; i<qml.count(); i++) {
+ QQmlComponent component(m_engine);
+ component.setData(qml[i], QUrl::fromLocalFile(""));
+ QVERIFY(component.isReady()); // fails if bad syntax
+ m_components << qobject_cast<QQuickItem*>(component.create());
+ }
+ m_rootItem = qobject_cast<QQuickItem*>(m_components.first());
+
+ // add an extra context to test for multiple contexts
+ QQmlContext *context = new QQmlContext(m_engine->rootContext(), this);
+ context->setObjectName("tst_QQmlDebug_childContext");
+
+ m_conn = new QQmlDebugConnection(this);
+ m_conn->connectToHost("127.0.0.1", 3768);
+
+ bool ok = m_conn->waitForConnected();
+ QVERIFY(ok);
+ QTRY_VERIFY(QQmlDebugService::hasDebuggingClient());
+ m_dbg = new QQmlEngineDebugClient(m_conn);
+ QTRY_VERIFY(m_dbg->state() == QQmlEngineDebugClient::Enabled);
+}
+
+void tst_QQmlEngineDebugService::cleanupTestCase()
+{
+ delete m_conn;
+ qDeleteAll(m_components);
+ delete m_engine;
+}
+
+void tst_QQmlEngineDebugService::setMethodBody()
+{
+ bool success;
+ QmlDebugObjectReference obj = findRootObject(2);
+
+ QObject *root = m_components.at(2);
+ // Without args
+ {
+ QVariant rv;
+ QVERIFY(QMetaObject::invokeMethod(root, "myMethodNoArgs", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, rv)));
+ QVERIFY(rv == QVariant(qreal(3)));
+
+
+ QVERIFY(m_dbg->setMethodBody(obj.debugId, "myMethodNoArgs", "return 7",
+ &success));
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "myMethodNoArgs", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, rv)));
+ QVERIFY(rv == QVariant(qreal(7)));
+ }
+
+ // With args
+ {
+ QVariant rv;
+ QVERIFY(QMetaObject::invokeMethod(root, "myMethod", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, rv), Q_ARG(QVariant, QVariant(19))));
+ QVERIFY(rv == QVariant(qreal(28)));
+
+ QVERIFY(m_dbg->setMethodBody(obj.debugId, "myMethod", "return a + 7",
+ &success));
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "myMethod", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, rv), Q_ARG(QVariant, QVariant(19))));
+ QVERIFY(rv == QVariant(qreal(26)));
+ }
+}
+
+void tst_QQmlEngineDebugService::watch_property()
+{
+ QmlDebugObjectReference obj = findRootObject();
+ QmlDebugPropertyReference prop = findProperty(obj.properties, "width");
+
+ bool success;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->addWatch(prop, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->addWatch(QmlDebugPropertyReference(), &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), false);
+
+ quint32 id = m_dbg->addWatch(prop, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ QSignalSpy spy(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant)));
+
+ int origWidth = m_rootItem->property("width").toInt();
+ m_rootItem->setProperty("width", origWidth*2);
+
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant))));
+ QCOMPARE(spy.count(), 1);
+
+ m_dbg->removeWatch(id, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ // restore original value and verify spy doesn't get additional signal since watch has been removed
+ m_rootItem->setProperty("width", origWidth);
+ QTest::qWait(100);
+ QCOMPARE(spy.count(), 1);
+
+ QCOMPARE(spy.at(0).at(0).value<QByteArray>(), prop.name.toUtf8());
+ QCOMPARE(spy.at(0).at(1).value<QVariant>(), qVariantFromValue(origWidth*2));
+}
+
+void tst_QQmlEngineDebugService::watch_object()
+{
+ QmlDebugObjectReference obj = findRootObject();
+
+ bool success;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->addWatch(obj, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->addWatch(QmlDebugObjectReference(), &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), false);
+
+ quint32 id = m_dbg->addWatch(obj, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ QSignalSpy spy(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant)));
+
+ int origWidth = m_rootItem->property("width").toInt();
+ int origHeight = m_rootItem->property("height").toInt();
+ m_rootItem->setProperty("width", origWidth*2);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant))));
+ m_rootItem->setProperty("height", origHeight*2);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant))));
+
+ QVERIFY(spy.count() > 0);
+
+ int newWidth = -1;
+ int newHeight = -1;
+ for (int i=0; i<spy.count(); i++) {
+ const QVariantList &values = spy[i];
+ if (values[0].value<QByteArray>() == "width")
+ newWidth = values[1].value<QVariant>().toInt();
+ else if (values[0].value<QByteArray>() == "height")
+ newHeight = values[1].value<QVariant>().toInt();
+
+ }
+
+ m_dbg->removeWatch(id, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ // since watch has been removed, restoring the original values should not trigger a valueChanged()
+ spy.clear();
+ m_rootItem->setProperty("width", origWidth);
+ m_rootItem->setProperty("height", origHeight);
+ QTest::qWait(100);
+ QCOMPARE(spy.count(), 0);
+
+ QCOMPARE(newWidth, origWidth * 2);
+ QCOMPARE(newHeight, origHeight * 2);
+}
+
+void tst_QQmlEngineDebugService::watch_expression()
+{
+ QFETCH(QString, expr);
+ QFETCH(int, increment);
+ QFETCH(int, incrementCount);
+
+ int origWidth = m_rootItem->property("width").toInt();
+
+ QmlDebugObjectReference obj = findRootObject();
+
+ bool success;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->addWatch(obj, expr, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->addWatch(QmlDebugObjectReference(), expr, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), false);
+
+ quint32 id = m_dbg->addWatch(obj, expr, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ QSignalSpy spy(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant)));
+
+ int width = origWidth;
+ for (int i=0; i<incrementCount+1; i++) {
+ if (i > 0) {
+ width += increment;
+ m_rootItem->setProperty("width", width);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant))));
+ }
+ }
+
+ m_dbg->removeWatch(id, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ // restore original value and verify spy doesn't get a signal since watch has been removed
+ m_rootItem->setProperty("width", origWidth);
+ QTest::qWait(100);
+ QCOMPARE(spy.count(), incrementCount);
+
+ width = origWidth + increment;
+ for (int i=0; i<spy.count(); i++) {
+ width += increment;
+ QCOMPARE(spy.at(i).at(1).value<QVariant>().toInt(), width);
+ }
+}
+
+void tst_QQmlEngineDebugService::watch_expression_data()
+{
+ QTest::addColumn<QString>("expr");
+ QTest::addColumn<int>("increment");
+ QTest::addColumn<int>("incrementCount");
+
+ QTest::newRow("width") << "width" << 0 << 0;
+ QTest::newRow("width+10") << "width + 10" << 10 << 5;
+}
+
+void tst_QQmlEngineDebugService::watch_context()
+{
+ QmlDebugContextReference c;
+ QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebugClient::addWatch(): Not implemented");
+ bool success;
+ m_dbg->addWatch(c, QString(), &success);
+ QVERIFY(!success);
+}
+
+void tst_QQmlEngineDebugService::watch_file()
+{
+ QmlDebugFileReference f;
+ QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebugClient::addWatch(): Not implemented");
+ bool success;
+ m_dbg->addWatch(f, &success);
+ QVERIFY(!success);
+}
+
+void tst_QQmlEngineDebugService::queryAvailableEngines()
+{
+ bool success;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->queryAvailableEngines(&success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->queryAvailableEngines(&success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ // TODO test multiple engines
+ QList<QmlDebugEngineReference> engines = m_dbg->engines();
+ QCOMPARE(engines.count(), 1);
+
+ foreach (const QmlDebugEngineReference &e, engines) {
+ QCOMPARE(e.debugId, QQmlDebugService::idForObject(m_engine));
+ QCOMPARE(e.name, m_engine->objectName());
+ }
+}
+
+void tst_QQmlEngineDebugService::queryRootContexts()
+{
+ bool success;
+ m_dbg->queryAvailableEngines(&success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QVERIFY(m_dbg->engines().count());
+ int engineId = m_dbg->engines()[0].debugId;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->queryRootContexts(engineId, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->queryRootContexts(engineId, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QQmlContext *actualContext = m_engine->rootContext();
+ QmlDebugContextReference context = m_dbg->rootContext();
+ QCOMPARE(context.debugId, QQmlDebugService::idForObject(actualContext));
+ QCOMPARE(context.name, actualContext->objectName());
+
+ // root context query sends only root object data - it doesn't fill in
+ // the children or property info
+ QCOMPARE(context.objects.count(), 0);
+ QCOMPARE(context.contexts.count(), 5);
+ QVERIFY(context.contexts[0].debugId >= 0);
+ QCOMPARE(context.contexts[0].name, QString("tst_QQmlDebug_childContext"));
+}
+
+void tst_QQmlEngineDebugService::queryObject()
+{
+ QFETCH(bool, recursive);
+
+ bool success;
+
+ QmlDebugObjectReference rootObject = findRootObject();
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ recursive ? unconnected->queryObjectRecursive(rootObject, &success) : unconnected->queryObject(rootObject, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ recursive ? m_dbg->queryObjectRecursive(rootObject, &success) : m_dbg->queryObject(rootObject, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QmlDebugObjectReference obj = m_dbg->object();
+
+ // check source as defined in main()
+ QmlDebugFileReference source = obj.source;
+ QCOMPARE(source.url, QUrl::fromLocalFile(""));
+ QCOMPARE(source.lineNumber, 3);
+ QCOMPARE(source.columnNumber, 1);
+
+ // generically test all properties, children and childrens' properties
+ recursiveObjectTest(m_rootItem, obj, recursive);
+
+ if (recursive) {
+ foreach (const QmlDebugObjectReference &child, obj.children)
+ QVERIFY(child.properties.count() > 0);
+
+ QmlDebugObjectReference rect;
+ QmlDebugObjectReference text;
+ foreach (const QmlDebugObjectReference &child, obj.children) {
+ if (child.className == "Rectangle")
+ rect = child;
+ else if (child.className == "Text")
+ text = child;
+ }
+
+ // test specific property values
+ QCOMPARE(findProperty(rect.properties, "width").value, qVariantFromValue(500));
+ QCOMPARE(findProperty(rect.properties, "height").value, qVariantFromValue(600));
+ QCOMPARE(findProperty(rect.properties, "color").value, qVariantFromValue(QColor("blue")));
+
+ QCOMPARE(findProperty(text.properties, "color").value, qVariantFromValue(QColor("blue")));
+ } else {
+ foreach (const QmlDebugObjectReference &child, obj.children)
+ QCOMPARE(child.properties.count(), 0);
+ }
+}
+
+void tst_QQmlEngineDebugService::queryObject_data()
+{
+ QTest::addColumn<bool>("recursive");
+
+ QTest::newRow("non-recursive") << false;
+ QTest::newRow("recursive") << true;
+}
+
+void tst_QQmlEngineDebugService::queryObjectsForLocation()
+{
+ QFETCH(bool, recursive);
+
+ bool success;
+
+ QmlDebugObjectReference rootObject = findRootObject();
+
+ const QString fileName = QFileInfo(rootObject.source.url.toString()).fileName();
+ int lineNumber = rootObject.source.lineNumber;
+ int columnNumber = rootObject.source.columnNumber;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ recursive ? unconnected->queryObjectsForLocationRecursive(fileName, lineNumber,
+ columnNumber, &success)
+ : unconnected->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ recursive ? m_dbg->queryObjectsForLocationRecursive(fileName, lineNumber,
+ columnNumber, &success)
+ : m_dbg->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QVERIFY(m_dbg->objects().count() == 1);
+ QmlDebugObjectReference obj = m_dbg->objects().first();
+
+ // check source as defined in main()
+ QmlDebugFileReference source = obj.source;
+ QCOMPARE(source.url, QUrl(fileName));
+ QCOMPARE(source.lineNumber, lineNumber);
+ QCOMPARE(source.columnNumber, columnNumber);
+
+ // generically test all properties, children and childrens' properties
+ recursiveObjectTest(m_rootItem, obj, recursive);
+
+ if (recursive) {
+ foreach (const QmlDebugObjectReference &child, obj.children)
+ QVERIFY(child.properties.count() > 0);
+
+ QmlDebugObjectReference rect;
+ QmlDebugObjectReference text;
+ foreach (const QmlDebugObjectReference &child, obj.children) {
+ if (child.className == "Rectangle")
+ rect = child;
+ else if (child.className == "Text")
+ text = child;
+ }
+
+ // test specific property values
+ QCOMPARE(findProperty(rect.properties, "width").value, qVariantFromValue(500));
+ QCOMPARE(findProperty(rect.properties, "height").value, qVariantFromValue(600));
+ QCOMPARE(findProperty(rect.properties, "color").value, qVariantFromValue(QColor("blue")));
+
+ QCOMPARE(findProperty(text.properties, "color").value, qVariantFromValue(QColor("blue")));
+ } else {
+ foreach (const QmlDebugObjectReference &child, obj.children)
+ QCOMPARE(child.properties.count(), 0);
+ }
+}
+
+void tst_QQmlEngineDebugService::queryObjectsForLocation_data()
+{
+ QTest::addColumn<bool>("recursive");
+
+ QTest::newRow("non-recursive") << false;
+ QTest::newRow("recursive") << true;
+}
+
+void tst_QQmlEngineDebugService::regression_QTCREATORBUG_7451()
+{
+ QmlDebugObjectReference rootObject = findRootObject();
+ int contextId = rootObject.contextDebugId;
+ QQmlContext *context = qobject_cast<QQmlContext *>(QQmlDebugService::objectForId(contextId));
+ QQmlComponent component(context->engine());
+ QByteArray content;
+ content.append("import QtQuick 2.0\n"
+ "Text {"
+ "y: 10\n"
+ "text: \"test\"\n"
+ "}");
+ component.setData(content, rootObject.source.url);
+ QObject *object = component.create(context);
+ QVERIFY(object);
+ int idNew = QQmlDebugService::idForObject(object);
+ QVERIFY(idNew >= 0);
+
+ const QString fileName = QFileInfo(rootObject.source.url.toString()).fileName();
+ int lineNumber = rootObject.source.lineNumber;
+ int columnNumber = rootObject.source.columnNumber;
+ bool success = false;
+
+ m_dbg->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ foreach (QmlDebugObjectReference child, rootObject.children) {
+ success = false;
+ lineNumber = child.source.lineNumber;
+ columnNumber = child.source.columnNumber;
+ m_dbg->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ }
+
+ delete object;
+ QObject *deleted = QQmlDebugService::objectForId(idNew);
+ QVERIFY(!deleted);
+
+ lineNumber = rootObject.source.lineNumber;
+ columnNumber = rootObject.source.columnNumber;
+ success = false;
+ m_dbg->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ foreach (QmlDebugObjectReference child, rootObject.children) {
+ success = false;
+ lineNumber = child.source.lineNumber;
+ columnNumber = child.source.columnNumber;
+ m_dbg->queryObjectsForLocation(fileName, lineNumber,
+ columnNumber, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ }
+}
+
+
+void tst_QQmlEngineDebugService::queryExpressionResult()
+{
+ QFETCH(QString, expr);
+ QFETCH(QVariant, result);
+
+ int objectId = findRootObject().debugId;
+
+ bool success;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->queryExpressionResult(objectId, expr, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->queryExpressionResult(objectId, expr, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QCOMPARE(m_dbg->resultExpr(), result);
+}
+
+void tst_QQmlEngineDebugService::queryExpressionResult_data()
+{
+ QTest::addColumn<QString>("expr");
+ QTest::addColumn<QVariant>("result");
+
+ QTest::newRow("width + 50") << "width + 50" << qVariantFromValue(60);
+ QTest::newRow("blueRect.width") << "blueRect.width" << qVariantFromValue(500);
+ QTest::newRow("bad expr") << "aeaef" << qVariantFromValue(QString("<undefined>"));
+ QTest::newRow("QObject*") << "varObj" << qVariantFromValue(QString("<unnamed object>"));
+ QTest::newRow("list of QObject*") << "varObjList" << qVariantFromValue(QVariantList() << QVariant(QString("<unnamed object>")));
+ QVariantMap map;
+ map.insert(QLatin1String("rect"), QVariant(QLatin1String("<unnamed object>")));
+ QTest::newRow("varObjMap") << "varObjMap" << qVariantFromValue(map);
+ QTest::newRow("simpleVar") << "simpleVar" << qVariantFromValue(10.05);
+}
+
+void tst_QQmlEngineDebugService::queryExpressionResultInRootContext()
+{
+ bool success;
+ const QString exp = QLatin1String("1");
+ m_dbg->queryExpressionResult(-1, exp, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QCOMPARE(m_dbg->resultExpr().toString(), exp);
+}
+
+void tst_QQmlEngineDebugService::queryExpressionResultBC()
+{
+ QFETCH(QString, expr);
+ QFETCH(QVariant, result);
+
+ int objectId = findRootObject().debugId;
+
+ bool success;
+
+ QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0);
+ unconnected->queryExpressionResultBC(objectId, expr, &success);
+ QVERIFY(!success);
+ delete unconnected;
+
+ m_dbg->queryExpressionResultBC(objectId, expr, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ QCOMPARE(m_dbg->resultExpr(), result);
+}
+
+void tst_QQmlEngineDebugService::queryExpressionResultBC_data()
+{
+ QTest::addColumn<QString>("expr");
+ QTest::addColumn<QVariant>("result");
+
+ QTest::newRow("width + 50") << "width + 50" << qVariantFromValue(60);
+ QTest::newRow("blueRect.width") << "blueRect.width" << qVariantFromValue(500);
+ QTest::newRow("bad expr") << "aeaef" << qVariantFromValue(QString("<undefined>"));
+ QTest::newRow("QObject*") << "varObj" << qVariantFromValue(QString("<unnamed object>"));
+ QTest::newRow("list of QObject*") << "varObjList" << qVariantFromValue(QVariantList() << QVariant(QString("<unnamed object>")));
+ QVariantMap map;
+ map.insert(QLatin1String("rect"), QVariant(QLatin1String("<unnamed object>")));
+ QTest::newRow("varObjMap") << "varObjMap" << qVariantFromValue(map);
+ QTest::newRow("simpleVar") << "simpleVar" << qVariantFromValue(10.05);
+}
+
+void tst_QQmlEngineDebugService::setBindingForObject()
+{
+ QmlDebugObjectReference rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QmlDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width");
+
+ QCOMPARE(widthPropertyRef.value, QVariant(10));
+ QCOMPARE(widthPropertyRef.binding, QString());
+
+ bool success;
+ //
+ // set literal
+ //
+ m_dbg->setBindingForObject(rootObject.debugId, "width", "15", true,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ rootObject = findRootObject();
+ widthPropertyRef = findProperty(rootObject.properties, "width");
+
+ QCOMPARE(widthPropertyRef.value, QVariant(15));
+ QCOMPARE(widthPropertyRef.binding, QString());
+
+ //
+ // set expression
+ //
+ m_dbg->setBindingForObject(rootObject.debugId, "width", "height", false,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ rootObject = findRootObject();
+ widthPropertyRef = findProperty(rootObject.properties, "width");
+
+ QCOMPARE(widthPropertyRef.value, QVariant(20));
+ QCOMPARE(widthPropertyRef.binding, QString("height"));
+
+ //
+ // set handler
+ //
+ rootObject = findRootObject();
+ QCOMPARE(rootObject.children.size(), 5); // Rectangle, Text, MouseArea, Component.onCompleted, NonScriptPropertyElement
+ QmlDebugObjectReference mouseAreaObject = rootObject.children.at(2);
+ m_dbg->queryObjectRecursive(mouseAreaObject, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ mouseAreaObject = m_dbg->object();
+
+ QCOMPARE(mouseAreaObject.className, QString("MouseArea"));
+
+ QmlDebugPropertyReference onEnteredRef = findProperty(mouseAreaObject.properties, "onEntered");
+
+ QCOMPARE(onEnteredRef.name, QString("onEntered"));
+ QCOMPARE(onEnteredRef.value, QVariant("(function onEntered() { { console.log('hello') } })"));
+
+ m_dbg->setBindingForObject(mouseAreaObject.debugId, "onEntered",
+ "{console.log('hello, world') }", false,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ rootObject = findRootObject();
+ mouseAreaObject = rootObject.children.at(2);
+ m_dbg->queryObjectRecursive(mouseAreaObject, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ mouseAreaObject = m_dbg->object();
+ onEnteredRef = findProperty(mouseAreaObject.properties, "onEntered");
+ QCOMPARE(onEnteredRef.name, QString("onEntered"));
+ QCOMPARE(onEnteredRef.value, QVariant("{console.log('hello, world') }"));
+}
+
+void tst_QQmlEngineDebugService::resetBindingForObject()
+{
+ QmlDebugObjectReference rootObject = findRootObject();
+ QVERIFY(rootObject.debugId != -1);
+ QmlDebugPropertyReference widthPropertyRef = findProperty(rootObject.properties, "width");
+
+ bool success = false;
+
+ m_dbg->setBindingForObject(rootObject.debugId, "width", "15", true,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ //
+ // reset
+ //
+ m_dbg->resetBindingForObject(rootObject.debugId, "width", &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ rootObject = findRootObject();
+ widthPropertyRef = findProperty(rootObject.properties, "width");
+
+ QCOMPARE(widthPropertyRef.value, QVariant(0));
+ QCOMPARE(widthPropertyRef.binding, QString());
+
+ //
+ // reset nested property
+ //
+ success = false;
+ m_dbg->resetBindingForObject(rootObject.debugId, "font.bold", &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ rootObject = findRootObject();
+ QmlDebugPropertyReference boldPropertyRef = findProperty(rootObject.properties, "font.bold");
+
+ QCOMPARE(boldPropertyRef.value.toBool(), false);
+ QCOMPARE(boldPropertyRef.binding, QString());
+}
+
+void tst_QQmlEngineDebugService::setBindingInStates()
+{
+ // Check if changing bindings of propertychanges works
+
+ const int sourceIndex = 3;
+
+ QmlDebugObjectReference obj = findRootObject(sourceIndex);
+
+ QVERIFY(obj.debugId != -1);
+ QVERIFY(obj.children.count() >= 2);
+ bool success;
+ // We are going to switch state a couple of times, we need to get rid of the transition before
+ m_dbg->queryExpressionResult(obj.debugId,QString("transitions = []"), &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+
+ // check initial value of the property that is changing
+ m_dbg->queryExpressionResult(obj.debugId,QString("state=\"state1\""), &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(),200);
+
+
+ m_dbg->queryExpressionResult(obj.debugId,QString("state=\"\""),
+ &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+
+ obj = findRootObject(sourceIndex, true);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(),100);
+
+
+ // change the binding
+ QmlDebugObjectReference state = obj.children[1];
+ QCOMPARE(state.className, QString("State"));
+ QVERIFY(state.children.count() > 0);
+
+ QmlDebugObjectReference propertyChange = state.children[0];
+ QVERIFY(propertyChange.debugId != -1);
+
+ m_dbg->setBindingForObject(propertyChange.debugId, "width",QVariant(300),true,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ // check properties changed in state
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(),100);
+
+
+ m_dbg->queryExpressionResult(obj.debugId,QString("state=\"state1\""), &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(),300);
+
+ // check changing properties of base state from within a state
+ m_dbg->setBindingForObject(obj.debugId,"width","height*2",false,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ m_dbg->setBindingForObject(obj.debugId,"height","200",true,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(),300);
+
+ m_dbg->queryExpressionResult(obj.debugId,QString("state=\"\""), &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 400);
+
+ // reset binding while in a state
+ m_dbg->queryExpressionResult(obj.debugId,QString("state=\"state1\""), &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 300);
+
+ m_dbg->resetBindingForObject(propertyChange.debugId, "width", &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 400);
+
+ // re-add binding
+ m_dbg->setBindingForObject(propertyChange.debugId, "width", "300", true,
+ QString(), -1, &success);
+ QVERIFY(success);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result())));
+ QCOMPARE(m_dbg->valid(), true);
+
+ obj = findRootObject(sourceIndex);
+ QCOMPARE(findProperty(obj.properties,"width").value.toInt(), 300);
+}
+
+void tst_QQmlEngineDebugService::queryObjectTree()
+{
+ const int sourceIndex = 3;
+
+ QmlDebugObjectReference obj = findRootObject(sourceIndex, true);
+
+ QVERIFY(obj.debugId != -1);
+ QVERIFY(obj.children.count() >= 2);
+
+ // check state
+ QmlDebugObjectReference state = obj.children[1];
+ QCOMPARE(state.className, QString("State"));
+ QVERIFY(state.children.count() > 0);
+
+ QmlDebugObjectReference propertyChange = state.children[0];
+ QVERIFY(propertyChange.debugId != -1);
+
+ QmlDebugPropertyReference propertyChangeTarget = findProperty(propertyChange.properties,"target");
+ QCOMPARE(propertyChangeTarget.objectDebugId, propertyChange.debugId);
+
+ QmlDebugObjectReference targetReference = qvariant_cast<QmlDebugObjectReference>(propertyChangeTarget.value);
+ QVERIFY(targetReference.debugId != -1);
+
+
+
+ // check transition
+ QmlDebugObjectReference transition = obj.children[0];
+ QCOMPARE(transition.className, QString("Transition"));
+ QCOMPARE(findProperty(transition.properties,"from").value.toString(), QString("*"));
+ QCOMPARE(findProperty(transition.properties,"to").value, findProperty(state.properties,"name").value);
+ QVERIFY(transition.children.count() > 0);
+
+ QmlDebugObjectReference animation = transition.children[0];
+ QVERIFY(animation.debugId != -1);
+
+ QmlDebugPropertyReference animationTarget = findProperty(animation.properties,"target");
+ QCOMPARE(animationTarget.objectDebugId, animation.debugId);
+
+ targetReference = qvariant_cast<QmlDebugObjectReference>(animationTarget.value);
+ QVERIFY(targetReference.debugId != -1);
+
+ QCOMPARE(findProperty(animation.properties,"property").value.toString(), QString("width"));
+ QCOMPARE(findProperty(animation.properties,"duration").value.toInt(), 100);
+}
+
+int main(int argc, char *argv[])
+{
+ int _argc = argc + 1;
+ char **_argv = new char*[_argc];
+ for (int i = 0; i < argc; ++i)
+ _argv[i] = argv[i];
+ char arg[] = "-qmljsdebugger=port:3768";
+ _argv[_argc - 1] = arg;
+
+ QGuiApplication app(_argc, _argv);
+ tst_QQmlEngineDebugService tc;
+ return QTest::qExec(&tc, _argc, _argv);
+ delete _argv;
+}
+
+#include "tst_qqmlenginedebugservice.moc"
diff --git a/tests/auto/qml/debugger/qqmlinspector/data/changes.txt b/tests/auto/qml/debugger/qqmlinspector/data/changes.txt
new file mode 100644
index 0000000000..38b17caeff
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlinspector/data/changes.txt
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+Item {
+ id: test
+ Component.onCompleted: {
+ console.log("version 2.0");
+ Qt.quit()
+ }
+}
diff --git a/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
new file mode 100644
index 0000000000..9c36e13c5b
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlinspector/data/qtquick2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/tests/auto/qml/debugger/qqmlinspector/data/window.qml b/tests/auto/qml/debugger/qqmlinspector/data/window.qml
new file mode 100644
index 0000000000..29eaced121
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlinspector/data/window.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0
+
+Window {
+ height: 100
+ width: 100
+}
diff --git a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
new file mode 100644
index 0000000000..4adda35aea
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro
@@ -0,0 +1,15 @@
+CONFIG += testcase
+TARGET = tst_qqmlinspector
+
+QT += qml testlib gui-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlinspector.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/qqmlinspectorclient.pri)
+include(../shared/debugutil.pri)
+
+TESTDATA = data/*
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
new file mode 100644
index 0000000000..f1fbdd20a9
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QTimer>
+#include <QHostAddress>
+#include <QDebug>
+#include <QThread>
+#include <QtCore/QLibraryInfo>
+
+#include "../shared/debugutil_p.h"
+#include "../../../shared/util.h"
+#include "qqmlinspectorclient.h"
+
+#define PORT 3772
+#define STR_PORT "3772"
+
+
+
+class tst_QQmlInspector : public QQmlDataTest
+{
+ Q_OBJECT
+
+public:
+ tst_QQmlInspector()
+ : m_process(0)
+ , m_connection(0)
+ , m_client(0)
+ {
+ }
+
+private:
+ void startQmlsceneProcess(const char *qmlFile);
+
+private:
+ QQmlDebugProcess *m_process;
+ QQmlDebugConnection *m_connection;
+ QQmlInspectorClient *m_client;
+
+private slots:
+ void init();
+ void cleanup();
+
+ void connect();
+ void showAppOnTop();
+ void reloadQml();
+ void reloadQmlWindow();
+};
+
+void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
+{
+ const QString argument = "-qmljsdebugger=port:" STR_PORT ",block";
+
+ m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+ m_process->start(QStringList() << argument << testFile("qtquick2.qml"));
+ QVERIFY2(m_process->waitForSessionStart(),
+ "Could not launch application, or did not get 'Waiting for connection'.");
+
+ QQmlDebugConnection *m_connection = new QQmlDebugConnection();
+ m_client = new QQmlInspectorClient(m_connection);
+
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), PORT);
+}
+
+void tst_QQmlInspector::init()
+{
+}
+
+void tst_QQmlInspector::cleanup()
+{
+ if (QTest::currentTestFailed()) {
+ qDebug() << "Process State:" << m_process->state();
+ qDebug() << "Application Output:" << m_process->output();
+ }
+ delete m_process;
+ delete m_connection;
+ delete m_client;
+}
+
+void tst_QQmlInspector::connect()
+{
+ startQmlsceneProcess("qtquick2.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+}
+
+void tst_QQmlInspector::showAppOnTop()
+{
+ startQmlsceneProcess("qtquick2.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setShowAppOnTop(true);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
+ QCOMPARE(m_client->m_requestResult, true);
+
+ m_client->setShowAppOnTop(false);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
+ QCOMPARE(m_client->m_requestResult, true);
+}
+
+void tst_QQmlInspector::reloadQml()
+{
+ startQmlsceneProcess("qtquick2.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ QByteArray fileContents;
+
+ QFile file(testFile("changes.txt"));
+ if (file.open(QFile::ReadOnly))
+ fileContents = file.readAll();
+ file.close();
+
+ QHash<QString, QByteArray> changesHash;
+ changesHash.insert("qtquick2.qml", fileContents);
+
+ m_client->reloadQml(changesHash);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
+
+ QTRY_COMPARE(m_process->output().contains(
+ QString("version 2.0")), true);
+
+ QCOMPARE(m_client->m_requestResult, true);
+ QCOMPARE(m_client->m_reloadRequestId, m_client->m_responseId);
+}
+
+void tst_QQmlInspector::reloadQmlWindow()
+{
+ startQmlsceneProcess("window.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ QByteArray fileContents;
+
+ QFile file(testFile("changes.txt"));
+ if (file.open(QFile::ReadOnly))
+ fileContents = file.readAll();
+ file.close();
+
+ QHash<QString, QByteArray> changesHash;
+ changesHash.insert("window.qml", fileContents);
+
+ m_client->reloadQml(changesHash);
+ QVERIFY(QQmlDebugTest::waitForSignal(m_client, SIGNAL(responseReceived())));
+
+ QEXPECT_FAIL("", "cannot debug with a QML file containing a top-level Window", Abort);
+ QTRY_COMPARE(m_process->output().contains(
+ QString("version 2.0")), true);
+
+ QCOMPARE(m_client->m_requestResult, true);
+ QCOMPARE(m_client->m_reloadRequestId, m_client->m_responseId);
+}
+
+QTEST_MAIN(tst_QQmlInspector)
+
+#include "tst_qqmlinspector.moc"
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml
new file mode 100644
index 0000000000..b250524caa
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ Timer {
+ running: true
+ interval: 1
+ onTriggered: Qt.quit();
+ }
+}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml
new file mode 100644
index 0000000000..9c36e13c5b
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
new file mode 100644
index 0000000000..5bff33dd25
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlprofilerservice
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlprofilerservice.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
+
+TESTDATA = data/*
+
+QT += core qml testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
new file mode 100644
index 0000000000..3a925e2905
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -0,0 +1,342 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QLibraryInfo>
+
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
+#include "../../../shared/util.h"
+
+#define PORT 13773
+#define STR_PORT "13773"
+
+struct QQmlProfilerData
+{
+ qint64 time;
+ int messageType;
+ int detailType;
+
+ //###
+ QString detailData; //used by RangeData and RangeLocation
+ int line; //used by RangeLocation
+ int column; //used by RangeLocation
+ int framerate; //used by animation events
+ int animationcount; //used by animation events
+
+ QByteArray toByteArray() const;
+};
+
+class QQmlProfilerClient : public QQmlDebugClient
+{
+ Q_OBJECT
+
+public:
+ enum Message {
+ Event,
+ RangeStart,
+ RangeData,
+ RangeLocation,
+ RangeEnd,
+ Complete, // end of transmission
+
+ MaximumMessage
+ };
+
+ enum EventType {
+ FramePaint,
+ Mouse,
+ Key,
+ AnimationFrame,
+ EndTrace,
+ StartTrace,
+
+ MaximumEventType
+ };
+
+ enum RangeType {
+ Painting,
+ Compiling,
+ Creating,
+ Binding, //running a binding
+ HandlingSignal, //running a signal handler
+
+ MaximumRangeType
+ };
+
+ QQmlProfilerClient(QQmlDebugConnection *connection)
+ : QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection)
+ {
+ }
+
+ QList<QQmlProfilerData> traceMessages;
+
+ void setTraceState(bool enabled) {
+ QByteArray message;
+ QDataStream stream(&message, QIODevice::WriteOnly);
+ stream << enabled;
+ sendMessage(message);
+ }
+
+signals:
+ void complete();
+
+protected:
+ void messageReceived(const QByteArray &message);
+};
+
+class tst_QQmlProfilerService : public QQmlDataTest
+{
+ Q_OBJECT
+
+public:
+ tst_QQmlProfilerService()
+ : m_process(0)
+ , m_connection(0)
+ , m_client(0)
+ {
+ }
+
+private:
+ QQmlDebugProcess *m_process;
+ QQmlDebugConnection *m_connection;
+ QQmlProfilerClient *m_client;
+
+ void connect(bool block, const QString &testFile);
+
+private slots:
+ void cleanup();
+
+ void blockingConnectWithTraceEnabled();
+ void blockingConnectWithTraceDisabled();
+ void nonBlockingConnect();
+ void profileOnExit();
+};
+
+void QQmlProfilerClient::messageReceived(const QByteArray &message)
+{
+ QByteArray msg = message;
+ QDataStream stream(&msg, QIODevice::ReadOnly);
+
+
+ QQmlProfilerData data;
+ data.time = -2;
+ data.messageType = -1;
+ data.detailType = -1;
+ data.line = -1;
+ data.framerate = -1;
+ data.animationcount = -1;
+
+ stream >> data.time >> data.messageType;
+
+ QVERIFY(data.time >= -1);
+
+ switch (data.messageType) {
+ case (QQmlProfilerClient::Event): {
+ stream >> data.detailType;
+
+ switch (data.detailType) {
+ case QQmlProfilerClient::AnimationFrame: {
+ stream >> data.framerate >> data.animationcount;
+ QVERIFY(data.framerate != -1);
+ QVERIFY(data.animationcount != -1);
+ break;
+ }
+ case QQmlProfilerClient::FramePaint:
+ case QQmlProfilerClient::Mouse:
+ case QQmlProfilerClient::Key:
+ case QQmlProfilerClient::StartTrace:
+ case QQmlProfilerClient::EndTrace:
+ break;
+ default: {
+ QString failMsg = QString("Unknown event type:") + data.detailType;
+ QFAIL(qPrintable(failMsg));
+ break;
+ }
+ }
+ break;
+ }
+ case QQmlProfilerClient::Complete: {
+ emit complete();
+ return;
+ }
+ case QQmlProfilerClient::RangeStart: {
+ stream >> data.detailType;
+ QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
+ break;
+ }
+ case QQmlProfilerClient::RangeEnd: {
+ stream >> data.detailType;
+ QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
+ break;
+ }
+ case QQmlProfilerClient::RangeData: {
+ stream >> data.detailType >> data.detailData;
+ QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
+ break;
+ }
+ case QQmlProfilerClient::RangeLocation: {
+ stream >> data.detailType >> data.detailData >> data.line >> data.column;
+ QVERIFY(data.detailType >= 0 && data.detailType < QQmlProfilerClient::MaximumRangeType);
+ QVERIFY(data.line >= -2);
+ break;
+ }
+ default:
+ QString failMsg = QString("Unknown message type:") + data.messageType;
+ QFAIL(qPrintable(failMsg));
+ break;
+ }
+ QVERIFY(stream.atEnd());
+ traceMessages.append(data);
+}
+
+void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
+{
+ const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
+ QStringList arguments;
+
+ if (block)
+ arguments << QString("-qmljsdebugger=port:" STR_PORT ",block");
+ else
+ arguments << QString("-qmljsdebugger=port:" STR_PORT);
+
+ arguments << QQmlDataTest::instance()->testFile(testFile);
+
+ m_process = new QQmlDebugProcess(executable, this);
+ m_process->start(QStringList() << arguments);
+ QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'.");
+
+ QQmlDebugConnection *m_connection = new QQmlDebugConnection();
+ m_client = new QQmlProfilerClient(m_connection);
+
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), PORT);
+}
+
+void tst_QQmlProfilerService::cleanup()
+{
+ if (QTest::currentTestFailed()) {
+ qDebug() << "Process State:" << m_process->state();
+ qDebug() << "Application Output:" << m_process->output();
+ }
+ delete m_process;
+ delete m_connection;
+ delete m_client;
+}
+
+void tst_QQmlProfilerService::blockingConnectWithTraceEnabled()
+{
+ connect(true, "test.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(true);
+ m_client->setTraceState(false);
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+
+ QVERIFY(m_client->traceMessages.count());
+ // must start with "StartTrace"
+ QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
+
+ // must end with "EndTrace"
+ QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
+}
+
+void tst_QQmlProfilerService::blockingConnectWithTraceDisabled()
+{
+ connect(true, "test.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(false);
+ m_client->setTraceState(true);
+ m_client->setTraceState(false);
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+
+ QVERIFY(m_client->traceMessages.count());
+
+ // must start with "StartTrace"
+ QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
+
+ // must end with "EndTrace"
+ QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
+}
+
+void tst_QQmlProfilerService::nonBlockingConnect()
+{
+ connect(false, "test.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(true);
+ m_client->setTraceState(false);
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+
+ // must start with "StartTrace"
+ QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
+
+ // must end with "EndTrace"
+ QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
+}
+
+void tst_QQmlProfilerService::profileOnExit()
+{
+ connect(true, "exit.qml");
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(true);
+
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
+
+ // must start with "StartTrace"
+ QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
+
+ // must end with "EndTrace"
+ QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
+}
+
+QTEST_MAIN(tst_QQmlProfilerService)
+
+#include "tst_qqmlprofilerservice.moc"
diff --git a/tests/auto/qml/debugger/qv8profilerservice/data/console.qml b/tests/auto/qml/debugger/qv8profilerservice/data/console.qml
new file mode 100644
index 0000000000..c23c820216
--- /dev/null
+++ b/tests/auto/qml/debugger/qv8profilerservice/data/console.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+
+Item {
+ function f()
+ {
+ }
+
+ Component.onCompleted: {
+ console.profile();
+ f();
+ console.profileEnd();
+ }
+}
diff --git a/tests/auto/qml/debugger/qv8profilerservice/data/exit.qml b/tests/auto/qml/debugger/qv8profilerservice/data/exit.qml
new file mode 100644
index 0000000000..604265354c
--- /dev/null
+++ b/tests/auto/qml/debugger/qv8profilerservice/data/exit.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ Timer {
+ running: true
+ interval: 1
+ onTriggered: {
+ Qt.quit();
+ }
+ }
+}
diff --git a/tests/auto/qml/debugger/qv8profilerservice/data/test.qml b/tests/auto/qml/debugger/qv8profilerservice/data/test.qml
new file mode 100644
index 0000000000..9c36e13c5b
--- /dev/null
+++ b/tests/auto/qml/debugger/qv8profilerservice/data/test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
new file mode 100644
index 0000000000..dc6f4c5038
--- /dev/null
+++ b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qv8profilerservice
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qv8profilerservice.cpp
+
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
+
+TESTDATA = data/*
+
+QT += qml testlib gui-private
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+CONFIG+=insignificant_test
diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
new file mode 100644
index 0000000000..f33ee55c46
--- /dev/null
+++ b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -0,0 +1,334 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QLibraryInfo>
+
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
+#include "../../../shared/util.h"
+
+#define STR_PORT_FROM "13774"
+#define STR_PORT_TO "13790"
+
+struct QV8ProfilerData
+{
+ int messageType;
+ QString filename;
+ QString functionname;
+ int lineNumber;
+ double totalTime;
+ double selfTime;
+ int treeLevel;
+
+ QByteArray toByteArray() const;
+};
+
+class QV8ProfilerClient : public QQmlDebugClient
+{
+ Q_OBJECT
+
+public:
+ enum MessageType {
+ V8Entry,
+ V8Complete,
+ V8SnapshotChunk,
+ V8SnapshotComplete,
+ V8Started,
+
+ V8MaximumMessage
+ };
+
+ enum ServiceState { NotRunning, Running } serviceState;
+
+ QV8ProfilerClient(QQmlDebugConnection *connection)
+ : QQmlDebugClient(QLatin1String("V8Profiler"), connection)
+ , serviceState(NotRunning)
+ {
+ }
+
+ void startProfiling(const QString &name) {
+ QByteArray message;
+ QDataStream stream(&message, QIODevice::WriteOnly);
+ stream << QByteArray("V8PROFILER") << QByteArray("start") << name;
+ sendMessage(message);
+ }
+
+ void stopProfiling(const QString &name) {
+ QByteArray message;
+ QDataStream stream(&message, QIODevice::WriteOnly);
+ stream << QByteArray("V8PROFILER") << QByteArray("stop") << name;
+ sendMessage(message);
+ }
+
+ void takeSnapshot() {
+ QByteArray message;
+ QDataStream stream(&message, QIODevice::WriteOnly);
+ stream << QByteArray("V8SNAPSHOT") << QByteArray("full");
+ sendMessage(message);
+ }
+
+ void deleteSnapshots() {
+ QByteArray message;
+ QDataStream stream(&message, QIODevice::WriteOnly);
+ stream << QByteArray("V8SNAPSHOT") << QByteArray("delete");
+ sendMessage(message);
+ }
+
+ QList<QV8ProfilerData> traceMessages;
+ QList<QByteArray> snapshotMessages;
+
+signals:
+ void started();
+ void complete();
+ void snapshot();
+
+protected:
+ void messageReceived(const QByteArray &message);
+};
+
+class tst_QV8ProfilerService : public QQmlDataTest
+{
+ Q_OBJECT
+
+public:
+ tst_QV8ProfilerService()
+ : m_process(0)
+ , m_connection(0)
+ , m_client(0)
+ {
+ }
+
+private:
+ QQmlDebugProcess *m_process;
+ QQmlDebugConnection *m_connection;
+ QV8ProfilerClient *m_client;
+
+ bool connect(bool block, const QString &testFile, QString *error);
+
+private slots:
+ void cleanup();
+
+ void blockingConnectWithTraceEnabled();
+ void blockingConnectWithTraceDisabled();
+ void nonBlockingConnect();
+ void snapshot();
+ void profileOnExit();
+ void console();
+};
+
+void QV8ProfilerClient::messageReceived(const QByteArray &message)
+{
+ QByteArray msg = message;
+ QDataStream stream(&msg, QIODevice::ReadOnly);
+
+ int messageType;
+ stream >> messageType;
+
+ QVERIFY(messageType >= 0);
+ QVERIFY(messageType < QV8ProfilerClient::V8MaximumMessage);
+
+ switch (messageType) {
+ case QV8ProfilerClient::V8Entry: {
+ QCOMPARE(serviceState, Running);
+ QV8ProfilerData entry;
+ stream >> entry.filename >> entry.functionname >> entry.lineNumber >> entry.totalTime >> entry.selfTime >> entry.treeLevel;
+ traceMessages.append(entry);
+ break;
+ }
+ case QV8ProfilerClient::V8Complete:
+ QCOMPARE(serviceState, Running);
+ serviceState = NotRunning;
+ emit complete();
+ break;
+ case QV8ProfilerClient::V8SnapshotChunk: {
+ QByteArray json;
+ stream >> json;
+ snapshotMessages.append(json);
+ break;
+ }
+ case QV8ProfilerClient::V8SnapshotComplete:
+ emit snapshot();
+ break;
+ case QV8ProfilerClient::V8Started:
+ QCOMPARE(serviceState, NotRunning);
+ serviceState = Running;
+ emit started();
+ break;
+ default:
+ QString failMessage = QString("Unknown message type: %1").arg(messageType);
+ QFAIL(qPrintable(failMessage));
+ }
+
+ QVERIFY(stream.atEnd());
+}
+
+bool tst_QV8ProfilerService::connect(bool block, const QString &testFile,
+ QString *error)
+{
+ const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene";
+ QStringList arguments;
+
+ if (block)
+ arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block");
+ else
+ arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO);
+
+ arguments << QQmlDataTest::instance()->testFile(testFile);
+
+ m_connection = new QQmlDebugConnection();
+ m_client = new QV8ProfilerClient(m_connection);
+
+ m_process = new QQmlDebugProcess(executable);
+ m_process->start(QStringList() << arguments);
+ if (!m_process->waitForSessionStart()) {
+ *error = QLatin1String("Could not launch application, or did not get 'Waiting for connection'.");
+ return false;
+ }
+
+ m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort());
+ if (!m_connection->waitForConnected()) {
+ *error = QLatin1String("Could not connect to debugger port.");
+ return false;
+ }
+ return true;
+}
+
+void tst_QV8ProfilerService::cleanup()
+{
+ if (QTest::currentTestFailed()) {
+ qDebug() << "Process State:" << m_process->state();
+ qDebug() << "Application Output:" << m_process->output();
+ }
+ delete m_client;
+ delete m_process;
+ delete m_connection;
+}
+
+void tst_QV8ProfilerService::blockingConnectWithTraceEnabled()
+{
+ QString error;
+ if (!connect(true, "test.qml", &error))
+ QFAIL(qPrintable(error));
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->startProfiling("");
+ m_client->stopProfiling("");
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+ "No trace received in time.");
+}
+
+void tst_QV8ProfilerService::blockingConnectWithTraceDisabled()
+{
+ QString error;
+ if (!connect(true, "test.qml", &error))
+ QFAIL(qPrintable(error));
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->stopProfiling("");
+ QVERIFY2(!QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete()), 1000),
+ "Unexpected trace received.");
+ m_client->startProfiling("");
+ m_client->stopProfiling("");
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+ "No trace received in time.");
+}
+
+void tst_QV8ProfilerService::nonBlockingConnect()
+{
+ QString error;
+ if (!connect(false, "test.qml", &error))
+ QFAIL(qPrintable(error));
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->startProfiling("");
+ m_client->stopProfiling("");
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+ "No trace received in time.");
+}
+
+void tst_QV8ProfilerService::snapshot()
+{
+ QString error;
+ if (!connect(false, "test.qml", &error))
+ QFAIL(qPrintable(error));
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->takeSnapshot();
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(snapshot())),
+ "No trace received in time.");
+}
+
+void tst_QV8ProfilerService::profileOnExit()
+{
+ QString error;
+ if (!connect(true, "exit.qml", &error))
+ QFAIL(qPrintable(error));
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->startProfiling("");
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+ "No trace received in time.");
+}
+
+void tst_QV8ProfilerService::console()
+{
+ QString error;
+ if (!connect(true, "console.qml", &error))
+ QFAIL(qPrintable(error));
+
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->stopProfiling("");
+
+ QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())),
+ "No trace received in time.");
+ QVERIFY(!m_client->traceMessages.isEmpty());
+}
+
+QTEST_MAIN(tst_QV8ProfilerService)
+
+#include "tst_qv8profilerservice.moc"
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
new file mode 100644
index 0000000000..6585f7eca2
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -0,0 +1,214 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "debugutil_p.h"
+
+#include <QEventLoop>
+#include <QTimer>
+
+bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
+ QEventLoop loop;
+ QTimer timer;
+ timer.setSingleShot(true);
+ QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ QObject::connect(receiver, member, &loop, SLOT(quit()));
+ timer.start(timeout);
+ loop.exec();
+ if (!timer.isActive())
+ qWarning("waitForSignal %s timed out after %d ms", member, timeout);
+ return timer.isActive();
+}
+
+QQmlDebugTestClient::QQmlDebugTestClient(const QString &s, QQmlDebugConnection *c)
+ : QQmlDebugClient(s, c)
+{
+}
+
+QByteArray QQmlDebugTestClient::waitForResponse()
+{
+ lastMsg.clear();
+ QQmlDebugTest::waitForSignal(this, SIGNAL(serverMessage(QByteArray)));
+ if (lastMsg.isEmpty()) {
+ qWarning() << "no response from server!";
+ return QByteArray();
+ }
+ return lastMsg;
+}
+
+void QQmlDebugTestClient::stateChanged(State stat)
+{
+ QCOMPARE(stat, state());
+ emit stateHasChanged();
+}
+
+void QQmlDebugTestClient::messageReceived(const QByteArray &ba)
+{
+ lastMsg = ba;
+ emit serverMessage(ba);
+}
+
+QQmlDebugProcess::QQmlDebugProcess(const QString &executable, QObject *parent)
+ : QObject(parent)
+ , m_executable(executable)
+ , m_started(false)
+ , m_port(0)
+{
+ m_process.setProcessChannelMode(QProcess::MergedChannels);
+ m_timer.setSingleShot(true);
+ m_timer.setInterval(5000);
+ connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(processAppOutput()));
+ connect(&m_timer, SIGNAL(timeout()), SLOT(timeout()));
+}
+
+QQmlDebugProcess::~QQmlDebugProcess()
+{
+ stop();
+}
+
+QString QQmlDebugProcess::state()
+{
+ QString stateStr;
+ switch (m_process.state()) {
+ case QProcess::NotRunning: {
+ stateStr = "not running";
+ if (m_process.exitStatus() == QProcess::CrashExit)
+ stateStr += " (crashed!)";
+ else
+ stateStr += ", return value " + QString::number(m_process.exitCode());
+ break;
+ }
+ case QProcess::Starting: stateStr = "starting"; break;
+ case QProcess::Running: stateStr = "running"; break;
+ }
+ return stateStr;
+}
+
+void QQmlDebugProcess::start(const QStringList &arguments)
+{
+ m_mutex.lock();
+ m_port = 0;
+ m_process.setEnvironment(m_environment);
+ m_process.start(m_executable, arguments);
+ if (!m_process.waitForStarted()) {
+ qWarning() << "QML Debug Client: Could not launch app " << m_executable
+ << ": " << m_process.errorString();
+ m_eventLoop.quit();
+ } else {
+ m_timer.start();
+ }
+ m_mutex.unlock();
+}
+
+void QQmlDebugProcess::stop()
+{
+ if (m_process.state() != QProcess::NotRunning) {
+ m_process.kill();
+ m_process.waitForFinished(5000);
+ }
+}
+
+void QQmlDebugProcess::timeout()
+{
+ qWarning() << "Timeout while waiting for QML debugging messages "
+ "in application output. Process is in state" << m_process.state() << ".";
+ m_eventLoop.quit();
+}
+
+bool QQmlDebugProcess::waitForSessionStart()
+{
+ if (m_process.state() != QProcess::Running) {
+ qWarning() << "Could not start up " << m_executable;
+ return false;
+ }
+ m_eventLoop.exec();
+
+ return m_started;
+}
+
+int QQmlDebugProcess::debugPort() const
+{
+ return m_port;
+}
+
+void QQmlDebugProcess::setEnvironment(const QStringList &environment)
+{
+ m_environment = environment;
+}
+
+QString QQmlDebugProcess::output() const
+{
+ return m_output;
+}
+
+void QQmlDebugProcess::processAppOutput()
+{
+ m_mutex.lock();
+
+ QString newOutput = m_process.readAll();
+ m_output.append(newOutput);
+ m_outputBuffer.append(newOutput);
+
+ while (true) {
+ const int nlIndex = m_outputBuffer.indexOf(QLatin1Char('\n'));
+ if (nlIndex < 0) // no further complete lines
+ break;
+ const QString line = m_outputBuffer.left(nlIndex);
+ m_outputBuffer = m_outputBuffer.right(m_outputBuffer.size() - nlIndex - 1);
+
+ if (line.contains("QML Debugger:")) {
+ const QRegExp portRx("Waiting for connection on port (\\d+)");
+ if (portRx.indexIn(line) != -1) {
+ m_port = portRx.cap(1).toInt();
+ m_timer.stop();
+ m_started = true;
+ m_eventLoop.quit();
+ continue;
+ }
+ if (line.contains("Unable to listen")) {
+ qWarning() << "App was unable to bind to port!";
+ m_timer.stop();
+ m_eventLoop.quit();
+ continue;
+ }
+ }
+ }
+ m_mutex.unlock();
+}
diff --git a/tests/auto/qml/debugger/shared/debugutil.pri b/tests/auto/qml/debugger/shared/debugutil.pri
new file mode 100644
index 0000000000..cb9c761395
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/debugutil.pri
@@ -0,0 +1,8 @@
+HEADERS += $$PWD/debugutil_p.h \
+ $$PWD/qqmldebugclient.h \
+ $$PWD/../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h
+
+SOURCES += $$PWD/debugutil.cpp \
+ $$PWD/qqmldebugclient.cpp \
+ $$PWD/../../../../../src/plugins/qmltooling/shared/qpacketprotocol.cpp
+
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
new file mode 100644
index 0000000000..2b9a94366a
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -0,0 +1,118 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEBUGUTIL_H
+#define DEBUGUTIL_H
+
+#include <QEventLoop>
+#include <QTimer>
+#include <QThread>
+#include <QTest>
+#include <QProcess>
+#include <QMutex>
+
+#include <QtQml/qqmlengine.h>
+
+#include "qqmldebugclient.h"
+
+class QQmlDebugTest
+{
+public:
+ static bool waitForSignal(QObject *receiver, const char *member, int timeout = 10000);
+};
+
+class QQmlDebugTestClient : public QQmlDebugClient
+{
+ Q_OBJECT
+public:
+ QQmlDebugTestClient(const QString &s, QQmlDebugConnection *c);
+
+ QByteArray waitForResponse();
+
+signals:
+ void stateHasChanged();
+ void serverMessage(const QByteArray &);
+
+protected:
+ virtual void stateChanged(State state);
+ virtual void messageReceived(const QByteArray &ba);
+
+private:
+ QByteArray lastMsg;
+};
+
+class QQmlDebugProcess : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDebugProcess(const QString &executable, QObject *parent = 0);
+ ~QQmlDebugProcess();
+
+ QString state();
+
+ void setEnvironment(const QStringList &environment);
+
+ void start(const QStringList &arguments);
+ bool waitForSessionStart();
+ int debugPort() const;
+
+ QString output() const;
+ void stop();
+
+private slots:
+ void timeout();
+ void processAppOutput();
+
+private:
+ QString m_executable;
+ QProcess m_process;
+ QString m_outputBuffer;
+ QString m_output;
+ QTimer m_timer;
+ QEventLoop m_eventLoop;
+ QMutex m_mutex;
+ bool m_started;
+ QStringList m_environment;
+ int m_port;
+};
+
+#endif // DEBUGUTIL_H
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
new file mode 100644
index 0000000000..be3042311b
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
@@ -0,0 +1,447 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmldebugclient.h"
+#include "../../../../../src/plugins/qmltooling/shared/qpacketprotocol.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qeventloop.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qtimer.h>
+#include <QtNetwork/qnetworkproxy.h>
+
+const int protocolVersion = 1;
+const QString serverId = QLatin1String("QDeclarativeDebugServer");
+const QString clientId = QLatin1String("QDeclarativeDebugClient");
+
+class QQmlDebugClientPrivate
+{
+public:
+ QQmlDebugClientPrivate();
+
+ QString name;
+ QQmlDebugConnection *connection;
+};
+
+class QQmlDebugConnectionPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDebugConnectionPrivate(QQmlDebugConnection *c);
+ QQmlDebugConnection *q;
+ QPacketProtocol *protocol;
+ QIODevice *device;
+ QEventLoop handshakeEventLoop;
+ QTimer handshakeTimer;
+
+ bool gotHello;
+ QHash <QString, float> serverPlugins;
+ QHash<QString, QQmlDebugClient *> plugins;
+
+ void advertisePlugins();
+ void connectDeviceSignals();
+
+public Q_SLOTS:
+ void connected();
+ void readyRead();
+ void deviceAboutToClose();
+ void handshakeTimeout();
+};
+
+QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate(QQmlDebugConnection *c)
+ : QObject(c), q(c), protocol(0), device(0), gotHello(false)
+{
+ protocol = new QPacketProtocol(q, this);
+ QObject::connect(c, SIGNAL(connected()), this, SLOT(connected()));
+ QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+
+ handshakeTimer.setSingleShot(true);
+ handshakeTimer.setInterval(3000);
+ connect(&handshakeTimer, SIGNAL(timeout()), SLOT(handshakeTimeout()));
+}
+
+void QQmlDebugConnectionPrivate::advertisePlugins()
+{
+ if (!q->isConnected())
+ return;
+
+ QPacket pack;
+ pack << serverId << 1 << plugins.keys();
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::connected()
+{
+ QPacket pack;
+ pack << serverId << 0 << protocolVersion << plugins.keys()
+ << q->m_dataStreamVersion;
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::readyRead()
+{
+ if (!gotHello) {
+ QPacket pack = protocol->read();
+ QString name;
+
+ pack >> name;
+
+ bool validHello = false;
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+ if (op == 0) {
+ int version = -1;
+ pack >> version;
+ if (version == protocolVersion) {
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ pack >> q->m_dataStreamVersion;
+ validHello = true;
+ }
+ }
+ }
+
+ if (!validHello) {
+ qWarning("QQmlDebugConnection: Invalid hello message");
+ QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ return;
+ }
+ gotHello = true;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ QQmlDebugClient::State newState = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(iter.key()))
+ newState = QQmlDebugClient::Enabled;
+ iter.value()->stateChanged(newState);
+ }
+
+ handshakeTimer.stop();
+ handshakeEventLoop.quit();
+ }
+
+ while (protocol->packetsAvailable()) {
+ QPacket pack = protocol->read();
+ QString name;
+ pack >> name;
+
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+
+ if (op == 1) {
+ // Service Discovery
+ QHash<QString, float> oldServerPlugins = serverPlugins;
+ serverPlugins.clear();
+
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ const QString pluginName = iter.key();
+ QQmlDebugClient::State newSate = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(pluginName))
+ newSate = QQmlDebugClient::Enabled;
+
+ if (oldServerPlugins.contains(pluginName)
+ != serverPlugins.contains(pluginName)) {
+ iter.value()->stateChanged(newSate);
+ }
+ }
+ } else {
+ qWarning() << "QQmlDebugConnection: Unknown control message id" << op;
+ }
+ } else {
+ QByteArray message;
+ pack >> message;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter =
+ plugins.find(name);
+ if (iter == plugins.end()) {
+ qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name;
+ } else {
+ (*iter)->messageReceived(message);
+ }
+ }
+ }
+}
+
+void QQmlDebugConnectionPrivate::deviceAboutToClose()
+{
+ // This is nasty syntax but we want to emit our own aboutToClose signal (by calling QIODevice::close())
+ // without calling the underlying device close fn as that would cause an infinite loop
+ q->QIODevice::close();
+}
+
+void QQmlDebugConnectionPrivate::handshakeTimeout()
+{
+ if (!gotHello) {
+ qWarning() << "Qml Debug Client: Did not get handshake answer in time";
+ handshakeEventLoop.quit();
+ }
+}
+
+QQmlDebugConnection::QQmlDebugConnection(QObject *parent)
+ : QIODevice(parent), d(new QQmlDebugConnectionPrivate(this)),
+ m_dataStreamVersion(QDataStream::Qt_5_0)
+{
+}
+
+QQmlDebugConnection::~QQmlDebugConnection()
+{
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->d->connection = 0;
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+}
+
+void QQmlDebugConnection::setDataStreamVersion(int dataStreamVersion)
+{
+ m_dataStreamVersion = dataStreamVersion;
+}
+
+int QQmlDebugConnection::dataStreamVersion()
+{
+ return m_dataStreamVersion;
+}
+
+bool QQmlDebugConnection::isConnected() const
+{
+ return state() == QAbstractSocket::ConnectedState;
+}
+
+qint64 QQmlDebugConnection::readData(char *data, qint64 maxSize)
+{
+ return d->device->read(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::writeData(const char *data, qint64 maxSize)
+{
+ return d->device->write(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::bytesAvailable() const
+{
+ return d->device->bytesAvailable();
+}
+
+bool QQmlDebugConnection::isSequential() const
+{
+ return true;
+}
+
+void QQmlDebugConnection::close()
+{
+ if (isOpen()) {
+ QIODevice::close();
+ d->device->close();
+ emit stateChanged(QAbstractSocket::UnconnectedState);
+
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+ }
+}
+
+bool QQmlDebugConnection::waitForConnected(int msecs)
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (!socket)
+ return false;
+ if (!socket->waitForConnected(msecs))
+ return false;
+ // wait for handshake
+ d->handshakeTimer.start();
+ d->handshakeEventLoop.exec();
+ return d->gotHello;
+}
+
+QAbstractSocket::SocketState QQmlDebugConnection::state() const
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket)
+ return socket->state();
+
+ return QAbstractSocket::UnconnectedState;
+}
+
+void QQmlDebugConnection::flush()
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket) {
+ socket->flush();
+ return;
+ }
+}
+
+void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
+{
+ QTcpSocket *socket = new QTcpSocket(d);
+ socket->setProxy(QNetworkProxy::NoProxy);
+ d->device = socket;
+ d->connectDeviceSignals();
+ d->gotHello = false;
+ connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
+ connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
+ socket->connectToHost(hostName, port);
+ QIODevice::open(ReadWrite | Unbuffered);
+}
+
+void QQmlDebugConnectionPrivate::connectDeviceSignals()
+{
+ connect(device, SIGNAL(bytesWritten(qint64)), q, SIGNAL(bytesWritten(qint64)));
+ connect(device, SIGNAL(readyRead()), q, SIGNAL(readyRead()));
+ connect(device, SIGNAL(aboutToClose()), this, SLOT(deviceAboutToClose()));
+}
+
+//
+
+QQmlDebugClientPrivate::QQmlDebugClientPrivate()
+ : connection(0)
+{
+}
+
+QQmlDebugClient::QQmlDebugClient(const QString &name,
+ QQmlDebugConnection *parent)
+ : QObject(parent),
+ d(new QQmlDebugClientPrivate)
+{
+ d->name = name;
+ d->connection = parent;
+
+ if (!d->connection)
+ return;
+
+ if (d->connection->d->plugins.contains(name)) {
+ qWarning() << "QQmlDebugClient: Conflicting plugin name" << name;
+ d->connection = 0;
+ } else {
+ d->connection->d->plugins.insert(name, this);
+ d->connection->d->advertisePlugins();
+ }
+}
+
+QQmlDebugClient::~QQmlDebugClient()
+{
+ if (d->connection && d->connection->d) {
+ d->connection->d->plugins.remove(d->name);
+ d->connection->d->advertisePlugins();
+ }
+ delete d;
+}
+
+QString QQmlDebugClient::name() const
+{
+ return d->name;
+}
+
+float QQmlDebugClient::serviceVersion() const
+{
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return d->connection->d->serverPlugins.value(d->name);
+ return -1;
+}
+
+QQmlDebugClient::State QQmlDebugClient::state() const
+{
+ if (!d->connection
+ || !d->connection->isConnected()
+ || !d->connection->d->gotHello)
+ return NotConnected;
+
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return Enabled;
+
+ return Unavailable;
+}
+
+void QQmlDebugClient::sendMessage(const QByteArray &message)
+{
+ if (state() != Enabled)
+ return;
+
+ QPacket pack;
+ pack << d->name << message;
+ d->connection->d->protocol->send(pack);
+ d->connection->flush();
+}
+
+void QQmlDebugClient::stateChanged(State)
+{
+}
+
+void QQmlDebugClient::messageReceived(const QByteArray &)
+{
+}
+
+#include <qqmldebugclient.moc>
diff --git a/tests/auto/qml/debugger/shared/qqmldebugclient.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h
new file mode 100644
index 0000000000..fc0a80d565
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLDEBUGCLIENT_H
+#define QQMLDEBUGCLIENT_H
+
+#include <QtNetwork/qtcpsocket.h>
+
+class QQmlDebugConnectionPrivate;
+class QQmlDebugConnection : public QIODevice
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QQmlDebugConnection)
+public:
+ QQmlDebugConnection(QObject * = 0);
+ ~QQmlDebugConnection();
+
+ void connectToHost(const QString &hostName, quint16 port);
+
+ void setDataStreamVersion(int dataStreamVersion);
+ int dataStreamVersion();
+
+ qint64 bytesAvailable() const;
+ bool isConnected() const;
+ QAbstractSocket::SocketState state() const;
+ void flush();
+ bool isSequential() const;
+ void close();
+ bool waitForConnected(int msecs = 30000);
+
+signals:
+ void connected();
+ void stateChanged(QAbstractSocket::SocketState socketState);
+ void error(QAbstractSocket::SocketError socketError);
+
+protected:
+ qint64 readData(char *data, qint64 maxSize);
+ qint64 writeData(const char *data, qint64 maxSize);
+
+private:
+ QQmlDebugConnectionPrivate *d;
+ int m_dataStreamVersion;
+ friend class QQmlDebugClient;
+ friend class QQmlDebugClientPrivate;
+ friend class QQmlDebugConnectionPrivate;
+};
+
+class QQmlDebugClientPrivate;
+class QQmlDebugClient : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QQmlDebugClient)
+
+public:
+ enum State { NotConnected, Unavailable, Enabled };
+
+ QQmlDebugClient(const QString &, QQmlDebugConnection *parent);
+ ~QQmlDebugClient();
+
+ QString name() const;
+ float serviceVersion() const;
+ State state() const;
+
+ virtual void sendMessage(const QByteArray &);
+
+protected:
+ virtual void stateChanged(State);
+ virtual void messageReceived(const QByteArray &);
+
+private:
+ QQmlDebugClientPrivate *d;
+ friend class QQmlDebugConnection;
+ friend class QQmlDebugConnectionPrivate;
+};
+
+#endif // QQMLDEBUGCLIENT_H
diff --git a/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
new file mode 100644
index 0000000000..996998b1ff
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugtestservice.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmldebugtestservice.h"
+#include <QThread>
+
+QQmlDebugTestService::QQmlDebugTestService(const QString &s, float version, QObject *parent)
+ : QQmlDebugService(s, version, parent)
+{
+ registerService();
+}
+
+void QQmlDebugTestService::messageReceived(const QByteArray &ba)
+{
+ Q_ASSERT(QThread::currentThread() != thread());
+ QMetaObject::invokeMethod(this, "_sendMessage", Qt::QueuedConnection, Q_ARG(QByteArray, ba));
+}
+
+void QQmlDebugTestService::stateAboutToBeChanged(QQmlDebugService::State)
+{
+ Q_ASSERT(QThread::currentThread() != thread());
+}
+
+void QQmlDebugTestService::stateChanged(State)
+{
+ Q_ASSERT(QThread::currentThread() != thread());
+ emit stateHasChanged();
+}
+
+void QQmlDebugTestService::_sendMessage(const QByteArray &msg)
+{
+ QQmlDebugService::sendMessage(msg);
+}
diff --git a/tests/auto/qml/debugger/shared/qqmldebugtestservice.h b/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
new file mode 100644
index 0000000000..b966a8bac9
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmldebugtestservice.h
@@ -0,0 +1,66 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLDEBUGTESTSERVICE_H
+#define QQMLDEBUGTESTSERVICE_H
+
+#include <private/qqmldebugservice_p.h>
+
+class QQmlDebugTestService : public QQmlDebugService
+{
+ Q_OBJECT
+public:
+ QQmlDebugTestService(const QString &s, float version = 1, QObject *parent = 0);
+
+signals:
+ void stateHasChanged();
+
+private slots:
+ void _sendMessage(const QByteArray &msg);
+
+protected:
+ virtual void messageReceived(const QByteArray &ba);
+ virtual void stateAboutToBeChanged(State state);
+ virtual void stateChanged(State state);
+};
+
+#endif // QQMLDEBUGTESTSERVICE_H
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
new file mode 100644
index 0000000000..610d80d559
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.cpp
@@ -0,0 +1,533 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlenginedebugclient.h"
+
+struct QmlObjectData {
+ QUrl url;
+ int lineNumber;
+ int columnNumber;
+ QString idString;
+ QString objectName;
+ QString objectType;
+ int objectId;
+ int contextId;
+ int parentId;
+};
+
+QDataStream &operator>>(QDataStream &ds, QmlObjectData &data)
+{
+ ds >> data.url >> data.lineNumber >> data.columnNumber >> data.idString
+ >> data.objectName >> data.objectType >> data.objectId >> data.contextId
+ >> data.parentId;
+ return ds;
+}
+
+struct QmlObjectProperty {
+ enum Type { Unknown, Basic, Object, List, SignalProperty };
+ Type type;
+ QString name;
+ QVariant value;
+ QString valueTypeName;
+ QString binding;
+ bool hasNotifySignal;
+};
+
+QDataStream &operator>>(QDataStream &ds, QmlObjectProperty &data)
+{
+ int type;
+ ds >> type >> data.name >> data.value >> data.valueTypeName
+ >> data.binding >> data.hasNotifySignal;
+ data.type = (QmlObjectProperty::Type)type;
+ return ds;
+}
+
+QQmlEngineDebugClient::QQmlEngineDebugClient(
+ QQmlDebugConnection *connection)
+ : QQmlDebugClient(QLatin1String("QmlDebugger"), connection),
+ m_nextId(0),
+ m_valid(false)
+{
+}
+
+quint32 QQmlEngineDebugClient::addWatch(
+ const QmlDebugPropertyReference &property, bool *success)
+{
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_PROPERTY") << id << property.objectDebugId
+ << property.name.toUtf8();
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::addWatch(
+ const QmlDebugContextReference &, const QString &, bool *success)
+{
+ *success = false;
+ qWarning("QQmlEngineDebugClient::addWatch(): Not implemented");
+ return 0;
+}
+
+quint32 QQmlEngineDebugClient::addWatch(
+ const QmlDebugObjectReference &object, const QString &expr,
+ bool *success)
+{
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_EXPR_OBJECT") << id << object.debugId << expr;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::addWatch(
+ const QmlDebugObjectReference &object, bool *success)
+{
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_OBJECT") << id << object.debugId;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::addWatch(
+ const QmlDebugFileReference &, bool *success)
+{
+ *success = false;
+ qWarning("QQmlEngineDebugClient::addWatch(): Not implemented");
+ return 0;
+}
+
+void QQmlEngineDebugClient::removeWatch(quint32 id, bool *success)
+{
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("NO_WATCH") << id;
+ sendMessage(message);
+ *success = true;
+ }
+}
+
+quint32 QQmlEngineDebugClient::queryAvailableEngines(bool *success)
+{
+ m_engines.clear();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("LIST_ENGINES") << id;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::queryRootContexts(
+ const QmlDebugEngineReference &engine, bool *success)
+{
+ m_rootContext = QmlDebugContextReference();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled && engine.debugId != -1) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("LIST_OBJECTS") << id << engine.debugId;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::queryObject(
+ const QmlDebugObjectReference &object, bool *success)
+{
+ m_object = QmlDebugObjectReference();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled && object.debugId != -1) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECT") << id << object.debugId << false <<
+ true;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::queryObjectsForLocation(
+ const QString &file, int lineNumber, int columnNumber, bool *success)
+{
+ m_objects.clear();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber
+ << columnNumber << false << true;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::queryObjectRecursive(
+ const QmlDebugObjectReference &object, bool *success)
+{
+ m_object = QmlDebugObjectReference();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled && object.debugId != -1) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECT") << id << object.debugId << true <<
+ true;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::queryObjectsForLocationRecursive(const QString &file,
+ int lineNumber, int columnNumber, bool *success)
+{
+ m_objects.clear();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECTS_FOR_LOCATION") << id << file << lineNumber
+ << columnNumber << true << true;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::queryExpressionResult(
+ int objectDebugId, const QString &expr, bool *success)
+{
+ m_exprResult = QVariant();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr
+ << engines()[0].debugId;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::queryExpressionResultBC(
+ int objectDebugId, const QString &expr, bool *success)
+{
+ m_exprResult = QVariant();
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("EVAL_EXPRESSION") << id << objectDebugId << expr;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::setBindingForObject(
+ int objectDebugId,
+ const QString &propertyName,
+ const QVariant &bindingExpression,
+ bool isLiteralValue,
+ QString source, int line,
+ bool *success)
+{
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("SET_BINDING") << id << objectDebugId << propertyName
+ << bindingExpression << isLiteralValue << source << line;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::resetBindingForObject(
+ int objectDebugId,
+ const QString &propertyName,
+ bool *success)
+{
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("RESET_BINDING") << id << objectDebugId << propertyName;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+quint32 QQmlEngineDebugClient::setMethodBody(
+ int objectDebugId, const QString &methodName,
+ const QString &methodBody, bool *success)
+{
+ quint32 id = -1;
+ *success = false;
+ if (state() == QQmlDebugClient::Enabled && objectDebugId != -1) {
+ id = getId();
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("SET_METHOD_BODY") << id << objectDebugId
+ << methodName << methodBody;
+ sendMessage(message);
+ *success = true;
+ }
+ return id;
+}
+
+void QQmlEngineDebugClient::decode(QDataStream &ds,
+ QmlDebugObjectReference &o,
+ bool simple)
+{
+ QmlObjectData data;
+ ds >> data;
+ o.debugId = data.objectId;
+ o.className = data.objectType;
+ o.idString = data.idString;
+ o.name = data.objectName;
+ o.source.url = data.url;
+ o.source.lineNumber = data.lineNumber;
+ o.source.columnNumber = data.columnNumber;
+ o.contextDebugId = data.contextId;
+
+ if (simple)
+ return;
+
+ int childCount;
+ bool recur;
+ ds >> childCount >> recur;
+
+ for (int ii = 0; ii < childCount; ++ii) {
+ o.children.append(QmlDebugObjectReference());
+ decode(ds, o.children.last(), !recur);
+ }
+
+ int propCount;
+ ds >> propCount;
+
+ for (int ii = 0; ii < propCount; ++ii) {
+ QmlObjectProperty data;
+ ds >> data;
+ QmlDebugPropertyReference prop;
+ prop.objectDebugId = o.debugId;
+ prop.name = data.name;
+ prop.binding = data.binding;
+ prop.hasNotifySignal = data.hasNotifySignal;
+ prop.valueTypeName = data.valueTypeName;
+ switch (data.type) {
+ case QmlObjectProperty::Basic:
+ case QmlObjectProperty::List:
+ case QmlObjectProperty::SignalProperty:
+ {
+ prop.value = data.value;
+ break;
+ }
+ case QmlObjectProperty::Object:
+ {
+ QmlDebugObjectReference obj;
+ obj.debugId = prop.value.toInt();
+ prop.value = qVariantFromValue(obj);
+ break;
+ }
+ case QmlObjectProperty::Unknown:
+ break;
+ }
+ o.properties << prop;
+ }
+}
+
+void QQmlEngineDebugClient::decode(QDataStream &ds,
+ QList<QmlDebugObjectReference> &o,
+ bool simple)
+{
+ int count;
+ ds >> count;
+ for (int i = 0; i < count; i++) {
+ QmlDebugObjectReference obj;
+ decode(ds, obj, simple);
+ o << obj;
+ }
+}
+
+void QQmlEngineDebugClient::decode(QDataStream &ds,
+ QmlDebugContextReference &c)
+{
+ ds >> c.name >> c.debugId;
+
+ int contextCount;
+ ds >> contextCount;
+
+ for (int ii = 0; ii < contextCount; ++ii) {
+ c.contexts.append(QmlDebugContextReference());
+ decode(ds, c.contexts.last());
+ }
+
+ int objectCount;
+ ds >> objectCount;
+
+ for (int ii = 0; ii < objectCount; ++ii) {
+ QmlDebugObjectReference obj;
+ decode(ds, obj, true);
+
+ obj.contextDebugId = c.debugId;
+ c.objects << obj;
+ }
+}
+
+void QQmlEngineDebugClient::messageReceived(const QByteArray &data)
+{
+ m_valid = false;
+ QDataStream ds(data);
+ int queryId;
+ QByteArray type;
+ ds >> type >> queryId;
+
+ //qDebug() << "QQmlEngineDebugPrivate::message()" << type;
+
+ if (type == "LIST_ENGINES_R") {
+ int count;
+ ds >> count;
+
+ m_engines.clear();
+ for (int ii = 0; ii < count; ++ii) {
+ QmlDebugEngineReference eng;
+ ds >> eng.name;
+ ds >> eng.debugId;
+ m_engines << eng;
+ }
+ } else if (type == "LIST_OBJECTS_R") {
+ if (!ds.atEnd())
+ decode(ds, m_rootContext);
+
+ } else if (type == "FETCH_OBJECT_R") {
+ if (!ds.atEnd())
+ decode(ds, m_object, false);
+
+ } else if (type == "FETCH_OBJECTS_FOR_LOCATION_R") {
+ if (!ds.atEnd())
+ decode(ds, m_objects, false);
+
+ } else if (type == "EVAL_EXPRESSION_R") {;
+ ds >> m_exprResult;
+
+ } else if (type == "WATCH_PROPERTY_R") {
+ ds >> m_valid;
+
+ } else if (type == "WATCH_OBJECT_R") {
+ ds >> m_valid;
+
+ } else if (type == "WATCH_EXPR_OBJECT_R") {
+ ds >> m_valid;
+
+ } else if (type == "UPDATE_WATCH") {
+ int debugId;
+ QByteArray name;
+ QVariant value;
+ ds >> debugId >> name >> value;
+ emit valueChanged(name, value);
+ return;
+
+ } else if (type == "OBJECT_CREATED") {
+ emit newObjects();
+ return;
+ } else if (type == "SET_BINDING_R") {
+ ds >> m_valid;
+ } else if (type == "RESET_BINDING_R") {
+ ds >> m_valid;
+ } else if (type == "SET_METHOD_BODY_R") {
+ ds >> m_valid;
+ } else if (type == "NO_WATCH_R") {
+ ds >> m_valid;
+ }
+ emit result();
+}
+
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
new file mode 100644
index 0000000000..1d4b95a9e3
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.h
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLENGINEDEBUGCLIENT_H
+#define QQMLENGINEDEBUGCLIENT_H
+
+#include "qqmldebugclient.h"
+
+#include <QtCore/qurl.h>
+#include <QtCore/qvariant.h>
+
+class QQmlDebugConnection;
+
+struct QmlDebugPropertyReference
+{
+ QmlDebugPropertyReference()
+ : objectDebugId(-1), hasNotifySignal(false)
+ {
+ }
+
+ QmlDebugPropertyReference &operator=(
+ const QmlDebugPropertyReference &o)
+ {
+ objectDebugId = o.objectDebugId; name = o.name; value = o.value;
+ valueTypeName = o.valueTypeName; binding = o.binding;
+ hasNotifySignal = o.hasNotifySignal;
+ return *this;
+ }
+
+ int objectDebugId;
+ QString name;
+ QVariant value;
+ QString valueTypeName;
+ QString binding;
+ bool hasNotifySignal;
+};
+
+struct QmlDebugFileReference
+{
+ QmlDebugFileReference()
+ : lineNumber(-1), columnNumber(-1)
+ {
+ }
+
+ QmlDebugFileReference &operator=(
+ const QmlDebugFileReference &o)
+ {
+ url = o.url; lineNumber = o.lineNumber; columnNumber = o.columnNumber;
+ return *this;
+ }
+
+ QUrl url;
+ int lineNumber;
+ int columnNumber;
+};
+
+struct QmlDebugObjectReference
+{
+ QmlDebugObjectReference()
+ : debugId(-1), contextDebugId(-1)
+ {
+ }
+
+ QmlDebugObjectReference(int id)
+ : debugId(id), contextDebugId(-1)
+ {
+ }
+
+ QmlDebugObjectReference &operator=(
+ const QmlDebugObjectReference &o)
+ {
+ debugId = o.debugId; className = o.className; idString = o.idString;
+ name = o.name; source = o.source; contextDebugId = o.contextDebugId;
+ properties = o.properties; children = o.children;
+ return *this;
+ }
+ int debugId;
+ QString className;
+ QString idString;
+ QString name;
+ QmlDebugFileReference source;
+ int contextDebugId;
+ QList<QmlDebugPropertyReference> properties;
+ QList<QmlDebugObjectReference> children;
+};
+
+Q_DECLARE_METATYPE(QmlDebugObjectReference)
+
+struct QmlDebugContextReference
+{
+ QmlDebugContextReference()
+ : debugId(-1)
+ {
+ }
+
+ QmlDebugContextReference &operator=(
+ const QmlDebugContextReference &o)
+ {
+ debugId = o.debugId; name = o.name; objects = o.objects;
+ contexts = o.contexts;
+ return *this;
+ }
+
+ int debugId;
+ QString name;
+ QList<QmlDebugObjectReference> objects;
+ QList<QmlDebugContextReference> contexts;
+};
+
+struct QmlDebugEngineReference
+{
+ QmlDebugEngineReference()
+ : debugId(-1)
+ {
+ }
+
+ QmlDebugEngineReference(int id)
+ : debugId(id)
+ {
+ }
+
+ QmlDebugEngineReference &operator=(
+ const QmlDebugEngineReference &o)
+ {
+ debugId = o.debugId; name = o.name;
+ return *this;
+ }
+
+ int debugId;
+ QString name;
+};
+
+class QQmlEngineDebugClient : public QQmlDebugClient
+{
+ Q_OBJECT
+public:
+ explicit QQmlEngineDebugClient(QQmlDebugConnection *conn);
+
+ quint32 addWatch(const QmlDebugPropertyReference &,
+ bool *success);
+ quint32 addWatch(const QmlDebugContextReference &, const QString &,
+ bool *success);
+ quint32 addWatch(const QmlDebugObjectReference &, const QString &,
+ bool *success);
+ quint32 addWatch(const QmlDebugObjectReference &,
+ bool *success);
+ quint32 addWatch(const QmlDebugFileReference &,
+ bool *success);
+
+ void removeWatch(quint32 watch, bool *success);
+
+ quint32 queryAvailableEngines(bool *success);
+ quint32 queryRootContexts(const QmlDebugEngineReference &,
+ bool *success);
+ quint32 queryObject(const QmlDebugObjectReference &,
+ bool *success);
+ quint32 queryObjectsForLocation(const QString &file,
+ int lineNumber, int columnNumber, bool *success);
+ quint32 queryObjectRecursive(const QmlDebugObjectReference &,
+ bool *success);
+ quint32 queryObjectsForLocationRecursive(const QString &file,
+ int lineNumber, int columnNumber, bool *success);
+ quint32 queryExpressionResult(int objectDebugId,
+ const QString &expr,
+ bool *success);
+ quint32 queryExpressionResultBC(int objectDebugId,
+ const QString &expr,
+ bool *success);
+ quint32 setBindingForObject(int objectDebugId, const QString &propertyName,
+ const QVariant &bindingExpression,
+ bool isLiteralValue,
+ QString source, int line, bool *success);
+ quint32 resetBindingForObject(int objectDebugId,
+ const QString &propertyName, bool *success);
+ quint32 setMethodBody(int objectDebugId, const QString &methodName,
+ const QString &methodBody, bool *success);
+
+ quint32 getId() { return m_nextId++; }
+
+ void decode(QDataStream &, QmlDebugContextReference &);
+ void decode(QDataStream &, QmlDebugObjectReference &, bool simple);
+ void decode(QDataStream &ds, QList<QmlDebugObjectReference> &o, bool simple);
+
+ QList<QmlDebugEngineReference> engines() { return m_engines; }
+ QmlDebugContextReference rootContext() { return m_rootContext; }
+ QmlDebugObjectReference object() { return m_object; }
+ QList<QmlDebugObjectReference> objects() { return m_objects; }
+ QVariant resultExpr() { return m_exprResult; }
+ bool valid() { return m_valid; }
+
+signals:
+ void newObjects();
+ void valueChanged(QByteArray,QVariant);
+ void result();
+
+protected:
+ void messageReceived(const QByteArray &);
+
+private:
+ quint32 m_nextId;
+ bool m_valid;
+ QList<QmlDebugEngineReference> m_engines;
+ QmlDebugContextReference m_rootContext;
+ QmlDebugObjectReference m_object;
+ QList<QmlDebugObjectReference> m_objects;
+ QVariant m_exprResult;
+};
+
+#endif // QQMLENGINEDEBUGCLIENT_H
diff --git a/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri
new file mode 100644
index 0000000000..a969b4f153
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebugclient.pri
@@ -0,0 +1,3 @@
+HEADERS += $$PWD/qqmlenginedebugclient.h
+
+SOURCES += $$PWD/qqmlenginedebugclient.cpp
diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp
new file mode 100644
index 0000000000..a6646968fa
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlinspectorclient.h"
+#include "qdatastream.h"
+
+void QQmlInspectorClient::setShowAppOnTop(bool showOnTop)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("request") << m_requestId++
+ << QByteArray("showAppOnTop") << showOnTop;
+
+ sendMessage(message);
+}
+
+void QQmlInspectorClient::reloadQml(const QHash<QString, QByteArray> &changesHash)
+{
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ m_reloadRequestId = m_requestId;
+
+ ds << QByteArray("request") << m_requestId++
+ << QByteArray("reload") << changesHash;
+
+ sendMessage(message);
+}
+
+void QQmlInspectorClient::messageReceived(const QByteArray &message)
+{
+ QDataStream ds(message);
+ QByteArray type;
+ ds >> type;
+
+ if (type != QByteArray("response")) {
+ qDebug() << "Unhandled message of type" << type;
+ return;
+ }
+
+ m_requestResult = false;
+ ds >> m_responseId >> m_requestResult;
+ emit responseReceived();
+}
diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.h b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
new file mode 100644
index 0000000000..98d50850af
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QQMLINSPECTORCLIENT_H
+#define QQMLINSPECTORCLIENT_H
+
+#include "qqmldebugclient.h"
+
+class QQmlInspectorClient : public QQmlDebugClient
+{
+ Q_OBJECT
+
+public:
+ QQmlInspectorClient(QQmlDebugConnection *connection)
+ : QQmlDebugClient(QLatin1String("QmlInspector"), connection)
+ , m_showAppOnTop(false)
+ , m_requestId(0)
+ , m_requestResult(false)
+ , m_responseId(-1)
+ {
+ }
+
+ void setShowAppOnTop(bool showOnTop);
+ void reloadQml(const QHash<QString, QByteArray> &changesHash);
+
+signals:
+ void responseReceived();
+
+protected:
+ void messageReceived(const QByteArray &message);
+
+private:
+ bool m_showAppOnTop;
+ int m_requestId;
+
+public:
+ bool m_requestResult;
+ int m_responseId;
+ int m_reloadRequestId;
+};
+
+#endif // QQMLINSPECTORCLIENT_H
diff --git a/tests/auto/qml/debugger/shared/qqmlinspectorclient.pri b/tests/auto/qml/debugger/shared/qqmlinspectorclient.pri
new file mode 100644
index 0000000000..c136e1313a
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/qqmlinspectorclient.pri
@@ -0,0 +1,3 @@
+HEADERS += $$PWD/qqmlinspectorclient.h
+
+SOURCES += $$PWD/qqmlinspectorclient.cpp
diff --git a/tests/auto/qml/parserstress/parserstress.pro b/tests/auto/qml/parserstress/parserstress.pro
new file mode 100644
index 0000000000..8d92d69494
--- /dev/null
+++ b/tests/auto/qml/parserstress/parserstress.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_parserstress
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_parserstress.cpp
+
+TESTDATA = tests/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4-1.js
new file mode 100644
index 0000000000..b73ca2df71
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4-1.js
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4-1.js';
+
+/**
+ File Name: 15.4-1.js
+ ECMA Section: 15.4 Array Objects
+
+ Description: Every Array object has a length property whose value
+ is always an integer with positive sign and less than
+ Math.pow(2,32).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.4-1";
+var VERSION = "ECMA_1";
+startTest();
+
+var TITLE = "Array Objects";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length",
+ (Math.pow(2,32)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length",
+ (Math.pow(2,32)-2),
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length",
+ (Math.pow(2,31)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length",
+ (Math.pow(2,31)),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length",
+ (Math.pow(2,31)+1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length",
+ (Math.pow(2,30)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length")
+ );
+
+print(typeof testcases, testcases instanceof Array, testcases.length);
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4-2.js
new file mode 100644
index 0000000000..7d00703d30
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4-2.js
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4-2.js';
+
+/**
+ File Name: 15.4-2.js
+ ECMA Section: 15.4 Array Objects
+
+ Description: Whenever a property is added whose name is an array
+ index, the length property is changed, if necessary,
+ to be one more than the numeric value of that array
+ index; and whenever the length property is changed,
+ every property whose name is an array index whose value
+ is not smaller than the new length is automatically
+ deleted. This constraint applies only to the Array
+ object itself, and is unaffected by length or array
+ index properties that may be inherited from its
+ prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.4-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Objects";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length",
+ Math.pow(2,16)+1,
+ eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length",
+ Math.pow(2,30)-1,
+ eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length",
+ Math.pow(2,30),
+ eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length",
+ Math.pow(2,30)+1,
+ eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") );
+
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length",
+ Math.pow(2,31)-1,
+ eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length",
+ Math.pow(2,31),
+ eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length",
+ Math.pow(2,31)+1,
+ eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)",
+ "0,1",
+ eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") );
+
+new TestCase( SECTION,
+ "var arr = new Array(0,1); arr.length = 3; String(arr)",
+ "0,1,",
+ eval("var arr = new Array(0,1); arr.length = 3; String(arr)") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.1.js
new file mode 100644
index 0000000000..b894433d01
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.1.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.1.1.js';
+
+/**
+ File Name: 15.4.1.1.js
+ ECMA Section: 15.4.1 Array( item0, item1,... )
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creation new Array(...) with
+ the same arguments.
+
+ An array is created and returned as if by the expression
+ new Array( item0, item1, ... ).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.1.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "typeof Array(1,2)",
+ "object",
+ typeof Array(1,2) );
+
+new TestCase( SECTION,
+ "(Array(1,2)).toString",
+ Array.prototype.toString,
+ (Array(1,2)).toString );
+
+new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()",
+ "[object Array]",
+ eval("var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()") );
+
+new TestCase( SECTION,
+ "(Array(1,2)).length",
+ 2,
+ (Array(1,2)).length );
+
+new TestCase( SECTION,
+ "var arr = (Array(1,2)); arr[0]",
+ 1,
+ eval("var arr = (Array(1,2)); arr[0]") );
+
+new TestCase( SECTION,
+ "var arr = (Array(1,2)); arr[1]",
+ 2,
+ eval("var arr = (Array(1,2)); arr[1]") );
+
+new TestCase( SECTION,
+ "var arr = (Array(1,2)); String(arr)",
+ "1,2",
+ eval("var arr = (Array(1,2)); String(arr)") );
+
+test();
+
+function ToUint32( n ) {
+ n = Number( n );
+ if( isNaN(n) || n == 0 || n == Number.POSITIVE_INFINITY ||
+ n == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+ var sign = n < 0 ? -1 : 1;
+
+ return ( sign * ( n * Math.floor( Math.abs(n) ) ) ) % Math.pow(2, 32);
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.2.js
new file mode 100644
index 0000000000..7e2e7ef436
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.2.js
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.1.2.js';
+
+/**
+ File Name: 15.4.1.2.js
+ ECMA Section: 15.4.1.2 Array(len)
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
+
+ An array is created and returned as if by the
+ expression new Array(len).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.1.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Constructor Called as a Function: Array(len)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "(Array()).length",
+ 0,
+ (Array()).length );
+
+new TestCase( SECTION,
+ "(Array(0)).length",
+ 0,
+ (Array(0)).length );
+
+new TestCase( SECTION,
+ "(Array(1)).length",
+ 1,
+ (Array(1)).length );
+
+new TestCase( SECTION,
+ "(Array(10)).length",
+ 10,
+ (Array(10)).length );
+
+new TestCase( SECTION,
+ "(Array('1')).length",
+ 1,
+ (Array('1')).length );
+
+new TestCase( SECTION,
+ "(Array(1000)).length",
+ 1000,
+ (Array(1000)).length );
+
+new TestCase( SECTION,
+ "(Array('1000')).length",
+ 1,
+ (Array('1000')).length );
+
+new TestCase( SECTION,
+ "(Array(4294967295)).length",
+ ToUint32(4294967295),
+ (Array(4294967295)).length );
+
+new TestCase( SECTION,
+ "(Array(Math.pow(2,31)-1)).length",
+ ToUint32(Math.pow(2,31)-1),
+ (Array(Math.pow(2,31)-1)).length );
+
+new TestCase( SECTION,
+ "(Array(Math.pow(2,31))).length",
+ ToUint32(Math.pow(2,31)),
+ (Array(Math.pow(2,31))).length );
+
+new TestCase( SECTION,
+ "(Array(Math.pow(2,31)+1)).length",
+ ToUint32(Math.pow(2,31)+1),
+ (Array(Math.pow(2,31)+1)).length );
+
+new TestCase( SECTION,
+ "(Array('8589934592')).length",
+ 1,
+ (Array("8589934592")).length );
+
+new TestCase( SECTION,
+ "(Array('4294967296')).length",
+ 1,
+ (Array("4294967296")).length );
+
+new TestCase( SECTION,
+ "(Array(1073741823)).length",
+ ToUint32(1073741823),
+ (Array(1073741823)).length );
+
+new TestCase( SECTION,
+ "(Array(1073741824)).length",
+ ToUint32(1073741824),
+ (Array(1073741824)).length );
+
+new TestCase( SECTION,
+ "(Array('a string')).length",
+ 1,
+ (Array("a string")).length );
+
+test();
+
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.3.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.3.js
new file mode 100644
index 0000000000..b36f339966
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.3.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.1.3.js';
+
+/**
+ File Name: 15.4.1.3.js
+ ECMA Section: 15.4.1.3 Array()
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
+
+ An array is created and returned as if by the
+ expression new Array(len).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.1.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Constructor Called as a Function: Array()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "typeof Array()",
+ "object",
+ typeof Array() );
+
+new TestCase( SECTION,
+ "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()",
+ "[object Array]",
+ eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") );
+
+new TestCase( SECTION,
+ "(Array()).length",
+ 0,
+ (Array()).length );
+
+new TestCase( SECTION,
+ "Array().toString()",
+ "",
+ Array().toString() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.js
new file mode 100644
index 0000000000..414c901926
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.1.js
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.1.js';
+
+/**
+ File Name: 15.4.1.js
+ ECMA Section: 15.4.1 The Array Constructor Called as a Function
+
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Array() +''",
+ "",
+ Array() +"" );
+
+new TestCase( SECTION,
+ "typeof Array()",
+ "object",
+ typeof Array() );
+
+new TestCase( SECTION,
+ "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+new TestCase( SECTION,
+ "var arr = Array(); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(); arr.toString == Array.prototype.toString") );
+
+new TestCase( SECTION,
+ "Array().length",
+ 0,
+ Array().length );
+
+new TestCase( SECTION,
+ "Array(1,2,3) +''",
+ "1,2,3",
+ Array(1,2,3) +"" );
+
+new TestCase( SECTION,
+ "typeof Array(1,2,3)",
+ "object",
+ typeof Array(1,2,3) );
+
+new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") );
+
+new TestCase( SECTION,
+ "Array(1,2,3).length",
+ 3,
+ Array(1,2,3).length );
+
+new TestCase( SECTION,
+ "typeof Array(12345)",
+ "object",
+ typeof Array(12345) );
+
+new TestCase( SECTION,
+ "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+new TestCase( SECTION,
+ "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") );
+
+new TestCase( SECTION,
+ "Array(12345).length",
+ 12345,
+ Array(12345).length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-1.js
new file mode 100644
index 0000000000..986684e338
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-1.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.2.1-1.js';
+
+/**
+ File Name: 15.4.2.1-1.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ The length property of the newly constructed object is
+ set to the number of arguments.
+
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
+
+ This file tests the typeof the newly constructed object.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "typeof new Array(1,2)",
+ "object",
+ typeof new Array(1,2) );
+
+new TestCase( SECTION,
+ "(new Array(1,2)).toString",
+ Array.prototype.toString,
+ (new Array(1,2)).toString );
+
+new TestCase( SECTION,
+ "var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+new TestCase( SECTION,
+ "(new Array(1,2)).length",
+ 2,
+ (new Array(1,2)).length );
+
+new TestCase( SECTION,
+ "var arr = (new Array(1,2)); arr[0]",
+ 1,
+ eval("var arr = (new Array(1,2)); arr[0]") );
+
+new TestCase( SECTION,
+ "var arr = (new Array(1,2)); arr[1]",
+ 2,
+ eval("var arr = (new Array(1,2)); arr[1]") );
+
+new TestCase( SECTION,
+ "var arr = (new Array(1,2)); String(arr)",
+ "1,2",
+ eval("var arr = (new Array(1,2)); String(arr)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-2.js
new file mode 100644
index 0000000000..9e957cbb21
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-2.js
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.2.1-2.js';
+
+/**
+ File Name: 15.4.2.1-2.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ The length property of the newly constructed object is
+ set to the number of arguments.
+
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
+
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var TEST_STRING = "new Array(";
+var ARGUMENTS = ""
+ var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
+
+for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
+}
+
+TEST_STRING += ARGUMENTS + ")";
+
+TEST_ARRAY = eval( TEST_STRING );
+
+for ( var item = 0; item < TEST_LENGTH; item++ ) {
+ new TestCase( SECTION,
+ "["+item+"]",
+ item,
+ TEST_ARRAY[item] );
+}
+
+new TestCase( SECTION,
+ "new Array( ["+TEST_LENGTH+" arguments] ) +''",
+ ARGUMENTS,
+ TEST_ARRAY +"" );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-3.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-3.js
new file mode 100644
index 0000000000..4d1806d9b8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.1-3.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.2.1-3.js';
+
+/**
+ File Name: 15.4.2.1-3.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ The length property of the newly constructed object is
+ set to the number of arguments.
+
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
+
+ This test stresses the number of arguments presented to
+ the Array constructor. Should support up to Math.pow
+ (2,32) arguments, since that is the maximum length of an
+ ECMAScript array.
+
+ ***Change TEST_LENGTH to Math.pow(2,32) when larger array
+ lengths are supported.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.2.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = "new Array(";
+var ARGUMENTS = ""
+ var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
+
+for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
+}
+
+TEST_STRING += ARGUMENTS + ")";
+
+TEST_ARRAY = eval( TEST_STRING );
+
+for ( var item = 0; item < TEST_LENGTH; item++ ) {
+ new TestCase( SECTION,
+ "TEST_ARRAY["+item+"]",
+ item,
+ TEST_ARRAY[item] );
+}
+
+new TestCase( SECTION,
+ "new Array( ["+TEST_LENGTH+" arguments] ) +''",
+ ARGUMENTS,
+ TEST_ARRAY +"" );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.toString",
+ Array.prototype.toString,
+ TEST_ARRAY.toString );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.join",
+ Array.prototype.join,
+ TEST_ARRAY.join );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.sort",
+ Array.prototype.sort,
+ TEST_ARRAY.sort );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.reverse",
+ Array.prototype.reverse,
+ TEST_ARRAY.reverse );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.length",
+ TEST_LENGTH,
+ TEST_ARRAY.length );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()",
+ "[object Array]",
+ eval("TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-1.js
new file mode 100644
index 0000000000..255d0b5fb4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-1.js
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.2.2-1.js';
+
+/**
+ File Name: 15.4.2.2-1.js
+ ECMA Section: 15.4.2.2 new Array(len)
+
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype(0)
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ If the argument len is a number, then the length
+ property of the newly constructed object is set to
+ ToUint32(len).
+
+ If the argument len is not a number, then the length
+ property of the newly constructed object is set to 1
+ and the 0 property of the newly constructed object is
+ set to len.
+
+ This file tests cases where len is a number.
+
+ The cases in this test need to be updated since the
+ ToUint32 description has changed.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.2.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( len )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "new Array(0)",
+ "",
+ (new Array(0)).toString() );
+
+new TestCase( SECTION,
+ "typeof new Array(0)",
+ "object",
+ (typeof new Array(0)) );
+
+new TestCase( SECTION,
+ "(new Array(0)).length",
+ 0,
+ (new Array(0)).length );
+
+new TestCase( SECTION,
+ "(new Array(0)).toString",
+ Array.prototype.toString,
+ (new Array(0)).toString );
+
+new TestCase( SECTION,
+ "new Array(1)",
+ "",
+ (new Array(1)).toString() );
+
+new TestCase( SECTION,
+ "new Array(1).length",
+ 1,
+ (new Array(1)).length );
+
+new TestCase( SECTION,
+ "(new Array(1)).toString",
+ Array.prototype.toString,
+ (new Array(1)).toString );
+
+new TestCase( SECTION,
+ "(new Array(-0)).length",
+ 0,
+ (new Array(-0)).length );
+
+new TestCase( SECTION,
+ "(new Array(0)).length",
+ 0,
+ (new Array(0)).length );
+
+new TestCase( SECTION,
+ "(new Array(10)).length",
+ 10,
+ (new Array(10)).length );
+
+new TestCase( SECTION,
+ "(new Array('1')).length",
+ 1,
+ (new Array('1')).length );
+
+new TestCase( SECTION,
+ "(new Array(1000)).length",
+ 1000,
+ (new Array(1000)).length );
+
+new TestCase( SECTION,
+ "(new Array('1000')).length",
+ 1,
+ (new Array('1000')).length );
+
+new TestCase( SECTION,
+ "(new Array(4294967295)).length",
+ ToUint32(4294967295),
+ (new Array(4294967295)).length );
+
+new TestCase( SECTION,
+ "(new Array('8589934592')).length",
+ 1,
+ (new Array("8589934592")).length );
+
+new TestCase( SECTION,
+ "(new Array('4294967296')).length",
+ 1,
+ (new Array("4294967296")).length );
+
+new TestCase( SECTION,
+ "(new Array(1073741824)).length",
+ ToUint32(1073741824),
+ (new Array(1073741824)).length );
+
+test();
+
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-2.js
new file mode 100644
index 0000000000..e77ba8d876
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.2-2.js
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.2.2-2.js';
+
+/**
+ File Name: 15.4.2.2-2.js
+ ECMA Section: 15.4.2.2 new Array(len)
+
+ Description: This description only applies of the constructor is
+ given two or more arguments.
+
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype(0)
+ (15.4.3.1).
+
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
+
+ If the argument len is a number, then the length
+ property of the newly constructed object is set to
+ ToUint32(len).
+
+ If the argument len is not a number, then the length
+ property of the newly constructed object is set to 1
+ and the 0 property of the newly constructed object is
+ set to len.
+
+ This file tests length of the newly constructed array
+ when len is not a number.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.2.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( len )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "(new Array(new Number(1073741823))).length",
+ 1,
+ (new Array(new Number(1073741823))).length );
+
+new TestCase( SECTION,
+ "(new Array(new Number(0))).length",
+ 1,
+ (new Array(new Number(0))).length );
+
+new TestCase( SECTION,
+ "(new Array(new Number(1000))).length",
+ 1,
+ (new Array(new Number(1000))).length );
+
+new TestCase( SECTION,
+ "(new Array('mozilla, larryzilla, curlyzilla')).length",
+ 1,
+ (new Array('mozilla, larryzilla, curlyzilla')).length );
+
+new TestCase( SECTION,
+ "(new Array(true)).length",
+ 1,
+ (new Array(true)).length );
+
+new TestCase( SECTION,
+ "(new Array(false)).length",
+ 1,
+ (new Array(false)).length);
+
+new TestCase( SECTION,
+ "(new Array(new Boolean(true)).length",
+ 1,
+ (new Array(new Boolean(true))).length );
+
+new TestCase( SECTION,
+ "(new Array(new Boolean(false)).length",
+ 1,
+ (new Array(new Boolean(false))).length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.3.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.3.js
new file mode 100644
index 0000000000..27d9bd257b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.2.3.js
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.2.3.js';
+
+/**
+ File Name: 15.4.2.3.js
+ ECMA Section: 15.4.2.3 new Array()
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the origianl Array prototype object,
+ the one that is the initial value of Array.prototype.
+ The [[Class]] property of the new object is set to
+ "Array". The length of the object is set to 0.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.2.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "new Array() +''",
+ "",
+ (new Array()) +"" );
+
+new TestCase( SECTION,
+ "typeof new Array()",
+ "object",
+ (typeof new Array()) );
+
+new TestCase( SECTION,
+ "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
+
+new TestCase( SECTION,
+ "(new Array()).length",
+ 0,
+ (new Array()).length );
+
+new TestCase( SECTION,
+ "(new Array()).toString == Array.prototype.toString",
+ true,
+ (new Array()).toString == Array.prototype.toString );
+
+new TestCase( SECTION,
+ "(new Array()).join == Array.prototype.join",
+ true,
+ (new Array()).join == Array.prototype.join );
+
+new TestCase( SECTION,
+ "(new Array()).reverse == Array.prototype.reverse",
+ true,
+ (new Array()).reverse == Array.prototype.reverse );
+
+new TestCase( SECTION,
+ "(new Array()).sort == Array.prototype.sort",
+ true,
+ (new Array()).sort == Array.prototype.sort );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.1-2.js
new file mode 100644
index 0000000000..36c1967f16
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.1-2.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.3.1-2.js';
+
+/**
+ File Name: 15.4.3.1-1.js
+ ECMA Section: 15.4.3.1 Array.prototype
+ Description: The initial value of Array.prototype is the built-in
+ Array prototype object (15.4.4).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var ARRAY_PROTO = Array.prototype;
+
+new TestCase( SECTION,
+ "var props = ''; for ( p in Array ) { props += p } props",
+ "",
+ eval("var props = ''; for ( p in Array ) { props += p } props") );
+
+new TestCase( SECTION,
+ "Array.prototype = null; Array.prototype",
+ ARRAY_PROTO,
+ eval("Array.prototype = null; Array.prototype") );
+
+new TestCase( SECTION,
+ "delete Array.prototype",
+ false,
+ delete Array.prototype );
+
+new TestCase( SECTION,
+ "delete Array.prototype; Array.prototype",
+ ARRAY_PROTO,
+ eval("delete Array.prototype; Array.prototype") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.2.js
new file mode 100644
index 0000000000..dfb47ca284
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.3.2.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.3.2.js';
+
+/**
+ File Name: 15.4.3.2.js
+ ECMA Section: 15.4.3.2 Array.length
+ Description: The length property is 1.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.3.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.length";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Array.length",
+ 1,
+ Array.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.1.js
new file mode 100644
index 0000000000..bd886b0cb0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.1.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.1.js';
+
+/**
+ File Name: 15.4.4.1.js
+ ECMA Section: 15.4.4.1 Array.prototype.constructor
+ Description: The initial value of Array.prototype.constructor
+ is the built-in Array constructor.
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION,
+ "Array.prototype.constructor == Array",
+ true,
+ Array.prototype.constructor == Array);
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.2.js
new file mode 100644
index 0000000000..d0be6bd471
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.2.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.2.js';
+
+/**
+ File Name: 15.4.4.2.js
+ ECMA Section: 15.4.4.2 Array.prototype.toString()
+ Description: The elements of this object are converted to strings
+ and these strings are then concatenated, separated by
+ comma characters. The result is the same as if the
+ built-in join method were invoiked for this object
+ with no argument.
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.toString";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+print(1);
+new TestCase( SECTION,
+ "Array.prototype.toString.length",
+ 0,
+ Array.prototype.toString.length );
+
+print(2);
+new TestCase( SECTION,
+ "(new Array()).toString()",
+ "",
+ (new Array()).toString() );
+
+print(3);
+new TestCase( SECTION,
+ "(new Array(2)).toString()",
+ ",",
+ (new Array(2)).toString() );
+
+print(4);
+new TestCase( SECTION,
+ "(new Array(0,1)).toString()",
+ "0,1",
+ (new Array(0,1)).toString() );
+
+print(5);
+new TestCase( SECTION,
+ "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()",
+ "NaN,Infinity,-Infinity",
+ (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() );
+
+print(6);
+new TestCase( SECTION,
+ "(new Array( Boolean(1), Boolean(0))).toString()",
+ "true,false",
+ (new Array(Boolean(1),Boolean(0))).toString() );
+
+print(7);
+new TestCase( SECTION,
+ "(new Array(void 0,null)).toString()",
+ ",",
+ (new Array(void 0,null)).toString() );
+
+print(8);
+var EXPECT_STRING = "";
+var MYARR = new Array();
+
+for ( var i = -50; i < 50; i+= 0.25 ) {
+ print(i);
+ MYARR[MYARR.length] = i;
+ EXPECT_STRING += i +",";
+}
+
+EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 );
+
+print(9);
+new TestCase( SECTION,
+ "MYARR.toString()",
+ EXPECT_STRING,
+ MYARR.toString() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.3-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.3-1.js
new file mode 100644
index 0000000000..ff97512a44
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.3-1.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.3-1.js';
+
+/**
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.join()
+ Description: The elements of this object are converted to strings and
+ these strings are then concatenated, separated by comma
+ characters. The result is the same as if the built-in join
+ method were invoiked for this object with no argument.
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 07 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155285
+ ECMA-262 Ed.3 Section 15.4.4.5 Array.prototype.join()
+ Step 3: If |separator| is |undefined|, let |separator|
+ be the single-character string ","
+ *
+ */
+
+var SECTION = "15.4.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Array.prototype.join()");
+
+var ARR_PROTOTYPE = Array.prototype;
+
+new TestCase( SECTION, "Array.prototype.join.length", 1, Array.prototype.join.length );
+new TestCase( SECTION, "delete Array.prototype.join.length", false, delete Array.prototype.join.length );
+new TestCase( SECTION, "delete Array.prototype.join.length; Array.prototype.join.length", 1, eval("delete Array.prototype.join.length; Array.prototype.join.length") );
+
+// case where array length is 0
+
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(); TEST_ARRAY.join()",
+ "",
+ eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join()") );
+
+// array length is 0, but spearator is specified
+
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')",
+ "",
+ eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')") );
+
+// length is greater than 0, separator is supplied
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')",
+ "&&true&false&123&[object Object]&true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')") );
+
+// length is greater than 0, separator is empty string
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')",
+ "truefalse123[object Object]true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')") );
+
+// length is greater than 0, separator is undefined
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)",
+ ",,true,false,123,[object Object],true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)") );
+
+// length is greater than 0, separator is not supplied
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()",
+ ",,true,false,123,[object Object],true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()") );
+
+// separator is a control character
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')",
+ decodeURIComponent("%0B%0Btrue%0Bfalse%0B123%0B[object Object]%0Btrue"),
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')") );
+
+// length of array is 1
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(true) ); TEST_ARRAY.join('\v')",
+ "true",
+ eval("var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\v')") );
+
+
+SEPARATOR = "\t"
+ TEST_LENGTH = 100;
+TEST_STRING = "";
+ARGUMENTS = "";
+TEST_RESULT = "";
+
+for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += ( index == TEST_LENGTH -1 ) ? "" : ",";
+
+ TEST_RESULT += index;
+ TEST_RESULT += ( index == TEST_LENGTH -1 ) ? "" : SEPARATOR;
+}
+
+TEST_ARRAY = eval( "new Array( "+ARGUMENTS +")" );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.join("+SEPARATOR+")",
+ TEST_RESULT,
+ TEST_ARRAY.join( SEPARATOR ) );
+
+new TestCase( SECTION,
+ "(new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join()",
+ "true,false,,,1e+21,1e-7",
+ (new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join() );
+
+// this is not an Array object
+new TestCase( SECTION,
+ "var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')",
+ "true:false:111:0.5:1230000:NaN::",
+ eval("var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')") );
+
+test();
+
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.join;
+ this.getClass = Object.prototype.toString;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-1.js
new file mode 100644
index 0000000000..503d7e635e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-1.js
@@ -0,0 +1,294 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.4-1.js';
+
+/**
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
+ Description:
+
+ The elements of the array are rearranged so as to reverse their order.
+ This object is returned as the result of the call.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 3. Compute floor(Result(2)/2).
+ 4. Let k be 0.
+ 5. If k equals Result(3), return this object.
+ 6. Compute Result(2)k1.
+ 7. Call ToString(k).
+ 8. ToString(Result(6)).
+ 9. Call the [[Get]] method of this object with argument Result(7).
+ 10. Call the [[Get]] method of this object with argument Result(8).
+ 11. If this object has a property named by Result(8), go to step 12; but
+ if this object has no property named by Result(8), then go to either
+ step 12 or step 14, depending on the implementation.
+ 12. Call the [[Put]] method of this object with arguments Result(7) and
+ Result(10).
+ 13. Go to step 15.
+ 14. Call the [[Delete]] method on this object, providing Result(7) as the
+ name of the property to delete.
+ 15. If this object has a property named by Result(7), go to step 16; but if
+ this object has no property named by Result(7), then go to either step 16
+ or step 18, depending on the implementation.
+ 16. Call the [[Put]] method of this object with arguments Result(8) and
+ Result(9).
+ 17. Go to step 19.
+ 18. Call the [[Delete]] method on this object, providing Result(8) as the
+ name of the property to delete.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+
+ Note that the reverse function is intentionally generic; it does not require
+ that its this value be an Array object. Therefore it can be transferred to other
+ kinds of objects for use as a method. Whether the reverse function can be applied
+ successfully to a host object is implementation dependent.
+
+ Note: Array.prototype.reverse allows some flexibility in implementation
+ regarding array indices that have not been populated. This test covers the
+ cases in which unpopulated indices are not deleted, since the JavaScript
+ implementation does not delete uninitialzed indices.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.4.4.4-1";
+var VERSION = "ECMA_1";
+var BUGNUMBER="123724";
+startTest();
+
+writeHeaderToLog( SECTION + " Array.prototype.reverse()");
+
+var ARR_PROTOTYPE = Array.prototype;
+
+new TestCase( SECTION,
+ "Array.prototype.reverse.length",
+ 0,
+ Array.prototype.reverse.length );
+
+new TestCase( SECTION,
+ "delete Array.prototype.reverse.length",
+ false,
+ delete Array.prototype.reverse.length );
+
+new TestCase( SECTION,
+ "delete Array.prototype.reverse.length; Array.prototype.reverse.length",
+ 0,
+ eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
+
+// length of array is 0
+new TestCase( SECTION,
+ "var A = new Array(); A.reverse(); A.length",
+ 0,
+ eval("var A = new Array(); A.reverse(); A.length") );
+
+// length of array is 1
+var A = new Array(true);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ "var A = new Array(true); A.reverse(); A.length",
+ R.length,
+ eval("var A = new Array(true); A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+// length of array is 2
+var S = "var A = new Array( true,false )";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+// length of array is 3
+var S = "var A = new Array( true,false,null )";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+// length of array is 4
+var S = "var A = new Array( true,false,null,void 0 )";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+CheckItems( R, A );
+
+
+// some array indexes have not been set
+var S = "var A = new Array(); A[8] = 'hi', A[3] = 'yo'";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+
+var OBJECT_OBJECT = new Object();
+var FUNCTION_OBJECT = new Function( 'return this' );
+var BOOLEAN_OBJECT = new Boolean;
+var DATE_OBJECT = new Date(0);
+var STRING_OBJECT = new String('howdy');
+var NUMBER_OBJECT = new Number(Math.PI);
+var ARRAY_OBJECT= new Array(1000);
+
+var args = "null, void 0, Math.pow(2,32), 1.234e-32, OBJECT_OBJECT, BOOLEAN_OBJECT, FUNCTION_OBJECT, DATE_OBJECT, STRING_OBJECT,"+
+ "ARRAY_OBJECT, NUMBER_OBJECT, Math, true, false, 123, '90210'";
+
+var S = "var A = new Array("+args+")";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+var limit = 1000;
+var args = "";
+for (var i = 0; i < limit; i++ ) {
+ args += i +"";
+ if ( i + 1 < limit ) {
+ args += ",";
+ }
+}
+
+var S = "var A = new Array("+args+")";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+var S = "var MYOBJECT = new Object_1( \"void 0, 1, null, 2, \'\'\" )";
+eval(S);
+var R = Reverse( A );
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+test();
+
+function CheckItems( R, A ) {
+ for ( var i = 0; i < R.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "]",
+ R[i],
+ A[i] );
+ }
+}
+
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
+
+function Reverse( array ) {
+ var r2 = array.length;
+ var k = 0;
+ var r3 = Math.floor( r2/2 );
+ if ( r3 == k ) {
+ return array;
+ }
+
+ for ( k = 0; k < r3; k++ ) {
+ var r6 = r2 - k - 1;
+// var r7 = String( k );
+ var r7 = k;
+ var r8 = String( r6 );
+
+ var r9 = array[r7];
+ var r10 = array[r8];
+
+ array[r7] = r10;
+ array[r8] = r9;
+ }
+
+ return array;
+}
+
+function Iterate( array ) {
+ for ( var i = 0; i < array.length; i++ ) {
+// print( i+": "+ array[String(i)] );
+ }
+}
+
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = this.array[i];
+ }
+ this.reverse = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-2.js
new file mode 100644
index 0000000000..a9b7b0ec14
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.4-2.js
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.4-2.js';
+
+/**
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
+ Description:
+
+ The elements of the array are rearranged so as to reverse their order.
+ This object is returned as the result of the call.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 3. Compute floor(Result(2)/2).
+ 4. Let k be 0.
+ 5. If k equals Result(3), return this object.
+ 6. Compute Result(2)k1.
+ 7. Call ToString(k).
+ 8. ToString(Result(6)).
+ 9. Call the [[Get]] method of this object with argument Result(7).
+ 10. Call the [[Get]] method of this object with argument Result(8).
+ 11. If this object has a property named by Result(8), go to step 12; but
+ if this object has no property named by Result(8), then go to either
+ step 12 or step 14, depending on the implementation.
+ 12. Call the [[Put]] method of this object with arguments Result(7) and
+ Result(10).
+ 13. Go to step 15.
+ 14. Call the [[Delete]] method on this object, providing Result(7) as the
+ name of the property to delete.
+ 15. If this object has a property named by Result(7), go to step 16; but if
+ this object has no property named by Result(7), then go to either step 16
+ or step 18, depending on the implementation.
+ 16. Call the [[Put]] method of this object with arguments Result(8) and
+ Result(9).
+ 17. Go to step 19.
+ 18. Call the [[Delete]] method on this object, providing Result(8) as the
+ name of the property to delete.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+
+ Note that the reverse function is intentionally generic; it does not require
+ that its this value be an Array object. Therefore it can be transferred to other
+ kinds of objects for use as a method. Whether the reverse function can be applied
+ successfully to a host object is implementation dependent.
+
+ Note: Array.prototype.reverse allows some flexibility in implementation
+ regarding array indices that have not been populated. This test covers the
+ cases in which unpopulated indices are not deleted, since the JavaScript
+ implementation does not delete uninitialzed indices.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.4.4-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Array.prototype.reverse()");
+
+var ARR_PROTOTYPE = Array.prototype;
+
+new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length );
+new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length );
+new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
+
+// length of array is 0
+new TestCase( SECTION,
+ "var A = new Array(); A.reverse(); A.length",
+ 0,
+ eval("var A = new Array(); A.reverse(); A.length") );
+
+test();
+
+function CheckItems( R, A ) {
+ for ( var i = 0; i < R.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "]",
+ R[i],
+ A[i] );
+ }
+}
+test();
+
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
+function Reverse( array ) {
+ var r2 = array.length;
+ var k = 0;
+ var r3 = Math.floor( r2/2 );
+ if ( r3 == k ) {
+ return array;
+ }
+
+ for ( k = 0; k < r3; k++ ) {
+ var r6 = r2 - k - 1;
+// var r7 = String( k );
+ var r7 = k;
+ var r8 = String( r6 );
+
+ var r9 = array[r7];
+ var r10 = array[r8];
+
+ array[r7] = r10;
+ array[r8] = r9;
+ }
+
+ return array;
+}
+function Iterate( array ) {
+ for ( var i = 0; i < array.length; i++ ) {
+// print( i+": "+ array[String(i)] );
+ }
+}
+
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = this.array[i];
+ }
+ this.reverse = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-1.js
new file mode 100644
index 0000000000..a3a521da09
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-1.js
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.5-1.js';
+
+/**
+ File Name: 15.4.4.5.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
+
+ This test file tests cases in which the compare function is not supplied.
+
+ The elements of this array are sorted. The sort is not necessarily stable.
+ If comparefn is provided, it should be a function that accepts two arguments
+ x and y and returns a negative value if x < y, zero if x = y, or a positive
+ value if x > y.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 1. Perform an implementation-dependent sequence of calls to the
+ [[Get]] , [[Put]], and [[Delete]] methods of this object and
+ toSortCompare (described below), where the first argument for each call
+ to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
+ than Result(2) and where the arguments for calls to SortCompare are
+ results of previous calls to the [[Get]] method. After this sequence
+ is complete, this object must have the following two properties.
+ (1) There must be some mathematical permutation of the nonnegative
+ integers less than Result(2), such that for every nonnegative integer
+ j less than Result(2), if property old[j] existed, then new[(j)] is
+ exactly the same value as old[j],. but if property old[j] did not exist,
+ then new[(j)] either does not exist or exists with value undefined.
+ (2) If comparefn is not supplied or is a consistent comparison
+ function for the elements of this array, then for all nonnegative
+ integers j and k, each less than Result(2), if old[j] compares less
+ than old[k] (see SortCompare below), then (j) < (k). Here we use the
+ notation old[j] to refer to the hypothetical result of calling the [
+ [Get]] method of this object with argument j before this step is
+ executed, and the notation new[j] to refer to the hypothetical result
+ of calling the [[Get]] method of this object with argument j after this
+ step has been completely executed. A function is a consistent
+ comparison function for a set of values if (a) for any two of those
+ values (possibly the same value) considered as an ordered pair, it
+ always returns the same value when given that pair of values as its
+ two arguments, and the result of applying ToNumber to this value is
+ not NaN; (b) when considered as a relation, where the pair (x, y) is
+ considered to be in the relation if and only if applying the function
+ to x and y and then applying ToNumber to the result produces a
+ negative value, this relation is a partial order; and (c) when
+ considered as a different relation, where the pair (x, y) is considered
+ to be in the relation if and only if applying the function to x and y
+ and then applying ToNumber to the result produces a zero value (of either
+ sign), this relation is an equivalence relation. In this context, the
+ phrase "x compares less than y" means applying Result(2) to x and y and
+ then applying ToNumber to the result produces a negative value.
+ 3.Return this object.
+
+ When the SortCompare operator is called with two arguments x and y, the following steps are taken:
+ 1.If x and y are both undefined, return +0.
+ 2.If x is undefined, return 1.
+ 3.If y is undefined, return 1.
+ 4.If the argument comparefn was not provided in the call to sort, go to step 7.
+ 5.Call comparefn with arguments x and y.
+ 6.Return Result(5).
+ 7.Call ToString(x).
+ 8.Call ToString(y).
+ 9.If Result(7) < Result(8), return 1.
+ 10.If Result(7) > Result(8), return 1.
+ 11.Return +0.
+
+ Note that, because undefined always compared greater than any other value, undefined and nonexistent
+ property values always sort to the end of the result. It is implementation-dependent whether or not such
+ properties will exist or not at the end of the array when the sort is concluded.
+
+ Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
+ Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
+ applied successfully to a host object is implementation dependent .
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+var SECTION = "15.4.4.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.sort(comparefn)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+var S = new Array();
+var item = 0;
+
+// array is empty.
+S[item++] = "var A = new Array()";
+
+// array contains one item
+S[item++] = "var A = new Array( true )";
+
+// length of array is 2
+S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
+
+S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
+
+S[item] = "var A = new Array( ";
+
+var limit = 0x0061;
+for ( var i = 0x007A; i >= limit; i-- ) {
+ S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
+ if ( i > limit ) {
+ S[item] += ",";
+ }
+}
+
+S[item] += ")";
+
+item++;
+
+for ( var i = 0; i < S.length; i++ ) {
+ CheckItems( S[i] );
+}
+
+test();
+
+function CheckItems( S ) {
+ eval( S );
+ var E = Sort( A );
+
+ new TestCase( SECTION,
+ S +"; A.sort(); A.length",
+ E.length,
+ eval( S + "; A.sort(); A.length") );
+
+ for ( var i = 0; i < E.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "].toString()",
+ E[i] +"",
+ A[i] +"");
+
+ if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
+ new TestCase(
+ SECTION,
+ "typeof A["+i+ "]",
+ typeof E[i],
+ typeof A[i] );
+ }
+ }
+}
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.sort = Array.prototype.sort;
+ this.getClass = Object.prototype.toString;
+}
+function Sort( a ) {
+ for ( i = 0; i < a.length; i++ ) {
+ for ( j = i+1; j < a.length; j++ ) {
+ var lo = a[i];
+ var hi = a[j];
+ var c = Compare( lo, hi );
+ if ( c == 1 ) {
+ a[i] = hi;
+ a[j] = lo;
+ }
+ }
+ }
+ return a;
+}
+function Compare( x, y ) {
+ if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
+ return +0;
+ }
+ if ( x == void 0 && typeof x == "undefined" ) {
+ return 1;
+ }
+ if ( y == void 0 && typeof y == "undefined" ) {
+ return -1;
+ }
+ x = String(x);
+ y = String(y);
+ if ( x < y ) {
+ return -1;
+ }
+ if ( x > y ) {
+ return 1;
+ }
+ return 0;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-2.js
new file mode 100644
index 0000000000..301c435d15
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-2.js
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.5-2.js';
+
+/**
+ File Name: 15.4.4.5-2.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
+
+ This test file tests cases in which the compare function is supplied.
+ In this cases, the sort creates a reverse sort.
+
+ The elements of this array are sorted. The sort is not necessarily stable.
+ If comparefn is provided, it should be a function that accepts two arguments
+ x and y and returns a negative value if x < y, zero if x = y, or a positive
+ value if x > y.
+
+ 1. Call the [[Get]] method of this object with argument "length".
+ 2. Call ToUint32(Result(1)).
+ 1. Perform an implementation-dependent sequence of calls to the
+ [[Get]] , [[Put]], and [[Delete]] methods of this object and
+ toSortCompare (described below), where the first argument for each call
+ to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
+ than Result(2) and where the arguments for calls to SortCompare are
+ results of previous calls to the [[Get]] method. After this sequence
+ is complete, this object must have the following two properties.
+ (1) There must be some mathematical permutation of the nonnegative
+ integers less than Result(2), such that for every nonnegative integer
+ j less than Result(2), if property old[j] existed, then new[(j)] is
+ exactly the same value as old[j],. but if property old[j] did not exist,
+ then new[(j)] either does not exist or exists with value undefined.
+ (2) If comparefn is not supplied or is a consistent comparison
+ function for the elements of this array, then for all nonnegative
+ integers j and k, each less than Result(2), if old[j] compares less
+ than old[k] (see SortCompare below), then (j) < (k). Here we use the
+ notation old[j] to refer to the hypothetical result of calling the [
+ [Get]] method of this object with argument j before this step is
+ executed, and the notation new[j] to refer to the hypothetical result
+ of calling the [[Get]] method of this object with argument j after this
+ step has been completely executed. A function is a consistent
+ comparison function for a set of values if (a) for any two of those
+ values (possibly the same value) considered as an ordered pair, it
+ always returns the same value when given that pair of values as its
+ two arguments, and the result of applying ToNumber to this value is
+ not NaN; (b) when considered as a relation, where the pair (x, y) is
+ considered to be in the relation if and only if applying the function
+ to x and y and then applying ToNumber to the result produces a
+ negative value, this relation is a partial order; and (c) when
+ considered as a different relation, where the pair (x, y) is considered
+ to be in the relation if and only if applying the function to x and y
+ and then applying ToNumber to the result produces a zero value (of either
+ sign), this relation is an equivalence relation. In this context, the
+ phrase "x compares less than y" means applying Result(2) to x and y and
+ then applying ToNumber to the result produces a negative value.
+ 3.Return this object.
+
+ When the SortCompare operator is called with two arguments x and y, the following steps are taken:
+ 1.If x and y are both undefined, return +0.
+ 2.If x is undefined, return 1.
+ 3.If y is undefined, return 1.
+ 4.If the argument comparefn was not provided in the call to sort, go to step 7.
+ 5.Call comparefn with arguments x and y.
+ 6.Return Result(5).
+ 7.Call ToString(x).
+ 8.Call ToString(y).
+ 9.If Result(7) < Result(8), return 1.
+ 10.If Result(7) > Result(8), return 1.
+ 11.Return +0.
+
+ Note that, because undefined always compared greater than any other value, undefined and nonexistent
+ property values always sort to the end of the result. It is implementation-dependent whether or not such
+ properties will exist or not at the end of the array when the sort is concluded.
+
+ Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
+ Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
+ applied successfully to a host object is implementation dependent .
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+var SECTION = "15.4.4.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.sort(comparefn)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var S = new Array();
+var item = 0;
+
+// array is empty.
+S[item++] = "var A = new Array()";
+
+// array contains one item
+S[item++] = "var A = new Array( true )";
+
+// length of array is 2
+S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
+
+S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
+
+S[item] = "var A = new Array( ";
+
+var limit = 0x0061;
+for ( var i = 0x007A; i >= limit; i-- ) {
+ S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
+ if ( i > limit ) {
+ S[item] += ",";
+ }
+}
+
+S[item] += ")";
+
+for ( var i = 0; i < S.length; i++ ) {
+ CheckItems( S[i] );
+}
+
+test();
+
+function CheckItems( S ) {
+ eval( S );
+ var E = Sort( A );
+
+ new TestCase( SECTION,
+ S +"; A.sort(Compare); A.length",
+ E.length,
+ eval( S + "; A.sort(Compare); A.length") );
+
+ for ( var i = 0; i < E.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "].toString()",
+ E[i] +"",
+ A[i] +"");
+
+ if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
+ new TestCase(
+ SECTION,
+ "typeof A["+i+ "]",
+ typeof E[i],
+ typeof A[i] );
+ }
+ }
+}
+function Object_1( value ) {
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.sort = Array.prototype.sort;
+ this.getClass = Object.prototype.toString;
+}
+function Sort( a ) {
+ var r1 = a.length;
+ for ( i = 0; i < a.length; i++ ) {
+ for ( j = i+1; j < a.length; j++ ) {
+ var lo = a[i];
+ var hi = a[j];
+ var c = Compare( lo, hi );
+ if ( c == 1 ) {
+ a[i] = hi;
+ a[j] = lo;
+ }
+ }
+ }
+ return a;
+}
+function Compare( x, y ) {
+ if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
+ return +0;
+ }
+ if ( x == void 0 && typeof x == "undefined" ) {
+ return 1;
+ }
+ if ( y == void 0 && typeof y == "undefined" ) {
+ return -1;
+ }
+ x = String(x);
+ y = String(y);
+ if ( x < y ) {
+ return 1;
+ }
+ if ( x > y ) {
+ return -1;
+ }
+ return 0;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-3.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-3.js
new file mode 100644
index 0000000000..984d2fe80a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.5-3.js
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.5-3.js';
+
+/**
+ File Name: 15.4.4.5-3.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
+
+ This is a regression test for
+ http://scopus/bugsplat/show_bug.cgi?id=117144
+
+ Verify that sort is successfull, even if the sort compare function returns
+ a very large negative or positive value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+var SECTION = "15.4.4.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.sort(comparefn)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var array = new Array();
+
+array[array.length] = new Date( TIME_2000 * Math.PI );
+array[array.length] = new Date( TIME_2000 * 10 );
+array[array.length] = new Date( TIME_1900 + TIME_1900 );
+array[array.length] = new Date(0);
+array[array.length] = new Date( TIME_2000 );
+array[array.length] = new Date( TIME_1900 + TIME_1900 +TIME_1900 );
+array[array.length] = new Date( TIME_1900 * Math.PI );
+array[array.length] = new Date( TIME_1900 * 10 );
+array[array.length] = new Date( TIME_1900 );
+array[array.length] = new Date( TIME_2000 + TIME_2000 );
+array[array.length] = new Date( 1899, 0, 1 );
+array[array.length] = new Date( 2000, 1, 29 );
+array[array.length] = new Date( 2000, 0, 1 );
+array[array.length] = new Date( 1999, 11, 31 );
+
+var testarr1 = new Array();
+clone( array, testarr1 );
+testarr1.sort( comparefn1 );
+
+var testarr2 = new Array();
+clone( array, testarr2 );
+testarr2.sort( comparefn2 );
+
+testarr3 = new Array();
+clone( array, testarr3 );
+testarr3.sort( comparefn3 );
+
+// when there's no sort function, sort sorts by the toString value of Date.
+
+var testarr4 = new Array();
+clone( array, testarr4 );
+testarr4.sort();
+
+var realarr = new Array();
+clone( array, realarr );
+realarr.sort( realsort );
+
+var stringarr = new Array();
+clone( array, stringarr );
+stringarr.sort( stringsort );
+
+for ( var i = 0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr1["+i+"]",
+ realarr[i],
+ testarr1[i] );
+}
+
+for ( var i=0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr2["+i+"]",
+ realarr[i],
+ testarr2[i] );
+}
+
+for ( var i=0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr3["+i+"]",
+ realarr[i],
+ testarr3[i] );
+}
+
+for ( var i=0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr4["+i+"]",
+ stringarr[i].toString(),
+ testarr4[i].toString() );
+}
+
+test();
+
+function comparefn1( x, y ) {
+ return x - y;
+}
+function comparefn2( x, y ) {
+ return x.valueOf() - y.valueOf();
+}
+function realsort( x, y ) {
+ return ( x.valueOf() == y.valueOf() ? 0 : ( x.valueOf() > y.valueOf() ? 1 : -1 ) );
+}
+function comparefn3( x, y ) {
+ return ( x == y ? 0 : ( x > y ? 1: -1 ) );
+}
+function clone( source, target ) {
+ for (i = 0; i < source.length; i++ ) {
+ target[i] = source[i];
+ }
+}
+function stringsort( x, y ) {
+ for ( var i = 0; i < x.toString().length; i++ ) {
+ var d = (x.toString()).charCodeAt(i) - (y.toString()).charCodeAt(i);
+ if ( d > 0 ) {
+ return 1;
+ } else {
+ if ( d < 0 ) {
+ return -1;
+ } else {
+ continue;
+ }
+ }
+
+ var d = x.length - y.length;
+
+ if ( d > 0 ) {
+ return 1;
+ } else {
+ if ( d < 0 ) {
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.js
new file mode 100644
index 0000000000..2ab2072098
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.4.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.4.js';
+
+/**
+ File Name: 15.4.4.js
+ ECMA Section: 15.4.4 Properties of the Array Prototype Object
+ Description: The value of the internal [[Prototype]] property of
+ the Array prototype object is the Object prototype
+ object.
+
+ Note that the Array prototype object is itself an
+ array; it has a length property (whose initial value
+ is (0) and the special [[Put]] method.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Array Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "Array.prototype.length", 0, Array.prototype.length );
+
+// verify that prototype object is an Array object.
+new TestCase( SECTION, "typeof Array.prototype", "object", typeof Array.prototype );
+
+new TestCase( SECTION,
+ "Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()",
+ "[object Array]",
+ eval("Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-1.js
new file mode 100644
index 0000000000..090300d59b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-1.js
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.5.1-1.js';
+
+/**
+ File Name: 15.4.5.1-1.js
+ ECMA Section: [[ Put]] (P, V)
+ Description:
+ Array objects use a variation of the [[Put]] method used for other native
+ ECMAScript objects (section 8.6.2.2).
+
+ Assume A is an Array object and P is a string.
+
+ When the [[Put]] method of A is called with property P and value V, the
+ following steps are taken:
+
+ 1. Call the [[CanPut]] method of A with name P.
+ 2. If Result(1) is false, return.
+ 3. If A doesn't have a property with name P, go to step 7.
+ 4. If P is "length", go to step 12.
+ 5. Set the value of property P of A to V.
+ 6. Go to step 8.
+ 7. Create a property with name P, set its value to V and give it empty
+ attributes.
+ 8. If P is not an array index, return.
+ 9. If A itself has a property (not an inherited property) named "length",
+ andToUint32(P) is less than the value of the length property of A, then
+ return.
+ 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
+ 11. Return.
+ 12. Compute ToUint32(V).
+ 13. For every integer k that is less than the value of the length property
+ of A but not less than Result(12), if A itself has a property (not an
+ inherited property) named ToString(k), then delete that property.
+ 14. Set the value of property P of A to Result(12).
+ 15. Return.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.4.5.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array [[Put]] (P, V)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// P is "length"
+
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 1000; A.length",
+ 1000,
+ eval("var A = new Array(); A.length = 1000; A.length") );
+
+// A has Property P, and P is not length or an array index
+new TestCase( SECTION,
+ "var A = new Array(1000); A.name = 'name of this array'; A.name",
+ 'name of this array',
+ eval("var A = new Array(1000); A.name = 'name of this array'; A.name") );
+
+new TestCase( SECTION,
+ "var A = new Array(1000); A.name = 'name of this array'; A.length",
+ 1000,
+ eval("var A = new Array(1000); A.name = 'name of this array'; A.length") );
+
+
+// A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the
+// value of length
+
+new TestCase( SECTION,
+ "var A = new Array(1000); A[123] = 'hola'; A[123]",
+ 'hola',
+ eval("var A = new Array(1000); A[123] = 'hola'; A[123]") );
+
+new TestCase( SECTION,
+ "var A = new Array(1000); A[123] = 'hola'; A.length",
+ 1000,
+ eval("var A = new Array(1000); A[123] = 'hola'; A.length") );
+
+
+for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) {
+ TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'";
+ if ( i < 0x00FF - 1 ) {
+ TEST_STRING += ",";
+ } else {
+ TEST_STRING += ");"
+ }
+}
+
+var LENGTH = 0x00ff - 0x0020;
+
+new TestCase( SECTION,
+ TEST_STRING +" A[150] = 'hello'; A[150]",
+ 'hello',
+ eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) );
+
+new TestCase( SECTION,
+ TEST_STRING +" A[150] = 'hello'; A[150]",
+ LENGTH,
+ eval( TEST_STRING + " A[150] = 'hello'; A.length" ) );
+
+// A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the
+// value of length
+
+new TestCase( SECTION,
+ "var A = new Array(); A[123] = true; A.length",
+ 124,
+ eval("var A = new Array(); A[123] = true; A.length") );
+
+new TestCase( SECTION,
+ "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length",
+ 16,
+ eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") );
+
+for ( var i = 0; i < A.length; i++ ) {
+ new TestCase( SECTION,
+ "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]",
+ (i <= 10) ? i : ( i == 15 ? '15' : void 0 ),
+ A[i] );
+}
+// P is not an array index, and P is not "length"
+
+new TestCase( SECTION,
+ "var A = new Array(); A.join.length = 4; A.join.length",
+ 1,
+ eval("var A = new Array(); A.join.length = 4; A.join.length") );
+
+new TestCase( SECTION,
+ "var A = new Array(); A.join.length = 4; A.length",
+ 0,
+ eval("var A = new Array(); A.join.length = 4; A.length") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-2.js
new file mode 100644
index 0000000000..2966a00456
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.1-2.js
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.5.1-2.js';
+
+/**
+ File Name: 15.4.5.1-2.js
+ ECMA Section: [[ Put]] (P, V)
+ Description:
+ Array objects use a variation of the [[Put]] method used for other native
+ ECMAScript objects (section 8.6.2.2).
+
+ Assume A is an Array object and P is a string.
+
+ When the [[Put]] method of A is called with property P and value V, the
+ following steps are taken:
+
+ 1. Call the [[CanPut]] method of A with name P.
+ 2. If Result(1) is false, return.
+ 3. If A doesn't have a property with name P, go to step 7.
+ 4. If P is "length", go to step 12.
+ 5. Set the value of property P of A to V.
+ 6. Go to step 8.
+ 7. Create a property with name P, set its value to V and give it empty
+ attributes.
+ 8. If P is not an array index, return.
+ 9. If A itself has a property (not an inherited property) named "length",
+ andToUint32(P) is less than the value of the length property of A, then
+ return.
+ 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
+ 11. Return.
+ 12. Compute ToUint32(V).
+ 13. For every integer k that is less than the value of the length property
+ of A but not less than Result(12), if A itself has a property (not an
+ inherited property) named ToString(k), then delete that property.
+ 14. Set the value of property P of A to Result(12).
+ 15. Return.
+
+
+ These are gTestcases from Waldemar, detailed in
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552
+
+ Author: christine@netscape.com
+ Date: 15 June 1998
+*/
+
+var SECTION = "15.4.5.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array [[Put]] (P,V)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var a = new Array();
+
+AddCase( "3.00", "three" );
+AddCase( "00010", "eight" );
+AddCase( "37xyz", "thirty-five" );
+AddCase("5000000000", 5)
+ AddCase( "-2", -3 );
+
+new TestCase( SECTION,
+ "a[10]",
+ void 0,
+ a[10] );
+
+new TestCase( SECTION,
+ "a[3]",
+ void 0,
+ a[3] );
+
+a[4] = "four";
+
+new TestCase( SECTION,
+ "a[4] = \"four\"; a[4]",
+ "four",
+ a[4] );
+
+new TestCase( SECTION,
+ "a[\"4\"]",
+ "four",
+ a["4"] );
+
+new TestCase( SECTION,
+ "a[\"4.00\"]",
+ void 0,
+ a["4.00"] );
+
+new TestCase( SECTION,
+ "a.length",
+ 5,
+ a.length );
+
+
+a["5000000000"] = 5;
+
+new TestCase( SECTION,
+ "a[\"5000000000\"] = 5; a.length",
+ 5,
+ a.length );
+
+new TestCase( SECTION,
+ "a[\"-2\"] = -3; a.length",
+ 5,
+ a.length );
+
+test();
+
+function AddCase ( arg, value ) {
+
+ a[arg] = value;
+
+ new TestCase( SECTION,
+ "a[\"" + arg + "\"] = "+ value +"; a.length",
+ 0,
+ a.length );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-1.js
new file mode 100644
index 0000000000..ff15f9d4e8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-1.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.5.2-1.js';
+
+/**
+ File Name: 15.4.5.2-1.js
+ ECMA Section: Array.length
+ Description:
+ 15.4.5.2 length
+ The length property of this Array object is always numerically greater
+ than the name of every property whose name is an array index.
+
+ The length property has the attributes { DontEnum, DontDelete }.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.4.5.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.length";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var A = new Array(); A.length",
+ 0,
+ eval("var A = new Array(); A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length",
+ Math.pow(2,32)-1,
+ eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; A.length",
+ 123,
+ eval("var A = new Array(); A.length = 123; A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS",
+ "",
+ eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; delete A.length",
+ false ,
+ eval("var A = new Array(); A.length = 123; delete A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; delete A.length; A.length",
+ 123,
+ eval("var A = new Array(); A.length = 123; delete A.length; A.length") );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-2.js
new file mode 100644
index 0000000000..56a400ab49
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/15.4.5.2-2.js
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.5.2-2.js';
+
+/**
+ File Name: 15.4.5.2-2.js
+ ECMA Section: Array.length
+ Description:
+ 15.4.5.2 length
+ The length property of this Array object is always numerically greater
+ than the name of every property whose name is an array index.
+
+ The length property has the attributes { DontEnum, DontDelete }.
+
+ This test verifies that the Array.length property is not Read Only.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.4.5.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.length";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addCase( new Array(), 0, Math.pow(2,14), Math.pow(2,14) );
+
+addCase( new Array(), 0, 1, 1 );
+
+addCase( new Array(Math.pow(2,12)), Math.pow(2,12), 0, 0 );
+addCase( new Array(Math.pow(2,13)), Math.pow(2,13), Math.pow(2,12), Math.pow(2,12) );
+addCase( new Array(Math.pow(2,12)), Math.pow(2,12), Math.pow(2,12), Math.pow(2,12) );
+addCase( new Array(Math.pow(2,14)), Math.pow(2,14), Math.pow(2,12), Math.pow(2,12) )
+
+// some tests where array is not empty
+// array is populated with strings
+ for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) {
+ arg += String(i) + ( i != Math.pow(2,12)-1 ? "," : "" );
+
+ }
+// print(i +":"+arg);
+
+var a = eval( "new Array("+arg+")" );
+
+addCase( a, i, i, i );
+addCase( a, i, Math.pow(2,12)+i+1, Math.pow(2,12)+i+1, true );
+addCase( a, Math.pow(2,12)+5, 0, 0, true );
+
+test();
+
+function addCase( object, old_len, set_len, new_len, checkitems ) {
+ object.length = set_len;
+
+ new TestCase( SECTION,
+ "array = new Array("+ old_len+"); array.length = " + set_len +
+ "; array.length",
+ new_len,
+ object.length );
+
+ if ( checkitems ) {
+ // verify that items between old and newlen are all undefined
+ if ( new_len < old_len ) {
+ var passed = true;
+ for ( var i = new_len; i < old_len; i++ ) {
+ if ( object[i] != void 0 ) {
+ passed = false;
+ }
+ }
+ new TestCase( SECTION,
+ "verify that array items have been deleted",
+ true,
+ passed );
+ }
+ if ( new_len > old_len ) {
+ var passed = true;
+ for ( var i = old_len; i < new_len; i++ ) {
+ if ( object[i] != void 0 ) {
+ passed = false;
+ }
+ }
+ new TestCase( SECTION,
+ "verify that new items are undefined",
+ true,
+ passed );
+ }
+ }
+
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/browser.js b/tests/auto/qml/parserstress/tests/ecma/Array/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Array/shell.js b/tests/auto/qml/parserstress/tests/ecma/Array/shell.js
new file mode 100644
index 0000000000..9480d9e77d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Array/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Array';
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.1.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.1.js
new file mode 100644
index 0000000000..b698cbe407
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.1.js
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.1.js';
+
+/**
+ File Name: 15.6.1.js
+ ECMA Section: 15.6.1 The Boolean Function
+ 15.6.1.1 Boolean( value )
+ 15.6.1.2 Boolean ()
+ Description: Boolean( value ) should return a Boolean value
+ not a Boolean object) computed by
+ Boolean.toBooleanValue( value)
+
+ 15.6.1.2 Boolean() returns false
+
+ Author: christine@netscape.com
+ Date: 27 jun 1997
+
+
+ Data File Fields:
+ VALUE Argument passed to the Boolean function
+ TYPE typeof VALUE (not used, but helpful in understanding
+ the data file)
+ E_RETURN Expected return value of Boolean( VALUE )
+*/
+var SECTION = "15.6.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var array = new Array();
+var item = 0;
+
+new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
+new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
+new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
+new TestCase( SECTION, "Boolean('1')", true, Boolean("1") );
+new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
+new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") );
+new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
+new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
+
+new TestCase( SECTION, "Boolean('true')", true, Boolean("true") );
+new TestCase( SECTION, "Boolean('false')", true, Boolean("false") );
+new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
+
+new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
+new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) );
+new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) );
+new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) );
+new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) );
+new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) );
+new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) );
+new TestCase( SECTION, "Boolean()", false, Boolean() );
+// array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.2.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.2.js
new file mode 100644
index 0000000000..f9fccb3e57
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.2.js
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.2.js';
+
+/**
+ File Name: 15.6.2.js
+ ECMA Section: 15.6.2 The Boolean Constructor
+ 15.6.2.1 new Boolean( value )
+ 15.6.2.2 new Boolean()
+
+ This test verifies that the Boolean constructor
+ initializes a new object (typeof should return
+ "object"). The prototype of the new object should
+ be Boolean.prototype. The value of the object
+ should be ToBoolean( value ) (a boolean value).
+
+ Description:
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+var SECTION = "15.6.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var array = new Array();
+var item = 0;
+
+new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) );
+new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) );
+new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) );
+new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) );
+new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() );
+new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') );
+new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() );
+new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') );
+new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() );
+new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') );
+new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) );
+new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) );
+new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) );
+new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) );
+new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
+new TestCase( "15.6.2.2",
+ "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() );
+new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-1.js
new file mode 100644
index 0000000000..0be8097487
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-1.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.3.1-1.js';
+
+/**
+ File Name: 15.6.3.1-1.js
+ ECMA Section: 15.6.3 Boolean.prototype
+
+ Description: The initial value of Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the DontEnum property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+var SECTION = "15.6.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var array = new Array();
+var item = 0;
+
+new TestCase( SECTION,
+ "var str='';for ( p in Boolean ) { str += p } str;",
+ "",
+ eval("var str='';for ( p in Boolean ) { str += p } str;") );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-2.js
new file mode 100644
index 0000000000..5d435982d4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-2.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.3.1-2.js';
+
+/**
+ File Name: 15.6.3.1-2.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the DontDelete property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+var SECTION = "15.6.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype"
+ writeHeaderToLog( SECTION + TITLE );
+
+var array = new Array();
+var item = 0;
+
+new TestCase( SECTION,
+ "delete( Boolean.prototype)",
+ false,
+ delete( Boolean.prototype) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-3.js
new file mode 100644
index 0000000000..0f1b125267
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-3.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.3.1-3.js';
+
+/**
+ File Name: 15.6.3.1-3.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the DontDelete property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+var SECTION = "15.6.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype"
+ writeHeaderToLog( SECTION + TITLE );
+
+var array = new Array();
+var item = 0;
+
+new TestCase( SECTION,
+ "delete( Boolean.prototype); Boolean.prototype",
+ Boolean.prototype,
+ eval("delete( Boolean.prototype); Boolean.prototype") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-4.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-4.js
new file mode 100644
index 0000000000..822750308a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1-4.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.3.1-4.js';
+
+/**
+ File Name: 15.6.3.1-4.js
+ ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object
+
+ Description: The initial value of Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ This tests the ReadOnly property of Boolean.prototype
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+var SECTION = "15.6.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype"
+ writeHeaderToLog( SECTION + TITLE );
+
+var BOOL_PROTO = Boolean.prototype;
+
+new TestCase( SECTION,
+ "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO",
+ true,
+ eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") );
+
+new TestCase( SECTION,
+ "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null",
+ false,
+ eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1.js
new file mode 100644
index 0000000000..ca808c63a5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.3.1.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.3.1.js';
+
+/**
+ File Name: 15.6.3.1.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
+
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
+
+ It has the internal [[Call]] and [[Construct]]
+ properties (not tested), and the length property.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+
+var SECTION = "15.6.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
+new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4-1.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4-1.js
new file mode 100644
index 0000000000..584562b2a8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4-1.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4-1.js';
+
+/**
+ File Name: 15.6.4-1.js
+ ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
+
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is
+ "Boolean") whose value is false.
+
+ The value of the internal [[Prototype]] property of the Boolean prototype object
+ is the Object prototype object (15.2.3.1).
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+
+
+var VERSION = "ECMA_1"
+ startTest();
+var SECTION = "15.6.4-1";
+
+writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
+
+new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) );
+new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) );
+new TestCase( SECTION,
+ "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
+ "[object Boolean]",
+ eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
+new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.1.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.1.js
new file mode 100644
index 0000000000..3b75fb49ec
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.1.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.1.js';
+
+/**
+ File Name: 15.6.4.1.js
+ ECMA Section: 15.6.4.1 Boolean.prototype.constructor
+
+ Description: The initial value of Boolean.prototype.constructor
+ is the built-in Boolean constructor.
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+var SECTION = "15.6.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.constructor"
+ writeHeaderToLog( SECTION + TITLE );
+
+new TestCase( SECTION,
+ "( Boolean.prototype.constructor == Boolean )",
+ true ,
+ (Boolean.prototype.constructor == Boolean) );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-1.js
new file mode 100644
index 0000000000..54bd2e19d3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-1.js
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.2-1.js';
+
+/**
+ File Name: 15.6.4.2.js
+ ECMA Section: 15.6.4.2-1 Boolean.prototype.toString()
+ Description: If this boolean value is true, then the string "true"
+ is returned; otherwise this boolean value must be false,
+ and the string "false" is returned.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+var SECTION = "15.6.4.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()"
+ writeHeaderToLog( SECTION + TITLE );
+
+
+new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() );
+new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() );
+new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() );
+new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() );
+new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() );
+new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() );
+new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() );
+new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() );
+new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() );
+
+new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() );
+new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() );
+new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() );
+new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() );
+new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() );
+new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() );
+new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() );
+new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() );
+new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() );
+new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() );
+new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() );
+new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() );
+new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() );
+
+new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() );
+new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-2.js
new file mode 100644
index 0000000000..2039004472
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-2.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.2-2.js';
+
+/**
+ File Name: 15.6.4.2-2.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+var SECTION = "15.6.4.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()"
+ writeHeaderToLog( SECTION + TITLE );
+
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()",
+ "false",
+ eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") );
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()",
+ "true",
+ eval("tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()") );
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()",
+ "false",
+ eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-3.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-3.js
new file mode 100644
index 0000000000..4dcc65f21f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-3.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.2-3.js';
+
+/**
+ File Name: 15.6.4.2-3.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+
+var SECTION = "15.6.4.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()"
+ writeHeaderToLog( SECTION + TITLE );
+
+new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") );
+new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-4-n.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-4-n.js
new file mode 100644
index 0000000000..0dd3e5f349
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.2-4-n.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.2-4-n.js';
+
+/**
+ File Name: 15.6.4.2-4.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+var SECTION = "15.6.4.2-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()";
+writeHeaderToLog( SECTION +" "+ TITLE );
+
+DESCRIPTION = "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()",
+ "error",
+ eval("tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-1.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-1.js
new file mode 100644
index 0000000000..8b913e011e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-1.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.3-1.js';
+
+/**
+ File Name: 15.6.4.3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+var SECTION = "15.6.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() );
+
+new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() );
+new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
+new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() );
+new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() );
+new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() );
+new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() );
+new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() );
+new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() );
+
+new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() );
+new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() );
+new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
+new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
+new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() );
+
+new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
+new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
+new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-2.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-2.js
new file mode 100644
index 0000000000..5548a7874f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-2.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.3-2.js';
+
+/**
+ File Name: 15.6.4.3-2.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+var SECTION = "15.6.4.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") );
+
+new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-3.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-3.js
new file mode 100644
index 0000000000..f05dfc0c60
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-3.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.3-3.js';
+
+/**
+ File Name: 15.6.4.3-3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+var SECTION = "15.6.4.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()",
+ true,
+ eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-4-n.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-4-n.js
new file mode 100644
index 0000000000..4ebabfa84c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3-4-n.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.3-4-n.js';
+
+/**
+ File Name: 15.6.4.3-4.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+var SECTION = "15.6.4.3-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()"
+ EXPECTED = "error";
+
+new TestCase( SECTION,
+ "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()",
+ "error",
+ eval("valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3.js
new file mode 100644
index 0000000000..570652ee39
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.3.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.3.js';
+
+/**
+ File Name: 15.6.4.3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+
+startTest();
+
+new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() );
+
+new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() );
+
+new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() );
+
+new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.js
new file mode 100644
index 0000000000..0c95d255fe
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/15.6.4.js
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4.js';
+
+/**
+ File Name: 15.6.4.js
+ ECMA Section: Properties of the Boolean Prototype Object
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is "
+ Boolean") whose value is false.
+
+ The value of the internal [[Prototype]] property of the Boolean prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Boolean
+ prototype object, the phrase "this Boolean object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Boolean". Also, the phrase "this boolean value"
+ refers to the boolean value represented by this Boolean object, that is,
+ the value of the internal [[Value]] property of this Boolean object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.6.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Boolean Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Boolean.prototype == false",
+ true,
+ Boolean.prototype == false );
+
+new TestCase( SECTION,
+ "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
+ "[object Boolean]",
+ eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/browser.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Boolean/shell.js b/tests/auto/qml/parserstress/tests/ecma/Boolean/shell.js
new file mode 100644
index 0000000000..2ff7258ce8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Boolean/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Boolean';
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-1.js
new file mode 100644
index 0000000000..8e82d205f3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-1.js
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.1.1-1.js';
+
+/**
+ File Name: 15.9.1.1-1.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
+
+ - this test generates its own data -- it does not
+ read data from a file.
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+ Static variables:
+ FOUR_HUNDRED_YEARS
+
+*/
+
+// every one hundred years contains:
+// 24 years with 366 days
+//
+// every four hundred years contains:
+// 97 years with 366 days
+// 303 years with 365 days
+//
+// 86400000*365*97 = 3067372800000
+// +86400000*366*303 = + 9555408000000
+// = 1.26227808e+13
+var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+var SECTION = "15.9.1.1-1";
+startTest();
+
+writeHeaderToLog("15.8.1.1 Time Range");
+
+var M_SECS;
+var CURRENT_YEAR;
+
+for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS < 8640000000000000;
+ M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) {
+
+ new TestCase( SECTION,
+ "new Date("+M_SECS+")",
+ CURRENT_YEAR,
+ (new Date( M_SECS)).getUTCFullYear() );
+}
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-2.js
new file mode 100644
index 0000000000..7b8c2644e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.1-2.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.1.1-2.js';
+
+/**
+ File Name: 15.9.1.1-2.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
+ Author: christine@netscape.com
+ Date: 9 july 1997
+*/
+
+// every one hundred years contains:
+// 24 years with 366 days
+//
+// every four hundred years contains:
+// 97 years with 366 days
+// 303 years with 365 days
+//
+// 86400000*366*97 = 3067372800000
+// +86400000*365*303 = + 9555408000000
+// = 1.26227808e+13
+
+var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+var SECTION = "15.9.1.1-2";
+startTest();
+
+writeHeaderToLog("15.8.1.1 Time Range");
+
+var M_SECS;
+var CURRENT_YEAR;
+
+for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS > -8640000000000000;
+ M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
+
+ new TestCase( SECTION,
+ "new Date("+M_SECS+")",
+ CURRENT_YEAR,
+ (new Date( M_SECS )).getUTCFullYear() );
+
+}
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.13-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.13-1.js
new file mode 100755
index 0000000000..720b39dd54
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.1.13-1.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.1.13-1.js';
+
+/**
+ File Name: 15.9.1.13-1.js
+ ECMA Section: 15.9.1.1 MakeDate(day, time)
+ Description:
+
+ The operator MakeDate calculates a number of milliseconds from its
+ two arguments, which must be ECMAScript number values. This
+ operator functions as follows:
+
+ 1. If day is not finite or time is not finite, return NaN.
+
+ 2. Compute day * msPerDay + time.
+
+ 3. Return Result(2).
+*/
+startTest();
+
+new TestCase( SECTION,
+ "MakeDate(Number.POSITIVE_INFINITY, 0)",
+ Number.NaN,
+ MakeDate(Number.POSITIVE_INFINITY, 0));
+
+new TestCase( SECTION,
+ "MakeDate(Number.NEGATIVE_INFINITY, 0)",
+ Number.NaN,
+ MakeDate(Number.NEGATIVE_INFINITY, 0));
+
+new TestCase( SECTION,
+ "MakeDate(0, Number.POSITIVE_INFINITY)",
+ Number.NaN,
+ MakeDate(0, Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "MakeDate(0, Number.NEGATIVE_INFINITY)",
+ Number.NaN,
+ MakeDate(0, Number.NEGATIVE_INFINITY));
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.1.js
new file mode 100644
index 0000000000..6cd76efb6b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.1.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.2.1.js';
+
+/**
+ File Name: 15.9.2.1.js
+ ECMA Section: 15.9.2.1 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds, ms )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.2.1";
+var TITLE = "Date Constructor used as a function";
+var TYPEOF = "string";
+var TOLERANCE = 1000;
+
+writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " +
+ "Date( year, month, date, hours, minutes, seconds, ms )" );
+
+var TODAY = new Date();
+
+// Dates around 1970
+
+new TestCase( SECTION, "Date(1970,0,1,0,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(1969,11,31,15,59,59,999)", (new Date()).toString(), Date(1969,11,31,15,59,59,999));
+new TestCase( SECTION, "Date(1969,11,31,16,0,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0,0));
+new TestCase( SECTION, "Date(1969,11,31,16,0,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,0,1));
+
+// Dates around 2000
+new TestCase( SECTION, "Date(1999,11,15,59,59,999)", (new Date()).toString(), Date(1999,11,15,59,59,999));
+new TestCase( SECTION, "Date(1999,11,16,0,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0,0));
+new TestCase( SECTION, "Date(1999,11,31,23,59,59,999)", (new Date()).toString(), Date(1999,11,31,23,59,59,999) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0,0) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,0,1) );
+
+// Dates around 1900
+
+new TestCase( SECTION, "Date(1899,11,31,23,59,59,999)", (new Date()).toString(), Date(1899,11,31,23,59,59,999));
+new TestCase( SECTION, "Date(1900,0,1,0,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(1900,0,1,0,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,0,1) );
+new TestCase( SECTION, "Date(1899,11,31,16,0,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0,0));
+
+// Dates around feb 29, 2000
+
+new TestCase( SECTION, "Date( 2000,1,29,0,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,28,23,59,59,999)", (new Date()).toString(), Date( 2000,1,28,23,59,59,999));
+new TestCase( SECTION, "Date( 2000,1,27,16,0,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0,0));
+
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59,999)", (new Date()).toString(), Date(2004,11,31,23,59,59,999));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0,0));
+
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59,999)", (new Date()).toString(), Date(2031,11,31,23,59,59,999));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0,0));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-1.js
new file mode 100644
index 0000000000..0c643cfd3a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-1.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.2.2-1.js';
+
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
+
+writeHeaderToLog(SECTION+" "+TITLE );
+
+// Dates around 1970
+
+new TestCase( SECTION, "Date(1970,0,1,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0) );
+new TestCase( SECTION, "Date(1969,11,31,15,59,59)", (new Date()).toString(), Date(1969,11,31,15,59,59));
+new TestCase( SECTION, "Date(1969,11,31,16,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0));
+new TestCase( SECTION, "Date(1969,11,31,16,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,1));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-2.js
new file mode 100644
index 0000000000..af95bb3ae6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-2.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.2.2-2.js';
+
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
+
+writeHeaderToLog(SECTION+" "+TITLE );
+
+// Dates around 2000
+new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
+new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
+new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-3.js
new file mode 100644
index 0000000000..f7de60b5b1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-3.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.2.2-3.js';
+
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
+
+writeHeaderToLog(SECTION+" "+TITLE );
+
+// Dates around 1900
+
+new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-4.js
new file mode 100644
index 0000000000..119b4f2559
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-4.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.2.2-4.js';
+
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
+
+writeHeaderToLog(SECTION+" "+TITLE );
+
+// Dates around feb 29, 2000
+
+new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-5.js
new file mode 100644
index 0000000000..d9369ca4c5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-5.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.2.2-5.js';
+
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
+
+writeHeaderToLog(SECTION+" "+TITLE );
+
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-6.js
new file mode 100644
index 0000000000..8e549936e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.2.2-6.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.2.2-6.js';
+
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
+
+writeHeaderToLog(SECTION+" "+TITLE );
+
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-1.js
new file mode 100644
index 0000000000..642169a60c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-1.js
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.1-1.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Dates around 1970
+
+addNewTestCase( new Date( 1969,11,31,15,59,59,999),
+ "new Date( 1969,11,31,15,59,59,999)",
+ [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+
+addNewTestCase( new Date( 1969,11,31,23,59,59,999),
+ "new Date( 1969,11,31,23,59,59,999)",
+ [TIME_1970-PST_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+
+addNewTestCase( new Date( 1970,0,1,0,0,0,0),
+ "new Date( 1970,0,1,0,0,0,0)",
+ [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date( 1969,11,31,16,0,0,0),
+ "new Date( 1969,11,31,16,0,0,0)",
+ [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+addNewTestCase( new Date(1969,12,1,0,0,0,0),
+ "new Date(1969,12,1,0,0,0,0)",
+ [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date(1969,11,32,0,0,0,0),
+ "new Date(1969,11,32,0,0,0,0)",
+ [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date(1969,11,31,24,0,0,0),
+ "new Date(1969,11,31,24,0,0,0)",
+ [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date(1969,11,31,23,60,0,0),
+ "new Date(1969,11,31,23,60,0,0)",
+ [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date(1969,11,31,23,59,60,0),
+ "new Date(1969,11,31,23,59,60,0)",
+ [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date(1969,11,31,23,59,59,1000),
+ "new Date(1969,11,31,23,59,59,1000)",
+ [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+// Dates around 2000
+
+addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+
+addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-PST_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+
+addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-PST_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-PST_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+
+// Dates around 29 Feb 2000
+
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+// Dates around 1900
+
+addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-PST_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-PST_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-PST_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+// Dates around 2005
+
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_JAN_1_2005-PST_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+
+test();
+
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-2.js
new file mode 100644
index 0000000000..fb9dff486c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-2.js
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.1-2.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+
+// Dates around 2000
+
+addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+
+addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-PST_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+
+addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-PST_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-PST_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-3.js
new file mode 100644
index 0000000000..0d888b089c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-3.js
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.1-3.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000 - PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000 - PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-4.js
new file mode 100644
index 0000000000..5f95a5b797
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-4.js
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.1-4.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+
+// Dates around 1900
+
+addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-PST_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+
+addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-PST_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-PST_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-5.js
new file mode 100644
index 0000000000..f37c1c8da2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.1-5.js
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.1-5.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+
+// Dates around 2005
+
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_JAN_1_2005-PST_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-1.js
new file mode 100644
index 0000000000..ae0502be64
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-1.js
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.2-1.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+// for TCMS, the gTestcases array must be global.
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+startTest();
+
+writeHeaderToLog( SECTION+" " +TITLE );
+
+// Dates around 1970
+
+addNewTestCase( new Date( 1969,11,31,15,59,59),
+ "new Date( 1969,11,31,15,59,59)",
+ [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] );
+
+addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+addNewTestCase( new Date( 1969,11,31,23,59,59),
+ "new Date( 1969,11,31,23,59,59)",
+ [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] );
+
+addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0),
+ "new Date( 1970, 0, 1, 0, 0, 0)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-2.js
new file mode 100644
index 0000000000..acc2ac7f0b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-2.js
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.2-2.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+// for TCMS, the gTestcases array must be global.
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+startTest();
+
+writeHeaderToLog( SECTION+" " +TITLE );
+
+// Dates around 2000
+
+addNewTestCase( new Date( 1999,11,31,15,59,59),
+ "new Date( 1999,11,31,15,59,59)",
+ [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
+
+addNewTestCase( new Date( 1999,11,31,16,0,0),
+ "new Date( 1999,11,31,16,0,0)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+
+addNewTestCase( new Date( 2000,0,1,0,0,0),
+ "new Date( 2000,0,1,0,0,0)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-3.js
new file mode 100644
index 0000000000..d4b48fed35
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-3.js
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.2-3.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+// for TCMS, the gTestcases array must be global.
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+startTest();
+
+writeHeaderToLog( SECTION+" " +TITLE );
+
+// Dates around 1900
+
+addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+
+addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-4.js
new file mode 100644
index 0000000000..1b2757cd9a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-4.js
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.2-4.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+// for TCMS, the gTestcases array must be global.
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+startTest();
+
+writeHeaderToLog( SECTION+" " +TITLE );
+
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+// Dates around Feb 29, 2000
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-5.js
new file mode 100644
index 0000000000..09d6272c6f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.2-5.js
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.2-5.js';
+
+/**
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
+
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
+
+
+ This tests the returned value of a newly constructed
+ Date object.
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+// for TCMS, the gTestcases array must be global.
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+startTest();
+
+writeHeaderToLog( SECTION+" " +TITLE );
+
+// Dates around Jan 1, 2005
+
+var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+//adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-1.js
new file mode 100644
index 0000000000..d48199ccba
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-1.js
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.8-1.js';
+
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+
+// for TCMS, the gTestcases array must be global.
+var gTc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION +" " + TITLE );
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+// Dates around 1970
+addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+addNewTestCase( new Date(1),
+ "new Date(1)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+
+addNewTestCase( new Date(true),
+ "new Date(true)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+
+addNewTestCase( new Date(false),
+ "new Date(false)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+addNewTestCase( new Date( (new Date(0)).toString() ),
+ "new Date(\""+ (new Date(0)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-2.js
new file mode 100644
index 0000000000..f9d8d36d04
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-2.js
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.8-2.js';
+
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+
+// for TCMS, the gTestcases array must be global.
+var gTc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION +" " + TITLE );
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
+
+addNewTestCase( new Date((new Date(0)).toUTCString()),
+ "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+addNewTestCase( new Date((new Date(1)).toString()),
+ "new Date(\""+ (new Date(1)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+addNewTestCase( new Date( TZ_ADJUST ),
+ "new Date(" + TZ_ADJUST+")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+
+addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-3.js
new file mode 100644
index 0000000000..c3042a8216
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-3.js
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.8-3.js';
+
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+
+// for TCMS, the gTestcases array must be global.
+var gTc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION +" " + TITLE );
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+// Dates around 2000
+
+addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-4.js
new file mode 100644
index 0000000000..c3a1eae7dc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-4.js
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.8-4.js';
+
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+
+// for TCMS, the gTestcases array must be global.
+var gTc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION +" " + TITLE );
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
+
+// Dates around Feb 29, 2000
+
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+
+addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-5.js
new file mode 100644
index 0000000000..405842c79f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.3.8-5.js
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.3.8-5.js';
+
+/**
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
+
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
+
+ The [[Value]] property of the newly constructed object is
+ set as follows:
+
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
+
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+
+
+// for TCMS, the gTestcases array must be global.
+var gTc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION +" " + TITLE );
+
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
+
+
+// Dates around 1900
+
+var PST_1900 = TIME_1900 + 8*msPerHour;
+
+addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2-1.js
new file mode 100644
index 0000000000..4b269f264f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2-1.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.4.2-1.js';
+
+/**
+ * File Name:
+ * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088
+ * Description: Date parsing gets 12:30 AM wrong.
+ * New behavior:
+ * js> d = new Date('1/1/1999 13:30 AM')
+ * Invalid Date
+ * js> d = new Date('1/1/1999 13:30 PM')
+ * Invalid Date
+ * js> d = new Date('1/1/1999 12:30 AM')
+ * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999
+ * js> d = new Date('1/1/1999 12:30 PM')
+ * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999
+ * Author: christine@netscape.com
+ */
+
+var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section)
+var VERSION = "ECMA"; // Version of JavaScript or ECMA
+var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description
+var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report
+
+startTest(); // leave this alone
+
+AddTestCase( "new Date('1/1/1999 12:30 AM').toString()",
+ new Date(1999,0,1,0,30).toString(),
+ new Date('1/1/1999 12:30 AM').toString() );
+
+AddTestCase( "new Date('1/1/1999 12:30 PM').toString()",
+ new Date( 1999,0,1,12,30 ).toString(),
+ new Date('1/1/1999 12:30 PM').toString() );
+
+AddTestCase( "new Date('1/1/1999 13:30 AM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 AM').toString() );
+
+
+AddTestCase( "new Date('1/1/1999 13:30 PM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 PM').toString() );
+
+test(); // leave this alone. this executes the test cases and
+// displays results.
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2.js
new file mode 100644
index 0000000000..5a518e6442
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.2.js
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.4.2.js';
+
+/**
+ File Name: 15.9.4.2.js
+ ECMA Section: 15.9.4.2 Date.parse()
+ Description: The parse() function applies the to ToString() operator
+ to its argument and interprets the resulting string as
+ a date. It returns a number, the UTC time value
+ corresponding to the date.
+
+ The string may be interpreted as a local time, a UTC
+ time, or a time in some other time zone, depending on
+ the contents of the string.
+
+ (need to test strings containing stuff with the time
+ zone specified, and verify that parse() returns the
+ correct GMT time)
+
+ so for any Date object x, all of these things should
+ be equal:
+
+ value tested in function:
+ x.valueOf() test_value()
+ Date.parse(x.toString()) test_tostring()
+ Date.parse(x.toGMTString()) test_togmt()
+
+ Date.parse(x.toLocaleString()) is not required to
+ produce the same number value as the preceeding three
+ expressions. in general the value produced by
+ Date.parse is implementation dependent when given any
+ string value that could not be produced in that
+ implementation by the toString or toGMTString method.
+
+ value tested in function:
+ Date.parse( x.toLocaleString()) test_tolocale()
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.4.2";
+var TITLE = "Date.parse()";
+
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
+
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+var TYPEOF = "object";
+
+// for TCMS, the gTestcases array must be global.
+writeHeaderToLog("15.9.4.2 Date.parse()" );
+
+// Dates around 1970
+
+addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+
+addNewTestCase( new Date(-1),
+ "new Date(-1)",
+ [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+addNewTestCase( new Date(28799999),
+ "new Date(28799999)",
+ [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+addNewTestCase( new Date(28800000),
+ "new Date(28800000)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+
+// Dates around 2000
+
+addNewTestCase( new Date(946684799999),
+ "new Date(946684799999)",
+ [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+addNewTestCase( new Date(946713599999),
+ "new Date(946713599999)",
+ [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+addNewTestCase( new Date(946684800000),
+ "new Date(946684800000)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+addNewTestCase( new Date(946713600000),
+ "new Date(946713600000)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+
+// Dates around 1900
+
+addNewTestCase( new Date(-2208988800000),
+ "new Date(-2208988800000)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+
+addNewTestCase( new Date(-2208988800001),
+ "new Date(-2208988800001)",
+ [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+
+addNewTestCase( new Date(-2208960000001),
+ "new Date(-2208960000001)",
+ [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] );
+addNewTestCase( new Date(-2208960000000),
+ "new Date(-2208960000000)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(-2208959999999),
+ "new Date(-2208959999999)",
+ [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+
+// Dates around Feb 29, 2000
+
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+
+addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date(" + UTC_FEB_29_2000 +")",
+ [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date(" + PST_FEB_29_2000 +")",
+ [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]);
+
+// Dates around Jan 1 2005
+
+var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+
+addNewTestCase( new Date(UTC_JAN_1_2005),
+ "new Date("+ UTC_JAN_1_2005 +")",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(PST_JAN_1_2005),
+ "new Date("+ PST_JAN_1_2005 +")",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+
+
+test();
+
+function addNewTestCase( DateCase, DateString, ResultArray ) {
+ DateCase = DateCase;
+
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) );
+ new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.3.js
new file mode 100644
index 0000000000..b0549588aa
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.4.3.js
@@ -0,0 +1,186 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.4.3.js';
+
+var SECTION = "15.9.4.3";
+var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )";
+startTest();
+
+// Dates around 1970
+
+addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0),
+ "Date.UTC( 1970,0,1,0,0,0,0)",
+ utc(1970,0,1,0,0,0,0) );
+
+addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999),
+ "Date.UTC( 1969,11,31,23,59,59,999)",
+ utc(1969,11,31,23,59,59,999) );
+addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999),
+ "Date.UTC( 1972,1,29,23,59,59,999)",
+ utc(1972,1,29,23,59,59,999) );
+addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999),
+ "Date.UTC( 1972,2,1,23,59,59,999)",
+ utc(1972,2,1,23,59,59,999) );
+addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999),
+ "Date.UTC( 1968,1,29,23,59,59,999)",
+ utc(1968,1,29,23,59,59,999) );
+addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999),
+ "Date.UTC( 1968,2,1,23,59,59,999)",
+ utc(1968,2,1,23,59,59,999) );
+addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0),
+ "Date.UTC( 1969,0,1,0,0,0,0)",
+ utc(1969,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000),
+ "Date.UTC( 1969,11,31,23,59,59,1000)",
+ utc(1970,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999),
+ "Date.UTC( 1969,Number.NaN,31,23,59,59,999)",
+ utc(1969,Number.NaN,31,23,59,59,999) );
+
+// Dates around 2000
+
+addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999),
+ "Date.UTC( 1999,11,31,23,59,59,999)",
+ utc(1999,11,31,23,59,59,999) );
+addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0),
+ "Date.UTC( 2000,0,1,0,0,0,0)",
+ utc(2000,0,1,0,0,0,0) );
+
+// Dates around 1900
+addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999),
+ "Date.UTC( 1899,11,31,23,59,59,999)",
+ utc(1899,11,31,23,59,59,999) );
+addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0),
+ "Date.UTC( 1900,0,1,0,0,0,0)",
+ utc(1900,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0),
+ "Date.UTC( 1973,0,1,0,0,0,0)",
+ utc(1973,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111),
+ "Date.UTC( 1776,6,4,12,36,13,111)",
+ utc(1776,6,4,12,36,13,111) );
+addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123),
+ "Date.UTC( 2525,9,18,15,30,1,123)",
+ utc(2525,9,18,15,30,1,123) );
+
+// Dates around 29 Feb 2000
+
+addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ),
+ "Date.UTC( 2000,1,29,0,0,0,0 )",
+ utc(2000,1,29,0,0,0,0) );
+addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ),
+ "Date.UTC( 2000,1,29,8,0,0,0 )",
+ utc(2000,1,29,8,0,0,0) );
+
+// Dates around 1 Jan 2005
+
+addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ),
+ "Date.UTC( 2005,0,1,0,0,0,0 )",
+ utc(2005,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ),
+ "Date.UTC( 2004,11,31,16,0,0,0 )",
+ utc(2004,11,31,16,0,0,0) );
+
+test();
+
+function addNewTestCase( DateCase, DateString, ExpectDate) {
+ DateCase = DateCase;
+
+ new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+ new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+
+function utc( year, month, date, hours, minutes, seconds, ms ) {
+ d = new MyDate();
+ d.year = Number(year);
+
+ if (month)
+ d.month = Number(month);
+ if (date)
+ d.date = Number(date);
+ if (hours)
+ d.hours = Number(hours);
+ if (minutes)
+ d.minutes = Number(minutes);
+ if (seconds)
+ d.seconds = Number(seconds);
+ if (ms)
+ d.ms = Number(ms);
+
+ if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) {
+ d.year = 1900 + ToInteger(d.year);
+ }
+
+ if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) ||
+ isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) {
+ d.year = Number.NaN;
+ d.month = Number.NaN;
+ d.date = Number.NaN;
+ d.hours = Number.NaN;
+ d.minutes = Number.NaN;
+ d.seconds = Number.NaN;
+ d.ms = Number.NaN;
+ d.value = Number.NaN;
+ d.time = Number.NaN;
+ d.day =Number.NaN;
+ return d;
+ }
+
+ d.day = MakeDay( d.year, d.month, d.date );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = (TimeClip( MakeDate(d.day,d.time)));
+
+ return d;
+}
+
+function UTCTime( t ) {
+ sign = ( t < 0 ) ? -1 : 1;
+ return ( (t +(TZ_DIFF*msPerHour)) );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.1.js
new file mode 100644
index 0000000000..3185a7c4e5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.1.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.1.js';
+
+/**
+ File Name: 15.9.5.1.js
+ ECMA Section: 15.9.5.1 Date.prototype.constructor
+ Description:
+ The initial value of Date.prototype.constructor is the built-in Date
+ constructor.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Date.prototype.constructor == Date",
+ true,
+ Date.prototype.constructor == Date );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-1.js
new file mode 100644
index 0000000000..cd73d288c9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-1.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-1.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-10.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-10.js
new file mode 100644
index 0000000000..4142635486
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-10.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-10.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some daylight savings time cases
+
+var DST_START_1998 = GetDSTStart(TimeFromYear(1998));
+
+addTestCase( DST_START_1998+1 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-11.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-11.js
new file mode 100644
index 0000000000..dfadc18838
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-11.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-11.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some daylight savings time cases
+
+var DST_END_1998 = GetDSTEnd(TimeFromYear(1998));
+
+addTestCase( DST_END_1998 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-12.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-12.js
new file mode 100644
index 0000000000..2557108faf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-12.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-12.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some daylight savings time cases
+
+var DST_END_1998 = GetDSTEnd(TimeFromYear(1998));
+
+addTestCase( DST_END_1998-1 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-13.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-13.js
new file mode 100644
index 0000000000..e0e2402ebd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-13.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-13.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some daylight savings time cases
+
+var DST_END_1998 = GetDSTEnd(TimeFromYear(1998));
+
+addTestCase( DST_END_1998+1 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-2.js
new file mode 100644
index 0000000000..e44cfcc5d7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-2.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-2.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// addTestCase( TIME_0000 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ print(t);
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ print(start, stop, d);
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-3.js
new file mode 100644
index 0000000000..325c9bfaf2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-3.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-3.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1970 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-4.js
new file mode 100644
index 0000000000..41676c2658
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-4.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-4.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1900 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-5.js
new file mode 100644
index 0000000000..f17b0a0b29
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-5.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-5.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_2000 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-6.js
new file mode 100644
index 0000000000..84f57b8805
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-6.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-6.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_FEB_29_2000 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-7.js
new file mode 100644
index 0000000000..96ba89078a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-7.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-7.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-8.js
new file mode 100644
index 0000000000..bae220a94e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-8.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-8.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some daylight savings time cases
+
+var DST_START_1998 = GetDSTStart(TimeFromYear(1998));
+
+addTestCase( DST_START_1998 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-9.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-9.js
new file mode 100644
index 0000000000..a1cee0e682
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.10-9.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.10-9.js';
+
+/**
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some daylight savings time cases
+
+var DST_START_1998 = GetDSTStart(TimeFromYear(1998));
+
+addTestCase( DST_START_1998-1 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDate()",
+ DateFromTime(LocalTime(d)),
+ (new Date(d)).getDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-1.js
new file mode 100644
index 0000000000..5c2439ba09
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-1.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.11-1.js';
+
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDate()",
+ DateFromTime(d),
+ (new Date(d)).getUTCDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-2.js
new file mode 100644
index 0000000000..d9eda4cfc1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-2.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.11-2.js';
+
+/**
+ File Name: 15.9.5.11
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// addTestCase( TIME_0000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDate()",
+ DateFromTime(d),
+ (new Date(d)).getUTCDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-3.js
new file mode 100644
index 0000000000..d35f8d5967
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-3.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.11-3.js';
+
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1970 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDate()",
+ DateFromTime(d),
+ (new Date(d)).getUTCDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-4.js
new file mode 100644
index 0000000000..4fc9f2ee65
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-4.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.11-4.js';
+
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1900 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDate()",
+ DateFromTime(d),
+ (new Date(d)).getUTCDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-5.js
new file mode 100644
index 0000000000..cee93a770b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-5.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.11-5.js';
+
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_2000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDate()",
+ DateFromTime(d),
+ (new Date(d)).getUTCDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-6.js
new file mode 100644
index 0000000000..b756e43a7e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-6.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.11-6.js';
+
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_FEB_29_2000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDate()",
+ DateFromTime(d),
+ (new Date(d)).getUTCDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-7.js
new file mode 100644
index 0000000000..65c5c1c765
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.11-7.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.11-7.js';
+
+/**
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 1.Return DateFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_JAN_1_2005 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDate()",
+ DateFromTime(d),
+ (new Date(d)).getUTCDate() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-1.js
new file mode 100644
index 0000000000..c173ffb193
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-1.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-1.js';
+
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDay()",
+ WeekDay((LocalTime(d))),
+ (new Date(d)).getDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-2.js
new file mode 100644
index 0000000000..5967da6ef6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-2.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-2.js';
+
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// addTestCase( TIME_0000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDay()",
+ WeekDay((LocalTime(d))),
+ (new Date(d)).getDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-3.js
new file mode 100644
index 0000000000..9ce226665c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-3.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-3.js';
+
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1970 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDay()",
+ WeekDay((LocalTime(d))),
+ (new Date(d)).getDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-4.js
new file mode 100644
index 0000000000..3b752a1767
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-4.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-4.js';
+
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1900 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDay()",
+ WeekDay((LocalTime(d))),
+ (new Date(d)).getDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-5.js
new file mode 100644
index 0000000000..7fe153a5ea
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-5.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-5.js';
+
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_2000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDay()",
+ WeekDay((LocalTime(d))),
+ (new Date(d)).getDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-6.js
new file mode 100644
index 0000000000..663ab81b2d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-6.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-6.js';
+
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_FEB_29_2000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDay()",
+ WeekDay((LocalTime(d))),
+ (new Date(d)).getDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-7.js
new file mode 100644
index 0000000000..23a0218058
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-7.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-7.js';
+
+/**
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_JAN_1_2005 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getDay()",
+ WeekDay((LocalTime(d))),
+ (new Date(d)).getDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-8.js
new file mode 100644
index 0000000000..4f3f66e0ce
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.12-8.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.12-8.js';
+
+/**
+ File Name: 15.9.5.12
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
+
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-1.js
new file mode 100644
index 0000000000..d82f39a7e0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-1.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-1.js';
+
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// get the current time
+var now = (new Date()).valueOf();
+
+addTestCase( now );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDay()",
+ WeekDay((d)),
+ (new Date(d)).getUTCDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-2.js
new file mode 100644
index 0000000000..13f0d080e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-2.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-2.js';
+
+/**
+ File Name: 15.9.5.13
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_0000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDay()",
+ WeekDay((d)),
+ (new Date(d)).getUTCDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-3.js
new file mode 100644
index 0000000000..7c78072ee5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-3.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-3.js';
+
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1970 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDay()",
+ WeekDay((d)),
+ (new Date(d)).getUTCDay() );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-4.js
new file mode 100644
index 0000000000..bcfcfb8c00
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-4.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-4.js';
+
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1900 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDay()",
+ WeekDay((d)),
+ (new Date(d)).getUTCDay() );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-5.js
new file mode 100644
index 0000000000..96b1acb170
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-5.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-5.js';
+
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_2000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDay()",
+ WeekDay((d)),
+ (new Date(d)).getUTCDay() );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-6.js
new file mode 100644
index 0000000000..e749ad6b7f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-6.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-6.js';
+
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_FEB_29_2000 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDay()",
+ WeekDay((d)),
+ (new Date(d)).getUTCDay() );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-7.js
new file mode 100644
index 0000000000..63607f8d2d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-7.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-7.js';
+
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_JAN_1_2005 );
+
+test();
+
+function addTestCase( t ) {
+ var start = TimeFromYear(YearFromTime(t));
+ var stop = TimeFromYear(YearFromTime(t) + 1);
+
+ for (var d = start; d < stop; d += msPerDay)
+ {
+ new TestCase( SECTION,
+ "(new Date("+d+")).getUTCDay()",
+ WeekDay((d)),
+ (new Date(d)).getUTCDay() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-8.js
new file mode 100644
index 0000000000..75d42b200b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.13-8.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.13-8.js';
+
+/**
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return WeekDay(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCDay()",
+ NaN,
+ (new Date(NaN)).getUTCDay() );
+
+new TestCase( SECTION,
+ "Date.prototype.getUTCDay.length",
+ 0,
+ Date.prototype.getUTCDay.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.14.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.14.js
new file mode 100644
index 0000000000..5a3f8216da
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.14.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.14.js';
+
+/**
+ File Name: 15.9.5.14.js
+ ECMA Section: 15.9.5.14
+ Description: Date.prototype.getHours
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.14";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getHours()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getHours()",
+ NaN,
+ (new Date(NaN)).getHours() );
+
+new TestCase( SECTION,
+ "Date.prototype.getHours.length",
+ 0,
+ Date.prototype.getHours.length );
+test();
+
+function addTestCase( t ) {
+ for ( h = 0; h < 24; h+=4 ) {
+ t += msPerHour;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getHours()",
+ HourFromTime((LocalTime(t))),
+ (new Date(t)).getHours() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.15.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.15.js
new file mode 100644
index 0000000000..ca2babd7ef
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.15.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.15.js';
+
+/**
+ File Name: 15.9.5.15.js
+ ECMA Section: 15.9.5.15
+ Description: Date.prototype.getUTCHours
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.15";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCHours()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCHours()",
+ NaN,
+ (new Date(NaN)).getUTCHours() );
+
+new TestCase( SECTION,
+ "Date.prototype.getUTCHours.length",
+ 0,
+ Date.prototype.getUTCHours.length );
+test();
+
+function addTestCase( t ) {
+ for ( h = 0; h < 24; h+=3 ) {
+ t += msPerHour;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCHours()",
+ HourFromTime((t)),
+ (new Date(t)).getUTCHours() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.16.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.16.js
new file mode 100644
index 0000000000..e791b74eae
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.16.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.16.js';
+
+/**
+ File Name: 15.9.5.16.js
+ ECMA Section: 15.9.5.16
+ Description: Date.prototype.getMinutes
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return MinFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.16";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getMinutes()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getMinutes()",
+ NaN,
+ (new Date(NaN)).getMinutes() );
+
+new TestCase( SECTION,
+ "Date.prototype.getMinutes.length",
+ 0,
+ Date.prototype.getMinutes.length );
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getMinutes()",
+ MinFromTime((LocalTime(t))),
+ (new Date(t)).getMinutes() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.17.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.17.js
new file mode 100644
index 0000000000..e9b30c3eed
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.17.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.17.js';
+
+/**
+ File Name: 15.9.5.17.js
+ ECMA Section: 15.9.5.17
+ Description: Date.prototype.getUTCMinutes
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MinFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.17";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMinutes()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMinutes()",
+ NaN,
+ (new Date(NaN)).getUTCMinutes() );
+
+new TestCase( SECTION,
+ "Date.prototype.getUTCMinutes.length",
+ 0,
+ Date.prototype.getUTCMinutes.length );
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMinutes()",
+ MinFromTime(t),
+ (new Date(t)).getUTCMinutes() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.18.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.18.js
new file mode 100644
index 0000000000..f735168efe
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.18.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.18.js';
+
+/**
+ File Name: 15.9.5.18.js
+ ECMA Section: 15.9.5.18
+ Description: Date.prototype.getSeconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.18";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getSeconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getSeconds()",
+ NaN,
+ (new Date(NaN)).getSeconds() );
+
+new TestCase( SECTION,
+ "Date.prototype.getSeconds.length",
+ 0,
+ Date.prototype.getSeconds.length );
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getSeconds()",
+ SecFromTime(LocalTime(t)),
+ (new Date(t)).getSeconds() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.19.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.19.js
new file mode 100644
index 0000000000..2a0d7430ef
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.19.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.19.js';
+
+/**
+ File Name: 15.9.5.19.js
+ ECMA Section: 15.9.5.19
+ Description: Date.prototype.getUTCSeconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.19";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCSeconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCSeconds()",
+ NaN,
+ (new Date(NaN)).getUTCSeconds() );
+
+new TestCase( SECTION,
+ "Date.prototype.getUTCSeconds.length",
+ 0,
+ Date.prototype.getUTCSeconds.length );
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCSeconds()",
+ SecFromTime(t),
+ (new Date(t)).getUTCSeconds() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-1.js
new file mode 100644
index 0000000000..7ec3c691c8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-1.js
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.2-1.js';
+
+/**
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.toString";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
+
+var now = new Date();
+
+// can't test the content of the string, but can verify that the string is
+// parsable by Date.parse
+
+new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+
+new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+// 1970
+
+new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) );
+
+// 1900
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) );
+
+// 2000
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) );
+
+// 29 Feb 2000
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_FEB_29_2000+")).toString() )",
+ UTC_FEB_29_2000,
+ Date.parse( (new Date(UTC_FEB_29_2000)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_FEB_29_2000-1000)+")).toString() )",
+ UTC_FEB_29_2000-1000,
+ Date.parse( (new Date(UTC_FEB_29_2000-1000)).toString() ) );
+
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_FEB_29_2000-TZ_ADJUST)+")).toString() )",
+ UTC_FEB_29_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_FEB_29_2000-TZ_ADJUST)).toString() ) );
+// 2O05
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_JAN_1_2005+")).toString() )",
+ UTC_JAN_1_2005,
+ Date.parse( (new Date(UTC_JAN_1_2005)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_JAN_1_2005-1000)+")).toString() )",
+ UTC_JAN_1_2005-1000,
+ Date.parse( (new Date(UTC_JAN_1_2005-1000)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_JAN_1_2005-TZ_ADJUST)+")).toString() )",
+ UTC_JAN_1_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_JAN_1_2005-TZ_ADJUST)).toString() ) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-2-n.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-2-n.js
new file mode 100644
index 0000000000..c5513b8168
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2-2-n.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.2-2-n.js';
+
+/**
+ File Name: 15.9.5.2-2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+
+ This verifies that calling toString on an object that is not a string
+ generates a runtime error.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.toString";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var OBJ = new MyObject( new Date(0) );
+
+DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.toString()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.toString()",
+ "error",
+ eval("OBJ.toString()") );
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = Date.prototype.toString;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2.js
new file mode 100644
index 0000000000..ef2df0510b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.2.js
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.2.js';
+
+/**
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.toString";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
+
+var now = new Date();
+
+// can't test the content of the string, but can verify that the string is
+// parsable by Date.parse
+
+new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+
+new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+// 1970
+
+new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) );
+
+// 1900
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) );
+
+// 2000
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) );
+
+// 29 Feb 2000
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_FEB_29_2000+")).toString() )",
+ UTC_FEB_29_2000,
+ Date.parse( (new Date(UTC_FEB_29_2000)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_FEB_29_2000-1000)+")).toString() )",
+ UTC_FEB_29_2000-1000,
+ Date.parse( (new Date(UTC_FEB_29_2000-1000)).toString() ) );
+
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_FEB_29_2000-TZ_ADJUST)+")).toString() )",
+ UTC_FEB_29_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_FEB_29_2000-TZ_ADJUST)).toString() ) );
+// 2O05
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_JAN_1_2005+")).toString() )",
+ UTC_JAN_1_2005,
+ Date.parse( (new Date(UTC_JAN_1_2005)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_JAN_1_2005-1000)+")).toString() )",
+ UTC_JAN_1_2005-1000,
+ Date.parse( (new Date(UTC_JAN_1_2005-1000)).toString() ) );
+
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_JAN_1_2005-TZ_ADJUST)+")).toString() )",
+ UTC_JAN_1_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_JAN_1_2005-TZ_ADJUST)).toString() ) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.20.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.20.js
new file mode 100644
index 0000000000..fb3dafde2c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.20.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.20.js';
+
+/**
+ File Name: 15.9.5.20.js
+ ECMA Section: 15.9.5.20
+ Description: Date.prototype.getMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.20";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getMilliseconds()",
+ NaN,
+ (new Date(NaN)).getMilliseconds() );
+
+new TestCase( SECTION,
+ "Date.prototype.getMilliseconds.length",
+ 0,
+ Date.prototype.getMilliseconds.length );
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getMilliseconds()",
+ msFromTime(LocalTime(t)),
+ (new Date(t)).getMilliseconds() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-1.js
new file mode 100644
index 0000000000..4eea164305
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-1.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-1.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-2.js
new file mode 100644
index 0000000000..37b443117a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-2.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_0000 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-3.js
new file mode 100644
index 0000000000..d1d96cb7a3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-3.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-3.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1970 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-4.js
new file mode 100644
index 0000000000..b7dfa656ff
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-4.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-4.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1900 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-5.js
new file mode 100644
index 0000000000..ca90b1784a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-5.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-5.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_2000 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-6.js
new file mode 100644
index 0000000000..9178ae76cf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-6.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-6.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_FEB_29_2000 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-7.js
new file mode 100644
index 0000000000..c4d0a4b615
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-7.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-7.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_JAN_1_2005 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-8.js
new file mode 100644
index 0000000000..624d6c6bcb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.21-8.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.21-8.js';
+
+/**
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
+
+new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-1.js
new file mode 100644
index 0000000000..5d2a6934ab
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-1.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-1.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-2.js
new file mode 100644
index 0000000000..b828b468d1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-2.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-2.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_0000 );
+
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-3.js
new file mode 100644
index 0000000000..26c059368d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-3.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-3.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1970 );
+
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-4.js
new file mode 100644
index 0000000000..96b9771d59
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-4.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-4.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_1900 );
+
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-5.js
new file mode 100644
index 0000000000..a943aa5699
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-5.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-5.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_2000 );
+
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-6.js
new file mode 100644
index 0000000000..96b39d2c43
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-6.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-6.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_FEB_29_2000 );
+
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-7.js
new file mode 100644
index 0000000000..7fa0ecaf14
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-7.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-7.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( UTC_JAN_1_2005 );
+
+test();
+
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-8.js
new file mode 100644
index 0000000000..3eca9d8ec9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.22-8.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.22-8.js';
+
+/**
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
+
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
+
+new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-1.js
new file mode 100644
index 0000000000..e4a228e2cd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-1.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-1.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( 0, 0 );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-10.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-10.js
new file mode 100644
index 0000000000..d4cb298d19
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-10.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-10.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, -2208988800000 );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-11.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-11.js
new file mode 100644
index 0000000000..ca28015766
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-11.js
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-11.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, -86400000 );
+
+test();
+
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-12.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-12.js
new file mode 100644
index 0000000000..a03f599567
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-12.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-12.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, 946684800000 );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-13.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-13.js
new file mode 100644
index 0000000000..a68128770c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-13.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-13.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, -2208988800000 );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-14.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-14.js
new file mode 100644
index 0000000000..1923d715e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-14.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-14.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-14";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, 946684800000 );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-15.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-15.js
new file mode 100644
index 0000000000..31680eb386
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-15.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-15.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, 0 );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-16.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-16.js
new file mode 100644
index 0000000000..3dc0726ca8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-16.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-16.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, String( TIME_1900 ) );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-17.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-17.js
new file mode 100644
index 0000000000..605f4cf00b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-17.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-17.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-18.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-18.js
new file mode 100644
index 0000000000..e30d0f05c8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-18.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-18.js';
+
+/**
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+
+var now = "now";
+addTestCase( now, String( TIME_2000 ) );
+
+test();
+
+function addTestCase( startTime, setTime ) {
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-2.js
new file mode 100644
index 0000000000..8086af88d9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-2.js
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-2.js';
+
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+test_times = new Array( TIME_NOW, TIME_1970, TIME_1900, TIME_2000 );
+
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_NOW), test_times[j] );
+}
+
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
+
+function addTestCase( d, t ) {
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-3-n.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-3-n.js
new file mode 100644
index 0000000000..040604bd0e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-3-n.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-3-n.js';
+
+/**
+ File Name: 15.9.5.23-3-n.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.23-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MYDATE = new MyDate(TIME_1970);
+
+DESCRIPTION = "MYDATE.setTime(TIME_2000)";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "MYDATE.setTime(TIME_2000)",
+ "error",
+ eval("MYDATE.setTime(TIME_2000)") );
+
+test();
+
+function MyDate(value) {
+ this.value = value;
+ this.setTime = Date.prototype.setTime;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-4.js
new file mode 100644
index 0000000000..39e3dec8d4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-4.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-4.js';
+
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_0000), test_times[j] );
+}
+
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
+
+function addTestCase( d, t ) {
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-5.js
new file mode 100644
index 0000000000..b4317e6a55
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-5.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-5.js';
+
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1970), test_times[j] );
+}
+
+
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
+
+function addTestCase( d, t ) {
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-6.js
new file mode 100644
index 0000000000..cc9e07b9fd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-6.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-6.js';
+
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1900), test_times[j] );
+}
+
+
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
+function addTestCase( d, t ) {
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-7.js
new file mode 100644
index 0000000000..46bb900b18
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-7.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-7.js';
+
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_2000), test_times[j] );
+}
+
+
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
+
+function addTestCase( d, t ) {
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-8.js
new file mode 100644
index 0000000000..8072a9cc1f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-8.js
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-8.js';
+
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_FEB_29_2000), test_times[j] );
+}
+
+test();
+
+function addTestCase( d, t ) {
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-9.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-9.js
new file mode 100644
index 0000000000..b480791e3d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.23-9.js
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.23-9.js';
+
+/**
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
+
+
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_JAN_1_2005), test_times[j] );
+}
+
+test();
+
+function addTestCase( d, t ) {
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
+
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-1.js
new file mode 100644
index 0000000000..e02aa6150a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-1.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-1.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+
+addTestCase( 0, 0 );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-2.js
new file mode 100644
index 0000000000..da6261670b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-2.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-2.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+
+addTestCase( 0, -86400000 );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-3.js
new file mode 100644
index 0000000000..8199010953
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-3.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-3.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+
+addTestCase( 0, -2208988800000 );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-4.js
new file mode 100644
index 0000000000..f6b1dae966
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-4.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-4.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+
+addTestCase( 0, 946684800000 );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-5.js
new file mode 100644
index 0000000000..53458028be
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-5.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-5.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+
+addTestCase( 0, "0" );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-6.js
new file mode 100644
index 0000000000..188dbacff9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-6.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-6.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+
+addTestCase( 0, "-2208988800000" );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-7.js
new file mode 100644
index 0000000000..b2fe8fcff9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-7.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-7.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+
+addTestCase( 0, "-86400000" );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-8.js
new file mode 100644
index 0000000000..d6ea2d8d3e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.24-8.js
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.24-8.js';
+
+/**
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var TITLE = "Date.prototype.setTime"
+ var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+
+addTestCase( 0, "946684800000" );
+
+test();
+
+function addTestCase( startms, newms ) {
+
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.25-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.25-1.js
new file mode 100644
index 0000000000..0eb7783ec8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.25-1.js
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.25-1.js';
+
+/**
+ File Name: 15.9.5.25-1.js
+ ECMA Section: 15.9.5.25 Date.prototype.setUTCMilliseconds(ms)
+ Description:
+ 1. Let t be this time value.
+ 2. Call ToNumber(ms).
+ 3. Compute MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), Result(2)).
+ 4. Compute MakeDate(Day(t), Result(3)).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.25-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCMilliseconds(ms)");
+
+addNewTestCase( 0, 0, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(0);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,0)),
+ LocalDateFromTime(SetUTCMilliseconds(0,0)) );
+addNewTestCase( 28800000,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(28800000,999)),
+ LocalDateFromTime(SetUTCMilliseconds(28800000,999)) );
+addNewTestCase( 28800000,-28800000,
+ "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(-28800000);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(28800000,-28800000)),
+ LocalDateFromTime(SetUTCMilliseconds(28800000,-28800000)) );
+addNewTestCase( 946684800000,1234567,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(1234567);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(946684800000,1234567)),
+ LocalDateFromTime(SetUTCMilliseconds(946684800000,1234567)) );
+addNewTestCase( 946684800000, 123456789,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(946684800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(946684800000,123456789)) );
+
+addNewTestCase( -2208988800000,123456789,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+
+addNewTestCase( -2208988800000,123456,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+
+addNewTestCase( -2208988800000,-123456,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+
+addNewTestCase( 0,-999,
+ "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+
+test();
+
+function addNewTestCase( initialTime, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date(initialTime);
+ DateCase.setUTCMilliseconds(ms);
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetUTCMilliseconds( T, MS ) {
+ T = Number( T );
+ TIME = MakeTime( HourFromTime(T),
+ MinFromTime(T),
+ SecFromTime(T),
+ MS );
+ return( MakeDate( Day(T), TIME ));
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.26-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.26-1.js
new file mode 100644
index 0000000000..509ec73d33
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.26-1.js
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.26-1.js';
+
+/** File Name: 15.9.5.26-1.js
+ ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms])
+ Description:
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2),
+ Result(3)).
+ 5. Compute UTC(MakeDate(Day(t), Result(4))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.26-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )");
+
+addNewTestCase( 0, 0, 0,
+ "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE",
+ UTCDateFromTime(SetSeconds(0,0,0)),
+ LocalDateFromTime(SetSeconds(0,0,0)) );
+
+addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,59,999)),
+ LocalDateFromTime(SetSeconds(28800000,59,999)) );
+
+addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,999)),
+ LocalDateFromTime(SetSeconds(28800000,999,999)) );
+
+addNewTestCase( 28800000,999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,0)),
+ LocalDateFromTime(SetSeconds(28800000,999,0)) );
+
+addNewTestCase( 28800000,-28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,-28800)),
+ LocalDateFromTime(SetSeconds(28800000,-28800)) );
+
+addNewTestCase( 946684800000,1234567,void 0,
+ "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE",
+ UTCDateFromTime(SetSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetSeconds(946684800000,1234567)) );
+
+addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetSeconds(-2208988800000,59,999)) );
+
+test();
+
+function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) {
+ DateCase = new Date( startTime );
+ if ( ms != void 0 ) {
+ DateCase.setSeconds( sec, ms );
+ } else {
+ DateCase.setSeconds( sec );
+ }
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetSeconds( t, s, m ) {
+ var MS = ( m == void 0 ) ? msFromTime(t) : Number( m );
+ var TIME = LocalTime( t );
+ var SEC = Number(s);
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4));
+ return ( TimeClip(UTC_TIME) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.27-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.27-1.js
new file mode 100644
index 0000000000..1b06777332
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.27-1.js
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.27-1.js';
+
+/**
+ File Name: 15.9.5.27-1.js
+ ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms])
+ Description:
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getUTCMilliseconds( ).
+
+ 1. Let t be this time value.
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms)
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3))
+ 5. Compute MakeDate(Day(t), Result(4)).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.27-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )");
+
+addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE",
+ UTCDateFromTime(SetUTCSeconds(0,0,0)),
+ LocalDateFromTime(SetUTCSeconds(0,0,0)) );
+
+addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,59,999)) );
+
+addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,999)) );
+
+addNewTestCase( 28800000, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,0)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,0)) );
+
+addNewTestCase( 28800000, -28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,-28800)),
+ LocalDateFromTime(SetUTCSeconds(28800000,-28800)) );
+
+addNewTestCase( 946684800000, 1234567, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE",
+ UTCDateFromTime(SetUTCSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) );
+
+addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) );
+
+test();
+
+function addNewTestCase( startTime, sec, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date( startTime );
+ if ( ms == void 0) {
+ DateCase.setSeconds( sec );
+ } else {
+ DateCase.setSeconds( sec, ms );
+ }
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetUTCSeconds( t, s, m ) {
+ var TIME = t;
+ var SEC = Number(s);
+ var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m );
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT4)) );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.28-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.28-1.js
new file mode 100644
index 0000000000..902d70a873
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.28-1.js
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.28-1.js';
+
+/**
+ File Name: 15.9.5.28-1.js
+ ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getSeconds ( ).
+
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Day(t), Result(5))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.28-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )");
+
+addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE",
+ UTCDateFromTime(SetMinutes(0,0,0,0)),
+ LocalDateFromTime(SetMinutes(0,0,0,0)) );
+
+addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59)),
+ LocalDateFromTime(SetMinutes(28800000,59,59)) );
+
+addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(28800000,59,59,999)) );
+
+addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,0)),
+ LocalDateFromTime(SetMinutes(28800000,59,0)) );
+
+addNewTestCase( 28800000, -480, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,-480)),
+ LocalDateFromTime(SetMinutes(28800000,-480)) );
+
+addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE",
+ UTCDateFromTime(SetMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetMinutes(946684800000,1234567)) );
+
+addNewTestCase( -2208988800000,59, 59, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59)) );
+
+addNewTestCase( -2208988800000, 59, 59, 999,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) );
+
+test();
+
+function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
+ DateCase = new Date( time );
+
+ if ( sec == void 0 ) {
+ DateCase.setMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setMinutes( min, sec );
+ } else {
+ DateCase.setMinutes( min, sec, ms );
+ }
+ }
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetMinutes( t, min, sec, ms ) {
+ var TIME = LocalTime(t);
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.29-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.29-1.js
new file mode 100644
index 0000000000..42fa36e9b5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.29-1.js
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.29-1.js';
+
+/**
+ File Name: 15.9.5.29-1.js
+ ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getUTCSeconds ( ).
+
+ If ms is not specified, this behaves as if ms were specified with the value
+ getUTCMilliseconds( ).
+
+ 1. Let t be this time value.
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Day(t), Result(5)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.29-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )");
+
+addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE",
+ UTCDateFromTime(SetUTCMinutes(0,0,0,0)),
+ LocalDateFromTime(SetUTCMinutes(0,0,0,0)) );
+
+addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59)) );
+
+addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) );
+
+addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59)) );
+
+addNewTestCase( 28800000, -480, 0, 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,-480)),
+ LocalDateFromTime(SetUTCMinutes(28800000,-480)) );
+
+addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE",
+ UTCDateFromTime(SetUTCMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) );
+
+addNewTestCase( -2208988800000, 59, 999, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) );
+
+test();
+
+function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
+ var DateCase = new Date( time );
+
+ if ( sec == void 0 ) {
+ DateCase.setUTCMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setUTCMinutes( min, sec );
+ } else {
+ DateCase.setUTCMinutes( min, sec, ms );
+ }
+ }
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCMinutes( t, min, sec, ms ) {
+ var TIME = t;
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME),RESULT5)) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-1-n.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-1-n.js
new file mode 100644
index 0000000000..e1f227f785
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-1-n.js
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.3-1-n.js';
+
+/**
+ File Name: 15.9.5.3-1.js
+ ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.3-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.valueOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var OBJ = new MyObject( new Date(0) );
+
+DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()",
+ "error",
+ eval("OBJ.valueOf()") );
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+// The following line causes an infinte loop
+// this.toString = new Function( "return this+\"\";");
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-2.js
new file mode 100644
index 0000000000..9f425c3450
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.3-2.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.3-2.js';
+
+/**
+ File Name: 15.9.5.3-2.js
+ ECMA Section: 15.9.5.3-2 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.valueOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+").valueOf()",
+ t,
+ (new Date(t)).valueOf() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+").valueOf()",
+ t+1,
+ (new Date(t+1)).valueOf() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+").valueOf()",
+ t-1,
+ (new Date(t-1)).valueOf() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").valueOf()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).valueOf() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").valueOf()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).valueOf() );
+}
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+ this.toString = new Function( "return this+\"\";");
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.30-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.30-1.js
new file mode 100644
index 0000000000..7abb3927d7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.30-1.js
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.30-1.js';
+
+/**
+ File Name: 15.9.5.30-1.js
+ ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] )
+ Description:
+ If min is not specified, this behaves as if min were specified with the
+ value getMinutes( ). If sec is not specified, this behaves as if sec were
+ specified with the value getSeconds ( ). If ms is not specified, this
+ behaves as if ms were specified with the value getMilliseconds( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(hour).
+ 3. If min is not specified, compute MinFromTime(t); otherwise, call
+ ToNumber(min).
+ 4. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 5. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
+ 7. Compute UTC(MakeDate(Day(t), Result(6))).
+ 8. Set the [[Value]] property of the this value to TimeClip(Result(7)).
+ 9. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.30-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )");
+
+addNewTestCase( 0,0,0,0,void 0,
+ "TDATE = new Date(0);(TDATE).setHours(0);TDATE" );
+
+addNewTestCase( 28800000, 23, 59, 999,void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" );
+
+addNewTestCase( 28800000, 999, 999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" );
+
+addNewTestCase( 28800000,999,0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" );
+
+addNewTestCase( 28800000,-8, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" );
+
+addNewTestCase( 946684800000,8760, void 0, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setHours(8760);TDATE" );
+
+addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" );
+
+addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" );
+
+test();
+
+function addNewTestCase( time, hours, min, sec, ms, DateString) {
+ var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms ));
+ var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms ));
+
+ var DateCase = new Date( time );
+
+ if ( min == void 0 ) {
+ DateCase.setHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setHours( hours, min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setHours( hours, min, sec );
+ } else {
+ DateCase.setHours( hours, min, sec, ms );
+ }
+ }
+ }
+
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.day = WeekDay( t );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+
+ return (d);
+}
+function SetHours( t, hour, min, sec, ms ) {
+ var TIME = LocalTime(t);
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) );
+ return ( TimeClip(UTC_TIME) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.31-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.31-1.js
new file mode 100644
index 0000000000..10f0f93e17
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.31-1.js
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.31-1.js';
+
+/**
+ File Name: 15.9.5.31-1.js
+
+ ECMA Section:
+ 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )
+
+ Description:
+
+ If min is not specified, this behaves as if min were specified with
+ the value getUTCMinutes( ). If sec is not specified, this behaves
+ as if sec were specified with the value getUTCSeconds ( ). If ms
+ is not specified, this behaves as if ms were specified with the
+ value getUTCMilliseconds( ).
+
+ 1.Let t be this time value.
+ 2.Call ToNumber(hour).
+ 3.If min is not specified, compute MinFromTime(t);
+ otherwise, call ToNumber(min).
+ 4.If sec is not specified, compute SecFromTime(t);
+ otherwise, call ToNumber(sec).
+ 5.If ms is not specified, compute msFromTime(t);
+ otherwise, call ToNumber(ms).
+ 6.Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
+ 7.Compute MakeDate(Day(t), Result(6)).
+ 8.Set the [[Value]] property of the this value to TimeClip(Result(7)).
+
+ 1.Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.31-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog(SECTION +
+ " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )");
+
+addNewTestCase( 0, 0, void 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE",
+ UTCDateFromTime(SetUTCHours(0,0,0,0)),
+ LocalDateFromTime(SetUTCHours(0,0,0,0)) );
+
+addNewTestCase( 28800000, 23, 59, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,23,59,999)),
+ LocalDateFromTime(SetUTCHours(28800000,23,59,999)) );
+
+addNewTestCase( 28800000,999,999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,999)),
+ LocalDateFromTime(SetUTCHours(28800000,999,999)) );
+
+addNewTestCase( 28800000, 999, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,0)),
+ LocalDateFromTime(SetUTCHours(28800000,999,0)) );
+
+addNewTestCase( 28800000, -8670, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,-8670)),
+ LocalDateFromTime(SetUTCHours(28800000,-8670)) );
+
+addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE",
+ UTCDateFromTime(SetUTCHours(946684800000,1234567)),
+ LocalDateFromTime(SetUTCHours(946684800000,1234567)) );
+
+addNewTestCase( -2208988800000, 59, 999, void 0, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) );
+
+test();
+
+function addNewTestCase( time, hours, min, sec, ms, DateString, UTCDate, LocalDate) {
+
+ DateCase = new Date(time);
+ if ( min == void 0 ) {
+ DateCase.setUTCHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setUTCHours( hours, min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setUTCHours( hours, min, sec );
+ } else {
+ DateCase.setUTCHours( hours, min, sec, ms );
+ }
+ }
+ }
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value,
+ DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value,
+ DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year,
+ DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month,
+ DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date,
+ DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day,
+ DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours,
+ DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,
+ DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,
+ DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms,
+ DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year,
+ DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month,
+ DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date,
+ DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day,
+ DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours,
+ DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes,
+ DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds,
+ DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms,
+ DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;" +
+ DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCHours( t, hour, min, sec, ms ) {
+ var TIME = t;
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT6)) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.32-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.32-1.js
new file mode 100644
index 0000000000..d277fd9af1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.32-1.js
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.32-1.js';
+
+/**
+ File Name: 15.9.5.32-1.js
+ ECMA Section: 15.9.5.32 Date.prototype.setDate(date)
+ Description:
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.32-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setDate(date) ");
+
+addNewTestCase( 0, 1,
+ "TDATE = new Date(0);(TDATE).setDate(1);TDATE" );
+
+test();
+
+function addNewTestCase( t, d, DateString ) {
+ var DateCase = new Date( t );
+ DateCase.setDate( d );
+
+ var UTCDate = UTCDateFromTime(SetDate(t, d));
+ var LocalDate=LocalDateFromTime(SetDate(t,d));
+
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+
+function SetDate( t, date ) {
+ var T = LocalTime( t );
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) );
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.33-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.33-1.js
new file mode 100644
index 0000000000..01e1ff2f94
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.33-1.js
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.33-1.js';
+
+/**
+ File Name: 15.9.5.33-1.js
+ ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date)
+ Description:
+ 1. Let t be this time value.
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute MakeDate(Result(3), TimeWithinDay(t)).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.33-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) ");
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE",
+ UTCDateFromTime(SetUTCDate(0,31)),
+ LocalDateFromTime(SetUTCDate(0,31)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(0,1)),
+ LocalDateFromTime(SetUTCDate(0,1)) );
+
+addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(86400000,1)),
+ LocalDateFromTime(SetUTCDate(86400000,1)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCDate( t, date ) {
+ var T = t;
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.34-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.34-1.js
new file mode 100644
index 0000000000..de4d8c817b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.34-1.js
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.34-1.js';
+
+/**
+ File Name: 15.9.5.34-1.js
+ ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] )
+ Description:
+ If date is not specified, this behaves as if date were specified with the
+ value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date).
+ 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)).
+ 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.34-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )");
+
+getFunctionCases();
+
+// regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404
+d = new Date(0);
+d.setMonth(1,1,1,1,1,1);
+
+addNewTestCase(
+ "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE",
+ UTCDateFromTime(SetMonth(0,1,1)),
+ LocalDateFromTime(SetMonth(0,1,1)) );
+
+
+// whatever today is
+
+addNewTestCase( "TDATE = new Date(TIME_NOW); (TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime(SetMonth(TIME_NOW,11,31)),
+ LocalDateFromTime(SetMonth(TIME_NOW,11,31)) );
+
+// 1970
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE",
+ UTCDateFromTime(SetMonth(0,0,1)),
+ LocalDateFromTime(SetMonth(0,0,1)) );
+
+addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+
+ "(TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime( SetMonth(TIME_1900,11,31) ),
+ LocalDateFromTime( SetMonth(TIME_1900,11,31) ) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function getFunctionCases() {
+ // some tests for all functions
+ new TestCase(
+ SECTION,
+ "Date.prototype.setMonth.length",
+ 2,
+ Date.prototype.setMonth.length );
+
+ new TestCase(
+ SECTION,
+ "typeof Date.prototype.setMonth",
+ "function",
+ typeof Date.prototype.setMonth );
+
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetMonth( t, mon, date ) {
+ var TIME = LocalTime(t);
+ var MONTH = Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date );
+ var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE );
+ return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.35-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.35-1.js
new file mode 100644
index 0000000000..427657cb47
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.35-1.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.35-1.js';
+
+/**
+ File Name: 15.9.5.35-1.js
+ ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date])
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.35-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) ");
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,0)),
+ LocalDateFromTime(SetUTCMonth(0,0)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,11)),
+ LocalDateFromTime(SetUTCMonth(0,11)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,3,4)),
+ LocalDateFromTime(SetUTCMonth(0,3,4)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCMonth( t, month, date ) {
+ var T = t;
+ var MONTH = Number( month );
+ var DATE = ( date == void 0) ? DateFromTime(T) : Number( date );
+
+ var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE );
+ var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T));
+
+ return ( TimeClip(RESULT5) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-1.js
new file mode 100644
index 0000000000..f4cd44c2c2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-1.js
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.36-1.js';
+
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+
+// 1969
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969)),
+ LocalDateFromTime(SetFullYear(0,1969)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11)),
+ LocalDateFromTime(SetFullYear(0,1969,11)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11,31)),
+ LocalDateFromTime(SetFullYear(0,1969,11,31)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-2.js
new file mode 100644
index 0000000000..a0ce018d0f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-2.js
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.36-2.js';
+
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+var SECTION = "15.9.5.36-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+// 1970
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970)),
+ LocalDateFromTime(SetFullYear(0,1970)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0)),
+ LocalDateFromTime(SetFullYear(0,1970,0)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0,1)),
+ LocalDateFromTime(SetFullYear(0,1970,0,1)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-3.js
new file mode 100644
index 0000000000..f0849f28e7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-3.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.36-3.js';
+
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+// 1971
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-4.js
new file mode 100644
index 0000000000..0ca872f8db
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-4.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.36-4.js';
+
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+// 1999
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-5.js
new file mode 100644
index 0000000000..2496548b1d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-5.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.36-5.js';
+
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+// 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-6.js
new file mode 100644
index 0000000000..9a05c3130e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-6.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.36-6.js';
+
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+// feb 29, 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-7.js
new file mode 100644
index 0000000000..5bc330bbea
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.36-7.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.36-7.js';
+
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
+
+ 1. Let t be the result of LocalTime(this time value); but if this time
+ value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added test cases for Year 2000 Compatilibity Testing.
+
+*/
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetFullYear( t, year, mon, date ) {
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-1.js
new file mode 100644
index 0000000000..a6acd3d10a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-1.js
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.37-1.js';
+
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+
+// Dates around 1970
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1970)),
+ LocalDateFromTime(SetUTCFullYear(0,1970)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1971)),
+ LocalDateFromTime(SetUTCFullYear(0,1971)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-2.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-2.js
new file mode 100644
index 0000000000..e5ec78ea72
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-2.js
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.37-2.js';
+
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+
+// Dates around 2000
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2000)),
+ LocalDateFromTime(SetUTCFullYear(0,2000)) );
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2001)),
+ LocalDateFromTime(SetUTCFullYear(0,2001)) );
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1999)),
+ LocalDateFromTime(SetUTCFullYear(0,1999)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-3.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-3.js
new file mode 100644
index 0000000000..d256511459
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-3.js
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.37-3.js';
+
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+
+// Dates around 29 February 2000
+
+var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+ 31*msPerDay + 28*msPerDay;
+
+var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+
+addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+
+addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-4.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-4.js
new file mode 100644
index 0000000000..017afd6389
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-4.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.37-4.js';
+
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+// Dates around 2005
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+
+// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-5.js
new file mode 100644
index 0000000000..046f3095df
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.37-5.js
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.37-5.js';
+
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
+
+ 1. Let t be this time value; but if this time value is NaN, let t be +0.
+ 2. Call ToNumber(year).
+ 3. If mon is not specified, compute MonthFromTime(t); otherwise, call
+ ToNumber(mon).
+ 4. If date is not specified, compute DateFromTime(t); otherwise, call
+ ToNumber(date).
+ 5. Compute MakeDay(Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Result(5), TimeWithinDay(t)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Added some Year 2000 test cases.
+*/
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+
+// Dates around 1900
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
+
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
+
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
+}
+function LocalDateFromTime(t) {
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
+}
+function UTCDateFromTime(t) {
+ return ( MyDateFromTime(t) );
+}
+function MyDateFromTime( t ) {
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+
+ return (d);
+}
+function SetUTCFullYear( t, year, mon, date ) {
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-1.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-1.js
new file mode 100644
index 0000000000..6ad06931f8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-1.js
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.4-1.js';
+
+/**
+ File Name: 15.9.5.4-1.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.9.5.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTime";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+").getTime()",
+ t,
+ (new Date(t)).getTime() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+").getTime()",
+ t+1,
+ (new Date(t+1)).getTime() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+").getTime()",
+ t-1,
+ (new Date(t-1)).getTime() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").getTime()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).getTime() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").getTime()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).getTime() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-2-n.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-2-n.js
new file mode 100644
index 0000000000..1cd98dd801
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.4-2-n.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.4-2-n.js';
+
+/**
+ File Name: 15.9.5.4-2-n.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+var SECTION = "15.9.5.4-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTime";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MYDATE = new MyDate( TIME_2000 );
+
+DESCRIPTION = "MYDATE.getTime()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "MYDATE.getTime()",
+ "error",
+ eval("MYDATE.getTime()") );
+
+test();
+
+function MyDate( value ) {
+ this.value = value;
+ this.getTime = Date.prototype.getTime;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.5.js
new file mode 100644
index 0000000000..f0136b00ad
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.5.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.5.js';
+
+/**
+ File Name: 15.9.5.5.js
+ ECMA Section: 15.9.5.5
+ Description: Date.prototype.getYear
+
+ This function is specified here for backwards compatibility only. The
+ function getFullYear is much to be preferred for nearly all purposes,
+ because it avoids the "year 2000 problem."
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return YearFromTime(LocalTime(t)) 1900.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getYear()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getYear()",
+ NaN,
+ (new Date(NaN)).getYear() );
+
+new TestCase( SECTION,
+ "Date.prototype.getYear.length",
+ 0,
+ Date.prototype.getYear.length );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t))),
+ (new Date(t)).getYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+1))),
+ (new Date(t+1)).getYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-1))),
+ (new Date(t-1)).getYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))),
+ (new Date(t-TZ_ADJUST)).getYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))),
+ (new Date(t+TZ_ADJUST)).getYear() );
+}
+function GetYear( year ) {
+ return year - 1900;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.6.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.6.js
new file mode 100644
index 0000000000..9ae804ebb9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.6.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.6.js';
+
+/**
+ File Name: 15.9.5.6.js
+ ECMA Section: 15.9.5.6
+ Description: Date.prototype.getFullYear
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return YearFromTime(LocalTime(t)).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getFullYear()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getFullYear()",
+ NaN,
+ (new Date(NaN)).getFullYear() );
+
+new TestCase( SECTION,
+ "Date.prototype.getFullYear.length",
+ 0,
+ Date.prototype.getFullYear.length );
+
+test();
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getFullYear()",
+ YearFromTime(LocalTime(t)),
+ (new Date(t)).getFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getFullYear()",
+ YearFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getFullYear()",
+ YearFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getFullYear() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.7.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.7.js
new file mode 100644
index 0000000000..c4c83a2c38
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.7.js
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.7.js';
+
+/**
+ File Name: 15.9.5.7.js
+ ECMA Section: 15.9.5.7
+ Description: Date.prototype.getUTCFullYear
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return YearFromTime(t).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCFullYear()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCFullYear()",
+ NaN,
+ (new Date(NaN)).getUTCFullYear() );
+
+new TestCase( SECTION,
+ "Date.prototype.getUTCFullYear.length",
+ 0,
+ Date.prototype.getUTCFullYear.length );
+
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCFullYear()",
+ YearFromTime(t),
+ (new Date(t)).getUTCFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCFullYear()",
+ YearFromTime(t+1),
+ (new Date(t+1)).getUTCFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCFullYear()",
+ YearFromTime(t-1),
+ (new Date(t-1)).getUTCFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCFullYear() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCFullYear() );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.8.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.8.js
new file mode 100644
index 0000000000..572e293960
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.8.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.8.js';
+
+/**
+ File Name: 15.9.5.8.js
+ ECMA Section: 15.9.5.8
+ Description: Date.prototype.getMonth
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getMonth()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getMonth()",
+ NaN,
+ (new Date(NaN)).getMonth() );
+
+new TestCase( SECTION,
+ "Date.prototype.getMonth.length",
+ 0,
+ Date.prototype.getMonth.length );
+test();
+
+function addTestCase( t ) {
+ var leap = InLeapYear(t);
+
+ for ( var m = 0; m < 12; m++ ) {
+
+ t += TimeInMonth(m, leap);
+
+ new TestCase( SECTION,
+ "(new Date("+t+")).getMonth()",
+ MonthFromTime(LocalTime(t)),
+ (new Date(t)).getMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getMonth()",
+ MonthFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getMonth()",
+ MonthFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getMonth() );
+
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.9.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.9.js
new file mode 100644
index 0000000000..9f0fc124af
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.9.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.9.js';
+
+/**
+ File Name: 15.9.5.9.js
+ ECMA Section: 15.9.5.9
+ Description: Date.prototype.getUTCMonth
+
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(t).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5.9";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMonth()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+addTestCase( TIME_NOW );
+addTestCase( TIME_0000 );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
+
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMonth()",
+ NaN,
+ (new Date(NaN)).getUTCMonth() );
+
+new TestCase( SECTION,
+ "Date.prototype.getUTCMonth.length",
+ 0,
+ Date.prototype.getUTCMonth.length );
+test();
+
+function addTestCase( t ) {
+ var leap = InLeapYear(t);
+
+ for ( var m = 0; m < 12; m++ ) {
+
+ t += TimeInMonth(m, leap);
+
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMonth()",
+ MonthFromTime(t),
+ (new Date(t)).getUTCMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCMonth()",
+ MonthFromTime(t+1),
+ (new Date(t+1)).getUTCMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCMonth()",
+ MonthFromTime(t-1),
+ (new Date(t-1)).getUTCMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCMonth() );
+
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCMonth() );
+
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.js b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.js
new file mode 100644
index 0000000000..9e3bd94080
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/15.9.5.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.js';
+
+/**
+ File Name: 15.9.5.js
+ ECMA Section: 15.9.5 Properties of the Date prototype object
+ Description:
+
+ The Date prototype object is itself a Date object (its [[Class]] is
+ "Date") whose value is NaN.
+
+ The value of the internal [[Prototype]] property of the Date prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Date
+ prototype object, the phrase "this Date object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Date". Also, the phrase "this time value" refers
+ to the number value for the time represented by this Date object, that is,
+ the value of the internal [[Value]] property of this Date object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Date Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+Date.prototype.getClass = Object.prototype.toString;
+
+new TestCase( SECTION,
+ "Date.prototype.getClass",
+ "[object Date]",
+ Date.prototype.getClass() );
+new TestCase( SECTION,
+ "Date.prototype.valueOf()",
+ NaN,
+ Date.prototype.valueOf() );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/browser.js b/tests/auto/qml/parserstress/tests/ecma/Date/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Date/shell.js b/tests/auto/qml/parserstress/tests/ecma/Date/shell.js
new file mode 100644
index 0000000000..0beb78e064
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Date/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Date';
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-1.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-1.js
new file mode 100644
index 0000000000..699296d6b1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-1.js
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.3-1.js';
+
+/**
+ File Name: 10.1.3-1.js
+ ECMA Section: 10.1.3
+ Description:
+
+ For each formal parameter, as defined in the FormalParameterList, create
+ a property of the variable object whose name is the Identifier and whose
+ attributes are determined by the type of code. The values of the
+ parameters are supplied by the caller. If the caller supplies fewer
+ parameter values than there are formal parameters, the extra formal
+ parameters have value undefined. If two or more formal parameters share
+ the same name, hence the same property, the corresponding property is
+ given the value that was supplied for the last parameter with this name.
+ If the value of this last parameter was not supplied by the caller,
+ the value of the corresponding property is undefined.
+
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.1.3-1";
+var VERSION = "ECMA_1";
+var TITLE = "Variable Instantiation: Formal Parameters";
+var BUGNUMBER="104191";
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var myfun1 = new Function( "a", "a", "return a" );
+var myfun2 = new Function( "a", "b", "a", "return a" );
+
+function myfun3(a, b, a) {
+ return a;
+}
+
+// myfun1, myfun2, myfun3 tostring
+
+
+new TestCase(
+ SECTION,
+ String(myfun2) +"; myfun2(2,4,8)",
+ 8,
+ myfun2(2,4,8) );
+
+new TestCase(
+ SECTION,
+ "myfun2(2,4)",
+ void 0,
+ myfun2(2,4));
+
+new TestCase(
+ SECTION,
+ String(myfun3) +"; myfun3(2,4,8)",
+ 8,
+ myfun3(2,4,8) );
+
+new TestCase(
+ SECTION,
+ "myfun3(2,4)",
+ void 0,
+ myfun3(2,4) );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-2.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-2.js
new file mode 100755
index 0000000000..3762842461
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3-2.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): mozilla@florian.loitsch.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.3-2.js';
+
+/**
+ File Name: 10.1.3-1.js
+ ECMA Section: 10.1.3
+ Description:
+
+ Author: mozilla@florian.loitsch.com
+ Date: 27 July 2005
+*/
+
+var SECTION = "10.1.3-2";
+var VERSION = "ECMA_1";
+var TITLE = "Variable Instantiation: Function Declarations";
+var BUGNUMBER="299639";
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function f(g)
+{
+ function g() {
+ return "g";
+ };
+ return g;
+}
+
+new TestCase(
+ SECTION,
+ "typeof f(\"parameter\")",
+ "function",
+ typeof f("parameter") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3.js
new file mode 100644
index 0000000000..fd466de210
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.3.js
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.3.js';
+
+/**
+ File Name: 10.1.3.js
+ ECMA Section: 10.1.3.js Variable Instantiation
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+var SECTION = "10.1.3";
+var VERSION = "ECMA_1";
+var TITLE = "Variable instantiation";
+var BUGNUMBER = "20256";
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// overriding a variable or function name with a function should succeed
+
+new TestCase(SECTION,
+ "function t() { return \"first\" };" +
+ "function t() { return \"second\" };t() ",
+ "second",
+ eval("function t() { return \"first\" };" +
+ "function t() { return \"second\" };t()"));
+
+
+new TestCase(SECTION,
+ "var t; function t(){}; typeof(t)",
+ "function",
+ eval("var t; function t(){}; typeof(t)"));
+
+
+// formal parameter tests
+
+new TestCase(SECTION,
+ "function t1(a,b) { return b; }; t1( 4 );",
+ void 0,
+ eval("function t1(a,b) { return b; }; t1( 4 );") );
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1(4);",
+ 4,
+ eval("function t1(a,b) { return a; }; t1(4)"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1();",
+ void 0,
+ eval("function t1(a,b) { return a; }; t1()"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1(1,2,4);",
+ 1,
+ eval("function t1(a,b) { return a; }; t1(1,2,4)"));
+/*
+
+new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );",
+void 0,
+eval("function t1(a,a) { return a; }; t1( 4 )"));
+
+new TestCase(SECTION,
+"function t1(a,a) { return a; }; t1( 1,2 );",
+2,
+eval("function t1(a,a) { return a; }; t1( 1,2 )"));
+*/
+// variable declarations
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1( false, true );",
+ false,
+ eval("function t1(a,b) { return a; }; t1( false, true );"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return b; }; t1( false, true );",
+ true,
+ eval("function t1(a,b) { return b; }; t1( false, true );"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a+b; }; t1( 4, 2 );",
+ 6,
+ eval("function t1(a,b) { return a+b; }; t1( 4, 2 );"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a+b; }; t1( 4 );",
+ Number.NaN,
+ eval("function t1(a,b) { return a+b; }; t1( 4 );"));
+
+// overriding a function name with a variable should fail
+
+new TestCase(SECTION,
+ "function t() { return 'function' };" +
+ "var t = 'variable'; typeof(t)",
+ "string",
+ eval("function t() { return 'function' };" +
+ "var t = 'variable'; typeof(t)"));
+
+// function as a constructor
+
+new TestCase(SECTION,
+ "function t1(a,b) { var a = b; return a; } t1(1,3);",
+ 3,
+ eval("function t1(a, b){ var a = b; return a;}; t1(1,3)"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a",
+ 3,
+ eval("function t2(a,b) { this.a = b; };" +
+ "x = new t2(1,3); x.a"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a",
+ 1,
+ eval("function t2(a,b) { this.a = a; };" +
+ "x = new t2(1,3); x.a"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; this.b = a; } " +
+ "x = new t2(1,3);x.a;",
+ 3,
+ eval("function t2(a,b) { this.a = b; this.b = a; };" +
+ "x = new t2(1,3);x.a;"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; this.b = a; }" +
+ "x = new t2(1,3);x.b;",
+ 1,
+ eval("function t2(a,b) { this.a = b; this.b = a; };" +
+ "x = new t2(1,3);x.b;") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-1.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-1.js
new file mode 100644
index 0000000000..ec49f20596
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-1.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-1.js';
+
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION", "with MyObject, eval should return square of " );
+
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ gTestcases[gTc].description += "( " + INPUT +" )" ;
+
+ with ( MYOBJECT ) {
+ gTestcases[gTc].actual = eval( INPUT );
+ gTestcases[gTc].expect = Math.pow(INPUT,2);
+ }
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-10.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-10.js
new file mode 100644
index 0000000000..218031c83f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-10.js
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-10.js';
+
+/**
+ File Name: 10.1.4-10.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-10";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION", "MYOBJECT.toString()" );
+
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+ var VALUE = 12345;
+ var MYOBJECT = new Number( VALUE );
+
+ with ( MYOBJECT ) {
+ gTestcases[gTc].actual = toString();
+ gTestcases[gTc].expect = String(VALUE);
+ }
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-2.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-2.js
new file mode 100644
index 0000000000..2aee831b45
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-2.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-2.js';
+
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION", "with MyObject, eval should return square of " );
+
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ gTestcases[gTc].description += "( "+INPUT +" )" ;
+
+ with ( this ) {
+ with ( MYOBJECT ) {
+ gTestcases[gTc].actual = eval( INPUT );
+ gTestcases[gTc].expect = Math.pow(INPUT,2);
+ }
+ }
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-3.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-3.js
new file mode 100644
index 0000000000..a3ae0ffdec
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-3.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-3.js';
+
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ gTestcases[gTc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval( INPUT );
+ }
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-4.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-4.js
new file mode 100644
index 0000000000..31274a0209
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-4.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-4.js';
+
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ gTestcases[gTc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval( INPUT );
+ }
+
+ gTestcases[gTc].actual = eval( INPUT );
+ gTestcases[gTc].expect = INPUT;
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-5.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-5.js
new file mode 100644
index 0000000000..c36d2db8cc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-5.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-5.js';
+
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ gTestcases[gTc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval = null;
+ }
+
+ gTestcases[gTc].actual = eval( INPUT );
+ gTestcases[gTc].expect = INPUT;
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-6.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-6.js
new file mode 100644
index 0000000000..da11110cc5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-6.js
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-6.js';
+
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-6";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+
+var testcase = new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+
+var MYOBJECT = new MyObject();
+var INPUT = 2;
+testcase.description += ( INPUT +"" );
+
+with ( MYOBJECT ) {
+ ;
+}
+testcase.actual = eval( INPUT );
+testcase.expect = INPUT;
+
+test();
+
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-7.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-7.js
new file mode 100644
index 0000000000..f1a0db4569
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-7.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-7.js';
+
+/**
+ File Name: 10.1.4-7.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-7";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ gTestcases[gTc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ delete( eval );
+ gTestcases[gTc].actual = eval( INPUT );
+ gTestcases[gTc].expect = INPUT;
+ }
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-8.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-8.js
new file mode 100644
index 0000000000..1eee8da4fb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.4-8.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-8.js';
+
+/**
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( "SECTION",
+ "with MyObject, eval should cube INPUT: " );
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ gTestcases[gTc].description += ( INPUT +"" );
+
+ with ( MYOBJECT ) {
+ eval = new Function ( "x", "return(Math.pow(Number(x),3))" );
+
+ gTestcases[gTc].actual = eval( INPUT );
+ gTestcases[gTc].expect = Math.pow(INPUT,3);
+ }
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+
+function MyObject() {
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-1.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-1.js
new file mode 100644
index 0000000000..363581eff6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-1.js
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.5-1.js';
+
+/**
+ File Name: 10.1.5-1.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.5.1-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Global Object");
+
+
+new TestCase( "SECTION", "Global Code check" );
+
+if ( Object == null ) {
+ gTestcases[0].reason += " Object == null" ;
+}
+if ( Function == null ) {
+ gTestcases[0].reason += " Function == null";
+}
+if ( String == null ) {
+ gTestcases[0].reason += " String == null";
+}
+if ( Array == null ) {
+ gTestcases[0].reason += " Array == null";
+}
+if ( Number == null ) {
+ gTestcases[0].reason += " Function == null";
+}
+if ( Math == null ) {
+ gTestcases[0].reason += " Math == null";
+}
+if ( Boolean == null ) {
+ gTestcases[0].reason += " Boolean == null";
+}
+if ( Date == null ) {
+ gTestcases[0].reason += " Date == null";
+}
+/*
+ if ( NaN == null ) {
+ gTestcases[0].reason += " NaN == null";
+ }
+ if ( Infinity == null ) {
+ gTestcases[0].reason += " Infinity == null";
+ }
+*/
+if ( eval == null ) {
+ gTestcases[0].reason += " eval == null";
+}
+if ( parseInt == null ) {
+ gTestcases[0].reason += " parseInt == null";
+}
+
+if ( gTestcases[0].reason != "" ) {
+ gTestcases[0].actual = "fail";
+} else {
+ gTestcases[0].actual = "pass";
+}
+gTestcases[0].expect = "pass";
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-2.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-2.js
new file mode 100644
index 0000000000..cfba3b5c73
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-2.js
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.5-2.js';
+
+/**
+ File Name: 10.1.5-2.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.5.1-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Global Object");
+
+new TestCase( "SECTION", "Eval Code check" );
+
+var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' +
+ 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' +
+ 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' +
+ 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' +
+ 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' +
+ 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' +
+ 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' +
+ 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' +
+ 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' +
+ 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ;
+
+eval( EVAL_STRING );
+
+/*
+ if ( NaN == null ) {
+ gTestcases[0].reason += " NaN == null";
+ }
+ if ( Infinity == null ) {
+ gTestcases[0].reason += " Infinity == null";
+ }
+*/
+
+if ( gTestcases[0].reason != "" ) {
+ gTestcases[0].actual = "fail";
+} else {
+ gTestcases[0].actual = "pass";
+}
+gTestcases[0].expect = "pass";
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-3.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-3.js
new file mode 100644
index 0000000000..f5234cb13b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-3.js
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.5-3.js';
+
+/**
+ File Name: 10.1.5-3.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.5.1-3";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Global Object");
+
+new TestCase( "SECTION", "Function Code check" );
+
+test();
+
+function test() {
+ if ( Object == null ) {
+ gTestcases[0].reason += " Object == null" ;
+ }
+ if ( Function == null ) {
+ gTestcases[0].reason += " Function == null";
+ }
+ if ( String == null ) {
+ gTestcases[0].reason += " String == null";
+ }
+ if ( Array == null ) {
+ gTestcases[0].reason += " Array == null";
+ }
+ if ( Number == null ) {
+ gTestcases[0].reason += " Function == null";
+ }
+ if ( Math == null ) {
+ gTestcases[0].reason += " Math == null";
+ }
+ if ( Boolean == null ) {
+ gTestcases[0].reason += " Boolean == null";
+ }
+ if ( Date == null ) {
+ gTestcases[0].reason += " Date == null";
+ }
+/*
+ if ( NaN == null ) {
+ gTestcases[0].reason += " NaN == null";
+ }
+ if ( Infinity == null ) {
+ gTestcases[0].reason += " Infinity == null";
+ }
+*/
+ if ( eval == null ) {
+ gTestcases[0].reason += " eval == null";
+ }
+ if ( parseInt == null ) {
+ gTestcases[0].reason += " parseInt == null";
+ }
+
+ if ( gTestcases[0].reason != "" ) {
+ gTestcases[0].actual = "fail";
+ } else {
+ gTestcases[0].actual = "pass";
+ }
+ gTestcases[0].expect = "pass";
+
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-4.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-4.js
new file mode 100644
index 0000000000..953e6a8feb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.5-4.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.5-4.js';
+
+/**
+ File Name: 10.1.5-4.js
+ ECMA Section: 10.1.5 Global Object
+ Description:
+ There is a unique global object which is created before control enters
+ any execution context. Initially the global object has the following
+ properties:
+
+ Built-in objects such as Math, String, Date, parseInt, etc. These have
+ attributes { DontEnum }.
+
+ Additional host defined properties. This may include a property whose
+ value is the global object itself, for example window in HTML.
+
+ As control enters execution contexts, and as ECMAScript code is executed,
+ additional properties may be added to the global object and the initial
+ properties may be changed.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.5.1-4";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Global Object");
+
+new TestCase( "SECTION", "Anonymous Code check" );
+
+
+var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' +
+ 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' +
+ 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' +
+ 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' +
+ 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' +
+ 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' +
+ 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' +
+ 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' +
+ 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' +
+ 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ;
+
+var NEW_FUNCTION = new Function( EVAL_STRING );
+
+if ( gTestcases[0].reason != "" ) {
+ gTestcases[0].actual = "fail";
+} else {
+ gTestcases[0].actual = "pass";
+}
+gTestcases[0].expect = "pass";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-2.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-2.js
new file mode 100644
index 0000000000..40e6f0ee8f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-2.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.8-2.js';
+
+/**
+ File Name: 10.1.8-2
+ ECMA Section: Arguments Object
+ Description:
+
+ When control enters an execution context for declared function code,
+ anonymous code, or implementation-supplied code, an arguments object is
+ created and initialized as follows:
+
+ The [[Prototype]] of the arguments object is to the original Object
+ prototype object, the one that is the initial value of Object.prototype
+ (section 15.2.3.1).
+
+ A property is created with name callee and property attributes {DontEnum}.
+ The initial value of this property is the function object being executed.
+ This allows anonymous functions to be recursive.
+
+ A property is created with name length and property attributes {DontEnum}.
+ The initial value of this property is the number of actual parameter values
+ supplied by the caller.
+
+ For each non-negative integer, iarg, less than the value of the length
+ property, a property is created with name ToString(iarg) and property
+ attributes { DontEnum }. The initial value of this property is the value
+ of the corresponding actual parameter supplied by the caller. The first
+ actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
+ so on. In the case when iarg is less than the number of formal parameters
+ for the function object, this property shares its value with the
+ corresponding property of the activation object. This means that changing
+ this property changes the corresponding property of the activation object
+ and vice versa. The value sharing mechanism depends on the implementation.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.1.8-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Arguments Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Tests for anonymous functions
+
+var GetCallee = new Function( "var c = arguments.callee; return c" );
+var GetArguments = new Function( "var a = arguments; return a" );
+var GetLength = new Function( "var l = arguments.length; return l" );
+
+var ARG_STRING = "value of the argument property";
+
+new TestCase( SECTION,
+ "GetCallee()",
+ GetCallee,
+ GetCallee() );
+
+var LIMIT = 100;
+
+for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
+ args += String(i) + ( i+1 < LIMIT ? "," : "" );
+
+}
+
+var LENGTH = eval( "GetLength("+ args +")" );
+
+new TestCase( SECTION,
+ "GetLength("+args+")",
+ 100,
+ LENGTH );
+
+var ARGUMENTS = eval( "GetArguments( " +args+")" );
+
+for ( var i = 0; i < 100; i++ ) {
+ new TestCase( SECTION,
+ "GetArguments("+args+")["+i+"]",
+ i,
+ ARGUMENTS[i] );
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-3.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-3.js
new file mode 100644
index 0000000000..71aa876f02
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.1.8-3.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Norris Boyd
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.8-3.js';
+
+/**
+ File Name: 10.1.8-3
+ ECMA Section: Arguments Object
+ Description:
+
+ The [[Prototype]] of the arguments object is to the original Object
+ prototype object, the one that is the initial value of Object.prototype
+ (section 15.2.3.1).
+
+ ...
+
+ Test that "typeof arguments" is thus "object".
+
+*/
+
+var SECTION = "10.1.8-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Arguments Object";
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var expected = "object";
+var actual = (function () { return typeof arguments; })();
+reportCompare(expected, actual, "typeof arguments == object");
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.1.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.1.js
new file mode 100644
index 0000000000..5384da4f83
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.1.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.2.1.js';
+
+/**
+ File Name: 10.2.1.js
+ ECMA Section: 10.2.1 Global Code
+ Description:
+
+ The scope chain is created and initialized to contain the global object and
+ no others.
+
+ Variable instantiation is performed using the global object as the variable
+ object and using empty property attributes.
+
+ The this value is the global object.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Global Code";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var THIS = this;
+
+new TestCase( SECTION,
+ "this +''",
+ GLOBAL,
+ THIS + "" );
+
+var GLOBAL_PROPERTIES = new Array();
+var i = 0;
+
+for ( p in this ) {
+ GLOBAL_PROPERTIES[i++] = p;
+}
+
+for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ new TestCase( SECTION,
+ GLOBAL_PROPERTIES[i] +" == void 0",
+ false,
+ eval("GLOBAL_PROPERTIES["+i+"] == void 0"));
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-1.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-1.js
new file mode 100644
index 0000000000..787ef9e5b3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-1.js
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.2.2-1.js';
+
+/**
+ File Name: 10.2.2-1.js
+ ECMA Section: 10.2.2 Eval Code
+ Description:
+
+ When control enters an execution context for eval code, the previous
+ active execution context, referred to as the calling context, is used to
+ determine the scope chain, the variable object, and the this value. If
+ there is no calling context, then initializing the scope chain, variable
+ instantiation, and determination of the this value are performed just as
+ for global code.
+
+ The scope chain is initialized to contain the same objects, in the same
+ order, as the calling context's scope chain. This includes objects added
+ to the calling context's scope chain by WithStatement.
+
+ Variable instantiation is performed using the calling context's variable
+ object and using empty property attributes.
+
+ The this value is the same as the this value of the calling context.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.2.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Eval Code";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var THIS = eval("this");
+
+new TestCase( SECTION,
+ "this +''",
+ GLOBAL,
+ THIS + "" );
+
+var GLOBAL_PROPERTIES = new Array();
+var i = 0;
+
+for ( p in THIS ) {
+ GLOBAL_PROPERTIES[i++] = p;
+}
+
+for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ new TestCase( SECTION,
+ GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]",
+ true,
+ eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
+}
+
+// this in eval statements is the same as this value of the calling context
+
+var RESULT = THIS == this;
+
+new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ RESULT );
+
+var RESULT = THIS +'';
+
+new TestCase( SECTION,
+ "eval( 'this + \"\"' )",
+ GLOBAL,
+ RESULT );
+
+
+new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ eval( "this == THIS" ) );
+
+new TestCase( SECTION,
+ "eval( 'this + \"\"' )",
+ GLOBAL,
+ eval( "this +''") );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-2.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-2.js
new file mode 100644
index 0000000000..8048c45575
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.2-2.js
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.2.2-2.js';
+
+/**
+ File Name: 10.2.2-2.js
+ ECMA Section: 10.2.2 Eval Code
+ Description:
+
+ When control enters an execution context for eval code, the previous
+ active execution context, referred to as the calling context, is used to
+ determine the scope chain, the variable object, and the this value. If
+ there is no calling context, then initializing the scope chain, variable
+ instantiation, and determination of the this value are performed just as
+ for global code.
+
+ The scope chain is initialized to contain the same objects, in the same
+ order, as the calling context's scope chain. This includes objects added
+ to the calling context's scope chain by WithStatement.
+
+ Variable instantiation is performed using the calling context's variable
+ object and using empty property attributes.
+
+ The this value is the same as the this value of the calling context.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.2.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Eval Code";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Test Objects
+
+var OBJECT = new MyObject( "hello" );
+var GLOBAL_PROPERTIES = new Array();
+var i = 0;
+
+for ( p in this ) {
+ GLOBAL_PROPERTIES[i++] = p;
+}
+
+with ( OBJECT ) {
+ var THIS = this;
+ new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ eval("this == THIS") );
+ new TestCase( SECTION,
+ "this in a with() block",
+ GLOBAL,
+ this+"" );
+ new TestCase( SECTION,
+ "new MyObject('hello').value",
+ "hello",
+ value );
+ new TestCase( SECTION,
+ "eval(new MyObject('hello').value)",
+ "hello",
+ eval("value") );
+ new TestCase( SECTION,
+ "new MyObject('hello').getClass()",
+ "[object Object]",
+ getClass() );
+ new TestCase( SECTION,
+ "eval(new MyObject('hello').getClass())",
+ "[object Object]",
+ eval("getClass()") );
+ new TestCase( SECTION,
+ "eval(new MyObject('hello').toString())",
+ "hello",
+ eval("toString()") );
+ new TestCase( SECTION,
+ "eval('getClass') == Object.prototype.toString",
+ true,
+ eval("getClass") == Object.prototype.toString );
+
+ for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ new TestCase( SECTION, GLOBAL_PROPERTIES[i] +
+ " == THIS["+GLOBAL_PROPERTIES[i]+"]", true,
+ eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
+ }
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.getClass = Object.prototype.toString;
+ this.toString = new Function( "return this.value+''" );
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-1.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-1.js
new file mode 100644
index 0000000000..a1977c66d6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-1.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.2.3-1.js';
+
+/**
+ File Name: 10.2.3-1.js
+ ECMA Section: 10.2.3 Function and Anonymous Code
+ Description:
+
+ The scope chain is initialized to contain the activation object followed
+ by the global object. Variable instantiation is performed using the
+ activation by the global object. Variable instantiation is performed using
+ the activation object as the variable object and using property attributes
+ { DontDelete }. The caller provides the this value. If the this value
+ provided by the caller is not an object (including the case where it is
+ null), then the this value is the global object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.2.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Eval Code";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var o = new MyObject("hello")
+
+ new TestCase( SECTION,
+ "var o = new MyObject('hello'); o.THIS == x",
+ true,
+ o.THIS == o );
+
+var o = MyFunction();
+
+new TestCase( SECTION,
+ "var o = MyFunction(); o == this",
+ true,
+ o == this );
+
+test();
+
+function MyFunction( value ) {
+ return this;
+}
+function MyObject( value ) {
+ this.THIS = this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-2.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-2.js
new file mode 100644
index 0000000000..e1aa78c5da
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/10.2.3-2.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.2.3-2.js';
+
+/**
+ File Name: 10.2.3-2.js
+ ECMA Section: 10.2.3 Function and Anonymous Code
+ Description:
+
+ The scope chain is initialized to contain the activation object followed
+ by the global object. Variable instantiation is performed using the
+ activation by the global object. Variable instantiation is performed using
+ the activation object as the variable object and using property attributes
+ { DontDelete }. The caller provides the this value. If the this value
+ provided by the caller is not an object (including the case where it is
+ null), then the this value is the global object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.2.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function and Anonymous Code";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var o = new MyObject("hello");
+
+new TestCase( SECTION,
+ "MyFunction(\"PASSED!\")",
+ "PASSED!",
+ MyFunction("PASSED!") );
+
+var o = MyFunction();
+
+new TestCase( SECTION,
+ "MyOtherFunction(true);",
+ false,
+ MyOtherFunction(true) );
+
+test();
+
+function MyFunction( value ) {
+ var x = value;
+ delete x;
+ return x;
+}
+function MyOtherFunction(value) {
+ var x = value;
+ return delete x;
+}
+function MyObject( value ) {
+ this.THIS = this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/browser.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/shell.js b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/shell.js
new file mode 100644
index 0000000000..1d353cff74
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ExecutionContexts/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'ExecutionContexts';
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.1.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.1.1.js
new file mode 100644
index 0000000000..18f0ec7f13
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.1.1.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.1.1.js';
+
+/**
+ File Name: 11.1.1.js
+ ECMA Section: 11.1.1 The this keyword
+ Description:
+
+ The this keyword evaluates to the this value of the execution context.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.1.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The this keyword");
+
+var GLOBAL_OBJECT = this.toString();
+
+// this in global code and eval(this) in global code should return the global object.
+
+new TestCase( SECTION,
+ "Global Code: this.toString()",
+ GLOBAL_OBJECT,
+ this.toString() );
+
+new TestCase( SECTION,
+ "Global Code: eval('this.toString()')",
+ GLOBAL_OBJECT,
+ eval('this.toString()') );
+
+// this in anonymous code called as a function should return the global object.
+
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('return this.toString()'); MYFUNC()",
+ GLOBAL_OBJECT,
+ eval("var MYFUNC = new Function('return this.toString()'); MYFUNC()") );
+
+// eval( this ) in anonymous code called as a function should return that function's activation object
+
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('return (eval(\"this.toString()\")'); (MYFUNC()).toString()",
+ GLOBAL_OBJECT,
+ eval("var MYFUNC = new Function('return eval(\"this.toString()\")'); (MYFUNC()).toString()") );
+
+// this and eval( this ) in anonymous code called as a constructor should return the object
+
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()",
+ "[object Object]",
+ eval("var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()") );
+
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
+ true,
+ eval("var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
+
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC().THIS).toString()",
+ "[object Object]",
+ eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC()).THIS).toString()") );
+
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
+ true,
+ eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
+
+// this and eval(this) in function code called as a function should return the global object.
+new TestCase( SECTION,
+ "Function Code: ReturnThis()",
+ GLOBAL_OBJECT,
+ ReturnThis() );
+
+new TestCase( SECTION,
+ "Function Code: ReturnEvalThis()",
+ GLOBAL_OBJECT,
+ ReturnEvalThis() );
+
+// this and eval(this) in function code called as a contructor should return the object.
+new TestCase( SECTION,
+ "var MYOBJECT = new ReturnThis(); MYOBJECT.toString()",
+ "[object Object]",
+ eval("var MYOBJECT = new ReturnThis(); MYOBJECT.toString()") );
+
+new TestCase( SECTION,
+ "var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()",
+ "[object Object]",
+ eval("var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()") );
+
+test();
+
+function ReturnThis() {
+ return this.toString();
+}
+
+function ReturnEvalThis() {
+ return( eval("this.toString()") );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-1.js
new file mode 100644
index 0000000000..5b70334ff5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-1.js
@@ -0,0 +1,270 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.10-1.js';
+
+/**
+ File Name: 11.10-1.js
+ ECMA Section: 11.10-1 Binary Bitwise Operators: &
+ Description:
+ Semantics
+
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
+
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.10-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Binary Bitwise Operators: &");
+
+var shiftexp = 0;
+var addexp = 0;
+
+// for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+for ( shiftpow = 0; shiftpow < 1; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
+
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ new TestCase( SECTION,
+ shiftexp + " & " + addexp,
+ And( shiftexp, addexp ),
+ shiftexp & addexp );
+ }
+}
+
+test();
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function And( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+ return ToInt32Decimal(result);
+}
+function Xor( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
+function Or( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-2.js
new file mode 100644
index 0000000000..27bde196e0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-2.js
@@ -0,0 +1,269 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.10-2.js';
+
+/**
+ File Name: 11.10-2.js
+ ECMA Section: 11.10-2 Binary Bitwise Operators: |
+ Description:
+ Semantics
+
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
+
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.10-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Binary Bitwise Operators: |");
+
+var shiftexp = 0;
+var addexp = 0;
+
+for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
+
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ new TestCase( SECTION,
+ shiftexp + " | " + addexp,
+ Or( shiftexp, addexp ),
+ shiftexp | addexp );
+ }
+}
+
+test();
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function And( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+ return ToInt32Decimal(result);
+}
+function Xor( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
+function Or( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-3.js
new file mode 100644
index 0000000000..3da6963255
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.10-3.js
@@ -0,0 +1,268 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.10-3.js';
+
+/**
+ File Name: 11.10-3.js
+ ECMA Section: 11.10-3 Binary Bitwise Operators: ^
+ Description:
+ Semantics
+
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
+
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.10-3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Binary Bitwise Operators: ^");
+
+var shiftexp = 0;
+var addexp = 0;
+
+for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
+
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ new TestCase( SECTION,
+ shiftexp + " ^ " + addexp,
+ Xor( shiftexp, addexp ),
+ shiftexp ^ addexp );
+ }
+}
+
+test();
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function And( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+ return ToInt32Decimal(result);
+}
+function Xor( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
+function Or( s, a ) {
+ s = ToInt32( s );
+ a = ToInt32( a );
+
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
+
+ var result = "";
+
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
+ }
+ }
+
+ return ToInt32Decimal(result);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-1.js
new file mode 100644
index 0000000000..ff131b672e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-1.js
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.12-1.js';
+
+/**
+ File Name: 11.12.js
+ ECMA Section: 11.12 Conditional Operator
+ Description:
+ Logi
+
+ calORExpression ? AssignmentExpression : AssignmentExpression
+
+ Semantics
+
+ The production ConditionalExpression :
+ LogicalORExpression ? AssignmentExpression : AssignmentExpression
+ is evaluated as follows:
+
+ 1. Evaluate LogicalORExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToBoolean(Result(2)).
+ 4. If Result(3) is false, go to step 8.
+ 5. Evaluate the first AssignmentExpression.
+ 6. Call GetValue(Result(5)).
+ 7. Return Result(6).
+ 8. Evaluate the second AssignmentExpression.
+ 9. Call GetValue(Result(8)).
+ 10. Return Result(9).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.12";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Conditional operator( ? : )");
+
+new TestCase( SECTION,
+ "true ? 'PASSED' : 'FAILED'",
+ "PASSED",
+ (true?"PASSED":"FAILED"));
+
+new TestCase( SECTION,
+ "false ? 'FAILED' : 'PASSED'",
+ "PASSED",
+ (false?"FAILED":"PASSED"));
+
+new TestCase( SECTION,
+ "1 ? 'PASSED' : 'FAILED'",
+ "PASSED",
+ (true?"PASSED":"FAILED"));
+
+new TestCase( SECTION,
+ "0 ? 'FAILED' : 'PASSED'",
+ "PASSED",
+ (false?"FAILED":"PASSED"));
+
+new TestCase( SECTION,
+ "-1 ? 'PASSED' : 'FAILED'",
+ "PASSED",
+ (true?"PASSED":"FAILED"));
+
+new TestCase( SECTION,
+ "NaN ? 'FAILED' : 'PASSED'",
+ "PASSED",
+ (Number.NaN?"FAILED":"PASSED"));
+
+new TestCase( SECTION,
+ "var VAR = true ? , : 'FAILED'",
+ "PASSED",
+ (VAR = true ? "PASSED" : "FAILED") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-2-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-2-n.js
new file mode 100644
index 0000000000..c2a1e894e0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-2-n.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.12-2-n.js';
+
+/**
+ File Name: 11.12-2-n.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.12-2-n";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+
+// the following expression should be an error in JS.
+
+DESCRIPTION = "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR",
+ "error",
+ eval("var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-3.js
new file mode 100644
index 0000000000..11dde79fb3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-3.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.12-3.js';
+
+/**
+ File Name: 11.12-3.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.12-3";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+
+// the following expression should NOT be an error in JS.
+
+new TestCase( SECTION,
+ "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR",
+ "PASSED",
+ eval("var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR"));
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-4.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-4.js
new file mode 100644
index 0000000000..861692c4e8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.12-4.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.12-4.js';
+
+/**
+ File Name: 11.12-4.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.12-4";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+
+// the following expression should NOT be an error in JS.
+
+new TestCase( SECTION,
+ "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1",
+ "PASSED",
+ eval("true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.1.js
new file mode 100644
index 0000000000..5e548a3e76
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.1.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.13.1.js';
+
+/**
+ File Name: 11.13.1.js
+ ECMA Section: 11.13.1 Simple assignment
+ Description:
+
+ 11.13.1 Simple Assignment ( = )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression = AssignmentExpression is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Evaluate AssignmentExpression.
+ 3. Call GetValue(Result(2)).
+ 4. Call PutValue(Result(1), Result(3)).
+ 5. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.13.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Simple Assignment ( = )");
+
+new TestCase( SECTION,
+ "SOMEVAR = true",
+ true,
+ SOMEVAR = true );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-1.js
new file mode 100644
index 0000000000..41402b77ce
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-1.js
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.13.2-1.js';
+
+/**
+ File Name: 11.13.2-1.js
+ ECMA Section: 11.13.2 Compound Assignment: *=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.13.2-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Compound Assignment: *=");
+
+
+// NaN cases
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 *= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2; VAR1") );
+
+// number cases
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 *= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0xFF; VAR2 = 0xA, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 *= VAR2") );
+
+// special multiplication cases
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= Infinity; VAR1 *= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= -Infinity; VAR1 *= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2= Infinity; VAR1 *= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2=-Infinity; VAR1 *= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+// string cases
+new TestCase( SECTION,
+ "VAR1 = 10; VAR2 = '255', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = 10; VAR2 = '255', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
+
+// boolean cases
+new TestCase( SECTION,
+ "VAR1 = true; VAR2 = false; VAR1 *= VAR2",
+ 0,
+ eval("VAR1 = true; VAR2 = false; VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = true; VAR2 = true; VAR1 *= VAR2",
+ 1,
+ eval("VAR1 = true; VAR2 = true; VAR1 *= VAR2") );
+
+// object cases
+new TestCase( SECTION,
+ "VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2;VAR1",
+ 10,
+ eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1",
+ 110,
+ eval("VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2",
+ 110,
+ eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2",
+ 225,
+ eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-2.js
new file mode 100644
index 0000000000..2d3b53630b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-2.js
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.13.2-2.js';
+
+/**
+ File Name: 11.13.2-2js
+ ECMA Section: 11.13.2 Compound Assignment: /=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.13.2-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Compound Assignment: /=");
+
+
+// NaN cases
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") );
+
+// number cases
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2",
+ 25.5,
+ eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") );
+
+// special division cases
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= 0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= 0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= 0; VAR1 /= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -0; VAR1 /= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= 0; VAR1 /= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -0; VAR1 /= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+// string cases
+new TestCase( SECTION,
+ "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1",
+ 100,
+ eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1",
+ 100,
+ eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") );
+/*
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
+
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
+
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") );
+
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") );
+
+*/
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-3.js
new file mode 100644
index 0000000000..c432934a30
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-3.js
@@ -0,0 +1,300 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.13.2-3.js';
+
+/**
+ File Name: 11.13.2-4.js
+ ECMA Section: 11.13.2 Compound Assignment: %=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.13.2-3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Compound Assignment: +=");
+
+// If either operand is NaN, result is NaN
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") );
+
+// if the dividend is infinity or the divisor is zero or both, the result is NaN
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+// if the dividend is finite and the divisor is an infinity, the result equals the dividend.
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ 1,
+ eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ -1,
+ eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ -1,
+ eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ 1,
+ eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+// if the dividend is a zero and the divisor is finite, the result is the same as the dividend
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
+
+// string cases
+new TestCase( SECTION,
+ "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") );
+/*
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
+
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
+
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") );
+
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") );
+
+*/
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-4.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-4.js
new file mode 100644
index 0000000000..8514dd8c9c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-4.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.13.2-4.js';
+
+/**
+ File Name: 11.13.2-4.js
+ ECMA Section: 11.13.2 Compound Assignment:+=
+ Description:
+
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.13.2-4";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Compound Assignment: +=");
+
+// If either operand is NaN, result is NaN
+
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") );
+
+// the sum of two Infinities the same sign is the infinity of that sign
+// the sum of two Infinities of opposite sign is NaN
+
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+
+// the sum of an infinity and a finite value is equal to the infinite operand
+
+new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+
+// the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
+
+new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") );
+
+// the sum of a zero and a nonzero finite value is eqal to the nonzero operand
+
+new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") );
+
+// the sum of a zero and a nozero finite value is equal to the nonzero operand.
+new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") );
+
+// the sum of two nonzero finite values of the same magnitude and opposite sign is +0
+new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") );
+
+/*
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
+
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
+
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") );
+
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") );
+
+*/
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-5.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-5.js
new file mode 100644
index 0000000000..99d227b80f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.2-5.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.13.2-5.js';
+
+/**
+ File Name: 11.13.2-5.js
+ ECMA Section: 11.13.2 Compound Assignment: -=
+ Description:
+
+ *= /= %= -= -= <<= >>= >>>= &= ^= |=
+
+ 11.13.2 Compound assignment ( op= )
+
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
+
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.13.2-5";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Compound Assignment: -=");
+
+// If either operand is NaN, result is NaN
+
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2; VAR1") );
+
+// the sum of two Infinities the same sign is the infinity of that sign
+// the sum of two Infinities of opposite sign is NaN
+
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 -= VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+
+// the sum of an infinity and a finite value is equal to the infinite operand
+
+new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+
+// the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
+
+new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 -= VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
+
+// the sum of a zero and a nonzero finite value is eqal to the nonzero operand
+
+new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = 0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = -0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = -0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = 0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
+
+// the sum of a zero and a nozero finite value is equal to the nonzero operand.
+new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
+
+// the sum of two nonzero finite values of the same magnitude and opposite sign is +0
+new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1") );
+
+/*
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
+
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
+
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 -= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 -= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 -= VAR2") );
+
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2") );
+
+*/
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.js
new file mode 100644
index 0000000000..bf5f172d36
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.13.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.13.js';
+
+/**
+ File Name: 11.12.js
+ ECMA Section: 11.12 Conditional Operator
+ Description:
+ Logi
+
+ calORExpression ? AssignmentExpression : AssignmentExpression
+
+ Semantics
+
+ The production ConditionalExpression :
+ LogicalORExpression ? AssignmentExpression : AssignmentExpression
+ is evaluated as follows:
+
+ 1. Evaluate LogicalORExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToBoolean(Result(2)).
+ 4. If Result(3) is false, go to step 8.
+ 5. Evaluate the first AssignmentExpression.
+ 6. Call GetValue(Result(5)).
+ 7. Return Result(6).
+ 8. Evaluate the second AssignmentExpression.
+ 9. Call GetValue(Result(8)).
+ 10. Return Result(9).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.12";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Conditional operator( ? : )");
+
+new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+
+new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+
+new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED"));
+
+new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.14-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.14-1.js
new file mode 100644
index 0000000000..c2f30afb6a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.14-1.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.14-1.js';
+
+/**
+ File Name: 11.14-1.js
+ ECMA Section: 11.14 Comma operator (,)
+ Description:
+ Expression :
+
+ AssignmentExpression
+ Expression , AssignmentExpression
+
+ Semantics
+
+ The production Expression : Expression , AssignmentExpression is evaluated as follows:
+
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Return Result(4).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.14-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Comma operator (,)");
+
+new TestCase( SECTION, "true, false", false, eval("true, false") );
+new TestCase( SECTION, "VAR1=true, VAR2=false", false, eval("VAR1=true, VAR2=false") );
+new TestCase( SECTION, "VAR1=true, VAR2=false;VAR1", true, eval("VAR1=true, VAR2=false; VAR1") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-1.js
new file mode 100644
index 0000000000..91e25b01f1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-1.js
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.1-1.js';
+
+/**
+ File Name: 11.2.1-1.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+
+// go through all Native Function objects, methods, and properties and get their typeof.
+
+var PROPERTY = new Array();
+var p = 0;
+
+// properties and functions of the global object
+
+PROPERTY[p++] = new Property( "this", "NaN", "number" );
+PROPERTY[p++] = new Property( "this", "Infinity", "number" );
+PROPERTY[p++] = new Property( "this", "eval", "function" );
+PROPERTY[p++] = new Property( "this", "parseInt", "function" );
+PROPERTY[p++] = new Property( "this", "parseFloat", "function" );
+PROPERTY[p++] = new Property( "this", "escape", "function" );
+PROPERTY[p++] = new Property( "this", "unescape", "function" );
+PROPERTY[p++] = new Property( "this", "isNaN", "function" );
+PROPERTY[p++] = new Property( "this", "isFinite", "function" );
+PROPERTY[p++] = new Property( "this", "Object", "function" );
+PROPERTY[p++] = new Property( "this", "Number", "function" );
+PROPERTY[p++] = new Property( "this", "Function", "function" );
+PROPERTY[p++] = new Property( "this", "Array", "function" );
+PROPERTY[p++] = new Property( "this", "String", "function" );
+PROPERTY[p++] = new Property( "this", "Boolean", "function" );
+PROPERTY[p++] = new Property( "this", "Date", "function" );
+PROPERTY[p++] = new Property( "this", "Math", "object" );
+
+// properties and methods of Object objects
+
+PROPERTY[p++] = new Property( "Object", "prototype", "object" );
+PROPERTY[p++] = new Property( "Object", "toString", "function" );
+PROPERTY[p++] = new Property( "Object", "valueOf", "function" );
+PROPERTY[p++] = new Property( "Object", "constructor", "function" );
+
+// properties of the Function object
+
+PROPERTY[p++] = new Property( "Function", "prototype", "function" );
+PROPERTY[p++] = new Property( "Function.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Function.prototype", "length", "number" );
+PROPERTY[p++] = new Property( "Function.prototype", "valueOf", "function" );
+
+Function.prototype.myProperty = "hi";
+
+PROPERTY[p++] = new Property( "Function.prototype", "myProperty", "string" );
+
+// properties of the Array object
+PROPERTY[p++] = new Property( "Array", "prototype", "object" );
+PROPERTY[p++] = new Property( "Array", "length", "number" );
+PROPERTY[p++] = new Property( "Array.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "join", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "reverse", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "sort", "function" );
+
+// properties of the String object
+PROPERTY[p++] = new Property( "String", "prototype", "object" );
+PROPERTY[p++] = new Property( "String", "fromCharCode", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "valueOf", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "charAt", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "charCodeAt", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "indexOf", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "lastIndexOf", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "split", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "substring", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "toLowerCase", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "toUpperCase", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "length", "number" );
+
+// properties of the Boolean object
+PROPERTY[p++] = new Property( "Boolean", "prototype", "object" );
+PROPERTY[p++] = new Property( "Boolean", "constructor", "function" );
+PROPERTY[p++] = new Property( "Boolean.prototype", "valueOf", "function" );
+PROPERTY[p++] = new Property( "Boolean.prototype", "toString", "function" );
+
+// properties of the Number object
+
+PROPERTY[p++] = new Property( "Number", "MAX_VALUE", "number" );
+PROPERTY[p++] = new Property( "Number", "MIN_VALUE", "number" );
+PROPERTY[p++] = new Property( "Number", "NaN", "number" );
+PROPERTY[p++] = new Property( "Number", "NEGATIVE_INFINITY", "number" );
+PROPERTY[p++] = new Property( "Number", "POSITIVE_INFINITY", "number" );
+PROPERTY[p++] = new Property( "Number.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Number.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "Number.prototype", "valueOf", "function" );
+
+// properties of the Math Object.
+PROPERTY[p++] = new Property( "Math", "E", "number" );
+PROPERTY[p++] = new Property( "Math", "LN10", "number" );
+PROPERTY[p++] = new Property( "Math", "LN2", "number" );
+PROPERTY[p++] = new Property( "Math", "LOG2E", "number" );
+PROPERTY[p++] = new Property( "Math", "LOG10E", "number" );
+PROPERTY[p++] = new Property( "Math", "PI", "number" );
+PROPERTY[p++] = new Property( "Math", "SQRT1_2", "number" );
+PROPERTY[p++] = new Property( "Math", "SQRT2", "number" );
+PROPERTY[p++] = new Property( "Math", "abs", "function" );
+PROPERTY[p++] = new Property( "Math", "acos", "function" );
+PROPERTY[p++] = new Property( "Math", "asin", "function" );
+PROPERTY[p++] = new Property( "Math", "atan", "function" );
+PROPERTY[p++] = new Property( "Math", "atan2", "function" );
+PROPERTY[p++] = new Property( "Math", "ceil", "function" );
+PROPERTY[p++] = new Property( "Math", "cos", "function" );
+PROPERTY[p++] = new Property( "Math", "exp", "function" );
+PROPERTY[p++] = new Property( "Math", "floor", "function" );
+PROPERTY[p++] = new Property( "Math", "log", "function" );
+PROPERTY[p++] = new Property( "Math", "max", "function" );
+PROPERTY[p++] = new Property( "Math", "min", "function" );
+PROPERTY[p++] = new Property( "Math", "pow", "function" );
+PROPERTY[p++] = new Property( "Math", "random", "function" );
+PROPERTY[p++] = new Property( "Math", "round", "function" );
+PROPERTY[p++] = new Property( "Math", "sin", "function" );
+PROPERTY[p++] = new Property( "Math", "sqrt", "function" );
+PROPERTY[p++] = new Property( "Math", "tan", "function" );
+
+// properties of the Date object
+PROPERTY[p++] = new Property( "Date", "parse", "function" );
+PROPERTY[p++] = new Property( "Date", "prototype", "object" );
+PROPERTY[p++] = new Property( "Date", "UTC", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "valueOf", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getTime", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getDay", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCDay", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getMilliseconds","function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCMilliseconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setTime", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setMilliseconds","function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCMilliseconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toLocaleString", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toUTCString", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toGMTString", "function" );
+
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name );
+
+ new TestCase( SECTION,
+ "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name,
+ PROPERTY[i].type,
+ RESULT );
+
+ RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']");
+
+ new TestCase( SECTION,
+ "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']",
+ PROPERTY[i].type,
+ RESULT );
+}
+
+test();
+
+function MyObject( arg0, arg1, arg2, arg3, arg4 ) {
+ this.name = arg0;
+}
+function Property( object, name, type ) {
+ this.object = object;
+ this.name = name;
+ this.type = type;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-2.js
new file mode 100644
index 0000000000..eda8168c0f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-2.js
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.1-2.js';
+
+/**
+ File Name: 11.2.1-2.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+
+// go through all Native Function objects, methods, and properties and get their typeof.
+
+var PROPERTY = new Array();
+var p = 0;
+
+// try to access properties of primitive types
+
+PROPERTY[p++] = new Property( "\"hi\"", "hi", "hi", NaN );
+PROPERTY[p++] = new Property( NaN, NaN, "NaN", NaN );
+// PROPERTY[p++] = new Property( 3, 3, "3", 3 );
+PROPERTY[p++] = new Property( true, true, "true", 1 );
+PROPERTY[p++] = new Property( false, false, "false", 0 );
+
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
+
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( PROPERTY[i].object+ ".toString()" ) );
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-3-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-3-n.js
new file mode 100644
index 0000000000..0732aa0378
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-3-n.js
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.1-3-n.js';
+
+/**
+ File Name: 11.2.1-2.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+
+// go through all Native Function objects, methods, and properties and get their typeof.
+
+var PROPERTY = new Array();
+var p = 0;
+
+// try to access properties of primitive types
+
+PROPERTY[p++] = new Property( "undefined", void 0, "undefined", NaN );
+
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+
+ DESCRIPTION = PROPERTY[i].object + ".valueOf()";
+ EXPECTED = "error";
+
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
+
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval(PROPERTY[i].object+ ".toString()") );
+}
+test();
+
+
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-4-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-4-n.js
new file mode 100644
index 0000000000..110684c9c6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-4-n.js
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.1-4-n.js';
+
+/**
+ File Name: 11.2.1-4-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.2.1-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+
+// go through all Native Function objects, methods, and properties and get their typeof.
+
+var PROPERTY = new Array();
+var p = 0;
+
+// try to access properties of primitive types
+
+PROPERTY[p++] = new Property( "null", null, "null", 0 );
+
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+
+ DESCRIPTION = PROPERTY[i].object + ".valueOf()";
+ EXPECTED = "error";
+
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
+
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval(PROPERTY[i].object+ ".toString()") );
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-5.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-5.js
new file mode 100644
index 0000000000..2d9f0f1632
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.1-5.js
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.1-5.js';
+
+/**
+ File Name: 11.2.1-5.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
+
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
+
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ <identifier-string> ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ <identifier-string> ]
+ where <identifier-string> is a string literal containing the same sequence
+ of characters as the Identifier.
+
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
+
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.2.1-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+
+// go through all Native Function objects, methods, and properties and get their typeof.
+
+var PROPERTY = new Array();
+var p = 0;
+
+// try to access properties of primitive types
+
+PROPERTY[p++] = new Property( new String("hi"), "hi", "hi", NaN );
+PROPERTY[p++] = new Property( new Number(NaN), NaN, "NaN", NaN );
+PROPERTY[p++] = new Property( new Number(3), 3, "3", 3 );
+PROPERTY[p++] = new Property( new Boolean(true), true, "true", 1 );
+PROPERTY[p++] = new Property( new Boolean(false), false, "false", 0 );
+
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( "PROPERTY[i].object.valueOf()" ) );
+
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( "PROPERTY[i].object.toString()" ) );
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
+}
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1-n.js
new file mode 100644
index 0000000000..3603892114
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1-n.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-1-n.js';
+
+/**
+ File Name: 11.2.2-1.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-1-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var OBJECT = new Object();
+
+DESCRIPTION = "OBJECT = new Object; var o = new OBJECT()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "OBJECT = new Object; var o = new OBJECT()",
+ "error",
+ eval("o = new OBJECT()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1.js
new file mode 100644
index 0000000000..7105f17071
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-1.js
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-1.js';
+
+/**
+ File Name: 11.2.2-1.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "(new TestFunction(0,1,2,3,4,5)).length",
+ 6,
+ (new TestFunction(0,1,2,3,4,5)).length );
+
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-10-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-10-n.js
new file mode 100644
index 0000000000..36781503d9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-10-n.js
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-10-n.js';
+
+/**
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-9-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var m = new Math()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var m = new Math()",
+ "error",
+ eval("m = new Math()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-11.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-11.js
new file mode 100644
index 0000000000..03a0f8c436
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-11.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-11.js';
+
+/**
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-9-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var FUNCTION = new Function();
+
+new TestCase( SECTION,
+ "var FUNCTION = new Function(); f = new FUNCTION(); typeof f",
+ "object",
+ eval("var FUNCTION = new Function(); f = new FUNCTION(); typeof f") );
+
+new TestCase( SECTION,
+ "var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f",
+ "object",
+ eval("var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-2-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-2-n.js
new file mode 100644
index 0000000000..7fbea97ca1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-2-n.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-2-n.js';
+
+/**
+ File Name: 11.2.2-2.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-2-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var UNDEFINED = void 0;
+
+DESCRIPTION = "UNDEFINED = void 0; var o = new UNDEFINED()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "UNDEFINED = void 0; var o = new UNDEFINED()",
+ "error",
+ eval("o = new UNDEFINED()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-3-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-3-n.js
new file mode 100644
index 0000000000..8b344a3dda
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-3-n.js
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-3-n.js';
+
+/**
+ File Name: 11.2.2-3-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-3-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var DESCRIPTION = "NULL = null; var o = new NULL()";
+var EXPECTED = "error";
+var NULL = null;
+
+new TestCase( SECTION,
+ "NULL = null; var o = new NULL()",
+ "error",
+ eval("o = new NULL()") );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-4-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-4-n.js
new file mode 100644
index 0000000000..c2ff538b9f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-4-n.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-4-n.js';
+
+/**
+ File Name: 11.2.2-4-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-4-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var STRING = "";
+
+DESCRIPTION = "STRING = '', var s = new STRING()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "STRING = '', var s = new STRING()",
+ "error",
+ eval("s = new STRING()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-5-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-5-n.js
new file mode 100644
index 0000000000..ba8d0756fb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-5-n.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-5-n.js';
+
+/**
+ File Name: 11.2.2-5-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-5-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var NUMBER = 0;
+
+DESCRIPTION = "NUMBER=0, var n = new NUMBER()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "NUMBER=0, var n = new NUMBER()",
+ "error",
+ eval("n = new NUMBER()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-6-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-6-n.js
new file mode 100644
index 0000000000..f89b4009e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-6-n.js
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-6-n.js';
+
+/**
+ File Name: 11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.2.2-6-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var BOOLEAN = true;
+DESCRIPTION = "BOOLEAN = true; var b = new BOOLEAN()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "BOOLEAN = true; var b = new BOOLEAN()",
+ "error",
+ eval("b = new BOOLEAN()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-7-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-7-n.js
new file mode 100644
index 0000000000..97ae43e810
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-7-n.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-7-n.js';
+
+/**
+ File Name: 11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-6-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var STRING = new String("hi");
+
+DESCRIPTION = "var STRING = new String('hi'); var s = new STRING()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var STRING = new String('hi'); var s = new STRING()",
+ "error",
+ eval("s = new STRING()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-8-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-8-n.js
new file mode 100644
index 0000000000..10117c726e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-8-n.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-8-n.js';
+
+/**
+ File Name: 11.2.2-8-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-8-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var NUMBER = new Number(1);
+
+DESCRIPTION = "var NUMBER = new Number(1); var n = new NUMBER()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var NUMBER = new Number(1); var n = new NUMBER()",
+ "error",
+ eval("n = new NUMBER()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-9-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-9-n.js
new file mode 100644
index 0000000000..6099754ca3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.2-9-n.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.2-9-n.js';
+
+/**
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
+
+ new NewExpression
+
+ The production NewExpression : new NewExpression is evaluated as follows:
+
+ 1. Evaluate NewExpression.
+ 2. Call GetValue(Result(1)).
+ 3. If Type(Result(2)) is not Object, generate a runtime error.
+ 4. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 5. Call the [[Construct]] method on Result(2), providing no arguments
+ (that is, an empty list of arguments).
+ 6. If Type(Result(5)) is not Object, generate a runtime error.
+ 7. Return Result(5).
+
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 4. If Type(Result(2)) is not Object, generate a runtime error.
+ 5. If Result(2) does not implement the internal [[Construct]] method,
+ generate a runtime error.
+ 6. Call the [[Construct]] method on Result(2), providing the list
+ Result(3) as the argument values.
+ 7. If Type(Result(6)) is not Object, generate a runtime error.
+ 8 .Return Result(6).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.2-9-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var BOOLEAN = new Boolean();
+
+DESCRIPTION = "var BOOLEAN = new Boolean(); var b = new BOOLEAN()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var BOOLEAN = new Boolean(); var b = new BOOLEAN()",
+ "error",
+ eval("b = new BOOLEAN()") );
+test();
+
+function TestFunction() {
+ return arguments;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-1.js
new file mode 100644
index 0000000000..6e36ba8d3f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-1.js
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.3-1.js';
+
+/**
+ File Name: 11.2.3-1.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+/* this.eval() is no longer legal syntax.
+// MemberExpression : this
+
+new TestCase( SECTION,
+"this.eval()",
+void 0,
+this.eval() );
+
+new TestCase( SECTION,
+"this.eval('NaN')",
+NaN,
+this.eval("NaN") );
+*/
+// MemberExpression: Identifier
+
+var OBJECT = true;
+
+new TestCase( SECTION,
+ "OBJECT.toString()",
+ "true",
+ OBJECT.toString() );
+
+// MemberExpression[ Expression]
+
+new TestCase( SECTION,
+ "(new Array())['length'].valueOf()",
+ 0,
+ (new Array())["length"].valueOf() );
+
+// MemberExpression . Identifier
+new TestCase( SECTION,
+ "(new Array()).length.valueOf()",
+ 0,
+ (new Array()).length.valueOf() );
+// new MemberExpression Arguments
+
+new TestCase( SECTION,
+ "(new Array(20))['length'].valueOf()",
+ 20,
+ (new Array(20))["length"].valueOf() );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-2-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-2-n.js
new file mode 100644
index 0000000000..c3539e817a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-2-n.js
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.3-2-n.js';
+
+/**
+ File Name: 11.2.3-2-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.3-2-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "3.valueOf()",
+ 3,
+ eval("3.valueOf()") );
+
+new TestCase( SECTION,
+ "(3).valueOf()",
+ 3,
+ eval("(3).valueOf()") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-3-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-3-n.js
new file mode 100644
index 0000000000..3023fee16b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-3-n.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.3-3-n.js';
+
+/**
+ File Name: 11.2.3-3-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.3-3-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "(void 0).valueOf()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "(void 0).valueOf()",
+ "error",
+ eval("(void 0).valueOf()") );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-4-n.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-4-n.js
new file mode 100644
index 0000000000..3c0ac1a4b3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-4-n.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.3-4-n.js';
+
+/**
+ File Name: 11.2.3-4-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.3-4-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "null.valueOf()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "null.valueOf()",
+ "error",
+ eval("null.valueOf()") );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-5.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-5.js
new file mode 100644
index 0000000000..92b356c1dd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.2.3-5.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.2.3-5.js';
+
+/**
+ File Name: 11.2.3-5-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3. Call GetValue(Result(1)).
+ 4. If Type(Result(3)) is not Object, generate a runtime error.
+ 5. If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6. If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7. If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8. Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9. Return Result(8).
+
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
+
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "11.2.3-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "true.valueOf()", true, true.valueOf() );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.1.js
new file mode 100644
index 0000000000..29235f1107
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.1.js
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.3.1.js';
+
+/**
+ File Name: 11.3.1.js
+ ECMA Section: 11.3.1 Postfix increment operator
+ Description:
+ The production MemberExpression : MemberExpression ++ is evaluated as
+ follows:
+
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Add the value 1 to Result(3), using the same rules as for the +
+ operator (section 0).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.3.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Postfix increment operator");
+
+// special numbers
+new TestCase( SECTION, "var MYVAR; MYVAR++", NaN, eval("var MYVAR; MYVAR++") );
+new TestCase( SECTION, "var MYVAR= void 0; MYVAR++", NaN, eval("var MYVAR=void 0; MYVAR++") );
+new TestCase( SECTION, "var MYVAR=null; MYVAR++", 0, eval("var MYVAR=null; MYVAR++") );
+new TestCase( SECTION, "var MYVAR=true; MYVAR++", 1, eval("var MYVAR=true; MYVAR++") );
+new TestCase( SECTION, "var MYVAR=false; MYVAR++", 0, eval("var MYVAR=false; MYVAR++") );
+
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++;MYVAR") );
+
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;MYVAR++", 0, eval("var MYVAR=0;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++", 0.2345, eval("var MYVAR=0.2345;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++", -0.2345, eval("var MYVAR=-0.2345;MYVAR++") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++;MYVAR", 1.2345, eval("var MYVAR=0.2345;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++;MYVAR", 0.7655, eval("var MYVAR=-0.2345;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+
+// boolean values
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=true;MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=true;MYVAR++;MYVAR", 2, eval("var MYVAR=true;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR++;MYVAR", 1, eval("var MYVAR=false;MYVAR++;MYVAR") );
+
+// boolean objects
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++;MYVAR", 2, eval("var MYVAR=new Boolean(true);MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++;MYVAR", 1, eval("var MYVAR=new Boolean(false);MYVAR++;MYVAR") );
+
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';MYVAR++", Number.NaN, eval("var MYVAR='string';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR++", 12345, eval("var MYVAR='12345';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR++", -12345, eval("var MYVAR='-12345';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='0Xf';MYVAR++", 15, eval("var MYVAR='0Xf';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR++", 77, eval("var MYVAR='077';MYVAR++") );
+new TestCase( SECTION, "var MYVAR=''; MYVAR++", 0, eval("var MYVAR='';MYVAR++") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR='string';MYVAR++;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR++;MYVAR", 12346, eval("var MYVAR='12345';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR++;MYVAR", -12344, eval("var MYVAR='-12345';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';MYVAR++;MYVAR", 16, eval("var MYVAR='0xf';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR++;MYVAR", 78, eval("var MYVAR='077';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';MYVAR++;MYVAR", 1, eval("var MYVAR='';MYVAR++;MYVAR") );
+
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++", Number.NaN, eval("var MYVAR=new String('string');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++", 12345, eval("var MYVAR=new String('12345');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++", -12345, eval("var MYVAR=new String('-12345');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR++", 15, eval("var MYVAR=new String('0Xf');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++", 77, eval("var MYVAR=new String('077');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String(''); MYVAR++", 0, eval("var MYVAR=new String('');MYVAR++") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++;MYVAR", 12346, eval("var MYVAR=new String('12345');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++;MYVAR", -12344, eval("var MYVAR=new String('-12345');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR++;MYVAR", 16, eval("var MYVAR=new String('0xf');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++;MYVAR", 78, eval("var MYVAR=new String('077');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');MYVAR++;MYVAR", 1, eval("var MYVAR=new String('');MYVAR++;MYVAR") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.2.js
new file mode 100644
index 0000000000..2d6f6c6770
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.3.2.js
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.3.2.js';
+
+/**
+ File Name: 11.3.2.js
+ ECMA Section: 11.3.2 Postfix decrement operator
+ Description:
+
+ 11.3.2 Postfix decrement operator
+
+ The production MemberExpression : MemberExpression -- is evaluated as follows:
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Subtract the value 1 from Result(3), using the same rules as for the -
+ operator (section 0).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.3.2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Postfix decrement operator");
+
+// special numbers
+new TestCase( SECTION, "var MYVAR; MYVAR--", NaN, eval("var MYVAR; MYVAR--") );
+new TestCase( SECTION, "var MYVAR= void 0; MYVAR--", NaN, eval("var MYVAR=void 0; MYVAR--") );
+new TestCase( SECTION, "var MYVAR=null; MYVAR--", 0, eval("var MYVAR=null; MYVAR--") );
+new TestCase( SECTION, "var MYVAR=true; MYVAR--", 1, eval("var MYVAR=true; MYVAR--") );
+new TestCase( SECTION, "var MYVAR=false; MYVAR--", 0, eval("var MYVAR=false; MYVAR--") );
+
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--;MYVAR") );
+
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;MYVAR--", 0, eval("var MYVAR=0;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--", 0.2345, eval("var MYVAR=0.2345;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--", -0.2345, eval("var MYVAR=-0.2345;MYVAR--") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--;MYVAR", -0.7655, eval("var MYVAR=0.2345;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--;MYVAR", -1.2345, eval("var MYVAR=-0.2345;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+
+// boolean values
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=true;MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=true;MYVAR--;MYVAR", 0, eval("var MYVAR=true;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR--;MYVAR", -1, eval("var MYVAR=false;MYVAR--;MYVAR") );
+
+// boolean objects
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--;MYVAR", 0, eval("var MYVAR=new Boolean(true);MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--;MYVAR", -1, eval("var MYVAR=new Boolean(false);MYVAR--;MYVAR") );
+
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';MYVAR--", Number.NaN, eval("var MYVAR='string';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR--", 12345, eval("var MYVAR='12345';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR--", -12345, eval("var MYVAR='-12345';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='0Xf';MYVAR--", 15, eval("var MYVAR='0Xf';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR--", 77, eval("var MYVAR='077';MYVAR--") );
+new TestCase( SECTION, "var MYVAR=''; MYVAR--", 0, eval("var MYVAR='';MYVAR--") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR='string';MYVAR--;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR--;MYVAR", 12344, eval("var MYVAR='12345';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR--;MYVAR", -12346, eval("var MYVAR='-12345';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';MYVAR--;MYVAR", 14, eval("var MYVAR='0xf';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR--;MYVAR", 76, eval("var MYVAR='077';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';MYVAR--;MYVAR", -1, eval("var MYVAR='';MYVAR--;MYVAR") );
+
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--", Number.NaN, eval("var MYVAR=new String('string');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--", 12345, eval("var MYVAR=new String('12345');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--", -12345, eval("var MYVAR=new String('-12345');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR--", 15, eval("var MYVAR=new String('0Xf');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--", 77, eval("var MYVAR=new String('077');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String(''); MYVAR--", 0, eval("var MYVAR=new String('');MYVAR--") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--;MYVAR", 12344, eval("var MYVAR=new String('12345');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--;MYVAR", -12346, eval("var MYVAR=new String('-12345');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR--;MYVAR", 14, eval("var MYVAR=new String('0xf');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--;MYVAR", 76, eval("var MYVAR=new String('077');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');MYVAR--;MYVAR", -1, eval("var MYVAR=new String('');MYVAR--;MYVAR") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.1.js
new file mode 100644
index 0000000000..62354e17bc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.1.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.1.js';
+
+/**
+ File Name: 11.4.1.js
+ ECMA Section: 11.4.1 the Delete Operator
+ Description: returns true if the property could be deleted
+ returns false if it could not be deleted
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+
+var SECTION = "11.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The delete operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.length", 2, eval("x=[9,8,7];delete(x[2]);x.length") );
+// new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.toString()", "9,8", eval("x=[9,8,7];delete(x[2]);x.toString()") );
+new TestCase( SECTION, "x=new Date();delete x;typeof(x)", "undefined", eval("x=new Date();delete x;typeof(x)") );
+
+// array[item++] = new TestCase( SECTION, "delete(x=new Date())", true, delete(x=new Date()) );
+// array[item++] = new TestCase( SECTION, "delete('string primitive')", true, delete("string primitive") );
+// array[item++] = new TestCase( SECTION, "delete(new String( 'string object' ) )", true, delete(new String("string object")) );
+// array[item++] = new TestCase( SECTION, "delete(new Number(12345) )", true, delete(new Number(12345)) );
+new TestCase( SECTION, "delete(Math.PI)", false, delete(Math.PI) );
+// array[item++] = new TestCase( SECTION, "delete(null)", true, delete(null) );
+// array[item++] = new TestCase( SECTION, "delete(void(0))", true, delete(void(0)) );
+
+// variables declared with the var statement are not deletable.
+
+var abc;
+new TestCase( SECTION, "var abc; delete(abc)", false, delete abc );
+
+new TestCase( SECTION,
+ "var OB = new MyObject(); for ( p in OB ) { delete p }",
+ true,
+ eval("var OB = new MyObject(); for ( p in OB ) { delete p }") );
+
+test();
+
+function MyObject() {
+ this.prop1 = true;
+ this.prop2 = false;
+ this.prop3 = null;
+ this.prop4 = void 0;
+ this.prop5 = "hi";
+ this.prop6 = 42;
+ this.prop7 = new Date();
+ this.prop8 = Math.PI;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.2.js
new file mode 100644
index 0000000000..b89d9145c9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.2.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.2.js';
+
+/**
+ File Name: 11.4.2.js
+ ECMA Section: 11.4.2 the Void Operator
+ Description: always returns undefined (?)
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "11.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The void operator";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "void(new String('string object'))", void 0, void(new String( 'string object' )) );
+new TestCase( SECTION, "void('string primitive')", void 0, void("string primitive") );
+new TestCase( SECTION, "void(Number.NaN)", void 0, void(Number.NaN) );
+new TestCase( SECTION, "void(Number.POSITIVE_INFINITY)", void 0, void(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "void(1)", void 0, void(1) );
+new TestCase( SECTION, "void(0)", void 0, void(0) );
+new TestCase( SECTION, "void(-1)", void 0, void(-1) );
+new TestCase( SECTION, "void(Number.NEGATIVE_INFINITY)", void 0, void(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "void(Math.PI)", void 0, void(Math.PI) );
+new TestCase( SECTION, "void(true)", void 0, void(true) );
+new TestCase( SECTION, "void(false)", void 0, void(false) );
+new TestCase( SECTION, "void(null)", void 0, void(null) );
+new TestCase( SECTION, "void new String('string object')", void 0, void new String( 'string object' ) );
+new TestCase( SECTION, "void 'string primitive'", void 0, void "string primitive" );
+new TestCase( SECTION, "void Number.NaN", void 0, void Number.NaN );
+new TestCase( SECTION, "void Number.POSITIVE_INFINITY", void 0, void Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "void 1", void 0, void 1 );
+new TestCase( SECTION, "void 0", void 0, void 0 );
+new TestCase( SECTION, "void -1", void 0, void -1 );
+new TestCase( SECTION, "void Number.NEGATIVE_INFINITY", void 0, void Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "void Math.PI", void 0, void Math.PI );
+new TestCase( SECTION, "void true", void 0, void true );
+new TestCase( SECTION, "void false", void 0, void false );
+new TestCase( SECTION, "void null", void 0, void null );
+
+// array[item++] = new TestCase( SECTION, "void()", void 0, void() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.3.js
new file mode 100644
index 0000000000..b746fbe8b5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.3.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.3.js';
+
+/**
+ File Name: typeof_1.js
+ ECMA Section: 11.4.3 typeof operator
+ Description: typeof evaluates unary expressions:
+ undefined "undefined"
+ null "object"
+ Boolean "boolean"
+ Number "number"
+ String "string"
+ Object "object" [native, doesn't implement Call]
+ Object "function" [native, implements [Call]]
+ Object implementation dependent
+ [not sure how to test this]
+ Author: christine@netscape.com
+ Date: june 30, 1997
+
+*/
+
+var SECTION = "11.4.3";
+
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = " The typeof operator";
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "typeof(void(0))", "undefined", typeof(void(0)) );
+new TestCase( SECTION, "typeof(null)", "object", typeof(null) );
+new TestCase( SECTION, "typeof(true)", "boolean", typeof(true) );
+new TestCase( SECTION, "typeof(false)", "boolean", typeof(false) );
+new TestCase( SECTION, "typeof(new Boolean())", "object", typeof(new Boolean()) );
+new TestCase( SECTION, "typeof(new Boolean(true))", "object", typeof(new Boolean(true)) );
+new TestCase( SECTION, "typeof(Boolean())", "boolean", typeof(Boolean()) );
+new TestCase( SECTION, "typeof(Boolean(false))", "boolean", typeof(Boolean(false)) );
+new TestCase( SECTION, "typeof(Boolean(true))", "boolean", typeof(Boolean(true)) );
+new TestCase( SECTION, "typeof(NaN)", "number", typeof(Number.NaN) );
+new TestCase( SECTION, "typeof(Infinity)", "number", typeof(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "typeof(-Infinity)", "number", typeof(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "typeof(Math.PI)", "number", typeof(Math.PI) );
+new TestCase( SECTION, "typeof(0)", "number", typeof(0) );
+new TestCase( SECTION, "typeof(1)", "number", typeof(1) );
+new TestCase( SECTION, "typeof(-1)", "number", typeof(-1) );
+new TestCase( SECTION, "typeof('0')", "string", typeof("0") );
+new TestCase( SECTION, "typeof(Number())", "number", typeof(Number()) );
+new TestCase( SECTION, "typeof(Number(0))", "number", typeof(Number(0)) );
+new TestCase( SECTION, "typeof(Number(1))", "number", typeof(Number(1)) );
+new TestCase( SECTION, "typeof(Nubmer(-1))", "number", typeof(Number(-1)) );
+new TestCase( SECTION, "typeof(new Number())", "object", typeof(new Number()) );
+new TestCase( SECTION, "typeof(new Number(0))", "object", typeof(new Number(0)) );
+new TestCase( SECTION, "typeof(new Number(1))", "object", typeof(new Number(1)) );
+
+// Math does not implement [[Construct]] or [[Call]] so its type is object.
+
+new TestCase( SECTION, "typeof(Math)", "object", typeof(Math) );
+
+new TestCase( SECTION, "typeof(Number.prototype.toString)", "function", typeof(Number.prototype.toString) );
+
+new TestCase( SECTION, "typeof('a string')", "string", typeof("a string") );
+new TestCase( SECTION, "typeof('')", "string", typeof("") );
+new TestCase( SECTION, "typeof(new Date())", "object", typeof(new Date()) );
+new TestCase( SECTION, "typeof(new Array(1,2,3))", "object", typeof(new Array(1,2,3)) );
+new TestCase( SECTION, "typeof(new String('string object'))", "object", typeof(new String("string object")) );
+new TestCase( SECTION, "typeof(String('string primitive'))", "string", typeof(String("string primitive")) );
+new TestCase( SECTION, "typeof(['array', 'of', 'strings'])", "object", typeof(["array", "of", "strings"]) );
+new TestCase( SECTION, "typeof(new Function())", "function", typeof( new Function() ) );
+new TestCase( SECTION, "typeof(parseInt)", "function", typeof( parseInt ) );
+new TestCase( SECTION, "typeof(test)", "function", typeof( test ) );
+new TestCase( SECTION, "typeof(String.fromCharCode)", "function", typeof( String.fromCharCode ) );
+
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.4.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.4.js
new file mode 100644
index 0000000000..cbacf869e4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.4.js
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.4.js';
+
+/**
+ File Name: 11.4.4.js
+ ECMA Section: 11.4.4 Prefix increment operator
+ Description:
+ The production UnaryExpression : ++ UnaryExpression is evaluated as
+ follows:
+
+ 1. Evaluate UnaryExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Add the value 1 to Result(3), using the same rules as for the +
+ operator (section 11.6.3).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(4).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.4.4";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Prefix increment operator");
+
+// special case: var is not defined
+
+new TestCase( SECTION, "var MYVAR; ++MYVAR", NaN, eval("var MYVAR; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR= void 0; ++MYVAR", NaN, eval("var MYVAR=void 0; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR=null; ++MYVAR", 1, eval("var MYVAR=null; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR=true; ++MYVAR", 2, eval("var MYVAR=true; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR=false; ++MYVAR", 1, eval("var MYVAR=false; ++MYVAR") );
+
+// special numbers
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR;MYVAR") );
+
+
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;++MYVAR", 1, eval("var MYVAR=0;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR;MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR;MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+
+// boolean values
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=true;++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=true;++MYVAR;MYVAR", 2, eval("var MYVAR=true;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;++MYVAR;MYVAR", 1, eval("var MYVAR=false;++MYVAR;MYVAR") );
+
+// boolean objects
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR;MYVAR", 2, eval("var MYVAR=new Boolean(true);++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR;MYVAR", 1, eval("var MYVAR=new Boolean(false);++MYVAR;MYVAR") );
+
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';++MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';++MYVAR", 12346, eval("var MYVAR='12345';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';++MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='0Xf';++MYVAR", 16, eval("var MYVAR='0Xf';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';++MYVAR", 78, eval("var MYVAR='077';++MYVAR") );
+new TestCase( SECTION, "var MYVAR=''; ++MYVAR", 1, eval("var MYVAR='';++MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR='string';++MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';++MYVAR;MYVAR", 12346, eval("var MYVAR='12345';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';++MYVAR;MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';++MYVAR;MYVAR", 16, eval("var MYVAR='0xf';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';++MYVAR;MYVAR", 78, eval("var MYVAR='077';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';++MYVAR;MYVAR", 1, eval("var MYVAR='';++MYVAR;MYVAR") );
+
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');++MYVAR", 16, eval("var MYVAR=new String('0Xf');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String(''); ++MYVAR", 1, eval("var MYVAR=new String('');++MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR;MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR;MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');++MYVAR;MYVAR", 16, eval("var MYVAR=new String('0xf');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR;MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');++MYVAR;MYVAR", 1, eval("var MYVAR=new String('');++MYVAR;MYVAR") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.5.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.5.js
new file mode 100644
index 0000000000..ee761c5d96
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.5.js
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.5.js';
+
+/**
+ File Name: 11.4.5.js
+ ECMA Section: 11.4.5 Prefix decrement operator
+ Description:
+
+ The production UnaryExpression : -- UnaryExpression is evaluated as follows:
+
+ 1.Evaluate UnaryExpression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToNumber(Result(2)).
+ 4.Subtract the value 1 from Result(3), using the same rules as for the - operator (section 11.6.3).
+ 5.Call PutValue(Result(1), Result(4)).
+
+ 1.Return Result(4).
+ Author: christine@netscape.com
+ Date: \ 12 november 1997
+*/
+var SECTION = "11.4.5";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Prefix decrement operator");
+
+//
+new TestCase( SECTION, "var MYVAR; --MYVAR", NaN, eval("var MYVAR; --MYVAR") );
+new TestCase( SECTION, "var MYVAR= void 0; --MYVAR", NaN, eval("var MYVAR=void 0; --MYVAR") );
+new TestCase( SECTION, "var MYVAR=null; --MYVAR", -1, eval("var MYVAR=null; --MYVAR") );
+new TestCase( SECTION, "var MYVAR=true; --MYVAR", 0, eval("var MYVAR=true; --MYVAR") );
+new TestCase( SECTION, "var MYVAR=false; --MYVAR", -1, eval("var MYVAR=false; --MYVAR") );
+
+// special numbers
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR;MYVAR") );
+
+
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;--MYVAR", -1, eval("var MYVAR=0;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR;MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR;MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+
+// boolean values
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=true;--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=true;--MYVAR;MYVAR", 0, eval("var MYVAR=true;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;--MYVAR;MYVAR", -1, eval("var MYVAR=false;--MYVAR;MYVAR") );
+
+// boolean objects
+// verify return value
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR;MYVAR", 0, eval("var MYVAR=new Boolean(true);--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR;MYVAR", -1, eval("var MYVAR=new Boolean(false);--MYVAR;MYVAR") );
+
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';--MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';--MYVAR", 12344, eval("var MYVAR='12345';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';--MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='0Xf';--MYVAR", 14, eval("var MYVAR='0Xf';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';--MYVAR", 76, eval("var MYVAR='077';--MYVAR") );
+new TestCase( SECTION, "var MYVAR=''; --MYVAR", -1, eval("var MYVAR='';--MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR='string';--MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';--MYVAR;MYVAR", 12344, eval("var MYVAR='12345';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';--MYVAR;MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';--MYVAR;MYVAR", 14, eval("var MYVAR='0xf';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';--MYVAR;MYVAR", 76, eval("var MYVAR='077';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';--MYVAR;MYVAR", -1, eval("var MYVAR='';--MYVAR;MYVAR") );
+
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');--MYVAR", 14, eval("var MYVAR=new String('0Xf');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String(''); --MYVAR", -1, eval("var MYVAR=new String('');--MYVAR") );
+
+// verify value of variable
+
+new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR;MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR;MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');--MYVAR;MYVAR", 14, eval("var MYVAR=new String('0xf');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR;MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');--MYVAR;MYVAR", -1, eval("var MYVAR=new String('');--MYVAR;MYVAR") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.6.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.6.js
new file mode 100644
index 0000000000..9b100d9d50
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.6.js
@@ -0,0 +1,299 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.6.js';
+
+/**
+ File Name: 11.4.6.js
+ ECMA Section: 11.4.6 Unary + Operator
+ Description: convert operand to Number type
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "11.4.6";
+var VERSION = "ECMA_1";
+var BUGNUMBER="77391";
+
+startTest();
+
+writeHeaderToLog( SECTION + " Unary + operator");
+
+new TestCase( SECTION, "+('')", 0, +("") );
+new TestCase( SECTION, "+(' ')", 0, +(" ") );
+new TestCase( SECTION, "+(\\t)", 0, +("\t") );
+new TestCase( SECTION, "+(\\n)", 0, +("\n") );
+new TestCase( SECTION, "+(\\r)", 0, +("\r") );
+new TestCase( SECTION, "+(\\f)", 0, +("\f") );
+
+new TestCase( SECTION, "+(String.fromCharCode(0x0009)", 0, +(String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x0020)", 0, +(String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000C)", 0, +(String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000B)", 0, +(String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000D)", 0, +(String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000A)", 0, +(String.fromCharCode(0x000A)) );
+
+// a StringNumericLiteral may be preceeded or followed by whitespace and/or
+// line terminators
+
+new TestCase( SECTION, "+( ' ' + 999 )", 999, +( ' '+999) );
+new TestCase( SECTION, "+( '\\n' + 999 )", 999, +( '\n' +999) );
+new TestCase( SECTION, "+( '\\r' + 999 )", 999, +( '\r' +999) );
+new TestCase( SECTION, "+( '\\t' + 999 )", 999, +( '\t' +999) );
+new TestCase( SECTION, "+( '\\f' + 999 )", 999, +( '\f' +999) );
+
+new TestCase( SECTION, "+( 999 + ' ' )", 999, +( 999+' ') );
+new TestCase( SECTION, "+( 999 + '\\n' )", 999, +( 999+'\n' ) );
+new TestCase( SECTION, "+( 999 + '\\r' )", 999, +( 999+'\r' ) );
+new TestCase( SECTION, "+( 999 + '\\t' )", 999, +( 999+'\t' ) );
+new TestCase( SECTION, "+( 999 + '\\f' )", 999, +( 999+'\f' ) );
+
+new TestCase( SECTION, "+( '\\n' + 999 + '\\n' )", 999, +( '\n' +999+'\n' ) );
+new TestCase( SECTION, "+( '\\r' + 999 + '\\r' )", 999, +( '\r' +999+'\r' ) );
+new TestCase( SECTION, "+( '\\t' + 999 + '\\t' )", 999, +( '\t' +999+'\t' ) );
+new TestCase( SECTION, "+( '\\f' + 999 + '\\f' )", 999, +( '\f' +999+'\f' ) );
+
+new TestCase( SECTION, "+( ' ' + '999' )", 999, +( ' '+'999') );
+new TestCase( SECTION, "+( '\\n' + '999' )", 999, +( '\n' +'999') );
+new TestCase( SECTION, "+( '\\r' + '999' )", 999, +( '\r' +'999') );
+new TestCase( SECTION, "+( '\\t' + '999' )", 999, +( '\t' +'999') );
+new TestCase( SECTION, "+( '\\f' + '999' )", 999, +( '\f' +'999') );
+
+new TestCase( SECTION, "+( '999' + ' ' )", 999, +( '999'+' ') );
+new TestCase( SECTION, "+( '999' + '\\n' )", 999, +( '999'+'\n' ) );
+new TestCase( SECTION, "+( '999' + '\\r' )", 999, +( '999'+'\r' ) );
+new TestCase( SECTION, "+( '999' + '\\t' )", 999, +( '999'+'\t' ) );
+new TestCase( SECTION, "+( '999' + '\\f' )", 999, +( '999'+'\f' ) );
+
+new TestCase( SECTION, "+( '\\n' + '999' + '\\n' )", 999, +( '\n' +'999'+'\n' ) );
+new TestCase( SECTION, "+( '\\r' + '999' + '\\r' )", 999, +( '\r' +'999'+'\r' ) );
+new TestCase( SECTION, "+( '\\t' + '999' + '\\t' )", 999, +( '\t' +'999'+'\t' ) );
+new TestCase( SECTION, "+( '\\f' + '999' + '\\f' )", 999, +( '\f' +'999'+'\f' ) );
+
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' )", 99, +( String.fromCharCode(0x0009) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' )", 99, +( String.fromCharCode(0x0020) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' )", 99, +( String.fromCharCode(0x000C) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' )", 99, +( String.fromCharCode(0x000B) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' )", 99, +( String.fromCharCode(0x000D) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' )", 99, +( String.fromCharCode(0x000A) + '99' ) );
+
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0009)", 99, +( '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0020)", 99, +( '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000C)", 99, +( '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000D)", 99, +( '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000B)", 99, +( '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000A)", 99, +( '99' + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 )", 99, +( String.fromCharCode(0x0009) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 )", 99, +( String.fromCharCode(0x0020) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 )", 99, +( String.fromCharCode(0x000C) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 )", 99, +( String.fromCharCode(0x000B) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 )", 99, +( String.fromCharCode(0x000D) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 )", 99, +( String.fromCharCode(0x000A) + 99 ) );
+
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0009)", 99, +( 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0020)", 99, +( 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000C)", 99, +( 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000D)", 99, +( 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000B)", 99, +( 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000A)", 99, +( 99 + String.fromCharCode(0x000A)) );
+
+
+// StrNumericLiteral:::StrDecimalLiteral:::Infinity
+
+new TestCase( SECTION, "+('Infinity')", Math.pow(10,10000), +("Infinity") );
+new TestCase( SECTION, "+('-Infinity')", -Math.pow(10,10000), +("-Infinity") );
+new TestCase( SECTION, "+('+Infinity')", Math.pow(10,10000), +("+Infinity") );
+
+// StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
+
+new TestCase( SECTION, "+('0')", 0, +("0") );
+new TestCase( SECTION, "+('-0')", -0, +("-0") );
+new TestCase( SECTION, "+('+0')", 0, +("+0") );
+
+new TestCase( SECTION, "+('1')", 1, +("1") );
+new TestCase( SECTION, "+('-1')", -1, +("-1") );
+new TestCase( SECTION, "+('+1')", 1, +("+1") );
+
+new TestCase( SECTION, "+('2')", 2, +("2") );
+new TestCase( SECTION, "+('-2')", -2, +("-2") );
+new TestCase( SECTION, "+('+2')", 2, +("+2") );
+
+new TestCase( SECTION, "+('3')", 3, +("3") );
+new TestCase( SECTION, "+('-3')", -3, +("-3") );
+new TestCase( SECTION, "+('+3')", 3, +("+3") );
+
+new TestCase( SECTION, "+('4')", 4, +("4") );
+new TestCase( SECTION, "+('-4')", -4, +("-4") );
+new TestCase( SECTION, "+('+4')", 4, +("+4") );
+
+new TestCase( SECTION, "+('5')", 5, +("5") );
+new TestCase( SECTION, "+('-5')", -5, +("-5") );
+new TestCase( SECTION, "+('+5')", 5, +("+5") );
+
+new TestCase( SECTION, "+('6')", 6, +("6") );
+new TestCase( SECTION, "+('-6')", -6, +("-6") );
+new TestCase( SECTION, "+('+6')", 6, +("+6") );
+
+new TestCase( SECTION, "+('7')", 7, +("7") );
+new TestCase( SECTION, "+('-7')", -7, +("-7") );
+new TestCase( SECTION, "+('+7')", 7, +("+7") );
+
+new TestCase( SECTION, "+('8')", 8, +("8") );
+new TestCase( SECTION, "+('-8')", -8, +("-8") );
+new TestCase( SECTION, "+('+8')", 8, +("+8") );
+
+new TestCase( SECTION, "+('9')", 9, +("9") );
+new TestCase( SECTION, "+('-9')", -9, +("-9") );
+new TestCase( SECTION, "+('+9')", 9, +("+9") );
+
+new TestCase( SECTION, "+('3.14159')", 3.14159, +("3.14159") );
+new TestCase( SECTION, "+('-3.14159')", -3.14159, +("-3.14159") );
+new TestCase( SECTION, "+('+3.14159')", 3.14159, +("+3.14159") );
+
+new TestCase( SECTION, "+('3.')", 3, +("3.") );
+new TestCase( SECTION, "+('-3.')", -3, +("-3.") );
+new TestCase( SECTION, "+('+3.')", 3, +("+3.") );
+
+new TestCase( SECTION, "+('3.e1')", 30, +("3.e1") );
+new TestCase( SECTION, "+('-3.e1')", -30, +("-3.e1") );
+new TestCase( SECTION, "+('+3.e1')", 30, +("+3.e1") );
+
+new TestCase( SECTION, "+('3.e+1')", 30, +("3.e+1") );
+new TestCase( SECTION, "+('-3.e+1')", -30, +("-3.e+1") );
+new TestCase( SECTION, "+('+3.e+1')", 30, +("+3.e+1") );
+
+new TestCase( SECTION, "+('3.e-1')", .30, +("3.e-1") );
+new TestCase( SECTION, "+('-3.e-1')", -.30, +("-3.e-1") );
+new TestCase( SECTION, "+('+3.e-1')", .30, +("+3.e-1") );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "+('.00001')", 0.00001, +(".00001") );
+new TestCase( SECTION, "+('+.00001')", 0.00001, +("+.00001") );
+new TestCase( SECTION, "+('-0.0001')", -0.00001, +("-.00001") );
+
+new TestCase( SECTION, "+('.01e2')", 1, +(".01e2") );
+new TestCase( SECTION, "+('+.01e2')", 1, +("+.01e2") );
+new TestCase( SECTION, "+('-.01e2')", -1, +("-.01e2") );
+
+new TestCase( SECTION, "+('.01e+2')", 1, +(".01e+2") );
+new TestCase( SECTION, "+('+.01e+2')", 1, +("+.01e+2") );
+new TestCase( SECTION, "+('-.01e+2')", -1, +("-.01e+2") );
+
+new TestCase( SECTION, "+('.01e-2')", 0.0001, +(".01e-2") );
+new TestCase( SECTION, "+('+.01e-2')", 0.0001, +("+.01e-2") );
+new TestCase( SECTION, "+('-.01e-2')", -0.0001, +("-.01e-2") );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "+('1234e5')", 123400000, +("1234e5") );
+new TestCase( SECTION, "+('+1234e5')", 123400000, +("+1234e5") );
+new TestCase( SECTION, "+('-1234e5')", -123400000, +("-1234e5") );
+
+new TestCase( SECTION, "+('1234e+5')", 123400000, +("1234e+5") );
+new TestCase( SECTION, "+('+1234e+5')", 123400000, +("+1234e+5") );
+new TestCase( SECTION, "+('-1234e+5')", -123400000, +("-1234e+5") );
+
+new TestCase( SECTION, "+('1234e-5')", 0.01234, +("1234e-5") );
+new TestCase( SECTION, "+('+1234e-5')", 0.01234, +("+1234e-5") );
+new TestCase( SECTION, "+('-1234e-5')", -0.01234, +("-1234e-5") );
+
+// StrNumericLiteral::: HexIntegerLiteral
+
+new TestCase( SECTION, "+('0x0')", 0, +("0x0"));
+new TestCase( SECTION, "+('0x1')", 1, +("0x1"));
+new TestCase( SECTION, "+('0x2')", 2, +("0x2"));
+new TestCase( SECTION, "+('0x3')", 3, +("0x3"));
+new TestCase( SECTION, "+('0x4')", 4, +("0x4"));
+new TestCase( SECTION, "+('0x5')", 5, +("0x5"));
+new TestCase( SECTION, "+('0x6')", 6, +("0x6"));
+new TestCase( SECTION, "+('0x7')", 7, +("0x7"));
+new TestCase( SECTION, "+('0x8')", 8, +("0x8"));
+new TestCase( SECTION, "+('0x9')", 9, +("0x9"));
+new TestCase( SECTION, "+('0xa')", 10, +("0xa"));
+new TestCase( SECTION, "+('0xb')", 11, +("0xb"));
+new TestCase( SECTION, "+('0xc')", 12, +("0xc"));
+new TestCase( SECTION, "+('0xd')", 13, +("0xd"));
+new TestCase( SECTION, "+('0xe')", 14, +("0xe"));
+new TestCase( SECTION, "+('0xf')", 15, +("0xf"));
+new TestCase( SECTION, "+('0xA')", 10, +("0xA"));
+new TestCase( SECTION, "+('0xB')", 11, +("0xB"));
+new TestCase( SECTION, "+('0xC')", 12, +("0xC"));
+new TestCase( SECTION, "+('0xD')", 13, +("0xD"));
+new TestCase( SECTION, "+('0xE')", 14, +("0xE"));
+new TestCase( SECTION, "+('0xF')", 15, +("0xF"));
+
+new TestCase( SECTION, "+('0X0')", 0, +("0X0"));
+new TestCase( SECTION, "+('0X1')", 1, +("0X1"));
+new TestCase( SECTION, "+('0X2')", 2, +("0X2"));
+new TestCase( SECTION, "+('0X3')", 3, +("0X3"));
+new TestCase( SECTION, "+('0X4')", 4, +("0X4"));
+new TestCase( SECTION, "+('0X5')", 5, +("0X5"));
+new TestCase( SECTION, "+('0X6')", 6, +("0X6"));
+new TestCase( SECTION, "+('0X7')", 7, +("0X7"));
+new TestCase( SECTION, "+('0X8')", 8, +("0X8"));
+new TestCase( SECTION, "+('0X9')", 9, +("0X9"));
+new TestCase( SECTION, "+('0Xa')", 10, +("0Xa"));
+new TestCase( SECTION, "+('0Xb')", 11, +("0Xb"));
+new TestCase( SECTION, "+('0Xc')", 12, +("0Xc"));
+new TestCase( SECTION, "+('0Xd')", 13, +("0Xd"));
+new TestCase( SECTION, "+('0Xe')", 14, +("0Xe"));
+new TestCase( SECTION, "+('0Xf')", 15, +("0Xf"));
+new TestCase( SECTION, "+('0XA')", 10, +("0XA"));
+new TestCase( SECTION, "+('0XB')", 11, +("0XB"));
+new TestCase( SECTION, "+('0XC')", 12, +("0XC"));
+new TestCase( SECTION, "+('0XD')", 13, +("0XD"));
+new TestCase( SECTION, "+('0XE')", 14, +("0XE"));
+new TestCase( SECTION, "+('0XF')", 15, +("0XF"));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-01.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-01.js
new file mode 100644
index 0000000000..827b80189d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-01.js
@@ -0,0 +1,299 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.7-01.js';
+
+/**
+ File Name: 11.4.7-01.js
+ ECMA Section: 11.4.7 Unary - Operator
+ Description: convert operand to Number type and change sign
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "11.4.7";
+var VERSION = "ECMA_1";
+var BUGNUMBER="77391";
+
+startTest();
+
+writeHeaderToLog( SECTION + " Unary + operator");
+
+new TestCase( SECTION, "-('')", -0, -("") );
+new TestCase( SECTION, "-(' ')", -0, -(" ") );
+new TestCase( SECTION, "-(\\t)", -0, -("\t") );
+new TestCase( SECTION, "-(\\n)", -0, -("\n") );
+new TestCase( SECTION, "-(\\r)", -0, -("\r") );
+new TestCase( SECTION, "-(\\f)", -0, -("\f") );
+
+new TestCase( SECTION, "-(String.fromCharCode(0x0009)", -0, -(String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "-(String.fromCharCode(0x0020)", -0, -(String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "-(String.fromCharCode(0x000C)", -0, -(String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "-(String.fromCharCode(0x000B)", -0, -(String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "-(String.fromCharCode(0x000D)", -0, -(String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "-(String.fromCharCode(0x000A)", -0, -(String.fromCharCode(0x000A)) );
+
+// a StringNumericLiteral may be preceeded or followed by whitespace and/or
+// line terminators
+
+new TestCase( SECTION, "-( ' ' + 999 )", -999, -( ' '+999) );
+new TestCase( SECTION, "-( '\\n' + 999 )", -999, -( '\n' +999) );
+new TestCase( SECTION, "-( '\\r' + 999 )", -999, -( '\r' +999) );
+new TestCase( SECTION, "-( '\\t' + 999 )", -999, -( '\t' +999) );
+new TestCase( SECTION, "-( '\\f' + 999 )", -999, -( '\f' +999) );
+
+new TestCase( SECTION, "-( 999 + ' ' )", -999, -( 999+' ') );
+new TestCase( SECTION, "-( 999 + '\\n' )", -999, -( 999+'\n' ) );
+new TestCase( SECTION, "-( 999 + '\\r' )", -999, -( 999+'\r' ) );
+new TestCase( SECTION, "-( 999 + '\\t' )", -999, -( 999+'\t' ) );
+new TestCase( SECTION, "-( 999 + '\\f' )", -999, -( 999+'\f' ) );
+
+new TestCase( SECTION, "-( '\\n' + 999 + '\\n' )", -999, -( '\n' +999+'\n' ) );
+new TestCase( SECTION, "-( '\\r' + 999 + '\\r' )", -999, -( '\r' +999+'\r' ) );
+new TestCase( SECTION, "-( '\\t' + 999 + '\\t' )", -999, -( '\t' +999+'\t' ) );
+new TestCase( SECTION, "-( '\\f' + 999 + '\\f' )", -999, -( '\f' +999+'\f' ) );
+
+new TestCase( SECTION, "-( ' ' + '999' )", -999, -( ' '+'999') );
+new TestCase( SECTION, "-( '\\n' + '999' )", -999, -( '\n' +'999') );
+new TestCase( SECTION, "-( '\\r' + '999' )", -999, -( '\r' +'999') );
+new TestCase( SECTION, "-( '\\t' + '999' )", -999, -( '\t' +'999') );
+new TestCase( SECTION, "-( '\\f' + '999' )", -999, -( '\f' +'999') );
+
+new TestCase( SECTION, "-( '999' + ' ' )", -999, -( '999'+' ') );
+new TestCase( SECTION, "-( '999' + '\\n' )", -999, -( '999'+'\n' ) );
+new TestCase( SECTION, "-( '999' + '\\r' )", -999, -( '999'+'\r' ) );
+new TestCase( SECTION, "-( '999' + '\\t' )", -999, -( '999'+'\t' ) );
+new TestCase( SECTION, "-( '999' + '\\f' )", -999, -( '999'+'\f' ) );
+
+new TestCase( SECTION, "-( '\\n' + '999' + '\\n' )", -999, -( '\n' +'999'+'\n' ) );
+new TestCase( SECTION, "-( '\\r' + '999' + '\\r' )", -999, -( '\r' +'999'+'\r' ) );
+new TestCase( SECTION, "-( '\\t' + '999' + '\\t' )", -999, -( '\t' +'999'+'\t' ) );
+new TestCase( SECTION, "-( '\\f' + '999' + '\\f' )", -999, -( '\f' +'999'+'\f' ) );
+
+new TestCase( SECTION, "-( String.fromCharCode(0x0009) + '99' )", -99, -( String.fromCharCode(0x0009) + '99' ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x0020) + '99' )", -99, -( String.fromCharCode(0x0020) + '99' ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000C) + '99' )", -99, -( String.fromCharCode(0x000C) + '99' ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000B) + '99' )", -99, -( String.fromCharCode(0x000B) + '99' ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000D) + '99' )", -99, -( String.fromCharCode(0x000D) + '99' ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000A) + '99' )", -99, -( String.fromCharCode(0x000A) + '99' ) );
+
+new TestCase( SECTION, "-( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "-( '99' + String.fromCharCode(0x0009)", -99, -( '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "-( '99' + String.fromCharCode(0x0020)", -99, -( '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000C)", -99, -( '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000D)", -99, -( '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000B)", -99, -( '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000A)", -99, -( '99' + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "-( String.fromCharCode(0x0009) + 99 )", -99, -( String.fromCharCode(0x0009) + 99 ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x0020) + 99 )", -99, -( String.fromCharCode(0x0020) + 99 ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000C) + 99 )", -99, -( String.fromCharCode(0x000C) + 99 ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000B) + 99 )", -99, -( String.fromCharCode(0x000B) + 99 ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000D) + 99 )", -99, -( String.fromCharCode(0x000D) + 99 ) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000A) + 99 )", -99, -( String.fromCharCode(0x000A) + 99 ) );
+
+new TestCase( SECTION, "-( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "-( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "-( 99 + String.fromCharCode(0x0009)", -99, -( 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "-( 99 + String.fromCharCode(0x0020)", -99, -( 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000C)", -99, -( 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000D)", -99, -( 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000B)", -99, -( 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000A)", -99, -( 99 + String.fromCharCode(0x000A)) );
+
+
+// StrNumericLiteral:::StrDecimalLiteral:::Infinity
+
+new TestCase( SECTION, "-('Infinity')", -Math.pow(10,10000), -("Infinity") );
+new TestCase( SECTION, "-('-Infinity')", +Math.pow(10,10000), -("-Infinity") );
+new TestCase( SECTION, "-('+Infinity')", -Math.pow(10,10000), -("+Infinity") );
+
+// StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
+
+new TestCase( SECTION, "-('0')", -0, -("0") );
+new TestCase( SECTION, "-('-0')", +0, -("-0") );
+new TestCase( SECTION, "-('+0')", -0, -("+0") );
+
+new TestCase( SECTION, "-('1')", -1, -("1") );
+new TestCase( SECTION, "-('-1')", +1, -("-1") );
+new TestCase( SECTION, "-('+1')", -1, -("+1") );
+
+new TestCase( SECTION, "-('2')", -2, -("2") );
+new TestCase( SECTION, "-('-2')", +2, -("-2") );
+new TestCase( SECTION, "-('+2')", -2, -("+2") );
+
+new TestCase( SECTION, "-('3')", -3, -("3") );
+new TestCase( SECTION, "-('-3')", +3, -("-3") );
+new TestCase( SECTION, "-('+3')", -3, -("+3") );
+
+new TestCase( SECTION, "-('4')", -4, -("4") );
+new TestCase( SECTION, "-('-4')", +4, -("-4") );
+new TestCase( SECTION, "-('+4')", -4, -("+4") );
+
+new TestCase( SECTION, "-('5')", -5, -("5") );
+new TestCase( SECTION, "-('-5')", +5, -("-5") );
+new TestCase( SECTION, "-('+5')", -5, -("+5") );
+
+new TestCase( SECTION, "-('6')", -6, -("6") );
+new TestCase( SECTION, "-('-6')", +6, -("-6") );
+new TestCase( SECTION, "-('+6')", -6, -("+6") );
+
+new TestCase( SECTION, "-('7')", -7, -("7") );
+new TestCase( SECTION, "-('-7')", +7, -("-7") );
+new TestCase( SECTION, "-('+7')", -7, -("+7") );
+
+new TestCase( SECTION, "-('8')", -8, -("8") );
+new TestCase( SECTION, "-('-8')", +8, -("-8") );
+new TestCase( SECTION, "-('+8')", -8, -("+8") );
+
+new TestCase( SECTION, "-('9')", -9, -("9") );
+new TestCase( SECTION, "-('-9')", +9, -("-9") );
+new TestCase( SECTION, "-('+9')", -9, -("+9") );
+
+new TestCase( SECTION, "-('3.14159')", -3.14159, -("3.14159") );
+new TestCase( SECTION, "-('-3.14159')", +3.14159, -("-3.14159") );
+new TestCase( SECTION, "-('+3.14159')", -3.14159, -("+3.14159") );
+
+new TestCase( SECTION, "-('3.')", -3, -("3.") );
+new TestCase( SECTION, "-('-3.')", +3, -("-3.") );
+new TestCase( SECTION, "-('+3.')", -3, -("+3.") );
+
+new TestCase( SECTION, "-('3.e1')", -30, -("3.e1") );
+new TestCase( SECTION, "-('-3.e1')", +30, -("-3.e1") );
+new TestCase( SECTION, "-('+3.e1')", -30, -("+3.e1") );
+
+new TestCase( SECTION, "-('3.e+1')", -30, -("3.e+1") );
+new TestCase( SECTION, "-('-3.e+1')", +30, -("-3.e+1") );
+new TestCase( SECTION, "-('+3.e+1')", -30, -("+3.e+1") );
+
+new TestCase( SECTION, "-('3.e-1')", -.30, -("3.e-1") );
+new TestCase( SECTION, "-('-3.e-1')", +.30, -("-3.e-1") );
+new TestCase( SECTION, "-('+3.e-1')", -.30, -("+3.e-1") );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "-('.00001')", -0.00001, -(".00001") );
+new TestCase( SECTION, "-('+.00001')", -0.00001, -("+.00001") );
+new TestCase( SECTION, "-('-0.0001')", +0.00001, -("-.00001") );
+
+new TestCase( SECTION, "-('.01e2')", -1, -(".01e2") );
+new TestCase( SECTION, "-('+.01e2')", -1, -("+.01e2") );
+new TestCase( SECTION, "-('-.01e2')", +1, -("-.01e2") );
+
+new TestCase( SECTION, "-('.01e+2')", -1, -(".01e+2") );
+new TestCase( SECTION, "-('+.01e+2')", -1, -("+.01e+2") );
+new TestCase( SECTION, "-('-.01e+2')", +1, -("-.01e+2") );
+
+new TestCase( SECTION, "-('.01e-2')", -0.0001, -(".01e-2") );
+new TestCase( SECTION, "-('+.01e-2')", -0.0001, -("+.01e-2") );
+new TestCase( SECTION, "-('-.01e-2')", +0.0001, -("-.01e-2") );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "-('1234e5')", -123400000, -("1234e5") );
+new TestCase( SECTION, "-('+1234e5')", -123400000, -("+1234e5") );
+new TestCase( SECTION, "-('-1234e5')", +123400000, -("-1234e5") );
+
+new TestCase( SECTION, "-('1234e+5')", -123400000, -("1234e+5") );
+new TestCase( SECTION, "-('+1234e+5')", -123400000, -("+1234e+5") );
+new TestCase( SECTION, "-('-1234e+5')", +123400000, -("-1234e+5") );
+
+new TestCase( SECTION, "-('1234e-5')", -0.01234, -("1234e-5") );
+new TestCase( SECTION, "-('+1234e-5')", -0.01234, -("+1234e-5") );
+new TestCase( SECTION, "-('-1234e-5')", +0.01234, -("-1234e-5") );
+
+// StrNumericLiteral::: HexIntegerLiteral
+
+new TestCase( SECTION, "-('0x0')", -0, -("0x0"));
+new TestCase( SECTION, "-('0x1')", -1, -("0x1"));
+new TestCase( SECTION, "-('0x2')", -2, -("0x2"));
+new TestCase( SECTION, "-('0x3')", -3, -("0x3"));
+new TestCase( SECTION, "-('0x4')", -4, -("0x4"));
+new TestCase( SECTION, "-('0x5')", -5, -("0x5"));
+new TestCase( SECTION, "-('0x6')", -6, -("0x6"));
+new TestCase( SECTION, "-('0x7')", -7, -("0x7"));
+new TestCase( SECTION, "-('0x8')", -8, -("0x8"));
+new TestCase( SECTION, "-('0x9')", -9, -("0x9"));
+new TestCase( SECTION, "-('0xa')", -10, -("0xa"));
+new TestCase( SECTION, "-('0xb')", -11, -("0xb"));
+new TestCase( SECTION, "-('0xc')", -12, -("0xc"));
+new TestCase( SECTION, "-('0xd')", -13, -("0xd"));
+new TestCase( SECTION, "-('0xe')", -14, -("0xe"));
+new TestCase( SECTION, "-('0xf')", -15, -("0xf"));
+new TestCase( SECTION, "-('0xA')", -10, -("0xA"));
+new TestCase( SECTION, "-('0xB')", -11, -("0xB"));
+new TestCase( SECTION, "-('0xC')", -12, -("0xC"));
+new TestCase( SECTION, "-('0xD')", -13, -("0xD"));
+new TestCase( SECTION, "-('0xE')", -14, -("0xE"));
+new TestCase( SECTION, "-('0xF')", -15, -("0xF"));
+
+new TestCase( SECTION, "-('0X0')", -0, -("0X0"));
+new TestCase( SECTION, "-('0X1')", -1, -("0X1"));
+new TestCase( SECTION, "-('0X2')", -2, -("0X2"));
+new TestCase( SECTION, "-('0X3')", -3, -("0X3"));
+new TestCase( SECTION, "-('0X4')", -4, -("0X4"));
+new TestCase( SECTION, "-('0X5')", -5, -("0X5"));
+new TestCase( SECTION, "-('0X6')", -6, -("0X6"));
+new TestCase( SECTION, "-('0X7')", -7, -("0X7"));
+new TestCase( SECTION, "-('0X8')", -8, -("0X8"));
+new TestCase( SECTION, "-('0X9')", -9, -("0X9"));
+new TestCase( SECTION, "-('0Xa')", -10, -("0Xa"));
+new TestCase( SECTION, "-('0Xb')", -11, -("0Xb"));
+new TestCase( SECTION, "-('0Xc')", -12, -("0Xc"));
+new TestCase( SECTION, "-('0Xd')", -13, -("0Xd"));
+new TestCase( SECTION, "-('0Xe')", -14, -("0Xe"));
+new TestCase( SECTION, "-('0Xf')", -15, -("0Xf"));
+new TestCase( SECTION, "-('0XA')", -10, -("0XA"));
+new TestCase( SECTION, "-('0XB')", -11, -("0XB"));
+new TestCase( SECTION, "-('0XC')", -12, -("0XC"));
+new TestCase( SECTION, "-('0XD')", -13, -("0XD"));
+new TestCase( SECTION, "-('0XE')", -14, -("0XE"));
+new TestCase( SECTION, "-('0XF')", -15, -("0XF"));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-02.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-02.js
new file mode 100644
index 0000000000..43bd923e23
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.7-02.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.7-02.js';
+
+/**
+ * File Name: 11.4.7-02.js
+ * Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=432881
+ * Description: ecma 11.4.7
+ */
+
+var SECTION = "11.4.7";
+var VERSION = "ECMA";
+var TITLE = "Unary - Operator";
+var BUGNUMBER = "432881";
+
+startTest();
+
+test_negation(0, -0.0);
+test_negation(-0.0, 0);
+test_negation(1, -1);
+test_negation(1.0/0.0, -1.0/0.0);
+test_negation(-1.0/0.0, 1.0/0.0);
+
+//1073741824 == (1 << 30)
+test_negation(1073741824, -1073741824);
+test_negation(-1073741824, 1073741824);
+
+//1073741824 == (1 << 30) - 1
+test_negation(1073741823, -1073741823);
+test_negation(-1073741823, 1073741823);
+
+//1073741824 == (1 << 30)
+test_negation(1073741824, -1073741824);
+test_negation(-1073741824, 1073741824);
+
+//1073741824 == (1 << 30) - 1
+test_negation(1073741823, -1073741823);
+test_negation(-1073741823, 1073741823);
+
+//2147483648 == (1 << 31)
+test_negation(2147483648, -2147483648);
+test_negation(-2147483648, 2147483648);
+
+//2147483648 == (1 << 31) - 1
+test_negation(2147483647, -2147483647);
+test_negation(-2147483647, 2147483647);
+
+function test_negation(value, expected)
+{
+ var actual = -value;
+ reportCompare(expected, actual, '-(' + value + ') == ' + expected);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.8.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.8.js
new file mode 100644
index 0000000000..f617e10689
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.8.js
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.8.js';
+
+/**
+ File Name: 11.4.8.js
+ ECMA Section: 11.4.8 Bitwise NOT Operator
+ Description: flip bits up to 32 bits
+ no special cases
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+ Data File Fields:
+ VALUE value passed as an argument to the ~ operator
+ E_RESULT expected return value of ~ VALUE;
+
+ Static variables:
+ none
+
+*/
+
+var SECTION = "11.4.8";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Bitwise Not operator");
+
+for ( var i = 0; i < 35; i++ ) {
+ var p = Math.pow(2,i);
+
+ new TestCase( SECTION, "~"+p, Not(p), ~p );
+
+}
+for ( i = 0; i < 35; i++ ) {
+ var p = -Math.pow(2,i);
+
+ new TestCase( SECTION, "~"+p, Not(p), ~p );
+
+}
+
+test();
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( var p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( var p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+ for ( var l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function Not( n ) {
+ n = ToInt32(n);
+ n = ToInt32BitString(n);
+
+ var r = "";
+
+ for( var l = 0; l < n.length; l++ ) {
+ r += ( n.charAt(l) == "0" ) ? "1" : "0";
+ }
+
+ n = ToInt32Decimal(r);
+
+ return n;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.9.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.9.js
new file mode 100644
index 0000000000..2c57e88211
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.4.9.js
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.4.9.js';
+
+/**
+ File Name: 11.4.9.js
+ ECMA Section: 11.4.9 Logical NOT Operator (!)
+ Description: if the ToBoolean( VALUE ) result is true, return
+ true. else return false.
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+ Static variables:
+ none
+*/
+var SECTION = "11.4.9";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Logical NOT operator (!)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// version("130")
+
+
+new TestCase( SECTION, "!(null)", true, !(null) );
+new TestCase( SECTION, "!(var x)", true, !(eval("var x")) );
+new TestCase( SECTION, "!(void 0)", true, !(void 0) );
+
+new TestCase( SECTION, "!(false)", true, !(false) );
+new TestCase( SECTION, "!(true)", false, !(true) );
+new TestCase( SECTION, "!()", true, !(eval()) );
+new TestCase( SECTION, "!(0)", true, !(0) );
+new TestCase( SECTION, "!(-0)", true, !(-0) );
+new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) );
+new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) );
+new TestCase( SECTION, "!(1)", false, !(1) );
+new TestCase( SECTION, "!(-1)", false, !(-1) );
+new TestCase( SECTION, "!('')", true, !("") );
+new TestCase( SECTION, "!('\t')", false, !("\t") );
+new TestCase( SECTION, "!('0')", false, !("0") );
+new TestCase( SECTION, "!('string')", false, !("string") );
+new TestCase( SECTION, "!(new String(''))", false, !(new String("")) );
+new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) );
+new TestCase( SECTION, "!(new String())", false, !(new String()) );
+new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) );
+new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) );
+new TestCase( SECTION, "!(new Array())", false, !(new Array()) );
+new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) );
+new TestCase( SECTION, "!(new Number())", false, !(new Number()) );
+new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) );
+new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) );
+new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.1.js
new file mode 100644
index 0000000000..94edcefea5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.1.js
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.5.1.js';
+
+/**
+ File Name: 11.5.1.js
+ ECMA Section: 11.5.1 Applying the * operator
+ Description:
+
+ 11.5.1 Applying the * operator
+
+ The * operator performs multiplication, producing the product of its
+ operands. Multiplication is commutative. Multiplication is not always
+ associative in ECMAScript, because of finite precision.
+
+ The result of a floating-point multiplication is governed by the rules
+ of IEEE 754 double-precision arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sign of the result is positive if both operands have the same sign,
+ negative if the operands have different signs.
+ Multiplication of an infinity by a zero results in NaN.
+ Multiplication of an infinity by an infinity results in an infinity.
+ The sign is determined by the rule already stated above.
+ Multiplication of an infinity by a finite non-zero value results in a
+ signed infinity. The sign is determined by the rule already stated above.
+ In the remaining cases, where neither an infinity or NaN is involved, the
+ product is computed and rounded to the nearest representable value using IEEE
+ 754 round-to-nearest mode. If the magnitude is too large to represent,
+ the result is then an infinity of appropriate sign. If the magnitude is
+ oo small to represent, the result is then a zero
+ of appropriate sign. The ECMAScript language requires support of gradual
+ underflow as defined by IEEE 754.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.5.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Applying the * operator");
+
+new TestCase( SECTION, "Number.NaN * Number.NaN", Number.NaN, Number.NaN * Number.NaN );
+new TestCase( SECTION, "Number.NaN * 1", Number.NaN, Number.NaN * 1 );
+new TestCase( SECTION, "1 * Number.NaN", Number.NaN, 1 * Number.NaN );
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * 0", Number.NaN, Number.POSITIVE_INFINITY * 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 0", Number.NaN, Number.NEGATIVE_INFINITY * 0 );
+new TestCase( SECTION, "0 * Number.POSITIVE_INFINITY", Number.NaN, 0 * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 * Number.NEGATIVE_INFINITY", Number.NaN, 0 * Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "-0 * Number.POSITIVE_INFINITY", Number.NaN, -0 * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-0 * Number.NEGATIVE_INFINITY", Number.NaN, -0 * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * -0", Number.NaN, Number.POSITIVE_INFINITY * -0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -0", Number.NaN, Number.NEGATIVE_INFINITY * -0 );
+
+new TestCase( SECTION, "0 * -0", -0, 0 * -0 );
+new TestCase( SECTION, "-0 * 0", -0, -0 * 0 );
+new TestCase( SECTION, "-0 * -0", 0, -0 * -0 );
+new TestCase( SECTION, "0 * 0", 0, 0 * 0 );
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * 1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * -1 );
+new TestCase( SECTION, "1 * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, 1 * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-1 * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, -1 * Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * 1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * -1 );
+new TestCase( SECTION, "1 * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, 1 * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, -1 * Number.POSITIVE_INFINITY );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.2.js
new file mode 100644
index 0000000000..e459e7613f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.2.js
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.5.2.js';
+
+/**
+ File Name: 11.5.2.js
+ ECMA Section: 11.5.2 Applying the / operator
+ Description:
+
+ The / operator performs division, producing the quotient of its operands.
+ The left operand is the dividend and the right operand is the divisor.
+ ECMAScript does not perform integer division. The operands and result of all
+ division operations are double-precision floating-point numbers.
+ The result of division is determined by the specification of IEEE 754 arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sign of the result is positive if both operands have the same sign, negative if the operands have different
+ signs.
+ Division of an infinity by an infinity results in NaN.
+ Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated above.
+ Division of an infinity by a non-zero finite value results in a signed infinity. The sign is determined by the rule
+ already stated above.
+ Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated above.
+ Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign
+ determined by the rule already stated above.
+ Division of a non-zero finite value by a zero results in a signed infinity. The sign is determined by the rule
+ already stated above.
+ In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the quotient is computed and
+ rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too
+ large to represent, we say the operation overflows; the result is then an infinity of appropriate sign. If the
+ magnitude is too small to represent, we say the operation underflows and the result is a zero of the appropriate
+ sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.5.2";
+var VERSION = "ECMA_1";
+var BUGNUMBER="111202";
+startTest();
+
+writeHeaderToLog( SECTION + " Applying the / operator");
+
+// if either operand is NaN, the result is NaN.
+
+new TestCase( SECTION, "Number.NaN / Number.NaN", Number.NaN, Number.NaN / Number.NaN );
+new TestCase( SECTION, "Number.NaN / 1", Number.NaN, Number.NaN / 1 );
+new TestCase( SECTION, "1 / Number.NaN", Number.NaN, 1 / Number.NaN );
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NaN", Number.NaN, Number.POSITIVE_INFINITY / Number.NaN );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY / Number.NaN );
+
+// Division of an infinity by an infinity results in NaN.
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY );
+
+// Division of an infinity by a zero results in an infinity.
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / 0", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 0", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / -0", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -0", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -0 );
+
+// Division of an infinity by a non-zero finite value results in a signed infinity.
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -1 );
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / Number.MAX_VALUE );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / -Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -Number.MAX_VALUE );
+
+// Division of a finite value by an infinity results in zero.
+
+new TestCase( SECTION, "1 / Number.NEGATIVE_INFINITY", -0, 1 / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "1 / Number.POSITIVE_INFINITY", 0, 1 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 / Number.POSITIVE_INFINITY", -0, -1 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 / Number.NEGATIVE_INFINITY", 0, -1 / Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "Number.MAX_VALUE / Number.NEGATIVE_INFINITY", -0, Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE / Number.POSITIVE_INFINITY", 0, Number.MAX_VALUE / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE / Number.POSITIVE_INFINITY", -0, -Number.MAX_VALUE / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE / Number.NEGATIVE_INFINITY", 0, -Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
+
+// Division of a zero by a zero results in NaN
+
+new TestCase( SECTION, "0 / -0", Number.NaN, 0 / -0 );
+new TestCase( SECTION, "-0 / 0", Number.NaN, -0 / 0 );
+new TestCase( SECTION, "-0 / -0", Number.NaN, -0 / -0 );
+new TestCase( SECTION, "0 / 0", Number.NaN, 0 / 0 );
+
+// division of zero by any other finite value results in zero
+
+new TestCase( SECTION, "0 / 1", 0, 0 / 1 );
+new TestCase( SECTION, "0 / -1", -0, 0 / -1 );
+new TestCase( SECTION, "-0 / 1", -0, -0 / 1 );
+new TestCase( SECTION, "-0 / -1", 0, -0 / -1 );
+
+// Division of a non-zero finite value by a zero results in a signed infinity.
+
+new TestCase( SECTION, "1 / 0", Number.POSITIVE_INFINITY, 1/0 );
+new TestCase( SECTION, "1 / -0", Number.NEGATIVE_INFINITY, 1/-0 );
+new TestCase( SECTION, "-1 / 0", Number.NEGATIVE_INFINITY, -1/0 );
+new TestCase( SECTION, "-1 / -0", Number.POSITIVE_INFINITY, -1/-0 );
+
+new TestCase( SECTION, "0 / Number.POSITIVE_INFINITY", 0, 0 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 / Number.NEGATIVE_INFINITY", -0, 0 / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-0 / Number.POSITIVE_INFINITY", -0, -0 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-0 / Number.NEGATIVE_INFINITY", 0, -0 / Number.NEGATIVE_INFINITY );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.3.js
new file mode 100644
index 0000000000..9558b63a96
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.5.3.js
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.5.3.js';
+
+/**
+ File Name: 11.5.3.js
+ ECMA Section: 11.5.3 Applying the % operator
+ Description:
+
+ The binary % operator is said to yield the remainder of its operands from
+ an implied division; the left operand is the dividend and the right operand
+ is the divisor. In C and C++, the remainder operator accepts only integral
+ operands, but in ECMAScript, it also accepts floating-point operands.
+
+ The result of a floating-point remainder operation as computed by the %
+ operator is not the same as the "remainder" operation defined by IEEE 754.
+ The IEEE 754 "remainder" operation computes the remainder from a rounding
+ division, not a truncating division, and so its behavior is not analogous
+ to that of the usual integer remainder operator. Instead the ECMAScript
+ language defines % on floating-point operations to behave in a manner
+ analogous to that of the Java integer remainder operator; this may be
+ compared with the C library function fmod.
+
+ The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sign of the result equals the sign of the dividend.
+ If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
+ If the dividend is finite and the divisor is an infinity, the result equals the dividend.
+ If the dividend is a zero and the divisor is finite, the result is the same as the dividend.
+ In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r
+ from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that
+ is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as
+ possible without exceeding the magnitude of the true mathematical quotient of n and d.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.5.3";
+var VERSION = "ECMA_1";
+var BUGNUMBER="111202";
+startTest();
+
+
+writeHeaderToLog( SECTION + " Applying the % operator");
+
+// if either operand is NaN, the result is NaN.
+
+new TestCase( SECTION, "Number.NaN % Number.NaN", Number.NaN, Number.NaN % Number.NaN );
+new TestCase( SECTION, "Number.NaN % 1", Number.NaN, Number.NaN % 1 );
+new TestCase( SECTION, "1 % Number.NaN", Number.NaN, 1 % Number.NaN );
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NaN", Number.NaN, Number.POSITIVE_INFINITY % Number.NaN );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY % Number.NaN );
+
+// If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
+// dividend is an infinity
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % 0", Number.NaN, Number.POSITIVE_INFINITY % 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 0", Number.NaN, Number.NEGATIVE_INFINITY % 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % -0", Number.NaN, Number.POSITIVE_INFINITY % -0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -0", Number.NaN, Number.NEGATIVE_INFINITY % -0 );
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 1 ", Number.NaN, Number.NEGATIVE_INFINITY % 1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -1 ", Number.NaN, Number.NEGATIVE_INFINITY % -1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % 1 ", Number.NaN, Number.POSITIVE_INFINITY % 1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % -1 ", Number.NaN, Number.POSITIVE_INFINITY % -1 );
+
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % Number.MAX_VALUE );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % -Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % -Number.MAX_VALUE );
+
+// divisor is 0
+new TestCase( SECTION, "0 % -0", Number.NaN, 0 % -0 );
+new TestCase( SECTION, "-0 % 0", Number.NaN, -0 % 0 );
+new TestCase( SECTION, "-0 % -0", Number.NaN, -0 % -0 );
+new TestCase( SECTION, "0 % 0", Number.NaN, 0 % 0 );
+
+new TestCase( SECTION, "1 % 0", Number.NaN, 1%0 );
+new TestCase( SECTION, "1 % -0", Number.NaN, 1%-0 );
+new TestCase( SECTION, "-1 % 0", Number.NaN, -1%0 );
+new TestCase( SECTION, "-1 % -0", Number.NaN, -1%-0 );
+
+new TestCase( SECTION, "Number.MAX_VALUE % 0", Number.NaN, Number.MAX_VALUE%0 );
+new TestCase( SECTION, "Number.MAX_VALUE % -0", Number.NaN, Number.MAX_VALUE%-0 );
+new TestCase( SECTION, "-Number.MAX_VALUE % 0", Number.NaN, -Number.MAX_VALUE%0 );
+new TestCase( SECTION, "-Number.MAX_VALUE % -0", Number.NaN, -Number.MAX_VALUE%-0 );
+
+// If the dividend is finite and the divisor is an infinity, the result equals the dividend.
+
+new TestCase( SECTION, "1 % Number.NEGATIVE_INFINITY", 1, 1 % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "1 % Number.POSITIVE_INFINITY", 1, 1 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 % Number.POSITIVE_INFINITY", -1, -1 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 % Number.NEGATIVE_INFINITY", -1, -1 % Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE % Number.POSITIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "0 % Number.POSITIVE_INFINITY", 0, 0 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 % Number.NEGATIVE_INFINITY", 0, 0 % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-0 % Number.POSITIVE_INFINITY", -0, -0 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-0 % Number.NEGATIVE_INFINITY", -0, -0 % Number.NEGATIVE_INFINITY );
+
+// If the dividend is a zero and the divisor is finite, the result is the same as the dividend.
+
+new TestCase( SECTION, "0 % 1", 0, 0 % 1 );
+new TestCase( SECTION, "0 % -1", -0, 0 % -1 );
+new TestCase( SECTION, "-0 % 1", -0, -0 % 1 );
+new TestCase( SECTION, "-0 % -1", 0, -0 % -1 );
+
+// In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r
+// from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that
+// is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as
+// possible without exceeding the magnitude of the true mathematical quotient of n and d.
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-1.js
new file mode 100644
index 0000000000..87666161b6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-1.js
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.1-1.js';
+
+/**
+ File Name: 11.6.1-1.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does not cover cases where the Additive or Mulplicative expression
+ ToPrimitive is string.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.1-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
+
+// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+// a boolean primitive and a boolean object.
+
+new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+// tests for number primitive, number object, Object object, a "MyObject" whose value is
+// a number primitive and a number object.
+
+new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") );
+
+
+test();
+
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-2.js
new file mode 100644
index 0000000000..1d96d14e92
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-2.js
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.1-2.js';
+
+/**
+ File Name: 11.6.1-2.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does only covers cases where the Additive or Mulplicative expression
+ ToPrimitive is a string.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.1-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
+
+// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+// a boolean primitive and a boolean object.
+
+new TestCase( SECTION,
+ "var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+// tests for number primitive, number object, Object object, a "MyObject" whose value is
+// a number primitive and a number object.
+
+new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") );
+
+test();
+
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-3.js
new file mode 100644
index 0000000000..9a162787d5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.1-3.js
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.1-3.js';
+
+/**
+ File Name: 11.6.1-3.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does only covers cases where the Additive or Mulplicative expression
+ is a Date.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.1-3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
+
+// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+// a boolean primitive and a boolean object.
+
+var DATE1 = new Date();
+
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + DATE1",
+ DATE1.toString() + DATE1.toString(),
+ DATE1 + DATE1 );
+
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + 0",
+ DATE1.toString() + 0,
+ DATE1 + 0 );
+
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Number(0)",
+ DATE1.toString() + 0,
+ DATE1 + new Number(0) );
+
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + true",
+ DATE1.toString() + "true",
+ DATE1 + true );
+
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Boolean(true)",
+ DATE1.toString() + "true",
+ DATE1 + new Boolean(true) );
+
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Boolean(true)",
+ DATE1.toString() + "true",
+ DATE1 + new Boolean(true) );
+
+var MYOB1 = new MyObject( DATE1 );
+
+new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + new Number(1)",
+ "[object Object]1",
+ MYOB1 + new Number(1) );
+
+new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + 1",
+ "[object Object]1",
+ MYOB1 + 1 );
+
+new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + true",
+ "[object Object]true",
+ MYOB1 + true );
+
+test();
+
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.2-1.js
new file mode 100644
index 0000000000..b3ab9b17fb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.2-1.js
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.2-1.js';
+
+/**
+ File Name: 11.6.2-1.js
+ ECMA Section: 11.6.2 The Subtraction operator ( - )
+ Description:
+
+ The production AdditiveExpression : AdditiveExpression -
+ MultiplicativeExpression is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToNumber(Result(2)).
+ 6. Call ToNumber(Result(4)).
+ 7. Apply the subtraction operation to Result(5) and Result(6). See the
+ discussion below (11.6.3).
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.2-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The subtraction operator ( - )");
+
+// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+// a boolean primitive and a boolean object.
+
+new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2") );
+
+// tests for number primitive, number object, Object object, a "MyObject" whose value is
+// a number primitive and a number object.
+
+new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2") );
+
+// same thing with string!
+new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1'); EXP_1 - EXP_2",
+ 254,
+ eval("var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1')); EXP_1 - EXP_2") );
+
+test();
+
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
+function MyOtherObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function ( "return this.value + ''" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.3.js
new file mode 100644
index 0000000000..cf44738528
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.6.3.js
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.3.js';
+
+/**
+ File Name: 11.6.3.js
+ ECMA Section: 11.6.3 Applying the additive operators
+ (+, -) to numbers
+ Description:
+ The + operator performs addition when applied to two operands of numeric
+ type, producing the sum of the operands. The - operator performs
+ subtraction, producing the difference of two numeric operands.
+
+ Addition is a commutative operation, but not always associative.
+
+ The result of an addition is determined using the rules of IEEE 754
+ double-precision arithmetic:
+
+ If either operand is NaN, the result is NaN.
+ The sum of two infinities of opposite sign is NaN.
+ The sum of two infinities of the same sign is the infinity of that sign.
+ The sum of an infinity and a finite value is equal to the infinite operand.
+ The sum of two negative zeros is 0. The sum of two positive zeros, or of
+ two zeros of opposite sign, is +0.
+ The sum of a zero and a nonzero finite value is equal to the nonzero
+ operand.
+ The sum of two nonzero finite values of the same magnitude and opposite
+ sign is +0.
+ In the remaining cases, where neither an infinity, nor a zero, nor NaN is
+ involved, and the operands have the same sign or have different
+ magnitudes, the sum is computed and rounded to the nearest
+ representable value using IEEE 754 round-to-nearest mode. If the
+ magnitude is too large to represent, the operation overflows and
+ the result is then an infinity of appropriate sign. The ECMAScript
+ language requires support of gradual underflow as defined by IEEE 754.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Applying the additive operators (+,-) to numbers");
+
+new TestCase( SECTION, "Number.NaN + 1", Number.NaN, Number.NaN + 1 );
+new TestCase( SECTION, "1 + Number.NaN", Number.NaN, 1 + Number.NaN );
+
+new TestCase( SECTION, "Number.NaN - 1", Number.NaN, Number.NaN - 1 );
+new TestCase( SECTION, "1 - Number.NaN", Number.NaN, 1 - Number.NaN );
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY);
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY);
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY);
+
+new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY);
+
+new TestCase( SECTION, "-0 + -0", -0, -0 + -0 );
+new TestCase( SECTION, "-0 - 0", -0, -0 - 0 );
+
+new TestCase( SECTION, "0 + 0", 0, 0 + 0 );
+new TestCase( SECTION, "0 + -0", 0, 0 + -0 );
+new TestCase( SECTION, "0 - -0", 0, 0 - -0 );
+new TestCase( SECTION, "0 - 0", 0, 0 - 0 );
+new TestCase( SECTION, "-0 - -0", 0, -0 - -0 );
+new TestCase( SECTION, "-0 + 0", 0, -0 + 0 );
+
+new TestCase( SECTION, "Number.MAX_VALUE - Number.MAX_VALUE", 0, Number.MAX_VALUE - Number.MAX_VALUE );
+new TestCase( SECTION, "1/Number.MAX_VALUE - 1/Number.MAX_VALUE", 0, 1/Number.MAX_VALUE - 1/Number.MAX_VALUE );
+
+new TestCase( SECTION, "Number.MIN_VALUE - Number.MIN_VALUE", 0, Number.MIN_VALUE - Number.MIN_VALUE );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.1.js
new file mode 100644
index 0000000000..44099f6c94
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.1.js
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.7.1.js';
+
+/**
+ File Name: 11.7.1.js
+ ECMA Section: 11.7.1 The Left Shift Operator ( << )
+ Description:
+ Performs a bitwise left shift operation on the left argument by the amount
+ specified by the right argument.
+
+ The production ShiftExpression : ShiftExpression << AdditiveExpression is
+ evaluated as follows:
+
+ 1. Evaluate ShiftExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AdditiveExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToUint32(Result(4)).
+ 7. Mask out all but the least significant 5 bits of Result(6), that is,
+ compute Result(6) & 0x1F.
+ 8. Left shift Result(5) by Result(7) bits. The result is a signed 32 bit
+ integer.
+ 9. Return Result(8).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.7.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The left shift operator ( << )");
+
+for ( power = 0; power < 33; power++ ) {
+ shiftexp = Math.pow( 2, power );
+
+ for ( addexp = 0; addexp < 33; addexp++ ) {
+ new TestCase( SECTION,
+ shiftexp + " << " + addexp,
+ LeftShift( shiftexp, addexp ),
+ shiftexp << addexp );
+ }
+}
+
+test();
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function LeftShift( s, a ) {
+ var shift = ToInt32( s );
+ var add = ToUint32( a );
+ add = Mask( add, 5 );
+ var exp = LShift( shift, add );
+
+ return ( exp );
+}
+function LShift( s, a ) {
+ s = ToInt32BitString( s );
+
+ for ( var z = 0; z < a; z++ ) {
+ s += "0";
+ }
+
+ s = s.substring( a, s.length);
+
+ return ToInt32(ToInt32Decimal(s));
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.2.js
new file mode 100644
index 0000000000..843388767f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.2.js
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.7.2.js';
+
+/**
+ File Name: 11.7.2.js
+ ECMA Section: 11.7.2 The signed right shift operator ( >> )
+ Description:
+ Performs a sign-filling bitwise right shift operation on the left argument
+ by the amount specified by the right argument.
+
+ The production ShiftExpression : ShiftExpression >> AdditiveExpression is
+ evaluated as follows:
+
+ 1. Evaluate ShiftExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AdditiveExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToUint32(Result(4)).
+ 7. Mask out all but the least significant 5 bits of Result(6), that is,
+ compute Result(6) & 0x1F.
+ 8. Perform sign-extending right shift of Result(5) by Result(7) bits. The
+ most significant bit is propagated. The result is a signed 32 bit
+ integer.
+ 9. Return Result(8).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.7.2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The signed right shift operator ( >> )");
+
+var power = 0;
+var addexp = 0;
+
+for ( power = 0; power <= 32; power++ ) {
+ shiftexp = Math.pow( 2, power );
+
+ for ( addexp = 0; addexp <= 32; addexp++ ) {
+ new TestCase( SECTION,
+ shiftexp + " >> " + addexp,
+ SignedRightShift( shiftexp, addexp ),
+ shiftexp >> addexp );
+ }
+}
+
+for ( power = 0; power <= 32; power++ ) {
+ shiftexp = -Math.pow( 2, power );
+
+ for ( addexp = 0; addexp <= 32; addexp++ ) {
+ new TestCase( SECTION,
+ shiftexp + " >> " + addexp,
+ SignedRightShift( shiftexp, addexp ),
+ shiftexp >> addexp );
+ }
+}
+
+test();
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function SignedRightShift( s, a ) {
+ s = ToInt32( s );
+ a = ToUint32( a );
+ a = Mask( a, 5 );
+ return ( SignedRShift( s, a ) );
+}
+function SignedRShift( s, a ) {
+ s = ToInt32BitString( s );
+
+ var firstbit = s.substring(0,1);
+
+ s = s.substring( 1, s.length );
+
+ for ( var z = 0; z < a; z++ ) {
+ s = firstbit + s;
+ }
+
+ s = s.substring( 0, s.length - a);
+
+ s = firstbit +s;
+
+
+ return ToInt32(ToInt32Decimal(s));
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.3.js
new file mode 100644
index 0000000000..27d24e121a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.7.3.js
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.7.3.js';
+
+/**
+ File Name: 11.7.3.js
+ ECMA Section: 11.7.3 The unsigned right shift operator ( >>> )
+ Description:
+ 11.7.3 The unsigned right shift operator ( >>> )
+ Performs a zero-filling bitwise right shift operation on the left argument
+ by the amount specified by the right argument.
+
+ The production ShiftExpression : ShiftExpression >>> AdditiveExpression is
+ evaluated as follows:
+
+ 1. Evaluate ShiftExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AdditiveExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToUint32(Result(2)).
+ 6. Call ToUint32(Result(4)).
+ 7. Mask out all but the least significant 5 bits of Result(6), that is,
+ compute Result(6) & 0x1F.
+ 8. Perform zero-filling right shift of Result(5) by Result(7) bits.
+ Vacated bits are filled with zero. The result is an unsigned 32 bit
+ integer.
+ 9. Return Result(8).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.7.3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The unsigned right shift operator ( >>> )");
+
+var addexp = 0;
+var power = 0;
+
+for ( power = 0; power <= 32; power++ ) {
+ shiftexp = Math.pow( 2, power );
+
+ for ( addexp = 0; addexp <= 32; addexp++ ) {
+ new TestCase( SECTION,
+ shiftexp + " >>> " + addexp,
+ UnsignedRightShift( shiftexp, addexp ),
+ shiftexp >>> addexp );
+ }
+}
+
+test();
+
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
+}
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+
+ return ( n );
+}
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+function ToUint16( n ) {
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
+
+ return ( n );
+}
+function Mask( b, n ) {
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
+}
+function ToUint32BitString( n ) {
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
+ }
+ }
+ return b;
+}
+function ToInt32BitString( n ) {
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ b += ( sign == 1 ) ? "0" : "1";
+
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
+ }
+ }
+
+ return b;
+}
+function ToInt32Decimal( bin ) {
+ var r = 0;
+ var sign;
+
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
+
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
+
+ return r;
+}
+function ToUint32Decimal( bin ) {
+ var r = 0;
+
+
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
+
+ for ( j = 0; j < 32; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+
+ }
+
+ return r;
+}
+function RShift( s, a ) {
+ s = ToUint32BitString( s );
+ for ( z = 0; z < a; z++ ) {
+ s = "0" + s;
+ }
+ s = s.substring( 0, s.length - a );
+
+ return ToUint32Decimal(s);
+}
+function UnsignedRightShift( s, a ) {
+ s = ToUint32( s );
+ a = ToUint32( a );
+ a = Mask( a, 5 );
+ return ( RShift( s, a ) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.1.js
new file mode 100644
index 0000000000..4b35c11b16
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.1.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.8.1.js';
+
+/**
+ File Name: 11.8.1.js
+ ECMA Section: 11.8.1 The less-than operator ( < )
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.8.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The less-than operator ( < )");
+
+new TestCase( SECTION, "true < false", false, true < false );
+new TestCase( SECTION, "false < true", true, false < true );
+new TestCase( SECTION, "false < false", false, false < false );
+new TestCase( SECTION, "true < true", false, true < true );
+
+new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) );
+
+new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) );
+
+new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) );
+
+new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN );
+new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN );
+new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 );
+
+new TestCase( SECTION, "0 < -0", false, 0 < -0 );
+new TestCase( SECTION, "-0 < 0", false, -0 < 0 );
+
+new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 );
+new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 );
+new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE );
+
+new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' );
+new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' );
+new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' );
+new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' );
+new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' );
+new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' );
+
+test();
+
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.2.js
new file mode 100644
index 0000000000..c4e6f4cfbd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.2.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.8.2.js';
+
+/**
+ File Name: 11.8.2.js
+ ECMA Section: 11.8.2 The greater-than operator ( > )
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.8.2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The greater-than operator ( > )");
+
+new TestCase( SECTION, "true > false", true, true > false );
+new TestCase( SECTION, "false > true", false, false > true );
+new TestCase( SECTION, "false > false", false, false > false );
+new TestCase( SECTION, "true > true", false, true > true );
+
+new TestCase( SECTION, "new Boolean(true) > new Boolean(true)", false, new Boolean(true) > new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) > new Boolean(false)", true, new Boolean(true) > new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) > new Boolean(true)", false, new Boolean(false) > new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) > new Boolean(false)", false, new Boolean(false) > new Boolean(false) );
+
+new TestCase( SECTION, "new MyObject(Infinity) > new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(true)", false, new MyValueObject(false) > new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) > new MyValueObject(true)", false, new MyValueObject(true) > new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(false)", false, new MyValueObject(false) > new MyValueObject(false) );
+
+new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(true)", false, new MyStringObject(false) > new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) > new MyStringObject(true)", false, new MyStringObject(true) > new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(false)", false, new MyStringObject(false) > new MyStringObject(false) );
+
+new TestCase( SECTION, "Number.NaN > Number.NaN", false, Number.NaN > Number.NaN );
+new TestCase( SECTION, "0 > Number.NaN", false, 0 > Number.NaN );
+new TestCase( SECTION, "Number.NaN > 0", false, Number.NaN > 0 );
+
+new TestCase( SECTION, "0 > -0", false, 0 > -0 );
+new TestCase( SECTION, "-0 > 0", false, -0 > 0 );
+
+new TestCase( SECTION, "Infinity > 0", true, Number.POSITIVE_INFINITY > 0 );
+new TestCase( SECTION, "Infinity > Number.MAX_VALUE", true, Number.POSITIVE_INFINITY > Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity > Infinity", false, Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 > Infinity", false, 0 > Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE > Infinity", false, Number.MAX_VALUE > Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 > -Infinity", true, 0 > Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE > -Infinity", true, Number.MAX_VALUE > Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity > -Infinity", false, Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "-Infinity > 0", false, Number.NEGATIVE_INFINITY > 0 );
+new TestCase( SECTION, "-Infinity > -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY > -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity > Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY > Number.MIN_VALUE );
+
+new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
+new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
+new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
+new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
+new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
+new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
+
+test();
+
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.3.js
new file mode 100644
index 0000000000..2180fc5655
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.3.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.8.3.js';
+
+/**
+ File Name: 11.8.3.js
+ ECMA Section: 11.8.3 The less-than-or-equal operator ( <= )
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.8.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )");
+
+new TestCase( SECTION, "true <= false", false, true <= false );
+new TestCase( SECTION, "false <= true", true, false <= true );
+new TestCase( SECTION, "false <= false", true, false <= false );
+new TestCase( SECTION, "true <= true", true, true <= true );
+
+new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) );
+
+new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) );
+
+new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) );
+
+new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN );
+new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN );
+new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 );
+
+new TestCase( SECTION, "0 <= -0", true, 0 <= -0 );
+new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 );
+
+new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 );
+new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 );
+new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE );
+
+new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' );
+new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' );
+new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' );
+new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' );
+new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' );
+new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' );
+
+test();
+
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.4.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.4.js
new file mode 100644
index 0000000000..d43aaa260d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.8.4.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.8.4.js';
+
+/**
+ File Name: 11.8.4.js
+ ECMA Section: 11.8.4 The greater-than-or-equal operator ( >= )
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.8.4";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The greater-than-or-equal operator ( >= )");
+
+new TestCase( SECTION, "true >= false", true, true >= false );
+new TestCase( SECTION, "false >= true", false, false >= true );
+new TestCase( SECTION, "false >= false", true, false >= false );
+new TestCase( SECTION, "true >= true", true, true >= true );
+
+new TestCase( SECTION, "new Boolean(true) >= new Boolean(true)", true, new Boolean(true) >= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) >= new Boolean(false)", true, new Boolean(true) >= new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) >= new Boolean(true)", false, new Boolean(false) >= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) >= new Boolean(false)", true, new Boolean(false) >= new Boolean(false) );
+
+new TestCase( SECTION, "new MyObject(Infinity) >= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(true)", false, new MyValueObject(false) >= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) >= new MyValueObject(true)", true, new MyValueObject(true) >= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(false)", true, new MyValueObject(false) >= new MyValueObject(false) );
+
+new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(true)", false, new MyStringObject(false) >= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) >= new MyStringObject(true)", true, new MyStringObject(true) >= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(false)", true, new MyStringObject(false) >= new MyStringObject(false) );
+
+new TestCase( SECTION, "Number.NaN >= Number.NaN", false, Number.NaN >= Number.NaN );
+new TestCase( SECTION, "0 >= Number.NaN", false, 0 >= Number.NaN );
+new TestCase( SECTION, "Number.NaN >= 0", false, Number.NaN >= 0 );
+
+new TestCase( SECTION, "0 >= -0", true, 0 >= -0 );
+new TestCase( SECTION, "-0 >= 0", true, -0 >= 0 );
+
+new TestCase( SECTION, "Infinity >= 0", true, Number.POSITIVE_INFINITY >= 0 );
+new TestCase( SECTION, "Infinity >= Number.MAX_VALUE", true, Number.POSITIVE_INFINITY >= Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity >= Infinity", true, Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 >= Infinity", false, 0 >= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE >= Infinity", false, Number.MAX_VALUE >= Number.POSITIVE_INFINITY );
+
+new TestCase( SECTION, "0 >= -Infinity", true, 0 >= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE >= -Infinity", true, Number.MAX_VALUE >= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity >= -Infinity", true, Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY );
+
+new TestCase( SECTION, "-Infinity >= 0", false, Number.NEGATIVE_INFINITY >= 0 );
+new TestCase( SECTION, "-Infinity >= -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY >= -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity >= Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY >= Number.MIN_VALUE );
+
+new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
+new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
+new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
+new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
+new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
+new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
+
+test();
+
+function MyObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
+}
+function MyValueObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
+function MyStringObject(value) {
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.1.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.1.js
new file mode 100644
index 0000000000..6bf3fc0517
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.1.js
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.9.1.js';
+
+/**
+ File Name: 11.9.1.js
+ ECMA Section: 11.9.1 The equals operator ( == )
+ Description:
+
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
+
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.9.1";
+var VERSION = "ECMA_1";
+var BUGNUMBER="77391";
+startTest();
+
+writeHeaderToLog( SECTION + " The equals operator ( == )");
+
+// type x and type y are the same. if type x is undefined or null, return true
+
+new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
+new TestCase( SECTION, "null == null", true, null == null );
+
+// if x is NaN, return false. if y is NaN, return false.
+
+new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
+new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
+new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
+new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
+
+// if x is the same number value as y, return true.
+
+new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
+new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
+
+// if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+
+new TestCase( SECTION, "0 == 0", true, 0 == 0 );
+new TestCase( SECTION, "0 == -0", true, 0 == -0 );
+new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
+new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
+
+// return false.
+
+new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
+new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
+new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
+new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
+
+// type x and type y are the same type, but not numbers.
+
+
+// x and y are strings. return true if x and y are exactly the same sequence of characters.
+// otherwise, return false.
+
+new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
+
+// x and y are booleans. return true if both are true or both are false.
+
+new TestCase( SECTION, "true == true", true, true == true );
+new TestCase( SECTION, "false == false", true, false == false );
+new TestCase( SECTION, "true == false", false, true == false );
+new TestCase( SECTION, "false == true", false, false == true );
+
+// return true if x and y refer to the same object. otherwise return false.
+
+new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+
+new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
+
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+// if x is null and y is undefined, return true. if x is undefined and y is null return true.
+
+new TestCase( SECTION, "null == void 0", true, null == void 0 );
+new TestCase( SECTION, "void 0 == null", true, void 0 == null );
+
+// if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
+
+new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
+new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
+new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
+new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
+
+
+new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
+new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
+
+new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
+new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
+
+new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
+new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
+
+new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
+new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.2.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.2.js
new file mode 100644
index 0000000000..b6983e6af1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.2.js
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.9.2.js';
+
+/**
+ File Name: 11.9.2.js
+ ECMA Section: 11.9.2 The equals operator ( == )
+ Description:
+
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
+
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.9.2";
+var VERSION = "ECMA_1";
+var BUGNUMBER="77391";
+startTest();
+
+writeHeaderToLog( SECTION + " The equals operator ( == )");
+
+// type x and type y are the same. if type x is undefined or null, return true
+
+new TestCase( SECTION, "void 0 == void 0", false, void 0 != void 0 );
+new TestCase( SECTION, "null == null", false, null != null );
+
+// if x is NaN, return false. if y is NaN, return false.
+
+new TestCase( SECTION, "NaN != NaN", true, Number.NaN != Number.NaN );
+new TestCase( SECTION, "NaN != 0", true, Number.NaN != 0 );
+new TestCase( SECTION, "0 != NaN", true, 0 != Number.NaN );
+new TestCase( SECTION, "NaN != Infinity", true, Number.NaN != Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Infinity != NaN", true, Number.POSITIVE_INFINITY != Number.NaN );
+
+// if x is the same number value as y, return true.
+
+new TestCase( SECTION, "Number.MAX_VALUE != Number.MAX_VALUE", false, Number.MAX_VALUE != Number.MAX_VALUE );
+new TestCase( SECTION, "Number.MIN_VALUE != Number.MIN_VALUE", false, Number.MIN_VALUE != Number.MIN_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY", false, Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY", false, Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY );
+
+// if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+
+new TestCase( SECTION, "0 != 0", false, 0 != 0 );
+new TestCase( SECTION, "0 != -0", false, 0 != -0 );
+new TestCase( SECTION, "-0 != 0", false, -0 != 0 );
+new TestCase( SECTION, "-0 != -0", false, -0 != -0 );
+
+// return false.
+
+new TestCase( SECTION, "0.9 != 1", true, 0.9 != 1 );
+new TestCase( SECTION, "0.999999 != 1", true, 0.999999 != 1 );
+new TestCase( SECTION, "0.9999999999 != 1", true, 0.9999999999 != 1 );
+new TestCase( SECTION, "0.9999999999999 != 1", true, 0.9999999999999 != 1 );
+
+// type x and type y are the same type, but not numbers.
+
+
+// x and y are strings. return true if x and y are exactly the same sequence of characters.
+// otherwise, return false.
+
+new TestCase( SECTION, "'hello' != 'hello'", false, "hello" != "hello" );
+
+// x and y are booleans. return true if both are true or both are false.
+
+new TestCase( SECTION, "true != true", false, true != true );
+new TestCase( SECTION, "false != false", false, false != false );
+new TestCase( SECTION, "true != false", true, true != false );
+new TestCase( SECTION, "false != true", true, false != true );
+
+// return true if x and y refer to the same object. otherwise return false.
+
+new TestCase( SECTION, "new MyObject(true) != new MyObject(true)", true, new MyObject(true) != new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
+
+
+new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z != y", false, eval("x = new MyObject(true); y = x; z = x; z != y") );
+new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z != y", false, eval("x = new MyObject(false); y = x; z = x; z != y") );
+new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z != y", false, eval("x = new Boolean(true); y = x; z = x; z != y") );
+new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z != y", false, eval("x = new Boolean(false); y = x; z = x; z != y") );
+
+new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
+
+// if x is null and y is undefined, return true. if x is undefined and y is null return true.
+
+new TestCase( SECTION, "null != void 0", false, null != void 0 );
+new TestCase( SECTION, "void 0 != null", false, void 0 != null );
+
+// if type(x) is Number and type(y) is string, return the result of the comparison x != ToNumber(y).
+
+new TestCase( SECTION, "1 != '1'", false, 1 != '1' );
+new TestCase( SECTION, "255 != '0xff'", false, 255 != '0xff' );
+new TestCase( SECTION, "0 != '\r'", false, 0 != "\r" );
+new TestCase( SECTION, "1e19 != '1e19'", false, 1e19 != "1e19" );
+
+
+new TestCase( SECTION, "new Boolean(true) != true", false, true != new Boolean(true) );
+new TestCase( SECTION, "new MyObject(true) != true", false, true != new MyObject(true) );
+
+new TestCase( SECTION, "new Boolean(false) != false", false, new Boolean(false) != false );
+new TestCase( SECTION, "new MyObject(false) != false", false, new MyObject(false) != false );
+
+new TestCase( SECTION, "true != new Boolean(true)", false, true != new Boolean(true) );
+new TestCase( SECTION, "true != new MyObject(true)", false, true != new MyObject(true) );
+
+new TestCase( SECTION, "false != new Boolean(false)", false, false != new Boolean(false) );
+new TestCase( SECTION, "false != new MyObject(false)", false, false != new MyObject(false) );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.3.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.3.js
new file mode 100644
index 0000000000..cce1c63c16
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/11.9.3.js
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.9.3.js';
+
+/**
+ File Name: 11.9.3.js
+ ECMA Section: 11.9.3 The equals operator ( == )
+ Description:
+
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
+
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.9.3";
+var VERSION = "ECMA_1";
+var BUGNUMBER="77391";
+startTest();
+
+writeHeaderToLog( SECTION + " The equals operator ( == )");
+
+// type x and type y are the same. if type x is undefined or null, return true
+
+new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
+new TestCase( SECTION, "null == null", true, null == null );
+
+// if x is NaN, return false. if y is NaN, return false.
+
+new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
+new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
+new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
+new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
+
+// if x is the same number value as y, return true.
+
+new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
+new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
+
+// if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+
+new TestCase( SECTION, "0 == 0", true, 0 == 0 );
+new TestCase( SECTION, "0 == -0", true, 0 == -0 );
+new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
+new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
+
+// return false.
+
+new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
+new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
+new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
+new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
+
+// type x and type y are the same type, but not numbers.
+
+
+// x and y are strings. return true if x and y are exactly the same sequence of characters.
+// otherwise, return false.
+
+new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
+
+// x and y are booleans. return true if both are true or both are false.
+
+new TestCase( SECTION, "true == true", true, true == true );
+new TestCase( SECTION, "false == false", true, false == false );
+new TestCase( SECTION, "true == false", false, true == false );
+new TestCase( SECTION, "false == true", false, false == true );
+
+// return true if x and y refer to the same object. otherwise return false.
+
+new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+
+new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
+
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+
+// if x is null and y is undefined, return true. if x is undefined and y is null return true.
+
+new TestCase( SECTION, "null == void 0", true, null == void 0 );
+new TestCase( SECTION, "void 0 == null", true, void 0 == null );
+
+// if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
+
+new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
+new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
+new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
+new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
+
+
+new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
+new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
+
+new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
+new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
+
+new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
+new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
+
+new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
+new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/browser.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Expressions/shell.js b/tests/auto/qml/parserstress/tests/ecma/Expressions/shell.js
new file mode 100644
index 0000000000..8f5d1129d5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Expressions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Expressions';
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-1.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-1.js
new file mode 100644
index 0000000000..90f080acc9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-1.js
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.1.1-1.js';
+
+/**
+ File Name: 15.3.1.1.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn, body
+ (where n might be 0, that is, there are no "p" arguments, and where body might
+ also not be provided), the following steps are taken:
+
+ 1. Create and return a new Function object exactly if the function constructor had
+ been called with the same arguments (15.3.2.1).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.1.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" );
+
+
+var myfunc = Function();
+myfunc.toString = Object.prototype.toString;
+
+// not going to test toString here since it is implementation dependent.
+// new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+
+myfunc.toString = Object.prototype.toString;
+new TestCase( SECTION,
+ "myfunc = Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc.toString() );
+
+new TestCase( SECTION,
+ "myfunc.length",
+ 0,
+ myfunc.length );
+
+new TestCase( SECTION,
+ "myfunc.prototype.toString()",
+ "[object Object]",
+ myfunc.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc.prototype.constructor",
+ myfunc,
+ myfunc.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc.arguments",
+ null,
+ myfunc.arguments );
+
+new TestCase( SECTION,
+ "var OBJ = new MyObject(true); OBJ.valueOf()",
+ true,
+ eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+
+new TestCase( SECTION,
+ "OBJ.toString()",
+ "true",
+ OBJ.toString() );
+
+new TestCase( SECTION,
+ "OBJ.toString = Object.prototype.toString; OBJ.toString()",
+ "[object Object]",
+ eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.toString = Object.prototype.toString; MyObject.toString()",
+ "[object Function]",
+ eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.length",
+ 1,
+ MyObject.length );
+
+new TestCase( SECTION,
+ "MyObject.prototype.constructor",
+ MyObject,
+ MyObject.prototype.constructor );
+
+new TestCase( SECTION,
+ "MyObject.arguments",
+ null,
+ MyObject.arguments );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-2.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-2.js
new file mode 100644
index 0000000000..57fe78c8f1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-2.js
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.1.1-2.js';
+
+/**
+ File Name: 15.3.1.1-2.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+ Function(p1, p2, ..., pn, body )
+
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn,
+ body (where n might be 0, that is, there are no "p" arguments, and where body
+ might also not be provided), the following steps are taken:
+
+ 1. Create and return a new Function object exactly if the function constructor
+ had been called with the same arguments (15.3.2.1).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.1.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var myfunc1 = Function("a","b","c", "return a+b+c" );
+var myfunc2 = Function("a, b, c", "return a+b+c" );
+var myfunc3 = Function("a,b", "c", "return a+b+c" );
+
+myfunc1.toString = Object.prototype.toString;
+myfunc2.toString = Object.prototype.toString;
+myfunc3.toString = Object.prototype.toString;
+
+new TestCase( SECTION,
+ "myfunc1 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc1.toString() );
+
+new TestCase( SECTION,
+ "myfunc1.length",
+ 3,
+ myfunc1.length );
+
+new TestCase( SECTION,
+ "myfunc1.prototype.toString()",
+ "[object Object]",
+ myfunc1.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc1.prototype.constructor",
+ myfunc1,
+ myfunc1.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc1.arguments",
+ null,
+ myfunc1.arguments );
+
+new TestCase( SECTION,
+ "myfunc1(1,2,3)",
+ 6,
+ myfunc1(1,2,3) );
+
+new TestCase( SECTION,
+ "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+new TestCase( SECTION,
+ "myfunc2 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc2.toString() );
+
+new TestCase( SECTION,
+ "myfunc2.length",
+ 3,
+ myfunc2.length );
+
+new TestCase( SECTION,
+ "myfunc2.prototype.toString()",
+ "[object Object]",
+ myfunc2.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc2.prototype.constructor",
+ myfunc2,
+ myfunc2.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc2.arguments",
+ null,
+ myfunc2.arguments );
+
+new TestCase( SECTION,
+ "myfunc2( 1000, 200, 30 )",
+ 1230,
+ myfunc2(1000,200,30) );
+
+new TestCase( SECTION,
+ "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+new TestCase( SECTION,
+ "myfunc3 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc3.toString() );
+
+new TestCase( SECTION,
+ "myfunc3.length",
+ 3,
+ myfunc3.length );
+
+new TestCase( SECTION,
+ "myfunc3.prototype.toString()",
+ "[object Object]",
+ myfunc3.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc3.prototype.valueOf() +''",
+ "[object Object]",
+ myfunc3.prototype.valueOf() +'' );
+
+new TestCase( SECTION,
+ "myfunc3.prototype.constructor",
+ myfunc3,
+ myfunc3.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc3.arguments",
+ null,
+ myfunc3.arguments );
+
+new TestCase( SECTION,
+ "myfunc3(-100,100,NaN)",
+ Number.NaN,
+ myfunc3(-100,100,NaN) );
+
+new TestCase( SECTION,
+ "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-3.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-3.js
new file mode 100644
index 0000000000..51f7bb763b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.1.1-3.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.1.1-3.js';
+
+/**
+ File Name: 15.3.1.1-3.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.1.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var args = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
+}
+
+var s = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
+}
+
+MyFunc = Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+MyObject = Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+var MY_OB = eval( "MyFunc("+ s +")" );
+
+new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, MY_OB );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+
+new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-1.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-1.js
new file mode 100644
index 0000000000..d76e57b828
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-1.js
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.2.1-1.js';
+
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" );
+
+var myfunc = new Function();
+
+// not going to test toString here since it is implementation dependent.
+// new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+
+myfunc.toString = Object.prototype.toString;
+
+new TestCase( SECTION, "myfunc = new Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc.toString() );
+
+new TestCase( SECTION,
+ "myfunc.length",
+ 0,
+ myfunc.length );
+
+new TestCase( SECTION,
+ "myfunc.prototype.toString()",
+ "[object Object]",
+ myfunc.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc.prototype.constructor",
+ myfunc,
+ myfunc.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc.arguments",
+ null,
+ myfunc.arguments );
+
+new TestCase( SECTION,
+ "var OBJ = new MyObject(true); OBJ.valueOf()",
+ true,
+ eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+
+new TestCase( SECTION,
+ "OBJ.toString()",
+ "true",
+ OBJ.toString() );
+
+new TestCase( SECTION,
+ "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]",
+ eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.toString = Object.prototype.toString; MyObject.toString()",
+ "[object Function]",
+ eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.length",
+ 1,
+ MyObject.length );
+
+new TestCase( SECTION,
+ "MyObject.prototype.constructor",
+ MyObject,
+ MyObject.prototype.constructor );
+
+new TestCase( SECTION,
+ "MyObject.arguments",
+ null,
+ MyObject.arguments );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-2.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-2.js
new file mode 100644
index 0000000000..7729c9587a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-2.js
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.2.1-2.js';
+
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var myfunc1 = new Function("a","b","c", "return a+b+c" );
+var myfunc2 = new Function("a, b, c", "return a+b+c" );
+var myfunc3 = new Function("a,b", "c", "return a+b+c" );
+
+myfunc1.toString = Object.prototype.toString;
+myfunc2.toString = Object.prototype.toString;
+myfunc3.toString = Object.prototype.toString;
+
+new TestCase( SECTION, "myfunc1 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc1.toString() );
+
+new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length );
+new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() );
+
+new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor );
+new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments );
+new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) );
+new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+new TestCase( SECTION, "myfunc2 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc2.toString() );
+new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length );
+new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() );
+
+new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor );
+new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments );
+new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) );
+new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+new TestCase( SECTION, "myfunc3 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc3.toString() );
+new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length );
+new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() );
+new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' );
+new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor );
+new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments );
+new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) );
+
+new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-3.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-3.js
new file mode 100644
index 0000000000..80b1c41e00
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.2.1-3.js
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.2.1-3.js';
+
+/**
+ File Name: 15.3.2.1-3.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.2.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var args = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
+}
+
+var s = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
+}
+
+MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+
+new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-2.js
new file mode 100644
index 0000000000..b760afd149
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.3.1-2.js';
+
+/**
+ File Name: 15.3.3.1-2.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the DontEnum property of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var str='';for (prop in Function ) str += prop; str;",
+ "",
+ eval("var str='';for (prop in Function) str += prop; str;")
+ );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-3.js
new file mode 100644
index 0000000000..62e6d42342
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-3.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.3.1-3.js';
+
+/**
+ File Name: 15.3.3.1-3.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the DontDelete property of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var FUN_PROTO = Function.prototype;
+
+new TestCase( SECTION,
+ "delete Function.prototype",
+ false,
+ delete Function.prototype
+ );
+
+new TestCase( SECTION,
+ "delete Function.prototype; Function.prototype",
+ FUN_PROTO,
+ eval("delete Function.prototype; Function.prototype")
+ );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-4.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-4.js
new file mode 100644
index 0000000000..6e1aa8426d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.1-4.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.3.1-4.js';
+
+/**
+ File Name: 15.3.3.1-4.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the ReadOnly property of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Function.prototype = null; Function.prototype",
+ Function.prototype,
+ eval("Function.prototype = null; Function.prototype")
+ );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.2.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.2.js
new file mode 100644
index 0000000000..b1d04f3957
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.3.2.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.3.2.js';
+
+/**
+ File Name: 15.3.3.2.js
+ ECMA Section: 15.3.3.2 Properties of the Function Constructor
+ Function.length
+
+ Description: The length property is 1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.3.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.length";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Function.length", 1, Function.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4-1.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4-1.js
new file mode 100644
index 0000000000..c90c26a9e5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4-1.js
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.4-1.js';
+
+/**
+ File Name: 15.3.4-1.js
+ ECMA Section: 15.3.4 Properties of the Function Prototype Object
+
+ Description: The Function prototype object is itself a Function
+ object ( its [[Class]] is "Function") that, when
+ invoked, accepts any arguments and returns undefined.
+
+ The value of the internal [[Prototype]] property
+ object is the Object prototype object.
+
+ It is a function with an "empty body"; if it is
+ invoked, it merely returns undefined.
+
+ The Function prototype object does not have a valueOf
+ property of its own; however it inherits the valueOf
+ property from the Object prototype Object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Function Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
+
+
+// new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+
+new TestCase( SECTION,
+ "Function.prototype.valueOf",
+ Object.prototype.valueOf,
+ Function.prototype.valueOf );
+
+new TestCase( SECTION,
+ "Function.prototype()",
+ (void 0),
+ Function.prototype() );
+
+new TestCase( SECTION,
+ "Function.prototype(1,true,false,'string', new Date(),null)",
+ (void 0),
+ Function.prototype(1,true,false,'string', new Date(),null) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.1.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.1.js
new file mode 100644
index 0000000000..a6bc775902
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.1.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.4.1.js';
+
+/**
+ File Name: 15.3.4.1.js
+ ECMA Section: 15.3.4.1 Function.prototype.constructor
+
+ Description: The initial value of Function.prototype.constructor
+ is the built-in Function constructor.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Function.prototype.constructor", Function, Function.prototype.constructor );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.js
new file mode 100644
index 0000000000..59e3ff81a5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.4.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.4.js';
+
+/**
+ File Name: 15.3.4.js
+ ECMA Section: 15.3.4 Properties of the Function Prototype Object
+
+ Description: The Function prototype object is itself a Function
+ object ( its [[Class]] is "Function") that, when
+ invoked, accepts any arguments and returns undefined.
+
+ The value of the internal [[Prototype]] property
+ object is the Object prototype object.
+
+ It is a function with an "empty body"; if it is
+ invoked, it merely returns undefined.
+
+ The Function prototype object does not have a valueOf
+ property of its own; however it inherits the valueOf
+ property from the Object prototype Object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Function Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
+
+
+// new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf );
+new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() );
+new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-1.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-1.js
new file mode 100644
index 0000000000..c3fbfc774e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-1.js
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.5-1.js';
+
+/**
+ File Name: 15.3.5-1.js
+ ECMA Section: 15.3.5 Properties of Function Instances
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+
+ 15.3.5.1 length
+
+ The value of the length property is usually an integer that indicates
+ the "typical" number of arguments expected by the function. However,
+ the language permits the function to be invoked with some other number
+ of arguments. The behavior of a function when invoked on a number of
+ arguments other than the number specified by its length property depends
+ on the function.
+
+ 15.3.5.2 prototype
+ The value of the prototype property is used to initialize the internal [[
+ Prototype]] property of a newly created object before the Function object
+ is invoked as a constructor for that newly created object.
+
+ 15.3.5.3 arguments
+
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the function has been called
+ but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
+ arguments property is "dynamically bound" to a newly created object that contains the
+ arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility with existing old code.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of Function Instances";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+var args = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
+}
+
+var s = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
+}
+
+MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+
+new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+new TestCase( SECTION, "MyFunc.prototype.toString()", "[object Object]", MyFunc.prototype.toString() );
+new TestCase( SECTION, "typeof MyFunc.prototype", "object", typeof MyFunc.prototype );
+
+
+new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-2.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-2.js
new file mode 100644
index 0000000000..dcb351985d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5-2.js
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.5-2.js';
+
+/**
+ File Name: 15.3.5-1.js
+ ECMA Section: 15.3.5 Properties of Function Instances
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+
+ 15.3.5.1 length
+
+ The value of the length property is usually an integer that indicates
+ the "typical" number of arguments expected by the function. However,
+ the language permits the function to be invoked with some other number
+ of arguments. The behavior of a function when invoked on a number of
+ arguments other than the number specified by its length property depends
+ on the function.
+
+ 15.3.5.2 prototype
+ The value of the prototype property is used to initialize the internal [[
+ Prototype]] property of a newly created object before the Function object
+ is invoked as a constructor for that newly created object.
+
+ 15.3.5.3 arguments
+
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the function has been called
+ but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
+ arguments property is "dynamically bound" to a newly created object that contains the
+ arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility with existing old code.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of Function Instances";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+var MyObject = new Function( 'a', 'b', 'c', 'this.a = a; this.b = b; this.c = c; this.value = a+b+c; this.valueOf = new Function( "return this.value" )' );
+
+new TestCase( SECTION, "MyObject.length", 3, MyObject.length );
+new TestCase( SECTION, "typeof MyObject.prototype", "object", typeof MyObject.prototype );
+new TestCase( SECTION, "typeof MyObject.prototype.constructor", "function", typeof MyObject.prototype.constructor );
+new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.1.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.1.js
new file mode 100644
index 0000000000..406d569dba
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.1.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.5.1.js';
+
+/**
+ File Name: 15.3.5.1.js
+ ECMA Section: Function.length
+ Description:
+
+ The value of the length property is usually an integer that indicates the
+ "typical" number of arguments expected by the function. However, the
+ language permits the function to be invoked with some other number of
+ arguments. The behavior of a function when invoked on a number of arguments
+ other than the number specified by its length property depends on the function.
+
+ this test needs a 1.2 version check.
+
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.3.5.1";
+var VERSION = "ECMA_1";
+var TITLE = "Function.length";
+var BUGNUMBER="104204";
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var f = new Function( "a","b", "c", "return f.length");
+
+new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f()',
+ 3,
+ f() );
+
+
+new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
+ 3,
+ f(1,2,3,4,5) );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.3.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.3.js
new file mode 100644
index 0000000000..4a127fbc68
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/15.3.5.3.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.5.3.js';
+
+/**
+ File Name: 15.3.5.3.js
+ ECMA Section: Function.arguments
+ Description:
+
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the
+ function has been called but has not yet returned). When a non-internal
+ Function object (15.3.2.1) is invoked, its arguments property is
+ "dynamically bound" to a newly created object that contains the arguments
+ on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility
+ with existing old code.
+
+ See sections 10.1.6 and 10.1.8 for more extensive tests.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.3.5.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.arguments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MYFUNCTION = new Function( "return this.arguments" );
+
+new TestCase( SECTION, "var MYFUNCTION = new Function( 'return this.arguments' ); MYFUNCTION.arguments", null, MYFUNCTION.arguments );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/browser.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/shell.js b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/shell.js
new file mode 100644
index 0000000000..27aa7b1318
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/FunctionObjects/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'FunctionObjects';
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-1-n.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-1-n.js
new file mode 100644
index 0000000000..9946a7f2da
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-1-n.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1-1-n.js';
+
+/**
+ File Name: 15.1-1-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.1-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Global Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var MY_GLOBAL = new this()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var MY_GLOBAL = new this()",
+ "error",
+ eval("var MY_GLOBAL = new this()") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-2-n.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-2-n.js
new file mode 100644
index 0000000000..545caeeae0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1-2-n.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1-2-n.js';
+
+/**
+ File Name: 15.1-2-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Call]] property; it is not possible
+ to invoke the global object as a function.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.1-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Global Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var MY_GLOBAL = this()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var MY_GLOBAL = this()",
+ "error",
+ eval("var MY_GLOBAL = this()") );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.1.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.1.js
new file mode 100644
index 0000000000..a8d4e7fecf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.1.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.1.1.js';
+
+/**
+ File Name: 15.1.1.1.js
+ ECMA Section: 15.1.1.1 NaN
+
+ Description: The initial value of NaN is NaN.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.1.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "NaN";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "NaN", Number.NaN, NaN );
+new TestCase( SECTION, "this.NaN", Number.NaN, this.NaN );
+new TestCase( SECTION, "typeof NaN", "number", typeof NaN );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.2.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.2.js
new file mode 100644
index 0000000000..8671ff642a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.1.2.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.1.2.js';
+
+/**
+ File Name: 15.1.1.2.js
+ ECMA Section: 15.1.1.2 Infinity
+
+ Description: The initial value of Infinity is +Infinity.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.1.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Infinity";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Infinity", Number.POSITIVE_INFINITY, Infinity );
+new TestCase( SECTION, "this.Infinity", Number.POSITIVE_INFINITY, this.Infinity );
+new TestCase( SECTION, "typeof Infinity", "number", typeof Infinity );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.1-2.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.1-2.js
new file mode 100644
index 0000000000..8572371f8e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.1-2.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.1-2.js';
+
+/**
+ File Name: 15.1.2.1-2.js
+ ECMA Section: 15.1.2.1 eval(x)
+
+ Parse x as an ECMAScript Program. If the parse fails,
+ generate a runtime error. Evaluate the program. If
+ result is "Normal completion after value V", return
+ the value V. Else, return undefined.
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.1.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "eval(x)";
+var BUGNUMBER = "none";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x",
+ "0/1/1970",
+ eval( "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x" ));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js
new file mode 100644
index 0000000000..87cba8cd2f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js
@@ -0,0 +1,372 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.2-1.js';
+
+/**
+ File Name: 15.1.2.2-1.js
+ ECMA Section: 15.1.2.2 Function properties of the global object
+ parseInt( string, radix )
+
+ Description:
+
+ The parseInt function produces an integer value dictated by intepretation
+ of the contents of the string argument according to the specified radix.
+
+ When the parseInt function is called, the following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute a substring of Result(1) consisting of the leftmost character
+ that is not a StrWhiteSpaceChar and all characters to the right of
+ that character. (In other words, remove leading whitespace.)
+ 3. Let sign be 1.
+ 4. If Result(2) is not empty and the first character of Result(2) is a
+ minus sign -, let sign be -1.
+ 5. If Result(2) is not empty and the first character of Result(2) is a
+ plus sign + or a minus sign -, then Result(5) is the substring of
+ Result(2) produced by removing the first character; otherwise, Result(5)
+ is Result(2).
+ 6. If the radix argument is not supplied, go to step 12.
+ 7. Call ToInt32(radix).
+ 8. If Result(7) is zero, go to step 12; otherwise, if Result(7) < 2 or
+ Result(7) > 36, return NaN.
+ 9. Let R be Result(7).
+ 10. If R = 16 and the length of Result(5) is at least 2 and the first two
+ characters of Result(5) are either "0x" or "0X", let S be the substring
+ of Result(5) consisting of all but the first two characters; otherwise,
+ let S be Result(5).
+ 11. Go to step 22.
+ 12. If Result(5) is empty or the first character of Result(5) is not 0,
+ go to step 20.
+ 13. If the length of Result(5) is at least 2 and the second character of
+ Result(5) is x or X, go to step 17.
+ 14. Let R be 8.
+ 15. Let S be Result(5).
+ 16. Go to step 22.
+ 17. Let R be 16.
+ 18. Let S be the substring of Result(5) consisting of all but the first
+ two characters.
+ 19. Go to step 22.
+ 20. Let R be 10.
+ 21. Let S be Result(5).
+ 22. If S contains any character that is not a radix-R digit, then let Z be
+ the substring of S consisting of all characters to the left of the
+ leftmost such character; otherwise, let Z be S.
+ 23. If Z is empty, return NaN.
+ 24. Compute the mathematical integer value that is represented by Z in
+ radix-R notation. (But if R is 10 and Z contains more than 20
+ significant digits, every digit after the 20th may be replaced by a 0
+ digit, at the option of the implementation; and if R is not 2, 4, 8,
+ 10, 16, or 32, then Result(24) may be an implementation-dependent
+ approximation to the mathematical integer value that is represented
+ by Z in radix-R notation.)
+ 25. Compute the number value for Result(24).
+ 26. Return sign Result(25).
+
+ Note that parseInt may interpret only a leading portion of the string as
+ an integer value; it ignores any characters that cannot be interpreted as
+ part of the notation of an integer, and no indication is given that any
+ such characters were ignored.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.2.2-1";
+var VERSION = "ECMA_1";
+var TITLE = "parseInt(string, radix)";
+var BUGNUMBER = "none";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var HEX_STRING = "0x0";
+var HEX_VALUE = 0;
+
+new TestCase( SECTION,
+ "parseInt.length",
+ 2,
+ parseInt.length );
+
+new TestCase( SECTION,
+ "parseInt.length = 0; parseInt.length",
+ 2,
+ eval("parseInt.length = 0; parseInt.length") );
+
+new TestCase( SECTION,
+ "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", "prototype",
+ eval("var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS") );
+
+new TestCase( SECTION,
+ "delete parseInt.length",
+ false,
+ delete parseInt.length );
+
+new TestCase( SECTION,
+ "delete parseInt.length; parseInt.length",
+ 2,
+ eval("delete parseInt.length; parseInt.length") );
+
+new TestCase( SECTION,
+ "parseInt.length = null; parseInt.length",
+ 2,
+ eval("parseInt.length = null; parseInt.length") );
+
+new TestCase( SECTION,
+ "parseInt()",
+ NaN,
+ parseInt() );
+
+new TestCase( SECTION,
+ "parseInt('')",
+ NaN,
+ parseInt("") );
+
+new TestCase( SECTION,
+ "parseInt('','')",
+ NaN,
+ parseInt("","") );
+
+new TestCase( SECTION,
+ "parseInt(\" 0xabcdef ",
+ 11259375,
+ parseInt( " 0xabcdef " ));
+
+new TestCase( SECTION,
+ "parseInt(\" 0XABCDEF ",
+ 11259375,
+ parseInt( " 0XABCDEF " ) );
+
+new TestCase( SECTION,
+ "parseInt( 0xabcdef )",
+ 11259375,
+ parseInt( "0xabcdef") );
+
+new TestCase( SECTION,
+ "parseInt( 0XABCDEF )",
+ 11259375,
+ parseInt( "0XABCDEF") );
+
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",null)", HEX_VALUE, parseInt(HEX_STRING,null) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+", void 0)", HEX_VALUE, parseInt(HEX_STRING, void 0) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+
+// a few tests with spaces
+
+for ( var space = " ", HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0;
+ POWER < 15;
+ POWER++, HEX_STRING = HEX_STRING +"f", space += " ")
+{
+ new TestCase( SECTION, "parseInt("+space+HEX_STRING+space+", void 0)", HEX_VALUE, parseInt(space+HEX_STRING+space, void 0) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+
+// a few tests with negative numbers
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+
+// we should stop parsing when we get to a value that is not a numeric literal for the type we expect
+
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"g",16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"G",16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "-0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+
+new TestCase( SECTION,
+ "parseInt( '0x' )",
+ NaN,
+ parseInt("0x") );
+
+new TestCase( SECTION,
+ "parseInt( '0X' )",
+ NaN,
+ parseInt("0X") );
+
+new TestCase( SECTION,
+ "parseInt( '11111111112222222222' )",
+ 11111111112222222222,
+ parseInt("11111111112222222222") );
+
+new TestCase( SECTION,
+ "parseInt( '111111111122222222223' )",
+ 111111111122222222220,
+ parseInt("111111111122222222223") );
+
+new TestCase( SECTION,
+ "parseInt( '11111111112222222222',10 )",
+ 11111111112222222222,
+ parseInt("11111111112222222222",10) );
+
+new TestCase( SECTION,
+ "parseInt( '111111111122222222223',10 )",
+ 111111111122222222220,
+ parseInt("111111111122222222223",10) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', -1 )",
+ Number.NaN,
+ parseInt("01234567890",-1) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 0 )",
+ Number.NaN,
+ parseInt("01234567890",1) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 1 )",
+ Number.NaN,
+ parseInt("01234567890",1) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 2 )",
+ 1,
+ parseInt("01234567890",2) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 3 )",
+ 5,
+ parseInt("01234567890",3) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 4 )",
+ 27,
+ parseInt("01234567890",4) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 5 )",
+ 194,
+ parseInt("01234567890",5) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 6 )",
+ 1865,
+ parseInt("01234567890",6) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 7 )",
+ 22875,
+ parseInt("01234567890",7) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 8 )",
+ 342391,
+ parseInt("01234567890",8) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 9 )",
+ 6053444,
+ parseInt("01234567890",9) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 10 )",
+ 1234567890,
+ parseInt("01234567890",10) );
+
+// need more test cases with hex radix
+
+new TestCase( SECTION,
+ "parseInt( '1234567890', '0xa')",
+ 1234567890,
+ parseInt("1234567890","0xa") );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 11 )",
+ 17715,
+ parseInt("012345",11) );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 35 )",
+ 1590195,
+ parseInt("012345",35) );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 36 )",
+ 1776965,
+ parseInt("012345",36) );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 37 )",
+ Number.NaN,
+ parseInt("012345",37) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-2.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-2.js
new file mode 100644
index 0000000000..ff8806dfb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-2.js
@@ -0,0 +1,238 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.2-2.js';
+
+/**
+ File Name: 15.1.2.2-1.js
+ ECMA Section: 15.1.2.2 Function properties of the global object
+ parseInt( string, radix )
+
+ Description: parseInt test cases written by waldemar, and documented in
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.2.2-2";
+var VERSION = "ECMA_1";
+var TITLE = "parseInt(string, radix)";
+var BUGNUMBER = "none";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)',
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
+
+new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)',
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111101",2));
+
+new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)',
+ 9027215253084864,
+ parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
+
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)',
+ 18054430506169720,
+ parseInt("0000001000000001001000110100010101100111100010011010101111010",2) );
+
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)',
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111011",2));
+
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)',
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111100",2) );
+
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)',
+ 18054430506169728,
+ parseInt("0000001000000001001000110100010101100111100010011010101111110",2) );
+
+new TestCase( SECTION,
+ 'parseInt("yz",35)',
+ 34,
+ parseInt("yz",35) );
+
+new TestCase( SECTION,
+ 'parseInt("yz",36)',
+ 1259,
+ parseInt("yz",36) );
+
+new TestCase( SECTION,
+ 'parseInt("yz",37)',
+ NaN,
+ parseInt("yz",37) );
+
+new TestCase( SECTION,
+ 'parseInt("+77")',
+ 77,
+ parseInt("+77") );
+
+new TestCase( SECTION,
+ 'parseInt("-77",9)',
+ -70,
+ parseInt("-77",9) );
+
+new TestCase( SECTION,
+ 'parseInt("\u20001234\u2000")',
+ 1234,
+ parseInt("\u20001234\u2000") );
+
+new TestCase( SECTION,
+ 'parseInt("123456789012345678")',
+ 123456789012345680,
+ parseInt("123456789012345678") );
+
+new TestCase( SECTION,
+ 'parseInt("9",8)',
+ NaN,
+ parseInt("9",8) );
+
+new TestCase( SECTION,
+ 'parseInt("1e2")',
+ 1,
+ parseInt("1e2") );
+
+new TestCase( SECTION,
+ 'parseInt("1.9999999999999999999")',
+ 1,
+ parseInt("1.9999999999999999999") );
+
+new TestCase( SECTION,
+ 'parseInt("0x10")',
+ 16,
+ parseInt("0x10") );
+
+new TestCase( SECTION,
+ 'parseInt("0x10",10)',
+ 0,
+ parseInt("0x10",10));
+
+new TestCase( SECTION,
+ 'parseInt("0022")',
+ 18,
+ parseInt("0022"));
+
+new TestCase( SECTION,
+ 'parseInt("0022",10)',
+ 22,
+ parseInt("0022",10) );
+
+new TestCase( SECTION,
+ 'parseInt("0x1000000000000080")',
+ 1152921504606847000,
+ parseInt("0x1000000000000080") );
+
+new TestCase( SECTION,
+ 'parseInt("0x1000000000000081")',
+ 1152921504606847200,
+ parseInt("0x1000000000000081") );
+
+s =
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+
+ s += "0000000000000000000000000000000000000";
+
+new TestCase( SECTION,
+ "s = " + s +"; -s",
+ -1.7976931348623157e+308,
+ -s );
+
+s =
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+s += "0000000000000000000000000000000000001";
+
+new TestCase( SECTION,
+ "s = " + s +"; -s",
+ -1.7976931348623157e+308,
+ -s );
+
+
+s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+s += "0000000000000000000000000000000000000"
+
+
+new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -Infinity,
+ -s );
+
+s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+s += "0000000000000000000000000000000000001";
+
+new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -1.7976931348623157e+308,
+ -s );
+
+s += "0"
+
+new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -Infinity,
+ -s );
+
+new TestCase( SECTION,
+ 'parseInt(s)',
+ Infinity,
+ parseInt(s) );
+
+new TestCase( SECTION,
+ 'parseInt(s,32)',
+ 0,
+ parseInt(s,32) );
+
+new TestCase( SECTION,
+ 'parseInt(s,36)',
+ Infinity,
+ parseInt(s,36));
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js
new file mode 100644
index 0000000000..a89154e597
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js
@@ -0,0 +1,410 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.3-1.js';
+
+/**
+ File Name: 15.1.2.3.js
+ ECMA Section: 15.1.2.3 Function properties of the global object:
+ parseFloat( string )
+
+ Description: The parseFloat function produces a number value dictated
+ by the interpretation of the contents of the string
+ argument defined as a decimal literal.
+
+ When the parseFloat function is called, the following
+ steps are taken:
+
+ 1. Call ToString( string ).
+ 2. Remove leading whitespace Result(1).
+ 3. If neither Result(2) nor any prefix of Result(2)
+ satisfies the syntax of a StrDecimalLiteral,
+ return NaN.
+ 4. Compute the longest prefix of Result(2) which might
+ be Resusult(2) itself, that satisfies the syntax of
+ a StrDecimalLiteral
+ 5. Return the number value for the MV of Result(4).
+
+ Note that parseFloate may interpret only a leading
+ portion of the string as a number value; it ignores any
+ characters that cannot be interpreted as part of the
+ notation of a decimal literal, and no indication is given
+ that such characters were ignored.
+
+ StrDecimalLiteral::
+ Infinity
+ DecimalDigits.DecimalDigits opt ExponentPart opt
+ .DecimalDigits ExponentPart opt
+ DecimalDigits ExponentPart opt
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.1.2.3-1";
+var VERSION = "ECMA_1";
+var TITLE = "parseFloat(string)";
+var BUGNUMBER="none";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "parseFloat.length", 1, parseFloat.length );
+
+new TestCase( SECTION, "parseFloat.length = null; parseFloat.length", 1, eval("parseFloat.length = null; parseFloat.length") );
+new TestCase( SECTION, "delete parseFloat.length", false, delete parseFloat.length );
+new TestCase( SECTION, "delete parseFloat.length; parseFloat.length", 1, eval("delete parseFloat.length; parseFloat.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "prototype", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") );
+
+new TestCase( SECTION, "parseFloat()", Number.NaN, parseFloat() );
+new TestCase( SECTION, "parseFloat('')", Number.NaN, parseFloat('') );
+
+new TestCase( SECTION, "parseFloat(' ')", Number.NaN, parseFloat(' ') );
+new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
+new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
+new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
+
+new TestCase( SECTION, "parseFloat(' Infinity')", Infinity, parseFloat("Infinity") );
+new TestCase( SECTION, "parseFloat(' Infinity ')", Infinity, parseFloat(' Infinity ') );
+
+new TestCase( SECTION, "parseFloat('Infinity')", Infinity, parseFloat("Infinity") );
+new TestCase( SECTION, "parseFloat(Infinity)", Infinity, parseFloat(Infinity) );
+
+
+new TestCase( SECTION, "parseFloat(' +Infinity')", +Infinity, parseFloat("+Infinity") );
+new TestCase( SECTION, "parseFloat(' -Infinity ')", -Infinity, parseFloat(' -Infinity ') );
+
+new TestCase( SECTION, "parseFloat('+Infinity')", +Infinity, parseFloat("+Infinity") );
+new TestCase( SECTION, "parseFloat(-Infinity)", -Infinity, parseFloat(-Infinity) );
+
+new TestCase( SECTION, "parseFloat('0')", 0, parseFloat("0") );
+new TestCase( SECTION, "parseFloat('-0')", -0, parseFloat("-0") );
+new TestCase( SECTION, "parseFloat('+0')", 0, parseFloat("+0") );
+
+new TestCase( SECTION, "parseFloat('1')", 1, parseFloat("1") );
+new TestCase( SECTION, "parseFloat('-1')", -1, parseFloat("-1") );
+new TestCase( SECTION, "parseFloat('+1')", 1, parseFloat("+1") );
+
+new TestCase( SECTION, "parseFloat('2')", 2, parseFloat("2") );
+new TestCase( SECTION, "parseFloat('-2')", -2, parseFloat("-2") );
+new TestCase( SECTION, "parseFloat('+2')", 2, parseFloat("+2") );
+
+new TestCase( SECTION, "parseFloat('3')", 3, parseFloat("3") );
+new TestCase( SECTION, "parseFloat('-3')", -3, parseFloat("-3") );
+new TestCase( SECTION, "parseFloat('+3')", 3, parseFloat("+3") );
+
+new TestCase( SECTION, "parseFloat('4')", 4, parseFloat("4") );
+new TestCase( SECTION, "parseFloat('-4')", -4, parseFloat("-4") );
+new TestCase( SECTION, "parseFloat('+4')", 4, parseFloat("+4") );
+
+new TestCase( SECTION, "parseFloat('5')", 5, parseFloat("5") );
+new TestCase( SECTION, "parseFloat('-5')", -5, parseFloat("-5") );
+new TestCase( SECTION, "parseFloat('+5')", 5, parseFloat("+5") );
+
+new TestCase( SECTION, "parseFloat('6')", 6, parseFloat("6") );
+new TestCase( SECTION, "parseFloat('-6')", -6, parseFloat("-6") );
+new TestCase( SECTION, "parseFloat('+6')", 6, parseFloat("+6") );
+
+new TestCase( SECTION, "parseFloat('7')", 7, parseFloat("7") );
+new TestCase( SECTION, "parseFloat('-7')", -7, parseFloat("-7") );
+new TestCase( SECTION, "parseFloat('+7')", 7, parseFloat("+7") );
+
+new TestCase( SECTION, "parseFloat('8')", 8, parseFloat("8") );
+new TestCase( SECTION, "parseFloat('-8')", -8, parseFloat("-8") );
+new TestCase( SECTION, "parseFloat('+8')", 8, parseFloat("+8") );
+
+new TestCase( SECTION, "parseFloat('9')", 9, parseFloat("9") );
+new TestCase( SECTION, "parseFloat('-9')", -9, parseFloat("-9") );
+new TestCase( SECTION, "parseFloat('+9')", 9, parseFloat("+9") );
+
+new TestCase( SECTION, "parseFloat('3.14159')", 3.14159, parseFloat("3.14159") );
+new TestCase( SECTION, "parseFloat('-3.14159')", -3.14159, parseFloat("-3.14159") );
+new TestCase( SECTION, "parseFloat('+3.14159')", 3.14159, parseFloat("+3.14159") );
+
+new TestCase( SECTION, "parseFloat('3.')", 3, parseFloat("3.") );
+new TestCase( SECTION, "parseFloat('-3.')", -3, parseFloat("-3.") );
+new TestCase( SECTION, "parseFloat('+3.')", 3, parseFloat("+3.") );
+
+new TestCase( SECTION, "parseFloat('3.e1')", 30, parseFloat("3.e1") );
+new TestCase( SECTION, "parseFloat('-3.e1')", -30, parseFloat("-3.e1") );
+new TestCase( SECTION, "parseFloat('+3.e1')", 30, parseFloat("+3.e1") );
+
+new TestCase( SECTION, "parseFloat('3.e+1')", 30, parseFloat("3.e+1") );
+new TestCase( SECTION, "parseFloat('-3.e+1')", -30, parseFloat("-3.e+1") );
+new TestCase( SECTION, "parseFloat('+3.e+1')", 30, parseFloat("+3.e+1") );
+
+new TestCase( SECTION, "parseFloat('3.e-1')", .30, parseFloat("3.e-1") );
+new TestCase( SECTION, "parseFloat('-3.e-1')", -.30, parseFloat("-3.e-1") );
+new TestCase( SECTION, "parseFloat('+3.e-1')", .30, parseFloat("+3.e-1") );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat('.00001')", 0.00001, parseFloat(".00001") );
+new TestCase( SECTION, "parseFloat('+.00001')", 0.00001, parseFloat("+.00001") );
+new TestCase( SECTION, "parseFloat('-0.0001')", -0.00001, parseFloat("-.00001") );
+
+new TestCase( SECTION, "parseFloat('.01e2')", 1, parseFloat(".01e2") );
+new TestCase( SECTION, "parseFloat('+.01e2')", 1, parseFloat("+.01e2") );
+new TestCase( SECTION, "parseFloat('-.01e2')", -1, parseFloat("-.01e2") );
+
+new TestCase( SECTION, "parseFloat('.01e+2')", 1, parseFloat(".01e+2") );
+new TestCase( SECTION, "parseFloat('+.01e+2')", 1, parseFloat("+.01e+2") );
+new TestCase( SECTION, "parseFloat('-.01e+2')", -1, parseFloat("-.01e+2") );
+
+new TestCase( SECTION, "parseFloat('.01e-2')", 0.0001, parseFloat(".01e-2") );
+new TestCase( SECTION, "parseFloat('+.01e-2')", 0.0001, parseFloat("+.01e-2") );
+new TestCase( SECTION, "parseFloat('-.01e-2')", -0.0001, parseFloat("-.01e-2") );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat('1234e5')", 123400000, parseFloat("1234e5") );
+new TestCase( SECTION, "parseFloat('+1234e5')", 123400000, parseFloat("+1234e5") );
+new TestCase( SECTION, "parseFloat('-1234e5')", -123400000, parseFloat("-1234e5") );
+
+new TestCase( SECTION, "parseFloat('1234e+5')", 123400000, parseFloat("1234e+5") );
+new TestCase( SECTION, "parseFloat('+1234e+5')", 123400000, parseFloat("+1234e+5") );
+new TestCase( SECTION, "parseFloat('-1234e+5')", -123400000, parseFloat("-1234e+5") );
+
+new TestCase( SECTION, "parseFloat('1234e-5')", 0.01234, parseFloat("1234e-5") );
+new TestCase( SECTION, "parseFloat('+1234e-5')", 0.01234, parseFloat("+1234e-5") );
+new TestCase( SECTION, "parseFloat('-1234e-5')", -0.01234, parseFloat("-1234e-5") );
+
+
+new TestCase( SECTION, "parseFloat(0)", 0, parseFloat(0) );
+new TestCase( SECTION, "parseFloat(-0)", -0, parseFloat(-0) );
+
+new TestCase( SECTION, "parseFloat(1)", 1, parseFloat(1) );
+new TestCase( SECTION, "parseFloat(-1)", -1, parseFloat(-1) );
+
+new TestCase( SECTION, "parseFloat(2)", 2, parseFloat(2) );
+new TestCase( SECTION, "parseFloat(-2)", -2, parseFloat(-2) );
+
+new TestCase( SECTION, "parseFloat(3)", 3, parseFloat(3) );
+new TestCase( SECTION, "parseFloat(-3)", -3, parseFloat(-3) );
+
+new TestCase( SECTION, "parseFloat(4)", 4, parseFloat(4) );
+new TestCase( SECTION, "parseFloat(-4)", -4, parseFloat(-4) );
+
+new TestCase( SECTION, "parseFloat(5)", 5, parseFloat(5) );
+new TestCase( SECTION, "parseFloat(-5)", -5, parseFloat(-5) );
+
+new TestCase( SECTION, "parseFloat(6)", 6, parseFloat(6) );
+new TestCase( SECTION, "parseFloat(-6)", -6, parseFloat(-6) );
+
+new TestCase( SECTION, "parseFloat(7)", 7, parseFloat(7) );
+new TestCase( SECTION, "parseFloat(-7)", -7, parseFloat(-7) );
+
+new TestCase( SECTION, "parseFloat(8)", 8, parseFloat(8) );
+new TestCase( SECTION, "parseFloat(-8)", -8, parseFloat(-8) );
+
+new TestCase( SECTION, "parseFloat(9)", 9, parseFloat(9) );
+new TestCase( SECTION, "parseFloat(-9)", -9, parseFloat(-9) );
+
+new TestCase( SECTION, "parseFloat(3.14159)", 3.14159, parseFloat(3.14159) );
+new TestCase( SECTION, "parseFloat(-3.14159)", -3.14159, parseFloat(-3.14159) );
+
+new TestCase( SECTION, "parseFloat(3.)", 3, parseFloat(3.) );
+new TestCase( SECTION, "parseFloat(-3.)", -3, parseFloat(-3.) );
+
+new TestCase( SECTION, "parseFloat(3.e1)", 30, parseFloat(3.e1) );
+new TestCase( SECTION, "parseFloat(-3.e1)", -30, parseFloat(-3.e1) );
+
+new TestCase( SECTION, "parseFloat(3.e+1)", 30, parseFloat(3.e+1) );
+new TestCase( SECTION, "parseFloat(-3.e+1)", -30, parseFloat(-3.e+1) );
+
+new TestCase( SECTION, "parseFloat(3.e-1)", .30, parseFloat(3.e-1) );
+new TestCase( SECTION, "parseFloat(-3.e-1)", -.30, parseFloat(-3.e-1) );
+
+
+new TestCase( SECTION, "parseFloat(3.E1)", 30, parseFloat(3.E1) );
+new TestCase( SECTION, "parseFloat(-3.E1)", -30, parseFloat(-3.E1) );
+
+new TestCase( SECTION, "parseFloat(3.E+1)", 30, parseFloat(3.E+1) );
+new TestCase( SECTION, "parseFloat(-3.E+1)", -30, parseFloat(-3.E+1) );
+
+new TestCase( SECTION, "parseFloat(3.E-1)", .30, parseFloat(3.E-1) );
+new TestCase( SECTION, "parseFloat(-3.E-1)", -.30, parseFloat(-3.E-1) );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat(.00001)", 0.00001, parseFloat(.00001) );
+new TestCase( SECTION, "parseFloat(-0.0001)", -0.00001, parseFloat(-.00001) );
+
+new TestCase( SECTION, "parseFloat(.01e2)", 1, parseFloat(.01e2) );
+new TestCase( SECTION, "parseFloat(-.01e2)", -1, parseFloat(-.01e2) );
+
+new TestCase( SECTION, "parseFloat(.01e+2)", 1, parseFloat(.01e+2) );
+new TestCase( SECTION, "parseFloat(-.01e+2)", -1, parseFloat(-.01e+2) );
+
+new TestCase( SECTION, "parseFloat(.01e-2)", 0.0001, parseFloat(.01e-2) );
+new TestCase( SECTION, "parseFloat(-.01e-2)", -0.0001, parseFloat(-.01e-2) );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat(1234e5)", 123400000, parseFloat(1234e5) );
+new TestCase( SECTION, "parseFloat(-1234e5)", -123400000, parseFloat(-1234e5) );
+
+new TestCase( SECTION, "parseFloat(1234e+5)", 123400000, parseFloat(1234e+5) );
+new TestCase( SECTION, "parseFloat(-1234e+5)", -123400000, parseFloat(-1234e+5) );
+
+new TestCase( SECTION, "parseFloat(1234e-5)", 0.01234, parseFloat(1234e-5) );
+new TestCase( SECTION, "parseFloat(-1234e-5)", -0.01234, parseFloat(-1234e-5) );
+
+// hex cases should all return 0 (0 is the longest string that satisfies a StringDecimalLiteral)
+
+new TestCase( SECTION, "parseFloat('0x0')", 0, parseFloat("0x0"));
+new TestCase( SECTION, "parseFloat('0x1')", 0, parseFloat("0x1"));
+new TestCase( SECTION, "parseFloat('0x2')", 0, parseFloat("0x2"));
+new TestCase( SECTION, "parseFloat('0x3')", 0, parseFloat("0x3"));
+new TestCase( SECTION, "parseFloat('0x4')", 0, parseFloat("0x4"));
+new TestCase( SECTION, "parseFloat('0x5')", 0, parseFloat("0x5"));
+new TestCase( SECTION, "parseFloat('0x6')", 0, parseFloat("0x6"));
+new TestCase( SECTION, "parseFloat('0x7')", 0, parseFloat("0x7"));
+new TestCase( SECTION, "parseFloat('0x8')", 0, parseFloat("0x8"));
+new TestCase( SECTION, "parseFloat('0x9')", 0, parseFloat("0x9"));
+new TestCase( SECTION, "parseFloat('0xa')", 0, parseFloat("0xa"));
+new TestCase( SECTION, "parseFloat('0xb')", 0, parseFloat("0xb"));
+new TestCase( SECTION, "parseFloat('0xc')", 0, parseFloat("0xc"));
+new TestCase( SECTION, "parseFloat('0xd')", 0, parseFloat("0xd"));
+new TestCase( SECTION, "parseFloat('0xe')", 0, parseFloat("0xe"));
+new TestCase( SECTION, "parseFloat('0xf')", 0, parseFloat("0xf"));
+new TestCase( SECTION, "parseFloat('0xA')", 0, parseFloat("0xA"));
+new TestCase( SECTION, "parseFloat('0xB')", 0, parseFloat("0xB"));
+new TestCase( SECTION, "parseFloat('0xC')", 0, parseFloat("0xC"));
+new TestCase( SECTION, "parseFloat('0xD')", 0, parseFloat("0xD"));
+new TestCase( SECTION, "parseFloat('0xE')", 0, parseFloat("0xE"));
+new TestCase( SECTION, "parseFloat('0xF')", 0, parseFloat("0xF"));
+
+new TestCase( SECTION, "parseFloat('0X0')", 0, parseFloat("0X0"));
+new TestCase( SECTION, "parseFloat('0X1')", 0, parseFloat("0X1"));
+new TestCase( SECTION, "parseFloat('0X2')", 0, parseFloat("0X2"));
+new TestCase( SECTION, "parseFloat('0X3')", 0, parseFloat("0X3"));
+new TestCase( SECTION, "parseFloat('0X4')", 0, parseFloat("0X4"));
+new TestCase( SECTION, "parseFloat('0X5')", 0, parseFloat("0X5"));
+new TestCase( SECTION, "parseFloat('0X6')", 0, parseFloat("0X6"));
+new TestCase( SECTION, "parseFloat('0X7')", 0, parseFloat("0X7"));
+new TestCase( SECTION, "parseFloat('0X8')", 0, parseFloat("0X8"));
+new TestCase( SECTION, "parseFloat('0X9')", 0, parseFloat("0X9"));
+new TestCase( SECTION, "parseFloat('0Xa')", 0, parseFloat("0Xa"));
+new TestCase( SECTION, "parseFloat('0Xb')", 0, parseFloat("0Xb"));
+new TestCase( SECTION, "parseFloat('0Xc')", 0, parseFloat("0Xc"));
+new TestCase( SECTION, "parseFloat('0Xd')", 0, parseFloat("0Xd"));
+new TestCase( SECTION, "parseFloat('0Xe')", 0, parseFloat("0Xe"));
+new TestCase( SECTION, "parseFloat('0Xf')", 0, parseFloat("0Xf"));
+new TestCase( SECTION, "parseFloat('0XA')", 0, parseFloat("0XA"));
+new TestCase( SECTION, "parseFloat('0XB')", 0, parseFloat("0XB"));
+new TestCase( SECTION, "parseFloat('0XC')", 0, parseFloat("0XC"));
+new TestCase( SECTION, "parseFloat('0XD')", 0, parseFloat("0XD"));
+new TestCase( SECTION, "parseFloat('0XE')", 0, parseFloat("0XE"));
+new TestCase( SECTION, "parseFloat('0XF')", 0, parseFloat("0XF"));
+new TestCase( SECTION, "parseFloat(' 0XF ')", 0, parseFloat(" 0XF "));
+
+// hex literals should still succeed
+
+new TestCase( SECTION, "parseFloat(0x0)", 0, parseFloat(0x0));
+new TestCase( SECTION, "parseFloat(0x1)", 1, parseFloat(0x1));
+new TestCase( SECTION, "parseFloat(0x2)", 2, parseFloat(0x2));
+new TestCase( SECTION, "parseFloat(0x3)", 3, parseFloat(0x3));
+new TestCase( SECTION, "parseFloat(0x4)", 4, parseFloat(0x4));
+new TestCase( SECTION, "parseFloat(0x5)", 5, parseFloat(0x5));
+new TestCase( SECTION, "parseFloat(0x6)", 6, parseFloat(0x6));
+new TestCase( SECTION, "parseFloat(0x7)", 7, parseFloat(0x7));
+new TestCase( SECTION, "parseFloat(0x8)", 8, parseFloat(0x8));
+new TestCase( SECTION, "parseFloat(0x9)", 9, parseFloat(0x9));
+new TestCase( SECTION, "parseFloat(0xa)", 10, parseFloat(0xa));
+new TestCase( SECTION, "parseFloat(0xb)", 11, parseFloat(0xb));
+new TestCase( SECTION, "parseFloat(0xc)", 12, parseFloat(0xc));
+new TestCase( SECTION, "parseFloat(0xd)", 13, parseFloat(0xd));
+new TestCase( SECTION, "parseFloat(0xe)", 14, parseFloat(0xe));
+new TestCase( SECTION, "parseFloat(0xf)", 15, parseFloat(0xf));
+new TestCase( SECTION, "parseFloat(0xA)", 10, parseFloat(0xA));
+new TestCase( SECTION, "parseFloat(0xB)", 11, parseFloat(0xB));
+new TestCase( SECTION, "parseFloat(0xC)", 12, parseFloat(0xC));
+new TestCase( SECTION, "parseFloat(0xD)", 13, parseFloat(0xD));
+new TestCase( SECTION, "parseFloat(0xE)", 14, parseFloat(0xE));
+new TestCase( SECTION, "parseFloat(0xF)", 15, parseFloat(0xF));
+
+new TestCase( SECTION, "parseFloat(0X0)", 0, parseFloat(0X0));
+new TestCase( SECTION, "parseFloat(0X1)", 1, parseFloat(0X1));
+new TestCase( SECTION, "parseFloat(0X2)", 2, parseFloat(0X2));
+new TestCase( SECTION, "parseFloat(0X3)", 3, parseFloat(0X3));
+new TestCase( SECTION, "parseFloat(0X4)", 4, parseFloat(0X4));
+new TestCase( SECTION, "parseFloat(0X5)", 5, parseFloat(0X5));
+new TestCase( SECTION, "parseFloat(0X6)", 6, parseFloat(0X6));
+new TestCase( SECTION, "parseFloat(0X7)", 7, parseFloat(0X7));
+new TestCase( SECTION, "parseFloat(0X8)", 8, parseFloat(0X8));
+new TestCase( SECTION, "parseFloat(0X9)", 9, parseFloat(0X9));
+new TestCase( SECTION, "parseFloat(0Xa)", 10, parseFloat(0Xa));
+new TestCase( SECTION, "parseFloat(0Xb)", 11, parseFloat(0Xb));
+new TestCase( SECTION, "parseFloat(0Xc)", 12, parseFloat(0Xc));
+new TestCase( SECTION, "parseFloat(0Xd)", 13, parseFloat(0Xd));
+new TestCase( SECTION, "parseFloat(0Xe)", 14, parseFloat(0Xe));
+new TestCase( SECTION, "parseFloat(0Xf)", 15, parseFloat(0Xf));
+new TestCase( SECTION, "parseFloat(0XA)", 10, parseFloat(0XA));
+new TestCase( SECTION, "parseFloat(0XB)", 11, parseFloat(0XB));
+new TestCase( SECTION, "parseFloat(0XC)", 12, parseFloat(0XC));
+new TestCase( SECTION, "parseFloat(0XD)", 13, parseFloat(0XD));
+new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE));
+new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF));
+
+
+// A StringNumericLIteral may have any number of leading 0 digits
+
+new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001"));
+new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001"));
+new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 "));
+
+// make sure it's reflexive
+new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI));
+new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2));
+new TestCase( SECTION, "parseFloat(Math.LN10)", Math.LN10, parseFloat(Math.LN10));
+new TestCase( SECTION, "parseFloat(Math.LOG2E)", Math.LOG2E, parseFloat(Math.LOG2E));
+new TestCase( SECTION, "parseFloat(Math.LOG10E)", Math.LOG10E, parseFloat(Math.LOG10E));
+new TestCase( SECTION, "parseFloat(Math.SQRT2)", Math.SQRT2, parseFloat(Math.SQRT2));
+new TestCase( SECTION, "parseFloat(Math.SQRT1_2)", Math.SQRT1_2, parseFloat(Math.SQRT1_2));
+
+new TestCase( SECTION, "parseFloat(Math.PI+'')", Math.PI, parseFloat(Math.PI+''));
+new TestCase( SECTION, "parseFloat(Math.LN2+'')", Math.LN2, parseFloat(Math.LN2+''));
+new TestCase( SECTION, "parseFloat(Math.LN10+'')", Math.LN10, parseFloat(Math.LN10+''));
+new TestCase( SECTION, "parseFloat(Math.LOG2E+'')", Math.LOG2E, parseFloat(Math.LOG2E+''));
+new TestCase( SECTION, "parseFloat(Math.LOG10E+'')", Math.LOG10E, parseFloat(Math.LOG10E+''));
+new TestCase( SECTION, "parseFloat(Math.SQRT2+'')", Math.SQRT2, parseFloat(Math.SQRT2+''));
+new TestCase( SECTION, "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2, parseFloat(Math.SQRT1_2+''));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js
new file mode 100644
index 0000000000..1167b73ee1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js
@@ -0,0 +1,269 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.3-2.js';
+
+/**
+ File Name: 15.1.2.3-2.js
+ ECMA Section: 15.1.2.3 Function properties of the global object:
+ parseFloat( string )
+
+ Description: The parseFloat function produces a number value dictated
+ by the interpretation of the contents of the string
+ argument defined as a decimal literal.
+
+ When the parseFloat function is called, the following
+ steps are taken:
+
+ 1. Call ToString( string ).
+ 2. Remove leading whitespace Result(1).
+ 3. If neither Result(2) nor any prefix of Result(2)
+ satisfies the syntax of a StrDecimalLiteral,
+ return NaN.
+ 4. Compute the longest prefix of Result(2) which might
+ be Resusult(2) itself, that satisfies the syntax of
+ a StrDecimalLiteral
+ 5. Return the number value for the MV of Result(4).
+
+ Note that parseFloate may interpret only a leading
+ portion of the string as a number value; it ignores any
+ characters that cannot be interpreted as part of the
+ notation of a decimal literal, and no indication is given
+ that such characters were ignored.
+
+ StrDecimalLiteral::
+ Infinity
+ DecimalDigits.DecimalDigits opt ExponentPart opt
+ .DecimalDigits ExponentPart opt
+ DecimalDigits ExponentPart opt
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.2.3-2";
+var VERSION = "ECMA_1";
+startTest();
+
+var BUGNUMBER="none";
+
+new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
+new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
+new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
+
+new TestCase( SECTION, "parseFloat(' Infinity')", Number.POSITIVE_INFINITY, parseFloat("Infinity") );
+// new TestCase( SECTION, "parseFloat(Infinity)", Number.POSITIVE_INFINITY, parseFloat(Infinity) );
+
+new TestCase( SECTION, "parseFloat(' 0')", 0, parseFloat(" 0") );
+new TestCase( SECTION, "parseFloat(' -0')", -0, parseFloat(" -0") );
+new TestCase( SECTION, "parseFloat(' +0')", 0, parseFloat(" +0") );
+
+new TestCase( SECTION, "parseFloat(' 1')", 1, parseFloat(" 1") );
+new TestCase( SECTION, "parseFloat(' -1')", -1, parseFloat(" -1") );
+new TestCase( SECTION, "parseFloat(' +1')", 1, parseFloat(" +1") );
+
+new TestCase( SECTION, "parseFloat(' 2')", 2, parseFloat(" 2") );
+new TestCase( SECTION, "parseFloat(' -2')", -2, parseFloat(" -2") );
+new TestCase( SECTION, "parseFloat(' +2')", 2, parseFloat(" +2") );
+
+new TestCase( SECTION, "parseFloat(' 3')", 3, parseFloat(" 3") );
+new TestCase( SECTION, "parseFloat(' -3')", -3, parseFloat(" -3") );
+new TestCase( SECTION, "parseFloat(' +3')", 3, parseFloat(" +3") );
+
+new TestCase( SECTION, "parseFloat(' 4')", 4, parseFloat(" 4") );
+new TestCase( SECTION, "parseFloat(' -4')", -4, parseFloat(" -4") );
+new TestCase( SECTION, "parseFloat(' +4')", 4, parseFloat(" +4") );
+
+new TestCase( SECTION, "parseFloat(' 5')", 5, parseFloat(" 5") );
+new TestCase( SECTION, "parseFloat(' -5')", -5, parseFloat(" -5") );
+new TestCase( SECTION, "parseFloat(' +5')", 5, parseFloat(" +5") );
+
+new TestCase( SECTION, "parseFloat(' 6')", 6, parseFloat(" 6") );
+new TestCase( SECTION, "parseFloat(' -6')", -6, parseFloat(" -6") );
+new TestCase( SECTION, "parseFloat(' +6')", 6, parseFloat(" +6") );
+
+new TestCase( SECTION, "parseFloat(' 7')", 7, parseFloat(" 7") );
+new TestCase( SECTION, "parseFloat(' -7')", -7, parseFloat(" -7") );
+new TestCase( SECTION, "parseFloat(' +7')", 7, parseFloat(" +7") );
+
+new TestCase( SECTION, "parseFloat(' 8')", 8, parseFloat(" 8") );
+new TestCase( SECTION, "parseFloat(' -8')", -8, parseFloat(" -8") );
+new TestCase( SECTION, "parseFloat(' +8')", 8, parseFloat(" +8") );
+
+new TestCase( SECTION, "parseFloat(' 9')", 9, parseFloat(" 9") );
+new TestCase( SECTION, "parseFloat(' -9')", -9, parseFloat(" -9") );
+new TestCase( SECTION, "parseFloat(' +9')", 9, parseFloat(" +9") );
+
+new TestCase( SECTION, "parseFloat(' 3.14159')", 3.14159, parseFloat(" 3.14159") );
+new TestCase( SECTION, "parseFloat(' -3.14159')", -3.14159, parseFloat(" -3.14159") );
+new TestCase( SECTION, "parseFloat(' +3.14159')", 3.14159, parseFloat(" +3.14159") );
+
+new TestCase( SECTION, "parseFloat(' 3.')", 3, parseFloat(" 3.") );
+new TestCase( SECTION, "parseFloat(' -3.')", -3, parseFloat(" -3.") );
+new TestCase( SECTION, "parseFloat(' +3.')", 3, parseFloat(" +3.") );
+
+new TestCase( SECTION, "parseFloat(' 3.e1')", 30, parseFloat(" 3.e1") );
+new TestCase( SECTION, "parseFloat(' -3.e1')", -30, parseFloat(" -3.e1") );
+new TestCase( SECTION, "parseFloat(' +3.e1')", 30, parseFloat(" +3.e1") );
+
+new TestCase( SECTION, "parseFloat(' 3.e+1')", 30, parseFloat(" 3.e+1") );
+new TestCase( SECTION, "parseFloat(' -3.e+1')", -30, parseFloat(" -3.e+1") );
+new TestCase( SECTION, "parseFloat(' +3.e+1')", 30, parseFloat(" +3.e+1") );
+
+new TestCase( SECTION, "parseFloat(' 3.e-1')", .30, parseFloat(" 3.e-1") );
+new TestCase( SECTION, "parseFloat(' -3.e-1')", -.30, parseFloat(" -3.e-1") );
+new TestCase( SECTION, "parseFloat(' +3.e-1')", .30, parseFloat(" +3.e-1") );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat(' .00001')", 0.00001, parseFloat(" .00001") );
+new TestCase( SECTION, "parseFloat(' +.00001')", 0.00001, parseFloat(" +.00001") );
+new TestCase( SECTION, "parseFloat(' -0.0001')", -0.00001, parseFloat(" -.00001") );
+
+new TestCase( SECTION, "parseFloat(' .01e2')", 1, parseFloat(" .01e2") );
+new TestCase( SECTION, "parseFloat(' +.01e2')", 1, parseFloat(" +.01e2") );
+new TestCase( SECTION, "parseFloat(' -.01e2')", -1, parseFloat(" -.01e2") );
+
+new TestCase( SECTION, "parseFloat(' .01e+2')", 1, parseFloat(" .01e+2") );
+new TestCase( SECTION, "parseFloat(' +.01e+2')", 1, parseFloat(" +.01e+2") );
+new TestCase( SECTION, "parseFloat(' -.01e+2')", -1, parseFloat(" -.01e+2") );
+
+new TestCase( SECTION, "parseFloat(' .01e-2')", 0.0001, parseFloat(" .01e-2") );
+new TestCase( SECTION, "parseFloat(' +.01e-2')", 0.0001, parseFloat(" +.01e-2") );
+new TestCase( SECTION, "parseFloat(' -.01e-2')", -0.0001, parseFloat(" -.01e-2") );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat(' 1234e5')", 123400000, parseFloat(" 1234e5") );
+new TestCase( SECTION, "parseFloat(' +1234e5')", 123400000, parseFloat(" +1234e5") );
+new TestCase( SECTION, "parseFloat(' -1234e5')", -123400000, parseFloat(" -1234e5") );
+
+new TestCase( SECTION, "parseFloat(' 1234e+5')", 123400000, parseFloat(" 1234e+5") );
+new TestCase( SECTION, "parseFloat(' +1234e+5')", 123400000, parseFloat(" +1234e+5") );
+new TestCase( SECTION, "parseFloat(' -1234e+5')", -123400000, parseFloat(" -1234e+5") );
+
+new TestCase( SECTION, "parseFloat(' 1234e-5')", 0.01234, parseFloat(" 1234e-5") );
+new TestCase( SECTION, "parseFloat(' +1234e-5')", 0.01234, parseFloat(" +1234e-5") );
+new TestCase( SECTION, "parseFloat(' -1234e-5')", -0.01234, parseFloat(" -1234e-5") );
+
+
+new TestCase( SECTION, "parseFloat(' .01E2')", 1, parseFloat(" .01E2") );
+new TestCase( SECTION, "parseFloat(' +.01E2')", 1, parseFloat(" +.01E2") );
+new TestCase( SECTION, "parseFloat(' -.01E2')", -1, parseFloat(" -.01E2") );
+
+new TestCase( SECTION, "parseFloat(' .01E+2')", 1, parseFloat(" .01E+2") );
+new TestCase( SECTION, "parseFloat(' +.01E+2')", 1, parseFloat(" +.01E+2") );
+new TestCase( SECTION, "parseFloat(' -.01E+2')", -1, parseFloat(" -.01E+2") );
+
+new TestCase( SECTION, "parseFloat(' .01E-2')", 0.0001, parseFloat(" .01E-2") );
+new TestCase( SECTION, "parseFloat(' +.01E-2')", 0.0001, parseFloat(" +.01E-2") );
+new TestCase( SECTION, "parseFloat(' -.01E-2')", -0.0001, parseFloat(" -.01E-2") );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+new TestCase( SECTION, "parseFloat(' 1234E5')", 123400000, parseFloat(" 1234E5") );
+new TestCase( SECTION, "parseFloat(' +1234E5')", 123400000, parseFloat(" +1234E5") );
+new TestCase( SECTION, "parseFloat(' -1234E5')", -123400000, parseFloat(" -1234E5") );
+
+new TestCase( SECTION, "parseFloat(' 1234E+5')", 123400000, parseFloat(" 1234E+5") );
+new TestCase( SECTION, "parseFloat(' +1234E+5')", 123400000, parseFloat(" +1234E+5") );
+new TestCase( SECTION, "parseFloat(' -1234E+5')", -123400000, parseFloat(" -1234E+5") );
+
+new TestCase( SECTION, "parseFloat(' 1234E-5')", 0.01234, parseFloat(" 1234E-5") );
+new TestCase( SECTION, "parseFloat(' +1234E-5')", 0.01234, parseFloat(" +1234E-5") );
+new TestCase( SECTION, "parseFloat(' -1234E-5')", -0.01234, parseFloat(" -1234E-5") );
+
+
+// hex cases should all return NaN
+
+new TestCase( SECTION, "parseFloat(' 0x0')", 0, parseFloat(" 0x0"));
+new TestCase( SECTION, "parseFloat(' 0x1')", 0, parseFloat(" 0x1"));
+new TestCase( SECTION, "parseFloat(' 0x2')", 0, parseFloat(" 0x2"));
+new TestCase( SECTION, "parseFloat(' 0x3')", 0, parseFloat(" 0x3"));
+new TestCase( SECTION, "parseFloat(' 0x4')", 0, parseFloat(" 0x4"));
+new TestCase( SECTION, "parseFloat(' 0x5')", 0, parseFloat(" 0x5"));
+new TestCase( SECTION, "parseFloat(' 0x6')", 0, parseFloat(" 0x6"));
+new TestCase( SECTION, "parseFloat(' 0x7')", 0, parseFloat(" 0x7"));
+new TestCase( SECTION, "parseFloat(' 0x8')", 0, parseFloat(" 0x8"));
+new TestCase( SECTION, "parseFloat(' 0x9')", 0, parseFloat(" 0x9"));
+new TestCase( SECTION, "parseFloat(' 0xa')", 0, parseFloat(" 0xa"));
+new TestCase( SECTION, "parseFloat(' 0xb')", 0, parseFloat(" 0xb"));
+new TestCase( SECTION, "parseFloat(' 0xc')", 0, parseFloat(" 0xc"));
+new TestCase( SECTION, "parseFloat(' 0xd')", 0, parseFloat(" 0xd"));
+new TestCase( SECTION, "parseFloat(' 0xe')", 0, parseFloat(" 0xe"));
+new TestCase( SECTION, "parseFloat(' 0xf')", 0, parseFloat(" 0xf"));
+new TestCase( SECTION, "parseFloat(' 0xA')", 0, parseFloat(" 0xA"));
+new TestCase( SECTION, "parseFloat(' 0xB')", 0, parseFloat(" 0xB"));
+new TestCase( SECTION, "parseFloat(' 0xC')", 0, parseFloat(" 0xC"));
+new TestCase( SECTION, "parseFloat(' 0xD')", 0, parseFloat(" 0xD"));
+new TestCase( SECTION, "parseFloat(' 0xE')", 0, parseFloat(" 0xE"));
+new TestCase( SECTION, "parseFloat(' 0xF')", 0, parseFloat(" 0xF"));
+
+new TestCase( SECTION, "parseFloat(' 0X0')", 0, parseFloat(" 0X0"));
+new TestCase( SECTION, "parseFloat(' 0X1')", 0, parseFloat(" 0X1"));
+new TestCase( SECTION, "parseFloat(' 0X2')", 0, parseFloat(" 0X2"));
+new TestCase( SECTION, "parseFloat(' 0X3')", 0, parseFloat(" 0X3"));
+new TestCase( SECTION, "parseFloat(' 0X4')", 0, parseFloat(" 0X4"));
+new TestCase( SECTION, "parseFloat(' 0X5')", 0, parseFloat(" 0X5"));
+new TestCase( SECTION, "parseFloat(' 0X6')", 0, parseFloat(" 0X6"));
+new TestCase( SECTION, "parseFloat(' 0X7')", 0, parseFloat(" 0X7"));
+new TestCase( SECTION, "parseFloat(' 0X8')", 0, parseFloat(" 0X8"));
+new TestCase( SECTION, "parseFloat(' 0X9')", 0, parseFloat(" 0X9"));
+new TestCase( SECTION, "parseFloat(' 0Xa')", 0, parseFloat(" 0Xa"));
+new TestCase( SECTION, "parseFloat(' 0Xb')", 0, parseFloat(" 0Xb"));
+new TestCase( SECTION, "parseFloat(' 0Xc')", 0, parseFloat(" 0Xc"));
+new TestCase( SECTION, "parseFloat(' 0Xd')", 0, parseFloat(" 0Xd"));
+new TestCase( SECTION, "parseFloat(' 0Xe')", 0, parseFloat(" 0Xe"));
+new TestCase( SECTION, "parseFloat(' 0Xf')", 0, parseFloat(" 0Xf"));
+new TestCase( SECTION, "parseFloat(' 0XA')", 0, parseFloat(" 0XA"));
+new TestCase( SECTION, "parseFloat(' 0XB')", 0, parseFloat(" 0XB"));
+new TestCase( SECTION, "parseFloat(' 0XC')", 0, parseFloat(" 0XC"));
+new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFloat(" 0XD"));
+new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE"));
+new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF"));
+
+
+// make sure it' s reflexive
+new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LN2+' ')", Math.LN2, parseFloat( ' ' +Math.LN2+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LN10+' ')", Math.LN10, parseFloat( ' ' +Math.LN10+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LOG2E+' ')", Math.LOG2E, parseFloat( ' ' +Math.LOG2E+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LOG10E+' ')", Math.LOG10E, parseFloat( ' ' +Math.LOG10E+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT2+' ')", Math.SQRT2, parseFloat( ' ' +Math.SQRT2+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT1_2+' ')", Math.SQRT1_2, parseFloat( ' ' +Math.SQRT1_2+' '));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.4.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.4.js
new file mode 100644
index 0000000000..bd2114a1a9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.4.js
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.4.js';
+
+/**
+ File Name: 15.1.2.4.js
+ ECMA Section: 15.1.2.4 Function properties of the global object
+ escape( string )
+
+ Description:
+ The escape function computes a new version of a string value in which
+ certain characters have been replaced by a hexadecimal escape sequence.
+ The result thus contains no special characters that might have special
+ meaning within a URL.
+
+ For characters whose Unicode encoding is 0xFF or less, a two-digit
+ escape sequence of the form %xx is used in accordance with RFC1738.
+ For characters whose Unicode encoding is greater than 0xFF, a four-
+ digit escape sequence of the form %uxxxx is used.
+
+ When the escape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Get the character at position k within Result(1).
+ 7. If Result(6) is one of the 69 nonblank ASCII characters
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
+ 0123456789 @*_+-./, go to step 14.
+ 8. Compute the 16-bit unsigned integer that is the Unicode character
+ encoding of Result(6).
+ 9. If Result(8), is less than 256, go to step 12.
+ 10. Let S be a string containing six characters "%uwxyz" where wxyz are
+ four hexadecimal digits encoding the value of Result(8).
+ 11. Go to step 15.
+ 12. Let S be a string containing three characters "%xy" where xy are two
+ hexadecimal digits encoding the value of Result(8).
+ 13. Go to step 15.
+ 14. Let S be a string containing the single character Result(6).
+ 15. Let R be a new string value computed by concatenating the previous value
+ of R and S.
+ 16. Increase k by 1.
+ 17. Go to step 5.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.2.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "escape(string)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "escape.length", 1, escape.length );
+new TestCase( SECTION, "escape.length = null; escape.length", 1, eval("escape.length = null; escape.length") );
+new TestCase( SECTION, "delete escape.length", false, delete escape.length );
+new TestCase( SECTION, "delete escape.length; escape.length", 1, eval("delete escape.length; escape.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", "prototype", eval("var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS") );
+
+new TestCase( SECTION, "escape()", "undefined", escape() );
+new TestCase( SECTION, "escape('')", "", escape('') );
+new TestCase( SECTION, "escape( null )", "null", escape(null) );
+new TestCase( SECTION, "escape( void 0 )", "undefined", escape(void 0) );
+new TestCase( SECTION, "escape( true )", "true", escape( true ) );
+new TestCase( SECTION, "escape( false )", "false", escape( false ) );
+
+new TestCase( SECTION, "escape( new Boolean(true) )", "true", escape(new Boolean(true)) );
+new TestCase( SECTION, "escape( new Boolean(false) )", "false", escape(new Boolean(false)) );
+
+new TestCase( SECTION, "escape( Number.NaN )", "NaN", escape(Number.NaN) );
+new TestCase( SECTION, "escape( -0 )", "0", escape( -0 ) );
+new TestCase( SECTION, "escape( 'Infinity' )", "Infinity", escape( "Infinity" ) );
+new TestCase( SECTION, "escape( Number.POSITIVE_INFINITY )", "Infinity", escape( Number.POSITIVE_INFINITY ) );
+new TestCase( SECTION, "escape( Number.NEGATIVE_INFINITY )", "-Infinity", escape( Number.NEGATIVE_INFINITY ) );
+
+var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
+
+new TestCase( SECTION, "escape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, escape( ASCII_TEST_STRING ) );
+
+// ASCII value less than
+
+for ( var CHARCODE = 0; CHARCODE < 32; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%"+ToHexString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+}
+for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%"+ToHexString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+}
+
+for ( var CHARCODE = 256; CHARCODE < 1024; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%u"+ ToUnicodeString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+}
+for ( var CHARCODE = 65500; CHARCODE < 65536; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%u"+ ToUnicodeString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+}
+
+test();
+
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-1.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-1.js
new file mode 100644
index 0000000000..b7b072a627
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-1.js
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.5-1.js';
+
+/**
+ File Name: 15.1.2.5-1.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+
+ Description:
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+var SECTION = "15.1.2.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "unescape(string)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "unescape.length", 1, unescape.length );
+new TestCase( SECTION, "unescape.length = null; unescape.length", 1, eval("unescape.length=null; unescape.length") );
+new TestCase( SECTION, "delete unescape.length", false, delete unescape.length );
+new TestCase( SECTION, "delete unescape.length; unescape.length", 1, eval("delete unescape.length; unescape.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", "prototype", eval("var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS") );
+
+new TestCase( SECTION, "unescape()", "undefined", unescape() );
+new TestCase( SECTION, "unescape('')", "", unescape('') );
+new TestCase( SECTION, "unescape( null )", "null", unescape(null) );
+new TestCase( SECTION, "unescape( void 0 )", "undefined", unescape(void 0) );
+new TestCase( SECTION, "unescape( true )", "true", unescape( true ) );
+new TestCase( SECTION, "unescape( false )", "false", unescape( false ) );
+
+new TestCase( SECTION, "unescape( new Boolean(true) )", "true", unescape(new Boolean(true)) );
+new TestCase( SECTION, "unescape( new Boolean(false) )", "false", unescape(new Boolean(false)) );
+
+new TestCase( SECTION, "unescape( Number.NaN )", "NaN", unescape(Number.NaN) );
+new TestCase( SECTION, "unescape( -0 )", "0", unescape( -0 ) );
+new TestCase( SECTION, "unescape( 'Infinity' )", "Infinity", unescape( "Infinity" ) );
+new TestCase( SECTION, "unescape( Number.POSITIVE_INFINITY )", "Infinity", unescape( Number.POSITIVE_INFINITY ) );
+new TestCase( SECTION, "unescape( Number.NEGATIVE_INFINITY )", "-Infinity", unescape( Number.NEGATIVE_INFINITY ) );
+
+var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
+
+new TestCase( SECTION, "unescape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, unescape( ASCII_TEST_STRING ) );
+
+// escaped chars with ascii values less than 256
+
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "unescape( %"+ ToHexString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%" + ToHexString(CHARCODE) ) );
+}
+
+// unicode chars represented by two hex digits
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ ToHexString(CHARCODE)+" )",
+ "%u"+ToHexString(CHARCODE),
+ unescape( "%u" + ToHexString(CHARCODE) ) );
+}
+/*
+ for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%u" + ToUnicodeString(CHARCODE) ) );
+ }
+ for ( var CHARCODE = 256; CHARCODE < 65536; CHARCODE+= 333 ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%u" + ToUnicodeString(CHARCODE) ) );
+ }
+*/
+
+test();
+
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-2.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-2.js
new file mode 100644
index 0000000000..99b58752b2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-2.js
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.5-2.js';
+
+/**
+ File Name: 15.1.2.5-2.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+ Description:
+
+ This tests the cases where there are fewer than 4 characters following "%u",
+ or fewer than 2 characters following "%" or "%u".
+
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+var SECTION = "15.1.2.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "unescape(string)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// since there is only one character following "%", no conversion should occur.
+
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) {
+ new TestCase( SECTION,
+ "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
+ "%"+(ToHexString(CHARCODE)).substring(0,1),
+ unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) );
+}
+
+// since there is only one character following "%u", no conversion should occur.
+
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE +=16 ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
+ "%u"+(ToHexString(CHARCODE)).substring(0,1),
+ unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1) ) );
+}
+
+
+// three char unicode string. no conversion should occur
+
+for ( var CHARCODE = 1024; CHARCODE < 65536; CHARCODE+= 1234 ) {
+ new TestCase
+ ( SECTION,
+ "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3)+ " )",
+
+ "%u"+(ToUnicodeString(CHARCODE)).substring(0,3),
+ unescape( "%u"+(ToUnicodeString(CHARCODE)).substring(0,3) )
+ );
+}
+
+test();
+
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-3.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-3.js
new file mode 100644
index 0000000000..2615d62531
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.5-3.js
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.5-3.js';
+
+/**
+ File Name: 15.1.2.5-3.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+
+ Description:
+ This tests the cases where one of the four characters following "%u" is
+ not a hexidecimal character, or one of the two characters following "%"
+ or "%u" is not a hexidecimal character.
+
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+
+var SECTION = "15.1.2.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "unescape(string)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ new TestCase( SECTION,
+ "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+ "%"+(ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ),
+ unescape( "%" + (ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+}
+for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ new TestCase( SECTION,
+ "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+ "%u"+(ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ),
+ unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+}
+
+for ( var CHARCODE = 0, NONHEXCHARCODE = 0 ; CHARCODE < 65536; CHARCODE+= 54321, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ new TestCase( SECTION,
+ "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+
+ String.fromCharCode(eval("0x"+ (ToUnicodeString(CHARCODE)).substring(0,2))) +
+ (ToUnicodeString(CHARCODE)).substring(2,3) +
+ String.fromCharCode( NONHEXCHARCODE ),
+
+ unescape( "%" + (ToUnicodeString(CHARCODE)).substring(0,3)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+}
+
+test();
+
+function getNextNonHexCharCode( n ) {
+ for ( ; n < Math.pow(2,16); n++ ) {
+ if ( ( n == 43 || n == 45 || n == 46 || n == 47 ||
+ (n >= 71 && n <= 90) || (n >= 103 && n <= 122) ||
+ n == 64 || n == 95 ) ) {
+ break;
+ } else {
+ n = ( n > 122 ) ? 0 : n;
+ }
+ }
+ return n;
+}
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js
new file mode 100644
index 0000000000..18f1986d7e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.6.js';
+
+/**
+ File Name: 15.1.2.6.js
+ ECMA Section: 15.1.2.6 isNaN( x )
+
+ Description: Applies ToNumber to its argument, then returns true if
+ the result isNaN and otherwise returns false.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.2.6";
+var VERSION = "ECMA_1";
+var TITLE = "isNaN( x )";
+var BUGNUMBER = "none";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "isNaN.length", 1, isNaN.length );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", "prototype", eval("var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS") );
+new TestCase( SECTION, "isNaN.length = null; isNaN.length", 1, eval("isNaN.length=null; isNaN.length") );
+new TestCase( SECTION, "delete isNaN.length", false, delete isNaN.length );
+new TestCase( SECTION, "delete isNaN.length; isNaN.length", 1, eval("delete isNaN.length; isNaN.length") );
+
+// new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ );
+
+new TestCase( SECTION, "isNaN()", true, isNaN() );
+new TestCase( SECTION, "isNaN( null )", false, isNaN(null) );
+new TestCase( SECTION, "isNaN( void 0 )", true, isNaN(void 0) );
+new TestCase( SECTION, "isNaN( true )", false, isNaN(true) );
+new TestCase( SECTION, "isNaN( false)", false, isNaN(false) );
+new TestCase( SECTION, "isNaN( ' ' )", false, isNaN( " " ) );
+
+new TestCase( SECTION, "isNaN( 0 )", false, isNaN(0) );
+new TestCase( SECTION, "isNaN( 1 )", false, isNaN(1) );
+new TestCase( SECTION, "isNaN( 2 )", false, isNaN(2) );
+new TestCase( SECTION, "isNaN( 3 )", false, isNaN(3) );
+new TestCase( SECTION, "isNaN( 4 )", false, isNaN(4) );
+new TestCase( SECTION, "isNaN( 5 )", false, isNaN(5) );
+new TestCase( SECTION, "isNaN( 6 )", false, isNaN(6) );
+new TestCase( SECTION, "isNaN( 7 )", false, isNaN(7) );
+new TestCase( SECTION, "isNaN( 8 )", false, isNaN(8) );
+new TestCase( SECTION, "isNaN( 9 )", false, isNaN(9) );
+
+new TestCase( SECTION, "isNaN( '0' )", false, isNaN('0') );
+new TestCase( SECTION, "isNaN( '1' )", false, isNaN('1') );
+new TestCase( SECTION, "isNaN( '2' )", false, isNaN('2') );
+new TestCase( SECTION, "isNaN( '3' )", false, isNaN('3') );
+new TestCase( SECTION, "isNaN( '4' )", false, isNaN('4') );
+new TestCase( SECTION, "isNaN( '5' )", false, isNaN('5') );
+new TestCase( SECTION, "isNaN( '6' )", false, isNaN('6') );
+new TestCase( SECTION, "isNaN( '7' )", false, isNaN('7') );
+new TestCase( SECTION, "isNaN( '8' )", false, isNaN('8') );
+new TestCase( SECTION, "isNaN( '9' )", false, isNaN('9') );
+
+
+new TestCase( SECTION, "isNaN( 0x0a )", false, isNaN( 0x0a ) );
+new TestCase( SECTION, "isNaN( 0xaa )", false, isNaN( 0xaa ) );
+new TestCase( SECTION, "isNaN( 0x0A )", false, isNaN( 0x0A ) );
+new TestCase( SECTION, "isNaN( 0xAA )", false, isNaN( 0xAA ) );
+
+new TestCase( SECTION, "isNaN( '0x0a' )", false, isNaN( "0x0a" ) );
+new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) );
+new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) );
+new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) );
+
+
+new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) );
+new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "isNaN( Number.NEGATIVE_INFINITY )", false, isNaN(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "isNaN( Number.MAX_VALUE )", false, isNaN(Number.MAX_VALUE) );
+new TestCase( SECTION, "isNaN( Number.MIN_VALUE )", false, isNaN(Number.MIN_VALUE) );
+
+new TestCase( SECTION, "isNaN( NaN )", true, isNaN(NaN) );
+new TestCase( SECTION, "isNaN( Infinity )", false, isNaN(Infinity) );
+
+new TestCase( SECTION, "isNaN( 'Infinity' )", false, isNaN("Infinity") );
+new TestCase( SECTION, "isNaN( '-Infinity' )", false, isNaN("-Infinity") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js
new file mode 100644
index 0000000000..9eb52a8ff1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.7.js';
+
+/**
+ File Name: 15.1.2.7.js
+ ECMA Section: 15.1.2.7 isFinite(number)
+
+ Description: Applies ToNumber to its argument, then returns false if
+ the result is NaN, Infinity, or -Infinity, and otherwise
+ returns true.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.1.2.7";
+var VERSION = "ECMA_1";
+var TITLE = "isFinite( x )";
+var BUGNUMBER= "none";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "isFinite.length", 1, isFinite.length );
+new TestCase( SECTION, "isFinite.length = null; isFinite.length", 1, eval("isFinite.length=null; isFinite.length") );
+new TestCase( SECTION, "delete isFinite.length", false, delete isFinite.length );
+new TestCase( SECTION, "delete isFinite.length; isFinite.length", 1, eval("delete isFinite.length; isFinite.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", "prototype", eval("var MYPROPS=''; for ( p in isFinite ) { MYPROPS += p }; MYPROPS") );
+
+new TestCase( SECTION, "isFinite()", false, isFinite() );
+new TestCase( SECTION, "isFinite( null )", true, isFinite(null) );
+new TestCase( SECTION, "isFinite( void 0 )", false, isFinite(void 0) );
+new TestCase( SECTION, "isFinite( false )", true, isFinite(false) );
+new TestCase( SECTION, "isFinite( true)", true, isFinite(true) );
+new TestCase( SECTION, "isFinite( ' ' )", true, isFinite( " " ) );
+
+new TestCase( SECTION, "isFinite( new Boolean(true) )", true, isFinite(new Boolean(true)) );
+new TestCase( SECTION, "isFinite( new Boolean(false) )", true, isFinite(new Boolean(false)) );
+
+new TestCase( SECTION, "isFinite( 0 )", true, isFinite(0) );
+new TestCase( SECTION, "isFinite( 1 )", true, isFinite(1) );
+new TestCase( SECTION, "isFinite( 2 )", true, isFinite(2) );
+new TestCase( SECTION, "isFinite( 3 )", true, isFinite(3) );
+new TestCase( SECTION, "isFinite( 4 )", true, isFinite(4) );
+new TestCase( SECTION, "isFinite( 5 )", true, isFinite(5) );
+new TestCase( SECTION, "isFinite( 6 )", true, isFinite(6) );
+new TestCase( SECTION, "isFinite( 7 )", true, isFinite(7) );
+new TestCase( SECTION, "isFinite( 8 )", true, isFinite(8) );
+new TestCase( SECTION, "isFinite( 9 )", true, isFinite(9) );
+
+new TestCase( SECTION, "isFinite( '0' )", true, isFinite('0') );
+new TestCase( SECTION, "isFinite( '1' )", true, isFinite('1') );
+new TestCase( SECTION, "isFinite( '2' )", true, isFinite('2') );
+new TestCase( SECTION, "isFinite( '3' )", true, isFinite('3') );
+new TestCase( SECTION, "isFinite( '4' )", true, isFinite('4') );
+new TestCase( SECTION, "isFinite( '5' )", true, isFinite('5') );
+new TestCase( SECTION, "isFinite( '6' )", true, isFinite('6') );
+new TestCase( SECTION, "isFinite( '7' )", true, isFinite('7') );
+new TestCase( SECTION, "isFinite( '8' )", true, isFinite('8') );
+new TestCase( SECTION, "isFinite( '9' )", true, isFinite('9') );
+
+new TestCase( SECTION, "isFinite( 0x0a )", true, isFinite( 0x0a ) );
+new TestCase( SECTION, "isFinite( 0xaa )", true, isFinite( 0xaa ) );
+new TestCase( SECTION, "isFinite( 0x0A )", true, isFinite( 0x0A ) );
+new TestCase( SECTION, "isFinite( 0xAA )", true, isFinite( 0xAA ) );
+
+new TestCase( SECTION, "isFinite( '0x0a' )", true, isFinite( "0x0a" ) );
+new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0xaa" ) );
+new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) );
+new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) );
+
+new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) );
+new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) );
+
+new TestCase( SECTION, "isFinite( 'Infinity' )", false, isFinite("Infinity") );
+new TestCase( SECTION, "isFinite( '-Infinity' )", false, isFinite("-Infinity") );
+new TestCase( SECTION, "isFinite( Number.POSITIVE_INFINITY )", false, isFinite(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "isFinite( Number.NEGATIVE_INFINITY )", false, isFinite(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "isFinite( Number.NaN )", false, isFinite(Number.NaN) );
+
+new TestCase( SECTION, "isFinite( Infinity )", false, isFinite(Infinity) );
+new TestCase( SECTION, "isFinite( -Infinity )", false, isFinite(-Infinity) );
+new TestCase( SECTION, "isFinite( NaN )", false, isFinite(NaN) );
+
+
+new TestCase( SECTION, "isFinite( Number.MAX_VALUE )", true, isFinite(Number.MAX_VALUE) );
+new TestCase( SECTION, "isFinite( Number.MIN_VALUE )", true, isFinite(Number.MIN_VALUE) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/browser.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/shell.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/shell.js
new file mode 100644
index 0000000000..d922707218
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'GlobalObject';
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-1.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-1.js
new file mode 100644
index 0000000000..7fa415c20d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-1.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.1-1.js';
+
+/**
+ File Name: 7.1-1.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
+
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab <TAB> \t
+ \u000B veritical tab <VT> \v
+ \U000C form feed <FF> \f
+ \u0020 space <SP> " "
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+var SECTION = "7.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "White Space";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// whitespace between var keyword and identifier
+
+new TestCase( SECTION, 'var'+'\t'+'MYVAR1=10;MYVAR1', 10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') );
+new TestCase( SECTION, 'var'+'\f'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, 'var'+'\v'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, 'var'+'\ '+'MYVAR2=10;MYVAR2', 10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') );
+
+// use whitespace between tokens object name, dot operator, and object property
+
+new TestCase( SECTION,
+ "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length",
+ 12345,
+ eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-2.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-2.js
new file mode 100644
index 0000000000..aa0c3fb373
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-2.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.1-2.js';
+
+/**
+ File Name: 7.1-2.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
+
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab <TAB> \t
+ \u000B veritical tab <VT> ??
+ \U000C form feed <FF> \f
+ \u0020 space <SP> " "
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+var SECTION = "7.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "White Space";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
+new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
+new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-3.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-3.js
new file mode 100644
index 0000000000..c405106ade
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.1-3.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.1-3.js';
+
+/**
+ File Name: 7.1-3.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
+
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab <TAB> \t
+ \u000B veritical tab <VT> ??
+ \U000C form feed <FF> \f
+ \u0020 space <SP> " "
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+var SECTION = "7.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "White Space";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
+new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
+new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
+
+// +<white space>+ should be interpreted as the unary + operator twice, not as a post or prefix increment operator
+
+new TestCase( SECTION,
+ "var VAR = 12345; + + VAR",
+ 12345,
+ eval("var VAR = 12345; + + VAR") );
+
+new TestCase( SECTION,
+ "var VAR = 12345;VAR+ + VAR",
+ 24690,
+ eval("var VAR = 12345;VAR+ +VAR") );
+new TestCase( SECTION,
+ "var VAR = 12345;VAR - - VAR",
+ 24690,
+ eval("var VAR = 12345;VAR- -VAR") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-1.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-1.js
new file mode 100644
index 0000000000..dd4f2fcbed
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-1.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.2-1.js';
+
+/**
+ File Name: 7.2-1.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
+new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") );
+new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-2-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-2-n.js
new file mode 100644
index 0000000000..d945115832
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-2-n.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.2-2-n.js';
+
+/**
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "\r\r\r\nb";
+EXPECTED = "error"
+
+ new TestCase( SECTION, DESCRIPTION, "error", eval("\r\r\r\nb"));
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-3-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-3-n.js
new file mode 100644
index 0000000000..c62410d202
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-3-n.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.2-3-n.js';
+
+/**
+ File Name: 7.2-3.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+DESCRIPTION = "\r\nb";
+EXPECTED = "error"
+
+ new TestCase( SECTION, "<cr>a", "error", eval("\r\nb"));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-4-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-4-n.js
new file mode 100644
index 0000000000..b29f999739
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-4-n.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.2-4-n.js';
+
+/**
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.2-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "\nb";
+EXPECTED = "error";
+
+new TestCase( SECTION, "\nb", "error", eval("\nb"));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-5-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-5-n.js
new file mode 100644
index 0000000000..b563d86437
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-5-n.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.2-5-n.js';
+
+/**
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.2-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION =
+ EXPECTED = "error";
+
+new TestCase( SECTION, "\rb", "error", eval("\rb"));
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-6.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-6.js
new file mode 100644
index 0000000000..220548e78e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.2-6.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.2-6.js';
+
+/**
+ File Name: 7.2-6.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.2-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "var a\u000Ab = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\u000Db = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-1.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-1.js
new file mode 100644
index 0000000000..9701660576
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-1.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-1.js';
+
+/**
+ File Name: 7.3-1.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase;
+
+testcase = new TestCase( SECTION,
+ "a comment with a line terminator string, and text following",
+ "pass",
+ "pass");
+
+// "\u000A" testcase.actual = "fail";
+
+
+testcase = new TestCase( SECTION,
+ "// test \\n testcase.actual = \"pass\"",
+ "pass",
+ "" );
+
+var x = "// test \n testcase.actual = 'pass'";
+
+testcase.actual = eval(x);
+
+test();
+
+// XXX bc replace test()
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +": "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( gTestcases );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-10.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-10.js
new file mode 100644
index 0000000000..1cd0f18a90
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-10.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-10.js';
+
+/**
+ File Name: 7.3-10.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+
+/*//*/testcase.actual="pass";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-11.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-11.js
new file mode 100644
index 0000000000..f9033cd05a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-11.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-11.js';
+
+/**
+ File Name: 7.3-11.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "pass");
+
+////testcase.actual="fail";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-12.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-12.js
new file mode 100644
index 0000000000..04ceb81409
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-12.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-12.js';
+
+/**
+ File Name: 7.3-12.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "pass");
+/*testcase.actual="fail";**/
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-13-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-13-n.js
new file mode 100644
index 0000000000..714de99a9a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-13-n.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-13-n.js';
+
+/**
+ File Name: 7.3-13-n.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-13-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "nested comment";
+EXPECTED = "error";
+
+var testcase = new TestCase( SECTION,
+ "nested comment",
+ "error",
+ eval("/*/*\"fail\";*/*/"));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-2.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-2.js
new file mode 100644
index 0000000000..7aa029feda
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-2.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-2.js';
+
+/**
+ File Name: 7.3-2.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "a comment with a carriage return, and text following",
+ "pass",
+ "pass");
+
+// "\u000D" testcase.actual = "fail";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-3.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-3.js
new file mode 100644
index 0000000000..1886639e26
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-3.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-3.js';
+
+/**
+ File Name: 7.3-3.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "source text directly following a single-line comment",
+ "pass",
+ "fail");
+// a comment string
+testcase.actual = "pass";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-4.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-4.js
new file mode 100644
index 0000000000..4cb53af0fb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-4.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-4.js';
+
+/**
+ File Name: 7.3-4.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "multiline comment ",
+ "pass",
+ "pass");
+
+/*testcase.actual = "fail";*/
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-5.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-5.js
new file mode 100644
index 0000000000..22d9e08a60
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-5.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-5.js';
+
+/**
+ File Name: 7.3-5.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "a comment with a carriage return, and text following",
+ "pass",
+ "pass");
+
+// "\u000A" testcase.actual = "fail";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-6.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-6.js
new file mode 100644
index 0000000000..91afd319a4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-6.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-6.js';
+
+/**
+ File Name: 7.3-6.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+var testcase = new TestCase( SECTION,
+ "comment with multiple asterisks",
+ "pass",
+ "fail");
+
+/*
+***/testcase.actual="pass";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-7.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-7.js
new file mode 100644
index 0000000000..a35cd54289
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-7.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-7.js';
+
+/**
+ File Name: 7.3-7.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "single line comment following multiline comment",
+ "pass",
+ "pass");
+
+/*
+***///testcase.actual="fail";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-8.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-8.js
new file mode 100644
index 0000000000..2d665c4ff0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-8.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-8.js';
+
+/**
+ File Name: 7.3-7.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+
+/**/testcase.actual="pass";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-9.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-9.js
new file mode 100644
index 0000000000..caff9f7f09
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.3-9.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.3-9.js';
+
+/**
+ File Name: 7.3-9.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.3-9";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+
+/*/*/testcase.actual="pass";
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-1-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-1-n.js
new file mode 100644
index 0000000000..2153cc2638
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-1-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.1-1-n.js';
+
+/**
+ File Name: 7.4.1-1-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var null = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var null = true", "error", eval("var null = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-2-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-2-n.js
new file mode 100644
index 0000000000..a50bd6020f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-2-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.1-2-n.js';
+
+/**
+ File Name: 7.4.1-2.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var true = false";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var true = false", "error", eval("var true = false") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-3-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-3-n.js
new file mode 100644
index 0000000000..b49fe7937b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.1-3-n.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.1-3-n.js';
+
+/**
+ File Name: 7.4.1-3-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+DESCRIPTION = "var false = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var false = true", "error", eval("var false = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-1-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-1-n.js
new file mode 100644
index 0000000000..36723173f5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-1-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-1-n.js';
+
+/**
+ File Name: 7.4.2-1.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.2-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var break = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var break = true", "error", eval("var break = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-10-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-10-n.js
new file mode 100644
index 0000000000..89003d3601
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-10-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-10-n.js';
+
+/**
+ File Name: 7.4.2-10.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-10-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var if = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var if = true", "error", eval("var if = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-11-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-11-n.js
new file mode 100644
index 0000000000..3aff749e51
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-11-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-11-n.js';
+
+/**
+ File Name: 7.4.2-11-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-11-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var this = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var this = true", "error", eval("var this = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-12-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-12-n.js
new file mode 100644
index 0000000000..f19ed8c904
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-12-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-12-n.js';
+
+/**
+ File Name: 7.4.2-12-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-12-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var while = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var while = true", "error", eval("var while = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-13-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-13-n.js
new file mode 100644
index 0000000000..22a5284dcc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-13-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-13-n.js';
+
+/**
+ File Name: 7.4.2-13-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-13-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var else = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var else = true", "error", eval("var else = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-14-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-14-n.js
new file mode 100644
index 0000000000..b9b05f42b7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-14-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-14-n.js';
+
+/**
+ File Name: 7.4.2-14-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-14-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var in = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var in = true", "error", eval("var in = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-15-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-15-n.js
new file mode 100644
index 0000000000..27e83972c3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-15-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-15-n.js';
+
+/**
+ File Name: 7.4.2-15-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-15-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var typeof = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var typeof = true", "error", eval("var typeof = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-16-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-16-n.js
new file mode 100644
index 0000000000..988920538c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-16-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-16-n.js';
+
+/**
+ File Name: 7.4.2-16-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-16-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var with = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var with = true", "error", eval("var with = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-2-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-2-n.js
new file mode 100644
index 0000000000..648610a9e6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-2-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-2-n.js';
+
+/**
+ File Name: 7.4.2-2-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var for = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var for = true", "error", eval("var for = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-3-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-3-n.js
new file mode 100644
index 0000000000..d8b74d6b0e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-3-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-3-n.js';
+
+/**
+ File Name: 7.4.2-3-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.2-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var new = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var new = true", "error", eval("var new = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-4-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-4-n.js
new file mode 100644
index 0000000000..2bb0aa260b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-4-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-4-n.js';
+
+/**
+ File Name: 7.4.2-4-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.2-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var var = true";
+EXPECTED = "error";
+
+TestCase( SECTION, "var var = true", "error", eval("var var = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-5-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-5-n.js
new file mode 100644
index 0000000000..3fdf06b2c1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-5-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-5-n.js';
+
+/**
+ File Name: 7.4.2-5-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.2-5-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var continue = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var continue = true", "error", eval("var continue = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-6-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-6-n.js
new file mode 100644
index 0000000000..00f3f99a4c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-6-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-6-n.js';
+
+/**
+ File Name: 7.4.2-6.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.2-6-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var function = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var function = true", "error", eval("var function = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-7-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-7-n.js
new file mode 100644
index 0000000000..6a85b261ce
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-7-n.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-7-n.js';
+
+/**
+ File Name: 7.4.2-7-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.2-7";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Keywords");
+
+DESCRIPTION = "var return = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var return = true", "error", eval("var return = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-8-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-8-n.js
new file mode 100644
index 0000000000..5f5122e0f2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-8-n.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-8-n.js';
+
+/**
+ File Name: 7.4.2-8-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.2-8";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Keywords");
+
+DESCRIPTION = "var void = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var void = true", "error", eval("var void = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-9-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-9-n.js
new file mode 100644
index 0000000000..c1c4df6d9b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.2-9-n.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.2-9-n.js';
+
+/**
+ File Name: 7.4.2-9-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "7.4.1-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var delete = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var delete = true", "error", eval("var delete = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-1-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-1-n.js
new file mode 100644
index 0000000000..dee163d8e5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-1-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-1-n.js';
+
+/**
+ File Name: 7.4.3-1-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var case = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var case = true", "error", eval("var case = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-10-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-10-n.js
new file mode 100644
index 0000000000..8d717f323d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-10-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-10-n.js';
+
+/**
+ File Name: 7.4.3-10-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-10-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var do = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var do = true", "error", eval("var do = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-11-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-11-n.js
new file mode 100644
index 0000000000..4e29e9c3af
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-11-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-11-n.js';
+
+/**
+ File Name: 7.4.3-11-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-11-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var finally = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var finally = true", "error", eval("var finally = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-12-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-12-n.js
new file mode 100644
index 0000000000..913fae905b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-12-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-12-n.js';
+
+/**
+ File Name: 7.4.3-12-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-12-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var throw = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var throw = true", "error", eval("var throw = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-13-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-13-n.js
new file mode 100644
index 0000000000..c196ea2418
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-13-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-13-n.js';
+
+/**
+ File Name: 7.4.3-13-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-13-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var const = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var const = true", "error", eval("var const = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-14-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-14-n.js
new file mode 100644
index 0000000000..8d5af29ede
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-14-n.js
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-14-n.js';
+
+/**
+ File Name: 7.4.3-14-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-14-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var actual = 'no error';
+var prefValue;
+
+print("This test requires option javascript.options.strict enabled");
+
+options('strict');
+options('werror');
+
+try
+{
+ eval("var enum = true");
+}
+catch(e)
+{
+ actual = 'error';
+}
+
+DESCRIPTION = "var enum = true";
+EXPECTED = "error";
+
+// force exception since this is a negative test
+if (actual == 'error')
+{
+ throw actual;
+}
+
+new TestCase( SECTION,
+ "var enum = true",
+ "error",
+ actual );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-15-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-15-n.js
new file mode 100644
index 0000000000..f855132d8a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-15-n.js
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-15-n.js';
+
+/**
+ File Name: 7.4.3-15-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-15-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var actual = 'no error';
+var prefValue;
+
+print("This test requires option javascript.options.strict enabled");
+
+options('strict');
+options('werror');
+
+try
+{
+ eval("var import = true");
+}
+catch(e)
+{
+ actual = 'error';
+}
+
+DESCRIPTION = "var import = true";
+EXPECTED = "error";
+
+// force exception since this is a negative test
+if (actual == 'error')
+{
+ throw actual;
+}
+
+new TestCase( SECTION,
+ "var import = true",
+ "error",
+ actual );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-16-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-16-n.js
new file mode 100644
index 0000000000..6d86d357f2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-16-n.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-16-n.js';
+
+/**
+ File Name: lexical-023.js
+ Corresponds To: 7.4.3-16-n.js
+ ECMA Section: 7.4.3
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-023.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+/*
+ try {
+ try = true;
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+*/
+
+DESCRIPTION = "try = true";
+EXPECTED = "error";
+
+new TestCase(
+ SECTION,
+ "try = true" +
+ " (threw " + exception +")",
+ "error",
+ eval("try = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-2-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-2-n.js
new file mode 100644
index 0000000000..fe5f6ffac1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-2-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-2-n.js';
+
+/**
+ File Name: 7.4.3-2-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var debugger = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var debugger = true", "error", eval("var debugger = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-3-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-3-n.js
new file mode 100644
index 0000000000..b95c8ecbe0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-3-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-3-n.js';
+
+/**
+ File Name: 7.4.3-3-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var export = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var export = true", "error", eval("var export = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-4-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-4-n.js
new file mode 100644
index 0000000000..b17b06f2e9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-4-n.js
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-4-n.js';
+
+/**
+ File Name: 7.4.3-4-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var actual = 'no error';
+var prefValue;
+
+print("This test requires option javascript.options.strict enabled");
+
+options('strict');
+options('werror');
+
+try
+{
+ eval("var super = true");
+}
+catch(e)
+{
+ actual = 'error';
+}
+
+DESCRIPTION = "var super = true"
+ EXPECTED = "error";
+
+// force exception since this is a negative test
+if (actual == 'error')
+{
+ throw actual;
+}
+
+new TestCase( SECTION,
+ "var super = true",
+ "error",
+ actual );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-5-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-5-n.js
new file mode 100644
index 0000000000..d76025b3cc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-5-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-5-n.js';
+
+/**
+ File Name: 7.4.3-5-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-5-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var catch = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var catch = true", "error", eval("var catch = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-6-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-6-n.js
new file mode 100644
index 0000000000..36ffe63977
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-6-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-6-n.js';
+
+/**
+ File Name: 7.4.3-6-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-6-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var default = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var default = true", "error", eval("var default = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-7-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-7-n.js
new file mode 100644
index 0000000000..31239d561a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-7-n.js
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-7-n.js';
+
+/**
+ File Name: 7.4.3-7-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-7-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var actual = 'no error';
+var prefValue;
+
+print("This test requires option javascript.options.strict enabled");
+
+options('strict');
+options('werror');
+
+try
+{
+ eval("var extends = true");
+}
+catch(e)
+{
+ actual = 'error';
+}
+
+DESCRIPTION = "var extends = true";
+EXPECTED = "error";
+
+// force exception since this is a negative test
+if (actual == 'error')
+{
+ throw actual;
+}
+
+new TestCase( SECTION,
+ "var extends = true",
+ "error",
+ actual);
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-8-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-8-n.js
new file mode 100644
index 0000000000..666abcc0c8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-8-n.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-8-n.js';
+
+/**
+ File Name: 7.4.3-8-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var switch = true";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var switch = true", "error", eval("var switch = true") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-9-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-9-n.js
new file mode 100644
index 0000000000..4fee9c8c4a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.4.3-9-n.js
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.4.3-9-n.js';
+
+/**
+ File Name: 7.4.3-9-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "7.4.3-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var actual = 'no error';
+var prefValue;
+
+DESCRIPTION = "var class = true";
+EXPECTED = "error";
+
+
+print("This test requires option javascript.options.strict enabled");
+
+options('strict');
+options('werror');
+
+try
+{
+ eval("var class = true");
+}
+catch(e)
+{
+ actual = 'error';
+}
+
+// force exception since this is a negative test
+if (actual == 'error')
+{
+ throw actual;
+}
+
+new TestCase( SECTION,
+ "var class = true",
+ "error",
+ actual );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-1.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-1.js
new file mode 100644
index 0000000000..57be9b63ee
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-1.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-1.js';
+
+/**
+ File Name: 7.5-1.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") );
+new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-10-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-10-n.js
new file mode 100644
index 0000000000..2561a3deda
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-10-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-10-n.js';
+
+/**
+ File Name: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var 123=\"hi\"";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var 123=\"hi\"", "error", eval("123 = \"hi\"; array[item] = 123;") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-2-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-2-n.js
new file mode 100644
index 0000000000..3401fe4891
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-2-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-2-n.js';
+
+/**
+ File Name: 7.5-2-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var 0abc";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var 0abc", "error", eval("var 0abc") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-3-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-3-n.js
new file mode 100644
index 0000000000..778c284cfb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-3-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-3-n.js';
+
+/**
+ File Name: 7.5-2.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var 1abc";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var 1abc", "error", eval("var 1abc") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-4-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-4-n.js
new file mode 100644
index 0000000000..0f4b0fb2f1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-4-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-4-n.js';
+
+/**
+ File Name: 7.5-4-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var 2abc";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var 2abc", "error", eval("var 2abc") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-5-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-5-n.js
new file mode 100644
index 0000000000..97a61e3449
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-5-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-5-n.js';
+
+/**
+ File Name: 7.5-5-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-5-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var 3abc";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var 3abc", "error", eval("var 3abc") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-6.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-6.js
new file mode 100644
index 0000000000..a53f4413eb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-6.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-6.js';
+
+/**
+ File Name: 7.5-6.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "var _0abc = 5", 5, eval("var _0abc = 5; _0abc") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-7.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-7.js
new file mode 100644
index 0000000000..c3446c6c0d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-7.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-7.js';
+
+/**
+ File Name: 7.5-7.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "var $0abc = 5", 5, eval("var $0abc = 5; $0abc") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-8-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-8-n.js
new file mode 100644
index 0000000000..e363666148
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-8-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-8-n.js';
+
+/**
+ File Name: 7.5-8-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-8-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var @0abc = 5; @0abc";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var @0abc = 5; @0abc", "error", eval("var @0abc = 5; @0abc") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-9-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-9-n.js
new file mode 100644
index 0000000000..c1ac68512a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.5-9-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.5-9-n.js';
+
+/**
+ File Name: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "7.5-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var 123=\"hi\"";
+EXPECTED = "error";
+
+new TestCase( SECTION, "var 123=\"hi\"", "error", eval("var 123 = \"hi\";array[item] = 123;") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.6.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.6.js
new file mode 100644
index 0000000000..091c74d7db
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.6.js
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.6.js';
+
+/**
+ File Name: 7.6.js
+ ECMA Section: Punctuators
+ Description:
+
+ This tests verifies that all ECMA punctutors are recognized as a
+ token separator, but does not attempt to verify the functionality
+ of any punctuator.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "7.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Punctuators";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// ==
+new TestCase( SECTION,
+ "var c,d;c==d",
+ true,
+ eval("var c,d;c==d") );
+
+// =
+
+new TestCase( SECTION,
+ "var a=true;a",
+ true,
+ eval("var a=true;a") );
+
+// >
+new TestCase( SECTION,
+ "var a=true,b=false;a>b",
+ true,
+ eval("var a=true,b=false;a>b") );
+
+// <
+new TestCase( SECTION,
+ "var a=true,b=false;a<b",
+ false,
+ eval("var a=true,b=false;a<b") );
+
+// <=
+new TestCase( SECTION,
+ "var a=0xFFFF,b=0X0FFF;a<=b",
+ false,
+ eval("var a=0xFFFF,b=0X0FFF;a<=b") );
+
+// >=
+new TestCase( SECTION,
+ "var a=0xFFFF,b=0XFFFE;a>=b",
+ true,
+ eval("var a=0xFFFF,b=0XFFFE;a>=b") );
+
+// !=
+new TestCase( SECTION,
+ "var a=true,b=false;a!=b",
+ true,
+ eval("var a=true,b=false;a!=b") );
+
+new TestCase( SECTION,
+ "var a=false,b=false;a!=b",
+ false,
+ eval("var a=false,b=false;a!=b") );
+// ,
+new TestCase( SECTION,
+ "var a=true,b=false;a,b",
+ false,
+ eval("var a=true,b=false;a,b") );
+// !
+new TestCase( SECTION,
+ "var a=true,b=false;!a",
+ false,
+ eval("var a=true,b=false;!a") );
+
+// ~
+new TestCase( SECTION,
+ "var a=true;~a",
+ -2,
+ eval("var a=true;~a") );
+// ?
+new TestCase( SECTION,
+ "var a=true; (a ? 'PASS' : '')",
+ "PASS",
+ eval("var a=true; (a ? 'PASS' : '')") );
+
+// :
+
+new TestCase( SECTION,
+ "var a=false; (a ? 'FAIL' : 'PASS')",
+ "PASS",
+ eval("var a=false; (a ? 'FAIL' : 'PASS')") );
+// .
+
+new TestCase( SECTION,
+ "var a=Number;a.NaN",
+ NaN,
+ eval("var a=Number;a.NaN") );
+
+// &&
+new TestCase( SECTION,
+ "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
+ "PASS",
+ eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
+
+// ||
+new TestCase( SECTION,
+ "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
+ "PASS",
+ eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
+// ++
+new TestCase( SECTION,
+ "var a=false,b=false;++a",
+ 1,
+ eval("var a=false,b=false;++a") );
+// --
+new TestCase( SECTION,
+ "var a=true,b=false--a",
+ 0,
+ eval("var a=true,b=false;--a") );
+// +
+
+new TestCase( SECTION,
+ "var a=true,b=true;a+b",
+ 2,
+ eval("var a=true,b=true;a+b") );
+// -
+new TestCase( SECTION,
+ "var a=true,b=true;a-b",
+ 0,
+ eval("var a=true,b=true;a-b") );
+// *
+new TestCase( SECTION,
+ "var a=true,b=true;a*b",
+ 1,
+ eval("var a=true,b=true;a*b") );
+// /
+new TestCase( SECTION,
+ "var a=true,b=true;a/b",
+ 1,
+ eval("var a=true,b=true;a/b") );
+// &
+new TestCase( SECTION,
+ "var a=3,b=2;a&b",
+ 2,
+ eval("var a=3,b=2;a&b") );
+// |
+new TestCase( SECTION,
+ "var a=4,b=3;a|b",
+ 7,
+ eval("var a=4,b=3;a|b") );
+
+// |
+new TestCase( SECTION,
+ "var a=4,b=3;a^b",
+ 7,
+ eval("var a=4,b=3;a^b") );
+
+// %
+new TestCase( SECTION,
+ "var a=4,b=3;a|b",
+ 1,
+ eval("var a=4,b=3;a%b") );
+
+// <<
+new TestCase( SECTION,
+ "var a=4,b=3;a<<b",
+ 32,
+ eval("var a=4,b=3;a<<b") );
+
+// >>
+new TestCase( SECTION,
+ "var a=4,b=1;a>>b",
+ 2,
+ eval("var a=4,b=1;a>>b") );
+
+// >>>
+new TestCase( SECTION,
+ "var a=1,b=1;a>>>b",
+ 0,
+ eval("var a=1,b=1;a>>>b") );
+// +=
+new TestCase( SECTION,
+ "var a=4,b=3;a+=b;a",
+ 7,
+ eval("var a=4,b=3;a+=b;a") );
+
+// -=
+new TestCase( SECTION,
+ "var a=4,b=3;a-=b;a",
+ 1,
+ eval("var a=4,b=3;a-=b;a") );
+// *=
+new TestCase( SECTION,
+ "var a=4,b=3;a*=b;a",
+ 12,
+ eval("var a=4,b=3;a*=b;a") );
+// +=
+new TestCase( SECTION,
+ "var a=4,b=3;a+=b;a",
+ 7,
+ eval("var a=4,b=3;a+=b;a") );
+// /=
+new TestCase( SECTION,
+ "var a=12,b=3;a/=b;a",
+ 4,
+ eval("var a=12,b=3;a/=b;a") );
+
+// &=
+new TestCase( SECTION,
+ "var a=4,b=5;a&=b;a",
+ 4,
+ eval("var a=4,b=5;a&=b;a") );
+
+// |=
+new TestCase( SECTION,
+ "var a=4,b=5;a&=b;a",
+ 5,
+ eval("var a=4,b=5;a|=b;a") );
+// ^=
+new TestCase( SECTION,
+ "var a=4,b=5;a^=b;a",
+ 1,
+ eval("var a=4,b=5;a^=b;a") );
+// %=
+new TestCase( SECTION,
+ "var a=12,b=5;a%=b;a",
+ 2,
+ eval("var a=12,b=5;a%=b;a") );
+// <<=
+new TestCase( SECTION,
+ "var a=4,b=3;a<<=b;a",
+ 32,
+ eval("var a=4,b=3;a<<=b;a") );
+
+// >>
+new TestCase( SECTION,
+ "var a=4,b=1;a>>=b;a",
+ 2,
+ eval("var a=4,b=1;a>>=b;a") );
+
+// >>>
+new TestCase( SECTION,
+ "var a=1,b=1;a>>>=b;a",
+ 0,
+ eval("var a=1,b=1;a>>>=b;a") );
+
+// ()
+new TestCase( SECTION,
+ "var a=4,b=3;(a)",
+ 4,
+ eval("var a=4,b=3;(a)") );
+// {}
+new TestCase( SECTION,
+ "var a=4,b=3;{b}",
+ 3,
+ eval("var a=4,b=3;{b}") );
+
+// []
+new TestCase( SECTION,
+ "var a=new Array('hi');a[0]",
+ "hi",
+ eval("var a=new Array('hi');a[0]") );
+// []
+new TestCase( SECTION,
+ ";",
+ void 0,
+ eval(";") );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.1.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.1.js
new file mode 100644
index 0000000000..83325b5f32
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.1.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.7.1.js';
+
+/**
+ File Name: 7.7.1.js
+ ECMA Section: 7.7.1 Null Literals
+
+ Description: NullLiteral::
+ null
+
+
+ The value of the null literal null is the sole value
+ of the Null type, namely null.
+
+ Author: christine@netscape.com
+ Date: 21 october 1997
+*/
+var SECTION = "7.7.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Null Literals";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "null", null, null);
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.2.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.2.js
new file mode 100644
index 0000000000..f021eb9b18
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.2.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.7.2.js';
+
+/**
+ File Name: 7.7.2.js
+ ECMA Section: 7.7.2 Boolean Literals
+
+ Description: BooleanLiteral::
+ true
+ false
+
+ The value of the Boolean literal true is a value of the
+ Boolean type, namely true.
+
+ The value of the Boolean literal false is a value of the
+ Boolean type, namely false.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "7.7.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean Literals";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// StringLiteral:: "" and ''
+
+new TestCase( SECTION, "true", Boolean(true), true );
+new TestCase( SECTION, "false", Boolean(false), false );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js
new file mode 100644
index 0000000000..3eacb2990f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.7.3-1.js';
+
+/**
+ File Name: 7.7.3-1.js
+ ECMA Section: 7.7.3 Numeric Literals
+
+ Description: A numeric literal stands for a value of the Number type
+ This value is determined in two steps: first a
+ mathematical value (MV) is derived from the literal;
+ second, this mathematical value is rounded, ideally
+ using IEEE 754 round-to-nearest mode, to a reprentable
+ value of of the number type.
+
+ These test cases came from Waldemar.
+
+ Author: christine@netscape.com
+ Date: 12 June 1998
+*/
+
+var SECTION = "7.7.3-1";
+var VERSION = "ECMA_1";
+var TITLE = "Numeric Literals";
+var BUGNUMBER="122877";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "0x12345678",
+ 305419896,
+ 0x12345678 );
+
+new TestCase( SECTION,
+ "0x80000000",
+ 2147483648,
+ 0x80000000 );
+
+new TestCase( SECTION,
+ "0xffffffff",
+ 4294967295,
+ 0xffffffff );
+
+new TestCase( SECTION,
+ "0x100000000",
+ 4294967296,
+ 0x100000000 );
+
+new TestCase( SECTION,
+ "0x1fffffffffffff",
+ 9007199254740991,
+ 0x1fffffffffffff );
+
+new TestCase( SECTION,
+ "0x20000000000000",
+ 9007199254740992,
+ 0x20000000000000 );
+
+new TestCase( SECTION,
+ "0x20123456789abc",
+ 9027215253084860,
+ 0x20123456789abc );
+
+new TestCase( SECTION,
+ "0x20123456789abd",
+ 9027215253084860,
+ 0x20123456789abd );
+
+new TestCase( SECTION,
+ "0x20123456789abe",
+ 9027215253084862,
+ 0x20123456789abe );
+
+new TestCase( SECTION,
+ "0x20123456789abf",
+ 9027215253084864,
+ 0x20123456789abf );
+
+new TestCase( SECTION,
+ "0x1000000000000080",
+ 1152921504606847000,
+ 0x1000000000000080 );
+
+new TestCase( SECTION,
+ "0x1000000000000081",
+ 1152921504606847200,
+ 0x1000000000000081 );
+
+new TestCase( SECTION,
+ "0x1000000000000100",
+ 1152921504606847200,
+ 0x1000000000000100 );
+
+new TestCase( SECTION,
+ "0x100000000000017f",
+ 1152921504606847200,
+ 0x100000000000017f );
+
+new TestCase( SECTION,
+ "0x1000000000000180",
+ 1152921504606847500,
+ 0x1000000000000180 );
+
+new TestCase( SECTION,
+ "0x1000000000000181",
+ 1152921504606847500,
+ 0x1000000000000181 );
+
+new TestCase( SECTION,
+ "0x10000000000001f0",
+ 1152921504606847500,
+ 0x10000000000001f0 );
+
+new TestCase( SECTION,
+ "0x1000000000000200",
+ 1152921504606847500,
+ 0x1000000000000200 );
+
+new TestCase( SECTION,
+ "0x100000000000027f",
+ 1152921504606847500,
+ 0x100000000000027f );
+
+new TestCase( SECTION,
+ "0x1000000000000280",
+ 1152921504606847500,
+ 0x1000000000000280 );
+
+new TestCase( SECTION,
+ "0x1000000000000281",
+ 1152921504606847700,
+ 0x1000000000000281 );
+
+new TestCase( SECTION,
+ "0x10000000000002ff",
+ 1152921504606847700,
+ 0x10000000000002ff );
+
+new TestCase( SECTION,
+ "0x1000000000000300",
+ 1152921504606847700,
+ 0x1000000000000300 );
+
+new TestCase( SECTION,
+ "0x10000000000000000",
+ 18446744073709552000,
+ 0x10000000000000000 );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js
new file mode 100644
index 0000000000..6121cd54fd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.7.3-2.js';
+
+/**
+ File Name: 7.7.3-2.js
+ ECMA Section: 7.7.3 Numeric Literals
+
+ Description:
+
+ This is a regression test for
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884
+
+ Waldemar's comments:
+
+ A numeric literal that starts with either '08' or '09' is interpreted as a
+ decimal literal; it should be an error instead. (Strictly speaking, according
+ to ECMA v1 such literals should be interpreted as two integers -- a zero
+ followed by a decimal number whose first digit is 8 or 9, but this is a bug in
+ ECMA that will be fixed in v2. In any case, there is no place in the grammar
+ where two consecutive numbers would be legal.)
+
+ Author: christine@netscape.com
+ Date: 15 june 1998
+
+*/
+var SECTION = "7.7.3-2";
+var VERSION = "ECMA_1";
+var TITLE = "Numeric Literals";
+var BUGNUMBER="122884";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "9",
+ 9,
+ 9 );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js
new file mode 100644
index 0000000000..29635596e1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.7.3.js';
+
+/**
+ File Name: 7.7.3.js
+ ECMA Section: 7.7.3 Numeric Literals
+
+ Description: A numeric literal stands for a value of the Number type
+ This value is determined in two steps: first a
+ mathematical value (MV) is derived from the literal;
+ second, this mathematical value is rounded, ideally
+ using IEEE 754 round-to-nearest mode, to a reprentable
+ value of of the number type.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "7.7.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Numeric Literals";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "0", 0, 0 );
+new TestCase( SECTION, "1", 1, 1 );
+new TestCase( SECTION, "2", 2, 2 );
+new TestCase( SECTION, "3", 3, 3 );
+new TestCase( SECTION, "4", 4, 4 );
+new TestCase( SECTION, "5", 5, 5 );
+new TestCase( SECTION, "6", 6, 6 );
+new TestCase( SECTION, "7", 7, 7 );
+new TestCase( SECTION, "8", 8, 8 );
+new TestCase( SECTION, "9", 9, 9 );
+
+new TestCase( SECTION, "0.", 0, 0. );
+new TestCase( SECTION, "1.", 1, 1. );
+new TestCase( SECTION, "2.", 2, 2. );
+new TestCase( SECTION, "3.", 3, 3. );
+new TestCase( SECTION, "4.", 4, 4. );
+
+new TestCase( SECTION, "0.e0", 0, 0.e0 );
+new TestCase( SECTION, "1.e1", 10, 1.e1 );
+new TestCase( SECTION, "2.e2", 200, 2.e2 );
+new TestCase( SECTION, "3.e3", 3000, 3.e3 );
+new TestCase( SECTION, "4.e4", 40000, 4.e4 );
+
+new TestCase( SECTION, "0.1e0", .1, 0.1e0 );
+new TestCase( SECTION, "1.1e1", 11, 1.1e1 );
+new TestCase( SECTION, "2.2e2", 220, 2.2e2 );
+new TestCase( SECTION, "3.3e3", 3300, 3.3e3 );
+new TestCase( SECTION, "4.4e4", 44000, 4.4e4 );
+
+new TestCase( SECTION, ".1e0", .1, .1e0 );
+new TestCase( SECTION, ".1e1", 1, .1e1 );
+new TestCase( SECTION, ".2e2", 20, .2e2 );
+new TestCase( SECTION, ".3e3", 300, .3e3 );
+new TestCase( SECTION, ".4e4", 4000, .4e4 );
+
+new TestCase( SECTION, "0e0", 0, 0e0 );
+new TestCase( SECTION, "1e1", 10, 1e1 );
+new TestCase( SECTION, "2e2", 200, 2e2 );
+new TestCase( SECTION, "3e3", 3000, 3e3 );
+new TestCase( SECTION, "4e4", 40000, 4e4 );
+
+new TestCase( SECTION, "0e0", 0, 0e0 );
+new TestCase( SECTION, "1e1", 10, 1e1 );
+new TestCase( SECTION, "2e2", 200, 2e2 );
+new TestCase( SECTION, "3e3", 3000, 3e3 );
+new TestCase( SECTION, "4e4", 40000, 4e4 );
+
+new TestCase( SECTION, "0E0", 0, 0E0 );
+new TestCase( SECTION, "1E1", 10, 1E1 );
+new TestCase( SECTION, "2E2", 200, 2E2 );
+new TestCase( SECTION, "3E3", 3000, 3E3 );
+new TestCase( SECTION, "4E4", 40000, 4E4 );
+
+new TestCase( SECTION, "1.e-1", 0.1, 1.e-1 );
+new TestCase( SECTION, "2.e-2", 0.02, 2.e-2 );
+new TestCase( SECTION, "3.e-3", 0.003, 3.e-3 );
+new TestCase( SECTION, "4.e-4", 0.0004, 4.e-4 );
+
+new TestCase( SECTION, "0.1e-0", .1, 0.1e-0 );
+new TestCase( SECTION, "1.1e-1", 0.11, 1.1e-1 );
+new TestCase( SECTION, "2.2e-2", .022, 2.2e-2 );
+new TestCase( SECTION, "3.3e-3", .0033, 3.3e-3 );
+new TestCase( SECTION, "4.4e-4", .00044, 4.4e-4 );
+
+new TestCase( SECTION, ".1e-0", .1, .1e-0 );
+new TestCase( SECTION, ".1e-1", .01, .1e-1 );
+new TestCase( SECTION, ".2e-2", .002, .2e-2 );
+new TestCase( SECTION, ".3e-3", .0003, .3e-3 );
+new TestCase( SECTION, ".4e-4", .00004, .4e-4 );
+
+new TestCase( SECTION, "1.e+1", 10, 1.e+1 );
+new TestCase( SECTION, "2.e+2", 200, 2.e+2 );
+new TestCase( SECTION, "3.e+3", 3000, 3.e+3 );
+new TestCase( SECTION, "4.e+4", 40000, 4.e+4 );
+
+new TestCase( SECTION, "0.1e+0", .1, 0.1e+0 );
+new TestCase( SECTION, "1.1e+1", 11, 1.1e+1 );
+new TestCase( SECTION, "2.2e+2", 220, 2.2e+2 );
+new TestCase( SECTION, "3.3e+3", 3300, 3.3e+3 );
+new TestCase( SECTION, "4.4e+4", 44000, 4.4e+4 );
+
+new TestCase( SECTION, ".1e+0", .1, .1e+0 );
+new TestCase( SECTION, ".1e+1", 1, .1e+1 );
+new TestCase( SECTION, ".2e+2", 20, .2e+2 );
+new TestCase( SECTION, ".3e+3", 300, .3e+3 );
+new TestCase( SECTION, ".4e+4", 4000, .4e+4 );
+
+new TestCase( SECTION, "0x0", 0, 0x0 );
+new TestCase( SECTION, "0x1", 1, 0x1 );
+new TestCase( SECTION, "0x2", 2, 0x2 );
+new TestCase( SECTION, "0x3", 3, 0x3 );
+new TestCase( SECTION, "0x4", 4, 0x4 );
+new TestCase( SECTION, "0x5", 5, 0x5 );
+new TestCase( SECTION, "0x6", 6, 0x6 );
+new TestCase( SECTION, "0x7", 7, 0x7 );
+new TestCase( SECTION, "0x8", 8, 0x8 );
+new TestCase( SECTION, "0x9", 9, 0x9 );
+new TestCase( SECTION, "0xa", 10, 0xa );
+new TestCase( SECTION, "0xb", 11, 0xb );
+new TestCase( SECTION, "0xc", 12, 0xc );
+new TestCase( SECTION, "0xd", 13, 0xd );
+new TestCase( SECTION, "0xe", 14, 0xe );
+new TestCase( SECTION, "0xf", 15, 0xf );
+
+new TestCase( SECTION, "0X0", 0, 0X0 );
+new TestCase( SECTION, "0X1", 1, 0X1 );
+new TestCase( SECTION, "0X2", 2, 0X2 );
+new TestCase( SECTION, "0X3", 3, 0X3 );
+new TestCase( SECTION, "0X4", 4, 0X4 );
+new TestCase( SECTION, "0X5", 5, 0X5 );
+new TestCase( SECTION, "0X6", 6, 0X6 );
+new TestCase( SECTION, "0X7", 7, 0X7 );
+new TestCase( SECTION, "0X8", 8, 0X8 );
+new TestCase( SECTION, "0X9", 9, 0X9 );
+new TestCase( SECTION, "0Xa", 10, 0Xa );
+new TestCase( SECTION, "0Xb", 11, 0Xb );
+new TestCase( SECTION, "0Xc", 12, 0Xc );
+new TestCase( SECTION, "0Xd", 13, 0Xd );
+new TestCase( SECTION, "0Xe", 14, 0Xe );
+new TestCase( SECTION, "0Xf", 15, 0Xf );
+
+new TestCase( SECTION, "0x0", 0, 0x0 );
+new TestCase( SECTION, "0x1", 1, 0x1 );
+new TestCase( SECTION, "0x2", 2, 0x2 );
+new TestCase( SECTION, "0x3", 3, 0x3 );
+new TestCase( SECTION, "0x4", 4, 0x4 );
+new TestCase( SECTION, "0x5", 5, 0x5 );
+new TestCase( SECTION, "0x6", 6, 0x6 );
+new TestCase( SECTION, "0x7", 7, 0x7 );
+new TestCase( SECTION, "0x8", 8, 0x8 );
+new TestCase( SECTION, "0x9", 9, 0x9 );
+new TestCase( SECTION, "0xA", 10, 0xA );
+new TestCase( SECTION, "0xB", 11, 0xB );
+new TestCase( SECTION, "0xC", 12, 0xC );
+new TestCase( SECTION, "0xD", 13, 0xD );
+new TestCase( SECTION, "0xE", 14, 0xE );
+new TestCase( SECTION, "0xF", 15, 0xF );
+
+new TestCase( SECTION, "0X0", 0, 0X0 );
+new TestCase( SECTION, "0X1", 1, 0X1 );
+new TestCase( SECTION, "0X2", 2, 0X2 );
+new TestCase( SECTION, "0X3", 3, 0X3 );
+new TestCase( SECTION, "0X4", 4, 0X4 );
+new TestCase( SECTION, "0X5", 5, 0X5 );
+new TestCase( SECTION, "0X6", 6, 0X6 );
+new TestCase( SECTION, "0X7", 7, 0X7 );
+new TestCase( SECTION, "0X8", 8, 0X8 );
+new TestCase( SECTION, "0X9", 9, 0X9 );
+new TestCase( SECTION, "0XA", 10, 0XA );
+new TestCase( SECTION, "0XB", 11, 0XB );
+new TestCase( SECTION, "0XC", 12, 0XC );
+new TestCase( SECTION, "0XD", 13, 0XD );
+new TestCase( SECTION, "0XE", 14, 0XE );
+new TestCase( SECTION, "0XF", 15, 0XF );
+
+
+new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 );
+new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 );
+
+
+new TestCase( SECTION,
+ "123456789012345671.9999",
+ "123456789012345660",
+ 123456789012345671.9999 +"");
+new TestCase( SECTION,
+ "123456789012345672",
+ "123456789012345660",
+ 123456789012345672 +"");
+
+new TestCase( SECTION,
+ "123456789012345672.000000000000000000000000000",
+ "123456789012345660",
+ 123456789012345672.000000000000000000000000000 +"");
+
+new TestCase( SECTION,
+ "123456789012345672.01",
+ "123456789012345680",
+ 123456789012345672.01 +"");
+
+new TestCase( SECTION,
+ "123456789012345672.000000000000000000000000001+'' == 123456789012345680 || 123456789012345660",
+ true,
+ ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345680 )
+ ||
+ ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345660) );
+
+new TestCase( SECTION,
+ "123456789012345673",
+ "123456789012345680",
+ 123456789012345673 +"" );
+
+new TestCase( SECTION,
+ "-123456789012345671.9999",
+ "-123456789012345660",
+ -123456789012345671.9999 +"" );
+
+new TestCase( SECTION,
+ "-123456789012345672",
+ "-123456789012345660",
+ -123456789012345672+"");
+
+new TestCase( SECTION,
+ "-123456789012345672.000000000000000000000000000",
+ "-123456789012345660",
+ -123456789012345672.000000000000000000000000000 +"");
+
+new TestCase( SECTION,
+ "-123456789012345672.01",
+ "-123456789012345680",
+ -123456789012345672.01 +"" );
+
+new TestCase( SECTION,
+ "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660",
+ true,
+ (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680)
+ ||
+ (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660));
+
+new TestCase( SECTION,
+ -123456789012345673,
+ "-123456789012345680",
+ -123456789012345673 +"");
+
+new TestCase( SECTION,
+ "12345678901234567890",
+ "12345678901234567000",
+ 12345678901234567890 +"" );
+
+
+/*
+ new TestCase( SECTION, "12345678901234567", "12345678901234567", 12345678901234567+"" );
+ new TestCase( SECTION, "123456789012345678", "123456789012345678", 123456789012345678+"" );
+ new TestCase( SECTION, "1234567890123456789", "1234567890123456789", 1234567890123456789+"" );
+ new TestCase( SECTION, "12345678901234567890", "12345678901234567890", 12345678901234567890+"" );
+ new TestCase( SECTION, "123456789012345678900", "123456789012345678900", 123456789012345678900+"" );
+ new TestCase( SECTION, "1234567890123456789000", "1234567890123456789000", 1234567890123456789000+"" );
+*/
+new TestCase( SECTION, "0x1", 1, 0x1 );
+new TestCase( SECTION, "0x10", 16, 0x10 );
+new TestCase( SECTION, "0x100", 256, 0x100 );
+new TestCase( SECTION, "0x1000", 4096, 0x1000 );
+new TestCase( SECTION, "0x10000", 65536, 0x10000 );
+new TestCase( SECTION, "0x100000", 1048576, 0x100000 );
+new TestCase( SECTION, "0x1000000", 16777216, 0x1000000 );
+new TestCase( SECTION, "0x10000000", 268435456, 0x10000000 );
+/*
+ new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 );
+ new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 );
+ new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 );
+*/
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js
new file mode 100644
index 0000000000..4b799f8df1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js
@@ -0,0 +1,220 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.7.4.js';
+
+/**
+ File Name: 7.7.4.js
+ ECMA Section: 7.7.4 String Literals
+
+ Description: A string literal is zero or more characters enclosed in
+ single or double quotes. Each character may be
+ represented by an escape sequence.
+
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "7.7.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String Literals";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// StringLiteral:: "" and ''
+
+new TestCase( SECTION, "\"\"", "", "" );
+new TestCase( SECTION, "\'\'", "", '' );
+
+// DoubleStringCharacters:: DoubleStringCharacter :: EscapeSequence :: CharacterEscapeSequence
+new TestCase( SECTION, "\\\"", String.fromCharCode(0x0022), "\"" );
+new TestCase( SECTION, "\\\'", String.fromCharCode(0x0027), "\'" );
+new TestCase( SECTION, "\\", String.fromCharCode(0x005C), "\\" );
+new TestCase( SECTION, "\\b", String.fromCharCode(0x0008), "\b" );
+new TestCase( SECTION, "\\f", String.fromCharCode(0x000C), "\f" );
+new TestCase( SECTION, "\\n", String.fromCharCode(0x000A), "\n" );
+new TestCase( SECTION, "\\r", String.fromCharCode(0x000D), "\r" );
+new TestCase( SECTION, "\\t", String.fromCharCode(0x0009), "\t" );
+new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" );
+
+// DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence
+
+
+// DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence
+/*
+ new TestCase( SECTION, "\\x0", String.fromCharCode(0), "\x0" );
+ new TestCase( SECTION, "\\x1", String.fromCharCode(1), "\x1" );
+ new TestCase( SECTION, "\\x2", String.fromCharCode(2), "\x2" );
+ new TestCase( SECTION, "\\x3", String.fromCharCode(3), "\x3" );
+ new TestCase( SECTION, "\\x4", String.fromCharCode(4), "\x4" );
+ new TestCase( SECTION, "\\x5", String.fromCharCode(5), "\x5" );
+ new TestCase( SECTION, "\\x6", String.fromCharCode(6), "\x6" );
+ new TestCase( SECTION, "\\x7", String.fromCharCode(7), "\x7" );
+ new TestCase( SECTION, "\\x8", String.fromCharCode(8), "\x8" );
+ new TestCase( SECTION, "\\x9", String.fromCharCode(9), "\x9" );
+ new TestCase( SECTION, "\\xA", String.fromCharCode(10), "\xA" );
+ new TestCase( SECTION, "\\xB", String.fromCharCode(11), "\xB" );
+ new TestCase( SECTION, "\\xC", String.fromCharCode(12), "\xC" );
+ new TestCase( SECTION, "\\xD", String.fromCharCode(13), "\xD" );
+ new TestCase( SECTION, "\\xE", String.fromCharCode(14), "\xE" );
+ new TestCase( SECTION, "\\xF", String.fromCharCode(15), "\xF" );
+
+*/
+new TestCase( SECTION, "\\xF0", String.fromCharCode(240), "\xF0" );
+new TestCase( SECTION, "\\xE1", String.fromCharCode(225), "\xE1" );
+new TestCase( SECTION, "\\xD2", String.fromCharCode(210), "\xD2" );
+new TestCase( SECTION, "\\xC3", String.fromCharCode(195), "\xC3" );
+new TestCase( SECTION, "\\xB4", String.fromCharCode(180), "\xB4" );
+new TestCase( SECTION, "\\xA5", String.fromCharCode(165), "\xA5" );
+new TestCase( SECTION, "\\x96", String.fromCharCode(150), "\x96" );
+new TestCase( SECTION, "\\x87", String.fromCharCode(135), "\x87" );
+new TestCase( SECTION, "\\x78", String.fromCharCode(120), "\x78" );
+new TestCase( SECTION, "\\x69", String.fromCharCode(105), "\x69" );
+new TestCase( SECTION, "\\x5A", String.fromCharCode(90), "\x5A" );
+new TestCase( SECTION, "\\x4B", String.fromCharCode(75), "\x4B" );
+new TestCase( SECTION, "\\x3C", String.fromCharCode(60), "\x3C" );
+new TestCase( SECTION, "\\x2D", String.fromCharCode(45), "\x2D" );
+new TestCase( SECTION, "\\x1E", String.fromCharCode(30), "\x1E" );
+new TestCase( SECTION, "\\x0F", String.fromCharCode(15), "\x0F" );
+
+// string literals only take up to two hext digits. therefore, the third character in this string
+// should be interpreted as a StringCharacter and not part of the HextEscapeSequence
+
+new TestCase( SECTION, "\\xF0F", String.fromCharCode(240)+"F", "\xF0F" );
+new TestCase( SECTION, "\\xE1E", String.fromCharCode(225)+"E", "\xE1E" );
+new TestCase( SECTION, "\\xD2D", String.fromCharCode(210)+"D", "\xD2D" );
+new TestCase( SECTION, "\\xC3C", String.fromCharCode(195)+"C", "\xC3C" );
+new TestCase( SECTION, "\\xB4B", String.fromCharCode(180)+"B", "\xB4B" );
+new TestCase( SECTION, "\\xA5A", String.fromCharCode(165)+"A", "\xA5A" );
+new TestCase( SECTION, "\\x969", String.fromCharCode(150)+"9", "\x969" );
+new TestCase( SECTION, "\\x878", String.fromCharCode(135)+"8", "\x878" );
+new TestCase( SECTION, "\\x787", String.fromCharCode(120)+"7", "\x787" );
+new TestCase( SECTION, "\\x696", String.fromCharCode(105)+"6", "\x696" );
+new TestCase( SECTION, "\\x5A5", String.fromCharCode(90)+"5", "\x5A5" );
+new TestCase( SECTION, "\\x4B4", String.fromCharCode(75)+"4", "\x4B4" );
+new TestCase( SECTION, "\\x3C3", String.fromCharCode(60)+"3", "\x3C3" );
+new TestCase( SECTION, "\\x2D2", String.fromCharCode(45)+"2", "\x2D2" );
+new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E1" );
+new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" );
+
+// G is out of hex range
+/* Invalid testcase: we no longer silently ignore invalid hexadecimal escape sequences.
+new TestCase( SECTION, "\\xG", "xG", "\xG" );
+new TestCase( SECTION, "\\xCG", "xCG", "\xCG" );
+*/
+
+// DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter
+new TestCase( SECTION, "\\a", "a", "\a" );
+new TestCase( SECTION, "\\c", "c", "\c" );
+new TestCase( SECTION, "\\d", "d", "\d" );
+new TestCase( SECTION, "\\e", "e", "\e" );
+new TestCase( SECTION, "\\g", "g", "\g" );
+new TestCase( SECTION, "\\h", "h", "\h" );
+new TestCase( SECTION, "\\i", "i", "\i" );
+new TestCase( SECTION, "\\j", "j", "\j" );
+new TestCase( SECTION, "\\k", "k", "\k" );
+new TestCase( SECTION, "\\l", "l", "\l" );
+new TestCase( SECTION, "\\m", "m", "\m" );
+new TestCase( SECTION, "\\o", "o", "\o" );
+new TestCase( SECTION, "\\p", "p", "\p" );
+new TestCase( SECTION, "\\q", "q", "\q" );
+new TestCase( SECTION, "\\s", "s", "\s" );
+
+new TestCase( SECTION, "\\w", "w", "\w" );
+new TestCase( SECTION, "\\y", "y", "\y" );
+new TestCase( SECTION, "\\z", "z", "\z" );
+
+new TestCase( SECTION, "\\A", "A", "\A" );
+new TestCase( SECTION, "\\B", "B", "\B" );
+new TestCase( SECTION, "\\C", "C", "\C" );
+new TestCase( SECTION, "\\D", "D", "\D" );
+new TestCase( SECTION, "\\E", "E", "\E" );
+new TestCase( SECTION, "\\F", "F", "\F" );
+new TestCase( SECTION, "\\G", "G", "\G" );
+new TestCase( SECTION, "\\H", "H", "\H" );
+new TestCase( SECTION, "\\I", "I", "\I" );
+new TestCase( SECTION, "\\J", "J", "\J" );
+new TestCase( SECTION, "\\K", "K", "\K" );
+new TestCase( SECTION, "\\L", "L", "\L" );
+new TestCase( SECTION, "\\M", "M", "\M" );
+new TestCase( SECTION, "\\N", "N", "\N" );
+new TestCase( SECTION, "\\O", "O", "\O" );
+new TestCase( SECTION, "\\P", "P", "\P" );
+new TestCase( SECTION, "\\Q", "Q", "\Q" );
+new TestCase( SECTION, "\\R", "R", "\R" );
+new TestCase( SECTION, "\\S", "S", "\S" );
+new TestCase( SECTION, "\\T", "T", "\T" );
+new TestCase( SECTION, "\\U", "U", "\U" );
+new TestCase( SECTION, "\\V", "V", "\V" );
+new TestCase( SECTION, "\\W", "W", "\W" );
+new TestCase( SECTION, "\\X", "X", "\X" );
+new TestCase( SECTION, "\\Y", "Y", "\Y" );
+new TestCase( SECTION, "\\Z", "Z", "\Z" );
+
+// DoubleStringCharacter::EscapeSequence::UnicodeEscapeSequence
+
+new TestCase( SECTION, "\\u0020", " ", "\u0020" );
+new TestCase( SECTION, "\\u0021", "!", "\u0021" );
+new TestCase( SECTION, "\\u0022", "\"", "\u0022" );
+new TestCase( SECTION, "\\u0023", "#", "\u0023" );
+new TestCase( SECTION, "\\u0024", "$", "\u0024" );
+new TestCase( SECTION, "\\u0025", "%", "\u0025" );
+new TestCase( SECTION, "\\u0026", "&", "\u0026" );
+new TestCase( SECTION, "\\u0027", "'", "\u0027" );
+new TestCase( SECTION, "\\u0028", "(", "\u0028" );
+new TestCase( SECTION, "\\u0029", ")", "\u0029" );
+new TestCase( SECTION, "\\u002A", "*", "\u002A" );
+new TestCase( SECTION, "\\u002B", "+", "\u002B" );
+new TestCase( SECTION, "\\u002C", ",", "\u002C" );
+new TestCase( SECTION, "\\u002D", "-", "\u002D" );
+new TestCase( SECTION, "\\u002E", ".", "\u002E" );
+new TestCase( SECTION, "\\u002F", "/", "\u002F" );
+new TestCase( SECTION, "\\u0030", "0", "\u0030" );
+new TestCase( SECTION, "\\u0031", "1", "\u0031" );
+new TestCase( SECTION, "\\u0032", "2", "\u0032" );
+new TestCase( SECTION, "\\u0033", "3", "\u0033" );
+new TestCase( SECTION, "\\u0034", "4", "\u0034" );
+new TestCase( SECTION, "\\u0035", "5", "\u0035" );
+new TestCase( SECTION, "\\u0036", "6", "\u0036" );
+new TestCase( SECTION, "\\u0037", "7", "\u0037" );
+new TestCase( SECTION, "\\u0038", "8", "\u0038" );
+new TestCase( SECTION, "\\u0039", "9", "\u0039" );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.8.2-n.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.8.2-n.js
new file mode 100644
index 0000000000..b8d844e41d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.8.2-n.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '7.8.2-n.js';
+
+/**
+ File Name: 7.8.2.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION="7.8.2";
+var VERSION="ECMA_1"
+ startTest();
+writeHeaderToLog(SECTION+" "+"Examples of Semicolon Insertion");
+
+
+// new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, eval("{ 1 \n 2 } 3") );
+
+DESCRIPTION = "{ 1 2 } 3";
+EXPECTED = "error";
+
+new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/browser.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/shell.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/shell.js
new file mode 100644
index 0000000000..4e1d61d68a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'LexicalConventions';
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8-2-n.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8-2-n.js
new file mode 100644
index 0000000000..40c2ae8d2d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8-2-n.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8-2-n.js';
+
+/**
+ File Name: 15.8-2.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+
+var SECTION = "15.8-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Math Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "MYMATH = new Math()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "MYMATH = new Math()",
+ "error",
+ eval("MYMATH = new Math()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8-3-n.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8-3-n.js
new file mode 100644
index 0000000000..f6333d7ec7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8-3-n.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8-3-n.js';
+
+/**
+ File Name: 15.8-3.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "15.8-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Math Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "MYMATH = Math()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "MYMATH = Math()",
+ "error",
+ eval("MYMATH = Math()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-1.js
new file mode 100644
index 0000000000..f90f74b9e8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-1.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.1-1.js';
+
+/**
+ File Name: 15.8.1.1-1.js
+ ECMA Section: 15.8.1.1.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.E = 0; Math.E",
+ 2.7182818284590452354,
+ eval("Math.E=0;Math.E") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-2.js
new file mode 100644
index 0000000000..9f136f2fb8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.1-2.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.1-2.js';
+
+/**
+ File Name: 15.8.1.1-2.js
+ ECMA Section: 15.8.1.1.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MATH_E = 2.7182818284590452354
+ new TestCase( SECTION,
+ "delete(Math.E)",
+ false,
+ eval("delete Math.E") );
+new TestCase( SECTION,
+ "delete(Math.E); Math.E",
+ MATH_E,
+ eval("delete Math.E; Math.E") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-1.js
new file mode 100644
index 0000000000..0cbc65a4fb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-1.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.2-1.js';
+
+/**
+ File Name: 15.8.1.2-1.js
+ ECMA Section: 15.8.2.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LN10
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN10";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.LN10=0; Math.LN10",
+ 2.302585092994046,
+ eval("Math.LN10=0; Math.LN10") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-2.js
new file mode 100644
index 0000000000..6937b3520b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.2-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.2-2.js';
+
+/**
+ File Name: 15.8.1.2-1.js
+ ECMA Section: 15.8.2.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LN10
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN10";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete( Math.LN10 ); Math.LN10",
+ 2.302585092994046,
+ eval("delete(Math.LN10); Math.LN10") );
+
+new TestCase( SECTION,
+ "delete( Math.LN10 ); ",
+ false,
+ eval("delete(Math.LN10)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-1.js
new file mode 100644
index 0000000000..8289cc2a46
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-1.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.3-1.js';
+
+/**
+ File Name: 15.8.1.3-1.js
+ ECMA Section: 15.8.1.3.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LN2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.LN2=0; Math.LN2",
+ 0.6931471805599453,
+ eval("Math.LN2=0; Math.LN2") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-2.js
new file mode 100644
index 0000000000..24a8b18231
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.3-2.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.3-2.js';
+
+/**
+ File Name: 15.8.1.3-3.js
+ ECMA Section: 15.8.1.3.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LN2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MATH_LN2 = 0.6931471805599453;
+
+new TestCase( SECTION,
+ "delete(Math.LN2)",
+ false,
+ eval("delete(Math.LN2)") );
+
+new TestCase( SECTION,
+ "delete(Math.LN2); Math.LN2",
+ MATH_LN2,
+ eval("delete(Math.LN2); Math.LN2") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-1.js
new file mode 100644
index 0000000000..227dbb3e2a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-1.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.4-1.js';
+
+/**
+ File Name: 15.8.1.4-1.js
+ ECMA Section: 15.8.1.4.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LOG2E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LOG2E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.L0G2E=0; Math.LOG2E",
+ 1.4426950408889634,
+ eval("Math.LOG2E=0; Math.LOG2E") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-2.js
new file mode 100644
index 0000000000..c9aa98e77a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.4-2.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.4-2.js';
+
+/**
+ File Name: 15.8.1.4-2.js
+ ECMA Section: 15.8.1.4.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LOG2E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.4-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LOG2E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete(Math.L0G2E);Math.LOG2E",
+ 1.4426950408889634,
+ eval("delete(Math.LOG2E);Math.LOG2E") );
+new TestCase( SECTION,
+ "delete(Math.L0G2E)",
+ false,
+ eval("delete(Math.LOG2E)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-1.js
new file mode 100644
index 0000000000..b753025c8a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-1.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.5-1.js';
+
+/**
+ File Name: 15.8.1.5-1.js
+ ECMA Section: 15.8.1.5.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LOG10E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.8.1.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LOG10E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.LOG10E=0; Math.LOG10E",
+ 0.4342944819032518,
+ eval("Math.LOG10E=0; Math.LOG10E") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-2.js
new file mode 100644
index 0000000000..c134e4a577
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.5-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.5-2.js';
+
+/**
+ File Name: 15.8.1.5-2.js
+ ECMA Section: 15.8.1.5.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LOG10E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LOG10E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete Math.LOG10E; Math.LOG10E",
+ 0.4342944819032518,
+ eval("delete Math.LOG10E; Math.LOG10E") );
+
+new TestCase( SECTION,
+ "delete Math.LOG10E",
+ false,
+ eval("delete Math.LOG10E") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-1.js
new file mode 100644
index 0000000000..f2a395618c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-1.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.6-1.js';
+
+/**
+ File Name: 15.8.1.6-1.js
+ ECMA Section: 15.8.1.6.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.PI
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.PI";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.PI=0; Math.PI",
+ 3.1415926535897923846,
+ eval("Math.PI=0; Math.PI") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-2.js
new file mode 100644
index 0000000000..ba53e78de5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.6-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.6-2.js';
+
+/**
+ File Name: 15.8.1.6-2.js
+ ECMA Section: 15.8.1.6.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.PI
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.6-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.PI";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete Math.PI; Math.PI",
+ 3.1415926535897923846,
+ eval("delete Math.PI; Math.PI") );
+
+new TestCase( SECTION,
+ "delete Math.PI; Math.PI",
+ false,
+ eval("delete Math.PI") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-1.js
new file mode 100644
index 0000000000..aa60aead5b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-1.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.7-1.js';
+
+/**
+ File Name: 15.8.1.7-1.js
+ ECMA Section: 15.8.1.7.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.SQRT1_2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.7-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT1_2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.SQRT1_2=0; Math.SQRT1_2",
+ 0.7071067811865476,
+ eval("Math.SQRT1_2=0; Math.SQRT1_2") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-2.js
new file mode 100644
index 0000000000..2f8c45c9f9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.7-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.7-2.js';
+
+/**
+ File Name: 15.8.1.7-2.js
+ ECMA Section: 15.8.1.7.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT1_2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.7-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT1_2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete Math.SQRT1_2; Math.SQRT1_2",
+ 0.7071067811865476,
+ eval("delete Math.SQRT1_2; Math.SQRT1_2") );
+
+new TestCase( SECTION,
+ "delete Math.SQRT1_2",
+ false,
+ eval("delete Math.SQRT1_2") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-1.js
new file mode 100644
index 0000000000..3c5764d019
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-1.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.8-1.js';
+
+/**
+ File Name: 15.8.1.8-1.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.8-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.SQRT2=0; Math.SQRT2",
+ 1.4142135623730951,
+ eval("Math.SQRT2=0; Math.SQRT2") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-2.js
new file mode 100644
index 0000000000..f999dac920
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-2.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.8-2.js';
+
+/**
+ File Name: 15.8.1.8-2.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.8-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete Math.SQRT2; Math.SQRT2",
+ 1.4142135623730951,
+ eval("delete Math.SQRT2; Math.SQRT2") );
+
+new TestCase( SECTION,
+ "delete Math.SQRT2",
+ false,
+ eval("delete Math.SQRT2") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-3.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-3.js
new file mode 100644
index 0000000000..0c823aea57
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.8-3.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.8-3.js';
+
+/**
+ File Name: 15.8.1.8-3.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.8-3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete");
+
+new TestCase( SECTION,
+ "delete Math.SQRT2",
+ false,
+ eval("delete Math.SQRT2") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.js
new file mode 100644
index 0000000000..009325640b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.1.js
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.1.js';
+
+/**
+ File Name: 15.8.1.js
+ ECMA Section: 15.8.1.js Value Properties of the Math Object
+ 15.8.1.1 E
+ 15.8.1.2 LN10
+ 15.8.1.3 LN2
+ 15.8.1.4 LOG2E
+ 15.8.1.5 LOG10E
+ 15.8.1.6 PI
+ 15.8.1.7 SQRT1_2
+ 15.8.1.8 SQRT2
+ Description: verify the values of some math constants
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.1"
+ var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Value Properties of the Math Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( "15.8.1.1", "Math.E",
+ 2.7182818284590452354,
+ Math.E );
+
+new TestCase( "15.8.1.1",
+ "typeof Math.E",
+ "number",
+ typeof Math.E );
+
+new TestCase( "15.8.1.2",
+ "Math.LN10",
+ 2.302585092994046,
+ Math.LN10 );
+
+new TestCase( "15.8.1.2",
+ "typeof Math.LN10",
+ "number",
+ typeof Math.LN10 );
+
+new TestCase( "15.8.1.3",
+ "Math.LN2",
+ 0.6931471805599453,
+ Math.LN2 );
+
+new TestCase( "15.8.1.3",
+ "typeof Math.LN2",
+ "number",
+ typeof Math.LN2 );
+
+new TestCase( "15.8.1.4",
+ "Math.LOG2E",
+ 1.4426950408889634,
+ Math.LOG2E );
+
+new TestCase( "15.8.1.4",
+ "typeof Math.LOG2E",
+ "number",
+ typeof Math.LOG2E );
+
+new TestCase( "15.8.1.5",
+ "Math.LOG10E",
+ 0.4342944819032518,
+ Math.LOG10E);
+
+new TestCase( "15.8.1.5",
+ "typeof Math.LOG10E",
+ "number",
+ typeof Math.LOG10E);
+
+new TestCase( "15.8.1.6",
+ "Math.PI",
+ 3.14159265358979323846,
+ Math.PI );
+
+new TestCase( "15.8.1.6",
+ "typeof Math.PI",
+ "number",
+ typeof Math.PI );
+
+new TestCase( "15.8.1.7",
+ "Math.SQRT1_2",
+ 0.7071067811865476,
+ Math.SQRT1_2);
+
+new TestCase( "15.8.1.7",
+ "typeof Math.SQRT1_2",
+ "number",
+ typeof Math.SQRT1_2);
+
+new TestCase( "15.8.1.8",
+ "Math.SQRT2",
+ 1.4142135623730951,
+ Math.SQRT2 );
+
+new TestCase( "15.8.1.8",
+ "typeof Math.SQRT2",
+ "number",
+ typeof Math.SQRT2 );
+
+new TestCase( SECTION,
+ "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
+ "",
+ eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js
new file mode 100644
index 0000000000..abe1095d40
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.1.js';
+
+/**
+ File Name: 15.8.2.1.js
+ ECMA Section: 15.8.2.1 abs( x )
+ Description: return the absolute value of the argument,
+ which should be the magnitude of the argument
+ with a positive sign.
+ - if x is NaN, return NaN
+ - if x is -0, result is +0
+ - if x is -Infinity, result is +Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+var SECTION = "15.8.2.1";
+var VERSION = "ECMA_1";
+var TITLE = "Math.abs()";
+var BUGNUMBER = "77391";
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.abs.length",
+ 1,
+ Math.abs.length );
+
+new TestCase( SECTION,
+ "Math.abs()",
+ Number.NaN,
+ Math.abs() );
+
+new TestCase( SECTION,
+ "Math.abs( void 0 )",
+ Number.NaN,
+ Math.abs(void 0) );
+
+new TestCase( SECTION,
+ "Math.abs( null )",
+ 0,
+ Math.abs(null) );
+
+new TestCase( SECTION,
+ "Math.abs( true )",
+ 1,
+ Math.abs(true) );
+
+new TestCase( SECTION,
+ "Math.abs( false )",
+ 0,
+ Math.abs(false) );
+
+new TestCase( SECTION,
+ "Math.abs( string primitive)",
+ Number.NaN,
+ Math.abs("a string primitive") );
+
+new TestCase( SECTION,
+ "Math.abs( string object )",
+ Number.NaN,
+ Math.abs(new String( 'a String object' )) );
+
+new TestCase( SECTION,
+ "Math.abs( Number.NaN )",
+ Number.NaN,
+ Math.abs(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.abs(0)",
+ 0,
+ Math.abs( 0 ) );
+
+new TestCase( SECTION,
+ "Math.abs( -0 )",
+ 0,
+ Math.abs(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.abs(-0)",
+ Infinity,
+ Infinity/Math.abs(-0) );
+
+new TestCase( SECTION,
+ "Math.abs( -Infinity )",
+ Number.POSITIVE_INFINITY,
+ Math.abs( Number.NEGATIVE_INFINITY ) );
+
+new TestCase( SECTION,
+ "Math.abs( Infinity )",
+ Number.POSITIVE_INFINITY,
+ Math.abs( Number.POSITIVE_INFINITY ) );
+
+new TestCase( SECTION,
+ "Math.abs( - MAX_VALUE )",
+ Number.MAX_VALUE,
+ Math.abs( - Number.MAX_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( - MIN_VALUE )",
+ Number.MIN_VALUE,
+ Math.abs( -Number.MIN_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( MAX_VALUE )",
+ Number.MAX_VALUE,
+ Math.abs( Number.MAX_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( MIN_VALUE )",
+ Number.MIN_VALUE,
+ Math.abs( Number.MIN_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( -1 )",
+ 1,
+ Math.abs( -1 ) );
+
+new TestCase( SECTION,
+ "Math.abs( new Number( -1 ) )",
+ 1,
+ Math.abs( new Number(-1) ) );
+
+new TestCase( SECTION,
+ "Math.abs( 1 )",
+ 1,
+ Math.abs( 1 ) );
+
+new TestCase( SECTION,
+ "Math.abs( Math.PI )",
+ Math.PI,
+ Math.abs( Math.PI ) );
+
+new TestCase( SECTION,
+ "Math.abs( -Math.PI )",
+ Math.PI,
+ Math.abs( -Math.PI ) );
+
+new TestCase( SECTION,
+ "Math.abs(-1/100000000)",
+ 1/100000000,
+ Math.abs(-1/100000000) );
+
+new TestCase( SECTION,
+ "Math.abs(-Math.pow(2,32))",
+ Math.pow(2,32),
+ Math.abs(-Math.pow(2,32)) );
+
+new TestCase( SECTION,
+ "Math.abs(Math.pow(2,32))",
+ Math.pow(2,32),
+ Math.abs(Math.pow(2,32)) );
+
+new TestCase( SECTION,
+ "Math.abs( -0xfff )",
+ 4095,
+ Math.abs( -0xfff ) );
+
+new TestCase( SECTION,
+ "Math.abs('-1e-1')",
+ 0.1,
+ Math.abs('-1e-1') );
+
+new TestCase( SECTION,
+ "Math.abs('0xff')",
+ 255,
+ Math.abs('0xff') );
+
+new TestCase( SECTION,
+ "Math.abs('077')",
+ 77,
+ Math.abs('077') );
+
+new TestCase( SECTION,
+ "Math.abs( 'Infinity' )",
+ Infinity,
+ Math.abs('Infinity') );
+
+new TestCase( SECTION,
+ "Math.abs( '-Infinity' )",
+ Infinity,
+ Math.abs('-Infinity') );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.10.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.10.js
new file mode 100644
index 0000000000..05d4c187c9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.10.js
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.10.js';
+
+/**
+ File Name: 15.8.2.10.js
+ ECMA Section: 15.8.2.10 Math.log(x)
+ Description: return an approximiation to the natural logarithm of
+ the argument.
+ special cases:
+ - if arg is NaN result is NaN
+ - if arg is <0 result is NaN
+ - if arg is 0 or -0 result is -Infinity
+ - if arg is 1 result is 0
+ - if arg is Infinity result is Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.10";
+var VERSION = "ECMA_1";
+var TITLE = "Math.log(x)";
+var BUGNUMBER = "77391";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION,
+ "Math.log.length",
+ 1,
+ Math.log.length );
+
+
+new TestCase( SECTION,
+ "Math.log()",
+ Number.NaN,
+ Math.log() );
+
+new TestCase( SECTION,
+ "Math.log(void 0)",
+ Number.NaN,
+ Math.log(void 0) );
+
+new TestCase( SECTION,
+ "Math.log(null)",
+ Number.NEGATIVE_INFINITY,
+ Math.log(null) );
+
+new TestCase( SECTION,
+ "Math.log(true)",
+ 0,
+ Math.log(true) );
+
+new TestCase( SECTION,
+ "Math.log(false)",
+ -Infinity,
+ Math.log(false) );
+
+new TestCase( SECTION,
+ "Math.log('0')",
+ -Infinity,
+ Math.log('0') );
+
+new TestCase( SECTION,
+ "Math.log('1')",
+ 0,
+ Math.log('1') );
+
+new TestCase( SECTION,
+ "Math.log('Infinity')",
+ Infinity,
+ Math.log("Infinity") );
+
+
+new TestCase( SECTION,
+ "Math.log(NaN)",
+ Number.NaN,
+ Math.log(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.log(-0.0000001)",
+ Number.NaN,
+ Math.log(-0.000001) );
+
+new TestCase( SECTION,
+ "Math.log(-1)",
+ Number.NaN,
+ Math.log(-1) );
+
+new TestCase( SECTION,
+ "Math.log(0)",
+ Number.NEGATIVE_INFINITY,
+ Math.log(0) );
+
+new TestCase( SECTION,
+ "Math.log(-0)",
+ Number.NEGATIVE_INFINITY,
+ Math.log(-0));
+
+new TestCase( SECTION,
+ "Math.log(1)",
+ 0,
+ Math.log(1) );
+
+new TestCase( SECTION,
+ "Math.log(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.log(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.log(-Infinity)",
+ Number.NaN,
+ Math.log(Number.NEGATIVE_INFINITY) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.11.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.11.js
new file mode 100644
index 0000000000..5a957b3de4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.11.js
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.11.js';
+
+/**
+ File Name: 15.8.2.11.js
+ ECMA Section: 15.8.2.11 Math.max(x, y)
+ Description: return the smaller of the two arguments.
+ special cases:
+ - if x is NaN or y is NaN return NaN
+ - if x < y return x
+ - if y > x return y
+ - if x is +0 and y is +0 return +0
+ - if x is +0 and y is -0 return -0
+ - if x is -0 and y is +0 return -0
+ - if x is -0 and y is -0 return -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.11";
+var VERSION = "ECMA_1";
+var TITLE = "Math.max(x, y)";
+var BUGNUMBER="76439";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.max.length",
+ 2,
+ Math.max.length );
+
+new TestCase( SECTION,
+ "Math.max()",
+ -Infinity,
+ Math.max() );
+
+new TestCase( SECTION,
+ "Math.max(void 0, 1)",
+ Number.NaN,
+ Math.max( void 0, 1 ) );
+
+new TestCase( SECTION,
+ "Math.max(void 0, void 0)",
+ Number.NaN,
+ Math.max( void 0, void 0 ) );
+
+new TestCase( SECTION,
+ "Math.max(null, 1)",
+ 1,
+ Math.max( null, 1 ) );
+
+new TestCase( SECTION,
+ "Math.max(-1, null)",
+ 0,
+ Math.max( -1, null ) );
+
+new TestCase( SECTION,
+ "Math.max(true, false)",
+ 1,
+ Math.max(true,false) );
+
+new TestCase( SECTION,
+ "Math.max('-99','99')",
+ 99,
+ Math.max( "-99","99") );
+
+new TestCase( SECTION,
+ "Math.max(NaN, Infinity)",
+ Number.NaN,
+ Math.max(Number.NaN,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(NaN, 0)",
+ Number.NaN,
+ Math.max(Number.NaN, 0) );
+
+new TestCase( SECTION,
+ "Math.max('a string', 0)",
+ Number.NaN,
+ Math.max("a string", 0) );
+
+new TestCase( SECTION,
+ "Math.max(NaN, 1)",
+ Number.NaN,
+ Math.max(Number.NaN,1) );
+
+new TestCase( SECTION,
+ "Math.max('a string',Infinity)",
+ Number.NaN,
+ Math.max("a string", Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(Infinity, NaN)",
+ Number.NaN,
+ Math.max( Number.POSITIVE_INFINITY, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(NaN, NaN)",
+ Number.NaN,
+ Math.max(Number.NaN, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(0,NaN)",
+ Number.NaN,
+ Math.max(0,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(1, NaN)",
+ Number.NaN,
+ Math.max(1, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(0,0)",
+ 0,
+ Math.max(0,0) );
+
+new TestCase( SECTION,
+ "Math.max(0,-0)",
+ 0,
+ Math.max(0,-0) );
+
+new TestCase( SECTION,
+ "Math.max(-0,0)",
+ 0,
+ Math.max(-0,0) );
+
+new TestCase( SECTION,
+ "Math.max(-0,-0)",
+ -0,
+ Math.max(-0,-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.max(-0,-0)",
+ -Infinity,
+ Infinity/Math.max(-0,-0) );
+
+new TestCase( SECTION,
+ "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY,
+ Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) );
+
+new TestCase( SECTION,
+ "Math.max(Infinity, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(-Infinity,-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(1,.99999999999999)",
+ 1,
+ Math.max(1,.99999999999999) );
+
+new TestCase( SECTION,
+ "Math.max(-1,-.99999999999999)",
+ -.99999999999999,
+ Math.max(-1,-.99999999999999) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.12.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.12.js
new file mode 100644
index 0000000000..a33a5aca4a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.12.js
@@ -0,0 +1,177 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.12.js';
+
+/**
+ File Name: 15.8.2.12.js
+ ECMA Section: 15.8.2.12 Math.min(x, y)
+ Description: return the smaller of the two arguments.
+ special cases:
+ - if x is NaN or y is NaN return NaN
+ - if x < y return x
+ - if y > x return y
+ - if x is +0 and y is +0 return +0
+ - if x is +0 and y is -0 return -0
+ - if x is -0 and y is +0 return -0
+ - if x is -0 and y is -0 return -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+
+var SECTION = "15.8.2.12";
+var VERSION = "ECMA_1";
+var TITLE = "Math.min(x, y)";
+var BUGNUMBER="76439";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.min.length",
+ 2,
+ Math.min.length );
+
+new TestCase( SECTION,
+ "Math.min()",
+ Infinity,
+ Math.min() );
+
+new TestCase( SECTION,
+ "Math.min(void 0, 1)",
+ Number.NaN,
+ Math.min( void 0, 1 ) );
+
+new TestCase( SECTION,
+ "Math.min(void 0, void 0)",
+ Number.NaN,
+ Math.min( void 0, void 0 ) );
+
+new TestCase( SECTION,
+ "Math.min(null, 1)",
+ 0,
+ Math.min( null, 1 ) );
+
+new TestCase( SECTION,
+ "Math.min(-1, null)",
+ -1,
+ Math.min( -1, null ) );
+
+new TestCase( SECTION,
+ "Math.min(true, false)",
+ 0,
+ Math.min(true,false) );
+
+new TestCase( SECTION,
+ "Math.min('-99','99')",
+ -99,
+ Math.min( "-99","99") );
+
+new TestCase( SECTION,
+ "Math.min(NaN,0)",
+ Number.NaN,
+ Math.min(Number.NaN,0) );
+
+new TestCase( SECTION,
+ "Math.min(NaN,1)",
+ Number.NaN,
+ Math.min(Number.NaN,1) );
+
+new TestCase( SECTION,
+ "Math.min(NaN,-1)",
+ Number.NaN,
+ Math.min(Number.NaN,-1) );
+
+new TestCase( SECTION,
+ "Math.min(0,NaN)",
+ Number.NaN,
+ Math.min(0,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(1,NaN)",
+ Number.NaN,
+ Math.min(1,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(-1,NaN)",
+ Number.NaN,
+ Math.min(-1,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(NaN,NaN)",
+ Number.NaN,
+ Math.min(Number.NaN,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(1,1.0000000001)",
+ 1,
+ Math.min(1,1.0000000001) );
+
+new TestCase( SECTION,
+ "Math.min(1.0000000001,1)",
+ 1,
+ Math.min(1.0000000001,1) );
+
+new TestCase( SECTION,
+ "Math.min(0,0)",
+ 0,
+ Math.min(0,0) );
+
+new TestCase( SECTION,
+ "Math.min(0,-0)",
+ -0,
+ Math.min(0,-0) );
+
+new TestCase( SECTION,
+ "Math.min(-0,-0)",
+ -0,
+ Math.min(-0,-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.min(0,-0)",
+ -Infinity,
+ Infinity/Math.min(0,-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.min(-0,-0)",
+ -Infinity,
+ Infinity/Math.min(-0,-0) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.13.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.13.js
new file mode 100644
index 0000000000..341b3e7651
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.13.js
@@ -0,0 +1,385 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.13.js';
+
+/**
+ File Name: 15.8.2.13.js
+ ECMA Section: 15.8.2.13 Math.pow(x, y)
+ Description: return an approximation to the result of x
+ to the power of y. there are many special cases;
+ refer to the spec.
+ Author: christine@netscape.com
+ Date: 9 july 1997
+*/
+
+var SECTION = "15.8.2.13";
+var VERSION = "ECMA_1";
+var TITLE = "Math.pow(x, y)";
+var BUGNUMBER="77141";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.pow.length",
+ 2,
+ Math.pow.length );
+
+new TestCase( SECTION,
+ "Math.pow()",
+ Number.NaN,
+ Math.pow() );
+
+new TestCase( SECTION,
+ "Math.pow(null, null)",
+ 1,
+ Math.pow(null,null) );
+
+new TestCase( SECTION,
+ "Math.pow(void 0, void 0)",
+ Number.NaN,
+ Math.pow(void 0, void 0));
+
+new TestCase( SECTION,
+ "Math.pow(true, false)",
+ 1,
+ Math.pow(true, false) );
+
+new TestCase( SECTION,
+ "Math.pow(false,true)",
+ 0,
+ Math.pow(false,true) );
+
+new TestCase( SECTION,
+ "Math.pow('2','32')",
+ 4294967296,
+ Math.pow('2','32') );
+
+new TestCase( SECTION,
+ "Math.pow(1,NaN)",
+ Number.NaN,
+ Math.pow(1,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.pow(0,NaN)",
+ Number.NaN,
+ Math.pow(0,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.pow(NaN,0)",
+ 1,
+ Math.pow(Number.NaN,0) );
+
+new TestCase( SECTION,
+ "Math.pow(NaN,-0)",
+ 1,
+ Math.pow(Number.NaN,-0) );
+
+new TestCase( SECTION,
+ "Math.pow(NaN,1)",
+ Number.NaN,
+ Math.pow(Number.NaN, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(NaN,.5)",
+ Number.NaN,
+ Math.pow(Number.NaN, .5) );
+
+new TestCase( SECTION,
+ "Math.pow(1.00000001, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(1.00000001, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(1.00000001, -Infinity)",
+ 0,
+ Math.pow(1.00000001, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1.00000001, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-1.00000001,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1.00000001, -Infinity)",
+ 0,
+ Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(1, Infinity)",
+ Number.NaN,
+ Math.pow(1, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(1, -Infinity)",
+ Number.NaN,
+ Math.pow(1, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, Infinity)",
+ Number.NaN,
+ Math.pow(-1, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, -Infinity)",
+ Number.NaN,
+ Math.pow(-1, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(.0000000009, Infinity)",
+ 0,
+ Math.pow(.0000000009, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-.0000000009, Infinity)",
+ 0,
+ Math.pow(-.0000000009, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(.0000000009, -Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, .00000000001)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY,.00000000001) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, 1)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, -.00000000001)",
+ 0,
+ Math.pow(Number.POSITIVE_INFINITY, -.00000000001) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, -1)",
+ 0,
+ Math.pow(Number.POSITIVE_INFINITY, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 1)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 333)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 333) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, 2)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY, 2) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 666)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 666) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 0.5)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -1)",
+ -0,
+ Math.pow(Number.NEGATIVE_INFINITY, -1) );
+
+new TestCase( SECTION,
+ "Infinity/Math.pow(-Infinity, -1)",
+ -Infinity,
+ Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -3)",
+ -0,
+ Math.pow(Number.NEGATIVE_INFINITY, -3) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -2)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY, -2) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -0.5)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY,-0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -Infinity)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 1)",
+ 0,
+ Math.pow(0,1) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 0)",
+ 1,
+ Math.pow(0,0) );
+
+new TestCase( SECTION,
+ "Math.pow(1, 0)",
+ 1,
+ Math.pow(1,0) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, 0)",
+ 1,
+ Math.pow(-1,0) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 0.5)",
+ 0,
+ Math.pow(0,0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 1000)",
+ 0,
+ Math.pow(0,1000) );
+
+new TestCase( SECTION,
+ "Math.pow(0, Infinity)",
+ 0,
+ Math.pow(0, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -1)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -0.5)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -1000)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -1000) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 1)",
+ -0,
+ Math.pow(-0, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 3)",
+ -0,
+ Math.pow(-0,3) );
+
+new TestCase( SECTION,
+ "Infinity/Math.pow(-0, 1)",
+ -Infinity,
+ Infinity/Math.pow(-0, 1) );
+
+new TestCase( SECTION,
+ "Infinity/Math.pow(-0, 3)",
+ -Infinity,
+ Infinity/Math.pow(-0,3) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 2)",
+ 0,
+ Math.pow(-0,2) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, Infinity)",
+ 0,
+ Math.pow(-0, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, -1)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(-0, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, -10001)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(-0, -10001) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, -2)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-0, -2) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 0.5)",
+ 0,
+ Math.pow(-0, 0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, Infinity)",
+ 0,
+ Math.pow(-0, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, 0.5)",
+ Number.NaN,
+ Math.pow(-1, 0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, NaN)",
+ Number.NaN,
+ Math.pow(-1, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, -0.5)",
+ Number.NaN,
+ Math.pow(-1, -0.5) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.14.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.14.js
new file mode 100644
index 0000000000..1972518c81
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.14.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.14.js';
+
+/**
+ File Name: 15.8.2.14.js
+ ECMA Section: 15.8.2.14 Math.random()
+ returns a number value x with a positive sign
+ with 1 > x >= 0 with approximately uniform
+ distribution over that range, using an
+ implementation-dependent algorithm or strategy.
+ This function takes no arguments.
+
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.2.14";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.random()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+for ( var item = 0; item < 100; item++ ) {
+ var testcase = new TestCase( SECTION,
+ "Math.random()",
+ "pass",
+ null );
+ testcase.reason = Math.random();
+ testcase.actual = "pass";
+
+ if ( ! ( testcase.reason >= 0) ) {
+ testcase.actual = "fail";
+ }
+
+ if ( ! (testcase.reason < 1) ) {
+ testcase.actual = "fail";
+ }
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.15.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.15.js
new file mode 100644
index 0000000000..a5c36b4e61
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.15.js
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.15.js';
+
+/**
+ File Name: 15.8.2.15.js
+ ECMA Section: 15.8.2.15 Math.round(x)
+ Description: return the greatest number value that is closest to the
+ argument and is an integer. if two integers are equally
+ close to the argument. then the result is the number value
+ that is closer to Infinity. if the argument is an integer,
+ return the argument.
+ special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = -0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if 0 < x < 0.5 return 0
+ - if -0.5 <= x < 0 return -0
+ example:
+ Math.round( 3.5 ) == 4
+ Math.round( -3.5 ) == 3
+ also:
+ - Math.round(x) == Math.floor( x + 0.5 )
+ except if x = -0. in that case, Math.round(x) = -0
+
+ and Math.floor( x+0.5 ) = +0
+
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.15";
+var VERSION = "ECMA_1";
+var TITLE = "Math.round(x)";
+var BUGNUMBER="331411";
+
+var EXCLUDE = "true";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.round.length",
+ 1,
+ Math.round.length );
+
+new TestCase( SECTION,
+ "Math.round()",
+ Number.NaN,
+ Math.round() );
+
+new TestCase( SECTION,
+ "Math.round(null)",
+ 0,
+ Math.round(0) );
+
+new TestCase( SECTION,
+ "Math.round(void 0)",
+ Number.NaN,
+ Math.round(void 0) );
+
+new TestCase( SECTION,
+ "Math.round(true)",
+ 1,
+ Math.round(true) );
+
+new TestCase( SECTION,
+ "Math.round(false)",
+ 0,
+ Math.round(false) );
+
+new TestCase( SECTION,
+ "Math.round('.99999')",
+ 1,
+ Math.round('.99999') );
+
+new TestCase( SECTION,
+ "Math.round('12345e-2')",
+ 123,
+ Math.round('12345e-2') );
+
+new TestCase( SECTION,
+ "Math.round(NaN)",
+ Number.NaN,
+ Math.round(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.round(0)",
+ 0,
+ Math.round(0) );
+
+new TestCase( SECTION,
+ "Math.round(-0)",
+ -0,
+ Math.round(-0));
+
+new TestCase( SECTION,
+ "Infinity/Math.round(-0)",
+ -Infinity,
+ Infinity/Math.round(-0) );
+
+new TestCase( SECTION,
+ "Math.round(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.round(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.round(-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.round(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.round(0.49)",
+ 0,
+ Math.round(0.49));
+
+new TestCase( SECTION,
+ "Math.round(0.5)",
+ 1,
+ Math.round(0.5));
+
+new TestCase( SECTION,
+ "Math.round(0.51)",
+ 1,
+ Math.round(0.51));
+
+new TestCase( SECTION,
+ "Math.round(-0.49)",
+ -0,
+ Math.round(-0.49));
+
+new TestCase( SECTION,
+ "Math.round(-0.5)",
+ -0,
+ Math.round(-0.5));
+
+new TestCase( SECTION,
+ "Infinity/Math.round(-0.49)",
+ -Infinity,
+ Infinity/Math.round(-0.49));
+
+new TestCase( SECTION,
+ "Infinity/Math.round(-0.5)",
+ -Infinity,
+ Infinity/Math.round(-0.5));
+
+new TestCase( SECTION,
+ "Math.round(-0.51)",
+ -1,
+ Math.round(-0.51));
+
+new TestCase( SECTION,
+ "Math.round(3.5)",
+ 4,
+ Math.round(3.5));
+
+new TestCase( SECTION,
+ "Math.round(-3.5)",
+ -3,
+ Math.round(-3));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.16.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.16.js
new file mode 100644
index 0000000000..deb873cdaa
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.16.js
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.16.js';
+
+/**
+ File Name: 15.8.2.16.js
+ ECMA Section: 15.8.2.16 sin( x )
+ Description: return an approximation to the sine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.2.16";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.sin(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.sin.length",
+ 1,
+ Math.sin.length );
+
+new TestCase( SECTION,
+ "Math.sin()",
+ Number.NaN,
+ Math.sin() );
+
+new TestCase( SECTION,
+ "Math.sin(null)",
+ 0,
+ Math.sin(null) );
+
+new TestCase( SECTION,
+ "Math.sin(void 0)",
+ Number.NaN,
+ Math.sin(void 0) );
+
+new TestCase( SECTION,
+ "Math.sin(false)",
+ 0,
+ Math.sin(false) );
+
+new TestCase( SECTION,
+ "Math.sin('2.356194490192')",
+ 0.7071067811865,
+ Math.sin('2.356194490192') );
+
+new TestCase( SECTION,
+ "Math.sin(NaN)",
+ Number.NaN,
+ Math.sin(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.sin(0)",
+ 0,
+ Math.sin(0) );
+
+new TestCase( SECTION,
+ "Math.sin(-0)",
+ -0,
+ Math.sin(-0));
+
+new TestCase( SECTION,
+ "Math.sin(Infinity)",
+ Number.NaN,
+ Math.sin(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sin(-Infinity)",
+ Number.NaN,
+ Math.sin(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sin(0.7853981633974)",
+ 0.7071067811865,
+ Math.sin(0.7853981633974));
+
+new TestCase( SECTION,
+ "Math.sin(1.570796326795)",
+ 1,
+ Math.sin(1.570796326795));
+
+new TestCase( SECTION,
+ "Math.sin(2.356194490192)",
+ 0.7071067811865,
+ Math.sin(2.356194490192));
+
+new TestCase( SECTION,
+ "Math.sin(3.14159265359)",
+ 0,
+ Math.sin(3.14159265359));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.17.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.17.js
new file mode 100644
index 0000000000..2f12f1d93b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.17.js
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.17.js';
+
+/**
+ File Name: 15.8.2.17.js
+ ECMA Section: 15.8.2.17 Math.sqrt(x)
+ Description: return an approximation to the squareroot of the argument.
+ special cases:
+ - if x is NaN return NaN
+ - if x < 0 return NaN
+ - if x == 0 return 0
+ - if x == -0 return -0
+ - if x == Infinity return Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.17";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.sqrt(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.sqrt.length",
+ 1,
+ Math.sqrt.length );
+
+new TestCase( SECTION,
+ "Math.sqrt()",
+ Number.NaN,
+ Math.sqrt() );
+
+new TestCase( SECTION,
+ "Math.sqrt(void 0)",
+ Number.NaN,
+ Math.sqrt(void 0) );
+
+new TestCase( SECTION,
+ "Math.sqrt(null)",
+ 0,
+ Math.sqrt(null) );
+
+new TestCase( SECTION,
+ "Math.sqrt(true)",
+ 1,
+ Math.sqrt(1) );
+
+new TestCase( SECTION,
+ "Math.sqrt(false)",
+ 0,
+ Math.sqrt(false) );
+
+new TestCase( SECTION,
+ "Math.sqrt('225')",
+ 15,
+ Math.sqrt('225') );
+
+new TestCase( SECTION,
+ "Math.sqrt(NaN)",
+ Number.NaN,
+ Math.sqrt(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.sqrt(-Infinity)",
+ Number.NaN,
+ Math.sqrt(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sqrt(-1)",
+ Number.NaN,
+ Math.sqrt(-1));
+
+new TestCase( SECTION,
+ "Math.sqrt(-0.5)",
+ Number.NaN,
+ Math.sqrt(-0.5));
+
+new TestCase( SECTION,
+ "Math.sqrt(0)",
+ 0,
+ Math.sqrt(0));
+
+new TestCase( SECTION,
+ "Math.sqrt(-0)",
+ -0,
+ Math.sqrt(-0));
+
+new TestCase( SECTION,
+ "Infinity/Math.sqrt(-0)",
+ -Infinity,
+ Infinity/Math.sqrt(-0) );
+
+new TestCase( SECTION,
+ "Math.sqrt(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.sqrt(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sqrt(1)",
+ 1,
+ Math.sqrt(1));
+
+new TestCase( SECTION,
+ "Math.sqrt(2)",
+ Math.SQRT2,
+ Math.sqrt(2));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.5)",
+ Math.SQRT1_2,
+ Math.sqrt(0.5));
+
+new TestCase( SECTION,
+ "Math.sqrt(4)",
+ 2,
+ Math.sqrt(4));
+
+new TestCase( SECTION,
+ "Math.sqrt(9)",
+ 3,
+ Math.sqrt(9));
+
+new TestCase( SECTION,
+ "Math.sqrt(16)",
+ 4,
+ Math.sqrt(16));
+
+new TestCase( SECTION,
+ "Math.sqrt(25)",
+ 5,
+ Math.sqrt(25));
+
+new TestCase( SECTION,
+ "Math.sqrt(36)",
+ 6,
+ Math.sqrt(36));
+
+new TestCase( SECTION,
+ "Math.sqrt(49)",
+ 7,
+ Math.sqrt(49));
+
+new TestCase( SECTION,
+ "Math.sqrt(64)",
+ 8,
+ Math.sqrt(64));
+
+new TestCase( SECTION,
+ "Math.sqrt(256)",
+ 16,
+ Math.sqrt(256));
+
+new TestCase( SECTION,
+ "Math.sqrt(10000)",
+ 100,
+ Math.sqrt(10000));
+
+new TestCase( SECTION,
+ "Math.sqrt(65536)",
+ 256,
+ Math.sqrt(65536));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.09)",
+ 0.3,
+ Math.sqrt(0.09));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.01)",
+ 0.1,
+ Math.sqrt(0.01));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.00000001)",
+ 0.0001,
+ Math.sqrt(0.00000001));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.18.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.18.js
new file mode 100644
index 0000000000..be68ea191f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.18.js
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.18.js';
+
+/**
+ File Name: 15.8.2.18.js
+ ECMA Section: 15.8.2.18 tan( x )
+ Description: return an approximation to the tan of the
+ argument. argument is expressed in radians
+ special cases:
+ - if x is NaN result is NaN
+ - if x is 0 result is 0
+ - if x is -0 result is -0
+ - if x is Infinity or -Infinity result is NaN
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.18";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.tan(x)";
+var EXCLUDE = "true";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.tan.length",
+ 1,
+ Math.tan.length );
+
+new TestCase( SECTION,
+ "Math.tan()",
+ Number.NaN,
+ Math.tan() );
+
+new TestCase( SECTION,
+ "Math.tan(void 0)",
+ Number.NaN,
+ Math.tan(void 0));
+
+new TestCase( SECTION,
+ "Math.tan(null)",
+ 0,
+ Math.tan(null) );
+
+new TestCase( SECTION,
+ "Math.tan(false)",
+ 0,
+ Math.tan(false) );
+
+new TestCase( SECTION,
+ "Math.tan(NaN)",
+ Number.NaN,
+ Math.tan(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.tan(0)",
+ 0,
+ Math.tan(0));
+
+new TestCase( SECTION,
+ "Math.tan(-0)",
+ -0,
+ Math.tan(-0));
+
+new TestCase( SECTION,
+ "Math.tan(Infinity)",
+ Number.NaN,
+ Math.tan(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.tan(-Infinity)",
+ Number.NaN,
+ Math.tan(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.tan(Math.PI/4)",
+ 1,
+ Math.tan(Math.PI/4));
+
+new TestCase( SECTION,
+ "Math.tan(3*Math.PI/4)",
+ -1,
+ Math.tan(3*Math.PI/4));
+
+new TestCase( SECTION,
+ "Math.tan(Math.PI)",
+ -0,
+ Math.tan(Math.PI));
+
+new TestCase( SECTION,
+ "Math.tan(5*Math.PI/4)",
+ 1,
+ Math.tan(5*Math.PI/4));
+
+new TestCase( SECTION,
+ "Math.tan(7*Math.PI/4)",
+ -1,
+ Math.tan(7*Math.PI/4));
+
+new TestCase( SECTION,
+ "Infinity/Math.tan(-0)",
+ -Infinity,
+ Infinity/Math.tan(-0) );
+
+/*
+ Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2.
+ That is to say, perturbing PI/2 by this much is about the smallest rounding error possible.
+
+ This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I
+ suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest
+ results to infinity that the algorithm can deliver.
+
+ In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger.
+ = C =
+*/
+
+new TestCase( SECTION,
+ "Math.tan(3*Math.PI/2) >= 5443000000000000",
+ true,
+ Math.tan(3*Math.PI/2) >= 5443000000000000 );
+
+new TestCase( SECTION,
+ "Math.tan(Math.PI/2) >= 5443000000000000",
+ true,
+ Math.tan(Math.PI/2) >= 5443000000000000 );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.2.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.2.js
new file mode 100644
index 0000000000..12fb00ef81
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.2.js
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.2.js';
+
+/**
+ File Name: 15.8.2.2.js
+ ECMA Section: 15.8.2.2 acos( x )
+ Description: return an approximation to the arc cosine of the
+ argument. the result is expressed in radians and
+ range is from +0 to +PI. special cases:
+ - if x is NaN, return NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == 1, the result is +0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+var SECTION = "15.8.2.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.acos()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.acos.length",
+ 1,
+ Math.acos.length );
+
+new TestCase( SECTION,
+ "Math.acos(void 0)",
+ Number.NaN,
+ Math.acos(void 0) );
+
+new TestCase( SECTION,
+ "Math.acos()",
+ Number.NaN,
+ Math.acos() );
+
+new TestCase( SECTION,
+ "Math.acos(null)",
+ Math.PI/2,
+ Math.acos(null) );
+
+new TestCase( SECTION,
+ "Math.acos(NaN)",
+ Number.NaN,
+ Math.acos(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.acos(a string)",
+ Number.NaN,
+ Math.acos("a string") );
+
+new TestCase( SECTION,
+ "Math.acos('0')",
+ Math.PI/2,
+ Math.acos('0') );
+
+new TestCase( SECTION,
+ "Math.acos('1')",
+ 0,
+ Math.acos('1') );
+
+new TestCase( SECTION,
+ "Math.acos('-1')",
+ Math.PI,
+ Math.acos('-1') );
+
+new TestCase( SECTION,
+ "Math.acos(1.00000001)",
+ Number.NaN,
+ Math.acos(1.00000001) );
+
+new TestCase( SECTION,
+ "Math.acos(11.00000001)",
+ Number.NaN,
+ Math.acos(-1.00000001) );
+
+new TestCase( SECTION,
+ "Math.acos(1)",
+ 0,
+ Math.acos(1) );
+
+new TestCase( SECTION,
+ "Math.acos(-1)",
+ Math.PI,
+ Math.acos(-1) );
+
+new TestCase( SECTION,
+ "Math.acos(0)",
+ Math.PI/2,
+ Math.acos(0) );
+
+new TestCase( SECTION,
+ "Math.acos(-0)",
+ Math.PI/2,
+ Math.acos(-0) );
+
+new TestCase( SECTION,
+ "Math.acos(Math.SQRT1_2)",
+ Math.PI/4,
+ Math.acos(Math.SQRT1_2));
+
+new TestCase( SECTION,
+ "Math.acos(-Math.SQRT1_2)",
+ Math.PI/4*3,
+ Math.acos(-Math.SQRT1_2));
+
+new TestCase( SECTION,
+ "Math.acos(0.9999619230642)",
+ Math.PI/360,
+ Math.acos(0.9999619230642));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.3.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.3.js
new file mode 100644
index 0000000000..11c6d73657
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.3.js
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.3.js';
+
+/**
+ File Name: 15.8.2.3.js
+ ECMA Section: 15.8.2.3 asin( x )
+ Description: return an approximation to the arc sine of the
+ argument. the result is expressed in radians and
+ range is from -PI/2 to +PI/2. special cases:
+ - if x is NaN, the result is NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == +0, the result is +0
+ - if x == -0, the result is -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.2.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.asin()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.asin()",
+ Number.NaN,
+ Math.asin() );
+
+new TestCase( SECTION,
+ "Math.asin(void 0)",
+ Number.NaN,
+ Math.asin(void 0) );
+
+new TestCase( SECTION,
+ "Math.asin(null)",
+ 0,
+ Math.asin(null) );
+
+new TestCase( SECTION,
+ "Math.asin(NaN)",
+ Number.NaN,
+ Math.asin(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.asin('string')",
+ Number.NaN,
+ Math.asin("string") );
+
+new TestCase( SECTION,
+ "Math.asin('0')",
+ 0,
+ Math.asin("0") );
+
+new TestCase( SECTION,
+ "Math.asin('1')",
+ Math.PI/2,
+ Math.asin("1") );
+
+new TestCase( SECTION,
+ "Math.asin('-1')",
+ -Math.PI/2,
+ Math.asin("-1") );
+
+new TestCase( SECTION,
+ "Math.asin(Math.SQRT1_2+'')",
+ Math.PI/4,
+ Math.asin(Math.SQRT1_2+'') );
+
+new TestCase( SECTION,
+ "Math.asin(-Math.SQRT1_2+'')",
+ -Math.PI/4,
+ Math.asin(-Math.SQRT1_2+'') );
+
+new TestCase( SECTION,
+ "Math.asin(1.000001)",
+ Number.NaN,
+ Math.asin(1.000001) );
+
+new TestCase( SECTION,
+ "Math.asin(-1.000001)",
+ Number.NaN,
+ Math.asin(-1.000001) );
+
+new TestCase( SECTION,
+ "Math.asin(0)",
+ 0,
+ Math.asin(0) );
+
+new TestCase( SECTION,
+ "Math.asin(-0)",
+ -0,
+ Math.asin(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.asin(-0)",
+ -Infinity,
+ Infinity/Math.asin(-0) );
+
+new TestCase( SECTION,
+ "Math.asin(1)",
+ Math.PI/2,
+ Math.asin(1) );
+
+new TestCase( SECTION,
+ "Math.asin(-1)",
+ -Math.PI/2,
+ Math.asin(-1) );
+
+new TestCase( SECTION,
+ "Math.asin(Math.SQRT1_2))",
+ Math.PI/4,
+ Math.asin(Math.SQRT1_2) );
+
+new TestCase( SECTION,
+ "Math.asin(-Math.SQRT1_2))",
+ -Math.PI/4,
+ Math.asin(-Math.SQRT1_2));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.4.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.4.js
new file mode 100644
index 0000000000..c67ac6d4ea
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.4.js
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.4.js';
+
+/**
+ File Name: 15.8.2.4.js
+ ECMA Section: 15.8.2.4 atan( x )
+ Description: return an approximation to the arc tangent of the
+ argument. the result is expressed in radians and
+ range is from -PI/2 to +PI/2. special cases:
+ - if x is NaN, the result is NaN
+ - if x == +0, the result is +0
+ - if x == -0, the result is -0
+ - if x == +Infinity, the result is approximately +PI/2
+ - if x == -Infinity, the result is approximately -PI/2
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+var SECTION = "15.8.2.4";
+var VERSION = "ECMA_1";
+var TITLE = "Math.atan()";
+var BUGNUMBER="77391";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.atan.length",
+ 1,
+ Math.atan.length );
+
+new TestCase( SECTION,
+ "Math.atan()",
+ Number.NaN,
+ Math.atan() );
+
+new TestCase( SECTION,
+ "Math.atan(void 0)",
+ Number.NaN,
+ Math.atan(void 0) );
+
+new TestCase( SECTION,
+ "Math.atan(null)",
+ 0,
+ Math.atan(null) );
+
+new TestCase( SECTION,
+ "Math.atan(NaN)",
+ Number.NaN,
+ Math.atan(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.atan('a string')",
+ Number.NaN,
+ Math.atan("a string") );
+
+new TestCase( SECTION,
+ "Math.atan('0')",
+ 0,
+ Math.atan('0') );
+
+new TestCase( SECTION,
+ "Math.atan('1')",
+ Math.PI/4,
+ Math.atan('1') );
+
+new TestCase( SECTION,
+ "Math.atan('-1')",
+ -Math.PI/4,
+ Math.atan('-1') );
+
+new TestCase( SECTION,
+ "Math.atan('Infinity)",
+ Math.PI/2,
+ Math.atan('Infinity') );
+
+new TestCase( SECTION,
+ "Math.atan('-Infinity)",
+ -Math.PI/2,
+ Math.atan('-Infinity') );
+
+new TestCase( SECTION,
+ "Math.atan(0)",
+ 0,
+ Math.atan(0) );
+
+new TestCase( SECTION,
+ "Math.atan(-0)",
+ -0,
+ Math.atan(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.atan(-0)",
+ -Infinity,
+ Infinity/Math.atan(-0) );
+
+new TestCase( SECTION,
+ "Math.atan(Infinity)",
+ Math.PI/2,
+ Math.atan(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan(-Infinity)",
+ -Math.PI/2,
+ Math.atan(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan(1)",
+ Math.PI/4,
+ Math.atan(1) );
+
+new TestCase( SECTION,
+ "Math.atan(-1)",
+ -Math.PI/4,
+ Math.atan(-1) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.5.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.5.js
new file mode 100644
index 0000000000..0adc690743
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.5.js
@@ -0,0 +1,244 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.5.js';
+
+/**
+ File Name: 15.8.2.5.js
+ ECMA Section: 15.8.2.5 atan2( y, x )
+ Description:
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+var SECTION = "15.8.2.5";
+var VERSION = "ECMA_1";
+var TITLE = "Math.atan2(x,y)";
+var BUGNUMBER="76111";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.atan2.length",
+ 2,
+ Math.atan2.length );
+
+new TestCase( SECTION,
+ "Math.atan2(NaN, 0)",
+ Number.NaN,
+ Math.atan2(Number.NaN,0) );
+
+new TestCase( SECTION,
+ "Math.atan2(null, null)",
+ 0,
+ Math.atan2(null, null) );
+
+new TestCase( SECTION,
+ "Math.atan2(void 0, void 0)",
+ Number.NaN,
+ Math.atan2(void 0, void 0) );
+
+new TestCase( SECTION,
+ "Math.atan2()",
+ Number.NaN,
+ Math.atan2() );
+
+new TestCase( SECTION,
+ "Math.atan2(0, NaN)",
+ Number.NaN,
+ Math.atan2(0,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.atan2(1, 0)",
+ Math.PI/2,
+ Math.atan2(1,0) );
+
+new TestCase( SECTION,
+ "Math.atan2(1,-0)",
+ Math.PI/2,
+ Math.atan2(1,-0) );
+
+new TestCase( SECTION,
+ "Math.atan2(0,0.001)",
+ 0,
+ Math.atan2(0,0.001) );
+
+new TestCase( SECTION,
+ "Math.atan2(0,0)",
+ 0,
+ Math.atan2(0,0) );
+
+new TestCase( SECTION,
+ "Math.atan2(0, -0)",
+ Math.PI,
+ Math.atan2(0,-0) );
+
+new TestCase( SECTION,
+ "Math.atan2(0, -1)",
+ Math.PI,
+ Math.atan2(0, -1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, 1)",
+ -0,
+ Math.atan2(-0, 1) );
+
+new TestCase( SECTION,
+ "Infinity/Math.atan2(-0, 1)",
+ -Infinity,
+ Infinity/Math.atan2(-0,1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, 0)",
+ -0,
+ Math.atan2(-0,0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, -0)",
+ -Math.PI,
+ Math.atan2(-0, -0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, -1)",
+ -Math.PI,
+ Math.atan2(-0, -1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, 0)",
+ -Math.PI/2,
+ Math.atan2(-1, 0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, -0)",
+ -Math.PI/2,
+ Math.atan2(-1, -0) );
+
+new TestCase( SECTION,
+ "Math.atan2(1, Infinity)",
+ 0,
+ Math.atan2(1, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(1,-Infinity)",
+ Math.PI,
+ Math.atan2(1, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, Infinity)",
+ -0,
+ Math.atan2(-1,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Infinity/Math.atan2(-1, Infinity)",
+ -Infinity,
+ Infinity/Math.atan2(-1,Infinity) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1,-Infinity)",
+ -Math.PI,
+ Math.atan2(-1,Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, 0)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY, 0) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, 1)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity,-1)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY,-1) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity,-0)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY,-0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, 0)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY, 0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity,-0)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY,-0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, 1)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, -1)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY,-1) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, Infinity)",
+ Math.PI/4,
+ Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, -Infinity)",
+ 3*Math.PI/4,
+ Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, Infinity)",
+ -Math.PI/4,
+ Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, -Infinity)",
+ -3*Math.PI/4,
+ Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, 1)",
+ -Math.PI/4,
+ Math.atan2( -1, 1) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.6.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.6.js
new file mode 100644
index 0000000000..1c20a1c93e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.6.js
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.6.js';
+
+/**
+ File Name: 15.8.2.6.js
+ ECMA Section: 15.8.2.6 Math.ceil(x)
+ Description: return the smallest number value that is not less than the
+ argument and is equal to a mathematical integer. if the
+ number is already an integer, return the number itself.
+ special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = 0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if ( -1 < x < 0 ) return -0
+ also:
+ - the value of Math.ceil(x) == -Math.ceil(-x)
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+var SECTION = "15.8.2.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.ceil(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.ceil.length",
+ 1,
+ Math.ceil.length );
+
+new TestCase( SECTION,
+ "Math.ceil(NaN)",
+ Number.NaN,
+ Math.ceil(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.ceil(null)",
+ 0,
+ Math.ceil(null) );
+
+new TestCase( SECTION,
+ "Math.ceil()",
+ Number.NaN,
+ Math.ceil() );
+
+new TestCase( SECTION,
+ "Math.ceil(void 0)",
+ Number.NaN,
+ Math.ceil(void 0) );
+
+new TestCase( SECTION,
+ "Math.ceil('0')",
+ 0,
+ Math.ceil('0') );
+
+new TestCase( SECTION,
+ "Math.ceil('-0')",
+ -0,
+ Math.ceil('-0') );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil('0')",
+ Infinity,
+ Infinity/Math.ceil('0'));
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil('-0')",
+ -Infinity,
+ Infinity/Math.ceil('-0'));
+
+new TestCase( SECTION,
+ "Math.ceil(0)",
+ 0,
+ Math.ceil(0) );
+
+new TestCase( SECTION,
+ "Math.ceil(-0)",
+ -0,
+ Math.ceil(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(0)",
+ Infinity,
+ Infinity/Math.ceil(0));
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(-0)",
+ -Infinity,
+ Infinity/Math.ceil(-0));
+
+
+new TestCase( SECTION,
+ "Math.ceil(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.ceil(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.ceil(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Number.MIN_VALUE)",
+ -0,
+ Math.ceil(-Number.MIN_VALUE) );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(-Number.MIN_VALUE)",
+ -Infinity,
+ Infinity/Math.ceil(-Number.MIN_VALUE) );
+
+new TestCase( SECTION,
+ "Math.ceil(1)",
+ 1,
+ Math.ceil(1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1)",
+ -1,
+ Math.ceil(-1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-0.9)",
+ -0,
+ Math.ceil(-0.9) );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(-0.9)",
+ -Infinity,
+ Infinity/Math.ceil(-0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(0.9 )",
+ 1,
+ Math.ceil( 0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1.1)",
+ -1,
+ Math.ceil( -1.1));
+
+new TestCase( SECTION,
+ "Math.ceil( 1.1)",
+ 2,
+ Math.ceil( 1.1));
+
+new TestCase( SECTION,
+ "Math.ceil(Infinity)",
+ -Math.floor(-Infinity),
+ Math.ceil(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Infinity)",
+ -Math.floor(Infinity),
+ Math.ceil(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Number.MIN_VALUE)",
+ -Math.floor(Number.MIN_VALUE),
+ Math.ceil(-Number.MIN_VALUE) );
+
+new TestCase( SECTION,
+ "Math.ceil(1)",
+ -Math.floor(-1),
+ Math.ceil(1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1)",
+ -Math.floor(1),
+ Math.ceil(-1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-0.9)",
+ -Math.floor(0.9),
+ Math.ceil(-0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(0.9 )",
+ -Math.floor(-0.9),
+ Math.ceil( 0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1.1)",
+ -Math.floor(1.1),
+ Math.ceil( -1.1));
+
+new TestCase( SECTION,
+ "Math.ceil( 1.1)",
+ -Math.floor(-1.1),
+ Math.ceil( 1.1));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.7.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.7.js
new file mode 100644
index 0000000000..2b19b5986e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.7.js
@@ -0,0 +1,283 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.7.js';
+
+/**
+ File Name: 15.8.2.7.js
+ ECMA Section: 15.8.2.7 cos( x )
+ Description: return an approximation to the cosine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
+
+*/
+
+var SECTION = "15.8.2.7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.cos(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.cos.length",
+ 1,
+ Math.cos.length );
+
+new TestCase( SECTION,
+ "Math.cos()",
+ Number.NaN,
+ Math.cos() );
+
+new TestCase( SECTION,
+ "Math.cos(void 0)",
+ Number.NaN,
+ Math.cos(void 0) );
+
+new TestCase( SECTION,
+ "Math.cos(false)",
+ 1,
+ Math.cos(false) );
+
+new TestCase( SECTION,
+ "Math.cos(null)",
+ 1,
+ Math.cos(null) );
+
+new TestCase( SECTION,
+ "Math.cos('0')",
+ 1,
+ Math.cos('0') );
+
+new TestCase( SECTION,
+ "Math.cos('Infinity')",
+ Number.NaN,
+ Math.cos("Infinity") );
+
+new TestCase( SECTION,
+ "Math.cos('3.14159265359')",
+ -1,
+ Math.cos('3.14159265359') );
+
+new TestCase( SECTION,
+ "Math.cos(NaN)",
+ Number.NaN,
+ Math.cos(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.cos(0)",
+ 1,
+ Math.cos(0) );
+
+new TestCase( SECTION,
+ "Math.cos(-0)",
+ 1,
+ Math.cos(-0) );
+
+new TestCase( SECTION,
+ "Math.cos(Infinity)",
+ Number.NaN,
+ Math.cos(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.cos(-Infinity)",
+ Number.NaN,
+ Math.cos(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.cos(0.7853981633974)",
+ 0.7071067811865,
+ Math.cos(0.7853981633974) );
+
+new TestCase( SECTION,
+ "Math.cos(1.570796326795)",
+ 0,
+ Math.cos(1.570796326795) );
+
+new TestCase( SECTION,
+ "Math.cos(2.356194490192)",
+ -0.7071067811865,
+ Math.cos(2.356194490192) );
+
+new TestCase( SECTION,
+ "Math.cos(3.14159265359)",
+ -1,
+ Math.cos(3.14159265359) );
+
+new TestCase( SECTION,
+ "Math.cos(3.926990816987)",
+ -0.7071067811865,
+ Math.cos(3.926990816987) );
+
+new TestCase( SECTION,
+ "Math.cos(4.712388980385)",
+ 0,
+ Math.cos(4.712388980385) );
+
+new TestCase( SECTION,
+ "Math.cos(5.497787143782)",
+ 0.7071067811865,
+ Math.cos(5.497787143782) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI*2)",
+ 1,
+ Math.cos(Math.PI*2) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI/2)",
+ 0,
+ Math.cos(Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(3*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(3*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI)",
+ -1,
+ Math.cos(Math.PI) );
+
+new TestCase( SECTION,
+ "Math.cos(5*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(5*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(3*Math.PI/2)",
+ 0,
+ Math.cos(3*Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(7*Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(7*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI*2)",
+ 1,
+ Math.cos(2*Math.PI) );
+
+new TestCase( SECTION,
+ "Math.cos(-0.7853981633974)",
+ 0.7071067811865,
+ Math.cos(-0.7853981633974) );
+
+new TestCase( SECTION,
+ "Math.cos(-1.570796326795)",
+ 0,
+ Math.cos(-1.570796326795) );
+
+new TestCase( SECTION,
+ "Math.cos(-2.3561944901920)",
+ -.7071067811865,
+ Math.cos(2.3561944901920) );
+
+new TestCase( SECTION,
+ "Math.cos(-3.14159265359)",
+ -1,
+ Math.cos(3.14159265359) );
+
+new TestCase( SECTION,
+ "Math.cos(-3.926990816987)",
+ -0.7071067811865,
+ Math.cos(3.926990816987) );
+
+new TestCase( SECTION,
+ "Math.cos(-4.712388980385)",
+ 0,
+ Math.cos(4.712388980385) );
+
+new TestCase( SECTION,
+ "Math.cos(-5.497787143782)",
+ 0.7071067811865,
+ Math.cos(5.497787143782) );
+
+new TestCase( SECTION,
+ "Math.cos(-6.28318530718)",
+ 1,
+ Math.cos(6.28318530718) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(-Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI/2)",
+ 0,
+ Math.cos(-Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(-3*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(-3*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI)",
+ -1,
+ Math.cos(-Math.PI) );
+
+new TestCase( SECTION,
+ "Math.cos(-5*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(-5*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-3*Math.PI/2)",
+ 0,
+ Math.cos(-3*Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(-7*Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(-7*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI*2)",
+ 1,
+ Math.cos(-Math.PI*2) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.8.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.8.js
new file mode 100644
index 0000000000..96b6231da2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.8.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.8.js';
+
+/**
+ File Name: 15.8.2.8.js
+ ECMA Section: 15.8.2.8 Math.exp(x)
+ Description: return an approximation to the exponential function of
+ the argument (e raised to the power of the argument)
+ special cases:
+ - if x is NaN return NaN
+ - if x is 0 return 1
+ - if x is -0 return 1
+ - if x is Infinity return Infinity
+ - if x is -Infinity return 0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+
+var SECTION = "15.8.2.8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.exp(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.exp.length",
+ 1,
+ Math.exp.length );
+
+new TestCase( SECTION,
+ "Math.exp()",
+ Number.NaN,
+ Math.exp() );
+
+new TestCase( SECTION,
+ "Math.exp(null)",
+ 1,
+ Math.exp(null) );
+
+new TestCase( SECTION,
+ "Math.exp(void 0)",
+ Number.NaN,
+ Math.exp(void 0) );
+
+new TestCase( SECTION,
+ "Math.exp(1)",
+ Math.E,
+ Math.exp(1) );
+
+new TestCase( SECTION,
+ "Math.exp(true)",
+ Math.E,
+ Math.exp(true) );
+
+new TestCase( SECTION,
+ "Math.exp(false)",
+ 1,
+ Math.exp(false) );
+
+new TestCase( SECTION,
+ "Math.exp('1')",
+ Math.E,
+ Math.exp('1') );
+
+new TestCase( SECTION,
+ "Math.exp('0')",
+ 1,
+ Math.exp('0') );
+
+new TestCase( SECTION,
+ "Math.exp(NaN)",
+ Number.NaN,
+ Math.exp(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.exp(0)",
+ 1,
+ Math.exp(0) );
+
+new TestCase( SECTION,
+ "Math.exp(-0)",
+ 1,
+ Math.exp(-0) );
+
+new TestCase( SECTION,
+ "Math.exp(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.exp(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.exp(-Infinity)",
+ 0,
+ Math.exp(Number.NEGATIVE_INFINITY) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.9.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.9.js
new file mode 100644
index 0000000000..b68a57d5bb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.9.js
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8.2.9.js';
+
+/**
+ File Name: 15.8.2.9.js
+ ECMA Section: 15.8.2.9 Math.floor(x)
+ Description: return the greatest number value that is not greater
+ than the argument and is equal to a mathematical integer.
+ if the number is already an integer, return the number
+ itself. special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = -0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if ( -1 < x < 0 ) return -0
+ also:
+ - the value of Math.floor(x) == -Math.ceil(-x)
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+
+var SECTION = "15.8.2.9";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.floor(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.floor.length",
+ 1,
+ Math.floor.length );
+
+new TestCase( SECTION,
+ "Math.floor()",
+ Number.NaN,
+ Math.floor() );
+
+new TestCase( SECTION,
+ "Math.floor(void 0)",
+ Number.NaN,
+ Math.floor(void 0) );
+
+new TestCase( SECTION,
+ "Math.floor(null)",
+ 0,
+ Math.floor(null) );
+
+new TestCase( SECTION,
+ "Math.floor(true)",
+ 1,
+ Math.floor(true) );
+
+new TestCase( SECTION,
+ "Math.floor(false)",
+ 0,
+ Math.floor(false) );
+
+new TestCase( SECTION,
+ "Math.floor('1.1')",
+ 1,
+ Math.floor("1.1") );
+
+new TestCase( SECTION,
+ "Math.floor('-1.1')",
+ -2,
+ Math.floor("-1.1") );
+
+new TestCase( SECTION,
+ "Math.floor('0.1')",
+ 0,
+ Math.floor("0.1") );
+
+new TestCase( SECTION,
+ "Math.floor('-0.1')",
+ -1,
+ Math.floor("-0.1") );
+
+new TestCase( SECTION,
+ "Math.floor(NaN)",
+ Number.NaN,
+ Math.floor(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.floor(NaN)==-Math.ceil(-NaN)",
+ false,
+ Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.floor(0)",
+ 0,
+ Math.floor(0) );
+
+new TestCase( SECTION,
+ "Math.floor(0)==-Math.ceil(-0)",
+ true,
+ Math.floor(0) == -Math.ceil(-0) );
+
+new TestCase( SECTION,
+ "Math.floor(-0)",
+ -0,
+ Math.floor(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.floor(-0)",
+ -Infinity,
+ Infinity/Math.floor(-0) );
+
+new TestCase( SECTION,
+ "Math.floor(-0)==-Math.ceil(0)",
+ true,
+ Math.floor(-0)== -Math.ceil(0) );
+
+new TestCase( SECTION,
+ "Math.floor(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.floor(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(Infinity)==-Math.ceil(-Infinity)",
+ true,
+ Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.floor(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(-Infinity)==-Math.ceil(Infinity)",
+ true,
+ Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(0.0000001)",
+ 0,
+ Math.floor(0.0000001) );
+
+new TestCase( SECTION,
+ "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true,
+ Math.floor(0.0000001)==-Math.ceil(-0.0000001) );
+
+new TestCase( SECTION,
+ "Math.floor(-0.0000001)",
+ -1,
+ Math.floor(-0.0000001) );
+
+new TestCase( SECTION,
+ "Math.floor(0.0000001)==-Math.ceil(0.0000001)",
+ true,
+ Math.floor(-0.0000001)==-Math.ceil(0.0000001) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/browser.js b/tests/auto/qml/parserstress/tests/ecma/Math/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/shell.js b/tests/auto/qml/parserstress/tests/ecma/Math/shell.js
new file mode 100644
index 0000000000..fbcc5c3f92
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Math/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Math';
diff --git a/tests/auto/qml/parserstress/tests/ecma/NativeObjects/browser.js b/tests/auto/qml/parserstress/tests/ecma/NativeObjects/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/NativeObjects/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/NativeObjects/shell.js b/tests/auto/qml/parserstress/tests/ecma/NativeObjects/shell.js
new file mode 100644
index 0000000000..4ddb940f71
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/NativeObjects/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'NativeObjects';
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.1.js
new file mode 100644
index 0000000000..34cec9f378
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.1.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.1.js';
+
+/**
+ File Name: 15.7.1.js
+ ECMA Section: 15.7.1 The Number Constructor Called as a Function
+ 15.7.1.1
+ 15.7.1.2
+
+ Description: When Number is called as a function rather than as a
+ constructor, it performs a type conversion.
+ 15.7.1.1 Return a number value (not a Number object)
+ computed by ToNumber( value )
+ 15.7.1.2 Number() returns 0.
+
+ need to add more test cases. see the gTestcases for
+ TypeConversion ToNumber.
+
+ Author: christine@netscape.com
+ Date: 29 september 1997
+*/
+
+var SECTION = "15.7.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Number Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(SECTION, "Number()", 0, Number() );
+new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
+new TestCase(SECTION, "Number(null)", 0, Number(null) );
+new TestCase(SECTION, "Number()", 0, Number() );
+new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) );
+new TestCase(SECTION, "Number(0)", 0, Number(0) );
+new TestCase(SECTION, "Number(1)", 1, Number(1) );
+new TestCase(SECTION, "Number(-1)", -1, Number(-1) );
+new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) );
+new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") );
+new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) );
+new TestCase(SECTION, "Number('')", 0, Number( "" ) );
+new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") );
+
+new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.2.js
new file mode 100644
index 0000000000..4c2c8a298c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.2.js
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.2.js';
+
+/**
+ File Name: 15.7.2.js
+ ECMA Section: 15.7.2 The Number Constructor
+ 15.7.2.1
+ 15.7.2.2
+
+ Description: 15.7.2 When Number is called as part of a new
+ expression, it is a constructor: it initializes
+ the newly created object.
+
+ 15.7.2.1 The [[Prototype]] property of the newly
+ constructed object is set to othe original Number
+ prototype object, the one that is the initial value
+ of Number.prototype(0). The [[Class]] property is
+ set to "Number". The [[Value]] property of the
+ newly constructed object is set to ToNumber(value)
+
+ 15.7.2.2 new Number(). same as in 15.7.2.1, except
+ the [[Value]] property is set to +0.
+
+ need to add more test cases. see the gTestcases for
+ TypeConversion ToNumber.
+
+ Author: christine@netscape.com
+ Date: 29 september 1997
+*/
+
+var SECTION = "15.7.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Number Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// To verify that the object's prototype is the Number.prototype, check to see if the object's
+// constructor property is the same as Number.prototype.constructor.
+
+new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
+
+new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
+new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor );
+new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) );
+new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor );
+new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) );
+new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor );
+new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) );
+new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor );
+new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) );
+new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor );
+new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) );
+new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor );
+new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) );
+new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor );
+new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) );
+new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor );
+new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) );
+new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor );
+new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) );
+new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+
+new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
+new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
+new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
+new TestCase(SECTION,
+ "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()",
+ "[object Number]",
+ eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-1.js
new file mode 100644
index 0000000000..d275f50a12
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-1.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.1-1.js';
+
+/**
+ File Name: 15.7.3.1-2.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.prototype
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.prototype";
+
+writeHeaderToLog( SECTION +" "+ TITLE);
+
+new TestCase(SECTION,
+ "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype",
+ true,
+ eval("var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype") );
+
+new TestCase(SECTION,
+ "delete( Number.prototype )",
+ false,
+ eval("delete( Number.prototype )") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-2.js
new file mode 100644
index 0000000000..ff26a03e63
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-2.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.1-2.js';
+
+/**
+ File Name: 15.7.3.1-2.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.prototype
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT",
+ true,
+ eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") );
+
+new TestCase( SECTION,
+ "Number.prototype=0; Number.prototype",
+ Number.prototype,
+ eval("Number.prototype=0; Number.prototype") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-3.js
new file mode 100644
index 0000000000..4669e969a7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.1-3.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.1-3.js';
+
+/**
+ File Name: 15.7.3.1-4.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.prototype
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.7.3.1-3";
+var TITLE = "Number.prototype";
+
+writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute");
+
+new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;")
+ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-1.js
new file mode 100644
index 0000000000..35ff1b25c3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-1.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.2-1.js';
+
+/**
+ File Name: 15.7.3.2-1.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Number.MAX_VALUE",
+ 1.7976931348623157e308,
+ Number.MAX_VALUE );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-2.js
new file mode 100644
index 0000000000..980b688bb6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.2-2.js';
+
+/**
+ File Name: 15.7.3.2-2.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE: DontDelete Attribute";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete( Number.MAX_VALUE ); Number.MAX_VALUE",
+ 1.7976931348623157e308,
+ eval("delete( Number.MAX_VALUE );Number.MAX_VALUE") );
+
+new TestCase( SECTION,
+ "delete( Number.MAX_VALUE )",
+ false,
+ eval("delete( Number.MAX_VALUE )") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-3.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-3.js
new file mode 100644
index 0000000000..2f20efe2a8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-3.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.2-3.js';
+
+/**
+ File Name: 15.7.3.2-3.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE";
+
+writeHeaderToLog( SECTION + " "+ TITLE );
+
+var MAX_VAL = 1.7976931348623157e308;
+
+new TestCase( SECTION,
+ "Number.MAX_VALUE=0; Number.MAX_VALUE",
+ MAX_VAL,
+ eval("Number.MAX_VALUE=0; Number.MAX_VALUE") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-4.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-4.js
new file mode 100644
index 0000000000..04d70ce3a9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.2-4.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.2-4.js';
+
+/**
+ File Name: 15.7.3.2-4.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.MAX_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.3.2-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE: DontEnum Attribute";
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;")
+ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-1.js
new file mode 100644
index 0000000000..ed7f0e88a9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-1.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.3-1.js';
+
+/**
+ File Name: 15.7.3.3-1.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MIN_VALUE";
+
+writeHeaderToLog( SECTION + " "+ TITLE );
+
+var MIN_VAL = 5e-324;
+
+new TestCase( SECTION,
+ "Number.MIN_VALUE",
+ MIN_VAL,
+ Number.MIN_VALUE );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-2.js
new file mode 100644
index 0000000000..2b73147c2a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-2.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.3-2.js';
+
+/**
+ File Name: 15.7.3.3-2.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MIN_VALUE";
+
+writeHeaderToLog( SECTION + " "+ TITLE );
+
+var MIN_VAL = 5e-324;
+
+new TestCase( SECTION,
+ "delete( Number.MIN_VALUE )",
+ false,
+ eval("delete( Number.MIN_VALUE )") );
+
+new TestCase( SECTION,
+ "delete( Number.MIN_VALUE ); Number.MIN_VALUE",
+ MIN_VAL,
+ eval("delete( Number.MIN_VALUE );Number.MIN_VALUE") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-3.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-3.js
new file mode 100644
index 0000000000..d0c98282dd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-3.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.3-3.js';
+
+/**
+ File Name: 15.7.3.3-3.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.3.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MIN_VALUE: ReadOnly Attribute";
+
+writeHeaderToLog( SECTION + " "+TITLE );
+
+new TestCase( SECTION,
+ "Number.MIN_VALUE=0; Number.MIN_VALUE",
+ Number.MIN_VALUE,
+ eval("Number.MIN_VALUE=0; Number.MIN_VALUE" ));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-4.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-4.js
new file mode 100644
index 0000000000..e9427c62f2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.3-4.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.3-4.js';
+
+/**
+ File Name: 15.7.3.3-4.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.MIN_VALUE
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.3-4";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute");
+
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;")
+ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-1.js
new file mode 100644
index 0000000000..6a6835f04d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-1.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.4-1.js';
+
+/**
+ File Name: 15.7.3.4-1.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
+
+writeHeaderToLog( SECTION + " "+ TITLE );
+
+new TestCase(SECTION,
+ "NaN",
+ NaN,
+ Number.NaN );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-2.js
new file mode 100644
index 0000000000..fd1e630d54
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-2.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.4-2.js';
+
+/**
+ File Name: 15.7.3.4-2.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.3.4-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
+
+writeHeaderToLog( SECTION + " "+ TITLE );
+
+new TestCase(SECTION,
+ "delete( Number.NaN ); Number.NaN",
+ NaN,
+ eval("delete( Number.NaN );Number.NaN" ));
+
+new TestCase( SECTION,
+ "delete( Number.NaN )",
+ false,
+ eval("delete( Number.NaN )") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-3.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-3.js
new file mode 100644
index 0000000000..6cf1072e20
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-3.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.4-3.js';
+
+/**
+ File Name: 15.7.3.4-3.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.4-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
+
+writeHeaderToLog( SECTION + " "+ TITLE );
+
+new TestCase( SECTION,
+ "Number.NaN=0; Number.NaN",
+ Number.NaN,
+ eval("Number.NaN=0; Number.NaN") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-4.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-4.js
new file mode 100644
index 0000000000..3e1db5b9d2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.4-4.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.4-4.js';
+
+/**
+ File Name: 15.7.3.4-4.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.NaN
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.4-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
+
+writeHeaderToLog( SECTION + " " + TITLE);
+
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;")
+ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-1.js
new file mode 100644
index 0000000000..8bcb3e3782
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-1.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.5-1.js';
+
+/**
+ File Name: 15.7.3.5-1.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.3.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase(SECTION,
+ "Number.NEGATIVE_INFINITY",
+ -Infinity,
+ Number.NEGATIVE_INFINITY );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-2.js
new file mode 100644
index 0000000000..e0c2c440ac
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.5-2.js';
+
+/**
+ File Name: 15.7.3.5-2.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "delete( Number.NEGATIVE_INFINITY )",
+ false,
+ eval("delete( Number.NEGATIVE_INFINITY )") );
+
+new TestCase( SECTION,
+ "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY",
+ -Infinity,
+ eval("delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-3.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-3.js
new file mode 100644
index 0000000000..983cdd3147
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-3.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.5-3.js';
+
+/**
+ File Name: 15.7.3.5-3.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY",
+ -Infinity,
+ eval("Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-4.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-4.js
new file mode 100644
index 0000000000..acf7b0f543
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.5-4.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.5-4.js';
+
+/**
+ File Name: 15.7.3.5-4.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.5-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;")
+ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-1.js
new file mode 100644
index 0000000000..466267f7d4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-1.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.6-1.js';
+
+/**
+ File Name: 15.7.3.6-1.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the value of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "Number.POSITIVE_INFINITY",
+ Infinity,
+ Number.POSITIVE_INFINITY );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-2.js
new file mode 100644
index 0000000000..c3e6dbd0fb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-2.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.6-2.js';
+
+/**
+ File Name: 15.7.3.6-2.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.3.6-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase(SECTION,
+ "delete( Number.POSITIVE_INFINITY )",
+ false,
+ eval("delete( Number.POSITIVE_INFINITY )") );
+
+new TestCase(SECTION,
+ "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY",
+ Infinity,
+ eval("delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-3.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-3.js
new file mode 100644
index 0000000000..6055f49374
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-3.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.6-3.js';
+
+/**
+ File Name: 15.7.3.6-3.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.7.3.6-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY",
+ Number.POSITIVE_INFINITY,
+ eval("Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-4.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-4.js
new file mode 100644
index 0000000000..75fa6ee485
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.6-4.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.6-4.js';
+
+/**
+ File Name: 15.7.3.6-4.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontEnum attribute of Number.POSITIVE_INFINITY
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.3.6-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;")
+ );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.js
new file mode 100644
index 0000000000..bc5e7a3fa1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.3.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.js';
+
+/**
+ File Name: 15.7.3.js
+ 15.7.3 Properties of the Number Constructor
+
+ Description: The value of the internal [[Prototype]] property
+ of the Number constructor is the Function prototype
+ object. The Number constructor also has the internal
+ [[Call]] and [[Construct]] properties, and the length
+ property.
+
+ Other properties are in subsequent tests.
+
+ Author: christine@netscape.com
+ Date: 29 september 1997
+*/
+
+var SECTION = "15.7.3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Number Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(SECTION,
+ "Number.length",
+ 1,
+ Number.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4-1.js
new file mode 100644
index 0000000000..175835987a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4-1.js
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4-1.js';
+
+/**
+ File Name: 15.7.4-1.js
+ ECMA Section: 15.7.4.1 Properties of the Number Prototype Object
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.7.4-1";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + "Properties of the Number prototype object");
+
+new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() );
+new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) );
+new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number );
+// new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.1.js
new file mode 100644
index 0000000000..27c0a0a9e4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.1.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.1.js';
+
+/**
+ File Name: 15.7.4.1.js
+ ECMA Section: 15.7.4.1.1 Number.prototype.constructor
+
+ Number.prototype.constructor is the built-in Number constructor.
+
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "Number.prototype.constructor",
+ Number,
+ Number.prototype.constructor );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-1.js
new file mode 100644
index 0000000000..531876d980
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-1.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.2-1.js';
+
+/**
+ File Name: 15.7.4.2.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.2-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
+
+// the following two lines cause navigator to crash -- cmb 9/16/97
+new TestCase(SECTION,
+ "Number.prototype.toString()",
+ "0",
+ eval("Number.prototype.toString()") );
+
+new TestCase(SECTION,
+ "typeof(Number.prototype.toString())",
+ "string",
+ eval("typeof(Number.prototype.toString())") );
+
+new TestCase(SECTION,
+ "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()",
+ "0",
+ eval("s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()") );
+
+new TestCase(SECTION,
+ "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()",
+ "1",
+ eval("s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()") );
+
+new TestCase(SECTION,
+ "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()",
+ "-1",
+ eval("s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()") );
+
+new TestCase(SECTION,
+ "var MYNUM = new Number(255); MYNUM.toString(10)",
+ "255",
+ eval("var MYNUM = new Number(255); MYNUM.toString(10)") );
+
+new TestCase(SECTION,
+ "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)",
+ "NaN",
+ eval("var MYNUM = new Number(Number.NaN); MYNUM.toString(10)") );
+
+new TestCase(SECTION,
+ "var MYNUM = new Number(Infinity); MYNUM.toString(10)",
+ "Infinity",
+ eval("var MYNUM = new Number(Infinity); MYNUM.toString(10)") );
+
+new TestCase(SECTION,
+ "var MYNUM = new Number(-Infinity); MYNUM.toString(10)",
+ "-Infinity",
+ eval("var MYNUM = new Number(-Infinity); MYNUM.toString(10)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-2-n.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-2-n.js
new file mode 100644
index 0000000000..a99b1deb45
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-2-n.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.2-2-n.js';
+
+/**
+ File Name: 15.7.4.2-2-n.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.2-2-n";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
+
+DESCRIPTION = "o = new Object(); o.toString = Number.prototype.toString; o.toString()";
+EXPECTED = "error";
+
+new TestCase(SECTION,
+ "o = new Object(); o.toString = Number.prototype.toString; o.toString()",
+ "error",
+ eval("o = new Object(); o.toString = Number.prototype.toString; o.toString()") );
+
+// new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") );
+// new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", eval("o = 3; o.toString = Number.prototype.toString; o.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-3-n.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-3-n.js
new file mode 100644
index 0000000000..f6148db1cc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-3-n.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.2-3-n.js';
+
+/**
+ File Name: 15.7.4.2-3-n.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.2-3-n";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
+
+DESCRIPTION = "o = new String(); o.toString = Number.prototype.toString; o.toString()";
+EXPECTED = "error";
+
+new TestCase(SECTION,
+ "o = new String(); o.toString = Number.prototype.toString; o.toString()",
+ "error",
+ eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-4.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-4.js
new file mode 100644
index 0000000000..c2fd40dd17
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.2-4.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.2-4.js';
+
+/**
+ File Name: 15.7.4.2-4.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.2-4";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
+
+new TestCase(SECTION,
+ "o = 3; o.toString = Number.prototype.toString; o.toString()",
+ "3",
+ eval("o = 3; o.toString = Number.prototype.toString; o.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-1.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-1.js
new file mode 100644
index 0000000000..755e2281b3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-1.js
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.3-1.js';
+
+/**
+ File Name: 15.7.4.3-1.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
+
+
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+
+// the following two line causes navigator to crash -- cmb 9/16/97
+new TestCase("SECTION",
+ "Number.prototype.valueOf()",
+ 0,
+ eval("Number.prototype.valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number(1)).valueOf()",
+ 1,
+ eval("(new Number(1)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number(-1)).valueOf()",
+ -1,
+ eval("(new Number(-1)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number(0)).valueOf()",
+ 0,
+ eval("(new Number(0)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number(Number.POSITIVE_INFINITY)).valueOf()",
+ Number.POSITIVE_INFINITY,
+ eval("(new Number(Number.POSITIVE_INFINITY)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number(Number.NaN)).valueOf()",
+ Number.NaN,
+ eval("(new Number(Number.NaN)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number()).valueOf()",
+ 0,
+ eval("(new Number()).valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-2.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-2.js
new file mode 100644
index 0000000000..1bfed1d4af
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-2.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.3-2.js';
+
+/**
+ File Name: 15.7.4.3-2.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.3-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+
+new TestCase(SECTION,
+ "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()",
+ 3,
+ eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-3-n.js b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-3-n.js
new file mode 100644
index 0000000000..7df413ae48
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/15.7.4.3-3-n.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.3-3-n.js';
+
+/**
+ File Name: 15.7.4.3-3.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.7.4.3-3-n";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+
+// new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") );
+
+DESCRIPTION = "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()";
+EXPECTED = "error";
+
+new TestCase("15.7.4.1",
+ "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()",
+ "error",
+ eval("v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()") );
+
+// new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", eval("v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/browser.js b/tests/auto/qml/parserstress/tests/ecma/Number/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Number/shell.js b/tests/auto/qml/parserstress/tests/ecma/Number/shell.js
new file mode 100644
index 0000000000..03cca1d551
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Number/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Number';
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.1.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.1.js
new file mode 100644
index 0000000000..73ddd2894c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.1.js
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.1.1.js';
+
+/**
+ File Name: 15.2.1.1.js
+ ECMA Section: 15.2.1.1 The Object Constructor Called as a Function:
+ Object(value)
+ Description: When Object is called as a function rather than as a
+ constructor, the following steps are taken:
+
+ 1. If value is null or undefined, create and return a
+ new object with no properties other than internal
+ properties exactly as if the object constructor
+ had been called on that same value (15.2.2.1).
+ 2. Return ToObject (value), whose rules are:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+var SECTION = "15.2.1.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object( value )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var NULL_OBJECT = Object(null);
+
+new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() );
+new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) );
+
+var UNDEFINED_OBJECT = Object( void 0 );
+
+new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() );
+new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) );
+
+new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
+new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
+new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
+new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
+new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
+new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
+new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
+new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
+new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
+new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
+new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
+new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
+new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
+new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
+new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
+new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
+new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
+new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
+new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
+new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
+new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
+new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
+new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
+// new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.2.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.2.js
new file mode 100644
index 0000000000..9e41594430
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.1.2.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.1.2.js';
+
+/**
+ File Name: 15.2.1.2.js
+ ECMA Section: 15.2.1.2 The Object Constructor Called as a Function:
+ Object(value)
+ Description: When Object is called as a function rather than as a
+ constructor, the following steps are taken:
+
+ 1. If value is null or undefined, create and return a
+ new object with no proerties other than internal
+ properties exactly as if the object constructor
+ had been called on that same value (15.2.2.1).
+ 2. Return ToObject (value), whose rules are:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+var SECTION = "15.2.1.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MYOB = Object();
+
+new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() );
+new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) );
+new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.1.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.1.js
new file mode 100644
index 0000000000..dfdfaeb4ab
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.1.js
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.2.1.js';
+
+/**
+ File Name: 15.2.2.1.js
+ ECMA Section: 15.2.2.1 The Object Constructor: new Object( value )
+
+ 1.If the type of the value is not Object, go to step 4.
+ 2.If the value is a native ECMAScript object, do not create a new object; simply return value.
+ 3.If the value is a host object, then actions are taken and a result is returned in an
+ implementation-dependent manner that may depend on the host object.
+ 4.If the type of the value is String, return ToObject(value).
+ 5.If the type of the value is Boolean, return ToObject(value).
+ 6.If the type of the value is Number, return ToObject(value).
+ 7.(The type of the value must be Null or Undefined.) Create a new native ECMAScript object.
+ The [[Prototype]] property of the newly constructed object is set to the Object prototype object.
+ The [[Class]] property of the newly constructed object is set to "Object".
+ The newly constructed object has no [[Value]] property.
+ Return the newly created native object.
+
+ Description: This does not test cases where the object is a host object.
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.2.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Object( value )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "typeof new Object(null)", "object", typeof new Object(null) );
+new TestCase( SECTION, "MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "typeof new Object(void 0)", "object", typeof new Object(void 0) );
+new TestCase( SECTION, "MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+
+new TestCase( SECTION, "typeof new Object('string')", "object", typeof new Object('string') );
+new TestCase( SECTION, "MYOB = (new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object('string').valueOf()", "string", (new Object('string')).valueOf() );
+
+new TestCase( SECTION, "typeof new Object('')", "object", typeof new Object('') );
+new TestCase( SECTION, "MYOB = (new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object('').valueOf()", "", (new Object('')).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(Number.NaN)", "object", typeof new Object(Number.NaN) );
+new TestCase( SECTION, "MYOB = (new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(Number.NaN).valueOf()", Number.NaN, (new Object(Number.NaN)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(0)", "object", typeof new Object(0) );
+new TestCase( SECTION, "MYOB = (new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(0).valueOf()", 0, (new Object(0)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(-0)", "object", typeof new Object(-0) );
+new TestCase( SECTION, "MYOB = (new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(-0).valueOf()", -0, (new Object(-0)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(1)", "object", typeof new Object(1) );
+new TestCase( SECTION, "MYOB = (new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(1).valueOf()", 1, (new Object(1)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(-1)", "object", typeof new Object(-1) );
+new TestCase( SECTION, "MYOB = (new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(-1).valueOf()", -1, (new Object(-1)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(true)", "object", typeof new Object(true) );
+new TestCase( SECTION, "MYOB = (new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(true).valueOf()", true, (new Object(true)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(false)", "object", typeof new Object(false) );
+new TestCase( SECTION, "MYOB = (new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(false).valueOf()", false, (new Object(false)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(Boolean())", "object", typeof new Object(Boolean()) );
+new TestCase( SECTION, "MYOB = (new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(Boolean()).valueOf()", Boolean(), (new Object(Boolean())).valueOf() );
+
+
+var myglobal = this;
+var myobject = new Object( "my new object" );
+var myarray = new Array();
+var myboolean = new Boolean();
+var mynumber = new Number();
+var mystring = new String();
+var myobject = new Object();
+var myfunction = new Function( "x", "return x");
+var mymath = Math;
+
+new TestCase( SECTION, "myglobal = new Object( this )", myglobal, new Object(this) );
+new TestCase( SECTION, "myobject = new Object('my new object'); new Object(myobject)", myobject, new Object(myobject) );
+new TestCase( SECTION, "myarray = new Array(); new Object(myarray)", myarray, new Object(myarray) );
+new TestCase( SECTION, "myboolean = new Boolean(); new Object(myboolean)", myboolean, new Object(myboolean) );
+new TestCase( SECTION, "mynumber = new Number(); new Object(mynumber)", mynumber, new Object(mynumber) );
+new TestCase( SECTION, "mystring = new String9); new Object(mystring)", mystring, new Object(mystring) );
+new TestCase( SECTION, "myobject = new Object(); new Object(mynobject)", myobject, new Object(myobject) );
+new TestCase( SECTION, "myfunction = new Function(); new Object(myfunction)", myfunction, new Object(myfunction) );
+new TestCase( SECTION, "mymath = Math; new Object(mymath)", mymath, new Object(mymath) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.2.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.2.js
new file mode 100644
index 0000000000..2a5743a826
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.2.2.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.2.2.js';
+
+/**
+ File Name: 15.2.2.2.js
+ ECMA Section: 15.2.2.2 new Object()
+ Description:
+
+ When the Object constructor is called with no argument, the following
+ step is taken:
+
+ 1. Create a new native ECMAScript object.
+ The [[Prototype]] property of the newly constructed object is set to
+ the Object prototype object.
+
+ The [[Class]] property of the newly constructed object is set
+ to "Object".
+
+ The newly constructed object has no [[Value]] property.
+
+ Return the newly created native object.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+var SECTION = "15.2.2.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Object()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "typeof new Object()", "object", typeof new Object() );
+new TestCase( SECTION, "Object.prototype.toString()", "[object Object]", Object.prototype.toString() );
+new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3-1.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3-1.js
new file mode 100644
index 0000000000..5242d7e6a5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3-1.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.3-1.js';
+
+/**
+ File Name: 15.2.3-1.js
+ ECMA Section: 15.2.3 Properties of the Object Constructor
+
+ Description: The value of the internal [[Prototype]] property of the
+ Object constructor is the Function prototype object.
+
+ Besides the call and construct propreties and the length
+ property, the Object constructor has properties described
+ in 15.2.3.1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.2.3";
+var VERSION = "ECMA_2";
+startTest();
+
+writeHeaderToLog( SECTION + " Properties of the Object Constructor");
+
+new TestCase( SECTION, "Object.length", 1, Object.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-1.js
new file mode 100644
index 0000000000..39510b6b22
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-1.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.3.1-1.js';
+
+/**
+ File Name: 15.2.3.1-1.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [DontEnum] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.2.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var str = '';for ( p in Object ) { str += p; }; str",
+ "",
+ eval( "var str = ''; for ( p in Object ) { str += p; }; str" ) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-2.js
new file mode 100644
index 0000000000..a92739f2d1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.3.1-2.js';
+
+/**
+ File Name: 15.2.3.1-2.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [DontDelete] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.2.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete( Object.prototype )",
+ false,
+ eval("delete( Object.prototype )") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-3.js
new file mode 100644
index 0000000000..0a82c6cd02
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-3.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.3.1-3.js';
+
+/**
+ File Name: 15.2.3.1-3.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [ReadOnly] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.2.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Object.prototype = null; Object.prototype",
+ Object.prototype,
+ eval("Object.prototype = null; Object.prototype"));
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-4.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-4.js
new file mode 100644
index 0000000000..86be98e1ad
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.1-4.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.3.1-4.js';
+
+/**
+ File Name: 15.2.3.1-4.js
+ ECMA Section: 15.2.3.1 Object.prototype
+
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
+
+ This tests the [DontDelete] property of Object.prototype
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.2.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete( Object.prototype ); Object.prototype",
+ Object.prototype,
+ eval("delete(Object.prototype); Object.prototype") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.js
new file mode 100644
index 0000000000..70a9605c2e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.3.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.3.js';
+
+/**
+ File Name: 15.2.3.js
+ ECMA Section: 15.2.3 Properties of the Object Constructor
+
+ Description: The value of the internal [[Prototype]] property of the
+ Object constructor is the Function prototype object.
+
+ Besides the call and construct propreties and the length
+ property, the Object constructor has properties described
+ in 15.2.3.1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.2.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Object Constructor";
+
+writeHeaderToLog( SECTION + " " + TITLE);
+
+// new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+new TestCase( SECTION, "Object.length", 1, Object.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.1.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.1.js
new file mode 100644
index 0000000000..bff668f43c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.1.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.4.1.js';
+
+/**
+ File Name: 15.2.4.1.js
+ ECMA Section: 15.2.4 Object.prototype.constructor
+
+ Description: The initial value of the Object.prototype.constructor
+ is the built-in Object constructor.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.2.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Object.prototype.constructor",
+ Object,
+ Object.prototype.constructor );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.2.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.2.js
new file mode 100644
index 0000000000..c52a825bb8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.2.js
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.4.2.js';
+
+/**
+ File Name: 15.2.4.2.js
+ ECMA Section: 15.2.4.2 Object.prototype.toString()
+
+ Description: When the toString method is called, the following
+ steps are taken:
+ 1. Get the [[Class]] property of this object
+ 2. Call ToString( Result(1) )
+ 3. Compute a string value by concatenating the three
+ strings "[object " + Result(2) + "]"
+ 4. Return Result(3).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.2.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype.toString()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
+
+new TestCase( SECTION, "myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()",
+ GLOBAL.replace(/ @ 0x[0-9a-fA-F]+ \(native @ 0x[0-9a-fA-F]+\)/, ''),
+ eval("myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()")
+ );
+
+new TestCase( SECTION, "myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Function]",
+ eval("myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()",
+ '[object Object]',
+ eval("myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Number]",
+ eval("myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object String]",
+ eval("myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Math]",
+ eval("myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Function]",
+ eval("myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Array]",
+ eval("myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Boolean]",
+ eval("myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Date]",
+ eval("myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+
+new TestCase( SECTION, "var MYVAR = new Object( this ); MYVAR.toString()",
+ GLOBAL.replace(/ @ 0x[0-9a-fA-F]+ \(native @ 0x[0-9a-fA-F]+\)/, ''),
+ eval("var MYVAR = new Object( this ); MYVAR.toString()")
+ );
+
+new TestCase( SECTION, "var MYVAR = new Object(); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(); MYVAR.toString()") );
+
+new TestCase( SECTION, "var MYVAR = new Object(void 0); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(void 0); MYVAR.toString()") );
+
+new TestCase( SECTION, "var MYVAR = new Object(null); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(null); MYVAR.toString()") );
+
+
+function MyObject( value ) {
+ this.value = new Function( "return this.value" );
+ this.toString = new Function ( "return this.value+''");
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.3.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.3.js
new file mode 100644
index 0000000000..17c4558679
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/15.2.4.3.js
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.4.3.js';
+
+/**
+ File Name: 15.2.4.3.js
+ ECMA Section: 15.2.4.3 Object.prototype.valueOf()
+
+ Description: As a rule, the valueOf method for an object simply
+ returns the object; but if the object is a "wrapper"
+ for a host object, as may perhaps be created by the
+ Object constructor, then the contained host object
+ should be returned.
+
+ This only covers native objects.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.2.4.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype.valueOf()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var myarray = new Array();
+myarray.valueOf = Object.prototype.valueOf;
+var myboolean = new Boolean();
+myboolean.valueOf = Object.prototype.valueOf;
+var myfunction = new Function();
+myfunction.valueOf = Object.prototype.valueOf;
+var myobject = new Object();
+myobject.valueOf = Object.prototype.valueOf;
+var mymath = Math;
+mymath.valueOf = Object.prototype.valueOf;
+var mydate = new Date();
+mydate.valueOf = Object.prototype.valueOf;
+var mynumber = new Number();
+mynumber.valueOf = Object.prototype.valueOf;
+var mystring = new String();
+mystring.valueOf = Object.prototype.valueOf;
+
+new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length );
+
+new TestCase( SECTION,
+ "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()",
+ myarray,
+ myarray.valueOf() );
+new TestCase( SECTION,
+ "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()",
+ myboolean,
+ myboolean.valueOf() );
+new TestCase( SECTION,
+ "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()",
+ myfunction,
+ myfunction.valueOf() );
+new TestCase( SECTION,
+ "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()",
+ myobject,
+ myobject.valueOf() );
+new TestCase( SECTION,
+ "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()",
+ mymath,
+ mymath.valueOf() );
+new TestCase( SECTION,
+ "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()",
+ mynumber,
+ mynumber.valueOf() );
+new TestCase( SECTION,
+ "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()",
+ mystring,
+ mystring.valueOf() );
+new TestCase( SECTION,
+ "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()",
+ mydate,
+ mydate.valueOf() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/browser.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/shell.js b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/shell.js
new file mode 100644
index 0000000000..1a71207967
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/ObjectObjects/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'ObjectObjects';
diff --git a/tests/auto/qml/parserstress/tests/ecma/README b/tests/auto/qml/parserstress/tests/ecma/README
new file mode 100755
index 0000000000..91f174ab61
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/README
@@ -0,0 +1 @@
+ECMA 262 Edition 1
diff --git a/tests/auto/qml/parserstress/tests/ecma/SourceText/6-1.js b/tests/auto/qml/parserstress/tests/ecma/SourceText/6-1.js
new file mode 100644
index 0000000000..487a47e3aa
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/SourceText/6-1.js
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '6-1.js';
+
+/**
+ File Name: 6-1.js
+ ECMA Section: Source Text
+ Description:
+
+ ECMAScript source text is represented as a sequence of characters
+ representable using the Unicode version 2.0 character encoding.
+
+ SourceCharacter ::
+ any Unicode character
+
+ However, it is possible to represent every ECMAScript program using
+ only ASCII characters (which are equivalent to the first 128 Unicode
+ characters). Non-ASCII Unicode characters may appear only within comments
+ and string literals. In string literals, any Unicode character may also be
+ expressed as a Unicode escape sequence consisting of six ASCII characters,
+ namely \u plus four hexadecimal digits. Within a comment, such an escape
+ sequence is effectively ignored as part of the comment. Within a string
+ literal, the Unicode escape sequence contributes one character to the string
+ value of the literal.
+
+ Note that ECMAScript differs from the Java programming language in the
+ behavior of Unicode escape sequences. In a Java program, if the Unicode escape
+ sequence \u000A, for example, occurs within a single-line comment, it is
+ interpreted as a line terminator (Unicode character 000A is line feed) and
+ therefore the next character is not part of the comment. Similarly, if the
+ Unicode escape sequence \u000A occurs within a string literal in a Java
+ program, it is likewise interpreted as a line terminator, which is not
+ allowed within a string literal-one must write \n instead of \u000A to
+ cause a line feed to be part of the string value of a string literal. In
+ an ECMAScript program, a Unicode escape sequence occurring within a comment
+ is never interpreted and therefore cannot contribute to termination of the
+ comment. Similarly, a Unicode escape sequence occurring within a string literal
+ in an ECMAScript program always contributes a character to the string value of
+ the literal and is never interpreted as a line terminator or as a quote mark
+ that might terminate the string literal.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Source Text";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var testcase = new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \u000A",
+ 'PASSED',
+ "PASSED" );
+
+// \u000A testcase.actual = "FAILED!";
+
+testcase =
+ new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'",
+ 'PASSED',
+ 'PASSED' );
+
+// the following character should noy be interpreted as a line terminator: \\n testcase.actual = "FAILED"
+
+testcase =
+ new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'",
+ 'PASSED',
+ 'PASSED' );
+
+// the following character should not be interpreted as a line terminator: \u000A testcase.actual = "FAILED"
+
+testcase =
+ new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'",
+ 'PASSED',
+ 'PASSED' );
+// the following character should not be interpreted as a line terminator: \n testcase.actual = 'FAILED'
+
+testcase =
+ new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: u000D",
+ 'PASSED',
+ 'PASSED' );
+
+// the following character should not be interpreted as a line terminator: \u000D testcase.actual = "FAILED"
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/SourceText/6-2.js b/tests/auto/qml/parserstress/tests/ecma/SourceText/6-2.js
new file mode 100644
index 0000000000..4044308053
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/SourceText/6-2.js
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '6-2.js';
+
+/**
+ File Name: 6-1.js
+ ECMA Section: Source Text
+ Description:
+
+ ECMAScript source text is represented as a sequence of characters
+ representable using the Unicode version 2.0 character encoding.
+
+ SourceCharacter ::
+ any Unicode character
+
+ However, it is possible to represent every ECMAScript program using
+ only ASCII characters (which are equivalent to the first 128 Unicode
+ characters). Non-ASCII Unicode characters may appear only within comments
+ and string literals. In string literals, any Unicode character may also be
+ expressed as a Unicode escape sequence consisting of six ASCII characters,
+ namely \u plus four hexadecimal digits. Within a comment, such an escape
+ sequence is effectively ignored as part of the comment. Within a string
+ literal, the Unicode escape sequence contributes one character to the string
+ value of the literal.
+
+ Note that ECMAScript differs from the Java programming language in the
+ behavior of Unicode escape sequences. In a Java program, if the Unicode escape
+ sequence \u000A, for example, occurs within a single-line comment, it is
+ interpreted as a line terminator (Unicode character 000A is line feed) and
+ therefore the next character is not part of the comment. Similarly, if the
+ Unicode escape sequence \u000A occurs within a string literal in a Java
+ program, it is likewise interpreted as a line terminator, which is not
+ allowed within a string literal-one must write \n instead of \u000A to
+ cause a line feed to be part of the string value of a string literal. In
+ an ECMAScript program, a Unicode escape sequence occurring within a comment
+ is never interpreted and therefore cannot contribute to termination of the
+ comment. Similarly, a Unicode escape sequence occurring within a string literal
+ in an ECMAScript program always contributes a character to the string value of
+ the literal and is never interpreted as a line terminator or as a quote mark
+ that might terminate the string literal.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Source Text";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// encoded quotes should not end a quote
+
+new TestCase( SECTION,
+ "var s = 'PAS\\u0022SED'; s",
+ "PAS\"SED",
+ eval("var s = 'PAS\\u0022SED'; s") );
+
+new TestCase( SECTION,
+ 'var s = "PAS\\u0022SED"; s',
+ "PAS\"SED",
+ eval('var s = "PAS\\u0022SED"; s') );
+
+
+new TestCase( SECTION,
+ "var s = 'PAS\\u0027SED'; s",
+ "PAS\'SED",
+ eval("var s = 'PAS\\u0027SED'; s") );
+
+
+new TestCase( SECTION,
+ 'var s = "PAS\\u0027SED"; s',
+ "PAS\'SED",
+ eval('var s = "PAS\\u0027SED"; s') );
+
+var testcase = new TestCase( SECTION,
+ 'var s="PAS\\u0027SED"; s',
+ "PAS\'SED",
+ "" );
+var s = "PAS\u0027SED";
+
+testcase.actual = s;
+
+testcase = new TestCase( SECTION,
+ 'var s = "PAS\\u0022SED"; s',
+ "PAS\"SED",
+ "" );
+var s = "PAS\u0022SED";
+
+testcase.actual = s;
+
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/SourceText/browser.js b/tests/auto/qml/parserstress/tests/ecma/SourceText/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/SourceText/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/SourceText/shell.js b/tests/auto/qml/parserstress/tests/ecma/SourceText/shell.js
new file mode 100644
index 0000000000..c8f9f02671
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/SourceText/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'SourceText';
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.10-1.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.10-1.js
new file mode 100644
index 0000000000..7cb13789eb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.10-1.js
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.10-1.js';
+
+/**
+ File Name: 12.10-1.js
+ ECMA Section: 12.10 The with statement
+ Description:
+ WithStatement :
+ with ( Expression ) Statement
+
+ The with statement adds a computed object to the front of the scope chain
+ of the current execution context, then executes a statement with this
+ augmented scope chain, then restores the scope chain.
+
+ Semantics
+
+ The production WithStatement : with ( Expression ) Statement is evaluated
+ as follows:
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Add Result(3) to the front of the scope chain.
+ 5. Evaluate Statement using the augmented scope chain from step 4.
+ 6. Remove Result(3) from the front of the scope chain.
+ 7. Return Result(5).
+
+ Discussion
+ Note that no matter how control leaves the embedded Statement, whether
+ normally or by some form of abrupt completion, the scope chain is always
+ restored to its former state.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "12.10-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The with statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// although the scope chain changes, the this value is immutable for a given
+// execution context.
+
+new TestCase( SECTION,
+ "with( new Number() ) { this +'' }",
+ GLOBAL,
+ eval("with( new Number() ) { this +'' }") );
+
+// the object's functions and properties should override those of the
+// global object.
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(true); with (MYOB) { parseInt() }",
+ true,
+ eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") );
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(false); with (MYOB) { NaN }",
+ false,
+ eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") );
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(NaN); with (MYOB) { Infinity }",
+ Number.NaN,
+ eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") );
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(false); with (MYOB) { }; Infinity",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") );
+
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") );
+
+// let us leave the with block via a break.
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") );
+
+
+test();
+
+function WithObject( value ) {
+ this.prop1 = 1;
+ this.prop2 = new Boolean(true);
+ this.prop3 = "a string";
+ this.value = value;
+
+ // now we will override global functions
+
+ this.parseInt = new Function( "return this.value" );
+ this.NaN = value;
+ this.Infinity = value;
+ this.unescape = new Function( "return this.value" );
+ this.escape = new Function( "return this.value" );
+ this.eval = new Function( "return this.value" );
+ this.parseFloat = new Function( "return this.value" );
+ this.isNaN = new Function( "return this.value" );
+ this.isFinite = new Function( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.10.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.10.js
new file mode 100644
index 0000000000..b8d27c64e9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.10.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.10.js';
+
+/**
+ File Name: 12.10-1.js
+ ECMA Section: 12.10 The with statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.10-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The with statement";
+
+writeHeaderToLog( SECTION +" "+ TITLE);
+
+new TestCase( SECTION,
+ "var x; with (7) x = valueOf(); typeof x;",
+ "number",
+ eval("var x; with(7) x = valueOf(); typeof x;") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.2-1.js
new file mode 100644
index 0000000000..d6f3b97f6d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.2-1.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.2-1.js';
+
+/**
+ File Name: 12.2-1.js
+ ECMA Section: The variable statement
+ Description:
+
+ If the variable statement occurs inside a FunctionDeclaration, the
+ variables are defined with function-local scope in that function, as
+ described in section 10.1.3. Otherwise, they are defined with global
+ scope, that is, they are created as members of the global object, as
+ described in section 0. Variables are created when the execution scope
+ is entered. A Block does not define a new execution scope. Only Program and
+ FunctionDeclaration produce a new scope. Variables are initialized to the
+ undefined value when created. A variable with an Initializer is assigned
+ the value of its AssignmentExpression when the VariableStatement is executed,
+ not when the variable is created.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "12.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The variable statement";
+
+writeHeaderToLog( SECTION +" "+ TITLE);
+
+new TestCase( "SECTION",
+ "var x = 3; function f() { var a = x; var x = 23; return a; }; f()",
+ void 0,
+ eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.5-1.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.5-1.js
new file mode 100644
index 0000000000..0745428c4a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.5-1.js
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.5-1.js';
+
+/**
+ File Name: 12.5-1.js
+ ECMA Section: The if statement
+ Description:
+
+ The production IfStatement : if ( Expression ) Statement else Statement
+ is evaluated as follows:
+
+ 1.Evaluate Expression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToBoolean(Result(2)).
+ 4.If Result(3) is false, go to step 7.
+ 5.Evaluate the first Statement.
+ 6.Return Result(5).
+ 7.Evaluate the second Statement.
+ 8.Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+
+var SECTION = "12.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The if statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION,
+ "var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
+ "PASSED",
+ eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
+ "PASSED",
+ eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.5-2.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.5-2.js
new file mode 100644
index 0000000000..143edb0705
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.5-2.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.5-2.js';
+
+/**
+ File Name: 12.5-2.js
+ ECMA Section: The if statement
+ Description:
+
+ The production IfStatement : if ( Expression ) Statement else Statement
+ is evaluated as follows:
+
+ 1.Evaluate Expression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToBoolean(Result(2)).
+ 4.If Result(3) is false, go to step 7.
+ 5.Evaluate the first Statement.
+ 6.Return Result(5).
+ 7.Evaluate the second Statement.
+ 8.Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "12.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The if statement" ;
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( false ) MYVAR='FAILED'; MYVAR;",
+ "PASSED",
+ eval("var MYVAR=\"PASSED\"; if ( false ) MYVAR='FAILED'; MYVAR;") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR") );
+
+new TestCase( SECTION,
+ "var MYVAR; if ( 0 ) MYVAR='FAILED'; MYVAR;",
+ "PASSED",
+ eval("var MYVAR=\"PASSED\"; if ( 0 ) MYVAR='FAILED'; MYVAR;") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.1-1.js
new file mode 100644
index 0000000000..97b9afaa82
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.1-1.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.1-1.js';
+
+/**
+ File Name: 12.6.1-1.js
+ ECMA Section: The while statement
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "12.6.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The While statement";
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION,
+ "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ",
+ 1,
+ eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR "));
+
+new TestCase( SECTION,
+ "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ",
+ 100,
+ eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR "));
+
+new TestCase( SECTION,
+ "function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)",
+ 2,
+ eval("function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)"));
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-1.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-1.js
new file mode 100644
index 0000000000..2ef9378f5a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-1.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-1.js';
+
+/**
+ File Name: 12.6.2-1.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "12.6.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( "12.6.2-1", "for statement", 99, testprogram() );
+
+test();
+
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; ; ) {
+ if ( ++myVar == 99 )
+ break;
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-2.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-2.js
new file mode 100644
index 0000000000..cc8676cd29
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-2.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-2.js';
+
+/**
+ File Name: 12.6.2-2.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+var SECTION = "12.6.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "for statement", 99, testprogram() );
+
+test();
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; ; myVar++ ) {
+ if ( myVar < 99 ) {
+ continue;
+ } else {
+ break;
+ }
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-3.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-3.js
new file mode 100644
index 0000000000..a16b7aa18e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-3.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-3.js';
+
+/**
+ File Name: 12.6.2-3.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+var SECTION = "12.6.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "for statement", 100, testprogram() );
+
+test();
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; myVar < 100 ; myVar++ ) {
+ continue;
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-4.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-4.js
new file mode 100644
index 0000000000..6b1500d3a4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-4.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-4.js';
+
+/**
+ File Name: 12.6.2-4.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "12.6.2-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "for statement", 100, testprogram() );
+
+test();
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; myVar < 100 ; myVar++ ) {
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-5.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-5.js
new file mode 100644
index 0000000000..a6f86ecc88
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-5.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-5.js';
+
+/**
+ File Name: 12.6.2-5.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+var SECTION = "12.6.2-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "for statement", 99, testprogram() );
+
+test();
+
+function testprogram() {
+ myVar = 0;
+
+ for ( ; myVar < 100 ; myVar++ ) {
+ if (myVar == 99)
+ break;
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-6.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-6.js
new file mode 100644
index 0000000000..48a4e2e607
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-6.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-6.js';
+
+/**
+ File Name: 12.6.2-6.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is present.
+ 2. second expression is not present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+var SECTION = "12.6.2-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( "12.6.2-6", "for statement", 256, testprogram() );
+
+test();
+
+function testprogram() {
+ var myVar;
+
+ for ( myVar=2; ; myVar *= myVar ) {
+
+ if (myVar > 100)
+ break;
+ continue;
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-7.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-7.js
new file mode 100644
index 0000000000..a14ced0497
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-7.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-7.js';
+
+/**
+ File Name: 12.6.2-7.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is present.
+ 2. second expression is not present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+var SECTION = "12.6.2-7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "for statement", 256, testprogram() );
+
+test();
+
+function testprogram() {
+ var myVar;
+
+ for ( myVar=2; myVar < 100 ; myVar *= myVar ) {
+
+ continue;
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-8.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-8.js
new file mode 100644
index 0000000000..73d931d838
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-8.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-8.js';
+
+/**
+ File Name: 12.6.2-8.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is present.
+ 2. second expression is present
+ 3. third expression is present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+var SECTION = "12.6.2-8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "for statement", 256, testprogram() );
+
+test();
+
+function testprogram() {
+ var myVar;
+
+ for ( myVar=2; myVar < 256; myVar *= myVar ) {
+ }
+
+ return myVar;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-9-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-9-n.js
new file mode 100644
index 0000000000..3e2f942a22
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.2-9-n.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.2-9-n.js';
+
+/**
+ File Name: 12.6.2-9-n.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+
+var SECTION = "12.6.2-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "for (i)";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "for (i)",
+ "error",
+ eval("for (i) { }") );
+
+/*
+ for (i) {
+ }
+
+*/
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-1.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-1.js
new file mode 100644
index 0000000000..6e23b84a48
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-1.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-1.js';
+
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+var SECTION = "12.6.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var x; Number.prototype.foo = 34; for ( j in 7 ) x = j; x",
+ "foo",
+ eval("var x; Number.prototype.foo = 34; for ( j in 7 ){x = j;} x") );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-10.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-10.js
new file mode 100644
index 0000000000..0e74f14ece
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-10.js
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-10.js';
+
+/**
+ File Name: 12.6.3-10.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+var count = 0;
+function f() { count++; return new Array("h","e","l","l","o"); }
+
+var result = "";
+for ( p in f() ) { result += f()[p] };
+
+new TestCase( SECTION,
+ "count = 0; result = \"\"; "+
+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
+ "for ( p in f() ) { result += f()[p] }; count",
+ 6,
+ count );
+
+new TestCase( SECTION,
+ "result",
+ "hello",
+ result );
+
+// LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+// LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+// LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+// LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+// LeftHandSideExpression:CallExpression:MemberExpression Arguments
+// LeftHandSideExpression:CallExpression Arguments
+// LeftHandSideExpression:CallExpression [ Expression ]
+// LeftHandSideExpression:CallExpression . Identifier
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-11.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-11.js
new file mode 100644
index 0000000000..efc65ee14e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-11.js
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-11.js';
+
+/**
+ File Name: 12.6.3-11.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// 5. Get the name of the next property of Result(3) that doesn't have the
+// DontEnum attribute. If there is no such property, go to step 14.
+
+var result = "";
+
+for ( p in Number ) { result += String(p) };
+
+new TestCase( SECTION,
+ "result = \"\"; for ( p in Number ) { result += String(p) };",
+ "",
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-12.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-12.js
new file mode 100644
index 0000000000..840ca9da65
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-12.js
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-12.js';
+
+/**
+ File Name: 12.6.3-12.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+
+ This is a regression test for http://bugzilla.mozilla.org/show_bug.cgi?id=9802.
+
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "PASSED";
+
+for ( aVar in this ) {
+ if (aVar == "aVar") {
+ result = "FAILED"
+ }
+};
+
+new TestCase(
+ SECTION,
+ "var result=''; for ( aVar in this ) { " +
+ "if (aVar == 'aVar') {return a failure}; result",
+ "PASSED",
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-19.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-19.js
new file mode 100644
index 0000000000..5acbee7127
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-19.js
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-19.js';
+
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+var count = 0;
+function f() { count++; return new Array("h","e","l","l","o"); }
+
+var result = "";
+for ( p in f() ) { result += f()[p] };
+
+new TestCase( SECTION,
+ "count = 0; result = \"\"; "+
+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
+ "for ( p in f() ) { result += f()[p] }; count",
+ 6,
+ count );
+
+new TestCase( SECTION,
+ "result",
+ "hello",
+ result );
+
+
+
+// LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+// LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+// LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+// LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+// LeftHandSideExpression:CallExpression:MemberExpression Arguments
+// LeftHandSideExpression:CallExpression Arguments
+// LeftHandSideExpression:CallExpression [ Expression ]
+// LeftHandSideExpression:CallExpression . Identifier
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-2.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-2.js
new file mode 100644
index 0000000000..3ed93dc9a1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-2.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-2.js';
+
+/**
+ File Name: 12.6.3-2.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description: Check the Boolean Object
+
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+
+var SECTION = "12.6.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]",
+ 34,
+ eval("Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] ") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-3.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-3.js
new file mode 100644
index 0000000000..f52569bba2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-3.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-3.js';
+
+/**
+ File Name: 12.6.3-3.js
+ ECMA Section: for..in loops
+ Description:
+
+ This verifies the fix to
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112156
+ for..in should take general lvalue for first argument
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "12.6.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var o = {};
+
+var result = "";
+
+for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); }
+
+new TestCase( SECTION,
+ "for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } result",
+ "123",
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-4.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-4.js
new file mode 100644
index 0000000000..c30641f8bb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-4.js
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-4.js';
+
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+var o = new MyObject();
+var result = 0;
+
+for ( MyObject in o ) {
+ result += o[MyObject];
+}
+
+new TestCase( SECTION,
+ "for ( MyObject in o ) { result += o[MyObject] }",
+ 6,
+ result );
+
+var result = 0;
+
+for ( value in o ) {
+ result += o[value];
+}
+
+new TestCase( SECTION,
+ "for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+var value = "value";
+var result = 0;
+for ( value in o ) {
+ result += o[value];
+}
+
+new TestCase( SECTION,
+ "value = \"value\"; for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+var value = 0;
+var result = 0;
+for ( value in o ) {
+ result += o[value];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+// this causes a segv
+
+var ob = { 0:"hello" };
+var result = 0;
+for ( ob[0] in o ) {
+ result += o[ob[0]];
+}
+
+new TestCase( SECTION,
+ "ob = { 0:\"hello\" }; for ( ob[0] in o ) { result += o[ob[0]]",
+ 6,
+ result );
+
+var result = 0;
+for ( ob["0"] in o ) {
+ result += o[ob["0"]];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( ob[\"0\"] in o ) { result += o[o[\"0\"]]",
+ 6,
+ result );
+
+var result = 0;
+var ob = { value:"hello" };
+for ( ob[value] in o ) {
+ result += o[ob[value]];
+}
+
+new TestCase( SECTION,
+ "ob = { 0:\"hello\" }; for ( ob[value] in o ) { result += o[ob[value]]",
+ 6,
+ result );
+
+var result = 0;
+for ( ob["value"] in o ) {
+ result += o[ob["value"]];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( ob[\"value\"] in o ) { result += o[ob[\"value\"]]",
+ 6,
+ result );
+
+var result = 0;
+for ( ob.value in o ) {
+ result += o[ob.value];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( ob.value in o ) { result += o[ob.value]",
+ 6,
+ result );
+
+// LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+// LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+// LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+// LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+// LeftHandSideExpression:CallExpression:MemberExpression Arguments
+// LeftHandSideExpression:CallExpression Arguments
+// LeftHandSideExpression:CallExpression [ Expression ]
+// LeftHandSideExpression:CallExpression . Identifier
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-5-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-5-n.js
new file mode 100644
index 0000000000..295d059c39
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-5-n.js
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-5-n.js';
+
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+DESCRIPTION = "more than one member expression";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "more than one member expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( var i, p in this) { result += this[p]; }") );
+
+/*
+ var o = new MyObject();
+ var result = 0;
+
+ for ( var i, p in this) {
+ result += this[p];
+ }
+*/
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-6-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-6-n.js
new file mode 100644
index 0000000000..8cb4c7f638
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-6-n.js
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-6-n.js';
+
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+DESCRIPTION = "bad left-hand side expression";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( this in o) { result += this[p]; }") );
+/*
+ var o = new MyObject();
+ var result = 0;
+
+ for ( this in o) {
+ result += this[p];
+ }
+*/
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-7-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-7-n.js
new file mode 100644
index 0000000000..871dd474cb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-7-n.js
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-7-n.js';
+
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+DESCRIPTION = "bad left-hand side expression";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( \"a\" in o) { result += this[p]; } ") );
+
+/*
+ var o = new MyObject();
+ var result = 0;
+
+ for ( "a" in o) {
+ result += this[p];
+ }
+*/
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-8-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-8-n.js
new file mode 100644
index 0000000000..b75a7b5f37
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-8-n.js
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-8-n.js';
+
+/**
+ File Name: 12.6.3-8-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+DESCRIPTION = "bad left-hand side expression";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( 1 in o) { result += this[p]; } ") );
+
+/*
+ var o = new MyObject();
+ var result = 0;
+
+ for ( 1 in o) {
+ result += this[p];
+ }
+*/
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-9-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-9-n.js
new file mode 100644
index 0000000000..f83a8ed65a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.6.3-9-n.js
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.6.3-9-n.js';
+
+/**
+ File Name: 12.6.3-9-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "12.6.3-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
+
+DESCRIPTION = "object is not defined";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "object is not defined",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( var o in foo) { result += this[o]; } ") );
+/*
+ var o = new MyObject();
+ var result = 0;
+
+ for ( var o in foo) {
+ result += this[o];
+ }
+*/
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.7-1-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.7-1-n.js
new file mode 100644
index 0000000000..7978f3be56
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.7-1-n.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.7-1-n.js';
+
+/**
+ File Name: 12.7-1-n.js
+ ECMA Section: 12.7 The continue statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "12.7.1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The continue statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "continue";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "continue",
+ "error",
+ eval("continue") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.8-1-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.8-1-n.js
new file mode 100644
index 0000000000..29f46cf29e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.8-1-n.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.8-1-n.js';
+
+/**
+ File Name: 12.8-1-n.js
+ ECMA Section: 12.8 The break statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "12.8-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The break in statement";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "break";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "break",
+ "error",
+ eval("break") );
+
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/12.9-1-n.js b/tests/auto/qml/parserstress/tests/ecma/Statements/12.9-1-n.js
new file mode 100644
index 0000000000..450cb66593
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/12.9-1-n.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '12.9-1-n.js';
+
+/**
+ File Name: 12.9-1-n.js
+ ECMA Section: 12.9 The return statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "12.9-1-n";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The return statement");
+
+DESCRIPTION = "return";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "return",
+ "error",
+ eval("return") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/browser.js b/tests/auto/qml/parserstress/tests/ecma/Statements/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Statements/shell.js b/tests/auto/qml/parserstress/tests/ecma/Statements/shell.js
new file mode 100644
index 0000000000..7346f697a5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Statements/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Statements';
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.1.js
new file mode 100644
index 0000000000..cf7ab8b420
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.1.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.1.js';
+
+/**
+ File Name: 15.5.1.js
+ ECMA Section: 15.5.1 The String Constructor called as a Function
+ 15.5.1.1 String(value)
+ 15.5.1.2 String()
+
+ Description: When String is called as a function rather than as
+ a constructor, it performs a type conversion.
+ - String(value) returns a string value (not a String
+ object) computed by ToString(value)
+ - String() returns the empty string ""
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The String Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String('string primitive')", "string primitive", String('string primitive') );
+new TestCase( SECTION, "String(void 0)", "undefined", String( void 0) );
+new TestCase( SECTION, "String(null)", "null", String( null ) );
+new TestCase( SECTION, "String(true)", "true", String( true) );
+new TestCase( SECTION, "String(false)", "false", String( false ) );
+new TestCase( SECTION, "String(Boolean(true))", "true", String(Boolean(true)) );
+new TestCase( SECTION, "String(Boolean(false))", "false", String(Boolean(false)) );
+new TestCase( SECTION, "String(Boolean())", "false", String(Boolean(false)) );
+new TestCase( SECTION, "String(new Array())", "", String( new Array()) );
+new TestCase( SECTION, "String(new Array(1,2,3))", "1,2,3", String( new Array(1,2,3)) );
+
+
+new TestCase( SECTION, "String( Number.NaN )", "NaN", String( Number.NaN ) );
+new TestCase( SECTION, "String( 0 )", "0", String( 0 ) );
+new TestCase( SECTION, "String( -0 )", "0", String( -0 ) );
+new TestCase( SECTION, "String( Number.POSITIVE_INFINITY )", "Infinity", String( Number.POSITIVE_INFINITY ) );
+new TestCase( SECTION, "String( Number.NEGATIVE_INFINITY )", "-Infinity", String( Number.NEGATIVE_INFINITY ) );
+new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
+
+// cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
+
+new TestCase( SECTION, "String( 1 )", "1", String( 1 ) );
+new TestCase( SECTION, "String( 10 )", "10", String( 10 ) );
+new TestCase( SECTION, "String( 100 )", "100", String( 100 ) );
+new TestCase( SECTION, "String( 1000 )", "1000", String( 1000 ) );
+new TestCase( SECTION, "String( 10000 )", "10000", String( 10000 ) );
+new TestCase( SECTION, "String( 10000000000 )", "10000000000", String( 10000000000 ) );
+new TestCase( SECTION, "String( 10000000000000000000 )", "10000000000000000000", String( 10000000000000000000 ) );
+new TestCase( SECTION, "String( 100000000000000000000 )","100000000000000000000",String( 100000000000000000000 ) );
+
+new TestCase( SECTION, "String( 12345 )", "12345", String( 12345 ) );
+new TestCase( SECTION, "String( 1234567890 )", "1234567890", String( 1234567890 ) );
+
+new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
+new TestCase( SECTION, "String( -10 )", "-10", String( -10 ) );
+new TestCase( SECTION, "String( -100 )", "-100", String( -100 ) );
+new TestCase( SECTION, "String( -1000 )", "-1000", String( -1000 ) );
+new TestCase( SECTION, "String( -1000000000 )", "-1000000000", String( -1000000000 ) );
+new TestCase( SECTION, "String( -1000000000000000 )", "-1000000000000000", String( -1000000000000000 ) );
+new TestCase( SECTION, "String( -100000000000000000000 )", "-100000000000000000000", String( -100000000000000000000 ) );
+new TestCase( SECTION, "String( -1000000000000000000000 )", "-1e+21", String( -1000000000000000000000 ) );
+
+new TestCase( SECTION, "String( -12345 )", "-12345", String( -12345 ) );
+new TestCase( SECTION, "String( -1234567890 )", "-1234567890", String( -1234567890 ) );
+
+// cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
+new TestCase( SECTION, "String( 1.0000001 )", "1.0000001", String( 1.0000001 ) );
+
+
+// cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
+
+// cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
+
+new TestCase( SECTION, "String( 1000000000000000000000 )", "1e+21", String( 1000000000000000000000 ) );
+new TestCase( SECTION, "String( 10000000000000000000000 )", "1e+22", String( 10000000000000000000000 ) );
+
+// cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
+new TestCase( SECTION, "String( 1.2345 )", "1.2345", String( 1.2345));
+new TestCase( SECTION, "String( 1.234567890 )", "1.23456789", String( 1.234567890 ));
+
+new TestCase( SECTION, "String( .12345 )", "0.12345", String(.12345 ) );
+new TestCase( SECTION, "String( .012345 )", "0.012345", String(.012345) );
+new TestCase( SECTION, "String( .0012345 )", "0.0012345", String(.0012345) );
+new TestCase( SECTION, "String( .00012345 )", "0.00012345", String(.00012345) );
+new TestCase( SECTION, "String( .000012345 )", "0.000012345", String(.000012345) );
+new TestCase( SECTION, "String( .0000012345 )", "0.0000012345", String(.0000012345) );
+new TestCase( SECTION, "String( .00000012345 )", "1.2345e-7", String(.00000012345));
+
+new TestCase( "15.5.2", "String()", "", String() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.2.js
new file mode 100644
index 0000000000..062d31cdc2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.2.js
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.2.js';
+
+/**
+ File Name: 15.5.2.js
+ ECMA Section: 15.5.2 The String Constructor
+ 15.5.2.1 new String(value)
+ 15.5.2.2 new String()
+
+ Description: When String is called as part of a new expression, it
+ is a constructor; it initializes the newly constructed
+ object.
+
+ - The prototype property of the newly constructed
+ object is set to the original String prototype object,
+ the one that is the intial value of String.prototype
+ - The internal [[Class]] property of the object is "String"
+ - The value of the object is ToString(value).
+ - If no value is specified, its value is the empty string.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') );
+new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() );
+new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring );
+
+new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) );
+new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() );
+new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString );
+
+new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) );
+new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() );
+new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf );
+
+new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) );
+new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() );
+new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt );
+
+new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) );
+new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() );
+new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt );
+
+new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) );
+new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() );
+new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf );
+
+new TestCase( SECTION, "typeof new String()", "object", typeof new String() );
+new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() );
+new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf );
+
+new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') );
+new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() );
+new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-1.js
new file mode 100644
index 0000000000..cc62c9ed51
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-1.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.1-1.js';
+
+/**
+ File Name: 15.5.3.1-1.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the DontEnum attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length );
+
+new TestCase( SECTION,
+ "var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str",
+ "",
+ eval("var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-2.js
new file mode 100644
index 0000000000..b87137a140
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-2.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.1-2.js';
+
+/**
+ File Name: 15.5.3.1-2.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the ReadOnly attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "String.prototype=null;String.prototype",
+ String.prototype,
+ eval("String.prototype=null;String.prototype") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-3.js
new file mode 100644
index 0000000000..f94f83db11
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-3.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.1-3.js';
+
+/**
+ File Name: 15.5.3.1-3.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the DontDelete attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "delete( String.prototype )", false, eval("delete ( String.prototype )") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-4.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-4.js
new file mode 100644
index 0000000000..af8c1b9560
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.1-4.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.1-4.js';
+
+/**
+ File Name: 15.5.3.1-4.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the DontDelete attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "delete( String.prototype );String.prototype", String.prototype, eval("delete ( String.prototype );String.prototype") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-1.js
new file mode 100644
index 0000000000..17e715bca0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-1.js
@@ -0,0 +1,190 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.2-1.js';
+
+/**
+ File Name: 15.5.3.2-1.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
+
+ This test covers Basic Latin (range U+0020 - U+007F)
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+
+var SECTION = "15.5.3.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.fromCharCode()";
+
+new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode );
+new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode );
+new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") );
+new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length );
+
+new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() );
+new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) );
+new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) );
+new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) );
+new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) );
+new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) );
+new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) );
+new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) );
+new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) );
+new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) );
+new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) );
+new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) );
+new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) );
+new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) );
+new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) );
+new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) );
+new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) );
+
+new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) );
+new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) );
+new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) );
+new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) );
+new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) );
+new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) );
+new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) );
+new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) );
+new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) );
+new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) );
+new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) );
+new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) );
+new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) );
+new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) );
+new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) );
+new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) );
+
+new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
+new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
+new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
+new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
+new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
+new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
+new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
+new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
+new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
+new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
+new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
+new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
+new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
+new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
+new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
+new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
+
+new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
+new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
+new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
+new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
+new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
+new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
+new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
+new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
+new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
+new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
+new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
+new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
+new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
+new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
+new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
+new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
+
+new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) );
+new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) );
+new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) );
+new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) );
+new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) );
+new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) );
+new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) );
+new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) );
+new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) );
+new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) );
+new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) );
+new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) );
+new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) );
+new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) );
+new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) );
+new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) );
+
+new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) );
+new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) );
+new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) );
+new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) );
+new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) );
+new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) );
+new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) );
+new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) );
+new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) );
+new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) );
+new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) );
+new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) );
+new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) );
+new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) );
+new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) );
+new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) );
+
+new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) );
+new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) );
+new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) );
+new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) );
+new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) );
+new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) );
+new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) );
+new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) );
+new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) );
+new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) );
+new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) );
+new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) );
+new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) );
+new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) );
+new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) );
+// new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-2.js
new file mode 100644
index 0000000000..563623e6e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-2.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.2-2.js';
+
+/**
+ File Name: 15.5.3.2-2.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
+
+ This tests String.fromCharCode with multiple arguments.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+
+var SECTION = "15.5.3.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.fromCharCode()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING",
+ " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
+ eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" ));
+
+new TestCase( SECTION,
+ "MYSTRING.length",
+ 0x007f - 0x0020,
+ MYSTRING.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-3.js
new file mode 100644
index 0000000000..ae41742be2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.2-3.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.2-3.js';
+
+/**
+ File Name: 15.5.3.2-1.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
+
+ This test covers Basic Latin (range U+0020 - U+007F)
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+
+var SECTION = "15.5.3.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.fromCharCode()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+for ( CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+for ( CHARCODE = 256; CHARCODE < 65536; CHARCODE+=333 ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+for ( CHARCODE = 65535; CHARCODE < 65538; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+for ( CHARCODE = Math.pow(2,32)-1; CHARCODE < Math.pow(2,32)+1; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+for ( CHARCODE = 0; CHARCODE > -65536; CHARCODE-=3333 ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
+new TestCase( SECTION, "(String.fromCharCode(65536)).charCodeAt(0)", 0, (String.fromCharCode(65536)).charCodeAt(0) );
+new TestCase( SECTION, "(String.fromCharCode(65537)).charCodeAt(0)", 1, (String.fromCharCode(65537)).charCodeAt(0) );
+
+test();
+
+function ToUint16( num ) {
+ num = Number( num );
+ if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( num < 0 ) ? -1 : 1;
+
+ num = sign * Math.floor( Math.abs( num ) );
+ num = num % Math.pow(2,16);
+ num = ( num > -65536 && num < 0) ? 65536 + num : num;
+ return num;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.js
new file mode 100644
index 0000000000..5370484568
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.3.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.js';
+
+/**
+ File Name: 15.5.3.1.js
+ ECMA Section: 15.5.3 Properties of the String Constructor
+
+ Description: The value of the internal [[Prototype]] property of
+ the String constructor is the Function prototype
+ object.
+
+ In addition to the internal [[Call]] and [[Construct]]
+ properties, the String constructor also has the length
+ property, as well as properties described in 15.5.3.1
+ and 15.5.3.2.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3";
+var VERSION = "ECMA_2";
+startTest();
+var passed = true;
+writeHeaderToLog( SECTION + " Properties of the String Constructor" );
+
+new TestCase( SECTION, "String.length", 1, String.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.1.js
new file mode 100644
index 0000000000..ae8e12463d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.1.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.1.js';
+
+/**
+ File Name: 15.5.4.1.js
+ ECMA Section: 15.5.4.1 String.prototype.constructor
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.5.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.constructor == String", true, String.prototype.constructor == String );
+
+new TestCase( SECTION, "var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()",
+ "[object String]",
+ eval("var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.10-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.10-1.js
new file mode 100644
index 0000000000..2647d18cb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.10-1.js
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.10-1.js';
+
+/**
+ File Name: 15.5.4.10-1.js
+ ECMA Section: 15.5.4.10 String.prototype.substring( start, end )
+ Description:
+
+ 15.5.4.10 String.prototype.substring(start, end)
+
+ Returns a substring of the result of converting this object to a string,
+ starting from character position start and running to character position
+ end of the string. The result is a string value, not a String object.
+
+ If either argument is NaN or negative, it is replaced with zero; if either
+ argument is larger than the length of the string, it is replaced with the
+ length of the string.
+
+ If start is larger than end, they are swapped.
+
+ When the substring method is called with two arguments start and end, the
+ following steps are taken:
+
+ 1. Call ToString, giving it the this value as its argument.
+ 2. Call ToInteger(start).
+ 3. Call ToInteger (end).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(2), 0), Result(4)).
+ 6. Compute min(max(Result(3), 0), Result(4)).
+ 7. Compute min(Result(5), Result(6)).
+ 8. Compute max(Result(5), Result(6)).
+ 9. Return a string whose length is the difference between Result(8) and
+ Result(7), containing characters from Result(1), namely the characters
+ with indices Result(7) through Result(8)1, in ascending order.
+
+ Note that the substring function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.10-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.substring( start, end )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
+
+// test cases for when substring is called with no arguments.
+
+// this is a string object
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.substring()",
+ "string",
+ eval("var s = new String('this is a string object'); typeof s.substring()") );
+
+new TestCase( SECTION,
+ "var s = new String(''); s.substring(1,0)",
+ "",
+ eval("var s = new String(''); s.substring(1,0)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(true, false)",
+ "t",
+ eval("var s = new String('this is a string object'); s.substring(false, true)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(NaN, Infinity)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(NaN, Infinity)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity, NaN)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(Infinity, NaN)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity, Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(Infinity, Infinity)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-0.01, 0)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(-0.01,0)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length, s.length)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length, s.length)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length+1, 0)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(s.length+1, 0)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)") );
+
+// this is not a String object, start is not an integer
+
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)",
+ "1,2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)") );
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)",
+ "1",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)") );
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')",
+ "3",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')") );
+
+
+// this is an object object
+new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)",
+ "[object ",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,obj.toString().length)",
+ "Object]",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8, obj.toString().length)") );
+
+// this is a function object
+new TestCase( SECTION,
+ "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8, Infinity)",
+ "Function]",
+ eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8,Infinity)") );
+// this is a number object
+new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)",
+ "NaN",
+ eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)") );
+
+// this is the Math object
+new TestCase( SECTION,
+ "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)",
+ "[ob",
+ eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)") );
+
+// this is a Boolean object
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))",
+ "f",
+ eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))") );
+
+// this is a user defined object
+
+new TestCase( SECTION,
+ "var obj = new MyObject( void 0 ); obj.substring(0, 100)",
+ "undefined",
+ eval( "var obj = new MyObject( void 0 ); obj.substring(0,100)") );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-1.js
new file mode 100644
index 0000000000..a705f3bbda
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-1.js
@@ -0,0 +1,518 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.11-1.js';
+
+/**
+ File Name: 15.5.4.11-1.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.11-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
+
+// Basic Latin, Latin-1 Supplement, Latin Extended A
+for ( var i = 0; i <= 0x017f; i++ ) {
+ var U = new Unicode(i);
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-2.js
new file mode 100644
index 0000000000..7377dc8247
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-2.js
@@ -0,0 +1,515 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.11-2.js';
+
+/**
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.11-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Georgian
+// Range: U+10A0 to U+10FF
+for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
+ var U = new Unicode( i );
+
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-3.js
new file mode 100644
index 0000000000..0a37dcd28a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-3.js
@@ -0,0 +1,514 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.11-3.js';
+
+/**
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.11-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Halfwidth and Fullwidth Forms
+// Range: U+FF00 to U+FFEF
+for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
+ var U = new Unicode(i);
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-4.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-4.js
new file mode 100644
index 0000000000..1196e61c08
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-4.js
@@ -0,0 +1,507 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.11-4.js';
+
+/**
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.11-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Hiragana (no upper / lower case)
+// Range: U+3040 to U+309F
+
+for ( var i = 0x3040; i <= 0x309F; i++ ) {
+ var U = new Unicode( i );
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ this.upper = c;
+ this.lower = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+ if ( c == 0x00FF ) {
+ this.upper = 0x0178;
+ this.lower = c;
+ return this;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ this.upper = c;
+ this.lower = 0x0069;
+ return this;
+ }
+ if ( c == 0x0131 ) {
+ this.upper = 0x0049;
+ this.lower = c;
+ return this;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+ if ( c == 0x0178 ) {
+ this.upper = c;
+ this.lower = 0x00FF;
+ return this;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+ if ( c == 0x017F ) {
+ this.upper = 0x0053;
+ this.lower = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ this.upper = c;
+ this.lower = c + 80;
+ return this;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ this.upper = c -80;
+ this.lower = c;
+ return this;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ this.upper = c;
+ this.lower = c +1;
+ } else {
+ this.upper = c - 1;
+ this.lower = c;
+ }
+ return this;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ this.upper = c;
+ this.lower = c + 48;
+ return this;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ this.upper = c - 48;
+ this.lower = c;
+ return this;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ this.upper = c;
+ this.lower = c + 48;
+ return this;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ this.upper = c;
+ this.lower = c;
+ return this;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return this;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-5.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-5.js
new file mode 100644
index 0000000000..eec6410200
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-5.js
@@ -0,0 +1,520 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.11-5.js';
+
+/**
+ File Name: 15.5.4.11-5.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.11-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
+
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
+
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
+
+// Cyrillic (part)
+// Range: U+0400 to U+04FF
+for ( var i = 0x0400; i <= 0x047F; i++ ) {
+ var U = new Unicode( i );
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-6.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-6.js
new file mode 100644
index 0000000000..e3cc6039d4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.11-6.js
@@ -0,0 +1,516 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.11-6.js';
+
+/**
+ File Name: 15.5.4.11-6.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.11-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Armenian
+// Range: U+0530 to U+058F
+for ( var i = 0x0530; i <= 0x058F; i++ ) {
+
+ var U = new Unicode( i );
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-1.js
new file mode 100644
index 0000000000..ecc497db48
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-1.js
@@ -0,0 +1,520 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.12-1.js';
+
+/**
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.12-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.toUpperCase.length", 0, String.prototype.toUpperCase.length );
+new TestCase( SECTION, "delete String.prototype.toUpperCase.length", false, delete String.prototype.toUpperCase.length );
+new TestCase( SECTION, "delete String.prototype.toupperCase.length; String.prototype.toupperCase.length", 0, eval("delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.length") );
+
+// Basic Latin, Latin-1 Supplement, Latin Extended A
+for ( var i = 0; i <= 0x017f; i++ ) {
+ var U = new Unicode( i );
+
+ // XXX DF fails in java
+
+ if ( i == 0x00DF ) {
+ continue;
+ }
+
+
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+}
+
+test();
+
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-2.js
new file mode 100644
index 0000000000..c22b87b4dc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-2.js
@@ -0,0 +1,518 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.12-2.js';
+
+/**
+ File Name: 15.5.4.12-2.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.12-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = "";
+var EXPECT_STRING = "";
+
+// basic latin test
+
+for ( var i = 0; i < 0x007A; i++ ) {
+ var u = new Unicode(i);
+ TEST_STRING += String.fromCharCode(i);
+ EXPECT_STRING += String.fromCharCode( u.upper );
+}
+
+// don't print out the value of the strings since they contain control
+// characters that break the driver
+var isEqual = EXPECT_STRING == (new String( TEST_STRING )).toUpperCase();
+
+new TestCase( SECTION,
+ "isEqual",
+ true,
+ isEqual);
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-3.js
new file mode 100644
index 0000000000..d9d8bc69ce
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-3.js
@@ -0,0 +1,559 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.12-3.js';
+
+/**
+ File Name: 15.5.4.12-3.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.12-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Georgian
+// Range: U+10A0 to U+10FF
+for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
+ var U = new Unicode( i );
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ String.fromCharCode(U.upper),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+
+}
+
+// Halfwidth and Fullwidth Forms
+// Range: U+FF00 to U+FFEF
+for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ eval( "var u = new Unicode( i ); u.upper" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
+}
+
+// Hiragana (no upper / lower case)
+// Range: U+3040 to U+309F
+
+for ( var i = 0x3040; i <= 0x309F; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ eval( "var u = new Unicode( i ); u.upper" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
+}
+
+
+/*
+ var TEST_STRING = "";
+ var EXPECT_STRING = "";
+
+ // basic latin test
+
+ for ( var i = 0; i < 0x007A; i++ ) {
+ var u = new Unicode(i);
+ TEST_STRING += String.fromCharCode(i);
+ EXPECT_STRING += String.fromCharCode( u.upper );
+ }
+*/
+
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-4.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-4.js
new file mode 100644
index 0000000000..caf5663f07
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-4.js
@@ -0,0 +1,515 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.12-4.js';
+
+/**
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.12-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Cyrillic (part)
+// Range: U+0400 to U+04FF
+for ( var i = 0x0400; i <= 0x047F; i++ ) {
+ var U =new Unicode( i );
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ U.upper,
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-5.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-5.js
new file mode 100644
index 0000000000..2fbed42202
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.12-5.js
@@ -0,0 +1,515 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.12-5.js';
+
+/**
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
+
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
+
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
+
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.12-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Armenian
+// Range: U+0530 to U+058F
+for ( var i = 0x0530; i <= 0x058F; i++ ) {
+ var U = new Unicode( i );
+/*
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ String.fromCharCode(U.upper),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+*/
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+
+}
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
+function Unicode( c ) {
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
+ return this;
+}
+function GetUnicodeValues( c ) {
+ u = new Array();
+
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
+ u[0] = c;
+ u[1] = c;
+ return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
+}
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "0x";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-1.js
new file mode 100644
index 0000000000..e607ed51e4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-1.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.2-1.js';
+
+/**
+ File Name: 15.5.4.2-1.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.4.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toString";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
+new TestCase( SECTION, "(new String()).toString()", "", (new String()).toString() );
+new TestCase( SECTION, "(new String(\"\")).toString()", "", (new String("")).toString() );
+new TestCase( SECTION, "(new String( String() )).toString()","", (new String(String())).toString() );
+new TestCase( SECTION, "(new String( \"h e l l o\" )).toString()", "h e l l o", (new String("h e l l o")).toString() );
+new TestCase( SECTION, "(new String( 0 )).toString()", "0", (new String(0)).toString() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-2-n.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-2-n.js
new file mode 100644
index 0000000000..930c1f8136
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-2-n.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.2-2-n.js';
+
+/**
+ File Name: 15.5.4.2-2-n.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.4.2-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toString";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()",
+ "error",
+ eval("var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-3.js
new file mode 100644
index 0000000000..1e306a06f3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2-3.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.2-3.js';
+
+/**
+ File Name: 15.5.4.2-3.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+
+var SECTION = "15.5.4.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toString";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()",
+ "",
+ eval("var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()") );
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()",
+ "0",
+ eval("var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()") );
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()",
+ "hello",
+ eval("var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()") );
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()",
+ "",
+ eval("var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2.js
new file mode 100644
index 0000000000..0a1100fc63
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.2.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.2.js';
+
+/**
+ File Name: 15.5.4.2.js
+ ECMA Section: 15.5.4.2 String.prototype.toString
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.5.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.tostring";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "String.prototype.toString() == String.prototype.valueOf()",
+ true,
+ String.prototype.toString() == String.prototype.valueOf() );
+
+new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
+new TestCase( SECTION, "String.prototype.toString.length", 0, String.prototype.toString.length );
+
+
+new TestCase( SECTION,
+ "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-1.js
new file mode 100644
index 0000000000..b990876fe8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-1.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.3-1.js';
+
+/**
+ File Name: 15.5.4.3-1.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.valueOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.valueOf.length", 0, String.prototype.valueOf.length );
+
+new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() );
+new TestCase( SECTION, "(new String()).valueOf()", "", (new String()).valueOf() );
+new TestCase( SECTION, "(new String(\"\")).valueOf()", "", (new String("")).valueOf() );
+new TestCase( SECTION, "(new String( String() )).valueOf()","", (new String(String())).valueOf() );
+new TestCase( SECTION, "(new String( \"h e l l o\" )).valueOf()", "h e l l o", (new String("h e l l o")).valueOf() );
+new TestCase( SECTION, "(new String( 0 )).valueOf()", "0", (new String(0)).valueOf() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-2.js
new file mode 100644
index 0000000000..4747e013e6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-2.js
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.3-2.js';
+
+/**
+ File Name: 15.5.4.3-2.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+
+var SECTION = "15.5.4.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.valueOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valof()",
+ "",
+ eval("var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valueOf()") );
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valof()",
+ "0",
+ eval("var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valueOf()") );
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valof()",
+ "hello",
+ eval("var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valueOf()") );
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valof()",
+ "",
+ eval("var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valueOf()") );
+/*
+ new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
+ "error",
+ eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") );
+*/
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-3-n.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-3-n.js
new file mode 100644
index 0000000000..bdfa52ece0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.3-3-n.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.3-3-n.js';
+
+/**
+ File Name: 15.5.4.3-3-n.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+
+var SECTION = "15.5.4.3-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.valueOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
+ "error",
+ eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-1.js
new file mode 100644
index 0000000000..5dbffb1d14
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-1.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.4-1.js';
+
+/**
+ File Name: 15.5.4.4-1.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+
+ In this test, this is a String, pos is an integer, and
+ all pos are in range.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+var item = 0;
+var i;
+
+for ( i = 0x0020; i < 0x007e; i++, item++) {
+ new TestCase( SECTION,
+ "TEST_STRING.charAt("+item+")",
+ String.fromCharCode( i ),
+ TEST_STRING.charAt( item ) );
+}
+
+for ( i = 0x0020; i < 0x007e; i++, item++) {
+ new TestCase( SECTION,
+ "TEST_STRING.charAt("+item+") == TEST_STRING.substring( "+item +", "+ (item+1) + ")",
+ true,
+ TEST_STRING.charAt( item ) == TEST_STRING.substring( item, item+1 )
+ );
+}
+
+new TestCase( SECTION, "String.prototype.charAt.length", 1, String.prototype.charAt.length );
+
+print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-2.js
new file mode 100644
index 0000000000..c822a1d5f7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-2.js
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.4-2.js';
+
+/**
+ File Name: 15.5.4.4-1.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.4-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)", "u", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)", "e", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)") );
+
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)") );
+
+new TestCase( SECTION, "x = new String(); x.charAt(0)", "", eval("x=new String();x.charAt(0)") );
+new TestCase( SECTION, "x = new String(); x.charAt(1)", "", eval("x=new String();x.charAt(1)") );
+new TestCase( SECTION, "x = new String(); x.charAt(-1)", "", eval("x=new String();x.charAt(-1)") );
+
+new TestCase( SECTION, "x = new String(); x.charAt(NaN)", "", eval("x=new String();x.charAt(Number.NaN)") );
+new TestCase( SECTION, "x = new String(); x.charAt(Number.POSITIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.POSITIVE_INFINITY)") );
+new TestCase( SECTION, "x = new String(); x.charAt(Number.NEGATIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.NEGATIVE_INFINITY)") );
+
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(0)", "1", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(0)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(1)", "2", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(1)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(2)", "3", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(2)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(3)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(3)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(4)", "5", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(4)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(5)", "6", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(5)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(6)", "7", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(6)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(7)", "8", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(7)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(8)", "9", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(8)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(9)", "0", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(9)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(10)", "", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(10)") );
+
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)") );
+
+// MyOtherObject.toString will return "[object Object]
+
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)", "[", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)", "o", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)", " ", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)", "O", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)", "]", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)") );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return this.value +''" );
+ this.charAt = String.prototype.charAt;
+}
+function MyOtherObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.charAt = String.prototype.charAt;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-3.js
new file mode 100644
index 0000000000..96b4759c98
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-3.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.4-3.js';
+
+/**
+ File Name: 15.5.4.4-3.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ This tests assiging charAt to a user-defined function.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.4-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var foo = new MyObject('hello');
+
+
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "h", foo.charAt(0) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "e", foo.charAt(1) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(2) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(3) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "o", foo.charAt(4) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(-1) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(5) );
+
+var boo = new MyObject(true);
+
+new TestCase( SECTION, "var boo = new MyObject(true); ", "t", boo.charAt(0) );
+new TestCase( SECTION, "var boo = new MyObject(true); ", "r", boo.charAt(1) );
+new TestCase( SECTION, "var boo = new MyObject(true); ", "u", boo.charAt(2) );
+new TestCase( SECTION, "var boo = new MyObject(true); ", "e", boo.charAt(3) );
+
+var noo = new MyObject( Math.PI );
+
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "3", noo.charAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", ".", noo.charAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "4", noo.charAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(4) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "5", noo.charAt(5) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "9", noo.charAt(6) );
+
+test();
+
+function MyObject (v) {
+ this.value = v;
+ this.toString = new Function( "return this.value +'';" );
+ this.valueOf = new Function( "return this.value" );
+ this.charAt = String.prototype.charAt;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-4.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-4.js
new file mode 100644
index 0000000000..bf9f7a6898
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.4-4.js
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.4-4.js';
+
+/**
+ File Name: 15.5.4.4-4.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ This tests assiging charAt to primitive types..
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.4-4";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "String.prototype.charAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)", "2", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)", "3", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)") );
+
+new TestCase( SECTION, "x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)", "", eval("x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)") );
+
+new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)") );
+
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(4)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(5)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(6)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(7)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(8)", "O", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(8)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(9)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(9)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(10)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(10)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(11)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(11)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(12)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(12)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(13)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(13)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(14)", "]", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(14)") );
+
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)", "F", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)", "u", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)", "i", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)", "]", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)", "", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)") );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-1.js
new file mode 100644
index 0000000000..a1ba440a60
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-1.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.5-1.js';
+
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) {
+ new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCodeAt( j ) );
+}
+
+new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.charCodeAt( i ) );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-2.js
new file mode 100644
index 0000000000..29cb76152e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-2.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.5-2.js';
+
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+var x;
+
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
+
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
+
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)", 0x0031, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)", 0x0032, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)", 0x0033, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)", NaN, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)") );
+
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)", 0x005B, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)", 0x006F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)", 0x0065, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)", 0x0063, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)", 0x0074, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)") );
+
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)", 0x0020, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)") );
+
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)", 0x004F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-3.js
new file mode 100644
index 0000000000..46852f4022
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-3.js
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.5-3.js';
+
+/**
+ File Name: 15.5.4.5-3.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+
+var foo = new MyObject('hello');
+
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(0)", 0x0068, foo.charCodeAt(0) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(1)", 0x0065, foo.charCodeAt(1) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(2)", 0x006c, foo.charCodeAt(2) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(3)", 0x006c, foo.charCodeAt(3) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(4)", 0x006f, foo.charCodeAt(4) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(-1)", Number.NaN, foo.charCodeAt(-1) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(5)", Number.NaN, foo.charCodeAt(5) );
+
+var boo = new MyObject(true);
+
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(0)", 0x0074, boo.charCodeAt(0) );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(1)", 0x0072, boo.charCodeAt(1) );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(2)", 0x0075, boo.charCodeAt(2) );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(3)", 0x0065, boo.charCodeAt(3) );
+
+var noo = new MyObject( Math.PI );
+
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(0)", 0x0033, noo.charCodeAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(1)", 0x002E, noo.charCodeAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(2)", 0x0031, noo.charCodeAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(3)", 0x0034, noo.charCodeAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(4)", 0x0031, noo.charCodeAt(4) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(5)", 0x0035, noo.charCodeAt(5) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(6)", 0x0039, noo.charCodeAt(6) );
+
+var noo = new MyObject( null );
+
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(0)", 0x006E, noo.charCodeAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(1)", 0x0075, noo.charCodeAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(2)", 0x006C, noo.charCodeAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(3)", 0x006C, noo.charCodeAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(4)", NaN, noo.charCodeAt(4) );
+
+var noo = new MyObject( void 0 );
+
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(0)", 0x0075, noo.charCodeAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(1)", 0x006E, noo.charCodeAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(2)", 0x0064, noo.charCodeAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(3)", 0x0065, noo.charCodeAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(4)", 0x0066, noo.charCodeAt(4) );
+
+test();
+
+
+function MyObject (v) {
+ this.value = v;
+ this.toString = new Function ( "return this.value +\"\"" );
+ this.charCodeAt = String.prototype.charCodeAt;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-4.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-4.js
new file mode 100644
index 0000000000..e1d42c820f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-4.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.5-4.js';
+
+/**
+ File Name: 15.5.4.5-4.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+
+ Description: Returns a nonnegative integer less than 2^16.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var VERSION = "0697";
+startTest();
+var SECTION = "15.5.4.5-4";
+
+writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" );
+
+var MAXCHARCODE = Math.pow(2,16);
+var item=0, CHARCODE;
+
+for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
+ CHARCODE,
+ (String.fromCharCode(CHARCODE)).charCodeAt(0) );
+}
+for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
+ CHARCODE,
+ (String.fromCharCode(CHARCODE)).charCodeAt(0) );
+}
+
+new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-5.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-5.js
new file mode 100644
index 0000000000..cb3ec71e25
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.5-5.js
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.5-5.js';
+
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.5-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = "";
+
+for ( var i = 0x0000; i < 255; i++ ) {
+ TEST_STRING += String.fromCharCode( i );
+}
+
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
+
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
+
+for ( var j = 0; j < 255; j++ ) {
+ new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", j, TEST_STRING.charCodeAt(j) );
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-1.js
new file mode 100644
index 0000000000..94e34ad5ed
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-1.js
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.6-1.js';
+
+/**
+ File Name: 15.5.4.6-1.js
+ ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
+ Description: If the given searchString appears as a substring of the
+ result of converting this object to a string, at one or
+ more positions that are at or to the right of the
+ specified position, then the index of the leftmost such
+ position is returned; otherwise -1 is returned. If
+ positionis undefined or not supplied, 0 is assumed, so
+ as to search all of the string.
+
+ When the indexOf method is called with two arguments,
+ searchString and pos, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its
+ argument.
+ 2. Call ToString(searchString).
+ 3. Call ToInteger(position). (If position is undefined
+ or not supplied, this step produces the value 0).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(3), 0), Result(4)).
+ 6. Compute the number of characters in the string that
+ is Result(2).
+ 7. Compute the smallest possible integer k not smaller
+ than Result(5) such that k+Result(6) is not greater
+ than Result(4), and for all nonnegative integers j
+ less than Result(6), the character at position k+j
+ of Result(1) is the same as the character at position
+ j of Result(2); but if there is no such integer k,
+ then compute the value -1.
+ 8. Return Result(7).
+
+ Note that the indexOf function is intentionally generic;
+ it does not require that its this value be a String object.
+ Therefore it can be transferred to other kinds of objects
+ for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.protoype.indexOf";
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var j = 0;
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf(" +String.fromCharCode(i)+ ", 0)",
+ k,
+ TEST_STRING.indexOf( String.fromCharCode(i), 0 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+String.fromCharCode(i)+ ", "+ k +")",
+ k,
+ TEST_STRING.indexOf( String.fromCharCode(i), k ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")",
+ -1,
+ TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+0+")",
+ k,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ 0 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k +")",
+ k,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k ) );
+}
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k+1 +")",
+ -1,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k+1 ) );
+}
+
+new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) );
+
+new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 ));
+
+print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-2.js
new file mode 100644
index 0000000000..acaeffb38a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.6-2.js
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.6-2.js';
+
+/**
+ File Name: 15.5.4.6-1.js
+ ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
+ Description: If the given searchString appears as a substring of the
+ result of converting this object to a string, at one or
+ more positions that are at or to the right of the
+ specified position, then the index of the leftmost such
+ position is returned; otherwise -1 is returned. If
+ positionis undefined or not supplied, 0 is assumed, so
+ as to search all of the string.
+
+ When the indexOf method is called with two arguments,
+ searchString and pos, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its
+ argument.
+ 2. Call ToString(searchString).
+ 3. Call ToInteger(position). (If position is undefined
+ or not supplied, this step produces the value 0).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(3), 0), Result(4)).
+ 6. Compute the number of characters in the string that
+ is Result(2).
+ 7. Compute the smallest possible integer k not smaller
+ than Result(5) such that k+Result(6) is not greater
+ than Result(4), and for all nonnegative integers j
+ less than Result(6), the character at position k+j
+ of Result(1) is the same as the character at position
+ j of Result(2); but if there is no such integer k,
+ then compute the value -1.
+ 8. Return Result(7).
+
+ Note that the indexOf function is intentionally generic;
+ it does not require that its this value be a String object.
+ Therefore it can be transferred to other kinds of objects
+ for use as a method.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 02 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.7
+ The length property of the indexOf method is 1
+ *
+ */
+var SECTION = "15.5.4.6-2";
+var VERSION = "ECMA_1";
+var TITLE = "String.protoype.indexOf";
+var BUGNUMBER="105721";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// the following test regresses http://scopus/bugsplat/show_bug.cgi?id=105721
+
+// regress http://scopus/bugsplat/show_bug.cgi?id=105721
+
+new TestCase( SECTION,
+ "function f() { return this; }; function g() { var h = f; return h(); }; g().toString()",
+ GLOBAL,
+ g().toString()
+ );
+
+
+new TestCase( SECTION, "String.prototype.indexOf.length", 1, String.prototype.indexOf.length );
+new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype.indexOf.length", 1, eval("String.prototype.indexOf.length = null; String.prototype.indexOf.length") );
+new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length );
+new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") );
+
+new TestCase( SECTION,
+ "var s = new String(); s.indexOf()",
+ -1,
+ eval("var s = new String(); s.indexOf()") );
+
+// some Unicode tests.
+
+// generate a test string.
+
+var TEST_STRING = "";
+
+for ( var u = 0x00A1; u <= 0x00FF; u++ ) {
+ TEST_STRING += String.fromCharCode( u );
+}
+
+for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
+ new TestCase( SECTION,
+ "TEST_STRING.indexOf( " + String.fromCharCode(u) + " )",
+ i,
+ TEST_STRING.indexOf( String.fromCharCode(u) ) );
+}
+for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
+ new TestCase( SECTION,
+ "TEST_STRING.indexOf( " + String.fromCharCode(u) + ", void 0 )",
+ i,
+ TEST_STRING.indexOf( String.fromCharCode(u), void 0 ) );
+}
+
+
+
+var foo = new MyObject('hello');
+
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('h')", 0, foo.indexOf("h") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('e')", 1, foo.indexOf("e") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('o')", 4, foo.indexOf("o") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('X')", -1, foo.indexOf("X") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf(5) ", -1, foo.indexOf(5) );
+
+var boo = new MyObject(true);
+
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('t')", 0, boo.indexOf("t") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('r')", 1, boo.indexOf("r") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('u')", 2, boo.indexOf("u") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('e')", 3, boo.indexOf("e") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('true')", 0, boo.indexOf("true") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('rue')", 1, boo.indexOf("rue") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('ue')", 2, boo.indexOf("ue") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('oy')", -1, boo.indexOf("oy") );
+
+
+var noo = new MyObject( Math.PI );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('3') ", 0, noo.indexOf('3') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('.') ", 1, noo.indexOf('.') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('4') ", 3, noo.indexOf('4') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('5') ", 5, noo.indexOf('5') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('9') ", 6, noo.indexOf('9') );
+
+new TestCase( SECTION,
+ "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')",
+ 0,
+ eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')") );
+
+new TestCase( SECTION,
+ "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')",
+ 3,
+ eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')",
+ 0,
+ eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')",
+ 2,
+ eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')") );
+
+new TestCase( SECTION,
+ "var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')",
+ 0,
+ eval("var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')") );
+
+new TestCase( SECTION,
+ "var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')",
+ 0,
+ eval("var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')") );
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')",
+ -1,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')") );
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)",
+ -1,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)") );
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)",
+ 0,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)") );
+
+new TestCase( SECTION,
+ "var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')",
+ 1,
+ eval("var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')") );
+
+new TestCase( SECTION,
+ "var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')",
+ 0,
+ eval("var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')") );
+
+new TestCase( SECTION,
+ "var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')",
+ 1,
+ eval("var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')") );
+
+new TestCase( SECTION,
+ "var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )",
+ 8,
+ eval("var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )") );
+
+// new Date(0) has '31' or '01' at index 8 depending on whether tester is (GMT-) or (GMT+), respectively
+new TestCase( SECTION,
+ "var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')",
+ 8,
+ eval("var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')") );
+
+test();
+
+function f() {
+ return this;
+}
+function g() {
+ var h = f;
+ return h();
+}
+
+function MyObject (v) {
+ this.value = v;
+ this.toString = new Function ( "return this.value +\"\"");
+ this.indexOf = String.prototype.indexOf;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-1.js
new file mode 100644
index 0000000000..094be2ed62
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-1.js
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.7-1.js';
+
+/**
+ File Name: 15.5.4.7-1.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
+
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
+
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToString(searchString).
+ 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN).
+ 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)).
+ 5.Compute the number of characters in Result(1).
+ 6.Compute min(max(Result(4), 0), Result(5)).
+ 7.Compute the number of characters in the string that is Result(2).
+ 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
+
+ 1.Return Result(8).
+
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.7-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.protoype.lastIndexOf";
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var j = 0;
+
+for ( k = 0, i = 0x0021; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf(" +String.fromCharCode(i)+ ", 0)",
+ -1,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), 0 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+String.fromCharCode(i)+ ", "+ k +")",
+ k,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), k ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+String.fromCharCode(i)+ ", "+k+1+")",
+ k,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), k+1 ) );
+}
+
+for ( k = 9, i = 0x0021; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ 0 + ")",
+ LastIndexOf( TEST_STRING, String.fromCharCode(i) +
+ String.fromCharCode(i+1)+String.fromCharCode(i+2), 0),
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ 0 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k +")",
+ k,
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k ) );
+}
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k+1 +")",
+ k,
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k+1 ) );
+}
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+
+ (String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ (k-1) +")",
+ LastIndexOf( TEST_STRING, String.fromCharCode(i) +
+ String.fromCharCode(i+1)+String.fromCharCode(i+2), k-1),
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k-1 ) );
+}
+
+new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 0 ) );
+
+// new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 1 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 1 ));
+
+new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ")", 0, TEST_STRING.lastIndexOf( TEST_STRING ));
+
+print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+test();
+
+function LastIndexOf( string, search, position ) {
+ string = String( string );
+ search = String( search );
+
+ position = Number( position )
+
+ if ( isNaN( position ) ) {
+ position = Infinity;
+ } else {
+ position = ToInteger( position );
+ }
+
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
+
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
+ }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
+ }
+ }
+
+ return result8;
+}
+function ToInteger( n ) {
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
+
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor(Math.abs(n)) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-2.js
new file mode 100644
index 0000000000..0252eae00f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.7-2.js
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.7-2.js';
+
+/**
+ File Name: 15.5.4.7-2.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
+
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
+
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToString(searchString).
+ 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN).
+ 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)).
+ 5.Compute the number of characters in Result(1).
+ 6.Compute min(max(Result(4), 0), Result(5)).
+ 7.Compute the number of characters in the string that is Result(2).
+ 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
+
+ 1.Return Result(8).
+
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 02 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.8
+ The length property of the lastIndexOf method is 1
+ *
+ */
+var SECTION = "15.5.4.7-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.protoype.lastIndexOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "String.prototype.lastIndexOf.length", 1, String.prototype.lastIndexOf.length );
+new TestCase( SECTION, "delete String.prototype.lastIndexOf.length", false, delete String.prototype.lastIndexOf.length );
+new TestCase( SECTION, "delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length", 1, eval("delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length" ) );
+
+new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('', 0)", LastIndexOf("","",0), eval("var s = new String(''); s.lastIndexOf('', 0)") );
+new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('')", LastIndexOf("",""), eval("var s = new String(''); s.lastIndexOf('')") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('', 0)", LastIndexOf("hello","",0), eval("var s = new String('hello'); s.lastIndexOf('',0)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('')", LastIndexOf("hello",""), eval("var s = new String('hello'); s.lastIndexOf('')") );
+
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll')", LastIndexOf("hello","ll"), eval("var s = new String('hello'); s.lastIndexOf('ll')") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 0)", LastIndexOf("hello","ll",0), eval("var s = new String('hello'); s.lastIndexOf('ll', 0)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1)", LastIndexOf("hello","ll",1), eval("var s = new String('hello'); s.lastIndexOf('ll', 1)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2)", LastIndexOf("hello","ll",2), eval("var s = new String('hello'); s.lastIndexOf('ll', 2)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 3)", LastIndexOf("hello","ll",3), eval("var s = new String('hello'); s.lastIndexOf('ll', 3)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 4)", LastIndexOf("hello","ll",4), eval("var s = new String('hello'); s.lastIndexOf('ll', 4)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 5)", LastIndexOf("hello","ll",5), eval("var s = new String('hello'); s.lastIndexOf('ll', 5)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 6)", LastIndexOf("hello","ll",6), eval("var s = new String('hello'); s.lastIndexOf('ll', 6)") );
+
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1.5)", LastIndexOf('hello','ll', 1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 1.5)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2.5)", LastIndexOf('hello','ll', 2.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 2.5)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1)", LastIndexOf('hello','ll', -1), eval("var s = new String('hello'); s.lastIndexOf('ll', -1)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1.5)",LastIndexOf('hello','ll', -1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', -1.5)") );
+
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -Infinity)", LastIndexOf("hello","ll",-Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', -Infinity)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', Infinity)", LastIndexOf("hello","ll",Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', Infinity)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', NaN)", LastIndexOf("hello","ll",NaN), eval("var s = new String('hello'); s.lastIndexOf('ll', NaN)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -0)", LastIndexOf("hello","ll",-0), eval("var s = new String('hello'); s.lastIndexOf('ll', -0)") );
+for ( var i = 0; i < ( "[object Object]" ).length; i++ ) {
+ new TestCase( SECTION,
+ "var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")",
+ ( i < 2 ? -1 : ( i < 9 ? 2 : 9 )) ,
+ eval("var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")") );
+}
+for ( var i = 0; i < 5; i ++ ) {
+ new TestCase( SECTION,
+ "var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")",
+ ( i < 2 ? -1 : 2 ),
+ eval("var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")") );
+}
+for ( var i = 0; i < 5; i ++ ) {
+ new TestCase( SECTION,
+ "var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")",
+ ( i < 1 ? -1 : ( i < 9 ? 1 : ( i < 10 ? 9 : 10 ) ) ),
+ eval("var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")") );
+}
+for ( var i = 0; i < 9; i++ ) {
+ new TestCase( SECTION,
+ "var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )",
+ ( i < 3 ? -1 : ( i < 5 ? 3 : 5 ) ),
+ eval("var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )") );
+}
+var a = new Array( "abc","def","ghi","jkl","mno","pqr","stu","vwx","yz" );
+
+for ( var i = 0; i < (a.toString()).length; i++ ) {
+ new TestCase( SECTION,
+ "var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )",
+ ( i < 15 ? -1 : 15 ),
+ eval("var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )") );
+}
+
+for ( var i = 0; i < 15; i ++ ) {
+ new TestCase( SECTION,
+ "var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")",
+ ( i < 6 ? -1 : ( i < 10 ? 6 : 10 ) ),
+ eval("var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")") );
+}
+/*
+ for ( var i = 0; i < 15; i++ ) {
+ new TestCase( SECTION,
+ "var d = new Date(); d.lastIndexOf = String.prototype.lastIndexOf; d.lastIndexOf( '0' )",
+ )
+ }
+
+*/
+
+test();
+
+function LastIndexOf( string, search, position ) {
+ string = String( string );
+ search = String( search );
+
+ position = Number( position )
+
+ if ( isNaN( position ) ) {
+ position = Infinity;
+ } else {
+ position = ToInteger( position );
+ }
+
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
+
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
+ }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
+ }
+ }
+
+ return result8;
+}
+function ToInteger( n ) {
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
+
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor(Math.abs(n)) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-1.js
new file mode 100644
index 0000000000..4aa16d5ea0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-1.js
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.8-1.js';
+
+/**
+ File Name: 15.5.4.8-1.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
+
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
+
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
+
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 12 November 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.14
+ The length property of the split method is 2
+ *
+ */
+
+var SECTION = "15.5.4.8-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.split";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.split.length", 2, String.prototype.split.length );
+new TestCase( SECTION, "delete String.prototype.split.length", false, delete String.prototype.split.length );
+new TestCase( SECTION, "delete String.prototype.split.length; String.prototype.split.length", 2, eval("delete String.prototype.split.length; String.prototype.split.length") );
+
+// test cases for when split is called with no arguments.
+
+// this is a string object
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.split()",
+ "object",
+ eval("var s = new String('this is a string object'); typeof s.split()") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()",
+ "[object Array]",
+ eval("var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.split().length",
+ 1,
+ eval("var s = new String('this is a string object'); s.split().length") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.split()[0]",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.split()[0]") );
+
+// this is an object object
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Object(); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]",
+ "[object Object]",
+ eval("var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]") );
+
+// this is a function object
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Function(); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]",
+ "[object Function]",
+ eval("var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]") );
+
+// this is a number object
+new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]",
+ "-1e+21",
+ eval("var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]") );
+
+
+// this is the Math object
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = Math; obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = Math; obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; obj.split()[0]",
+ "[object Math]",
+ eval("var obj = Math; obj.split = String.prototype.split; obj.split()[0]") );
+
+// this is an array object
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]",
+ "1,2,3,4,5",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]") );
+
+// this is a Boolean object
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]",
+ "false",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]") );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-2.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-2.js
new file mode 100644
index 0000000000..ff33e62ba6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-2.js
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.8-2.js';
+
+/**
+ File Name: 15.5.4.8-2.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
+
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
+
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
+
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
+
+ When the split method is called with one argument separator, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its argument.
+ 2. Create a new Array object of length 0 and call it A.
+ 3. If separator is not supplied, call the [[Put]] method of A with 0 and
+ Result(1) as arguments, and then return A.
+ 4. Call ToString(separator).
+ 5. Compute the number of characters in Result(1).
+ 6. Compute the number of characters in the string that is Result(4).
+ 7. Let p be 0.
+ 8. If Result(6) is zero (the separator string is empty), go to step 17.
+ 9. Compute the smallest possible integer k not smaller than p such that
+ k+Result(6) is not greater than Result(5), and for all nonnegative
+ integers j less than Result(6), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2);
+ but if there is no such integer k, then go to step 14.
+ 10. Compute a string value equal to the substring of Result(1), consisting
+ of the characters at positions p through k1, inclusive.
+ 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
+ 12. Let p be k+Result(6).
+ 13. Go to step 9.
+ 14. Compute a string value equal to the substring of Result(1), consisting
+ of the characters from position p to the end of Result(1).
+ 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
+ 16. Return A.
+ 17. If p equals Result(5), return A.
+ 18. Compute a string value equal to the substring of Result(1), consisting of
+ the single character at position p.
+ 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
+ 20. Increase p by 1.
+ 21. Go to step 17.
+
+ Note that the split function is intentionally generic; it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.8-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.split";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// case where separator is the empty string.
+
+var TEST_STRING = "this is a string object";
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split('').length",
+ TEST_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split('').length") );
+
+for ( var i = 0; i < TEST_STRING.length; i++ ) {
+
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split('')["+i+"]",
+ TEST_STRING.charAt(i),
+ eval("var s = new String( TEST_STRING ); s.split('')["+i+"]") );
+}
+
+// case where the value of the separator is undefined. in this case. the value of the separator
+// should be ToString( separator ), or "undefined".
+
+var TEST_STRING = "thisundefinedisundefinedaundefinedstringundefinedobject";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(void 0).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(void 0).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(void 0)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(void 0)["+i+"]") );
+}
+
+// case where the value of the separator is null. in this case the value of the separator is "null".
+TEST_STRING = "thisnullisnullanullstringnullobject";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(null).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(null).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(null)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(null)["+i+"]") );
+}
+
+// case where the value of the separator is a boolean.
+TEST_STRING = "thistrueistrueatruestringtrueobject";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(true).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(true).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(true)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(true)["+i+"]") );
+}
+
+// case where the value of the separator is a number
+TEST_STRING = "this123is123a123string123object";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(123).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
+}
+
+
+// case where the value of the separator is a number
+TEST_STRING = "this123is123a123string123object";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(123).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
+}
+
+// case where the separator is not in the string
+TEST_STRING = "this is a string";
+EXPECT_STRING = new Array( "this is a string" );
+
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split(':').length",
+ 1,
+ eval("var s = new String( TEST_STRING ); s.split(':').length") );
+
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split(':')[0]",
+ TEST_STRING,
+ eval("var s = new String( TEST_STRING ); s.split(':')[0]") );
+
+// case where part but not all of separator is in the string.
+TEST_STRING = "this is a string";
+EXPECT_STRING = new Array( "this is a string" );
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('strings').length",
+ 1,
+ eval("var s = new String( TEST_STRING ); s.split('strings').length") );
+
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('strings')[0]",
+ TEST_STRING,
+ eval("var s = new String( TEST_STRING ); s.split('strings')[0]") );
+
+// case where the separator is at the end of the string
+TEST_STRING = "this is a string";
+EXPECT_STRING = new Array( "this is a " );
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('string').length",
+ 2,
+ eval("var s = new String( TEST_STRING ); s.split('string').length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split('string')["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split('string')["+i+"]") );
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-3.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-3.js
new file mode 100644
index 0000000000..fe10284a9c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.8-3.js
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.8-3.js';
+
+/**
+ File Name: 15.5.4.8-3.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
+
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
+
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
+
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
+
+ When the split method is called with one argument separator, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its argument.
+ 2. Create a new Array object of length 0 and call it A.
+ 3. If separator is not supplied, call the [[Put]] method of A with 0 and
+ Result(1) as arguments, and then return A.
+ 4. Call ToString(separator).
+ 5. Compute the number of characters in Result(1).
+ 6. Compute the number of characters in the string that is Result(4).
+ 7. Let p be 0.
+ 8. If Result(6) is zero (the separator string is empty), go to step 17.
+ 9. Compute the smallest possible integer k not smaller than p such that
+ k+Result(6) is not greater than Result(5), and for all nonnegative
+ integers j less than Result(6), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2);
+ but if there is no such integer k, then go to step 14.
+ 10. Compute a string value equal to the substring of Result(1), consisting
+ of the characters at positions p through k1, inclusive.
+ 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
+ 12. Let p be k+Result(6).
+ 13. Go to step 9.
+ 14. Compute a string value equal to the substring of Result(1), consisting
+ of the characters from position p to the end of Result(1).
+ 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
+ 16. Return A.
+ 17. If p equals Result(5), return A.
+ 18. Compute a string value equal to the substring of Result(1), consisting of
+ the single character at position p.
+ 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
+ 20. Increase p by 1.
+ 21. Go to step 17.
+
+ Note that the split function is intentionally generic; it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.8-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.split";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = "";
+var EXPECT = new Array();
+
+// this.toString is the empty string.
+
+new TestCase( SECTION,
+ "var s = new String(); s.split().length",
+ 1,
+ eval("var s = new String(); s.split().length") );
+
+new TestCase( SECTION,
+ "var s = new String(); s.split()[0]",
+ "",
+ eval("var s = new String(); s.split()[0]") );
+
+// this.toString() is the empty string, separator is specified.
+
+new TestCase( SECTION,
+ "var s = new String(); s.split('').length",
+ 0,
+ eval("var s = new String(); s.split('').length") );
+
+new TestCase( SECTION,
+ "var s = new String(); s.split(' ').length",
+ 1,
+ eval("var s = new String(); s.split(' ').length") );
+
+// this to string is " "
+new TestCase( SECTION,
+ "var s = new String(' '); s.split().length",
+ 1,
+ eval("var s = new String(' '); s.split().length") );
+
+new TestCase( SECTION,
+ "var s = new String(' '); s.split()[0]",
+ " ",
+ eval("var s = new String(' '); s.split()[0]") );
+
+new TestCase( SECTION,
+ "var s = new String(' '); s.split('').length",
+ 1,
+ eval("var s = new String(' '); s.split('').length") );
+
+new TestCase( SECTION,
+ "var s = new String(' '); s.split('')[0]",
+ " ",
+ eval("var s = new String(' '); s.split('')[0]") );
+
+new TestCase( SECTION,
+ "var s = new String(' '); s.split(' ').length",
+ 2,
+ eval("var s = new String(' '); s.split(' ').length") );
+
+new TestCase( SECTION,
+ "var s = new String(' '); s.split(' ')[0]",
+ "",
+ eval("var s = new String(' '); s.split(' ')[0]") );
+
+new TestCase( SECTION,
+ "\"\".split(\"\").length",
+ 0,
+ ("".split("")).length );
+
+new TestCase( SECTION,
+ "\"\".split(\"x\").length",
+ 1,
+ ("".split("x")).length );
+
+new TestCase( SECTION,
+ "\"\".split(\"x\")[0]",
+ "",
+ ("".split("x"))[0] );
+
+test();
+
+function Split( string, separator ) {
+ string = String( string );
+
+ var A = new Array();
+
+ if ( arguments.length < 2 ) {
+ A[0] = string;
+ return A;
+ }
+
+ separator = String( separator );
+
+ var str_len = String( string ).length;
+ var sep_len = String( separator ).length;
+
+ var p = 0;
+ var k = 0;
+
+ if ( sep_len == 0 ) {
+ for ( ; p < str_len; p++ ) {
+ A[A.length] = String( string.charAt(p) );
+ }
+ }
+ return A;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.9-1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.9-1.js
new file mode 100644
index 0000000000..2184c60f45
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.9-1.js
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.9-1.js';
+
+/**
+ File Name: 15.5.4.9-1.js
+ ECMA Section: 15.5.4.9 String.prototype.substring( start )
+ Description:
+
+ 15.5.4.9 String.prototype.substring(start)
+
+ Returns a substring of the result of converting this object to a string,
+ starting from character position start and running to the end of the
+ string. The result is a string value, not a String object.
+
+ If the argument is NaN or negative, it is replaced with zero; if the
+ argument is larger than the length of the string, it is replaced with the
+ length of the string.
+
+ When the substring method is called with one argument start, the following
+ steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToInteger(start).
+ 3.Compute the number of characters in Result(1).
+ 4.Compute min(max(Result(2), 0), Result(3)).
+ 5.Return a string whose length is the difference between Result(3) and Result(4),
+ containing characters from Result(1), namely the characters with indices Result(4)
+ through Result(3)1, in ascending order.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.9-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.substring( start )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
+
+// test cases for when substring is called with no arguments.
+
+// this is a string object
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.substring()",
+ "string",
+ eval("var s = new String('this is a string object'); typeof s.substring()") );
+
+new TestCase( SECTION,
+ "var s = new String(''); s.substring()",
+ "",
+ eval("var s = new String(''); s.substring()") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring()",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring()") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(NaN)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(NaN)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-0.01)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(-0.01)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length+1)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length+1)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(Infinity)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-Infinity)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(-Infinity)") );
+
+// this is not a String object, start is not an integer
+
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()",
+ "1,2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()") );
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)",
+ ",2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)") );
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')",
+ "3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')") );
+
+new TestCase( SECTION,
+ "var s = new Array(); s.substring = String.prototype.substring; s.substring('4')",
+ "",
+ eval("var s = new Array(); s.substring = String.prototype.substring; s.substring('4')") );
+
+// this is an object object
+new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)",
+ "Object]",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)") );
+
+// this is a function object
+new TestCase( SECTION,
+ "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)",
+ "Function]",
+ eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)") );
+// this is a number object
+new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)",
+ "NaN",
+ eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)") );
+
+// this is the Math object
+new TestCase( SECTION,
+ "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)",
+ "ject Math]",
+ eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)") );
+
+// this is a Boolean object
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())",
+ "false",
+ eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())") );
+
+// this is a user defined object
+
+new TestCase( SECTION,
+ "var obj = new MyObject( null ); obj.substring(0)",
+ "null",
+ eval( "var obj = new MyObject( null ); obj.substring(0)") );
+
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.js
new file mode 100644
index 0000000000..063e4e68d1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.4.js
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.js';
+
+/**
+ File Name: 15.5.4.js
+ ECMA Section: 15.5.4 Properties of the String prototype object
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.5.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Prototype objecta";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION,
+ "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()",
+ "[object String]",
+ eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") );
+
+delete String.prototype.getClass;
+
+new TestCase( SECTION,
+ "typeof String.prototype",
+ "object",
+ typeof String.prototype );
+
+new TestCase( SECTION,
+ "String.prototype.valueOf()",
+ "",
+ String.prototype.valueOf() );
+
+new TestCase( SECTION,
+ "String.prototype +''",
+ "",
+ String.prototype + '' );
+
+new TestCase( SECTION,
+ "String.prototype.length",
+ 0,
+ String.prototype.length );
+
+var prop;
+var value;
+
+value = '';
+for (prop in "")
+{
+ value += prop;
+}
+new TestCase( SECTION,
+ 'String "" has no enumerable properties',
+ '',
+ value );
+
+value = '';
+for (prop in String.prototype)
+{
+ value += prop;
+}
+new TestCase( SECTION,
+ 'String.prototype has no enumerable properties',
+ '',
+ value );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/15.5.5.1.js b/tests/auto/qml/parserstress/tests/ecma/String/15.5.5.1.js
new file mode 100644
index 0000000000..85d3d24ef2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/15.5.5.1.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.5.1.js';
+
+/**
+ File Name: 15.5.5.1
+ ECMA Section: String.length
+ Description:
+
+ The number of characters in the String value represented by this String
+ object.
+
+ Once a String object is created, this property is unchanging. It has the
+ attributes { DontEnum, DontDelete, ReadOnly }.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.5.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.length";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var s = new String(); s.length",
+ 0,
+ eval("var s = new String(); s.length") );
+
+new TestCase( SECTION,
+ "var s = new String(); s.length = 10; s.length",
+ 0,
+ eval("var s = new String(); s.length = 10; s.length") );
+
+new TestCase( SECTION,
+ "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props",
+ "",
+ eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") );
+
+new TestCase( SECTION,
+ "var s = new String(); delete s.length",
+ false,
+ eval("var s = new String(); delete s.length") );
+
+new TestCase( SECTION,
+ "var s = new String('hello'); delete s.length; s.length",
+ 5,
+ eval("var s = new String('hello'); delete s.length; s.length") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/browser.js b/tests/auto/qml/parserstress/tests/ecma/String/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/String/shell.js b/tests/auto/qml/parserstress/tests/ecma/String/shell.js
new file mode 100644
index 0000000000..7d850446cc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/String/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'String';
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.2.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.2.js
new file mode 100644
index 0000000000..2d428b9a9e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.2.js
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): christine@netscape.com
+ * Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.2.js';
+
+/**
+ File Name: 9.2.js
+ ECMA Section: 9.2 Type Conversion: ToBoolean
+ Description: rules for converting an argument to a boolean.
+ undefined false
+ Null false
+ Boolean input argument( no conversion )
+ Number returns false for 0, -0, and NaN
+ otherwise return true
+ String return false if the string is empty
+ (length is 0) otherwise the result is
+ true
+ Object all return true
+
+ Author: christine@netscape.com
+ Date: 14 july 1997
+*/
+var SECTION = "9.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToBoolean";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// special cases here
+
+new TestCase( SECTION, "Boolean()", false, Boolean() );
+new TestCase( SECTION, "Boolean(var x)", false, Boolean(eval("var x")) );
+new TestCase( SECTION, "Boolean(void 0)", false, Boolean(void 0) );
+new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
+new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
+new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
+new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
+new TestCase( SECTION, "Boolean(-0)", false, Boolean(-0) );
+new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
+new TestCase( SECTION, "Boolean('')", false, Boolean("") );
+
+// normal test cases here
+
+new TestCase( SECTION, "Boolean(Infinity)", true, Boolean(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "Boolean(Math.PI)", true, Boolean(Math.PI) );
+new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
+new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
+new TestCase( SECTION, "Boolean([tab])", true, Boolean("\t") );
+new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
+new TestCase( SECTION, "Boolean('string')", true, Boolean("string") );
+
+// ToBoolean (object) should always return true.
+new TestCase( SECTION, "Boolean(new String() )", true, Boolean(new String()) );
+new TestCase( SECTION, "Boolean(new String('') )", true, Boolean(new String("")) );
+
+new TestCase( SECTION, "Boolean(new Boolean(true))", true, Boolean(new Boolean(true)) );
+new TestCase( SECTION, "Boolean(new Boolean(false))", true, Boolean(new Boolean(false)) );
+new TestCase( SECTION, "Boolean(new Boolean() )", true, Boolean(new Boolean()) );
+
+new TestCase( SECTION, "Boolean(new Array())", true, Boolean(new Array()) );
+
+new TestCase( SECTION, "Boolean(new Number())", true, Boolean(new Number()) );
+new TestCase( SECTION, "Boolean(new Number(-0))", true, Boolean(new Number(-0)) );
+new TestCase( SECTION, "Boolean(new Number(0))", true, Boolean(new Number(0)) );
+new TestCase( SECTION, "Boolean(new Number(NaN))", true, Boolean(new Number(Number.NaN)) );
+
+new TestCase( SECTION, "Boolean(new Number(-1))", true, Boolean(new Number(-1)) );
+new TestCase( SECTION, "Boolean(new Number(Infinity))", true, Boolean(new Number(Number.POSITIVE_INFINITY)) );
+new TestCase( SECTION, "Boolean(new Number(-Infinity))",true, Boolean(new Number(Number.NEGATIVE_INFINITY)) );
+
+new TestCase( SECTION, "Boolean(new Object())", true, Boolean(new Object()) );
+new TestCase( SECTION, "Boolean(new Function())", true, Boolean(new Function()) );
+new TestCase( SECTION, "Boolean(new Date())", true, Boolean(new Date()) );
+new TestCase( SECTION, "Boolean(new Date(0))", true, Boolean(new Date(0)) );
+new TestCase( SECTION, "Boolean(Math)", true, Boolean(Math) );
+
+// bug 375793
+new TestCase( SECTION,
+ "NaN ? true : false",
+ false,
+ (NaN ? true : false) );
+new TestCase( SECTION,
+ "1000 % 0 ? true : false",
+ false,
+ (1000 % 0 ? true : false) );
+new TestCase( SECTION,
+ "(function(a,b){ return a % b ? true : false })(1000, 0)",
+ false,
+ ((function(a,b){ return a % b ? true : false })(1000, 0)) );
+
+new TestCase( SECTION,
+ "(function(x) { return !(x) })(0/0)",
+ true,
+ ((function(x) { return !(x) })(0/0)) );
+new TestCase( SECTION,
+ "!(0/0)",
+ true,
+ (!(0/0)) );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3-1.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3-1.js
new file mode 100644
index 0000000000..9994d6a7cd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3-1.js
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.3-1.js';
+
+/**
+ File Name: 9.3-1.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+
+ This tests ToNumber applied to the object type, except
+ if object is string. See 9.3-2 for
+ ToNumber( String object).
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+var SECTION = "9.3-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " ToNumber");
+
+// object is Number
+new TestCase( SECTION, "Number(new Number())", 0, Number(new Number()) );
+new TestCase( SECTION, "typeof Number(new Number())", "number", typeof Number(new Number()) );
+
+new TestCase( SECTION, "Number(new Number(Number.NaN))", Number.NaN, Number(new Number(Number.NaN)) );
+new TestCase( SECTION, "typeof Number(new Number(Number.NaN))","number", typeof Number(new Number(Number.NaN)) );
+
+new TestCase( SECTION, "Number(new Number(0))", 0, Number(new Number(0)) );
+new TestCase( SECTION, "typeof Number(new Number(0))", "number", typeof Number(new Number(0)) );
+
+new TestCase( SECTION, "Number(new Number(null))", 0, Number(new Number(null)) );
+new TestCase( SECTION, "typeof Number(new Number(null))", "number", typeof Number(new Number(null)) );
+
+
+// new TestCase( SECTION, "Number(new Number(void 0))", Number.NaN, Number(new Number(void 0)) );
+new TestCase( SECTION, "Number(new Number(true))", 1, Number(new Number(true)) );
+new TestCase( SECTION, "typeof Number(new Number(true))", "number", typeof Number(new Number(true)) );
+
+new TestCase( SECTION, "Number(new Number(false))", 0, Number(new Number(false)) );
+new TestCase( SECTION, "typeof Number(new Number(false))", "number", typeof Number(new Number(false)) );
+
+// object is boolean
+new TestCase( SECTION, "Number(new Boolean(true))", 1, Number(new Boolean(true)) );
+new TestCase( SECTION, "typeof Number(new Boolean(true))", "number", typeof Number(new Boolean(true)) );
+
+new TestCase( SECTION, "Number(new Boolean(false))", 0, Number(new Boolean(false)) );
+new TestCase( SECTION, "typeof Number(new Boolean(false))", "number", typeof Number(new Boolean(false)) );
+
+// object is array
+new TestCase( SECTION, "Number(new Array(2,4,8,16,32))", Number.NaN, Number(new Array(2,4,8,16,32)) );
+new TestCase( SECTION, "typeof Number(new Array(2,4,8,16,32))", "number", typeof Number(new Array(2,4,8,16,32)) );
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-1.js
new file mode 100644
index 0000000000..da3e8794c0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-1.js
@@ -0,0 +1,323 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.3.1-1.js';
+
+/**
+ File Name: 9.3.1-1.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+
+ This tests ToNumber applied to the string type
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+var SECTION = "9.3.1-1";
+var VERSION = "ECMA_1";
+var TITLE = "ToNumber applied to the String type";
+var BUGNUMBER="77391";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// StringNumericLiteral:::StrWhiteSpace:::StrWhiteSpaceChar StrWhiteSpace:::
+//
+// Name Unicode Value Escape Sequence
+// <TAB> 0X0009 \t
+// <SP> 0X0020
+// <FF> 0X000C \f
+// <VT> 0X000B
+// <CR> 0X000D \r
+// <LF> 0X000A \n
+new TestCase( SECTION, "Number('')", 0, Number("") );
+new TestCase( SECTION, "Number(' ')", 0, Number(" ") );
+new TestCase( SECTION, "Number(\\t)", 0, Number("\t") );
+new TestCase( SECTION, "Number(\\n)", 0, Number("\n") );
+new TestCase( SECTION, "Number(\\r)", 0, Number("\r") );
+new TestCase( SECTION, "Number(\\f)", 0, Number("\f") );
+
+new TestCase( SECTION, "Number(String.fromCharCode(0x0009)", 0, Number(String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x0020)", 0, Number(String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000C)", 0, Number(String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000B)", 0, Number(String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000D)", 0, Number(String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000A)", 0, Number(String.fromCharCode(0x000A)) );
+
+// a StringNumericLiteral may be preceeded or followed by whitespace and/or
+// line terminators
+
+new TestCase( SECTION, "Number( ' ' + 999 )", 999, Number( ' '+999) );
+new TestCase( SECTION, "Number( '\\n' + 999 )", 999, Number( '\n' +999) );
+new TestCase( SECTION, "Number( '\\r' + 999 )", 999, Number( '\r' +999) );
+new TestCase( SECTION, "Number( '\\t' + 999 )", 999, Number( '\t' +999) );
+new TestCase( SECTION, "Number( '\\f' + 999 )", 999, Number( '\f' +999) );
+
+new TestCase( SECTION, "Number( 999 + ' ' )", 999, Number( 999+' ') );
+new TestCase( SECTION, "Number( 999 + '\\n' )", 999, Number( 999+'\n' ) );
+new TestCase( SECTION, "Number( 999 + '\\r' )", 999, Number( 999+'\r' ) );
+new TestCase( SECTION, "Number( 999 + '\\t' )", 999, Number( 999+'\t' ) );
+new TestCase( SECTION, "Number( 999 + '\\f' )", 999, Number( 999+'\f' ) );
+
+new TestCase( SECTION, "Number( '\\n' + 999 + '\\n' )", 999, Number( '\n' +999+'\n' ) );
+new TestCase( SECTION, "Number( '\\r' + 999 + '\\r' )", 999, Number( '\r' +999+'\r' ) );
+new TestCase( SECTION, "Number( '\\t' + 999 + '\\t' )", 999, Number( '\t' +999+'\t' ) );
+new TestCase( SECTION, "Number( '\\f' + 999 + '\\f' )", 999, Number( '\f' +999+'\f' ) );
+
+new TestCase( SECTION, "Number( ' ' + '999' )", 999, Number( ' '+'999') );
+new TestCase( SECTION, "Number( '\\n' + '999' )", 999, Number( '\n' +'999') );
+new TestCase( SECTION, "Number( '\\r' + '999' )", 999, Number( '\r' +'999') );
+new TestCase( SECTION, "Number( '\\t' + '999' )", 999, Number( '\t' +'999') );
+new TestCase( SECTION, "Number( '\\f' + '999' )", 999, Number( '\f' +'999') );
+
+new TestCase( SECTION, "Number( '999' + ' ' )", 999, Number( '999'+' ') );
+new TestCase( SECTION, "Number( '999' + '\\n' )", 999, Number( '999'+'\n' ) );
+new TestCase( SECTION, "Number( '999' + '\\r' )", 999, Number( '999'+'\r' ) );
+new TestCase( SECTION, "Number( '999' + '\\t' )", 999, Number( '999'+'\t' ) );
+new TestCase( SECTION, "Number( '999' + '\\f' )", 999, Number( '999'+'\f' ) );
+
+new TestCase( SECTION, "Number( '\\n' + '999' + '\\n' )", 999, Number( '\n' +'999'+'\n' ) );
+new TestCase( SECTION, "Number( '\\r' + '999' + '\\r' )", 999, Number( '\r' +'999'+'\r' ) );
+new TestCase( SECTION, "Number( '\\t' + '999' + '\\t' )", 999, Number( '\t' +'999'+'\t' ) );
+new TestCase( SECTION, "Number( '\\f' + '999' + '\\f' )", 999, Number( '\f' +'999'+'\f' ) );
+
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' )", 99, Number( String.fromCharCode(0x0009) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' )", 99, Number( String.fromCharCode(0x0020) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' )", 99, Number( String.fromCharCode(0x000C) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' )", 99, Number( String.fromCharCode(0x000B) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' )", 99, Number( String.fromCharCode(0x000D) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' )", 99, Number( String.fromCharCode(0x000A) + '99' ) );
+
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0009)", 99, Number( '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0020)", 99, Number( '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000C)", 99, Number( '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000D)", 99, Number( '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000B)", 99, Number( '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000A)", 99, Number( '99' + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 )", 99, Number( String.fromCharCode(0x0009) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 )", 99, Number( String.fromCharCode(0x0020) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 )", 99, Number( String.fromCharCode(0x000C) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 )", 99, Number( String.fromCharCode(0x000B) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 )", 99, Number( String.fromCharCode(0x000D) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 )", 99, Number( String.fromCharCode(0x000A) + 99 ) );
+
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
+
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0009)", 99, Number( 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0020)", 99, Number( 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000C)", 99, Number( 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000D)", 99, Number( 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000B)", 99, Number( 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000A)", 99, Number( 99 + String.fromCharCode(0x000A)) );
+
+
+// StrNumericLiteral:::StrDecimalLiteral:::Infinity
+
+new TestCase( SECTION, "Number('Infinity')", Math.pow(10,10000), Number("Infinity") );
+new TestCase( SECTION, "Number('-Infinity')", -Math.pow(10,10000), Number("-Infinity") );
+new TestCase( SECTION, "Number('+Infinity')", Math.pow(10,10000), Number("+Infinity") );
+
+// StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
+
+new TestCase( SECTION, "Number('0')", 0, Number("0") );
+new TestCase( SECTION, "Number('-0')", -0, Number("-0") );
+new TestCase( SECTION, "Number('+0')", 0, Number("+0") );
+
+new TestCase( SECTION, "Number('1')", 1, Number("1") );
+new TestCase( SECTION, "Number('-1')", -1, Number("-1") );
+new TestCase( SECTION, "Number('+1')", 1, Number("+1") );
+
+new TestCase( SECTION, "Number('2')", 2, Number("2") );
+new TestCase( SECTION, "Number('-2')", -2, Number("-2") );
+new TestCase( SECTION, "Number('+2')", 2, Number("+2") );
+
+new TestCase( SECTION, "Number('3')", 3, Number("3") );
+new TestCase( SECTION, "Number('-3')", -3, Number("-3") );
+new TestCase( SECTION, "Number('+3')", 3, Number("+3") );
+
+new TestCase( SECTION, "Number('4')", 4, Number("4") );
+new TestCase( SECTION, "Number('-4')", -4, Number("-4") );
+new TestCase( SECTION, "Number('+4')", 4, Number("+4") );
+
+new TestCase( SECTION, "Number('5')", 5, Number("5") );
+new TestCase( SECTION, "Number('-5')", -5, Number("-5") );
+new TestCase( SECTION, "Number('+5')", 5, Number("+5") );
+
+new TestCase( SECTION, "Number('6')", 6, Number("6") );
+new TestCase( SECTION, "Number('-6')", -6, Number("-6") );
+new TestCase( SECTION, "Number('+6')", 6, Number("+6") );
+
+new TestCase( SECTION, "Number('7')", 7, Number("7") );
+new TestCase( SECTION, "Number('-7')", -7, Number("-7") );
+new TestCase( SECTION, "Number('+7')", 7, Number("+7") );
+
+new TestCase( SECTION, "Number('8')", 8, Number("8") );
+new TestCase( SECTION, "Number('-8')", -8, Number("-8") );
+new TestCase( SECTION, "Number('+8')", 8, Number("+8") );
+
+new TestCase( SECTION, "Number('9')", 9, Number("9") );
+new TestCase( SECTION, "Number('-9')", -9, Number("-9") );
+new TestCase( SECTION, "Number('+9')", 9, Number("+9") );
+
+new TestCase( SECTION, "Number('3.14159')", 3.14159, Number("3.14159") );
+new TestCase( SECTION, "Number('-3.14159')", -3.14159, Number("-3.14159") );
+new TestCase( SECTION, "Number('+3.14159')", 3.14159, Number("+3.14159") );
+
+new TestCase( SECTION, "Number('3.')", 3, Number("3.") );
+new TestCase( SECTION, "Number('-3.')", -3, Number("-3.") );
+new TestCase( SECTION, "Number('+3.')", 3, Number("+3.") );
+
+new TestCase( SECTION, "Number('3.e1')", 30, Number("3.e1") );
+new TestCase( SECTION, "Number('-3.e1')", -30, Number("-3.e1") );
+new TestCase( SECTION, "Number('+3.e1')", 30, Number("+3.e1") );
+
+new TestCase( SECTION, "Number('3.e+1')", 30, Number("3.e+1") );
+new TestCase( SECTION, "Number('-3.e+1')", -30, Number("-3.e+1") );
+new TestCase( SECTION, "Number('+3.e+1')", 30, Number("+3.e+1") );
+
+new TestCase( SECTION, "Number('3.e-1')", .30, Number("3.e-1") );
+new TestCase( SECTION, "Number('-3.e-1')", -.30, Number("-3.e-1") );
+new TestCase( SECTION, "Number('+3.e-1')", .30, Number("+3.e-1") );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "Number('.00001')", 0.00001, Number(".00001") );
+new TestCase( SECTION, "Number('+.00001')", 0.00001, Number("+.00001") );
+new TestCase( SECTION, "Number('-0.0001')", -0.00001, Number("-.00001") );
+
+new TestCase( SECTION, "Number('.01e2')", 1, Number(".01e2") );
+new TestCase( SECTION, "Number('+.01e2')", 1, Number("+.01e2") );
+new TestCase( SECTION, "Number('-.01e2')", -1, Number("-.01e2") );
+
+new TestCase( SECTION, "Number('.01e+2')", 1, Number(".01e+2") );
+new TestCase( SECTION, "Number('+.01e+2')", 1, Number("+.01e+2") );
+new TestCase( SECTION, "Number('-.01e+2')", -1, Number("-.01e+2") );
+
+new TestCase( SECTION, "Number('.01e-2')", 0.0001, Number(".01e-2") );
+new TestCase( SECTION, "Number('+.01e-2')", 0.0001, Number("+.01e-2") );
+new TestCase( SECTION, "Number('-.01e-2')", -0.0001, Number("-.01e-2") );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "Number('1234e5')", 123400000, Number("1234e5") );
+new TestCase( SECTION, "Number('+1234e5')", 123400000, Number("+1234e5") );
+new TestCase( SECTION, "Number('-1234e5')", -123400000, Number("-1234e5") );
+
+new TestCase( SECTION, "Number('1234e+5')", 123400000, Number("1234e+5") );
+new TestCase( SECTION, "Number('+1234e+5')", 123400000, Number("+1234e+5") );
+new TestCase( SECTION, "Number('-1234e+5')", -123400000, Number("-1234e+5") );
+
+new TestCase( SECTION, "Number('1234e-5')", 0.01234, Number("1234e-5") );
+new TestCase( SECTION, "Number('+1234e-5')", 0.01234, Number("+1234e-5") );
+new TestCase( SECTION, "Number('-1234e-5')", -0.01234, Number("-1234e-5") );
+
+// StrNumericLiteral::: HexIntegerLiteral
+
+new TestCase( SECTION, "Number('0x0')", 0, Number("0x0"));
+new TestCase( SECTION, "Number('0x1')", 1, Number("0x1"));
+new TestCase( SECTION, "Number('0x2')", 2, Number("0x2"));
+new TestCase( SECTION, "Number('0x3')", 3, Number("0x3"));
+new TestCase( SECTION, "Number('0x4')", 4, Number("0x4"));
+new TestCase( SECTION, "Number('0x5')", 5, Number("0x5"));
+new TestCase( SECTION, "Number('0x6')", 6, Number("0x6"));
+new TestCase( SECTION, "Number('0x7')", 7, Number("0x7"));
+new TestCase( SECTION, "Number('0x8')", 8, Number("0x8"));
+new TestCase( SECTION, "Number('0x9')", 9, Number("0x9"));
+new TestCase( SECTION, "Number('0xa')", 10, Number("0xa"));
+new TestCase( SECTION, "Number('0xb')", 11, Number("0xb"));
+new TestCase( SECTION, "Number('0xc')", 12, Number("0xc"));
+new TestCase( SECTION, "Number('0xd')", 13, Number("0xd"));
+new TestCase( SECTION, "Number('0xe')", 14, Number("0xe"));
+new TestCase( SECTION, "Number('0xf')", 15, Number("0xf"));
+new TestCase( SECTION, "Number('0xA')", 10, Number("0xA"));
+new TestCase( SECTION, "Number('0xB')", 11, Number("0xB"));
+new TestCase( SECTION, "Number('0xC')", 12, Number("0xC"));
+new TestCase( SECTION, "Number('0xD')", 13, Number("0xD"));
+new TestCase( SECTION, "Number('0xE')", 14, Number("0xE"));
+new TestCase( SECTION, "Number('0xF')", 15, Number("0xF"));
+
+new TestCase( SECTION, "Number('0X0')", 0, Number("0X0"));
+new TestCase( SECTION, "Number('0X1')", 1, Number("0X1"));
+new TestCase( SECTION, "Number('0X2')", 2, Number("0X2"));
+new TestCase( SECTION, "Number('0X3')", 3, Number("0X3"));
+new TestCase( SECTION, "Number('0X4')", 4, Number("0X4"));
+new TestCase( SECTION, "Number('0X5')", 5, Number("0X5"));
+new TestCase( SECTION, "Number('0X6')", 6, Number("0X6"));
+new TestCase( SECTION, "Number('0X7')", 7, Number("0X7"));
+new TestCase( SECTION, "Number('0X8')", 8, Number("0X8"));
+new TestCase( SECTION, "Number('0X9')", 9, Number("0X9"));
+new TestCase( SECTION, "Number('0Xa')", 10, Number("0Xa"));
+new TestCase( SECTION, "Number('0Xb')", 11, Number("0Xb"));
+new TestCase( SECTION, "Number('0Xc')", 12, Number("0Xc"));
+new TestCase( SECTION, "Number('0Xd')", 13, Number("0Xd"));
+new TestCase( SECTION, "Number('0Xe')", 14, Number("0Xe"));
+new TestCase( SECTION, "Number('0Xf')", 15, Number("0Xf"));
+new TestCase( SECTION, "Number('0XA')", 10, Number("0XA"));
+new TestCase( SECTION, "Number('0XB')", 11, Number("0XB"));
+new TestCase( SECTION, "Number('0XC')", 12, Number("0XC"));
+new TestCase( SECTION, "Number('0XD')", 13, Number("0XD"));
+new TestCase( SECTION, "Number('0XE')", 14, Number("0XE"));
+new TestCase( SECTION, "Number('0XF')", 15, Number("0XF"));
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-2.js
new file mode 100644
index 0000000000..911ec84b94
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-2.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.3.1-2.js';
+
+/**
+ File Name: 9.3.1-2.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+ This tests special cases of ToNumber(string) that are
+ not covered in 9.3.1-1.js.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+var SECTION = "9.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToNumber applied to the String type";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// A StringNumericLiteral may not use octal notation
+
+new TestCase( SECTION, "Number(00)", 0, Number("00"));
+new TestCase( SECTION, "Number(01)", 1, Number("01"));
+new TestCase( SECTION, "Number(02)", 2, Number("02"));
+new TestCase( SECTION, "Number(03)", 3, Number("03"));
+new TestCase( SECTION, "Number(04)", 4, Number("04"));
+new TestCase( SECTION, "Number(05)", 5, Number("05"));
+new TestCase( SECTION, "Number(06)", 6, Number("06"));
+new TestCase( SECTION, "Number(07)", 7, Number("07"));
+new TestCase( SECTION, "Number(010)", 10, Number("010"));
+new TestCase( SECTION, "Number(011)", 11, Number("011"));
+
+// A StringNumericLIteral may have any number of leading 0 digits
+
+new TestCase( SECTION, "Number(001)", 1, Number("001"));
+new TestCase( SECTION, "Number(0001)", 1, Number("0001"));
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js
new file mode 100644
index 0000000000..3141906d5d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js
@@ -0,0 +1,733 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.3.1-3.js';
+
+/**
+ File Name: 9.3.1-3.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+
+ Test cases provided by waldemar.
+
+
+ Author: christine@netscape.com
+ Date: 10 june 1998
+
+*/
+
+var SECTION = "9.3.1-3";
+var VERSION = "ECMA_1";
+var BUGNUMBER="129087";
+
+var TITLE = "Number To String, String To Number";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// test case from http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312954
+var z = 0;
+
+new TestCase(
+ SECTION,
+ "var z = 0; print(1/-z)",
+ -Infinity,
+ 1/-z );
+
+
+
+
+
+// test cases from bug http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122882
+
+
+
+new TestCase( SECTION,
+ '- -"0x80000000"',
+ 2147483648,
+ - -"0x80000000" );
+
+new TestCase( SECTION,
+ '- -"0x100000000"',
+ 4294967296,
+ - -"0x100000000" );
+
+new TestCase( SECTION,
+ '- "-0x123456789abcde8"',
+ 81985529216486880,
+ - "-0x123456789abcde8" );
+
+// Convert some large numbers to string
+
+
+new TestCase( SECTION,
+ "1e2000 +''",
+ "Infinity",
+ 1e2000 +"" );
+
+new TestCase( SECTION,
+ "1e2000",
+ Infinity,
+ 1e2000 );
+
+new TestCase( SECTION,
+ "-1e2000 +''",
+ "-Infinity",
+ -1e2000 +"" );
+
+new TestCase( SECTION,
+ "-\"1e2000\"",
+ -Infinity,
+ -"1e2000" );
+
+new TestCase( SECTION,
+ "-\"-1e2000\" +''",
+ "Infinity",
+ -"-1e2000" +"" );
+
+new TestCase( SECTION,
+ "1e-2000",
+ 0,
+ 1e-2000 );
+
+new TestCase( SECTION,
+ "1/1e-2000",
+ Infinity,
+ 1/1e-2000 );
+
+// convert some strings to large numbers
+
+new TestCase( SECTION,
+ "1/-1e-2000",
+ -Infinity,
+ 1/-1e-2000 );
+
+new TestCase( SECTION,
+ "1/\"1e-2000\"",
+ Infinity,
+ 1/"1e-2000" );
+
+new TestCase( SECTION,
+ "1/\"-1e-2000\"",
+ -Infinity,
+ 1/"-1e-2000" );
+
+new TestCase( SECTION,
+ "parseFloat(\"1e2000\")",
+ Infinity,
+ parseFloat("1e2000") );
+
+new TestCase( SECTION,
+ "parseFloat(\"1e-2000\")",
+ 0,
+ parseFloat("1e-2000") );
+
+new TestCase( SECTION,
+ "1.7976931348623157E+308",
+ 1.7976931348623157e+308,
+ 1.7976931348623157E+308 );
+
+new TestCase( SECTION,
+ "1.7976931348623158e+308",
+ 1.7976931348623157e+308,
+ 1.7976931348623158e+308 );
+
+new TestCase( SECTION,
+ "1.7976931348623159e+308",
+ Infinity,
+ 1.7976931348623159e+308 );
+
+s =
+ "17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068";
+
+print("s = " + s);
+print("-s = " + (-s));
+
+new TestCase( SECTION,
+ "s = " + s +"; s +="+
+ "\"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779\""+
+
+ +"; s",
+ "17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779",
+ s +=
+ "190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779"
+ );
+
+s1 = s+1;
+
+print("s1 = " + s1);
+print("-s1 = " + (-s1));
+
+new TestCase( SECTION,
+ "s1 = s+1; s1",
+ "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791",
+ s1 );
+
+/***** This answer is preferred but -Infinity is also acceptable here *****/
+
+new TestCase( SECTION,
+ "-s1 == Infinity || s1 == 1.7976931348623157e+308",
+ true,
+ -s1 == Infinity || s1 == 1.7976931348623157e+308 );
+
+s2 = s + 2;
+
+print("s2 = " + s2);
+print("-s2 = " + (-s2));
+
+new TestCase( SECTION,
+ "s2 = s+2; s2",
+ "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792",
+ s2 );
+
+// ***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here *****
+new TestCase( SECTION,
+ "-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ",
+ true,
+ -s2 == -Infinity || -s2 == -1.7976931348623157e+308 );
+
+s3 = s+3;
+
+print("s3 = " + s3);
+print("-s3 = " + (-s3));
+
+new TestCase( SECTION,
+ "s3 = s+3; s3",
+ "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497793",
+ s3 );
+
+//***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here *****
+
+new TestCase( SECTION,
+ "-s3 == -Infinity || -s3 == -1.7976931348623157e+308",
+ true,
+ -s3 == -Infinity || -s3 == -1.7976931348623157e+308 );
+
+
+//***** This answer is preferred but Infinity is also acceptable here *****
+
+new TestCase( SECTION,
+ "parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity",
+ true,
+ parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity );
+
+//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here *****
+new TestCase( SECTION,
+ "parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308",
+ true ,
+ parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 );
+
+//***** This answer is preferred but Infinity is also acceptable here *****
+
+new TestCase( SECTION,
+ "parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity",
+ true,
+ parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity);
+
+//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here *****
+new TestCase( SECTION,
+ "parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308",
+ true,
+ parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 );
+
+new TestCase( SECTION,
+ "0x12345678",
+ 305419896,
+ 0x12345678 );
+
+new TestCase( SECTION,
+ "0x80000000",
+ 2147483648,
+ 0x80000000 );
+
+new TestCase( SECTION,
+ "0xffffffff",
+ 4294967295,
+ 0xffffffff );
+
+new TestCase( SECTION,
+ "0x100000000",
+ 4294967296,
+ 0x100000000 );
+
+new TestCase( SECTION,
+ "0x1fffffffffffff",
+ 9007199254740991,
+ 0x1fffffffffffff );
+
+new TestCase( SECTION,
+ "0x20000000000000",
+ 9007199254740992,
+ 0x20000000000000 );
+
+new TestCase( SECTION,
+ "0x20123456789abc",
+ 9027215253084860,
+ 0x20123456789abc );
+
+new TestCase( SECTION,
+ "0x20123456789abd",
+ 9027215253084860,
+ 0x20123456789abd );
+
+new TestCase( SECTION,
+ "0x20123456789abe",
+ 9027215253084862,
+ 0x20123456789abe );
+
+new TestCase( SECTION,
+ "0x20123456789abf",
+ 9027215253084864,
+ 0x20123456789abf );
+
+/***** These test the round-to-nearest-or-even-if-equally-close rule *****/
+
+new TestCase( SECTION,
+ "0x1000000000000080",
+ 1152921504606847000,
+ 0x1000000000000080 );
+
+new TestCase( SECTION,
+ "0x1000000000000081",
+ 1152921504606847200,
+ 0x1000000000000081 );
+
+new TestCase( SECTION,
+ "0x1000000000000100",
+ 1152921504606847200,
+ 0x1000000000000100 );
+new TestCase( SECTION,
+ "0x100000000000017f",
+ 1152921504606847200,
+ 0x100000000000017f );
+
+new TestCase( SECTION,
+ "0x1000000000000180",
+ 1152921504606847500,
+ 0x1000000000000180 );
+
+new TestCase( SECTION,
+ "0x1000000000000181",
+ 1152921504606847500,
+ 0x1000000000000181 );
+
+new TestCase( SECTION,
+ "0x10000000000001f0",
+ 1152921504606847500,
+ 0x10000000000001f0 );
+
+new TestCase( SECTION,
+ "0x1000000000000200",
+ 1152921504606847500,
+ 0x1000000000000200 );
+
+new TestCase( SECTION,
+ "0x100000000000027f",
+ 1152921504606847500,
+ 0x100000000000027f );
+
+new TestCase( SECTION,
+ "0x1000000000000280",
+ 1152921504606847500,
+ 0x1000000000000280 );
+
+new TestCase( SECTION,
+ "0x1000000000000281",
+ 1152921504606847700,
+ 0x1000000000000281 );
+
+new TestCase( SECTION,
+ "0x10000000000002ff",
+ 1152921504606847700,
+ 0x10000000000002ff );
+
+new TestCase( SECTION,
+ "0x1000000000000300",
+ 1152921504606847700,
+ 0x1000000000000300 );
+
+new TestCase( SECTION,
+ "0x10000000000000000",
+ 18446744073709552000,
+ 0x10000000000000000 );
+
+new TestCase( SECTION,
+ "parseInt(\"000000100000000100100011010001010110011110001001101010111100\",2)",
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
+
+new TestCase( SECTION,
+ "parseInt(\"000000100000000100100011010001010110011110001001101010111101\",2)",
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111101",2) );
+
+new TestCase( SECTION,
+ "parseInt(\"000000100000000100100011010001010110011110001001101010111111\",2)",
+ 9027215253084864,
+ parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
+
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111010\",2)",
+ 18054430506169720,
+ parseInt("0000001000000001001000110100010101100111100010011010101111010",2));
+
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111011\",2)",
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111011",2) );
+
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111100\",2)",
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111100",2));
+
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111110\",2)",
+ 18054430506169728,
+ parseInt("0000001000000001001000110100010101100111100010011010101111110",2));
+
+new TestCase( SECTION,
+ "parseInt(\"yz\",35)",
+ 34,
+ parseInt("yz",35) );
+
+new TestCase( SECTION,
+ "parseInt(\"yz\",36)",
+ 1259,
+ parseInt("yz",36) );
+
+new TestCase( SECTION,
+ "parseInt(\"yz\",37)",
+ NaN,
+ parseInt("yz",37) );
+
+new TestCase( SECTION,
+ "parseInt(\"+77\")",
+ 77,
+ parseInt("+77") );
+
+new TestCase( SECTION,
+ "parseInt(\"-77\",9)",
+ -70,
+ parseInt("-77",9) );
+
+new TestCase( SECTION,
+ "parseInt(\"\\u20001234\\u2000\")",
+ 1234,
+ parseInt("\u20001234\u2000") );
+
+new TestCase( SECTION,
+ "parseInt(\"123456789012345678\")",
+ 123456789012345680,
+ parseInt("123456789012345678") );
+
+new TestCase( SECTION,
+ "parseInt(\"9\",8)",
+ NaN,
+ parseInt("9",8) );
+
+new TestCase( SECTION,
+ "parseInt(\"1e2\")",
+ 1,
+ parseInt("1e2") );
+
+new TestCase( SECTION,
+ "parseInt(\"1.9999999999999999999\")",
+ 1,
+ parseInt("1.9999999999999999999") );
+
+new TestCase( SECTION,
+ "parseInt(\"0x10\")",
+ 16,
+ parseInt("0x10") );
+
+new TestCase( SECTION,
+ "parseInt(\"0x10\",10)",
+ 0,
+ parseInt("0x10",10) );
+
+new TestCase( SECTION,
+ "parseInt(\"0022\")",
+ 18,
+ parseInt("0022") );
+
+new TestCase( SECTION,
+ "parseInt(\"0022\",10)",
+ 22,
+ parseInt("0022",10) );
+
+new TestCase( SECTION,
+ "parseInt(\"0x1000000000000080\")",
+ 1152921504606847000,
+ parseInt("0x1000000000000080") );
+
+new TestCase( SECTION,
+ "parseInt(\"0x1000000000000081\")",
+ 1152921504606847200,
+ parseInt("0x1000000000000081") );
+
+s =
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+new TestCase( SECTION, "s = "+
+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+ "s",
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s );
+
+
+new TestCase( SECTION, "s +="+
+ "\"0000000000000000000000000000000000000\"; s",
+ "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s += "0000000000000000000000000000000000000" );
+
+new TestCase( SECTION, "-s",
+ -1.7976931348623157e+308,
+ -s );
+
+s =
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+new TestCase( SECTION, "s ="+
+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+ "s",
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s );
+
+new TestCase( SECTION,
+ "s += \"0000000000000000000000000000000000001\"",
+ "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
+ s += "0000000000000000000000000000000000001" );
+
+new TestCase( SECTION,
+ "-s",
+ -1.7976931348623157e+308,
+ -s );
+
+s =
+ "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+new TestCase( SECTION,
+ "s ="+
+ "\"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+ "s",
+ "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s );
+
+
+new TestCase( SECTION,
+ "s += \"0000000000000000000000000000000000000\"",
+ "0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s += "0000000000000000000000000000000000000");
+
+
+new TestCase( SECTION,
+ "-s",
+ -Infinity,
+ -s );
+
+s =
+ "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+new TestCase( SECTION,
+ "s = "+
+ "\"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";s",
+ "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s);
+
+new TestCase( SECTION,
+ "s += \"0000000000000000000000000000000000001\"",
+ "0xFFFFFFFFFFFFFB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
+ s += "0000000000000000000000000000000000001" );
+
+new TestCase( SECTION,
+ "-s",
+ -1.7976931348623157e+308,
+ -s );
+
+new TestCase( SECTION,
+ "s += \"0\"",
+ "0xFFFFFFFFFFFFFB000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010",
+ s += "0" );
+
+new TestCase( SECTION,
+ "-s",
+ -Infinity,
+ -s );
+
+new TestCase( SECTION,
+ "parseInt(s)",
+ Infinity,
+ parseInt(s) );
+
+new TestCase( SECTION,
+ "parseInt(s,32)",
+ 0,
+ parseInt(s,32) );
+
+new TestCase( SECTION,
+ "parseInt(s,36)",
+ Infinity,
+ parseInt(s,36) );
+
+new TestCase( SECTION,
+ "-\"\"",
+ 0,
+ -"" );
+
+new TestCase( SECTION,
+ "-\" \"",
+ 0,
+ -" " );
+
+new TestCase( SECTION,
+ "-\"999\"",
+ -999,
+ -"999" );
+
+new TestCase( SECTION,
+ "-\" 999\"",
+ -999,
+ -" 999" );
+
+new TestCase( SECTION,
+ "-\"\\t999\"",
+ -999,
+ -"\t999" );
+
+new TestCase( SECTION,
+ "-\"013 \"",
+ -13,
+ -"013 " );
+
+new TestCase( SECTION,
+ "-\"999\\t\"",
+ -999,
+ -"999\t" );
+
+new TestCase( SECTION,
+ "-\"-Infinity\"",
+ Infinity,
+ -"-Infinity" );
+
+new TestCase( SECTION,
+ "-\"-infinity\"",
+ NaN,
+ -"-infinity" );
+
+
+new TestCase( SECTION,
+ "-\"+Infinity\"",
+ -Infinity,
+ -"+Infinity" );
+
+new TestCase( SECTION,
+ "-\"+Infiniti\"",
+ NaN,
+ -"+Infiniti" );
+
+new TestCase( SECTION,
+ "- -\"0x80000000\"",
+ 2147483648,
+ - -"0x80000000" );
+
+new TestCase( SECTION,
+ "- -\"0x100000000\"",
+ 4294967296,
+ - -"0x100000000" );
+
+new TestCase( SECTION,
+ "- \"-0x123456789abcde8\"",
+ 81985529216486880,
+ - "-0x123456789abcde8" );
+
+// the following two tests are not strictly ECMA 1.0
+
+new TestCase( SECTION,
+ "-\"\\u20001234\\u2001\"",
+ -1234,
+ -"\u20001234\u2001" );
+
+new TestCase( SECTION,
+ "-\"\\u20001234\\0\"",
+ NaN,
+ -"\u20001234\0" );
+
+new TestCase( SECTION,
+ "-\"0x10\"",
+ -16,
+ -"0x10" );
+
+new TestCase( SECTION,
+ "-\"+\"",
+ NaN,
+ -"+" );
+
+new TestCase( SECTION,
+ "-\"-\"",
+ NaN,
+ -"-" );
+
+new TestCase( SECTION,
+ "-\"-0-\"",
+ NaN,
+ -"-0-" );
+
+new TestCase( SECTION,
+ "-\"1e-\"",
+ NaN,
+ -"1e-" );
+
+new TestCase( SECTION,
+ "-\"1e-1\"",
+ -0.1,
+ -"1e-1" );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.js
new file mode 100644
index 0000000000..c4b866e7f3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.3.js';
+
+/**
+ File Name: 9.3.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
+
+ For ToNumber applied to the String type, see test 9.3.1.
+ For ToNumber applied to the object type, see test 9.3-1.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+var SECTION = "9.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToNumber";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// special cases here
+
+new TestCase( SECTION, "Number()", 0, Number() );
+new TestCase( SECTION, "Number(eval('var x'))", Number.NaN, Number(eval("var x")) );
+new TestCase( SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
+new TestCase( SECTION, "Number(null)", 0, Number(null) );
+new TestCase( SECTION, "Number(true)", 1, Number(true) );
+new TestCase( SECTION, "Number(false)", 0, Number(false) );
+new TestCase( SECTION, "Number(0)", 0, Number(0) );
+new TestCase( SECTION, "Number(-0)", -0, Number(-0) );
+new TestCase( SECTION, "Number(1)", 1, Number(1) );
+new TestCase( SECTION, "Number(-1)", -1, Number(-1) );
+new TestCase( SECTION, "Number(Number.MAX_VALUE)", 1.7976931348623157e308, Number(Number.MAX_VALUE) );
+new TestCase( SECTION, "Number(Number.MIN_VALUE)", 5e-324, Number(Number.MIN_VALUE) );
+
+new TestCase( SECTION, "Number(Number.NaN)", Number.NaN, Number(Number.NaN) );
+new TestCase( SECTION, "Number(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, Number(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "Number(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, Number(Number.NEGATIVE_INFINITY) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-1.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-1.js
new file mode 100644
index 0000000000..e99875697a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-1.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.4-1.js';
+
+/**
+ File Name: 9.4-1.js
+ ECMA Section: 9.4 ToInteger
+ Description: 1. Call ToNumber on the input argument
+ 2. If Result(1) is NaN, return +0
+ 3. If Result(1) is +0, -0, Infinity, or -Infinity,
+ return Result(1).
+ 4. Compute sign(Result(1)) * floor(abs(Result(1))).
+ 5. Return Result(4).
+
+ To test ToInteger, this test uses new Date(value),
+ 15.9.3.7. The Date constructor sets the [[Value]]
+ property of the new object to TimeClip(value), which
+ uses the rules:
+
+ TimeClip(time)
+ 1. If time is not finite, return NaN
+ 2. If abs(Result(1)) > 8.64e15, return NaN
+ 3. Return an implementation dependent choice of either
+ ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
+ (Adding a positive 0 converts -0 to +0).
+
+ This tests ToInteger for values -8.64e15 > value > 8.64e15,
+ not including -0 and +0.
+
+ For additional special cases (0, +0, Infinity, -Infinity,
+ and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+var SECTION = "9.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToInteger";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some special cases
+
+new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+
+// value is not an integer
+
+new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
+
+new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
+
+// value is not a number
+
+new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
+
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+
+// edge cases
+new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-2.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-2.js
new file mode 100644
index 0000000000..9b26a67fac
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.4-2.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.4-2.js';
+
+/**
+ File Name: 9.4-1.js
+ ECMA Section: 9.4 ToInteger
+ Description: 1. Call ToNumber on the input argument
+ 2. If Result(1) is NaN, return +0
+ 3. If Result(1) is +0, -0, Infinity, or -Infinity,
+ return Result(1).
+ 4. Compute sign(Result(1)) * floor(abs(Result(1))).
+ 5. Return Result(4).
+
+ To test ToInteger, this test uses new Date(value),
+ 15.9.3.7. The Date constructor sets the [[Value]]
+ property of the new object to TimeClip(value), which
+ uses the rules:
+
+ TimeClip(time)
+ 1. If time is not finite, return NaN
+ 2. If abs(Result(1)) > 8.64e15, return NaN
+ 3. Return an implementation dependent choice of either
+ ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
+ (Adding a positive 0 converts -0 to +0).
+
+ This tests ToInteger for values -8.64e15 > value > 8.64e15,
+ not including -0 and +0.
+
+ For additional special cases (0, +0, Infinity, -Infinity,
+ and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+
+*/
+var SECTION = "9.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToInteger";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// some special cases
+
+new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+
+// value is not an integer
+
+new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
+
+new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
+
+// value is not a number
+
+new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
+
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+
+// edge cases
+new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.5-2.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.5-2.js
new file mode 100644
index 0000000000..2773052340
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.5-2.js
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.5-2.js';
+
+/**
+ File Name: 9.5-2.js
+ ECMA Section: 9.5 Type Conversion: ToInt32
+ Description: rules for converting an argument to a signed 32 bit integer
+
+ this test uses << 0 to convert the argument to a 32bit
+ integer.
+
+ The operator ToInt32 converts its argument to one of 2^32
+ integer values in the range -2^31 through 2^31 inclusive.
+ This operator functions as follows:
+
+ 1 call ToNumber on argument
+ 2 if result is NaN, 0, -0, return 0
+ 3 compute (sign (result(1)) * floor(abs(result 1)))
+ 4 compute result(3) modulo 2^32:
+ 5 if result(4) is greater than or equal to 2^31, return
+ result(5)-2^32. otherwise, return result(5)
+
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
+ Numbers greater than 2^31 (see step 5 above)
+ (note http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+var SECTION = "9.5-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " ToInt32");
+
+new TestCase( SECTION, "0 << 0", 0, 0 << 0 );
+new TestCase( SECTION, "-0 << 0", 0, -0 << 0 );
+new TestCase( SECTION, "Infinity << 0", 0, "Infinity" << 0 );
+new TestCase( SECTION, "-Infinity << 0", 0, "-Infinity" << 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY << 0", 0, Number.POSITIVE_INFINITY << 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY << 0", 0, Number.NEGATIVE_INFINITY << 0 );
+new TestCase( SECTION, "Number.NaN << 0", 0, Number.NaN << 0 );
+
+new TestCase( SECTION, "Number.MIN_VALUE << 0", 0, Number.MIN_VALUE << 0 );
+new TestCase( SECTION, "-Number.MIN_VALUE << 0", 0, -Number.MIN_VALUE << 0 );
+new TestCase( SECTION, "0.1 << 0", 0, 0.1 << 0 );
+new TestCase( SECTION, "-0.1 << 0", 0, -0.1 << 0 );
+new TestCase( SECTION, "1 << 0", 1, 1 << 0 );
+new TestCase( SECTION, "1.1 << 0", 1, 1.1 << 0 );
+new TestCase( SECTION, "-1 << 0", ToInt32(-1), -1 << 0 );
+
+
+new TestCase( SECTION, "2147483647 << 0", ToInt32(2147483647), 2147483647 << 0 );
+new TestCase( SECTION, "2147483648 << 0", ToInt32(2147483648), 2147483648 << 0 );
+new TestCase( SECTION, "2147483649 << 0", ToInt32(2147483649), 2147483649 << 0 );
+
+new TestCase( SECTION, "(Math.pow(2,31)-1) << 0", ToInt32(2147483647), (Math.pow(2,31)-1) << 0 );
+new TestCase( SECTION, "Math.pow(2,31) << 0", ToInt32(2147483648), Math.pow(2,31) << 0 );
+new TestCase( SECTION, "(Math.pow(2,31)+1) << 0", ToInt32(2147483649), (Math.pow(2,31)+1) << 0 );
+
+new TestCase( SECTION, "(Math.pow(2,32)-1) << 0", ToInt32(4294967295), (Math.pow(2,32)-1) << 0 );
+new TestCase( SECTION, "(Math.pow(2,32)) << 0", ToInt32(4294967296), (Math.pow(2,32)) << 0 );
+new TestCase( SECTION, "(Math.pow(2,32)+1) << 0", ToInt32(4294967297), (Math.pow(2,32)+1) << 0 );
+
+new TestCase( SECTION, "4294967295 << 0", ToInt32(4294967295), 4294967295 << 0 );
+new TestCase( SECTION, "4294967296 << 0", ToInt32(4294967296), 4294967296 << 0 );
+new TestCase( SECTION, "4294967297 << 0", ToInt32(4294967297), 4294967297 << 0 );
+
+new TestCase( SECTION, "'2147483647' << 0", ToInt32(2147483647), '2147483647' << 0 );
+new TestCase( SECTION, "'2147483648' << 0", ToInt32(2147483648), '2147483648' << 0 );
+new TestCase( SECTION, "'2147483649' << 0", ToInt32(2147483649), '2147483649' << 0 );
+
+new TestCase( SECTION, "'4294967295' << 0", ToInt32(4294967295), '4294967295' << 0 );
+new TestCase( SECTION, "'4294967296' << 0", ToInt32(4294967296), '4294967296' << 0 );
+new TestCase( SECTION, "'4294967297' << 0", ToInt32(4294967297), '4294967297' << 0 );
+
+new TestCase( SECTION, "-2147483647 << 0", ToInt32(-2147483647), -2147483647 << 0 );
+new TestCase( SECTION, "-2147483648 << 0", ToInt32(-2147483648), -2147483648 << 0 );
+new TestCase( SECTION, "-2147483649 << 0", ToInt32(-2147483649), -2147483649 << 0 );
+
+new TestCase( SECTION, "-4294967295 << 0", ToInt32(-4294967295), -4294967295 << 0 );
+new TestCase( SECTION, "-4294967296 << 0", ToInt32(-4294967296), -4294967296 << 0 );
+new TestCase( SECTION, "-4294967297 << 0", ToInt32(-4294967297), -4294967297 << 0 );
+
+/*
+ * Numbers between 2^31 and 2^32 will have a negative ToInt32 per ECMA (see step 5 of introduction)
+ * (These are by stevechapel@earthlink.net; cf. http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
+ */
+new TestCase( SECTION, "2147483648.25 << 0", ToInt32(2147483648.25), 2147483648.25 << 0 );
+new TestCase( SECTION, "2147483648.5 << 0", ToInt32(2147483648.5), 2147483648.5 << 0 );
+new TestCase( SECTION, "2147483648.75 << 0", ToInt32(2147483648.75), 2147483648.75 << 0 );
+new TestCase( SECTION, "4294967295.25 << 0", ToInt32(4294967295.25), 4294967295.25 << 0 );
+new TestCase( SECTION, "4294967295.5 << 0", ToInt32(4294967295.5), 4294967295.5 << 0 );
+new TestCase( SECTION, "4294967295.75 << 0", ToInt32(4294967295.75), 4294967295.75 << 0 );
+new TestCase( SECTION, "3000000000.25 << 0", ToInt32(3000000000.25), 3000000000.25 << 0 );
+new TestCase( SECTION, "3000000000.5 << 0", ToInt32(3000000000.5), 3000000000.5 << 0 );
+new TestCase( SECTION, "3000000000.75 << 0", ToInt32(3000000000.75), 3000000000.75 << 0 );
+
+/*
+ * Numbers between - 2^31 and - 2^32
+ */
+new TestCase( SECTION, "-2147483648.25 << 0", ToInt32(-2147483648.25), -2147483648.25 << 0 );
+new TestCase( SECTION, "-2147483648.5 << 0", ToInt32(-2147483648.5), -2147483648.5 << 0 );
+new TestCase( SECTION, "-2147483648.75 << 0", ToInt32(-2147483648.75), -2147483648.75 << 0 );
+new TestCase( SECTION, "-4294967295.25 << 0", ToInt32(-4294967295.25), -4294967295.25 << 0 );
+new TestCase( SECTION, "-4294967295.5 << 0", ToInt32(-4294967295.5), -4294967295.5 << 0 );
+new TestCase( SECTION, "-4294967295.75 << 0", ToInt32(-4294967295.75), -4294967295.75 << 0 );
+new TestCase( SECTION, "-3000000000.25 << 0", ToInt32(-3000000000.25), -3000000000.25 << 0 );
+new TestCase( SECTION, "-3000000000.5 << 0", ToInt32(-3000000000.5), -3000000000.5 << 0 );
+new TestCase( SECTION, "-3000000000.75 << 0", ToInt32(-3000000000.75), -3000000000.75 << 0 );
+
+
+test();
+
+function ToInt32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ if ( sign == -1 ) {
+ n = ( n < -Math.pow(2,31) ) ? n + Math.pow(2,32) : n;
+ } else{
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ }
+
+ return ( n );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.6.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.6.js
new file mode 100644
index 0000000000..3d958b3f9d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.6.js
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.6.js';
+
+/**
+ File Name: 9.6.js
+ ECMA Section: 9.6 Type Conversion: ToUint32
+ Description: rules for converting an argument to an unsigned
+ 32 bit integer
+
+ this test uses >>> 0 to convert the argument to
+ an unsigned 32bit integer.
+
+ 1 call ToNumber on argument
+ 2 if result is NaN, 0, -0, Infinity, -Infinity
+ return 0
+ 3 compute (sign (result(1)) * floor(abs(result 1)))
+ 4 compute result(3) modulo 2^32:
+ 5 return result(4)
+
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ 0 returns 0
+ ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
+ ** NEED TO DO THIS PART IN A SEPARATE TEST FILE **
+
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+var SECTION = "9.6";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Type Conversion: ToUint32");
+
+new TestCase( SECTION, "0 >>> 0", 0, 0 >>> 0 );
+// new TestCase( SECTION, "+0 >>> 0", 0, +0 >>> 0);
+new TestCase( SECTION, "-0 >>> 0", 0, -0 >>> 0 );
+new TestCase( SECTION, "'Infinity' >>> 0", 0, "Infinity" >>> 0 );
+new TestCase( SECTION, "'-Infinity' >>> 0", 0, "-Infinity" >>> 0);
+new TestCase( SECTION, "'+Infinity' >>> 0", 0, "+Infinity" >>> 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY >>> 0", 0, Number.POSITIVE_INFINITY >>> 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY >>> 0", 0, Number.NEGATIVE_INFINITY >>> 0 );
+new TestCase( SECTION, "Number.NaN >>> 0", 0, Number.NaN >>> 0 );
+
+new TestCase( SECTION, "Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
+new TestCase( SECTION, "-Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
+new TestCase( SECTION, "0.1 >>> 0", 0, 0.1 >>> 0 );
+new TestCase( SECTION, "-0.1 >>> 0", 0, -0.1 >>> 0 );
+new TestCase( SECTION, "1 >>> 0", 1, 1 >>> 0 );
+new TestCase( SECTION, "1.1 >>> 0", 1, 1.1 >>> 0 );
+
+new TestCase( SECTION, "-1.1 >>> 0", ToUint32(-1.1), -1.1 >>> 0 );
+new TestCase( SECTION, "-1 >>> 0", ToUint32(-1), -1 >>> 0 );
+
+new TestCase( SECTION, "2147483647 >>> 0", ToUint32(2147483647), 2147483647 >>> 0 );
+new TestCase( SECTION, "2147483648 >>> 0", ToUint32(2147483648), 2147483648 >>> 0 );
+new TestCase( SECTION, "2147483649 >>> 0", ToUint32(2147483649), 2147483649 >>> 0 );
+
+new TestCase( SECTION, "4294967295 >>> 0", ToUint32(4294967295), 4294967295 >>> 0 );
+new TestCase( SECTION, "4294967296 >>> 0", ToUint32(4294967296), 4294967296 >>> 0 );
+new TestCase( SECTION, "4294967297 >>> 0", ToUint32(4294967297), 4294967297 >>> 0 );
+
+new TestCase( SECTION, "-2147483647 >>> 0", ToUint32(-2147483647), -2147483647 >>> 0 );
+new TestCase( SECTION, "-2147483648 >>> 0", ToUint32(-2147483648), -2147483648 >>> 0 );
+new TestCase( SECTION, "-2147483649 >>> 0", ToUint32(-2147483649), -2147483649 >>> 0 );
+
+new TestCase( SECTION, "-4294967295 >>> 0", ToUint32(-4294967295), -4294967295 >>> 0 );
+new TestCase( SECTION, "-4294967296 >>> 0", ToUint32(-4294967296), -4294967296 >>> 0 );
+new TestCase( SECTION, "-4294967297 >>> 0", ToUint32(-4294967297), -4294967297 >>> 0 );
+
+new TestCase( SECTION, "'2147483647' >>> 0", ToUint32(2147483647), '2147483647' >>> 0 );
+new TestCase( SECTION, "'2147483648' >>> 0", ToUint32(2147483648), '2147483648' >>> 0 );
+new TestCase( SECTION, "'2147483649' >>> 0", ToUint32(2147483649), '2147483649' >>> 0 );
+
+new TestCase( SECTION, "'4294967295' >>> 0", ToUint32(4294967295), '4294967295' >>> 0 );
+new TestCase( SECTION, "'4294967296' >>> 0", ToUint32(4294967296), '4294967296' >>> 0 );
+new TestCase( SECTION, "'4294967297' >>> 0", ToUint32(4294967297), '4294967297' >>> 0 );
+
+
+test();
+
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.7.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.7.js
new file mode 100644
index 0000000000..34e4857fd7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.7.js
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.7.js';
+
+/**
+ File Name: 9.7.js
+ ECMA Section: 9.7 Type Conversion: ToInt16
+ Description: rules for converting an argument to an unsigned
+ 16 bit integer in the range 0 to 2^16-1.
+
+ this test uses String.prototype.fromCharCode() and
+ String.prototype.charCodeAt() to test ToInt16.
+
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ 0 returns 0
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+var SECTION = "9.7";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Type Conversion: ToInt16");
+
+/*
+ new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", 0, String.fromCharCode(0).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", 0, String.fromCharCode(-0).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", 1, String.fromCharCode(1).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", 64, String.fromCharCode(64).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", 126, String.fromCharCode(126).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", 127, String.fromCharCode(127).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", 128, String.fromCharCode(128).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", 130, String.fromCharCode(130).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", 255, String.fromCharCode(255).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", 256, String.fromCharCode(256).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
+*/
+
+
+new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", ToInt16(0), String.fromCharCode(0).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", ToInt16(0), String.fromCharCode(-0).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", ToInt16(1), String.fromCharCode(1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", ToInt16(64), String.fromCharCode(64).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", ToInt16(126), String.fromCharCode(126).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", ToInt16(127), String.fromCharCode(127).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", ToInt16(128), String.fromCharCode(128).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", ToInt16(130), String.fromCharCode(130).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", ToInt16(255), String.fromCharCode(255).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", ToInt16(256), String.fromCharCode(256).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode(65535).charCodeAt(0)", ToInt16(65535), String.fromCharCode(65535).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(65536).charCodeAt(0)", ToInt16(65536), String.fromCharCode(65536).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(65537).charCodeAt(0)", ToInt16(65537), String.fromCharCode(65537).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode(131071).charCodeAt(0)", ToInt16(131071), String.fromCharCode(131071).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(131072).charCodeAt(0)", ToInt16(131072), String.fromCharCode(131072).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(131073).charCodeAt(0)", ToInt16(131073), String.fromCharCode(131073).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode('65535').charCodeAt(0)", 65535, String.fromCharCode("65535").charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode('65536').charCodeAt(0)", 0, String.fromCharCode("65536").charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode(-1).charCodeAt(0)", ToInt16(-1), String.fromCharCode(-1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-64).charCodeAt(0)", ToInt16(-64), String.fromCharCode(-64).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-126).charCodeAt(0)", ToInt16(-126), String.fromCharCode(-126).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-127).charCodeAt(0)", ToInt16(-127), String.fromCharCode(-127).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-128).charCodeAt(0)", ToInt16(-128), String.fromCharCode(-128).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-130).charCodeAt(0)", ToInt16(-130), String.fromCharCode(-130).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-255).charCodeAt(0)", ToInt16(-255), String.fromCharCode(-255).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-256).charCodeAt(0)", ToInt16(-256), String.fromCharCode(-256).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(-Math.pow(2,16)).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode(-65535).charCodeAt(0)", ToInt16(-65535), String.fromCharCode(-65535).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-65536).charCodeAt(0)", ToInt16(-65536), String.fromCharCode(-65536).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-65537).charCodeAt(0)", ToInt16(-65537), String.fromCharCode(-65537).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode(-131071).charCodeAt(0)", ToInt16(-131071), String.fromCharCode(-131071).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-131072).charCodeAt(0)", ToInt16(-131072), String.fromCharCode(-131072).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-131073).charCodeAt(0)", ToInt16(-131073), String.fromCharCode(-131073).charCodeAt(0) );
+
+new TestCase( "9.7", "String.fromCharCode('-65535').charCodeAt(0)", ToInt16(-65535), String.fromCharCode("-65535").charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode('-65536').charCodeAt(0)", ToInt16(-65536), String.fromCharCode("-65536").charCodeAt(0) );
+
+
+// new TestCase( "9.7", "String.fromCharCode(2147483648).charCodeAt(0)", ToInt16(2147483648), String.fromCharCode(2147483648).charCodeAt(0) );
+
+
+
+// the following test cases cause a runtime error. see: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=78878
+
+// new TestCase( "9.7", "String.fromCharCode(Infinity).charCodeAt(0)", 0, String.fromCharCode("Infinity").charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(-Infinity).charCodeAt(0)", 0, String.fromCharCode("-Infinity").charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(NaN).charCodeAt(0)", 0, String.fromCharCode(Number.NaN).charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) );
+
+test();
+
+function ToInt16( num ) {
+ num = Number( num );
+ if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( num < 0 ) ? -1 : 1;
+
+ num = sign * Math.floor( Math.abs( num ) );
+
+ num = num % Math.pow(2,16);
+
+ num = ( num > -65536 && num < 0) ? 65536 + num : num;
+
+ return num;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.8.1.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.8.1.js
new file mode 100644
index 0000000000..897dc59f6f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.8.1.js
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.8.1.js';
+
+/**
+ File Name: 9.8.1.js
+ ECMA Section: 9.8.1 ToString Applied to the Number Type
+ Description: The operator ToString convers a number m to string
+ as follows:
+
+ 1. if m is NaN, return the string "NaN"
+ 2. if m is +0 or -0, return the string "0"
+ 3. if m is less than zero, return the string
+ concatenation of the string "-" and ToString(-m).
+ 4. If m is Infinity, return the string "Infinity".
+ 5. Otherwise, let n, k, and s be integers such that
+ k >= 1, 10k1 <= s < 10k, the number value for s10nk
+ is m, and k is as small as possible. Note that k is
+ the number of digits in the decimal representation
+ of s, that s is not divisible by 10, and that the
+ least significant digit of s is not necessarily
+ uniquely determined by these criteria.
+ 6. If k <= n <= 21, return the string consisting of the
+ k digits of the decimal representation of s (in order,
+ with no leading zeroes), followed by n-k occurences
+ of the character '0'.
+ 7. If 0 < n <= 21, return the string consisting of the
+ most significant n digits of the decimal
+ representation of s, followed by a decimal point
+ '.', followed by the remaining kn digits of the
+ decimal representation of s.
+ 8. If 6 < n <= 0, return the string consisting of the
+ character '0', followed by a decimal point '.',
+ followed by n occurences of the character '0',
+ followed by the k digits of the decimal
+ representation of s.
+ 9. Otherwise, if k = 1, return the string consisting
+ of the single digit of s, followed by lowercase
+ character 'e', followed by a plus sign '+' or minus
+ sign '' according to whether n1 is positive or
+ negative, followed by the decimal representation
+ of the integer abs(n1) (with no leading zeros).
+ 10. Return the string consisting of the most significant
+ digit of the decimal representation of s, followed
+ by a decimal point '.', followed by the remaining k1
+ digits of the decimal representation of s, followed
+ by the lowercase character 'e', followed by a plus
+ sign '+' or minus sign '' according to whether n1 is
+ positive or negative, followed by the decimal
+ representation of the integer abs(n1) (with no
+ leading zeros).
+
+ Note that if x is any number value other than 0, then
+ ToNumber(ToString(x)) is exactly the same number value as x.
+
+ As noted, the least significant digit of s is not always
+ uniquely determined by the requirements listed in step 5.
+ The following specification for step 5 was considered, but
+ not adopted:
+
+ Author: christine@netscape.com
+ Date: 10 july 1997
+*/
+
+var SECTION = "9.8.1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " ToString applied to the Number type");
+
+new TestCase( SECTION, "Number.NaN", "NaN", Number.NaN + "" );
+new TestCase( SECTION, "0", "0", 0 + "" );
+new TestCase( SECTION, "-0", "0", -0 + "" );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY", "Infinity", Number.POSITIVE_INFINITY + "" );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY", "-Infinity", Number.NEGATIVE_INFINITY + "" );
+new TestCase( SECTION, "-1", "-1", -1 + "" );
+
+// cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
+
+new TestCase( SECTION, "1", "1", 1 + "" );
+new TestCase( SECTION, "10", "10", 10 + "" );
+new TestCase( SECTION, "100", "100", 100 + "" );
+new TestCase( SECTION, "1000", "1000", 1000 + "" );
+new TestCase( SECTION, "10000", "10000", 10000 + "" );
+new TestCase( SECTION, "10000000000", "10000000000", 10000000000 + "" );
+new TestCase( SECTION, "10000000000000000000", "10000000000000000000", 10000000000000000000 + "" );
+new TestCase( SECTION, "100000000000000000000","100000000000000000000",100000000000000000000 + "" );
+
+new TestCase( SECTION, "12345", "12345", 12345 + "" );
+new TestCase( SECTION, "1234567890", "1234567890", 1234567890 + "" );
+
+new TestCase( SECTION, "-1", "-1", -1 + "" );
+new TestCase( SECTION, "-10", "-10", -10 + "" );
+new TestCase( SECTION, "-100", "-100", -100 + "" );
+new TestCase( SECTION, "-1000", "-1000", -1000 + "" );
+new TestCase( SECTION, "-1000000000", "-1000000000", -1000000000 + "" );
+new TestCase( SECTION, "-1000000000000000", "-1000000000000000", -1000000000000000 + "" );
+new TestCase( SECTION, "-100000000000000000000", "-100000000000000000000", -100000000000000000000 + "" );
+new TestCase( SECTION, "-1000000000000000000000", "-1e+21", -1000000000000000000000 + "" );
+
+new TestCase( SECTION, "-12345", "-12345", -12345 + "" );
+new TestCase( SECTION, "-1234567890", "-1234567890", -1234567890 + "" );
+
+// cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
+new TestCase( SECTION, "1.0000001", "1.0000001", 1.0000001 + "" );
+
+// cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
+
+// cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
+
+new TestCase( SECTION, "1000000000000000000000", "1e+21", 1000000000000000000000 + "" );
+new TestCase( SECTION, "10000000000000000000000", "1e+22", 10000000000000000000000 + "" );
+
+// cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
+
+new TestCase( SECTION, "1.2345", "1.2345", String( 1.2345));
+new TestCase( SECTION, "1.234567890", "1.23456789", String( 1.234567890 ));
+
+
+new TestCase( SECTION, ".12345", "0.12345", String(.12345 ) );
+new TestCase( SECTION, ".012345", "0.012345", String(.012345) );
+new TestCase( SECTION, ".0012345", "0.0012345", String(.0012345) );
+new TestCase( SECTION, ".00012345", "0.00012345", String(.00012345) );
+new TestCase( SECTION, ".000012345", "0.000012345", String(.000012345) );
+new TestCase( SECTION, ".0000012345", "0.0000012345", String(.0000012345) );
+new TestCase( SECTION, ".00000012345", "1.2345e-7", String(.00000012345));
+
+new TestCase( SECTION, "-1e21", "-1e+21", String(-1e21) );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.9-1.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.9-1.js
new file mode 100644
index 0000000000..ea22980767
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.9-1.js
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.9-1.js';
+
+/**
+ File Name: 9.9-1.js
+ ECMA Section: 9.9 Type Conversion: ToObject
+ Description:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "9.9-1";
+
+writeHeaderToLog( SECTION + " Type Conversion: ToObject" );
+
+new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
+new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
+
+new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
+new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
+
+new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
+new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
+
+new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
+new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
+
+new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
+new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
+
+new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
+new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
+
+new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
+
+new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
+
+new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
+
+new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
+new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
+
+new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
+new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
+
+new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
+new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
+
+new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
+new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
+
+new TestCase( SECTION, "Object( new MyObject(true) ).valueOf()", true, eval("Object( new MyObject(true) ).valueOf()") );
+new TestCase( SECTION, "typeof Object( new MyObject(true) )", "object", eval("typeof Object( new MyObject(true) )") );
+new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function ( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/browser.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/shell.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/shell.js
new file mode 100644
index 0000000000..49ce60f627
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'TypeConversion';
diff --git a/tests/auto/qml/parserstress/tests/ecma/Types/8.1.js b/tests/auto/qml/parserstress/tests/ecma/Types/8.1.js
new file mode 100644
index 0000000000..7abcb93c02
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Types/8.1.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '8.1.js';
+
+/**
+ File Name: 8.1.js
+ ECMA Section: The undefined type
+ Description:
+
+ The Undefined type has exactly one value, called undefined. Any variable
+ that has not been assigned a value is of type Undefined.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "8.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The undefined type";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var x; typeof x",
+ "undefined",
+ eval("var x; typeof x") );
+
+new TestCase( SECTION,
+ "var x; typeof x == 'undefined",
+ true,
+ eval("var x; typeof x == 'undefined'") );
+
+new TestCase( SECTION,
+ "var x; x == void 0",
+ true,
+ eval("var x; x == void 0") );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Types/8.4.js b/tests/auto/qml/parserstress/tests/ecma/Types/8.4.js
new file mode 100644
index 0000000000..7d3465f8b2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Types/8.4.js
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '8.4.js';
+
+/**
+ File Name: 8.4.js
+ ECMA Section: The String type
+ Description:
+
+ The String type is the set of all finite ordered sequences of zero or more
+ Unicode characters. Each character is regarded as occupying a position
+ within the sequence. These positions are identified by nonnegative
+ integers. The leftmost character (if any) is at position 0, the next
+ character (if any) at position 1, and so on. The length of a string is the
+ number of distinct positions within it. The empty string has length zero
+ and therefore contains no characters.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "8.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The String type";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var s = ''; s.length",
+ 0,
+ eval("var s = ''; s.length") );
+
+new TestCase( SECTION,
+ "var s = ''; s.charAt(0)",
+ "",
+ eval("var s = ''; s.charAt(0)") );
+
+
+for ( var i = 0x0041, TEST_STRING = "", EXPECT_STRING = ""; i < 0x007B; i++ ) {
+ TEST_STRING += ("\\u"+ DecimalToHexString( i ) );
+ EXPECT_STRING += String.fromCharCode(i);
+}
+
+new TestCase( SECTION,
+ "var s = '" + TEST_STRING+ "'; s",
+ EXPECT_STRING,
+ eval("var s = '" + TEST_STRING+ "'; s") );
+
+new TestCase( SECTION,
+ "var s = '" + TEST_STRING+ "'; s.length",
+ 0x007B-0x0041,
+ eval("var s = '" + TEST_STRING+ "'; s.length") );
+
+test();
+
+function DecimalToHexString( n ) {
+ n = Number( n );
+ var h = "";
+
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
+ }
+ }
+
+ return h;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/Types/8.6.2.1-1.js b/tests/auto/qml/parserstress/tests/ecma/Types/8.6.2.1-1.js
new file mode 100644
index 0000000000..c06999c42c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Types/8.6.2.1-1.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '8.6.2.1-1.js';
+
+/**
+ File Name: 8.6.2.1-1.js
+ ECMA Section: 8.6.2.1 Get (Value)
+ Description:
+
+ When the [[Get]] method of O is called with property name P, the following
+ steps are taken:
+
+ 1. If O doesn't have a property with name P, go to step 4.
+ 2. Get the value of the property.
+ 3. Return Result(2).
+ 4. If the [[Prototype]] of O is null, return undefined.
+ 5. Call the [[Get]] method of [[Prototype]] with property name P.
+ 6. Return Result(5).
+
+ This tests [[Get]] (Value).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "8.6.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " [[Get]] (Value)");
+
+new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+
+new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+
+new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") );
+
+test();
+
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/Types/browser.js b/tests/auto/qml/parserstress/tests/ecma/Types/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Types/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/Types/shell.js b/tests/auto/qml/parserstress/tests/ecma/Types/shell.js
new file mode 100644
index 0000000000..a16b996e00
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/Types/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Types';
diff --git a/tests/auto/qml/parserstress/tests/ecma/browser.js b/tests/auto/qml/parserstress/tests/ecma/browser.js
new file mode 100644
index 0000000000..60e48ceed8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/browser.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ * <script src="./../shell.js"></script>
+ * <script src="./../browser.js"></script>
+ * <script src="./mytest.js"></script>
+ */
+
+/*
+ * The earlier versions of the test code used exceptions
+ * to terminate the test script in "negative" test cases
+ * before the failure reporting code could run. In order
+ * to be able to capture errors for the "negative" case
+ * where the exception is a sign the test actually passed,
+ * the err online handler will assume that any error is a
+ * failure unless gExceptionExpected is true.
+ */
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.4-9.js b/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.4-9.js
new file mode 100644
index 0000000000..91982de20c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.4-9.js
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.4-9.js';
+
+/**
+ File Name: 10.1.4-9.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
+
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
+
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
+
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "10.1.4-9";
+var VERSION = "ECMA_2";
+startTest();
+
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+
+new TestCase( SECTION, "NEW_PROPERTY = " );
+
+test();
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+
+ var MYOBJECT = new MyObject();
+ var RESULT = "hello";
+
+ with ( MYOBJECT ) {
+ NEW_PROPERTY = RESULT;
+ }
+ gTestcases[gTc].actual = NEW_PROPERTY;
+ gTestcases[gTc].expect = RESULT;
+
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+
+ gTestcases[gTc].actual );
+
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( gTestcases );
+}
+function MyObject( n ) {
+ this.__proto__ = Number.prototype;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.6.js b/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.6.js
new file mode 100644
index 0000000000..99fd4a7ff1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.6.js
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.6.js';
+
+/**
+ File Name: 10.1.6
+ ECMA Section: Activation Object
+ Description:
+
+ If the function object being invoked has an arguments property, let x be
+ the value of that property; the activation object is also given an internal
+ property [[OldArguments]] whose initial value is x; otherwise, an arguments
+ property is created for the function object but the activation object is
+ not given an [[OldArguments]] property. Next, arguments object described
+ below (the same one stored in the arguments property of the activation
+ object) is used as the new value of the arguments property of the function
+ object. This new value is installed even if the arguments property already
+ exists and has the ReadOnly attribute (as it will for native Function
+ objects). (These actions are taken to provide compatibility with a form of
+ program syntax that is now discouraged: to access the arguments object for
+ function f within the body of f by using the expression f.arguments.
+ The recommended way to access the arguments object for function f within
+ the body of f is simply to refer to the variable arguments.)
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.1.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Activation Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var arguments = "FAILED!";
+
+var ARG_STRING = "value of the argument property";
+
+new TestCase( SECTION,
+ "(new TestObject(0,1,2,3,4,5)).length",
+ 6,
+ (new TestObject(0,1,2,3,4,5)).length );
+
+for ( i = 0; i < 6; i++ ) {
+
+ new TestCase( SECTION,
+ "(new TestObject(0,1,2,3,4,5))["+i+"]",
+ i,
+ (new TestObject(0,1,2,3,4,5))[i]);
+}
+
+
+// The current object already has an arguments property.
+
+new TestCase( SECTION,
+ "(new AnotherTestObject(1,2,3)).arguments",
+ ARG_STRING,
+ (new AnotherTestObject(1,2,3)).arguments );
+
+// The function invoked with [[Call]]
+
+new TestCase( SECTION,
+ "TestFunction(1,2,3)",
+ ARG_STRING,
+ TestFunction() + '' );
+
+
+test();
+
+
+
+function Prototype() {
+ this.arguments = ARG_STRING;
+}
+function TestObject() {
+ this.__proto__ = new Prototype();
+ return arguments;
+}
+function AnotherTestObject() {
+ this.__proto__ = new Prototype();
+ return this;
+}
+function TestFunction() {
+ arguments = ARG_STRING;
+ return arguments;
+}
+function AnotherTestFunction() {
+ this.__proto__ = new Prototype();
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.8-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.8-1.js
new file mode 100644
index 0000000000..adfc8d5df5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/10.1.8-1.js
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '10.1.8-1.js';
+
+/**
+ File Name: 10.1.8
+ ECMA Section: Arguments Object
+ Description:
+
+ When control enters an execution context for declared function code,
+ anonymous code, or implementation-supplied code, an arguments object is
+ created and initialized as follows:
+
+ The [[Prototype]] of the arguments object is to the original Object
+ prototype object, the one that is the initial value of Object.prototype
+ (section 15.2.3.1).
+
+ A property is created with name callee and property attributes {DontEnum}.
+ The initial value of this property is the function object being executed.
+ This allows anonymous functions to be recursive.
+
+ A property is created with name length and property attributes {DontEnum}.
+ The initial value of this property is the number of actual parameter values
+ supplied by the caller.
+
+ For each non-negative integer, iarg, less than the value of the length
+ property, a property is created with name ToString(iarg) and property
+ attributes { DontEnum }. The initial value of this property is the value
+ of the corresponding actual parameter supplied by the caller. The first
+ actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
+ so on. In the case when iarg is less than the number of formal parameters
+ for the function object, this property shares its value with the
+ corresponding property of the activation object. This means that changing
+ this property changes the corresponding property of the activation object
+ and vice versa. The value sharing mechanism depends on the implementation.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "10.1.8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Arguments Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var ARG_STRING = "value of the argument property";
+
+new TestCase( SECTION,
+ "GetCallee()",
+ GetCallee,
+ GetCallee() );
+
+var LIMIT = 100;
+
+for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
+ args += String(i) + ( i+1 < LIMIT ? "," : "" );
+
+}
+
+var LENGTH = eval( "GetLength("+ args +")" );
+
+new TestCase( SECTION,
+ "GetLength("+args+")",
+ 100,
+ LENGTH );
+
+var ARGUMENTS = eval( "GetArguments( " +args+")" );
+
+for ( var i = 0; i < 100; i++ ) {
+ new TestCase( SECTION,
+ "GetArguments("+args+")["+i+"]",
+ i,
+ ARGUMENTS[i] );
+}
+
+test();
+
+function TestFunction() {
+ var arg_proto = arguments.__proto__;
+}
+function GetCallee() {
+ var c = arguments.callee;
+ return c;
+}
+function GetArguments() {
+ var a = arguments;
+ return a;
+}
+function GetLength() {
+ var l = arguments.length;
+ return l;
+}
+
+function AnotherTestFunction() {
+ this.__proto__ = new Prototype();
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-1.js
new file mode 100644
index 0000000000..e467157441
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-1.js
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.1-1.js';
+
+/**
+ File Name: 11.6.1-1.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does not cover cases where the Additive or Mulplicative expression
+ ToPrimitive is string.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.1-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
+
+// tests for "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2",
+ 1,
+ eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2",
+ "truefalse",
+ eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+// tests for "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
+
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2",
+ 99,
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2",
+ "100-1",
+ eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1",
+ "truetrue",
+ eval("var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1") );
+
+test();
+
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-2.js b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-2.js
new file mode 100644
index 0000000000..a486885b7f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-2.js
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.1-2.js';
+
+/**
+ File Name: 11.6.1-2.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does only covers cases where the Additive or Mulplicative expression
+ ToPrimitive is a string.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.1-2";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
+
+// tests for "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") );
+
+// tests for "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") );
+
+test();
+
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-3.js b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-3.js
new file mode 100644
index 0000000000..7d66e58530
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.1-3.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.1-3.js';
+
+/**
+ File Name: 11.6.1-3.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
+
+ The addition operator either performs string concatenation or numeric
+ addition.
+
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
+
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
+
+ This test does only covers cases where the Additive or Mulplicative expression
+ is a Date.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.1-3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
+
+// tests for a boolean primitive and a boolean object, and
+// "MyValuelessObject", where the value is set in the object's
+// prototype, not the object itself.
+
+var DATE1 = new Date();
+
+var MYOB1 = new MyObject( DATE1 );
+var MYOB2 = new MyValuelessObject( DATE1 );
+var MYOB3 = new MyProtolessObject( DATE1 );
+var MYOB4 = new MyProtoValuelessObject( DATE1 );
+
+new TestCase( SECTION,
+ "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + 'string'",
+ DATE1.toString() + "string",
+ MYOB2 + 'string' );
+
+new TestCase( SECTION,
+ "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + new String('string')",
+ DATE1.toString() + "string",
+ MYOB2 + new String('string') );
+/*
+ new TestCase( SECTION,
+ "MYOB3 = new MyProtolessObject(DATE1); MYOB3 + new Boolean(true)",
+ DATE1.toString() + "true",
+ MYOB3 + new Boolean(true) );
+*/
+
+test();
+
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.2-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.2-1.js
new file mode 100644
index 0000000000..be8a6f6c98
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/11.6.2-1.js
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '11.6.2-1.js';
+
+/**
+ File Name: 11.6.2-1.js
+ ECMA Section: 11.6.2 The Subtraction operator ( - )
+ Description:
+
+ The production AdditiveExpression : AdditiveExpression -
+ MultiplicativeExpression is evaluated as follows:
+
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToNumber(Result(2)).
+ 6. Call ToNumber(Result(4)).
+ 7. Apply the subtraction operation to Result(5) and Result(6). See the
+ discussion below (11.6.3).
+ 8. Return Result(7).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "11.6.2-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " The subtraction operator ( - )");
+
+// tests "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
+
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2") );
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2") );
+
+// tests "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
+
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2") );
+/*
+ new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2") );
+*/
+// same thing with string!
+
+test();
+
+function MyProtoValuelessObject() {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
+function MyObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
+function MyOtherObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function ( "return this.value + ''" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15-1.js
new file mode 100644
index 0000000000..fc037873a5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15-1.js
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15-1.js';
+
+/**
+ File Name: 15.js
+ ECMA Section: 15 Native ECMAScript Objects
+ Description: Every built-in prototype object has the Object prototype
+ object, which is the value of the expression
+ Object.prototype (15.2.3.1) as the value of its internal
+ [[Prototype]] property, except the Object prototype
+ object itself.
+
+ Every native object associated with a program-created
+ function also has the Object prototype object as the
+ value of its internal [[Prototype]] property.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Native ECMAScript Objects";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+/*
+ new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+ new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ );
+ new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
+ new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
+ new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
+// new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ );
+new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ );
+new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ );
+
+new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ );
+*/
+new TestCase( SECTION, "Function.prototype.__proto__ == Object.prototype", true, Function.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Array.prototype.__proto__ == Object.prototype", true, Array.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "String.prototype.__proto__ == Object.prototype", true, String.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
+// new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase.prototype.__proto__ == Object.prototype );
+
+new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype );
+
+
+test();
+
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15-2.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15-2.js
new file mode 100644
index 0000000000..e403e46e8e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15-2.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15-2.js';
+
+/**
+ File Name: 15-2.js
+ ECMA Section: 15 Native ECMAScript Objects
+
+ Description: Every built-in function and every built-in constructor
+ has the Function prototype object, which is the value of
+ the expression Function.prototype as the value of its
+ internal [[Prototype]] property, except the Function
+ prototype object itself.
+
+ That is, the __proto__ property of builtin functions and
+ constructors should be the Function.prototype object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Native ECMAScript Objects";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ );
+new TestCase( SECTION, "String.__proto__", Function.prototype, String.__proto__ );
+new TestCase( SECTION, "Boolean.__proto__", Function.prototype, Boolean.__proto__ );
+new TestCase( SECTION, "Number.__proto__", Function.prototype, Number.__proto__ );
+new TestCase( SECTION, "Date.__proto__", Function.prototype, Date.__proto__ );
+new TestCase( SECTION, "TestCase.__proto__", Function.prototype, TestCase.__proto__ );
+
+new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
+new TestCase( SECTION, "Math.pow.__proto__", Function.prototype, Math.pow.__proto__ );
+new TestCase( SECTION, "String.prototype.indexOf.__proto__", Function.prototype, String.prototype.indexOf.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.1.2.1-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.1.2.1-1.js
new file mode 100644
index 0000000000..c3fe679e5e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.1.2.1-1.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.1.2.1-1.js';
+
+/**
+ File Name: 15.1.2.1-1.js
+ ECMA Section: 15.1.2.1 eval(x)
+
+ if x is not a string object, return x.
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.1.2.1-1";
+var VERSION = "ECMA_1";
+var TITLE = "eval(x)";
+var BUGNUMBER = "none";
+
+startTest();
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "eval.length", 1, eval.length );
+new TestCase( SECTION, "delete eval.length", false, delete eval.length );
+new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "prototype", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") );
+new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") );
+// new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
+
+// test cases where argument is not a string. should return the argument.
+
+new TestCase( SECTION, "eval()", void 0, eval() );
+new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) );
+new TestCase( SECTION, "eval(null)", null, eval( null ) );
+new TestCase( SECTION, "eval(true)", true, eval( true ) );
+new TestCase( SECTION, "eval(false)", false, eval( false ) );
+
+new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) );
+
+new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) );
+new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) );
+new TestCase( SECTION, "eval(1)", 1, eval(1) );
+new TestCase( SECTION, "eval(0)", 0, eval(0) );
+new TestCase( SECTION, "eval(-1)", -1, eval(-1) );
+new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) );
+new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) );
+new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) );
+new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) );
+new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.1.1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.1.1.js
new file mode 100644
index 0000000000..f4f821877d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.1.1.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.1.1.js';
+
+/**
+ File Name: 15.2.1.1.js
+ ECMA Section: 15.2.1.1 The Object Constructor Called as a Function:
+ Object(value)
+ Description: When Object is called as a function rather than as a
+ constructor, the following steps are taken:
+
+ 1. If value is null or undefined, create and return a
+ new object with no properties other than internal
+ properties exactly as if the object constructor
+ had been called on that same value (15.2.2.1).
+ 2. Return ToObject (value), whose rules are:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+var SECTION = "15.2.1.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object( value )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var NULL_OBJECT = Object(null);
+
+new TestCase( SECTION, "Object(null).__proto__", Object.prototype, (Object(null)).__proto__ );
+
+new TestCase( SECTION, "Object(void 0).__proto__", Object.prototype, (Object(void 0)).__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.3-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.3-1.js
new file mode 100644
index 0000000000..6d49db2481
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.3-1.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.3-1.js';
+
+/**
+ File Name: 15.2.3-1.js
+ ECMA Section: 15.2.3 Properties of the Object Constructor
+
+ Description: The value of the internal [[Prototype]] property of the
+ Object constructor is the Function prototype object.
+
+ Besides the call and construct propreties and the length
+ property, the Object constructor has properties described
+ in 15.2.3.1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.2.3";
+var VERSION = "ECMA_2";
+startTest();
+
+writeHeaderToLog( SECTION + " Properties of the Object Constructor");
+
+new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.4.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.4.js
new file mode 100644
index 0000000000..df55e0894a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.2.4.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.2.4.js';
+
+/**
+ File Name: 15.2.4.js
+ ECMA Section: 15.2.4 Properties of the Object prototype object
+
+ Description: The value of the internal [[Prototype]] property of
+ the Object prototype object is null
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.2.4";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Object.prototype object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Object.prototype.__proto__",
+ null,
+ Object.prototype.__proto__ );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-1.js
new file mode 100644
index 0000000000..169cf50851
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-1.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.1.1-1.js';
+
+/**
+ File Name: 15.3.1.1.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn, body
+ (where n might be 0, that is, there are no "p" arguments, and where body might
+ also not be provided), the following steps are taken:
+
+ 1. Create and return a new Function object exactly if the function constructor had
+ been called with the same arguments (15.3.2.1).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.1.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" );
+
+
+var myfunc = Function();
+myfunc.toString = Object.prototype.toString;
+
+// not going to test toString here since it is implementation dependent.
+// new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+
+myfunc.toString = Object.prototype.toString;
+
+new TestCase( SECTION,
+ "MyObject.__proto__ == Function.prototype",
+ true,
+ MyObject.__proto__ == Function.prototype );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-2.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-2.js
new file mode 100644
index 0000000000..42165465bc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.1.1-2.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.1.1-2.js';
+
+/**
+ File Name: 15.3.1.1-2.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+ Function(p1, p2, ..., pn, body )
+
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn,
+ body (where n might be 0, that is, there are no "p" arguments, and where body
+ might also not be provided), the following steps are taken:
+
+ 1. Create and return a new Function object exactly if the function constructor
+ had been called with the same arguments (15.3.2.1).
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.1.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var myfunc2 = Function("a, b, c", "return a+b+c" );
+var myfunc3 = Function("a,b", "c", "return a+b+c" );
+
+myfunc2.toString = Object.prototype.toString;
+myfunc3.toString = Object.prototype.toString;
+
+
+new TestCase( SECTION,
+ "myfunc2.__proto__",
+ Function.prototype,
+ myfunc2.__proto__ );
+
+new TestCase( SECTION,
+ "myfunc3.__proto__",
+ Function.prototype,
+ myfunc3.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-1.js
new file mode 100644
index 0000000000..fab359211f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-1.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.2.1-1.js';
+
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" );
+
+new TestCase( SECTION,
+ "MyObject.__proto__ == Function.prototype",
+ true,
+ MyObject.__proto__ == Function.prototype );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-2.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-2.js
new file mode 100644
index 0000000000..0b37e21028
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.2.1-2.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.2.1-2.js';
+
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var myfunc1 = new Function("a","b","c", "return a+b+c" );
+var myfunc2 = new Function("a, b, c", "return a+b+c" );
+var myfunc3 = new Function("a,b", "c", "return a+b+c" );
+
+myfunc1.toString = Object.prototype.toString;
+myfunc2.toString = Object.prototype.toString;
+myfunc3.toString = Object.prototype.toString;
+
+
+new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ );
+
+new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.3.1-1.js
new file mode 100644
index 0000000000..d4f22ff257
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.3.3.1-1.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.3.3.1-1.js';
+
+/**
+ File Name: 15.3.3.1-1.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
+
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
+
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
+
+ This test the value of Function.prototype.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.3.1-1";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Function.prototype";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Function.prototype == Function.__proto__", true, Function.__proto__ == Function.prototype );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.4.3.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.4.3.js
new file mode 100644
index 0000000000..8cbf949855
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.4.3.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.4.3.js';
+
+/**
+ File Name: 15.4.3.js
+ ECMA Section: 15.4.3 Properties of the Array Constructor
+ Description: The value of the internal [[Prototype]] property of the
+ Array constructor is the Function prototype object.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
+*/
+
+var SECTION = "15.4.3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Array Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Array.__proto__",
+ Function.prototype,
+ Array.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.3.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.3.js
new file mode 100644
index 0000000000..c25398c4f4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.3.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.3.js';
+
+/**
+ File Name: 15.5.3.1.js
+ ECMA Section: 15.5.3 Properties of the String Constructor
+
+ Description: The value of the internal [[Prototype]] property of
+ the String constructor is the Function prototype
+ object.
+
+ In addition to the internal [[Call]] and [[Construct]]
+ properties, the String constructor also has the length
+ property, as well as properties described in 15.5.3.1
+ and 15.5.3.2.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3";
+var VERSION = "ECMA_2";
+startTest();
+var passed = true;
+writeHeaderToLog( SECTION + " Properties of the String Constructor" );
+
+new TestCase( SECTION, "String.prototype", Function.prototype, String.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.2.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.2.js
new file mode 100644
index 0000000000..ebf4d03781
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.2.js
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.2.js';
+
+/**
+ File Name: 15.5.4.2.js
+ ECMA Section: 15.5.4.2 String.prototype.toString
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.5.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.tostring";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.toString.__proto__", Function.prototype, String.prototype.toString.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.4-4.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.4-4.js
new file mode 100644
index 0000000000..c2e115e0c6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.4-4.js
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.4-4.js';
+
+/**
+ File Name: 15.5.4.4-4.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ This tests assiging charAt to primitive types..
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.4-4";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "String.prototype.charAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+/*
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "n", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "u", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "u", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "n", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "d", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+*/
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "f", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "s", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(4)") );
+
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "t", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "r", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "u", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+
+new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+
+new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.5-6.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.5-6.js
new file mode 100644
index 0000000000..4eadc66c04
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.5-6.js
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.5-6.js';
+
+/**
+ File Name: 15.5.4.5-6.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.5-6";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION,
+ "var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "true",
+ eval("var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+
+new TestCase( SECTION,
+ "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "1234",
+ eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+
+new TestCase( SECTION,
+ "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "hello",
+ eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.7-3.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.7-3.js
new file mode 100644
index 0000000000..c5832fd477
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.5.4.7-3.js
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.5.4.7-3.js';
+
+/**
+ File Name: 15.5.4.7-3.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
+
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
+
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToString(searchString).
+ 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN).
+ 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)).
+ 5.Compute the number of characters in Result(1).
+ 6.Compute min(max(Result(4), 0), Result(5)).
+ 7.Compute the number of characters in the string that is Result(2).
+ 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
+
+ 1.Return Result(8).
+
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.7-3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "String.protoype.lastIndexOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )",
+ -1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )") );
+
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )") );
+
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )") );
+
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )") );
+
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )") );
+
+test();
+
+function LastIndexOf( string, search, position ) {
+ string = String( string );
+ search = String( search );
+
+ position = Number( position )
+
+ if ( isNaN( position ) ) {
+ position = Infinity;
+ } else {
+ position = ToInteger( position );
+ }
+
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
+
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
+ }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
+ }
+ }
+
+ return result8;
+}
+function ToInteger( n ) {
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
+
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor(Math.abs(n)) );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.1-5.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.1-5.js
new file mode 100644
index 0000000000..b9f35b8225
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.1-5.js
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.3.1-5.js';
+
+/**
+ File Name: 15.6.3.1-5.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var VERSION = "ECMA_2";
+startTest();
+var SECTION = "15.6.3.1-5";
+var TITLE = "Boolean.prototype"
+
+ writeHeaderToLog( SECTION + " " + TITLE );
+
+new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.js
new file mode 100644
index 0000000000..0ae48c59f2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.3.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.3.js';
+
+/**
+ File Name: 15.6.3.js
+ ECMA Section: 15.6.3 Properties of the Boolean Constructor
+
+ Description: The value of the internal prototype property is
+ the Function prototype object.
+
+ It has the internal [[Call]] and [[Construct]]
+ properties, and the length property.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+
+*/
+var SECTION = "15.6.3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Boolean Constructor"
+ writeHeaderToLog( SECTION + TITLE );
+
+
+new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype );
+new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.4-2.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.4-2.js
new file mode 100644
index 0000000000..7ca222235f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.6.4-2.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.6.4-2.js';
+
+/**
+ File Name: 15.6.4-2.js
+ ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
+
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is
+ "Boolean") whose value is false.
+
+ The value of the internal [[Prototype]] property of the Boolean prototype object
+ is the Object prototype object (15.2.3.1).
+
+ Author: christine@netscape.com
+ Date: 30 september 1997
+
+*/
+
+
+var VERSION = "ECMA_2"
+ startTest();
+var SECTION = "15.6.4-2";
+
+writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
+
+new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.7.3.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.7.3.js
new file mode 100644
index 0000000000..84e362c2db
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.7.3.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.3.js';
+
+/**
+ File Name: 15.7.3.js
+ 15.7.3 Properties of the Number Constructor
+
+ Description: The value of the internal [[Prototype]] property
+ of the Number constructor is the Function prototype
+ object. The Number constructor also has the internal
+ [[Call]] and [[Construct]] properties, and the length
+ property.
+
+ Other properties are in subsequent tests.
+
+ Author: christine@netscape.com
+ Date: 29 september 1997
+*/
+
+var SECTION = "15.7.3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Number Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase(SECTION,
+ "Number.__proto__",
+ Function.prototype,
+ Number.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.7.4.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.7.4.js
new file mode 100644
index 0000000000..733b937e55
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.7.4.js
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.7.4.js';
+
+/**
+ File Name: 15.7.4.js
+ ECMA Section: 15.7.4
+
+ Description:
+
+ The Number prototype object is itself a Number object (its [[Class]] is
+ "Number") whose value is +0.
+
+ The value of the internal [[Prototype]] property of the Number prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Number
+ prototype object, the phrase "this Number object" refers to the object
+ that is the this value for the invocation of the function; it is an error
+ if this does not refer to an object for which the value of the internal
+ [[Class]] property is "Number". Also, the phrase "this number value" refers
+ to the number value represented by this Number object, that is, the value
+ of the internal [[Value]] property of this Number object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "15.7.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Number Prototype Object";
+
+writeHeaderToLog( SECTION + " "+TITLE);
+
+new TestCase( SECTION,
+ "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()",
+ "[object Number]",
+ eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") );
+
+new TestCase( SECTION,
+ "typeof Number.prototype",
+ "object",
+ typeof Number.prototype );
+
+new TestCase( SECTION,
+ "Number.prototype.valueOf()",
+ 0,
+ Number.prototype.valueOf() );
+
+// The __proto__ property cannot be used in ECMA_1 tests.
+// new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
+// new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.8-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.8-1.js
new file mode 100644
index 0000000000..0f51cf5e61
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.8-1.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.8-1.js';
+
+/**
+ File Name: 15.8-1.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+
+var SECTION = "15.8-1";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "The Math Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.__proto__ == Object.prototype",
+ true,
+ Math.__proto__ == Object.prototype );
+
+new TestCase( SECTION,
+ "Math.__proto__",
+ Object.prototype,
+ Math.__proto__ );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/15.9.5.js b/tests/auto/qml/parserstress/tests/ecma/extensions/15.9.5.js
new file mode 100644
index 0000000000..54e6bb6f0f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/15.9.5.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '15.9.5.js';
+
+/**
+ File Name: 15.9.5.js
+ ECMA Section: 15.9.5 Properties of the Date prototype object
+ Description:
+
+ The Date prototype object is itself a Date object (its [[Class]] is
+ "Date") whose value is NaN.
+
+ The value of the internal [[Prototype]] property of the Date prototype
+ object is the Object prototype object (15.2.3.1).
+
+ In following descriptions of functions that are properties of the Date
+ prototype object, the phrase "this Date object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Date". Also, the phrase "this time value" refers
+ to the number value for the time represented by this Date object, that is,
+ the value of the internal [[Value]] property of this Date object.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.9.5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Date Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Date.prototype.__proto__ == Object.prototype",
+ true,
+ Date.prototype.__proto__ == Object.prototype );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/8.6.2.1-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/8.6.2.1-1.js
new file mode 100644
index 0000000000..a99bb01ee6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/8.6.2.1-1.js
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '8.6.2.1-1.js';
+
+/**
+ File Name: 8.6.2.1-1.js
+ ECMA Section: 8.6.2.1 Get (Value)
+ Description:
+
+ When the [[Get]] method of O is called with property name P, the following
+ steps are taken:
+
+ 1. If O doesn't have a property with name P, go to step 4.
+ 2. Get the value of the property.
+ 3. Return Result(2).
+ 4. If the [[Prototype]] of O is null, return undefined.
+ 5. Call the [[Get]] method of [[Prototype]] with property name P.
+ 6. Return Result(5).
+
+ This tests [[Get]] (Value).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "8.6.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " [[Get]] (Value)");
+
+new TestCase( SECTION, "var OBJ = new MyValuelessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyValuelessObject(true); OBJ.valueOf()") );
+// new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(true); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+new TestCase( SECTION, "var OBJ = new MyProtolessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyProtolessObject(true); OBJ.valueOf()") );
+
+new TestCase( SECTION, "var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+// new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(Number.POSITIVE_INFINITY); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+new TestCase( SECTION, "var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+
+new TestCase( SECTION, "var OBJ = new MyValuelessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyValuelessObject('string'); OBJ.valueOf()") );
+// new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject('string'); OJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+new TestCase( SECTION, "var OBJ = new MyProtolessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyProtolessObject('string'); OBJ.valueOf()") );
+
+test();
+
+function MyProtoValuelessObject(value) {
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
+}
+
+function MyProtolessObject( value ) {
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
+}
+function MyValuelessObject(value) {
+ this.__proto__ = new MyPrototypeObject(value);
+}
+function MyPrototypeObject(value) {
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/9.9-1.js b/tests/auto/qml/parserstress/tests/ecma/extensions/9.9-1.js
new file mode 100644
index 0000000000..0df44013cd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/9.9-1.js
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = '9.9-1.js';
+
+/**
+ File Name: 9.9-1.js
+ ECMA Section: 9.9 Type Conversion: ToObject
+ Description:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+ Author: christine@netscape.com
+ Date: 17 july 1997
+*/
+
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "9.9-1";
+
+writeHeaderToLog( SECTION + " Type Conversion: ToObject" );
+
+new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
+
+new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
+
+new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ );
+
+new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ );
+
+new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ );
+
+new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ );
+
+new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ );
+
+new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ );
+
+new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ );
+
+new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ );
+
+new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ );
+
+new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ );
+
+new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ );
+
+new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ );
+
+new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ );
+
+new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function ( "return this.value" );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/browser.js b/tests/auto/qml/parserstress/tests/ecma/extensions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma/extensions/shell.js b/tests/auto/qml/parserstress/tests/ecma/extensions/shell.js
new file mode 100644
index 0000000000..3f52cffbc0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/extensions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'extensions';
diff --git a/tests/auto/qml/parserstress/tests/ecma/jsref.js b/tests/auto/qml/parserstress/tests/ecma/jsref.js
new file mode 100644
index 0000000000..1416643e1e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/jsref.js
@@ -0,0 +1,634 @@
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+TITLE = "";
+
+/*
+ * constant strings
+ */
+var GLOBAL = "[object global]";
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+var DEBUG = false;
+
+TZ_DIFF = -8;
+
+var TT = "";
+var TT_ = "";
+var BR = "";
+var NBSP = " ";
+var CR = "\n";
+var FONT = "";
+var FONT_ = "";
+var FONT_RED = "";
+var FONT_GREEN = "";
+var B = "";
+var B_ = ""
+var H2 = "";
+var H2_ = "";
+var HR = "";
+var DEBUG = false;
+
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+/* wrapper for test cas constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ print( "added " + this.description );
+ }
+
+ testcases[tc++] = this;
+}
+
+/*
+ * Set up test environment.
+ *
+ */
+function startTest() {
+ if ( version ) {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ }
+
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ print ("BUGNUMBER: " + BUGNUMBER );
+ }
+
+ testcases = new Array();
+ tc = 0;
+}
+
+
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ print( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+
+function writeHeaderToLog( string ) {
+ print( H2 + string + H2_ );
+}
+function stopTest()
+{
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+ print( HR );
+ gc();
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+
+/**
+ * Type Conversion functions used by Type Conversion
+ *
+ */
+
+
+
+ /*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
+}
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
+ return ( DaysInYear(y) * msPerDay );
+}
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
+}
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
+}
+function YearNumber( t ) {
+}
+function TimeFromYear( y ) {
+ return ( msPerDay * DayFromYear(y) );
+}
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
+}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+t+") case not covered";
+ }
+}
+function YearFromTime( t ) {
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
+}
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
+}
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
+}
+function DateFromTime( t ) {
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
+}
+
+// missing daylight savins time adjustment
+
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
+}
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
+}
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+function DaylightSavingTA( t ) {
+ t = t - LocalTZA();
+
+ var dst_start = GetFirstSundayInApril(t) + 2*msPerHour;
+ var dst_end = GetLastSundayInOctober(t)+ 2*msPerHour;
+
+ if ( t >= dst_start && t < dst_end ) {
+ return msPerHour;
+ } else {
+ return 0;
+ }
+
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
+ // PST. Other time zones will need to override this function.
+
+ print( new Date( UTC(dst_start + LocalTZA())) );
+
+ return UTC(dst_start + LocalTZA());
+}
+function GetFirstSundayInApril( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
+
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+function GetLastSundayInOctober( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
+ oct += TimeInMonth(m, leap);
+ }
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
+}
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
+
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
+
+ return ( (Day(t)) + date - 1 );
+}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
+
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
+
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ||
+ day == Number.NaN ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
+}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
+
+ return ( ToInteger( t ) );
+}
+function ToInteger( t ) {
+ t = Number( t );
+
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+function Enumerate ( o ) {
+ var properties = new Array();
+ for ( p in o ) {
+ properties[ properties.length ] = new Array( p, o[p] );
+ }
+ return properties;
+}
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma/shell.js b/tests/auto/qml/parserstress/tests/ecma/shell.js
new file mode 100644
index 0000000000..1c012601e6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/shell.js
@@ -0,0 +1,577 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestsuite = 'ecma';
+
+/*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC
+var TZ_ADJUST = TZ_DIFF * msPerHour;
+var TZ_PST = -8; // offset of Pacific Standard Time from UTC
+var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST
+var PST_ADJUST = TZ_PST * msPerHour;
+var TIME_0000 = (function ()
+ { // calculate time for year 0
+ for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+ }
+ return time;
+ })();
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+var now = new Date();
+var TIME_NOW = now.valueOf(); //valueOf() is to accurate to the millisecond
+ //Date.parse() is accurate only to the second
+
+/*
+ * Originally, the test suite used a hard-coded value TZ_DIFF = -8.
+ * But that was only valid for testers in the Pacific Standard Time Zone!
+ * We calculate the proper number dynamically for any tester. We just
+ * have to be careful not to use a date subject to Daylight Savings Time...
+ */
+function getTimeZoneDiff()
+{
+ return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
+}
+
+/*
+ * Date test "ResultArrays" are hard-coded for Pacific Standard Time.
+ * We must adjust them for the tester's own timezone -
+ */
+function adjustResultArray(ResultArray, msMode)
+{
+ // If the tester's system clock is in PST, no need to continue -
+// if (!PST_DIFF) {return;}
+
+ /* The date gTestcases instantiate Date objects in two different ways:
+ *
+ * millisecond mode: e.g. dt = new Date(10000000);
+ * year-month-day mode: dt = new Date(2000, 5, 1, ...);
+ *
+ * In the first case, the date is measured from Time 0 in Greenwich (i.e. UTC).
+ * In the second case, it is measured with reference to the tester's local timezone.
+ *
+ * In the first case we must correct those values expected for local measurements,
+ * like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc.
+ *
+ * In the second case, it is exactly the other way around -
+ */
+ if (msMode)
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a UTC date.
+ // Shift to the right by the offset between UTC and the tester.
+ var t = ResultArray[TIME] + TZ_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the local hour, day, etc.
+ ResultArray[HOURS] = HourFromTime(t);
+ ResultArray[DAY] = WeekDay(t);
+ ResultArray[DATE] = DateFromTime(t);
+ ResultArray[MONTH] = MonthFromTime(t);
+ ResultArray[YEAR] = YearFromTime(t);
+ }
+ else
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a PST date.
+ // Shift to the left by the offset between PST and the tester.
+ var t = ResultArray[TIME] - PST_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the UTC hour, day, etc.
+ ResultArray[TIME] = t;
+ ResultArray[UTC_HOURS] = HourFromTime(t);
+ ResultArray[UTC_DAY] = WeekDay(t);
+ ResultArray[UTC_DATE] = DateFromTime(t);
+ ResultArray[UTC_MONTH] = MonthFromTime(t);
+ ResultArray[UTC_YEAR] = YearFromTime(t);
+ }
+}
+
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
+}
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
+ return ( DaysInYear(y) * msPerDay );
+}
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
+}
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
+}
+function YearNumber( t ) {
+}
+function TimeFromYear( y ) {
+ return ( msPerDay * DayFromYear(y) );
+}
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
+}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+ t + ") case not covered";
+ }
+}
+function YearFromTime( t ) {
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
+}
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
+}
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
+}
+function DateFromTime( t ) {
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
+}
+
+// missing daylight savings time adjustment
+
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
+}
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
+}
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+function DaylightSavingTA( t ) {
+ t = t - LocalTZA();
+
+ var dst_start = GetDSTStart(t);
+ var dst_end = GetDSTEnd(t);
+
+ if ( t >= dst_start && t < dst_end )
+ return msPerHour;
+
+ return 0;
+}
+
+function GetFirstSundayInMonth( t, m ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+// month m 0..11
+// april == 3
+// march == 2
+
+ // set time to first day of month m
+ var time = TimeFromYear(year);
+ for (var i = 0; i < m; ++i)
+ {
+ time += TimeInMonth(i, leap);
+ }
+
+ for ( var first_sunday = time; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+
+function GetLastSundayInMonth( t, m ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+// month m 0..11
+// april == 3
+// march == 2
+
+ // first day of following month
+ var time = TimeFromYear(year);
+ for (var i = 0; i <= m; ++i)
+ {
+ time += TimeInMonth(i, leap);
+ }
+ // prev day == last day of month
+ time -= msPerDay;
+
+ for ( var last_sunday = time; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+
+/*
+ 15.9.1.9 Daylight Saving Time Adjustment
+
+ The implementation of ECMAScript should not try to determine whether
+ the exact time was subject to daylight saving time, but just whether
+ daylight saving time would have been in effect if the current
+ daylight saving time algorithm had been used at the time. This avoids
+ complications such as taking into account the years that the locale
+ observed daylight saving time year round.
+*/
+
+/*
+ US DST algorithm
+
+ Before 2007, DST starts first Sunday in April at 2 AM and ends last
+ Sunday in October at 2 AM
+
+ Starting in 2007, DST starts second Sunday in March at 2 AM and ends
+ first Sunday in November at 2 AM
+
+ Note that different operating systems behave differently.
+
+ Fully patched Windows XP uses the 2007 algorithm for all dates while
+ fully patched Fedora Core 6 and RHEL 4 Linux use the algorithm in
+ effect at the time.
+
+ Since pre-2007 DST is a subset of 2007 DST rules, this only affects
+ tests that occur in the period Mar-Apr and Oct-Nov where the two
+ algorithms do not agree.
+
+*/
+
+function GetDSTStart( t )
+{
+ return (GetFirstSundayInMonth(t, 2) + 7*msPerDay + 2*msPerHour - LocalTZA());
+}
+
+function GetDSTEnd( t )
+{
+ return (GetFirstSundayInMonth(t, 10) + 2*msPerHour - LocalTZA());
+}
+
+function GetOldDSTStart( t )
+{
+ return (GetFirstSundayInMonth(t, 3) + 2*msPerHour - LocalTZA());
+}
+
+function GetOldDSTEnd( t )
+{
+ return (GetLastSundayInMonth(t, 9) + 2*msPerHour - LocalTZA());
+}
+
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
+}
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
+
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
+
+ return ( (Day(t)) + date - 1 );
+}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
+
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
+
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.NEGATIVE_INFINITY ) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
+}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
+
+ return ( ToInteger( t ) );
+}
+function ToInteger( t ) {
+ t = Number( t );
+
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+function Enumerate ( o ) {
+ var p;
+ for ( p in o ) {
+ print( p +": " + o[p] );
+ }
+}
+
+/* these functions are useful for running tests manually in Rhino */
+
+function GetContext() {
+ return Packages.com.netscape.javascript.Context.getCurrentContext();
+}
+function OptLevel( i ) {
+ i = Number(i);
+ var cx = GetContext();
+ cx.setOptimizationLevel(i);
+}
+/* end of Rhino functions */
+
diff --git a/tests/auto/qml/parserstress/tests/ecma/template.js b/tests/auto/qml/parserstress/tests/ecma/template.js
new file mode 100644
index 0000000000..8f11686890
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma/template.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'template.js';
+
+/**
+ * File Name: template.js
+ * Reference: ** replace with bugzilla URL or document reference **
+ * Description: ** replace with description of test **
+ * Author: ** replace with your e-mail address **
+ */
+
+var SECTION = ""; // provide a document reference (ie, ECMA section)
+var VERSION = "ECMA"; // Version of JavaScript or ECMA
+var TITLE = ""; // Provide ECMA section title or a description
+var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report
+
+startTest(); // leave this alone
+
+/*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * AddTestCase("** description",
+ * "** expected value",
+ * "** actual value");
+ */
+
+// leave this alone. this executes the test cases and
+// displays results.
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-001.js
new file mode 100644
index 0000000000..7462df2f98
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-001.js
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'boolean-001.js';
+
+/**
+ File Name: boolean-001.js
+ Description: Corresponds to ecma/Boolean/15.6.4.2-4-n.js
+
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: june 27, 1997
+*/
+var SECTION = "boolean-001.js";
+var VERSION = "JS1_4";
+var TITLE = "Boolean.prototype.toString()";
+startTest();
+writeHeaderToLog( SECTION +" "+ TITLE );
+
+var exception = "No exception thrown";
+var result = "Failed";
+
+var TO_STRING = Boolean.prototype.toString;
+
+try {
+ var s = new String("Not a Boolean");
+ s.toString = TO_STRING;
+ s.toString();
+} catch ( e ) {
+ result = "Passed!";
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "Assigning Boolean.prototype.toString to a String object "+
+ "(threw " +exception +")",
+ "Passed!",
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-002.js
new file mode 100644
index 0000000000..813e11cd39
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/boolean-002.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'boolean-002.js';
+
+/**
+ File Name: boolean-001.js
+ Description: Corresponds to ecma/Boolean/15.6.4.3-4-n.js
+
+ 15.6.4.3 Boolean.prototype.valueOf()
+ Returns this boolean value.
+
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+var SECTION = "boolean-002.js";
+var VERSION = "JS1_4";
+var TITLE = "Boolean.prototype.valueOf()";
+startTest();
+writeHeaderToLog( SECTION +" "+ TITLE );
+
+
+var exception = "No exception thrown";
+var result = "Failed";
+
+var VALUE_OF = Boolean.prototype.valueOf;
+
+try {
+ var s = new String("Not a Boolean");
+ s.valueOf = VALUE_0F;
+ s.valueOf();
+} catch ( e ) {
+ result = "Passed!";
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "Assigning Boolean.prototype.valueOf to a String object "+
+ "(threw " +exception +")",
+ "Passed!",
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-001.js
new file mode 100644
index 0000000000..041bbb523c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-001.js
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'date-001.js';
+
+/**
+ File Name: date-001.js
+ Corresponds To: 15.9.5.2-2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+
+ This verifies that calling toString on an object that is not a string
+ generates a runtime error.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "date-001";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.toString";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var OBJ = new MyObject( new Date(0) );
+ result = OBJ.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "OBJECT = new MyObject( new Date(0)) ; result = OBJ.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = Date.prototype.toString;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-002.js
new file mode 100644
index 0000000000..4fb11b38d9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-002.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'date-002.js';
+
+/**
+ File Name: date-002.js
+ Corresponds To: 15.9.5.23-3-n.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
+
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "date-002";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.setTime()";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var MYDATE = new MyDate();
+ result = MYDATE.setTime(0);
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "MYDATE = new MyDate(); MYDATE.setTime(0)" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyDate(value) {
+ this.value = value;
+ this.setTime = Date.prototype.setTime;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-003.js
new file mode 100644
index 0000000000..95129177c7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-003.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'date-003.js';
+
+/**
+ File Name: date-003.js
+ Corresponds To 15.9.5.3-1.js
+ ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
+ Description:
+
+ The valueOf function returns a number, which is this time value.
+
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "date-003";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.valueOf";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var OBJ = new MyObject( new Date(0) );
+ result = OBJ.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "OBJ = new MyObject( new Date(0)); OBJ.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+// The following line causes an infinte loop
+// this.toString = new Function( "return this+\"\";");
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-004.js
new file mode 100644
index 0000000000..d77bd1c272
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/date-004.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'date-004.js';
+
+/**
+ File Name: date-004.js
+ Corresponds To: 15.9.5.4-2-n.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "date-004";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.getTime";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var MYDATE = new MyDate();
+ result = MYDATE.getTime();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "MYDATE = new MyDate(); MYDATE.getTime()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyDate( value ) {
+ this.value = value;
+ this.getTime = Date.prototype.getTime;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-001.js
new file mode 100644
index 0000000000..3762c5b3c4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-001.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-001.js';
+
+/**
+ * File Name: exception-001
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Call error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-001";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: CallError";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+Call_1();
+
+test();
+
+function Call_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ Math();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "Math() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-002.js
new file mode 100644
index 0000000000..e5328b8b81
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-002.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-002.js';
+
+/**
+ * File Name: exception-002
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Construct error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-002";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: ConstructError";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+Construct_1();
+
+test();
+
+function Construct_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = new Math();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "new Math() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-003.js
new file mode 100644
index 0000000000..c5956ffc95
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-003.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-003.js';
+
+/**
+ * File Name: exception-003
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Target error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-003";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: TargetError";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+Target_1();
+
+test();
+
+function Target_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ string = new String("hi");
+ string.toString = Boolean.prototype.toString;
+ string.toString();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "string = new String(\"hi\");"+
+ "string.toString = Boolean.prototype.toString" +
+ "string.toString() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-004.js
new file mode 100644
index 0000000000..15a07a806f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-004.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-004.js';
+
+/**
+ * File Name: exception-004
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * ToObject error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-004";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+ToObject_1();
+
+test();
+
+function ToObject_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = foo["bar"];
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "foo[\"bar\"] [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-005.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-005.js
new file mode 100644
index 0000000000..e5532ff40c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-005.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-005.js';
+
+/**
+ * File Name: exception-005
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * ToObject error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-005";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+ToObject_1();
+
+test();
+
+function ToObject_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = foo["bar"];
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "foo[\"bar\"] [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-006.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-006.js
new file mode 100644
index 0000000000..b37b52becb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-006.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-006.js';
+
+/**
+ * File Name: exception-006
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * ToPrimitive error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-006";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+ToPrimitive_1();
+
+test();
+
+
+/**
+ * Getting the [[DefaultValue]] of any instances of MyObject
+ * should result in a runtime error in ToPrimitive.
+ */
+
+function MyObject() {
+ this.toString = void 0;
+ this.valueOf = void 0;
+}
+
+function ToPrimitive_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = new MyObject() + new MyObject();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "new MyObject() + new MyObject() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-007.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-007.js
new file mode 100644
index 0000000000..a63ed0e3f8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-007.js
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-007.js';
+
+/**
+ * File Name: exception-007
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * DefaultValue error.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-007";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
+var BUGNUMBER="318250";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DefaultValue_1();
+
+test();
+
+
+/**
+ * Getting the [[DefaultValue]] of any instances of MyObject
+ * should result in a runtime error in ToPrimitive.
+ */
+
+function MyObject() {
+ this.toString = void 0;
+ this.valueOf = new Object();
+}
+
+function DefaultValue_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = new MyObject() + new MyObject();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "new MyObject() + new MyObject() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-008.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-008.js
new file mode 100644
index 0000000000..39326183a4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-008.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-008.js';
+
+/**
+ * File Name: exception-008
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * SyntaxError.
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-008";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+Syntax_1();
+
+test();
+
+function Syntax_1() {
+ result = "failed: no exception thrown";
+ exception = null;
+
+ try {
+ result = eval("continue;");
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "eval(\"continue\") [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-009.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-009.js
new file mode 100644
index 0000000000..bd5cbe7f40
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-009.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-009.js';
+
+/**
+ * File Name: exception-009
+ * ECMA Section:
+ * Description: Tests for JavaScript Standard Exceptions
+ *
+ * Regression test for nested try blocks.
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312964
+ *
+ * Author: christine@netscape.com
+ * Date: 31 August 1998
+ */
+var SECTION = "exception-009";
+var VERSION = "JS1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
+var BUGNUMBER= "312964";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+try {
+ expect = "passed: no exception thrown";
+ result = expect;
+ Nested_1();
+} catch ( e ) {
+ result = "failed: threw " + e;
+} finally {
+ new TestCase(
+ SECTION,
+ "nested try",
+ expect,
+ result );
+}
+
+
+test();
+
+function Nested_1() {
+ try {
+ try {
+ } catch (a) {
+ } finally {
+ }
+ } catch (b) {
+ } finally {
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-010-n.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-010-n.js
new file mode 100644
index 0000000000..cb28d635a6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-010-n.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-010-n.js';
+
+var SECTION = "exception-010";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Don't Crash throwing null";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+print("Null throw test.");
+print("BUGNUMBER: 21799");
+
+DESCRIPTION = "throw null";
+EXPECTED = "error";
+
+new TestCase( SECTION, "throw null", "error", eval("throw null" ));
+
+test();
+
+print("FAILED!: Should have exited with uncaught exception.");
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-011-n.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-011-n.js
new file mode 100644
index 0000000000..ec5302c247
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/exception-011-n.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exception-011-n.js';
+
+var SECTION = "exception-011";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Don't Crash throwing undefined";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+print("Undefined throw test.");
+
+DESCRIPTION = "throw undefined";
+EXPECTED = "error";
+
+new TestCase( SECTION, "throw undefined", "error", eval("throw (void 0)") );
+
+test();
+
+print("FAILED!: Should have exited with uncaught exception.");
+
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-001.js
new file mode 100644
index 0000000000..c3ae4f21e6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-001.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-001.js';
+
+/**
+ File Name: expression-001.js
+ Corresponds to: ecma/Expressions/11.12-2-n.js
+ ECMA Section: 11.12
+ Description:
+
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+var SECTION = "expression-001";
+var VERSION = "JS1_4";
+var TITLE = "Conditional operator ( ? : )"
+ startTest();
+writeHeaderToLog( SECTION + " " + TITLE );
+
+// the following expression should be an error in JS.
+
+var result = "Failed"
+ var exception = "No exception was thrown";
+
+try {
+ eval("var MY_VAR = true ? \"EXPR1\", \"EXPR2\" : \"EXPR3\"");
+} catch ( e ) {
+ result = "Passed";
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "comma expression in a conditional statement "+
+ "(threw "+ exception +")",
+ "Passed",
+ result );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-002.js
new file mode 100644
index 0000000000..2f060936ae
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-002.js
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-002.js';
+
+/**
+ File Name: expressions-002.js
+ Corresponds to: ecma/Expressions/11.2.1-3-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Try to access properties of an object whose value is undefined.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+var SECTION = "expressions-002.js";
+var VERSION = "JS1_4";
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+
+startTest();
+
+// go through all Native Function objects, methods, and properties and get their typeof.
+
+var PROPERTY = new Array();
+var p = 0;
+
+// try to access properties of primitive types
+
+OBJECT = new Property( "undefined", void 0, "undefined", NaN );
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = OBJECT.value.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+
+new TestCase(
+ SECTION,
+ "Get the value of an object whose value is undefined "+
+ "(threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.valueOf = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-003.js
new file mode 100644
index 0000000000..5007b83adf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-003.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-003.js';
+
+/**
+ File Name: expressions-003.js
+ Corresponds to: ecma/Expressions/11.2.1-3-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Try to access properties of an object whose value is undefined.
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+var SECTION = "expressions-003.js";
+var VERSION = "JS1_4";
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+
+startTest();
+
+// try to access properties of primitive types
+
+OBJECT = new Property( "undefined", void 0, "undefined", NaN );
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = OBJECT.value.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+
+new TestCase(
+ SECTION,
+ "Get the toString value of an object whose value is undefined "+
+ "(threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-004.js
new file mode 100644
index 0000000000..2befdd10f3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-004.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-004.js';
+
+/**
+ File Name: expression-004.js
+ Corresponds To: 11.2.1-4-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
+
+ Author: christine@netscape.com
+ Date: 09 september 1998
+*/
+var SECTION = "expression-004";
+var VERSION = "JS1_4";
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+startTest();
+
+var OBJECT = new Property( "null", null, "null", 0 );
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = OBJECT.value.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "Get the toString value of an object whose value is null "+
+ "(threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function Property( object, value, string, number ) {
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-005.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-005.js
new file mode 100644
index 0000000000..2d76593ea2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-005.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-005.js';
+
+/**
+ File Name: expression-005.js
+ Corresponds To: 11.2.2-10-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "expression-005";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var expect = "Passed";
+var exception = "No exception thrown";
+
+try {
+ result = new Math();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "result= new Math() (threw " + exception + ")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-006.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-006.js
new file mode 100644
index 0000000000..eb21e0308c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-006.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-006.js';
+
+/**
+ File Name: expression-006.js
+ Corresponds to: 11.2.2-1-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ http://scopus/bugsplat/show_bug.cgi?id=327765
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-006.js";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER="327765";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var OBJECT = new Object();
+ result = new OBJECT();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; result = new OBJECT()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-007.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-007.js
new file mode 100644
index 0000000000..a2305be16d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-007.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-007.js';
+
+/**
+ File Name: expression-007.js
+ Corresponds To: 11.2.2-2-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-007";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ UNDEFINED = void 0;
+ result = new UNDEFINED();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "UNDEFINED = void 0; result = new UNDEFINED()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-008.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-008.js
new file mode 100644
index 0000000000..c85310f957
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-008.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-008.js';
+
+/**
+ File Name: expression-008
+ Corresponds To: 11.2.2-3-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-008";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var NULL = null;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = new NULL();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "NULL = null; result = new NULL()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-009.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-009.js
new file mode 100644
index 0000000000..feec2cd052
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-009.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-009.js';
+
+/**
+ File Name: expression-009
+ Corresponds to: ecma/Expressions/11.2.2-4-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-009";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var STRING = "";
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = new STRING();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "STRING = ''; result = new STRING()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-010.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-010.js
new file mode 100644
index 0000000000..e0b38a4838
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-010.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-010.js';
+
+/**
+ File Name: expression-010.js
+ Corresponds To: 11.2.2-5-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-010";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var NUMBER = 0;
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = new NUMBER();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "NUMBER=0, result = new NUMBER()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-011.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-011.js
new file mode 100644
index 0000000000..75f872480d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-011.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-011.js';
+
+/**
+ File Name: expression-011.js
+ Corresponds To: ecma/Expressions/11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-011";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var BOOLEAN = true;
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var OBJECT = new BOOLEAN();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "BOOLEAN = true; result = new BOOLEAN()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-012.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-012.js
new file mode 100644
index 0000000000..5223abd480
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-012.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-012.js';
+
+/**
+ File Name: expression-012.js
+ Corresponds To: ecma/Expressions/11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ http://scopus/bugsplat/show_bug.cgi?id=327765
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-012";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var STRING = new String("hi");
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = new STRING();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "STRING = new String(\"hi\"); result = new STRING()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-013.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-013.js
new file mode 100644
index 0000000000..10ad726653
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-013.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-013.js';
+
+/**
+ File Name: expression-013.js
+ Corresponds To: ecma/Expressions/11.2.2-8-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-013";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var NUMBER = new Number(1);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = new NUMBER();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "NUMBER = new Number(1); result = new NUMBER()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-014.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-014.js
new file mode 100644
index 0000000000..fadca81c7a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-014.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-014.js';
+
+/**
+ File Name: expression-014.js
+ Corresponds To: ecma/Expressions/11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-014.js";
+var VERSION = "ECMA_1";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var BOOLEAN = new Boolean();
+
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = new BOOLEAN();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "BOOLEAN = new Boolean(); result = new BOOLEAN()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-015.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-015.js
new file mode 100644
index 0000000000..2bd2b8d094
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-015.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-015.js';
+
+/**
+ File Name: expression-015.js
+ Corresponds To: ecma/Expressions/11.2.3-2-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-015";
+var VERSION = "JS1_4";
+var TITLE = "Function Calls";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("result = 3.valueOf();");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "3.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-016.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-016.js
new file mode 100644
index 0000000000..3c91495f3c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-016.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-016.js';
+
+/**
+ File Name: expression-016.js
+ Corresponds To: ecma/Expressions/11.2.3-3-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-016";
+var VERSION = "JS1_4";
+var TITLE = "Function Calls";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = (void 0).valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "(void 0).valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-017.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-017.js
new file mode 100644
index 0000000000..4e762a54a9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-017.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-017.js';
+
+/**
+ File Name: expression-07.js
+ Corresponds To: ecma/Expressions/11.2.3-4-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-017";
+var VERSION = "JS1_4";
+var TITLE = "Function Calls";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = nullvalueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "null.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-019.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-019.js
new file mode 100644
index 0000000000..11ee3a0063
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/expression-019.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'expression-019.js';
+
+/**
+ File Name: expression-019.js
+ Corresponds To: 11.2.2-7-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "expression-019";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var STRING = new String("hi");
+ result = new STRING();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var STRING = new String(\"hi\"); result = new STRING();" +
+ " (threw " + exception + ")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/function-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/function-001.js
new file mode 100644
index 0000000000..d5f7b452e2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/function-001.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'function-001.js';
+
+/**
+ * File Name: boolean-001.js
+ * Description:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232
+ *
+ * eval("function f(){}function g(){}") at top level is an error for JS1.2
+ * and above (missing ; between named function expressions), but declares f
+ * and g as functions below 1.2.
+ *
+ * Fails to produce error regardless of version:
+ * js> version(100)
+ * 120
+ * js> eval("function f(){}function g(){}")
+ * js> version(120);
+ * 100
+ * js> eval("function f(){}function g(){}")
+ * js>
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "function-001.js";
+var VERSION = "JS_12";
+var TITLE = "functions not separated by semicolons are errors in version 120 and higher";
+var BUGNUMBER="10278";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "pass";
+var exception = "no exception thrown";
+
+try {
+ eval("function f(){}function g(){}");
+} catch ( e ) {
+ result = "fail";
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "eval(\"function f(){}function g(){}\") (threw "+exception,
+ "pass",
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-001.js
new file mode 100644
index 0000000000..a186a51e64
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-001.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'global-001.js';
+
+/**
+ File Name: global-001
+ Corresponds To: ecma/GlobalObject/15.1-1-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "global-001";
+var VERSION = "ECMA_1";
+var TITLE = "The Global Object";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = new this();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "result = new this()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-002.js
new file mode 100644
index 0000000000..c4ef143529
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/global-002.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'global-002.js';
+
+/**
+ File Name: global-002
+ Corresponds To: ecma/GlobalObject/15.1-2-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "global-002";
+var VERSION = "JS1_4";
+var TITLE = "The Global Object";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = this();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "result = this()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-001.js
new file mode 100644
index 0000000000..cc2e3a46aa
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-001.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-001.js';
+
+/**
+ File Name: lexical-001.js
+ CorrespondsTo: ecma/LexicalConventions/7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "lexical-001";
+var VERSION = "JS1_4";
+var TITLE = "Line Terminators";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = eval("\r\n\expect");
+} catch ( e ) {
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; result = new OBJECT()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-002.js
new file mode 100644
index 0000000000..f7f691a049
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-002.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-002.js';
+
+/**
+ File Name: lexical-002.js
+ Corresponds To: ecma/LexicalConventions/7.2-3-n.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
+
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed <LF> \n
+ \u000D carriage return <CR> \r
+
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "lexical-002";
+var VERSION = "JS1_4";
+var TITLE = "Line Terminators";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ result = eval("\r\n\expect");
+} catch ( e ) {
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "result=eval(\"\r\nexpect\")" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-003.js
new file mode 100644
index 0000000000..482382eeed
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-003.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-003.js';
+
+/**
+ File Name: lexical-003.js
+ Corresponds To: 7.3-13-n.js
+ ECMA Section: 7.3 Comments
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-003.js";
+var VERSION = "JS1_4";
+var TITLE = "Comments";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("/*\n/* nested comment */\n*/\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "/*/*nested comment*/ */" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-004.js
new file mode 100644
index 0000000000..ccf6124109
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-004.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-004.js';
+
+/**
+ File Name: lexical-004.js
+ Corresponds To: ecma/LexicalExpressions/7.4.1-1-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-004";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var null = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var null = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-005.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-005.js
new file mode 100644
index 0000000000..44b2ea9c87
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-005.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-005.js';
+
+/**
+ File Name: lexical-005.js
+ Corresponds To: 7.4.1-2.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-005";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("true = false;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "true = false" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-006.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-006.js
new file mode 100644
index 0000000000..6f693d8ad2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-006.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-006.js';
+
+/**
+ File Name: lexical-006.js
+ Corresponds To: 7.4.2-1.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-006";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("break = new Object();");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "break = new Object()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-007.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-007.js
new file mode 100644
index 0000000000..b6d5152ea0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-007.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-007.js';
+
+/**
+ File Name: lexical-005.js
+ Corresponds To: 7.4.1-3-n.js
+ ECMA Section: 7.4.1
+
+ Description:
+
+ Reserved words cannot be used as identifiers.
+
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-005";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("false = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "false = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-008.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-008.js
new file mode 100644
index 0000000000..eed455c243
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-008.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-008.js';
+
+/**
+ File Name: lexical-008.js
+ Corresponds To: 7.4.3-1-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-008.js";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("case = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "case = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-009.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-009.js
new file mode 100644
index 0000000000..d796574809
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-009.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-009.js';
+
+/**
+ File Name: lexical-009
+ Corresponds To: 7.4.3-2-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-009";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("debugger = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "debugger = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-010.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-010.js
new file mode 100644
index 0000000000..059b5a06be
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-010.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-010.js';
+
+/**
+ File Name: lexical-010.js
+ Corresponds To: 7.4.3-3-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-010";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("export = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "export = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-011.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-011.js
new file mode 100644
index 0000000000..7f01041c41
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-011.js
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-011.js';
+
+/**
+ File Name: lexical-011.js
+ Corresponds To: 7.4.3-4-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-011";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+print("This test requires option javascript.options.strict enabled");
+
+if (!options().match(/strict/))
+{
+ options('strict');
+}
+if (!options().match(/werror/))
+{
+ options('werror');
+}
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("super = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "super = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-012.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-012.js
new file mode 100644
index 0000000000..e55b6eb30f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-012.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-012.js';
+
+/**
+ File Name: lexical-012.js
+ Corresponds To: 7.4.3-5-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-012";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("catch = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "catch = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-013.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-013.js
new file mode 100644
index 0000000000..fbbf20b263
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-013.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-013.js';
+
+/**
+ File Name: lexical-013.js
+ Corresponds To: 7.4.3-6-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-013";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("default = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "default = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-014.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-014.js
new file mode 100644
index 0000000000..880d2800e5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-014.js
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-014.js';
+
+/**
+ File Name: lexical-014.js
+ Corresponds To: 7.4.3-7-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-014.js";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+print("This test requires option javascript.options.strict enabled");
+
+if (!options().match(/strict/))
+{
+ options('strict');
+}
+if (!options().match(/werror/))
+{
+ options('werror');
+}
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("extends = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "extends = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-015.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-015.js
new file mode 100644
index 0000000000..a15a2be544
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-015.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-015.js';
+
+/**
+ File Name: lexical-015.js
+ Corresponds To: 7.4.3-8-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-015";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("switch = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "switch = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-016.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-016.js
new file mode 100644
index 0000000000..021594d052
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-016.js
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-016.js';
+
+/**
+ File Name: lexical-016
+ Corresponds To: 7.4.3-9-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-016";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+print("This test requires option javascript.options.strict enabled");
+
+if (!options().match(/strict/))
+{
+ options('strict');
+}
+if (!options().match(/werror/))
+{
+ options('werror');
+}
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("class = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "class = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-017.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-017.js
new file mode 100644
index 0000000000..b89a526229
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-017.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-017.js';
+
+/**
+ File Name: lexical-017.js
+ Corresponds To: 7.4.3-10-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-017";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("do = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "do = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-018.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-018.js
new file mode 100644
index 0000000000..18773dafe6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-018.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-018.js';
+
+/**
+ File Name: lexical-018
+ Corresponds To: 7.4.3-11-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-018";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("finally = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "finally = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-019.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-019.js
new file mode 100644
index 0000000000..c1c34a93c1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-019.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-019.js';
+
+/**
+ File Name: lexical-019.js
+ Corresponds To: 7.4.3-12-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-019";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("throw = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "throw = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-020.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-020.js
new file mode 100644
index 0000000000..e82e1e50b9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-020.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-020.js';
+
+/**
+ File Name: lexical-020.js
+ Corresponds To 7.4.3-13-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-020";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("const = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "const = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-021.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-021.js
new file mode 100644
index 0000000000..47a0725a09
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-021.js
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-021.js';
+
+/**
+ File Name: lexical-021.js
+ Corresponds To: 7.4.3-14-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-021.js";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+print("This test requires option javascript.options.strict enabled");
+
+if (!options().match(/strict/))
+{
+ options('strict');
+}
+if (!options().match(/werror/))
+{
+ options('werror');
+}
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("enum = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "enum = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-022.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-022.js
new file mode 100644
index 0000000000..75d72aa5b6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-022.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-022.js';
+
+/**
+ File Name: lexical-022
+ Corresponds To 7.4.3-15-n.js
+ ECMA Section: 7.4.3
+
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-022.js";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("import = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "import = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-023.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-023.js
new file mode 100644
index 0000000000..aa89c04782
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-023.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-023.js';
+
+/**
+ File Name: lexical-023.js
+ Corresponds To: 7.4.3-16-n.js
+ ECMA Section: 7.4.3
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
+
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "lexical-023.js";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("try = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "try = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-024.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-024.js
new file mode 100644
index 0000000000..7c1f22f745
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-024.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-024.js';
+
+/**
+ File Name: lexical-024
+ Corresponds To: 7.4.2-1-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-024";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var break;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var break" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-025.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-025.js
new file mode 100644
index 0000000000..f1c7b93daf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-025.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-025.js';
+
+/**
+ File Name: lexical-025.js
+ Corresponds To 7.4.2-2-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-025";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var for;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var for" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-026.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-026.js
new file mode 100644
index 0000000000..31b5aaaf61
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-026.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-026.js';
+
+/**
+ File Name: lexical-026.js
+ Corresponds To: 7.4.2-3-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-026";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var new;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var new" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-027.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-027.js
new file mode 100644
index 0000000000..573025b591
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-027.js
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-027.js';
+
+/**
+ File Name: lexical-027.js
+ Corresponds To: 7.4.2-4-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ var
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-027";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var var;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var var" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-028.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-028.js
new file mode 100644
index 0000000000..1b76a22169
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-028.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-028.js';
+
+/**
+ File Name: lexical-028.js
+ Corresponds To: 7.4.2-5-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-028";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var continue=true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var continue=true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-029.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-029.js
new file mode 100644
index 0000000000..f978b8ef89
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-029.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-029.js';
+
+/**
+ File Name: lexical-029.js
+ Corresponds To: 7.4.2-6.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-029";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var function = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var function = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-030.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-030.js
new file mode 100644
index 0000000000..3796551698
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-030.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-030.js';
+
+/**
+ File Name: lexical-030.js
+ Corresponds To: 7.4.2-7-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-030";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var return = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var return = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-031.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-031.js
new file mode 100644
index 0000000000..13379fed01
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-031.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-031.js';
+
+/**
+ File Name: lexical-031.js
+ Corresponds To: 7.4.2-8-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-031";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var return;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var return" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-032.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-032.js
new file mode 100644
index 0000000000..48e6e9aac5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-032.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-032.js';
+
+/**
+ File Name: lexical-032.js
+ Corresponds To: 7.4.2-9-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-032";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("delete = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "delete = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-033.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-033.js
new file mode 100644
index 0000000000..cc223c2282
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-033.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-033.js';
+
+/**
+ File Name: lexical-033.js
+ Corresponds To: 7.4.2-10.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-033";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("if = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "if = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-034.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-034.js
new file mode 100644
index 0000000000..4d3c7d5fc0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-034.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-034.js';
+
+/**
+ File Name: 7.4.2-11-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-034";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("this = true");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "this = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-035.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-035.js
new file mode 100644
index 0000000000..2a61b437ba
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-035.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-035.js';
+
+/**
+ File Name: lexical-035.js
+ Correpsonds To: 7.4.2-12-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-035";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var while");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var while" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-036.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-036.js
new file mode 100644
index 0000000000..a1923b7303
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-036.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-036.js';
+
+/**
+ File Name: lexical-036.js
+ Corresponds To: 7.4.2-13-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-036";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("else = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "else = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-037.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-037.js
new file mode 100644
index 0000000000..e3cd75bd60
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-037.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-037.js';
+
+/**
+ File Name: lexical-037.js
+ Corresponds To: 7.4.2-14-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-028";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var in;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var in" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-038.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-038.js
new file mode 100644
index 0000000000..1bf8c6c4e4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-038.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-038.js';
+
+/**
+ File Name: lexical-038.js
+ Corresponds To: 7.4.2-15-n.js
+ ECMA Section: 7.4.2
+
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
+
+ Syntax
+
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
+
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+var SECTION = "lexical-038";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("typeof = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "typeof = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-039.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-039.js
new file mode 100644
index 0000000000..2f193af89a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-039.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-039.js';
+
+/**
+ File Name: lexical-039
+ Corresponds To: 7.5-2-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "lexical-039";
+var VERSION = "JS1_4";
+var TITLE = "Identifiers";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var 0abc;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var 0abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-040.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-040.js
new file mode 100644
index 0000000000..f5ba3533dd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-040.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-040.js';
+
+/**
+ File Name: lexical-040.js
+ Corresponds To: 7.5-2.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "lexical-040";
+var VERSION = "JS1_4";
+var TITLE = "Identifiers";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var 1abc;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var 1abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-041.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-041.js
new file mode 100644
index 0000000000..06d63bddb3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-041.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-041.js';
+
+/**
+ File Name: lexical-041.js
+ Corresponds To: 7.5-8-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "lexical-041";
+var VERSION = "ECMA_1";
+var TITLE = "Identifiers";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var @abc;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var @abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-042.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-042.js
new file mode 100644
index 0000000000..c2cedb0b81
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-042.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-042.js';
+
+/**
+ File Name: lexical-042.js
+ Corresponds To: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "lexical-042";
+var VERSION = "JS1_4";
+var TITLE = "Identifiers";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("var 123;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "var 123" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-047.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-047.js
new file mode 100644
index 0000000000..e809c24149
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-047.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-047.js';
+
+/**
+ File Name: lexical-047.js
+ Corresponds To: 7.8.1-7-n.js
+ ECMA Section: 7.8.1
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "lexical-047";
+var VERSION = "JS1_4";
+var TITLE = "for loops";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var counter = 0;
+ eval("for ( counter = 0\n"
+ + "counter <= 1\n"
+ + "counter++ )\n"
+ + "{\n"
+ + "result += \": got to inner loop\";\n"
+ + "}\n");
+
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-048.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-048.js
new file mode 100644
index 0000000000..18054d4328
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-048.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-048.js';
+
+/**
+ File Name: lexical-048.js
+ Corresponds To: 7.8.1-1.js
+ ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertion
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "lexical-048";
+var VERSION = "JS1_4";
+var TITLE = "The Rules of Automatic Semicolon Insertion";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var counter = 0;
+ eval( "for ( counter = 0;\ncounter <= 1\ncounter++ ) {\nresult += \": got inside for loop\")");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-049.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-049.js
new file mode 100644
index 0000000000..e4ce840829
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-049.js
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-049.js';
+
+/**
+ File Name: lexical-049
+ Corresponds To: 7.8.1-1.js
+ ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertioin
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+var SECTION = "lexical-049";
+var VERSION = "JS1_4";
+var TITLE = "The Rules of Automatic Semicolon Insertion";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var counter = 0;
+ eval("for ( counter = 0\n"
+ + "counter <= 1;\n"
+ + "counter++ )\n"
+ + "{\n"
+ + "result += \": got inside for loop\";\n"
+ + "}\n");
+
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-050.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-050.js
new file mode 100644
index 0000000000..d9161c4b8f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-050.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-050.js';
+
+/**
+ File Name: lexical-050.js
+ Corresponds to: 7.8.2-1-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "lexical-050";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("{ 1 2 } 3");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "{ 1 2 } 3" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-051.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-051.js
new file mode 100644
index 0000000000..97ccbc6b43
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-051.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-051.js';
+
+/**
+ File Name: lexical-051.js
+ Corresponds to: 7.8.2-3-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "lexical-051";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("for (a; b\n) result += \": got to inner loop\";")
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "for (a; b\n)" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-052.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-052.js
new file mode 100644
index 0000000000..20d2d3c254
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-052.js
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-052.js';
+
+/**
+ File Name: lexical-052.js
+ Corresponds to: 7.8.2-4-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "lexical-052";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ MyFunction();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "calling return indirectly" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyFunction() {
+ var s = "return";
+ eval(s);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-053.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-053.js
new file mode 100644
index 0000000000..4e64fa1322
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-053.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-053.js';
+
+/**
+ File Name: lexical-053.js
+ Corresponds to: 7.8.2-7-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "lexical-053";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ a = true
+ b = false
+
+ eval('if (a > b)\nelse result += ": got to else statement"');
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "calling return indirectly" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-054.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-054.js
new file mode 100644
index 0000000000..3e25c36ef8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/lexical-054.js
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'lexical-054.js';
+
+/**
+ File Name: lexical-054.js
+ Corresponds to: 7.8.2-7-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "lexical-054";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ a=0;
+ b=1;
+ c=2;
+ d=3;
+ eval("if (a > b)\nelse c = d");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "if (a > b)\nelse c = d" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-001.js
new file mode 100644
index 0000000000..eb49a5b9bd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-001.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'number-001.js';
+
+/**
+ File Name: number-001
+ Corresponds To: 15.7.4.2-2-n.js
+ ECMA Section: 15.7.4.2.2 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
+
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
+
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "number-001";
+var VERSION = "JS1_4";
+var TITLE = "Exceptions for Number.toString()";
+
+startTest();
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ object= new Object();
+ object.toString = Number.prototype.toString;
+ result = object.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "object = new Object(); object.toString = Number.prototype.toString; object.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-002.js
new file mode 100644
index 0000000000..fef61fd527
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-002.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'number-002.js';
+
+/**
+ File Name: number-002.js
+ Corresponds To: ecma/Number/15.7.4.3-2-n.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "number-002";
+var VERSION = "JS1_4";
+var TITLE = "Exceptions for Number.valueOf()";
+
+startTest();
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ object= new Object();
+ object.toString = Number.prototype.valueOf;
+ result = object.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-003.js
new file mode 100644
index 0000000000..46920b7072
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/number-003.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'number-003.js';
+
+/**
+ File Name: number-003.js
+ Corresponds To: 15.7.4.3-3.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
+
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "number-003";
+var VERSION = "JS1_4";
+var TITLE = "Exceptions for Number.valueOf()";
+
+startTest();
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ VALUE_OF = Number.prototype.valueOf;
+ OBJECT = new String("Infinity");
+ OBJECT.valueOf = VALUE_OF;
+ result = OBJECT.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "Assigning Number.prototype.valueOf as the valueOf of a String object " +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/shell.js
new file mode 100644
index 0000000000..6c671f1eea
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Exceptions';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-001.js
new file mode 100644
index 0000000000..98e3d61a0c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-001.js
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-001.js';
+
+/**
+ File Name: statement-001.js
+ Corresponds To: 12.6.2-9-n.js
+ ECMA Section: 12.6.2 The for Statement
+
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
+
+
+ Author: christine@netscape.com
+ Date: 15 september 1997
+*/
+
+var SECTION = "statement-001.js";
+// var SECTION = "12.6.2-9-n";
+var VERSION = "ECMA_1";
+var TITLE = "The for statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("for (i) {\n}");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "for(i) {}" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-002.js
new file mode 100644
index 0000000000..da9931e9ab
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-002.js
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-002.js';
+
+/**
+ File Name: statement-002.js
+ Corresponds To: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "statement-002";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval(" for ( var i, p in this) { result += this[p]; }");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "more than one member expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-003.js
new file mode 100644
index 0000000000..d51083c4cf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-003.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-003.js';
+
+/**
+ File Name: statement-003
+ Corresponds To: 12.6.3-7-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
+
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "statement-003";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var o = new MyObject();
+ var result = 0;
+
+ eval("for ( this in o) {\n"
+ + "result += this[p];\n"
+ + "}\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-004.js
new file mode 100644
index 0000000000..8b9789a929
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-004.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-004.js';
+
+/**
+ File Name: statement-004.js
+ Corresponds To: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "statement-004";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var o = new MyObject();
+
+ eval("for ( \"a\" in o) {\n"
+ + "result += this[p];\n"
+ + "}");
+
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-005.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-005.js
new file mode 100644
index 0000000000..62a8c45d92
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-005.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-005.js';
+
+/**
+ File Name: statement-005.js
+ Corresponds To: 12.6.3-8-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "statement-005";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var o = new MyObject();
+ result = 0;
+
+ eval("for (1 in o) {\n"
+ + "result += this[p];"
+ + "}\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-006.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-006.js
new file mode 100644
index 0000000000..ec5ba97576
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-006.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-006.js';
+
+/**
+ File Name: statement-006.js
+ Corresponds To: 12.6.3-9-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
+*/
+var SECTION = "statement-006";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var o = new MyObject();
+ var result = 0;
+ for ( var o in foo) {
+ result += this[o];
+ }
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "object is not defined" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+function MyObject() {
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-007.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-007.js
new file mode 100644
index 0000000000..bb367c9924
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-007.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-007.js';
+
+/**
+ File Name: statement-007.js
+ Corresponds To: 12.7-1-n.js
+ ECMA Section: 12.7 The continue statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "statement-007";
+var VERSION = "JS1_4";
+var TITLE = "The continue statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("continue;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "continue outside of an iteration statement" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-008.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-008.js
new file mode 100644
index 0000000000..54ab39a9c9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-008.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-008.js';
+
+/**
+ File Name: statement-008.js
+ Corresponds To: 12.8-1-n.js
+ ECMA Section: 12.8 The break statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "statement-008";
+var VERSION = "JS1_4";
+var TITLE = "The break in statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("break;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "break outside of an iteration statement" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-009.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-009.js
new file mode 100644
index 0000000000..a63bd84e8e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/statement-009.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'statement-009.js';
+
+/**
+ File Name: 12.9-1-n.js
+ ECMA Section: 12.9 The return statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "12.9-1-n";
+var VERSION = "ECMA_1";
+var TITLE = "The return statement";
+
+startTest();
+writeHeaderToLog( SECTION + " The return statement");
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ eval("return;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "return outside of a function" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-001.js
new file mode 100644
index 0000000000..551030db33
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-001.js
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'string-001.js';
+
+/**
+ File Name: string-001.js
+ Corresponds To: 15.5.4.2-2-n.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
+
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
+
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+var SECTION = "string-001";
+var VERSION = "JS1_4";
+var TITLE = "String.prototype.toString";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ OBJECT = new Object();
+ OBJECT.toString = String.prototype.toString();
+ result = OBJECT.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; "+
+ " OBJECT.toString = String.prototype.toString; OBJECT.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-002.js
new file mode 100644
index 0000000000..785e339080
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Exceptions/string-002.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'string-002.js';
+
+/**
+ File Name: string-002.js
+ Corresponds To: 15.5.4.3-3-n.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+var SECTION = "string-002";
+var VERSION = "JS1_4";
+var TITLE = "String.prototype.valueOf";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+
+try {
+ var OBJECT =new Object();
+ OBJECT.valueOf = String.prototype.valueOf;
+ result = OBJECT.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
+
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+
+ "result = OBJECT.valueOf();" +
+ " (threw " + exception +")",
+ expect,
+ result );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Expressions/StrictEquality-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Expressions/StrictEquality-001.js
new file mode 100644
index 0000000000..db5c403d3d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Expressions/StrictEquality-001.js
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'StrictEquality-001.js';
+
+/**
+ * File Name: StrictEquality-001.js
+ * ECMA Section: 11.9.6.js
+ * Description:
+ *
+ * Author: christine@netscape.com
+ * Date: 4 september 1998
+ */
+var SECTION = "StrictEquality-001 - 11.9.6";
+var VERSION = "ECMA_2";
+var TITLE = "The strict equality operator ( === )";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+// 1. If Type(x) is different from Type(y) return false
+
+StrictEquality( true, new Boolean(true), false );
+StrictEquality( new Boolean(), false, false );
+StrictEquality( "", new String(), false );
+StrictEquality( new String("hi"), "hi", false );
+
+// 2. If Type(x) is not Number go to step 9.
+
+// 3. If x is NaN, return false
+StrictEquality( NaN, NaN, false );
+StrictEquality( NaN, 0, false );
+
+// 4. If y is NaN, return false.
+StrictEquality( 0, NaN, false );
+
+// 5. if x is the same number value as y, return true
+
+// 6. If x is +0 and y is -0, return true
+
+// 7. If x is -0 and y is +0, return true
+
+// 8. Return false.
+
+
+// 9. If Type(x) is String, then return true if x and y are exactly
+// the same sequence of characters ( same length and same characters
+// in corresponding positions.) Otherwise return false.
+
+// 10. If Type(x) is Boolean, return true if x and y are both true or
+// both false. otherwise return false.
+
+
+// Return true if x and y refer to the same object. Otherwise return
+// false.
+
+// Return false.
+
+
+test();
+
+function StrictEquality( x, y, expect ) {
+ result = ( x === y );
+
+ new TestCase(
+ SECTION,
+ x +" === " + y,
+ expect,
+ result );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Expressions/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/Expressions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Expressions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Expressions/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/Expressions/shell.js
new file mode 100644
index 0000000000..8f5d1129d5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Expressions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Expressions';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/apply-001-n.js b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/apply-001-n.js
new file mode 100644
index 0000000000..e58d087121
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/apply-001-n.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'apply-001-n.js';
+
+print("STATUS: f.apply crash test.");
+
+print("BUGNUMBER: 21836");
+
+function f ()
+{
+}
+
+var SECTION = "apply-001-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "f.apply(2,2) doesn't crash";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "f.apply(2,2) doesn't crash";
+EXPECTED = "error";
+
+new TestCase( SECTION, "f.apply(2,2) doesn't crash", "error", eval("f.apply(2,2)") );
+
+test();
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/call-1.js b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/call-1.js
new file mode 100644
index 0000000000..283e323797
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/call-1.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'call-1.js';
+
+/**
+ File Name: call-1.js
+ Section: Function.prototype.call
+ Description:
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "call-1";
+var VERSION = "ECMA_2";
+var TITLE = "Function.prototype.call";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "ToString.call( this, this )",
+ GLOBAL,
+ ToString.call( this, this ) );
+
+new TestCase( SECTION,
+ "ToString.call( Boolean, Boolean.prototype )",
+ "false",
+ ToString.call( Boolean, Boolean.prototype ) );
+
+new TestCase( SECTION,
+ "ToString.call( Boolean, Boolean.prototype.valueOf() )",
+ "false",
+ ToString.call( Boolean, Boolean.prototype.valueOf() ) );
+
+test();
+
+function ToString( obj ) {
+ return obj +"";
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/shell.js
new file mode 100644
index 0000000000..27aa7b1318
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/FunctionObjects/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'FunctionObjects';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/keywords-001.js b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/keywords-001.js
new file mode 100644
index 0000000000..7362613783
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/keywords-001.js
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'keywords-001.js';
+
+/**
+ * File Name:
+ * ECMA Section:
+ * Description:
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "";
+var VERSION = "ECMA_2";
+var TITLE = "Keywords";
+
+startTest();
+
+print("This test requires option javascript.options.strict enabled");
+
+if (!options().match(/strict/))
+{
+ options('strict');
+}
+if (!options().match(/werror/))
+{
+ options('werror');
+}
+
+var result = "failed";
+
+try {
+ eval("super;");
+}
+catch (x) {
+ if (x instanceof SyntaxError)
+ result = x.name;
+}
+
+AddTestCase(
+ "using the expression \"super\" shouldn't cause js to crash",
+ "SyntaxError",
+ result );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-001.js b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-001.js
new file mode 100644
index 0000000000..caa50fe363
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-001.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regexp-literals-001.js';
+
+/**
+ * File Name: LexicalConventions/regexp-literals-001.js
+ * ECMA Section: 7.8.5
+ * Description:
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "LexicalConventions/regexp-literals-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "Regular Expression Literals";
+
+startTest();
+
+// Regular Expression Literals may not be empty; // should be regarded
+// as a comment, not a RegExp literal.
+
+s = //;
+
+ "passed";
+
+AddTestCase(
+ "// should be a comment, not a regular expression literal",
+ "passed",
+ String(s));
+
+AddTestCase(
+ "// typeof object should be type of object declared on following line",
+ "passed",
+ (typeof s) == "string" ? "passed" : "failed" );
+
+AddTestCase(
+ "// should not return an object of the type RegExp",
+ "passed",
+ (typeof s == "object") ? "failed" : "passed" );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-002.js b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-002.js
new file mode 100644
index 0000000000..911b5d117a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/regexp-literals-002.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regexp-literals-002.js';
+
+/**
+ * File Name: LexicalConventions/regexp-literals-002.js
+ * ECMA Section: 7.8.5
+ * Description: Based on ECMA 2 Draft 8 October 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "LexicalConventions/regexp-literals-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "Regular Expression Literals";
+
+startTest();
+
+// A regular expression literal represents an object of type RegExp.
+
+AddTestCase(
+ "// A regular expression literal represents an object of type RegExp.",
+ "true",
+ (/x*/ instanceof RegExp).toString() );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/shell.js
new file mode 100644
index 0000000000..4e1d61d68a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/LexicalConventions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'LexicalConventions';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/README b/tests/auto/qml/parserstress/tests/ecma_2/README
new file mode 100755
index 0000000000..6da6cdd514
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/README
@@ -0,0 +1 @@
+ECMA 262 Edition 2
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js
new file mode 100644
index 0000000000..f1dba13b06
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/constructor-001.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'constructor-001.js';
+
+/**
+ * File Name: RegExp/constructor-001.js
+ * ECMA Section: 15.7.3.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/constructor-001";
+var VERSION = "ECMA_2";
+var TITLE = "new RegExp()";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
+
+AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
+
+AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
+
+AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
+
+AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
+
+AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
+
+AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
+
+test()
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js
new file mode 100644
index 0000000000..2d1bab472c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-001.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exec-001.js';
+
+/**
+ * File Name: RegExp/exec-001.js
+ * ECMA Section: 15.7.5.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/exec-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp.prototype.exec(string)";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
+
+// test cases without subpatterns
+// test cases with subpatterns
+// global property is true
+// global property is false
+// test cases in which the exec returns null
+
+AddTestCase("NO TESTS EXIST", "PASSED", "Test not implemented");
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js
new file mode 100644
index 0000000000..026f27d9d4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/exec-002.js
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'exec-002.js';
+
+/**
+ * File Name: RegExp/exec-002.js
+ * ECMA Section: 15.7.5.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Test cases provided by rogerl@netscape.com
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/exec-002";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp.prototype.exec(string)";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
+
+AddRegExpCases(
+ /(a|d|q|)x/i,
+ "bcaDxqy",
+ 3,
+ ["Dx", "D"] );
+
+AddRegExpCases(
+ /(a|(e|q))(x|y)/,
+ "bcaddxqy",
+ 6,
+ ["qy","q","q","y"] );
+
+
+AddRegExpCases(
+ /a+b+d/,
+ "aabbeeaabbs",
+ 0,
+ null );
+
+AddRegExpCases(
+ /a*b/,
+ "aaadaabaaa",
+ 4,
+ ["aab"] );
+
+AddRegExpCases(
+ /a*b/,
+ "dddb",
+ 3,
+ ["b"] );
+
+AddRegExpCases(
+ /a*b/,
+ "xxx",
+ 0,
+ null );
+
+AddRegExpCases(
+ /x\d\dy/,
+ "abcx45ysss235",
+ 3,
+ ["x45y"] );
+
+AddRegExpCases(
+ /[^abc]def[abc]+/,
+ "abxdefbb",
+ 2,
+ ["xdefbb"] );
+
+AddRegExpCases(
+ /(a*)baa/,
+ "ccdaaabaxaabaa",
+ 9,
+ ["aabaa", "aa"] );
+
+AddRegExpCases(
+ /(a*)baa/,
+ "aabaa",
+ 0,
+ ["aabaa", "aa"] );
+
+AddRegExpCases(
+ /q(a|b)*q/,
+ "xxqababqyy",
+ 2,
+ ["qababq", "b"] );
+
+AddRegExpCases(
+ /(a(.|[^d])c)*/,
+ "adcaxc",
+ 0,
+ ["adcaxc", "axc", "x"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabaxaabaayy",
+ 6,
+ ["aba", "a"] );
+
+AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabqxaabaayy",
+ 7,
+ ["b", ""] );
+
+AddRegExpCases(
+ /"(.|[^"\\\\])*"/,
+ 'xx\"makudonarudo\"yy',
+ 2,
+ ["\"makudonarudo\"", "o"] );
+
+ AddRegExpCases(
+ /"(.|[^"\\\\])*"/,
+ "xx\"ma\"yy",
+ 2,
+ ["\"ma\"", "a"] );
+
+ test();
+
+ function AddRegExpCases(
+ regexp, pattern, index, matches_array ) {
+
+// prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ regexp + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+ }
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js
new file mode 100644
index 0000000000..8b219b935b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/function-001.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'function-001.js';
+
+/**
+ * File Name: RegExp/function-001.js
+ * ECMA Section: 15.7.2.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/function-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp( pattern, flags )";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
+
+AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
+
+AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
+
+AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
+
+AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
+
+AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
+
+AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
+
+test()
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js
new file mode 100644
index 0000000000..f2dccd9267
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'hex-001.js';
+
+/**
+ * File Name: RegExp/hex-001.js
+ * ECMA Section: 15.7.3.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Positive test cases for constructing a RegExp object
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/hex-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences";
+
+startTest();
+
+// These examples come from 15.7.1, HexidecimalEscapeSequence
+
+AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] );
+
+/* Invalid testcase: we no longer silently ignore invalid hexadecimal escape sequences.
+AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] );
+*/
+
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]);
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ str_regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js
new file mode 100644
index 0000000000..102f91fcd4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/multiline-001.js
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'multiline-001.js';
+
+/**
+ * File Name: RegExp/multiline-001.js
+ * ECMA Section:
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Date: 19 February 1999
+ */
+
+var SECTION = "RegExp/multiline-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp: multiline flag";
+var BUGNUMBER="343901";
+
+startTest();
+
+var woodpeckers = "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" +
+ "northern flicker\npileated\n";
+
+AddRegExpCases( /.*[y]$/m, woodpeckers, woodpeckers.indexOf("downy"), ["downy"] );
+
+AddRegExpCases( /.*[d]$/m, woodpeckers, woodpeckers.indexOf("ivory-billed"), ["ivory-billed"] );
+
+test();
+
+
+function AddRegExpCases
+( regexp, pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js
new file mode 100644
index 0000000000..1c520750ce
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-001.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'octal-001.js';
+
+/**
+ * File Name: RegExp/octal-001.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/octal-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196";
+
+startTest();
+
+
+// backreference
+AddRegExpCases(
+ /(.)\1/,
+ "/(.)\\1/",
+ "HI!!",
+ "HI!",
+ 2,
+ ["!!", "!"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js
new file mode 100644
index 0000000000..b654e5e68a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-002.js
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'octal-002.js';
+
+/**
+ * File Name: RegExp/octal-002.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/octal-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346189";
+
+startTest();
+
+// backreference
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaaabbbccc",
+ "aabbccaaabbbccc",
+ 0,
+ ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] );
+
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\9",
+ "aabbccaabbcc",
+ "aabbccaabbcc",
+ 0,
+ ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaababcc",
+ "aabbccaababcc",
+ 0,
+ ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
+/*
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+*/
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js
new file mode 100644
index 0000000000..ee07ca602b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/octal-003.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'octal-003.js';
+
+/**
+ * File Name: RegExp/octal-003.js
+ * ECMA Section: 15.7.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Simple test cases for matching OctalEscapeSequences.
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ *
+ * Revised: 02 August 2002
+ * Author: pschwartau@netscape.com
+ *
+ * WHY: the original test expected the regexp /.\011/
+ * to match 'a' + String.fromCharCode(0) + '11'
+ *
+ * This is incorrect: the string is a 4-character string consisting of
+ * the characters <'a'>, <nul>, <'1'>, <'1'>. By contrast, the \011 in the
+ * regexp should be parsed as a single token: it is the octal escape sequence
+ * for the horizontal tab character '\t' === '\u0009' === '\x09' === '\011'.
+ *
+ * So the regexp consists of 2 characters: <any-character>, <'\t'>.
+ * There is no match between the regexp and the string.
+ *
+ * See the testcase ecma_3/RegExp/octal-002.js for an elaboration.
+ *
+ */
+var SECTION = "RegExp/octal-003.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132";
+
+startTest();
+
+AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ escape(pattern),
+ escape(regexp.exec(pattern).input) );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ escape(regexp.exec(pattern).toString()) );
+
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ escape(regexp.exec(pattern)[matches]) );
+ }
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js
new file mode 100644
index 0000000000..7d2913cc53
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-001.js
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'properties-001.js';
+
+/**
+ * File Name: RegExp/properties-001.js
+ * ECMA Section: 15.7.6.js
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/properties-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "Properties of RegExp Instances";
+var BUGNUMBER ="";
+
+startTest();
+
+AddRegExpCases( new RegExp, "", false, false, false, 0 );
+AddRegExpCases( /.*/, ".*", false, false, false, 0 );
+AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 );
+AddRegExpCases( /[\S]?$/i, "[\\S]?$", false, true, false, 0 );
+AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m, "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 );
+AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi, "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 );
+AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 );
+AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 );
+
+AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 );
+AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 );
+AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 );
+
+test();
+
+function AddRegExpCases( re, s, g, i, m, l ) {
+
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
+
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
+
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
+
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
+
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
+
+ // properties
+
+ AddTestCase( re + ".source",
+ s,
+ re.source );
+
+/*
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed
+ * the behavior of toString() and toSource() on empty regexps.
+ * So branch if |s| is the empty string -
+ */
+ var S = s? s : '(?:)';
+
+ AddTestCase( re + ".toString()",
+ "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
+
+ AddTestCase( re + ".global",
+ g,
+ re.global );
+
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
+
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
+
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js
new file mode 100644
index 0000000000..1fcfd8d219
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/properties-002.js
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'properties-002.js';
+
+/**
+ * File Name: RegExp/properties-002.js
+ * ECMA Section: 15.7.6.js
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+//-----------------------------------------------------------------------------
+var SECTION = "RegExp/properties-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "Properties of RegExp Instances";
+var BUGNUMBER ="124339";
+
+startTest();
+
+re_1 = /\cA?/g;
+re_1.lastIndex = Math.pow(2,31);
+AddRegExpCases( re_1, "\\cA?", true, false, false, Math.pow(2,31) );
+
+re_2 = /\w*/i;
+re_2.lastIndex = Math.pow(2,32) -1;
+AddRegExpCases( re_2, "\\w*", false, true, false, Math.pow(2,32)-1 );
+
+re_3 = /\*{0,80}/m;
+re_3.lastIndex = Math.pow(2,31) -1;
+AddRegExpCases( re_3, "\\*{0,80}", false, false, true, Math.pow(2,31) -1 );
+
+re_4 = /^./gim;
+re_4.lastIndex = Math.pow(2,30) -1;
+AddRegExpCases( re_4, "^.", true, true, true, Math.pow(2,30) -1 );
+
+re_5 = /\B/;
+re_5.lastIndex = Math.pow(2,30);
+AddRegExpCases( re_5, "\\B", false, false, false, Math.pow(2,30) );
+
+/*
+ * Brendan: "need to test cases Math.pow(2,32) and greater to see
+ * whether they round-trip." Reason: thanks to the work done in
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, lastIndex
+ * is now stored as a double instead of a uint32 (unsigned integer).
+ *
+ * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
+ * all the way up to Number.MAX_VALUE. So that's why we need cases
+ * between those two numbers.
+ *
+ */
+re_6 = /\B/;
+re_6.lastIndex = Math.pow(2,32);
+AddRegExpCases( re_6, "\\B", false, false, false, Math.pow(2,32) );
+
+re_7 = /\B/;
+re_7.lastIndex = Math.pow(2,32) + 1;
+AddRegExpCases( re_7, "\\B", false, false, false, Math.pow(2,32) + 1 );
+
+re_8 = /\B/;
+re_8.lastIndex = Math.pow(2,32) * 2;
+AddRegExpCases( re_8, "\\B", false, false, false, Math.pow(2,32) * 2 );
+
+re_9 = /\B/;
+re_9.lastIndex = Math.pow(2,40);
+AddRegExpCases( re_9, "\\B", false, false, false, Math.pow(2,40) );
+
+re_10 = /\B/;
+re_10.lastIndex = Number.MAX_VALUE;
+AddRegExpCases( re_10, "\\B", false, false, false, Number.MAX_VALUE );
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function AddRegExpCases( re, s, g, i, m, l ){
+
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
+
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
+
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
+
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
+
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
+
+ // properties
+
+ AddTestCase( re + ".source",
+ s,
+ re.source );
+
+ AddTestCase( re + ".toString()",
+ "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
+
+ AddTestCase( re + ".global",
+ g,
+ re.global );
+
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
+
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
+
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js
new file mode 100644
index 0000000000..c26a1216ea
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regexp-enumerate-001.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regexp-enumerate-001.js';
+
+/**
+ File Name: regexp-enumerate-001.js
+ ECMA V2 Section:
+ Description: Regression Test.
+
+ If instance Native Object have properties that are enumerable,
+ JavaScript enumerated through the properties twice. This only
+ happened if objects had been instantiated, but their properties
+ had not been enumerated. ie, the object inherited properties
+ from its prototype that are enumerated.
+
+ In the core JavaScript, this is only a problem with RegExp
+ objects, since the inherited properties of most core JavaScript
+ objects are not enumerated.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 12 November 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155291
+ ECMA-262 Ed.3 Sections 15.10.7.1 through 15.10.7.5
+ RegExp properties should be DontEnum
+ *
+ */
+// onerror = err;
+
+var SECTION = "regexp-enumerate-001";
+var VERSION = "ECMA_2";
+var TITLE = "Regression Test for Enumerating Properties";
+
+var BUGNUMBER="339403";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+/*
+ * This test expects RegExp instances to have four enumerated properties:
+ * source, global, ignoreCase, and lastIndex
+ *
+ * 99.01.25: now they also have a multiLine instance property.
+ *
+ */
+
+
+var r = new RegExp();
+
+var e = new Array();
+
+var t = new TestRegExp();
+
+for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) };
+
+new TestCase( SECTION,
+ "r = new RegExp(); e = new Array(); "+
+ "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length",
+ 0,
+ e.length );
+
+test();
+
+function TestRegExp() {
+ this.addProperty = addProperty;
+}
+function addProperty(name, value) {
+ var pass = false;
+
+ if ( eval("this."+name) != void 0 ) {
+ pass = true;
+ } else {
+ eval( "this."+ name+" = "+ false );
+ }
+
+ new TestCase( SECTION,
+ "Property: " + name +" already enumerated?",
+ false,
+ pass );
+
+ if ( gTestcases[ gTestcases.length-1].passed == false ) {
+ gTestcases[gTestcases.length-1].reason = "property already enumerated";
+
+ }
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js
new file mode 100644
index 0000000000..219ce245ee
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/regress-001.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regress-001.js';
+
+/**
+ * File Name: RegExp/regress-001.js
+ * ECMA Section: N/A
+ * Description: Regression test case:
+ * JS regexp anchoring on empty match bug
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=2157
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/hex-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "JS regexp anchoring on empty match bug";
+var BUGNUMBER = "2157";
+
+startTest();
+
+AddRegExpCases( /a||b/(''),
+ "//a||b/('')",
+ 1,
+ [''] );
+
+test();
+
+function AddRegExpCases( regexp, str_regexp, length, matches_array ) {
+
+ AddTestCase(
+ "( " + str_regexp + " ).length",
+ regexp.length,
+ regexp.length );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ "( " + str_regexp + " )[" + matches +"]",
+ matches_array[matches],
+ regexp[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js
new file mode 100644
index 0000000000..9b4657d963
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'RegExp';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js
new file mode 100644
index 0000000000..79a3212a2e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/unicode-001.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'unicode-001.js';
+
+/**
+ * File Name: RegExp/unicode-001.js
+ * ECMA Section: 15.7.3.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ * Positive test cases for constructing a RegExp object
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/unicode-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "new RegExp( pattern, flags )";
+
+startTest();
+
+// These examples come from 15.7.1, UnicodeEscapeSequence
+
+AddRegExpCases( /\u0041/, "/\\u0041/", "A", "A", 1, 0, ["A"] );
+AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( /\u001g/, "/\\u001g/", "u001g", "u001g", 1, 0, ["u001g"] );
+
+AddRegExpCases( /A/, "/A/", "\u0041", "\\u0041", 1, 0, ["A"] );
+AddRegExpCases( /A/, "/A/", "\u00412", "\\u00412", 1, 0, ["A"] );
+AddRegExpCases( /A2/, "/A2/", "\u00412", "\\u00412", 1, 0, ["A2"]);
+AddRegExpCases( /A/, "/A/", "A2", "A2", 1, 0, ["A"] );
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-001.js
new file mode 100644
index 0000000000..8cfdc25dd6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-001.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'dowhile-001.js';
+
+/**
+ * File Name: dowhile-001
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "dowhile-002";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+LabeledContinue( 0, 1 );
+LabeledContinue( 1, 1 );
+LabeledContinue( -1, 1 );
+LabeledContinue( 5, 5 );
+
+test();
+
+function LabeledContinue( limit, expect ) {
+ i = 0;
+woohoo:
+ do {
+ i++;
+ continue woohoo;
+ } while ( i < limit );
+
+ new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-002.js
new file mode 100644
index 0000000000..ca53dff899
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-002.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'dowhile-002.js';
+
+/**
+ * File Name: dowhile-002
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Verify that code after a labeled break is not executed. Verify that
+ * a labeled break breaks you out of the whole labeled block, and not
+ * just the current iteration statement.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "dowhile-002";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+LabeledContinue( 0, 1 );
+LabeledContinue( 1, 1 );
+LabeledContinue( -1, 1 );
+LabeledContinue( 5, 5 );
+
+test();
+
+// The labeled statement contains statements after the labeled break.
+// Verify that the statements after the break are not executed.
+
+function LabeledContinue( limit, expect ) {
+ i = 0;
+ result1 = "pass";
+ result2 = "pass";
+
+woohoo: {
+ do {
+ i++;
+ if ( ! (i < limit) ) {
+ break woohoo;
+ result1 = "fail: evaluated statement after a labeled break";
+ }
+ } while ( true );
+
+ result2 = "failed: broke out of loop, but not out of labeled block";
+ }
+
+ new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
+
+ new TestCase(
+ SECTION,
+ "breaking out of a do... while loop",
+ "pass",
+ result1 );
+
+
+ new TestCase(
+ SECTION,
+ "breaking out of a labeled do...while loop",
+ "pass",
+ result2 );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-003.js
new file mode 100644
index 0000000000..598f655f8d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-003.js
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'dowhile-003.js';
+
+/**
+ * File Name: dowhile-003
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Test do while, when the while expression is a JavaScript Number object.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "dowhile-003";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile( new DoWhileObject( 1, 1, 0 ));
+DoWhile( new DoWhileObject( 1000, 1000, 0 ));
+DoWhile( new DoWhileObject( 1001, 1001, 0 ));
+DoWhile( new DoWhileObject( 1002, 1001, 1 ));
+DoWhile( new DoWhileObject( -1, 1001, -1002 ));
+
+test();
+
+function DoWhileObject( value, iterations, endvalue ) {
+ this.value = value;
+ this.iterations = iterations;
+ this.endvalue = endvalue;
+}
+
+function DoWhile( object ) {
+ var i = 0;
+
+ do {
+ object.value = --object.value;
+ i++;
+ if ( i > 1000 )
+ break;
+ } while( object.value );
+
+ new TestCase(
+ SECTION,
+ "loop iterations",
+ object.iterations,
+ i
+ );
+
+ new TestCase(
+ SECTION,
+ "object.value",
+ object.endvalue,
+ Number( object.value )
+ );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-004.js
new file mode 100644
index 0000000000..eb8e0c1b72
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-004.js
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'dowhile-004.js';
+
+/**
+ * File Name: dowhile-004
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Test a labeled do...while. Break out of the loop with no label
+ * should break out of the loop, but not out of the label.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "dowhile-004";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile( 0, 1 );
+DoWhile( 1, 1 );
+DoWhile( -1, 1 );
+DoWhile( 5, 5 );
+
+test();
+
+function DoWhile( limit, expect ) {
+ i = 0;
+ result1 = "pass";
+ result2 = "failed: broke out of labeled statement unexpectedly";
+
+foo: {
+ do {
+ i++;
+ if ( ! (i < limit) ) {
+ break;
+ result1 = "fail: evaluated statement after a labeled break";
+ }
+ } while ( true );
+
+ result2 = "pass";
+ }
+
+ new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
+
+ new TestCase(
+ SECTION,
+ "breaking out of a do... while loop",
+ "pass",
+ result1 );
+
+
+ new TestCase(
+ SECTION,
+ "breaking out of a labeled do...while loop",
+ "pass",
+ result2 );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-005.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-005.js
new file mode 100644
index 0000000000..e4096f0d25
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-005.js
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'dowhile-005.js';
+
+/**
+ * File Name: dowhile-005
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Test a labeled do...while. Break out of the loop with no label
+ * should break out of the loop, but not out of the label.
+ *
+ * Currently causes an infinite loop in the monkey. Uncomment the
+ * print statement below and it works OK.
+ *
+ * Author: christine@netscape.com
+ * Date: 26 August 1998
+ */
+var SECTION = "dowhile-005";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
+var BUGNUMBER = "316293";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+NestedLabel();
+
+
+test();
+
+function NestedLabel() {
+ i = 0;
+ result1 = "pass";
+ result2 = "fail: did not hit code after inner loop";
+ result3 = "pass";
+
+outer: {
+ do {
+ inner: {
+// print( i );
+ break inner;
+ result1 = "fail: did break out of inner label";
+ }
+ result2 = "pass";
+ break outer;
+ print(i);
+ } while ( i++ < 100 );
+
+ }
+
+ result3 = "fail: did not break out of outer label";
+
+ new TestCase(
+ SECTION,
+ "number of loop iterations",
+ 0,
+ i );
+
+ new TestCase(
+ SECTION,
+ "break out of inner loop",
+ "pass",
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "break out of outer loop",
+ "pass",
+ result2 );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-006.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-006.js
new file mode 100644
index 0000000000..c8ad46f629
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-006.js
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'dowhile-006.js';
+
+/**
+ * File Name: dowhile-006
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * A general do...while test.
+ *
+ * Author: christine@netscape.com
+ * Date: 26 August 1998
+ */
+var SECTION = "dowhile-006";
+var VERSION = "ECMA_2";
+var TITLE = "do...while";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile( new DoWhileObject( false, false, 10 ) );
+DoWhile( new DoWhileObject( true, false, 2 ) );
+DoWhile( new DoWhileObject( false, true, 3 ) );
+DoWhile( new DoWhileObject( true, true, 4 ) );
+
+test();
+
+function looping( object ) {
+ object.iterations--;
+
+ if ( object.iterations <= 0 ) {
+ return false;
+ } else {
+ return true;
+ }
+}
+function DoWhileObject( breakOut, breakIn, iterations, loops ) {
+ this.iterations = iterations;
+ this.loops = loops;
+ this.breakOut = breakOut;
+ this.breakIn = breakIn;
+ this.looping = looping;
+}
+function DoWhile( object ) {
+ var result1 = false;
+ var result2 = false;
+
+outie: {
+ innie: {
+ do {
+ if ( object.breakOut )
+ break outie;
+
+ if ( object.breakIn )
+ break innie;
+
+ } while ( looping(object) );
+
+ // statements should be executed if:
+ // do...while exits normally
+ // do...while exits abruptly with no label
+
+ result1 = true;
+
+ }
+
+// statements should be executed if:
+// do...while breaks out with label "innie"
+// do...while exits normally
+// do...while does not break out with "outie"
+
+ result2 = true;
+ }
+
+ new TestCase(
+ SECTION,
+ "hit code after loop in inner loop",
+ ( object.breakIn || object.breakOut ) ? false : true ,
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "hit code after loop in outer loop",
+ ( object.breakOut ) ? false : true,
+ result2 );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-007.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-007.js
new file mode 100644
index 0000000000..5d148095d1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/dowhile-007.js
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'dowhile-007.js';
+
+/**
+ * File Name: dowhile-007
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * A general do...while test.
+ *
+ * Author: christine@netscape.com
+ * Date: 26 August 1998
+ */
+var SECTION = "dowhile-007";
+var VERSION = "ECMA_2";
+var TITLE = "do...while";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile( new DoWhileObject( false, false, false, false ));
+DoWhile( new DoWhileObject( true, false, false, false ));
+DoWhile( new DoWhileObject( true, true, false, false ));
+DoWhile( new DoWhileObject( true, true, true, false ));
+DoWhile( new DoWhileObject( true, true, true, true ));
+DoWhile( new DoWhileObject( false, false, false, true ));
+DoWhile( new DoWhileObject( false, false, true, true ));
+DoWhile( new DoWhileObject( false, true, true, true ));
+DoWhile( new DoWhileObject( false, false, true, false ));
+
+test();
+
+function DoWhileObject( out1, out2, out3, in1 ) {
+ this.breakOutOne = out1;
+ this.breakOutTwo = out2;
+ this.breakOutThree = out3;
+ this.breakIn = in1;
+}
+function DoWhile( object ) {
+ result1 = false;
+ result2 = false;
+ result3 = false;
+ result4 = false;
+
+outie:
+ do {
+ if ( object.breakOutOne ) {
+ break outie;
+ }
+ result1 = true;
+
+ innie:
+ do {
+ if ( object.breakOutTwo ) {
+ break outie;
+ }
+ result2 = true;
+
+ if ( object.breakIn ) {
+ break innie;
+ }
+ result3 = true;
+
+ } while ( false );
+ if ( object.breakOutThree ) {
+ break outie;
+ }
+ result4 = true;
+ } while ( false );
+
+ new TestCase(
+ SECTION,
+ "break one: ",
+ (object.breakOutOne) ? false : true,
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "break two: ",
+ (object.breakOutOne||object.breakOutTwo) ? false : true,
+ result2 );
+
+ new TestCase(
+ SECTION,
+ "break three: ",
+ (object.breakOutOne||object.breakOutTwo||object.breakIn) ? false : true,
+ result3 );
+
+ new TestCase(
+ SECTION,
+ "break four: ",
+ (object.breakOutOne||object.breakOutTwo||object.breakOutThree) ? false: true,
+ result4 );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-001.js
new file mode 100644
index 0000000000..0f20f6e953
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-001.js
@@ -0,0 +1,330 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'forin-001.js';
+
+/**
+ * File Name: forin-001.js
+ * ECMA Section:
+ * Description: The forin-001 statement
+ *
+ * Verify that the property name is assigned to the property on the left
+ * hand side of the for...in expression.
+ *
+ * Author: christine@netscape.com
+ * Date: 28 August 1998
+ */
+var SECTION = "forin-001";
+var VERSION = "ECMA_2";
+var TITLE = "The for...in statement";
+var BUGNUMBER="330890";
+var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+ForIn_1( { length:4, company:"netscape", year:2000, 0:"zero" } );
+ForIn_2( { length:4, company:"netscape", year:2000, 0:"zero" } );
+ForIn_3( { length:4, company:"netscape", year:2000, 0:"zero" } );
+
+// ForIn_6({ length:4, company:"netscape", year:2000, 0:"zero" });
+// ForIn_7({ length:4, company:"netscape", year:2000, 0:"zero" });
+ForIn_8({ length:4, company:"netscape", year:2000, 0:"zero" });
+
+test();
+
+/**
+ * Verify that the left side argument is evaluated with every iteration.
+ * Verify that the name of each property of the object is assigned to a
+ * a property.
+ *
+ */
+function ForIn_1( object ) {
+ PropertyArray = new Array();
+ ValueArray = new Array();
+
+ for ( PropertyArray[PropertyArray.length] in object ) {
+ ValueArray[ValueArray.length] =
+ object[PropertyArray[PropertyArray.length-1]];
+ }
+
+ for ( var i = 0; i < PropertyArray.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "object[" + PropertyArray[i] +"]",
+ object[PropertyArray[i]],
+ ValueArray[i]
+ );
+ }
+
+ new TestCase(
+ SECTION,
+ "object.length",
+ PropertyArray.length,
+ object.length );
+}
+
+/**
+ * Similar to ForIn_1, except it should increment the counter variable
+ * every time the left hand expression is evaluated.
+ */
+function ForIn_2( object ) {
+ PropertyArray = new Array();
+ ValueArray = new Array();
+ var i = 0;
+
+ for ( PropertyArray[i++] in object ) {
+ ValueArray[ValueArray.length] =
+ object[PropertyArray[PropertyArray.length-1]];
+ }
+
+ for ( i = 0; i < PropertyArray.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "object[" + PropertyArray[i] +"]",
+ object[PropertyArray[i]],
+ ValueArray[i]
+ );
+ }
+
+ new TestCase(
+ SECTION,
+ "object.length",
+ PropertyArray.length,
+ object.length );
+}
+
+/**
+ * Break out of a for...in loop
+ *
+ *
+ */
+function ForIn_3( object ) {
+ var checkBreak = "pass";
+ var properties = new Array();
+ var values = new Array();
+
+ for ( properties[properties.length] in object ) {
+ values[values.length] = object[properties[properties.length-1]];
+ break;
+ checkBreak = "fail";
+ }
+
+ new TestCase(
+ SECTION,
+ "check break out of for...in",
+ "pass",
+ checkBreak );
+
+ new TestCase(
+ SECTION,
+ "properties.length",
+ 1,
+ properties.length );
+
+ new TestCase(
+ SECTION,
+ "object["+properties[0]+"]",
+ values[0],
+ object[properties[0]] );
+}
+
+/**
+ * Break out of a labeled for...in loop.
+ */
+function ForIn_4( object ) {
+ var result1 = 0;
+ var result2 = 0;
+ var result3 = 0;
+ var result4 = 0;
+ var i = 0;
+ var property = new Array();
+
+butterbean: {
+ result1++;
+
+ for ( property[i++] in object ) {
+ result2++;
+ break;
+ result4++;
+ }
+ result3++;
+ }
+
+ new TestCase(
+ SECTION,
+ "verify labeled statement is only executed once",
+ true,
+ result1 == 1 );
+
+ new TestCase(
+ SECTION,
+ "verify statements in for loop are evaluated",
+ true,
+ result2 == i );
+
+ new TestCase(
+ SECTION,
+ "verify break out of labeled for...in loop",
+ true,
+ result4 == 0 );
+
+ new TestCase(
+ SECTION,
+ "verify break out of labeled block",
+ true,
+ result3 == 0 );
+}
+
+/**
+ * Labeled break out of a labeled for...in loop.
+ */
+function ForIn_5 (object) {
+ var result1 = 0;
+ var result2 = 0;
+ var result3 = 0;
+ var result4 = 0;
+ var i = 0;
+ var property = new Array();
+
+bigredbird: {
+ result1++;
+ for ( property[i++] in object ) {
+ result2++;
+ break bigredbird;
+ result4++;
+ }
+ result3++;
+ }
+
+ new TestCase(
+ SECTION,
+ "verify labeled statement is only executed once",
+ true,
+ result1 == 1 );
+
+ new TestCase(
+ SECTION,
+ "verify statements in for loop are evaluated",
+ true,
+ result2 == i );
+
+ new TestCase(
+ SECTION,
+ "verify break out of labeled for...in loop",
+ true,
+ result4 == 0 );
+
+ new TestCase(
+ SECTION,
+ "verify break out of labeled block",
+ true,
+ result3 == 0 );
+}
+
+/**
+ * Labeled continue from a labeled for...in loop
+ */
+function ForIn_7( object ) {
+ var result1 = 0;
+ var result2 = 0;
+ var result3 = 0;
+ var result4 = 0;
+ var i = 0;
+ var property = new Array();
+
+bigredbird:
+ for ( property[i++] in object ) {
+ result2++;
+ continue bigredbird;
+ result4++;
+ }
+
+ new TestCase(
+ SECTION,
+ "verify statements in for loop are evaluated",
+ true,
+ result2 == i );
+
+ new TestCase(
+ SECTION,
+ "verify break out of labeled for...in loop",
+ true,
+ result4 == 0 );
+
+ new TestCase(
+ SECTION,
+ "verify break out of labeled block",
+ true,
+ result3 == 1 );
+}
+
+
+/**
+ * continue in a for...in loop
+ *
+ */
+function ForIn_8( object ) {
+ var checkBreak = "pass";
+ var properties = new Array();
+ var values = new Array();
+
+ for ( properties[properties.length] in object ) {
+ values[values.length] = object[properties[properties.length-1]];
+ break;
+ checkBreak = "fail";
+ }
+
+ new TestCase(
+ SECTION,
+ "check break out of for...in",
+ "pass",
+ checkBreak );
+
+ new TestCase(
+ SECTION,
+ "properties.length",
+ 1,
+ properties.length );
+
+ new TestCase(
+ SECTION,
+ "object["+properties[0]+"]",
+ values[0],
+ object[properties[0]] );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-002.js
new file mode 100644
index 0000000000..524bf38b9a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/forin-002.js
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'forin-002.js';
+
+/**
+ * File Name: forin-002.js
+ * ECMA Section:
+ * Description: The forin-001 statement
+ *
+ * Verify that the property name is assigned to the property on the left
+ * hand side of the for...in expression.
+ *
+ * Author: christine@netscape.com
+ * Date: 28 August 1998
+ */
+var SECTION = "forin-002";
+var VERSION = "ECMA_2";
+var TITLE = "The for...in statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function ( "return this.value" );
+ this.toString = new Function ( "return this.value + \"\"" );
+ this.toNumber = new Function ( "return this.value + 0" );
+ this.toBoolean = new Function ( "return Boolean( this.value )" );
+}
+
+ForIn_1(this);
+ForIn_2(this);
+
+ForIn_1(new MyObject(true));
+ForIn_2(new MyObject(new Boolean(true)));
+
+ForIn_2(3);
+
+test();
+
+/**
+ * For ... In in a With Block
+ *
+ */
+function ForIn_1( object) {
+ with ( object ) {
+ for ( property in object ) {
+ new TestCase(
+ SECTION,
+ "with loop in a for...in loop. ("+object+")["+property +"] == "+
+ "eval ( " + property +" )",
+ true,
+ object[property] == eval(property) );
+ }
+ }
+}
+
+/**
+ * With block in a For...In loop
+ *
+ */
+function ForIn_2(object) {
+ for ( property in object ) {
+ with ( object ) {
+ new TestCase(
+ SECTION,
+ "with loop in a for...in loop. ("+object+")["+property +"] == "+
+ "eval ( " + property +" )",
+ true,
+ object[property] == eval(property) );
+ }
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/if-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/if-001.js
new file mode 100644
index 0000000000..439410c9a6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/if-001.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'if-001.js';
+
+/**
+ * File Name: if-001.js
+ * ECMA Section:
+ * Description: The if statement
+ *
+ * Verify that assignment in the if expression is evaluated correctly.
+ * Verifies the fix for bug http://scopus/bugsplat/show_bug.cgi?id=148822.
+ *
+ * Author: christine@netscape.com
+ * Date: 28 August 1998
+ */
+var SECTION = "for-001";
+var VERSION = "ECMA_2";
+var TITLE = "The if statement";
+var BUGNUMBER="148822";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var a = 0;
+var b = 0;
+var result = "passed";
+
+if ( a = b ) {
+ result = "failed: a = b should return 0";
+}
+
+new TestCase(
+ SECTION,
+ "if ( a = b ), where a and b are both equal to 0",
+ "passed",
+ result );
+
+
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/label-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/label-001.js
new file mode 100644
index 0000000000..07bdeb6b81
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/label-001.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'label-001.js';
+
+/**
+ * File Name: label-001.js
+ * ECMA Section:
+ * Description: Labeled statements
+ *
+ * Labeled break and continue within a for loop.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "label-003";
+var VERSION = "ECMA_2";
+var TITLE = "Labeled statements";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+LabelTest(0, 0);
+LabelTest(1, 1)
+ LabelTest(-1, 1000);
+LabelTest(false, 0);
+LabelTest(true, 1);
+
+test();
+
+function LabelTest( limit, expect) {
+woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } };
+
+ new TestCase(
+ SECTION,
+ "break out of a labeled for loop: "+ limit,
+ expect,
+ result );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/label-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/label-002.js
new file mode 100644
index 0000000000..83b114d3f2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/label-002.js
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'label-002.js';
+
+/**
+ * File Name: label-002.js
+ * ECMA Section:
+ * Description: Labeled statements
+ *
+ * Labeled break and continue within a for-in loop.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "label-002";
+var VERSION = "ECMA_2";
+var TITLE = "Labeled statements";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," );
+LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" );
+
+LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" );
+LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" );
+
+test();
+
+function LabelTest( object, expect1, expect2 ) {
+ result = "";
+
+yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo };
+
+ new TestCase(
+ SECTION,
+ "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }",
+ true,
+ result == expect1 || result == expect2 );
+}
+
+function LabelTest2( object, expect1, expect2 ) {
+ result = "";
+
+yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ;
+
+ new TestCase(
+ SECTION,
+ "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}",
+ true,
+ result == expect1 || result == expect2 );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/shell.js
new file mode 100644
index 0000000000..7346f697a5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Statements';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-001.js
new file mode 100644
index 0000000000..22ab0a7b60
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-001.js
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'switch-001.js';
+
+/**
+ * File Name: switch-001.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * A simple switch test with no abrupt completions.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+var SECTION = "switch-001";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
+
+var BUGNUMBER="315767";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+SwitchTest( 0, 126 );
+SwitchTest( 1, 124 );
+SwitchTest( 2, 120 );
+SwitchTest( 3, 112 );
+SwitchTest( 4, 64 );
+SwitchTest( 5, 96 );
+SwitchTest( true, 96 );
+SwitchTest( false, 96 );
+SwitchTest( null, 96 );
+SwitchTest( void 0, 96 );
+SwitchTest( "0", 96 );
+
+test();
+
+function SwitchTest( input, expect ) {
+ var result = 0;
+
+ switch ( input ) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ case 4:
+ result +=64;
+ }
+
+ new TestCase(
+ SECTION,
+ "switch with no breaks, case expressions are numbers. input is "+
+ input,
+ expect,
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-002.js
new file mode 100644
index 0000000000..6cb5491beb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-002.js
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'switch-002.js';
+
+/**
+ * File Name: switch-002.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * A simple switch test with no abrupt completions.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+var SECTION = "switch-002";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+SwitchTest( 0, 6 );
+SwitchTest( 1, 4 );
+SwitchTest( 2, 56 );
+SwitchTest( 3, 48 );
+SwitchTest( 4, 64 );
+SwitchTest( true, 32 );
+SwitchTest( false, 32 );
+SwitchTest( null, 32 );
+SwitchTest( void 0, 32 );
+SwitchTest( "0", 32 );
+
+test();
+
+function SwitchTest( input, expect ) {
+ var result = 0;
+
+ switch ( input ) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ }
+
+ new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-003.js
new file mode 100644
index 0000000000..27ed593bfe
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-003.js
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'switch-003.js';
+
+/**
+ * File Name: switch-003.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * Attempt to verify that case statements are evaluated in source order
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+var SECTION = "switch-003";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+SwitchTest( "a", "abc" );
+SwitchTest( "b", "bc" );
+SwitchTest( "c", "c" );
+SwitchTest( "d", "*abc" );
+SwitchTest( "v", "*abc" );
+SwitchTest( "w", "w*abc" );
+SwitchTest( "x", "xw*abc" );
+SwitchTest( "y", "yxw*abc" );
+SwitchTest( "z", "zyxw*abc" );
+// SwitchTest( new java.lang.String("z"), "*abc" );
+
+test();
+
+function SwitchTest( input, expect ) {
+ var result = "";
+
+ switch ( input ) {
+ case "z": result += "z";
+ case "y": result += "y";
+ case "x": result += "x";
+ case "w": result += "w";
+ default: result += "*";
+ case "a": result += "a";
+ case "b": result += "b";
+ case "c": result += "c";
+ }
+
+ new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-004.js
new file mode 100644
index 0000000000..e7605222d6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/switch-004.js
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'switch-004.js';
+
+/**
+ * File Name: switch-003.js
+ * ECMA Section:
+ * Description: The switch Statement
+ *
+ * This uses variables and objects as case expressions in switch statements.
+ * This verifies a bunch of bugs:
+ *
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315988
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315975
+ * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315954
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ *
+ */
+var SECTION = "switch-003";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
+var BUGNUMBER= "315988";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+ONE = new Number(1);
+ZERO = new Number(0);
+var A = new String("A");
+var B = new String("B");
+TRUE = new Boolean( true );
+FALSE = new Boolean( false );
+UNDEFINED = void 0;
+NULL = null;
+
+SwitchTest( ZERO, "ZERO" );
+SwitchTest( NULL, "NULL" );
+SwitchTest( UNDEFINED, "UNDEFINED" );
+SwitchTest( FALSE, "FALSE" );
+SwitchTest( false, "false" );
+SwitchTest( 0, "0" );
+
+SwitchTest ( TRUE, "TRUE" );
+SwitchTest( 1, "1" );
+SwitchTest( ONE, "ONE" );
+SwitchTest( true, "true" );
+
+SwitchTest( "a", "a" );
+SwitchTest( A, "A" );
+SwitchTest( "b", "b" );
+SwitchTest( B, "B" );
+
+SwitchTest( new Boolean( true ), "default" );
+SwitchTest( new Boolean(false ), "default" );
+SwitchTest( new String( "A" ), "default" );
+SwitchTest( new Number( 0 ), "default" );
+
+test();
+
+function SwitchTest( input, expect ) {
+ var result = "";
+
+ switch ( input ) {
+ default: result += "default"; break;
+ case "a": result += "a"; break;
+ case "b": result += "b"; break;
+ case A: result += "A"; break;
+ case B: result += "B"; break;
+ case new Boolean(true): result += "new TRUE"; break;
+ case new Boolean(false): result += "new FALSE"; break;
+ case NULL: result += "NULL"; break;
+ case UNDEFINED: result += "UNDEFINED"; break;
+ case true: result += "true"; break;
+ case false: result += "false"; break;
+ case TRUE: result += "TRUE"; break;
+ case FALSE: result += "FALSE"; break;
+ case 0: result += "0"; break;
+ case 1: result += "1"; break;
+ case new Number(0) : result += "new ZERO"; break;
+ case new Number(1) : result += "new ONE"; break;
+ case ONE: result += "ONE"; break;
+ case ZERO: result += "ZERO"; break;
+ }
+
+ new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-001.js
new file mode 100644
index 0000000000..c7b430dabe
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-001.js
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-001.js';
+
+/**
+ * File Name: try-001.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test contains try, catch, and finally blocks. An exception is
+ * sometimes thrown by a function called from within the try block.
+ *
+ * This test doesn't actually make any LiveConnect calls.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var INVALID_JAVA_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
+
+TryNewJavaInteger( "3.14159", INVALID_JAVA_INTEGER_VALUE );
+TryNewJavaInteger( NaN, INVALID_JAVA_INTEGER_VALUE );
+TryNewJavaInteger( 0, 0 );
+TryNewJavaInteger( -1, -1 );
+TryNewJavaInteger( 1, 1 );
+TryNewJavaInteger( Infinity, Infinity );
+
+test();
+
+/**
+ * Check to see if the input is valid for java.lang.Integer. If it is
+ * not valid, throw INVALID_JAVA_INTEGER_VALUE. If input is valid,
+ * return Number( v )
+ *
+ */
+
+function newJavaInteger( v ) {
+ value = Number( v );
+ if ( Math.floor(value) != value || isNaN(value) ) {
+ throw ( INVALID_JAVA_INTEGER_VALUE );
+ } else {
+ return value;
+ }
+}
+
+/**
+ * Call newJavaInteger( value ) from within a try block. Catch any
+ * exception, and store it in result. Verify that we got the right
+ * return value from newJavaInteger in cases in which we do not expect
+ * exceptions, and that we got the exception in cases where an exception
+ * was expected.
+ */
+function TryNewJavaInteger( value, expect ) {
+ var finalTest = false;
+
+ try {
+ result = newJavaInteger( value );
+ } catch ( e ) {
+ result = String( e );
+ } finally {
+ finalTest = true;
+ }
+ new TestCase(
+ SECTION,
+ "newJavaValue( " + value +" )",
+ expect,
+ result);
+
+ new TestCase(
+ SECTION,
+ "newJavaValue( " + value +" ) hit finally block",
+ true,
+ finalTest);
+
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-003.js
new file mode 100644
index 0000000000..2c39aac243
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-003.js
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-003.js';
+
+/**
+ * File Name: try-003.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with no catch, and a finally.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-003";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=313585";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Tests start here.
+
+TrySomething( "x = \"hi\"", false );
+TrySomething( "throw \"boo\"", true );
+TrySomething( "throw 3", true );
+
+test();
+
+/**
+ * This function contains a try block with no catch block,
+ * but it does have a finally block. Try to evaluate expressions
+ * that do and do not throw exceptions.
+ */
+
+function TrySomething( expression, throwing ) {
+ innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
+ if (throwing) {
+ outerCatch = "FAILED: NO EXCEPTION CAUGHT";
+ } else {
+ outerCatch = "PASS";
+ }
+ outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
+
+ try {
+ try {
+ eval( expression );
+ } finally {
+ innerFinally = "PASS";
+ }
+ } catch ( e ) {
+ if (throwing) {
+ outerCatch = "PASS";
+ } else {
+ outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
+ }
+ } finally {
+ outerFinally = "PASS";
+ }
+
+
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ innerFinally );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ outerCatch );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ outerFinally );
+
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-004.js
new file mode 100644
index 0000000000..d41903de18
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-004.js
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-004.js';
+
+/**
+ * File Name: try-004.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with one catch block but no finally.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-004";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+TryToCatch( "Math.PI", Math.PI );
+TryToCatch( "Thrower(5)", "Caught 5" );
+TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
+
+test();
+
+function Thrower( v ) {
+ throw "Caught " + v;
+}
+
+/**
+ * Evaluate a string. Catch any exceptions thrown. If no exception is
+ * expected, verify the result of the evaluation. If an exception is
+ * expected, verify that we got the right exception.
+ */
+
+function TryToCatch( value, expect ) {
+ try {
+ result = eval( value );
+ } catch ( e ) {
+ result = e;
+ }
+
+ new TestCase(
+ SECTION,
+ "eval( " + value +" )",
+ expect,
+ result );
+}
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-005.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-005.js
new file mode 100644
index 0000000000..0b9a055325
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-005.js
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-005.js';
+
+/**
+ * File Name: try-005.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with one catch block but no finally. Same
+ * as try-004, but the eval statement is called from a function, not
+ * directly from within the try block.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-005";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+TryToCatch( "Math.PI", Math.PI );
+TryToCatch( "Thrower(5)", "Caught 5" );
+TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
+
+test();
+
+function Thrower( v ) {
+ throw "Caught " + v;
+}
+function Eval( v ) {
+ return eval( v );
+}
+
+/**
+ * Evaluate a string. Catch any exceptions thrown. If no exception is
+ * expected, verify the result of the evaluation. If an exception is
+ * expected, verify that we got the right exception.
+ */
+
+function TryToCatch( value, expect ) {
+ try {
+ result = Eval( value );
+ } catch ( e ) {
+ result = e;
+ }
+
+ new TestCase(
+ SECTION,
+ "eval( " + value +" )",
+ expect,
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-006.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-006.js
new file mode 100644
index 0000000000..1cfbd28656
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-006.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-006.js';
+
+/**
+ * File Name: try-006.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * Throw an exception from within a With block in a try block. Verify
+ * that any expected exceptions are caught.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-006";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+/**
+ * This is the "check" function for test objects that will
+ * throw an exception.
+ */
+function throwException() {
+ throw EXCEPTION_STRING +": " + this.valueOf();
+}
+var EXCEPTION_STRING = "Exception thrown:";
+
+/**
+ * This is the "check" function for test objects that do not
+ * throw an exception
+ */
+function noException() {
+ return this.valueOf();
+}
+
+/**
+ * Add test cases here
+ */
+TryWith( new TryObject( "hello", throwException, true ));
+TryWith( new TryObject( "hola", noException, false ));
+
+/**
+ * Run the test.
+ */
+
+test();
+
+/**
+ * This is the object that will be the "this" in a with block.
+ */
+function TryObject( value, fun, exception ) {
+ this.value = value;
+ this.exception = exception;
+
+ this.valueOf = new Function ( "return this.value" );
+ this.check = fun;
+}
+
+/**
+ * This function has the try block that has a with block within it.
+ * Test cases are added in this function. Within the with block, the
+ * object's "check" function is called. If the test object's exception
+ * property is true, we expect the result to be the exception value.
+ * If exception is false, then we expect the result to be the value of
+ * the object.
+ */
+function TryWith( object ) {
+ try {
+ with ( object ) {
+ result = check();
+ }
+ } catch ( e ) {
+ result = e;
+ }
+
+ new TestCase(
+ SECTION,
+ "TryWith( " + object.value +" )",
+ (object.exception ? EXCEPTION_STRING +": " + object.valueOf() : object.valueOf()),
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-007.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-007.js
new file mode 100644
index 0000000000..566166755c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-007.js
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-007.js';
+
+/**
+ * File Name: try-007.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a for-in statement within a try block.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-007";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: for-in";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+/**
+ * This is the "check" function for test objects that will
+ * throw an exception.
+ */
+function throwException() {
+ throw EXCEPTION_STRING +": " + this.valueOf();
+}
+var EXCEPTION_STRING = "Exception thrown:";
+
+/**
+ * This is the "check" function for test objects that do not
+ * throw an exception
+ */
+function noException() {
+ return this.valueOf();
+}
+
+/**
+ * Add test cases here
+ */
+TryForIn( new TryObject( "hello", throwException, true ));
+TryForIn( new TryObject( "hola", noException, false ));
+
+/**
+ * Run the test.
+ */
+
+test();
+
+/**
+ * This is the object that will be the "this" in a with block.
+ * The check function is either throwException() or noException().
+ * See above.
+ *
+ */
+function TryObject( value, fun, exception ) {
+ this.value = value;
+ this.exception = exception;
+
+ this.check = fun;
+ this.valueOf = function () { return this.value; }
+}
+
+/**
+ * This function has a for-in statement within a try block. Test cases
+ * are added after the try-catch-finally statement. Within the for-in
+ * block, call a function that can throw an exception. Verify that any
+ * exceptions are properly caught.
+ */
+
+function TryForIn( object ) {
+ try {
+ for ( p in object ) {
+ if ( typeof object[p] == "function" ) {
+ result = object[p]();
+ }
+ }
+ } catch ( e ) {
+ result = e;
+ }
+
+ new TestCase(
+ SECTION,
+ "TryForIn( " + object+ " )",
+ (object.exception ? EXCEPTION_STRING +": " + object.value : object.value),
+ result );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-008.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-008.js
new file mode 100644
index 0000000000..016ab29a31
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-008.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-008.js';
+
+/**
+ * File Name: try-008.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try block in a constructor.
+ *
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-008";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: try in a constructor";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function Integer( value, exception ) {
+ try {
+ this.value = checkValue( value );
+ } catch ( e ) {
+ this.value = e.toString();
+ }
+
+ new TestCase(
+ SECTION,
+ "Integer( " + value +" )",
+ (exception ? INVALID_INTEGER_VALUE +": " + value : this.value),
+ this.value );
+}
+
+var INVALID_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
+
+function checkValue( value ) {
+ if ( Math.floor(value) != value || isNaN(value) ) {
+ throw ( INVALID_INTEGER_VALUE +": " + value );
+ } else {
+ return value;
+ }
+}
+
+// add test cases
+
+new Integer( 3, false );
+new Integer( NaN, true );
+new Integer( 0, false );
+new Integer( Infinity, false );
+new Integer( -2.12, true );
+new Integer( Math.LN2, true );
+
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-009.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-009.js
new file mode 100644
index 0000000000..d6ce368638
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-009.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-009.js';
+
+/**
+ * File Name: try-009.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try block within a while block. Verify that an exception
+ * breaks out of the while. I don't really know why this is an interesting
+ * test case but Mike Shaver had two of these so what the hey.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-009";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: try in a while block";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var EXCEPTION_STRING = "Exception thrown: ";
+var NO_EXCEPTION_STRING = "No exception thrown: ";
+
+
+TryInWhile( new TryObject( "hello", ThrowException, true ) );
+TryInWhile( new TryObject( "aloha", NoException, false ));
+
+test();
+
+function TryObject( value, throwFunction, result ) {
+ this.value = value;
+ this.thrower = throwFunction;
+ this.result = result;
+}
+function ThrowException() {
+ throw EXCEPTION_STRING + this.value;
+}
+function NoException() {
+ return NO_EXCEPTION_STRING + this.value;
+}
+function TryInWhile( object ) {
+ result = null;
+ while ( true ) {
+ try {
+ object.thrower();
+ result = NO_EXCEPTION_STRING + object.value;
+ break;
+ } catch ( e ) {
+ result = e;
+ break;
+ }
+ }
+
+ new TestCase(
+ SECTION,
+ "( "+ object +".thrower() )",
+ (object.result
+ ? EXCEPTION_STRING + object.value :
+ NO_EXCEPTION_STRING + object.value),
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-010.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-010.js
new file mode 100644
index 0000000000..27e712c895
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-010.js
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-010.js';
+
+/**
+ * File Name: try-010.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This has a try block nested in the try block. Verify that the
+ * exception is caught by the right try block, and all finally blocks
+ * are executed.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-010";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: try in a tryblock";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var EXCEPTION_STRING = "Exception thrown: ";
+var NO_EXCEPTION_STRING = "No exception thrown: ";
+
+
+NestedTry( new TryObject( "No Exceptions Thrown", NoException, NoException, 43 ) );
+NestedTry( new TryObject( "Throw Exception in Outer Try", ThrowException, NoException, 48 ));
+NestedTry( new TryObject( "Throw Exception in Inner Try", NoException, ThrowException, 45 ));
+NestedTry( new TryObject( "Throw Exception in Both Trys", ThrowException, ThrowException, 48 ));
+
+test();
+
+function TryObject( description, tryOne, tryTwo, result ) {
+ this.description = description;
+ this.tryOne = tryOne;
+ this.tryTwo = tryTwo;
+ this.result = result;
+}
+function ThrowException() {
+ throw EXCEPTION_STRING + this.value;
+}
+function NoException() {
+ return NO_EXCEPTION_STRING + this.value;
+}
+function NestedTry( object ) {
+ result = 0;
+ try {
+ object.tryOne();
+ result += 1;
+ try {
+ object.tryTwo();
+ result += 2;
+ } catch ( e ) {
+ result +=4;
+ } finally {
+ result += 8;
+ }
+ } catch ( e ) {
+ result += 16;
+ } finally {
+ result += 32;
+ }
+
+ new TestCase(
+ SECTION,
+ object.description,
+ object.result,
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-012.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-012.js
new file mode 100644
index 0000000000..79dfca2f03
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/try-012.js
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'try-012.js';
+
+/**
+ * File Name: try-012.js
+ * ECMA Section:
+ * Description: The try statement
+ *
+ * This test has a try with no catch, and a finally. This is like try-003,
+ * but throws from a finally block, not the try block.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "try-012";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+var BUGNUMBER="336872";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// Tests start here.
+
+TrySomething( "x = \"hi\"", true );
+TrySomething( "throw \"boo\"", true );
+TrySomething( "throw 3", true );
+
+test();
+
+/**
+ * This function contains a try block with no catch block,
+ * but it does have a finally block. Try to evaluate expressions
+ * that do and do not throw exceptions.
+ *
+ * The productioni TryStatement Block Finally is evaluated as follows:
+ * 1. Evaluate Block
+ * 2. Evaluate Finally
+ * 3. If Result(2).type is normal return result 1 (in the test case, result 1 has
+ * the completion type throw)
+ * 4. return result 2 (does not get hit in this case)
+ *
+ */
+
+function TrySomething( expression, throwing ) {
+ innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
+ if (throwing) {
+ outerCatch = "FAILED: NO EXCEPTION CAUGHT";
+ } else {
+ outerCatch = "PASS";
+ }
+ outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
+
+
+ // If the inner finally does not throw an exception, the result
+ // of the try block should be returned. (Type of inner return
+ // value should be throw if finally executes correctly
+
+ try {
+ try {
+ throw 0;
+ } finally {
+ innerFinally = "PASS";
+ eval( expression );
+ }
+ } catch ( e ) {
+ if (throwing) {
+ outerCatch = "PASS";
+ } else {
+ outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
+ }
+ } finally {
+ outerFinally = "PASS";
+ }
+
+
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated inner finally block",
+ "PASS",
+ innerFinally );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated outer catch block ",
+ "PASS",
+ outerCatch );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated outer finally block",
+ "PASS",
+ outerFinally );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-001.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-001.js
new file mode 100644
index 0000000000..467efe7f02
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-001.js
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'while-001.js';
+
+/**
+ * File Name: while-001
+ * ECMA Section:
+ * Description: while statement
+ *
+ * Verify that the while statement is not executed if the while expression is
+ * false
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "while-001";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile();
+test();
+
+function DoWhile() {
+ result = "pass";
+
+ while (false) {
+ result = "fail";
+ break;
+ }
+
+ new TestCase(
+ SECTION,
+ "while statement: don't evaluate statement is expression is false",
+ "pass",
+ result );
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-002.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-002.js
new file mode 100644
index 0000000000..c89e195497
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-002.js
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'while-002.js';
+
+/**
+ * File Name: while-002
+ * ECMA Section:
+ * Description: while statement
+ *
+ * Verify that the while statement is not executed if the while expression is
+ * false
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "while-002";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile( new DoWhileObject(
+ "while expression is null",
+ null,
+ "result = \"fail: should not have evaluated statements in while block;break"
+ ) );
+
+DoWhile( new DoWhileObject(
+ "while expression is undefined",
+ void 0,
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
+
+DoWhile( new DoWhileObject(
+ "while expression is 0",
+ 0,
+ "result = \"fail: should not have evaluated statements in while block; break;"
+ ));
+
+DoWhile( new DoWhileObject(
+ "while expression is eval(\"\")",
+ eval(""),
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
+
+DoWhile( new DoWhileObject(
+ "while expression is NaN",
+ NaN,
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
+
+test();
+
+function DoWhileObject( d, e, s ) {
+ this.description = d;
+ this.whileExpression = e;
+ this.statements = s;
+}
+
+function DoWhile( object ) {
+ result = "pass";
+
+ while ( expression = object.whileExpression ) {
+ eval( object.statements );
+ }
+
+ // verify that the while expression was evaluated
+
+ new TestCase(
+ SECTION,
+ "verify that while expression was evaluated (should be "+
+ object.whileExpression +")",
+ "pass",
+ (object.whileExpression == expression ||
+ ( isNaN(object.whileExpression) && isNaN(expression) )
+ ) ? "pass" : "fail" );
+
+ new TestCase(
+ SECTION,
+ object.description,
+ "pass",
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-003.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-003.js
new file mode 100644
index 0000000000..5fb734cce6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-003.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'while-003.js';
+
+/**
+ * File Name: while-003
+ * ECMA Section:
+ * Description: while statement
+ *
+ * The while expression evaluates to true, Statement returns abrupt completion.
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "while-003";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile( new DoWhileObject(
+ "while expression is true",
+ true,
+ "result = \"pass\";" ));
+
+DoWhile( new DoWhileObject(
+ "while expression is 1",
+ 1,
+ "result = \"pass\";" ));
+
+DoWhile( new DoWhileObject(
+ "while expression is new Boolean(false)",
+ new Boolean(false),
+ "result = \"pass\";" ));
+
+DoWhile( new DoWhileObject(
+ "while expression is new Object()",
+ new Object(),
+ "result = \"pass\";" ));
+
+DoWhile( new DoWhileObject(
+ "while expression is \"hi\"",
+ "hi",
+ "result = \"pass\";" ));
+/*
+ DoWhile( new DoWhileObject(
+ "while expression has a continue in it",
+ "true",
+ "if ( i == void 0 ) i = 0; result=\"pass\"; if ( ++i == 1 ) {continue;} else {break;} result=\"fail\";"
+ ));
+*/
+test();
+
+function DoWhileObject( d, e, s ) {
+ this.description = d;
+ this.whileExpression = e;
+ this.statements = s;
+}
+
+function DoWhile( object ) {
+ result = "fail: statements in while block were not evaluated";
+
+ while ( expression = object.whileExpression ) {
+ eval( object.statements );
+ break;
+ }
+
+ // verify that the while expression was evaluated
+
+ new TestCase(
+ SECTION,
+ "verify that while expression was evaluated (should be "+
+ object.whileExpression +")",
+ "pass",
+ (object.whileExpression == expression ||
+ ( isNaN(object.whileExpression) && isNaN(expression) )
+ ) ? "pass" : "fail" );
+
+ new TestCase(
+ SECTION,
+ object.description,
+ "pass",
+ result );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-004.js b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-004.js
new file mode 100644
index 0000000000..c5e2472816
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/Statements/while-004.js
@@ -0,0 +1,250 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'while-004.js';
+
+/**
+ * File Name: while-004
+ * ECMA Section:
+ * Description: while statement
+ *
+ * Author: christine@netscape.com
+ * Date: 11 August 1998
+ */
+var SECTION = "while-004";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
+var BUGNUMBER="316725";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DoWhile_1();
+DoWhile_2();
+DoWhile_3();
+DoWhile_4();
+DoWhile_5();
+
+test();
+
+/**
+ * Break out of a while by calling return.
+ *
+ * Tests: 12.6.2 step 6.
+ */
+function dowhile() {
+ result = "pass";
+
+ while (true) {
+ return result;
+ result = "fail: hit code after return statement";
+ break;
+ }
+}
+
+function DoWhile_1() {
+ description = "return statement in a while block";
+
+ result = dowhile();
+
+ new TestCase(
+ SECTION,
+ "DoWhile_1" + description,
+ "pass",
+ result );
+}
+
+/**
+ * While with a labeled continue statement. Verify that statements
+ * after the continue statement are not evaluated.
+ *
+ * Tests: 12.6.2 step 8.
+ *
+ */
+function DoWhile_2() {
+ var description = "while with a labeled continue statement";
+ var result1 = "pass";
+ var result2 = "fail: did not execute code after loop, but inside label";
+ var i = 0;
+ var j = 0;
+
+theloop:
+ while( i++ < 10 ) {
+ j++;
+ continue theloop;
+ result1 = "failed: hit code after continue statement";
+ }
+ result2 = "pass";
+
+ new TestCase(
+ SECTION,
+ "DoWhile_2: " +description + " - code inside the loop, before the continue should be executed ("+j+")",
+ true,
+ j == 10 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_2: " +description +" - code after labeled continue should not be executed",
+ "pass",
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_2: " +description +" - code after loop but inside label should be executed",
+ "pass",
+ result2 );
+}
+
+/**
+ * While with a labeled break.
+ *
+ */
+function DoWhile_3() {
+ var description = "while with a labeled break statement";
+ var result1 = "pass";
+ var result2 = "pass";
+ var result3 = "fail: did not get to code after label";
+
+woohoo: {
+ while( true ) {
+ break woohoo;
+ result1 = "fail: got to code after a break";
+ }
+ result2 = "fail: got to code outside of loop but inside label";
+ }
+
+ result3 = "pass";
+
+ new TestCase(
+ SECTION,
+ "DoWhile_3: " +description +" - verify break out of loop",
+ "pass",
+ result1 );
+
+
+ new TestCase(
+ SECTION,
+ "DoWhile_3: " +description +" - verify break out of label",
+ "pass",
+ result2 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_3: " +description + " - verify correct exit from label",
+ "pass",
+ result3 );
+}
+
+
+/**
+ * Labled while with an unlabeled break
+ *
+ */
+function DoWhile_4() {
+ var description = "labeled while with an unlabeled break";
+ var result1 = "pass";
+ var result2 = "pass";
+ var result3 = "fail: did not evaluate statement after label";
+
+woohooboy: {
+ while( true ) {
+ break woohooboy;
+ result1 = "fail: got to code after the break";
+ }
+ result2 = "fail: broke out of while, but not out of label";
+ }
+ result3 = "pass";
+
+ new TestCase(
+ SECTION,
+ "DoWhile_4: " +description +" - verify break out of while loop",
+ "pass",
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_4: " +description + " - verify break out of label",
+ "pass",
+ result2 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_4: " +description +" - verify that statements after label are evaluated",
+ "pass",
+ result3 );
+}
+
+/**
+ * in this case, should behave the same way as
+ *
+ *
+ */
+function DoWhile_5() {
+ var description = "while with a labeled continue statement";
+ var result1 = "pass";
+ var result2 = "fail: did not execute code after loop, but inside label";
+ var i = 0;
+ var j = 0;
+
+theloop: {
+ j++;
+ while( i++ < 10 ) {
+ continue;
+ result1 = "failed: hit code after continue statement";
+ }
+ result2 = "pass";
+ }
+
+ new TestCase(
+ SECTION,
+ "DoWhile_5: " +description + " - continue should not execute statements above the loop",
+ true,
+ ( j == 1 ) );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_5: " +description +" - code after labeled continue should not be executed",
+ "pass",
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_5: " +description +" - code after loop but inside label should be executed",
+ "pass",
+ result2 );
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/String/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/match-001.js b/tests/auto/qml/parserstress/tests/ecma_2/String/match-001.js
new file mode 100644
index 0000000000..de2275b5d6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/match-001.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'match-001.js';
+
+/**
+ * File Name: String/match-001.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ */
+
+var SECTION = "String/match-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
+
+startTest();
+
+// the regexp argument is not a RegExp object
+// this is not a string object
+
+// cases in which the regexp global property is false
+
+AddRegExpCases( 3, "3", "1234567890", 1, 2, ["3"] );
+
+// cases in which the regexp object global property is true
+
+AddGlobalRegExpCases( /34/g, "/34/g", "343443444", 3, ["34", "34", "34"] );
+AddGlobalRegExpCases( /\d{1}/g, "/d{1}/g", "123456abcde7890", 10,
+ ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] );
+
+AddGlobalRegExpCases( /\d{2}/g, "/d{2}/g", "123456abcde7890", 5,
+ ["12", "34", "56", "78", "90"] );
+
+AddGlobalRegExpCases( /\D{2}/g, "/d{2}/g", "123456abcde7890", 2,
+ ["ab", "cd"] );
+
+test();
+
+
+function AddRegExpCases(
+ regexp, str_regexp, string, length, index, matches_array ) {
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ string,
+ string.match(regexp).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, length, matches_array ) {
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ length,
+ string.match(regexp).length );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/match-002.js b/tests/auto/qml/parserstress/tests/ecma_2/String/match-002.js
new file mode 100644
index 0000000000..a57da2f77f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/match-002.js
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'match-002.js';
+
+/**
+ * File Name: String/match-002.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ *
+ * This file tests cases in which regexp.global is false. Therefore,
+ * results should behave as regexp.exec with string passed as a parameter.
+ *
+ */
+
+var SECTION = "String/match-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
+
+startTest();
+
+// the regexp argument is not a RegExp object
+// this is not a string object
+
+AddRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/,
+ "/([\d]{5})([-\ ]?[\d]{4})?$/",
+ "Boston, Mass. 02134",
+ 14,
+ ["02134", "02134", undefined]);
+
+AddGlobalRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/g,
+ "/([\d]{5})([-\ ]?[\d]{4})?$/g",
+ "Boston, Mass. 02134",
+ ["02134"]);
+
+// set the value of lastIndex
+re = /([\d]{5})([-\ ]?[\d]{4})?$/;
+re.lastIndex = 0;
+
+s = "Boston, MA 02134";
+
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex =0",
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
+
+
+re.lastIndex = s.length;
+
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.length,
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined] );
+
+re.lastIndex = s.lastIndexOf("0");
+
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0"),
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
+
+re.lastIndex = s.lastIndexOf("0") + 1;
+
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0") +1,
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
+
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, string, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ string + ".match(" + regexp +")",
+ matches_array,
+ string.match(regexp) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ string,
+ string.match(regexp).input );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + string +")",
+ matches_array,
+ regexp.exec(string) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/match-003.js b/tests/auto/qml/parserstress/tests/ecma_2/String/match-003.js
new file mode 100644
index 0000000000..cd3d80c919
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/match-003.js
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'match-003.js';
+
+/**
+ * File Name: String/match-003.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ */
+
+var SECTION = "String/match-003.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
+
+startTest();
+
+// the regexp argument is not a RegExp object
+// this is not a string object
+
+
+// [if regexp.global is true] set the regexp.lastIndex property to 0 and
+// invoke RegExp.prototype.exec repeatedly until there is no match. If
+// there is a match with an empty string (in other words, if the value of
+// regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+// The value returned is an array with the properties 0 through n-1
+// corresponding to the first element of the result of each matching invocation
+// of RegExp.prototype.exec.
+
+
+// set the value of lastIndex
+re = /([\d]{5})([-\ ]?[\d]{4})?$/g;
+
+
+s = "Boston, MA 02134";
+
+AddGlobalRegExpCases( re,
+ "re = " + re,
+ s,
+ ["02134" ]);
+
+re.lastIndex = 0;
+
+AddGlobalRegExpCases(
+ re,
+ "re = " + re + "; re.lastIndex = 0 ",
+ s,
+ ["02134"]);
+
+
+re.lastIndex = s.length;
+
+AddGlobalRegExpCases(
+ re,
+ "re = " + re + "; re.lastIndex = " + s.length,
+ s,
+ ["02134"] );
+
+re.lastIndex = s.lastIndexOf("0");
+
+AddGlobalRegExpCases(
+ re,
+ "re = "+ re +"; re.lastIndex = " + s.lastIndexOf("0"),
+ s,
+ ["02134"]);
+
+re.lastIndex = s.lastIndexOf("0") + 1;
+
+AddGlobalRegExpCases(
+ re,
+ "re = " +re+ "; re.lastIndex = " + (s.lastIndexOf("0") +1),
+ s,
+ ["02134"]);
+
+test();
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( string.match(regexp) == null || matches_array == null ) {
+ AddTestCase(
+ string + ".match(" + str_regexp +")",
+ matches_array,
+ string.match(regexp) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/match-004.js b/tests/auto/qml/parserstress/tests/ecma_2/String/match-004.js
new file mode 100644
index 0000000000..5c26de8b61
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/match-004.js
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'match-004.js';
+
+/**
+ * File Name: String/match-004.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * String.match( regexp )
+ *
+ * If regexp is not an object of type RegExp, it is replaced with result
+ * of the expression new RegExp(regexp). Let string denote the result of
+ * converting the this value to a string. If regexp.global is false,
+ * return the result obtained by invoking RegExp.prototype.exec (see
+ * section 15.7.5.3) on regexp with string as parameter.
+ *
+ * Otherwise, set the regexp.lastIndex property to 0 and invoke
+ * RegExp.prototype.exec repeatedly until there is no match. If there is a
+ * match with an empty string (in other words, if the value of
+ * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1.
+ * The value returned is an array with the properties 0 through n-1
+ * corresponding to the first element of the result of each matching
+ * invocation of RegExp.prototype.exec.
+ *
+ * Note that the match function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ *
+ *
+ * The match function should be intentionally generic, and not require
+ * this to be a string.
+ *
+ */
+
+var SECTION = "String/match-004.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
+
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=345818";
+
+startTest();
+
+// set the value of lastIndex
+re = /0./;
+s = 10203040506070809000;
+
+Number.prototype.match = String.prototype.match;
+
+AddRegExpCases( re,
+ "re = " + re ,
+ s,
+ String(s),
+ 1,
+ ["02"]);
+
+
+re.lastIndex = 0;
+AddRegExpCases( re,
+ "re = " + re +" [lastIndex is " + re.lastIndex+"]",
+ s,
+ String(s),
+ 1,
+ ["02"]);
+/*
+
+re.lastIndex = s.length;
+
+AddRegExpCases( re,
+"re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+s.length,
+s,
+s.lastIndexOf("0"),
+null );
+
+re.lastIndex = s.lastIndexOf("0");
+
+AddRegExpCases( re,
+"re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+s.lastIndexOf("0"),
+s,
+s.lastIndexOf("0"),
+["02134"]);
+
+re.lastIndex = s.lastIndexOf("0") + 1;
+
+AddRegExpCases( re,
+"re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+s.lastIndexOf("0") +1,
+s,
+0,
+null);
+*/
+test();
+
+function AddRegExpCases(
+ regexp, str_regexp, string, str_string, index, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ string + ".match(" + regexp +")",
+ matches_array,
+ string.match(regexp) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ str_string,
+ string.match(regexp).input );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
+
+function AddGlobalRegExpCases(
+ regexp, str_regexp, string, matches_array ) {
+
+ // prevent a runtime error
+
+ if ( regexp.exec(string) == null || matches_array == null ) {
+ AddTestCase(
+ regexp + ".exec(" + string +")",
+ matches_array,
+ regexp.exec(string) );
+
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/replace-001.js b/tests/auto/qml/parserstress/tests/ecma_2/String/replace-001.js
new file mode 100644
index 0000000000..f0ae3cdbfa
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/replace-001.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'replace-001.js';
+
+/**
+ * File Name: String/replace-001.js
+ * ECMA Section: 15.6.4.10
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+var SECTION = "String/replace-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.replace( regexp, replaceValue )";
+
+startTest();
+
+/*
+ * If regexp is not an object of type RegExp, it is replaced with the
+ * result of the expression new RegExp(regexp). Let string denote the
+ * result of converting the this value to a string. String is searched
+ * for the first occurrence of the regular expression pattern regexp if
+ * regexp.global is false, or all occurrences if regexp.global is true.
+ *
+ * The match is performed as in String.prototype.match, including the
+ * update of regexp.lastIndex. Let m be the number of matched
+ * parenthesized subexpressions as specified in section 15.7.5.3.
+ *
+ * If replaceValue is a function, then for each matched substring, call
+ * the function with the following m + 3 arguments. Argument 1 is the
+ * substring that matched. The next m arguments are all of the matched
+ * subexpressions. Argument m + 2 is the length of the left context, and
+ * argument m + 3 is string.
+ *
+ * The result is a string value derived from the original input by
+ * replacing each matched substring with the corresponding return value
+ * of the function call, converted to a string if need be.
+ *
+ * Otherwise, let newstring denote the result of converting replaceValue
+ * to a string. The result is a string value derived from the original
+ * input string by replacing each matched substring with a string derived
+ * from newstring by replacing characters in newstring by replacement text
+ * as specified in the following table:
+ *
+ * $& The matched substring.
+ * $‘ The portion of string that precedes the matched substring.
+ * $’ The portion of string that follows the matched substring.
+ * $+ The substring matched by the last parenthesized subexpressions in
+ * the regular expression.
+ * $n The corresponding matched parenthesized subexpression n, where n
+ * is a single digit 0-9. If there are fewer than n subexpressions, “$n
+ * is left unchanged.
+ *
+ * Note that the replace function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ */
+
+
+AddTestCase( "NO TESTS EXIST", "PASSED", "Test not implemented");
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/String/shell.js
new file mode 100644
index 0000000000..7d850446cc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'String';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/split-001.js b/tests/auto/qml/parserstress/tests/ecma_2/String/split-001.js
new file mode 100644
index 0000000000..bbab3b0428
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/split-001.js
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'split-001.js';
+
+/**
+ * File Name: String/split-001.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * Since regular expressions have been part of JavaScript since 1.2, there
+ * are already tests for regular expressions in the js1_2/regexp folder.
+ *
+ * These new tests try to supplement the existing tests, and verify that
+ * our implementation of RegExp conforms to the ECMA specification, but
+ * does not try to be as exhaustive as in previous tests.
+ *
+ * The [,limit] argument to String.split is new, and not covered in any
+ * existing tests.
+ *
+ * String.split cases are covered in ecma/String/15.5.4.8-*.js.
+ * String.split where separator is a RegExp are in
+ * js1_2/regexp/string_split.js
+ *
+ */
+
+var SECTION = "ecma_2/String/split-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.split( regexp, [,limit] )";
+
+startTest();
+
+// the separator is not supplied
+// separator is undefined
+// separator is an empty string
+
+AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] );
+AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] );
+
+// separartor is a regexp
+// separator regexp value global setting is set
+// string is an empty string
+// if separator is an empty string, split each by character
+
+// this is not a String object
+
+// limit is not a number
+// limit is undefined
+// limit is larger than 2^32-1
+// limit is a negative number
+
+test();
+
+function AddSplitCases( string, separator, str_sep, split_array ) {
+
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").constructor == Array",
+ true,
+ string.split(separator).constructor == Array );
+
+ // check the number of items in the array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").length",
+ split_array.length,
+ string.split(separator).length );
+
+ // check the value of each array item
+ var limit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator).length;
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +")[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
+}
+
+function AddLimitedSplitCases(
+ string, separator, str_sep, limit, str_limit, split_array ) {
+
+ // verify that the result of split is an object of type Array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit +
+ " ).constructor == Array",
+ true,
+ string.split(separator, limit).constructor == Array );
+
+ // check the length of the array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit + " ).length",
+ length,
+ string.split(separator).length );
+
+ // check the value of each array item
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit + " )[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/split-002.js b/tests/auto/qml/parserstress/tests/ecma_2/String/split-002.js
new file mode 100644
index 0000000000..9ae000790e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/split-002.js
@@ -0,0 +1,303 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'split-002.js';
+
+/**
+ * File Name: String/split-002.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * Since regular expressions have been part of JavaScript since 1.2, there
+ * are already tests for regular expressions in the js1_2/regexp folder.
+ *
+ * These new tests try to supplement the existing tests, and verify that
+ * our implementation of RegExp conforms to the ECMA specification, but
+ * does not try to be as exhaustive as in previous tests.
+ *
+ * The [,limit] argument to String.split is new, and not covered in any
+ * existing tests.
+ *
+ * String.split cases are covered in ecma/String/15.5.4.8-*.js.
+ * String.split where separator is a RegExp are in
+ * js1_2/regexp/string_split.js
+ *
+ */
+
+var SECTION = "ecma_2/String/split-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.split( regexp, [,limit] )";
+
+startTest();
+
+// the separator is not supplied
+// separator is undefined
+// separator is an empty string
+
+// AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] );
+// AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] );
+
+// separator is an empty regexp
+// separator is not supplied
+
+CompareSplit( "hello", "ll" );
+
+CompareSplit( "hello", "l" );
+CompareSplit( "hello", "x" );
+CompareSplit( "hello", "h" );
+CompareSplit( "hello", "o" );
+CompareSplit( "hello", "hello" );
+CompareSplit( "hello", undefined );
+
+CompareSplit( "hello", "");
+CompareSplit( "hello", "hellothere" );
+
+CompareSplit( new String("hello" ) );
+
+
+Number.prototype.split = String.prototype.split;
+
+CompareSplit( new Number(100111122133144155), 1 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, 1 );
+
+CompareSplitWithLimit(new Number(100111122133144155), 1, 2 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, 0 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, 100 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, void 0 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, Math.pow(2,32)-1 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, "boo" );
+CompareSplitWithLimit(new Number(100111122133144155), 1, -(Math.pow(2,32)-1) );
+CompareSplitWithLimit( "hello", "l", NaN );
+CompareSplitWithLimit( "hello", "l", 0 );
+CompareSplitWithLimit( "hello", "l", 1 );
+CompareSplitWithLimit( "hello", "l", 2 );
+CompareSplitWithLimit( "hello", "l", 3 );
+CompareSplitWithLimit( "hello", "l", 4 );
+
+
+/*
+ CompareSplitWithLimit( "hello", "ll", 0 );
+ CompareSplitWithLimit( "hello", "ll", 1 );
+ CompareSplitWithLimit( "hello", "ll", 2 );
+ CompareSplit( "", " " );
+ CompareSplit( "" );
+*/
+
+// separartor is a regexp
+// separator regexp value global setting is set
+// string is an empty string
+// if separator is an empty string, split each by character
+
+// this is not a String object
+
+// limit is not a number
+// limit is undefined
+// limit is larger than 2^32-1
+// limit is a negative number
+
+test();
+
+function CompareSplit( string, separator ) {
+ split_1 = string.split( separator );
+ split_2 = string_split( string, separator );
+
+ AddTestCase(
+ "( " + string +".split(" + separator + ") ).length" ,
+ split_2.length,
+ split_1.length );
+
+ var limit = split_1.length > split_2.length ?
+ split_1.length : split_2.length;
+
+ for ( var split_item = 0; split_item < limit; split_item++ ) {
+ AddTestCase(
+ string + ".split(" + separator + ")["+split_item+"]",
+ split_2[split_item],
+ split_1[split_item] );
+ }
+}
+
+function CompareSplitWithLimit( string, separator, splitlimit ) {
+ split_1 = string.split( separator, splitlimit );
+ split_2 = string_split( string, separator, splitlimit );
+
+ AddTestCase(
+ "( " + string +".split(" + separator + ", " + splitlimit+") ).length" ,
+ split_2.length,
+ split_1.length );
+
+ var limit = split_1.length > split_2.length ?
+ split_1.length : split_2.length;
+
+ for ( var split_item = 0; split_item < limit; split_item++ ) {
+ AddTestCase(
+ string + ".split(" + separator + ", " + splitlimit+")["+split_item+"]",
+ split_2[split_item],
+ split_1[split_item] );
+ }
+}
+
+function string_split ( __this, separator, limit ) {
+ var S = String(__this ); // 1
+
+ var A = new Array(); // 2
+
+ if ( limit == undefined ) { // 3
+ lim = Math.pow(2, 31 ) -1;
+ } else {
+ lim = ToUint32( limit );
+ }
+
+ var s = S.length; // 4
+ var p = 0; // 5
+
+ if ( separator == undefined ) { // 8
+ A[0] = S;
+ return A;
+ }
+
+ if ( separator.constructor == RegExp ) // 6
+ R = separator;
+ else
+ R = separator.toString();
+
+ if (lim == 0) return A; // 7
+
+ if ( separator == undefined ) { // 8
+ A[0] = S;
+ return A;
+ }
+
+ if (s == 0) { // 9
+ z = SplitMatch(R, S, 0);
+ if (z != false) return A;
+ A[0] = S;
+ return A;
+ }
+
+ var q = p; // 10
+loop:
+ while (true ) {
+
+ if ( q == s ) break; // 11
+
+ z = SplitMatch(R, S, q); // 12
+
+//print("Returned ", z);
+
+ if (z != false) { // 13
+ e = z.endIndex; // 14
+ cap = z.captures; // 14
+ if (e != p) { // 15
+//print("S = ", S, ", p = ", p, ", q = ", q);
+ T = S.slice(p, q); // 16
+//print("T = ", T);
+ A[A.length] = T; // 17
+ if (A.length == lim) return A; // 18
+ p = e; // 19
+ i = 0; // 20
+ while (true) { // 25
+ if (i == cap.length) { // 21
+ q = p; // 10
+ continue loop;
+ }
+ i = i + 1; // 22
+ A[A.length] = cap[i] // 23
+ if (A.length == lim) return A; // 24
+ }
+ }
+ }
+
+ q = q + 1; // 26
+ }
+
+ T = S.slice(p, q);
+ A[A.length] = T;
+ return A;
+}
+
+function SplitMatch(R, S, q)
+{
+ if (R.constructor == RegExp) { // 1
+ var reResult = R.match(S, q); // 8
+ if (reResult == undefined)
+ return false;
+ else {
+ a = new Array(reResult.length - 1);
+ for (var i = 1; i < reResult.length; i++)
+ a[a.length] = reResult[i];
+ return { endIndex : reResult.index + reResult[0].length, captures : cap };
+ }
+ }
+ else {
+ var r = R.length; // 2
+ s = S.length; // 3
+ if ((q + r) > s) return false; // 4
+ for (var i = 0; i < r; i++) {
+//print("S.charAt(", q + i, ") = ", S.charAt(q + i), ", R.charAt(", i, ") = ", R.charAt(i));
+ if (S.charAt(q + i) != R.charAt(i)) // 5
+ return false;
+ }
+ cap = new Array(); // 6
+ return { endIndex : q + r, captures : cap }; // 7
+ }
+}
+
+function ToUint32( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( Math.abs( n ) == 0
+ || Math.abs( n ) == Number.POSITIVE_INFINITY
+ || n != n) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
+
+ n = n % Math.pow(2,32);
+
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
+
+ return ( n );
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/String/split-003.js b/tests/auto/qml/parserstress/tests/ecma_2/String/split-003.js
new file mode 100644
index 0000000000..5029fc98f9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/String/split-003.js
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'split-003.js';
+
+/**
+ * File Name: String/split-003.js
+ * ECMA Section: 15.6.4.9
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+
+/*
+ * Since regular expressions have been part of JavaScript since 1.2, there
+ * are already tests for regular expressions in the js1_2/regexp folder.
+ *
+ * These new tests try to supplement the existing tests, and verify that
+ * our implementation of RegExp conforms to the ECMA specification, but
+ * does not try to be as exhaustive as in previous tests.
+ *
+ * The [,limit] argument to String.split is new, and not covered in any
+ * existing tests.
+ *
+ * String.split cases are covered in ecma/String/15.5.4.8-*.js.
+ * String.split where separator is a RegExp are in
+ * js1_2/regexp/string_split.js
+ *
+ */
+
+var SECTION = "ecma_2/String/split-003.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.split( regexp, [,limit] )";
+
+startTest();
+
+// separator is a regexp
+// separator regexp value global setting is set
+// string is an empty string
+// if separator is an empty string, split each by character
+
+
+AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
+
+AddSplitCases( "hello", /l/, "/l/", ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 0, [] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 1, ["he"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 2, ["he",""] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 3, ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 4, ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", void 0, ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", "hi", [] );
+AddLimitedSplitCases( "hello", /l/, "/l/", undefined, ["he","","o"] );
+
+AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 0, [] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 1, ["h"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 2, ["h","e"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 3, ["h","e","l"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 4, ["h","e","l","l"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", void 0, ["h","e","l","l","o"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", "hi", [] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", undefined, ["h","e","l","l","o"] );
+
+test();
+
+function AddSplitCases( string, separator, str_sep, split_array ) {
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").constructor == Array",
+ true,
+ string.split(separator).constructor == Array );
+
+ // check the number of items in the array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").length",
+ split_array.length,
+ string.split(separator).length );
+
+ // check the value of each array item
+ var limit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator).length;
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +")[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
+}
+
+function AddLimitedSplitCases(
+ string, separator, str_sep, limit, split_array ) {
+
+ // verify that the result of split is an object of type Array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit +
+ " ).constructor == Array",
+ true,
+ string.split(separator, limit).constructor == Array );
+
+ // check the length of the array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit + " ).length",
+ split_array.length,
+ string.split(separator, limit).length );
+
+ // check the value of each array item
+
+ var slimit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator, limit).length;
+
+ for ( var matches = 0; matches < slimit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit + " )[" + matches +"]",
+ split_array[matches],
+ string.split( separator, limit )[matches] );
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/browser.js
new file mode 100644
index 0000000000..4cde9b0629
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/browser.js
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/constructor-001.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/constructor-001.js
new file mode 100755
index 0000000000..cc7907d006
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/constructor-001.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'constructor-001.js';
+
+/**
+ * File Name: RegExp/constructor-001.js
+ * ECMA Section: 15.7.3.3
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/constructor-001";
+var VERSION = "ECMA_2";
+var TITLE = "new RegExp()";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
+
+AddTestCase(
+ "new RegExp().__proto__",
+ RegExp.prototype,
+ re.__proto__
+ );
+
+test()
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/function-001.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/function-001.js
new file mode 100755
index 0000000000..5153d25f9d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/function-001.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'function-001.js';
+
+/**
+ * File Name: RegExp/function-001.js
+ * ECMA Section: 15.7.2.1
+ * Description: Based on ECMA 2 Draft 7 February 1999
+ *
+ * Author: christine@netscape.com
+ * Date: 19 February 1999
+ */
+var SECTION = "RegExp/function-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp( pattern, flags )";
+
+startTest();
+
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
+
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
+
+AddTestCase(
+ "new RegExp().__proto__",
+ RegExp.prototype,
+ re.__proto__
+ );
+
+test()
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-001.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-001.js
new file mode 100755
index 0000000000..8ea446a248
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-001.js
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-001.js';
+
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+var SECTION = "instanceof-001";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
+
+ startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
+
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
+
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
+
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
+
+
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
+
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+ GenB.prototype = void 0;
+
+// RelationalExpression is not an object.
+
+InstanceOf( true, Boolean, false );
+InstanceOf( new Boolean(false), Boolean, true );
+
+// __proto__ of RelationalExpression is null. should return false
+genA = new GenA();
+genA.__proto__ = null;
+
+InstanceOf( genA, GenA, false );
+
+// RelationalExpression.__proto__ == (but not ===) Identifier.prototype
+
+InstanceOf( new Gen2(), Gen0, false );
+InstanceOf( new Gen2(), Gen1, false );
+InstanceOf( new Gen2(), Gen2, true );
+InstanceOf( new Gen2(), Gen3, true );
+
+// RelationalExpression.__proto__.__proto__ === Identifier.prototype
+InstanceOf( new Gen0(), Gen0, true );
+InstanceOf( new Gen0(), Gen1, true );
+InstanceOf( new Gen0(), Gen2, true );
+InstanceOf( new Gen0(), Gen3, true );
+
+InstanceOf( new Gen0(), Object, true );
+InstanceOf( new Gen0(), Function, false );
+
+InstanceOf( Gen0, Function, true );
+InstanceOf( Gen0, Object, true );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-002.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-002.js
new file mode 100755
index 0000000000..9cc837d8ef
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-002.js
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-002.js';
+
+/**
+ File Name: instanceof-002.js
+ Section:
+ Description: Determining Instance Relationships
+
+ This test is the same as js1_3/inherit/proto-002, except that it uses
+ the builtin instanceof operator rather than a user-defined function
+ called InstanceOf.
+
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+// onerror = err;
+
+var SECTION = "instanceof-002";
+var VERSION = "ECMA_2";
+var TITLE = "Determining Instance Relationships";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function InstanceOf( object, constructor ) {
+ while ( object != null ) {
+ if ( object == constructor.prototype ) {
+ return true;
+ }
+ object = object.__proto__;
+ }
+ return false;
+}
+
+function Employee ( name, dept ) {
+ this.name = name || "";
+ this.dept = dept || "general";
+}
+
+function Manager () {
+ this.reports = [];
+}
+Manager.prototype = new Employee();
+
+function WorkerBee ( name, dept, projs ) {
+ this.base = Employee;
+ this.base( name, dept)
+ this.projects = projs || new Array();
+}
+WorkerBee.prototype = new Employee();
+
+function SalesPerson () {
+ this.dept = "sales";
+ this.quota = 100;
+}
+SalesPerson.prototype = new WorkerBee();
+
+function Engineer ( name, projs, machine ) {
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
+ this.machine = machine || "";
+}
+Engineer.prototype = new WorkerBee();
+
+var pat = new Engineer();
+
+new TestCase( SECTION,
+ "pat.__proto__ == Engineer.prototype",
+ true,
+ pat.__proto__ == Engineer.prototype );
+
+new TestCase( SECTION,
+ "pat.__proto__.__proto__ == WorkerBee.prototype",
+ true,
+ pat.__proto__.__proto__ == WorkerBee.prototype );
+
+new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__ == Employee.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__ == Employee.prototype );
+
+new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype );
+
+new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null );
+
+new TestCase( SECTION,
+ "pat instanceof Engineer",
+ true,
+ pat instanceof Engineer );
+
+new TestCase( SECTION,
+ "pat instanceof WorkerBee )",
+ true,
+ pat instanceof WorkerBee );
+
+new TestCase( SECTION,
+ "pat instanceof Employee )",
+ true,
+ pat instanceof Employee );
+
+new TestCase( SECTION,
+ "pat instanceof Object )",
+ true,
+ pat instanceof Object );
+
+new TestCase( SECTION,
+ "pat instanceof SalesPerson )",
+ false,
+ pat instanceof SalesPerson );
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-003-n.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-003-n.js
new file mode 100755
index 0000000000..7a763a895c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-003-n.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-003-n.js';
+
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+var SECTION = "instanceof-003-n";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
+
+ startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function InstanceOf( object_1, object_2, expect ) {
+
+ result = object_1 instanceof object_2;
+
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
+
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
+
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
+
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
+
+
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
+
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+ GenB.prototype = void 0;
+
+// Identifier is not a function
+DESCRIPTION = "Identifier is not a function";
+EXPECTED = "error";
+
+InstanceOf( true, true, "error" );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-004-n.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-004-n.js
new file mode 100755
index 0000000000..1662ae566b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-004-n.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-004-n.js';
+
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+var SECTION = "instanceof-004-n";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
+
+ startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
+
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
+
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
+
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
+
+
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
+
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+ GenB.prototype = void 0;
+
+// Identifier is not a function
+
+DESCRIPTION = "Identifier is not a function";
+EXPECTED = "error";
+
+InstanceOf( new Boolean(true), false, "error" );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-005-n.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-005-n.js
new file mode 100755
index 0000000000..1a9b1b3437
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-005-n.js
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-005-n.js';
+
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+var SECTION = "instanceof-005-n";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
+
+ startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
+
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
+
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
+
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
+
+
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
+
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+ GenB.prototype = void 0;
+
+
+// Identifier is a function, prototype of Identifier is not an object
+
+DESCRIPTION = "Identifier is a function, prototype of Identifier is not an object";
+EXPECTED = "error";
+
+InstanceOf( new GenB(), GenB, "error" );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-006.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-006.js
new file mode 100755
index 0000000000..03c0f16fb9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/instanceof-006.js
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-006.js';
+
+/**
+ * File Name: instanceof-001.js
+ * ECMA Section: 11.8.6
+ * Description:
+ *
+ * RelationalExpression instanceof Identifier
+ *
+ * Author: christine@netscape.com
+ * Date: 2 September 1998
+ */
+var SECTION = "instanceof-001";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
+
+ startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
+
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
+
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
+
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
+
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
+
+
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
+
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+ GenB.prototype = void 0;
+
+// RelationalExpression is not an object.
+
+// InstanceOf( true, Boolean, false );
+InstanceOf( new Boolean(false), Boolean, true );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/extensions/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/extensions/shell.js
new file mode 100644
index 0000000000..3f52cffbc0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/extensions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'extensions';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/instanceof/browser.js b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-001.js b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-001.js
new file mode 100644
index 0000000000..39ae96fa5b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-001.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-001.js';
+
+/**
+ File Name: instanceof-1.js
+ ECMA Section:
+ Description: instanceof operator
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof operator";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var b = new Boolean();
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b instanceof Boolean",
+ true,
+ b instanceof Boolean );
+
+new TestCase( SECTION,
+ "b instanceof Object",
+ true,
+ b instanceof Object );
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-002.js b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-002.js
new file mode 100644
index 0000000000..c35fcb0486
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-002.js
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-002.js';
+
+/**
+ File Name:
+ ECMA Section:
+ Description: Call Objects
+
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+var SECTION = "";
+var VERSION = "ECMA_2";
+var TITLE = "The Call Constructor";
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var b = new Boolean();
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b instanceof Boolean",
+ true,
+ b instanceof Boolean );
+
+new TestCase( SECTION,
+ "b instanceof Object",
+ true,
+ b instanceof Object );
+
+new TestCase( SECTION,
+ "b instanceof Array",
+ false,
+ b instanceof Array );
+
+new TestCase( SECTION,
+ "true instanceof Boolean",
+ false,
+ true instanceof Boolean );
+
+new TestCase( SECTION,
+ "Boolean instanceof Object",
+ true,
+ Boolean instanceof Object );
+test();
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-003.js b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-003.js
new file mode 100644
index 0000000000..6c1279f865
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/instanceof-003.js
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communication Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'instanceof-003.js';
+
+/**
+ File Name: instanceof-003.js
+ ECMA Section:
+ Description: http://bugzilla.mozilla.org/show_bug.cgi?id=7635
+
+ js> function Foo() {}
+ js> theproto = {};
+ [object Object]
+ js> Foo.prototype = theproto
+ [object Object]
+ js> theproto instanceof Foo
+ true
+
+ I think this should be 'false'
+
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+ Modified to conform to ECMA3
+ https://bugzilla.mozilla.org/show_bug.cgi?id=281606
+*/
+var SECTION = "instanceof-003";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof operator";
+var BUGNUMBER ="7635";
+
+startTest();
+
+function Foo() {};
+theproto = {};
+Foo.prototype = theproto;
+
+AddTestCase(
+ "function Foo() = {}; theproto = {}; Foo.prototype = theproto; " +
+ "theproto instanceof Foo",
+ false,
+ theproto instanceof Foo );
+
+
+var o = {};
+
+// https://bugzilla.mozilla.org/show_bug.cgi?id=281606
+try
+{
+ AddTestCase(
+ "o = {}; o instanceof o",
+ "error",
+ o instanceof o );
+}
+catch(e)
+{
+ AddTestCase(
+ "o = {}; o instanceof o",
+ "error",
+ "error" );
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/instanceof/regress-7635.js b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/regress-7635.js
new file mode 100644
index 0000000000..c643920b04
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/regress-7635.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'regress-7635.js';
+
+/**
+ * File Name: regress-7635.js
+ * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=7635
+ * Description: instanceof tweaks
+ * Author:
+ */
+
+var SECTION = "instanceof"; // provide a document reference (ie, ECMA section)
+var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+var TITLE = "Regression test for Bugzilla #7635"; // Provide ECMA section title or a description
+var BUGNUMBER = "7635"; // Provide URL to bugsplat or bugzilla report
+
+startTest(); // leave this alone
+
+/*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * var zip = /[\d]{5}$/;
+ *
+ * AddTestCase(
+ * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test
+ * "02134", // expected result
+ * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result
+ *
+ */
+
+function Foo() {}
+theproto = {};
+Foo.prototype = theproto
+ theproto instanceof Foo
+
+
+ AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo",
+ false,
+ theproto instanceof Foo );
+
+var f = new Function();
+
+AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f );
+
+
+test(); // leave this alone. this executes the test cases and
+// displays results.
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/instanceof/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/shell.js
new file mode 100644
index 0000000000..b390356c38
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/instanceof/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'instanceof';
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/jsref.js b/tests/auto/qml/parserstress/tests/ecma_2/jsref.js
new file mode 100644
index 0000000000..e5a3ddfeed
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/jsref.js
@@ -0,0 +1,591 @@
+var completed = false;
+var testcases;
+var tc = 0;
+
+SECTION = "";
+VERSION = "";
+BUGNUMBER = "";
+EXCLUDE = "";
+BUGNUMBER = "";
+
+
+TZ_DIFF = -8;
+
+var TT = "";
+var TT_ = "";
+var BR = "";
+var NBSP = " ";
+var CR = "\n";
+var FONT = "";
+var FONT_ = "";
+var FONT_RED = "";
+var FONT_GREEN = "";
+var B = "";
+var B_ = ""
+var H2 = "";
+var H2_ = "";
+var HR = "";
+var DEBUG = false;
+
+
+var PASSED = " PASSED!"
+var FAILED = " FAILED! expected: ";
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
+}
+
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ print( "added " + this.description );
+ }
+}
+function startTest() {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_13" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_12" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_11" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ testcases = new Array();
+ tc = 0;
+
+}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
+
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
+
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
+
+ return passed;
+}
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = TT + string ;
+
+ for ( k = 0;
+ k < (60 - string.length >= 0 ? 60 - string.length : 5) ;
+ k++ ) {
+ }
+
+ s += B ;
+ s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ;
+
+ print( s + FONT_ + B_ + TT_ );
+
+ return passed;
+}
+
+function writeHeaderToLog( string ) {
+ print( H2 + string + H2_ );
+}
+function stopTest()
+{
+ var sizeTag = "<#TEST CASES SIZE>";
+ var doneTag = "<#TEST CASES DONE>";
+ var beginTag = "<#TEST CASE ";
+ var endTag = ">";
+
+ print(sizeTag);
+ print(testcases.length);
+ for (tc = 0; tc < testcases.length; tc++)
+ {
+ print(beginTag + 'PASSED' + endTag);
+ print(testcases[tc].passed);
+ print(beginTag + 'NAME' + endTag);
+ print(testcases[tc].name);
+ print(beginTag + 'EXPECTED' + endTag);
+ print(testcases[tc].expect);
+ print(beginTag + 'ACTUAL' + endTag);
+ print(testcases[tc].actual);
+ print(beginTag + 'DESCRIPTION' + endTag);
+ print(testcases[tc].description);
+ print(beginTag + 'REASON' + endTag);
+ print(( testcases[tc].passed ) ? "" : "wrong value ");
+ print(beginTag + 'BUGNUMBER' + endTag);
+ print( BUGNUMBER );
+ }
+ print(doneTag);
+ print( HR );
+ gc();
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
+function err( msg, page, line ) {
+ testcases[tc].actual = "error";
+ testcases[tc].reason = msg;
+ writeTestCaseResult( testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual +
+ ": " + testcases[tc].reason );
+ stopTest();
+ return true;
+}
+
+/**
+ * Type Conversion functions used by Type Conversion
+ *
+ */
+
+
+
+ /*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
+}
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
+ return ( DaysInYear(y) * msPerDay );
+}
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
+}
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
+}
+function YearNumber( t ) {
+}
+function TimeFromYear( y ) {
+ return ( msPerDay * DayFromYear(y) );
+}
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
+}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+t+") case not covered";
+ }
+}
+function YearFromTime( t ) {
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
+}
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
+}
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
+}
+function DateFromTime( t ) {
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
+}
+
+// missing daylight savins time adjustment
+
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
+}
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
+}
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+function DaylightSavingTA( t ) {
+ t = t - LocalTZA();
+
+ var dst_start = GetFirstSundayInApril(t) + 2*msPerHour;
+ var dst_end = GetLastSundayInOctober(t)+ 2*msPerHour;
+
+ if ( t >= dst_start && t < dst_end ) {
+ return msPerHour;
+ } else {
+ return 0;
+ }
+
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
+ // PST. Other time zones will need to override this function.
+
+ print( new Date( UTC(dst_start + LocalTZA())) );
+
+ return UTC(dst_start + LocalTZA());
+}
+function GetFirstSundayInApril( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
+
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+function GetLastSundayInOctober( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
+ oct += TimeInMonth(m, leap);
+ }
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
+}
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
+
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
+
+ return ( (Day(t)) + date - 1 );
+}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
+
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
+
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ||
+ day == Number.NaN ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
+}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
+
+ return ( ToInteger( t ) );
+}
+function ToInteger( t ) {
+ t = Number( t );
+
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+function Enumerate ( o ) {
+ var properties = new Array();
+ for ( p in o ) {
+ properties[ properties.length ] = new Array( p, o[p] );
+ }
+ return properties;
+}
+function AddTestCase( description, expect, actual ) {
+ testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+}
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/shell.js b/tests/auto/qml/parserstress/tests/ecma_2/shell.js
new file mode 100644
index 0000000000..a83dd68ec2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/shell.js
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestsuite = 'ecma_2';
+
+var TZ_DIFF = getTimeZoneDiff();
+
+/*
+ * Originally, the test suite used a hard-coded value TZ_DIFF = -8.
+ * But that was only valid for testers in the Pacific Standard Time Zone!
+ * We calculate the proper number dynamically for any tester. We just
+ * have to be careful to use a date not subject to Daylight Savings Time...
+ */
+function getTimeZoneDiff()
+{
+ return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_2/template.js b/tests/auto/qml/parserstress/tests/ecma_2/template.js
new file mode 100644
index 0000000000..83397ba7b3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_2/template.js
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestfile = 'template.js';
+
+/**
+ * File Name: template.js
+ * Reference: ** replace with bugzilla URL or document reference **
+ * Description: ** replace with description of test **
+ * Author: ** replace with your e-mail address **
+ */
+
+var SECTION = ""; // if ECMA test, provide section number
+var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+var TITLE = ""; // Provide ECMA section title or description
+var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report
+
+startTest(); // leave this alone
+
+
+/* Calls to AddTestCase here */
+
+test(); // leave this alone
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.11-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.11-01.js
new file mode 100755
index 0000000000..0436b8c1e0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.11-01.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.4.4.11-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 312138;
+var summary = 'Array.sort should not eat exceptions';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = "e=1 N=1";
+
+var N = 0;
+var array = [4,3,2,1];
+
+try {
+ array.sort(function() {
+ throw ++N;
+ });
+} catch (e) {
+ actual = ("e="+e+" N="+N);
+}
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.3-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.3-1.js
new file mode 100644
index 0000000000..e3de6fb116
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.3-1.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 12 Mar 2001
+ *
+ *
+ * SUMMARY: Testing Array.prototype.toLocaleString()
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=56883
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=58031
+ *
+ * By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString()
+ * should be applied to each element of the array, and the results should be
+ * concatenated with an implementation-specific delimiter. For example:
+ *
+ * myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc.
+ *
+ * In this testcase toLocaleString is a user-defined property of each
+ * array element; therefore it is the function that should be
+ * invoked. This function increments a global variable. Therefore the
+ * end value of this variable should be myArray.length.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.4.4.3-1.js';
+var BUGNUMBER = 56883;
+var summary = 'Testing Array.prototype.toLocaleString() -';
+var actual = '';
+var expect = '';
+var n = 0;
+var obj = {toLocaleString: function() {n++}};
+var myArray = [obj, obj, obj];
+
+
+myArray.toLocaleString();
+actual = n;
+expect = 3; // (see explanation above)
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.4-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.4-001.js
new file mode 100644
index 0000000000..b87233ea97
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.4.4-001.js
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * george@vanous.com, igor@icesoft.no, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 19 September 2002
+ * SUMMARY: Testing Array.prototype.concat()
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=169795
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.4.4.4-001.js';
+var UBound = 0;
+var BUGNUMBER = 169795;
+var summary = 'Testing Array.prototype.concat()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var x;
+
+
+status = inSection(1);
+x = "Hello";
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(2);
+x = 999;
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(3);
+x = /Hello/g;
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(4);
+x = new Error("Hello");
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(5);
+x = function() {return "Hello";};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(6);
+x = [function() {return "Hello";}];
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(7);
+x = [1,2,3].concat([4,5,6]);
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(8);
+x = eval('this');
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+/*
+ * The next two sections are by igor@icesoft.no; see
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3
+ */
+status = inSection(9);
+x={length:0};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+status = inSection(10);
+x={length:2, 0:0, 1:1};
+actual = [].concat(x).toString();
+expect = x.toString();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.5.1-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.5.1-01.js
new file mode 100755
index 0000000000..b55430b44e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/15.4.5.1-01.js
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.4.5.1-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = "(none)";
+var summary = '15.4.5.1 - array.length coverage';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var a = [];
+
+ expect = 'RangeError: invalid array length';
+ actual = '';
+ try
+ {
+ a.length = -1;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ actual = '';
+ try
+ {
+ a.length = 12345678901234567890;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ actual = '';
+ try
+ {
+ a.length = 'a';
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-101488.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-101488.js
new file mode 100644
index 0000000000..15a4556298
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-101488.js
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@icesoft.no, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 24 September 2001
+ *
+ * SUMMARY: Try assigning arr.length = new Number(n)
+ * From correspondence with Igor Bukanov <igor@icesoft.no>
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=101488
+ *
+ * Without the "new" keyword, assigning arr.length = Number(n) worked.
+ * But with it, Rhino was giving an error "Inappropriate array length"
+ * and SpiderMonkey was exiting without giving any error or return value -
+ *
+ * Comments on the Rhino code by igor@icesoft.no:
+ *
+ * jsSet_length requires that the new length value should be an instance
+ * of Number. But according to Ecma 15.4.5.1, item 12-13, an error should
+ * be thrown only if ToUint32(length_value) != ToNumber(length_value)
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-101488.js';
+var UBound = 0;
+var BUGNUMBER = 101488;
+var summary = 'Try assigning arr.length = new Number(n)';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var arr = [];
+
+
+status = inSection(1);
+arr = Array();
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(2);
+arr = Array(5);
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(3);
+arr = Array();
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+status = inSection(4);
+arr = Array(5);
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+
+/*
+ * Also try the above with the "new" keyword before Array().
+ * Array() and new Array() should be equivalent, by ECMA 15.4.1.1
+ */
+status = inSection(5);
+arr = new Array();
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+status = inSection(6);
+arr = new Array(5);
+tryThis('arr.length = new Number(1);');
+actual = arr.length;
+expect = 1;
+addThis();
+
+arr = new Array();
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+status = inSection(7);
+arr = new Array(5);
+tryThis('arr.length = new Number(17);');
+actual = arr.length;
+expect = 17;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function tryThis(s)
+{
+ try
+ {
+ eval(s);
+ }
+ catch(e)
+ {
+ // keep going
+ }
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-130451.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-130451.js
new file mode 100644
index 0000000000..a738bf6356
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-130451.js
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * brendan@mozilla.org, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 25 Mar 2002
+ * SUMMARY: Array.prototype.sort() should not (re-)define .length
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=130451
+ *
+ * From the ECMA-262 Edition 3 Final spec:
+ *
+ * NOTE: The sort function is intentionally generic; it does not require that
+ * its |this| value be an Array object. Therefore, it can be transferred to
+ * other kinds of objects for use as a method. Whether the sort function can
+ * be applied successfully to a host object is implementation-dependent.
+ *
+ * The interesting parts of this testcase are the contrasting expectations for
+ * Brendan's test below, when applied to Array objects vs. non-Array objects.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-130451.js';
+var UBound = 0;
+var BUGNUMBER = 130451;
+var summary = 'Array.prototype.sort() should not (re-)define .length';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var arr = [];
+var cmp = new Function();
+
+
+/*
+ * First: test Array.prototype.sort() on Array objects
+ */
+status = inSection(1);
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+actual = arr.sort(cmp).length;
+expect = 4;
+addThis();
+
+status = inSection(2);
+arr = [0,1,2,3];
+cmp = function(x,y) {return y-x;};
+actual = arr.sort(cmp).length;
+expect = 4;
+addThis();
+
+status = inSection(3);
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+arr.length = 1;
+actual = arr.sort(cmp).length;
+expect = 1;
+addThis();
+
+/*
+ * This test is by Brendan. Setting arr.length to
+ * 2 and then 4 should cause elements to be deleted.
+ */
+arr = [0,1,2,3];
+cmp = function(x,y) {return x-y;};
+arr.sort(cmp);
+
+status = inSection(4);
+actual = arr.join();
+expect = '0,1,2,3';
+addThis();
+
+status = inSection(5);
+actual = arr.length;
+expect = 4;
+addThis();
+
+status = inSection(6);
+arr.length = 2;
+actual = arr.join();
+expect = '0,1';
+addThis();
+
+status = inSection(7);
+arr.length = 4;
+actual = arr.join();
+expect = '0,1,,'; //<---- see how 2,3 have been lost
+addThis();
+
+
+
+/*
+ * Now test Array.prototype.sort() on non-Array objects
+ */
+status = inSection(8);
+var obj = new Object();
+obj.sort = Array.prototype.sort;
+obj.length = 4;
+obj[0] = 0;
+obj[1] = 1;
+obj[2] = 2;
+obj[3] = 3;
+cmp = function(x,y) {return x-y;};
+actual = obj.sort(cmp).length;
+expect = 4;
+addThis();
+
+
+/*
+ * Here again is Brendan's test. Unlike the array case
+ * above, the setting of obj.length to 2 and then 4
+ * should NOT cause elements to be deleted
+ */
+obj = new Object();
+obj.sort = Array.prototype.sort;
+obj.length = 4;
+obj[0] = 3;
+obj[1] = 2;
+obj[2] = 1;
+obj[3] = 0;
+cmp = function(x,y) {return x-y;};
+obj.sort(cmp); //<---- this is what triggered the buggy behavior below
+obj.join = Array.prototype.join;
+
+status = inSection(9);
+actual = obj.join();
+expect = '0,1,2,3';
+addThis();
+
+status = inSection(10);
+actual = obj.length;
+expect = 4;
+addThis();
+
+status = inSection(11);
+obj.length = 2;
+actual = obj.join();
+expect = '0,1';
+addThis();
+
+/*
+ * Before this bug was fixed, |actual| held the value '0,1,,'
+ * as in the Array-object case at top. This bug only occurred
+ * if Array.prototype.sort() had been applied to |obj|,
+ * as we have done higher up.
+ */
+status = inSection(12);
+obj.length = 4;
+actual = obj.join();
+expect = '0,1,2,3';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-01.js
new file mode 100755
index 0000000000..4e277e6da5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-01.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Joaquin Cuenca Abela
+ * Martin Honnen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-322135-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 322135;
+var summary = 'Array.prototype.push on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array = new Array(length);
+
+printStatus('before array.length = ' + array.length);
+
+try
+{
+ array.push('Kibo');
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary);
+
+//expect = 'Kibo';
+//actual = array[length];
+//reportCompare(expect, actual, summary + ': element appended');
+
+//expect = length;
+//actual = array.length;
+//reportCompare(expect, actual, summary + ': array length unchanged');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-02.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-02.js
new file mode 100755
index 0000000000..ee426a0cec
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-02.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Joaquin Cuenca Abela
+ * Martin Honnen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-322135-02.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 322135;
+var summary = 'Array.prototype.concat on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array1 = new Array(length);
+var array2 = ['Kibo'];
+var array;
+
+try
+{
+ array = array1.concat(array2);
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-03.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-03.js
new file mode 100755
index 0000000000..95ee7f7a92
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-03.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Joaquin Cuenca Abela
+ * Martin Honnen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-322135-03.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 322135;
+var summary = 'Array.prototype.splice on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array = new Array(length);
+var array1 = ['Kibo'];
+var array;
+
+try
+{
+ array.splice(0, 0, array1);
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary + ': RangeError');
+
+//expect = 'Kibo';
+//actual = array[0];
+//reportCompare(expect, actual, summary + ': element prepended');
+
+//expect = length;
+//actual = array.length;
+//reportCompare(expect, actual, summary + ': array length unchanged');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-04.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-04.js
new file mode 100755
index 0000000000..fe9f8fc71e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-322135-04.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Joaquin Cuenca Abela
+ * Martin Honnen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-322135-04.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 322135;
+var summary = 'Array.prototype.unshift on Array with length 2^32-1';
+var actual = 'Completed';
+var expect = 'Completed';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+printStatus('This bug passes if it does not cause an out of memory error');
+printStatus('Other issues related to array length are not tested.');
+
+var length = 4294967295;
+var array = new Array(length);
+
+try
+{
+ array.unshift('Kibo');
+}
+catch(ex)
+{
+ printStatus(ex.name + ': ' + ex.message);
+}
+reportCompare(expect, actual, summary);
+
+//expect = 'Kibo';
+//actual = array[0];
+//reportCompare(expect, actual, summary + ': first prepended');
+
+//expect = length;
+//actual = array.length;
+//reportCompare(expect, actual, summary + ': array length unchanged');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-387501.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-387501.js
new file mode 100755
index 0000000000..36cf1478d2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-387501.js
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-387501.js';
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 387501;
+var summary = 'Array.prototype.toString|toSource|toLocaleString is not generic';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ expect = 'TypeError: Array.prototype.toString called on incompatible String';
+ actual = Array.prototype.toString.call((new String('foo')));
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ try
+ {
+ expect = 'TypeError: Array.prototype.toLocaleString called on incompatible String';
+ actual = Array.prototype.toLocaleString.call((new String('foo')));
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ if (typeof Array.prototype.toSource != 'undefined')
+ {
+ try
+ {
+ expect = 'TypeError: Array.prototype.toSource called on incompatible String';
+ actual = Array.prototype.toSource.call((new String('foo')));
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-421325.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-421325.js
new file mode 100755
index 0000000000..c869d7bff4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-421325.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brian Crowder
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-421325.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 421325;
+var summary = 'Dense Arrays and holes';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ Array.prototype[1] = 'bar';
+
+ var a = [];
+ a[0]='foo';
+ a[2] = 'baz';
+ expect = 'foo,bar,baz';
+ actual = a + '';
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-430717.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-430717.js
new file mode 100755
index 0000000000..f750ffb449
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/regress-430717.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Mike Shaver
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-430717.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430717;
+var summary = 'Dense Arrays should inherit deleted elements from Array.prototype';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ Array.prototype[2] = "two";
+ var a = [0,1,2,3];
+ delete a[2];
+
+ expect = 'two';
+ actual = a[2];
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Array/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Array/shell.js
new file mode 100644
index 0000000000..9480d9e77d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Array/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Array';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.1.2-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.1.2-01.js
new file mode 100755
index 0000000000..61b1de6ef1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.1.2-01.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.9.1.2-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 264727;
+var summary = '15.9.1.2 - TimeWithinDay(TIME_1900) == 0';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 0;
+ actual = TimeWithinDay(TIME_1900);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.3.2-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.3.2-1.js
new file mode 100755
index 0000000000..d79b60b996
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.3.2-1.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.9.3.2-1.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 273292;
+var summary = '15.9.3.2 new Date(value)';
+var actual = '';
+var expect = '';
+var date1;
+var date2;
+var i;
+var validDateStrings = [
+ "11/69/2004",
+ "11/70/2004",
+ "69/69/2004",
+ "69/69/69",
+ "69/69/1969",
+ "70/69/70",
+ "70/69/1970",
+ "70/69/2004"
+ ];
+
+var invalidDateStrings = [
+ "70/70/70",
+ "70/70/1970",
+ "70/70/2004"
+ ];
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = 0;
+
+for (i = 0; i < validDateStrings.length; i++)
+{
+ date1 = new Date(validDateStrings[i]);
+ date2 = new Date(date1.toDateString());
+ actual = date2 - date1;
+
+ reportCompare(expect, actual, inSection(i) + ' ' +
+ validDateStrings[i]);
+}
+
+expect = true;
+
+var offset = validDateStrings.length;
+
+for (i = 0; i < invalidDateStrings.length; i++)
+{
+ date1 = new Date(invalidDateStrings[i]);
+ actual = isNaN(date1);
+
+ reportCompare(expect, actual, inSection(i + offset) + ' ' +
+ invalidDateStrings[i] + ' is invalid.');
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.4.3.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.4.3.js
new file mode 100755
index 0000000000..b197dcb9c2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.4.3.js
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): nanto_vi (TOYAMA Nao)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.9.4.3.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 363578;
+var summary = '15.9.4.3 - Date.UTC edge-case arguments.';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ //
+
+ expect = 31;
+ actual = (new Date(Date.UTC(2006, 0, 0)).getUTCDate());
+ reportCompare(expect, actual, summary + ': date 0');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0)).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours 0');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0)).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes 0');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0)).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds 0');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, 0)).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds 0');
+
+ //
+
+ expect = 30;
+ actual = (new Date(Date.UTC(2006, 0, -1)).getUTCDate());
+ reportCompare(expect, actual, summary + ': date -1');
+
+ expect = 23;
+ actual = (new Date(Date.UTC(2006, 0, 0, -1)).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours -1');
+
+ expect = 59;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, -1)).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes -1');
+
+ expect = 59;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, -1)).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds -1');
+
+ expect = 999;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, -1)).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds -1');
+
+ //
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, undefined)).getUTCDate());
+ reportCompare(expect, actual, summary + ': date undefined');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, undefined)).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours undefined');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, undefined)).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes undefined');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, undefined)).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds undefined');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, undefined)).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds undefined');
+
+ //
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, {})).getUTCDate());
+ reportCompare(expect, actual, summary + ': date {}');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, {})).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours {}');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, {})).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes {}');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, {})).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds {}');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, {})).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds {}');
+
+ //
+
+ expect = 31;
+ actual = (new Date(Date.UTC(2006, 0, null)).getUTCDate());
+ reportCompare(expect, actual, summary + ': date null');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, null)).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours null');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, null)).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes null');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, null)).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds null');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, null)).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds null');
+
+ //
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, Infinity)).getUTCDate());
+ reportCompare(expect, actual, summary + ': date Infinity');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, Infinity)).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours Infinity');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, Infinity)).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes Infinity');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, Infinity)).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds Infinity');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, Infinity)).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds Infinity');
+
+ //
+
+ expect = 31;
+ actual = (new Date(Date.UTC(2006, 0, -Infinity)).getUTCDate());
+ reportCompare(expect, actual, summary + ': date -Infinity');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, -Infinity)).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours -Infinity');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, -Infinity)).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes -Infinity');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, -Infinity)).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds -Infinity');
+
+ expect = 0;
+ actual = (new Date(Date.UTC(2006, 0, 0, 0, 0, 0, -Infinity)).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds -Infinity');
+
+ //
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, NaN)).getUTCDate());
+ reportCompare(expect, actual, summary + ': date NaN');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, NaN)).getUTCHours());
+ reportCompare(expect, actual, summary + ': hours NaN');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, NaN)).getUTCMinutes());
+ reportCompare(expect, actual, summary + ': minutes NaN');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, NaN)).getUTCSeconds());
+ reportCompare(expect, actual, summary + ': seconds NaN');
+
+ expect = true;
+ actual = isNaN(new Date(Date.UTC(2006, 0, 0, 0, 0, 0, NaN)).getUTCMilliseconds());
+ reportCompare(expect, actual, summary + ': milliseconds NaN');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.3.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.3.js
new file mode 100644
index 0000000000..6704f1fcad
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.3.js
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**
+ File Name: 15.9.5.3.js
+ ECMA Section: 15.9.5.3 Date.prototype.toDateString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "date"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We can't test the content of the string,
+ but can verify that the string is parsable by Date.parse
+
+ The toDateString function is not generic; it generates a runtime error
+ if its 'this' value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000 (adapted from ecma/Date/15.9.5.2.js)
+*/
+
+var gTestfile = '15.9.5.3.js';
+var SECTION = "15.9.5.3";
+var VERSION = "ECMA_3";
+var TITLE = "Date.prototype.toDateString()";
+
+var status = '';
+var actual = '';
+var expect = '';
+
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// first, some generic tests -
+
+status = "typeof (now.toDateString())";
+actual = typeof (now.toDateString());
+expect = "string";
+addTestCase();
+
+status = "Date.prototype.toDateString.length";
+actual = Date.prototype.toDateString.length;
+expect = 0;
+addTestCase();
+
+/*
+ * Date.parse is accurate to the second; valueOf() to the millisecond.
+ * Here we expect them to coincide, as we expect a time of exactly
+ * midnight -
+ */
+status = "(Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0";
+actual = (Date.parse(now.toDateString()) - (midnight(now)).valueOf()) == 0;
+expect = true;
+addTestCase();
+
+
+
+// 1970
+addDateTestCase(0);
+addDateTestCase(TZ_ADJUST);
+
+
+// 1900
+addDateTestCase(TIME_1900);
+addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+
+// 2000
+addDateTestCase(TIME_2000);
+addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+
+// 29 Feb 2000
+addDateTestCase(UTC_29_FEB_2000);
+addDateTestCase(UTC_29_FEB_2000 - 1000);
+addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+// 2005
+addDateTestCase(UTC_1_JAN_2005);
+addDateTestCase(UTC_1_JAN_2005 - 1000);
+addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ new TestCase(
+ SECTION,
+ status,
+ expect,
+ actual);
+}
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ var givenDate = new Date(date_given_in_milliseconds);
+
+ status = 'Date.parse(' + givenDate + ').toDateString())';
+ actual = Date.parse(givenDate.toDateString());
+ expect = Date.parse(midnight(givenDate));
+ addTestCase();
+}
+
+
+function midnight(givenDate)
+{
+ // midnight on the given date -
+ return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate());
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.4.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.4.js
new file mode 100644
index 0000000000..a2643bfe3c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.4.js
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**
+ File Name: 15.9.5.4.js
+ ECMA Section: 15.9.5.4 Date.prototype.toTimeString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "time"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We test the content of the string by checking
+ that d.toDateString() + d.toTimeString() == d.toString()
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+ Revised: 07 january 2002 because of a change in JS Date format:
+
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
+*/
+//-----------------------------------------------------------------------------
+var gTestfile = '15.9.5.4.js';
+var SECTION = "15.9.5.4";
+var VERSION = "ECMA_3";
+var TITLE = "Date.prototype.toTimeString()";
+
+var status = '';
+var actual = '';
+var expect = '';
+var givenDate;
+var year = '';
+var regexp = '';
+var reducedDateString = '';
+var hopeThisIsTimeString = '';
+var cnEmptyString = '';
+var cnERR ='OOPS! FATAL ERROR: no regexp match in extractTimeString()';
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// first, a couple of generic tests -
+
+status = "typeof (now.toTimeString())";
+actual = typeof (now.toTimeString());
+expect = "string";
+addTestCase();
+
+status = "Date.prototype.toTimeString.length";
+actual = Date.prototype.toTimeString.length;
+expect = 0;
+addTestCase();
+
+// 1970
+addDateTestCase(0);
+addDateTestCase(TZ_ADJUST);
+
+
+// 1900
+addDateTestCase(TIME_1900);
+addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+
+// 2000
+addDateTestCase(TIME_2000);
+addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+
+// 29 Feb 2000
+addDateTestCase(UTC_29_FEB_2000);
+addDateTestCase(UTC_29_FEB_2000 - 1000);
+addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+// Now
+addDateTestCase( TIME_NOW);
+addDateTestCase( TIME_NOW - TZ_ADJUST);
+
+
+// 2005
+addDateTestCase(UTC_1_JAN_2005);
+addDateTestCase(UTC_1_JAN_2005 - 1000);
+addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+//-----------------------------------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------------------------------
+
+function addTestCase()
+{
+ new TestCase(
+ SECTION,
+ status,
+ expect,
+ actual);
+}
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ givenDate = new Date(date_given_in_milliseconds);
+
+ status = '(' + givenDate + ').toTimeString()';
+ actual = givenDate.toTimeString();
+ expect = extractTimeString(givenDate);
+ addTestCase();
+}
+
+
+/*
+ * As of 2002-01-07, the format for JavaScript dates changed.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
+ *
+ * WAS: Mon Jan 07 13:40:34 GMT-0800 (Pacific Standard Time) 2002
+ * NOW: Mon Jan 07 2002 13:40:34 GMT-0800 (Pacific Standard Time)
+ *
+ * Thus, use a regexp of the form /date.toDateString()(.*)$/
+ * to capture the TimeString into the first backreference -
+ */
+function extractTimeString(date)
+{
+ regexp = new RegExp(date.toDateString() + '(.*)' + '$');
+
+ try
+ {
+ hopeThisIsTimeString = date.toString().match(regexp)[1];
+ }
+ catch(e)
+ {
+ return cnERR;
+ }
+
+ // trim any leading or trailing spaces -
+ return trimL(trimR(hopeThisIsTimeString));
+}
+
+
+function trimL(s)
+{
+ if (!s) {return cnEmptyString;};
+ for (var i = 0; i!=s.length; i++) {if (s[i] != ' ') {break;}}
+ return s.substring(i);
+}
+
+
+function trimR(s)
+{
+ if (!s) {return cnEmptyString;};
+ for (var i = (s.length - 1); i!=-1; i--) {if (s[i] != ' ') {break;}}
+ return s.substring(0, i+1);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5-02.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5-02.js
new file mode 100755
index 0000000000..e3b073e7ec
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5-02.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.9.5.5-02.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 398485;
+var summary = 'Date.prototype.toLocaleString should not clamp year';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var d;
+ var y;
+ var l;
+ var maxms = 8640000000000000;
+
+ d = new Date(-maxms );
+ y = d.getFullYear();
+ l = d.toLocaleString();
+ print(l);
+
+ actual = y;
+ expect = -271821;
+ reportCompare(expect, actual, summary + ': check year');
+
+ actual = l.match(new RegExp(y)) + '';
+ expect = y + '';
+ reportCompare(expect, actual, summary + ': check toLocaleString');
+
+ d = new Date(maxms );
+ y = d.getFullYear();
+ l = d.toLocaleString();
+ print(l);
+
+ actual = y;
+ expect = 275760;
+ reportCompare(expect, actual, summary + ': check year');
+
+ actual = l.match(new RegExp(y)) + '';
+ expect = y + '';
+ reportCompare(expect, actual, summary + ': check toLocaleString');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5.js
new file mode 100644
index 0000000000..2b76fdcfc2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.5.js
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.9.5.5.js';
+
+/**
+ File Name: 15.9.5.5.js
+ ECMA Section: 15.9.5.5 Date.prototype.toLocaleString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "date"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We can't test the content of the string,
+ but can verify that the string is parsable by Date.parse
+
+ The toLocaleString function is not generic; it generates a runtime error
+ if its 'this' value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Note: This test isn't supposed to work with a non-English locale per spec.
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+*/
+
+var SECTION = "15.9.5.5";
+var VERSION = "ECMA_3";
+var TITLE = "Date.prototype.toLocaleString()";
+
+var status = '';
+var actual = '';
+var expect = '';
+
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// first, some generic tests -
+
+status = "typeof (now.toLocaleString())";
+actual = typeof (now.toLocaleString());
+expect = "string";
+addTestCase();
+
+status = "Date.prototype.toLocaleString.length";
+actual = Date.prototype.toLocaleString.length;
+expect = 0;
+addTestCase();
+
+// Date.parse is accurate to the second; valueOf() to the millisecond -
+status = "Math.abs(Date.parse(now.toLocaleString()) - now.valueOf()) < 1000";
+actual = Math.abs(Date.parse(now.toLocaleString()) - now.valueOf()) < 1000;
+expect = true;
+addTestCase();
+
+
+
+// 1970
+addDateTestCase(0);
+addDateTestCase(TZ_ADJUST);
+
+
+// 1900
+addDateTestCase(TIME_1900);
+addDateTestCase(TIME_1900 -TZ_ADJUST);
+
+
+// 2000
+addDateTestCase(TIME_2000);
+addDateTestCase(TIME_2000 -TZ_ADJUST);
+
+
+// 29 Feb 2000
+addDateTestCase(UTC_29_FEB_2000);
+addDateTestCase(UTC_29_FEB_2000 - 1000);
+addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+// 2005
+addDateTestCase(UTC_1_JAN_2005);
+addDateTestCase(UTC_1_JAN_2005 - 1000);
+addDateTestCase(UTC_1_JAN_2005-TZ_ADJUST);
+
+
+
+//-----------------------------------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ AddTestCase(
+ status,
+ expect,
+ actual);
+}
+
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ var givenDate = new Date(date_given_in_milliseconds);
+
+ status = 'Date.parse(' + givenDate + ').toLocaleString())';
+ actual = Date.parse(givenDate.toLocaleString());
+ expect = date_given_in_milliseconds;
+ addTestCase();
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.6.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.6.js
new file mode 100644
index 0000000000..004fbce2e0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.6.js
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.9.5.6.js';
+
+/**
+ File Name: 15.9.5.6.js
+ ECMA Section: 15.9.5.6 Date.prototype.toLocaleDateString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "date"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We can't test the content of the string,
+ but can verify that the string is parsable by Date.parse
+
+ The toLocaleDateString function is not generic; it generates a runtime error
+ if its 'this' value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
+
+ Note: This test isn't supposed to work with a non-English locale per spec.
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+*/
+
+var SECTION = "15.9.5.6";
+var VERSION = "ECMA_3";
+var TITLE = "Date.prototype.toLocaleDateString()";
+
+var status = '';
+var actual = '';
+var expect = '';
+
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// first, some generic tests -
+
+status = "typeof (now.toLocaleDateString())";
+actual = typeof (now.toLocaleDateString());
+expect = "string";
+addTestCase();
+
+status = "Date.prototype.toLocaleDateString.length";
+actual = Date.prototype.toLocaleDateString.length;
+expect = 0;
+addTestCase();
+
+/* Date.parse is accurate to the second; valueOf() to the millisecond.
+ Here we expect them to coincide, as we expect a time of exactly midnight - */
+status = "(Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0";
+actual = (Date.parse(now.toLocaleDateString()) - (midnight(now)).valueOf()) == 0;
+expect = true;
+addTestCase();
+
+
+
+// 1970
+addDateTestCase(0);
+addDateTestCase(TZ_ADJUST);
+
+
+// 1900
+addDateTestCase(TIME_1900);
+addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+
+// 2000
+addDateTestCase(TIME_2000);
+addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+
+// 29 Feb 2000
+addDateTestCase(UTC_29_FEB_2000);
+addDateTestCase(UTC_29_FEB_2000 - 1000);
+addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+
+// 2005
+addDateTestCase(UTC_1_JAN_2005);
+addDateTestCase(UTC_1_JAN_2005 - 1000);
+addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+
+
+//-----------------------------------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------------------------------
+
+
+function addTestCase()
+{
+ new TestCase(
+ gTestfile,
+ status,
+ expect,
+ actual);
+}
+
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ var givenDate = new Date(date_given_in_milliseconds);
+
+ status = 'Date.parse(' + givenDate + ').toLocaleDateString())';
+ actual = Date.parse(givenDate.toLocaleDateString());
+ expect = Date.parse(midnight(givenDate));
+ addTestCase();
+}
+
+
+function midnight(givenDate)
+{
+ // midnight on the given date -
+ return new Date(givenDate.getFullYear(), givenDate.getMonth(), givenDate.getDate());
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.7.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.7.js
new file mode 100644
index 0000000000..00d2541803
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/15.9.5.7.js
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**
+ File Name: 15.9.5.7.js
+ ECMA Section: 15.9.5.7 Date.prototype.toLocaleTimeString()
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the "time"
+ portion of the Date in the current time zone in a convenient,
+ human-readable form. We test the content of the string by checking
+ that
+
+ new Date(d.toDateString() + " " + d.toLocaleTimeString()) == d
+
+ Author: pschwartau@netscape.com
+ Date: 14 november 2000
+ Revised: 07 january 2002 because of a change in JS Date format:
+ Revised: 21 November 2005 since the string comparison stuff is horked.
+ bclary
+
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118266 (SpiderMonkey)
+ See http://bugzilla.mozilla.org/show_bug.cgi?id=118636 (Rhino)
+*/
+//-----------------------------------------------------------------------------
+var gTestfile = '15.9.5.7.js';
+var SECTION = "15.9.5.7";
+var VERSION = "ECMA_3";
+var TITLE = "Date.prototype.toLocaleTimeString()";
+
+var status = '';
+var actual = '';
+var expect = '';
+var givenDate;
+var year = '';
+var regexp = '';
+var TimeString = '';
+var reducedDateString = '';
+var hopeThisIsLocaleTimeString = '';
+var cnERR ='OOPS! FATAL ERROR: no regexp match in extractLocaleTimeString()';
+
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// first, a couple generic tests -
+
+status = "typeof (now.toLocaleTimeString())";
+actual = typeof (now.toLocaleTimeString());
+expect = "string";
+addTestCase();
+
+status = "Date.prototype.toLocaleTimeString.length";
+actual = Date.prototype.toLocaleTimeString.length;
+expect = 0;
+addTestCase();
+
+// 1970
+addDateTestCase(0);
+addDateTestCase(TZ_ADJUST);
+
+// 1900
+addDateTestCase(TIME_1900);
+addDateTestCase(TIME_1900 - TZ_ADJUST);
+
+// 2000
+addDateTestCase(TIME_2000);
+addDateTestCase(TIME_2000 - TZ_ADJUST);
+
+// 29 Feb 2000
+addDateTestCase(UTC_29_FEB_2000);
+addDateTestCase(UTC_29_FEB_2000 - 1000);
+addDateTestCase(UTC_29_FEB_2000 - TZ_ADJUST);
+
+// Now
+addDateTestCase( TIME_NOW);
+addDateTestCase( TIME_NOW - TZ_ADJUST);
+
+// 2005
+addDateTestCase(UTC_1_JAN_2005);
+addDateTestCase(UTC_1_JAN_2005 - 1000);
+addDateTestCase(UTC_1_JAN_2005 - TZ_ADJUST);
+
+test();
+
+function addTestCase()
+{
+ new TestCase(
+ SECTION,
+ status,
+ expect,
+ actual);
+}
+
+
+function addDateTestCase(date_given_in_milliseconds)
+{
+ var s = 'new Date(' + date_given_in_milliseconds + ')';
+ givenDate = new Date(date_given_in_milliseconds);
+
+ status = 'd = ' + s +
+ '; d == new Date(d.toDateString() + " " + d.toLocaleTimeString())';
+ expect = givenDate.toString();
+ actual = new Date(givenDate.toDateString() +
+ ' ' + givenDate.toLocaleTimeString()).toString();
+ addTestCase();
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/browser.js
new file mode 100644
index 0000000000..4cde9b0629
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/browser.js
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Date/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Date/shell.js
new file mode 100644
index 0000000000..6111c3b934
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Date/shell.js
@@ -0,0 +1,564 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestsubsuite = 'Date';
+
+/*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC
+var TZ_ADJUST = TZ_DIFF * msPerHour;
+var TZ_PST = -8; // offset of Pacific Standard Time from UTC
+var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
+var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+var now = new Date();
+var TIME_NOW = now.valueOf(); //valueOf() is to accurate to the millisecond
+ //Date.parse() is accurate only to the second
+
+/*
+ * Originally, the test suite used a hard-coded value TZ_DIFF = -8.
+ * But that was only valid for testers in the Pacific Standard Time Zone!
+ * We calculate the proper number dynamically for any tester. We just
+ * have to be careful not to use a date subject to Daylight Savings Time...
+ */
+function getTimeZoneDiff()
+{
+ return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
+}
+
+
+/*
+ * Date test "ResultArrays" are hard-coded for Pacific Standard Time.
+ * We must adjust them for the tester's own timezone -
+ */
+function adjustResultArray(ResultArray, msMode)
+{
+ // If the tester's system clock is in PST, no need to continue -
+ if (!PST_DIFF) {return;}
+
+ /* The date gTestcases instantiate Date objects in two different ways:
+ *
+ * millisecond mode: e.g. dt = new Date(10000000);
+ * year-month-day mode: dt = new Date(2000, 5, 1, ...);
+ *
+ * In the first case, the date is measured from Time 0 in Greenwich (i.e. UTC).
+ * In the second case, it is measured with reference to the tester's local timezone.
+ *
+ * In the first case we must correct those values expected for local measurements,
+ * like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc.
+ *
+ * In the second case, it is exactly the other way around -
+ */
+ if (msMode)
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a UTC date.
+ // Shift to the right by the offset between UTC and the tester.
+ var t = ResultArray[TIME] + TZ_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the local hour, day, etc.
+ ResultArray[HOURS] = HourFromTime(t);
+ ResultArray[DAY] = WeekDay(t);
+ ResultArray[DATE] = DateFromTime(t);
+ ResultArray[MONTH] = MonthFromTime(t);
+ ResultArray[YEAR] = YearFromTime(t);
+ }
+ else
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a PST date.
+ // Shift to the left by the offset between PST and the tester.
+ var t = ResultArray[TIME] - PST_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the UTC hour, day, etc.
+ ResultArray[TIME] = t;
+ ResultArray[UTC_HOURS] = HourFromTime(t);
+ ResultArray[UTC_DAY] = WeekDay(t);
+ ResultArray[UTC_DATE] = DateFromTime(t);
+ ResultArray[UTC_MONTH] = MonthFromTime(t);
+ ResultArray[UTC_YEAR] = YearFromTime(t);
+ }
+}
+
+
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
+}
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
+ return ( DaysInYear(y) * msPerDay );
+}
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
+}
+function TimeWithinDay( t ) {
+
+ var r = t % msPerDay;
+
+ if (r < 0)
+ {
+ r += msPerDay;
+ }
+ return r;
+
+}
+function YearNumber( t ) {
+}
+function TimeFromYear( y ) {
+ return ( msPerDay * DayFromYear(y) );
+}
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
+}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+ t + ") case not covered";
+ }
+}
+function YearFromTime( t ) {
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
+
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
+}
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
+
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
+}
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
+}
+function DateFromTime( t ) {
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
+
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
+}
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
+}
+
+// missing daylight savings time adjustment
+
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
+}
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
+}
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+}
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
+}
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
+}
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+}
+
+function DaylightSavingTA( t ) {
+ t = t - LocalTZA();
+
+ var dst_start = GetDSTStart(t);
+ var dst_end = GetDSTEnd(t);
+
+ if ( t >= dst_start && t < dst_end )
+ return msPerHour;
+
+ return 0;
+}
+
+function GetFirstSundayInMonth( t, m ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+// month m 0..11
+// april == 3
+// march == 2
+
+ // set time to first day of month m
+ var time = TimeFromYear(year);
+ for (var i = 0; i < m; ++i)
+ {
+ time += TimeInMonth(i, leap);
+ }
+
+ for ( var first_sunday = time; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
+
+ return first_sunday;
+}
+
+function GetLastSundayInMonth( t, m ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
+
+// month m 0..11
+// april == 3
+// march == 2
+
+ // first day of following month
+ var time = TimeFromYear(year);
+ for (var i = 0; i <= m; ++i)
+ {
+ time += TimeInMonth(i, leap);
+ }
+ // prev day == last day of month
+ time -= msPerDay;
+
+ for ( var last_sunday = time; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
+}
+
+/*
+ 15.9.1.9 Daylight Saving Time Adjustment
+
+ The implementation of ECMAScript should not try to determine whether
+ the exact time was subject to daylight saving time, but just whether
+ daylight saving time would have been in effect if the current
+ daylight saving time algorithm had been used at the time. This avoids
+ complications such as taking into account the years that the locale
+ observed daylight saving time year round.
+*/
+
+/*
+ US DST algorithm
+
+ Before 2007, DST starts first Sunday in April at 2 AM and ends last
+ Sunday in October at 2 AM
+
+ Starting in 2007, DST starts second Sunday in March at 2 AM and ends
+ first Sunday in November at 2 AM
+
+ Note that different operating systems behave differently.
+
+ Fully patched Windows XP uses the 2007 algorithm for all dates while
+ fully patched Fedora Core 6 and RHEL 4 Linux use the algorithm in
+ effect at the time.
+
+ Since pre-2007 DST is a subset of 2007 DST rules, this only affects
+ tests that occur in the period Mar-Apr and Oct-Nov where the two
+ algorithms do not agree.
+
+*/
+
+function GetDSTStart( t )
+{
+ return (GetFirstSundayInMonth(t, 2) + 7*msPerDay + 2*msPerHour - LocalTZA());
+}
+
+function GetDSTEnd( t )
+{
+ return (GetFirstSundayInMonth(t, 10) + 2*msPerHour - LocalTZA());
+}
+
+function GetOldDSTStart( t )
+{
+ return (GetFirstSundayInMonth(t, 3) + 2*msPerHour - LocalTZA());
+}
+
+function GetOldDSTEnd( t )
+{
+ return (GetLastSundayInMonth(t, 9) + 2*msPerHour - LocalTZA());
+}
+
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
+}
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
+
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
+
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
+}
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
+
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
+
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
+
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
+
+ var leap = InLeapYear( t );
+
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
+
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
+
+ return ( (Day(t)) + date - 1 );
+}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
+
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
+
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
+
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+}
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.NEGATIVE_INFINITY ) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
+}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
+
+ return ( ToInteger( t ) );
+}
+function ToInteger( t ) {
+ t = Number( t );
+
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( t < 0 ) ? -1 : 1;
+
+ return ( sign * Math.floor( Math.abs( t ) ) );
+}
+function Enumerate ( o ) {
+ var p;
+ for ( p in o ) {
+ print( p +": " + o[p] );
+ }
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.1.1.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.1.1.js
new file mode 100644
index 0000000000..6910d76f15
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.1.1.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * joerg.schaible@gmx.de
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 27 Nov 2002
+ * SUMMARY: Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1).
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.11.1.1.js';
+var UBound = 0;
+var BUGNUMBER = '';
+var summary = 'Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1)';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+function otherScope(msg)
+{
+ return Error(msg);
+}
+
+
+status = inSection(1);
+var err1 = Error('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = otherScope('msg2');
+actual = examineThis(err2, 'msg2');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = otherScope();
+actual = examineThis(err3, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = eval("Error('msg4')");
+actual = examineThis(err4, 'msg4');
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Searches err.toString() for err.name + ':' + err.message,
+ * with possible whitespace on each side of the colon sign.
+ *
+ * We allow for no colon in case err.message was not provided by the user.
+ * In such a case, SpiderMonkey and Rhino currently set err.message = '',
+ * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case.
+ *
+ * If this is ever changed to a non-empty string, e.g. 'undefined',
+ * you may have to modify |pattern| to take that into account -
+ *
+ */
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.4.4-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.4.4-1.js
new file mode 100644
index 0000000000..00f9503041
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.4.4-1.js
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * d-russo@ti.com, pschwartau@netscape.com, joerg.schaible@gmx.de
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 22 Jan 2002
+ * SUMMARY: Testing Error.prototype.toString()
+ *
+ * Revised: 25 Nov 2002
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=181909
+ *
+ * Note that ECMA-262 3rd Edition Final, Section 15.11.4.4 states that
+ * Error.prototype.toString() returns an implementation-dependent string.
+ * Therefore any testcase on this property is somewhat arbitrary.
+ *
+ * However, d-russo@ti.com pointed out that Rhino was returning this:
+ *
+ * js> err = new Error()
+ * undefined: undefined
+ *
+ * js> err = new Error("msg")
+ * undefined: msg
+ *
+ *
+ * We expect Rhino to return what SpiderMonkey currently does:
+ *
+ * js> err = new Error()
+ * Error
+ *
+ * js> err = new Error("msg")
+ * Error: msg
+ *
+ *
+ * i.e. we expect err.toString() === err.name if err.message is not defined;
+ * otherwise, we expect err.toString() === err.name + ': ' + err.message.
+ *
+ * See also ECMA 15.11.4.2, 15.11.4.3
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.11.4.4-1.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing Error.prototype.toString()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+status = inSection(1);
+var err1 = new Error('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = new Error(err1);
+actual = examineThis(err2, err1);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = new Error();
+actual = examineThis(err3, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = new Error(EMPTY_STRING);
+actual = examineThis(err4, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+// now generate a run-time error -
+status = inSection(5);
+try
+{
+ eval('1=2');
+}
+catch(err5)
+{
+ actual = examineThis(err5, '.*');
+}
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Searches err.toString() for err.name + ':' + err.message,
+ * with possible whitespace on each side of the colon sign.
+ *
+ * We allow for no colon in case err.message was not provided by the user.
+ * In such a case, SpiderMonkey and Rhino currently set err.message = '',
+ * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case.
+ *
+ * If this is ever changed to a non-empty string, e.g. 'undefined',
+ * you may have to modify |pattern| to take that into account -
+ *
+ */
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-001.js
new file mode 100644
index 0000000000..c6248cc7c1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-001.js
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@fastmail.fm, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 14 April 2003
+ * SUMMARY: Prototype of predefined error objects should be DontEnum
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.11.7.6-001.js';
+var UBound = 0;
+var BUGNUMBER = 201989;
+var summary = 'Prototype of predefined error objects should be DontEnum';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Tests that |F.prototype| is not enumerable in |F|
+ */
+function testDontEnum(F)
+{
+ var proto = F.prototype;
+
+ for (var prop in F)
+ {
+ if (F[prop] === proto)
+ return false;
+ }
+ return true;
+}
+
+
+var list = [
+ "Error",
+ "ConversionError",
+ "EvalError",
+ "RangeError",
+ "ReferenceError",
+ "SyntaxError",
+ "TypeError",
+ "URIError"
+ ];
+
+
+for (i in list)
+{
+ var F = this[list[i]];
+
+ // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
+ if (F)
+ {
+ status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|';
+ actual = testDontEnum(F);
+ expect = true;
+ addThis();
+ }
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-002.js
new file mode 100644
index 0000000000..a9da1c4e4e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-002.js
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@fastmail.fm, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 14 April 2003
+ * SUMMARY: Prototype of predefined error objects should be DontDelete
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.11.7.6-002.js';
+var UBound = 0;
+var BUGNUMBER = 201989;
+var summary = 'Prototype of predefined error objects should be DontDelete';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Tests that |F.prototype| is DontDelete
+ */
+function testDontDelete(F)
+{
+ var e;
+ var orig = F.prototype;
+ try
+ {
+ delete F.prototype;
+ }
+ catch (e)
+ {
+ }
+ return F.prototype === orig;
+}
+
+
+var list = [
+ "Error",
+ "ConversionError",
+ "EvalError",
+ "RangeError",
+ "ReferenceError",
+ "SyntaxError",
+ "TypeError",
+ "URIError"
+ ];
+
+
+for (i in list)
+{
+ var F = this[list[i]];
+
+ // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
+ if (F)
+ {
+ status = 'Testing DontDelete attribute of |' + list[i] + '.prototype|';
+ actual = testDontDelete(F);
+ expect = true;
+ addThis();
+ }
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-003.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-003.js
new file mode 100644
index 0000000000..af45b2112d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/15.11.7.6-003.js
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@fastmail.fm, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 14 April 2003
+ * SUMMARY: Prototype of predefined error objects should be ReadOnly
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=201989
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.11.7.6-003.js';
+var UBound = 0;
+var BUGNUMBER = 201989;
+var summary = 'Prototype of predefined error objects should be ReadOnly';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Tests that |F.prototype| is ReadOnly
+ */
+function testReadOnly(F)
+{
+ var e;
+ var orig = F.prototype;
+ try
+ {
+ F.prototype = new Object();
+ }
+ catch (e)
+ {
+ }
+ return F.prototype === orig;
+}
+
+
+var list = [
+ "Error",
+ "ConversionError",
+ "EvalError",
+ "RangeError",
+ "ReferenceError",
+ "SyntaxError",
+ "TypeError",
+ "URIError"
+ ];
+
+
+for (i in list)
+{
+ var F = this[list[i]];
+
+ // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not.
+ if (F)
+ {
+ status = 'Testing ReadOnly attribute of |' + list[i] + '.prototype|';
+ actual = testReadOnly(F);
+ expect = true;
+ addThis();
+ }
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/binding-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/binding-001.js
new file mode 100644
index 0000000000..ea2dd6042f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/binding-001.js
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * brendan@mozilla.org, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-08-27
+ *
+ * SUMMARY: Testing binding of function names
+ *
+ * Brendan:
+ *
+ * "... the question is, does Rhino bind 'sum' in the global object
+ * for the following test? If it does, it's buggy.
+ *
+ * var f = function sum(){};
+ * print(sum); // should fail with 'sum is not defined' "
+ *
+ */
+
+//-----------------------------------------------------------------------------
+var gTestfile = 'binding-001.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing binding of function names';
+var ERR_REF_YES = 'ReferenceError';
+var ERR_REF_NO = 'did NOT generate a ReferenceError';
+var statusitems = [];
+var actualvalues = [];
+var expectedvalues = [];
+var status = summary;
+var actual = ERR_REF_NO;
+var expect= ERR_REF_YES;
+
+
+try
+{
+ var f = function sum(){};
+ print(sum);
+}
+catch (e)
+{
+ status = 'Section 1 of test';
+ actual = e instanceof ReferenceError;
+ expect = true;
+ addThis();
+
+
+ /*
+ * This test is more literal, and one day may not be valid.
+ * Searching for literal string "ReferenceError" in e.toString()
+ */
+ status = 'Section 2 of test';
+ var match = e.toString().search(/ReferenceError/);
+ actual = (match > -1);
+ expect = true;
+ addThis();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = isReferenceError(actual);
+ expectedvalues[UBound] = isReferenceError(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+// converts a Boolean result into a textual result -
+function isReferenceError(bResult)
+{
+ return bResult? ERR_REF_YES : ERR_REF_NO;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181654.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181654.js
new file mode 100644
index 0000000000..3fe80f15ac
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181654.js
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * joerg.schaible@gmx.de
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 23 Nov 2002
+ * SUMMARY: Calling toString for an object derived from the Error class
+ * results in an TypeError (Rhino only)
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=181654
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-181654.js';
+var UBound = 0;
+var BUGNUMBER = '181654';
+var summary = 'Calling toString for an object derived from the Error class should be possible.';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+// derive MyError from Error
+function MyError( msg )
+{
+ this.message = msg;
+}
+MyError.prototype = new Error();
+MyError.prototype.name = "MyError";
+
+
+status = inSection(1);
+var err1 = new MyError('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = new MyError(String(err1));
+actual = examineThis(err2, err1);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = new MyError();
+actual = examineThis(err3, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = new MyError(EMPTY_STRING);
+actual = examineThis(err4, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+// now generate an error -
+status = inSection(5);
+try
+{
+ throw new MyError("thrown");
+}
+catch(err5)
+{
+ actual = examineThis(err5, "thrown");
+}
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Searches err.toString() for err.name + ':' + err.message,
+ * with possible whitespace on each side of the colon sign.
+ *
+ * We allow for no colon in case err.message was not provided by the user.
+ * In such a case, SpiderMonkey and Rhino currently set err.message = '',
+ * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case.
+ *
+ * If this is ever changed to a non-empty string, e.g. 'undefined',
+ * you may have to modify |pattern| to take that into account -
+ *
+ */
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181914.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181914.js
new file mode 100644
index 0000000000..f4d1f224c8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-181914.js
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * joerg.schaible@gmx.de, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 25 Nov 2002
+ * SUMMARY: Calling a user-defined superconstructor
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=181914, esp. Comment 10.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-181914.js';
+var UBound = 0;
+var BUGNUMBER = '181914';
+var summary = 'Calling a user-defined superconstructor';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var EMPTY_STRING = '';
+var EXPECTED_FORMAT = 0;
+
+
+// make a user-defined version of the Error constructor
+function _Error(msg)
+{
+ this.message = msg;
+}
+_Error.prototype = new Error();
+_Error.prototype.name = '_Error';
+
+
+// derive MyApplyError from _Error
+function MyApplyError(msg)
+{
+ if(this instanceof MyApplyError)
+ _Error.apply(this, arguments);
+ else
+ return new MyApplyError(msg);
+}
+MyApplyError.prototype = new _Error();
+MyApplyError.prototype.name = "MyApplyError";
+
+
+// derive MyCallError from _Error
+function MyCallError(msg)
+{
+ if(this instanceof MyCallError)
+ _Error.call(this, msg);
+ else
+ return new MyCallError(msg);
+}
+MyCallError.prototype = new _Error();
+MyCallError.prototype.name = "MyCallError";
+
+
+function otherScope(msg)
+{
+ return MyApplyError(msg);
+}
+
+
+status = inSection(1);
+var err1 = new MyApplyError('msg1');
+actual = examineThis(err1, 'msg1');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(2);
+var err2 = new MyCallError('msg2');
+actual = examineThis(err2, 'msg2');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(3);
+var err3 = MyApplyError('msg3');
+actual = examineThis(err3, 'msg3');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(4);
+var err4 = MyCallError('msg4');
+actual = examineThis(err4, 'msg4');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(5);
+var err5 = otherScope('msg5');
+actual = examineThis(err5, 'msg5');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(6);
+var err6 = otherScope();
+actual = examineThis(err6, EMPTY_STRING);
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(7);
+var err7 = eval("MyApplyError('msg7')");
+actual = examineThis(err7, 'msg7');
+expect = EXPECTED_FORMAT;
+addThis();
+
+status = inSection(8);
+var err8;
+try
+{
+ throw MyApplyError('msg8');
+}
+catch(e)
+{
+ if(e instanceof Error)
+ err8 = e;
+}
+actual = examineThis(err8, 'msg8');
+expect = EXPECTED_FORMAT;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+// Searches |err.toString()| for |err.name + ':' + err.message|
+function examineThis(err, msg)
+{
+ var pattern = err.name + '\\s*:?\\s*' + msg;
+ return err.toString().search(RegExp(pattern));
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-58946.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-58946.js
new file mode 100644
index 0000000000..97212c88a0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-58946.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-58946.js';
+//-------------------------------------------------------------------------------------------------
+var BUGNUMBER = '58946';
+var stat = 'Testing a return statement inside a catch statement inside a function';
+
+test();
+
+function test() {
+ enterFunc ("test");
+ printBugNumber(BUGNUMBER);
+ printStatus (stat);
+
+ expect = 'PASS';
+
+ function f()
+ {
+ try
+ {
+ throw 'PASS';
+ }
+ catch(e)
+ {
+ return e;
+ }
+ }
+
+ actual = f();
+
+ reportCompare(expect, actual, stat);
+
+ exitFunc ("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-95101.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-95101.js
new file mode 100644
index 0000000000..b7ef074350
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/regress-95101.js
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 13 August 2001
+ *
+ * SUMMARY: Invoking an undefined function should produce a ReferenceError
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=95101
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-95101.js';
+var UBound = 0;
+var BUGNUMBER = 95101;
+var summary = 'Invoking an undefined function should produce a ReferenceError';
+var msgERR_REF_YES = 'ReferenceError';
+var msgERR_REF_NO = 'did NOT generate a ReferenceError';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+try
+{
+ xxxyyyzzz();
+}
+catch (e)
+{
+ status = 'Section 1 of test';
+ actual = e instanceof ReferenceError;
+ expect = true;
+ addThis();
+
+
+ /*
+ * This test is more literal, and may one day be invalid.
+ * Searching for literal string "ReferenceError" in e.toString()
+ */
+ status = 'Section 2 of test';
+ var match = e.toString().search(/ReferenceError/);
+ actual = (match > -1);
+ expect = true;
+ addThis();
+}
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = isReferenceError(actual);
+ expectedvalues[UBound] = isReferenceError(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+// converts a Boolean result into a textual result -
+function isReferenceError(bResult)
+{
+ return bResult? msgERR_REF_YES : msgERR_REF_NO;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/shell.js
new file mode 100644
index 0000000000..6c671f1eea
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Exceptions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Exceptions';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-1.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-1.js
new file mode 100644
index 0000000000..1e7e0254bf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-1.js
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 11 Feb 2002
+ * SUMMARY: Testing functions having duplicate formal parameter names
+ *
+ * Note: given function f(x,x,x,x) {return x;}; f(1,2,3,4) should return 4.
+ * See ECMA-262 3rd Edition Final Section 10.1.3: Variable Instantiation
+ *
+ * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=124900
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '10.1.3-1.js';
+var UBound = 0;
+var BUGNUMBER = 124900;
+var summary = 'Testing functions having duplicate formal parameter names';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f1(x,x)
+{
+ return x;
+}
+status = inSection(1);
+actual = f1(1,2);
+expect = 2;
+addThis();
+
+
+function f2(x,x,x)
+{
+ return x*x*x;
+}
+status = inSection(2);
+actual = f2(1,2,3);
+expect = 27;
+addThis();
+
+
+function f3(x,x,x,x)
+{
+ return 'a' + x + 'b' + x + 'c' + x ;
+}
+status = inSection(3);
+actual = f3(1,2,3,4);
+expect = 'a4b4c4';
+addThis();
+
+
+/*
+ * If the value of the last duplicate parameter is not provided by
+ * the function caller, the value of this parameter is undefined
+ */
+function f4(x,a,b,x,z)
+{
+ return x;
+}
+status = inSection(4);
+actual = f4(1,2);
+expect = undefined;
+addThis();
+
+
+/*
+ * f.toString() should preserve any duplicate formal parameter names that exist
+ */
+function f5(x,x,x,x)
+{
+}
+status = inSection(5);
+actual = f5.toString().match(/\((.*)\)/)[1];
+actual = actual.replace(/\s/g, ''); // for definiteness, remove any white space
+expect = 'x,x,x,x';
+addThis();
+
+
+function f6(x,x,x,x)
+{
+ var ret = [];
+
+ for (var i=0; i<arguments.length; i++)
+ ret.push(arguments[i]);
+
+ return ret.toString();
+}
+status = inSection(6);
+actual = f6(1,2,3,4);
+expect = '1,2,3,4';
+addThis();
+
+
+/*
+ * This variation (assigning to x inside f) is from nboyd@atg.com
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=124900
+ */
+function f7(x,x,x,x)
+{
+ x = 999;
+ var ret = [];
+
+ for (var i=0; i<arguments.length; i++)
+ ret.push(arguments[i]);
+
+ return ret.toString();
+}
+status = inSection(7);
+actual = f7(1,2,3,4);
+expect = '1,2,3,999';
+addThis();
+
+
+/*
+ * Same as above, but with |var| keyword added -
+ */
+function f8(x,x,x,x)
+{
+ var x = 999;
+ var ret = [];
+
+ for (var i=0; i<arguments.length; i++)
+ ret.push(arguments[i]);
+
+ return ret.toString();
+}
+status = inSection(8);
+actual = f8(1,2,3,4);
+expect = '1,2,3,999';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-2.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-2.js
new file mode 100644
index 0000000000..b2e22e6c55
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3-2.js
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Martin Honnen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '10.1.3-2.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 395907;
+var summary = 'eval of function declaration should change existing variable';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'typeof x: number, typeof x: function, x(): true';
+ var x = "string";
+ function f () {
+ var x = 0;
+ actual += 'typeof x: ' + (typeof x) + ', ';
+ eval('function x() { return true; }');
+ actual += 'typeof x: ' + (typeof x) + ', ';
+ actual += 'x(): ' + x();
+ }
+ f();
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3.js
new file mode 100644
index 0000000000..45a81f1f3a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.3.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '10.1.3.js';
+
+/**
+ ECMA Section: 10.1.3: Variable Instantiation
+ FunctionDeclarations are processed before VariableDeclarations, and
+ VariableDeclarations don't replace existing values with undefined
+*/
+
+test();
+
+function f()
+{
+ var x;
+
+ return typeof x;
+
+ function x()
+ {
+ return 7;
+ }
+}
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("ECMA Section: 10.1.3: Variable Instantiation.");
+ printBugNumber (17290);
+
+ reportCompare ("function", f(), "Declaration precedence test");
+
+ exitFunc("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.4-1.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.4-1.js
new file mode 100644
index 0000000000..896841fa29
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.1.4-1.js
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '10.1.4-1.js';
+
+/**
+ ECMA Section: 10.1.4.1 Entering An Execution Context
+ ECMA says:
+ * Global Code, Function Code
+ Variable instantiation is performed using the global object as the
+ variable object and using property attributes { DontDelete }.
+
+ * Eval Code
+ Variable instantiation is performed using the calling context's
+ variable object and using empty property attributes.
+*/
+
+var BUGNUMBER = '(none)';
+var summary = '10.1.4.1 Entering An Execution Context';
+var actual = '';
+var expect = '';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var y;
+ eval("var x = 1");
+
+ if (delete y)
+ reportCompare('PASS', 'FAIL', "Expected *NOT* to be able to delete y");
+
+ if (typeof x == "undefined")
+ reportCompare('PASS', 'FAIL', "x did not remain defined after eval()");
+ else if (x != 1)
+ reportCompare('PASS', 'FAIL', "x did not retain it's value after eval()");
+
+ if (!delete x)
+ reportCompare('PASS', 'FAIL', "Expected to be able to delete x");
+
+ reportCompare('PASS', 'PASS', '10.1.4.1 Entering An Execution Context');
+
+ exitFunc("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.6.1-01.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.6.1-01.js
new file mode 100755
index 0000000000..6fbe85e19f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/10.6.1-01.js
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bryant Chen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '10.6.1-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 290774;
+var summary = 'activation object never delegates to Object.prototype';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var toStringResult;
+var evalResult;
+var watchResult;
+var parseIntResult;
+
+var eval = 'fooEval';
+var watch = undefined;
+var parseInt = 'fooParseInt';
+
+
+function toString()
+{
+ return 'fooString';
+}
+
+function normal()
+{
+ toStringResult = toString;
+ evalResult = eval;
+ watchResult = watch;
+ parseIntResult = parseInt;
+}
+
+function outerinnervar()
+{
+ toStringResult = toString;
+ evalResult = eval;
+ watchResult = watch;
+ parseIntResult = parseInt;
+ function inner()
+ {
+ // addition of any statement
+ // which accesses a variable
+ // from the outer scope causes the bug
+ printStatus(toString);
+ }
+}
+
+expect = true;
+
+printStatus('normal');
+printStatus('======');
+normal();
+
+printStatus('toStringResult ' + toStringResult);
+printStatus('toString ' + toString);
+actual = ((toStringResult + '') == (toString + ''));
+reportCompare(expect, actual, inSection(1));
+
+printStatus('evalResult ' + evalResult);
+printStatus('eval ' + eval);
+actual = ((evalResult + '') == (eval + ''));
+reportCompare(expect, actual, inSection(2));
+
+printStatus('watchResult ' + watchResult);
+printStatus('watch ' + watch);
+actual = ((watchResult + '') == (watch + ''));
+reportCompare(expect, actual, inSection(3));
+
+printStatus('parseIntResult ' + parseIntResult);
+printStatus('parseInt ' + parseInt);
+actual = ((parseIntResult + '') == (parseInt + ''));
+reportCompare(expect, actual, inSection(4));
+
+printStatus('outerinner');
+printStatus('==========');
+
+outerinnervar();
+
+printStatus('toStringResult ' + toStringResult);
+printStatus('toString ' + toString);
+actual = ((toStringResult + '') == (toString + ''));
+reportCompare(expect, actual, inSection(5));
+
+
+printStatus('evalResult ' + evalResult);
+printStatus('eval ' + eval);
+actual = ((evalResult + '') == (eval + ''));
+reportCompare(expect, actual, inSection(6));
+
+printStatus('watchResult ' + watchResult);
+printStatus('watch ' + watch);
+actual = ((watchResult + '') == (watch + ''));
+reportCompare(expect, actual, inSection(7));
+
+printStatus('parseIntResult ' + parseIntResult);
+printStatus('parseInt ' + parseInt);
+actual = ((parseIntResult + '') == (parseInt + ''));
+reportCompare(expect, actual, inSection(8));
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-23346.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-23346.js
new file mode 100644
index 0000000000..6283d886f0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-23346.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-23346.js';
+
+var CALL_CALLED = "PASSED";
+
+test();
+
+function f(x)
+{
+ if (x)
+ return call();
+
+ return "FAILED!";
+}
+
+function call()
+{
+ return CALL_CALLED;
+}
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("ECMA Section: 10.1.3: Variable Instantiation.");
+ printBugNumber (23346);
+
+ reportCompare ("PASSED", f(true),
+ "Unqualified reference should not see Function.prototype");
+
+ exitFunc("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-448595-01.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-448595-01.js
new file mode 100755
index 0000000000..f303199b51
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/regress-448595-01.js
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Oliver Hunt
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-448595-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 448595;
+var summary = 'scope chain var declaration with initialiser in |with| clauses';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var f;
+
+ expect = 'bar';
+
+ f = function(){
+ var e = "bar";
+ with({e:"foo"}) {
+ var e = "wibble";
+ };
+
+ actual = e;
+ }
+
+ f();
+
+ reportCompare(expect, actual, summary + ': with');
+
+ f = function(){
+ var e = "bar";
+ try
+ {
+ throw {e:"foo"};
+ }
+ catch(e) {
+ var e = "wibble";
+ };
+
+ actual = e;
+ }
+
+ f();
+
+ reportCompare(expect, actual, summary + ': catch');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/shell.js
new file mode 100644
index 0000000000..1d353cff74
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/ExecutionContexts/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'ExecutionContexts';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-01.js
new file mode 100755
index 0000000000..fd47d5d86b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-01.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.10-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 396969;
+var summary = '11.10 - & should evaluate operands in order';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'o.valueOf, p.valueOf';
+ var actualval;
+ var expectval = 2;
+
+ var o = {
+ valueOf: (function (){ actual += 'o.valueOf'; return this.value}),
+ value:42
+ };
+
+ var p = {
+ valueOf: (function (){ actual += ', p.valueOf'; return this.value}),
+ value:2
+ };
+
+ actualval = (o & p);
+
+ reportCompare(expectval, actualval, summary + ': value');
+ reportCompare(expect, actual, summary + ': order');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-02.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-02.js
new file mode 100755
index 0000000000..8f387c1349
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-02.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.10-02.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 396969;
+var summary = '11.10 - ^ should evaluate operands in order';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'o.valueOf, p.valueOf';
+ var actualval;
+ var expectval = 40;
+
+ var o = {
+ valueOf: (function (){ actual += 'o.valueOf'; return this.value}),
+ value:42
+ };
+
+ var p = {
+ valueOf: (function (){ actual += ', p.valueOf'; return this.value}),
+ value:2
+ };
+
+ actualval = (o ^ p);
+
+ reportCompare(expectval, actualval, summary + ': value');
+ reportCompare(expect, actual, summary + ': order');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-03.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-03.js
new file mode 100755
index 0000000000..99af0f87c5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.10-03.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.10-03.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 396969;
+var summary = '11.10 - | should evaluate operands in order';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'o.valueOf, p.valueOf';
+ var actualval;
+ var expectval = 42;
+
+ var o = {
+ valueOf: (function (){ actual += 'o.valueOf'; return this.value}),
+ value:42
+ };
+
+ var p = {
+ valueOf: (function (){ actual += ', p.valueOf'; return this.value}),
+ value:2
+ };
+
+ actualval = (o | p);
+
+ reportCompare(expectval, actualval, summary + ': value');
+ reportCompare(expect, actual, summary + ': order');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.6.1-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.6.1-1.js
new file mode 100644
index 0000000000..8854c499f2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.6.1-1.js
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * bzbarsky@mit.edu, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 14 Mar 2003
+ * SUMMARY: Testing left-associativity of the + operator
+ *
+ * See ECMA-262 Ed.3, Section 11.6.1, "The Addition operator"
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=196290
+ *
+ * The upshot: |a + b + c| should always equal |(a + b) + c|
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '11.6.1-1.js';
+var UBound = 0;
+var BUGNUMBER = 196290;
+var summary = 'Testing left-associativity of the + operator';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = 1 + 1 + 'px';
+expect = '2px';
+addThis();
+
+status = inSection(2);
+actual = 'px' + 1 + 1;
+expect = 'px11';
+addThis();
+
+status = inSection(3);
+actual = 1 + 1 + 1 + 'px';
+expect = '3px';
+addThis();
+
+status = inSection(4);
+actual = 1 + 1 + 'a' + 1 + 1 + 'b';
+expect = '2a11b';
+addThis();
+
+/*
+ * The next sections test the + operator via eval()
+ */
+status = inSection(5);
+actual = sumThese(1, 1, 'a', 1, 1, 'b');
+expect = '2a11b';
+addThis();
+
+status = inSection(6);
+actual = sumThese(new Number(1), new Number(1), 'a');
+expect = '2a';
+addThis();
+
+status = inSection(7);
+actual = sumThese('a', new Number(1), new Number(1));
+expect = 'a11';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+/*
+ * Applies the + operator to the provided arguments via eval().
+ *
+ * Form an eval string of the form 'arg1 + arg2 + arg3', but
+ * remember to add double-quotes inside the eval string around
+ * any argument that is of string type. For example, suppose the
+ * arguments were 11, 'a', 22. Then the eval string should be
+ *
+ * arg1 + quoteThis(arg2) + arg3
+ *
+ * If we didn't put double-quotes around the string argument,
+ * we'd get this for an eval string:
+ *
+ * '11 + a + 22'
+ *
+ * If we eval() this, we get 'ReferenceError: a is not defined'.
+ * With proper quoting, we get eval('11 + "a" + 22') as desired.
+ */
+function sumThese()
+{
+ var sEval = '';
+ var arg;
+ var i;
+
+ var L = arguments.length;
+ for (i=0; i<L; i++)
+ {
+ arg = arguments[i];
+ if (typeof arg === 'string')
+ arg = quoteThis(arg);
+
+ if (i < L-1)
+ sEval += arg + ' + ';
+ else
+ sEval += arg;
+ }
+
+ return eval(sEval);
+}
+
+
+function quoteThis(x)
+{
+ return '"' + x + '"';
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.1-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.1-01.js
new file mode 100755
index 0000000000..05f9622ce2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.1-01.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.7.1-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 396969;
+var summary = '11.7.1 - << should evaluate operands in order';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'o.valueOf, p.valueOf';
+ var actualval;
+ var expectval = 168;
+
+ var o = {
+ valueOf: (function (){ actual += 'o.valueOf'; return this.value}),
+ value:42
+ };
+
+ var p = {
+ valueOf: (function (){ actual += ', p.valueOf'; return this.value}),
+ value:2
+ };
+
+ actualval = (o << p);
+
+ reportCompare(expectval, actualval, summary + ': value');
+ reportCompare(expect, actual, summary + ': order');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.2-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.2-01.js
new file mode 100755
index 0000000000..64e426888a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.2-01.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.7.2-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 396969;
+var summary = '11.7.2 - >> should evaluate operands in order';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'o.valueOf, p.valueOf';
+ var actualval;
+ var expectval = 10;
+
+ var o = {
+ valueOf: (function (){ actual += 'o.valueOf'; return this.value}),
+ value:42
+ };
+
+ var p = {
+ valueOf: (function (){ actual += ', p.valueOf'; return this.value}),
+ value:2
+ };
+
+ actualval = (o >> p);
+
+ reportCompare(expectval, actualval, summary + ': value');
+ reportCompare(expect, actual, summary + ': order');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.3-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.3-01.js
new file mode 100755
index 0000000000..d5af3b86d4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.7.3-01.js
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.7.3-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 396969;
+var summary = '11.7.3 - >>> should evaluate operands in order';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'o.valueOf, p.valueOf';
+ var actualval;
+ var expectval = 10;
+
+ var o = {
+ valueOf: (function (){ actual += 'o.valueOf'; return this.value}),
+ value:42
+ };
+
+ var p = {
+ valueOf: (function (){ actual += ', p.valueOf'; return this.value}),
+ value:2
+ };
+
+ actualval = (o >>> p);
+
+ reportCompare(expectval, actualval, summary + ': value');
+ reportCompare(expect, actual, summary + ': order');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.9.6-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.9.6-1.js
new file mode 100644
index 0000000000..1e8f59e400
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/11.9.6-1.js
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 20 Feb 2002
+ * SUMMARY: Testing the comparison |undefined === null|
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=126722
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '11.9.6-1.js';
+var UBound = 0;
+var BUGNUMBER = 126722;
+var summary = 'Testing the comparison |undefined === null|';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+if (undefined === null)
+ actual = true;
+else
+ actual = false;
+expect = false;
+addThis();
+
+
+
+status = inSection(2);
+switch(true)
+{
+case (undefined === null) :
+ actual = true;
+ break;
+
+default:
+ actual = false;
+}
+expect = false;
+addThis();
+
+
+
+status = inSection(3);
+function f3(x)
+{
+ var res = false;
+
+ switch(true)
+ {
+ case (x === null) :
+ res = true;
+ break;
+
+ default:
+ // do nothing
+ }
+
+ return res;
+}
+
+actual = f3(undefined);
+expect = false;
+addThis();
+
+
+
+status = inSection(4);
+function f4(arr)
+{
+ var elt = '';
+ var res = false;
+
+ for (i=0; i<arr.length; i++)
+ {
+ elt = arr[i];
+
+ switch(true)
+ {
+ case (elt === null) :
+ res = true;
+ break;
+
+ default:
+ // do nothing
+ }
+ }
+
+ return res;
+}
+
+var arr = Array('a', undefined);
+actual = f4(arr);
+expect = false;
+addThis();
+
+
+
+status = inSection(5);
+function f5(arr)
+{
+ var len = arr.length;
+
+ for(var i=0; (arr[i]===undefined) && (i<len); i++)
+ ; //do nothing
+
+ return i;
+}
+
+/*
+ * An array of 5 undefined elements. Note:
+ *
+ * The return value of eval(a STATEMENT) is undefined.
+ * A non-existent PROPERTY is undefined, not a ReferenceError.
+ * No undefined element exists AFTER trailing comma at end.
+ *
+ */
+var arrUndef = [ , undefined, eval('var x = 0'), this.NOT_A_PROPERTY, , ];
+actual = f5(arrUndef);
+expect = 5;
+addThis();
+
+
+
+status = inSection(6);
+function f6(arr)
+{
+ var len = arr.length;
+
+ for(var i=0; (arr[i]===null) && (i<len); i++)
+ ; //do nothing
+
+ return i;
+}
+
+/*
+ * Use same array as above. This time we're comparing to |null|, so we expect 0
+ */
+actual = f6(arrUndef);
+expect = 0;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Expressions/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/shell.js
new file mode 100644
index 0000000000..8f5d1129d5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Expressions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Expressions';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001-n.js b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001-n.js
new file mode 100644
index 0000000000..71ed2fbb08
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001-n.js
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'fe-001-n.js';
+
+DESCRIPTION = "Previous statement should have thrown a ReferenceError";
+EXPECTED = "error";
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+ printStatus ("Function Expression test.");
+
+ var x = function f(){return "inner";}();
+ var y = f();
+ reportCompare('PASS', 'FAIL', "Previous statement should have thrown a ReferenceError");
+
+ exitFunc ("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001.js b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001.js
new file mode 100644
index 0000000000..366c5fd472
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001.js
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'fe-001.js';
+
+if (1) function f() {return 1;}
+if (0) function f() {return 0;}
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Function Expression Statements basic test.");
+
+ reportCompare (1, f(), "Both functions were defined.");
+
+ exitFunc ("test");
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-002.js b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-002.js
new file mode 100644
index 0000000000..d602b01b09
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-002.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'fe-002.js';
+
+function f()
+{
+ return "outer";
+}
+
+function test()
+{
+ enterFunc ("test");
+ printStatus ("Function Expression test.");
+
+ var x = function f(){return "inner";}();
+
+ reportCompare ("outer", f(),
+ "Inner function statement should not have been called.");
+
+ exitFunc ("test");
+}
+
+test();
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/shell.js
new file mode 100644
index 0000000000..ecf5f4798f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/FunExpr/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'FunExpr';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.3-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.3-1.js
new file mode 100644
index 0000000000..ef51379e4f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.3-1.js
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor3@apochta.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 21 May 2002
+ * SUMMARY: ECMA conformance of Function.prototype.apply
+ *
+ * Function.prototype.apply(thisArg, argArray)
+ *
+ * See ECMA-262 Edition 3 Final, Section 15.3.4.3
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.3.4.3-1.js';
+var UBound = 0;
+var BUGNUMBER = 145791;
+var summary = 'Testing ECMA conformance of Function.prototype.apply';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function F0(a)
+{
+ return "" + this + arguments.length;
+}
+
+function F1(a)
+{
+ return "" + this + a;
+}
+
+function F2()
+{
+ return "" + this;
+}
+
+
+
+/*
+ * Function.prototype.apply.length should return 2
+ */
+status = inSection(1);
+actual = Function.prototype.apply.length;
+expect = 2;
+addThis();
+
+
+/*
+ * When |thisArg| is not provided to the apply() method, the
+ * called function must be passed the global object as |this|
+ */
+status = inSection(2);
+actual = F0.apply();
+expect = "" + this + 0;
+addThis();
+
+
+/*
+ * If |argArray| is not provided to the apply() method, the
+ * called function should be invoked with an empty argument list
+ */
+status = inSection(3);
+actual = F0.apply("");
+expect = "" + "" + 0;
+addThis();
+
+status = inSection(4);
+actual = F0.apply(true);
+expect = "" + true + 0;
+addThis();
+
+
+/*
+ * Function.prototype.apply(x) and
+ * Function.prototype.apply(x, undefined) should return the same result
+ */
+status = inSection(5);
+actual = F1.apply(0, undefined);
+expect = F1.apply(0);
+addThis();
+
+status = inSection(6);
+actual = F1.apply("", undefined);
+expect = F1.apply("");
+addThis();
+
+status = inSection(7);
+actual = F1.apply(null, undefined);
+expect = F1.apply(null);
+addThis();
+
+status = inSection(8);
+actual = F1.apply(undefined, undefined);
+expect = F1.apply(undefined);
+addThis();
+
+
+/*
+ * Function.prototype.apply(x) and
+ * Function.prototype.apply(x, null) should return the same result
+ */
+status = inSection(9);
+actual = F1.apply(0, null);
+expect = F1.apply(0);
+addThis();
+
+status = inSection(10);
+actual = F1.apply("", null);
+expect = F1.apply("");
+addThis();
+
+status = inSection(11);
+actual = F1.apply(null, null);
+expect = F1.apply(null);
+addThis();
+
+status = inSection(12);
+actual = F1.apply(undefined, null);
+expect = F1.apply(undefined);
+addThis();
+
+
+/*
+ * Function.prototype.apply() and
+ * Function.prototype.apply(undefined) should return the same result
+ */
+status = inSection(13);
+actual = F2.apply(undefined);
+expect = F2.apply();
+addThis();
+
+
+/*
+ * Function.prototype.apply() and
+ * Function.prototype.apply(null) should return the same result
+ */
+status = inSection(14);
+actual = F2.apply(null);
+expect = F2.apply();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.4-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.4-1.js
new file mode 100644
index 0000000000..d27b8487b7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/15.3.4.4-1.js
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor3@apochta.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 21 May 2002
+ * SUMMARY: ECMA conformance of Function.prototype.call
+ *
+ * Function.prototype.call(thisArg [,arg1 [,arg2, ...]])
+ *
+ * See ECMA-262 Edition 3 Final, Section 15.3.4.4
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.3.4.4-1.js';
+var UBound = 0;
+var BUGNUMBER = 145791;
+var summary = 'Testing ECMA conformance of Function.prototype.call';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function F0(a)
+{
+ return "" + this + arguments.length;
+}
+
+function F1(a)
+{
+ return "" + this + a;
+}
+
+function F2()
+{
+ return "" + this;
+}
+
+
+
+/*
+ * Function.prototype.call.length should return 1
+ */
+status = inSection(1);
+actual = Function.prototype.call.length;
+expect = 1;
+addThis();
+
+
+/*
+ * When |thisArg| is not provided to the call() method, the
+ * called function must be passed the global object as |this|
+ */
+status = inSection(2);
+actual = F0.call();
+expect = "" + this + 0;
+addThis();
+
+
+/*
+ * If [,arg1 [,arg2, ...]] are not provided to the call() method,
+ * the called function should be invoked with an empty argument list
+ */
+status = inSection(3);
+actual = F0.call("");
+expect = "" + "" + 0;
+addThis();
+
+status = inSection(4);
+actual = F0.call(true);
+expect = "" + true + 0;
+addThis();
+
+
+/*
+ * Function.prototype.call(x) and
+ * Function.prototype.call(x, undefined) should return the same result
+ */
+status = inSection(5);
+actual = F1.call(0, undefined);
+expect = F1.call(0);
+addThis();
+
+status = inSection(6);
+actual = F1.call("", undefined);
+expect = F1.call("");
+addThis();
+
+status = inSection(7);
+actual = F1.call(null, undefined);
+expect = F1.call(null);
+addThis();
+
+status = inSection(8);
+actual = F1.call(undefined, undefined);
+expect = F1.call(undefined);
+addThis();
+
+
+/*
+ * Function.prototype.call() and
+ * Function.prototype.call(undefined) should return the same result
+ */
+status = inSection(9);
+actual = F2.call(undefined);
+expect = F2.call();
+addThis();
+
+
+/*
+ * Function.prototype.call() and
+ * Function.prototype.call(null) should return the same result
+ */
+status = inSection(10);
+actual = F2.call(null);
+expect = F2.call();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/arguments-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/arguments-001.js
new file mode 100644
index 0000000000..2dbd603e02
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/arguments-001.js
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * brendan@mozilla.org, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 07 May 2001
+ *
+ * SUMMARY: Testing the arguments object
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=72884
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'arguments-001.js';
+var UBound = 0;
+var BUGNUMBER = 72884;
+var summary = 'Testing the arguments object';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var a = '';
+
+
+status = inSection(1);
+function f()
+{
+ delete arguments.length;
+ return arguments;
+}
+
+a = f();
+actual = a instanceof Object;
+expect = true;
+addThis();
+
+actual = a instanceof Array;
+expect = false;
+addThis();
+
+actual = a.length;
+expect = undefined;
+addThis();
+
+
+
+status = inSection(2);
+a = f(1,2,3);
+actual = a instanceof Object;
+expect = true;
+addThis();
+
+actual = a instanceof Array;
+expect = false;
+addThis();
+
+actual = a.length;
+expect = undefined;
+addThis();
+
+actual = a[0];
+expect = 1;
+addThis();
+
+actual = a[1];
+expect = 2;
+addThis();
+
+actual = a[2];
+expect = 3;
+addThis();
+
+
+
+status = inSection(3);
+/*
+ * Brendan:
+ *
+ * Note that only callee and length can be overridden, so deleting an indexed
+ * property and asking for it again causes it to be recreated by args_resolve:
+ *
+ * function g(){delete arguments[0]; return arguments[0]}
+ * g(42) // should this print 42?
+ *
+ * I'm not positive this violates ECMA, which allows in chapter 16 for extensions
+ * including properties (does it allow for magically reappearing properties?). The
+ * delete operator successfully deletes arguments[0] and results in true, but that
+ * is not distinguishable from the case where arguments[0] was delegated to
+ * Arguments.prototype[0], which was how the bad old code worked.
+ *
+ * I'll ponder this last detail...
+ *
+ * UPDATE: Per ECMA-262, delete on an arguments[i] should succeed
+ * and remove that property from the arguments object, leaving any get
+ * of it after the delete to evaluate to undefined.
+ */
+function g()
+{
+ delete arguments[0];
+ return arguments[0];
+}
+actual = g(42);
+expect = undefined; // not 42...
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/arguments-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/arguments-002.js
new file mode 100755
index 0000000000..78005560a7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/arguments-002.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'arguments-002.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 383269;
+var summary = 'Allow override of arguments';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var expect1 = '33,42';
+ var expect2 = 33;
+ var actual1 = '';
+ var actual2 = '';
+
+ function f(){
+ var a=arguments; actual1 = a[0]; arguments=42; actual1 += ',' + arguments; return a;
+ }
+
+ actual2 = f(33)[0];
+
+ expect = expect1 + ':' + expect2;
+ actual = actual1 + ':' + actual2;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/call-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/call-001.js
new file mode 100644
index 0000000000..61ab3b930b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/call-001.js
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-07-13
+ *
+ * SUMMARY: Applying Function.prototype.call to the Function object itself
+ *
+ *
+ * ECMA-262 15.3.4.4 Function.prototype.call (thisArg [,arg1 [,arg2,…] ] )
+ *
+ * When applied to the Function object itself, thisArg should be ignored.
+ * As explained by Waldemar (waldemar@netscape.com):
+ *
+ * Function.call(obj, "print(this)") is equivalent to invoking
+ * Function("print(this)") with this set to obj. Now, Function("print(this)")
+ * is equivalent to new Function("print(this)") (see 15.3.1.1), and the latter
+ * ignores the this value that you passed it and constructs a function
+ * (which we'll call F) which will print the value of the this that will be
+ * passed in when F will be invoked.
+ *
+ * With the last set of () you're invoking F(), which means you're calling it
+ * with no this value. When you don't provide a this value, it defaults to the
+ * global object.
+ *
+ */
+
+//-----------------------------------------------------------------------------
+var gTestfile = 'call-001.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Applying Function.prototype.call to the Function object itself';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var self = this; // capture a reference to the global object
+var cnOBJECT_GLOBAL = self.toString();
+var cnOBJECT_OBJECT = (new Object).toString();
+var cnHello = 'Hello';
+var cnRed = 'red';
+var objTEST = {color:cnRed};
+var f = new Function();
+var g = new Function();
+
+
+f = Function.call(self, 'return cnHello');
+g = Function.call(objTEST, 'return cnHello');
+
+status = 'Section A of test';
+actual = f();
+expect = cnHello;
+captureThis();
+
+status = 'Section B of test';
+actual = g();
+expect = cnHello;
+captureThis();
+
+
+f = Function.call(self, 'return this.toString()');
+g = Function.call(objTEST, 'return this.toString()');
+
+status = 'Section C of test';
+actual = f();
+expect = cnOBJECT_GLOBAL;
+captureThis();
+
+status = 'Section D of test';
+actual = g();
+expect = cnOBJECT_GLOBAL;
+captureThis();
+
+
+f = Function.call(self, 'return this.color');
+g = Function.call(objTEST, 'return this.color');
+
+status = 'Section E of test';
+actual = f();
+expect = undefined;
+captureThis();
+
+status = 'Section F of test';
+actual = g();
+expect = undefined;
+captureThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-131964.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-131964.js
new file mode 100644
index 0000000000..f3998db91c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-131964.js
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 19 Mar 2002
+ * SUMMARY: Function declarations in global or function scope are {DontDelete}.
+ * Function declarations in eval scope are not {DontDelete}.
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=131964
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-131964.js';
+var UBound = 0;
+var BUGNUMBER = 131964;
+var summary = 'Functions defined in global or function scope are {DontDelete}';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+function f()
+{
+ return 'f lives!';
+}
+delete f;
+
+try
+{
+ actual = f();
+}
+catch(e)
+{
+ actual = 'f was deleted';
+}
+
+expect = 'f lives!';
+addThis();
+
+
+
+/*
+ * Try the same test in function scope -
+ */
+status = inSection(2);
+function g()
+{
+ function f()
+ {
+ return 'f lives!';
+ }
+ delete f;
+
+ try
+ {
+ actual = f();
+ }
+ catch(e)
+ {
+ actual = 'f was deleted';
+ }
+
+ expect = 'f lives!';
+ addThis();
+}
+g();
+
+
+
+/*
+ * Try the same test in eval scope - here we EXPECT the function to be deleted (?)
+ */
+status = inSection(3);
+var s = '';
+s += 'function h()';
+s += '{ ';
+s += ' return "h lives!";';
+s += '}';
+s += 'delete h;';
+
+s += 'try';
+s += '{';
+s += ' actual = h();';
+s += '}';
+s += 'catch(e)';
+s += '{';
+s += ' actual = "h was deleted";';
+s += '}';
+
+s += 'expect = "h was deleted";';
+s += 'addThis();';
+eval(s);
+
+
+/*
+ * Define the function in eval scope, but delete it in global scope -
+ */
+status = inSection(4);
+s = '';
+s += 'function k()';
+s += '{ ';
+s += ' return "k lives!";';
+s += '}';
+eval(s);
+
+delete k;
+
+try
+{
+ actual = k();
+}
+catch(e)
+{
+ actual = 'k was deleted';
+}
+
+expect = 'k was deleted';
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function wasDeleted(functionName)
+{
+ return functionName + ' was deleted...';
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-137181.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-137181.js
new file mode 100644
index 0000000000..1bf7c35f93
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-137181.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * ibukanov8@yahoo.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 12 Apr 2002
+ * SUMMARY: delete arguments[i] should break connection to local reference
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=137181
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-137181.js';
+var UBound = 0;
+var BUGNUMBER = 137181;
+var summary = 'delete arguments[i] should break connection to local reference';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+function f1(x)
+{
+ x = 1;
+ delete arguments[0];
+ return x;
+}
+actual = f1(0); // (bug: Rhino was returning |undefined|)
+expect = 1;
+addThis();
+
+
+status = inSection(2);
+function f2(x)
+{
+ x = 1;
+ delete arguments[0];
+ arguments[0] = -1;
+ return x;
+}
+actual = f2(0); // (bug: Rhino was returning -1)
+expect = 1;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-193555.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-193555.js
new file mode 100644
index 0000000000..ed37b46c90
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-193555.js
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@icesoft.no, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 17 February 2003
+ * SUMMARY: Testing access to function name from inside function
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=193555
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-193555.js';
+var UBound = 0;
+var BUGNUMBER = 193555;
+var summary = 'Testing access to function name from inside function';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+// test via function statement
+status = inSection(1);
+function f() {return f.toString();};
+actual = f();
+expect = f.toString();
+addThis();
+
+// test via function expression
+status = inSection(2);
+var x = function g() {return g.toString();};
+actual = x();
+expect = x.toString();
+addThis();
+
+// test via eval() outside function
+status = inSection(3);
+eval ('function a() {return a.toString();}');
+actual = a();
+expect = a.toString();
+addThis();
+
+status = inSection(4);
+eval ('var y = function b() {return b.toString();}');
+actual = y();
+expect = y.toString();
+addThis();
+
+// test via eval() inside function
+status = inSection(5);
+function c() {return eval('c').toString();};
+actual = c();
+expect = c.toString();
+addThis();
+
+status = inSection(6);
+var z = function d() {return eval('d').toString();};
+actual = z();
+expect = z.toString();
+addThis();
+
+// test via two evals!
+status = inSection(7);
+eval('var w = function e() {return eval("e").toString();}');
+actual = w();
+expect = w.toString();
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-313570.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-313570.js
new file mode 100755
index 0000000000..e159c4c87f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-313570.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Yuh-Ruey Chen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-313570.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 313570;
+var summary = 'length of objects whose prototype chain includes a function';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+function tmp() {}
+tmp.prototype = function(a, b, c) {};
+var obj = new tmp();
+
+// arity
+expect = 3;
+actual = obj.length;
+reportCompare(expect, actual, summary + ': arity');
+
+// immutable
+obj.length = 10;
+
+expect = 3;
+actual = obj.length;
+reportCompare(expect, actual, summary + ': immutable');
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-49286.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-49286.js
new file mode 100644
index 0000000000..50e203bed8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-49286.js
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * jlaprise@delanotech.com,pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-07-10
+ *
+ * SUMMARY: Invoking try...catch through Function.call
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=49286
+ *
+ * 1) Define a function with a try...catch block in it
+ * 2) Invoke the function via the call method of Function
+ * 3) Pass bad syntax to the try...catch block
+ * 4) We should catch the error!
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-49286.js';
+var UBound = 0;
+var BUGNUMBER = 49286;
+var summary = 'Invoking try...catch through Function.call';
+var cnErrorCaught = 'Error caught';
+var cnErrorNotCaught = 'Error NOT caught';
+var cnGoodSyntax = '1==2';
+var cnBadSyntax = '1=2';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+var obj = new testObject();
+
+status = 'Section A of test: direct call of f';
+actual = f.call(obj);
+expect = cnErrorCaught;
+addThis();
+
+status = 'Section B of test: indirect call of f';
+actual = g.call(obj);
+expect = cnErrorCaught;
+addThis();
+
+
+
+//-----------------------------------------
+test();
+//-----------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+// An object storing bad syntax as a property -
+function testObject()
+{
+ this.badSyntax = cnBadSyntax;
+ this.goodSyntax = cnGoodSyntax;
+}
+
+
+// A function wrapping a try...catch block
+function f()
+{
+ try
+ {
+ eval(this.badSyntax);
+ }
+ catch(e)
+ {
+ return cnErrorCaught;
+ }
+ return cnErrorNotCaught;
+}
+
+
+// A function wrapping a call to f -
+function g()
+{
+ return f.call(this);
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-58274.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-58274.js
new file mode 100644
index 0000000000..da5bde597f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-58274.js
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * rogerl@netscape.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 15 July 2002
+ * SUMMARY: Testing functions with double-byte names
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=58274
+ *
+ * Here is a sample of the problem:
+ *
+ * js> function f\u02B1 () {}
+ *
+ * js> f\u02B1.toSource();
+ * function f¦() {}
+ *
+ * js> f\u02B1.toSource().toSource();
+ * (new String("function f\xB1() {}"))
+ *
+ *
+ * See how the high-byte information (the 02) has been lost?
+ * The same thing was happening with the toString() method:
+ *
+ * js> f\u02B1.toString();
+ *
+ * function f¦() {
+ * }
+ *
+ * js> f\u02B1.toString().toSource();
+ * (new String("\nfunction f\xB1() {\n}\n"))
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-58274.js';
+var UBound = 0;
+var BUGNUMBER = 58274;
+var summary = 'Testing functions with double-byte names';
+var ERR = 'UNEXPECTED ERROR! \n';
+var ERR_MALFORMED_NAME = ERR + 'Could not find function name in: \n\n';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var sEval;
+var sName;
+
+
+sEval = "function f\u02B2() {return 42;}";
+eval(sEval);
+sName = getFunctionName(f\u02B2);
+
+// Test function call -
+status = inSection(1);
+actual = f\u02B2();
+expect = 42;
+addThis();
+
+// Test both characters of function name -
+status = inSection(2);
+actual = sName[0];
+expect = sEval[9];
+addThis();
+
+status = inSection(3);
+actual = sName[1];
+expect = sEval[10];
+addThis();
+
+
+
+sEval = "function f\u02B2\u0AAA () {return 84;}";
+eval(sEval);
+sName = getFunctionName(f\u02B2\u0AAA);
+
+// Test function call -
+status = inSection(4);
+actual = f\u02B2\u0AAA();
+expect = 84;
+addThis();
+
+// Test all three characters of function name -
+status = inSection(5);
+actual = sName[0];
+expect = sEval[9];
+addThis();
+
+status = inSection(6);
+actual = sName[1];
+expect = sEval[10];
+addThis();
+
+status = inSection(7);
+actual = sName[2];
+expect = sEval[11];
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Goal: test that f.toString() contains the proper function name.
+ *
+ * Note, however, f.toString() is implementation-independent. For example,
+ * it may begin with '\nfunction' instead of 'function'. Therefore we use
+ * a regexp to make sure we extract the name properly.
+ *
+ * Here we assume that f has been defined by means of a function statement,
+ * and not a function expression (where it wouldn't have to have a name).
+ *
+ * Rhino uses a Unicode representation for f.toString(); whereas
+ * SpiderMonkey uses an ASCII representation, putting escape sequences
+ * for non-ASCII characters. For example, if a function is called f\u02B1,
+ * then in Rhino the toString() method will present a 2-character Unicode
+ * string for its name, whereas SpiderMonkey will present a 7-character
+ * ASCII string for its name: the string literal 'f\u02B1'.
+ *
+ * So we force the lexer to condense the string before using it.
+ * This will give uniform results in Rhino and SpiderMonkey.
+ */
+function getFunctionName(f)
+{
+ var s = condenseStr(f.toString());
+ var re = /\s*function\s+(\S+)\s*\(/;
+ var arr = s.match(re);
+
+ if (!(arr && arr[1]))
+ return ERR_MALFORMED_NAME + s;
+ return arr[1];
+}
+
+
+/*
+ * This function is the opposite of functions like escape(), which take
+ * Unicode characters and return escape sequences for them. Here, we force
+ * the lexer to turn escape sequences back into single characters.
+ *
+ * Note we can't simply do |eval(str)|, since in practice |str| will be an
+ * identifier somewhere in the program (e.g. a function name); thus |eval(str)|
+ * would return the object that the identifier represents: not what we want.
+ *
+ * So we surround |str| lexicographically with quotes to force the lexer to
+ * evaluate it as a string. Have to strip out any linefeeds first, however -
+ */
+function condenseStr(str)
+{
+ /*
+ * You won't be able to do the next step if |str| has
+ * any carriage returns or linefeeds in it. For example:
+ *
+ * js> eval("'" + '\nHello' + "'");
+ * 1: SyntaxError: unterminated string literal:
+ * 1: '
+ * 1: ^
+ *
+ * So replace them with the empty string -
+ */
+ str = str.replace(/[\r\n]/g, '')
+ return eval("'" + str + "'");
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-85880.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-85880.js
new file mode 100644
index 0000000000..8ea4fb6c41
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-85880.js
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-06-14
+ *
+ * SUMMARY: Regression test for Bugzilla bug 85880
+ *
+ * Rhino interpreted mode was nulling out the arguments object of a
+ * function if it happened to call another function inside its body.
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=85880
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-85880.js';
+var UBound = 0;
+var BUGNUMBER = 85880;
+var summary = 'Arguments object of g(){f()} should not be null';
+var cnNonNull = 'Arguments != null';
+var cnNull = 'Arguments == null';
+var cnRecurse = true;
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function f1(x)
+{
+}
+
+
+function f2()
+{
+ return f2.arguments;
+}
+status = 'Section A of test';
+actual = (f2() == null);
+expect = false;
+addThis();
+
+status = 'Section B of test';
+actual = (f2(0) == null);
+expect = false;
+addThis();
+
+
+function f3()
+{
+ f1();
+ return f3.arguments;
+}
+status = 'Section C of test';
+actual = (f3() == null);
+expect = false;
+addThis();
+
+status = 'Section D of test';
+actual = (f3(0) == null);
+expect = false;
+addThis();
+
+
+function f4()
+{
+ f1();
+ f2();
+ f3();
+ return f4.arguments;
+}
+status = 'Section E of test';
+actual = (f4() == null);
+expect = false;
+addThis();
+
+status = 'Section F of test';
+actual = (f4(0) == null);
+expect = false;
+addThis();
+
+
+function f5()
+{
+ if (cnRecurse)
+ {
+ cnRecurse = false;
+ f5();
+ }
+ return f5.arguments;
+}
+status = 'Section G of test';
+actual = (f5() == null);
+expect = false;
+addThis();
+
+status = 'Section H of test';
+actual = (f5(0) == null);
+expect = false;
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = isThisNull(actual);
+ expectedvalues[UBound] = isThisNull(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function isThisNull(bool)
+{
+ return bool? cnNull : cnNonNull
+ }
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-94506.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-94506.js
new file mode 100644
index 0000000000..b6ab5cc24c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-94506.js
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * deneen@alum.bucknell.edu, shaver@mozilla.org
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 08 August 2001
+ *
+ * SUMMARY: When we invoke a function, the arguments object should take
+ * a back seat to any local identifier named "arguments".
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=94506
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-94506.js';
+var UBound = 0;
+var BUGNUMBER = 94506;
+var summary = 'Testing functions employing identifiers named "arguments"';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var TYPE_OBJECT = typeof new Object();
+var arguments = 5555;
+
+
+// use a parameter named "arguments"
+function F1(arguments)
+{
+ return arguments;
+}
+
+
+// use a local variable named "arguments"
+function F2()
+{
+ var arguments = 55;
+ return arguments;
+}
+
+
+// same thing in a different order. CHANGES THE RESULT!
+function F3()
+{
+ return arguments;
+ var arguments = 555;
+}
+
+
+// use the global variable above named "arguments"
+function F4()
+{
+ return arguments;
+}
+
+
+
+/*
+ * In Sections 1 and 2, expect the local identifier, not the arguments object.
+ * In Sections 3 and 4, expect the arguments object, not the the identifier.
+ */
+
+status = 'Section 1 of test';
+actual = F1(5);
+expect = 5;
+addThis();
+
+
+status = 'Section 2 of test';
+actual = F2();
+expect = 55;
+addThis();
+
+
+status = 'Section 3 of test';
+actual = typeof F3();
+expect = TYPE_OBJECT;
+addThis();
+
+
+status = 'Section 4 of test';
+actual = typeof F4();
+expect = TYPE_OBJECT;
+addThis();
+
+
+// Let's try calling F1 without providing a parameter -
+status = 'Section 5 of test';
+actual = F1();
+expect = undefined;
+addThis();
+
+
+// Let's try calling F1 with too many parameters -
+status = 'Section 6 of test';
+actual = F1(3,33,333);
+expect = 3;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-97921.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-97921.js
new file mode 100644
index 0000000000..855f966dc4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/regress-97921.js
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * georg@bioshop.de, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 10 September 2001
+ *
+ * SUMMARY: Testing with() statement with nested functions
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=97921
+ *
+ * Brendan: "The bug is peculiar to functions that have formal parameters,
+ * but that are called with fewer actual arguments than the declared number
+ * of formal parameters."
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-97921.js';
+var UBound = 0;
+var BUGNUMBER = 97921;
+var summary = 'Testing with() statement with nested functions';
+var cnYES = 'Inner value === outer value';
+var cnNO = "Inner value !== outer value!";
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var outerValue = '';
+var innerValue = '';
+var useWith = '';
+
+
+function F(i)
+{
+ i = 0;
+ if(useWith) with(1){i;}
+ i++;
+
+ outerValue = i; // capture value of i in outer function
+ F1 = function() {innerValue = i;}; // capture value of i in inner function
+ F1();
+}
+
+
+status = inSection(1);
+useWith=false;
+F(); // call F without supplying the argument
+actual = innerValue === outerValue;
+expect = true;
+addThis();
+
+status = inSection(2);
+useWith=true;
+F(); // call F without supplying the argument
+actual = innerValue === outerValue;
+expect = true;
+addThis();
+
+
+function G(i)
+{
+ i = 0;
+ with (new Object()) {i=100};
+ i++;
+
+ outerValue = i; // capture value of i in outer function
+ G1 = function() {innerValue = i;}; // capture value of i in inner function
+ G1();
+}
+
+
+status = inSection(3);
+G(); // call G without supplying the argument
+actual = innerValue === 101;
+expect = true;
+addThis();
+
+status = inSection(4);
+G(); // call G without supplying the argument
+actual = innerValue === outerValue;
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = areTheseEqual(actual);
+ expectedvalues[UBound] = areTheseEqual(expect);
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function areTheseEqual(yes)
+{
+ return yes? cnYES : cnNO
+ }
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/scope-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/scope-001.js
new file mode 100644
index 0000000000..3aa1d3bc03
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/scope-001.js
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com, rogerl@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 28 May 2001
+ *
+ * SUMMARY: Functions are scoped statically, not dynamically
+ *
+ * See ECMA Section 10.1.4 Scope Chain and Identifier Resolution
+ * (This section defines the scope chain of an execution context)
+ *
+ * See ECMA Section 12.10 The with Statement
+ *
+ * See ECMA Section 13 Function Definition
+ * (This section defines the scope chain of a function object as that
+ * of the running execution context when the function was declared)
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'scope-001.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing that functions are scoped statically, not dynamically';
+var self = this; // capture a reference to the global object
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+/*
+ * In this section the expected value is 1, not 2.
+ *
+ * Why? f captures its scope chain from when it's declared, and imposes that chain
+ * when it's executed. In other words, f's scope chain is from when it was compiled.
+ * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1.
+ */
+status = 'Section A of test';
+var a = 1;
+function f()
+{
+ return a;
+}
+var obj = {a:2};
+with (obj)
+{
+ actual = f();
+}
+expect = 1;
+addThis();
+
+
+/*
+ * In this section the expected value is 2, not 1. That is because here
+ * f's associated scope chain now includes 'obj' before the global object.
+ */
+status = 'Section B of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+ actual = f();
+}
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section B , except that we call f outside the with block.
+ * By the principles explained above, we still expect 2 -
+ */
+status = 'Section C of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+actual = f();
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section C, but with one more level of indirection -
+ */
+status = 'Section D of test';
+var a = 1;
+var obj = {a:2, obj:{a:3}};
+with (obj)
+{
+ with (obj)
+ {
+ function f()
+ {
+ return a;
+ }
+ }
+}
+actual = f();
+expect = 3;
+addThis();
+
+
+/*
+ * Like Section C, but here we actually delete obj before calling f.
+ * We still expect 2 -
+ */
+status = 'Section E of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+delete obj;
+actual = f();
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section E. Here we redefine obj and call f under with (obj) -
+ * We still expect 2 -
+ */
+status = 'Section F of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+delete obj;
+var obj = {a:3};
+with (obj)
+{
+ actual = f();
+}
+expect = 2; // NOT 3 !!!
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section G of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]);
+expect = String([false, true]);
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section H of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ function f()
+ {
+ return a;
+ }
+}
+actual = String(['f' in obj, 'f' in self]);
+expect = String([false, true]);
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+ resetTestVars();
+}
+
+
+function resetTestVars()
+{
+ delete a;
+ delete obj;
+ delete f;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/scope-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/scope-002.js
new file mode 100644
index 0000000000..7a9b6f204b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/scope-002.js
@@ -0,0 +1,245 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com, rogerl@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 28 May 2001
+ *
+ * SUMMARY: Functions are scoped statically, not dynamically
+ *
+ * See ECMA Section 10.1.4 Scope Chain and Identifier Resolution
+ * (This section defines the scope chain of an execution context)
+ *
+ * See ECMA Section 12.10 The with Statement
+ *
+ * See ECMA Section 13 Function Definition
+ * (This section defines the scope chain of a function object as that
+ * of the running execution context when the function was declared)
+ *
+ * Like scope-001.js, but using assignment var f = function expression
+ * instead of a function declaration: function f() {} etc.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'scope-002.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing that functions are scoped statically, not dynamically';
+var self = this; // capture a reference to the global object
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+
+/*
+ * In this section the expected value is 1, not 2.
+ *
+ * Why? f captures its scope chain from when it's declared, and imposes that chain
+ * when it's executed. In other words, f's scope chain is from when it was compiled.
+ * Since f is a top-level function, this is the global object only. Hence 'a' resolves to 1.
+ */
+status = 'Section A of test';
+var a = 1;
+var f = function () {return a;};
+var obj = {a:2};
+with (obj)
+{
+ actual = f();
+}
+expect = 1;
+addThis();
+
+
+/*
+ * In this section the expected value is 2, not 1. That is because here
+ * f's associated scope chain now includes 'obj' before the global object.
+ */
+status = 'Section B of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+ actual = f();
+}
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section B , except that we call f outside the with block.
+ * By the principles explained above, we still expect 2 -
+ */
+status = 'Section C of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+actual = f();
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section C, but with one more level of indirection -
+ */
+status = 'Section D of test';
+var a = 1;
+var obj = {a:2, obj:{a:3}};
+with (obj)
+{
+ with (obj)
+ {
+ var f = function () {return a;};
+ }
+}
+actual = f();
+expect = 3;
+addThis();
+
+
+/*
+ * Like Section C, but here we actually delete obj before calling f.
+ * We still expect 2 -
+ */
+status = 'Section E of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+delete obj;
+actual = f();
+expect = 2;
+addThis();
+
+
+/*
+ * Like Section E. Here we redefine obj and call f under with (obj) -
+ * We still expect 2 -
+ */
+status = 'Section F of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+delete obj;
+var obj = {a:3};
+with (obj)
+{
+ actual = f();
+}
+expect = 2; // NOT 3 !!!
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section G of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]);
+expect = String([false, true]);
+addThis();
+
+
+/*
+ * Explicitly verify that f exists at global level, even though
+ * it was defined under the with(obj) block -
+ */
+status = 'Section H of test';
+var a = 1;
+var obj = {a:2};
+with (obj)
+{
+ var f = function () {return a;};
+}
+actual = String(['f' in obj, 'f' in self]);
+expect = String([false, true]);
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+ resetTestVars();
+}
+
+
+function resetTestVars()
+{
+ delete a;
+ delete obj;
+ delete f;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Function/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Function/shell.js
new file mode 100644
index 0000000000..eebf3d51f8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Function/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Function';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/7.9.1.js b/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/7.9.1.js
new file mode 100755
index 0000000000..10ee26f929
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/7.9.1.js
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '7.9.1.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 402386;
+var summary = 'Automatic Semicolon insertion in postfix expressions';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var expr;
+ var code;
+
+ // LeftHandSideExpression [no LineTerminator here] ++
+
+ code = 'expr ++';
+ expr = 0;
+ expect = 1;
+
+ try
+ {
+ eval(code);
+ actual = expr;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + code);
+
+ code = 'expr\n++';
+ expr = 0;
+ expect = 'SyntaxError: syntax error';
+
+ try
+ {
+ eval(code);
+ actual = expr;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + code);
+
+ // LeftHandSideExpression [no LineTerminator here] --
+
+ code = 'expr --';
+ expr = 0;
+ expect = -1;
+
+ try
+ {
+ eval(code);
+ actual = expr;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + code);
+
+ code = 'expr\n--';
+ expr = 0;
+ expect = 'SyntaxError: syntax error';
+
+ try
+ {
+ eval(code);
+ actual = expr;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + code);
+
+ //
+
+ var x = 1;
+ var y = 1;
+ code = '(x\n)-- y';
+ expect = 'SyntaxError: missing ; before statement';
+
+ try
+ {
+ eval(code);
+ actual = expr;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + code);
+
+ code = '(x)-- y';
+ expect = 'SyntaxError: missing ; before statement';
+
+ try
+ {
+ eval(code);
+ actual = expr;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + code);
+
+ exitFunc ('test');
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/shell.js
new file mode 100644
index 0000000000..4e1d61d68a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/LexicalConventions/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'LexicalConventions';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.2-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.2-01.js
new file mode 100644
index 0000000000..36d63ed7e4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.2-01.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Jeff Walden.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.7.4.2-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = "411889";
+var summary = "num.toString(), num.toString(10), and num.toString(undefined)" +
+ " should all be equivalent";
+var actual, expect;
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var failed = false;
+
+try
+{
+ var noargs = 3.3.toString();
+ var tenarg = 3.3.toString(10);
+ var undefarg = 3.3.toString(undefined);
+
+ if (noargs !== tenarg)
+ throw "() !== (10): " + noargs + " !== " + tenarg;
+ if (tenarg !== undefarg)
+ throw "(10) !== (undefined): " + tenarg + " !== " + undefarg;
+}
+catch (e)
+{
+ failed = e;
+}
+
+expect = false;
+actual = failed;
+
+reportCompare(expect, actual, summary);
+
+expect = 1;
+actual = 3.3.toString.length;
+reportCompare(expect, actual, '3.3.toString.length should be 1');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-01.js
new file mode 100644
index 0000000000..7c4cba753d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-01.js
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Jeff Walden.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.7.4.3-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = "412068";
+var summary = "num.toLocaleString incorrectly accesses its first argument " +
+ "even when no first argument has been given";
+var actual, expect;
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var failed = false;
+
+try
+{
+ if ("3" !== 3..toLocaleString())
+ throw '"3" should equal 3..toLocaleString()';
+ if ("9" !== 9..toLocaleString(8))
+ throw 'Number.prototype.toLocaleString should ignore its first argument';
+}
+catch (e)
+{
+ failed = e;
+}
+
+expect = false;
+actual = failed;
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-02.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-02.js
new file mode 100644
index 0000000000..72e7c56141
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.3-02.js
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Jeff Walden.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Philip Taylor
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.7.4.3-02.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = "446494";
+var summary = "num.toLocaleString should handle exponents";
+var actual, expect;
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+expect = '1e-10';
+actual = 1e-10.toLocaleString();
+reportCompare(expect, actual, summary + ': ' + expect);
+
+expect = 'Infinity';
+actual = Infinity.toLocaleString();
+reportCompare(expect, actual, summary + ': ' + expect);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.5-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.5-1.js
new file mode 100644
index 0000000000..c21efa0b66
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.5-1.js
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-07-15
+ *
+ * SUMMARY: Testing Number.prototype.toFixed(fractionDigits)
+ * See EMCA 262 Edition 3 Section 15.7.4.5
+ *
+ * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.7.4.5-1.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing Number.prototype.toFixed(fractionDigits)';
+var cnIsRangeError = 'instanceof RangeError';
+var cnNotRangeError = 'NOT instanceof RangeError';
+var cnNoErrorCaught = 'NO ERROR CAUGHT...';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var testNum = 234.2040506;
+
+
+status = 'Section A of test: no error intended!';
+actual = testNum.toFixed(4);
+expect = '234.2041';
+captureThis();
+
+
+/////////////////////////// OOPS.... ///////////////////////////////
+/*************************************************************************
+ * 15.7.4.5 Number.prototype.toFixed(fractionDigits)
+ *
+ * An implementation is permitted to extend the behaviour of toFixed
+ * for values of fractionDigits less than 0 or greater than 20. In this
+ * case toFixed would not necessarily throw RangeError for such values.
+
+status = 'Section B of test: expect RangeError because fractionDigits < 0';
+actual = catchError('testNum.toFixed(-4)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section C of test: expect RangeError because fractionDigits > 20 ';
+actual = catchError('testNum.toFixed(21)');
+expect = cnIsRangeError;
+captureThis();
+*************************************************************************/
+
+
+status = 'Section D of test: no error intended!';
+actual = 0.00001.toFixed(2);
+expect = '0.00';
+captureThis();
+
+status = 'Section E of test: no error intended!';
+actual = 0.000000000000000000001.toFixed(20);
+expect = '0.00000000000000000000';
+captureThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function catchError(sEval)
+{
+ try {eval(sEval);}
+ catch(e) {return isRangeError(e);}
+ return cnNoErrorCaught;
+}
+
+
+function isRangeError(obj)
+{
+ if (obj instanceof RangeError)
+ return cnIsRangeError;
+ return cnNotRangeError;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.6-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.6-1.js
new file mode 100644
index 0000000000..dec9ed6a90
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.6-1.js
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-07-15
+ *
+ * SUMMARY: Testing Number.prototype.toExponential(fractionDigits)
+ * See EMCA 262 Edition 3 Section 15.7.4.6
+ *
+ * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.7.4.6-1.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing Number.prototype.toExponential(fractionDigits)';
+var cnIsRangeError = 'instanceof RangeError';
+var cnNotRangeError = 'NOT instanceof RangeError';
+var cnNoErrorCaught = 'NO ERROR CAUGHT...';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var testNum = 77.1234;
+
+
+status = 'Section A of test: no error intended!';
+actual = testNum.toExponential(4);
+expect = '7.7123e+1';
+captureThis();
+
+
+/////////////////////////// OOPS.... ///////////////////////////////
+/*************************************************************************
+ * 15.7.4.6 Number.prototype.toExponential(fractionDigits)
+ *
+ * An implementation is permitted to extend the behaviour of toExponential
+ * for values of fractionDigits less than 0 or greater than 20. In this
+ * case toExponential would not necessarily throw RangeError for such values.
+
+status = 'Section B of test: expect RangeError because fractionDigits < 0';
+actual = catchError('testNum.toExponential(-4)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section C of test: expect RangeError because fractionDigits > 20 ';
+actual = catchError('testNum.toExponential(21)');
+expect = cnIsRangeError;
+captureThis();
+*************************************************************************/
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function catchError(sEval)
+{
+ try {eval(sEval);}
+ catch(e) {return isRangeError(e);}
+ return cnNoErrorCaught;
+}
+
+
+function isRangeError(obj)
+{
+ if (obj instanceof RangeError)
+ return cnIsRangeError;
+ return cnNotRangeError;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-1.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-1.js
new file mode 100644
index 0000000000..5aa0724a46
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-1.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-07-15
+ *
+ * SUMMARY: Testing Number.prototype.toPrecision(precision)
+ * See EMCA 262 Edition 3 Section 15.7.4.7
+ *
+ * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=90551
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.7.4.7-1.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing Number.prototype.toPrecision(precision)';
+var cnIsRangeError = 'instanceof RangeError';
+var cnNotRangeError = 'NOT instanceof RangeError';
+var cnNoErrorCaught = 'NO ERROR CAUGHT...';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var testNum = 5.123456;
+
+
+status = 'Section A of test: no error intended!';
+actual = testNum.toPrecision(4);
+expect = '5.123';
+captureThis();
+
+
+/////////////////////////// OOPS.... ///////////////////////////////
+/*************************************************************************
+ * 15.7.4.7 Number.prototype.toPrecision(precision)
+ *
+ * An implementation is permitted to extend the behaviour of toPrecision
+ * for values of precision less than 1 or greater than 21. In this
+ * case toPrecision would not necessarily throw RangeError for such values.
+
+status = 'Section B of test: expect RangeError because precision < 1';
+actual = catchError('testNum.toPrecision(0)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section C of test: expect RangeError because precision < 1';
+actual = catchError('testNum.toPrecision(-4)');
+expect = cnIsRangeError;
+captureThis();
+
+status = 'Section D of test: expect RangeError because precision > 21 ';
+actual = catchError('testNum.toPrecision(22)');
+expect = cnIsRangeError;
+captureThis();
+*************************************************************************/
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function captureThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function catchError(sEval)
+{
+ try {eval(sEval);}
+ catch(e) {return isRangeError(e);}
+ return cnNoErrorCaught;
+}
+
+
+function isRangeError(obj)
+{
+ if (obj instanceof RangeError)
+ return cnIsRangeError;
+ return cnNotRangeError;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-2.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-2.js
new file mode 100644
index 0000000000..5c8ff396e4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/15.7.4.7-2.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Jeff Walden.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.7.4.7-2.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = "411893";
+var summary = "num.toPrecision(undefined) should equal num.toString()";
+var actual, expect;
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var failed = false;
+
+try
+{
+ var prec = 3.3.toPrecision(undefined);
+ var str = 3.3.toString();
+ if (prec !== str)
+ {
+ throw "not equal! " +
+ "3.3.toPrecision(undefined) === '" + prec + "', " +
+ "3.3.toString() === '" + str + "'";
+ }
+}
+catch (e)
+{
+ failed = e;
+}
+
+expect = false;
+actual = failed;
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/regress-442242-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/regress-442242-01.js
new file mode 100755
index 0000000000..e3fa070e5a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/regress-442242-01.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-442242-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 442242;
+var summary = 'Do not assert: INT_FITS_IN_JSVAL(i)';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var i = 28800000;
+ -i;
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Number/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Number/shell.js
new file mode 100644
index 0000000000..03cca1d551
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Number/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Number';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/shell.js
new file mode 100644
index 0000000000..1847703bf3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'NumberFormatting';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/tostring-001.js b/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/tostring-001.js
new file mode 100644
index 0000000000..34152aa5c0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/NumberFormatting/tostring-001.js
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'tostring-001.js';
+
+test();
+
+function test()
+{
+ var n0 = 1e23;
+ var n1 = 5e22;
+ var n2 = 1.6e24;
+
+ printStatus ("Number formatting test.");
+ printBugNumber ("11178");
+
+ reportCompare ("1e+23", n0.toString(), "1e23 toString()");
+ reportCompare ("5e+22", n1.toString(), "5e22 toString()");
+ reportCompare ("1.6e+24", n2.toString(), "1.6e24 toString()");
+
+}
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/8.6.1-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/8.6.1-01.js
new file mode 100755
index 0000000000..2897ece555
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/8.6.1-01.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Michael Daumling <daumling@adobe.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '8.6.1-01.js';
+//-----------------------------------------------------------------------------
+
+var BUGNUMBER = 315436;
+var summary = 'In strict mode, setting a read-only property should generate a warning';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+enterFunc (String (BUGNUMBER));
+
+// should throw an error in strict mode
+var actual = '';
+var expect = 's.length is read-only';
+var status = summary + ': Throw if STRICT and WERROR is enabled';
+
+if (!options().match(/strict/))
+{
+ options('strict');
+}
+if (!options().match(/werror/))
+{
+ options('werror');
+}
+
+try
+{
+ var s = new String ('abc');
+ s.length = 0;
+}
+catch (e)
+{
+ actual = e.message;
+}
+
+reportCompare(expect, actual, status);
+
+// should not throw an error if in strict mode and WERROR is false
+
+actual = 'did not throw';
+expect = 'did not throw';
+var status = summary + ': Do not throw if STRICT is enabled and WERROR is disabled';
+
+// toggle werror off
+options('werror');
+
+try
+{
+ s.length = 0;
+}
+catch (e)
+{
+ actual = e.message;
+}
+
+reportCompare(expect, actual, status);
+
+// should not throw an error if not in strict mode
+
+actual = 'did not throw';
+expect = 'did not throw';
+var status = summary + ': Do not throw if not in strict mode';
+
+// toggle strict off
+options('strict');
+
+try
+{
+ s.length = 0;
+}
+catch (e)
+{
+ actual = e.message;
+}
+
+reportCompare(expect, actual, status);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/8.6.2.6-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/8.6.2.6-001.js
new file mode 100644
index 0000000000..8fe2b23f4a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/8.6.2.6-001.js
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 09 September 2002
+ * SUMMARY: Test for TypeError on invalid default string value of object
+ * See ECMA reference at http://bugzilla.mozilla.org/show_bug.cgi?id=167325
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '8.6.2.6-001.js';
+var UBound = 0;
+var BUGNUMBER = 167325;
+var summary = "Test for TypeError on invalid default string value of object";
+var TEST_PASSED = 'TypeError';
+var TEST_FAILED = 'Generated an error, but NOT a TypeError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * This should generate a TypeError. See ECMA reference
+ * at http://bugzilla.mozilla.org/show_bug.cgi?id=167325
+ */
+try
+{
+ var obj = {toString: function() {return new Object();}}
+ obj == 'abc';
+}
+catch(e)
+{
+ if (e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/browser.js
new file mode 100644
index 0000000000..0e57d1fcd0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/browser.js
@@ -0,0 +1,7 @@
+var GLOBAL = 'Window';
+
+function isObject(obj)
+{
+ return obj instanceof Object || obj == window;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/class-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-001.js
new file mode 100644
index 0000000000..faa2f4fceb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-001.js
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 14 Mar 2001
+ *
+ * SUMMARY: Testing the internal [[Class]] property of objects
+ * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2
+ *
+ * The getJSClass() function we use is in a utility file, e.g. "shell.js".
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'class-001.js';
+var i = 0;
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing the internal [[Class]] property of objects';
+var statprefix = 'Current object is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+
+status = 'the global object';
+actual = getJSClass(this);
+expect = GLOBAL;
+if (expect == 'Window' && actual == 'XPCCrossOriginWrapper')
+{
+ print('Skipping global object due to XPCCrossOriginWrapper. See bug 390946');
+}
+else
+{
+ addThis();
+}
+
+status = 'new Object()';
+actual = getJSClass(new Object());
+expect = 'Object';
+addThis();
+
+status = 'new Function()';
+actual = getJSClass(new Function());
+expect = 'Function';
+addThis();
+
+status = 'new Array()';
+actual = getJSClass(new Array());
+expect = 'Array';
+addThis();
+
+status = 'new String()';
+actual = getJSClass(new String());
+expect = 'String';
+addThis();
+
+status = 'new Boolean()';
+actual = getJSClass(new Boolean());
+expect = 'Boolean';
+addThis();
+
+status = 'new Number()';
+actual = getJSClass(new Number());
+expect = 'Number';
+addThis();
+
+status = 'Math';
+actual = getJSClass(Math); // can't use 'new' with the Math object (EMCA3, 15.8)
+expect = 'Math';
+addThis();
+
+status = 'new Date()';
+actual = getJSClass(new Date());
+expect = 'Date';
+addThis();
+
+status = 'new RegExp()';
+actual = getJSClass(new RegExp());
+expect = 'RegExp';
+addThis();
+
+status = 'new Error()';
+actual = getJSClass(new Error());
+expect = 'Error';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/class-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-002.js
new file mode 100644
index 0000000000..0b49ffd9db
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-002.js
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 14 Mar 2001
+ *
+ * SUMMARY: Testing the [[Class]] property of native constructors.
+ * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
+ *
+ * Same as class-001.js - but testing the constructors here, not
+ * object instances. Therefore we expect the [[Class]] property to
+ * equal 'Function' in each case.
+ *
+ * The getJSClass() function we use is in a utility file, e.g. "shell.js"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'class-002.js';
+var i = 0;
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing the internal [[Class]] property of native constructors';
+var statprefix = 'Current constructor is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Function' every time; see discussion above -
+ */
+status = 'Object';
+actual = getJSClass(Object);
+expect = 'Function';
+addThis();
+
+status = 'Function';
+actual = getJSClass(Function);
+expect = 'Function';
+addThis();
+
+status = 'Array';
+actual = getJSClass(Array);
+expect = 'Function';
+addThis();
+
+status = 'String';
+actual = getJSClass(String);
+expect = 'Function';
+addThis();
+
+status = 'Boolean';
+actual = getJSClass(Boolean);
+expect = 'Function';
+addThis();
+
+status = 'Number';
+actual = getJSClass(Number);
+expect = 'Function';
+addThis();
+
+status = 'Date';
+actual = getJSClass(Date);
+expect = 'Function';
+addThis();
+
+status = 'RegExp';
+actual = getJSClass(RegExp);
+expect = 'Function';
+addThis();
+
+status = 'Error';
+actual = getJSClass(Error);
+expect = 'Function';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/class-003.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-003.js
new file mode 100644
index 0000000000..7afedb2985
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-003.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 14 Mar 2001
+ *
+ * SUMMARY: Testing the [[Class]] property of native error types.
+ * See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property.
+ *
+ * Same as class-001.js - but testing only the native error types here.
+ * See ECMA-262 Edition 3, Section 15.11.6 for a list of these types.
+ *
+ * ECMA expects the [[Class]] property to equal 'Error' in each case.
+ * See ECMA-262 Edition 3, Sections 15.11.1.1 and 15.11.7.2 for this.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=56868
+ *
+ * The getJSClass() function we use is in a utility file, e.g. "shell.js"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'class-003.js';
+var i = 0;
+var UBound = 0;
+var BUGNUMBER = 56868;
+var summary = 'Testing the internal [[Class]] property of native error types';
+var statprefix = 'Current object is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Error' every time; see discussion above -
+ */
+status = 'new Error()';
+actual = getJSClass(new Error());
+expect = 'Error';
+addThis();
+
+status = 'new EvalError()';
+actual = getJSClass(new EvalError());
+expect = 'Error';
+addThis();
+
+status = 'new RangeError()';
+actual = getJSClass(new RangeError());
+expect = 'Error';
+addThis();
+
+status = 'new ReferenceError()';
+actual = getJSClass(new ReferenceError());
+expect = 'Error';
+addThis();
+
+status = 'new SyntaxError()';
+actual = getJSClass(new SyntaxError());
+expect = 'Error';
+addThis();
+
+status = 'new TypeError()';
+actual = getJSClass(new TypeError());
+expect = 'Error';
+addThis();
+
+status = 'new URIError()';
+actual = getJSClass(new URIError());
+expect = 'Error';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/class-004.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-004.js
new file mode 100644
index 0000000000..729b041086
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-004.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 14 Mar 2001
+ *
+ * SUMMARY: Testing [[Class]] property of native error constructors.
+ * See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property.
+ *
+ * See ECMA-262 Edition 3, Section 15.11.6 for the native error types.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=56868
+ *
+ * Same as class-003.js - but testing the constructors here, not
+ * object instances. Therefore we expect the [[Class]] property to
+ * equal 'Function' in each case.
+ *
+ * The getJSClass() function we use is in a utility file, e.g. "shell.js"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'class-004.js';
+var i = 0;
+var UBound = 0;
+var BUGNUMBER = 56868;
+var summary = 'Testing the internal [[Class]] property of native error constructors';
+var statprefix = 'Current constructor is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Function' every time; see discussion above -
+ */
+status = 'Error';
+actual = getJSClass(Error);
+expect = 'Function';
+addThis();
+
+status = 'EvalError';
+actual = getJSClass(EvalError);
+expect = 'Function';
+addThis();
+
+status = 'RangeError';
+actual = getJSClass(RangeError);
+expect = 'Function';
+addThis();
+
+status = 'ReferenceError';
+actual = getJSClass(ReferenceError);
+expect = 'Function';
+addThis();
+
+status = 'SyntaxError';
+actual = getJSClass(SyntaxError);
+expect = 'Function';
+addThis();
+
+status = 'TypeError';
+actual = getJSClass(TypeError);
+expect = 'Function';
+addThis();
+
+status = 'URIError';
+actual = getJSClass(URIError);
+expect = 'Function';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/class-005.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-005.js
new file mode 100644
index 0000000000..f57d0681cf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/class-005.js
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 14 Mar 2001
+ *
+ * SUMMARY: Testing the internal [[Class]] property of user-defined types.
+ * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
+ *
+ * Same as class-001.js - but testing user-defined types here, not
+ * native types. Therefore we expect the [[Class]] property to equal
+ * 'Object' in each case -
+ *
+ * The getJSClass() function we use is in a utility file, e.g. "shell.js"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'class-005.js';
+var i = 0;
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing the internal [[Class]] property of user-defined types';
+var statprefix = 'Current user-defined type is: ';
+var status = ''; var statusList = [ ];
+var actual = ''; var actualvalue = [ ];
+var expect= ''; var expectedvalue = [ ];
+
+
+Calf.prototype= new Cow();
+
+/*
+ * We set the expect variable each time only for readability.
+ * We expect 'Object' every time; see discussion above -
+ */
+status = 'new Cow()';
+actual = getJSClass(new Cow());
+expect = 'Object';
+addThis();
+
+status = 'new Calf()';
+actual = getJSClass(new Calf());
+expect = 'Object';
+addThis();
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusList[UBound] = status;
+ actualvalue[UBound] = actual;
+ expectedvalue[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statprefix + statusList[i];
+}
+
+
+function Cow(name)
+{
+ this.name=name;
+}
+
+
+function Calf(name)
+{
+ this.name=name;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-361274.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-361274.js
new file mode 100755
index 0000000000..d3962004e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-361274.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jason Sachs
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-361274.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 361274;
+var summary = 'Embedded nulls in property names';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var x='123'+'\0'+'456';
+ var y='123'+'\0'+'789';
+ var a={};
+ a[x]=1;
+ a[y]=2;
+
+ reportCompare(1, a[x], summary + ': 123\\0456');
+ reportCompare(2, a[y], summary + ': 123\\0789');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-385393-07.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-385393-07.js
new file mode 100755
index 0000000000..0473fe4956
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-385393-07.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-385393-07.js';
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 385393;
+var summary = 'Regression test for bug 385393';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ (2).eval();
+ }
+ catch(ex)
+ {
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-72773.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-72773.js
new file mode 100644
index 0000000000..5b0dee62bf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-72773.js
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 09 May 2001
+ *
+ * SUMMARY: Regression test: we shouldn't crash on this code
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=72773
+ *
+ * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
+ *
+ * Same as class-001.js - but testing user-defined types here, not
+ * native types. Therefore we expect the [[Class]] property to equal
+ * 'Object' in each case -
+ *
+ * The getJSClass() function we use is in a utility file, e.g. "shell.js"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-72773.js';
+var BUGNUMBER = 72773;
+var summary = "Regression test: we shouldn't crash on this code";
+var status = '';
+var actual = '';
+var expect = '';
+var sToEval = '';
+
+/*
+ * This code should produce an error, but not a crash.
+ * 'TypeError: Function.prototype.toString called on incompatible object'
+ */
+sToEval += 'function Cow(name){this.name = name;}'
+sToEval += 'function Calf(str){this.name = str;}'
+sToEval += 'Calf.prototype = Cow;'
+sToEval += 'new Calf().toString();'
+
+status = 'Trying to catch an expected error';
+try
+{
+ eval(sToEval);
+}
+catch(e)
+{
+ actual = getJSClass(e);
+ expect = 'Error';
+}
+
+
+//----------------------------------------------------------------------------------------------
+test();
+//----------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ reportCompare(expect, actual, status);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-79129-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-79129-001.js
new file mode 100644
index 0000000000..efafed8047
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/regress-79129-001.js
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 06 May 2001
+ *
+ * SUMMARY: Regression test: we shouldn't crash on this code
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=79129
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-79129-001.js';
+var BUGNUMBER = 79129;
+var summary = "Regression test: we shouldn't crash on this code";
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ tryThis();
+ reportCompare('No Crash', 'No Crash', 'Should not crash');
+ exitFunc ('test');
+}
+
+
+function tryThis()
+{
+ obj={};
+ obj.a = obj.b = obj.c = 1;
+ delete obj.a;
+ delete obj.b;
+ delete obj.c;
+ obj.d = obj.e = 1;
+ obj.a=1;
+ obj.b=1;
+ obj.c=1;
+ obj.d=1;
+ obj.e=1;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Object/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Object/shell.js
new file mode 100644
index 0000000000..d0ee054485
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Object/shell.js
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 14 Mar 2001
+ *
+ * SUMMARY: Utility functions for testing objects -
+ *
+ * Suppose obj is an instance of a native type, e.g. Number.
+ * Then obj.toString() invokes Number.prototype.toString().
+ * We would also like to access Object.prototype.toString().
+ *
+ * The difference is this: suppose obj = new Number(7).
+ * Invoking Number.prototype.toString() on this just returns 7.
+ * Object.prototype.toString() on this returns '[object Number]'.
+ *
+ * The getJSType() function below will return '[object Number]' for us.
+ * The getJSClass() function returns 'Number', the [[Class]] property of obj.
+ * See ECMA-262 Edition 3, 13-Oct-1999, Section 8.6.2
+ */
+//-----------------------------------------------------------------------------
+
+gTestsubsuite = 'Object';
+
+var cnNoObject = 'Unexpected Error!!! Parameter to this function must be an object';
+var cnNoClass = 'Unexpected Error!!! Cannot find Class property';
+var cnObjectToString = Object.prototype.toString;
+var GLOBAL = 'global';
+
+// checks that it's safe to call findType()
+function getJSType(obj)
+{
+ if (isObject(obj))
+ return findType(obj);
+ return cnNoObject;
+}
+
+
+// checks that it's safe to call findType()
+function getJSClass(obj)
+{
+ if (isObject(obj))
+ return findClass(findType(obj));
+ return cnNoObject;
+}
+
+
+function findType(obj)
+{
+ return cnObjectToString.apply(obj);
+}
+
+
+// given '[object Number]', return 'Number'
+function findClass(sType)
+{
+ var re = /^\[.*\s+(\w+)\s*\]$/;
+ var a = sType.match(re);
+
+ if (a && a[1])
+ return a[1];
+ return cnNoClass;
+}
+
+
+function isObject(obj)
+{
+ return obj instanceof Object;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-001.js
new file mode 100644
index 0000000000..935eed2de1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-001.js
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * brendan@mozilla.org, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 08 May 2003
+ * SUMMARY: JS should evaluate RHS before binding LHS implicit variable
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=204919
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '11.13.1-001.js';
+var UBound = 0;
+var BUGNUMBER = 204919;
+var summary = 'JS should evaluate RHS before binding LHS implicit variable';
+var TEST_PASSED = 'ReferenceError';
+var TEST_FAILED = 'Generated an error, but NOT a ReferenceError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * global scope -
+ */
+status = inSection(1);
+try
+{
+ x = x;
+ actual = TEST_FAILED_BADLY;
+}
+catch(e)
+{
+ if (e instanceof ReferenceError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+expect = TEST_PASSED;
+addThis();
+
+
+/*
+ * function scope -
+ */
+status = inSection(2);
+try
+{
+ (function() {y = y;})();
+ actual = TEST_FAILED_BADLY;
+}
+catch(e)
+{
+ if (e instanceof ReferenceError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+expect = TEST_PASSED;
+addThis();
+
+
+/*
+ * eval scope -
+ */
+status = inSection(3);
+try
+{
+ eval('z = z');
+ actual = TEST_FAILED_BADLY;
+}
+catch(e)
+{
+ if (e instanceof ReferenceError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+expect = TEST_PASSED;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-002.js
new file mode 100755
index 0000000000..5d3307e4a7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.13.1-002.js
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Seno.Aiko@gmail.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.13.1-002.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 312354;
+var summary = '11.13.1 Simple Assignment should return type of RHS';
+var actual = '';
+var expect = '';
+
+// XXX this test should really test each property of the native
+// objects, but I'm too lazy. Patches accepted.
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var re = /x/g;
+var y = re.lastIndex = "7";
+
+expect = "string";
+actual = typeof y;
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-001.js
new file mode 100644
index 0000000000..7a5ed8f915
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-001.js
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@fastmail.fm, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 14 April 2003
+ * SUMMARY: |delete x.y| should return |true| if |x| has no property |y|
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=201987
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '11.4.1-001.js';
+var UBound = 0;
+var BUGNUMBER = 201987;
+var summary = '|delete x.y| should return |true| if |x| has no property |y|';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+var x = {};
+actual = delete x.y;
+expect = true;
+addThis();
+
+status = inSection(2);
+actual = delete {}.y;
+expect = true;
+addThis();
+
+status = inSection(3);
+actual = delete "".y;
+expect = true;
+addThis();
+
+status = inSection(4);
+actual = delete /abc/.y;
+expect = true;
+addThis();
+
+status = inSection(5);
+actual = delete (new Date()).y;
+expect = true;
+addThis();
+
+status = inSection(6);
+var x = 99;
+actual = delete x.y;
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-002.js
new file mode 100755
index 0000000000..c48565ba5f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Operators/11.4.1-002.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): x0
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '11.4.1-002.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 423300;
+var summary = '11.4.1 - The delete Operator - delete f()';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function f() {}
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = true;
+
+ try
+ {
+ actual = delete f();
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Operators/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Operators/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Operators/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Operators/order-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Operators/order-01.js
new file mode 100755
index 0000000000..671faceb81
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Operators/order-01.js
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'order-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 433672;
+var summary = 'operator evaluation order';
+var actual = '';
+var expect = '';
+
+function makeObject(label)
+{
+ var o = (function (){});
+
+ o.label = label;
+ o.valueOf = (function() { actual += this.label + ' valueOf, '; return Object.prototype.valueOf.call(this); });
+ o.toString = (function() { actual += this.label + ' toString, '; return Object.prototype.toString.call(this); });
+
+ return o;
+}
+
+operators = [
+ {section: '11.5.1', operator: '*'},
+ {section: '11.5.2', operator: '/'},
+ {section: '11.5.3', operator: '%'},
+ {section: '11.6.1', operator: '+'},
+ {section: '11.6.2', operator: '-'},
+ {section: '11.7.1', operator: '<<'},
+ {section: '11.7.2', operator: '>>'},
+ {section: '11.7.3', operator: '>>>'},
+ {section: '11.8.1', operator: '<'},
+ {section: '11.8.2', operator: '>'},
+ {section: '11.8.3', operator: '<='},
+ {section: '11.8.4', operator: '>='},
+ {section: '11.10', operator: '&'},
+ {section: '11.10', operator: '^'},
+ {section: '11.10', operator: '|'},
+ {section: '11.13.2', operator: '*='},
+ {section: '11.13.2', operator: '/='},
+ {section: '11.13.2', operator: '%='},
+ {section: '11.13.2', operator: '+='},
+ {section: '11.13.2', operator: '<<='},
+ {section: '11.13.2', operator: '>>='},
+ {section: '11.13.2', operator: '>>>='},
+ {section: '11.13.2', operator: '&='},
+ {section: '11.13.2', operator: '^='},
+ {section: '11.13.2', operator: '|='},
+ ];
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < operators.length; i++)
+ {
+ expect = 'left valueOf, left toString, right valueOf, right toString, ';
+ actual = '';
+
+ var left = makeObject('left');
+ var right = makeObject('right');
+
+ eval('left ' + operators[i].operator + ' right');
+
+ reportCompare(expect, actual, summary + ': ' + operators[i].section + ' ' + operators[i].operator);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Operators/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Operators/shell.js
new file mode 100644
index 0000000000..910515cfe4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Operators/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Operators';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/README b/tests/auto/qml/parserstress/tests/ecma_3/README
new file mode 100755
index 0000000000..eebd421c2e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/README
@@ -0,0 +1 @@
+ECMA 262 Edition 3
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2-1.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2-1.js
new file mode 100644
index 0000000000..9439a2ccd6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2-1.js
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * rogerl@netscape.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 09 July 2002
+ * SUMMARY: RegExp conformance test
+ *
+ * These gTestcases are derived from the examples in the ECMA-262 Ed.3 spec
+ * scattered through section 15.10.2.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.2-1.js';
+var i = 0;
+var BUGNUMBER = '(none)';
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /a|ab/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(2);
+pattern = /((a)|(ab))((c)|(bc))/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'a', 'a', undefined, 'bc', undefined, 'bc');
+addThis();
+
+status = inSection(3);
+pattern = /a[a-z]{2,4}/;
+string = 'abcdefghi';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcde');
+addThis();
+
+status = inSection(4);
+pattern = /a[a-z]{2,4}?/;
+string = 'abcdefghi';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(5);
+pattern = /(aa|aabaac|ba|b|c)*/;
+string = 'aabaac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaba', 'ba');
+addThis();
+
+status = inSection(6);
+pattern = /^(a+)\1*,\1+$/;
+string = 'aaaaaaaaaa,aaaaaaaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaaaa,aaaaaaaaaaaaaaa', 'aaaaa');
+addThis();
+
+status = inSection(7);
+pattern = /(z)((a+)?(b+)?(c))*/;
+string = 'zaacbbbcac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('zaacbbbcac', 'z', 'ac', 'a', undefined, 'c');
+addThis();
+
+status = inSection(8);
+pattern = /(a*)*/;
+string = 'b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', undefined);
+addThis();
+
+status = inSection(9);
+pattern = /(a*)b\1+/;
+string = 'baaaac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('b', '');
+addThis();
+
+status = inSection(10);
+pattern = /(?=(a+))/;
+string = 'baaabac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', 'aaa');
+addThis();
+
+status = inSection(11);
+pattern = /(?=(a+))a*b\1/;
+string = 'baaabac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aba', 'a');
+addThis();
+
+status = inSection(12);
+pattern = /(.*?)a(?!(a+)b\2c)\2(.*)/;
+string = 'baaabaac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('baaabaac', 'ba', undefined, 'abaac');
+addThis();
+
+status = inSection(13);
+pattern = /(?=(a+))/;
+string = 'baaabac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', 'aaa');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2.12.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2.12.js
new file mode 100755
index 0000000000..d68b86c2ed
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.2.12.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Tandetnik
+ * Martin Honnen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.10.2.12.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 378738;
+var summary = '15.10.2.12 - CharacterClassEscape \d';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = false;
+ actual = /\d/.test("\uFF11");
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-1.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-1.js
new file mode 100644
index 0000000000..7286cea297
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-1.js
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 26 November 2000
+ *
+ *
+ * SUMMARY: Passing (RegExp object, flag) to RegExp() function.
+ * This test arose from Bugzilla bug 61266. The ECMA3 section is:
+ *
+ * 15.10.3 The RegExp Constructor Called as a Function
+ *
+ * 15.10.3.1 RegExp(pattern, flags)
+ *
+ * If pattern is an object R whose [[Class]] property is "RegExp"
+ * and flags is undefined, then return R unchanged. Otherwise
+ * call the RegExp constructor (section 15.10.4.1), passing it the
+ * pattern and flags arguments and return the object constructed
+ * by that constructor.
+ *
+ *
+ * The current test will check the first scenario outlined above:
+ *
+ * "pattern" is itself a RegExp object R
+ * "flags" is undefined
+ *
+ * The flags parameter will be undefined in the sense of not being
+ * provided. We check that RegExp(R) returns R -
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.3.1-1.js';
+var BUGNUMBER = '61266';
+var summary = 'Passing (RegExp object,flag) to RegExp() function';
+var statprefix = 'RegExp(new RegExp(';
+var comma = ', '; var singlequote = "'"; var closeparens = '))';
+var cnSUCCESS = 'RegExp() returned the supplied RegExp object';
+var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object';
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj = {};
+var status = ''; var actual = ''; var expect = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj = new RegExp(s, f);
+
+ actual = (obj == RegExp(obj))? cnSUCCESS : cnFAILURE;
+ expect = cnSUCCESS;
+ reportCompare (expect, actual, status);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + comma + flag + closeparens);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-2.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-2.js
new file mode 100644
index 0000000000..d78be13c25
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.3.1-2.js
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 26 November 2000
+ *
+ *
+ * SUMMARY: Passing (RegExp object, flag) to RegExp() function.
+ * This test arose from Bugzilla bug 61266. The ECMA3 section is:
+ *
+ * 15.10.3 The RegExp Constructor Called as a Function
+ *
+ * 15.10.3.1 RegExp(pattern, flags)
+ *
+ * If pattern is an object R whose [[Class]] property is "RegExp"
+ * and flags is undefined, then return R unchanged. Otherwise
+ * call the RegExp constructor (section 15.10.4.1), passing it the
+ * pattern and flags arguments and return the object constructed
+ * by that constructor.
+ *
+ *
+ * The current test will check the first scenario outlined above:
+ *
+ * "pattern" is itself a RegExp object R
+ * "flags" is undefined
+ *
+ * This test is identical to test 15.10.3.1-1.js, except here we do:
+ *
+ * RegExp(R, undefined);
+ *
+ * instead of:
+ *
+ * RegExp(R);
+ *
+ *
+ * We check that RegExp(R, undefined) returns R -
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.3.1-2.js';
+var BUGNUMBER = '61266';
+var summary = 'Passing (RegExp object,flag) to RegExp() function';
+var statprefix = 'RegExp(new RegExp(';
+var comma = ', '; var singlequote = "'"; var closeparens = '))';
+var cnSUCCESS = 'RegExp() returned the supplied RegExp object';
+var cnFAILURE = 'RegExp() did NOT return the supplied RegExp object';
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj = {};
+var status = ''; var actual = ''; var expect = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj = new RegExp(s, f);
+
+ actual = (obj == RegExp(obj, undefined))? cnSUCCESS : cnFAILURE ;
+ expect = cnSUCCESS;
+ reportCompare (expect, actual, status);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + comma + flag + closeparens);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-1.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-1.js
new file mode 100644
index 0000000000..47faf0051b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-1.js
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 26 November 2000
+ *
+ *
+ *SUMMARY: Passing a RegExp object to a RegExp() constructor.
+ *This test arose from Bugzilla bug 61266. The ECMA3 section is:
+ *
+ * 15.10.4.1 new RegExp(pattern, flags)
+ *
+ * If pattern is an object R whose [[Class]] property is "RegExp" and
+ * flags is undefined, then let P be the pattern used to construct R
+ * and let F be the flags used to construct R. If pattern is an object R
+ * whose [[Class]] property is "RegExp" and flags is not undefined,
+ * then throw a TypeError exception. Otherwise, let P be the empty string
+ * if pattern is undefined and ToString(pattern) otherwise, and let F be
+ * the empty string if flags is undefined and ToString(flags) otherwise.
+ *
+ *
+ *The current test will check the first scenario outlined above:
+ *
+ * "pattern" is itself a RegExp object R
+ * "flags" is undefined
+ *
+ * We check that a new RegExp object obj2 defined from these parameters
+ * is morally the same as the original RegExp object obj1. Of course, they
+ * can't be equal as objects - so we check their enumerable properties...
+ *
+ * In this test, the initial RegExp object obj1 will not include a
+ * flag. The flags parameter for obj2 will be undefined in the sense
+ * of not being provided.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.4.1-1.js';
+var BUGNUMBER = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+ status =getStatus(s);
+ obj1 = new RegExp(s);
+ obj2 = new RegExp(obj1);
+
+ reportCompare (obj1 + '', obj2 + '', status);
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp)
+{
+ return (statprefix + quote(regexp) + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-2.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-2.js
new file mode 100644
index 0000000000..1d67b8afe6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-2.js
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 26 November 2000
+ *
+ *
+ *SUMMARY: Passing a RegExp object to a RegExp() constructor.
+ *This test arose from Bugzilla bug 61266. The ECMA3 section is:
+ *
+ * 15.10.4.1 new RegExp(pattern, flags)
+ *
+ * If pattern is an object R whose [[Class]] property is "RegExp" and
+ * flags is undefined, then let P be the pattern used to construct R
+ * and let F be the flags used to construct R. If pattern is an object R
+ * whose [[Class]] property is "RegExp" and flags is not undefined,
+ * then throw a TypeError exception. Otherwise, let P be the empty string
+ * if pattern is undefined and ToString(pattern) otherwise, and let F be
+ * the empty string if flags is undefined and ToString(flags) otherwise.
+ *
+ *
+ *The current test will check the first scenario outlined above:
+ *
+ * "pattern" is itself a RegExp object R
+ * "flags" is undefined
+ *
+ * We check that a new RegExp object obj2 defined from these parameters
+ * is morally the same as the original RegExp object obj1. Of course, they
+ * can't be equal as objects - so we check their enumerable properties...
+ *
+ * In this test, the initial RegExp object obj1 will not include a
+ * flag. This test is identical to test 15.10.4.1-1.js, except that
+ * here we use this syntax:
+ *
+ * obj2 = new RegExp(obj1, undefined);
+ *
+ * instead of:
+ *
+ * obj2 = new RegExp(obj1);
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.4.1-2.js';
+var BUGNUMBER = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+ status =getStatus(s);
+ obj1 = new RegExp(s);
+ obj2 = new RegExp(obj1, undefined); // see introduction to bug
+
+ reportCompare (obj1 + '', obj2 + '', status);
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp)
+{
+ return (statprefix + quote(regexp) + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-3.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-3.js
new file mode 100644
index 0000000000..12ef46bde8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-3.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 26 November 2000
+ *
+ *
+ *SUMMARY: Passing a RegExp object to a RegExp() constructor.
+ *This test arose from Bugzilla bug 61266. The ECMA3 section is:
+ *
+ * 15.10.4.1 new RegExp(pattern, flags)
+ *
+ * If pattern is an object R whose [[Class]] property is "RegExp" and
+ * flags is undefined, then let P be the pattern used to construct R
+ * and let F be the flags used to construct R. If pattern is an object R
+ * whose [[Class]] property is "RegExp" and flags is not undefined,
+ * then throw a TypeError exception. Otherwise, let P be the empty string
+ * if pattern is undefined and ToString(pattern) otherwise, and let F be
+ * the empty string if flags is undefined and ToString(flags) otherwise.
+ *
+ *
+ *The current test will check the first scenario outlined above:
+ *
+ * "pattern" is itself a RegExp object R
+ * "flags" is undefined
+ *
+ * We check that a new RegExp object obj2 defined from these parameters
+ * is morally the same as the original RegExp object obj1. Of course, they
+ * can't be equal as objects - so we check their enumerable properties...
+ *
+ * In this test, the initial RegExp obj1 will include a flag. The flags
+ * parameter for obj2 will be undefined in the sense of not being provided.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.4.1-3.js';
+var BUGNUMBER = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statmiddle = ' and flag ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var j = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj1 = new RegExp(s, f);
+ obj2 = new RegExp(obj1);
+
+ reportCompare (obj1 + '', obj2 + '', status);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statmiddle + flag + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-4.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-4.js
new file mode 100644
index 0000000000..3b4245851e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-4.js
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 26 November 2000
+ *
+ *
+ *SUMMARY: Passing a RegExp object to a RegExp() constructor.
+ *This test arose from Bugzilla bug 61266. The ECMA3 section is:
+ *
+ * 15.10.4.1 new RegExp(pattern, flags)
+ *
+ * If pattern is an object R whose [[Class]] property is "RegExp" and
+ * flags is undefined, then let P be the pattern used to construct R
+ * and let F be the flags used to construct R. If pattern is an object R
+ * whose [[Class]] property is "RegExp" and flags is not undefined,
+ * then throw a TypeError exception. Otherwise, let P be the empty string
+ * if pattern is undefined and ToString(pattern) otherwise, and let F be
+ * the empty string if flags is undefined and ToString(flags) otherwise.
+ *
+ *
+ *The current test will check the first scenario outlined above:
+ *
+ * "pattern" is itself a RegExp object R
+ * "flags" is undefined
+ *
+ * We check that a new RegExp object obj2 defined from these parameters
+ * is morally the same as the original RegExp object obj1. Of course, they
+ * can't be equal as objects - so we check their enumerable properties...
+ *
+ * In this test, the initial RegExp object obj1 will include a
+ * flag. This test is identical to test 15.10.4.1-3.js, except that
+ * here we use this syntax:
+ *
+ * obj2 = new RegExp(obj1, undefined);
+ *
+ * instead of:
+ *
+ * obj2 = new RegExp(obj1);
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.4.1-4.js';
+var BUGNUMBER = '61266';
+var summary = 'Passing a RegExp object to a RegExp() constructor';
+var statprefix = 'Applying RegExp() twice to pattern ';
+var statmiddle = ' and flag ';
+var statsuffix = '; testing property ';
+var singlequote = "'";
+var i = -1; var j = -1; var s = '';
+var obj1 = {}; var obj2 = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+flags[3] = undefined;
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ obj1 = new RegExp(s, f);
+ obj2 = new RegExp(obj1, undefined); // see introduction to bug
+
+ reportCompare (obj1 + '', obj2 + '', status);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statmiddle + flag + statsuffix);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-5-n.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-5-n.js
new file mode 100644
index 0000000000..592fb03ac7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.4.1-5-n.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.10.4.1-5-n.js';
+/*
+ *
+ * Date: 26 November 2000
+ *
+ *
+ *SUMMARY: Passing a RegExp object to a RegExp() constructor.
+ *This test arose from Bugzilla bug 61266. The ECMA3 section is:
+ *
+ * 15.10.4.1 new RegExp(pattern, flags)
+ *
+ * If pattern is an object R whose [[Class]] property is "RegExp" and
+ * flags is undefined, then let P be the pattern used to construct R
+ * and let F be the flags used to construct R. If pattern is an object R
+ * whose [[Class]] property is "RegExp" and flags is not undefined,
+ * then throw a TypeError exception. Otherwise, let P be the empty string
+ * if pattern is undefined and ToString(pattern) otherwise, and let F be
+ * the empty string if flags is undefined and ToString(flags) otherwise.
+ *
+ *
+ *The current test will check the second scenario outlined above:
+ *
+ * "pattern" is itself a RegExp object R
+ * "flags" is NOT undefined
+ *
+ * This should throw an exception ... we test for this.
+ *
+ */
+
+//-------------------------------------------------------------------------------------------------
+var BUGNUMBER = '61266';
+var summary = 'Negative test: Passing (RegExp object, flag) to RegExp() constructor';
+var statprefix = 'Passing RegExp object on pattern ';
+var statsuffix = '; passing flag ';
+var cnFAILURE = 'Expected an exception to be thrown, but none was -';
+var singlequote = "'";
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj1 = {}; var obj2 = {};
+var patterns = new Array();
+var flags = new Array();
+
+
+// various regular expressions to try -
+patterns[0] = '';
+patterns[1] = 'abc';
+patterns[2] = '(.*)(3-1)\s\w';
+patterns[3] = '(.*)(...)\\s\\w';
+patterns[4] = '[^A-Za-z0-9_]';
+patterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// various flags to try -
+flags[0] = 'i';
+flags[1] = 'g';
+flags[2] = 'm';
+
+
+DESCRIPTION = "Negative test: Passing (RegExp object, flag) to RegExp() constructor"
+ EXPECTED = "error";
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ printStatus(getStatus(s, f));
+ obj1 = new RegExp(s, f);
+ obj2 = new RegExp(obj1, f); // this should cause an exception
+
+ // WE SHOULD NEVER REACH THIS POINT -
+ reportCompare('PASS', 'FAIL', cnFAILURE);
+ }
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statsuffix + flag);
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-1.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-1.js
new file mode 100644
index 0000000000..8203da4967
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-1.js
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 23 October 2001
+ *
+ * SUMMARY: Testing regexps with the global flag set.
+ * NOT every substring fitting the given pattern will be matched.
+ * The parent string is CONSUMED as successive matches are found.
+ *
+ * From the ECMA-262 Final spec:
+ *
+ * 15.10.6.2 RegExp.prototype.exec(string)
+ * Performs a regular expression match of string against the regular
+ * expression and returns an Array object containing the results of
+ * the match, or null if the string did not match.
+ *
+ * The string ToString(string) is searched for an occurrence of the
+ * regular expression pattern as follows:
+ *
+ * 1. Let S be the value of ToString(string).
+ * 2. Let length be the length of S.
+ * 3. Let lastIndex be the value of the lastIndex property.
+ * 4. Let i be the value of ToInteger(lastIndex).
+ * 5. If the global property is false, let i = 0.
+ * 6. If i < 0 or i > length then set lastIndex to 0 and return null.
+ * 7. Call [[Match]], giving it the arguments S and i.
+ * If [[Match]] returned failure, go to step 8;
+ * otherwise let r be its State result and go to step 10.
+ * 8. Let i = i+1.
+ * 9. Go to step 6.
+ * 10. Let e be r's endIndex value.
+ * 11. If the global property is true, set lastIndex to e.
+ *
+ * etc.
+ *
+ *
+ * So when the global flag is set, |lastIndex| is incremented every time
+ * there is a match; not from i to i+1, but from i to "endIndex" e:
+ *
+ * e = (index of last input character matched so far by the pattern) + 1
+ *
+ * Thus in the example below, the first endIndex e occurs after the
+ * first match 'a b'. The next match will begin AFTER this, and so
+ * will NOT be 'b c', but rather 'c d'. Similarly, 'd e' won't be matched.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.6.2-1.js';
+var i = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing regexps with the global flag set';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'a b c d e';
+pattern = /\w\s\w/g;
+actualmatch = string.match(pattern);
+expectedmatch = ['a b','c d']; // see above explanation -
+addThis();
+
+
+status = inSection(2);
+string = '12345678';
+pattern = /\d\d\d/g;
+actualmatch = string.match(pattern);
+expectedmatch = ['123','456'];
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-2.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-2.js
new file mode 100644
index 0000000000..e6fd6c6311
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/15.10.6.2-2.js
@@ -0,0 +1,367 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 18 Feb 2002
+ * SUMMARY: Testing re.exec(str) when re.lastIndex is < 0 or > str.length
+ *
+ * Case 1: If re has the global flag set, then re(str) should be null
+ * Case 2: If re doesn't have this set, then re(str) should be unaffected
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=76717
+ *
+ *
+ * From the ECMA-262 Final spec:
+ *
+ * 15.10.6.2 RegExp.prototype.exec(string)
+ * Performs a regular expression match of string against the regular
+ * expression and returns an Array object containing the results of
+ * the match, or null if the string did not match.
+ *
+ * The string ToString(string) is searched for an occurrence of the
+ * regular expression pattern as follows:
+ *
+ * 1. Let S be the value of ToString(string).
+ * 2. Let length be the length of S.
+ * 3. Let lastIndex be the value of the lastIndex property.
+ * 4. Let i be the value of ToInteger(lastIndex).
+ * 5. If the global property is false, let i = 0.
+ * 6. If i < 0 or i > length then set lastIndex to 0 and return null.
+ * 7. Call [[Match]], giving it the arguments S and i.
+ * If [[Match]] returned failure, go to step 8;
+ * otherwise let r be its State result and go to step 10.
+ * 8. Let i = i+1.
+ * 9. Go to step 6.
+ * 10. Let e be r's endIndex value.
+ * 11. If the global property is true, set lastIndex to e.
+ *
+ * etc.
+ *
+ *
+ * So:
+ *
+ * A. If the global flag is not set, |lastIndex| is set to 0
+ * before the match is attempted; thus the match is unaffected.
+ *
+ * B. If the global flag IS set and re.lastIndex is >= 0 and <= str.length,
+ * |lastIndex| is incremented every time there is a match; not from
+ * i to i+1, but from i to "endIndex" e:
+ *
+ * e = (index of last input character matched so far by the pattern) + 1
+ *
+ * The match is then attempted from this position in the string (Step 7).
+ *
+ * C. When the global flag IS set and re.lastIndex is < 0 or > str.length,
+ * |lastIndex| is set to 0 and the match returns null.
+ *
+ *
+ * Note the |lastIndex| property is writeable, and may be set arbitrarily
+ * by the programmer - and we will do that below.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '15.10.6.2-2.js';
+var i = 0;
+var BUGNUMBER = 76717;
+var summary = 'Testing re.exec(str) when re.lastIndex is < 0 or > str.length';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/******************************************************************************
+ *
+ * Case 1 : when the global flag is set -
+ *
+ *****************************************************************************/
+pattern = /abc/gi;
+string = 'AbcaBcabC';
+
+status = inSection(1);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc');
+addThis();
+
+status = inSection(2);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('aBc');
+addThis();
+
+status = inSection(3);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('abC');
+addThis();
+
+/*
+ * At this point |lastIndex| is > string.length, so the match should be null -
+ */
+status = inSection(4);
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+/*
+ * Now let's set |lastIndex| to -1, so the match should again be null -
+ */
+status = inSection(5);
+pattern.lastIndex = -1;
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+/*
+ * Now try some edge-case values. Thanks to the work done in
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex|
+ * is now stored as a double instead of a uint32 (unsigned integer).
+ *
+ * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
+ * all the way up to Number.MAX_VALUE. So that's why we need cases
+ * between those two numbers.
+ */
+status = inSection(6);
+pattern.lastIndex = Math.pow(2,32);
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(7);
+pattern.lastIndex = -Math.pow(2,32);
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(8);
+pattern.lastIndex = Math.pow(2,32) + 1;
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(9);
+pattern.lastIndex = -(Math.pow(2,32) + 1);
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(10);
+pattern.lastIndex = Math.pow(2,32) * 2;
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(11);
+pattern.lastIndex = -Math.pow(2,32) * 2;
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(12);
+pattern.lastIndex = Math.pow(2,40);
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(13);
+pattern.lastIndex = -Math.pow(2,40);
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(14);
+pattern.lastIndex = Number.MAX_VALUE;
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+status = inSection(15);
+pattern.lastIndex = -Number.MAX_VALUE;
+actualmatch = pattern.exec(string);
+expectedmatch = null;
+addThis();
+
+
+
+/******************************************************************************
+ *
+ * Case 2: repeat all the above cases WITHOUT the global flag set.
+ * According to EMCA. |lastIndex| should get set to 0 before the match.
+ *
+ * Therefore re.exec(str) should be unaffected; thus our expected values
+ * below are now DIFFERENT when |lastIndex| is < 0 or > str.length
+ *
+ *****************************************************************************/
+
+pattern = /abc/i;
+string = 'AbcaBcabC';
+
+status = inSection(16);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc');
+addThis();
+
+status = inSection(17);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc'); // NOT Array('aBc') as before -
+addThis();
+
+status = inSection(18);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc'); // NOT Array('abC') as before -
+addThis();
+
+/*
+ * At this point above, |lastIndex| WAS > string.length, but not here -
+ */
+status = inSection(19);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+/*
+ * Now let's set |lastIndex| to -1
+ */
+status = inSection(20);
+pattern.lastIndex = -1;
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+/*
+ * Now try some edge-case values. Thanks to the work done in
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, |lastIndex|
+ * is now stored as a double instead of a uint32 (unsigned integer).
+ *
+ * Note 2^32 -1 is the upper bound for uint32's, but doubles can go
+ * all the way up to Number.MAX_VALUE. So that's why we need cases
+ * between those two numbers.
+ */
+status = inSection(21);
+pattern.lastIndex = Math.pow(2,32);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(22);
+pattern.lastIndex = -Math.pow(2,32);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(23);
+pattern.lastIndex = Math.pow(2,32) + 1;
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(24);
+pattern.lastIndex = -(Math.pow(2,32) + 1);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(25);
+pattern.lastIndex = Math.pow(2,32) * 2;
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(26);
+pattern.lastIndex = -Math.pow(2,32) * 2;
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(27);
+pattern.lastIndex = Math.pow(2,40);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -;
+ addThis();
+
+status = inSection(28);
+pattern.lastIndex = -Math.pow(2,40);
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(29);
+pattern.lastIndex = Number.MAX_VALUE;
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+status = inSection(30);
+pattern.lastIndex = -Number.MAX_VALUE;
+actualmatch = pattern.exec(string);
+expectedmatch = Array('Abc') // NOT null as before -
+ addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-001.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-001.js
new file mode 100644
index 0000000000..f35724e47b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-001.js
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 18 July 2002
+ * SUMMARY: Testing octal sequences in regexps
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=141078
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'octal-001.js';
+var i = 0;
+var BUGNUMBER = 141078;
+var summary = 'Testing octal sequences in regexps';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /\240/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/*
+ * In the following sections, we test the octal escape sequence '\052'.
+ * This is character code 42, representing the asterisk character '*'.
+ * The Unicode escape for it would be '\u002A', the hex escape '\x2A'.
+ */
+status = inSection(2);
+pattern = /ab\052c/;
+string = 'ab*c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab*c');
+addThis();
+
+status = inSection(3);
+pattern = /ab\052*c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(4);
+pattern = /ab(\052)+c/;
+string = 'ab****c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab****c', '*');
+addThis();
+
+status = inSection(5);
+pattern = /ab((\052)+)c/;
+string = 'ab****c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab****c', '****', '*');
+addThis();
+
+status = inSection(6);
+pattern = /(?:\052)c/;
+string = 'ab****c';
+actualmatch = string.match(pattern);
+expectedmatch = Array('*c');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js
new file mode 100644
index 0000000000..053720d7e9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 31 July 2002
+ * SUMMARY: Testing regexps containing octal escape sequences
+ * This is an elaboration of mozilla/js/tests/ecma_2/RegExp/octal-003.js
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=141078
+ * for a reference on octal escape sequences in regexps.
+ *
+ * NOTE:
+ * We will use the identities '\011' === '\u0009' === '\x09' === '\t'
+ *
+ * The first is an octal escape sequence (\(0-3)OO; O an octal digit).
+ * See ECMA-262 Edition 2, Section 7.7.4 "String Literals". These were
+ * dropped in Edition 3 but we support them for backward compatibility.
+ *
+ * The second is a Unicode escape sequence (\uHHHH; H a hex digit).
+ * Since octal 11 = hex 9, the two escapes define the same character.
+ *
+ * The third is a hex escape sequence (\xHH; H a hex digit).
+ * Since hex 09 = hex 0009, this defines the same character.
+ *
+ * The fourth is the familiar escape sequence for a horizontal tab,
+ * defined in the ECMA spec as having Unicode value \u0009.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'octal-002.js';
+var i = 0;
+var BUGNUMBER = 141078;
+var summary = 'Testing regexps containing octal escape sequences';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * Test a string containing the null character '\0' followed by the string '11'
+ *
+ * 'a' + String.fromCharCode(0) + '11';
+ *
+ * Note we can't simply write 'a\011', because '\011' would be interpreted
+ * as the octal escape sequence for the tab character (see above).
+ *
+ * We should get no match from the regexp /.\011/, because it should be
+ * looking for the octal escape sequence \011, i.e. the tab character -
+ *
+ */
+status = inSection(1);
+pattern = /.\011/;
+string = 'a' + String.fromCharCode(0) + '11';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+/*
+ * Try same thing with 'xx' in place of '11'.
+ *
+ * Should get a match now, because the octal escape sequence in the regexp
+ * has been reduced from \011 to \0, and '\0' is present in the string -
+ */
+status = inSection(2);
+pattern = /.\0xx/;
+string = 'a' + String.fromCharCode(0) + 'xx';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Same thing; don't use |String.fromCharCode(0)| this time.
+ * There is no ambiguity in '\0xx': it is the null character
+ * followed by two x's, no other interpretation is possible.
+ */
+status = inSection(3);
+pattern = /.\0xx/;
+string = 'a\0xx';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-001.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-001.js
new file mode 100644
index 0000000000..0b27529a32
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-001.js
@@ -0,0 +1,3230 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com, rogerl@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 2002-07-07
+ * SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine.
+ * Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested.
+ *
+ * This test was created by running various patterns and strings through the
+ * Perl 5 RegExp engine. We saved the results below to test the JS engine.
+ *
+ * NOTE: ECMA/JS and Perl do differ on certain points. We have either commented
+ * out such sections altogether, or modified them to fit what we expect from JS.
+ *
+ * EXAMPLES:
+ *
+ * - In JS, regexp captures (/(a) etc./) must hold |undefined| if not used.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=123437.
+ * By contrast, in Perl, unmatched captures hold the empty string.
+ * We have modified such sections accordingly. Example:
+
+ pattern = /^([^a-z])|(\^)$/;
+ string = '.';
+ actualmatch = string.match(pattern);
+ //expectedmatch = Array('.', '.', ''); <<<--- Perl
+ expectedmatch = Array('.', '.', undefined); <<<--- JS
+ addThis();
+
+
+ * - In JS, you can't refer to a capture before it's encountered & completed
+ *
+ * - Perl supports ] & ^] inside a [], ECMA does not
+ *
+ * - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc.
+ *
+ * - ECMA doesn't support (?imsx or (?-imsx
+ *
+ * - ECMA doesn't support (?(condition)
+ *
+ * - Perl has \Z has end-of-line, ECMA doesn't
+ *
+ * - In ECMA, ^ matches only the empty string before the first character
+ *
+ * - In ECMA, $ matches only the empty string at end of input (unless multiline)
+ *
+ * - ECMA spec says that each atom in a range must be a single character
+ *
+ * - ECMA doesn't support \A
+ *
+ * - ECMA doesn't have rules for [:
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'perlstress-001.js';
+var i = 0;
+var BUGNUMBER = 85721;
+var summary = 'Testing regular expression edge cases';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+var cnLBOUND = 1;
+var cnUBOUND = 1000;
+
+
+status = inSection(1);
+pattern = /abc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(2);
+pattern = /abc/;
+string = 'xabcy';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(3);
+pattern = /abc/;
+string = 'ababc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(4);
+pattern = /ab*c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(5);
+pattern = /ab*bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(6);
+pattern = /ab*bc/;
+string = 'abbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbc');
+addThis();
+
+status = inSection(7);
+pattern = /ab*bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(8);
+pattern = /.{1}/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(9);
+pattern = /.{3,4}/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbb');
+addThis();
+
+status = inSection(10);
+pattern = /ab{0,}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(11);
+pattern = /ab+bc/;
+string = 'abbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbc');
+addThis();
+
+status = inSection(12);
+pattern = /ab+bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(13);
+pattern = /ab{1,}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(14);
+pattern = /ab{1,3}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(15);
+pattern = /ab{3,4}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbbc');
+addThis();
+
+status = inSection(16);
+pattern = /ab?bc/;
+string = 'abbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbc');
+addThis();
+
+status = inSection(17);
+pattern = /ab?bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(18);
+pattern = /ab{0,1}bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(19);
+pattern = /ab?c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(20);
+pattern = /ab{0,1}c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(21);
+pattern = /^abc$/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(22);
+pattern = /^abc/;
+string = 'abcc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(23);
+pattern = /abc$/;
+string = 'aabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(24);
+pattern = /^/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(25);
+pattern = /$/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(26);
+pattern = /a.c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(27);
+pattern = /a.c/;
+string = 'axc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('axc');
+addThis();
+
+status = inSection(28);
+pattern = /a.*c/;
+string = 'axyzc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('axyzc');
+addThis();
+
+status = inSection(29);
+pattern = /a[bc]d/;
+string = 'abd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abd');
+addThis();
+
+status = inSection(30);
+pattern = /a[b-d]e/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace');
+addThis();
+
+status = inSection(31);
+pattern = /a[b-d]/;
+string = 'aac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ac');
+addThis();
+
+status = inSection(32);
+pattern = /a[-b]/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-');
+addThis();
+
+status = inSection(33);
+pattern = /a[b-]/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-');
+addThis();
+
+status = inSection(34);
+pattern = /a]/;
+string = 'a]';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a]');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+ pattern = /a[]]b/;
+ status = inSection(35);
+ string = 'a]b';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a]b');
+ addThis();
+*/
+
+status = inSection(36);
+pattern = /a[^bc]d/;
+string = 'aed';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aed');
+addThis();
+
+status = inSection(37);
+pattern = /a[^-b]c/;
+string = 'adc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('adc');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+ status = inSection(38);
+ pattern = /a[^]b]c/;
+ string = 'adc';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('adc');
+ addThis();
+*/
+
+status = inSection(39);
+pattern = /\ba\b/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(40);
+pattern = /\ba\b/;
+string = '-a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(41);
+pattern = /\ba\b/;
+string = '-a-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(42);
+pattern = /\By\b/;
+string = 'xy';
+actualmatch = string.match(pattern);
+expectedmatch = Array('y');
+addThis();
+
+status = inSection(43);
+pattern = /\by\B/;
+string = 'yz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('y');
+addThis();
+
+status = inSection(44);
+pattern = /\By\B/;
+string = 'xyz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('y');
+addThis();
+
+status = inSection(45);
+pattern = /\w/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(46);
+pattern = /\W/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(47);
+pattern = /a\Sb/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-b');
+addThis();
+
+status = inSection(48);
+pattern = /\d/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = Array('1');
+addThis();
+
+status = inSection(49);
+pattern = /\D/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(50);
+pattern = /[\w]/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(51);
+pattern = /[\W]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(52);
+pattern = /a[\S]b/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a-b');
+addThis();
+
+status = inSection(53);
+pattern = /[\d]/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = Array('1');
+addThis();
+
+status = inSection(54);
+pattern = /[\D]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('-');
+addThis();
+
+status = inSection(55);
+pattern = /ab|cd/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(56);
+pattern = /ab|cd/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(57);
+pattern = /()ef/;
+string = 'def';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ef', '');
+addThis();
+
+status = inSection(58);
+pattern = /a\(b/;
+string = 'a(b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a(b');
+addThis();
+
+status = inSection(59);
+pattern = /a\(*b/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(60);
+pattern = /a\(*b/;
+string = 'a((b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a((b');
+addThis();
+
+status = inSection(61);
+pattern = /a\\b/;
+string = 'a\\b';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a\\b');
+addThis();
+
+status = inSection(62);
+pattern = /((a))/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a');
+addThis();
+
+status = inSection(63);
+pattern = /(a)b(c)/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'a', 'c');
+addThis();
+
+status = inSection(64);
+pattern = /a+b+c/;
+string = 'aabbabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(65);
+pattern = /a{1,}b{1,}c/;
+string = 'aabbabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(66);
+pattern = /a.+?c/;
+string = 'abcabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc');
+addThis();
+
+status = inSection(67);
+pattern = /(a+|b)*/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(68);
+pattern = /(a+|b){0,}/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(69);
+pattern = /(a+|b)+/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(70);
+pattern = /(a+|b){1,}/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'b');
+addThis();
+
+status = inSection(71);
+pattern = /(a+|b)?/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(72);
+pattern = /(a+|b){0,1}/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(73);
+pattern = /[^ab]*/;
+string = 'cde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('cde');
+addThis();
+
+status = inSection(74);
+pattern = /([abc])*d/;
+string = 'abbbcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abbbcd', 'c');
+addThis();
+
+status = inSection(75);
+pattern = /([abc])*bcd/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'a');
+addThis();
+
+status = inSection(76);
+pattern = /a|b|c|d|e/;
+string = 'e';
+actualmatch = string.match(pattern);
+expectedmatch = Array('e');
+addThis();
+
+status = inSection(77);
+pattern = /(a|b|c|d|e)f/;
+string = 'ef';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ef', 'e');
+addThis();
+
+status = inSection(78);
+pattern = /abcd*efg/;
+string = 'abcdefg';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcdefg');
+addThis();
+
+status = inSection(79);
+pattern = /ab*/;
+string = 'xabyabbbz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+status = inSection(80);
+pattern = /ab*/;
+string = 'xayabbbz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(81);
+pattern = /(ab|cd)e/;
+string = 'abcde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('cde', 'cd');
+addThis();
+
+status = inSection(82);
+pattern = /[abhgefdc]ij/;
+string = 'hij';
+actualmatch = string.match(pattern);
+expectedmatch = Array('hij');
+addThis();
+
+status = inSection(83);
+pattern = /(abc|)ef/;
+string = 'abcdef';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ef', '');
+addThis();
+
+status = inSection(84);
+pattern = /(a|b)c*d/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bcd', 'b');
+addThis();
+
+status = inSection(85);
+pattern = /(ab|ab*)bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'a');
+addThis();
+
+status = inSection(86);
+pattern = /a([bc]*)c*/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'bc');
+addThis();
+
+status = inSection(87);
+pattern = /a([bc]*)(c*d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'bc', 'd');
+addThis();
+
+status = inSection(88);
+pattern = /a([bc]+)(c*d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'bc', 'd');
+addThis();
+
+status = inSection(89);
+pattern = /a([bc]*)(c+d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'b', 'cd');
+addThis();
+
+status = inSection(90);
+pattern = /a[bcd]*dcdcde/;
+string = 'adcdcde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('adcdcde');
+addThis();
+
+status = inSection(91);
+pattern = /(ab|a)b*c/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'ab');
+addThis();
+
+status = inSection(92);
+pattern = /((a)(b)c)(d)/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'abc', 'a', 'b', 'd');
+addThis();
+
+status = inSection(93);
+pattern = /[a-zA-Z_][a-zA-Z0-9_]*/;
+string = 'alpha';
+actualmatch = string.match(pattern);
+expectedmatch = Array('alpha');
+addThis();
+
+status = inSection(94);
+pattern = /^a(bc+|b[eh])g|.h$/;
+string = 'abh';
+actualmatch = string.match(pattern);
+expectedmatch = Array('bh', undefined);
+addThis();
+
+status = inSection(95);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'effgz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('effgz', 'effgz', undefined);
+addThis();
+
+status = inSection(96);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'ij';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ij', 'ij', 'j');
+addThis();
+
+status = inSection(97);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'reffgz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('effgz', 'effgz', undefined);
+addThis();
+
+status = inSection(98);
+pattern = /((((((((((a))))))))))/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(99);
+pattern = /((((((((((a))))))))))\10/;
+string = 'aa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aa', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(100);
+pattern = /((((((((((a))))))))))/;
+string = 'a!';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(101);
+pattern = /(((((((((a)))))))))/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');
+addThis();
+
+status = inSection(102);
+pattern = /(.*)c(.*)/;
+string = 'abcde';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcde', 'ab', 'de');
+addThis();
+
+status = inSection(103);
+pattern = /abcd/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd');
+addThis();
+
+status = inSection(104);
+pattern = /a(bc)d/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcd', 'bc');
+addThis();
+
+status = inSection(105);
+pattern = /a[-]?c/;
+string = 'ac';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ac');
+addThis();
+
+status = inSection(106);
+pattern = /(abc)\1/;
+string = 'abcabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcabc', 'abc');
+addThis();
+
+status = inSection(107);
+pattern = /([a-c]*)\1/;
+string = 'abcabc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abcabc', 'abc');
+addThis();
+
+status = inSection(108);
+pattern = /(a)|\1/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(109);
+pattern = /(([a-c])b*?\2)*/;
+string = 'ababbbcbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ababb', 'bb', 'b');
+addThis();
+
+status = inSection(110);
+pattern = /(([a-c])b*?\2){3}/;
+string = 'ababbbcbc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ababbbcbc', 'cbc', 'c');
+addThis();
+
+/* Can't refer to a capture before it's encountered & completed
+ status = inSection(111);
+ pattern = /((\3|b)\2(a)x)+/;
+ string = 'aaaxabaxbaaxbbax';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('bbax', 'bbax', 'b', 'a');
+ addThis();
+
+ status = inSection(112);
+ pattern = /((\3|b)\2(a)){2,}/;
+ string = 'bbaababbabaaaaabbaaaabba';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('bbaaaabba', 'bba', 'b', 'a');
+ addThis();
+*/
+
+status = inSection(113);
+pattern = /abc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(114);
+pattern = /abc/i;
+string = 'XABCY';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(115);
+pattern = /abc/i;
+string = 'ABABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(116);
+pattern = /ab*c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(117);
+pattern = /ab*bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(118);
+pattern = /ab*bc/i;
+string = 'ABBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBC');
+addThis();
+
+status = inSection(119);
+pattern = /ab*?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(120);
+pattern = /ab{0,}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(121);
+pattern = /ab+?bc/i;
+string = 'ABBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBC');
+addThis();
+
+status = inSection(122);
+pattern = /ab+bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(123);
+pattern = /ab{1,}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(124);
+pattern = /ab{1,3}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(125);
+pattern = /ab{3,4}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBBC');
+addThis();
+
+status = inSection(126);
+pattern = /ab??bc/i;
+string = 'ABBC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBC');
+addThis();
+
+status = inSection(127);
+pattern = /ab??bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(128);
+pattern = /ab{0,1}?bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(129);
+pattern = /ab??c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(130);
+pattern = /ab{0,1}?c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(131);
+pattern = /^abc$/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(132);
+pattern = /^abc/i;
+string = 'ABCC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(133);
+pattern = /abc$/i;
+string = 'AABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(134);
+pattern = /^/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(135);
+pattern = /$/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(136);
+pattern = /a.c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(137);
+pattern = /a.c/i;
+string = 'AXC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AXC');
+addThis();
+
+status = inSection(138);
+pattern = /a.*?c/i;
+string = 'AXYZC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AXYZC');
+addThis();
+
+status = inSection(139);
+pattern = /a[bc]d/i;
+string = 'ABD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABD');
+addThis();
+
+status = inSection(140);
+pattern = /a[b-d]e/i;
+string = 'ACE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ACE');
+addThis();
+
+status = inSection(141);
+pattern = /a[b-d]/i;
+string = 'AAC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AC');
+addThis();
+
+status = inSection(142);
+pattern = /a[-b]/i;
+string = 'A-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A-');
+addThis();
+
+status = inSection(143);
+pattern = /a[b-]/i;
+string = 'A-';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A-');
+addThis();
+
+status = inSection(144);
+pattern = /a]/i;
+string = 'A]';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A]');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+ status = inSection(145);
+ pattern = /a[]]b/i;
+ string = 'A]B';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('A]B');
+ addThis();
+*/
+
+status = inSection(146);
+pattern = /a[^bc]d/i;
+string = 'AED';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AED');
+addThis();
+
+status = inSection(147);
+pattern = /a[^-b]c/i;
+string = 'ADC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ADC');
+addThis();
+
+/* Perl supports ] & ^] inside a [], ECMA does not
+ status = inSection(148);
+ pattern = /a[^]b]c/i;
+ string = 'ADC';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ADC');
+ addThis();
+*/
+
+status = inSection(149);
+pattern = /ab|cd/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(150);
+pattern = /ab|cd/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(151);
+pattern = /()ef/i;
+string = 'DEF';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EF', '');
+addThis();
+
+status = inSection(152);
+pattern = /a\(b/i;
+string = 'A(B';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A(B');
+addThis();
+
+status = inSection(153);
+pattern = /a\(*b/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(154);
+pattern = /a\(*b/i;
+string = 'A((B';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A((B');
+addThis();
+
+status = inSection(155);
+pattern = /a\\b/i;
+string = 'A\\B';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A\\B');
+addThis();
+
+status = inSection(156);
+pattern = /((a))/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A');
+addThis();
+
+status = inSection(157);
+pattern = /(a)b(c)/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'A', 'C');
+addThis();
+
+status = inSection(158);
+pattern = /a+b+c/i;
+string = 'AABBABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(159);
+pattern = /a{1,}b{1,}c/i;
+string = 'AABBABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(160);
+pattern = /a.+?c/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(161);
+pattern = /a.*?c/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(162);
+pattern = /a.{0,5}?c/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC');
+addThis();
+
+status = inSection(163);
+pattern = /(a+|b)*/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(164);
+pattern = /(a+|b){0,}/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(165);
+pattern = /(a+|b)+/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(166);
+pattern = /(a+|b){1,}/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'B');
+addThis();
+
+status = inSection(167);
+pattern = /(a+|b)?/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A');
+addThis();
+
+status = inSection(168);
+pattern = /(a+|b){0,1}/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A');
+addThis();
+
+status = inSection(169);
+pattern = /(a+|b){0,1}?/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', undefined);
+addThis();
+
+status = inSection(170);
+pattern = /[^ab]*/i;
+string = 'CDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('CDE');
+addThis();
+
+status = inSection(171);
+pattern = /([abc])*d/i;
+string = 'ABBBCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABBBCD', 'C');
+addThis();
+
+status = inSection(172);
+pattern = /([abc])*bcd/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'A');
+addThis();
+
+status = inSection(173);
+pattern = /a|b|c|d|e/i;
+string = 'E';
+actualmatch = string.match(pattern);
+expectedmatch = Array('E');
+addThis();
+
+status = inSection(174);
+pattern = /(a|b|c|d|e)f/i;
+string = 'EF';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EF', 'E');
+addThis();
+
+status = inSection(175);
+pattern = /abcd*efg/i;
+string = 'ABCDEFG';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCDEFG');
+addThis();
+
+status = inSection(176);
+pattern = /ab*/i;
+string = 'XABYABBBZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB');
+addThis();
+
+status = inSection(177);
+pattern = /ab*/i;
+string = 'XAYABBBZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A');
+addThis();
+
+status = inSection(178);
+pattern = /(ab|cd)e/i;
+string = 'ABCDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('CDE', 'CD');
+addThis();
+
+status = inSection(179);
+pattern = /[abhgefdc]ij/i;
+string = 'HIJ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('HIJ');
+addThis();
+
+status = inSection(180);
+pattern = /(abc|)ef/i;
+string = 'ABCDEF';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EF', '');
+addThis();
+
+status = inSection(181);
+pattern = /(a|b)c*d/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('BCD', 'B');
+addThis();
+
+status = inSection(182);
+pattern = /(ab|ab*)bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'A');
+addThis();
+
+status = inSection(183);
+pattern = /a([bc]*)c*/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'BC');
+addThis();
+
+status = inSection(184);
+pattern = /a([bc]*)(c*d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'BC', 'D');
+addThis();
+
+status = inSection(185);
+pattern = /a([bc]+)(c*d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'BC', 'D');
+addThis();
+
+status = inSection(186);
+pattern = /a([bc]*)(c+d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'B', 'CD');
+addThis();
+
+status = inSection(187);
+pattern = /a[bcd]*dcdcde/i;
+string = 'ADCDCDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ADCDCDE');
+addThis();
+
+status = inSection(188);
+pattern = /(ab|a)b*c/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABC', 'AB');
+addThis();
+
+status = inSection(189);
+pattern = /((a)(b)c)(d)/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'ABC', 'A', 'B', 'D');
+addThis();
+
+status = inSection(190);
+pattern = /[a-zA-Z_][a-zA-Z0-9_]*/i;
+string = 'ALPHA';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ALPHA');
+addThis();
+
+status = inSection(191);
+pattern = /^a(bc+|b[eh])g|.h$/i;
+string = 'ABH';
+actualmatch = string.match(pattern);
+expectedmatch = Array('BH', undefined);
+addThis();
+
+status = inSection(192);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'EFFGZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EFFGZ', 'EFFGZ', undefined);
+addThis();
+
+status = inSection(193);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'IJ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('IJ', 'IJ', 'J');
+addThis();
+
+status = inSection(194);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'REFFGZ';
+actualmatch = string.match(pattern);
+expectedmatch = Array('EFFGZ', 'EFFGZ', undefined);
+addThis();
+
+status = inSection(195);
+pattern = /((((((((((a))))))))))/i;
+string = 'A';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(196);
+pattern = /((((((((((a))))))))))\10/i;
+string = 'AA';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(197);
+pattern = /((((((((((a))))))))))/i;
+string = 'A!';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(198);
+pattern = /(((((((((a)))))))))/i;
+string = 'A';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');
+addThis();
+
+status = inSection(199);
+pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i;
+string = 'A';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', 'A');
+addThis();
+
+status = inSection(200);
+pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i;
+string = 'C';
+actualmatch = string.match(pattern);
+expectedmatch = Array('C', 'C');
+addThis();
+
+status = inSection(201);
+pattern = /(.*)c(.*)/i;
+string = 'ABCDE';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCDE', 'AB', 'DE');
+addThis();
+
+status = inSection(202);
+pattern = /abcd/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD');
+addThis();
+
+status = inSection(203);
+pattern = /a(bc)d/i;
+string = 'ABCD';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCD', 'BC');
+addThis();
+
+status = inSection(204);
+pattern = /a[-]?c/i;
+string = 'AC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AC');
+addThis();
+
+status = inSection(205);
+pattern = /(abc)\1/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCABC', 'ABC');
+addThis();
+
+status = inSection(206);
+pattern = /([a-c]*)\1/i;
+string = 'ABCABC';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ABCABC', 'ABC');
+addThis();
+
+status = inSection(207);
+pattern = /a(?!b)./;
+string = 'abad';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ad');
+addThis();
+
+status = inSection(208);
+pattern = /a(?=d)./;
+string = 'abad';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ad');
+addThis();
+
+status = inSection(209);
+pattern = /a(?=c|d)./;
+string = 'abad';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ad');
+addThis();
+
+status = inSection(210);
+pattern = /a(?:b|c|d)(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'e');
+addThis();
+
+status = inSection(211);
+pattern = /a(?:b|c|d)*(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'e');
+addThis();
+
+status = inSection(212);
+pattern = /a(?:b|c|d)+?(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'e');
+addThis();
+
+status = inSection(213);
+pattern = /a(?:b|c|d)+?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acd', 'd');
+addThis();
+
+status = inSection(214);
+pattern = /a(?:b|c|d)+(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(215);
+pattern = /a(?:b|c|d){2}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdb', 'b');
+addThis();
+
+status = inSection(216);
+pattern = /a(?:b|c|d){4,5}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdb', 'b');
+addThis();
+
+status = inSection(217);
+pattern = /a(?:b|c|d){4,5}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcd', 'd');
+addThis();
+
+// MODIFIED - ECMA has different rules for paren contents
+status = inSection(218);
+pattern = /((foo)|(bar))*/;
+string = 'foobar';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('foobar', 'bar', 'foo', 'bar');
+expectedmatch = Array('foobar', 'bar', undefined, 'bar');
+addThis();
+
+status = inSection(219);
+pattern = /a(?:b|c|d){6,7}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(220);
+pattern = /a(?:b|c|d){6,7}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(221);
+pattern = /a(?:b|c|d){5,6}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(222);
+pattern = /a(?:b|c|d){5,6}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdb', 'b');
+addThis();
+
+status = inSection(223);
+pattern = /a(?:b|c|d){5,7}(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdbe', 'e');
+addThis();
+
+status = inSection(224);
+pattern = /a(?:b|c|d){5,7}?(.)/;
+string = 'acdbcdbe';
+actualmatch = string.match(pattern);
+expectedmatch = Array('acdbcdb', 'b');
+addThis();
+
+status = inSection(225);
+pattern = /a(?:b|(c|e){1,2}?|d)+?(.)/;
+string = 'ace';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ace', 'c', 'e');
+addThis();
+
+status = inSection(226);
+pattern = /^(.+)?B/;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AB', 'A');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(227);
+pattern = /^([^a-z])|(\^)$/;
+string = '.';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('.', '.', '');
+expectedmatch = Array('.', '.', undefined);
+addThis();
+
+status = inSection(228);
+pattern = /^[<>]&/;
+string = '<&OUT';
+actualmatch = string.match(pattern);
+expectedmatch = Array('<&');
+addThis();
+
+/* Can't refer to a capture before it's encountered & completed
+ status = inSection(229);
+ pattern = /^(a\1?){4}$/;
+ string = 'aaaaaaaaaa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaaaaaaaaa', 'aaaa');
+ addThis();
+
+ status = inSection(230);
+ pattern = /^(a(?(1)\1)){4}$/;
+ string = 'aaaaaaaaaa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaaaaaaaaa', 'aaaa');
+ addThis();
+*/
+
+status = inSection(231);
+pattern = /((a{4})+)/;
+string = 'aaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa');
+addThis();
+
+status = inSection(232);
+pattern = /(((aa){2})+)/;
+string = 'aaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa');
+addThis();
+
+status = inSection(233);
+pattern = /(((a{2}){2})+)/;
+string = 'aaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa');
+addThis();
+
+status = inSection(234);
+pattern = /(?:(f)(o)(o)|(b)(a)(r))*/;
+string = 'foobar';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('foobar', 'f', 'o', 'o', 'b', 'a', 'r');
+expectedmatch = Array('foobar', undefined, undefined, undefined, 'b', 'a', 'r');
+addThis();
+
+/* ECMA supports (?: (?= and (?! but doesn't support (?< etc.
+ status = inSection(235);
+ pattern = /(?<=a)b/;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b');
+ addThis();
+
+ status = inSection(236);
+ pattern = /(?<!c)b/;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b');
+ addThis();
+
+ status = inSection(237);
+ pattern = /(?<!c)b/;
+ string = 'b';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b');
+ addThis();
+
+ status = inSection(238);
+ pattern = /(?<!c)b/;
+ string = 'b';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b');
+ addThis();
+*/
+
+status = inSection(239);
+pattern = /(?:..)*a/;
+string = 'aba';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aba');
+addThis();
+
+status = inSection(240);
+pattern = /(?:..)*?a/;
+string = 'aba';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+/*
+ * MODIFIED - ECMA has different rules for paren contents. Note
+ * this regexp has two non-capturing parens, and one capturing
+ *
+ * The issue: shouldn't the match be ['ab', undefined]? Because the
+ * '\1' matches the undefined value of the second iteration of the '*'
+ * (in which the 'b' part of the '|' matches). But Perl wants ['ab','b'].
+ *
+ * Answer: waldemar@netscape.com:
+ *
+ * The correct answer is ['ab', undefined]. Perl doesn't match
+ * ECMAScript here, and I'd say that Perl is wrong in this case.
+ */
+status = inSection(241);
+pattern = /^(?:b|a(?=(.)))*\1/;
+string = 'abc';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('ab', 'b');
+expectedmatch = Array('ab', undefined);
+addThis();
+
+status = inSection(242);
+pattern = /^(){3,5}/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('', '');
+addThis();
+
+status = inSection(243);
+pattern = /^(a+)*ax/;
+string = 'aax';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aax', 'a');
+addThis();
+
+status = inSection(244);
+pattern = /^((a|b)+)*ax/;
+string = 'aax';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aax', 'a', 'a');
+addThis();
+
+status = inSection(245);
+pattern = /^((a|bc)+)*ax/;
+string = 'aax';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aax', 'a', 'a');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(246);
+pattern = /(a|x)*ab/;
+string = 'cab';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('ab', '');
+expectedmatch = Array('ab', undefined);
+addThis();
+
+status = inSection(247);
+pattern = /(a)*ab/;
+string = 'cab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', undefined);
+addThis();
+
+/* ECMA doesn't support (?imsx or (?-imsx
+ status = inSection(248);
+ pattern = /(?:(?i)a)b/;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ status = inSection(249);
+ pattern = /((?i)a)b/;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab', 'a');
+ addThis();
+
+ status = inSection(250);
+ pattern = /(?:(?i)a)b/;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('Ab');
+ addThis();
+
+ status = inSection(251);
+ pattern = /((?i)a)b/;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('Ab', 'A');
+ addThis();
+
+ status = inSection(252);
+ pattern = /(?i:a)b/;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ status = inSection(253);
+ pattern = /((?i:a))b/;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab', 'a');
+ addThis();
+
+ status = inSection(254);
+ pattern = /(?i:a)b/;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('Ab');
+ addThis();
+
+ status = inSection(255);
+ pattern = /((?i:a))b/;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('Ab', 'A');
+ addThis();
+
+ status = inSection(256);
+ pattern = /(?:(?-i)a)b/i;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ status = inSection(257);
+ pattern = /((?-i)a)b/i;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab', 'a');
+ addThis();
+
+ status = inSection(258);
+ pattern = /(?:(?-i)a)b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB');
+ addThis();
+
+ status = inSection(259);
+ pattern = /((?-i)a)b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB', 'a');
+ addThis();
+
+ status = inSection(260);
+ pattern = /(?:(?-i)a)b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB');
+ addThis();
+
+ status = inSection(261);
+ pattern = /((?-i)a)b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB', 'a');
+ addThis();
+
+ status = inSection(262);
+ pattern = /(?-i:a)b/i;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ status = inSection(263);
+ pattern = /((?-i:a))b/i;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab', 'a');
+ addThis();
+
+ status = inSection(264);
+ pattern = /(?-i:a)b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB');
+ addThis();
+
+ status = inSection(265);
+ pattern = /((?-i:a))b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB', 'a');
+ addThis();
+
+ status = inSection(266);
+ pattern = /(?-i:a)b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB');
+ addThis();
+
+ status = inSection(267);
+ pattern = /((?-i:a))b/i;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aB', 'a');
+ addThis();
+
+ status = inSection(268);
+ pattern = /((?s-i:a.))b/i;
+ string = 'a\nB';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a\nB', 'a\n');
+ addThis();
+*/
+
+status = inSection(269);
+pattern = /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/;
+string = 'cabbbb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('cabbbb');
+addThis();
+
+status = inSection(270);
+pattern = /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/;
+string = 'caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';
+actualmatch = string.match(pattern);
+expectedmatch = Array('caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+addThis();
+
+status = inSection(271);
+pattern = /(ab)\d\1/i;
+string = 'Ab4ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Ab4ab', 'Ab');
+addThis();
+
+status = inSection(272);
+pattern = /(ab)\d\1/i;
+string = 'ab4Ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab4Ab', 'ab');
+addThis();
+
+status = inSection(273);
+pattern = /foo\w*\d{4}baz/;
+string = 'foobar1234baz';
+actualmatch = string.match(pattern);
+expectedmatch = Array('foobar1234baz');
+addThis();
+
+status = inSection(274);
+pattern = /x(~~)*(?:(?:F)?)?/;
+string = 'x~~';
+actualmatch = string.match(pattern);
+expectedmatch = Array('x~~', '~~');
+addThis();
+
+/* Perl supports (?# but JS doesn't
+ status = inSection(275);
+ pattern = /^a(?#xxx){3}c/;
+ string = 'aaac';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaac');
+ addThis();
+*/
+
+/* ECMA doesn't support (?< etc
+ status = inSection(276);
+ pattern = /(?<![cd])[ab]/;
+ string = 'dbaacb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(277);
+ pattern = /(?<!(c|d))[ab]/;
+ string = 'dbaacb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(278);
+ pattern = /(?<!cd)[ab]/;
+ string = 'cdaccb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b');
+ addThis();
+
+ status = inSection(279);
+ pattern = /((?s)^a(.))((?m)^b$)/;
+ string = 'a\nb\nc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a\nb', 'a\n', '\n', 'b');
+ addThis();
+
+ status = inSection(280);
+ pattern = /((?m)^b$)/;
+ string = 'a\nb\nc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b', 'b');
+ addThis();
+
+ status = inSection(281);
+ pattern = /(?m)^b/;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b');
+ addThis();
+
+ status = inSection(282);
+ pattern = /(?m)^(b)/;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b', 'b');
+ addThis();
+
+ status = inSection(283);
+ pattern = /((?m)^b)/;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b', 'b');
+ addThis();
+
+ status = inSection(284);
+ pattern = /\n((?m)^b)/;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('\nb', 'b');
+ addThis();
+
+ status = inSection(285);
+ pattern = /((?s).)c(?!.)/;
+ string = 'a\nb\nc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('\nc', '\n');
+ addThis();
+
+ status = inSection(286);
+ pattern = /((?s).)c(?!.)/;
+ string = 'a\nb\nc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('\nc', '\n');
+ addThis();
+
+ status = inSection(287);
+ pattern = /((?s)b.)c(?!.)/;
+ string = 'a\nb\nc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b\nc', 'b\n');
+ addThis();
+
+ status = inSection(288);
+ pattern = /((?s)b.)c(?!.)/;
+ string = 'a\nb\nc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b\nc', 'b\n');
+ addThis();
+
+ status = inSection(289);
+ pattern = /((?m)^b)/;
+ string = 'a\nb\nc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('b', 'b');
+ addThis();
+*/
+
+/* ECMA doesn't support (?(condition)
+ status = inSection(290);
+ pattern = /(?(1)b|a)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(291);
+ pattern = /(x)?(?(1)b|a)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(292);
+ pattern = /()?(?(1)b|a)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(293);
+ pattern = /()?(?(1)a|b)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(294);
+ pattern = /^(\()?blah(?(1)(\)))$/;
+ string = '(blah)';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('(blah)', '(', ')');
+ addThis();
+
+ status = inSection(295);
+ pattern = /^(\()?blah(?(1)(\)))$/;
+ string = 'blah';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('blah');
+ addThis();
+
+ status = inSection(296);
+ pattern = /^(\(+)?blah(?(1)(\)))$/;
+ string = '(blah)';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('(blah)', '(', ')');
+ addThis();
+
+ status = inSection(297);
+ pattern = /^(\(+)?blah(?(1)(\)))$/;
+ string = 'blah';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('blah');
+ addThis();
+
+ status = inSection(298);
+ pattern = /(?(?!a)b|a)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(299);
+ pattern = /(?(?=a)a|b)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+*/
+
+status = inSection(300);
+pattern = /(?=(a+?))(\1ab)/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aab', 'a', 'aab');
+addThis();
+
+status = inSection(301);
+pattern = /(\w+:)+/;
+string = 'one:';
+actualmatch = string.match(pattern);
+expectedmatch = Array('one:', 'one:');
+addThis();
+
+/* ECMA doesn't support (?< etc
+ status = inSection(302);
+ pattern = /$(?<=^(a))/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('', 'a');
+ addThis();
+*/
+
+status = inSection(303);
+pattern = /(?=(a+?))(\1ab)/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aab', 'a', 'aab');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(304);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('abcd', '', 'abcd');
+expectedmatch = Array('abcd', undefined, 'abcd');
+addThis();
+
+status = inSection(305);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'xy:z:::abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd');
+addThis();
+
+status = inSection(306);
+pattern = /^[^bcd]*(c+)/;
+string = 'aexycd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aexyc', 'c');
+addThis();
+
+status = inSection(307);
+pattern = /(a*)b+/;
+string = 'caab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aab', 'aa');
+addThis();
+
+/* MODIFIED - ECMA has different rules for paren contents */
+status = inSection(308);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd';
+actualmatch = string.match(pattern);
+//expectedmatch = Array('abcd', '', 'abcd');
+expectedmatch = Array('abcd', undefined, 'abcd');
+addThis();
+
+status = inSection(309);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'xy:z:::abcd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd');
+addThis();
+
+status = inSection(310);
+pattern = /^[^bcd]*(c+)/;
+string = 'aexycd';
+actualmatch = string.match(pattern);
+expectedmatch = Array('aexyc', 'c');
+addThis();
+
+/* ECMA doesn't support (?>
+ status = inSection(311);
+ pattern = /(?>a+)b/;
+ string = 'aaab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaab');
+ addThis();
+*/
+
+status = inSection(312);
+pattern = /([[:]+)/;
+ string = 'a:[b]:';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array(':[', ':[');
+ addThis();
+
+ status = inSection(313);
+ pattern = /([[=]+)/;
+ string = 'a=[b]=';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('=[', '=[');
+ addThis();
+
+ status = inSection(314);
+ pattern = /([[.]+)/;
+ string = 'a.[b].';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('.[', '.[');
+ addThis();
+
+/* ECMA doesn't have rules for [:
+ status = inSection(315);
+ pattern = /[a[:]b[:c]/;
+ string = 'abc';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abc');
+ addThis();
+*/
+
+/* ECMA doesn't support (?>
+ status = inSection(316);
+ pattern = /((?>a+)b)/;
+ string = 'aaab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaab', 'aaab');
+ addThis();
+
+ status = inSection(317);
+ pattern = /(?>(a+))b/;
+ string = 'aaab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaab', 'aaa');
+ addThis();
+
+ status = inSection(318);
+ pattern = /((?>[^()]+)|\([^()]*\))+/;
+ string = '((abc(ade)ufh()()x';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abc(ade)ufh()()x', 'x');
+ addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(319);
+ pattern = /\Z/;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+ status = inSection(320);
+ pattern = /\z/;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+*/
+
+ status = inSection(321);
+ pattern = /$/;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(322);
+ pattern = /\Z/;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+ status = inSection(323);
+ pattern = /\z/;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+*/
+
+ status = inSection(324);
+ pattern = /$/;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(325);
+ pattern = /\Z/;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+ status = inSection(326);
+ pattern = /\z/;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+*/
+
+ status = inSection(327);
+ pattern = /$/;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(328);
+ pattern = /\Z/m;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+ status = inSection(329);
+ pattern = /\z/m;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+*/
+
+ status = inSection(330);
+ pattern = /$/m;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(331);
+ pattern = /\Z/m;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+ status = inSection(332);
+ pattern = /\z/m;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+*/
+
+ status = inSection(333);
+ pattern = /$/m;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(334);
+ pattern = /\Z/m;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+ status = inSection(335);
+ pattern = /\z/m;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+*/
+
+ status = inSection(336);
+ pattern = /$/m;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(337);
+ pattern = /a\Z/;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+*/
+
+/* $ only matches end of input unless multiline
+ status = inSection(338);
+ pattern = /a$/;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(339);
+ pattern = /a\Z/;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(340);
+ pattern = /a\z/;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+*/
+
+ status = inSection(341);
+ pattern = /a$/;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(342);
+ pattern = /a$/m;
+ string = 'a\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(343);
+ pattern = /a\Z/m;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+*/
+
+ status = inSection(344);
+ pattern = /a$/m;
+ string = 'b\na\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(345);
+ pattern = /a\Z/m;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+ status = inSection(346);
+ pattern = /a\z/m;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+*/
+
+ status = inSection(347);
+ pattern = /a$/m;
+ string = 'b\na';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(348);
+ pattern = /aa\Z/;
+ string = 'b\naa\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+*/
+
+/* $ only matches end of input unless multiline
+ status = inSection(349);
+ pattern = /aa$/;
+ string = 'b\naa\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(350);
+ pattern = /aa\Z/;
+ string = 'b\naa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+
+ status = inSection(351);
+ pattern = /aa\z/;
+ string = 'b\naa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+*/
+
+ status = inSection(352);
+ pattern = /aa$/;
+ string = 'b\naa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+
+ status = inSection(353);
+ pattern = /aa$/m;
+ string = 'aa\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(354);
+ pattern = /aa\Z/m;
+ string = 'b\naa\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+*/
+
+ status = inSection(355);
+ pattern = /aa$/m;
+ string = 'b\naa\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(356);
+ pattern = /aa\Z/m;
+ string = 'b\naa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+
+ status = inSection(357);
+ pattern = /aa\z/m;
+ string = 'b\naa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+*/
+
+ status = inSection(358);
+ pattern = /aa$/m;
+ string = 'b\naa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aa');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(359);
+ pattern = /ab\Z/;
+ string = 'b\nab\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+*/
+
+/* $ only matches end of input unless multiline
+ status = inSection(360);
+ pattern = /ab$/;
+ string = 'b\nab\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(361);
+ pattern = /ab\Z/;
+ string = 'b\nab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ status = inSection(362);
+ pattern = /ab\z/;
+ string = 'b\nab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+*/
+
+ status = inSection(363);
+ pattern = /ab$/;
+ string = 'b\nab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ status = inSection(364);
+ pattern = /ab$/m;
+ string = 'ab\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(365);
+ pattern = /ab\Z/m;
+ string = 'b\nab\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+*/
+
+ status = inSection(366);
+ pattern = /ab$/m;
+ string = 'b\nab\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(367);
+ pattern = /ab\Z/m;
+ string = 'b\nab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+ status = inSection(368);
+ pattern = /ab\z/m;
+ string = 'b\nab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+*/
+
+ status = inSection(369);
+ pattern = /ab$/m;
+ string = 'b\nab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(370);
+ pattern = /abb\Z/;
+ string = 'b\nabb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+*/
+
+/* $ only matches end of input unless multiline
+ status = inSection(371);
+ pattern = /abb$/;
+ string = 'b\nabb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+*/
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(372);
+ pattern = /abb\Z/;
+ string = 'b\nabb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+
+ status = inSection(373);
+ pattern = /abb\z/;
+ string = 'b\nabb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+*/
+
+ status = inSection(374);
+ pattern = /abb$/;
+ string = 'b\nabb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+
+ status = inSection(375);
+ pattern = /abb$/m;
+ string = 'abb\nb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(376);
+ pattern = /abb\Z/m;
+ string = 'b\nabb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+*/
+
+ status = inSection(377);
+ pattern = /abb$/m;
+ string = 'b\nabb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+
+/* Perl has \Z has end-of-line, ECMA doesn't
+ status = inSection(378);
+ pattern = /abb\Z/m;
+ string = 'b\nabb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+
+ status = inSection(379);
+ pattern = /abb\z/m;
+ string = 'b\nabb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+*/
+
+ status = inSection(380);
+ pattern = /abb$/m;
+ string = 'b\nabb';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abb');
+ addThis();
+
+ status = inSection(381);
+ pattern = /(^|x)(c)/;
+ string = 'ca';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('c', '', 'c');
+ addThis();
+
+ status = inSection(382);
+ pattern = /foo.bart/;
+ string = 'foo.bart';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('foo.bart');
+ addThis();
+
+ status = inSection(383);
+ pattern = /^d[x][x][x]/m;
+ string = 'abcd\ndxxx';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('dxxx');
+ addThis();
+
+ status = inSection(384);
+ pattern = /tt+$/;
+ string = 'xxxtt';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('tt');
+ addThis();
+
+/* ECMA spec says that each atom in a range must be a single character
+ status = inSection(385);
+ pattern = /([a-\d]+)/;
+ string = 'za-9z';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('9', '9');
+ addThis();
+
+ status = inSection(386);
+ pattern = /([\d-z]+)/;
+ string = 'a0-za';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('0-z', '0-z');
+ addThis();
+*/
+
+/* ECMA doesn't support [:
+ status = inSection(387);
+ pattern = /([a-[:digit:]]+)/;
+ string = 'za-9z';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a-9', 'a-9');
+ addThis();
+
+ status = inSection(388);
+ pattern = /([[:digit:]-z]+)/;
+ string = '=0-z=';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('0-z', '0-z');
+ addThis();
+
+ status = inSection(389);
+ pattern = /([[:digit:]-[:alpha:]]+)/;
+ string = '=0-z=';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('0-z', '0-z');
+ addThis();
+*/
+
+ status = inSection(390);
+ pattern = /(\d+\.\d+)/;
+ string = '3.1415926';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('3.1415926', '3.1415926');
+ addThis();
+
+ status = inSection(391);
+ pattern = /\.c(pp|xx|c)?$/i;
+ string = 'IO.c';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('.c', undefined);
+ addThis();
+
+ status = inSection(392);
+ pattern = /(\.c(pp|xx|c)?$)/i;
+ string = 'IO.c';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('.c', '.c', undefined);
+ addThis();
+
+ status = inSection(393);
+ pattern = /(^|a)b/;
+ string = 'ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('ab', 'a');
+ addThis();
+
+ status = inSection(394);
+ pattern = /^([ab]*?)(b)?(c)$/;
+ string = 'abac';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abac', 'aba', undefined, 'c');
+ addThis();
+
+ status = inSection(395);
+ pattern = /^(?:.,){2}c/i;
+ string = 'a,b,c';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a,b,c');
+ addThis();
+
+ status = inSection(396);
+ pattern = /^(.,){2}c/i;
+ string = 'a,b,c';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a,b,c', 'b,');
+ addThis();
+
+ status = inSection(397);
+ pattern = /^(?:[^,]*,){2}c/;
+ string = 'a,b,c';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a,b,c');
+ addThis();
+
+ status = inSection(398);
+ pattern = /^([^,]*,){2}c/;
+ string = 'a,b,c';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a,b,c', 'b,');
+ addThis();
+
+ status = inSection(399);
+ pattern = /^([^,]*,){3}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(400);
+ pattern = /^([^,]*,){3,}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(401);
+ pattern = /^([^,]*,){0,3}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(402);
+ pattern = /^([^,]{1,3},){3}d/i;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(403);
+ pattern = /^([^,]{1,3},){3,}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(404);
+ pattern = /^([^,]{1,3},){0,3}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(405);
+ pattern = /^([^,]{1,},){3}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(406);
+ pattern = /^([^,]{1,},){3,}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(407);
+ pattern = /^([^,]{1,},){0,3}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(408);
+ pattern = /^([^,]{0,3},){3}d/i;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(409);
+ pattern = /^([^,]{0,3},){3,}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+ status = inSection(410);
+ pattern = /^([^,]{0,3},){0,3}d/;
+ string = 'aaa,b,c,d';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaa,b,c,d', 'c,');
+ addThis();
+
+/* ECMA doesn't support \A
+ status = inSection(411);
+ pattern = /(?!\A)x/m;
+ string = 'a\nxb\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('\n');
+ addThis();
+*/
+
+ status = inSection(412);
+ pattern = /^(a(b)?)+$/;
+ string = 'aba';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aba', 'a', undefined);
+ addThis();
+
+ status = inSection(413);
+ pattern = /^(aa(bb)?)+$/;
+ string = 'aabbaa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aabbaa', 'aa', undefined);
+ addThis();
+
+ status = inSection(414);
+ pattern = /^.{9}abc.*\n/m;
+ string = '123\nabcabcabcabc\n';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('abcabcabcabc\n');
+ addThis();
+
+ status = inSection(415);
+ pattern = /^(a)?a$/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('a', undefined);
+ addThis();
+
+ status = inSection(416);
+ pattern = /^(a\1?)(a\1?)(a\2?)(a\3?)$/;
+ string = 'aaaaaa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaaaaa', 'a', 'aa', 'a', 'aa');
+ addThis();
+
+/* Can't refer to a capture before it's encountered & completed
+ status = inSection(417);
+ pattern = /^(a\1?){4}$/;
+ string = 'aaaaaa';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaaaaa', 'aaa');
+ addThis();
+*/
+
+ status = inSection(418);
+ pattern = /^(0+)?(?:x(1))?/;
+ string = 'x1';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('x1', undefined, '1');
+ addThis();
+
+ status = inSection(419);
+ pattern = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/;
+ string = '012cxx0190';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('012cxx0190', '012c', undefined, '0190');
+ addThis();
+
+ status = inSection(420);
+ pattern = /^(b+?|a){1,2}c/;
+ string = 'bbbac';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('bbbac', 'a');
+ addThis();
+
+ status = inSection(421);
+ pattern = /^(b+?|a){1,2}c/;
+ string = 'bbbbac';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('bbbbac', 'a');
+ addThis();
+
+ status = inSection(422);
+ pattern = /((?:aaaa|bbbb)cccc)?/;
+ string = 'aaaacccc';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('aaaacccc', 'aaaacccc');
+ addThis();
+
+ status = inSection(423);
+ pattern = /((?:aaaa|bbbb)cccc)?/;
+ string = 'bbbbcccc';
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('bbbbcccc', 'bbbbcccc');
+ addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+ test();
+//-----------------------------------------------------------------------------
+
+
+
+ function addThis()
+ {
+ if(omitCurrentSection())
+ return;
+
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+ }
+
+
+ function omitCurrentSection()
+ {
+ try
+ {
+ // current section number is in global status variable
+ var n = status.match(/(\d+)/)[1];
+ return ((n < cnLBOUND) || (n > cnUBOUND));
+ }
+ catch(e)
+ {
+ return false;
+ }
+ }
+
+
+ function test()
+ {
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+ }
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-002.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-002.js
new file mode 100644
index 0000000000..a9b147b977
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/perlstress-002.js
@@ -0,0 +1,1842 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com, rogerl@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 2002-07-07
+ * SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine.
+ * Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested.
+ *
+ * This test was created by running various patterns and strings through the
+ * Perl 5 RegExp engine. We saved the results below to test the JS engine.
+ *
+ * Each of the examples below is a negative test; that is, each produces a
+ * null match in Perl. Thus we set |expectedmatch| = |null| in each section.
+ *
+ * NOTE: ECMA/JS and Perl do differ on certain points. We have either commented
+ * out such sections altogether, or modified them to fit what we expect from JS.
+ *
+ * EXAMPLES:
+ *
+ * - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc.
+ *
+ * - ECMA doesn't support (?(condition)
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'perlstress-002.js';
+var i = 0;
+var BUGNUMBER = 85721;
+var summary = 'Testing regular expression edge cases';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+var cnLBOUND = 0;
+var cnUBOUND = 1000;
+
+
+status = inSection(1);
+pattern = /abc/;
+string = 'xbc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(2);
+pattern = /abc/;
+string = 'axc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(3);
+pattern = /abc/;
+string = 'abx';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(4);
+pattern = /ab+bc/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(5);
+pattern = /ab+bc/;
+string = 'abq';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(6);
+pattern = /ab{1,}bc/;
+string = 'abq';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(7);
+pattern = /ab{4,5}bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(8);
+pattern = /ab?bc/;
+string = 'abbbbc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(9);
+pattern = /^abc$/;
+string = 'abcc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(10);
+pattern = /^abc$/;
+string = 'aabc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(11);
+pattern = /abc$/;
+string = 'aabcd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(12);
+pattern = /a.*c/;
+string = 'axyzd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(13);
+pattern = /a[bc]d/;
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(14);
+pattern = /a[b-d]e/;
+string = 'abd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(15);
+pattern = /a[^bc]d/;
+string = 'abd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(16);
+pattern = /a[^-b]c/;
+string = 'a-c';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(17);
+pattern = /a[^]b]c/;
+string = 'a]c';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(18);
+pattern = /\by\b/;
+string = 'xy';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(19);
+pattern = /\by\b/;
+string = 'yz';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(20);
+pattern = /\by\b/;
+string = 'xyz';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(21);
+pattern = /\Ba\B/;
+string = 'a-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(22);
+pattern = /\Ba\B/;
+string = '-a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(23);
+pattern = /\Ba\B/;
+string = '-a-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(24);
+pattern = /\w/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(25);
+pattern = /\W/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(26);
+pattern = /a\sb/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(27);
+pattern = /\d/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(28);
+pattern = /\D/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(29);
+pattern = /[\w]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(30);
+pattern = /[\W]/;
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(31);
+pattern = /a[\s]b/;
+string = 'a-b';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(32);
+pattern = /[\d]/;
+string = '-';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(33);
+pattern = /[\D]/;
+string = '1';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(34);
+pattern = /$b/;
+string = 'b';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(35);
+pattern = /^(ab|cd)e/;
+string = 'abcde';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(36);
+pattern = /a[bcd]+dcdcde/;
+string = 'adcdcde';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(37);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'effg';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(38);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/;
+string = 'bcdd';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(39);
+pattern = /[k]/;
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+// MODIFIED - ECMA has different rules for paren contents.
+status = inSection(40);
+pattern = /(a)|\1/;
+string = 'x';
+actualmatch = string.match(pattern);
+//expectedmatch = null;
+expectedmatch = Array("", undefined);
+addThis();
+
+// MODIFIED - ECMA has different rules for paren contents.
+status = inSection(41);
+pattern = /((\3|b)\2(a)x)+/;
+string = 'aaxabxbaxbbx';
+actualmatch = string.match(pattern);
+//expectedmatch = null;
+expectedmatch = Array("ax", "ax", "", "a");
+addThis();
+
+status = inSection(42);
+pattern = /abc/i;
+string = 'XBC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(43);
+pattern = /abc/i;
+string = 'AXC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(44);
+pattern = /abc/i;
+string = 'ABX';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(45);
+pattern = /ab+bc/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(46);
+pattern = /ab+bc/i;
+string = 'ABQ';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(47);
+pattern = /ab{1,}bc/i;
+string = 'ABQ';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(48);
+pattern = /ab{4,5}?bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(49);
+pattern = /ab??bc/i;
+string = 'ABBBBC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(50);
+pattern = /^abc$/i;
+string = 'ABCC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(51);
+pattern = /^abc$/i;
+string = 'AABC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(52);
+pattern = /a.*c/i;
+string = 'AXYZD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(53);
+pattern = /a[bc]d/i;
+string = 'ABC';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(54);
+pattern = /a[b-d]e/i;
+string = 'ABD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(55);
+pattern = /a[^bc]d/i;
+string = 'ABD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(56);
+pattern = /a[^-b]c/i;
+string = 'A-C';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(57);
+pattern = /a[^]b]c/i;
+string = 'A]C';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(58);
+pattern = /$b/i;
+string = 'B';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(59);
+pattern = /^(ab|cd)e/i;
+string = 'ABCDE';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(60);
+pattern = /a[bcd]+dcdcde/i;
+string = 'ADCDCDE';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(61);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'EFFG';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(62);
+pattern = /(bc+d$|ef*g.|h?i(j|k))/i;
+string = 'BCDD';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(63);
+pattern = /[k]/i;
+string = 'AB';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(64);
+pattern = /^(a\1?){4}$/;
+string = 'aaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(65);
+pattern = /^(a\1?){4}$/;
+string = 'aaaaaaaaaaa';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/* ECMA doesn't support (?(
+ status = inSection(66);
+ pattern = /^(a(?(1)\1)){4}$/;
+ string = 'aaaaaaaaa';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(67);
+ pattern = /^(a(?(1)\1)){4}$/;
+ string = 'aaaaaaaaaaa';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+*/
+
+/* ECMA doesn't support (?<
+ status = inSection(68);
+ pattern = /(?<=a)b/;
+ string = 'cb';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(69);
+ pattern = /(?<=a)b/;
+ string = 'b';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(70);
+ pattern = /(?<!c)b/;
+ string = 'cb';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+*/
+
+/* ECMA doesn't support (?(condition)
+ status = inSection(71);
+ pattern = /(?:(?i)a)b/;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(72);
+ pattern = /((?i)a)b/;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(73);
+ pattern = /(?i:a)b/;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(74);
+ pattern = /((?i:a))b/;
+ string = 'aB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(75);
+ pattern = /(?:(?-i)a)b/i;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(76);
+ pattern = /((?-i)a)b/i;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(77);
+ pattern = /(?:(?-i)a)b/i;
+ string = 'AB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(78);
+ pattern = /((?-i)a)b/i;
+ string = 'AB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(79);
+ pattern = /(?-i:a)b/i;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(80);
+ pattern = /((?-i:a))b/i;
+ string = 'Ab';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(81);
+ pattern = /(?-i:a)b/i;
+ string = 'AB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(82);
+ pattern = /((?-i:a))b/i;
+ string = 'AB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(83);
+ pattern = /((?-i:a.))b/i;
+ string = 'a\nB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(84);
+ pattern = /((?s-i:a.))b/i;
+ string = 'B\nB';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+*/
+
+/* ECMA doesn't support (?<
+ status = inSection(85);
+ pattern = /(?<![cd])b/;
+ string = 'dbcb';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(86);
+ pattern = /(?<!(c|d))b/;
+ string = 'dbcb';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+*/
+
+status = inSection(87);
+pattern = /^(?:a?b?)*$/;
+string = 'a--';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(88);
+pattern = /^b/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(89);
+pattern = /()^b/;
+string = 'a\nb\nc\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/* ECMA doesn't support (?(
+ status = inSection(90);
+ pattern = /(?(1)a|b)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(91);
+ pattern = /(x)?(?(1)a|b)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(92);
+ pattern = /()(?(1)b|a)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(93);
+ pattern = /^(\()?blah(?(1)(\)))$/;
+ string = 'blah)';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(94);
+ pattern = /^(\()?blah(?(1)(\)))$/;
+ string = '(blah';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(95);
+ pattern = /^(\(+)?blah(?(1)(\)))$/;
+ string = 'blah)';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(96);
+ pattern = /^(\(+)?blah(?(1)(\)))$/;
+ string = '(blah';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(97);
+ pattern = /(?(?{0})a|b)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(98);
+ pattern = /(?(?{1})b|a)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(99);
+ pattern = /(?(?!a)a|b)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+
+ status = inSection(100);
+ pattern = /(?(?=a)b|a)/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+*/
+
+status = inSection(101);
+pattern = /^(?=(a+?))\1ab/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(102);
+pattern = /^(?=(a+?))\1ab/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(103);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd:';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(104);
+pattern = /([\w:]+::)?(\w+)$/;
+string = 'abcd:';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(105);
+pattern = /(>a+)ab/;
+string = 'aaab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(106);
+pattern = /a\Z/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(107);
+pattern = /a\z/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(108);
+pattern = /a$/;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(109);
+pattern = /a\z/;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(110);
+pattern = /a\z/m;
+string = 'a\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(111);
+pattern = /a\z/m;
+string = 'b\na\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(112);
+pattern = /aa\Z/;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(113);
+pattern = /aa\z/;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(114);
+pattern = /aa$/;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(115);
+pattern = /aa\z/;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(116);
+pattern = /aa\z/m;
+string = 'aa\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(117);
+pattern = /aa\z/m;
+string = 'b\naa\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(118);
+pattern = /aa\Z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(119);
+pattern = /aa\z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(120);
+pattern = /aa$/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(121);
+pattern = /aa\Z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(122);
+pattern = /aa\z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(123);
+pattern = /aa$/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(124);
+pattern = /aa\Z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(125);
+pattern = /aa\z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(126);
+pattern = /aa$/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(127);
+pattern = /aa\Z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(128);
+pattern = /aa\z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(129);
+pattern = /aa$/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(130);
+pattern = /aa\Z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(131);
+pattern = /aa\z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(132);
+pattern = /aa$/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(133);
+pattern = /aa\Z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(134);
+pattern = /aa\z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(135);
+pattern = /aa$/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(136);
+pattern = /aa\Z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(137);
+pattern = /aa\z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(138);
+pattern = /aa$/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(139);
+pattern = /aa\Z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(140);
+pattern = /aa\z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(141);
+pattern = /aa$/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(142);
+pattern = /aa\Z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(143);
+pattern = /aa\z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(144);
+pattern = /aa$/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(145);
+pattern = /aa\Z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(146);
+pattern = /aa\z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(147);
+pattern = /aa$/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(148);
+pattern = /aa\Z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(149);
+pattern = /aa\z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(150);
+pattern = /aa$/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(151);
+pattern = /aa\Z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(152);
+pattern = /aa\z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(153);
+pattern = /aa$/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(154);
+pattern = /ab\Z/;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(155);
+pattern = /ab\z/;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(156);
+pattern = /ab$/;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(157);
+pattern = /ab\z/;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(158);
+pattern = /ab\z/m;
+string = 'ab\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(159);
+pattern = /ab\z/m;
+string = 'b\nab\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(160);
+pattern = /ab\Z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(161);
+pattern = /ab\z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(162);
+pattern = /ab$/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(163);
+pattern = /ab\Z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(164);
+pattern = /ab\z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(165);
+pattern = /ab$/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(166);
+pattern = /ab\Z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(167);
+pattern = /ab\z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(168);
+pattern = /ab$/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(169);
+pattern = /ab\Z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(170);
+pattern = /ab\z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(171);
+pattern = /ab$/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(172);
+pattern = /ab\Z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(173);
+pattern = /ab\z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(174);
+pattern = /ab$/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(175);
+pattern = /ab\Z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(176);
+pattern = /ab\z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(177);
+pattern = /ab$/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(178);
+pattern = /ab\Z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(179);
+pattern = /ab\z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(180);
+pattern = /ab$/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(181);
+pattern = /ab\Z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(182);
+pattern = /ab\z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(183);
+pattern = /ab$/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(184);
+pattern = /ab\Z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(185);
+pattern = /ab\z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(186);
+pattern = /ab$/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(187);
+pattern = /ab\Z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(188);
+pattern = /ab\z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(189);
+pattern = /ab$/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(190);
+pattern = /ab\Z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(191);
+pattern = /ab\z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(192);
+pattern = /ab$/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(193);
+pattern = /ab\Z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(194);
+pattern = /ab\z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(195);
+pattern = /ab$/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(196);
+pattern = /abb\Z/;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(197);
+pattern = /abb\z/;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(198);
+pattern = /abb$/;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(199);
+pattern = /abb\z/;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(200);
+pattern = /abb\z/m;
+string = 'abb\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(201);
+pattern = /abb\z/m;
+string = 'b\nabb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(202);
+pattern = /abb\Z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(203);
+pattern = /abb\z/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(204);
+pattern = /abb$/;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(205);
+pattern = /abb\Z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(206);
+pattern = /abb\z/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(207);
+pattern = /abb$/;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(208);
+pattern = /abb\Z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(209);
+pattern = /abb\z/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(210);
+pattern = /abb$/;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(211);
+pattern = /abb\Z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(212);
+pattern = /abb\z/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(213);
+pattern = /abb$/m;
+string = 'ac\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(214);
+pattern = /abb\Z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(215);
+pattern = /abb\z/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(216);
+pattern = /abb$/m;
+string = 'b\nac\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(217);
+pattern = /abb\Z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(218);
+pattern = /abb\z/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(219);
+pattern = /abb$/m;
+string = 'b\nac';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(220);
+pattern = /abb\Z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(221);
+pattern = /abb\z/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(222);
+pattern = /abb$/;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(223);
+pattern = /abb\Z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(224);
+pattern = /abb\z/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(225);
+pattern = /abb$/;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(226);
+pattern = /abb\Z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(227);
+pattern = /abb\z/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(228);
+pattern = /abb$/;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(229);
+pattern = /abb\Z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(230);
+pattern = /abb\z/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(231);
+pattern = /abb$/m;
+string = 'ca\nb\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(232);
+pattern = /abb\Z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(233);
+pattern = /abb\z/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(234);
+pattern = /abb$/m;
+string = 'b\nca\n';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(235);
+pattern = /abb\Z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(236);
+pattern = /abb\z/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(237);
+pattern = /abb$/m;
+string = 'b\nca';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(238);
+pattern = /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/;
+string = 'x';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(239);
+pattern = /\GX.*X/;
+string = 'aaaXbX';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(240);
+pattern = /\.c(pp|xx|c)?$/i;
+string = 'Changes';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(241);
+pattern = /^([a-z]:)/;
+string = 'C:/';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(242);
+pattern = /(\w)?(abc)\1b/;
+string = 'abcab';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+/* ECMA doesn't support (?(
+ status = inSection(243);
+ pattern = /^(a)?(?(1)a|b)+$/;
+ string = 'a';
+ actualmatch = string.match(pattern);
+ expectedmatch = null;
+ addThis();
+*/
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ if(omitCurrentSection())
+ return;
+
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function omitCurrentSection()
+{
+ try
+ {
+ // current section number is in global status variable
+ var n = status.match(/(\d+)/)[1];
+ return ((n < cnLBOUND) || (n > cnUBOUND));
+ }
+ catch(e)
+ {
+ return false;
+ }
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-100199.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-100199.js
new file mode 100644
index 0000000000..8c88aa7f52
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-100199.js
@@ -0,0 +1,307 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 17 September 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 100199
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=100199
+ *
+ * The empty character class [] is a valid RegExp construct: the condition
+ * that a given character belong to a set containing no characters. As such,
+ * it can never be met and is always FALSE. Similarly, [^] is a condition
+ * that matches any given character and is always TRUE.
+ *
+ * Neither one of these conditions should cause syntax errors in a RegExp.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-100199.js';
+var i = 0;
+var BUGNUMBER = 100199;
+var summary = '[], [^] are valid RegExp conditions. Should not cause errors -';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /[]/;
+string = 'abc';
+status = inSection(1);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '';
+status = inSection(2);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '[';
+status = inSection(3);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '/';
+status = inSection(4);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '[';
+status = inSection(5);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = ']';
+status = inSection(6);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '[]';
+status = inSection(7);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '[ ]';
+status = inSection(8);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '][';
+status = inSection(9);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+pattern = /a[]/;
+string = 'abc';
+status = inSection(10);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '';
+status = inSection(11);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = 'a[';
+status = inSection(12);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = 'a[]';
+status = inSection(13);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '[';
+status = inSection(14);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = ']';
+status = inSection(15);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '[]';
+status = inSection(16);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '[ ]';
+status = inSection(17);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+string = '][';
+status = inSection(18);
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+pattern = /[^]/;
+string = 'abc';
+status = inSection(19);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+string = '';
+status = inSection(20);
+actualmatch = string.match(pattern);
+expectedmatch = null; //there are no characters to test against the condition
+addThis();
+
+string = '\/';
+status = inSection(21);
+actualmatch = string.match(pattern);
+expectedmatch = Array('/');
+addThis();
+
+string = '\[';
+status = inSection(22);
+actualmatch = string.match(pattern);
+expectedmatch = Array('[');
+addThis();
+
+string = '[';
+status = inSection(23);
+actualmatch = string.match(pattern);
+expectedmatch = Array('[');
+addThis();
+
+string = ']';
+status = inSection(24);
+actualmatch = string.match(pattern);
+expectedmatch = Array(']');
+addThis();
+
+string = '[]';
+status = inSection(25);
+actualmatch = string.match(pattern);
+expectedmatch = Array('[');
+addThis();
+
+string = '[ ]';
+status = inSection(26);
+actualmatch = string.match(pattern);
+expectedmatch = Array('[');
+addThis();
+
+string = '][';
+status = inSection(27);
+actualmatch = string.match(pattern);
+expectedmatch = Array(']');
+addThis();
+
+
+pattern = /a[^]/;
+string = 'abc';
+status = inSection(28);
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab');
+addThis();
+
+string = '';
+status = inSection(29);
+actualmatch = string.match(pattern);
+expectedmatch = null; //there are no characters to test against the condition
+addThis();
+
+string = 'a[';
+status = inSection(30);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a[');
+addThis();
+
+string = 'a]';
+status = inSection(31);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a]');
+addThis();
+
+string = 'a[]';
+status = inSection(32);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a[');
+addThis();
+
+string = 'a[ ]';
+status = inSection(33);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a[');
+addThis();
+
+string = 'a][';
+status = inSection(34);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a]');
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-105972.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-105972.js
new file mode 100644
index 0000000000..e691c518b4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-105972.js
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * mozilla@pdavis.cx, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 22 October 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 105972:
+ * "/^.*?$/ will not match anything"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=105972
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-105972.js';
+var i = 0;
+var BUGNUMBER = 105972;
+var summary = 'Regression test for Bugzilla bug 105972';
+var cnEmptyString = '';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * The bug: this match was coming up null in Rhino and SpiderMonkey.
+ * It should match the whole string. The reason:
+ *
+ * The * operator is greedy, but *? is non-greedy: it will stop
+ * at the simplest match it can find. But the pattern here asks us
+ * to match till the end of the string. So the simplest match must
+ * go all the way out to the end, and *? has no choice but to do it.
+ */
+status = inSection(1);
+pattern = /^.*?$/;
+string = 'Hello World';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+
+/*
+ * Leave off the '$' condition - here we expect the empty string.
+ * Unlike the above pattern, we don't have to match till the end of
+ * the string, so the non-greedy operator *? doesn't try to...
+ */
+status = inSection(2);
+pattern = /^.*?/;
+string = 'Hello World';
+actualmatch = string.match(pattern);
+expectedmatch = Array(cnEmptyString);
+addThis();
+
+
+/*
+ * Try '$' combined with an 'or' operator.
+ *
+ * The operator *? will consume the string from left to right,
+ * attempting to satisfy the condition (:|$). When it hits ':',
+ * the match will stop because the operator *? is non-greedy.
+ *
+ * The submatch $1 = (:|$) will contain the ':'
+ */
+status = inSection(3);
+pattern = /^.*?(:|$)/;
+string = 'Hello: World';
+actualmatch = string.match(pattern);
+expectedmatch = Array('Hello:', ':');
+addThis();
+
+
+/*
+ * Again, '$' combined with an 'or' operator.
+ *
+ * The operator * will consume the string from left to right,
+ * attempting to satisfy the condition (:|$). When it hits ':',
+ * the match will not stop since * is greedy. The match will
+ * continue until it hits $, the end-of-string boundary.
+ *
+ * The submatch $1 = (:|$) will contain the empty string
+ * conceived to exist at the end-of-string boundary.
+ */
+status = inSection(4);
+pattern = /^.*(:|$)/;
+string = 'Hello: World';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, cnEmptyString);
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-119909.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-119909.js
new file mode 100644
index 0000000000..97f6414bc7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-119909.js
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 1010mozilla@Ostermiller.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 14 Jan 2002
+ * SUMMARY: Shouldn't crash on regexps with many nested parentheses
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=119909
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-119909.js';
+var BUGNUMBER = 119909;
+var summary = "Shouldn't crash on regexps with many nested parentheses";
+var NO_BACKREFS = false;
+var DO_BACKREFS = true;
+
+
+//--------------------------------------------------
+test();
+//--------------------------------------------------
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ testThis(500, NO_BACKREFS, 'hello', 'goodbye');
+ testThis(500, DO_BACKREFS, 'hello', 'goodbye');
+
+ reportCompare('No Crash', 'No Crash', '');
+
+ exitFunc('test');
+}
+
+
+/*
+ * Creates a regexp pattern like (((((((((hello)))))))))
+ * and tests str.search(), str.match(), str.replace()
+ */
+function testThis(numParens, doBackRefs, strOriginal, strReplace)
+{
+ var openParen = doBackRefs? '(' : '(?:';
+ var closeParen = ')';
+ var pattern = '';
+
+ for (var i=0; i<numParens; i++) {pattern += openParen;}
+ pattern += strOriginal;
+ for (i=0; i<numParens; i++) {pattern += closeParen;}
+ var re = new RegExp(pattern);
+
+ var res = strOriginal.search(re);
+ res = strOriginal.match(re);
+ res = strOriginal.replace(re, strReplace);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-122076.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-122076.js
new file mode 100644
index 0000000000..e77f433fc4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-122076.js
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 12 Feb 2002
+ * SUMMARY: Don't crash on invalid regexp literals / \\/ /
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=122076
+ * The function checkURL() below sometimes caused a compile-time error:
+ *
+ * SyntaxError: unterminated parenthetical (:
+ *
+ * However, sometimes it would cause a crash instead. The presence of
+ * other functions below is merely fodder to help provoke the crash.
+ * The constant |STRESS| is number of times we'll try to crash on this.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-122076.js';
+var BUGNUMBER = 122076;
+var summary = "Don't crash on invalid regexp literals / \\/ /";
+var STRESS = 10;
+var sEval = '';
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+
+sEval += 'function checkDate()'
+sEval += '{'
+sEval += 'return (this.value.search(/^[012]?\d\/[0123]?\d\/[0]\d$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkDNSName()'
+sEval += '{'
+sEval += ' return (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkEmail()'
+sEval += '{'
+sEval += ' return (this.value.search(/^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkHostOrIP()'
+sEval += '{'
+sEval += ' if (this.value.search(/^([\w\-]+\.)+([\w\-]{2,3})$/) == -1)'
+sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);'
+sEval += ' else'
+sEval += ' return true;'
+sEval += '}'
+
+sEval += 'function checkIPAddress()'
+sEval += '{'
+sEval += ' return (this.value.search(/^[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}$/) != -1);'
+sEval += '}'
+
+sEval += 'function checkURL()'
+sEval += '{'
+sEval += ' return (this.value.search(/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,4}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\/\*\$+@&#;`~=%!]*)(\.\w{2,})?)*\/?)$/) != -1);'
+sEval += '}'
+
+
+for (var i=0; i<STRESS; i++)
+{
+ try
+ {
+ eval(sEval);
+ }
+ catch(e)
+ {
+ }
+}
+
+reportCompare('No Crash', 'No Crash', '');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-123437.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-123437.js
new file mode 100644
index 0000000000..745a3a707a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-123437.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * waldemar, rogerl, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 04 Feb 2002
+ * SUMMARY: regexp backreferences must hold |undefined| if not used
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=123437 (SpiderMonkey)
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=123439 (Rhino)
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-123437.js';
+var i = 0;
+var BUGNUMBER = 123437;
+var summary = 'regexp backreferences must hold |undefined| if not used';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /(a)?a/;
+string = 'a';
+status = inSection(1);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined);
+addThis();
+
+pattern = /a|(b)/;
+string = 'a';
+status = inSection(2);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined);
+addThis();
+
+pattern = /(a)?(a)/;
+string = 'a';
+status = inSection(3);
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined, 'a');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-165353.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-165353.js
new file mode 100644
index 0000000000..f7c736ce4d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-165353.js
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * franky@pacificconnections.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 31 August 2002
+ * SUMMARY: RegExp conformance test
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=165353
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-165353.js';
+var i = 0;
+var BUGNUMBER = 165353;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /^([a-z]+)*[a-z]$/;
+status = inSection(1);
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', undefined);
+addThis();
+
+status = inSection(2);
+string = 'ab';
+actualmatch = string.match(pattern);
+expectedmatch = Array('ab', 'a');
+addThis();
+
+status = inSection(3);
+string = 'abc';
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'ab');
+addThis();
+
+
+string = 'www.netscape.com';
+status = inSection(4);
+pattern = /^(([a-z]+)*[a-z]\.)+[a-z]{2,}$/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap');
+addThis();
+
+// add one more capturing parens to the previous regexp -
+status = inSection(5);
+pattern = /^(([a-z]+)*([a-z])\.)+[a-z]{2,}$/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('www.netscape.com', 'netscape.', 'netscap', 'e');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169497.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169497.js
new file mode 100644
index 0000000000..5613a93872
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169497.js
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * martin.honnen@gmx.de, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 31 August 2002
+ * SUMMARY: RegExp conformance test
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=169497
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-169497.js';
+var i = 0;
+var BUGNUMBER = 169497;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var sBody = '';
+var sHTML = '';
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+sBody += '<body onXXX="alert(event.type);">\n';
+sBody += '<p>Kibology for all<\/p>\n';
+sBody += '<p>All for Kibology<\/p>\n';
+sBody += '<\/body>';
+
+sHTML += '<html>\n';
+sHTML += sBody;
+sHTML += '\n<\/html>';
+
+status = inSection(1);
+string = sHTML;
+pattern = /<body.*>((.*\n?)*?)<\/body>/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array(sBody, '\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n', '<p>All for Kibology</p>\n');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169534.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169534.js
new file mode 100644
index 0000000000..c736631bd7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-169534.js
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 20 Sep 2002
+ * SUMMARY: RegExp conformance test
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=169534
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-169534.js';
+var UBound = 0;
+var BUGNUMBER = 169534;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+var re = /(\|)([\w\x81-\xff ]*)(\|)([\/a-z][\w:\/\.]*\.[a-z]{3,4})(\|)/ig;
+var str = "To sign up click |here|https://www.xxxx.org/subscribe.htm|";
+actual = str.replace(re, '<a href="$4">$2</a>');
+expect = 'To sign up click <a href="https://www.xxxx.org/subscribe.htm">here</a>';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-187133.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-187133.js
new file mode 100644
index 0000000000..98ec4753bf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-187133.js
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * ji_bo@yahoo.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 06 January 2003
+ * SUMMARY: RegExp conformance test
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=187133
+ *
+ * The tests here employ the regular expression construct:
+ *
+ * (?!pattern)
+ *
+ * This is a "zero-width lookahead negative assertion".
+ * From the Perl documentation:
+ *
+ * For example, /foo(?!bar)/ matches any occurrence
+ * of 'foo' that isn't followed by 'bar'.
+ *
+ * It is "zero-width" means that it does not consume any characters and that
+ * the parens are non-capturing. A non-null match array in the example above
+ * will have only have length 1, not 2.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-187133.js';
+var i = 0;
+var BUGNUMBER = 187133;
+var summary = 'RegExp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /(\.(?!com|org)|\/)/;
+status = inSection(1);
+string = 'ah.info';
+actualmatch = string.match(pattern);
+expectedmatch = ['.', '.'];
+addThis();
+
+status = inSection(2);
+string = 'ah/info';
+actualmatch = string.match(pattern);
+expectedmatch = ['/', '/'];
+addThis();
+
+status = inSection(3);
+string = 'ah.com';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+pattern = /(?!a|b)|c/;
+status = inSection(4);
+string = '';
+actualmatch = string.match(pattern);
+expectedmatch = [''];
+addThis();
+
+status = inSection(5);
+string = 'bc';
+actualmatch = string.match(pattern);
+expectedmatch = [''];
+addThis();
+
+status = inSection(6);
+string = 'd';
+actualmatch = string.match(pattern);
+expectedmatch = [''];
+addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-188206.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-188206.js
new file mode 100644
index 0000000000..308c0ff605
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-188206.js
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * scole@planetweb.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 21 January 2003
+ * SUMMARY: Invalid use of regexp quantifiers should generate SyntaxErrors
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=188206
+ * and http://bugzilla.mozilla.org/show_bug.cgi?id=85721#c48 etc.
+ * and http://bugzilla.mozilla.org/show_bug.cgi?id=190685
+ * and http://bugzilla.mozilla.org/show_bug.cgi?id=197451
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-188206.js';
+var UBound = 0;
+var BUGNUMBER = 188206;
+var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
+var TEST_PASSED = 'SyntaxError';
+var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var CHECK_PASSED = 'Should not generate an error';
+var CHECK_FAILED = 'Generated an error!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * All the following are invalid uses of regexp quantifiers and
+ * should generate SyntaxErrors. That's what we're testing for.
+ *
+ * To allow the test to compile and run, we have to hide the errors
+ * inside eval strings, and check they are caught at run-time -
+ *
+ */
+status = inSection(1);
+testThis(' /a**/ ');
+
+status = inSection(2);
+testThis(' /a***/ ');
+
+status = inSection(3);
+testThis(' /a++/ ');
+
+status = inSection(4);
+testThis(' /a+++/ ');
+
+/*
+ * The ? quantifier, unlike * or +, may appear twice in succession.
+ * Thus we need at least three in a row to provoke a SyntaxError -
+ */
+
+status = inSection(5);
+testThis(' /a???/ ');
+
+status = inSection(6);
+testThis(' /a????/ ');
+
+
+/*
+ * Now do some weird things on the left side of the regexps -
+ */
+status = inSection(9);
+testThis(' /+a/ ');
+
+status = inSection(10);
+testThis(' /++a/ ');
+
+status = inSection(11);
+testThis(' /?a/ ');
+
+status = inSection(12);
+testThis(' /??a/ ');
+
+
+/*
+ * Misusing the {DecmalDigits} quantifier - according to BOTH ECMA and Perl.
+ *
+ * Just as with the * and + quantifiers above, can't have two {DecmalDigits}
+ * quantifiers in succession - it's a SyntaxError.
+ */
+status = inSection(28);
+testThis(' /x{1}{1}/ ');
+
+status = inSection(29);
+testThis(' /x{1,}{1}/ ');
+
+status = inSection(30);
+testThis(' /x{1,2}{1}/ ');
+
+status = inSection(31);
+testThis(' /x{1}{1,}/ ');
+
+status = inSection(32);
+testThis(' /x{1,}{1,}/ ');
+
+status = inSection(33);
+testThis(' /x{1,2}{1,}/ ');
+
+status = inSection(34);
+testThis(' /x{1}{1,2}/ ');
+
+status = inSection(35);
+testThis(' /x{1,}{1,2}/ ');
+
+status = inSection(36);
+testThis(' /x{1,2}{1,2}/ ');
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Invalid syntax should generate a SyntaxError
+ */
+function testThis(sInvalidSyntax)
+{
+ expect = TEST_PASSED;
+ actual = TEST_FAILED_BADLY;
+
+ try
+ {
+ eval(sInvalidSyntax);
+ }
+ catch(e)
+ {
+ if (e instanceof SyntaxError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+/*
+ * Allowed syntax shouldn't generate any errors
+ */
+function checkThis(sAllowedSyntax)
+{
+ expect = CHECK_PASSED;
+ actual = CHECK_PASSED;
+
+ try
+ {
+ eval(sAllowedSyntax);
+ }
+ catch(e)
+ {
+ actual = CHECK_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-191479.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-191479.js
new file mode 100644
index 0000000000..51d5f14c42
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-191479.js
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * flying@dom.natm.ru, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 31 January 2003
+ * SUMMARY: Testing regular expressions of form /(x|y){n,}/
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=191479
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-191479.js';
+var i = 0;
+var BUGNUMBER = 191479;
+var summary = 'Testing regular expressions of form /(x|y){n,}/';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = '12 3 45';
+pattern = /(\d|\d\s){2,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12', '2');
+addThis();
+
+status = inSection(2);
+string = '12 3 45';
+pattern = /(\d|\d\s){4,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+status = inSection(3);
+string = '12 3 45';
+pattern = /(\d|\d\s)+/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12', '2');
+addThis();
+
+status = inSection(4);
+string = '12 3 45';
+pattern = /(\d\s?){4,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+/*
+ * Let's reverse the operands in Sections 1-3 above -
+ */
+status = inSection(5);
+string = '12 3 45';
+pattern = /(\d\s|\d){2,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+status = inSection(6);
+string = '12 3 45';
+pattern = /(\d\s|\d){4,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+status = inSection(7);
+string = '12 3 45';
+pattern = /(\d\s|\d)+/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '5');
+addThis();
+
+
+/*
+ * Let's take all 7 sections above and make each quantifer non-greedy.
+ *
+ * This is done by appending ? to it. It doesn't change the meaning of
+ * the quantifier, but makes it non-greedy, which affects the results -
+ */
+status = inSection(8);
+string = '12 3 45';
+pattern = /(\d|\d\s){2,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12', '2');
+addThis();
+
+status = inSection(9);
+string = '12 3 45';
+pattern = /(\d|\d\s){4,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 3 4', '4');
+addThis();
+
+status = inSection(10);
+string = '12 3 45';
+pattern = /(\d|\d\s)+?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('1', '1');
+addThis();
+
+status = inSection(11);
+string = '12 3 45';
+pattern = /(\d\s?){4,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 3 4', '4');
+addThis();
+
+status = inSection(12);
+string = '12 3 45';
+pattern = /(\d\s|\d){2,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 ', '2 ');
+addThis();
+
+status = inSection(13);
+string = '12 3 45';
+pattern = /(\d\s|\d){4,}?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('12 3 4', '4');
+addThis();
+
+status = inSection(14);
+string = '12 3 45';
+pattern = /(\d\s|\d)+?/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('1', '1');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-202564.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-202564.js
new file mode 100644
index 0000000000..e0ae0f9948
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-202564.js
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * drbrain-bugzilla@segment7.net, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 18 April 2003
+ * SUMMARY: Testing regexp with many backreferences
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=202564
+ *
+ * Note that in Section 1 below, we expect the 1st and 4th backreferences
+ * to hold |undefined| instead of the empty strings one gets in Perl and IE6.
+ * This is because per ECMA, regexp backreferences must hold |undefined|
+ * if not used. See http://bugzilla.mozilla.org/show_bug.cgi?id=123437.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-202564.js';
+var i = 0;
+var BUGNUMBER = 202564;
+var summary = 'Testing regexp with many backreferences';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'Seattle, WA to Buckley, WA';
+pattern = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, undefined, "Seattle", "WA", undefined, "Buckley", "WA");
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209067.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209067.js
new file mode 100644
index 0000000000..98b4029ce4
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209067.js
@@ -0,0 +1,1106 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 12 June 2003
+ * SUMMARY: Testing complicated str.replace()
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=209067
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-209067.js';
+var UBound = 0;
+var BUGNUMBER = 209067;
+var summary = 'Testing complicated str.replace()';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+function formatHTML(h)
+{
+ // a replace function used in the succeeding lines -
+ function S(s)
+ {
+ return s.replace(/</g,'&lt;').replace(/>/g,'&gt;');
+ }
+
+ h+='\n';
+ h=h.replace(/&([^\s]+;)/g,'&lt;&amp;$1&gt;');
+ h=h.replace(new RegExp('<!-'+'-[\\s\\S]*-'+'->','g'), S);
+ h=h.replace(/"[^"]*"/g,S);
+ h=h.replace(/'[^']*'/g,S);
+
+
+ h=h.replace(/<([^>]*)>/g,
+ function(s,p)
+ {
+ if(s.match(/!doctype/i))
+ return'<span class=doctype>&lt;' + p + '&gt;</span>';
+
+ p=p.replace(/\\'/g,'\\&#39;').replace(/\\"/g,'\\&#34;').replace(/^\s/,'');
+p=p.replace(/(\s)([^<]+)$/g,
+ function(s,p1,p2)
+ {
+ p2=p2.replace(/(=)(\s*[^"'][^\s]*)(\s|$)/g,'$1<span class=attribute-value>$2</span>$3');
+ p2=p2.replace(/("[^"]*")/g,'<span class=attribute-value>$1</span>');
+ p2=p2.replace(/('[^']*')/g,'<span class=attribute-value>$1</span>');
+ return p1 + '<span class=attribute-name>'+p2+'</span>';
+ }
+ )
+
+ return'&lt;<span class=' + (s.match(/<\s*\//)?'end-tag':'start-tag') + '>' + p + '</span>&gt;';
+ }
+ )
+
+
+ h=h.replace(/&lt;(&[^\s]+;)&gt;/g,'<span class=entity>$1</span>');
+ h=h.replace(/(&lt;!--[\s\S]*--&gt;)/g,'<span class=comment>$1</span>');
+
+
+ numer=1;
+ h=h.replace(/(.*\n)/g,
+ function(s,p)
+ {
+ return (numer++) +'. ' + p;
+ }
+ )
+
+
+ return'<span class=text>' + h + '</span>';
+}
+
+
+
+/*
+ * sanity check
+ */
+status = inSection(1);
+actual = formatHTML('abc');
+expect = '<span class=text>1. abc\n</span>';
+addThis();
+
+
+/*
+ * The real test: can we run this without crashing?
+ * We are not validating the result, just running it.
+ */
+status = inSection(2);
+var HUGE_TEST_STRING = hugeString();
+formatHTML(HUGE_TEST_STRING);
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function hugeString()
+{
+var s = '';
+
+s += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
+s += '<html lang="en">';
+s += '<head>';
+s += ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">';
+s += ' <meta http-equiv="refresh" content="1800">';
+s += ' <title>CNN.com</title>';
+s += ' <link rel="Start" href="/">';
+s += ' <link rel="Search" href="/search/">';
+s += ' <link rel="stylesheet" href="http://i.cnn.net/cnn/.element/ssi/css/1.0/main.css" type="text/css">';
+s += ' <script language="JavaScript1.2" src="http://i.cnn.net/cnn/.element/ssi/js/1.0/main.js" type="text/javascript"></script>';
+s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsWrapper.js"></script>';
+s += '<style type="text/css">';
+s += '<!--';
+s += '.aoltextad { text-align: justify; font-size: 12px; color: black; font-family: Georgia, sans-serif }';
+s += '-->';
+s += '</style>';
+s += '<script language="JavaScript1.1" type="text/javascript" src="http://ar.atwola.com/file/adsPopup2.js"></script>';
+s += '<script language="JavaScript">';
+s += 'document.adoffset = 0;';
+s += 'document.adPopupDomain = "www.cnn.com";';
+s += 'document.adPopupFile = "/cnn_adspaces/adsPopup2.html";';
+s += 'document.adPopupInterval = "P24";';
+s += 'document.adPopunderInterval = "P24";';
+s += 'adSetOther("&TVAR="+escape("class=us.low"));';
+s += '</script>';
+s += '';
+s += ' ';
+s += '</head>';
+s += '<body class="cnnMainPage">';
+s += '';
+s += '';
+s += '';
+s += '<a name="top_of_page"></a>';
+s += '<a href="#ContentArea"><img src="http://i.cnn.net/cnn/images/1.gif" alt="Click here to skip to main content." width="10" height="1" border="0" align="right"></a>';
+s += '<table width="770" border="0" cellpadding="0" cellspacing="0" style="speak: none">';
+s += ' <col width="229">';
+s += ' <col width="73">';
+s += ' <col width="468">';
+s += ' <tr>';
+s += ' <td colspan="3"><!--';
+s += '[[!~~ netscape hat ~~]][[table border="0" cellpadding="0" cellspacing="0" width="100%"]][[tr]][[td]][[script Language="Javascript" SRC="http://toolbar.aol.com/dashboard.twhat?dom=cnn" type="text/javascript"]][[/script]][[/td]][[/tr]][[/table]]';
+s += '';
+s += '[[div]][[img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" border="0"]][[/div]]';
+s += '-->';
+s += ' </td>';
+s += ' </tr>';
+s += ' <tr valign="bottom">';
+s += ' <td width="229" style="speak: normal"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/logo/cnn.gif" alt="CNN.com" width="229" height="52" border="0"></td>';
+s += ' <td width="73"></td>';
+s += ' <td width="468" align="right">';
+s += ' <!-- home/bottom.468x60 -->';
+s += '<script language="JavaScript1.1">';
+s += '<!--';
+s += 'adSetTarget("_top");';
+s += 'htmlAdWH( (new Array(93103287,93103287,93103300,93103300))[document.adoffset||0] , 468, 60);';
+s += '//-->';
+ s += '</script>';
+ s += '<noscript><a href="http://ar.atwola.com/link/93103287/aol" target="_top"><img src="http://ar.atwola.com/image/93103287/aol" alt="Click Here" width="468" height="60" border="0"></a></noscript> ';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' <tr><td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+ s += ' <tr>';
+ s += ' <td colspan="3">';
+ s += '</td>';
+ s += ' </tr>';
+ s += ' <tr><td colspan="3" bgcolor="#CC0000"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3"></td></tr>';
+ s += ' <tr>';
+ s += ' <td colspan="3">';
+ s += '';
+ s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <form action="http://search.cnn.com/cnn/search" method="get" onsubmit="return CNN_validateSearchForm(this);">';
+ s += '<input type="hidden" name="source" value="cnn">';
+ s += '<input type="hidden" name="invocationType" value="search/top">';
+ s += ' <tr><td colspan="4"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" border="0"></td></tr>';
+ s += ' <tr><td colspan="4" bgcolor="#003366"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="3" border="0"></td></tr>';
+ s += ' <tr>';
+ s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.search.gif" alt="SEARCH" width="110" height="27" border="0"></td>';
+ s += ' <td colspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.top.bevel.gif" alt="" width="653" height="3" border="0"></td>';
+ s += ' <td rowspan="2"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.right.bevel.gif" alt="" width="7" height="27" border="0"></td>';
+ s += ' </tr>';
+ s += ' <tr bgcolor="#B6D8E0">';
+ s += ' <td><table border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td>&nbsp;&nbsp;</td>';
+ s += ' <td nowrap><span class="cnnFormTextB" style="color:#369">The Web</span></td>';
+ s += ' <td><input type="radio" name="sites" value="google" checked></td>';
+ s += ' <td>&nbsp;&nbsp;</td>';
+ s += ' <td><span class="cnnFormTextB" style="color:#369;">CNN.com</span></td>';
+ s += ' <td><input type="radio" name="sites" value="cnn"></td>';
+ s += ' <td>&nbsp;&nbsp;</td>';
+ s += ' <td><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="35" maxlength="40" style="width: 280px"></td>';
+ s += ' <td>&nbsp;<input type="Submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>';
+ s += ' </tr>';
+ s += ' </table></td>';
+ s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.google.gif" alt="enhanced by Google" width="137" height="24" border="0"></td>';
+ s += ' </tr>';
+ s += ' <tr><td colspan="4"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/searchbar/bar.bottom.bevel.gif" alt="" width="770" height="3" border="0"></td></tr>';
+ s += ' </form>';
+ s += '</table>';
+ s += ' </td>';
+ s += ' </tr>';
+ s += '';
+ s += '';
+ s += '</table>';
+ s += '';
+ s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <col width="126" align="left" valign="top">';
+ s += ' <col width="10">';
+ s += ' <col width="280">';
+ s += ' <col width="10">';
+ s += ' <col width="344">';
+ s += ' <tr valign="top">';
+ s += ' <td rowspan="5" width="126" style="speak: none"><table id="cnnNavBar" width="126" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" summary="CNN.com Navigation">';
+ s += ' <col width="8" align="left" valign="top">';
+ s += ' <col width="118" align="left" valign="top">';
+ s += ' <tr bgcolor="#CCCCCC" class="cnnNavHiliteRow"><td width="8" class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNavHilite" onClick="CNN_goTo("/")"><div class="cnnNavText"><a href="/">Home Page</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WORLD/")"><div class="cnnNavText"><a href="/WORLD/">World</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/US/")"><div class="cnnNavText"><a href="/US/">U.S.</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/WEATHER/")"><div class="cnnNavText"><a href="/WEATHER/">Weather</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/money/")"><div class="cnnNavText"><a href="/money/">Business</a>&nbsp;<a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_money.gif" alt="at CNN/Money" width="51" height="5" border="0"></a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/cnnsi/")"><div class="cnnNavText"><a href="/si/">Sports</a>&nbsp;<a href="/si/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/nav_at_si.gif" alt="at SI.com" width="50" height="5" border="0"></a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/ALLPOLITICS/")"><div class="cnnNavText"><a href="/ALLPOLITICS/">Politics</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/LAW/")"><div class="cnnNavText"><a href="/LAW/">Law</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/")"><div class="cnnNavText"><a href="/TECH/">Technology</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TECH/space/")"><div class="cnnNavText"><a href="/TECH/space/">Science &amp; Space</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/HEALTH/")"><div class="cnnNavText"><a href="/HEALTH/">Health</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SHOWBIZ/")"><div class="cnnNavText"><a href="/SHOWBIZ/">Entertainment</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/TRAVEL/")"><div class="cnnNavText"><a href="/TRAVEL/">Travel</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/EDUCATION/")"><div class="cnnNavText"><a href="/EDUCATION/">Education</a></div></td></tr>';
+ s += ' <tr class="cnnNavRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNav" onMouseOver="CNN_navBar(this,1,1)" onMouseOut="CNN_navBar(this,0,1)" onClick="CNN_navBarClick(this,1,"/SPECIALS/")"><div class="cnnNavText"><a href="/SPECIALS/">Special Reports</a></div></td></tr>';
+ s += ' <tr bgcolor="#FFFFFF"><td class="cnnNavAd" colspan="2" align="center"><!-- home/left.120x90 -->';
+ s += '<script language="JavaScript1.1">';
+ s += '<!--';
+ s += 'adSetTarget("_top");';
+ s += 'htmlAdWH( (new Array(93166917,93166917,93170132,93170132))[document.adoffset||0] , 120, 90);';
+ s += '//-->';
+ s += '</script><noscript><a href="http://ar.atwola.com/link/93166917/aol" target="_top"><img src="http://ar.atwola.com/image/93166917/aol" alt="Click here for our advertiser" width="120" height="90" border="0"></a></noscript></td></tr>';
+ s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">';
+ s += ' <td colspan="2" class="cnnNavGroup"><div class="cnnNavText">SERVICES</div></td></tr>';
+ s += ' <tr class="cnnNavOtherRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/video/")"><div class="cnnNavText"><a href="/video/">Video</a></div></td></tr>';
+ s += ' <tr class="cnnNavOtherRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/EMAIL/")"><div class="cnnNavText"><a href="/EMAIL/">E-Mail Services</a></div></td></tr>';
+ s += ' <tr class="cnnNavOtherRow"><td class="swath">&nbsp;</td>';
+ s += ' <td class="cnnNavOther" onMouseOver="CNN_navBar(this,1,0)" onMouseOut="CNN_navBar(this,0,0)" onClick="CNN_navBarClick(this,0,"/mobile/CNNtoGO/")"><div class="cnnNavText"><a href="/mobile/CNNtoGO/">CNN To Go</a></div></td></tr>';
+ s += ' <tr bgcolor="#999999" class="cnnNavGroupRow">';
+ s += ' <td colspan="2" class="cnnNavGroup" style="background-color: #445B60"><div class="cnnNavText" style="color: #fff">SEARCH</div></td></tr>';
+ s += ' <tr bgcolor="#CCCCCC"><td colspan="2" class="cnnNavSearch" style="background-color:#B6D8E0">';
+ s += '';
+ s += '<form action="http://search.cnn.com/cnn/search" method="get" name="nav_bottom_search" onSubmit="return CNN_validateSearchForm(this)" style="margin: 0px;">';
+ s += ' <input type="hidden" name="sites" value="cnn">';
+ s += ' <input type="hidden" name="source" value="cnn">';
+ s += ' <input type="hidden" name="invocationType" value="side/bottom">';
+ s += '<table width="100%" border="0" cellpadding="0" cellspacing="4">';
+ s += ' <tr><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td align="left"><span class="cnnFormTextB" style="color: #369">Web</span></td>';
+ s += ' <td><input type="radio" name="sites" value="google" checked></td>';
+ s += ' <td align="right"><span class="cnnFormTextB" style="color: #369">CNN.com</span></td>';
+ s += ' <td><input type="radio" name="sites" value="cnn"></td>';
+ s += ' </tr>';
+ s += ' </table></td></tr>';
+ s += ' <tr><td colspan="2"><input type="text" name="query" class="cnnFormText" value="" title="Enter text to search for and click Search" size="7" maxlength="40" style="width: 100%"></td></tr>';
+ s += ' <tr valign="top">';
+ s += ' <td><input type="submit" value="Search" class="cnnNavButton" style="padding: 0px; margin: 0px; width: 50px"></td>';
+ s += ' <td align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/nav.search.gif" alt="enhanced by Google" width="54" height="27"></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '';
+ s += '';
+ s += '</td></form></tr>';
+ s += '</table>';
+ s += '';
+ s += ' </td>';
+ s += ' <td rowspan="5" width="10"><a name="ContentArea"></a><img id="accessibilityPixel" src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="7" border="0"></td>';
+ s += ' <td colspan="3" valign="middle">';
+ s += ' <table border="0" cellpadding="0" cellspacing="0" width="100%">';
+ s += ' <tr>';
+ s += ' <td valign="top" nowrap><div class="cnnFinePrint" style="color: #333;padding:6px;padding-left:0px;">Updated: 05:53 p.m. EDT (2153 GMT) June 12, 2003</div></td>';
+ s += ' <td align="right" nowrap class="cnnt1link"><a href="http://edition.cnn.com/">Visit International Edition</a>&nbsp;</td>';
+ s += ' </tr><!--include virtual="/.element/ssi/sect/MAIN/1.0/banner.html"-->';
+ s += ' </table>';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' <tr valign="top">';
+ s += ' <td rowspan="2" width="280" bgcolor="#EAEFF4">';
+ s += '';
+ s += '<!-- T1 -->';
+ s += ' ';
+ s += ' <a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html"><img src="http://i.cnn.net/cnn/2003/SHOWBIZ/Movies/06/12/obit.peck/top.peck.obit.jpg" alt="Oscar-winner Peck dies" width="280" height="210" border="0" hspace="0" vspace="0"></a>';
+ s += '';
+ s += ' <div class="cnnMainT1">';
+ s += ' <h2 style="font-size:20px;"><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html">Oscar-winner Peck dies</a></h2>';
+ s += '<p>';
+ s += 'Actor Gregory Peck, who won an Oscar for his portrayal of upstanding lawyer Atticus Finch in 1962s "To Kill a Mockingbird," has died at age 87. Peck was best known for roles of dignified statesmen and people who followed a strong code of ethics. But he also could play against type. All told, Peck was nominated for five Academy Awards.';
+ s += '</p>';
+ s += ' <p>';
+ s += ' <b><a href="/2003/SHOWBIZ/Movies/06/12/obit.peck/index.html" class="cnnt1link">FULL STORY</a></b>';
+ s += ' </p>';
+ s += '';
+ s += '';
+ s += '';
+ s += '&#8226; <span class="cnnBodyText" style="font-weight:bold;color:#333;">Video: </span><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/showbiz/2003/06/12/peck.obit.affl.","300k");">A leading mans leading man</a><br>';
+ s += '';
+ s += '';
+ s += '';
+ s += ' ';
+ s += '&#8226; <span class="cnnBodyText" style="font-weight:bold;color:#333">Interactive: </span> <a href="javascript:CNN_openPopup("/interactive/entertainment/0306/peck.obit/frameset.exclude.html","620x430","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=620,height=430")">Gregory Peck through the years</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226; <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/12/peck.filmography/index.html" target="new">Gregory Peck filmography</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226; <a href="http://www.cnn.com/2003/SHOWBIZ/Movies/06/04/heroes.villains.ap/index.html" target="new">Pecks Finch chararcter AFIs top hero</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>';
+ s += ' </div>';
+ s += '';
+ s += '<!-- /T1 -->';
+ s += ' </td>';
+ s += ' ';
+ s += ' <td rowspan="2" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+ s += ' <td width="344">';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '<!-- T2 -->';
+ s += '';
+ s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>';
+ s += '<table width="344" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="285" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE TOP STORIES</b></span></td>';
+ s += ' <td width="59" class="cnnTabbedBoxTab" align="right" bgcolor="#336699"><a href="/userpicks"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/userpicks.gif" alt=" Hot Stories " width="59" height="11" border="0"></a></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '<div style="padding:6px;padding-left:0px;">';
+ s += '';
+ s += ' ';
+ s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/WORLD/meast/06/12/mideast/index.html">7 dead in new Gaza strike</a>';
+ s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/world/2003/06/11/cb.bush.roadmap.ap.","300k");">Video</a><br></div>';
+ s += '';
+ s += ' ';
+ s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/WORLD/meast/06/12/sprj.irq.main/index.html">U.S. helicopter, jet down in Iraqi raid</a>';
+ s += '| <img src="http://i.cnn.net/cnn/.element/img/1.0/misc/premium.gif" alt="premium content" width="9" height="11" hspace="0" vspace="0" border="0" align="absmiddle"> <a href="javascript:LaunchVideo("/iraq/2003/06/11/bw.iraq.oil.cnn.","300k");">Video</a><br></div>';
+ s += '';
+ s += ' ';
+ s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/SHOWBIZ/TV/06/12/obit.brinkley/index.html">Television icon David Brinkley dead at 82</a><br></div>';
+ s += '';
+ s += ' ';
+ s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/LAW/06/12/peterson.case/index.html">Peterson search warrants will be made public in July</a><br></div>';
+ s += '';
+ s += ' ';
+ s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/WORLD/asiapcf/east/06/12/okinawa.rape/index.html">U.S. Marine held in new Okinawa rape case</a><br></div>';
+ s += '';
+ s += ' ';
+ s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat discovered for shuttle launches</a><br></div>';
+ s += '';
+ s += ' ';
+ s += '<div class="cnnMainNewT2">&#8226; <a href="/2003/SHOWBIZ/TV/06/12/television.sopranos.reut/index.html">"Soprano" Gandolfini shares his wealth with castmates</a><br></div>';
+ s += '<!--[[div class="cnnMainNewT2"]]&#8226;&nbsp;[[b]][[span style="color:#C00;"]]CNN[[/span]]Radio:[[/b]]&nbsp;[[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]]Bush on Medicare[[/a]]&nbsp;[[a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/live.video.gif" alt="" width="61" height="14" vspace="0" hspace="2" align="absmiddle" border="0"]][[/a]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle"]][[br]][[/div]]--></div>';
+ s += '';
+ s += '<!-- /T2 -->';
+ s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+ s += '';
+ s += '<!--include virtual="/.element/ssi/misc/1.0/war.zone.smmap.txt"-->';
+ s += '<!-- =========== CNN Radio/Video Box =========== -->';
+ s += '<!-- top line --> ';
+ s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>';
+ s += '<!-- /top line -->';
+ s += ' <table width="344" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += '<!-- left-side line --> ';
+ s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="30" hspace="0" vspace="0" border="0"></td>';
+ s += '<!-- /left-side line --> ';
+ s += '<!-- CNNRadio cell -->';
+ s += ' <td width="114"><div class="cnn6pxPad">';
+ s += ' <span class="cnnBigPrint" style="color:#C00;font-weight:bold;">CNN</span><span class="cnnBigPrint" style="color:#000;font-weight:bold;">RADIO</span>';
+ s += '<div class="cnnMainNewT2"><a href="javascript:CNN_openPopup("/audio/radio/preferences.html","radioplayer","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=200,height=124")">Listen to latest updates</a><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/audio.gif" alt="" width="10" height="10" vspace="0" hspace="2" align="absmiddle">';
+ s += '<div><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="5" hspace="0" vspace="0"></div>';
+ s += '<!--';
+ s += '[[span class="cnnFinePrint"]]sponsored by:[[/span]][[br]][[center]]';
+ s += '[[!~~#include virtual="/cnn_adspaces/home/war_in_iraq/sponsor.88x31.ad"~~]]';
+ s += ' [[/center]]';
+ s += '-->';
+ s += ' </div></td>';
+ s += '<!-- /CNNRadio cell --> ';
+ s += '<!-- center line --> ';
+ s += ' <td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>';
+ s += '<!-- /center line --> ';
+ s += '<!-- video cell --> ';
+ s += ' <td width="227"><div class="cnn6pxPad">';
+ s += '<!-- video box --> ';
+ s += '<table width="215" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td width="144"><span class="cnnBigPrint" style="font-weight:bold;">VIDEO</span></td>';
+ s += ' <td width="6"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="6" height="1" hspace="0" vspace="0"></td>';
+ s += ' <td width="65"><a href="/video/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/more.video.blue.gif" alt="MORE VIDEO" width="62" height="11" hspace="0" vspace="0" border="0"></a></td></tr>';
+ s += ' <tr>';
+ s += ' <td width="215" colspan="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="1" height="2" hspace="0" vspace="0"></td></tr>';
+ s += ' <tr valign="top">';
+ s += ' <td><div class="cnnBodyText">';
+ s += ' Soldier broke dozens of hearts over e-mail<br>';
+ s += ' <img src="http://i.a.cnn.net/cnn/images/icons/premium.gif" align="middle" alt="premium content" width="9" height="11" hspace="0" vspace="1" border="0">&nbsp;<a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");" class="cnnVideoLink">PLAY VIDEO</a></div>';
+ s += ' </td>';
+ s += '<td width="3"><img src="http://i.a.cnn.net/cnn/images/1.gif" alt="" width="3" height="1" hspace="0" vspace="0"></td> ';
+ s += ' <td width="65" align="right">';
+ s += ' <a href="javascript:LaunchVideo("/offbeat/2003/06/12/ms.casanova.col.ap.","300k");"><img src="http://i.cnn.net/cnn/video/offbeat/2003/06/12/ms.casanova.col.vs.kndu.jpg" alt="" width="65" height="49" border="0" vspace="2" hspace="0"></a>';
+ s += ' </td></tr>';
+ s += '</table>';
+ s += ' <!-- /video box --> ';
+ s += ' </div></td>';
+ s += '<!-- /video cell --> ';
+ s += '<!-- right-side line --> ';
+ s += '<td bgcolor="#CCCCCC" width="1"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1" hspace="0" vspace="0" border="0"></td>';
+ s += '<!-- /right-side line --> ';
+ s += ' </tr>';
+ s += ' </table>';
+ s += '';
+ s += '<!-- bottom line -->';
+ s += '<div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="344" height="1"></div>';
+ s += '<!-- /bottom line -->';
+ s += '<!-- =========== /CNN Radio/Video Box =========== -->';
+ s += '';
+ s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+ s += '<div><img src="http://i.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="344" height="2"></div>';
+ s += '<table width="344" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="260" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>ON THE SCENE</b></span></td>';
+ s += ' <td width="84" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/law.gif" alt="more reports" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '<table width="344" border="0" cellpadding="5" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td style="padding-left:0px;"> <b>Jeffrey Toobin:</b> "It takes guts" for Peterson defense to subpoena judge over wiretap issue.';
+ s += '<a href="/2003/LAW/06/12/otsc.toobin/index.html">Full Story</a></td>';
+ s += '';
+ s += '<td width="65" align="right" style="padding-left:6px;"><a href="/2003/LAW/06/12/otsc.toobin/index.html"><img src="http://i.cnn.net/cnn/2003/LAW/06/12/otsc.toobin/tz.toobin.jpg" alt="image" width="65" height="49" border="0" hspace="0" vspace="0"></a></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' <tr valign="bottom">';
+ s += ' <td>';
+ s += '<table width="344" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="267" nowrap style="color: #c00; padding-left: 6px"><span class="cnnBigPrint" style="vertical-align: top"><b>BUSINESS</b></span>';
+ s += ' <a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/at_cnnmoney.gif" alt=" at CNN/Money " width="100" height="15" border="0"></a></td>';
+ s += ' <td width="77" align="right"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.news.blue.gif" alt=" Business News " width="77" height="11" border="0"></a></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '<table width="344" bgcolor="#EEEEEE" border="0" cellpadding="0" cellspacing="0" style="border: solid 1px #ddd">';
+ s += ' <tr valign="top">';
+ s += ' <td>';
+ s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">';
+ s += ' <tr>';
+ s += ' <td colspan="3"><span class="cnnMenuText"><b>STOCK/FUND QUOTES: </b></span></td>';
+ s += ' </tr><form action="http://qs.money.cnn.com/tq/stockquote" method="get" style="margin: 0px;">';
+ s += ' <tr>';
+ s += ' <td><span class="cnnFinePrint">enter symbol</span></td>';
+ s += ' <td><input type="text" name="symbols" size="7" maxlength="40" class="cnnMenuText" title="Enter stock/fund symbol or name to get a quote"></td>';
+ s += ' <td><input type="submit" value="GET" class="cnnNavButton"></td>';
+ s += ' </tr></form>';
+ s += ' </table>';
+ s += ' <table width="100%" border="0" cellpadding="0" cellspacing="4">';
+ s += ' <tr valign="top">';
+ s += ' <td><span class="cnnFinePrint">sponsored by:</span></td>';
+ s += ' <td align="right"><!--<a href="/money/news/specials/rebuild_iraq/"><img src="http://i.a.cnn.net/cnn/2003/images/04/17/money.box.gif" ALT="" width="150" height="31" HSPACE="0" VSPACE="0" border="0" align="left"></a>--><a href="http://ar.atwola.com/link/93103306/aol"><img src="http://ar.atwola.com/image/93103306/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a></td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' </td>';
+ s += ' <td class="cnnMainMarketBox"> <table width="100%" border="0" cellpadding="4" cellspacing="0" summary="Market data from CNNmoney">';
+ s += ' <tr class="noBottomBorder">';
+ s += ' <td colspan="5"><span class="cnnMainMarketCell"><span class="cnnMenuText"><b><a href="/money/markets/">MARKETS:</a></b></span> <!-- 16:30:15 -->';
+ s += '';
+ s += '4:30pm ET, 6/12</span></td>';
+ s += ' </tr>';
+ s += ' <tr class="noTopBorder">';
+ s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/dow.html" title="Dow Jones Industrial Average">DJIA</a></span></td>';
+ s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+13.30</span></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">9196.50</span></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.14%</span></td>';
+ s += '';
+ s += ' </tr>';
+ s += ' <tr>';
+ s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/nasdaq.html" title="NASDAQ">NAS</a></span></td>';
+ s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 7.60</span></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">1653.62</span></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.46%</span></td>';
+ s += '';
+ s += ' </tr>';
+ s += ' <tr class="noBottomBorder">';
+ s += ' <td><span class="cnnMainMarketCell"><a href="/money/markets/sandp.html" title="S&amp;P 500">S&amp;P</a></span></td>';
+ s += ' <td><img src="http://i.cnn.net/cnn/.element/img/1.0/main/arrow_up.gif" alt="" width="9" height="9"></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 1.03</span></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">998.51</span></td>';
+ s += ' <td align="right" nowrap><span class="cnnMainMarketCell">+ 0.10%</span></td>';
+ s += '';
+ s += ' </tr>';
+ s += ' </table>';
+ s += '</td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '</td>';
+ s += ' </tr>';
+ s += ' <tr>';
+ s += ' <td colspan="3"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="4"></td>';
+ s += ' </tr>';
+ s += ' <tr align="center" valign="bottom">';
+ s += ' <td width="280" bgcolor="#EEEEEE"><a href="/linkto/ftn.nytimes1.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.280x32.ny.times.gif" width="255" height="32" alt="" border="0"></a></td>';
+ s += '<td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+ s += ' <td width="344" bgcolor="#EEEEEE"><a href="/linkto/ftn.bn3.html"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/ftn.345x32.breaking.news.gif" width="340" height="32" alt="" border="0"></a></td>';
+ s += ' </tr>';
+ s += '';
+ s += '</table>';
+ s += '';
+ s += '';
+ s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+ s += '';
+ s += '';
+ s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <col width="10">';
+ s += ' <col width="483" align="left" valign="top">';
+ s += ' <col width="10">';
+ s += ' <col width="267" align="left" valign="top">';
+ s += ' <tr valign="top">';
+ s += ' <td rowspan="2"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+ s += ' <td valign="top">';
+ s += ' <table border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td width="238">';
+ s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="132" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>MORE REAL TV</b></span></td>';
+ s += ' <td width="106" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/SHOWBIZ"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.news.gif" alt="More Entertainment" border="0" width="102" height="11" hspace="2" vspace="2" align="right"></a></td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>';
+ s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td><div class="cnn6pxTpad">';
+ s += ' ';
+ s += ' <a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html">Go ahead, follow me</a><br>';
+ s += 'New reality series and the movie debut of "Idol" finalists';
+ s += ' </div></td>';
+ s += ' <td width="71" align="right"><a href="/2003/SHOWBIZ/06/11/eye.ent.voyeurs/index.html"><img src="http://i.a.cnn.net/cnn/2003/SHOWBIZ/06/11/eye.ent.voyeurs/tz.movies.gif" alt="Go ahead, follow me" width="65" height="49" border="0" vspace="6"></a></td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += ' ';
+ s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>';
+ s += '<!--include virtual="/.element/ssi/video/section_teases/topvideos_include.txt"-->';
+ s += ' </td>';
+ s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>';
+ s += ' <td width="238">';
+ s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="238" height="2"></div>';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="157" class="cnnTabbedBoxHeader" style="padding-left:0px;"><span class="cnnBigPrint"><b>GIFT IDEAS</b></span></td>';
+ s += ' <td width="81" class="cnnTabbedBoxTab" align="right" bgcolor="#336699" style="padding: 0px 3px;"><a href="/money"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/business.gif" alt="Business News" border="0" width="77" height="11" hspace="2" vspace="2" align="right"></a></td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="5" vspace="0" hspace="0"></div>';
+ s += ' <table width="238" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td><div class="cnn6pxTpad">';
+ s += '';
+ s += '';
+ s += '<span class="cnnBodyText" style="font-weight:bold;">CNN/Money: </span> <a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes">Fathers Day</a><br>';
+ s += 'Smaller is better --from digital cameras to iPod';
+ s += ' </div></td>';
+ s += ' <td width="71" align="right"><a href="/money/2003/06/12/news/companies/fathers_day/index.htm?cnn=yes"><img src="http://i.a.cnn.net/cnn/images/programming.boxes/tz.money.dads.day.watch.jpg" alt="Fathers Day" width="65" height="49" border="0" vspace="6"></a></td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="238" height="10" vspace="0" hspace="0"></div> ';
+ s += '<table width="483" border="0" cellspacing="0" cellpadding="0">';
+ s += ' <tr valign="top">';
+ s += ' <td rowspan="9"><br></td>';
+ s += ' <td width="238"><a href="/US/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/us.gif" alt="U.S. News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/US/South/06/11/miami.rapist/index.html">Miami police link 4 rapes to serial rapist</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/LAW/06/12/mistaken.identity.ap/index.html">Woman mistaken for fugitive jailed</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/US/Northeast/06/12/woman.impaled.ap/index.html">Pregnant woman impaled on mic stand</a><br>';
+ s += ' </div></td>';
+ s += ' <td rowspan="7" width="7"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="7" height="1"></td>';
+ s += ' <td width="238"><a href="/WORLD/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/world.gif" alt="World News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/WORLD/europe/06/12/nato.bases/index.html">NATO reshapes for new era</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/WORLD/africa/06/12/congo.democratic/index.html">U.N. reviews Bunia peace force</a><br>';
+ s += '';
+ s += '';
+ s += '';
+ s += '&#8226;&nbsp;<span class="cnnBodyText" style="font-weight:bold;color:#900;">TIME.com: </span><a href="/time/magazine/article/0,9171,1101030616-457361,00.html?CNN=yes" target="new">Saddams curtain trail</a><img src="http://i.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13" vspace="1" hspace="4" border="0" align="top"><br>';
+ s += ' </div></td>';
+ s += ' </tr><tr valign="top">';
+ s += ' <td width="238"><a href="/TECH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/technology.gif" alt="Sci-Tech News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/TECH/ptech/06/11/bus2.ptech.dvd.maker/index.html">Another reason to throw out your VCR</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/TECH/ptech/06/12/korea.samsung.reut/index.html">Flat screen TV prices dropping</a><br>';
+ s += ' </div></td>';
+ s += ' <td width="238"><a href="/SHOWBIZ/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/entertainment.gif" alt="Entertainment News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/SHOWBIZ/TV/06/12/cnn.obrien/index.html">CNN hires Soledad OBrien for "AM"</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/SHOWBIZ/TV/06/11/batchelor.troubles.ap/index.html">Dating show star let go by law firm</a><br>';
+ s += ' </div></td>';
+ s += ' </tr><tr valign="top">';
+ s += ' <td width="238"><a href="/ALLPOLITICS/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/politics.gif" alt="Politics News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/ALLPOLITICS/06/11/schwarzenegger.ap/index.html">Schwarzenegger on California politics</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/ALLPOLITICS/06/12/tax.credit.ap/index.html">House approves extension on child tax credit</a><br>';
+ s += ' </div></td>';
+ s += ' <td width="238"><a href="/LAW/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/law.gif" alt="Law News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/LAW/06/12/plaintiff.advances.ap/index.html">Court bars cash advances to plaintiffs</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/LAW/06/11/jackson.lawsuit.ap/index.html">Lawsuit against Jackson settled</a><br>';
+ s += ' </div></td>';
+ s += ' </tr><tr valign="top">';
+ s += ' <td width="238"><a href="/HEALTH/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/health.gif" alt="Health News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/HEALTH/06/12/monkeypox.ap/index.html">Monkeypox spreading person-to-person?</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/HEALTH/06/12/quick.xray.ap/index.html">A full body X-ray in 13 seconds</a><br>';
+ s += ' </div></td>';
+ s += ' <td width="238"><a href="/TECH/space/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/space.gif" alt="Space News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/TECH/science/06/12/hydrogen.ozone.ap/index.html">Hydrogen fuel may disturb ozone layer</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/TECH/space/06/12/sprj.colu.bolts.ap/index.html">New threat found for shuttle launches</a><br>';
+ s += ' </div></td>';
+ s += ' </tr><tr valign="top">';
+ s += ' <td width="238"><a href="/TRAVEL/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/travel.gif" alt="Travel News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/TRAVEL/DESTINATIONS/06/12/walk.across.america.ap/index.html">Walking America from coast to coast</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/TRAVEL/06/11/bi.airlines.executives.reut/index.html">Airline execs not seeing sunny skies yet</a><br>';
+ s += ' </div></td>';
+ s += ' <td width="238"><a href="/EDUCATION/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/education.gif" alt="Education News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/EDUCATION/06/12/arabs.prom.ap/index.html">Arab students seek prom balance</a><br>';
+ s += '';
+ s += ' ';
+ s += '&#8226;&nbsp;<a href="/2003/EDUCATION/06/11/school.fundraising.ap/index.html">Public schools turn to upscale fundraising</a><br>';
+ s += ' </div></td>';
+ s += ' </tr><tr valign="top">';
+ s += ' <td width="238"><a href="/si/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/sports.gif" alt="Sports News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '';
+ s += '&#8226;&nbsp;<a href="/cnnsi/golfonline/2003/us_open/news/2003/06/12/open_thursday_ap">Woods eyes third U.S. Open title</a><br>';
+ s += '&#8226;&nbsp;<a href="/cnnsi/basketball/news/2003/06/12/jordan_ruling_ap">Judge denies Jordan&#039;s former lover $5M payoff</a><br>';
+ s += ' </div></td>';
+ s += ' <td width="238"><a href="/money/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/business.gif" alt="Business News: " width="238" height="15" border="0"></a><br><div class="cnnMainSections">';
+ s += '&#8226;&nbsp;<a href="/money/2003/06/12/pf/saving/duppies/index.htm">Here come the "Duppies"</a><br>';
+ s += '&#8226;&nbsp;<a href="/money/2003/06/12/technology/oracle/index.htm">Oracle beats estimates</a><br>';
+ s += ' </div></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += ' </td>';
+ s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" width="10" hspace="0" vspace="0" alt=""></td>';
+ s += ' <td valign="top">';
+ s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>';
+ s += ' ';
+ s += '<table width="267" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="173" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>WATCH CNN TV</b></span></div></td>';
+ s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>';
+ s += ' <td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/CNN/Programs/"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"></a></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '<table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td><a href="/CNN/Programs/american.morning/"><img src="http://i.cnn.net/cnn/CNN/Programs/includes/showbox/images/2003/05/tz.hemmer.jpg" alt="American Morning, 7 a.m. ET" width="65" height="49" border="0" align="right"></a><a href="/CNN/Programs/american.morning/"><b>American Morning (7 a.m. ET):</b></a> Tomorrow, singer Carnie Wilson talks about her new book, "Im Still Hungry."';
+ s += ' </td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '<!--';
+ s += '[[table width="267" border="0" cellpadding="0" cellspacing="0"]]';
+ s += '[[tr]][[td width="173" bgcolor="#003366"]][[div class="cnnBlueBoxHeader"]][[span class="cnnBigPrint"]][[b]]WATCH CNN TV[[/b]][[/span]][[/div]][[/td]][[td width="25" class="cnnBlueBoxHeader" align="right"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""]][[/td]][[td width="69" class="cnnBlueBoxTab" align="right" bgcolor="#336699"]][[a href="/CNN/Programs/"]][[img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/tv.schedule.gif" alt="On CNN TV" border="0" width="65" height="11" hspace="2" vspace="2" align="right"]][[/a]][[/td]][[/tr]][[/table]][[table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0"]][[tr valign="top"]][[td]]';
+ s += '[[img src="http://i.cnn.net/cnn/2003/images/05/31/tz.bw.jpg" alt="" width="65" height="49" border="0" align="right"]]';
+ s += ' ';
+ s += '[[b]] CNN Presents: The Hunt for Eric Robert Rudolph (8 p.m. ET)[[/b]][[br]]Latest on his capture.';
+ s += ' [[/td]]';
+ s += ' [[/tr]]';
+ s += ' [[/table]]';
+ s += '-->';
+ s += '';
+ s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div> ';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>';
+ s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="184" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>ANALYSIS</b></span></div></td>';
+ s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>';
+ s += ' <td width="58" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/US"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/us.gif" alt="U.S. News" border="0" width="54" height="11" hspace="2" vspace="2" align="right"></a></td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <table width="267" bgcolor="#EEEEEE" border="0" cellpadding="4" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td>';
+ s += '<a href="/2003/US/06/12/nyt.safire/index.html"><img src="http://i.a.cnn.net/cnn/2003/US/06/12/nyt.safire/tz.stewart.jpg" alt="Fight It, Martha" width="65" height="49" border="0" align="right"></a>';
+ s += '';
+ s += '';
+ s += '<span class="cnnBodyText" style="font-weight:bold;color:#000;">NYTimes: </span> <a href="/2003/US/06/12/nyt.safire/index.html">Fight It, Martha</a><br>';
+ s += 'William Safire: I hope Martha Stewart beats this bum rap';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+ s += ' <div><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_c00.gif" alt="" width="267" height="2"></div>';
+ s += ' <table width="267" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="164" bgcolor="#003366"><div class="cnnBlueBoxHeader"><span class="cnnBigPrint"><b>OFFBEAT</b></span></div></td>';
+ s += ' <td width="25" class="cnnBlueBoxHeader" align="right"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/diagonal.gif" width="25" height="19" alt=""></td>';
+ s += ' <td width="78" class="cnnBlueBoxTab" align="right" bgcolor="#336699"><a href="/offbeat"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/superlinks/offbeat.gif" alt="more offbeat" width="74" height="11" border="0" hspace="2" vspace="2" align="right"></a></td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <table width="267" bgcolor="#DDDDDD" border="0" cellpadding="4" cellspacing="0">';
+ s += ' <tr valign="top">';
+ s += ' <td>';
+ s += '<a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html"><img src="http://i.a.cnn.net/cnn/2003/HEALTH/06/12/offbeat.china.sperm.ap/tz.china.sperm.jpg" alt="Waiting list" width="65" height="49" border="0" align="right"></a>';
+ s += ' ';
+ s += ' <a href="/2003/HEALTH/06/12/offbeat.china.sperm.ap/index.html">Waiting list</a><br>';
+ s += 'Chinas "smart sperm" bank needs donors';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="10"></div>';
+ s += '';
+ s += ' <table width="267" bgcolor="#999999" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td>';
+ s += ' <table width="100%" border="0" cellpadding="4" cellspacing="1">';
+ s += ' <tr>';
+ s += ' <td bgcolor="#EEEEEE" class="cnnMainWeatherBox"><a name="weatherBox"></a>';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '';
+ s += '<table width="257" border="0" cellpadding="1" cellspacing="0">';
+ s += '<form method="get" action="http://weather.cnn.com/weather/search" style="margin: 0px">';
+ s += '<input type="hidden" name="mode" value="hplwp">';
+ s += ' <tr>';
+ s += ' <td bgcolor="#FFFFFF"><table width="255" bgcolor="#EAEFF4" border="0" cellpadding="4" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td colspan="2" class="cnnWEATHERrow">&nbsp;<span class="cnnBigPrint">WEATHER</span></td>';
+ s += ' </tr>';
+ s += ' <tr>';
+ s += ' <td colspan="2" class="cnnBodyText">Get your hometown weather on the home page! <b>Enter city name or U.S. Zip Code:</b></td>';
+ s += ' </tr>';
+ s += ' <tr>';
+ s += ' <td><input class="cnnFormText" type="text" size="12" name="wsearch" value="" style="width:100px;"></td>';
+ s += ' <td><input class="cnnNavButton" type="submit" value="PERSONALIZE"></td>';
+ s += ' </tr>';
+ s += ' <tr>';
+ s += ' <td class="cnnBodyText" colspan="2">Or <a href="javascript:CNN_openPopup("http://weather.cnn.com/weather/select.popup/content2.jsp?mode=hplwp", "weather", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=260,height=250")"><b>select location from a list</b></a></td>';
+ s += ' </tr>';
+ s += ' </table></td>';
+ s += ' </tr>';
+ s += '</form>';
+ s += '</table>';
+ s += '';
+ s += '';
+ s += '';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' <tr>';
+ s += ' <td bgcolor="#EEEEEE">';
+ s += ' <table width="100%" border="0" cellpadding="0" cellspacing="2">';
+ s += ' <tr>';
+ s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/quickvote.gif" alt="Quick Vote" width="107" height="24" border="0"></td>';
+ s += ' <td width="88" align="right"><!-- ad home/quickvote/sponsor.88x31 -->';
+ s += '<!-- ad commented while aol investigates 3/31/03 5:40 a.m. lk -->';
+ s += '<a href="http://ar.atwola.com/link/93101912/aol"><img src="http://ar.atwola.com/image/93101912/aol" alt="Click Here" width="88" height="31" border="0" hspace="0" vspace="0"></a>';
+ s += '</td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += '<table width="100%" cellspacing="0" cellpadding="1" border="0"><form target="popuppoll" method="post" action="http://polls.cnn.com/poll">';
+ s += '<INPUT TYPE=HIDDEN NAME="poll_id" VALUE="3966">';
+ s += '<tr><td colspan="2" align="left"><span class="cnnBodyText">Should an international peacekeeping force be sent to the Mideast?<br></span></td></tr>';
+ s += '<tr valign="top">';
+ s += '<td><span class="cnnBodyText">Yes</span>';
+ s += '</td><td align="right"><input value="1" type="radio" name="question_1"></td></tr>';
+ s += '<tr valign="top">';
+ s += '<td><span class="cnnBodyText">No</span>';
+ s += '</td><td align="right"><input value="2" type="radio" name="question_1"></td></tr>';
+ s += '<!-- /end Question 1 -->';
+ s += '<tr>';
+ s += '<td colspan="2">';
+ s += '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><span class="cnnInterfaceLink"><nobr><a href="javascript:CNN_openPopup("/POLLSERVER/results/3966.html","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")">VIEW RESULTS</a></nobr></span></td>';
+ s += '<td align="right"><input class="cnnFormButton" onclick="CNN_openPopup("","popuppoll","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=510,height=400")" value="VOTE" type="SUBMIT"></td></tr></table></td></tr>';
+ s += '</form></table>';
+ s += '';
+ s += ' </td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += ' </td>';
+ s += ' </tr>';
+ s += ' </table>';
+ s += ' <!-- /right --></td>';
+ s += ' </tr>';
+ s += ' <tr>';
+ s += ' <td colspan="3" valign="bottom"> <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/px_ccc.gif" alt="" width="483" height="1"> </td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '<table width="770" border="0" cellpadding="0" cellspacing="0" summary="Links to stories from CNN partners">';
+ s += ' <col width="10">';
+ s += ' <col width="250" align="left" valign="top">';
+ s += ' <col width="5">';
+ s += ' <col width="250" align="left" valign="top">';
+ s += ' <col width="5">';
+ s += ' <col width="250" align="left" valign="top">';
+ s += ' <tr><td colspan="6"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+ s += ' <tr valign="top">';
+ s += ' <td rowspan="6" width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="1"></td>';
+ s += ' <td colspan="3"><span class="cnnMenuText" style="font-size: 12px"><b style="color: #c00">From our Partners</b></span>';
+ s += ' <img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_external.gif" alt=" External site icon " width="20" height="13" border="0" align="middle"></td>';
+ s += ' <td colspan="2"></td>';
+ s += ' </tr>';
+ s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+ s += ' <tr><td colspan="5" bgcolor="#CCCCCC"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr>';
+ s += ' <tr><td colspan="5"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></td></tr>';
+ s += ' <tr valign="top">';
+ s += ' <td class="cnnMainSections" width="250">';
+ s += '<a href="/time/" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_time.gif" alt="Time: " width="70" height="17" border="0"></a><br><div style="margin-top: 4px"> &#8226;&nbsp;<a target="new" href="/time/magazine/article/0,9171,1101030616-457387,00.html?CNN=yes">Where the Jobs Are</a><br> &#8226;&nbsp;<a target="new" href="/time/magazine/article/0,9171,1101030616-457373,00.html?CNN=yes">Of Dogs and Men</a><br> &#8226;&nbsp;<a target="new" href="/time/photoessays/gunmen/?CNN=yes">Photo Essay: Fighting the Peace</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td>&nbsp;&nbsp;<a target="new" href="/linkto/time.main.html">Subscribe to TIME</a>&nbsp;&nbsp;</td></tr></table> </td>';
+ s += ' <td width="5"><br></td>';
+ s += ' <td class="cnnMainSections" width="250">';
+ s += '<a href="/cnnsi/index.html?cnn=yes"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partner_si.gif" alt="CNNsi.com: " width="138" height="17" border="0"></a><br><div style="margin-top: 4px">';
+ s += '&#8226;&nbsp;Marty Burns: <a target="new" href="/cnnsi/inside_game/marty_burns/news/2003/06/11/burns_game4/">Nets pull out all stops</a><br>';
+ s += '&#8226;&nbsp;Michael Farber: <a target="new" href="/cnnsi/inside_game/michael_farber/news/2003/06/11/farber_wrapup/">Sens look good for "04</a><br>';
+ s += '&#8226;&nbsp;Tim Layden: <a target="new" href="/cnnsi/inside_game/tim_layden/news/2003/06/11/layden_neuheisel/">NFL or bust for Neuheisel</a><br>';
+ s += '</div>';
+ s += '<table border="0"><tr><td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr><tr bgcolor="#dddddd"><td>&nbsp;&nbsp;<a href="http://subs.timeinc.net/CampaignHandler/si_cnnsi?source_id=19">Subscribe to Sports Illustrated</a>&nbsp;&nbsp;</td></tr></table>';
+ s += ' </td>';
+ s += ' <td width="5"><br></td>';
+ s += ' <td class="cnnMainSections" width="250">';
+ s += '<a href="/linkto/nyt/main.banner.html" target="new"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/partners_nyt.gif" alt="New York Times: " width="105" height="17" border="0"></a><br><div style="margin-top: 4px"> &#8226;&nbsp;<a target="new" href="/linkto/nyt/story/1.0612.html">U.S. Widens Checks at Foreign Ports</a><br> &#8226;&nbsp;<a target="new" href="/linkto/nyt/story/2.0612.html">Rumsfeld: Iran Developing Nuclear Arms</a><br> &#8226;&nbsp;<a target="new" href="/linkto/nyt/story/3.0612.html">Vandalism, "Improvements" Mar Great Wall</a><br></div><table border="0"><tr><td><img height="1" width="1" alt="" src="http://i.cnn.net/cnn/images/1.gif"/></td></tr><tr bgcolor="#dddddd"><td>&nbsp;&nbsp;<a target="new" href="/linkto/nyt.main.html">Get 50% OFF the NY Times</a>&nbsp;&nbsp;</td></tr></table> </td>';
+ s += ' </tr>';
+ s += '';
+ s += '</table>';
+ s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="2"></div>';
+ s += '';
+ s += '<table width="770" border="0" cellpadding="0" cellspacing="0">';
+ s += ' <tr>';
+ s += ' <td width="10"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="10" height="10"></td>';
+ s += ' <td width="760">';
+ s += '<!-- floor -->';
+ s += '';
+ s += '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#999999"><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></td></tr></table>';
+ s += '';
+ s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>';
+ s += '';
+ s += '<table width="100%" bgcolor="#DEDEDE" border="0" cellpadding="3" cellspacing="0">';
+ s += ' <tr> ';
+ s += ' <td><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="5" height="5"></td>';
+ s += ' <td><a href="http://edition.cnn.com/" class="cnnFormTextB" onClick="clickEdLink()" style="color:#000;">International Edition</a></td>';
+ s += '<form>';
+ s += ' <td><select title="CNN.com is available in different languages" class="cnnMenuText" name="languages" size="1" style="font-weight: bold; vertical-align: middle" onChange="if (this.options[selectedIndex].value != "") location.href=this.options[selectedIndex].value">';
+ s += ' <option value="" disabled selected>Languages</option>';
+ s += ' <option value="" disabled>---------</option>';
+ s += ' <option value="/cnnes/">Spanish</option>';
+ s += ' <option value="http://cnn.de/">German</option>';
+ s += ' <option value="http://cnnitalia.it/">Italian</option>';
+ s += ' <option value="http://www.joins.com/cnn/">Korean</option>';
+ s += ' <option value="http://arabic.cnn.com/">Arabic</option>';
+ s += ' <option value="http://www.CNN.co.jp/">Japanese</option>';
+ s += ' </select></td>';
+ s += '</form>';
+ s += ' <td><a href="/CNN/Programs/" class="cnnFormTextB" style="color:#000;">CNN TV</a></td>';
+ s += ' <td><a href="/CNNI/" class="cnnFormTextB" style="color:#000;">CNN International</a></td>';
+ s += ' <td><a href="/HLN/" class="cnnFormTextB" style="color:#000;">Headline News</a></td>';
+ s += ' <td><a href="/TRANSCRIPTS/" class="cnnFormTextB" style="color:#000;">Transcripts</a></td>';
+ s += ' <td><a href="/services/preferences/" title="Customize your CNN.com experience" class="cnnFormTextB" style="color:#000;">Preferences</a></td>';
+ s += ' <td><a href="/INDEX/about.us/" class="cnnFormTextB" style="color:#000;">About CNN.com</a></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '<div><img src="http://i.cnn.net/cnn/images/1.gif" alt="" width="1" height="1"></div>';
+ s += '';
+ s += '<table width="100%" bgcolor="#EFEFEF" border="0" cellpadding="4" cellspacing="0">';
+ s += ' <tr valign="top"> ';
+ s += ' <td style="padding-left:10px"><div class="cnnSectCopyright">';
+ s += '<b>&copy; 2003 Cable News Network LP, LLLP.</b><br>';
+ s += 'An AOL Time Warner Company. All Rights Reserved.<br>';
+ s += '<a href="/interactive_legal.html">Terms</a> under which this service is provided to you.<br>';
+ s += 'Read our <a href="/privacy.html">privacy guidelines</a>. <a href="/feedback/">Contact us</a>.';
+ s += ' </div></td>';
+ s += ' <td align="right"><table border="0" cellpadding="4" cellspacing="0">';
+ s += ' <tr> ';
+ s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>';
+ s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/misc/icon.external.links.gif" alt="external link" width="20" height="13"></td>';
+ s += ' <td><div class="cnnSectExtSites">All external sites will open in a new browser.<br>';
+ s += ' CNN.com does not endorse external sites.</div></td>';
+ s += ' <td rowspan="2" align="middle"><img src="http://i.a.cnn.net/cnn/.element/img/1.0/sect/SEARCH/dotted.line.gif" alt="" width="7" height="46"></td>';
+ s += ' <td rowspan="2"><!-- home/powered_by/sponsor.88x31 -->';
+ s += '<script language="JavaScript1.1">';
+ s += '<!--';
+ s += 'adSetTarget("_top");';
+ s += 'htmlAdWH( (new Array(93103308,93103308,93103308,93103308))[document.adoffset||0] , 88, 31);';
+ s += '//-->';
+ s += '</script><noscript><a href="http://ar.atwola.com/link/93103308/aol" target="_top"><img src="http://ar.atwola.com/image/93103308/aol" alt="Click here for our advertiser" width="88" height="31" border="0"></a></noscript>';
+ s += '</td>';
+ s += ' </tr>';
+ s += ' <tr valign="top"> ';
+ s += ' <td><img src="http://i.a.cnn.net/cnn/.element/img/1.0/main/icon_premium.gif" alt=" Premium content icon " width="9" height="11"></td>';
+ s += ' <td><span class="cnnSectExtSites">Denotes premium content.</span></td>';
+ s += ' </tr>';
+ s += ' </table></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '<!-- /floor --></td>';
+ s += ' </tr>';
+ s += '</table>';
+ s += '';
+ s += '';
+ s += '';
+ s += '<!-- popunder ad generic/popunder_launch.720x300 -->';
+ s += '<script language="JavaScript1.1" type="text/javascript">';
+ s += '<!--';
+ s += 'if (document.adPopupFile) {';
+ s += ' if (document.adPopupInterval == null) {';
+ s += ' document.adPopupInterval = "0";';
+ s += ' }';
+ s += ' if (document.adPopunderInterval == null) {';
+ s += ' document.adPopunderInterval = document.adPopupInterval;';
+ s += ' }';
+ s += ' if (document.adPopupDomain != null) {';
+ s += ' adSetPopDm(document.adPopupDomain);';
+ s += ' }';
+ s += ' adSetPopupWH("93162673", "720", "300", document.adPopupFile, document.adPopunderInterval, 20, 50, -1);';
+ s += '}';
+ s += '// -->';
+ s += '</script>';
+ s += ' ';
+ s += '<!-- home/bottom.eyeblaster -->';
+ s += '<script language="JavaScript1.1" type="text/javascript">';
+ s += '<!--';
+ s += 'var MacPPC = (navigator.platform == "MacPPC") ? true : false;';
+ s += 'if (!MacPPC) {';
+ s += 'adSetType("J");';
+ s += 'htmlAdWH( (new Array(93137910,93137910,93137910,93137910))[document.adoffset||0], 101, 1);';
+ s += 'adSetType("");';
+ s += '}';
+ s += '// -->';
+ s += '</script>';
+ s += '';
+ s += '<script language="JavaScript1.1" src="http://ar.atwola.com/file/adsEnd.js"></script>';
+ s += '';
+ s += '<img src="/cookie.crumb" alt="" width="1" height="1">';
+ s += '<!--include virtual="/virtual/2002/main/survey.html"-->';
+ s += '</body>';
+ s += '</html>';
+
+ return s;
+ }
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209919.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209919.js
new file mode 100644
index 0000000000..62c3cd86f0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-209919.js
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * sagdjb@softwareag.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 19 June 2003
+ * SUMMARY: Testing regexp submatches with quantifiers
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=209919
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-209919.js';
+var i = 0;
+var BUGNUMBER = 209919;
+var summary = 'Testing regexp submatches with quantifiers';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * Waldemar: "ECMA-262 15.10.2.5, third algorithm, step 2.1 states that
+ * once the minimum repeat count (which is 0 for *, 1 for +, etc.) has
+ * been satisfied, an atom being repeated must not match the empty string."
+ *
+ * In this example, the minimum repeat count is 0, so the last thing the
+ * capturing parens is permitted to contain is the 'a'. It may NOT go on
+ * to capture the '' at the $ position of 'a', even though '' satifies
+ * the condition b*
+ *
+ */
+status = inSection(1);
+string = 'a';
+pattern = /(a|b*)*/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'a');
+addThis();
+
+
+/*
+ * In this example, the minimum repeat count is 5, so the capturing parens
+ * captures the 'a', then goes on to capture the '' at the $ position of 'a'
+ * 4 times before it has to stop. Therefore the last thing it contains is ''.
+ */
+status = inSection(2);
+string = 'a';
+pattern = /(a|b*){5,}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '');
+addThis();
+
+
+/*
+ * Reduction of the above examples to contain only the condition b*
+ * inside the capturing parens. This can be even harder to grasp!
+ *
+ * The global match is the '' at the ^ position of 'a', but the parens
+ * is NOT permitted to capture it since the minimum repeat count is 0!
+ */
+status = inSection(3);
+string = 'a';
+pattern = /(b*)*/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('', undefined);
+addThis();
+
+
+/*
+ * Here we have used the + quantifier (repeat count 1) outside the parens.
+ * Therefore the parens must capture at least once before stopping, so it
+ * does capture the '' this time -
+ */
+status = inSection(4);
+string = 'a';
+pattern = /(b*)+/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('', '');
+addThis();
+
+
+/*
+ * More complex examples -
+ */
+pattern = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/;
+
+status = inSection(5);
+string = '100.00';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '00', undefined);
+addThis();
+
+status = inSection(6);
+string = '100,00';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '100', ',00');
+addThis();
+
+status = inSection(7);
+string = '1.000,00';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '000', ',00');
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-216591.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-216591.js
new file mode 100644
index 0000000000..455565ae36
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-216591.js
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * okin7@yahoo.fr, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 19 August 2003
+ * SUMMARY: Regexp conformance test
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=216591
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-216591.js';
+var i = 0;
+var BUGNUMBER = 216591;
+var summary = 'Regexp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'a {result.data.DATA} b';
+pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array('{result.data.DATA}', 'result.data.', 'data.', 'DATA');
+addThis();
+
+/*
+ * Add a global flag to the regexp. In Perl 5, this gives the same results as above. Compare:
+ *
+ * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; print("$&, $1, $2, $3");'
+ * {result.data.DATA}, result.data., data., DATA
+ *
+ * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; print("$&, $1, $2, $3");'
+ * {result.data.DATA}, result.data., data., DATA
+ *
+ *
+ * But in JavaScript, there will no longer be any sub-captures:
+ */
+status = inSection(2);
+string = 'a {result.data.DATA} b';
+pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi;
+actualmatch = string.match(pattern);
+expectedmatch = Array('{result.data.DATA}');
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-220367-001.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-220367-001.js
new file mode 100644
index 0000000000..59abc0c4b0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-220367-001.js
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@fastmail.fm, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 26 September 2003
+ * SUMMARY: Regexp conformance test
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=220367
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-220367-001.js';
+var i = 0;
+var BUGNUMBER = 220367;
+var summary = 'Regexp conformance test';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'a';
+pattern = /(a)|(b)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'a', undefined);
+addThis();
+
+status = inSection(2);
+string = 'b';
+pattern = /(a)|(b)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, undefined, 'b');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223273.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223273.js
new file mode 100644
index 0000000000..2858e85487
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223273.js
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 23 October 2003
+ * SUMMARY: Unescaped, unbalanced parens in a regexp should cause SyntaxError.
+ *
+ * The same would also be true for unescaped, unbalanced brackets or braces
+ * if we followed the ECMA-262 Ed. 3 spec on this. But it was decided for
+ * backward compatibility reasons to follow Perl 5, which permits
+ *
+ * 1. an unescaped, unbalanced right bracket ]
+ * 2. an unescaped, unbalanced left brace {
+ * 3. an unescaped, unbalanced right brace }
+ *
+ * If any of these should occur, Perl treats each as a literal
+ * character. Therefore we permit all three of these cases, even
+ * though not ECMA-compliant. Note Perl errors on an unescaped,
+ * unbalanced left bracket; so will we.
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=223273
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-223273.js';
+var UBound = 0;
+var BUGNUMBER = 223273;
+var summary = 'Unescaped, unbalanced parens in regexp should be a SyntaxError';
+var TEST_PASSED = 'SyntaxError';
+var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var CHECK_PASSED = 'Should not generate an error';
+var CHECK_FAILED = 'Generated an error!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * All the following contain unescaped, unbalanced parens and
+ * should generate SyntaxErrors. That's what we're testing for.
+ *
+ * To allow the test to compile and run, we have to hide the errors
+ * inside eval strings, and check they are caught at run-time.
+ *
+ * Inside such strings, remember to escape any escape character!
+ */
+status = inSection(1);
+testThis(' /(/ ');
+
+status = inSection(2);
+testThis(' /)/ ');
+
+status = inSection(3);
+testThis(' /(abc\\)def(g/ ');
+
+status = inSection(4);
+testThis(' /\\(abc)def)g/ ');
+
+
+/*
+ * These regexp patterns are correct and should not generate
+ * any errors. Note we use checkThis() instead of testThis().
+ */
+status = inSection(5);
+checkThis(' /\\(/ ');
+
+status = inSection(6);
+checkThis(' /\\)/ ');
+
+status = inSection(7);
+checkThis(' /(abc)def\\(g/ ');
+
+status = inSection(8);
+checkThis(' /(abc\\)def)g/ ');
+
+status = inSection(9);
+checkThis(' /(abc(\\))def)g/ ');
+
+status = inSection(10);
+checkThis(' /(abc([x\\)yz]+)def)g/ ');
+
+
+
+/*
+ * Unescaped, unbalanced left brackets should be a SyntaxError
+ */
+status = inSection(11);
+testThis(' /[/ ');
+
+status = inSection(12);
+testThis(' /[abc\\]def[g/ ');
+
+
+/*
+ * We permit unescaped, unbalanced right brackets, as does Perl.
+ * No error should result, even though this is not ECMA-compliant.
+ * Note we use checkThis() instead of testThis().
+ */
+status = inSection(13);
+checkThis(' /]/ ');
+
+status = inSection(14);
+checkThis(' /\\[abc]def]g/ ');
+
+
+/*
+ * These regexp patterns are correct and should not generate
+ * any errors. Note we use checkThis() instead of testThis().
+ */
+status = inSection(15);
+checkThis(' /\\[/ ');
+
+status = inSection(16);
+checkThis(' /\\]/ ');
+
+status = inSection(17);
+checkThis(' /[abc]def\\[g/ ');
+
+status = inSection(18);
+checkThis(' /[abc\\]def]g/ ');
+
+status = inSection(19);
+checkThis(' /(abc[\\]]def)g/ ');
+
+status = inSection(20);
+checkThis(' /[abc(x\\]yz+)def]g/ ');
+
+
+
+/*
+ * Run some tests for unbalanced braces. We again follow Perl, and
+ * thus permit unescaped unbalanced braces - both left and right,
+ * even though this is not ECMA-compliant.
+ *
+ * Note we use checkThis() instead of testThis().
+ */
+status = inSection(21);
+checkThis(' /abc{def/ ');
+
+status = inSection(22);
+checkThis(' /abc}def/ ');
+
+status = inSection(23);
+checkThis(' /a{2}bc{def/ ');
+
+status = inSection(24);
+checkThis(' /a}b{3}c}def/ ');
+
+
+/*
+ * These regexp patterns are correct and should not generate
+ * any errors. Note we use checkThis() instead of testThis().
+ */
+status = inSection(25);
+checkThis(' /abc\\{def/ ');
+
+status = inSection(26);
+checkThis(' /abc\\}def/ ');
+
+status = inSection(27);
+checkThis(' /a{2}bc\\{def/ ');
+
+status = inSection(28);
+checkThis(' /a\\}b{3}c\\}def/ ');
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+
+/*
+ * Invalid syntax should generate a SyntaxError
+ */
+function testThis(sInvalidSyntax)
+{
+ expect = TEST_PASSED;
+ actual = TEST_FAILED_BADLY;
+
+ try
+ {
+ eval(sInvalidSyntax);
+ }
+ catch(e)
+ {
+ if (e instanceof SyntaxError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+/*
+ * Valid syntax shouldn't generate any errors
+ */
+function checkThis(sValidSyntax)
+{
+ expect = CHECK_PASSED;
+ actual = CHECK_PASSED;
+
+ try
+ {
+ eval(sValidSyntax);
+ }
+ catch(e)
+ {
+ actual = CHECK_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223535.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223535.js
new file mode 100644
index 0000000000..82305502fd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-223535.js
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * zack-weg@gmx.de, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 24 October 2003
+ * SUMMARY: Testing regexps with empty alternatives
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=223535
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-223535.js';
+var i = 0;
+var BUGNUMBER = 223535;
+var summary = 'Testing regexps with empty alternatives';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+string = 'a';
+status = inSection(1);
+pattern = /a|/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(2);
+pattern = /|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(3);
+pattern = /|/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('');
+addThis();
+
+status = inSection(4);
+pattern = /(a|)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(5);
+pattern = /(a||)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(6);
+pattern = /(|a)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('', '');
+addThis();
+
+status = inSection(7);
+pattern = /(|a|)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('', '');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-224676.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-224676.js
new file mode 100644
index 0000000000..88e89ee609
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-224676.js
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * zack-weg@gmx.de, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 04 November 2003
+ * SUMMARY: Testing regexps with various disjunction + character class patterns
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=224676
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-224676.js';
+var i = 0;
+var BUGNUMBER = 224676;
+var summary = 'Regexps with various disjunction + character class patterns';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+string = 'ZZZxZZZ';
+status = inSection(1);
+pattern = /[x]|x/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('x');
+addThis();
+
+status = inSection(2);
+pattern = /x|[x]/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('x');
+addThis();
+
+
+string = 'ZZZxbZZZ';
+status = inSection(3);
+pattern = /a|[x]b/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(4);
+pattern = /[x]b|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(5);
+pattern = /([x]b|a)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb', 'xb');
+addThis();
+
+status = inSection(6);
+pattern = /([x]b|a)|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb', 'xb');
+addThis();
+
+status = inSection(7);
+pattern = /^[x]b|a/;
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+string = 'xb';
+status = inSection(8);
+pattern = /^[x]b|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+
+string = 'ZZZxbZZZ';
+status = inSection(9);
+pattern = /([x]b)|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb', 'xb');
+addThis();
+
+status = inSection(10);
+pattern = /()[x]b|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb', '');
+addThis();
+
+status = inSection(11);
+pattern = /x[b]|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(12);
+pattern = /[x]{1}b|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(13);
+pattern = /[x]b|a|a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(14);
+pattern = /[x]b|[a]/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(15);
+pattern = /[x]b|a+/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(16);
+pattern = /[x]b|a{1}/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(17);
+pattern = /[x]b|(a)/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb', undefined);
+addThis();
+
+status = inSection(18);
+pattern = /[x]b|()a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb', undefined);
+addThis();
+
+status = inSection(19);
+pattern = /[x]b|^a/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(20);
+pattern = /a|[^b]b/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+status = inSection(21);
+pattern = /a|[^b]{1}b/;
+actualmatch = string.match(pattern);
+expectedmatch = Array('xb');
+addThis();
+
+
+string = 'hallo\";'
+ status = inSection(22);
+pattern = /^((\\[^\x00-\x1f]|[^\x00-\x1f"\\])*)"/;
+ actualmatch = string.match(pattern);
+ expectedmatch = Array('hallo"', 'hallo', 'o');
+ addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+ test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+ function addThis()
+ {
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+ }
+
+
+ function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225289.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225289.js
new file mode 100644
index 0000000000..6e05d12ead
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225289.js
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * PhilSchwartau@aol.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 10 November 2003
+ * SUMMARY: Testing regexps with complementary alternatives
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=225289
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-225289.js';
+var i = 0;
+var BUGNUMBER = 225289;
+var summary = 'Testing regexps with complementary alternatives';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+// this pattern should match any string!
+pattern = /a|[^a]/;
+
+status = inSection(1);
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(2);
+string = '';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(3);
+string = '()';
+actualmatch = string.match(pattern);
+expectedmatch = Array('(');
+addThis();
+
+
+pattern = /(a|[^a])/;
+
+status = inSection(4);
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a');
+addThis();
+
+status = inSection(5);
+string = '';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(6);
+string = '()';
+actualmatch = string.match(pattern);
+expectedmatch = Array('(', '(');
+addThis();
+
+
+pattern = /(a)|([^a])/;
+
+status = inSection(7);
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', 'a', undefined);
+addThis();
+
+status = inSection(8);
+string = '';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(9);
+string = '()';
+actualmatch = string.match(pattern);
+expectedmatch = Array('(', undefined, '(');
+addThis();
+
+
+// note this pattern has one non-capturing parens
+pattern = /((?:a|[^a])*)/g;
+
+status = inSection(10);
+string = 'a';
+actualmatch = string.match(pattern);
+expectedmatch = Array('a', ''); // see bug 225289 comment 6
+addThis();
+
+status = inSection(11);
+string = '';
+actualmatch = string.match(pattern);
+expectedmatch = Array(''); // see bug 225289 comment 9
+addThis();
+
+status = inSection(12);
+string = '()';
+actualmatch = string.match(pattern);
+expectedmatch = Array('()', ''); // see bug 225289 comment 6
+addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225343.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225343.js
new file mode 100644
index 0000000000..25e248adaa
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-225343.js
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * PhilSchwartau@aol.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 11 November 2003
+ * SUMMARY: Testing regexp character classes and the case-insensitive flag
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=225343
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-225343.js';
+var i = 0;
+var BUGNUMBER = 225343;
+var summary = 'Testing regexp character classes and the case-insensitive flag';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+string = 'a';
+pattern = /[A]/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array('a');
+addThis();
+
+status = inSection(2);
+string = 'A';
+pattern = /[a]/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array('A');
+addThis();
+
+status = inSection(3);
+string = '123abc123';
+pattern = /([A-Z]+)/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'abc');
+addThis();
+
+status = inSection(4);
+string = '123abc123';
+pattern = /([A-Z])+/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc', 'c');
+addThis();
+
+status = inSection(5);
+string = 'abc@test.com';
+pattern = /^[-!#$%&\'*+\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i;
+actualmatch = string.match(pattern);
+expectedmatch = Array('abc@test.com', 'test.', 'm');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-24712.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-24712.js
new file mode 100644
index 0000000000..c94472195f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-24712.js
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-24712.js';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printBugNumber (24712);
+
+ var re = /([\S]+([ \t]+[\S]+)*)[ \t]*=[ \t]*[\S]+/;
+ var result = re.exec("Course_Creator = Test") + '';
+
+ reportCompare('Course_Creator = Test,Course_Creator,', result, 'exec() returned null');
+
+ exitFunc ("test");
+
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-285219.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-285219.js
new file mode 100755
index 0000000000..9d462359fa
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-285219.js
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-285219.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 285219;
+var summary = 'Do not crash on RangeError: reserved slot out of range';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var o = {hi: 'there'};
+eval("var r = /re(1)(2)(3)/g", o);
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-28686.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-28686.js
new file mode 100644
index 0000000000..b3e355fa1c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-28686.js
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-28686.js';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printBugNumber (28686);
+
+ var str = 'foo "bar" baz';
+ reportCompare ('foo \\"bar\\" baz', str.replace(/([\'\"])/g, "\\$1"),
+ "str.replace failed.");
+
+ exitFunc ("test");
+
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-289669.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-289669.js
new file mode 100755
index 0000000000..2e3d044b74
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-289669.js
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bug Tracker
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-289669.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 289669;
+var summary = 'O(N^2) behavior on String.replace(/RegExp/, ...)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+var data = {X: [], Y:[]};
+
+function replace(str) {
+ var stra=str.replace(new RegExp('<a>','g'),"<span id=\"neurodna\" style=\"background-color:blue\"/>");
+ stra=stra.replace(new RegExp('</a>','g'),"</span><br>");
+}
+
+function runTest() {
+ for (var j = 1000; j <= 10000; j += 1000)
+ {
+ neurodna(j);
+ }
+}
+
+function neurodna(limit) {
+ var prepare="<go>";
+ for(var i=0;i<limit;i++) {
+ prepare += "<a>neurodna</a>";
+ }
+ prepare+="</go>";
+ var da1=new Date();
+ replace(prepare);
+ var da2=new Date();
+ data.X.push(limit);
+ data.Y.push(da2-da1);
+ gc();
+}
+
+runTest();
+
+var order = BigO(data);
+
+var msg = '';
+for (var p = 0; p < data.X.length; p++)
+{
+ msg += '(' + data.X[p] + ', ' + data.Y[p] + '); ';
+}
+printStatus(msg);
+printStatus('Order: ' + order);
+reportCompare(true, order < 2, summary + ' BigO ' + order + ' < 2');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-307456.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-307456.js
new file mode 100755
index 0000000000..dd2f540f6c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-307456.js
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Lupin.wp@gmail.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-307456.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 307456;
+var summary = 'Do not Freeze with RegExp';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var data='<!---<->---->\n\n<><>--!!!<><><><><><>\n!!<>\n\n<>\n<><><><>!\n\n\n\n--\n--\n--\n\n--\n--\n\n\n-------\n--\n--\n\n\n--\n\n\n\n----\n\n\n\n--\n\n\n-\n\n\n-\n\n-\n\n-\n\n-\n-\n\n----\n\n-\n\n\n\n\n-\n\n\n\n\n\n\n\n\n-----\n\n\n-\n------\n-------\n\n----\n\n\n\n!\n\n\n\n\n\n\n\n!!!\n\n\n--------\n\n\n\n-\n\n\n-\n--\n\n----\n\n\n\n\n\n-\n\n\n----\n\n\n\n\n\n--------\n!\n\n\n\n\n-\n---\n--\n\n----\n\n-\n\n-\n\n-\n\n\n\n-----\n\n\n\n-\n\n\n-\n\n\n--\n-\n\n\n-\n\n----\n\n---\n\n---\n\n----\n\n\n\n---\n\n-++\n\n-------<>\n\n-!\n\n--\n\n----!-\n\n\n\n';
+
+printStatus(data);
+data=data.replace(RegExp('<!--(\\n[^\\n]|[^-]|-[^-]|--[^>])*-->', 'g'), '');
+printStatus(data);
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-309840.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-309840.js
new file mode 100755
index 0000000000..8680b7bcfd
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-309840.js
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Phil Schwartau <pschwartau@meer.net>
+ * Bob Clary <bob@bclary.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-309840.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 309840;
+var summary = 'Treat / in a literal regexp class as valid';
+var actual = 'No error';
+var expect = 'No error';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+try
+{
+ var re = eval('/[/]/');
+}
+catch(e)
+{
+ actual = e.toString();
+}
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-311414.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-311414.js
new file mode 100755
index 0000000000..a24a07bb2b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-311414.js
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): timeless
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-311414.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 311414;
+var summary = 'RegExp captured tail match should be O(N)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+function q1(n) {
+ var c = [];
+ c[n] = 1;
+ c = c.join(" ");
+ var d = Date.now();
+ var e = c.match(/(.*)foo$/);
+ var f = Date.now();
+ return (f - d);
+}
+
+function q2(n) {
+ var c = [];
+ c[n] = 1;
+ c = c.join(" ");
+ var d = Date.now();
+ var e = /foo$/.test(c) && c.match(/(.*)foo$/);
+ var f = Date.now();
+ return (f - d);
+}
+
+var data1 = {X:[], Y:[]};
+var data2 = {X:[], Y:[]};
+
+for (var x = 500; x < 5000; x += 500)
+{
+ var y1 = q1(x);
+ var y2 = q2(x);
+ data1.X.push(x);
+ data1.Y.push(y1);
+ data2.X.push(x);
+ data2.Y.push(y2);
+ gc();
+}
+
+var order1 = BigO(data1);
+var order2 = BigO(data2);
+
+var msg = '';
+for (var p = 0; p < data1.X.length; p++)
+{
+ msg += '(' + data1.X[p] + ', ' + data1.Y[p] + '); ';
+}
+printStatus(msg);
+printStatus('Order: ' + order1);
+reportCompare(true, order1 < 2 , summary + ' BigO ' + order1 + ' < 2');
+
+msg = '';
+for (var p = 0; p < data2.X.length; p++)
+{
+ msg += '(' + data2.X[p] + ', ' + data2.Y[p] + '); ';
+}
+printStatus(msg);
+printStatus('Order: ' + order2);
+reportCompare(true, order2 < 2 , summary + ' BigO ' + order2 + ' < 2');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-312351.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-312351.js
new file mode 100755
index 0000000000..a9b00d317c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-312351.js
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): drimbk@yahoo.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-312351.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 312351;
+var summary = 'Do not crash on RegExp(null)';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var x = RegExp(null);
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-31316.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-31316.js
new file mode 100644
index 0000000000..594913f07c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-31316.js
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 01 May 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 31316:
+ * "Rhino: Regexp matches return garbage"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=31316
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-31316.js';
+var i = 0;
+var BUGNUMBER = 31316;
+var summary = 'Regression test for Bugzilla bug 31316';
+var cnEmptyString = '';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/;
+string = '<p>Some<br />test</p>';
+actualmatch = string.match(pattern);
+expectedmatch = Array('<p>', undefined, 'p');
+addThis();
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-330684.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-330684.js
new file mode 100755
index 0000000000..b097fbc3d7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-330684.js
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Shaohua Wen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-330684.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 330684;
+var summary = 'Do not hang on RegExp';
+var actual = 'Do not hang on RegExp';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var re = /^(?:(?:%[0-9A-Fa-f]{2})*[!\$&'\*-;=\?-Z_a-z]*)+$/;
+var url = "http://tw.yimg.com/a/tw/wenchuan/cam_240x400_381615_030806_2.swf?clickTAG=javascript:VRECopenWindow(1)";
+
+printStatus(re.test(url));
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-334158.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-334158.js
new file mode 100755
index 0000000000..41ebf0a731
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-334158.js
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Andreas
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-334158.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 334158;
+var summary = 'Parse error in control letter escapes (RegExp)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = true;
+actual = /\ca/.test( "\x01" );
+reportCompare(expect, actual, summary + ':/\ca/.test( "\x01" )');
+
+expect = false
+ actual = /\ca/.test( "\\ca" );
+reportCompare(expect, actual, summary + ': /\ca/.test( "\\ca" )');
+
+expect = false
+ actual = /\c[a/]/.test( "\x1ba/]" );
+reportCompare(expect, actual, summary + ': /\c[a/]/.test( "\x1ba/]" )');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-346090.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-346090.js
new file mode 100755
index 0000000000..dfd53a9922
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-346090.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Priit Laes
+ * Brian Crowder
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-346090.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 346090;
+var summary = 'Do not crash with this regexp';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var r = /%((h[^l]+)|(l[^h]+)){0,2}?a/g;
+ r.exec('%lld %d');
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-367888.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-367888.js
new file mode 100755
index 0000000000..923c1e5ab3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-367888.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-367888.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 367888;
+var summary = 'RegExp /(|)??x/g.exec("y") barfs';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = null;
+ actual = /(|)??x/g.exec("y");
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375642.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375642.js
new file mode 100755
index 0000000000..236eb00d28
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375642.js
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-375642.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 375642;
+var summary = 'RegExp /(?:a??)+?/.exec("")';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ /(?:a??)+?/.exec("")
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375711.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375711.js
new file mode 100755
index 0000000000..6e7339f9e9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375711.js
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-375711.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 375711;
+var summary = 'Do not assert with /[Q-b]/i.exec("")';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var s;
+
+ // see bug 416933
+ print('see bug 416933 for changed behavior on Gecko 1.9');
+
+ try
+ {
+ s = '/[Q-b]/.exec("")';
+ expect = 'No Error';
+ print(s + ' expect ' + expect);
+ eval(s);
+ actual = 'No Error';
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + s);
+
+ try
+ {
+ s ='/[Q-b]/i.exec("")';
+ expect = 'No Error';
+ print(s + ' expect ' + expect);
+ eval(s);
+ actual = 'No Error';
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + s);
+
+ try
+ {
+ s = '/[q-b]/.exec("")';
+ expect = 'SyntaxError: invalid range in character class';
+ print(s + ' expect ' + expect);
+ eval(s);
+ actual = 'No Error';
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + s);
+
+ try
+ {
+ s ='/[q-b]/i.exec("")';
+ expect = 'SyntaxError: invalid range in character class';
+ print(s + ' expect ' + expect);
+ eval(s);
+ actual = 'No Error';
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + ': ' + s);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-01-n.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-01-n.js
new file mode 100755
index 0000000000..437dcbd5c5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-01-n.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-375715-01-n.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 375715;
+var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)';
+var actual = '';
+var expect = '';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ // note that the assertion does not fire if the regexp is
+ // evald or used in new RegExp, so this test must be an -n
+ // with uncaught SyntaxError.
+
+ /[\Wb-G]/.exec("");
+ reportCompare(expect, actual, summary + ' /[\Wb-G]/.exec("")');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-02.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-02.js
new file mode 100755
index 0000000000..3cd858e845
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-02.js
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-375715-02.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 375715;
+var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ /[\s-:]/;
+ reportCompare(expect, actual, summary + '/[\s-:]/');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-03.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-03.js
new file mode 100755
index 0000000000..ffc5c5a4cc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-03.js
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-375715-03.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 375715;
+var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ /[_-t]/i.exec("");
+ reportCompare(expect, actual, summary + '/[_-t]/i.exec("")');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-04.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-04.js
new file mode 100755
index 0000000000..0c78a372ee
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-375715-04.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-375715-04.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 375715;
+var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ expect = 'SyntaxError: invalid range in character class';
+ (new RegExp("[\xDF-\xC7]]", "i")).exec("");
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary + '(new RegExp("[\xDF-\xC7]]", "i")).exec("")');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57572.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57572.js
new file mode 100644
index 0000000000..c7abd410bf
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57572.js
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 28 December 2000
+ *
+ * SUMMARY: Testing regular expressions containing the ? character.
+ * Arose from Bugzilla bug 57572: "RegExp with ? matches incorrectly"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=57572
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-57572.js';
+var i = 0;
+var BUGNUMBER = 57572;
+var summary = 'Testing regular expressions containing "?"';
+var cnEmptyString = ''; var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+status = inSection(1);
+pattern = /(\S+)?(.*)/;
+string = 'Test this';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Test', ' this'); //single space in front of 'this'
+addThis();
+
+status = inSection(2);
+pattern = /(\S+)? ?(.*)/; //single space between the ? characters
+string= 'Test this';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Test', 'this'); //NO space in front of 'this'
+addThis();
+
+status = inSection(3);
+pattern = /(\S+)?(.*)/;
+string = 'Stupid phrase, with six - (short) words';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Stupid', ' phrase, with six - (short) words'); //single space in front of 'phrase'
+addThis();
+
+status = inSection(4);
+pattern = /(\S+)? ?(.*)/; //single space between the ? characters
+string = 'Stupid phrase, with six - (short) words';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Stupid', 'phrase, with six - (short) words'); //NO space in front of 'phrase'
+addThis();
+
+
+// let's add an extra back-reference this time - three instead of two -
+status = inSection(5);
+pattern = /(\S+)?( ?)(.*)/; //single space before second ? character
+string = 'Stupid phrase, with six - (short) words';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'Stupid', cnSingleSpace, 'phrase, with six - (short) words');
+addThis();
+
+status = inSection(6);
+pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character
+string = 'AAABBB';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'AAABB', cnEmptyString, 'B');
+addThis();
+
+status = inSection(7);
+pattern = /(\S+)?(!?)(.*)/;
+string = 'WOW !!! !!!';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'WOW', cnEmptyString, ' !!! !!!');
+addThis();
+
+status = inSection(8);
+pattern = /(.+)?(!?)(!+)/;
+string = 'WOW !!! !!!';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'WOW !!! !!', cnEmptyString, '!');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57631.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57631.js
new file mode 100644
index 0000000000..dc222bfc0f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-57631.js
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com, zack-weg@gmx.de
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 26 November 2000
+ *
+ *
+ * SUMMARY: This test arose from Bugzilla bug 57631:
+ * "RegExp with invalid pattern or invalid flag causes segfault"
+ *
+ * Either error should throw an exception of type SyntaxError,
+ * and we check to see that it does...
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-57631.js';
+var BUGNUMBER = '57631';
+var summary = 'Testing new RegExp(pattern,flag) with illegal pattern or flag';
+var statprefix = 'Testing for error creating illegal RegExp object on pattern ';
+var statsuffix = 'and flag ';
+var cnSUCCESS = 'SyntaxError';
+var cnFAILURE = 'not a SyntaxError';
+var singlequote = "'";
+var i = -1; var j = -1; var s = ''; var f = '';
+var obj = {};
+var status = ''; var actual = ''; var expect = ''; var msg = '';
+var legalpatterns = new Array(); var illegalpatterns = new Array();
+var legalflags = new Array(); var illegalflags = new Array();
+
+
+// valid regular expressions to try -
+legalpatterns[0] = '';
+legalpatterns[1] = 'abc';
+legalpatterns[2] = '(.*)(3-1)\s\w';
+legalpatterns[3] = '(.*)(...)\\s\\w';
+legalpatterns[4] = '[^A-Za-z0-9_]';
+legalpatterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)';
+
+// invalid regular expressions to try -
+illegalpatterns[0] = '(?)';
+illegalpatterns[1] = '(a';
+illegalpatterns[2] = '( ]';
+//illegalpatterns[3] = '\d{1,s}';
+
+// valid flags to try -
+legalflags[0] = 'i';
+legalflags[1] = 'g';
+legalflags[2] = 'm';
+legalflags[3] = undefined;
+
+// invalid flags to try -
+illegalflags[0] = 'a';
+illegalflags[1] = 123;
+illegalflags[2] = new RegExp();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ testIllegalRegExps(legalpatterns, illegalflags);
+ testIllegalRegExps(illegalpatterns, legalflags);
+ testIllegalRegExps(illegalpatterns, illegalflags);
+
+ exitFunc ('test');
+}
+
+
+// This function will only be called where all the patterns are illegal, or all the flags
+function testIllegalRegExps(patterns, flags)
+{
+ for (i in patterns)
+ {
+ s = patterns[i];
+
+ for (j in flags)
+ {
+ f = flags[j];
+ status = getStatus(s, f);
+ actual = cnFAILURE;
+ expect = cnSUCCESS;
+
+ try
+ {
+ // This should cause an exception if either s or f is illegal -
+ eval('obj = new RegExp(s, f);');
+ }
+ catch(e)
+ {
+ // We expect to get a SyntaxError - test for this:
+ if (e instanceof SyntaxError)
+ actual = cnSUCCESS;
+ }
+
+ reportCompare(expect, actual, status);
+ }
+ }
+}
+
+
+function getStatus(regexp, flag)
+{
+ return (statprefix + quote(regexp) + statsuffix + quote(flag));
+}
+
+
+function quote(text)
+{
+ return (singlequote + text + singlequote);
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-67773.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-67773.js
new file mode 100644
index 0000000000..4ee0d52854
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-67773.js
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 06 February 2001
+ *
+ * SUMMARY: Arose from Bugzilla bug 67773:
+ * "Regular subexpressions followed by + failing to run to completion"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=67773
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-67773.js';
+var i = 0;
+var BUGNUMBER = 67773;
+var summary = 'Testing regular subexpressions followed by ? or +\n';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character
+status = inSection(1);
+string = 'AAABBB AAABBB '; //single space at middle and at end -
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(2);
+string = 'AAABBB BBB'; //single space in the middle
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'AAABBB', cnSingleSpace, 'BBB');
+addThis();
+
+status = inSection(3);
+string = 'AAABBB AAABBB'; //single space in the middle
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+pattern = /^(A+B)+$/;
+status = inSection(4);
+string = 'AABAAB';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'AAB');
+addThis();
+
+status = inSection(5);
+string = 'ABAABAAAAAAB';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'AAAAAAB');
+addThis();
+
+status = inSection(6);
+string = 'ABAABAABAB';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'AB');
+addThis();
+
+status = inSection(7);
+string = 'ABAABAABABB';
+actualmatch = string.match(pattern);
+expectedmatch = null; // because string doesn't match at end
+addThis();
+
+
+pattern = /^(A+1)+$/;
+status = inSection(8);
+string = 'AA1AA1';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'AA1');
+addThis();
+
+
+pattern = /^(\w+\-)+$/;
+status = inSection(9);
+string = '';
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(10);
+string = 'bla-';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, string);
+addThis();
+
+status = inSection(11);
+string = 'bla-bla'; // hyphen missing at end -
+actualmatch = string.match(pattern);
+expectedmatch = null; //because string doesn't match at end
+addThis();
+
+status = inSection(12);
+string = 'bla-bla-';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'bla-');
+addThis();
+
+
+pattern = /^(\S+)+(A+)$/;
+status = inSection(13);
+string = 'asdldflkjAAA';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'asdldflkjAA', 'A');
+addThis();
+
+status = inSection(14);
+string = 'asdldflkj AAA'; // space in middle
+actualmatch = string.match(pattern);
+expectedmatch = null; //because of the space
+addThis();
+
+
+pattern = /^(\S+)+(\d+)$/;
+status = inSection(15);
+string = 'asdldflkj122211';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'asdldflkj12221', '1');
+addThis();
+
+status = inSection(16);
+string = 'asdldflkj1111111aaa1';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, 'asdldflkj1111111aaa', '1');
+addThis();
+
+
+/*
+ * This one comes from Stephen Ostermiller.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989
+ */
+pattern = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)+$/;
+status = inSection(17);
+string = 'some.host.tld';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string, '.tld', '.');
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-72964.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-72964.js
new file mode 100644
index 0000000000..67a41e505c
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-72964.js
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 2001-07-17
+ *
+ * SUMMARY: Regression test for Bugzilla bug 72964:
+ * "String method for pattern matching failed for Chinese Simplified (GB2312)"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=72964
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-72964.js';
+var i = 0;
+var BUGNUMBER = 72964;
+var summary = 'Testing regular expressions containing non-Latin1 characters';
+var cnSingleSpace = ' ';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /[\S]+/;
+// 4 low Unicode chars = Latin1; whole string should match
+status = inSection(1);
+string = '\u00BF\u00CD\u00BB\u00A7';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+// Now put a space in the middle; first half of string should match
+status = inSection(2);
+string = '\u00BF\u00CD \u00BB\u00A7';
+actualmatch = string.match(pattern);
+expectedmatch = Array('\u00BF\u00CD');
+addThis();
+
+
+// 4 high Unicode chars = non-Latin1; whole string should match
+status = inSection(3);
+string = '\u4e00\uac00\u4e03\u4e00';
+actualmatch = string.match(pattern);
+expectedmatch = Array(string);
+addThis();
+
+// Now put a space in the middle; first half of string should match
+status = inSection(4);
+string = '\u4e00\uac00 \u4e03\u4e00';
+actualmatch = string.match(pattern);
+expectedmatch = Array('\u4e00\uac00');
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-76683.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-76683.js
new file mode 100644
index 0000000000..8792e379ca
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-76683.js
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 01 May 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 76683 on Rhino:
+ * "RegExp regression (NullPointerException)"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=76683
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-76683.js';
+var i = 0;
+var BUGNUMBER = 76683;
+var summary = 'Regression test for Bugzilla bug 76683';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+/*
+ * Rhino (2001-04-19) crashed on the 3rd regular expression below.
+ * It didn't matter what the string was. No problem in SpiderMonkey -
+ */
+string = 'abc';
+status = inSection(1);
+pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+status = inSection(2);
+pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/;
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+// This was the one causing a Rhino crash -
+status = inSection(3);
+pattern = /(<!--([^-]|-[^-]|--[^>])*-->)|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/;
+actualmatch = string.match(pattern);
+expectedmatch = null;
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-78156.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-78156.js
new file mode 100644
index 0000000000..dd42ce060b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-78156.js
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 06 February 2001
+ *
+ * SUMMARY: Arose from Bugzilla bug 78156:
+ * "m flag of regular expression does not work with $"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=78156
+ *
+ * The m flag means a regular expression should search strings
+ * across multiple lines, i.e. across '\n', '\r'.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-78156.js';
+var i = 0;
+var BUGNUMBER = 78156;
+var summary = 'Testing regular expressions with ^, $, and the m flag -';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+/*
+ * All patterns have an m flag; all strings are multiline.
+ * Looking for digit characters at beginning/end of lines.
+ */
+
+string = 'aaa\n789\r\nccc\r\n345';
+status = inSection(1);
+pattern = /^\d/gm;
+actualmatch = string.match(pattern);
+expectedmatch = ['7','3'];
+addThis();
+
+status = inSection(2);
+pattern = /\d$/gm;
+actualmatch = string.match(pattern);
+expectedmatch = ['9','5'];
+addThis();
+
+string = 'aaa\n789\r\nccc\r\nddd';
+status = inSection(3);
+pattern = /^\d/gm;
+actualmatch = string.match(pattern);
+expectedmatch = ['7'];
+addThis();
+
+status = inSection(4);
+pattern = /\d$/gm;
+actualmatch = string.match(pattern);
+expectedmatch = ['9'];
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js
new file mode 100644
index 0000000000..7b811abc31
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * rogerl@netscape.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 14 Feb 2002
+ * SUMMARY: Performance: Regexp performance degraded from 4.7
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=85721
+ *
+ * Adjust this testcase if necessary. The FAST constant defines
+ * an upper bound in milliseconds for any execution to take.
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-85721.js';
+var BUGNUMBER = 85721;
+var summary = 'Performance: execution of regular expression';
+var FAST = 100; // execution should be 100 ms or less to pass the test
+var MSG_FAST = 'Execution took less than ' + FAST + ' ms';
+var MSG_SLOW = 'Execution took ';
+var MSG_MS = ' ms';
+var str = '';
+var re = '';
+var status = '';
+var actual = '';
+var expect= '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+
+function elapsedTime(startTime)
+{
+ return new Date() - startTime;
+}
+
+
+function isThisFast(ms)
+{
+ if (ms <= FAST)
+ return MSG_FAST;
+ return MSG_SLOW + ms + MSG_MS;
+}
+
+
+
+/*
+ * The first regexp. We'll test for performance (Section 1) and accuracy (Section 2).
+ */
+str='<sql:connection id="conn1"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>';
+re = /<sql:connection id="([^\r\n]*?)">\s*<sql:url>\s*([^\r\n]*?)\s*<\/sql:url>\s*<sql:driver>\s*([^\r\n]*?)\s*<\/sql:driver>\s*(\s*<sql:userId>\s*([^\r\n]*?)\s*<\/sql:userId>\s*)?\s*(\s*<sql:password>\s*([^\r\n]*?)\s*<\/sql:password>\s*)?\s*<\/sql:connection>/;
+expect = Array("<sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>","conn1","www.m.com","drive.class","<sql:userId>foo</sql:userId> ","foo","<sql:password>goo</sql:password> ","goo");
+
+/*
+ * Check performance -
+ */
+status = inSection(1);
+var start = new Date();
+var result = re.exec(str);
+actual = elapsedTime(start);
+reportCompare(isThisFast(FAST), isThisFast(actual), status);
+
+/*
+ * Check accuracy -
+ */
+status = inSection(2);
+testRegExp([status], [re], [str], [result], [expect]);
+
+
+
+/*
+ * The second regexp (HUGE!). We'll test for performance (Section 3) and accuracy (Section 4).
+ * It comes from the O'Reilly book "Mastering Regular Expressions" by Jeffrey Friedl, Appendix B
+ */
+
+//# Some things for avoiding backslashitis later on.
+$esc = '\\\\';
+$Period = '\.';
+$space = '\x20'; $tab = '\t';
+$OpenBR = '\\['; $CloseBR = '\\]';
+$OpenParen = '\\('; $CloseParen = '\\)';
+$NonASCII = '\x80-\xff'; $ctrl = '\0-\x1f';
+$CRlist = '\n\x0d'; //# note: this should really be only \015.
+// Items 19, 20, 21
+$qtext = '[^' + $esc + $NonASCII + $CRlist + '\"]'; // # for within "..."
+$dtext = '[^' + $esc + $NonASCII + $CRlist + $OpenBR + $CloseBR + ']'; // # for within [...]
+$quoted_pair = $esc + '[^' + $NonASCII + ']'; // # an escaped character
+
+//##############################################################################
+//# Items 22 and 23, comment.
+//# Impossible to do properly with a regex, I make do by allowing at most one level of nesting.
+$ctext = '[^' + $esc + $NonASCII + $CRlist + '()]';
+
+//# $Cnested matches one non-nested comment.
+//# It is unrolled, with normal of $ctext, special of $quoted_pair.
+$Cnested =
+ $OpenParen + // # (
+ $ctext + '*' + // # normal*
+ '(?:' + $quoted_pair + $ctext + '*)*' + // # (special normal*)*
+ $CloseParen; // # )
+
+
+//# $comment allows one level of nested parentheses
+//# It is unrolled, with normal of $ctext, special of ($quoted_pair|$Cnested)
+$comment =
+ $OpenParen + // # (
+ $ctext + '*' + // # normal*
+ '(?:' + // # (
+ '(?:' + $quoted_pair + '|' + $Cnested + ')' + // # special
+ $ctext + '*' + // # normal*
+ ')*' + // # )*
+ $CloseParen; // # )
+
+
+//##############################################################################
+//# $X is optional whitespace/comments.
+$X =
+ '[' + $space + $tab + ']*' + // # Nab whitespace.
+ '(?:' + $comment + '[' + $space + $tab + ']*)*'; // # If comment found, allow more spaces.
+
+
+//# Item 10: atom
+$atom_char = '[^(' + $space + '<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $ctrl + $NonASCII + ']';
+$atom =
+ $atom_char + '+' + // # some number of atom characters...
+ '(?!' + $atom_char + ')'; // # ..not followed by something that could be part of an atom
+
+// # Item 11: doublequoted string, unrolled.
+$quoted_str =
+ '\"' + // # "
+ $qtext + '*' + // # normal
+ '(?:' + $quoted_pair + $qtext + '*)*' + // # ( special normal* )*
+ '\"'; // # "
+
+//# Item 7: word is an atom or quoted string
+$word =
+ '(?:' +
+ $atom + // # Atom
+ '|' + // # or
+ $quoted_str + // # Quoted string
+ ')'
+
+//# Item 12: domain-ref is just an atom
+ $domain_ref = $atom;
+
+//# Item 13: domain-literal is like a quoted string, but [...] instead of "..."
+$domain_lit =
+ $OpenBR + // # [
+ '(?:' + $dtext + '|' + $quoted_pair + ')*' + // # stuff
+ $CloseBR; // # ]
+
+// # Item 9: sub-domain is a domain-ref or domain-literal
+$sub_domain =
+ '(?:' +
+ $domain_ref +
+ '|' +
+ $domain_lit +
+ ')' +
+ $X; // # optional trailing comments
+
+// # Item 6: domain is a list of subdomains separated by dots.
+$domain =
+ $sub_domain +
+ '(?:' +
+ $Period + $X + $sub_domain +
+ ')*';
+
+//# Item 8: a route. A bunch of "@ $domain" separated by commas, followed by a colon.
+$route =
+ '\@' + $X + $domain +
+ '(?:,' + $X + '\@' + $X + $domain + ')*' + // # additional domains
+ ':' +
+ $X; // # optional trailing comments
+
+//# Item 6: local-part is a bunch of $word separated by periods
+$local_part =
+ $word + $X
+ '(?:' +
+ $Period + $X + $word + $X + // # additional words
+ ')*';
+
+// # Item 2: addr-spec is local@domain
+$addr_spec =
+ $local_part + '\@' + $X + $domain;
+
+//# Item 4: route-addr is <route? addr-spec>
+$route_addr =
+ '<' + $X + // # <
+ '(?:' + $route + ')?' + // # optional route
+ $addr_spec + // # address spec
+ '>'; // # >
+
+//# Item 3: phrase........
+$phrase_ctrl = '\0-\x08\x0a-\x1f'; // # like ctrl, but without tab
+
+//# Like atom-char, but without listing space, and uses phrase_ctrl.
+//# Since the class is negated, this matches the same as atom-char plus space and tab
+$phrase_char =
+ '[^()<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $NonASCII + $phrase_ctrl + ']';
+
+// # We've worked it so that $word, $comment, and $quoted_str to not consume trailing $X
+// # because we take care of it manually.
+$phrase =
+ $word + // # leading word
+ $phrase_char + '*' + // # "normal" atoms and/or spaces
+ '(?:' +
+ '(?:' + $comment + '|' + $quoted_str + ')' + // # "special" comment or quoted string
+ $phrase_char + '*' + // # more "normal"
+ ')*';
+
+// ## Item #1: mailbox is an addr_spec or a phrase/route_addr
+$mailbox =
+ $X + // # optional leading comment
+ '(?:' +
+ $phrase + $route_addr + // # name and address
+ '|' + // # or
+ $addr_spec + // # address
+ ')';
+
+
+//###########################################################################
+
+
+re = new RegExp($mailbox, "g");
+str = 'Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>';
+expect = Array('Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>');
+
+/*
+ * Check performance -
+ */
+status = inSection(3);
+var start = new Date();
+var result = re.exec(str);
+actual = elapsedTime(start);
+reportCompare(isThisFast(FAST), isThisFast(actual), status);
+
+/*
+ * Check accuracy -
+ */
+status = inSection(4);
+testRegExp([status], [re], [str], [result], [expect]);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-87231.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-87231.js
new file mode 100644
index 0000000000..b5467322eb
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-87231.js
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 22 June 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 87231:
+ * "Regular expression /(A)?(A.*)/ picks 'A' twice"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=87231
+ * Key case:
+ *
+ * pattern = /^(A)?(A.*)$/;
+ * string = 'A';
+ * expectedmatch = Array('A', '', 'A');
+ *
+ *
+ * We expect the 1st subexpression (A)? NOT to consume the single 'A'.
+ * Recall that "?" means "match 0 or 1 times". Here, it should NOT do
+ * greedy matching: it should match 0 times instead of 1. This allows
+ * the 2nd subexpression to make the only match it can: the single 'A'.
+ * Such "altruism" is the only way there can be a successful global match...
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-87231.js';
+var i = 0;
+var BUGNUMBER = 87231;
+var cnEmptyString = '';
+var summary = 'Testing regular expression /(A)?(A.*)/';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+
+
+pattern = /^(A)?(A.*)$/;
+status = inSection(1);
+string = 'AAA';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AAA', 'A', 'AA');
+addThis();
+
+status = inSection(2);
+string = 'AA';
+actualmatch = string.match(pattern);
+expectedmatch = Array('AA', 'A', 'A');
+addThis();
+
+status = inSection(3);
+string = 'A';
+actualmatch = string.match(pattern);
+expectedmatch = Array('A', undefined, 'A'); // 'altruistic' case: see above
+addThis();
+
+
+pattern = /(A)?(A.*)/;
+var strL = 'zxcasd;fl\\\ ^';
+var strR = 'aaAAaaaf;lrlrzs';
+
+status = inSection(4);
+string = strL + 'AAA' + strR;
+actualmatch = string.match(pattern);
+expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR);
+addThis();
+
+status = inSection(5);
+string = strL + 'AA' + strR;
+actualmatch = string.match(pattern);
+expectedmatch = Array('AA' + strR, 'A', 'A' + strR);
+addThis();
+
+status = inSection(6);
+string = strL + 'A' + strR;
+actualmatch = string.match(pattern);
+expectedmatch = Array('A' + strR, undefined, 'A' + strR); // 'altruistic' case: see above
+addThis();
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-98306.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-98306.js
new file mode 100644
index 0000000000..a2bfc2bf93
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-98306.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * jrgm@netscape.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 04 September 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 98306
+ * "JS parser crashes in ParseAtom for script using Regexp()"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=98306
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-98306.js';
+var BUGNUMBER = 98306;
+var summary = "Testing that we don't crash on this code -";
+var cnUBOUND = 10;
+var re;
+var s;
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ s = '"Hello".match(/[/]/)';
+ tryThis(s);
+
+ s = 're = /[/';
+ tryThis(s);
+
+ s = 're = /[/]/';
+ tryThis(s);
+
+ s = 're = /[//]/';
+ tryThis(s);
+
+ reportCompare('No Crash', 'No Crash', '');
+ exitFunc ('test');
+}
+
+
+// Try to provoke a crash -
+function tryThis(sCode)
+{
+ // sometimes more than one attempt is necessary -
+ for (var i=0; i<cnUBOUND; i++)
+ {
+ try
+ {
+ eval(sCode);
+ }
+ catch(e)
+ {
+ // do nothing; keep going -
+ }
+ }
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/shell.js
new file mode 100644
index 0000000000..dbc733c376
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/shell.js
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 07 February 2001
+ *
+ * Functionality common to RegExp testing -
+ */
+//-----------------------------------------------------------------------------
+
+gTestsubsuite = 'RegExp';
+
+var MSG_PATTERN = '\nregexp = ';
+var MSG_STRING = '\nstring = ';
+var MSG_EXPECT = '\nExpect: ';
+var MSG_ACTUAL = '\nActual: ';
+var ERR_LENGTH = '\nERROR !!! match arrays have different lengths:';
+var ERR_MATCH = '\nERROR !!! regexp failed to give expected match array:';
+var ERR_NO_MATCH = '\nERROR !!! regexp FAILED to match anything !!!';
+var ERR_UNEXP_MATCH = '\nERROR !!! regexp MATCHED when we expected it to fail !!!';
+var CHAR_LBRACKET = '[';
+var CHAR_RBRACKET = ']';
+var CHAR_QT_DBL = '"';
+var CHAR_QT = "'";
+var CHAR_NL = '\n';
+var CHAR_COMMA = ',';
+var CHAR_SPACE = ' ';
+var TYPE_STRING = typeof 'abc';
+
+
+
+function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches)
+{
+ var status = '';
+ var pattern = new RegExp();
+ var string = '';
+ var actualmatch = new Array();
+ var expectedmatch = new Array();
+ var state = '';
+ var lActual = -1;
+ var lExpect = -1;
+
+
+ for (var i=0; i != patterns.length; i++)
+ {
+ status = statuses[i];
+ pattern = patterns[i];
+ string = strings[i];
+ actualmatch=actualmatches[i];
+ expectedmatch=expectedmatches[i];
+ state = getState(status, pattern, string);
+
+ description = status;
+
+ if(actualmatch)
+ {
+ actual = formatArray(actualmatch);
+ if(expectedmatch)
+ {
+ // expectedmatch and actualmatch are arrays -
+ lExpect = expectedmatch.length;
+ lActual = actualmatch.length;
+
+ var expected = formatArray(expectedmatch);
+
+ if (lActual != lExpect)
+ {
+ reportCompare(lExpect, lActual,
+ state + ERR_LENGTH +
+ MSG_EXPECT + expected +
+ MSG_ACTUAL + actual +
+ CHAR_NL
+ );
+ continue;
+ }
+
+ // OK, the arrays have same length -
+ if (expected != actual)
+ {
+ reportCompare(expected, actual,
+ state + ERR_MATCH +
+ MSG_EXPECT + expected +
+ MSG_ACTUAL + actual +
+ CHAR_NL
+ );
+ }
+ else
+ {
+ reportCompare(expected, actual, state)
+ }
+
+ }
+ else //expectedmatch is null - that is, we did not expect a match -
+ {
+ expected = expectedmatch;
+ reportCompare(expected, actual,
+ state + ERR_UNEXP_MATCH +
+ MSG_EXPECT + expectedmatch +
+ MSG_ACTUAL + actual +
+ CHAR_NL
+ );
+ }
+
+ }
+ else // actualmatch is null
+ {
+ if (expectedmatch)
+ {
+ actual = actualmatch;
+ reportCompare(expected, actual,
+ state + ERR_NO_MATCH +
+ MSG_EXPECT + expectedmatch +
+ MSG_ACTUAL + actualmatch +
+ CHAR_NL
+ );
+ }
+ else // we did not expect a match
+ {
+ // Being ultra-cautious. Presumably expectedmatch===actualmatch===null
+ expected = expectedmatch;
+ actual = actualmatch;
+ reportCompare (expectedmatch, actualmatch, state);
+ }
+ }
+ }
+}
+
+
+function getState(status, pattern, string)
+{
+ /*
+ * Escape \n's, etc. to make them LITERAL in the presentation string.
+ * We don't have to worry about this in |pattern|; such escaping is
+ * done automatically by pattern.toString(), invoked implicitly below.
+ *
+ * One would like to simply do: string = string.replace(/(\s)/g, '\$1').
+ * However, the backreference $1 is not a literal string value,
+ * so this method doesn't work.
+ *
+ * Also tried string = string.replace(/(\s)/g, escape('$1'));
+ * but this just inserts the escape of the literal '$1', i.e. '%241'.
+ */
+ string = string.replace(/\n/g, '\\n');
+ string = string.replace(/\r/g, '\\r');
+ string = string.replace(/\t/g, '\\t');
+ string = string.replace(/\v/g, '\\v');
+ string = string.replace(/\f/g, '\\f');
+
+ return (status + MSG_PATTERN + pattern + MSG_STRING + singleQuote(string));
+}
+
+
+/*
+ * If available, arr.toSource() gives more detail than arr.toString()
+ *
+ * var arr = Array(1,2,'3');
+ *
+ * arr.toSource()
+ * [1, 2, "3"]
+ *
+ * arr.toString()
+ * 1,2,3
+ *
+ * But toSource() doesn't exist in Rhino, so use our own imitation, below -
+ *
+ */
+function formatArray(arr)
+{
+ try
+ {
+ return arr.toSource();
+ }
+ catch(e)
+ {
+ return toSource(arr);
+ }
+}
+
+
+/*
+ * Imitate SpiderMonkey's arr.toSource() method:
+ *
+ * a) Double-quote each array element that is of string type
+ * b) Represent |undefined| and |null| by empty strings
+ * c) Delimit elements by a comma + single space
+ * d) Do not add delimiter at the end UNLESS the last element is |undefined|
+ * e) Add square brackets to the beginning and end of the string
+ */
+function toSource(arr)
+{
+ var delim = CHAR_COMMA + CHAR_SPACE;
+ var elt = '';
+ var ret = '';
+ var len = arr.length;
+
+ for (i=0; i<len; i++)
+ {
+ elt = arr[i];
+
+ switch(true)
+ {
+ case (typeof elt === TYPE_STRING) :
+ ret += doubleQuote(elt);
+ break;
+
+ case (elt === undefined || elt === null) :
+ break; // add nothing but the delimiter, below -
+
+ default:
+ ret += elt.toString();
+ }
+
+ if ((i < len-1) || (elt === undefined))
+ ret += delim;
+ }
+
+ return CHAR_LBRACKET + ret + CHAR_RBRACKET;
+}
+
+
+function doubleQuote(text)
+{
+ return CHAR_QT_DBL + text + CHAR_QT_DBL;
+}
+
+
+function singleQuote(text)
+{
+ return CHAR_QT + text + CHAR_QT;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-385393-04.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-385393-04.js
new file mode 100755
index 0000000000..6e735fd1d2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-385393-04.js
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-385393-04.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 385393;
+var summary = 'Regression test for bug 385393';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ 'a'.replace(/a/g, eval);
+ }
+ catch(ex)
+ {
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-419152.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-419152.js
new file mode 100755
index 0000000000..f57f3a4f98
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-419152.js
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Mike Shaver
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-419152.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 419152;
+var summary = 'Shaver can not contain himself';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var a = [1,2,3];
+
+ a[5] = 6;
+ expect = '1,2,3,,,6:6';
+ actual = a + ':' + a.length;
+ reportCompare(expect, actual, summary + ': 1');
+
+ a = [1,2,3,4];
+ expect = 'undefined';
+ actual = a[-1] + '';
+ reportCompare(expect, actual, summary + ': 2');
+
+ a = [1,2,3];
+ a[-1] = 55;
+
+ expect = 3;
+ actual = a.length;
+ reportCompare(expect, actual, summary + ': 3');
+
+ expect = '1,2,3';
+ actual = a + '';
+ reportCompare(expect, actual, summary + ': 4');
+
+ expect = 55;
+ actual = a[-1];
+ reportCompare(expect, actual, summary + ': 5');
+
+ var s = "abcdef";
+
+ expect = 'undefined';
+ actual = s[-2] + '';
+ reportCompare(expect, actual, summary + ': 6');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420087.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420087.js
new file mode 100755
index 0000000000..1f21d19739
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420087.js
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Mike Shaver
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-420087.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 420087;
+var summary = 'Do not assert: PCVCAP_MAKE(sprop->shape, 0, 0) == entry->vcap';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var dict;
+
+ for (var i = 0; i < 2; i++)
+ dict = {p: 1, q: 1, p:1};
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420610.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420610.js
new file mode 100755
index 0000000000..ecd5a2dd42
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-420610.js
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-420610.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 420610;
+var summary = 'Do not crash with eval("this.x")';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+(function(){ eval("this.x") })();
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js
new file mode 100755
index 0000000000..27ddfab51d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jason Orendorff
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-441477-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 441477.01;
+var summary = '';
+var actual = 'No Exception';
+var expect = 'No Exception';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ try
+ {
+ for (i = 0; i < 5;)
+ {
+ if (i > 5)
+ throw "bad";
+ i++;
+ continue;
+ }
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/shell.js
new file mode 100644
index 0000000000..8c83369020
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Regress';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/12.6.3.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/12.6.3.js
new file mode 100755
index 0000000000..97c3ca3136
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/12.6.3.js
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bryant Chen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '12.6.3.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 292731;
+var summary = 'for-in should not call valueOf method';
+var actual = '';
+var expect = '';
+var i;
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+function MyObject()
+{
+}
+
+MyObject.prototype.valueOf = function()
+{
+ actual += 'MyObject.prototype.valueOf called. ';
+}
+
+ var myobject = new MyObject();
+
+var myfunction = new function()
+{
+ this.valueOf = function()
+ {
+ actual += 'this.valueOf called. ';
+ }
+}
+
+ actual = '';
+for (i in myobject)
+{
+ //calls valueOf
+}
+reportCompare(expect, actual, 'for-in custom object');
+
+actual = '';
+for (i in myfunction)
+{
+ //calls valueOf
+}
+reportCompare(expect, actual, 'for-in function expression');
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-121744.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-121744.js
new file mode 100644
index 0000000000..828cc5d8d5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-121744.js
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 30 Jan 2002
+ * Revised: 10 Apr 2002
+ * Revised: 14 July 2002
+ *
+ * SUMMARY: JS should error on |for(i in undefined)|, |for(i in null)|
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=121744
+ *
+ * ECMA-262 3rd Edition Final spec says such statements should error. See:
+ *
+ * Section 12.6.4 The for-in Statement
+ * Section 9.9 ToObject
+ *
+ *
+ * BUT: SpiderMonkey has decided NOT to follow this; it's a bug in the spec.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=131348
+ *
+ * UPDATE: Rhino has also decided not to follow the spec on this.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=136893
+ *
+
+ |--------------------------------------------------------------------|
+ | |
+ | So for now, adding an early return for this test so it won't run. |
+ | |
+ |--------------------------------------------------------------------|
+
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-121744.js';
+var UBound = 0;
+var BUGNUMBER = 121744;
+var summary = 'JS should error on |for(i in undefined)|, |for(i in null)|';
+var TEST_PASSED = 'TypeError';
+var TEST_FAILED = 'Generated an error, but NOT a TypeError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+/*
+ * AS OF 14 JULY 2002, DON'T RUN THIS TEST IN EITHER RHINO OR SPIDERMONKEY -
+ */
+quit();
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * OK, this should generate a TypeError
+ */
+try
+{
+ for (var i in undefined)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if (e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(2);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * OK, this should generate a TypeError
+ */
+try
+{
+ for (var i in null)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if (e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(3);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * Variable names that cannot be looked up generate ReferenceErrors; however,
+ * property names like obj.ZZZ that cannot be looked up are set to |undefined|
+ *
+ * Therefore, this should indirectly test | for (var i in undefined) |
+ */
+try
+{
+ for (var i in this.ZZZ)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if(e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(4);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * The result of an unsuccessful regexp match is the null value
+ * Therefore, this should indirectly test | for (var i in null) |
+ */
+try
+{
+ for (var i in 'bbb'.match(/aaa/))
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ if(e instanceof TypeError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-131348.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-131348.js
new file mode 100644
index 0000000000..013e114178
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-131348.js
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 10 Apr 2002
+ * Revised: 14 July 2002
+ *
+ * SUMMARY: JS should NOT error on |for(i in undefined)|, |for(i in null)|
+ *
+ * ECMA-262 3rd Edition Final spec says such statements SHOULD error. See:
+ *
+ * Section 12.6.4 The for-in Statement
+ * Section 9.9 ToObject
+ *
+ *
+ * But SpiderMonkey has decided NOT to follow this; it's a bug in the spec.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=131348
+ *
+ * Update: Rhino has also decided not to follow the spec on this
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=136893
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-131348.js';
+var UBound = 0;
+var BUGNUMBER = 131348;
+var summary = 'JS should not error on |for(i in undefined)|, |for(i in null)|';
+var TEST_PASSED = 'No error';
+var TEST_FAILED = 'An error was generated!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+try
+{
+ for (var i in undefined)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(2);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+try
+{
+ for (var i in null)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(3);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+/*
+ * Variable names that cannot be looked up generate ReferenceErrors; however,
+ * property names like obj.ZZZ that cannot be looked up are set to |undefined|
+ *
+ * Therefore, this should indirectly test | for (var i in undefined) |
+ */
+try
+{
+ for (var i in this.ZZZ)
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+status = inSection(4);
+expect = TEST_PASSED;
+actual = TEST_PASSED;
+/*
+ * The result of an unsuccessful regexp match is the null value
+ * Therefore, this should indirectly test | for (var i in null) |
+ */
+try
+{
+ for (var i in 'bbb'.match(/aaa/))
+ {
+ print(i);
+ }
+}
+catch(e)
+{
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-157509.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-157509.js
new file mode 100644
index 0000000000..0b1319ebba
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-157509.js
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor3@apochta.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 15 July 2002
+ * SUMMARY: Testing for SyntaxError on usage of '\' in identifiers
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=157509
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-157509.js';
+var UBound = 0;
+var BUGNUMBER = 157509;
+var summary = "Testing for SyntaxError on usage of '\\' in identifiers";
+var TEST_PASSED = 'SyntaxError';
+var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+expect = TEST_PASSED;
+actual = TEST_FAILED_BADLY;
+/*
+ * OK, this should generate a SyntaxError
+ */
+try
+{
+ eval('var a\\1 = 0;');
+}
+catch(e)
+{
+ if (e instanceof SyntaxError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+}
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-194364.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-194364.js
new file mode 100644
index 0000000000..a139f2b985
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-194364.js
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@icesoft.no, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 21 February 2003
+ * SUMMARY: Testing eval statements containing conditional function expressions
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=194364
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-194364.js';
+var UBound = 0;
+var BUGNUMBER = 194364;
+var summary = 'Testing eval statements with conditional function expressions';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+/*
+ From ECMA-262 Edition 3, 12.4:
+
+ 12.4 Expression Statement
+
+ Syntax
+ ExpressionStatement : [lookahead not in {{, function}] Expression ;
+
+ Note that an ExpressionStatement cannot start with an opening curly brace
+ because that might make it ambiguous with a Block. Also, an ExpressionStatement
+ cannot start with the function keyword because that might make it ambiguous with
+ a FunctionDeclaration.
+*/
+
+status = inSection(1);
+actual = eval('(function() {}); 1');
+expect = 1;
+addThis();
+
+status = inSection(2);
+actual = eval('(function f() {}); 2');
+expect = 2;
+addThis();
+
+status = inSection(3);
+actual = eval('if (true) (function() {}); 3');
+expect = 3;
+addThis();
+
+status = inSection(4);
+actual = eval('if (true) (function f() {}); 4');
+expect = 4;
+addThis();
+
+status = inSection(5);
+actual = eval('if (false) (function() {}); 5');
+expect = 5;
+addThis();
+
+status = inSection(6);
+actual = eval('if (false) (function f() {}); 6');
+expect = 6;
+addThis();
+
+status = inSection(7);
+actual = eval('switch(true) { case true: (function() {}) }; 7');
+expect = 7;
+addThis();
+
+status = inSection(8);
+actual = eval('switch(true) { case true: (function f() {}) }; 8');
+expect = 8;
+addThis();
+
+status = inSection(9);
+actual = eval('switch(false) { case false: (function() {}) }; 9');
+expect = 9;
+addThis();
+
+status = inSection(10);
+actual = eval('switch(false) { case false: (function f() {}) }; 10');
+expect = 10;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-226517.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-226517.js
new file mode 100644
index 0000000000..d99bfb503e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-226517.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@fastmail.fm, PhilSchwartau@aol.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 04 Dec 2003
+ * SUMMARY: |finally| statement should execute even after a |return|
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=226517
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-226517.js';
+var UBound = 0;
+var BUGNUMBER = 226517;
+var summary = '|finally| statement should execute even after a |return|';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * We can only use a return statement within a function.
+ * That makes the testcase more complicated to set up -
+ */
+function f()
+{
+ var return_expression_was_calculated = false;
+ try
+ {
+ return (return_expression_was_calculated = true);
+ }
+ finally
+ {
+ actual = return_expression_was_calculated;
+ }
+}
+
+
+status = inSection(1);
+f(); // sets |actual|
+expect = true;
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-302439.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-302439.js
new file mode 100755
index 0000000000..e1ebdb6e30
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-302439.js
@@ -0,0 +1,1368 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Silviu Trasca
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-302439.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 302439;
+var summary = 'spandep fu should skip unused JSOP_TABLESWITCH jump table entries';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+function productList(catID,famID) {
+ clearBox(document.Support_Form.Product_ID);
+
+ switch(parseInt(catID)) {
+
+ case 1 : // Sound Blaster
+ switch(parseInt(famID)) {
+
+ case 434 : // Audigy 4
+ break;
+
+ case 204 : // Audigy 2
+ break;
+
+ case 205 : // Audigy
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audigy Platinum eX', '45'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audigy Platinum', '4846'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audigy LS (SE)', '10365'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audigy Digital Entertainment', '5085'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audigy ES', '5086'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 206 : // Live!
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! 24-bit External', '10702'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Live! MP3+ 5.1', '573'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! 5.1', '50'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! Digital Entertainment 5.1 (SE)', '4855'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! Platinum 5.1', '572'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Live! 5.1 Digital (Dell)', '1853'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! Platinum', '3203'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Live! Value', '4856'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Live!', '4857'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 207 : // Others
+ try { addBoxItem(document.Support_Form.Product_ID, 'Extigy', '585'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Ensoniq AudioPCI', '420'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PCI4.1 Digital', '681'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Vibra128 4D', '9032'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Digital Music', '154'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Vibra 128', '4851'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster 32', '1844'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SB AWE64 Digital', '1821'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SB PCI 5.1', '1828'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster\u00AE', '1841'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster\u00AE 16', '1842'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster 16 Wave Effects', '1843'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster AWE32', '1848'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster AWE64', '1849'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster AWE64 Gold', '1850'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Microchannels', '1861'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster PCI 128', '1864'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster PCI 64', '1865'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Pro', '1866'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Audio PCI', '1559'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 16 : // Accessories
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live!Drive II', '9278'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster MIDI Adapter', '251'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mini to Standard MIDI Adapter', '252'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 210 : // Portable Media Players
+ switch(parseInt(famID)) {
+
+ case 211 : // Zen
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Portable Media Center', '9882'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 212 : // Accessories
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen PMC Docking Station', '10756'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen PMC Li-ion Polymer Battery', '10679'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen PMC FM Wired Remote', '10663'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 213 : // MP3 Players
+ switch(parseInt(famID)) {
+
+ case 214 : // Zen
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Touch', '10274'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Micro', '10795'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen', '11519'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Xtra', '9288'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen NX', '4836'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen USB 2.0', '9019'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Zen', '117'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 215 : // MuVo
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo Micro N200', '10737'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo\u00B2 X-Trainer', '5080'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo Slim', '10052'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo Sport C100', '10794'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo V200', '10732'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo TX FM', '9771'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo USB 2.0', '10919'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo', '110'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo NX', '4884'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo\u00B2', '4908'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo TX', '9672'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 216 : // Digital MP3 Player
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Xtra', '9288'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Rhomba NX', '10302'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MP3 Player FX120', '11010'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'DXT 200', '4996'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen USB 2.0', '9019'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Jukebox 3', '296'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative CD-MP3 Slim 600', '1582'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen NX', '4836'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MP3 Player', '4983'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MP3 Player 2', '4984'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MP3 Player MX', '4985'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Zen', '117'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'JukeBox 2', '239'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD JukeBox', '241'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD JukeBox C', '242'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Jukebox 10GB', '261'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative CD-MP3 M100', '264'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 217 : // Accessories
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Micro Battery', '11215'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Universal Travel Adapter for Zen Micro', '11711'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Neeon Stik-On', '12982'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Neeon Universal Travel Adapter', '12979'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Leather Case', '11511'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Neeon Leather Case', '12978'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Home Kit - Jukebox 3', '497'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox 3 Leather Case', '498'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Faceplates - Jukebox 3', '499'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo Armband', '511'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'NOMAD II MG Wired Remote', '515'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Accessory Kit', '533'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Battery Charger Kit', '538'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Battery Pack', '539'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'NOMAD II MG Travel Cable', '560'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Leather Case - Jukebox 2', '562'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Battery - Jukebox 2', '563'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo Battery Modules', '999'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PlayDock PD200', '31'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound', '80'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Li-Ion Battery - Jukebox 3', '86'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FM Wired Remote - Jukebox 3/Jukebox Zen/MuVo\u00B2', '115'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Power Adapter', '125'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Cassette Adapter Kit', '401'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Car Kit - Jukebox 3/Jukebox 2/Jukebox Zen/MuVo\u00B2', '496'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Battery Pack', '4997'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Battery Modules - MuVo NX / TX / TX FM', '9217'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Armband - MuVo NX / TX / TX FM', '10126'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 4 : // Speaker Systems
+ switch(parseInt(famID)) {
+
+ case 113 : // 7.1 Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire T7700', '5076'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 24 : // 6.1 Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 6.1 6600', '465'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 25 : // 5.1 Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Inspire 5.1 5100', '1704'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PCWorks LX520', '9412'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'I-Trigue 5600', '10736'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire T5900', '10323'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire P5800', '10596'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Theater 5.1 DTT2200', '428'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 5.1 5700 Digital', '439'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Inspire 5.1 Digital 5500', '990'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 5.1 5200', '55'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Inspire 5.1 5300', '238'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MegaWorks THX 5.1 550', '240'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Theater 5.1 DTT3500 Digital', '290'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PlayWorks DTT2500 Digital', '291'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Inspire 5.1 5600', '1705'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire T5400', '5077'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PlayWorks PS2000 Digital', '427'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Theater 5.1', '1628'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Theater 5.1 DTT2500 Digital', '1629'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Cambridge SoundWorks MegaWorks 510D', '478'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 26 : // 4.1 Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'FPS1600', '47'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FPS2000 Digital', '297'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 4.1 4400', '446'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FPS1800', '424'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-Works FourPointSurround FPS1000', '378'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FPS1500', '388'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 27 : // 2.1 Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'I-Trigue 3600', '10735'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire T3000', '10329'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'I-Trigue 3400', '10733'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire G380', '9276'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative I-Trigue 3200', '10327'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PCWorks LX220', '9407'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Inspire 2.1 Slim 2600', '434'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 2.1 2500', '461'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'I-Trigue L3500', '4912'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'I-Trigue L3450', '4913'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire T2900', '9025'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire P380', '9026'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SoundWorks SW320', '48'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MegaWorks THX 2.1 250D', '124'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'I-Trigue 2.1 3300', '139'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative SBS 2.1 350 Speakers', '281'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SBS 370', '283'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PCWorks', '284'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Inspire Slim 500', '289'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Inspire 2.1 2400', '298'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SoundWorks Digital', '299'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SoundWorks SW310', '304'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'I-Trigue i3350', '279'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 28 : // 2.0 Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire Monitor M85-D', '4910'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 2.0 1300', '4918'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SBS 230 Speakers', '4905'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SBS52', '1'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SBS16', '2'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Cambridge SBS20', '3'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SBS50', '1834'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SBS10', '1831'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative SBS15', '4906'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 29 : // Portable Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound 200', '10164'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound MP3', '1874'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PlayDock PD200', '31'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound', '80'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound i-300', '9022'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative TravelSound MP3 Titanium', '991'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 136 : // Decoders
+ try { addBoxItem(document.Support_Form.Product_ID, 'Decoder DDTS-100', '9468'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 30 : // Accessories
+ try { addBoxItem(document.Support_Form.Product_ID, 'MT-1100 Speaker Stands', '166'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones HQ-1700', '11164'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones HQ-1300', '4936'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones HN-505', '4938'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Backphones HQ-65', '4916'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Backphones HQ-60', '4937'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Earphones EP-880', '11156'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Earphones EP-480', '11708'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset HE-100', '11023'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset HS-300', '4939'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MT-1200 Speaker Stands', '9515'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'SurroundStation', '32'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative HQ-2000 Headphones', '4'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MT-500 Speaker Tripods', '399'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 2600 Spkr Grilles', '636'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 5300 Spkr Grilles', '637'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 5700 Spkr Grilles', '664'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative HQ-1000 Headphones', '4988'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 218 : // Web Cameras
+ switch(parseInt(famID)) {
+
+ case 219 : // WebCam
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Live! Ultra for Notebooks', '11491'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Live! Ultra', '10451'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Live! Pro', '10450'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Live!', '10412'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Instant', '10410'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam NX Ultra', '9340'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam NX Pro', '628'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam NX', '627'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam PRO eX', '243'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam PRO', '616'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Go Plus', '15'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Webcam Go ES', '1898'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Go Mini', '1900'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Go', '17'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Video Blaster WebCam Plus', '16'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Notebook', '629'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Mobile', '4890'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam 5', '1896'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Vista Pro', '11053'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Vista Plus', '11043'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam', '65'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam II', '4900'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam 3', '1908'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Vista', '1907'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 220 : // PC-CAM
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 900', '10119'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 930 Slim', '11431'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 920 Slim', '10823'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 880', '308'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 750', '4878'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 850', '4879'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative PC-CAM 300', '49'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 350', '106'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 550', '107'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CardCam Value', '116'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-CAM 600', '260'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 437 : // Headphones &amp; Headsets
+ switch(parseInt(famID)) {
+
+ case 438 : // Headphones
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones HQ-1700', '11164'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones HQ-1300', '4936'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones CB2530', '11644'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 439 : // Noise-Cancelling Headphones
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones HN-505', '4938'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 440 : // Backphones
+ try { addBoxItem(document.Support_Form.Product_ID, 'Backphones HQ-65', '4916'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Backphones HQ-60', '4937'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 441 : // Earphones
+ try { addBoxItem(document.Support_Form.Product_ID, 'Earphones EP-880', '11156'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Earphones EP-630', '11397'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Earphones EP-480', '11708'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Earphones EP-380', '11229'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 442 : // Headsets
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset HE-100', '11023'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset HS-300', '4939'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 9 : // Storage Devices
+ switch(parseInt(famID)) {
+
+ case 259 : // DVD±RW Drive
+ try { addBoxItem(document.Support_Form.Product_ID, 'DVD±RW Dual 8X', '9599'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'DVD±RW Dual 8x8', '10305'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'DVD+RW Dual External 8x8', '10583'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 47 : // Combo Drive
+ try { addBoxItem(document.Support_Form.Product_ID, 'Combo Drive 52.32.52x/16x', '11712'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Combo Drive 40-12-40/16', '4998'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Combo Drive NS', '9454'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 46 : // CD-RW Drive
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW External 52-32-52x', '9481'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW Blaster 12-10-32', '8'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW 52.24.52', '1590'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW Blaster 24-10-40 External', '4944'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW External 52-24-52x', '9027'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW 52-32-52x', '9453'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW Blaster 48-12-48 External', '9020'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-RW Blaster 48-12-48', '4941'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 45 : // PC-DVD Drive
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-DVD Encore 12x', '6'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-DVD ROM 12x', '1486'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-DVD DVD-ROM 16x', '1490'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'PC-DVD MPEG-1 Decoder Board', '1801'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 44 : // CD-ROM Drive
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-ROM Blaster Digital iR52X', '3562'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CD-ROM Blaster 52X', '11'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '12x CD-ROM Drives', '1485'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '16x CD-ROM Drives', '1489'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '48x CD-ROM Drives', '1548'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '1x & 2x CD-ROM Drives', '1493'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '24x CD-ROM Drives', '1495'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '2x & 3x CD-ROM (SCSI)', '1496'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '32x CD-ROM Drives', '1498'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '36x CD-ROM Drives', '1499'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '40x CD-Rom Drives', '1547'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '4x CD-ROM Drives', '1549'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '6x CD-ROM Drives', '1552'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '8x CD-ROM Drives', '1554'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 49 : // Portable Harddisk
+ try { addBoxItem(document.Support_Form.Product_ID, 'Storage Blaster Portable Harddisk', '8996'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 265 : // Portable Storage
+ try { addBoxItem(document.Support_Form.Product_ID, 'ThumbDrive', '10681'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 12 : // PC Barebone
+ switch(parseInt(famID)) {
+
+ case 54 : // SLiX PC
+ try { addBoxItem(document.Support_Form.Product_ID, 'SLiX PC MPC61Y0', '11766'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 11 : // Monitors
+ switch(parseInt(famID)) {
+
+ case 53 : // LCD
+ try { addBoxItem(document.Support_Form.Product_ID, '17" TFT LCD Monitor With DVI', '9980'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 60 : // Video
+ switch(parseInt(famID)) {
+
+ case 96 : // Video Editing
+ try { addBoxItem(document.Support_Form.Product_ID, 'Video Blaster MovieMaker', '13'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 13 : // Accessories
+ switch(parseInt(famID)) {
+
+ case 55 : // Sound Blaster
+ try { addBoxItem(document.Support_Form.Product_ID, 'Optical Digital I/O Card II', '30'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster MIDI Adapter', '251'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mini to Standard MIDI Adapter', '252'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live!Drive II', '9278'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Audigy Internal Drive', '88'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sound Blaster Audigy External Drive', '89'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! Drive IR', '26'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! Drive I', '27'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Remote Controller SBLive', '1816'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 449 : // Zen Micro
+ try { addBoxItem(document.Support_Form.Product_ID, 'Universal Travel Adapter for Zen Micro', '11711'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Leather Case', '11511'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 483 : // Zen Neeon
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Neeon Stik-On', '12982'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Neeon Leather Case', '12978'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen Neeon Universal Travel Adapter', '12979'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 264 : // Portable Media Center
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen PMC Docking Station', '10756'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen PMC Li-ion Polymer Battery', '10679'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Zen PMC FM Wired Remote', '10663'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 57 : // MP3 Players
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD JukeBox 3 Car Kit', '4894'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Home Kit - Jukebox 3', '497'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox 3 Leather Case', '498'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Faceplates - Jukebox 3', '499'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MuVo Armband', '511'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Accessory Kit', '533'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Battery Charger Kit', '538'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Battery Pack', '539'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Leather Case - Jukebox 2', '562'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Battery - Jukebox 2', '563'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Li-Ion Battery - Jukebox 3', '86'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FM Wired Remote - Jukebox 3/Jukebox Zen/MuVo\u00B2', '115'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative NOMAD Jukebox Power Adapter', '125'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Cassette Adapter Kit', '401'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Car Kit - Jukebox 3/Jukebox 2/Jukebox Zen/MuVo\u00B2', '496'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Battery Modules - MuVo NX / TX / TX FM', '9217'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Armband - MuVo NX / TX / TX FM', '10126'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 58 : // Speaker Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'MT-1100 Speaker Stands', '166'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones HQ-1700', '11164'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Earphones EP-880', '11156'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset HE-100', '11023'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'MT-500 Speaker Tripods', '399'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Speaker Extension Cables', '415'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 5300 Spkr Grilles', '637'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Inspire 5700 Spkr Grilles', '664'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 256 : // Wireless
+ try { addBoxItem(document.Support_Form.Product_ID, 'Wireless Headset for Bluetooth', '10287'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset CB2455', '11394'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones CB2530', '11644'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 59 : // Storage
+ try { addBoxItem(document.Support_Form.Product_ID, 'S-Video Cable Coupler', '250'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'IDE Cable Set', '255'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Dxr2 Decoder Board', '1648'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Dxr3 Decoder Card', '12'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 118 : // Digital Cameras
+ switch(parseInt(famID)) {
+
+ case 117 : // Digital Still Cameras
+ try { addBoxItem(document.Support_Form.Product_ID, 'DC-CAM 4200ZS', '10822'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'DC-CAM 3200Z', '9762'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'DC-CAM 3000Z', '9028'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CardCam', '120'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CardCam Value', '116'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 309 : // Digital Video Cameras
+ try { addBoxItem(document.Support_Form.Product_ID, 'DiVi CAM 316', '11175'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 10 : // Mice & Keyboards
+ switch(parseInt(famID)) {
+
+ case 223 : // Wired Mice
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse 5500', '11387'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse 3500', '11388'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Classic', '4919'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Optical Lite', '4920'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Optical 3000', '4924'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Optical Mouse', '262'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Notebook Optical', '9147'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 224 : // Wireless Mice
+ try { addBoxItem(document.Support_Form.Product_ID, 'FreePoint Travel', '11165'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FreePoint Travel Mini', '11166'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FreePoint 5500', '11178'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FreePoint 3500', '11386'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Wireless Optical 5000', '9145'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Wireless Optical', '263'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Wireless Optical 3000', '4923'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 227 : // Wireless Mice & Keyboards
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Wireless 9000 Pro', '11493'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Wireless 8000', '10104'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Wireless 6000', '5039'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 228 : // Wired PC & MIDI Keyboards
+ try { addBoxItem(document.Support_Form.Product_ID, 'Prodikeys DM', '9389'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Prodikeys DM Value', '9600'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Prodikeys', '504'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 52 : // Gaming Devices
+ try { addBoxItem(document.Support_Form.Product_ID, 'Avant Force NX', '9394'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Cobra Force 3D', '9396'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Gamepad I', '1658'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 8 : // Musical Keyboards
+ switch(parseInt(famID)) {
+
+ case 234 : // PC & MIDI Keyboards
+ try { addBoxItem(document.Support_Form.Product_ID, 'Prodikeys DM', '9389'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Prodikeys DM Value', '9600'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Prodikeys', '504'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 231 : // MIDI Keyboards
+ try { addBoxItem(document.Support_Form.Product_ID, 'Creative Blasterkeys', '40'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 237 : // Creative Professional
+ switch(parseInt(famID)) {
+
+ case 239 : // Digital Audio Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'E-MU 1820M', '10496'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'E-MU 1212M', '10500'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'E-MU 1820', '10494'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'E-MU 0404', '10498'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 240 : // Desktop Sampling Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'Emulator X', '10502'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Emulator X Studio', '10504'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Proteus X', '11074'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 421 : // Desktop Sound Modules
+ try { addBoxItem(document.Support_Form.Product_ID, 'Proteus X', '11074'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 258 : // Accessories and Upgrades
+ try { addBoxItem(document.Support_Form.Product_ID, 'Proteus X Software Upgrade', '11073'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Emulator X OS Upgrade', '10225'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mo\'Phatt X', '11329'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Planet Earth X', '11330'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Virtuoso X', '11332'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Vintage X Pro Collection', '11072'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Street Kits', '11331'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'AudioDock M', '10229'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audio Dock', '10230'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Beat Shop 2', '10404'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'EDI Cable', '10227'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Sync Daughter Card', '10576'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 243 : // Wireless
+ switch(parseInt(famID)) {
+
+ case 246 : // Mice & Keyboards
+ try { addBoxItem(document.Support_Form.Product_ID, 'FreePoint 5500', '11178'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'FreePoint 3500', '11386'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Wireless Optical 5000', '9145'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Wireless 8000', '10104'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Desktop Wireless 6000', '5039'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Wireless Optical', '263'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Wireless Optical 3000', '4923'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 248 : // Accessories
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset CB2460', '11238'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headset CB2455', '11394'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Wireless Headset for Bluetooth', '10287'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Headphones CB2530', '11644'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 244 : // Notebook Products
+ switch(parseInt(famID)) {
+
+ case 250 : // PCMCIA Sound Blaster
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audigy 2 ZS Notebook', '10769'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 249 : // USB Sound Blaster
+ try { addBoxItem(document.Support_Form.Product_ID, 'Audigy 2 NX', '9103'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Live! 24-bit External', '10702'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Digital Music LX', '10246'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Digital Music', '154'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Extigy', '585'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 251 : // Portable Speaker Systems
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound 200', '10164'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound i-300', '9022'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'TravelSound MP3', '1874'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 252 : // Mice & Keyboards
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Wireless NoteBook Optical', '10188'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Mouse Notebook Optical', '9147'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 253 : // Web Cameras
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Live! Ultra for Notebooks', '11491'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Notebook', '629'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WebCam Mobile', '4890'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 6 : // Graphics
+ switch(parseInt(famID)) {
+
+ case 37 : // ATI Radeon 9000 series
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster RX9250', '11489'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster RX9250 Xtreme', '11490'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 230 : // 3D Labs
+ try { addBoxItem(document.Support_Form.Product_ID, 'Graphics Blaster Picture Perfect', '164'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 99 : // NVIDIA GeForce
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster GeForce', '1500'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster GeForce 2', '1501'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster GeForce Pro', '1505'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster GeForce2 ULTRA 64MB AGP', '1512'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 98 : // NVIDIA Riva TNT Series
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster RIVA TNT2 Pro', '1527'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Graphics Blaster RIVA128ZX', '1689'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster Riva TNT2', '4841'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster RIVA TNT2 Value', '4842'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster TNT2 Ultra', '4843'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 73 : // 3D Blaster
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 4 Titanium 4200', '1516'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9700 Pro', '1524'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 4 MX440', '1539'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9000 64MB', '1540'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9000 Pro', '1541'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 4 MX420', '4869'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9800 Pro', '4917'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 4 MX460', '4969'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9600', '4973'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9000 Pro 128MB', '8995'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9200 SE', '9024'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9600 Pro', '9576'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9600 XT', '10311'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster 5 RX9600 SE', '10335'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster Savage 4', '1536'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster VLB', '1537'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster Voodoo 2', '1538'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster PCI', '1523'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster Banshee', '1506'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, '3D Blaster Banshee AGP', '1507'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 7 : // Modems & Networking
+ switch(parseInt(famID)) {
+
+ case 41 : // Wireless
+ try { addBoxItem(document.Support_Form.Product_ID, 'USB Adapter CB2431', '10863'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Network Blaster Wireless PCMCIA Card', '3868'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 42 : // Broadband
+ try { addBoxItem(document.Support_Form.Product_ID, 'Broadband Blaster DSL Router 8015U', '11176'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Broadband Blaster Router 8110', '10280'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Broadband Blaster ADSL Bridge ', '4873'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Broadband Blaster USB Modem', '4871'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Broadband Blaster DSL', '4921'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 40 : // Analog
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster PCMCIA', '24'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster V.92 PCI', '52'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster V.92 Serial', '258'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster V.92 USB', '266'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem 56k Internal', '1715'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster Flash 56II ISA', '18'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster V.90 ISA', '19'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster Flash 56 PCI', '21'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster V.90 USB', '22'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster V.90 External', '23'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster USB (DE5675)', '8992'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster USB (DE5673)', '8991'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster PCI (DI5663)', '4999'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster PCI (DI5656)', '8988'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster PCI (DI5655)', '8989'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster External (DE5625)', '8990'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Modem Blaster 28.8 External', '5000'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'CT5451 Modem Blaster Voice PnP', '5001'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'Phone Blaster', '1809'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+
+ }
+ break;
+
+ case 106 : // Software
+ switch(parseInt(famID)) {
+
+ case 241 : // HansVision DXT
+ try { addBoxItem(document.Support_Form.Product_ID, 'HansVision DXT 2005 Edition', '12218'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 242 : // Children\'s Multimedia Educational
+ try { addBoxItem(document.Support_Form.Product_ID, 'WaWaYaYa Happy Mandarin Series', '11269'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ try { addBoxItem(document.Support_Form.Product_ID, 'WaWaYaYa Happy English Series', '4932'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 107 : // HansVision
+ try { addBoxItem(document.Support_Form.Product_ID, 'HansVision DXT', '4928'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 108 : // WaWaYaYa
+ try { addBoxItem(document.Support_Form.Product_ID, 'WaWaYaYa Comprehensive Ability Series', '4930'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2'); } //
+
+ break;
+
+ case 109 : // Others
+
+ break;
+
+
+ }
+ break;
+
+ }
+ // addBoxItem(document.Support_Form.Product_ID, 'Zen Portable Media Center', 'DUMMYPREFIX_ZenPMC_Temp|9882');
+}
+
+try
+{
+ productList(0,0);
+}
+catch(e)
+{
+}
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-324650.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-324650.js
new file mode 100755
index 0000000000..003cd0fa42
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-324650.js
@@ -0,0 +1,5461 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Philipp Vogt
+ * Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-324650.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 324650;
+var summary = 'Switch Statement with many cases';
+var actual = 'No Hang';
+var expect = 'No Hang';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var notevil = "z1";
+var notevil2 = "z2";
+var notevil3 = "z3";
+var dut = 7;
+var dut2 = 7;
+var dut3 = 7;
+
+/* shouldn't be evil */
+
+switch ( notevil ) {
+case "z1": dut = 2;
+ break;
+case "z2":
+ notevil = (notevil + 2)/2;
+ break;
+case "z3":
+ notevil = (notevil + 3)/2;
+ break;
+case "z4":
+ notevil = (notevil + 4)/2;
+ break;
+case "z5":
+ notevil = (notevil + 5)/2;
+ break;
+case "z6":
+ notevil = (notevil + 6)/2;
+ break;
+case "z7":
+ notevil = (notevil + 7)/2;
+ break;
+case "z8":
+ notevil = (notevil + 8)/2;
+ break;
+case "z9":
+ notevil = (notevil + 9)/2;
+ break;
+case "z10":
+ notevil = (notevil + 10)/2;
+ break;
+case "z11":
+ notevil = (notevil + 11)/2;
+ break;
+case "z12":
+ notevil = (notevil + 12)/2;
+ break;
+case "z13":
+ notevil = (notevil + 13)/2;
+ break;
+case "z14":
+ notevil = (notevil + 14)/2;
+ break;
+case "z15":
+ notevil = (notevil + 15)/2;
+ break;
+case "z16":
+ notevil = (notevil + 16)/2;
+ break;
+case "z17":
+ notevil = (notevil + 17)/2;
+ break;
+case "z18":
+ notevil = (notevil + 18)/2;
+ break;
+case "z19":
+ notevil = (notevil + 19)/2;
+ break;
+case "z20":
+ notevil = (notevil + 20)/2;
+ break;
+case "z21":
+ notevil = (notevil + 21)/2;
+ break;
+case "z22":
+ notevil = (notevil + 22)/2;
+ break;
+case "z23":
+ notevil = (notevil + 23)/2;
+ break;
+case "z24":
+ notevil = (notevil + 24)/2;
+ break;
+case "z25":
+ notevil = (notevil + 25)/2;
+ break;
+case "z26":
+ notevil = (notevil + 26)/2;
+ break;
+case "z27":
+ notevil = (notevil + 27)/2;
+ break;
+case "z28":
+ notevil = (notevil + 28)/2;
+ break;
+case "z29":
+ notevil = (notevil + 29)/2;
+ break;
+case "z30":
+ notevil = (notevil + 30)/2;
+ break;
+case "z31":
+ notevil = (notevil + 31)/2;
+ break;
+case "z32":
+ notevil = (notevil + 32)/2;
+ break;
+case "z33":
+ notevil = (notevil + 33)/2;
+ break;
+case "z34":
+ notevil = (notevil + 34)/2;
+ break;
+case "z35":
+ notevil = (notevil + 35)/2;
+ break;
+case "z36":
+ notevil = (notevil + 36)/2;
+ break;
+case "z37":
+ notevil = (notevil + 37)/2;
+ break;
+case "z38":
+ notevil = (notevil + 38)/2;
+ break;
+case "z39":
+ notevil = (notevil + 39)/2;
+ break;
+case "z40":
+ notevil = (notevil + 40)/2;
+ break;
+case "z41":
+ notevil = (notevil + 41)/2;
+ break;
+case "z42":
+ notevil = (notevil + 42)/2;
+ break;
+case "z43":
+ notevil = (notevil + 43)/2;
+ break;
+case "z44":
+ notevil = (notevil + 44)/2;
+ break;
+case "z45":
+ notevil = (notevil + 45)/2;
+ break;
+case "z46":
+ notevil = (notevil + 46)/2;
+ break;
+case "z47":
+ notevil = (notevil + 47)/2;
+ break;
+case "z48":
+ notevil = (notevil + 48)/2;
+ break;
+case "z49":
+ notevil = (notevil + 49)/2;
+ break;
+case "z50":
+ notevil = (notevil + 50)/2;
+ break;
+case "z51":
+ notevil = (notevil + 51)/2;
+ break;
+case "z52":
+ notevil = (notevil + 52)/2;
+ break;
+case "z53":
+ notevil = (notevil + 53)/2;
+ break;
+case "z54":
+ notevil = (notevil + 54)/2;
+ break;
+case "z55":
+ notevil = (notevil + 55)/2;
+ break;
+case "z56":
+ notevil = (notevil + 56)/2;
+ break;
+case "z57":
+ notevil = (notevil + 57)/2;
+ break;
+case "z58":
+ notevil = (notevil + 58)/2;
+ break;
+case "z59":
+ notevil = (notevil + 59)/2;
+ break;
+case "z60":
+ notevil = (notevil + 60)/2;
+ break;
+case "z61":
+ notevil = (notevil + 61)/2;
+ break;
+case "z62":
+ notevil = (notevil + 62)/2;
+ break;
+case "z63":
+ notevil = (notevil + 63)/2;
+ break;
+case "z64":
+ notevil = (notevil + 64)/2;
+ break;
+case "z65":
+ notevil = (notevil + 65)/2;
+ break;
+case "z66":
+ notevil = (notevil + 66)/2;
+ break;
+case "z67":
+ notevil = (notevil + 67)/2;
+ break;
+case "z68":
+ notevil = (notevil + 68)/2;
+ break;
+case "z69":
+ notevil = (notevil + 69)/2;
+ break;
+case "z70":
+ notevil = (notevil + 70)/2;
+ break;
+case "z71":
+ notevil = (notevil + 71)/2;
+ break;
+case "z72":
+ notevil = (notevil + 72)/2;
+ break;
+case "z73":
+ notevil = (notevil + 73)/2;
+ break;
+case "z74":
+ notevil = (notevil + 74)/2;
+ break;
+case "z75":
+ notevil = (notevil + 75)/2;
+ break;
+case "z76":
+ notevil = (notevil + 76)/2;
+ break;
+case "z77":
+ notevil = (notevil + 77)/2;
+ break;
+case "z78":
+ notevil = (notevil + 78)/2;
+ break;
+case "z79":
+ notevil = (notevil + 79)/2;
+ break;
+case "z80":
+ notevil = (notevil + 80)/2;
+ break;
+case "z81":
+ notevil = (notevil + 81)/2;
+ break;
+case "z82":
+ notevil = (notevil + 82)/2;
+ break;
+case "z83":
+ notevil = (notevil + 83)/2;
+ break;
+case "z84":
+ notevil = (notevil + 84)/2;
+ break;
+case "z85":
+ notevil = (notevil + 85)/2;
+ break;
+case "z86":
+ notevil = (notevil + 86)/2;
+ break;
+case "z87":
+ notevil = (notevil + 87)/2;
+ break;
+case "z88":
+ notevil = (notevil + 88)/2;
+ break;
+case "z89":
+ notevil = (notevil + 89)/2;
+ break;
+case "z90":
+ notevil = (notevil + 90)/2;
+ break;
+case "z91":
+ notevil = (notevil + 91)/2;
+ break;
+case "z92":
+ notevil = (notevil + 92)/2;
+ break;
+case "z93":
+ notevil = (notevil + 93)/2;
+ break;
+case "z94":
+ notevil = (notevil + 94)/2;
+ break;
+case "z95":
+ notevil = (notevil + 95)/2;
+ break;
+case "z96":
+ notevil = (notevil + 96)/2;
+ break;
+case "z97":
+ notevil = (notevil + 97)/2;
+ break;
+case "z98":
+ notevil = (notevil + 98)/2;
+ break;
+case "z99":
+ notevil = (notevil + 99)/2;
+ break;
+case "z100":
+ notevil = (notevil + 100)/2;
+ break;
+case "z101":
+ notevil = (notevil + 101)/2;
+ break;
+case "z102":
+ notevil = (notevil + 102)/2;
+ break;
+case "z103":
+ notevil = (notevil + 103)/2;
+ break;
+case "z104":
+ notevil = (notevil + 104)/2;
+ break;
+case "z105":
+ notevil = (notevil + 105)/2;
+ break;
+case "z106":
+ notevil = (notevil + 106)/2;
+ break;
+case "z107":
+ notevil = (notevil + 107)/2;
+ break;
+case "z108":
+ notevil = (notevil + 108)/2;
+ break;
+case "z109":
+ notevil = (notevil + 109)/2;
+ break;
+case "z110":
+ notevil = (notevil + 110)/2;
+ break;
+case "z111":
+ notevil = (notevil + 111)/2;
+ break;
+case "z112":
+ notevil = (notevil + 112)/2;
+ break;
+case "z113":
+ notevil = (notevil + 113)/2;
+ break;
+case "z114":
+ notevil = (notevil + 114)/2;
+ break;
+case "z115":
+ notevil = (notevil + 115)/2;
+ break;
+case "z116":
+ notevil = (notevil + 116)/2;
+ break;
+case "z117":
+ notevil = (notevil + 117)/2;
+ break;
+case "z118":
+ notevil = (notevil + 118)/2;
+ break;
+case "z119":
+ notevil = (notevil + 119)/2;
+ break;
+case "z120":
+ notevil = (notevil + 120)/2;
+ break;
+case "z121":
+ notevil = (notevil + 121)/2;
+ break;
+case "z122":
+ notevil = (notevil + 122)/2;
+ break;
+case "z123":
+ notevil = (notevil + 123)/2;
+ break;
+case "z124":
+ notevil = (notevil + 124)/2;
+ break;
+case "z125":
+ notevil = (notevil + 125)/2;
+ break;
+case "z126":
+ notevil = (notevil + 126)/2;
+ break;
+case "z127":
+ notevil = (notevil + 127)/2;
+ break;
+case "z128":
+ notevil = (notevil + 128)/2;
+ break;
+case "z129":
+ notevil = (notevil + 129)/2;
+ break;
+case "z130":
+ notevil = (notevil + 130)/2;
+ break;
+case "z131":
+ notevil = (notevil + 131)/2;
+ break;
+case "z132":
+ notevil = (notevil + 132)/2;
+ break;
+case "z133":
+ notevil = (notevil + 133)/2;
+ break;
+case "z134":
+ notevil = (notevil + 134)/2;
+ break;
+case "z135":
+ notevil = (notevil + 135)/2;
+ break;
+case "z136":
+ notevil = (notevil + 136)/2;
+ break;
+case "z137":
+ notevil = (notevil + 137)/2;
+ break;
+case "z138":
+ notevil = (notevil + 138)/2;
+ break;
+case "z139":
+ notevil = (notevil + 139)/2;
+ break;
+case "z140":
+ notevil = (notevil + 140)/2;
+ break;
+case "z141":
+ notevil = (notevil + 141)/2;
+ break;
+case "z142":
+ notevil = (notevil + 142)/2;
+ break;
+case "z143":
+ notevil = (notevil + 143)/2;
+ break;
+case "z144":
+ notevil = (notevil + 144)/2;
+ break;
+case "z145":
+ notevil = (notevil + 145)/2;
+ break;
+case "z146":
+ notevil = (notevil + 146)/2;
+ break;
+case "z147":
+ notevil = (notevil + 147)/2;
+ break;
+case "z148":
+ notevil = (notevil + 148)/2;
+ break;
+case "z149":
+ notevil = (notevil + 149)/2;
+ break;
+case "z150":
+ notevil = (notevil + 150)/2;
+ break;
+case "z151":
+ notevil = (notevil + 151)/2;
+ break;
+case "z152":
+ notevil = (notevil + 152)/2;
+ break;
+case "z153":
+ notevil = (notevil + 153)/2;
+ break;
+case "z154":
+ notevil = (notevil + 154)/2;
+ break;
+case "z155":
+ notevil = (notevil + 155)/2;
+ break;
+case "z156":
+ notevil = (notevil + 156)/2;
+ break;
+case "z157":
+ notevil = (notevil + 157)/2;
+ break;
+case "z158":
+ notevil = (notevil + 158)/2;
+ break;
+case "z159":
+ notevil = (notevil + 159)/2;
+ break;
+case "z160":
+ notevil = (notevil + 160)/2;
+ break;
+case "z161":
+ notevil = (notevil + 161)/2;
+ break;
+case "z162":
+ notevil = (notevil + 162)/2;
+ break;
+case "z163":
+ notevil = (notevil + 163)/2;
+ break;
+case "z164":
+ notevil = (notevil + 164)/2;
+ break;
+case "z165":
+ notevil = (notevil + 165)/2;
+ break;
+case "z166":
+ notevil = (notevil + 166)/2;
+ break;
+case "z167":
+ notevil = (notevil + 167)/2;
+ break;
+case "z168":
+ notevil = (notevil + 168)/2;
+ break;
+case "z169":
+ notevil = (notevil + 169)/2;
+ break;
+case "z170":
+ notevil = (notevil + 170)/2;
+ break;
+case "z171":
+ notevil = (notevil + 171)/2;
+ break;
+case "z172":
+ notevil = (notevil + 172)/2;
+ break;
+case "z173":
+ notevil = (notevil + 173)/2;
+ break;
+case "z174":
+ notevil = (notevil + 174)/2;
+ break;
+case "z175":
+ notevil = (notevil + 175)/2;
+ break;
+case "z176":
+ notevil = (notevil + 176)/2;
+ break;
+case "z177":
+ notevil = (notevil + 177)/2;
+ break;
+case "z178":
+ notevil = (notevil + 178)/2;
+ break;
+case "z179":
+ notevil = (notevil + 179)/2;
+ break;
+case "z180":
+ notevil = (notevil + 180)/2;
+ break;
+case "z181":
+ notevil = (notevil + 181)/2;
+ break;
+case "z182":
+ notevil = (notevil + 182)/2;
+ break;
+case "z183":
+ notevil = (notevil + 183)/2;
+ break;
+case "z184":
+ notevil = (notevil + 184)/2;
+ break;
+case "z185":
+ notevil = (notevil + 185)/2;
+ break;
+case "z186":
+ notevil = (notevil + 186)/2;
+ break;
+case "z187":
+ notevil = (notevil + 187)/2;
+ break;
+case "z188":
+ notevil = (notevil + 188)/2;
+ break;
+case "z189":
+ notevil = (notevil + 189)/2;
+ break;
+case "z190":
+ notevil = (notevil + 190)/2;
+ break;
+case "z191":
+ notevil = (notevil + 191)/2;
+ break;
+case "z192":
+ notevil = (notevil + 192)/2;
+ break;
+case "z193":
+ notevil = (notevil + 193)/2;
+ break;
+case "z194":
+ notevil = (notevil + 194)/2;
+ break;
+case "z195":
+ notevil = (notevil + 195)/2;
+ break;
+case "z196":
+ notevil = (notevil + 196)/2;
+ break;
+case "z197":
+ notevil = (notevil + 197)/2;
+ break;
+case "z198":
+ notevil = (notevil + 198)/2;
+ break;
+case "z199":
+ notevil = (notevil + 199)/2;
+ break;
+case "z200":
+ notevil = (notevil + 200)/2;
+ break;
+case "z201":
+ notevil = (notevil + 201)/2;
+ break;
+case "z202":
+ notevil = (notevil + 202)/2;
+ break;
+case "z203":
+ notevil = (notevil + 203)/2;
+ break;
+case "z204":
+ notevil = (notevil + 204)/2;
+ break;
+case "z205":
+ notevil = (notevil + 205)/2;
+ break;
+case "z206":
+ notevil = (notevil + 206)/2;
+ break;
+case "z207":
+ notevil = (notevil + 207)/2;
+ break;
+case "z208":
+ notevil = (notevil + 208)/2;
+ break;
+case "z209":
+ notevil = (notevil + 209)/2;
+ break;
+case "z210":
+ notevil = (notevil + 210)/2;
+ break;
+case "z211":
+ notevil = (notevil + 211)/2;
+ break;
+case "z212":
+ notevil = (notevil + 212)/2;
+ break;
+case "z213":
+ notevil = (notevil + 213)/2;
+ break;
+case "z214":
+ notevil = (notevil + 214)/2;
+ break;
+case "z215":
+ notevil = (notevil + 215)/2;
+ break;
+case "z216":
+ notevil = (notevil + 216)/2;
+ break;
+case "z217":
+ notevil = (notevil + 217)/2;
+ break;
+case "z218":
+ notevil = (notevil + 218)/2;
+ break;
+case "z219":
+ notevil = (notevil + 219)/2;
+ break;
+case "z220":
+ notevil = (notevil + 220)/2;
+ break;
+case "z221":
+ notevil = (notevil + 221)/2;
+ break;
+case "z222":
+ notevil = (notevil + 222)/2;
+ break;
+case "z223":
+ notevil = (notevil + 223)/2;
+ break;
+case "z224":
+ notevil = (notevil + 224)/2;
+ break;
+case "z225":
+ notevil = (notevil + 225)/2;
+ break;
+case "z226":
+ notevil = (notevil + 226)/2;
+ break;
+case "z227":
+ notevil = (notevil + 227)/2;
+ break;
+case "z228":
+ notevil = (notevil + 228)/2;
+ break;
+case "z229":
+ notevil = (notevil + 229)/2;
+ break;
+case "z230":
+ notevil = (notevil + 230)/2;
+ break;
+case "z231":
+ notevil = (notevil + 231)/2;
+ break;
+case "z232":
+ notevil = (notevil + 232)/2;
+ break;
+case "z233":
+ notevil = (notevil + 233)/2;
+ break;
+case "z234":
+ notevil = (notevil + 234)/2;
+ break;
+case "z235":
+ notevil = (notevil + 235)/2;
+ break;
+case "z236":
+ notevil = (notevil + 236)/2;
+ break;
+case "z237":
+ notevil = (notevil + 237)/2;
+ break;
+case "z238":
+ notevil = (notevil + 238)/2;
+ break;
+case "z239":
+ notevil = (notevil + 239)/2;
+ break;
+case "z240":
+ notevil = (notevil + 240)/2;
+ break;
+case "z241":
+ notevil = (notevil + 241)/2;
+ break;
+case "z242":
+ notevil = (notevil + 242)/2;
+ break;
+case "z243":
+ notevil = (notevil + 243)/2;
+ break;
+case "z244":
+ notevil = (notevil + 244)/2;
+ break;
+case "z245":
+ notevil = (notevil + 245)/2;
+ break;
+case "z246":
+ notevil = (notevil + 246)/2;
+ break;
+case "z247":
+ notevil = (notevil + 247)/2;
+ break;
+case "z248":
+ notevil = (notevil + 248)/2;
+ break;
+case "z249":
+ notevil = (notevil + 249)/2;
+ break;
+case "z250":
+ notevil = (notevil + 250)/2;
+ break;
+case "z251":
+ notevil = (notevil + 251)/2;
+ break;
+case "z252":
+ notevil = (notevil + 252)/2;
+ break;
+case "z253":
+ notevil = (notevil + 253)/2;
+ break;
+case "z254":
+ notevil = (notevil + 254)/2;
+ break;
+case "z255":
+ notevil = (notevil + 255)/2;
+ break;
+case "z256":
+ notevil = (notevil + 256)/2;
+ break;
+case "z257":
+ notevil = (notevil + 257)/2;
+ break;
+case "z258":
+ notevil = (notevil + 258)/2;
+ break;
+case "z259":
+ notevil = (notevil + 259)/2;
+ break;
+case "z260":
+ notevil = (notevil + 260)/2;
+ break;
+case "z261":
+ notevil = (notevil + 261)/2;
+ break;
+case "z262":
+ notevil = (notevil + 262)/2;
+ break;
+case "z263":
+ notevil = (notevil + 263)/2;
+ break;
+case "z264":
+ notevil = (notevil + 264)/2;
+ break;
+case "z265":
+ notevil = (notevil + 265)/2;
+ break;
+case "z266":
+ notevil = (notevil + 266)/2;
+ break;
+case "z267":
+ notevil = (notevil + 267)/2;
+ break;
+case "z268":
+ notevil = (notevil + 268)/2;
+ break;
+case "z269":
+ notevil = (notevil + 269)/2;
+ break;
+case "z270":
+ notevil = (notevil + 270)/2;
+ break;
+case "z271":
+ notevil = (notevil + 271)/2;
+ break;
+case "z272":
+ notevil = (notevil + 272)/2;
+ break;
+case "z273":
+ notevil = (notevil + 273)/2;
+ break;
+case "z274":
+ notevil = (notevil + 274)/2;
+ break;
+case "z275":
+ notevil = (notevil + 275)/2;
+ break;
+case "z276":
+ notevil = (notevil + 276)/2;
+ break;
+case "z277":
+ notevil = (notevil + 277)/2;
+ break;
+case "z278":
+ notevil = (notevil + 278)/2;
+ break;
+case "z279":
+ notevil = (notevil + 279)/2;
+ break;
+case "z280":
+ notevil = (notevil + 280)/2;
+ break;
+case "z281":
+ notevil = (notevil + 281)/2;
+ break;
+case "z282":
+ notevil = (notevil + 282)/2;
+ break;
+case "z283":
+ notevil = (notevil + 283)/2;
+ break;
+case "z284":
+ notevil = (notevil + 284)/2;
+ break;
+case "z285":
+ notevil = (notevil + 285)/2;
+ break;
+case "z286":
+ notevil = (notevil + 286)/2;
+ break;
+case "z287":
+ notevil = (notevil + 287)/2;
+ break;
+case "z288":
+ notevil = (notevil + 288)/2;
+ break;
+case "z289":
+ notevil = (notevil + 289)/2;
+ break;
+case "z290":
+ notevil = (notevil + 290)/2;
+ break;
+case "z291":
+ notevil = (notevil + 291)/2;
+ break;
+case "z292":
+ notevil = (notevil + 292)/2;
+ break;
+case "z293":
+ notevil = (notevil + 293)/2;
+ break;
+case "z294":
+ notevil = (notevil + 294)/2;
+ break;
+case "z295":
+ notevil = (notevil + 295)/2;
+ break;
+case "z296":
+ notevil = (notevil + 296)/2;
+ break;
+case "z297":
+ notevil = (notevil + 297)/2;
+ break;
+case "z298":
+ notevil = (notevil + 298)/2;
+ break;
+case "z299":
+ notevil = (notevil + 299)/2;
+ break;
+case "z300":
+ notevil = (notevil + 300)/2;
+ break;
+case "z301":
+ notevil = (notevil + 301)/2;
+ break;
+case "z302":
+ notevil = (notevil + 302)/2;
+ break;
+case "z303":
+ notevil = (notevil + 303)/2;
+ break;
+case "z304":
+ notevil = (notevil + 304)/2;
+ break;
+case "z305":
+ notevil = (notevil + 305)/2;
+ break;
+case "z306":
+ notevil = (notevil + 306)/2;
+ break;
+case "z307":
+ notevil = (notevil + 307)/2;
+ break;
+case "z308":
+ notevil = (notevil + 308)/2;
+ break;
+case "z309":
+ notevil = (notevil + 309)/2;
+ break;
+case "z310":
+ notevil = (notevil + 310)/2;
+ break;
+case "z311":
+ notevil = (notevil + 311)/2;
+ break;
+case "z312":
+ notevil = (notevil + 312)/2;
+ break;
+case "z313":
+ notevil = (notevil + 313)/2;
+ break;
+case "z314":
+ notevil = (notevil + 314)/2;
+ break;
+case "z315":
+ notevil = (notevil + 315)/2;
+ break;
+case "z316":
+ notevil = (notevil + 316)/2;
+ break;
+case "z317":
+ notevil = (notevil + 317)/2;
+ break;
+case "z318":
+ notevil = (notevil + 318)/2;
+ break;
+case "z319":
+ notevil = (notevil + 319)/2;
+ break;
+case "z320":
+ notevil = (notevil + 320)/2;
+ break;
+case "z321":
+ notevil = (notevil + 321)/2;
+ break;
+case "z322":
+ notevil = (notevil + 322)/2;
+ break;
+case "z323":
+ notevil = (notevil + 323)/2;
+ break;
+case "z324":
+ notevil = (notevil + 324)/2;
+ break;
+case "z325":
+ notevil = (notevil + 325)/2;
+ break;
+case "z326":
+ notevil = (notevil + 326)/2;
+ break;
+case "z327":
+ notevil = (notevil + 327)/2;
+ break;
+case "z328":
+ notevil = (notevil + 328)/2;
+ break;
+case "z329":
+ notevil = (notevil + 329)/2;
+ break;
+case "z330":
+ notevil = (notevil + 330)/2;
+ break;
+case "z331":
+ notevil = (notevil + 331)/2;
+ break;
+case "z332":
+ notevil = (notevil + 332)/2;
+ break;
+case "z333":
+ notevil = (notevil + 333)/2;
+ break;
+case "z334":
+ notevil = (notevil + 334)/2;
+ break;
+case "z335":
+ notevil = (notevil + 335)/2;
+ break;
+case "z336":
+ notevil = (notevil + 336)/2;
+ break;
+case "z337":
+ notevil = (notevil + 337)/2;
+ break;
+case "z338":
+ notevil = (notevil + 338)/2;
+ break;
+case "z339":
+ notevil = (notevil + 339)/2;
+ break;
+case "z340":
+ notevil = (notevil + 340)/2;
+ break;
+case "z341":
+ notevil = (notevil + 341)/2;
+ break;
+case "z342":
+ notevil = (notevil + 342)/2;
+ break;
+case "z343":
+ notevil = (notevil + 343)/2;
+ break;
+case "z344":
+ notevil = (notevil + 344)/2;
+ break;
+case "z345":
+ notevil = (notevil + 345)/2;
+ break;
+case "z346":
+ notevil = (notevil + 346)/2;
+ break;
+case "z347":
+ notevil = (notevil + 347)/2;
+ break;
+case "z348":
+ notevil = (notevil + 348)/2;
+ break;
+case "z349":
+ notevil = (notevil + 349)/2;
+ break;
+case "z350":
+ notevil = (notevil + 350)/2;
+ break;
+case "z351":
+ notevil = (notevil + 351)/2;
+ break;
+case "z352":
+ notevil = (notevil + 352)/2;
+ break;
+case "z353":
+ notevil = (notevil + 353)/2;
+ break;
+case "z354":
+ notevil = (notevil + 354)/2;
+ break;
+case "z355":
+ notevil = (notevil + 355)/2;
+ break;
+case "z356":
+ notevil = (notevil + 356)/2;
+ break;
+case "z357":
+ notevil = (notevil + 357)/2;
+ break;
+case "z358":
+ notevil = (notevil + 358)/2;
+ break;
+case "z359":
+ notevil = (notevil + 359)/2;
+ break;
+case "z360":
+ notevil = (notevil + 360)/2;
+ break;
+case "z361":
+ notevil = (notevil + 361)/2;
+ break;
+case "z362":
+ notevil = (notevil + 362)/2;
+ break;
+case "z363":
+ notevil = (notevil + 363)/2;
+ break;
+case "z364":
+ notevil = (notevil + 364)/2;
+ break;
+case "z365":
+ notevil = (notevil + 365)/2;
+ break;
+case "z366":
+ notevil = (notevil + 366)/2;
+ break;
+case "z367":
+ notevil = (notevil + 367)/2;
+ break;
+case "z368":
+ notevil = (notevil + 368)/2;
+ break;
+case "z369":
+ notevil = (notevil + 369)/2;
+ break;
+case "z370":
+ notevil = (notevil + 370)/2;
+ break;
+case "z371":
+ notevil = (notevil + 371)/2;
+ break;
+case "z372":
+ notevil = (notevil + 372)/2;
+ break;
+case "z373":
+ notevil = (notevil + 373)/2;
+ break;
+case "z374":
+ notevil = (notevil + 374)/2;
+ break;
+case "z375":
+ notevil = (notevil + 375)/2;
+ break;
+case "z376":
+ notevil = (notevil + 376)/2;
+ break;
+case "z377":
+ notevil = (notevil + 377)/2;
+ break;
+case "z378":
+ notevil = (notevil + 378)/2;
+ break;
+case "z379":
+ notevil = (notevil + 379)/2;
+ break;
+case "z380":
+ notevil = (notevil + 380)/2;
+ break;
+case "z381":
+ notevil = (notevil + 381)/2;
+ break;
+case "z382":
+ notevil = (notevil + 382)/2;
+ break;
+case "z383":
+ notevil = (notevil + 383)/2;
+ break;
+case "z384":
+ notevil = (notevil + 384)/2;
+ break;
+case "z385":
+ notevil = (notevil + 385)/2;
+ break;
+case "z386":
+ notevil = (notevil + 386)/2;
+ break;
+case "z387":
+ notevil = (notevil + 387)/2;
+ break;
+case "z388":
+ notevil = (notevil + 388)/2;
+ break;
+case "z389":
+ notevil = (notevil + 389)/2;
+ break;
+case "z390":
+ notevil = (notevil + 390)/2;
+ break;
+case "z391":
+ notevil = (notevil + 391)/2;
+ break;
+case "z392":
+ notevil = (notevil + 392)/2;
+ break;
+case "z393":
+ notevil = (notevil + 393)/2;
+ break;
+case "z394":
+ notevil = (notevil + 394)/2;
+ break;
+case "z395":
+ notevil = (notevil + 395)/2;
+ break;
+case "z396":
+ notevil = (notevil + 396)/2;
+ break;
+case "z397":
+ notevil = (notevil + 397)/2;
+ break;
+case "z398":
+ notevil = (notevil + 398)/2;
+ break;
+case "z399":
+ notevil = (notevil + 399)/2;
+ break;
+case "z400":
+ notevil = (notevil + 400)/2;
+ break;
+case "z401":
+ notevil = (notevil + 401)/2;
+ break;
+case "z402":
+ notevil = (notevil + 402)/2;
+ break;
+case "z403":
+ notevil = (notevil + 403)/2;
+ break;
+case "z404":
+ notevil = (notevil + 404)/2;
+ break;
+case "z405":
+ notevil = (notevil + 405)/2;
+ break;
+case "z406":
+ notevil = (notevil + 406)/2;
+ break;
+case "z407":
+ notevil = (notevil + 407)/2;
+ break;
+case "z408":
+ notevil = (notevil + 408)/2;
+ break;
+case "z409":
+ notevil = (notevil + 409)/2;
+ break;
+case "z410":
+ notevil = (notevil + 410)/2;
+ break;
+case "z411":
+ notevil = (notevil + 411)/2;
+ break;
+case "z412":
+ notevil = (notevil + 412)/2;
+ break;
+case "z413":
+ notevil = (notevil + 413)/2;
+ break;
+case "z414":
+ notevil = (notevil + 414)/2;
+ break;
+case "z415":
+ notevil = (notevil + 415)/2;
+ break;
+case "z416":
+ notevil = (notevil + 416)/2;
+ break;
+case "z417":
+ notevil = (notevil + 417)/2;
+ break;
+case "z418":
+ notevil = (notevil + 418)/2;
+ break;
+case "z419":
+ notevil = (notevil + 419)/2;
+ break;
+case "z420":
+ notevil = (notevil + 420)/2;
+ break;
+case "z421":
+ notevil = (notevil + 421)/2;
+ break;
+case "z422":
+ notevil = (notevil + 422)/2;
+ break;
+case "z423":
+ notevil = (notevil + 423)/2;
+ break;
+case "z424":
+ notevil = (notevil + 424)/2;
+ break;
+case "z425":
+ notevil = (notevil + 425)/2;
+ break;
+case "z426":
+ notevil = (notevil + 426)/2;
+ break;
+case "z427":
+ notevil = (notevil + 427)/2;
+ break;
+case "z428":
+ notevil = (notevil + 428)/2;
+ break;
+case "z429":
+ notevil = (notevil + 429)/2;
+ break;
+case "z430":
+ notevil = (notevil + 430)/2;
+ break;
+case "z431":
+ notevil = (notevil + 431)/2;
+ break;
+case "z432":
+ notevil = (notevil + 432)/2;
+ break;
+case "z433":
+ notevil = (notevil + 433)/2;
+ break;
+case "z434":
+ notevil = (notevil + 434)/2;
+ break;
+case "z435":
+ notevil = (notevil + 435)/2;
+ break;
+case "z436":
+ notevil = (notevil + 436)/2;
+ break;
+case "z437":
+ notevil = (notevil + 437)/2;
+ break;
+case "z438":
+ notevil = (notevil + 438)/2;
+ break;
+case "z439":
+ notevil = (notevil + 439)/2;
+ break;
+case "z440":
+ notevil = (notevil + 440)/2;
+ break;
+case "z441":
+ notevil = (notevil + 441)/2;
+ break;
+case "z442":
+ notevil = (notevil + 442)/2;
+ break;
+case "z443":
+ notevil = (notevil + 443)/2;
+ break;
+case "z444":
+ notevil = (notevil + 444)/2;
+ break;
+case "z445":
+ notevil = (notevil + 445)/2;
+ break;
+case "z446":
+ notevil = (notevil + 446)/2;
+ break;
+case "z447":
+ notevil = (notevil + 447)/2;
+ break;
+case "z448":
+ notevil = (notevil + 448)/2;
+ break;
+case "z449":
+ notevil = (notevil + 449)/2;
+ break;
+case "z450":
+ notevil = (notevil + 450)/2;
+ break;
+case "z451":
+ notevil = (notevil + 451)/2;
+ break;
+case "z452":
+ notevil = (notevil + 452)/2;
+ break;
+case "z453":
+ notevil = (notevil + 453)/2;
+ break;
+case "z454":
+ notevil = (notevil + 454)/2;
+ break;
+case "z455":
+ notevil = (notevil + 455)/2;
+ break;
+case "z456":
+ notevil = (notevil + 456)/2;
+ break;
+case "z457":
+ notevil = (notevil + 457)/2;
+ break;
+case "z458":
+ notevil = (notevil + 458)/2;
+ break;
+case "z459":
+ notevil = (notevil + 459)/2;
+ break;
+case "z460":
+ notevil = (notevil + 460)/2;
+ break;
+case "z461":
+ notevil = (notevil + 461)/2;
+ break;
+case "z462":
+ notevil = (notevil + 462)/2;
+ break;
+case "z463":
+ notevil = (notevil + 463)/2;
+ break;
+case "z464":
+ notevil = (notevil + 464)/2;
+ break;
+case "z465":
+ notevil = (notevil + 465)/2;
+ break;
+case "z466":
+ notevil = (notevil + 466)/2;
+ break;
+case "z467":
+ notevil = (notevil + 467)/2;
+ break;
+case "z468":
+ notevil = (notevil + 468)/2;
+ break;
+case "z469":
+ notevil = (notevil + 469)/2;
+ break;
+case "z470":
+ notevil = (notevil + 470)/2;
+ break;
+case "z471":
+ notevil = (notevil + 471)/2;
+ break;
+case "z472":
+ notevil = (notevil + 472)/2;
+ break;
+case "z473":
+ notevil = (notevil + 473)/2;
+ break;
+case "z474":
+ notevil = (notevil + 474)/2;
+ break;
+case "z475":
+ notevil = (notevil + 475)/2;
+ break;
+case "z476":
+ notevil = (notevil + 476)/2;
+ break;
+case "z477":
+ notevil = (notevil + 477)/2;
+ break;
+case "z478":
+ notevil = (notevil + 478)/2;
+ break;
+case "z479":
+ notevil = (notevil + 479)/2;
+ break;
+case "z480":
+ notevil = (notevil + 480)/2;
+ break;
+case "z481":
+ notevil = (notevil + 481)/2;
+ break;
+case "z482":
+ notevil = (notevil + 482)/2;
+ break;
+case "z483":
+ notevil = (notevil + 483)/2;
+ break;
+case "z484":
+ notevil = (notevil + 484)/2;
+ break;
+case "z485":
+ notevil = (notevil + 485)/2;
+ break;
+case "z486":
+ notevil = (notevil + 486)/2;
+ break;
+case "z487":
+ notevil = (notevil + 487)/2;
+ break;
+case "z488":
+ notevil = (notevil + 488)/2;
+ break;
+case "z489":
+ notevil = (notevil + 489)/2;
+ break;
+case "z490":
+ notevil = (notevil + 490)/2;
+ break;
+case "z491":
+ notevil = (notevil + 491)/2;
+ break;
+case "z492":
+ notevil = (notevil + 492)/2;
+ break;
+case "z493":
+ notevil = (notevil + 493)/2;
+ break;
+case "z494":
+ notevil = (notevil + 494)/2;
+ break;
+case "z495":
+ notevil = (notevil + 495)/2;
+ break;
+case "z496":
+ notevil = (notevil + 496)/2;
+ break;
+case "z497":
+ notevil = (notevil + 497)/2;
+ break;
+case "z498":
+ notevil = (notevil + 498)/2;
+ break;
+case "z499":
+ notevil = (notevil + 499)/2;
+ break;
+case "z500":
+ notevil = (notevil + 500)/2;
+ break;
+case "z501":
+ notevil = (notevil + 501)/2;
+ break;
+case "z502":
+ notevil = (notevil + 502)/2;
+ break;
+case "z503":
+ notevil = (notevil + 503)/2;
+ break;
+case "z504":
+ notevil = (notevil + 504)/2;
+ break;
+case "z505":
+ notevil = (notevil + 505)/2;
+ break;
+case "z506":
+ notevil = (notevil + 506)/2;
+ break;
+case "z507":
+ notevil = (notevil + 507)/2;
+ break;
+case "z508":
+ notevil = (notevil + 508)/2;
+ break;
+case "z509":
+ notevil = (notevil + 509)/2;
+ break;
+case "z510":
+ notevil = (notevil + 510)/2;
+ break;
+case "z511":
+ notevil = (notevil + 511)/2;
+ break;
+case "z512":
+ notevil = (notevil + 512)/2;
+ break;
+case "z513":
+ notevil = (notevil + 513)/2;
+ break;
+case "z514":
+ notevil = (notevil + 514)/2;
+ break;
+case "z515":
+ notevil = (notevil + 515)/2;
+ break;
+case "z516":
+ notevil = (notevil + 516)/2;
+ break;
+case "z517":
+ notevil = (notevil + 517)/2;
+ break;
+case "z518":
+ notevil = (notevil + 518)/2;
+ break;
+case "z519":
+ notevil = (notevil + 519)/2;
+ break;
+case "z520":
+ notevil = (notevil + 520)/2;
+ break;
+case "z521":
+ notevil = (notevil + 521)/2;
+ break;
+case "z522":
+ notevil = (notevil + 522)/2;
+ break;
+case "z523":
+ notevil = (notevil + 523)/2;
+ break;
+case "z524":
+ notevil = (notevil + 524)/2;
+ break;
+case "z525":
+ notevil = (notevil + 525)/2;
+ break;
+case "z526":
+ notevil = (notevil + 526)/2;
+ break;
+case "z527":
+ notevil = (notevil + 527)/2;
+ break;
+case "z528":
+ notevil = (notevil + 528)/2;
+ break;
+case "z529":
+ notevil = (notevil + 529)/2;
+ break;
+case "z530":
+ notevil = (notevil + 530)/2;
+ break;
+case "z531":
+ notevil = (notevil + 531)/2;
+ break;
+case "z532":
+ notevil = (notevil + 532)/2;
+ break;
+case "z533":
+ notevil = (notevil + 533)/2;
+ break;
+case "z534":
+ notevil = (notevil + 534)/2;
+ break;
+case "z535":
+ notevil = (notevil + 535)/2;
+ break;
+case "z536":
+ notevil = (notevil + 536)/2;
+ break;
+case "z537":
+ notevil = (notevil + 537)/2;
+ break;
+case "z538":
+ notevil = (notevil + 538)/2;
+ break;
+case "z539":
+ notevil = (notevil + 539)/2;
+ break;
+case "z540":
+ notevil = (notevil + 540)/2;
+ break;
+case "z541":
+ notevil = (notevil + 541)/2;
+ break;
+case "z542":
+ notevil = (notevil + 542)/2;
+ break;
+case "z543":
+ notevil = (notevil + 543)/2;
+ break;
+case "z544":
+ notevil = (notevil + 544)/2;
+ break;
+case "z545":
+ notevil = (notevil + 545)/2;
+ break;
+case "z546":
+ notevil = (notevil + 546)/2;
+ break;
+case "z547":
+ notevil = (notevil + 547)/2;
+ break;
+case "z548":
+ notevil = (notevil + 548)/2;
+ break;
+case "z549":
+ notevil = (notevil + 549)/2;
+ break;
+case "z550":
+ notevil = (notevil + 550)/2;
+ break;
+case "z551":
+ notevil = (notevil + 551)/2;
+ break;
+case "z552":
+ notevil = (notevil + 552)/2;
+ break;
+case "z553":
+ notevil = (notevil + 553)/2;
+ break;
+case "z554":
+ notevil = (notevil + 554)/2;
+ break;
+case "z555":
+ notevil = (notevil + 555)/2;
+ break;
+case "z556":
+ notevil = (notevil + 556)/2;
+ break;
+case "z557":
+ notevil = (notevil + 557)/2;
+ break;
+case "z558":
+ notevil = (notevil + 558)/2;
+ break;
+case "z559":
+ notevil = (notevil + 559)/2;
+ break;
+case "z560":
+ notevil = (notevil + 560)/2;
+ break;
+case "z561":
+ notevil = (notevil + 561)/2;
+ break;
+case "z562":
+ notevil = (notevil + 562)/2;
+ break;
+case "z563":
+ notevil = (notevil + 563)/2;
+ break;
+case "z564":
+ notevil = (notevil + 564)/2;
+ break;
+case "z565":
+ notevil = (notevil + 565)/2;
+ break;
+case "z566":
+ notevil = (notevil + 566)/2;
+ break;
+case "z567":
+ notevil = (notevil + 567)/2;
+ break;
+case "z568":
+ notevil = (notevil + 568)/2;
+ break;
+case "z569":
+ notevil = (notevil + 569)/2;
+ break;
+case "z570":
+ notevil = (notevil + 570)/2;
+ break;
+case "z571":
+ notevil = (notevil + 571)/2;
+ break;
+case "z572":
+ notevil = (notevil + 572)/2;
+ break;
+case "z573":
+ notevil = (notevil + 573)/2;
+ break;
+case "z574":
+ notevil = (notevil + 574)/2;
+ break;
+case "z575":
+ notevil = (notevil + 575)/2;
+ break;
+case "z576":
+ notevil = (notevil + 576)/2;
+ break;
+case "z577":
+ notevil = (notevil + 577)/2;
+ break;
+case "z578":
+ notevil = (notevil + 578)/2;
+ break;
+case "z579":
+ notevil = (notevil + 579)/2;
+ break;
+case "z580":
+ notevil = (notevil + 580)/2;
+ break;
+case "z581":
+ notevil = (notevil + 581)/2;
+ break;
+case "z582":
+ notevil = (notevil + 582)/2;
+ break;
+case "z583":
+ notevil = (notevil + 583)/2;
+ break;
+case "z584":
+ notevil = (notevil + 584)/2;
+ break;
+case "z585":
+ notevil = (notevil + 585)/2;
+ break;
+case "z586":
+ notevil = (notevil + 586)/2;
+ break;
+case "z587":
+ notevil = (notevil + 587)/2;
+ break;
+case "z588":
+ notevil = (notevil + 588)/2;
+ break;
+case "z589":
+ notevil = (notevil + 589)/2;
+ break;
+case "z590":
+ notevil = (notevil + 590)/2;
+ break;
+case "z591":
+ notevil = (notevil + 591)/2;
+ break;
+case "z592":
+ notevil = (notevil + 592)/2;
+ break;
+case "z593":
+ notevil = (notevil + 593)/2;
+ break;
+case "z594":
+ notevil = (notevil + 594)/2;
+ break;
+case "z595":
+ notevil = (notevil + 595)/2;
+ break;
+case "z596":
+ notevil = (notevil + 596)/2;
+ break;
+case "z597":
+ notevil = (notevil + 597)/2;
+ break;
+case "z598":
+ notevil = (notevil + 598)/2;
+ break;
+case "z599":
+ notevil = (notevil + 599)/2;
+ break;
+case "z600":
+ notevil = (notevil + 600)/2;
+ break;
+case "z601":
+ notevil = (notevil + 601)/2;
+ break;
+case "z602":
+ notevil = (notevil + 602)/2;
+ break;
+case "z603":
+ notevil = (notevil + 603)/2;
+ break;
+case "z604":
+ notevil = (notevil + 604)/2;
+ break;
+case "z605":
+ notevil = (notevil + 605)/2;
+ break;
+case "z606":
+ notevil = (notevil + 606)/2;
+ break;
+case "z607":
+ notevil = (notevil + 607)/2;
+ break;
+case "z608":
+ notevil = (notevil + 608)/2;
+ break;
+case "z609":
+ notevil = (notevil + 609)/2;
+ break;
+case "z610":
+ notevil = (notevil + 610)/2;
+ break;
+case "z611":
+ notevil = (notevil + 611)/2;
+ break;
+case "z612":
+ notevil = (notevil + 612)/2;
+ break;
+case "z613":
+ notevil = (notevil + 613)/2;
+ break;
+case "z614":
+ notevil = (notevil + 614)/2;
+ break;
+case "z615":
+ notevil = (notevil + 615)/2;
+ break;
+case "z616":
+ notevil = (notevil + 616)/2;
+ break;
+case "z617":
+ notevil = (notevil + 617)/2;
+ break;
+case "z618":
+ notevil = (notevil + 618)/2;
+ break;
+case "z619":
+ notevil = (notevil + 619)/2;
+ break;
+case "z620":
+ notevil = (notevil + 620)/2;
+ break;
+case "z621":
+ notevil = (notevil + 621)/2;
+ break;
+case "z622":
+ notevil = (notevil + 622)/2;
+ break;
+case "z623":
+ notevil = (notevil + 623)/2;
+ break;
+case "z624":
+ notevil = (notevil + 624)/2;
+ break;
+case "z625":
+ notevil = (notevil + 625)/2;
+ break;
+case "z626":
+ notevil = (notevil + 626)/2;
+ break;
+case "z627":
+ notevil = (notevil + 627)/2;
+ break;
+case "z628":
+ notevil = (notevil + 628)/2;
+ break;
+case "z629":
+ notevil = (notevil + 629)/2;
+ break;
+case "z630":
+ notevil = (notevil + 630)/2;
+ break;
+case "z631":
+ notevil = (notevil + 631)/2;
+ break;
+case "z632":
+ notevil = (notevil + 632)/2;
+ break;
+case "z633":
+ notevil = (notevil + 633)/2;
+ break;
+case "z634":
+ notevil = (notevil + 634)/2;
+ break;
+case "z635":
+ notevil = (notevil + 635)/2;
+ break;
+case "z636":
+ notevil = (notevil + 636)/2;
+ break;
+case "z637":
+ notevil = (notevil + 637)/2;
+ break;
+case "z638":
+ notevil = (notevil + 638)/2;
+ break;
+case "z639":
+ notevil = (notevil + 639)/2;
+ break;
+case "z640":
+ notevil = (notevil + 640)/2;
+ break;
+case "z641":
+ notevil = (notevil + 641)/2;
+ break;
+case "z642":
+ notevil = (notevil + 642)/2;
+ break;
+case "z643":
+ notevil = (notevil + 643)/2;
+ break;
+case "z644":
+ notevil = (notevil + 644)/2;
+ break;
+case "z645":
+ notevil = (notevil + 645)/2;
+ break;
+case "z646":
+ notevil = (notevil + 646)/2;
+ break;
+case "z647":
+ notevil = (notevil + 647)/2;
+ break;
+case "z648":
+ notevil = (notevil + 648)/2;
+ break;
+case "z649":
+ notevil = (notevil + 649)/2;
+ break;
+case "z650":
+ notevil = (notevil + 650)/2;
+ break;
+case "z651":
+ notevil = (notevil + 651)/2;
+ break;
+case "z652":
+ notevil = (notevil + 652)/2;
+ break;
+case "z653":
+ notevil = (notevil + 653)/2;
+ break;
+case "z654":
+ notevil = (notevil + 654)/2;
+ break;
+case "z655":
+ notevil = (notevil + 655)/2;
+ break;
+case "z656":
+ notevil = (notevil + 656)/2;
+ break;
+case "z657":
+ notevil = (notevil + 657)/2;
+ break;
+case "z658":
+ notevil = (notevil + 658)/2;
+ break;
+case "z659":
+ notevil = (notevil + 659)/2;
+ break;
+case "z660":
+ notevil = (notevil + 660)/2;
+ break;
+case "z661":
+ notevil = (notevil + 661)/2;
+ break;
+case "z662":
+ notevil = (notevil + 662)/2;
+ break;
+case "z663":
+ notevil = (notevil + 663)/2;
+ break;
+case "z664":
+ notevil = (notevil + 664)/2;
+ break;
+case "z665":
+ notevil = (notevil + 665)/2;
+ break;
+case "z666":
+ notevil = (notevil + 666)/2;
+ break;
+case "z667":
+ notevil = (notevil + 667)/2;
+ break;
+case "z668":
+ notevil = (notevil + 668)/2;
+ break;
+case "z669":
+ notevil = (notevil + 669)/2;
+ break;
+case "z670":
+ notevil = (notevil + 670)/2;
+ break;
+case "z671":
+ notevil = (notevil + 671)/2;
+ break;
+case "z672":
+ notevil = (notevil + 672)/2;
+ break;
+case "z673":
+ notevil = (notevil + 673)/2;
+ break;
+case "z674":
+ notevil = (notevil + 674)/2;
+ break;
+case "z675":
+ notevil = (notevil + 675)/2;
+ break;
+case "z676":
+ notevil = (notevil + 676)/2;
+ break;
+case "z677":
+ notevil = (notevil + 677)/2;
+ break;
+case "z678":
+ notevil = (notevil + 678)/2;
+ break;
+case "z679":
+ notevil = (notevil + 679)/2;
+ break;
+case "z680":
+ notevil = (notevil + 680)/2;
+ break;
+case "z681":
+ notevil = (notevil + 681)/2;
+ break;
+case "z682":
+ notevil = (notevil + 682)/2;
+ break;
+case "z683":
+ notevil = (notevil + 683)/2;
+ break;
+case "z684":
+ notevil = (notevil + 684)/2;
+ break;
+case "z685":
+ notevil = (notevil + 685)/2;
+ break;
+case "z686":
+ notevil = (notevil + 686)/2;
+ break;
+case "z687":
+ notevil = (notevil + 687)/2;
+ break;
+case "z688":
+ notevil = (notevil + 688)/2;
+ break;
+case "z689":
+ notevil = (notevil + 689)/2;
+ break;
+case "z690":
+ notevil = (notevil + 690)/2;
+ break;
+case "z691":
+ notevil = (notevil + 691)/2;
+ break;
+case "z692":
+ notevil = (notevil + 692)/2;
+ break;
+case "z693":
+ notevil = (notevil + 693)/2;
+ break;
+case "z694":
+ notevil = (notevil + 694)/2;
+ break;
+case "z695":
+ notevil = (notevil + 695)/2;
+ break;
+case "z696":
+ notevil = (notevil + 696)/2;
+ break;
+case "z697":
+ notevil = (notevil + 697)/2;
+ break;
+case "z698":
+ notevil = (notevil + 698)/2;
+ break;
+case "z699":
+ notevil = (notevil + 699)/2;
+ break;
+case "z700":
+ notevil = (notevil + 700)/2;
+ break;
+case "z701":
+ notevil = (notevil + 701)/2;
+ break;
+case "z702":
+ notevil = (notevil + 702)/2;
+ break;
+case "z703":
+ notevil = (notevil + 703)/2;
+ break;
+case "z704":
+ notevil = (notevil + 704)/2;
+ break;
+case "z705":
+ notevil = (notevil + 705)/2;
+ break;
+case "z706":
+ notevil = (notevil + 706)/2;
+ break;
+case "z707":
+ notevil = (notevil + 707)/2;
+ break;
+case "z708":
+ notevil = (notevil + 708)/2;
+ break;
+case "z709":
+ notevil = (notevil + 709)/2;
+ break;
+case "z710":
+ notevil = (notevil + 710)/2;
+ break;
+case "z711":
+ notevil = (notevil + 711)/2;
+ break;
+case "z712":
+ notevil = (notevil + 712)/2;
+ break;
+case "z713":
+ notevil = (notevil + 713)/2;
+ break;
+case "z714":
+ notevil = (notevil + 714)/2;
+ break;
+case "z715":
+ notevil = (notevil + 715)/2;
+ break;
+case "z716":
+ notevil = (notevil + 716)/2;
+ break;
+case "z717":
+ notevil = (notevil + 717)/2;
+ break;
+case "z718":
+ notevil = (notevil + 718)/2;
+ break;
+case "z719":
+ notevil = (notevil + 719)/2;
+ break;
+case "z720":
+ notevil = (notevil + 720)/2;
+ break;
+case "z721":
+ notevil = (notevil + 721)/2;
+ break;
+case "z722":
+ notevil = (notevil + 722)/2;
+ break;
+case "z723":
+ notevil = (notevil + 723)/2;
+ break;
+case "z724":
+ notevil = (notevil + 724)/2;
+ break;
+case "z725":
+ notevil = (notevil + 725)/2;
+ break;
+case "z726":
+ notevil = (notevil + 726)/2;
+ break;
+case "z727":
+ notevil = (notevil + 727)/2;
+ break;
+case "z728":
+ notevil = (notevil + 728)/2;
+ break;
+case "z729":
+ notevil = (notevil + 729)/2;
+ break;
+case "z730":
+ notevil = (notevil + 730)/2;
+ break;
+case "z731":
+ notevil = (notevil + 731)/2;
+ break;
+case "z732":
+ notevil = (notevil + 732)/2;
+ break;
+case "z733":
+ notevil = (notevil + 733)/2;
+ break;
+case "z734":
+ notevil = (notevil + 734)/2;
+ break;
+case "z735":
+ notevil = (notevil + 735)/2;
+ break;
+case "z736":
+ notevil = (notevil + 736)/2;
+ break;
+case "z737":
+ notevil = (notevil + 737)/2;
+ break;
+case "z738":
+ notevil = (notevil + 738)/2;
+ break;
+case "z739":
+ notevil = (notevil + 739)/2;
+ break;
+case "z740":
+ notevil = (notevil + 740)/2;
+ break;
+case "z741":
+ notevil = (notevil + 741)/2;
+ break;
+case "z742":
+ notevil = (notevil + 742)/2;
+ break;
+case "z743":
+ notevil = (notevil + 743)/2;
+ break;
+case "z744":
+ notevil = (notevil + 744)/2;
+ break;
+case "z745":
+ notevil = (notevil + 745)/2;
+ break;
+case "z746":
+ notevil = (notevil + 746)/2;
+ break;
+case "z747":
+ notevil = (notevil + 747)/2;
+ break;
+case "z748":
+ notevil = (notevil + 748)/2;
+ break;
+case "z749":
+ notevil = (notevil + 749)/2;
+ break;
+case "z750":
+ notevil = (notevil + 750)/2;
+ break;
+case "z751":
+ notevil = (notevil + 751)/2;
+ break;
+case "z752":
+ notevil = (notevil + 752)/2;
+ break;
+case "z753":
+ notevil = (notevil + 753)/2;
+ break;
+case "z754":
+ notevil = (notevil + 754)/2;
+ break;
+case "z755":
+ notevil = (notevil + 755)/2;
+ break;
+case "z756":
+ notevil = (notevil + 756)/2;
+ break;
+case "z757":
+ notevil = (notevil + 757)/2;
+ break;
+case "z758":
+ notevil = (notevil + 758)/2;
+ break;
+case "z759":
+ notevil = (notevil + 759)/2;
+ break;
+case "z760":
+ notevil = (notevil + 760)/2;
+ break;
+case "z761":
+ notevil = (notevil + 761)/2;
+ break;
+case "z762":
+ notevil = (notevil + 762)/2;
+ break;
+case "z763":
+ notevil = (notevil + 763)/2;
+ break;
+case "z764":
+ notevil = (notevil + 764)/2;
+ break;
+case "z765":
+ notevil = (notevil + 765)/2;
+ break;
+case "z766":
+ notevil = (notevil + 766)/2;
+ break;
+case "z767":
+ notevil = (notevil + 767)/2;
+ break;
+case "z768":
+ notevil = (notevil + 768)/2;
+ break;
+case "z769":
+ notevil = (notevil + 769)/2;
+ break;
+case "z770":
+ notevil = (notevil + 770)/2;
+ break;
+case "z771":
+ notevil = (notevil + 771)/2;
+ break;
+case "z772":
+ notevil = (notevil + 772)/2;
+ break;
+case "z773":
+ notevil = (notevil + 773)/2;
+ break;
+case "z774":
+ notevil = (notevil + 774)/2;
+ break;
+case "z775":
+ notevil = (notevil + 775)/2;
+ break;
+case "z776":
+ notevil = (notevil + 776)/2;
+ break;
+case "z777":
+ notevil = (notevil + 777)/2;
+ break;
+case "z778":
+ notevil = (notevil + 778)/2;
+ break;
+case "z779":
+ notevil = (notevil + 779)/2;
+ break;
+case "z780":
+ notevil = (notevil + 780)/2;
+ break;
+case "z781":
+ notevil = (notevil + 781)/2;
+ break;
+case "z782":
+ notevil = (notevil + 782)/2;
+ break;
+case "z783":
+ notevil = (notevil + 783)/2;
+ break;
+case "z784":
+ notevil = (notevil + 784)/2;
+ break;
+case "z785":
+ notevil = (notevil + 785)/2;
+ break;
+case "z786":
+ notevil = (notevil + 786)/2;
+ break;
+case "z787":
+ notevil = (notevil + 787)/2;
+ break;
+case "z788":
+ notevil = (notevil + 788)/2;
+ break;
+case "z789":
+ notevil = (notevil + 789)/2;
+ break;
+case "z790":
+ notevil = (notevil + 790)/2;
+ break;
+case "z791":
+ notevil = (notevil + 791)/2;
+ break;
+case "z792":
+ notevil = (notevil + 792)/2;
+ break;
+case "z793":
+ notevil = (notevil + 793)/2;
+ break;
+case "z794":
+ notevil = (notevil + 794)/2;
+ break;
+case "z795":
+ notevil = (notevil + 795)/2;
+ break;
+case "z796":
+ notevil = (notevil + 796)/2;
+ break;
+case "z797":
+ notevil = (notevil + 797)/2;
+ break;
+case "z798":
+ notevil = (notevil + 798)/2;
+ break;
+case "z799":
+ notevil = (notevil + 799)/2;
+ break;
+case "z800":
+ notevil = (notevil + 800)/2;
+ break;
+case "z801":
+ notevil = (notevil + 801)/2;
+ break;
+case "z802":
+ notevil = (notevil + 802)/2;
+ break;
+case "z803":
+ notevil = (notevil + 803)/2;
+ break;
+case "z804":
+ notevil = (notevil + 804)/2;
+ break;
+case "z805":
+ notevil = (notevil + 805)/2;
+ break;
+case "z806":
+ notevil = (notevil + 806)/2;
+ break;
+case "z807":
+ notevil = (notevil + 807)/2;
+ break;
+case "z808":
+ notevil = (notevil + 808)/2;
+ break;
+case "z809":
+ notevil = (notevil + 809)/2;
+ break;
+case "z810":
+ notevil = (notevil + 810)/2;
+ break;
+case "z811":
+ notevil = (notevil + 811)/2;
+ break;
+case "z812":
+ notevil = (notevil + 812)/2;
+ break;
+case "z813":
+ notevil = (notevil + 813)/2;
+ break;
+case "z814":
+ notevil = (notevil + 814)/2;
+ break;
+case "z815":
+ notevil = (notevil + 815)/2;
+ break;
+case "z816":
+ notevil = (notevil + 816)/2;
+ break;
+case "z817":
+ notevil = (notevil + 817)/2;
+ break;
+case "z818":
+ notevil = (notevil + 818)/2;
+ break;
+case "z819":
+ notevil = (notevil + 819)/2;
+ break;
+case "z820":
+ notevil = (notevil + 820)/2;
+ break;
+case "z821":
+ notevil = (notevil + 821)/2;
+ break;
+case "z822":
+ notevil = (notevil + 822)/2;
+ break;
+case "z823":
+ notevil = (notevil + 823)/2;
+ break;
+case "z824":
+ notevil = (notevil + 824)/2;
+ break;
+case "z825":
+ notevil = (notevil + 825)/2;
+ break;
+case "z826":
+ notevil = (notevil + 826)/2;
+ break;
+case "z827":
+ notevil = (notevil + 827)/2;
+ break;
+case "z828":
+ notevil = (notevil + 828)/2;
+ break;
+case "z829":
+ notevil = (notevil + 829)/2;
+ break;
+case "z830":
+ notevil = (notevil + 830)/2;
+ break;
+case "z831":
+ notevil = (notevil + 831)/2;
+ break;
+case "z832":
+ notevil = (notevil + 832)/2;
+ break;
+case "z833":
+ notevil = (notevil + 833)/2;
+ break;
+case "z834":
+ notevil = (notevil + 834)/2;
+ break;
+case "z835":
+ notevil = (notevil + 835)/2;
+ break;
+case "z836":
+ notevil = (notevil + 836)/2;
+ break;
+case "z837":
+ notevil = (notevil + 837)/2;
+ break;
+case "z838":
+ notevil = (notevil + 838)/2;
+ break;
+case "z839":
+ notevil = (notevil + 839)/2;
+ break;
+case "z840":
+ notevil = (notevil + 840)/2;
+ break;
+case "z841":
+ notevil = (notevil + 841)/2;
+ break;
+case "z842":
+ notevil = (notevil + 842)/2;
+ break;
+case "z843":
+ notevil = (notevil + 843)/2;
+ break;
+case "z844":
+ notevil = (notevil + 844)/2;
+ break;
+case "z845":
+ notevil = (notevil + 845)/2;
+ break;
+case "z846":
+ notevil = (notevil + 846)/2;
+ break;
+case "z847":
+ notevil = (notevil + 847)/2;
+ break;
+case "z848":
+ notevil = (notevil + 848)/2;
+ break;
+case "z849":
+ notevil = (notevil + 849)/2;
+ break;
+case "z850":
+ notevil = (notevil + 850)/2;
+ break;
+case "z851":
+ notevil = (notevil + 851)/2;
+ break;
+case "z852":
+ notevil = (notevil + 852)/2;
+ break;
+case "z853":
+ notevil = (notevil + 853)/2;
+ break;
+case "z854":
+ notevil = (notevil + 854)/2;
+ break;
+case "z855":
+ notevil = (notevil + 855)/2;
+ break;
+case "z856":
+ notevil = (notevil + 856)/2;
+ break;
+case "z857":
+ notevil = (notevil + 857)/2;
+ break;
+case "z858":
+ notevil = (notevil + 858)/2;
+ break;
+case "z859":
+ notevil = (notevil + 859)/2;
+ break;
+case "z860":
+ notevil = (notevil + 860)/2;
+ break;
+case "z861":
+ notevil = (notevil + 861)/2;
+ break;
+case "z862":
+ notevil = (notevil + 862)/2;
+ break;
+case "z863":
+ notevil = (notevil + 863)/2;
+ break;
+case "z864":
+ notevil = (notevil + 864)/2;
+ break;
+case "z865":
+ notevil = (notevil + 865)/2;
+ break;
+case "z866":
+ notevil = (notevil + 866)/2;
+ break;
+case "z867":
+ notevil = (notevil + 867)/2;
+ break;
+case "z868":
+ notevil = (notevil + 868)/2;
+ break;
+case "z869":
+ notevil = (notevil + 869)/2;
+ break;
+case "z870":
+ notevil = (notevil + 870)/2;
+ break;
+case "z871":
+ notevil = (notevil + 871)/2;
+ break;
+case "z872":
+ notevil = (notevil + 872)/2;
+ break;
+case "z873":
+ notevil = (notevil + 873)/2;
+ break;
+case "z874":
+ notevil = (notevil + 874)/2;
+ break;
+case "z875":
+ notevil = (notevil + 875)/2;
+ break;
+case "z876":
+ notevil = (notevil + 876)/2;
+ break;
+case "z877":
+ notevil = (notevil + 877)/2;
+ break;
+case "z878":
+ notevil = (notevil + 878)/2;
+ break;
+case "z879":
+ notevil = (notevil + 879)/2;
+ break;
+case "z880":
+ notevil = (notevil + 880)/2;
+ break;
+case "z881":
+ notevil = (notevil + 881)/2;
+ break;
+case "z882":
+ notevil = (notevil + 882)/2;
+ break;
+case "z883":
+ notevil = (notevil + 883)/2;
+ break;
+case "z884":
+ notevil = (notevil + 884)/2;
+ break;
+case "z885":
+ notevil = (notevil + 885)/2;
+ break;
+case "z886":
+ notevil = (notevil + 886)/2;
+ break;
+case "z887":
+ notevil = (notevil + 887)/2;
+ break;
+case "z888":
+ notevil = (notevil + 888)/2;
+ break;
+case "z889":
+ notevil = (notevil + 889)/2;
+ break;
+case "z890":
+ notevil = (notevil + 890)/2;
+ break;
+case "z891":
+ notevil = (notevil + 891)/2;
+ break;
+case "z892":
+ notevil = (notevil + 892)/2;
+ break;
+case "z893":
+ notevil = (notevil + 893)/2;
+ break;
+case "z894":
+ notevil = (notevil + 894)/2;
+ break;
+case "z895":
+ notevil = (notevil + 895)/2;
+ break;
+case "z896":
+ notevil = (notevil + 896)/2;
+ break;
+case "z897":
+ notevil = (notevil + 897)/2;
+ break;
+case "z898":
+ notevil = (notevil + 898)/2;
+ break;
+case "z899":
+ notevil = (notevil + 899)/2;
+ break;
+case "z900":
+ notevil = (notevil + 900)/2;
+ break;
+case "z901":
+ notevil = (notevil + 901)/2;
+ break;
+case "z902":
+ notevil = (notevil + 902)/2;
+ break;
+case "z903":
+ notevil = (notevil + 903)/2;
+ break;
+case "z904":
+ notevil = (notevil + 904)/2;
+ break;
+case "z905":
+ notevil = (notevil + 905)/2;
+ break;
+case "z906":
+ notevil = (notevil + 906)/2;
+ break;
+case "z907":
+ notevil = (notevil + 907)/2;
+ break;
+case "z908":
+ notevil = (notevil + 908)/2;
+ break;
+case "z909":
+ notevil = (notevil + 909)/2;
+ break;
+case "z910":
+ notevil = (notevil + 910)/2;
+ break;
+case "z911":
+ notevil = (notevil + 911)/2;
+ break;
+case "z912":
+ notevil = (notevil + 912)/2;
+ break;
+case "z913":
+ notevil = (notevil + 913)/2;
+ break;
+case "z914":
+ notevil = (notevil + 914)/2;
+ break;
+case "z915":
+ notevil = (notevil + 915)/2;
+ break;
+case "z916":
+ notevil = (notevil + 916)/2;
+ break;
+case "z917":
+ notevil = (notevil + 917)/2;
+ break;
+case "z918":
+ notevil = (notevil + 918)/2;
+ break;
+case "z919":
+ notevil = (notevil + 919)/2;
+ break;
+case "z920":
+ notevil = (notevil + 920)/2;
+ break;
+case "z921":
+ notevil = (notevil + 921)/2;
+ break;
+case "z922":
+ notevil = (notevil + 922)/2;
+ break;
+case "z923":
+ notevil = (notevil + 923)/2;
+ break;
+case "z924":
+ notevil = (notevil + 924)/2;
+ break;
+case "z925":
+ notevil = (notevil + 925)/2;
+ break;
+case "z926":
+ notevil = (notevil + 926)/2;
+ break;
+case "z927":
+ notevil = (notevil + 927)/2;
+ break;
+case "z928":
+ notevil = (notevil + 928)/2;
+ break;
+case "z929":
+ notevil = (notevil + 929)/2;
+ break;
+case "z930":
+ notevil = (notevil + 930)/2;
+ break;
+case "z931":
+ notevil = (notevil + 931)/2;
+ break;
+case "z932":
+ notevil = (notevil + 932)/2;
+ break;
+case "z933":
+ notevil = (notevil + 933)/2;
+ break;
+case "z934":
+ notevil = (notevil + 934)/2;
+ break;
+case "z935":
+ notevil = (notevil + 935)/2;
+ break;
+case "z936":
+ notevil = (notevil + 936)/2;
+ break;
+case "z937":
+ notevil = (notevil + 937)/2;
+ break;
+case "z938":
+ notevil = (notevil + 938)/2;
+ break;
+case "z939":
+ notevil = (notevil + 939)/2;
+ break;
+case "z940":
+ notevil = (notevil + 940)/2;
+ break;
+case "z941":
+ notevil = (notevil + 941)/2;
+ break;
+case "z942":
+ notevil = (notevil + 942)/2;
+ break;
+case "z943":
+ notevil = (notevil + 943)/2;
+ break;
+case "z944":
+ notevil = (notevil + 944)/2;
+ break;
+case "z945":
+ notevil = (notevil + 945)/2;
+ break;
+case "z946":
+ notevil = (notevil + 946)/2;
+ break;
+case "z947":
+ notevil = (notevil + 947)/2;
+ break;
+case "z948":
+ notevil = (notevil + 948)/2;
+ break;
+case "z949":
+ notevil = (notevil + 949)/2;
+ break;
+case "z950":
+ notevil = (notevil + 950)/2;
+ break;
+case "z951":
+ notevil = (notevil + 951)/2;
+ break;
+case "z952":
+ notevil = (notevil + 952)/2;
+ break;
+case "z953":
+ notevil = (notevil + 953)/2;
+ break;
+case "z954":
+ notevil = (notevil + 954)/2;
+ break;
+case "z955":
+ notevil = (notevil + 955)/2;
+ break;
+case "z956":
+ notevil = (notevil + 956)/2;
+ break;
+case "z957":
+ notevil = (notevil + 957)/2;
+ break;
+case "z958":
+ notevil = (notevil + 958)/2;
+ break;
+case "z959":
+ notevil = (notevil + 959)/2;
+ break;
+case "z960":
+ notevil = (notevil + 960)/2;
+ break;
+case "z961":
+ notevil = (notevil + 961)/2;
+ break;
+case "z962":
+ notevil = (notevil + 962)/2;
+ break;
+case "z963":
+ notevil = (notevil + 963)/2;
+ break;
+case "z964":
+ notevil = (notevil + 964)/2;
+ break;
+case "z965":
+ notevil = (notevil + 965)/2;
+ break;
+case "z966":
+ notevil = (notevil + 966)/2;
+ break;
+case "z967":
+ notevil = (notevil + 967)/2;
+ break;
+case "z968":
+ notevil = (notevil + 968)/2;
+ break;
+case "z969":
+ notevil = (notevil + 969)/2;
+ break;
+case "z970":
+ notevil = (notevil + 970)/2;
+ break;
+case "z971":
+ notevil = (notevil + 971)/2;
+ break;
+case "z972":
+ notevil = (notevil + 972)/2;
+ break;
+case "z973":
+ notevil = (notevil + 973)/2;
+ break;
+case "z974":
+ notevil = (notevil + 974)/2;
+ break;
+case "z975":
+ notevil = (notevil + 975)/2;
+ break;
+case "z976":
+ notevil = (notevil + 976)/2;
+ break;
+case "z977":
+ notevil = (notevil + 977)/2;
+ break;
+case "z978":
+ notevil = (notevil + 978)/2;
+ break;
+case "z979":
+ notevil = (notevil + 979)/2;
+ break;
+case "z980":
+ notevil = (notevil + 980)/2;
+ break;
+case "z981":
+ notevil = (notevil + 981)/2;
+ break;
+case "z982":
+ notevil = (notevil + 982)/2;
+ break;
+case "z983":
+ notevil = (notevil + 983)/2;
+ break;
+case "z984":
+ notevil = (notevil + 984)/2;
+ break;
+case "z985":
+ notevil = (notevil + 985)/2;
+ break;
+case "z986":
+ notevil = (notevil + 986)/2;
+ break;
+case "z987":
+ notevil = (notevil + 987)/2;
+ break;
+case "z988":
+ notevil = (notevil + 988)/2;
+ break;
+case "z989":
+ notevil = (notevil + 989)/2;
+ break;
+case "z990":
+ notevil = (notevil + 990)/2;
+ break;
+case "z991":
+ notevil = (notevil + 991)/2;
+ break;
+case "z992":
+ notevil = (notevil + 992)/2;
+ break;
+case "z993":
+ notevil = (notevil + 993)/2;
+ break;
+case "z994":
+ notevil = (notevil + 994)/2;
+ break;
+case "z995":
+ notevil = (notevil + 995)/2;
+ break;
+case "z996":
+ notevil = (notevil + 996)/2;
+ break;
+case "z997":
+ notevil = (notevil + 997)/2;
+ break;
+case "z998":
+ notevil = (notevil + 998)/2;
+ break;
+case "z999":
+ notevil = (notevil + 999)/2;
+ break;
+case "z1000":
+ notevil = (notevil + 1000)/2;
+ break;
+case "z1001":
+ notevil = (notevil + 1001)/2;
+ break;
+case "z1002":
+ notevil = (notevil + 1002)/2;
+ break;
+case "z1003":
+ notevil = (notevil + 1003)/2;
+ break;
+case "z1004":
+ notevil = (notevil + 1004)/2;
+ break;
+case "z1005":
+ notevil = (notevil + 1005)/2;
+ break;
+case "z1006":
+ notevil = (notevil + 1006)/2;
+ break;
+case "z1007":
+ notevil = (notevil + 1007)/2;
+ break;
+case "z1008":
+ notevil = (notevil + 1008)/2;
+ break;
+case "z1009":
+ notevil = (notevil + 1009)/2;
+ break;
+case "z1010":
+ notevil = (notevil + 1010)/2;
+ break;
+case "z1011":
+ notevil = (notevil + 1011)/2;
+ break;
+case "z1012":
+ notevil = (notevil + 1012)/2;
+ break;
+case "z1013":
+ notevil = (notevil + 1013)/2;
+ break;
+case "z1014":
+ notevil = (notevil + 1014)/2;
+ break;
+case "z1015":
+ notevil = (notevil + 1015)/2;
+ break;
+case "z1016":
+ notevil = (notevil + 1016)/2;
+ break;
+case "z1017":
+ notevil = (notevil + 1017)/2;
+ break;
+case "z1018":
+ notevil = (notevil + 1018)/2;
+ break;
+case "z1019":
+ notevil = (notevil + 1019)/2;
+ break;
+case "z1020":
+ notevil = (notevil + 1020)/2;
+ break;
+case "z1021":
+ notevil = (notevil + 1021)/2;
+ break;
+case "z1022":
+ notevil = (notevil + 1022)/2;
+ break;
+case "z1023":
+ notevil = (notevil + 1023)/2;
+ break;
+case "z1024":
+ notevil = (notevil + 1024)/2;
+ break;
+case "z1025":
+ notevil = (notevil + 1025)/2;
+ break;
+case "z1026":
+ notevil = (notevil + 1026)/2;
+ break;
+case "z1027":
+ notevil = (notevil + 1027)/2;
+ break;
+case "z1028":
+ notevil = (notevil + 1028)/2;
+ break;
+case "z1029":
+ notevil = (notevil + 1029)/2;
+ break;
+case "z1030":
+ notevil = (notevil + 1030)/2;
+ break;
+case "z1031":
+ notevil = (notevil + 1031)/2;
+ break;
+case "z1032":
+ notevil = (notevil + 1032)/2;
+ break;
+case "z1033":
+ notevil = (notevil + 1033)/2;
+ break;
+case "z1034":
+ notevil = (notevil + 1034)/2;
+ break;
+case "z1035":
+ notevil = (notevil + 1035)/2;
+ break;
+case "z1036":
+ notevil = (notevil + 1036)/2;
+ break;
+case "z1037":
+ notevil = (notevil + 1037)/2;
+ break;
+case "z1038":
+ notevil = (notevil + 1038)/2;
+ break;
+case "z1039":
+ notevil = (notevil + 1039)/2;
+ break;
+case "z1040":
+ notevil = (notevil + 1040)/2;
+ break;
+case "z1041":
+ notevil = (notevil + 1041)/2;
+ break;
+case "z1042":
+ notevil = (notevil + 1042)/2;
+ break;
+case "z1043":
+ notevil = (notevil + 1043)/2;
+ break;
+case "z1044":
+ notevil = (notevil + 1044)/2;
+ break;
+case "z1045":
+ notevil = (notevil + 1045)/2;
+ break;
+case "z1046":
+ notevil = (notevil + 1046)/2;
+ break;
+case "z1047":
+ notevil = (notevil + 1047)/2;
+ break;
+case "z1048":
+ notevil = (notevil + 1048)/2;
+ break;
+case "z1049":
+ notevil = (notevil + 1049)/2;
+ break;
+case "z1050":
+ notevil = (notevil + 1050)/2;
+ break;
+case "z1051":
+ notevil = (notevil + 1051)/2;
+ break;
+case "z1052":
+ notevil = (notevil + 1052)/2;
+ break;
+case "z1053":
+ notevil = (notevil + 1053)/2;
+ break;
+case "z1054":
+ notevil = (notevil + 1054)/2;
+ break;
+case "z1055":
+ notevil = (notevil + 1055)/2;
+ break;
+case "z1056":
+ notevil = (notevil + 1056)/2;
+ break;
+case "z1057":
+ notevil = (notevil + 1057)/2;
+ break;
+case "z1058":
+ notevil = (notevil + 1058)/2;
+ break;
+case "z1059":
+ notevil = (notevil + 1059)/2;
+ break;
+case "z1060":
+ notevil = (notevil + 1060)/2;
+ break;
+case "z1061":
+ notevil = (notevil + 1061)/2;
+ break;
+case "z1062":
+ notevil = (notevil + 1062)/2;
+ break;
+case "z1063":
+ notevil = (notevil + 1063)/2;
+ break;
+case "z1064":
+ notevil = (notevil + 1064)/2;
+ break;
+case "z1065":
+ notevil = (notevil + 1065)/2;
+ break;
+case "z1066":
+ notevil = (notevil + 1066)/2;
+ break;
+case "z1067":
+ notevil = (notevil + 1067)/2;
+ break;
+case "z1068":
+ notevil = (notevil + 1068)/2;
+ break;
+case "z1069":
+ notevil = (notevil + 1069)/2;
+ break;
+case "z1070":
+ notevil = (notevil + 1070)/2;
+ break;
+case "z1071":
+ notevil = (notevil + 1071)/2;
+ break;
+case "z1072":
+ notevil = (notevil + 1072)/2;
+ break;
+case "z1073":
+ notevil = (notevil + 1073)/2;
+ break;
+case "z1074":
+ notevil = (notevil + 1074)/2;
+ break;
+case "z1075":
+ notevil = (notevil + 1075)/2;
+ break;
+case "z1076":
+ notevil = (notevil + 1076)/2;
+ break;
+case "z1077":
+ notevil = (notevil + 1077)/2;
+ break;
+case "z1078":
+ notevil = (notevil + 1078)/2;
+ break;
+case "z1079":
+ notevil = (notevil + 1079)/2;
+ break;
+case "z1080":
+ notevil = (notevil + 1080)/2;
+ break;
+case "z1081":
+ notevil = (notevil + 1081)/2;
+ break;
+case "z1082":
+ notevil = (notevil + 1082)/2;
+ break;
+case "z1083":
+ notevil = (notevil + 1083)/2;
+ break;
+case "z1084":
+ notevil = (notevil + 1084)/2;
+ break;
+case "z1085":
+ notevil = (notevil + 1085)/2;
+ break;
+case "z1086":
+ notevil = (notevil + 1086)/2;
+ break;
+case "z1087":
+ notevil = (notevil + 1087)/2;
+ break;
+case "z1088":
+ notevil = (notevil + 1088)/2;
+ break;
+case "z1089":
+ notevil = (notevil + 1089)/2;
+ break;
+case "z1090":
+ notevil = (notevil + 1090)/2;
+ break;
+case "z1091":
+ notevil = (notevil + 1091)/2;
+ break;
+case "z1092":
+ notevil = (notevil + 1092)/2;
+ break;
+case "z1093":
+ notevil = (notevil + 1093)/2;
+ break;
+case "z1094":
+ notevil = (notevil + 1094)/2;
+ break;
+case "z1095":
+ notevil = (notevil + 1095)/2;
+ break;
+case "z1096":
+ notevil = (notevil + 1096)/2;
+ break;
+case "z1097":
+ notevil = (notevil + 1097)/2;
+ break;
+case "z1098":
+ notevil = (notevil + 1098)/2;
+ break;
+case "z1099":
+ notevil = (notevil + 1099)/2;
+ break;
+case "z1100":
+ notevil = (notevil + 1100)/2;
+ break;
+case "z1101":
+ notevil = (notevil + 1101)/2;
+ break;
+case "z1102":
+ notevil = (notevil + 1102)/2;
+ break;
+case "z1103":
+ notevil = (notevil + 1103)/2;
+ break;
+case "z1104":
+ notevil = (notevil + 1104)/2;
+ break;
+case "z1105":
+ notevil = (notevil + 1105)/2;
+ break;
+case "z1106":
+ notevil = (notevil + 1106)/2;
+ break;
+case "z1107":
+ notevil = (notevil + 1107)/2;
+ break;
+case "z1108":
+ notevil = (notevil + 1108)/2;
+ break;
+case "z1109":
+ notevil = (notevil + 1109)/2;
+ break;
+case "z1110":
+ notevil = (notevil + 1110)/2;
+ break;
+case "z1111":
+ notevil = (notevil + 1111)/2;
+ break;
+case "z1112":
+ notevil = (notevil + 1112)/2;
+ break;
+case "z1113":
+ notevil = (notevil + 1113)/2;
+ break;
+case "z1114":
+ notevil = (notevil + 1114)/2;
+ break;
+case "z1115":
+ notevil = (notevil + 1115)/2;
+ break;
+case "z1116":
+ notevil = (notevil + 1116)/2;
+ break;
+case "z1117":
+ notevil = (notevil + 1117)/2;
+ break;
+case "z1118":
+ notevil = (notevil + 1118)/2;
+ break;
+case "z1119":
+ notevil = (notevil + 1119)/2;
+ break;
+case "z1120":
+ notevil = (notevil + 1120)/2;
+ break;
+case "z1121":
+ notevil = (notevil + 1121)/2;
+ break;
+case "z1122":
+ notevil = (notevil + 1122)/2;
+ break;
+case "z1123":
+ notevil = (notevil + 1123)/2;
+ break;
+case "z1124":
+ notevil = (notevil + 1124)/2;
+ break;
+case "z1125":
+ notevil = (notevil + 1125)/2;
+ break;
+case "z1126":
+ notevil = (notevil + 1126)/2;
+ break;
+case "z1127":
+ notevil = (notevil + 1127)/2;
+ break;
+case "z1128":
+ notevil = (notevil + 1128)/2;
+ break;
+case "z1129":
+ notevil = (notevil + 1129)/2;
+ break;
+case "z1130":
+ notevil = (notevil + 1130)/2;
+ break;
+case "z1131":
+ notevil = (notevil + 1131)/2;
+ break;
+case "z1132":
+ notevil = (notevil + 1132)/2;
+ break;
+case "z1133":
+ notevil = (notevil + 1133)/2;
+ break;
+case "z1134":
+ notevil = (notevil + 1134)/2;
+ break;
+case "z1135":
+ notevil = (notevil + 1135)/2;
+ break;
+case "z1136":
+ notevil = (notevil + 1136)/2;
+ break;
+case "z1137":
+ notevil = (notevil + 1137)/2;
+ break;
+case "z1138":
+ notevil = (notevil + 1138)/2;
+ break;
+case "z1139":
+ notevil = (notevil + 1139)/2;
+ break;
+case "z1140":
+ notevil = (notevil + 1140)/2;
+ break;
+case "z1141":
+ notevil = (notevil + 1141)/2;
+ break;
+case "z1142":
+ notevil = (notevil + 1142)/2;
+ break;
+case "z1143":
+ notevil = (notevil + 1143)/2;
+ break;
+case "z1144":
+ notevil = (notevil + 1144)/2;
+ break;
+case "z1145":
+ notevil = (notevil + 1145)/2;
+ break;
+case "z1146":
+ notevil = (notevil + 1146)/2;
+ break;
+case "z1147":
+ notevil = (notevil + 1147)/2;
+ break;
+case "z1148":
+ notevil = (notevil + 1148)/2;
+ break;
+case "z1149":
+ notevil = (notevil + 1149)/2;
+ break;
+case "z1150":
+ notevil = (notevil + 1150)/2;
+ break;
+case "z1151":
+ notevil = (notevil + 1151)/2;
+ break;
+case "z1152":
+ notevil = (notevil + 1152)/2;
+ break;
+case "z1153":
+ notevil = (notevil + 1153)/2;
+ break;
+case "z1154":
+ notevil = (notevil + 1154)/2;
+ break;
+case "z1155":
+ notevil = (notevil + 1155)/2;
+ break;
+case "z1156":
+ notevil = (notevil + 1156)/2;
+ break;
+case "z1157":
+ notevil = (notevil + 1157)/2;
+ break;
+case "z1158":
+ notevil = (notevil + 1158)/2;
+ break;
+case "z1159":
+ notevil = (notevil + 1159)/2;
+ break;
+case "z1160":
+ notevil = (notevil + 1160)/2;
+ break;
+case "z1161":
+ notevil = (notevil + 1161)/2;
+ break;
+case "z1162":
+ notevil = (notevil + 1162)/2;
+ break;
+case "z1163":
+ notevil = (notevil + 1163)/2;
+ break;
+case "z1164":
+ notevil = (notevil + 1164)/2;
+ break;
+case "z1165":
+ notevil = (notevil + 1165)/2;
+ break;
+case "z1166":
+ notevil = (notevil + 1166)/2;
+ break;
+case "z1167":
+ notevil = (notevil + 1167)/2;
+ break;
+case "z1168":
+ notevil = (notevil + 1168)/2;
+ break;
+case "z1169":
+ notevil = (notevil + 1169)/2;
+ break;
+case "z1170":
+ notevil = (notevil + 1170)/2;
+ break;
+case "z1171":
+ notevil = (notevil + 1171)/2;
+ break;
+case "z1172":
+ notevil = (notevil + 1172)/2;
+ break;
+case "z1173":
+ notevil = (notevil + 1173)/2;
+ break;
+case "z1174":
+ notevil = (notevil + 1174)/2;
+ break;
+case "z1175":
+ notevil = (notevil + 1175)/2;
+ break;
+case "z1176":
+ notevil = (notevil + 1176)/2;
+ break;
+case "z1177":
+ notevil = (notevil + 1177)/2;
+ break;
+case "z1178":
+ notevil = (notevil + 1178)/2;
+ break;
+case "z1179":
+ notevil = (notevil + 1179)/2;
+ break;
+case "z1180":
+ notevil = (notevil + 1180)/2;
+ break;
+case "z1181":
+ notevil = (notevil + 1181)/2;
+ break;
+case "z1182":
+ notevil = (notevil + 1182)/2;
+ break;
+case "z1183":
+ notevil = (notevil + 1183)/2;
+ break;
+case "z1184":
+ notevil = (notevil + 1184)/2;
+ break;
+case "z1185":
+ notevil = (notevil + 1185)/2;
+ break;
+case "z1186":
+ notevil = (notevil + 1186)/2;
+ break;
+case "z1187":
+ notevil = (notevil + 1187)/2;
+ break;
+case "z1188":
+ notevil = (notevil + 1188)/2;
+ break;
+case "z1189":
+ notevil = (notevil + 1189)/2;
+ break;
+case "z1190":
+ notevil = (notevil + 1190)/2;
+ break;
+case "z1191":
+ notevil = (notevil + 1191)/2;
+ break;
+case "z1192":
+ notevil = (notevil + 1192)/2;
+ break;
+case "z1193":
+ notevil = (notevil + 1193)/2;
+ break;
+case "z1194":
+ notevil = (notevil + 1194)/2;
+ break;
+case "z1195":
+ notevil = (notevil + 1195)/2;
+ break;
+case "z1196":
+ notevil = (notevil + 1196)/2;
+ break;
+case "z1197":
+ notevil = (notevil + 1197)/2;
+ break;
+case "z1198":
+ notevil = (notevil + 1198)/2;
+ break;
+case "z1199":
+ notevil = (notevil + 1199)/2;
+ break;
+case "z1200":
+ notevil = (notevil + 1200)/2;
+ break;
+case "z1201":
+ notevil = (notevil + 1201)/2;
+ break;
+case "z1202":
+ notevil = (notevil + 1202)/2;
+ break;
+case "z1203":
+ notevil = (notevil + 1203)/2;
+ break;
+case "z1204":
+ notevil = (notevil + 1204)/2;
+ break;
+case "z1205":
+ notevil = (notevil + 1205)/2;
+ break;
+case "z1206":
+ notevil = (notevil + 1206)/2;
+ break;
+case "z1207":
+ notevil = (notevil + 1207)/2;
+ break;
+case "z1208":
+ notevil = (notevil + 1208)/2;
+ break;
+case "z1209":
+ notevil = (notevil + 1209)/2;
+ break;
+case "z1210":
+ notevil = (notevil + 1210)/2;
+ break;
+case "z1211":
+ notevil = (notevil + 1211)/2;
+ break;
+case "z1212":
+ notevil = (notevil + 1212)/2;
+ break;
+case "z1213":
+ notevil = (notevil + 1213)/2;
+ break;
+case "z1214":
+ notevil = (notevil + 1214)/2;
+ break;
+case "z1215":
+ notevil = (notevil + 1215)/2;
+ break;
+case "z1216":
+ notevil = (notevil + 1216)/2;
+ break;
+case "z1217":
+ notevil = (notevil + 1217)/2;
+ break;
+case "z1218":
+ notevil = (notevil + 1218)/2;
+ break;
+case "z1219":
+ notevil = (notevil + 1219)/2;
+ break;
+case "z1220":
+ notevil = (notevil + 1220)/2;
+ break;
+case "z1221":
+ notevil = (notevil + 1221)/2;
+ break;
+case "z1222":
+ notevil = (notevil + 1222)/2;
+ break;
+case "z1223":
+ notevil = (notevil + 1223)/2;
+ break;
+case "z1224":
+ notevil = (notevil + 1224)/2;
+ break;
+case "z1225":
+ notevil = (notevil + 1225)/2;
+ break;
+case "z1226":
+ notevil = (notevil + 1226)/2;
+ break;
+case "z1227":
+ notevil = (notevil + 1227)/2;
+ break;
+case "z1228":
+ notevil = (notevil + 1228)/2;
+ break;
+case "z1229":
+ notevil = (notevil + 1229)/2;
+ break;
+case "z1230":
+ notevil = (notevil + 1230)/2;
+ break;
+case "z1231":
+ notevil = (notevil + 1231)/2;
+ break;
+case "z1232":
+ notevil = (notevil + 1232)/2;
+ break;
+case "z1233":
+ notevil = (notevil + 1233)/2;
+ break;
+case "z1234":
+ notevil = (notevil + 1234)/2;
+ break;
+case "z1235":
+ notevil = (notevil + 1235)/2;
+ break;
+case "z1236":
+ notevil = (notevil + 1236)/2;
+ break;
+case "z1237":
+ notevil = (notevil + 1237)/2;
+ break;
+case "z1238":
+ notevil = (notevil + 1238)/2;
+ break;
+case "z1239":
+ notevil = (notevil + 1239)/2;
+ break;
+case "z1240":
+ notevil = (notevil + 1240)/2;
+ break;
+case "z1241":
+ notevil = (notevil + 1241)/2;
+ break;
+case "z1242":
+ notevil = (notevil + 1242)/2;
+ break;
+case "z1243":
+ notevil = (notevil + 1243)/2;
+ break;
+case "z1244":
+ notevil = (notevil + 1244)/2;
+ break;
+case "z1245":
+ notevil = (notevil + 1245)/2;
+ break;
+case "z1246":
+ notevil = (notevil + 1246)/2;
+ break;
+case "z1247":
+ notevil = (notevil + 1247)/2;
+ break;
+case "z1248":
+ notevil = (notevil + 1248)/2;
+ break;
+case "z1249":
+ notevil = (notevil + 1249)/2;
+ break;
+case "z1250":
+ notevil = (notevil + 1250)/2;
+ break;
+case "z1251":
+ notevil = (notevil + 1251)/2;
+ break;
+case "z1252":
+ notevil = (notevil + 1252)/2;
+ break;
+case "z1253":
+ notevil = (notevil + 1253)/2;
+ break;
+case "z1254":
+ notevil = (notevil + 1254)/2;
+ break;
+case "z1255":
+ notevil = (notevil + 1255)/2;
+ break;
+case "z1256":
+ notevil = (notevil + 1256)/2;
+ break;
+case "z1257":
+ notevil = (notevil + 1257)/2;
+ break;
+case "z1258":
+ notevil = (notevil + 1258)/2;
+ break;
+case "z1259":
+ notevil = (notevil + 1259)/2;
+ break;
+case "z1260":
+ notevil = (notevil + 1260)/2;
+ break;
+case "z1261":
+ notevil = (notevil + 1261)/2;
+ break;
+case "z1262":
+ notevil = (notevil + 1262)/2;
+ break;
+case "z1263":
+ notevil = (notevil + 1263)/2;
+ break;
+case "z1264":
+ notevil = (notevil + 1264)/2;
+ break;
+case "z1265":
+ notevil = (notevil + 1265)/2;
+ break;
+case "z1266":
+ notevil = (notevil + 1266)/2;
+ break;
+case "z1267":
+ notevil = (notevil + 1267)/2;
+ break;
+case "z1268":
+ notevil = (notevil + 1268)/2;
+ break;
+case "z1269":
+ notevil = (notevil + 1269)/2;
+ break;
+case "z1270":
+ notevil = (notevil + 1270)/2;
+ break;
+case "z1271":
+ notevil = (notevil + 1271)/2;
+ break;
+case "z1272":
+ notevil = (notevil + 1272)/2;
+ break;
+case "z1273":
+ notevil = (notevil + 1273)/2;
+ break;
+case "z1274":
+ notevil = (notevil + 1274)/2;
+ break;
+case "z1275":
+ notevil = (notevil + 1275)/2;
+ break;
+case "z1276":
+ notevil = (notevil + 1276)/2;
+ break;
+case "z1277":
+ notevil = (notevil + 1277)/2;
+ break;
+case "z1278":
+ notevil = (notevil + 1278)/2;
+ break;
+case "z1279":
+ notevil = (notevil + 1279)/2;
+ break;
+case "z1280":
+ notevil = (notevil + 1280)/2;
+ break;
+case "z1281":
+ notevil = (notevil + 1281)/2;
+ break;
+case "z1282":
+ notevil = (notevil + 1282)/2;
+ break;
+case "z1283":
+ notevil = (notevil + 1283)/2;
+ break;
+case "z1284":
+ notevil = (notevil + 1284)/2;
+ break;
+case "z1285":
+ notevil = (notevil + 1285)/2;
+ break;
+case "z1286":
+ notevil = (notevil + 1286)/2;
+ break;
+case "z1287":
+ notevil = (notevil + 1287)/2;
+ break;
+case "z1288":
+ notevil = (notevil + 1288)/2;
+ break;
+case "z1289":
+ notevil = (notevil + 1289)/2;
+ break;
+case "z1290":
+ notevil = (notevil + 1290)/2;
+ break;
+case "z1291":
+ notevil = (notevil + 1291)/2;
+ break;
+case "z1292":
+ notevil = (notevil + 1292)/2;
+ break;
+case "z1293":
+ notevil = (notevil + 1293)/2;
+ break;
+case "z1294":
+ notevil = (notevil + 1294)/2;
+ break;
+case "z1295":
+ notevil = (notevil + 1295)/2;
+ break;
+case "z1296":
+ notevil = (notevil + 1296)/2;
+ break;
+case "z1297":
+ notevil = (notevil + 1297)/2;
+ break;
+case "z1298":
+ notevil = (notevil + 1298)/2;
+ break;
+case "z1299":
+ notevil = (notevil + 1299)/2;
+ break;
+case "z1300":
+ notevil = (notevil + 1300)/2;
+ break;
+case "z1301":
+ notevil = (notevil + 1301)/2;
+ break;
+case "z1302":
+ notevil = (notevil + 1302)/2;
+ break;
+case "z1303":
+ notevil = (notevil + 1303)/2;
+ break;
+case "z1304":
+ notevil = (notevil + 1304)/2;
+ break;
+case "z1305":
+ notevil = (notevil + 1305)/2;
+ break;
+case "z1306":
+ notevil = (notevil + 1306)/2;
+ break;
+case "z1307":
+ notevil = (notevil + 1307)/2;
+ break;
+case "z1308":
+ notevil = (notevil + 1308)/2;
+ break;
+case "z1309":
+ notevil = (notevil + 1309)/2;
+ break;
+case "z1310":
+ notevil = (notevil + 1310)/2;
+ break;
+case "z1311":
+ notevil = (notevil + 1311)/2;
+ break;
+case "z1312":
+ notevil = (notevil + 1312)/2;
+ break;
+case "z1313":
+ notevil = (notevil + 1313)/2;
+ break;
+case "z1314":
+ notevil = (notevil + 1314)/2;
+ break;
+case "z1315":
+ notevil = (notevil + 1315)/2;
+ break;
+case "z1316":
+ notevil = (notevil + 1316)/2;
+ break;
+case "z1317":
+ notevil = (notevil + 1317)/2;
+ break;
+case "z1318":
+ notevil = (notevil + 1318)/2;
+ break;
+case "z1319":
+ notevil = (notevil + 1319)/2;
+ break;
+case "z1320":
+ notevil = (notevil + 1320)/2;
+ break;
+case "z1321":
+ notevil = (notevil + 1321)/2;
+ break;
+case "z1322":
+ notevil = (notevil + 1322)/2;
+ break;
+case "z1323":
+ notevil = (notevil + 1323)/2;
+ break;
+case "z1324":
+ notevil = (notevil + 1324)/2;
+ break;
+case "z1325":
+ notevil = (notevil + 1325)/2;
+ break;
+case "z1326":
+ notevil = (notevil + 1326)/2;
+ break;
+case "z1327":
+ notevil = (notevil + 1327)/2;
+ break;
+case "z1328":
+ notevil = (notevil + 1328)/2;
+ break;
+case "z1329":
+ notevil = (notevil + 1329)/2;
+ break;
+case "z1330":
+ notevil = (notevil + 1330)/2;
+ break;
+case "z1331":
+ notevil = (notevil + 1331)/2;
+ break;
+case "z1332":
+ notevil = (notevil + 1332)/2;
+ break;
+case "z1333":
+ notevil = (notevil + 1333)/2;
+ break;
+case "z1334":
+ notevil = (notevil + 1334)/2;
+ break;
+case "z1335":
+ notevil = (notevil + 1335)/2;
+ break;
+case "z1336":
+ notevil = (notevil + 1336)/2;
+ break;
+case "z1337":
+ notevil = (notevil + 1337)/2;
+ break;
+case "z1338":
+ notevil = (notevil + 1338)/2;
+ break;
+case "z1339":
+ notevil = (notevil + 1339)/2;
+ break;
+case "z1340":
+ notevil = (notevil + 1340)/2;
+ break;
+case "z1341":
+ notevil = (notevil + 1341)/2;
+ break;
+case "z1342":
+ notevil = (notevil + 1342)/2;
+ break;
+case "z1343":
+ notevil = (notevil + 1343)/2;
+ break;
+case "z1344":
+ notevil = (notevil + 1344)/2;
+ break;
+case "z1345":
+ notevil = (notevil + 1345)/2;
+ break;
+case "z1346":
+ notevil = (notevil + 1346)/2;
+ break;
+case "z1347":
+ notevil = (notevil + 1347)/2;
+ break;
+case "z1348":
+ notevil = (notevil + 1348)/2;
+ break;
+case "z1349":
+ notevil = (notevil + 1349)/2;
+ break;
+case "z1350":
+ notevil = (notevil + 1350)/2;
+ break;
+case "z1351":
+ notevil = (notevil + 1351)/2;
+ break;
+case "z1352":
+ notevil = (notevil + 1352)/2;
+ break;
+case "z1353":
+ notevil = (notevil + 1353)/2;
+ break;
+case "z1354":
+ notevil = (notevil + 1354)/2;
+ break;
+case "z1355":
+ notevil = (notevil + 1355)/2;
+ break;
+case "z1356":
+ notevil = (notevil + 1356)/2;
+ break;
+case "z1357":
+ notevil = (notevil + 1357)/2;
+ break;
+case "z1358":
+ notevil = (notevil + 1358)/2;
+ break;
+case "z1359":
+ notevil = (notevil + 1359)/2;
+ break;
+case "z1360":
+ notevil = (notevil + 1360)/2;
+ break;
+case "z1361":
+ notevil = (notevil + 1361)/2;
+ break;
+case "z1362":
+ notevil = (notevil + 1362)/2;
+ break;
+case "z1363":
+ notevil = (notevil + 1363)/2;
+ break;
+case "z1364":
+ notevil = (notevil + 1364)/2;
+ break;
+case "z1365":
+ notevil = (notevil + 1365)/2;
+ break;
+case "z1366":
+ notevil = (notevil + 1366)/2;
+ break;
+case "z1367":
+ notevil = (notevil + 1367)/2;
+ break;
+case "z1368":
+ notevil = (notevil + 1368)/2;
+ break;
+case "z1369":
+ notevil = (notevil + 1369)/2;
+ break;
+case "z1370":
+ notevil = (notevil + 1370)/2;
+ break;
+case "z1371":
+ notevil = (notevil + 1371)/2;
+ break;
+case "z1372":
+ notevil = (notevil + 1372)/2;
+ break;
+case "z1373":
+ notevil = (notevil + 1373)/2;
+ break;
+case "z1374":
+ notevil = (notevil + 1374)/2;
+ break;
+case "z1375":
+ notevil = (notevil + 1375)/2;
+ break;
+case "z1376":
+ notevil = (notevil + 1376)/2;
+ break;
+case "z1377":
+ notevil = (notevil + 1377)/2;
+ break;
+case "z1378":
+ notevil = (notevil + 1378)/2;
+ break;
+case "z1379":
+ notevil = (notevil + 1379)/2;
+ break;
+case "z1380":
+ notevil = (notevil + 1380)/2;
+ break;
+case "z1381":
+ notevil = (notevil + 1381)/2;
+ break;
+case "z1382":
+ notevil = (notevil + 1382)/2;
+ break;
+case "z1383":
+ notevil = (notevil + 1383)/2;
+ break;
+case "z1384":
+ notevil = (notevil + 1384)/2;
+ break;
+case "z1385":
+ notevil = (notevil + 1385)/2;
+ break;
+case "z1386":
+ notevil = (notevil + 1386)/2;
+ break;
+case "z1387":
+ notevil = (notevil + 1387)/2;
+ break;
+case "z1388":
+ notevil = (notevil + 1388)/2;
+ break;
+case "z1389":
+ notevil = (notevil + 1389)/2;
+ break;
+case "z1390":
+ notevil = (notevil + 1390)/2;
+ break;
+case "z1391":
+ notevil = (notevil + 1391)/2;
+ break;
+case "z1392":
+ notevil = (notevil + 1392)/2;
+ break;
+case "z1393":
+ notevil = (notevil + 1393)/2;
+ break;
+case "z1394":
+ notevil = (notevil + 1394)/2;
+ break;
+case "z1395":
+ notevil = (notevil + 1395)/2;
+ break;
+case "z1396":
+ notevil = (notevil + 1396)/2;
+ break;
+case "z1397":
+ notevil = (notevil + 1397)/2;
+ break;
+case "z1398":
+ notevil = (notevil + 1398)/2;
+ break;
+case "z1399":
+ notevil = (notevil + 1399)/2;
+ break;
+case "z1400":
+ notevil = (notevil + 1400)/2;
+ break;
+case "z1401":
+ notevil = (notevil + 1401)/2;
+ break;
+case "z1402":
+ notevil = (notevil + 1402)/2;
+ break;
+case "z1403":
+ notevil = (notevil + 1403)/2;
+ break;
+case "z1404":
+ notevil = (notevil + 1404)/2;
+ break;
+case "z1405":
+ notevil = (notevil + 1405)/2;
+ break;
+case "z1406":
+ notevil = (notevil + 1406)/2;
+ break;
+case "z1407":
+ notevil = (notevil + 1407)/2;
+ break;
+case "z1408":
+ notevil = (notevil + 1408)/2;
+ break;
+case "z1409":
+ notevil = (notevil + 1409)/2;
+ break;
+case "z1410":
+ notevil = (notevil + 1410)/2;
+ break;
+case "z1411":
+ notevil = (notevil + 1411)/2;
+ break;
+case "z1412":
+ notevil = (notevil + 1412)/2;
+ break;
+case "z1413":
+ notevil = (notevil + 1413)/2;
+ break;
+case "z1414":
+ notevil = (notevil + 1414)/2;
+ break;
+case "z1415":
+ notevil = (notevil + 1415)/2;
+ break;
+case "z1416":
+ notevil = (notevil + 1416)/2;
+ break;
+case "z1417":
+ notevil = (notevil + 1417)/2;
+ break;
+case "z1418":
+ notevil = (notevil + 1418)/2;
+ break;
+case "z1419":
+ notevil = (notevil + 1419)/2;
+ break;
+case "z1420":
+ notevil = (notevil + 1420)/2;
+ break;
+case "z1421":
+ notevil = (notevil + 1421)/2;
+ break;
+case "z1422":
+ notevil = (notevil + 1422)/2;
+ break;
+case "z1423":
+ notevil = (notevil + 1423)/2;
+ break;
+case "z1424":
+ notevil = (notevil + 1424)/2;
+ break;
+case "z1425":
+ notevil = (notevil + 1425)/2;
+ break;
+case "z1426":
+ notevil = (notevil + 1426)/2;
+ break;
+case "z1427":
+ notevil = (notevil + 1427)/2;
+ break;
+case "z1428":
+ notevil = (notevil + 1428)/2;
+ break;
+case "z1429":
+ notevil = (notevil + 1429)/2;
+ break;
+case "z1430":
+ notevil = (notevil + 1430)/2;
+ break;
+case "z1431":
+ notevil = (notevil + 1431)/2;
+ break;
+case "z1432":
+ notevil = (notevil + 1432)/2;
+ break;
+case "z1433":
+ notevil = (notevil + 1433)/2;
+ break;
+case "z1434":
+ notevil = (notevil + 1434)/2;
+ break;
+case "z1435":
+ notevil = (notevil + 1435)/2;
+ break;
+case "z1436":
+ notevil = (notevil + 1436)/2;
+ break;
+case "z1437":
+ notevil = (notevil + 1437)/2;
+ break;
+case "z1438":
+ notevil = (notevil + 1438)/2;
+ break;
+case "z1439":
+ notevil = (notevil + 1439)/2;
+ break;
+case "z1440":
+ notevil = (notevil + 1440)/2;
+ break;
+case "z1441":
+ notevil = (notevil + 1441)/2;
+ break;
+case "z1442":
+ notevil = (notevil + 1442)/2;
+ break;
+case "z1443":
+ notevil = (notevil + 1443)/2;
+ break;
+case "z1444":
+ notevil = (notevil + 1444)/2;
+ break;
+case "z1445":
+ notevil = (notevil + 1445)/2;
+ break;
+case "z1446":
+ notevil = (notevil + 1446)/2;
+ break;
+case "z1447":
+ notevil = (notevil + 1447)/2;
+ break;
+case "z1448":
+ notevil = (notevil + 1448)/2;
+ break;
+case "z1449":
+ notevil = (notevil + 1449)/2;
+ break;
+case "z1450":
+ notevil = (notevil + 1450)/2;
+ break;
+case "z1451":
+ notevil = (notevil + 1451)/2;
+ break;
+case "z1452":
+ notevil = (notevil + 1452)/2;
+ break;
+case "z1453":
+ notevil = (notevil + 1453)/2;
+ break;
+case "z1454":
+ notevil = (notevil + 1454)/2;
+ break;
+case "z1455":
+ notevil = (notevil + 1455)/2;
+ break;
+case "z1456":
+ notevil = (notevil + 1456)/2;
+ break;
+case "z1457":
+ notevil = (notevil + 1457)/2;
+ break;
+case "z1458":
+ notevil = (notevil + 1458)/2;
+ break;
+case "z1459":
+ notevil = (notevil + 1459)/2;
+ break;
+case "z1460":
+ notevil = (notevil + 1460)/2;
+ break;
+case "z1461":
+ notevil = (notevil + 1461)/2;
+ break;
+case "z1462":
+ notevil = (notevil + 1462)/2;
+ break;
+case "z1463":
+ notevil = (notevil + 1463)/2;
+ break;
+case "z1464":
+ notevil = (notevil + 1464)/2;
+ break;
+case "z1465":
+ notevil = (notevil + 1465)/2;
+ break;
+case "z1466":
+ notevil = (notevil + 1466)/2;
+ break;
+case "z1467":
+ notevil = (notevil + 1467)/2;
+ break;
+case "z1468":
+ notevil = (notevil + 1468)/2;
+ break;
+case "z1469":
+ notevil = (notevil + 1469)/2;
+ break;
+case "z1470":
+ notevil = (notevil + 1470)/2;
+ break;
+case "z1471":
+ notevil = (notevil + 1471)/2;
+ break;
+case "z1472":
+ notevil = (notevil + 1472)/2;
+ break;
+case "z1473":
+ notevil = (notevil + 1473)/2;
+ break;
+case "z1474":
+ notevil = (notevil + 1474)/2;
+ break;
+case "z1475":
+ notevil = (notevil + 1475)/2;
+ break;
+case "z1476":
+ notevil = (notevil + 1476)/2;
+ break;
+case "z1477":
+ notevil = (notevil + 1477)/2;
+ break;
+case "z1478":
+ notevil = (notevil + 1478)/2;
+ break;
+case "z1479":
+ notevil = (notevil + 1479)/2;
+ break;
+case "z1480":
+ notevil = (notevil + 1480)/2;
+ break;
+case "z1481":
+ notevil = (notevil + 1481)/2;
+ break;
+case "z1482":
+ notevil = (notevil + 1482)/2;
+ break;
+case "z1483":
+ notevil = (notevil + 1483)/2;
+ break;
+case "z1484":
+ notevil = (notevil + 1484)/2;
+ break;
+case "z1485":
+ notevil = (notevil + 1485)/2;
+ break;
+case "z1486":
+ notevil = (notevil + 1486)/2;
+ break;
+case "z1487":
+ notevil = (notevil + 1487)/2;
+ break;
+case "z1488":
+ notevil = (notevil + 1488)/2;
+ break;
+case "z1489":
+ notevil = (notevil + 1489)/2;
+ break;
+case "z1490":
+ notevil = (notevil + 1490)/2;
+ break;
+case "z1491":
+ notevil = (notevil + 1491)/2;
+ break;
+case "z1492":
+ notevil = (notevil + 1492)/2;
+ break;
+case "z1493":
+ notevil = (notevil + 1493)/2;
+ break;
+case "z1494":
+ notevil = (notevil + 1494)/2;
+ break;
+case "z1495":
+ notevil = (notevil + 1495)/2;
+ break;
+case "z1496":
+ notevil = (notevil + 1496)/2;
+ break;
+case "z1497":
+ notevil = (notevil + 1497)/2;
+ break;
+case "z1498":
+ notevil = (notevil + 1498)/2;
+ break;
+case "z1499":
+ notevil = (notevil + 1499)/2;
+ break;
+case "z1500":
+ notevil = (notevil + 1500)/2;
+ break;
+case "z1501":
+ notevil = (notevil + 1501)/2;
+ break;
+case "z1502":
+ notevil = (notevil + 1502)/2;
+ break;
+case "z1503":
+ notevil = (notevil + 1503)/2;
+ break;
+case "z1504":
+ notevil = (notevil + 1504)/2;
+ break;
+case "z1505":
+ notevil = (notevil + 1505)/2;
+ break;
+case "z1506":
+ notevil = (notevil + 1506)/2;
+ break;
+case "z1507":
+ notevil = (notevil + 1507)/2;
+ break;
+case "z1508":
+ notevil = (notevil + 1508)/2;
+ break;
+case "z1509":
+ notevil = (notevil + 1509)/2;
+ break;
+case "z1510":
+ notevil = (notevil + 1510)/2;
+ break;
+case "z1511":
+ notevil = (notevil + 1511)/2;
+ break;
+case "z1512":
+ notevil = (notevil + 1512)/2;
+ break;
+case "z1513":
+ notevil = (notevil + 1513)/2;
+ break;
+case "z1514":
+ notevil = (notevil + 1514)/2;
+ break;
+case "z1515":
+ notevil = (notevil + 1515)/2;
+ break;
+case "z1516":
+ notevil = (notevil + 1516)/2;
+ break;
+case "z1517":
+ notevil = (notevil + 1517)/2;
+ break;
+case "z1518":
+ notevil = (notevil + 1518)/2;
+ break;
+case "z1519":
+ notevil = (notevil + 1519)/2;
+ break;
+case "z1520":
+ notevil = (notevil + 1520)/2;
+ break;
+case "z1521":
+ notevil = (notevil + 1521)/2;
+ break;
+case "z1522":
+ notevil = (notevil + 1522)/2;
+ break;
+case "z1523":
+ notevil = (notevil + 1523)/2;
+ break;
+case "z1524":
+ notevil = (notevil + 1524)/2;
+ break;
+case "z1525":
+ notevil = (notevil + 1525)/2;
+ break;
+case "z1526":
+ notevil = (notevil + 1526)/2;
+ break;
+case "z1527":
+ notevil = (notevil + 1527)/2;
+ break;
+case "z1528":
+ notevil = (notevil + 1528)/2;
+ break;
+case "z1529":
+ notevil = (notevil + 1529)/2;
+ break;
+case "z1530":
+ notevil = (notevil + 1530)/2;
+ break;
+case "z1531":
+ notevil = (notevil + 1531)/2;
+ break;
+case "z1532":
+ notevil = (notevil + 1532)/2;
+ break;
+case "z1533":
+ notevil = (notevil + 1533)/2;
+ break;
+case "z1534":
+ notevil = (notevil + 1534)/2;
+ break;
+case "z1535":
+ notevil = (notevil + 1535)/2;
+ break;
+case "z1536":
+ notevil = (notevil + 1536)/2;
+ break;
+case "z1537":
+ notevil = (notevil + 1537)/2;
+ break;
+case "z1538":
+ notevil = (notevil + 1538)/2;
+ break;
+case "z1539":
+ notevil = (notevil + 1539)/2;
+ break;
+case "z1540":
+ notevil = (notevil + 1540)/2;
+ break;
+case "z1541":
+ notevil = (notevil + 1541)/2;
+ break;
+case "z1542":
+ notevil = (notevil + 1542)/2;
+ break;
+case "z1543":
+ notevil = (notevil + 1543)/2;
+ break;
+case "z1544":
+ notevil = (notevil + 1544)/2;
+ break;
+case "z1545":
+ notevil = (notevil + 1545)/2;
+ break;
+case "z1546":
+ notevil = (notevil + 1546)/2;
+ break;
+case "z1547":
+ notevil = (notevil + 1547)/2;
+ break;
+case "z1548":
+ notevil = (notevil + 1548)/2;
+ break;
+case "z1549":
+ notevil = (notevil + 1549)/2;
+ break;
+case "z1550":
+ notevil = (notevil + 1550)/2;
+ break;
+case "z1551":
+ notevil = (notevil + 1551)/2;
+ break;
+case "z1552":
+ notevil = (notevil + 1552)/2;
+ break;
+case "z1553":
+ notevil = (notevil + 1553)/2;
+ break;
+case "z1554":
+ notevil = (notevil + 1554)/2;
+ break;
+case "z1555":
+ notevil = (notevil + 1555)/2;
+ break;
+case "z1556":
+ notevil = (notevil + 1556)/2;
+ break;
+case "z1557":
+ notevil = (notevil + 1557)/2;
+ break;
+case "z1558":
+ notevil = (notevil + 1558)/2;
+ break;
+case "z1559":
+ notevil = (notevil + 1559)/2;
+ break;
+case "z1560":
+ notevil = (notevil + 1560)/2;
+ break;
+case "z1561":
+ notevil = (notevil + 1561)/2;
+ break;
+case "z1562":
+ notevil = (notevil + 1562)/2;
+ break;
+case "z1563":
+ notevil = (notevil + 1563)/2;
+ break;
+case "z1564":
+ notevil = (notevil + 1564)/2;
+ break;
+case "z1565":
+ notevil = (notevil + 1565)/2;
+ break;
+case "z1566":
+ notevil = (notevil + 1566)/2;
+ break;
+case "z1567":
+ notevil = (notevil + 1567)/2;
+ break;
+case "z1568":
+ notevil = (notevil + 1568)/2;
+ break;
+case "z1569":
+ notevil = (notevil + 1569)/2;
+ break;
+case "z1570":
+ notevil = (notevil + 1570)/2;
+ break;
+case "z1571":
+ notevil = (notevil + 1571)/2;
+ break;
+case "z1572":
+ notevil = (notevil + 1572)/2;
+ break;
+case "z1573":
+ notevil = (notevil + 1573)/2;
+ break;
+case "z1574":
+ notevil = (notevil + 1574)/2;
+ break;
+case "z1575":
+ notevil = (notevil + 1575)/2;
+ break;
+case "z1576":
+ notevil = (notevil + 1576)/2;
+ break;
+case "z1577":
+ notevil = (notevil + 1577)/2;
+ break;
+case "z1578":
+ notevil = (notevil + 1578)/2;
+ break;
+case "z1579":
+ notevil = (notevil + 1579)/2;
+ break;
+case "z1580":
+ notevil = (notevil + 1580)/2;
+ break;
+case "z1581":
+ notevil = (notevil + 1581)/2;
+ break;
+case "z1582":
+ notevil = (notevil + 1582)/2;
+ break;
+case "z1583":
+ notevil = (notevil + 1583)/2;
+ break;
+case "z1584":
+ notevil = (notevil + 1584)/2;
+ break;
+case "z1585":
+ notevil = (notevil + 1585)/2;
+ break;
+case "z1586":
+ notevil = (notevil + 1586)/2;
+ break;
+case "z1587":
+ notevil = (notevil + 1587)/2;
+ break;
+case "z1588":
+ notevil = (notevil + 1588)/2;
+ break;
+case "z1589":
+ notevil = (notevil + 1589)/2;
+ break;
+case "z1590":
+ notevil = (notevil + 1590)/2;
+ break;
+case "z1591":
+ notevil = (notevil + 1591)/2;
+ break;
+case "z1592":
+ notevil = (notevil + 1592)/2;
+ break;
+case "z1593":
+ notevil = (notevil + 1593)/2;
+ break;
+case "z1594":
+ notevil = (notevil + 1594)/2;
+ break;
+case "z1595":
+ notevil = (notevil + 1595)/2;
+ break;
+case "z1596":
+ notevil = (notevil + 1596)/2;
+ break;
+case "z1597":
+ notevil = (notevil + 1597)/2;
+ break;
+case "z1598":
+ notevil = (notevil + 1598)/2;
+ break;
+case "z1599":
+ notevil = (notevil + 1599)/2;
+ break;
+case "z1600":
+ notevil = (notevil + 1600)/2;
+ break;
+case "z1601":
+ notevil = (notevil + 1601)/2;
+ break;
+case "z1602":
+ notevil = (notevil + 1602)/2;
+ break;
+case "z1603":
+ notevil = (notevil + 1603)/2;
+ break;
+case "z1604":
+ notevil = (notevil + 1604)/2;
+ break;
+case "z1605":
+ notevil = (notevil + 1605)/2;
+ break;
+case "z1606":
+ notevil = (notevil + 1606)/2;
+ break;
+case "z1607":
+ notevil = (notevil + 1607)/2;
+ break;
+case "z1608":
+ notevil = (notevil + 1608)/2;
+ break;
+case "z1609":
+ notevil = (notevil + 1609)/2;
+ break;
+case "z1610":
+ notevil = (notevil + 1610)/2;
+ break;
+case "z1611":
+ notevil = (notevil + 1611)/2;
+ break;
+case "z1612":
+ notevil = (notevil + 1612)/2;
+ break;
+case "z1613":
+ notevil = (notevil + 1613)/2;
+ break;
+case "z1614":
+ notevil = (notevil + 1614)/2;
+ break;
+case "z1615":
+ notevil = (notevil + 1615)/2;
+ break;
+case "z1616":
+ notevil = (notevil + 1616)/2;
+ break;
+case "z1617":
+ notevil = (notevil + 1617)/2;
+ break;
+case "z1618":
+ notevil = (notevil + 1618)/2;
+ break;
+case "z1619":
+ notevil = (notevil + 1619)/2;
+ break;
+case "z1620":
+ notevil = (notevil + 1620)/2;
+ break;
+case "z1621":
+ notevil = (notevil + 1621)/2;
+ break;
+case "z1622":
+ notevil = (notevil + 1622)/2;
+ break;
+case "z1623":
+ notevil = (notevil + 1623)/2;
+ break;
+case "z1624":
+ notevil = (notevil + 1624)/2;
+ break;
+case "z1625":
+ notevil = (notevil + 1625)/2;
+ break;
+case "z1626":
+ notevil = (notevil + 1626)/2;
+ break;
+case "z1627":
+ notevil = (notevil + 1627)/2;
+ break;
+case "z1628":
+ notevil = (notevil + 1628)/2;
+ break;
+case "z1629":
+ notevil = (notevil + 1629)/2;
+ break;
+case "z1630":
+ notevil = (notevil + 1630)/2;
+ break;
+case "z1631":
+ notevil = (notevil + 1631)/2;
+ break;
+case "z1632":
+ notevil = (notevil + 1632)/2;
+ break;
+case "z1633":
+ notevil = (notevil + 1633)/2;
+ break;
+case "z1634":
+ notevil = (notevil + 1634)/2;
+ break;
+case "z1635":
+ notevil = (notevil + 1635)/2;
+ break;
+case "z1636":
+ notevil = (notevil + 1636)/2;
+ break;
+case "z1637":
+ notevil = (notevil + 1637)/2;
+ break;
+case "z1638":
+ notevil = (notevil + 1638)/2;
+ break;
+case "z1639":
+ notevil = (notevil + 1639)/2;
+ break;
+case "z1640":
+ notevil = (notevil + 1640)/2;
+ break;
+case "z1641":
+ notevil = (notevil + 1641)/2;
+ break;
+case "z1642":
+ notevil = (notevil + 1642)/2;
+ break;
+case "z1643":
+ notevil = (notevil + 1643)/2;
+ break;
+case "z1644":
+ notevil = (notevil + 1644)/2;
+ break;
+case "z1645":
+ notevil = (notevil + 1645)/2;
+ break;
+case "z1646":
+ notevil = (notevil + 1646)/2;
+ break;
+case "z1647":
+ notevil = (notevil + 1647)/2;
+ break;
+case "z1648":
+ notevil = (notevil + 1648)/2;
+ break;
+case "z1649":
+ notevil = (notevil + 1649)/2;
+ break;
+case "z1650":
+ notevil = (notevil + 1650)/2;
+ break;
+case "z1651":
+ notevil = (notevil + 1651)/2;
+ break;
+case "z1652":
+ notevil = (notevil + 1652)/2;
+ break;
+case "z1653":
+ notevil = (notevil + 1653)/2;
+ break;
+case "z1654":
+ notevil = (notevil + 1654)/2;
+ break;
+case "z1655":
+ notevil = (notevil + 1655)/2;
+ break;
+case "z1656":
+ notevil = (notevil + 1656)/2;
+ break;
+case "z1657":
+ notevil = (notevil + 1657)/2;
+ break;
+case "z1658":
+ notevil = (notevil + 1658)/2;
+ break;
+case "z1659":
+ notevil = (notevil + 1659)/2;
+ break;
+case "z1660":
+ notevil = (notevil + 1660)/2;
+ break;
+case "z1661":
+ notevil = (notevil + 1661)/2;
+ break;
+case "z1662":
+ notevil = (notevil + 1662)/2;
+ break;
+case "z1663":
+ notevil = (notevil + 1663)/2;
+ break;
+case "z1664":
+ notevil = (notevil + 1664)/2;
+ break;
+case "z1665":
+ notevil = (notevil + 1665)/2;
+ break;
+case "z1666":
+ notevil = (notevil + 1666)/2;
+ break;
+case "z1667":
+ notevil = (notevil + 1667)/2;
+ break;
+case "z1668":
+ notevil = (notevil + 1668)/2;
+ break;
+case "z1669":
+ notevil = (notevil + 1669)/2;
+ break;
+case "z1670":
+ notevil = (notevil + 1670)/2;
+ break;
+case "z1671":
+ notevil = (notevil + 1671)/2;
+ break;
+case "z1672":
+ notevil = (notevil + 1672)/2;
+ break;
+case "z1673":
+ notevil = (notevil + 1673)/2;
+ break;
+case "z1674":
+ notevil = (notevil + 1674)/2;
+ break;
+case "z1675":
+ notevil = (notevil + 1675)/2;
+ break;
+case "z1676":
+ notevil = (notevil + 1676)/2;
+ break;
+case "z1677":
+ notevil = (notevil + 1677)/2;
+ break;
+case "z1678":
+ notevil = (notevil + 1678)/2;
+ break;
+case "z1679":
+ notevil = (notevil + 1679)/2;
+ break;
+case "z1680":
+ notevil = (notevil + 1680)/2;
+ break;
+case "z1681":
+ notevil = (notevil + 1681)/2;
+ break;
+case "z1682":
+ notevil = (notevil + 1682)/2;
+ break;
+case "z1683":
+ notevil = (notevil + 1683)/2;
+ break;
+case "z1684":
+ notevil = (notevil + 1684)/2;
+ break;
+case "z1685":
+ notevil = (notevil + 1685)/2;
+ break;
+case "z1686":
+ notevil = (notevil + 1686)/2;
+ break;
+case "z1687":
+ notevil = (notevil + 1687)/2;
+ break;
+case "z1688":
+ notevil = (notevil + 1688)/2;
+ break;
+case "z1689":
+ notevil = (notevil + 1689)/2;
+ break;
+case "z1690":
+ notevil = (notevil + 1690)/2;
+ break;
+case "z1691":
+ notevil = (notevil + 1691)/2;
+ break;
+case "z1692":
+ notevil = (notevil + 1692)/2;
+ break;
+case "z1693":
+ notevil = (notevil + 1693)/2;
+ break;
+case "z1694":
+ notevil = (notevil + 1694)/2;
+ break;
+case "z1695":
+ notevil = (notevil + 1695)/2;
+ break;
+case "z1696":
+ notevil = (notevil + 1696)/2;
+ break;
+case "z1697":
+ notevil = (notevil + 1697)/2;
+ break;
+case "z1698":
+ notevil = (notevil + 1698)/2;
+ break;
+case "z1699":
+ notevil = (notevil + 1699)/2;
+ break;
+case "z1700":
+ notevil = (notevil + 1700)/2;
+ break;
+case "z1701":
+ notevil = (notevil + 1701)/2;
+ break;
+case "z1702":
+ notevil = (notevil + 1702)/2;
+ break;
+case "z1703":
+ notevil = (notevil + 1703)/2;
+ break;
+case "z1704":
+ notevil = (notevil + 1704)/2;
+ break;
+case "z1705":
+ notevil = (notevil + 1705)/2;
+ break;
+case "z1706":
+ notevil = (notevil + 1706)/2;
+ break;
+case "z1707":
+ notevil = (notevil + 1707)/2;
+ break;
+case "z1708":
+ notevil = (notevil + 1708)/2;
+ break;
+case "z1709":
+ notevil = (notevil + 1709)/2;
+ break;
+case "z1710":
+ notevil = (notevil + 1710)/2;
+ break;
+case "z1711":
+ notevil = (notevil + 1711)/2;
+ break;
+case "z1712":
+ notevil = (notevil + 1712)/2;
+ break;
+case "z1713":
+ notevil = (notevil + 1713)/2;
+ break;
+case "z1714":
+ notevil = (notevil + 1714)/2;
+ break;
+case "z1715":
+ notevil = (notevil + 1715)/2;
+ break;
+case "z1716":
+ notevil = (notevil + 1716)/2;
+ break;
+case "z1717":
+ notevil = (notevil + 1717)/2;
+ break;
+case "z1718":
+ notevil = (notevil + 1718)/2;
+ break;
+case "z1719":
+ notevil = (notevil + 1719)/2;
+ break;
+case "z1720":
+ notevil = (notevil + 1720)/2;
+ break;
+case "z1721":
+ notevil = (notevil + 1721)/2;
+ break;
+case "z1722":
+ notevil = (notevil + 1722)/2;
+ break;
+case "z1723":
+ notevil = (notevil + 1723)/2;
+ break;
+case "z1724":
+ notevil = (notevil + 1724)/2;
+ break;
+case "z1725":
+ notevil = (notevil + 1725)/2;
+ break;
+case "z1726":
+ notevil = (notevil + 1726)/2;
+ break;
+case "z1727":
+ notevil = (notevil + 1727)/2;
+ break;
+case "z1728":
+ notevil = (notevil + 1728)/2;
+ break;
+case "z1729":
+ notevil = (notevil + 1729)/2;
+ break;
+case "z1730":
+ notevil = (notevil + 1730)/2;
+ break;
+case "z1731":
+ notevil = (notevil + 1731)/2;
+ break;
+case "z1732":
+ notevil = (notevil + 1732)/2;
+ break;
+case "z1733":
+ notevil = (notevil + 1733)/2;
+ break;
+case "z1734":
+ notevil = (notevil + 1734)/2;
+ break;
+case "z1735":
+ notevil = (notevil + 1735)/2;
+ break;
+case "z1736":
+ notevil = (notevil + 1736)/2;
+ break;
+case "z1737":
+ notevil = (notevil + 1737)/2;
+ break;
+case "z1738":
+ notevil = (notevil + 1738)/2;
+ break;
+case "z1739":
+ notevil = (notevil + 1739)/2;
+ break;
+case "z1740":
+ notevil = (notevil + 1740)/2;
+ break;
+case "z1741":
+ notevil = (notevil + 1741)/2;
+ break;
+case "z1742":
+ notevil = (notevil + 1742)/2;
+ break;
+case "z1743":
+ notevil = (notevil + 1743)/2;
+ break;
+case "z1744":
+ notevil = (notevil + 1744)/2;
+ break;
+case "z1745":
+ notevil = (notevil + 1745)/2;
+ break;
+case "z1746":
+ notevil = (notevil + 1746)/2;
+ break;
+case "z1747":
+ notevil = (notevil + 1747)/2;
+ break;
+case "z1748":
+ notevil = (notevil + 1748)/2;
+ break;
+case "z1749":
+ notevil = (notevil + 1749)/2;
+ break;
+case "z1750":
+ notevil = (notevil + 1750)/2;
+ break;
+case "z1751":
+ notevil = (notevil + 1751)/2;
+ break;
+case "z1752":
+ notevil = (notevil + 1752)/2;
+ break;
+case "z1753":
+ notevil = (notevil + 1753)/2;
+ break;
+case "z1754":
+ notevil = (notevil + 1754)/2;
+ break;
+case "z1755":
+ notevil = (notevil + 1755)/2;
+ break;
+case "z1756":
+ notevil = (notevil + 1756)/2;
+ break;
+case "z1757":
+ notevil = (notevil + 1757)/2;
+ break;
+case "z1758":
+ notevil = (notevil + 1758)/2;
+ break;
+case "z1759":
+ notevil = (notevil + 1759)/2;
+ break;
+case "z1760":
+ notevil = (notevil + 1760)/2;
+ break;
+case "z1761":
+ notevil = (notevil + 1761)/2;
+ break;
+case "z1762":
+ notevil = (notevil + 1762)/2;
+ break;
+case "z1763":
+ notevil = (notevil + 1763)/2;
+ break;
+case "z1764":
+ notevil = (notevil + 1764)/2;
+ break;
+case "z1765":
+ notevil = (notevil + 1765)/2;
+ break;
+case "z1766":
+ notevil = (notevil + 1766)/2;
+ break;
+case "z1767":
+ notevil = (notevil + 1767)/2;
+ break;
+case "z1768":
+ notevil = (notevil + 1768)/2;
+ break;
+case "z1769":
+ notevil = (notevil + 1769)/2;
+ break;
+case "z1770":
+ notevil = (notevil + 1770)/2;
+ break;
+case "z1771":
+ notevil = (notevil + 1771)/2;
+ break;
+case "z1772":
+ notevil = (notevil + 1772)/2;
+ break;
+case "z1773":
+ notevil = (notevil + 1773)/2;
+ break;
+case "z1774":
+ notevil = (notevil + 1774)/2;
+ break;
+case "z1775":
+ notevil = (notevil + 1775)/2;
+ break;
+case "z1776":
+ notevil = (notevil + 1776)/2;
+ break;
+case "z1777":
+ notevil = (notevil + 1777)/2;
+ break;
+case "z1778":
+ notevil = (notevil + 1778)/2;
+ break;
+case "z1779":
+ notevil = (notevil + 1779)/2;
+ break;
+case "z1780":
+ notevil = (notevil + 1780)/2;
+ break;
+case "z1781":
+ notevil = (notevil + 1781)/2;
+ break;
+case "z1782":
+ notevil = (notevil + 1782)/2;
+ break;
+case "z1783":
+ notevil = (notevil + 1783)/2;
+ break;
+case "z1784":
+ notevil = (notevil + 1784)/2;
+ break;
+case "z1785":
+ notevil = (notevil + 1785)/2;
+ break;
+case "z1786":
+ notevil = (notevil + 1786)/2;
+ break;
+case "z1787":
+ notevil = (notevil + 1787)/2;
+ break;
+case "z1788":
+ notevil = (notevil + 1788)/2;
+ break;
+case "z1789":
+ notevil = (notevil + 1789)/2;
+ break;
+case "z1790":
+ notevil = (notevil + 1790)/2;
+ break;
+case "z1791":
+ notevil = (notevil + 1791)/2;
+ break;
+case "z1792":
+ notevil = (notevil + 1792)/2;
+ break;
+case "z1793":
+ notevil = (notevil + 1793)/2;
+ break;
+case "z1794":
+ notevil = (notevil + 1794)/2;
+ break;
+case "z1795":
+ notevil = (notevil + 1795)/2;
+ break;
+case "z1796":
+ notevil = (notevil + 1796)/2;
+ break;
+case "z1797":
+ notevil = (notevil + 1797)/2;
+ break;
+case "z1798":
+ notevil = (notevil + 1798)/2;
+ break;
+case "z1799":
+ notevil = (notevil + 1799)/2;
+ break;
+
+default:
+ dut = 3;
+ break;
+}
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-001.js
new file mode 100644
index 0000000000..93dc425f72
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-001.js
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 01 May 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 74474
+ *"switch() misbehaves with duplicated labels"
+ *
+ * See ECMA3 Section 12.11, "The switch Statement"
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=74474
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-74474-001.js';
+var UBound = 0;
+var BUGNUMBER = 74474;
+var summary = 'Testing switch statements with duplicate labels';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+
+status = 'Section A of test: the string literal "1" as a duplicate label';
+actual = '';
+switch ('1')
+{
+case '1':
+ actual += 'a';
+case '1':
+ actual += 'b';
+}
+expect = 'ab';
+addThis();
+
+
+status = 'Section B of test: the numeric literal 1 as a duplicate label';
+actual = '';
+switch (1)
+{
+case 1:
+ actual += 'a';
+case 1:
+ actual += 'b';
+}
+expect = 'ab';
+addThis();
+
+
+status = 'Section C of test: the numeric literal 1 as a duplicate label, via a function parameter';
+tryThis(1);
+function tryThis(x)
+{
+ actual = '';
+
+ switch (x)
+ {
+ case x:
+ actual += 'a';
+ case x:
+ actual += 'b';
+ }
+}
+expect = 'ab';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], getStatus(i));
+ }
+
+ exitFunc ('test');
+}
+
+
+function getStatus(i)
+{
+ return statusitems[i];
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-002.js
new file mode 100644
index 0000000000..1c54849c48
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-002.js
@@ -0,0 +1,9097 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * brendan@mozilla.org, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 09 May 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 74474
+ * "switch() misbehaves with duplicated labels"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=74474
+ * See ECMA3 Section 12.11, "The switch Statement"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-74474-002.js';
+var UBound = 0;
+var BUGNUMBER = 74474;
+var summary = 'Test of switch statement that overflows the stack-allocated bitmap';
+var status = '(No duplicated labels)';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var x = 3;
+
+
+switch (x)
+{
+case 0:
+case 1:
+case 2:
+case 3:
+case 4:
+case 5:
+case 6:
+case 7:
+case 8:
+case 9:
+case 10:
+case 11:
+case 12:
+case 13:
+case 14:
+case 15:
+case 16:
+case 17:
+case 18:
+case 19:
+case 20:
+case 21:
+case 22:
+case 23:
+case 24:
+case 25:
+case 26:
+case 27:
+case 28:
+case 29:
+case 30:
+case 31:
+case 32:
+case 33:
+case 34:
+case 35:
+case 36:
+case 37:
+case 38:
+case 39:
+case 40:
+case 41:
+case 42:
+case 43:
+case 44:
+case 45:
+case 46:
+case 47:
+case 48:
+case 49:
+case 50:
+case 51:
+case 52:
+case 53:
+case 54:
+case 55:
+case 56:
+case 57:
+case 58:
+case 59:
+case 60:
+case 61:
+case 62:
+case 63:
+case 64:
+case 65:
+case 66:
+case 67:
+case 68:
+case 69:
+case 70:
+case 71:
+case 72:
+case 73:
+case 74:
+case 75:
+case 76:
+case 77:
+case 78:
+case 79:
+case 80:
+case 81:
+case 82:
+case 83:
+case 84:
+case 85:
+case 86:
+case 87:
+case 88:
+case 89:
+case 90:
+case 91:
+case 92:
+case 93:
+case 94:
+case 95:
+case 96:
+case 97:
+case 98:
+case 99:
+case 100:
+case 101:
+case 102:
+case 103:
+case 104:
+case 105:
+case 106:
+case 107:
+case 108:
+case 109:
+case 110:
+case 111:
+case 112:
+case 113:
+case 114:
+case 115:
+case 116:
+case 117:
+case 118:
+case 119:
+case 120:
+case 121:
+case 122:
+case 123:
+case 124:
+case 125:
+case 126:
+case 127:
+case 128:
+case 129:
+case 130:
+case 131:
+case 132:
+case 133:
+case 134:
+case 135:
+case 136:
+case 137:
+case 138:
+case 139:
+case 140:
+case 141:
+case 142:
+case 143:
+case 144:
+case 145:
+case 146:
+case 147:
+case 148:
+case 149:
+case 150:
+case 151:
+case 152:
+case 153:
+case 154:
+case 155:
+case 156:
+case 157:
+case 158:
+case 159:
+case 160:
+case 161:
+case 162:
+case 163:
+case 164:
+case 165:
+case 166:
+case 167:
+case 168:
+case 169:
+case 170:
+case 171:
+case 172:
+case 173:
+case 174:
+case 175:
+case 176:
+case 177:
+case 178:
+case 179:
+case 180:
+case 181:
+case 182:
+case 183:
+case 184:
+case 185:
+case 186:
+case 187:
+case 188:
+case 189:
+case 190:
+case 191:
+case 192:
+case 193:
+case 194:
+case 195:
+case 196:
+case 197:
+case 198:
+case 199:
+case 200:
+case 201:
+case 202:
+case 203:
+case 204:
+case 205:
+case 206:
+case 207:
+case 208:
+case 209:
+case 210:
+case 211:
+case 212:
+case 213:
+case 214:
+case 215:
+case 216:
+case 217:
+case 218:
+case 219:
+case 220:
+case 221:
+case 222:
+case 223:
+case 224:
+case 225:
+case 226:
+case 227:
+case 228:
+case 229:
+case 230:
+case 231:
+case 232:
+case 233:
+case 234:
+case 235:
+case 236:
+case 237:
+case 238:
+case 239:
+case 240:
+case 241:
+case 242:
+case 243:
+case 244:
+case 245:
+case 246:
+case 247:
+case 248:
+case 249:
+case 250:
+case 251:
+case 252:
+case 253:
+case 254:
+case 255:
+case 256:
+case 257:
+case 258:
+case 259:
+case 260:
+case 261:
+case 262:
+case 263:
+case 264:
+case 265:
+case 266:
+case 267:
+case 268:
+case 269:
+case 270:
+case 271:
+case 272:
+case 273:
+case 274:
+case 275:
+case 276:
+case 277:
+case 278:
+case 279:
+case 280:
+case 281:
+case 282:
+case 283:
+case 284:
+case 285:
+case 286:
+case 287:
+case 288:
+case 289:
+case 290:
+case 291:
+case 292:
+case 293:
+case 294:
+case 295:
+case 296:
+case 297:
+case 298:
+case 299:
+case 300:
+case 301:
+case 302:
+case 303:
+case 304:
+case 305:
+case 306:
+case 307:
+case 308:
+case 309:
+case 310:
+case 311:
+case 312:
+case 313:
+case 314:
+case 315:
+case 316:
+case 317:
+case 318:
+case 319:
+case 320:
+case 321:
+case 322:
+case 323:
+case 324:
+case 325:
+case 326:
+case 327:
+case 328:
+case 329:
+case 330:
+case 331:
+case 332:
+case 333:
+case 334:
+case 335:
+case 336:
+case 337:
+case 338:
+case 339:
+case 340:
+case 341:
+case 342:
+case 343:
+case 344:
+case 345:
+case 346:
+case 347:
+case 348:
+case 349:
+case 350:
+case 351:
+case 352:
+case 353:
+case 354:
+case 355:
+case 356:
+case 357:
+case 358:
+case 359:
+case 360:
+case 361:
+case 362:
+case 363:
+case 364:
+case 365:
+case 366:
+case 367:
+case 368:
+case 369:
+case 370:
+case 371:
+case 372:
+case 373:
+case 374:
+case 375:
+case 376:
+case 377:
+case 378:
+case 379:
+case 380:
+case 381:
+case 382:
+case 383:
+case 384:
+case 385:
+case 386:
+case 387:
+case 388:
+case 389:
+case 390:
+case 391:
+case 392:
+case 393:
+case 394:
+case 395:
+case 396:
+case 397:
+case 398:
+case 399:
+case 400:
+case 401:
+case 402:
+case 403:
+case 404:
+case 405:
+case 406:
+case 407:
+case 408:
+case 409:
+case 410:
+case 411:
+case 412:
+case 413:
+case 414:
+case 415:
+case 416:
+case 417:
+case 418:
+case 419:
+case 420:
+case 421:
+case 422:
+case 423:
+case 424:
+case 425:
+case 426:
+case 427:
+case 428:
+case 429:
+case 430:
+case 431:
+case 432:
+case 433:
+case 434:
+case 435:
+case 436:
+case 437:
+case 438:
+case 439:
+case 440:
+case 441:
+case 442:
+case 443:
+case 444:
+case 445:
+case 446:
+case 447:
+case 448:
+case 449:
+case 450:
+case 451:
+case 452:
+case 453:
+case 454:
+case 455:
+case 456:
+case 457:
+case 458:
+case 459:
+case 460:
+case 461:
+case 462:
+case 463:
+case 464:
+case 465:
+case 466:
+case 467:
+case 468:
+case 469:
+case 470:
+case 471:
+case 472:
+case 473:
+case 474:
+case 475:
+case 476:
+case 477:
+case 478:
+case 479:
+case 480:
+case 481:
+case 482:
+case 483:
+case 484:
+case 485:
+case 486:
+case 487:
+case 488:
+case 489:
+case 490:
+case 491:
+case 492:
+case 493:
+case 494:
+case 495:
+case 496:
+case 497:
+case 498:
+case 499:
+case 500:
+case 501:
+case 502:
+case 503:
+case 504:
+case 505:
+case 506:
+case 507:
+case 508:
+case 509:
+case 510:
+case 511:
+case 512:
+case 513:
+case 514:
+case 515:
+case 516:
+case 517:
+case 518:
+case 519:
+case 520:
+case 521:
+case 522:
+case 523:
+case 524:
+case 525:
+case 526:
+case 527:
+case 528:
+case 529:
+case 530:
+case 531:
+case 532:
+case 533:
+case 534:
+case 535:
+case 536:
+case 537:
+case 538:
+case 539:
+case 540:
+case 541:
+case 542:
+case 543:
+case 544:
+case 545:
+case 546:
+case 547:
+case 548:
+case 549:
+case 550:
+case 551:
+case 552:
+case 553:
+case 554:
+case 555:
+case 556:
+case 557:
+case 558:
+case 559:
+case 560:
+case 561:
+case 562:
+case 563:
+case 564:
+case 565:
+case 566:
+case 567:
+case 568:
+case 569:
+case 570:
+case 571:
+case 572:
+case 573:
+case 574:
+case 575:
+case 576:
+case 577:
+case 578:
+case 579:
+case 580:
+case 581:
+case 582:
+case 583:
+case 584:
+case 585:
+case 586:
+case 587:
+case 588:
+case 589:
+case 590:
+case 591:
+case 592:
+case 593:
+case 594:
+case 595:
+case 596:
+case 597:
+case 598:
+case 599:
+case 600:
+case 601:
+case 602:
+case 603:
+case 604:
+case 605:
+case 606:
+case 607:
+case 608:
+case 609:
+case 610:
+case 611:
+case 612:
+case 613:
+case 614:
+case 615:
+case 616:
+case 617:
+case 618:
+case 619:
+case 620:
+case 621:
+case 622:
+case 623:
+case 624:
+case 625:
+case 626:
+case 627:
+case 628:
+case 629:
+case 630:
+case 631:
+case 632:
+case 633:
+case 634:
+case 635:
+case 636:
+case 637:
+case 638:
+case 639:
+case 640:
+case 641:
+case 642:
+case 643:
+case 644:
+case 645:
+case 646:
+case 647:
+case 648:
+case 649:
+case 650:
+case 651:
+case 652:
+case 653:
+case 654:
+case 655:
+case 656:
+case 657:
+case 658:
+case 659:
+case 660:
+case 661:
+case 662:
+case 663:
+case 664:
+case 665:
+case 666:
+case 667:
+case 668:
+case 669:
+case 670:
+case 671:
+case 672:
+case 673:
+case 674:
+case 675:
+case 676:
+case 677:
+case 678:
+case 679:
+case 680:
+case 681:
+case 682:
+case 683:
+case 684:
+case 685:
+case 686:
+case 687:
+case 688:
+case 689:
+case 690:
+case 691:
+case 692:
+case 693:
+case 694:
+case 695:
+case 696:
+case 697:
+case 698:
+case 699:
+case 700:
+case 701:
+case 702:
+case 703:
+case 704:
+case 705:
+case 706:
+case 707:
+case 708:
+case 709:
+case 710:
+case 711:
+case 712:
+case 713:
+case 714:
+case 715:
+case 716:
+case 717:
+case 718:
+case 719:
+case 720:
+case 721:
+case 722:
+case 723:
+case 724:
+case 725:
+case 726:
+case 727:
+case 728:
+case 729:
+case 730:
+case 731:
+case 732:
+case 733:
+case 734:
+case 735:
+case 736:
+case 737:
+case 738:
+case 739:
+case 740:
+case 741:
+case 742:
+case 743:
+case 744:
+case 745:
+case 746:
+case 747:
+case 748:
+case 749:
+case 750:
+case 751:
+case 752:
+case 753:
+case 754:
+case 755:
+case 756:
+case 757:
+case 758:
+case 759:
+case 760:
+case 761:
+case 762:
+case 763:
+case 764:
+case 765:
+case 766:
+case 767:
+case 768:
+case 769:
+case 770:
+case 771:
+case 772:
+case 773:
+case 774:
+case 775:
+case 776:
+case 777:
+case 778:
+case 779:
+case 780:
+case 781:
+case 782:
+case 783:
+case 784:
+case 785:
+case 786:
+case 787:
+case 788:
+case 789:
+case 790:
+case 791:
+case 792:
+case 793:
+case 794:
+case 795:
+case 796:
+case 797:
+case 798:
+case 799:
+case 800:
+case 801:
+case 802:
+case 803:
+case 804:
+case 805:
+case 806:
+case 807:
+case 808:
+case 809:
+case 810:
+case 811:
+case 812:
+case 813:
+case 814:
+case 815:
+case 816:
+case 817:
+case 818:
+case 819:
+case 820:
+case 821:
+case 822:
+case 823:
+case 824:
+case 825:
+case 826:
+case 827:
+case 828:
+case 829:
+case 830:
+case 831:
+case 832:
+case 833:
+case 834:
+case 835:
+case 836:
+case 837:
+case 838:
+case 839:
+case 840:
+case 841:
+case 842:
+case 843:
+case 844:
+case 845:
+case 846:
+case 847:
+case 848:
+case 849:
+case 850:
+case 851:
+case 852:
+case 853:
+case 854:
+case 855:
+case 856:
+case 857:
+case 858:
+case 859:
+case 860:
+case 861:
+case 862:
+case 863:
+case 864:
+case 865:
+case 866:
+case 867:
+case 868:
+case 869:
+case 870:
+case 871:
+case 872:
+case 873:
+case 874:
+case 875:
+case 876:
+case 877:
+case 878:
+case 879:
+case 880:
+case 881:
+case 882:
+case 883:
+case 884:
+case 885:
+case 886:
+case 887:
+case 888:
+case 889:
+case 890:
+case 891:
+case 892:
+case 893:
+case 894:
+case 895:
+case 896:
+case 897:
+case 898:
+case 899:
+case 900:
+case 901:
+case 902:
+case 903:
+case 904:
+case 905:
+case 906:
+case 907:
+case 908:
+case 909:
+case 910:
+case 911:
+case 912:
+case 913:
+case 914:
+case 915:
+case 916:
+case 917:
+case 918:
+case 919:
+case 920:
+case 921:
+case 922:
+case 923:
+case 924:
+case 925:
+case 926:
+case 927:
+case 928:
+case 929:
+case 930:
+case 931:
+case 932:
+case 933:
+case 934:
+case 935:
+case 936:
+case 937:
+case 938:
+case 939:
+case 940:
+case 941:
+case 942:
+case 943:
+case 944:
+case 945:
+case 946:
+case 947:
+case 948:
+case 949:
+case 950:
+case 951:
+case 952:
+case 953:
+case 954:
+case 955:
+case 956:
+case 957:
+case 958:
+case 959:
+case 960:
+case 961:
+case 962:
+case 963:
+case 964:
+case 965:
+case 966:
+case 967:
+case 968:
+case 969:
+case 970:
+case 971:
+case 972:
+case 973:
+case 974:
+case 975:
+case 976:
+case 977:
+case 978:
+case 979:
+case 980:
+case 981:
+case 982:
+case 983:
+case 984:
+case 985:
+case 986:
+case 987:
+case 988:
+case 989:
+case 990:
+case 991:
+case 992:
+case 993:
+case 994:
+case 995:
+case 996:
+case 997:
+case 998:
+case 999:
+case 1000:
+case 1001:
+case 1002:
+case 1003:
+case 1004:
+case 1005:
+case 1006:
+case 1007:
+case 1008:
+case 1009:
+case 1010:
+case 1011:
+case 1012:
+case 1013:
+case 1014:
+case 1015:
+case 1016:
+case 1017:
+case 1018:
+case 1019:
+case 1020:
+case 1021:
+case 1022:
+case 1023:
+case 1024:
+case 1025:
+case 1026:
+case 1027:
+case 1028:
+case 1029:
+case 1030:
+case 1031:
+case 1032:
+case 1033:
+case 1034:
+case 1035:
+case 1036:
+case 1037:
+case 1038:
+case 1039:
+case 1040:
+case 1041:
+case 1042:
+case 1043:
+case 1044:
+case 1045:
+case 1046:
+case 1047:
+case 1048:
+case 1049:
+case 1050:
+case 1051:
+case 1052:
+case 1053:
+case 1054:
+case 1055:
+case 1056:
+case 1057:
+case 1058:
+case 1059:
+case 1060:
+case 1061:
+case 1062:
+case 1063:
+case 1064:
+case 1065:
+case 1066:
+case 1067:
+case 1068:
+case 1069:
+case 1070:
+case 1071:
+case 1072:
+case 1073:
+case 1074:
+case 1075:
+case 1076:
+case 1077:
+case 1078:
+case 1079:
+case 1080:
+case 1081:
+case 1082:
+case 1083:
+case 1084:
+case 1085:
+case 1086:
+case 1087:
+case 1088:
+case 1089:
+case 1090:
+case 1091:
+case 1092:
+case 1093:
+case 1094:
+case 1095:
+case 1096:
+case 1097:
+case 1098:
+case 1099:
+case 1100:
+case 1101:
+case 1102:
+case 1103:
+case 1104:
+case 1105:
+case 1106:
+case 1107:
+case 1108:
+case 1109:
+case 1110:
+case 1111:
+case 1112:
+case 1113:
+case 1114:
+case 1115:
+case 1116:
+case 1117:
+case 1118:
+case 1119:
+case 1120:
+case 1121:
+case 1122:
+case 1123:
+case 1124:
+case 1125:
+case 1126:
+case 1127:
+case 1128:
+case 1129:
+case 1130:
+case 1131:
+case 1132:
+case 1133:
+case 1134:
+case 1135:
+case 1136:
+case 1137:
+case 1138:
+case 1139:
+case 1140:
+case 1141:
+case 1142:
+case 1143:
+case 1144:
+case 1145:
+case 1146:
+case 1147:
+case 1148:
+case 1149:
+case 1150:
+case 1151:
+case 1152:
+case 1153:
+case 1154:
+case 1155:
+case 1156:
+case 1157:
+case 1158:
+case 1159:
+case 1160:
+case 1161:
+case 1162:
+case 1163:
+case 1164:
+case 1165:
+case 1166:
+case 1167:
+case 1168:
+case 1169:
+case 1170:
+case 1171:
+case 1172:
+case 1173:
+case 1174:
+case 1175:
+case 1176:
+case 1177:
+case 1178:
+case 1179:
+case 1180:
+case 1181:
+case 1182:
+case 1183:
+case 1184:
+case 1185:
+case 1186:
+case 1187:
+case 1188:
+case 1189:
+case 1190:
+case 1191:
+case 1192:
+case 1193:
+case 1194:
+case 1195:
+case 1196:
+case 1197:
+case 1198:
+case 1199:
+case 1200:
+case 1201:
+case 1202:
+case 1203:
+case 1204:
+case 1205:
+case 1206:
+case 1207:
+case 1208:
+case 1209:
+case 1210:
+case 1211:
+case 1212:
+case 1213:
+case 1214:
+case 1215:
+case 1216:
+case 1217:
+case 1218:
+case 1219:
+case 1220:
+case 1221:
+case 1222:
+case 1223:
+case 1224:
+case 1225:
+case 1226:
+case 1227:
+case 1228:
+case 1229:
+case 1230:
+case 1231:
+case 1232:
+case 1233:
+case 1234:
+case 1235:
+case 1236:
+case 1237:
+case 1238:
+case 1239:
+case 1240:
+case 1241:
+case 1242:
+case 1243:
+case 1244:
+case 1245:
+case 1246:
+case 1247:
+case 1248:
+case 1249:
+case 1250:
+case 1251:
+case 1252:
+case 1253:
+case 1254:
+case 1255:
+case 1256:
+case 1257:
+case 1258:
+case 1259:
+case 1260:
+case 1261:
+case 1262:
+case 1263:
+case 1264:
+case 1265:
+case 1266:
+case 1267:
+case 1268:
+case 1269:
+case 1270:
+case 1271:
+case 1272:
+case 1273:
+case 1274:
+case 1275:
+case 1276:
+case 1277:
+case 1278:
+case 1279:
+case 1280:
+case 1281:
+case 1282:
+case 1283:
+case 1284:
+case 1285:
+case 1286:
+case 1287:
+case 1288:
+case 1289:
+case 1290:
+case 1291:
+case 1292:
+case 1293:
+case 1294:
+case 1295:
+case 1296:
+case 1297:
+case 1298:
+case 1299:
+case 1300:
+case 1301:
+case 1302:
+case 1303:
+case 1304:
+case 1305:
+case 1306:
+case 1307:
+case 1308:
+case 1309:
+case 1310:
+case 1311:
+case 1312:
+case 1313:
+case 1314:
+case 1315:
+case 1316:
+case 1317:
+case 1318:
+case 1319:
+case 1320:
+case 1321:
+case 1322:
+case 1323:
+case 1324:
+case 1325:
+case 1326:
+case 1327:
+case 1328:
+case 1329:
+case 1330:
+case 1331:
+case 1332:
+case 1333:
+case 1334:
+case 1335:
+case 1336:
+case 1337:
+case 1338:
+case 1339:
+case 1340:
+case 1341:
+case 1342:
+case 1343:
+case 1344:
+case 1345:
+case 1346:
+case 1347:
+case 1348:
+case 1349:
+case 1350:
+case 1351:
+case 1352:
+case 1353:
+case 1354:
+case 1355:
+case 1356:
+case 1357:
+case 1358:
+case 1359:
+case 1360:
+case 1361:
+case 1362:
+case 1363:
+case 1364:
+case 1365:
+case 1366:
+case 1367:
+case 1368:
+case 1369:
+case 1370:
+case 1371:
+case 1372:
+case 1373:
+case 1374:
+case 1375:
+case 1376:
+case 1377:
+case 1378:
+case 1379:
+case 1380:
+case 1381:
+case 1382:
+case 1383:
+case 1384:
+case 1385:
+case 1386:
+case 1387:
+case 1388:
+case 1389:
+case 1390:
+case 1391:
+case 1392:
+case 1393:
+case 1394:
+case 1395:
+case 1396:
+case 1397:
+case 1398:
+case 1399:
+case 1400:
+case 1401:
+case 1402:
+case 1403:
+case 1404:
+case 1405:
+case 1406:
+case 1407:
+case 1408:
+case 1409:
+case 1410:
+case 1411:
+case 1412:
+case 1413:
+case 1414:
+case 1415:
+case 1416:
+case 1417:
+case 1418:
+case 1419:
+case 1420:
+case 1421:
+case 1422:
+case 1423:
+case 1424:
+case 1425:
+case 1426:
+case 1427:
+case 1428:
+case 1429:
+case 1430:
+case 1431:
+case 1432:
+case 1433:
+case 1434:
+case 1435:
+case 1436:
+case 1437:
+case 1438:
+case 1439:
+case 1440:
+case 1441:
+case 1442:
+case 1443:
+case 1444:
+case 1445:
+case 1446:
+case 1447:
+case 1448:
+case 1449:
+case 1450:
+case 1451:
+case 1452:
+case 1453:
+case 1454:
+case 1455:
+case 1456:
+case 1457:
+case 1458:
+case 1459:
+case 1460:
+case 1461:
+case 1462:
+case 1463:
+case 1464:
+case 1465:
+case 1466:
+case 1467:
+case 1468:
+case 1469:
+case 1470:
+case 1471:
+case 1472:
+case 1473:
+case 1474:
+case 1475:
+case 1476:
+case 1477:
+case 1478:
+case 1479:
+case 1480:
+case 1481:
+case 1482:
+case 1483:
+case 1484:
+case 1485:
+case 1486:
+case 1487:
+case 1488:
+case 1489:
+case 1490:
+case 1491:
+case 1492:
+case 1493:
+case 1494:
+case 1495:
+case 1496:
+case 1497:
+case 1498:
+case 1499:
+case 1500:
+case 1501:
+case 1502:
+case 1503:
+case 1504:
+case 1505:
+case 1506:
+case 1507:
+case 1508:
+case 1509:
+case 1510:
+case 1511:
+case 1512:
+case 1513:
+case 1514:
+case 1515:
+case 1516:
+case 1517:
+case 1518:
+case 1519:
+case 1520:
+case 1521:
+case 1522:
+case 1523:
+case 1524:
+case 1525:
+case 1526:
+case 1527:
+case 1528:
+case 1529:
+case 1530:
+case 1531:
+case 1532:
+case 1533:
+case 1534:
+case 1535:
+case 1536:
+case 1537:
+case 1538:
+case 1539:
+case 1540:
+case 1541:
+case 1542:
+case 1543:
+case 1544:
+case 1545:
+case 1546:
+case 1547:
+case 1548:
+case 1549:
+case 1550:
+case 1551:
+case 1552:
+case 1553:
+case 1554:
+case 1555:
+case 1556:
+case 1557:
+case 1558:
+case 1559:
+case 1560:
+case 1561:
+case 1562:
+case 1563:
+case 1564:
+case 1565:
+case 1566:
+case 1567:
+case 1568:
+case 1569:
+case 1570:
+case 1571:
+case 1572:
+case 1573:
+case 1574:
+case 1575:
+case 1576:
+case 1577:
+case 1578:
+case 1579:
+case 1580:
+case 1581:
+case 1582:
+case 1583:
+case 1584:
+case 1585:
+case 1586:
+case 1587:
+case 1588:
+case 1589:
+case 1590:
+case 1591:
+case 1592:
+case 1593:
+case 1594:
+case 1595:
+case 1596:
+case 1597:
+case 1598:
+case 1599:
+case 1600:
+case 1601:
+case 1602:
+case 1603:
+case 1604:
+case 1605:
+case 1606:
+case 1607:
+case 1608:
+case 1609:
+case 1610:
+case 1611:
+case 1612:
+case 1613:
+case 1614:
+case 1615:
+case 1616:
+case 1617:
+case 1618:
+case 1619:
+case 1620:
+case 1621:
+case 1622:
+case 1623:
+case 1624:
+case 1625:
+case 1626:
+case 1627:
+case 1628:
+case 1629:
+case 1630:
+case 1631:
+case 1632:
+case 1633:
+case 1634:
+case 1635:
+case 1636:
+case 1637:
+case 1638:
+case 1639:
+case 1640:
+case 1641:
+case 1642:
+case 1643:
+case 1644:
+case 1645:
+case 1646:
+case 1647:
+case 1648:
+case 1649:
+case 1650:
+case 1651:
+case 1652:
+case 1653:
+case 1654:
+case 1655:
+case 1656:
+case 1657:
+case 1658:
+case 1659:
+case 1660:
+case 1661:
+case 1662:
+case 1663:
+case 1664:
+case 1665:
+case 1666:
+case 1667:
+case 1668:
+case 1669:
+case 1670:
+case 1671:
+case 1672:
+case 1673:
+case 1674:
+case 1675:
+case 1676:
+case 1677:
+case 1678:
+case 1679:
+case 1680:
+case 1681:
+case 1682:
+case 1683:
+case 1684:
+case 1685:
+case 1686:
+case 1687:
+case 1688:
+case 1689:
+case 1690:
+case 1691:
+case 1692:
+case 1693:
+case 1694:
+case 1695:
+case 1696:
+case 1697:
+case 1698:
+case 1699:
+case 1700:
+case 1701:
+case 1702:
+case 1703:
+case 1704:
+case 1705:
+case 1706:
+case 1707:
+case 1708:
+case 1709:
+case 1710:
+case 1711:
+case 1712:
+case 1713:
+case 1714:
+case 1715:
+case 1716:
+case 1717:
+case 1718:
+case 1719:
+case 1720:
+case 1721:
+case 1722:
+case 1723:
+case 1724:
+case 1725:
+case 1726:
+case 1727:
+case 1728:
+case 1729:
+case 1730:
+case 1731:
+case 1732:
+case 1733:
+case 1734:
+case 1735:
+case 1736:
+case 1737:
+case 1738:
+case 1739:
+case 1740:
+case 1741:
+case 1742:
+case 1743:
+case 1744:
+case 1745:
+case 1746:
+case 1747:
+case 1748:
+case 1749:
+case 1750:
+case 1751:
+case 1752:
+case 1753:
+case 1754:
+case 1755:
+case 1756:
+case 1757:
+case 1758:
+case 1759:
+case 1760:
+case 1761:
+case 1762:
+case 1763:
+case 1764:
+case 1765:
+case 1766:
+case 1767:
+case 1768:
+case 1769:
+case 1770:
+case 1771:
+case 1772:
+case 1773:
+case 1774:
+case 1775:
+case 1776:
+case 1777:
+case 1778:
+case 1779:
+case 1780:
+case 1781:
+case 1782:
+case 1783:
+case 1784:
+case 1785:
+case 1786:
+case 1787:
+case 1788:
+case 1789:
+case 1790:
+case 1791:
+case 1792:
+case 1793:
+case 1794:
+case 1795:
+case 1796:
+case 1797:
+case 1798:
+case 1799:
+case 1800:
+case 1801:
+case 1802:
+case 1803:
+case 1804:
+case 1805:
+case 1806:
+case 1807:
+case 1808:
+case 1809:
+case 1810:
+case 1811:
+case 1812:
+case 1813:
+case 1814:
+case 1815:
+case 1816:
+case 1817:
+case 1818:
+case 1819:
+case 1820:
+case 1821:
+case 1822:
+case 1823:
+case 1824:
+case 1825:
+case 1826:
+case 1827:
+case 1828:
+case 1829:
+case 1830:
+case 1831:
+case 1832:
+case 1833:
+case 1834:
+case 1835:
+case 1836:
+case 1837:
+case 1838:
+case 1839:
+case 1840:
+case 1841:
+case 1842:
+case 1843:
+case 1844:
+case 1845:
+case 1846:
+case 1847:
+case 1848:
+case 1849:
+case 1850:
+case 1851:
+case 1852:
+case 1853:
+case 1854:
+case 1855:
+case 1856:
+case 1857:
+case 1858:
+case 1859:
+case 1860:
+case 1861:
+case 1862:
+case 1863:
+case 1864:
+case 1865:
+case 1866:
+case 1867:
+case 1868:
+case 1869:
+case 1870:
+case 1871:
+case 1872:
+case 1873:
+case 1874:
+case 1875:
+case 1876:
+case 1877:
+case 1878:
+case 1879:
+case 1880:
+case 1881:
+case 1882:
+case 1883:
+case 1884:
+case 1885:
+case 1886:
+case 1887:
+case 1888:
+case 1889:
+case 1890:
+case 1891:
+case 1892:
+case 1893:
+case 1894:
+case 1895:
+case 1896:
+case 1897:
+case 1898:
+case 1899:
+case 1900:
+case 1901:
+case 1902:
+case 1903:
+case 1904:
+case 1905:
+case 1906:
+case 1907:
+case 1908:
+case 1909:
+case 1910:
+case 1911:
+case 1912:
+case 1913:
+case 1914:
+case 1915:
+case 1916:
+case 1917:
+case 1918:
+case 1919:
+case 1920:
+case 1921:
+case 1922:
+case 1923:
+case 1924:
+case 1925:
+case 1926:
+case 1927:
+case 1928:
+case 1929:
+case 1930:
+case 1931:
+case 1932:
+case 1933:
+case 1934:
+case 1935:
+case 1936:
+case 1937:
+case 1938:
+case 1939:
+case 1940:
+case 1941:
+case 1942:
+case 1943:
+case 1944:
+case 1945:
+case 1946:
+case 1947:
+case 1948:
+case 1949:
+case 1950:
+case 1951:
+case 1952:
+case 1953:
+case 1954:
+case 1955:
+case 1956:
+case 1957:
+case 1958:
+case 1959:
+case 1960:
+case 1961:
+case 1962:
+case 1963:
+case 1964:
+case 1965:
+case 1966:
+case 1967:
+case 1968:
+case 1969:
+case 1970:
+case 1971:
+case 1972:
+case 1973:
+case 1974:
+case 1975:
+case 1976:
+case 1977:
+case 1978:
+case 1979:
+case 1980:
+case 1981:
+case 1982:
+case 1983:
+case 1984:
+case 1985:
+case 1986:
+case 1987:
+case 1988:
+case 1989:
+case 1990:
+case 1991:
+case 1992:
+case 1993:
+case 1994:
+case 1995:
+case 1996:
+case 1997:
+case 1998:
+case 1999:
+case 2000:
+case 2001:
+case 2002:
+case 2003:
+case 2004:
+case 2005:
+case 2006:
+case 2007:
+case 2008:
+case 2009:
+case 2010:
+case 2011:
+case 2012:
+case 2013:
+case 2014:
+case 2015:
+case 2016:
+case 2017:
+case 2018:
+case 2019:
+case 2020:
+case 2021:
+case 2022:
+case 2023:
+case 2024:
+case 2025:
+case 2026:
+case 2027:
+case 2028:
+case 2029:
+case 2030:
+case 2031:
+case 2032:
+case 2033:
+case 2034:
+case 2035:
+case 2036:
+case 2037:
+case 2038:
+case 2039:
+case 2040:
+case 2041:
+case 2042:
+case 2043:
+case 2044:
+case 2045:
+case 2046:
+case 2047:
+case 2048:
+case 2049:
+case 2050:
+case 2051:
+case 2052:
+case 2053:
+case 2054:
+case 2055:
+case 2056:
+case 2057:
+case 2058:
+case 2059:
+case 2060:
+case 2061:
+case 2062:
+case 2063:
+case 2064:
+case 2065:
+case 2066:
+case 2067:
+case 2068:
+case 2069:
+case 2070:
+case 2071:
+case 2072:
+case 2073:
+case 2074:
+case 2075:
+case 2076:
+case 2077:
+case 2078:
+case 2079:
+case 2080:
+case 2081:
+case 2082:
+case 2083:
+case 2084:
+case 2085:
+case 2086:
+case 2087:
+case 2088:
+case 2089:
+case 2090:
+case 2091:
+case 2092:
+case 2093:
+case 2094:
+case 2095:
+case 2096:
+case 2097:
+case 2098:
+case 2099:
+case 2100:
+case 2101:
+case 2102:
+case 2103:
+case 2104:
+case 2105:
+case 2106:
+case 2107:
+case 2108:
+case 2109:
+case 2110:
+case 2111:
+case 2112:
+case 2113:
+case 2114:
+case 2115:
+case 2116:
+case 2117:
+case 2118:
+case 2119:
+case 2120:
+case 2121:
+case 2122:
+case 2123:
+case 2124:
+case 2125:
+case 2126:
+case 2127:
+case 2128:
+case 2129:
+case 2130:
+case 2131:
+case 2132:
+case 2133:
+case 2134:
+case 2135:
+case 2136:
+case 2137:
+case 2138:
+case 2139:
+case 2140:
+case 2141:
+case 2142:
+case 2143:
+case 2144:
+case 2145:
+case 2146:
+case 2147:
+case 2148:
+case 2149:
+case 2150:
+case 2151:
+case 2152:
+case 2153:
+case 2154:
+case 2155:
+case 2156:
+case 2157:
+case 2158:
+case 2159:
+case 2160:
+case 2161:
+case 2162:
+case 2163:
+case 2164:
+case 2165:
+case 2166:
+case 2167:
+case 2168:
+case 2169:
+case 2170:
+case 2171:
+case 2172:
+case 2173:
+case 2174:
+case 2175:
+case 2176:
+case 2177:
+case 2178:
+case 2179:
+case 2180:
+case 2181:
+case 2182:
+case 2183:
+case 2184:
+case 2185:
+case 2186:
+case 2187:
+case 2188:
+case 2189:
+case 2190:
+case 2191:
+case 2192:
+case 2193:
+case 2194:
+case 2195:
+case 2196:
+case 2197:
+case 2198:
+case 2199:
+case 2200:
+case 2201:
+case 2202:
+case 2203:
+case 2204:
+case 2205:
+case 2206:
+case 2207:
+case 2208:
+case 2209:
+case 2210:
+case 2211:
+case 2212:
+case 2213:
+case 2214:
+case 2215:
+case 2216:
+case 2217:
+case 2218:
+case 2219:
+case 2220:
+case 2221:
+case 2222:
+case 2223:
+case 2224:
+case 2225:
+case 2226:
+case 2227:
+case 2228:
+case 2229:
+case 2230:
+case 2231:
+case 2232:
+case 2233:
+case 2234:
+case 2235:
+case 2236:
+case 2237:
+case 2238:
+case 2239:
+case 2240:
+case 2241:
+case 2242:
+case 2243:
+case 2244:
+case 2245:
+case 2246:
+case 2247:
+case 2248:
+case 2249:
+case 2250:
+case 2251:
+case 2252:
+case 2253:
+case 2254:
+case 2255:
+case 2256:
+case 2257:
+case 2258:
+case 2259:
+case 2260:
+case 2261:
+case 2262:
+case 2263:
+case 2264:
+case 2265:
+case 2266:
+case 2267:
+case 2268:
+case 2269:
+case 2270:
+case 2271:
+case 2272:
+case 2273:
+case 2274:
+case 2275:
+case 2276:
+case 2277:
+case 2278:
+case 2279:
+case 2280:
+case 2281:
+case 2282:
+case 2283:
+case 2284:
+case 2285:
+case 2286:
+case 2287:
+case 2288:
+case 2289:
+case 2290:
+case 2291:
+case 2292:
+case 2293:
+case 2294:
+case 2295:
+case 2296:
+case 2297:
+case 2298:
+case 2299:
+case 2300:
+case 2301:
+case 2302:
+case 2303:
+case 2304:
+case 2305:
+case 2306:
+case 2307:
+case 2308:
+case 2309:
+case 2310:
+case 2311:
+case 2312:
+case 2313:
+case 2314:
+case 2315:
+case 2316:
+case 2317:
+case 2318:
+case 2319:
+case 2320:
+case 2321:
+case 2322:
+case 2323:
+case 2324:
+case 2325:
+case 2326:
+case 2327:
+case 2328:
+case 2329:
+case 2330:
+case 2331:
+case 2332:
+case 2333:
+case 2334:
+case 2335:
+case 2336:
+case 2337:
+case 2338:
+case 2339:
+case 2340:
+case 2341:
+case 2342:
+case 2343:
+case 2344:
+case 2345:
+case 2346:
+case 2347:
+case 2348:
+case 2349:
+case 2350:
+case 2351:
+case 2352:
+case 2353:
+case 2354:
+case 2355:
+case 2356:
+case 2357:
+case 2358:
+case 2359:
+case 2360:
+case 2361:
+case 2362:
+case 2363:
+case 2364:
+case 2365:
+case 2366:
+case 2367:
+case 2368:
+case 2369:
+case 2370:
+case 2371:
+case 2372:
+case 2373:
+case 2374:
+case 2375:
+case 2376:
+case 2377:
+case 2378:
+case 2379:
+case 2380:
+case 2381:
+case 2382:
+case 2383:
+case 2384:
+case 2385:
+case 2386:
+case 2387:
+case 2388:
+case 2389:
+case 2390:
+case 2391:
+case 2392:
+case 2393:
+case 2394:
+case 2395:
+case 2396:
+case 2397:
+case 2398:
+case 2399:
+case 2400:
+case 2401:
+case 2402:
+case 2403:
+case 2404:
+case 2405:
+case 2406:
+case 2407:
+case 2408:
+case 2409:
+case 2410:
+case 2411:
+case 2412:
+case 2413:
+case 2414:
+case 2415:
+case 2416:
+case 2417:
+case 2418:
+case 2419:
+case 2420:
+case 2421:
+case 2422:
+case 2423:
+case 2424:
+case 2425:
+case 2426:
+case 2427:
+case 2428:
+case 2429:
+case 2430:
+case 2431:
+case 2432:
+case 2433:
+case 2434:
+case 2435:
+case 2436:
+case 2437:
+case 2438:
+case 2439:
+case 2440:
+case 2441:
+case 2442:
+case 2443:
+case 2444:
+case 2445:
+case 2446:
+case 2447:
+case 2448:
+case 2449:
+case 2450:
+case 2451:
+case 2452:
+case 2453:
+case 2454:
+case 2455:
+case 2456:
+case 2457:
+case 2458:
+case 2459:
+case 2460:
+case 2461:
+case 2462:
+case 2463:
+case 2464:
+case 2465:
+case 2466:
+case 2467:
+case 2468:
+case 2469:
+case 2470:
+case 2471:
+case 2472:
+case 2473:
+case 2474:
+case 2475:
+case 2476:
+case 2477:
+case 2478:
+case 2479:
+case 2480:
+case 2481:
+case 2482:
+case 2483:
+case 2484:
+case 2485:
+case 2486:
+case 2487:
+case 2488:
+case 2489:
+case 2490:
+case 2491:
+case 2492:
+case 2493:
+case 2494:
+case 2495:
+case 2496:
+case 2497:
+case 2498:
+case 2499:
+case 2500:
+case 2501:
+case 2502:
+case 2503:
+case 2504:
+case 2505:
+case 2506:
+case 2507:
+case 2508:
+case 2509:
+case 2510:
+case 2511:
+case 2512:
+case 2513:
+case 2514:
+case 2515:
+case 2516:
+case 2517:
+case 2518:
+case 2519:
+case 2520:
+case 2521:
+case 2522:
+case 2523:
+case 2524:
+case 2525:
+case 2526:
+case 2527:
+case 2528:
+case 2529:
+case 2530:
+case 2531:
+case 2532:
+case 2533:
+case 2534:
+case 2535:
+case 2536:
+case 2537:
+case 2538:
+case 2539:
+case 2540:
+case 2541:
+case 2542:
+case 2543:
+case 2544:
+case 2545:
+case 2546:
+case 2547:
+case 2548:
+case 2549:
+case 2550:
+case 2551:
+case 2552:
+case 2553:
+case 2554:
+case 2555:
+case 2556:
+case 2557:
+case 2558:
+case 2559:
+case 2560:
+case 2561:
+case 2562:
+case 2563:
+case 2564:
+case 2565:
+case 2566:
+case 2567:
+case 2568:
+case 2569:
+case 2570:
+case 2571:
+case 2572:
+case 2573:
+case 2574:
+case 2575:
+case 2576:
+case 2577:
+case 2578:
+case 2579:
+case 2580:
+case 2581:
+case 2582:
+case 2583:
+case 2584:
+case 2585:
+case 2586:
+case 2587:
+case 2588:
+case 2589:
+case 2590:
+case 2591:
+case 2592:
+case 2593:
+case 2594:
+case 2595:
+case 2596:
+case 2597:
+case 2598:
+case 2599:
+case 2600:
+case 2601:
+case 2602:
+case 2603:
+case 2604:
+case 2605:
+case 2606:
+case 2607:
+case 2608:
+case 2609:
+case 2610:
+case 2611:
+case 2612:
+case 2613:
+case 2614:
+case 2615:
+case 2616:
+case 2617:
+case 2618:
+case 2619:
+case 2620:
+case 2621:
+case 2622:
+case 2623:
+case 2624:
+case 2625:
+case 2626:
+case 2627:
+case 2628:
+case 2629:
+case 2630:
+case 2631:
+case 2632:
+case 2633:
+case 2634:
+case 2635:
+case 2636:
+case 2637:
+case 2638:
+case 2639:
+case 2640:
+case 2641:
+case 2642:
+case 2643:
+case 2644:
+case 2645:
+case 2646:
+case 2647:
+case 2648:
+case 2649:
+case 2650:
+case 2651:
+case 2652:
+case 2653:
+case 2654:
+case 2655:
+case 2656:
+case 2657:
+case 2658:
+case 2659:
+case 2660:
+case 2661:
+case 2662:
+case 2663:
+case 2664:
+case 2665:
+case 2666:
+case 2667:
+case 2668:
+case 2669:
+case 2670:
+case 2671:
+case 2672:
+case 2673:
+case 2674:
+case 2675:
+case 2676:
+case 2677:
+case 2678:
+case 2679:
+case 2680:
+case 2681:
+case 2682:
+case 2683:
+case 2684:
+case 2685:
+case 2686:
+case 2687:
+case 2688:
+case 2689:
+case 2690:
+case 2691:
+case 2692:
+case 2693:
+case 2694:
+case 2695:
+case 2696:
+case 2697:
+case 2698:
+case 2699:
+case 2700:
+case 2701:
+case 2702:
+case 2703:
+case 2704:
+case 2705:
+case 2706:
+case 2707:
+case 2708:
+case 2709:
+case 2710:
+case 2711:
+case 2712:
+case 2713:
+case 2714:
+case 2715:
+case 2716:
+case 2717:
+case 2718:
+case 2719:
+case 2720:
+case 2721:
+case 2722:
+case 2723:
+case 2724:
+case 2725:
+case 2726:
+case 2727:
+case 2728:
+case 2729:
+case 2730:
+case 2731:
+case 2732:
+case 2733:
+case 2734:
+case 2735:
+case 2736:
+case 2737:
+case 2738:
+case 2739:
+case 2740:
+case 2741:
+case 2742:
+case 2743:
+case 2744:
+case 2745:
+case 2746:
+case 2747:
+case 2748:
+case 2749:
+case 2750:
+case 2751:
+case 2752:
+case 2753:
+case 2754:
+case 2755:
+case 2756:
+case 2757:
+case 2758:
+case 2759:
+case 2760:
+case 2761:
+case 2762:
+case 2763:
+case 2764:
+case 2765:
+case 2766:
+case 2767:
+case 2768:
+case 2769:
+case 2770:
+case 2771:
+case 2772:
+case 2773:
+case 2774:
+case 2775:
+case 2776:
+case 2777:
+case 2778:
+case 2779:
+case 2780:
+case 2781:
+case 2782:
+case 2783:
+case 2784:
+case 2785:
+case 2786:
+case 2787:
+case 2788:
+case 2789:
+case 2790:
+case 2791:
+case 2792:
+case 2793:
+case 2794:
+case 2795:
+case 2796:
+case 2797:
+case 2798:
+case 2799:
+case 2800:
+case 2801:
+case 2802:
+case 2803:
+case 2804:
+case 2805:
+case 2806:
+case 2807:
+case 2808:
+case 2809:
+case 2810:
+case 2811:
+case 2812:
+case 2813:
+case 2814:
+case 2815:
+case 2816:
+case 2817:
+case 2818:
+case 2819:
+case 2820:
+case 2821:
+case 2822:
+case 2823:
+case 2824:
+case 2825:
+case 2826:
+case 2827:
+case 2828:
+case 2829:
+case 2830:
+case 2831:
+case 2832:
+case 2833:
+case 2834:
+case 2835:
+case 2836:
+case 2837:
+case 2838:
+case 2839:
+case 2840:
+case 2841:
+case 2842:
+case 2843:
+case 2844:
+case 2845:
+case 2846:
+case 2847:
+case 2848:
+case 2849:
+case 2850:
+case 2851:
+case 2852:
+case 2853:
+case 2854:
+case 2855:
+case 2856:
+case 2857:
+case 2858:
+case 2859:
+case 2860:
+case 2861:
+case 2862:
+case 2863:
+case 2864:
+case 2865:
+case 2866:
+case 2867:
+case 2868:
+case 2869:
+case 2870:
+case 2871:
+case 2872:
+case 2873:
+case 2874:
+case 2875:
+case 2876:
+case 2877:
+case 2878:
+case 2879:
+case 2880:
+case 2881:
+case 2882:
+case 2883:
+case 2884:
+case 2885:
+case 2886:
+case 2887:
+case 2888:
+case 2889:
+case 2890:
+case 2891:
+case 2892:
+case 2893:
+case 2894:
+case 2895:
+case 2896:
+case 2897:
+case 2898:
+case 2899:
+case 2900:
+case 2901:
+case 2902:
+case 2903:
+case 2904:
+case 2905:
+case 2906:
+case 2907:
+case 2908:
+case 2909:
+case 2910:
+case 2911:
+case 2912:
+case 2913:
+case 2914:
+case 2915:
+case 2916:
+case 2917:
+case 2918:
+case 2919:
+case 2920:
+case 2921:
+case 2922:
+case 2923:
+case 2924:
+case 2925:
+case 2926:
+case 2927:
+case 2928:
+case 2929:
+case 2930:
+case 2931:
+case 2932:
+case 2933:
+case 2934:
+case 2935:
+case 2936:
+case 2937:
+case 2938:
+case 2939:
+case 2940:
+case 2941:
+case 2942:
+case 2943:
+case 2944:
+case 2945:
+case 2946:
+case 2947:
+case 2948:
+case 2949:
+case 2950:
+case 2951:
+case 2952:
+case 2953:
+case 2954:
+case 2955:
+case 2956:
+case 2957:
+case 2958:
+case 2959:
+case 2960:
+case 2961:
+case 2962:
+case 2963:
+case 2964:
+case 2965:
+case 2966:
+case 2967:
+case 2968:
+case 2969:
+case 2970:
+case 2971:
+case 2972:
+case 2973:
+case 2974:
+case 2975:
+case 2976:
+case 2977:
+case 2978:
+case 2979:
+case 2980:
+case 2981:
+case 2982:
+case 2983:
+case 2984:
+case 2985:
+case 2986:
+case 2987:
+case 2988:
+case 2989:
+case 2990:
+case 2991:
+case 2992:
+case 2993:
+case 2994:
+case 2995:
+case 2996:
+case 2997:
+case 2998:
+case 2999:
+case 3000:
+case 3001:
+case 3002:
+case 3003:
+case 3004:
+case 3005:
+case 3006:
+case 3007:
+case 3008:
+case 3009:
+case 3010:
+case 3011:
+case 3012:
+case 3013:
+case 3014:
+case 3015:
+case 3016:
+case 3017:
+case 3018:
+case 3019:
+case 3020:
+case 3021:
+case 3022:
+case 3023:
+case 3024:
+case 3025:
+case 3026:
+case 3027:
+case 3028:
+case 3029:
+case 3030:
+case 3031:
+case 3032:
+case 3033:
+case 3034:
+case 3035:
+case 3036:
+case 3037:
+case 3038:
+case 3039:
+case 3040:
+case 3041:
+case 3042:
+case 3043:
+case 3044:
+case 3045:
+case 3046:
+case 3047:
+case 3048:
+case 3049:
+case 3050:
+case 3051:
+case 3052:
+case 3053:
+case 3054:
+case 3055:
+case 3056:
+case 3057:
+case 3058:
+case 3059:
+case 3060:
+case 3061:
+case 3062:
+case 3063:
+case 3064:
+case 3065:
+case 3066:
+case 3067:
+case 3068:
+case 3069:
+case 3070:
+case 3071:
+case 3072:
+case 3073:
+case 3074:
+case 3075:
+case 3076:
+case 3077:
+case 3078:
+case 3079:
+case 3080:
+case 3081:
+case 3082:
+case 3083:
+case 3084:
+case 3085:
+case 3086:
+case 3087:
+case 3088:
+case 3089:
+case 3090:
+case 3091:
+case 3092:
+case 3093:
+case 3094:
+case 3095:
+case 3096:
+case 3097:
+case 3098:
+case 3099:
+case 3100:
+case 3101:
+case 3102:
+case 3103:
+case 3104:
+case 3105:
+case 3106:
+case 3107:
+case 3108:
+case 3109:
+case 3110:
+case 3111:
+case 3112:
+case 3113:
+case 3114:
+case 3115:
+case 3116:
+case 3117:
+case 3118:
+case 3119:
+case 3120:
+case 3121:
+case 3122:
+case 3123:
+case 3124:
+case 3125:
+case 3126:
+case 3127:
+case 3128:
+case 3129:
+case 3130:
+case 3131:
+case 3132:
+case 3133:
+case 3134:
+case 3135:
+case 3136:
+case 3137:
+case 3138:
+case 3139:
+case 3140:
+case 3141:
+case 3142:
+case 3143:
+case 3144:
+case 3145:
+case 3146:
+case 3147:
+case 3148:
+case 3149:
+case 3150:
+case 3151:
+case 3152:
+case 3153:
+case 3154:
+case 3155:
+case 3156:
+case 3157:
+case 3158:
+case 3159:
+case 3160:
+case 3161:
+case 3162:
+case 3163:
+case 3164:
+case 3165:
+case 3166:
+case 3167:
+case 3168:
+case 3169:
+case 3170:
+case 3171:
+case 3172:
+case 3173:
+case 3174:
+case 3175:
+case 3176:
+case 3177:
+case 3178:
+case 3179:
+case 3180:
+case 3181:
+case 3182:
+case 3183:
+case 3184:
+case 3185:
+case 3186:
+case 3187:
+case 3188:
+case 3189:
+case 3190:
+case 3191:
+case 3192:
+case 3193:
+case 3194:
+case 3195:
+case 3196:
+case 3197:
+case 3198:
+case 3199:
+case 3200:
+case 3201:
+case 3202:
+case 3203:
+case 3204:
+case 3205:
+case 3206:
+case 3207:
+case 3208:
+case 3209:
+case 3210:
+case 3211:
+case 3212:
+case 3213:
+case 3214:
+case 3215:
+case 3216:
+case 3217:
+case 3218:
+case 3219:
+case 3220:
+case 3221:
+case 3222:
+case 3223:
+case 3224:
+case 3225:
+case 3226:
+case 3227:
+case 3228:
+case 3229:
+case 3230:
+case 3231:
+case 3232:
+case 3233:
+case 3234:
+case 3235:
+case 3236:
+case 3237:
+case 3238:
+case 3239:
+case 3240:
+case 3241:
+case 3242:
+case 3243:
+case 3244:
+case 3245:
+case 3246:
+case 3247:
+case 3248:
+case 3249:
+case 3250:
+case 3251:
+case 3252:
+case 3253:
+case 3254:
+case 3255:
+case 3256:
+case 3257:
+case 3258:
+case 3259:
+case 3260:
+case 3261:
+case 3262:
+case 3263:
+case 3264:
+case 3265:
+case 3266:
+case 3267:
+case 3268:
+case 3269:
+case 3270:
+case 3271:
+case 3272:
+case 3273:
+case 3274:
+case 3275:
+case 3276:
+case 3277:
+case 3278:
+case 3279:
+case 3280:
+case 3281:
+case 3282:
+case 3283:
+case 3284:
+case 3285:
+case 3286:
+case 3287:
+case 3288:
+case 3289:
+case 3290:
+case 3291:
+case 3292:
+case 3293:
+case 3294:
+case 3295:
+case 3296:
+case 3297:
+case 3298:
+case 3299:
+case 3300:
+case 3301:
+case 3302:
+case 3303:
+case 3304:
+case 3305:
+case 3306:
+case 3307:
+case 3308:
+case 3309:
+case 3310:
+case 3311:
+case 3312:
+case 3313:
+case 3314:
+case 3315:
+case 3316:
+case 3317:
+case 3318:
+case 3319:
+case 3320:
+case 3321:
+case 3322:
+case 3323:
+case 3324:
+case 3325:
+case 3326:
+case 3327:
+case 3328:
+case 3329:
+case 3330:
+case 3331:
+case 3332:
+case 3333:
+case 3334:
+case 3335:
+case 3336:
+case 3337:
+case 3338:
+case 3339:
+case 3340:
+case 3341:
+case 3342:
+case 3343:
+case 3344:
+case 3345:
+case 3346:
+case 3347:
+case 3348:
+case 3349:
+case 3350:
+case 3351:
+case 3352:
+case 3353:
+case 3354:
+case 3355:
+case 3356:
+case 3357:
+case 3358:
+case 3359:
+case 3360:
+case 3361:
+case 3362:
+case 3363:
+case 3364:
+case 3365:
+case 3366:
+case 3367:
+case 3368:
+case 3369:
+case 3370:
+case 3371:
+case 3372:
+case 3373:
+case 3374:
+case 3375:
+case 3376:
+case 3377:
+case 3378:
+case 3379:
+case 3380:
+case 3381:
+case 3382:
+case 3383:
+case 3384:
+case 3385:
+case 3386:
+case 3387:
+case 3388:
+case 3389:
+case 3390:
+case 3391:
+case 3392:
+case 3393:
+case 3394:
+case 3395:
+case 3396:
+case 3397:
+case 3398:
+case 3399:
+case 3400:
+case 3401:
+case 3402:
+case 3403:
+case 3404:
+case 3405:
+case 3406:
+case 3407:
+case 3408:
+case 3409:
+case 3410:
+case 3411:
+case 3412:
+case 3413:
+case 3414:
+case 3415:
+case 3416:
+case 3417:
+case 3418:
+case 3419:
+case 3420:
+case 3421:
+case 3422:
+case 3423:
+case 3424:
+case 3425:
+case 3426:
+case 3427:
+case 3428:
+case 3429:
+case 3430:
+case 3431:
+case 3432:
+case 3433:
+case 3434:
+case 3435:
+case 3436:
+case 3437:
+case 3438:
+case 3439:
+case 3440:
+case 3441:
+case 3442:
+case 3443:
+case 3444:
+case 3445:
+case 3446:
+case 3447:
+case 3448:
+case 3449:
+case 3450:
+case 3451:
+case 3452:
+case 3453:
+case 3454:
+case 3455:
+case 3456:
+case 3457:
+case 3458:
+case 3459:
+case 3460:
+case 3461:
+case 3462:
+case 3463:
+case 3464:
+case 3465:
+case 3466:
+case 3467:
+case 3468:
+case 3469:
+case 3470:
+case 3471:
+case 3472:
+case 3473:
+case 3474:
+case 3475:
+case 3476:
+case 3477:
+case 3478:
+case 3479:
+case 3480:
+case 3481:
+case 3482:
+case 3483:
+case 3484:
+case 3485:
+case 3486:
+case 3487:
+case 3488:
+case 3489:
+case 3490:
+case 3491:
+case 3492:
+case 3493:
+case 3494:
+case 3495:
+case 3496:
+case 3497:
+case 3498:
+case 3499:
+case 3500:
+case 3501:
+case 3502:
+case 3503:
+case 3504:
+case 3505:
+case 3506:
+case 3507:
+case 3508:
+case 3509:
+case 3510:
+case 3511:
+case 3512:
+case 3513:
+case 3514:
+case 3515:
+case 3516:
+case 3517:
+case 3518:
+case 3519:
+case 3520:
+case 3521:
+case 3522:
+case 3523:
+case 3524:
+case 3525:
+case 3526:
+case 3527:
+case 3528:
+case 3529:
+case 3530:
+case 3531:
+case 3532:
+case 3533:
+case 3534:
+case 3535:
+case 3536:
+case 3537:
+case 3538:
+case 3539:
+case 3540:
+case 3541:
+case 3542:
+case 3543:
+case 3544:
+case 3545:
+case 3546:
+case 3547:
+case 3548:
+case 3549:
+case 3550:
+case 3551:
+case 3552:
+case 3553:
+case 3554:
+case 3555:
+case 3556:
+case 3557:
+case 3558:
+case 3559:
+case 3560:
+case 3561:
+case 3562:
+case 3563:
+case 3564:
+case 3565:
+case 3566:
+case 3567:
+case 3568:
+case 3569:
+case 3570:
+case 3571:
+case 3572:
+case 3573:
+case 3574:
+case 3575:
+case 3576:
+case 3577:
+case 3578:
+case 3579:
+case 3580:
+case 3581:
+case 3582:
+case 3583:
+case 3584:
+case 3585:
+case 3586:
+case 3587:
+case 3588:
+case 3589:
+case 3590:
+case 3591:
+case 3592:
+case 3593:
+case 3594:
+case 3595:
+case 3596:
+case 3597:
+case 3598:
+case 3599:
+case 3600:
+case 3601:
+case 3602:
+case 3603:
+case 3604:
+case 3605:
+case 3606:
+case 3607:
+case 3608:
+case 3609:
+case 3610:
+case 3611:
+case 3612:
+case 3613:
+case 3614:
+case 3615:
+case 3616:
+case 3617:
+case 3618:
+case 3619:
+case 3620:
+case 3621:
+case 3622:
+case 3623:
+case 3624:
+case 3625:
+case 3626:
+case 3627:
+case 3628:
+case 3629:
+case 3630:
+case 3631:
+case 3632:
+case 3633:
+case 3634:
+case 3635:
+case 3636:
+case 3637:
+case 3638:
+case 3639:
+case 3640:
+case 3641:
+case 3642:
+case 3643:
+case 3644:
+case 3645:
+case 3646:
+case 3647:
+case 3648:
+case 3649:
+case 3650:
+case 3651:
+case 3652:
+case 3653:
+case 3654:
+case 3655:
+case 3656:
+case 3657:
+case 3658:
+case 3659:
+case 3660:
+case 3661:
+case 3662:
+case 3663:
+case 3664:
+case 3665:
+case 3666:
+case 3667:
+case 3668:
+case 3669:
+case 3670:
+case 3671:
+case 3672:
+case 3673:
+case 3674:
+case 3675:
+case 3676:
+case 3677:
+case 3678:
+case 3679:
+case 3680:
+case 3681:
+case 3682:
+case 3683:
+case 3684:
+case 3685:
+case 3686:
+case 3687:
+case 3688:
+case 3689:
+case 3690:
+case 3691:
+case 3692:
+case 3693:
+case 3694:
+case 3695:
+case 3696:
+case 3697:
+case 3698:
+case 3699:
+case 3700:
+case 3701:
+case 3702:
+case 3703:
+case 3704:
+case 3705:
+case 3706:
+case 3707:
+case 3708:
+case 3709:
+case 3710:
+case 3711:
+case 3712:
+case 3713:
+case 3714:
+case 3715:
+case 3716:
+case 3717:
+case 3718:
+case 3719:
+case 3720:
+case 3721:
+case 3722:
+case 3723:
+case 3724:
+case 3725:
+case 3726:
+case 3727:
+case 3728:
+case 3729:
+case 3730:
+case 3731:
+case 3732:
+case 3733:
+case 3734:
+case 3735:
+case 3736:
+case 3737:
+case 3738:
+case 3739:
+case 3740:
+case 3741:
+case 3742:
+case 3743:
+case 3744:
+case 3745:
+case 3746:
+case 3747:
+case 3748:
+case 3749:
+case 3750:
+case 3751:
+case 3752:
+case 3753:
+case 3754:
+case 3755:
+case 3756:
+case 3757:
+case 3758:
+case 3759:
+case 3760:
+case 3761:
+case 3762:
+case 3763:
+case 3764:
+case 3765:
+case 3766:
+case 3767:
+case 3768:
+case 3769:
+case 3770:
+case 3771:
+case 3772:
+case 3773:
+case 3774:
+case 3775:
+case 3776:
+case 3777:
+case 3778:
+case 3779:
+case 3780:
+case 3781:
+case 3782:
+case 3783:
+case 3784:
+case 3785:
+case 3786:
+case 3787:
+case 3788:
+case 3789:
+case 3790:
+case 3791:
+case 3792:
+case 3793:
+case 3794:
+case 3795:
+case 3796:
+case 3797:
+case 3798:
+case 3799:
+case 3800:
+case 3801:
+case 3802:
+case 3803:
+case 3804:
+case 3805:
+case 3806:
+case 3807:
+case 3808:
+case 3809:
+case 3810:
+case 3811:
+case 3812:
+case 3813:
+case 3814:
+case 3815:
+case 3816:
+case 3817:
+case 3818:
+case 3819:
+case 3820:
+case 3821:
+case 3822:
+case 3823:
+case 3824:
+case 3825:
+case 3826:
+case 3827:
+case 3828:
+case 3829:
+case 3830:
+case 3831:
+case 3832:
+case 3833:
+case 3834:
+case 3835:
+case 3836:
+case 3837:
+case 3838:
+case 3839:
+case 3840:
+case 3841:
+case 3842:
+case 3843:
+case 3844:
+case 3845:
+case 3846:
+case 3847:
+case 3848:
+case 3849:
+case 3850:
+case 3851:
+case 3852:
+case 3853:
+case 3854:
+case 3855:
+case 3856:
+case 3857:
+case 3858:
+case 3859:
+case 3860:
+case 3861:
+case 3862:
+case 3863:
+case 3864:
+case 3865:
+case 3866:
+case 3867:
+case 3868:
+case 3869:
+case 3870:
+case 3871:
+case 3872:
+case 3873:
+case 3874:
+case 3875:
+case 3876:
+case 3877:
+case 3878:
+case 3879:
+case 3880:
+case 3881:
+case 3882:
+case 3883:
+case 3884:
+case 3885:
+case 3886:
+case 3887:
+case 3888:
+case 3889:
+case 3890:
+case 3891:
+case 3892:
+case 3893:
+case 3894:
+case 3895:
+case 3896:
+case 3897:
+case 3898:
+case 3899:
+case 3900:
+case 3901:
+case 3902:
+case 3903:
+case 3904:
+case 3905:
+case 3906:
+case 3907:
+case 3908:
+case 3909:
+case 3910:
+case 3911:
+case 3912:
+case 3913:
+case 3914:
+case 3915:
+case 3916:
+case 3917:
+case 3918:
+case 3919:
+case 3920:
+case 3921:
+case 3922:
+case 3923:
+case 3924:
+case 3925:
+case 3926:
+case 3927:
+case 3928:
+case 3929:
+case 3930:
+case 3931:
+case 3932:
+case 3933:
+case 3934:
+case 3935:
+case 3936:
+case 3937:
+case 3938:
+case 3939:
+case 3940:
+case 3941:
+case 3942:
+case 3943:
+case 3944:
+case 3945:
+case 3946:
+case 3947:
+case 3948:
+case 3949:
+case 3950:
+case 3951:
+case 3952:
+case 3953:
+case 3954:
+case 3955:
+case 3956:
+case 3957:
+case 3958:
+case 3959:
+case 3960:
+case 3961:
+case 3962:
+case 3963:
+case 3964:
+case 3965:
+case 3966:
+case 3967:
+case 3968:
+case 3969:
+case 3970:
+case 3971:
+case 3972:
+case 3973:
+case 3974:
+case 3975:
+case 3976:
+case 3977:
+case 3978:
+case 3979:
+case 3980:
+case 3981:
+case 3982:
+case 3983:
+case 3984:
+case 3985:
+case 3986:
+case 3987:
+case 3988:
+case 3989:
+case 3990:
+case 3991:
+case 3992:
+case 3993:
+case 3994:
+case 3995:
+case 3996:
+case 3997:
+case 3998:
+case 3999:
+case 4000:
+case 4001:
+case 4002:
+case 4003:
+case 4004:
+case 4005:
+case 4006:
+case 4007:
+case 4008:
+case 4009:
+case 4010:
+case 4011:
+case 4012:
+case 4013:
+case 4014:
+case 4015:
+case 4016:
+case 4017:
+case 4018:
+case 4019:
+case 4020:
+case 4021:
+case 4022:
+case 4023:
+case 4024:
+case 4025:
+case 4026:
+case 4027:
+case 4028:
+case 4029:
+case 4030:
+case 4031:
+case 4032:
+case 4033:
+case 4034:
+case 4035:
+case 4036:
+case 4037:
+case 4038:
+case 4039:
+case 4040:
+case 4041:
+case 4042:
+case 4043:
+case 4044:
+case 4045:
+case 4046:
+case 4047:
+case 4048:
+case 4049:
+case 4050:
+case 4051:
+case 4052:
+case 4053:
+case 4054:
+case 4055:
+case 4056:
+case 4057:
+case 4058:
+case 4059:
+case 4060:
+case 4061:
+case 4062:
+case 4063:
+case 4064:
+case 4065:
+case 4066:
+case 4067:
+case 4068:
+case 4069:
+case 4070:
+case 4071:
+case 4072:
+case 4073:
+case 4074:
+case 4075:
+case 4076:
+case 4077:
+case 4078:
+case 4079:
+case 4080:
+case 4081:
+case 4082:
+case 4083:
+case 4084:
+case 4085:
+case 4086:
+case 4087:
+case 4088:
+case 4089:
+case 4090:
+case 4091:
+case 4092:
+case 4093:
+case 4094:
+case 4095:
+case 4096:
+case 4097:
+case 4098:
+case 4099:
+case 4100:
+case 4101:
+case 4102:
+case 4103:
+case 4104:
+case 4105:
+case 4106:
+case 4107:
+case 4108:
+case 4109:
+case 4110:
+case 4111:
+case 4112:
+case 4113:
+case 4114:
+case 4115:
+case 4116:
+case 4117:
+case 4118:
+case 4119:
+case 4120:
+case 4121:
+case 4122:
+case 4123:
+case 4124:
+case 4125:
+case 4126:
+case 4127:
+case 4128:
+case 4129:
+case 4130:
+case 4131:
+case 4132:
+case 4133:
+case 4134:
+case 4135:
+case 4136:
+case 4137:
+case 4138:
+case 4139:
+case 4140:
+case 4141:
+case 4142:
+case 4143:
+case 4144:
+case 4145:
+case 4146:
+case 4147:
+case 4148:
+case 4149:
+case 4150:
+case 4151:
+case 4152:
+case 4153:
+case 4154:
+case 4155:
+case 4156:
+case 4157:
+case 4158:
+case 4159:
+case 4160:
+case 4161:
+case 4162:
+case 4163:
+case 4164:
+case 4165:
+case 4166:
+case 4167:
+case 4168:
+case 4169:
+case 4170:
+case 4171:
+case 4172:
+case 4173:
+case 4174:
+case 4175:
+case 4176:
+case 4177:
+case 4178:
+case 4179:
+case 4180:
+case 4181:
+case 4182:
+case 4183:
+case 4184:
+case 4185:
+case 4186:
+case 4187:
+case 4188:
+case 4189:
+case 4190:
+case 4191:
+case 4192:
+case 4193:
+case 4194:
+case 4195:
+case 4196:
+case 4197:
+case 4198:
+case 4199:
+case 4200:
+case 4201:
+case 4202:
+case 4203:
+case 4204:
+case 4205:
+case 4206:
+case 4207:
+case 4208:
+case 4209:
+case 4210:
+case 4211:
+case 4212:
+case 4213:
+case 4214:
+case 4215:
+case 4216:
+case 4217:
+case 4218:
+case 4219:
+case 4220:
+case 4221:
+case 4222:
+case 4223:
+case 4224:
+case 4225:
+case 4226:
+case 4227:
+case 4228:
+case 4229:
+case 4230:
+case 4231:
+case 4232:
+case 4233:
+case 4234:
+case 4235:
+case 4236:
+case 4237:
+case 4238:
+case 4239:
+case 4240:
+case 4241:
+case 4242:
+case 4243:
+case 4244:
+case 4245:
+case 4246:
+case 4247:
+case 4248:
+case 4249:
+case 4250:
+case 4251:
+case 4252:
+case 4253:
+case 4254:
+case 4255:
+case 4256:
+case 4257:
+case 4258:
+case 4259:
+case 4260:
+case 4261:
+case 4262:
+case 4263:
+case 4264:
+case 4265:
+case 4266:
+case 4267:
+case 4268:
+case 4269:
+case 4270:
+case 4271:
+case 4272:
+case 4273:
+case 4274:
+case 4275:
+case 4276:
+case 4277:
+case 4278:
+case 4279:
+case 4280:
+case 4281:
+case 4282:
+case 4283:
+case 4284:
+case 4285:
+case 4286:
+case 4287:
+case 4288:
+case 4289:
+case 4290:
+case 4291:
+case 4292:
+case 4293:
+case 4294:
+case 4295:
+case 4296:
+case 4297:
+case 4298:
+case 4299:
+case 4300:
+case 4301:
+case 4302:
+case 4303:
+case 4304:
+case 4305:
+case 4306:
+case 4307:
+case 4308:
+case 4309:
+case 4310:
+case 4311:
+case 4312:
+case 4313:
+case 4314:
+case 4315:
+case 4316:
+case 4317:
+case 4318:
+case 4319:
+case 4320:
+case 4321:
+case 4322:
+case 4323:
+case 4324:
+case 4325:
+case 4326:
+case 4327:
+case 4328:
+case 4329:
+case 4330:
+case 4331:
+case 4332:
+case 4333:
+case 4334:
+case 4335:
+case 4336:
+case 4337:
+case 4338:
+case 4339:
+case 4340:
+case 4341:
+case 4342:
+case 4343:
+case 4344:
+case 4345:
+case 4346:
+case 4347:
+case 4348:
+case 4349:
+case 4350:
+case 4351:
+case 4352:
+case 4353:
+case 4354:
+case 4355:
+case 4356:
+case 4357:
+case 4358:
+case 4359:
+case 4360:
+case 4361:
+case 4362:
+case 4363:
+case 4364:
+case 4365:
+case 4366:
+case 4367:
+case 4368:
+case 4369:
+case 4370:
+case 4371:
+case 4372:
+case 4373:
+case 4374:
+case 4375:
+case 4376:
+case 4377:
+case 4378:
+case 4379:
+case 4380:
+case 4381:
+case 4382:
+case 4383:
+case 4384:
+case 4385:
+case 4386:
+case 4387:
+case 4388:
+case 4389:
+case 4390:
+case 4391:
+case 4392:
+case 4393:
+case 4394:
+case 4395:
+case 4396:
+case 4397:
+case 4398:
+case 4399:
+case 4400:
+case 4401:
+case 4402:
+case 4403:
+case 4404:
+case 4405:
+case 4406:
+case 4407:
+case 4408:
+case 4409:
+case 4410:
+case 4411:
+case 4412:
+case 4413:
+case 4414:
+case 4415:
+case 4416:
+case 4417:
+case 4418:
+case 4419:
+case 4420:
+case 4421:
+case 4422:
+case 4423:
+case 4424:
+case 4425:
+case 4426:
+case 4427:
+case 4428:
+case 4429:
+case 4430:
+case 4431:
+case 4432:
+case 4433:
+case 4434:
+case 4435:
+case 4436:
+case 4437:
+case 4438:
+case 4439:
+case 4440:
+case 4441:
+case 4442:
+case 4443:
+case 4444:
+case 4445:
+case 4446:
+case 4447:
+case 4448:
+case 4449:
+case 4450:
+case 4451:
+case 4452:
+case 4453:
+case 4454:
+case 4455:
+case 4456:
+case 4457:
+case 4458:
+case 4459:
+case 4460:
+case 4461:
+case 4462:
+case 4463:
+case 4464:
+case 4465:
+case 4466:
+case 4467:
+case 4468:
+case 4469:
+case 4470:
+case 4471:
+case 4472:
+case 4473:
+case 4474:
+case 4475:
+case 4476:
+case 4477:
+case 4478:
+case 4479:
+case 4480:
+case 4481:
+case 4482:
+case 4483:
+case 4484:
+case 4485:
+case 4486:
+case 4487:
+case 4488:
+case 4489:
+case 4490:
+case 4491:
+case 4492:
+case 4493:
+case 4494:
+case 4495:
+case 4496:
+case 4497:
+case 4498:
+case 4499:
+case 4500:
+case 4501:
+case 4502:
+case 4503:
+case 4504:
+case 4505:
+case 4506:
+case 4507:
+case 4508:
+case 4509:
+case 4510:
+case 4511:
+case 4512:
+case 4513:
+case 4514:
+case 4515:
+case 4516:
+case 4517:
+case 4518:
+case 4519:
+case 4520:
+case 4521:
+case 4522:
+case 4523:
+case 4524:
+case 4525:
+case 4526:
+case 4527:
+case 4528:
+case 4529:
+case 4530:
+case 4531:
+case 4532:
+case 4533:
+case 4534:
+case 4535:
+case 4536:
+case 4537:
+case 4538:
+case 4539:
+case 4540:
+case 4541:
+case 4542:
+case 4543:
+case 4544:
+case 4545:
+case 4546:
+case 4547:
+case 4548:
+case 4549:
+case 4550:
+case 4551:
+case 4552:
+case 4553:
+case 4554:
+case 4555:
+case 4556:
+case 4557:
+case 4558:
+case 4559:
+case 4560:
+case 4561:
+case 4562:
+case 4563:
+case 4564:
+case 4565:
+case 4566:
+case 4567:
+case 4568:
+case 4569:
+case 4570:
+case 4571:
+case 4572:
+case 4573:
+case 4574:
+case 4575:
+case 4576:
+case 4577:
+case 4578:
+case 4579:
+case 4580:
+case 4581:
+case 4582:
+case 4583:
+case 4584:
+case 4585:
+case 4586:
+case 4587:
+case 4588:
+case 4589:
+case 4590:
+case 4591:
+case 4592:
+case 4593:
+case 4594:
+case 4595:
+case 4596:
+case 4597:
+case 4598:
+case 4599:
+case 4600:
+case 4601:
+case 4602:
+case 4603:
+case 4604:
+case 4605:
+case 4606:
+case 4607:
+case 4608:
+case 4609:
+case 4610:
+case 4611:
+case 4612:
+case 4613:
+case 4614:
+case 4615:
+case 4616:
+case 4617:
+case 4618:
+case 4619:
+case 4620:
+case 4621:
+case 4622:
+case 4623:
+case 4624:
+case 4625:
+case 4626:
+case 4627:
+case 4628:
+case 4629:
+case 4630:
+case 4631:
+case 4632:
+case 4633:
+case 4634:
+case 4635:
+case 4636:
+case 4637:
+case 4638:
+case 4639:
+case 4640:
+case 4641:
+case 4642:
+case 4643:
+case 4644:
+case 4645:
+case 4646:
+case 4647:
+case 4648:
+case 4649:
+case 4650:
+case 4651:
+case 4652:
+case 4653:
+case 4654:
+case 4655:
+case 4656:
+case 4657:
+case 4658:
+case 4659:
+case 4660:
+case 4661:
+case 4662:
+case 4663:
+case 4664:
+case 4665:
+case 4666:
+case 4667:
+case 4668:
+case 4669:
+case 4670:
+case 4671:
+case 4672:
+case 4673:
+case 4674:
+case 4675:
+case 4676:
+case 4677:
+case 4678:
+case 4679:
+case 4680:
+case 4681:
+case 4682:
+case 4683:
+case 4684:
+case 4685:
+case 4686:
+case 4687:
+case 4688:
+case 4689:
+case 4690:
+case 4691:
+case 4692:
+case 4693:
+case 4694:
+case 4695:
+case 4696:
+case 4697:
+case 4698:
+case 4699:
+case 4700:
+case 4701:
+case 4702:
+case 4703:
+case 4704:
+case 4705:
+case 4706:
+case 4707:
+case 4708:
+case 4709:
+case 4710:
+case 4711:
+case 4712:
+case 4713:
+case 4714:
+case 4715:
+case 4716:
+case 4717:
+case 4718:
+case 4719:
+case 4720:
+case 4721:
+case 4722:
+case 4723:
+case 4724:
+case 4725:
+case 4726:
+case 4727:
+case 4728:
+case 4729:
+case 4730:
+case 4731:
+case 4732:
+case 4733:
+case 4734:
+case 4735:
+case 4736:
+case 4737:
+case 4738:
+case 4739:
+case 4740:
+case 4741:
+case 4742:
+case 4743:
+case 4744:
+case 4745:
+case 4746:
+case 4747:
+case 4748:
+case 4749:
+case 4750:
+case 4751:
+case 4752:
+case 4753:
+case 4754:
+case 4755:
+case 4756:
+case 4757:
+case 4758:
+case 4759:
+case 4760:
+case 4761:
+case 4762:
+case 4763:
+case 4764:
+case 4765:
+case 4766:
+case 4767:
+case 4768:
+case 4769:
+case 4770:
+case 4771:
+case 4772:
+case 4773:
+case 4774:
+case 4775:
+case 4776:
+case 4777:
+case 4778:
+case 4779:
+case 4780:
+case 4781:
+case 4782:
+case 4783:
+case 4784:
+case 4785:
+case 4786:
+case 4787:
+case 4788:
+case 4789:
+case 4790:
+case 4791:
+case 4792:
+case 4793:
+case 4794:
+case 4795:
+case 4796:
+case 4797:
+case 4798:
+case 4799:
+case 4800:
+case 4801:
+case 4802:
+case 4803:
+case 4804:
+case 4805:
+case 4806:
+case 4807:
+case 4808:
+case 4809:
+case 4810:
+case 4811:
+case 4812:
+case 4813:
+case 4814:
+case 4815:
+case 4816:
+case 4817:
+case 4818:
+case 4819:
+case 4820:
+case 4821:
+case 4822:
+case 4823:
+case 4824:
+case 4825:
+case 4826:
+case 4827:
+case 4828:
+case 4829:
+case 4830:
+case 4831:
+case 4832:
+case 4833:
+case 4834:
+case 4835:
+case 4836:
+case 4837:
+case 4838:
+case 4839:
+case 4840:
+case 4841:
+case 4842:
+case 4843:
+case 4844:
+case 4845:
+case 4846:
+case 4847:
+case 4848:
+case 4849:
+case 4850:
+case 4851:
+case 4852:
+case 4853:
+case 4854:
+case 4855:
+case 4856:
+case 4857:
+case 4858:
+case 4859:
+case 4860:
+case 4861:
+case 4862:
+case 4863:
+case 4864:
+case 4865:
+case 4866:
+case 4867:
+case 4868:
+case 4869:
+case 4870:
+case 4871:
+case 4872:
+case 4873:
+case 4874:
+case 4875:
+case 4876:
+case 4877:
+case 4878:
+case 4879:
+case 4880:
+case 4881:
+case 4882:
+case 4883:
+case 4884:
+case 4885:
+case 4886:
+case 4887:
+case 4888:
+case 4889:
+case 4890:
+case 4891:
+case 4892:
+case 4893:
+case 4894:
+case 4895:
+case 4896:
+case 4897:
+case 4898:
+case 4899:
+case 4900:
+case 4901:
+case 4902:
+case 4903:
+case 4904:
+case 4905:
+case 4906:
+case 4907:
+case 4908:
+case 4909:
+case 4910:
+case 4911:
+case 4912:
+case 4913:
+case 4914:
+case 4915:
+case 4916:
+case 4917:
+case 4918:
+case 4919:
+case 4920:
+case 4921:
+case 4922:
+case 4923:
+case 4924:
+case 4925:
+case 4926:
+case 4927:
+case 4928:
+case 4929:
+case 4930:
+case 4931:
+case 4932:
+case 4933:
+case 4934:
+case 4935:
+case 4936:
+case 4937:
+case 4938:
+case 4939:
+case 4940:
+case 4941:
+case 4942:
+case 4943:
+case 4944:
+case 4945:
+case 4946:
+case 4947:
+case 4948:
+case 4949:
+case 4950:
+case 4951:
+case 4952:
+case 4953:
+case 4954:
+case 4955:
+case 4956:
+case 4957:
+case 4958:
+case 4959:
+case 4960:
+case 4961:
+case 4962:
+case 4963:
+case 4964:
+case 4965:
+case 4966:
+case 4967:
+case 4968:
+case 4969:
+case 4970:
+case 4971:
+case 4972:
+case 4973:
+case 4974:
+case 4975:
+case 4976:
+case 4977:
+case 4978:
+case 4979:
+case 4980:
+case 4981:
+case 4982:
+case 4983:
+case 4984:
+case 4985:
+case 4986:
+case 4987:
+case 4988:
+case 4989:
+case 4990:
+case 4991:
+case 4992:
+case 4993:
+case 4994:
+case 4995:
+case 4996:
+case 4997:
+case 4998:
+case 4999:
+case 5000:
+case 5001:
+case 5002:
+case 5003:
+case 5004:
+case 5005:
+case 5006:
+case 5007:
+case 5008:
+case 5009:
+case 5010:
+case 5011:
+case 5012:
+case 5013:
+case 5014:
+case 5015:
+case 5016:
+case 5017:
+case 5018:
+case 5019:
+case 5020:
+case 5021:
+case 5022:
+case 5023:
+case 5024:
+case 5025:
+case 5026:
+case 5027:
+case 5028:
+case 5029:
+case 5030:
+case 5031:
+case 5032:
+case 5033:
+case 5034:
+case 5035:
+case 5036:
+case 5037:
+case 5038:
+case 5039:
+case 5040:
+case 5041:
+case 5042:
+case 5043:
+case 5044:
+case 5045:
+case 5046:
+case 5047:
+case 5048:
+case 5049:
+case 5050:
+case 5051:
+case 5052:
+case 5053:
+case 5054:
+case 5055:
+case 5056:
+case 5057:
+case 5058:
+case 5059:
+case 5060:
+case 5061:
+case 5062:
+case 5063:
+case 5064:
+case 5065:
+case 5066:
+case 5067:
+case 5068:
+case 5069:
+case 5070:
+case 5071:
+case 5072:
+case 5073:
+case 5074:
+case 5075:
+case 5076:
+case 5077:
+case 5078:
+case 5079:
+case 5080:
+case 5081:
+case 5082:
+case 5083:
+case 5084:
+case 5085:
+case 5086:
+case 5087:
+case 5088:
+case 5089:
+case 5090:
+case 5091:
+case 5092:
+case 5093:
+case 5094:
+case 5095:
+case 5096:
+case 5097:
+case 5098:
+case 5099:
+case 5100:
+case 5101:
+case 5102:
+case 5103:
+case 5104:
+case 5105:
+case 5106:
+case 5107:
+case 5108:
+case 5109:
+case 5110:
+case 5111:
+case 5112:
+case 5113:
+case 5114:
+case 5115:
+case 5116:
+case 5117:
+case 5118:
+case 5119:
+case 5120:
+case 5121:
+case 5122:
+case 5123:
+case 5124:
+case 5125:
+case 5126:
+case 5127:
+case 5128:
+case 5129:
+case 5130:
+case 5131:
+case 5132:
+case 5133:
+case 5134:
+case 5135:
+case 5136:
+case 5137:
+case 5138:
+case 5139:
+case 5140:
+case 5141:
+case 5142:
+case 5143:
+case 5144:
+case 5145:
+case 5146:
+case 5147:
+case 5148:
+case 5149:
+case 5150:
+case 5151:
+case 5152:
+case 5153:
+case 5154:
+case 5155:
+case 5156:
+case 5157:
+case 5158:
+case 5159:
+case 5160:
+case 5161:
+case 5162:
+case 5163:
+case 5164:
+case 5165:
+case 5166:
+case 5167:
+case 5168:
+case 5169:
+case 5170:
+case 5171:
+case 5172:
+case 5173:
+case 5174:
+case 5175:
+case 5176:
+case 5177:
+case 5178:
+case 5179:
+case 5180:
+case 5181:
+case 5182:
+case 5183:
+case 5184:
+case 5185:
+case 5186:
+case 5187:
+case 5188:
+case 5189:
+case 5190:
+case 5191:
+case 5192:
+case 5193:
+case 5194:
+case 5195:
+case 5196:
+case 5197:
+case 5198:
+case 5199:
+case 5200:
+case 5201:
+case 5202:
+case 5203:
+case 5204:
+case 5205:
+case 5206:
+case 5207:
+case 5208:
+case 5209:
+case 5210:
+case 5211:
+case 5212:
+case 5213:
+case 5214:
+case 5215:
+case 5216:
+case 5217:
+case 5218:
+case 5219:
+case 5220:
+case 5221:
+case 5222:
+case 5223:
+case 5224:
+case 5225:
+case 5226:
+case 5227:
+case 5228:
+case 5229:
+case 5230:
+case 5231:
+case 5232:
+case 5233:
+case 5234:
+case 5235:
+case 5236:
+case 5237:
+case 5238:
+case 5239:
+case 5240:
+case 5241:
+case 5242:
+case 5243:
+case 5244:
+case 5245:
+case 5246:
+case 5247:
+case 5248:
+case 5249:
+case 5250:
+case 5251:
+case 5252:
+case 5253:
+case 5254:
+case 5255:
+case 5256:
+case 5257:
+case 5258:
+case 5259:
+case 5260:
+case 5261:
+case 5262:
+case 5263:
+case 5264:
+case 5265:
+case 5266:
+case 5267:
+case 5268:
+case 5269:
+case 5270:
+case 5271:
+case 5272:
+case 5273:
+case 5274:
+case 5275:
+case 5276:
+case 5277:
+case 5278:
+case 5279:
+case 5280:
+case 5281:
+case 5282:
+case 5283:
+case 5284:
+case 5285:
+case 5286:
+case 5287:
+case 5288:
+case 5289:
+case 5290:
+case 5291:
+case 5292:
+case 5293:
+case 5294:
+case 5295:
+case 5296:
+case 5297:
+case 5298:
+case 5299:
+case 5300:
+case 5301:
+case 5302:
+case 5303:
+case 5304:
+case 5305:
+case 5306:
+case 5307:
+case 5308:
+case 5309:
+case 5310:
+case 5311:
+case 5312:
+case 5313:
+case 5314:
+case 5315:
+case 5316:
+case 5317:
+case 5318:
+case 5319:
+case 5320:
+case 5321:
+case 5322:
+case 5323:
+case 5324:
+case 5325:
+case 5326:
+case 5327:
+case 5328:
+case 5329:
+case 5330:
+case 5331:
+case 5332:
+case 5333:
+case 5334:
+case 5335:
+case 5336:
+case 5337:
+case 5338:
+case 5339:
+case 5340:
+case 5341:
+case 5342:
+case 5343:
+case 5344:
+case 5345:
+case 5346:
+case 5347:
+case 5348:
+case 5349:
+case 5350:
+case 5351:
+case 5352:
+case 5353:
+case 5354:
+case 5355:
+case 5356:
+case 5357:
+case 5358:
+case 5359:
+case 5360:
+case 5361:
+case 5362:
+case 5363:
+case 5364:
+case 5365:
+case 5366:
+case 5367:
+case 5368:
+case 5369:
+case 5370:
+case 5371:
+case 5372:
+case 5373:
+case 5374:
+case 5375:
+case 5376:
+case 5377:
+case 5378:
+case 5379:
+case 5380:
+case 5381:
+case 5382:
+case 5383:
+case 5384:
+case 5385:
+case 5386:
+case 5387:
+case 5388:
+case 5389:
+case 5390:
+case 5391:
+case 5392:
+case 5393:
+case 5394:
+case 5395:
+case 5396:
+case 5397:
+case 5398:
+case 5399:
+case 5400:
+case 5401:
+case 5402:
+case 5403:
+case 5404:
+case 5405:
+case 5406:
+case 5407:
+case 5408:
+case 5409:
+case 5410:
+case 5411:
+case 5412:
+case 5413:
+case 5414:
+case 5415:
+case 5416:
+case 5417:
+case 5418:
+case 5419:
+case 5420:
+case 5421:
+case 5422:
+case 5423:
+case 5424:
+case 5425:
+case 5426:
+case 5427:
+case 5428:
+case 5429:
+case 5430:
+case 5431:
+case 5432:
+case 5433:
+case 5434:
+case 5435:
+case 5436:
+case 5437:
+case 5438:
+case 5439:
+case 5440:
+case 5441:
+case 5442:
+case 5443:
+case 5444:
+case 5445:
+case 5446:
+case 5447:
+case 5448:
+case 5449:
+case 5450:
+case 5451:
+case 5452:
+case 5453:
+case 5454:
+case 5455:
+case 5456:
+case 5457:
+case 5458:
+case 5459:
+case 5460:
+case 5461:
+case 5462:
+case 5463:
+case 5464:
+case 5465:
+case 5466:
+case 5467:
+case 5468:
+case 5469:
+case 5470:
+case 5471:
+case 5472:
+case 5473:
+case 5474:
+case 5475:
+case 5476:
+case 5477:
+case 5478:
+case 5479:
+case 5480:
+case 5481:
+case 5482:
+case 5483:
+case 5484:
+case 5485:
+case 5486:
+case 5487:
+case 5488:
+case 5489:
+case 5490:
+case 5491:
+case 5492:
+case 5493:
+case 5494:
+case 5495:
+case 5496:
+case 5497:
+case 5498:
+case 5499:
+case 5500:
+case 5501:
+case 5502:
+case 5503:
+case 5504:
+case 5505:
+case 5506:
+case 5507:
+case 5508:
+case 5509:
+case 5510:
+case 5511:
+case 5512:
+case 5513:
+case 5514:
+case 5515:
+case 5516:
+case 5517:
+case 5518:
+case 5519:
+case 5520:
+case 5521:
+case 5522:
+case 5523:
+case 5524:
+case 5525:
+case 5526:
+case 5527:
+case 5528:
+case 5529:
+case 5530:
+case 5531:
+case 5532:
+case 5533:
+case 5534:
+case 5535:
+case 5536:
+case 5537:
+case 5538:
+case 5539:
+case 5540:
+case 5541:
+case 5542:
+case 5543:
+case 5544:
+case 5545:
+case 5546:
+case 5547:
+case 5548:
+case 5549:
+case 5550:
+case 5551:
+case 5552:
+case 5553:
+case 5554:
+case 5555:
+case 5556:
+case 5557:
+case 5558:
+case 5559:
+case 5560:
+case 5561:
+case 5562:
+case 5563:
+case 5564:
+case 5565:
+case 5566:
+case 5567:
+case 5568:
+case 5569:
+case 5570:
+case 5571:
+case 5572:
+case 5573:
+case 5574:
+case 5575:
+case 5576:
+case 5577:
+case 5578:
+case 5579:
+case 5580:
+case 5581:
+case 5582:
+case 5583:
+case 5584:
+case 5585:
+case 5586:
+case 5587:
+case 5588:
+case 5589:
+case 5590:
+case 5591:
+case 5592:
+case 5593:
+case 5594:
+case 5595:
+case 5596:
+case 5597:
+case 5598:
+case 5599:
+case 5600:
+case 5601:
+case 5602:
+case 5603:
+case 5604:
+case 5605:
+case 5606:
+case 5607:
+case 5608:
+case 5609:
+case 5610:
+case 5611:
+case 5612:
+case 5613:
+case 5614:
+case 5615:
+case 5616:
+case 5617:
+case 5618:
+case 5619:
+case 5620:
+case 5621:
+case 5622:
+case 5623:
+case 5624:
+case 5625:
+case 5626:
+case 5627:
+case 5628:
+case 5629:
+case 5630:
+case 5631:
+case 5632:
+case 5633:
+case 5634:
+case 5635:
+case 5636:
+case 5637:
+case 5638:
+case 5639:
+case 5640:
+case 5641:
+case 5642:
+case 5643:
+case 5644:
+case 5645:
+case 5646:
+case 5647:
+case 5648:
+case 5649:
+case 5650:
+case 5651:
+case 5652:
+case 5653:
+case 5654:
+case 5655:
+case 5656:
+case 5657:
+case 5658:
+case 5659:
+case 5660:
+case 5661:
+case 5662:
+case 5663:
+case 5664:
+case 5665:
+case 5666:
+case 5667:
+case 5668:
+case 5669:
+case 5670:
+case 5671:
+case 5672:
+case 5673:
+case 5674:
+case 5675:
+case 5676:
+case 5677:
+case 5678:
+case 5679:
+case 5680:
+case 5681:
+case 5682:
+case 5683:
+case 5684:
+case 5685:
+case 5686:
+case 5687:
+case 5688:
+case 5689:
+case 5690:
+case 5691:
+case 5692:
+case 5693:
+case 5694:
+case 5695:
+case 5696:
+case 5697:
+case 5698:
+case 5699:
+case 5700:
+case 5701:
+case 5702:
+case 5703:
+case 5704:
+case 5705:
+case 5706:
+case 5707:
+case 5708:
+case 5709:
+case 5710:
+case 5711:
+case 5712:
+case 5713:
+case 5714:
+case 5715:
+case 5716:
+case 5717:
+case 5718:
+case 5719:
+case 5720:
+case 5721:
+case 5722:
+case 5723:
+case 5724:
+case 5725:
+case 5726:
+case 5727:
+case 5728:
+case 5729:
+case 5730:
+case 5731:
+case 5732:
+case 5733:
+case 5734:
+case 5735:
+case 5736:
+case 5737:
+case 5738:
+case 5739:
+case 5740:
+case 5741:
+case 5742:
+case 5743:
+case 5744:
+case 5745:
+case 5746:
+case 5747:
+case 5748:
+case 5749:
+case 5750:
+case 5751:
+case 5752:
+case 5753:
+case 5754:
+case 5755:
+case 5756:
+case 5757:
+case 5758:
+case 5759:
+case 5760:
+case 5761:
+case 5762:
+case 5763:
+case 5764:
+case 5765:
+case 5766:
+case 5767:
+case 5768:
+case 5769:
+case 5770:
+case 5771:
+case 5772:
+case 5773:
+case 5774:
+case 5775:
+case 5776:
+case 5777:
+case 5778:
+case 5779:
+case 5780:
+case 5781:
+case 5782:
+case 5783:
+case 5784:
+case 5785:
+case 5786:
+case 5787:
+case 5788:
+case 5789:
+case 5790:
+case 5791:
+case 5792:
+case 5793:
+case 5794:
+case 5795:
+case 5796:
+case 5797:
+case 5798:
+case 5799:
+case 5800:
+case 5801:
+case 5802:
+case 5803:
+case 5804:
+case 5805:
+case 5806:
+case 5807:
+case 5808:
+case 5809:
+case 5810:
+case 5811:
+case 5812:
+case 5813:
+case 5814:
+case 5815:
+case 5816:
+case 5817:
+case 5818:
+case 5819:
+case 5820:
+case 5821:
+case 5822:
+case 5823:
+case 5824:
+case 5825:
+case 5826:
+case 5827:
+case 5828:
+case 5829:
+case 5830:
+case 5831:
+case 5832:
+case 5833:
+case 5834:
+case 5835:
+case 5836:
+case 5837:
+case 5838:
+case 5839:
+case 5840:
+case 5841:
+case 5842:
+case 5843:
+case 5844:
+case 5845:
+case 5846:
+case 5847:
+case 5848:
+case 5849:
+case 5850:
+case 5851:
+case 5852:
+case 5853:
+case 5854:
+case 5855:
+case 5856:
+case 5857:
+case 5858:
+case 5859:
+case 5860:
+case 5861:
+case 5862:
+case 5863:
+case 5864:
+case 5865:
+case 5866:
+case 5867:
+case 5868:
+case 5869:
+case 5870:
+case 5871:
+case 5872:
+case 5873:
+case 5874:
+case 5875:
+case 5876:
+case 5877:
+case 5878:
+case 5879:
+case 5880:
+case 5881:
+case 5882:
+case 5883:
+case 5884:
+case 5885:
+case 5886:
+case 5887:
+case 5888:
+case 5889:
+case 5890:
+case 5891:
+case 5892:
+case 5893:
+case 5894:
+case 5895:
+case 5896:
+case 5897:
+case 5898:
+case 5899:
+case 5900:
+case 5901:
+case 5902:
+case 5903:
+case 5904:
+case 5905:
+case 5906:
+case 5907:
+case 5908:
+case 5909:
+case 5910:
+case 5911:
+case 5912:
+case 5913:
+case 5914:
+case 5915:
+case 5916:
+case 5917:
+case 5918:
+case 5919:
+case 5920:
+case 5921:
+case 5922:
+case 5923:
+case 5924:
+case 5925:
+case 5926:
+case 5927:
+case 5928:
+case 5929:
+case 5930:
+case 5931:
+case 5932:
+case 5933:
+case 5934:
+case 5935:
+case 5936:
+case 5937:
+case 5938:
+case 5939:
+case 5940:
+case 5941:
+case 5942:
+case 5943:
+case 5944:
+case 5945:
+case 5946:
+case 5947:
+case 5948:
+case 5949:
+case 5950:
+case 5951:
+case 5952:
+case 5953:
+case 5954:
+case 5955:
+case 5956:
+case 5957:
+case 5958:
+case 5959:
+case 5960:
+case 5961:
+case 5962:
+case 5963:
+case 5964:
+case 5965:
+case 5966:
+case 5967:
+case 5968:
+case 5969:
+case 5970:
+case 5971:
+case 5972:
+case 5973:
+case 5974:
+case 5975:
+case 5976:
+case 5977:
+case 5978:
+case 5979:
+case 5980:
+case 5981:
+case 5982:
+case 5983:
+case 5984:
+case 5985:
+case 5986:
+case 5987:
+case 5988:
+case 5989:
+case 5990:
+case 5991:
+case 5992:
+case 5993:
+case 5994:
+case 5995:
+case 5996:
+case 5997:
+case 5998:
+case 5999:
+case 6000:
+case 6001:
+case 6002:
+case 6003:
+case 6004:
+case 6005:
+case 6006:
+case 6007:
+case 6008:
+case 6009:
+case 6010:
+case 6011:
+case 6012:
+case 6013:
+case 6014:
+case 6015:
+case 6016:
+case 6017:
+case 6018:
+case 6019:
+case 6020:
+case 6021:
+case 6022:
+case 6023:
+case 6024:
+case 6025:
+case 6026:
+case 6027:
+case 6028:
+case 6029:
+case 6030:
+case 6031:
+case 6032:
+case 6033:
+case 6034:
+case 6035:
+case 6036:
+case 6037:
+case 6038:
+case 6039:
+case 6040:
+case 6041:
+case 6042:
+case 6043:
+case 6044:
+case 6045:
+case 6046:
+case 6047:
+case 6048:
+case 6049:
+case 6050:
+case 6051:
+case 6052:
+case 6053:
+case 6054:
+case 6055:
+case 6056:
+case 6057:
+case 6058:
+case 6059:
+case 6060:
+case 6061:
+case 6062:
+case 6063:
+case 6064:
+case 6065:
+case 6066:
+case 6067:
+case 6068:
+case 6069:
+case 6070:
+case 6071:
+case 6072:
+case 6073:
+case 6074:
+case 6075:
+case 6076:
+case 6077:
+case 6078:
+case 6079:
+case 6080:
+case 6081:
+case 6082:
+case 6083:
+case 6084:
+case 6085:
+case 6086:
+case 6087:
+case 6088:
+case 6089:
+case 6090:
+case 6091:
+case 6092:
+case 6093:
+case 6094:
+case 6095:
+case 6096:
+case 6097:
+case 6098:
+case 6099:
+case 6100:
+case 6101:
+case 6102:
+case 6103:
+case 6104:
+case 6105:
+case 6106:
+case 6107:
+case 6108:
+case 6109:
+case 6110:
+case 6111:
+case 6112:
+case 6113:
+case 6114:
+case 6115:
+case 6116:
+case 6117:
+case 6118:
+case 6119:
+case 6120:
+case 6121:
+case 6122:
+case 6123:
+case 6124:
+case 6125:
+case 6126:
+case 6127:
+case 6128:
+case 6129:
+case 6130:
+case 6131:
+case 6132:
+case 6133:
+case 6134:
+case 6135:
+case 6136:
+case 6137:
+case 6138:
+case 6139:
+case 6140:
+case 6141:
+case 6142:
+case 6143:
+case 6144:
+case 6145:
+case 6146:
+case 6147:
+case 6148:
+case 6149:
+case 6150:
+case 6151:
+case 6152:
+case 6153:
+case 6154:
+case 6155:
+case 6156:
+case 6157:
+case 6158:
+case 6159:
+case 6160:
+case 6161:
+case 6162:
+case 6163:
+case 6164:
+case 6165:
+case 6166:
+case 6167:
+case 6168:
+case 6169:
+case 6170:
+case 6171:
+case 6172:
+case 6173:
+case 6174:
+case 6175:
+case 6176:
+case 6177:
+case 6178:
+case 6179:
+case 6180:
+case 6181:
+case 6182:
+case 6183:
+case 6184:
+case 6185:
+case 6186:
+case 6187:
+case 6188:
+case 6189:
+case 6190:
+case 6191:
+case 6192:
+case 6193:
+case 6194:
+case 6195:
+case 6196:
+case 6197:
+case 6198:
+case 6199:
+case 6200:
+case 6201:
+case 6202:
+case 6203:
+case 6204:
+case 6205:
+case 6206:
+case 6207:
+case 6208:
+case 6209:
+case 6210:
+case 6211:
+case 6212:
+case 6213:
+case 6214:
+case 6215:
+case 6216:
+case 6217:
+case 6218:
+case 6219:
+case 6220:
+case 6221:
+case 6222:
+case 6223:
+case 6224:
+case 6225:
+case 6226:
+case 6227:
+case 6228:
+case 6229:
+case 6230:
+case 6231:
+case 6232:
+case 6233:
+case 6234:
+case 6235:
+case 6236:
+case 6237:
+case 6238:
+case 6239:
+case 6240:
+case 6241:
+case 6242:
+case 6243:
+case 6244:
+case 6245:
+case 6246:
+case 6247:
+case 6248:
+case 6249:
+case 6250:
+case 6251:
+case 6252:
+case 6253:
+case 6254:
+case 6255:
+case 6256:
+case 6257:
+case 6258:
+case 6259:
+case 6260:
+case 6261:
+case 6262:
+case 6263:
+case 6264:
+case 6265:
+case 6266:
+case 6267:
+case 6268:
+case 6269:
+case 6270:
+case 6271:
+case 6272:
+case 6273:
+case 6274:
+case 6275:
+case 6276:
+case 6277:
+case 6278:
+case 6279:
+case 6280:
+case 6281:
+case 6282:
+case 6283:
+case 6284:
+case 6285:
+case 6286:
+case 6287:
+case 6288:
+case 6289:
+case 6290:
+case 6291:
+case 6292:
+case 6293:
+case 6294:
+case 6295:
+case 6296:
+case 6297:
+case 6298:
+case 6299:
+case 6300:
+case 6301:
+case 6302:
+case 6303:
+case 6304:
+case 6305:
+case 6306:
+case 6307:
+case 6308:
+case 6309:
+case 6310:
+case 6311:
+case 6312:
+case 6313:
+case 6314:
+case 6315:
+case 6316:
+case 6317:
+case 6318:
+case 6319:
+case 6320:
+case 6321:
+case 6322:
+case 6323:
+case 6324:
+case 6325:
+case 6326:
+case 6327:
+case 6328:
+case 6329:
+case 6330:
+case 6331:
+case 6332:
+case 6333:
+case 6334:
+case 6335:
+case 6336:
+case 6337:
+case 6338:
+case 6339:
+case 6340:
+case 6341:
+case 6342:
+case 6343:
+case 6344:
+case 6345:
+case 6346:
+case 6347:
+case 6348:
+case 6349:
+case 6350:
+case 6351:
+case 6352:
+case 6353:
+case 6354:
+case 6355:
+case 6356:
+case 6357:
+case 6358:
+case 6359:
+case 6360:
+case 6361:
+case 6362:
+case 6363:
+case 6364:
+case 6365:
+case 6366:
+case 6367:
+case 6368:
+case 6369:
+case 6370:
+case 6371:
+case 6372:
+case 6373:
+case 6374:
+case 6375:
+case 6376:
+case 6377:
+case 6378:
+case 6379:
+case 6380:
+case 6381:
+case 6382:
+case 6383:
+case 6384:
+case 6385:
+case 6386:
+case 6387:
+case 6388:
+case 6389:
+case 6390:
+case 6391:
+case 6392:
+case 6393:
+case 6394:
+case 6395:
+case 6396:
+case 6397:
+case 6398:
+case 6399:
+case 6400:
+case 6401:
+case 6402:
+case 6403:
+case 6404:
+case 6405:
+case 6406:
+case 6407:
+case 6408:
+case 6409:
+case 6410:
+case 6411:
+case 6412:
+case 6413:
+case 6414:
+case 6415:
+case 6416:
+case 6417:
+case 6418:
+case 6419:
+case 6420:
+case 6421:
+case 6422:
+case 6423:
+case 6424:
+case 6425:
+case 6426:
+case 6427:
+case 6428:
+case 6429:
+case 6430:
+case 6431:
+case 6432:
+case 6433:
+case 6434:
+case 6435:
+case 6436:
+case 6437:
+case 6438:
+case 6439:
+case 6440:
+case 6441:
+case 6442:
+case 6443:
+case 6444:
+case 6445:
+case 6446:
+case 6447:
+case 6448:
+case 6449:
+case 6450:
+case 6451:
+case 6452:
+case 6453:
+case 6454:
+case 6455:
+case 6456:
+case 6457:
+case 6458:
+case 6459:
+case 6460:
+case 6461:
+case 6462:
+case 6463:
+case 6464:
+case 6465:
+case 6466:
+case 6467:
+case 6468:
+case 6469:
+case 6470:
+case 6471:
+case 6472:
+case 6473:
+case 6474:
+case 6475:
+case 6476:
+case 6477:
+case 6478:
+case 6479:
+case 6480:
+case 6481:
+case 6482:
+case 6483:
+case 6484:
+case 6485:
+case 6486:
+case 6487:
+case 6488:
+case 6489:
+case 6490:
+case 6491:
+case 6492:
+case 6493:
+case 6494:
+case 6495:
+case 6496:
+case 6497:
+case 6498:
+case 6499:
+case 6500:
+case 6501:
+case 6502:
+case 6503:
+case 6504:
+case 6505:
+case 6506:
+case 6507:
+case 6508:
+case 6509:
+case 6510:
+case 6511:
+case 6512:
+case 6513:
+case 6514:
+case 6515:
+case 6516:
+case 6517:
+case 6518:
+case 6519:
+case 6520:
+case 6521:
+case 6522:
+case 6523:
+case 6524:
+case 6525:
+case 6526:
+case 6527:
+case 6528:
+case 6529:
+case 6530:
+case 6531:
+case 6532:
+case 6533:
+case 6534:
+case 6535:
+case 6536:
+case 6537:
+case 6538:
+case 6539:
+case 6540:
+case 6541:
+case 6542:
+case 6543:
+case 6544:
+case 6545:
+case 6546:
+case 6547:
+case 6548:
+case 6549:
+case 6550:
+case 6551:
+case 6552:
+case 6553:
+case 6554:
+case 6555:
+case 6556:
+case 6557:
+case 6558:
+case 6559:
+case 6560:
+case 6561:
+case 6562:
+case 6563:
+case 6564:
+case 6565:
+case 6566:
+case 6567:
+case 6568:
+case 6569:
+case 6570:
+case 6571:
+case 6572:
+case 6573:
+case 6574:
+case 6575:
+case 6576:
+case 6577:
+case 6578:
+case 6579:
+case 6580:
+case 6581:
+case 6582:
+case 6583:
+case 6584:
+case 6585:
+case 6586:
+case 6587:
+case 6588:
+case 6589:
+case 6590:
+case 6591:
+case 6592:
+case 6593:
+case 6594:
+case 6595:
+case 6596:
+case 6597:
+case 6598:
+case 6599:
+case 6600:
+case 6601:
+case 6602:
+case 6603:
+case 6604:
+case 6605:
+case 6606:
+case 6607:
+case 6608:
+case 6609:
+case 6610:
+case 6611:
+case 6612:
+case 6613:
+case 6614:
+case 6615:
+case 6616:
+case 6617:
+case 6618:
+case 6619:
+case 6620:
+case 6621:
+case 6622:
+case 6623:
+case 6624:
+case 6625:
+case 6626:
+case 6627:
+case 6628:
+case 6629:
+case 6630:
+case 6631:
+case 6632:
+case 6633:
+case 6634:
+case 6635:
+case 6636:
+case 6637:
+case 6638:
+case 6639:
+case 6640:
+case 6641:
+case 6642:
+case 6643:
+case 6644:
+case 6645:
+case 6646:
+case 6647:
+case 6648:
+case 6649:
+case 6650:
+case 6651:
+case 6652:
+case 6653:
+case 6654:
+case 6655:
+case 6656:
+case 6657:
+case 6658:
+case 6659:
+case 6660:
+case 6661:
+case 6662:
+case 6663:
+case 6664:
+case 6665:
+case 6666:
+case 6667:
+case 6668:
+case 6669:
+case 6670:
+case 6671:
+case 6672:
+case 6673:
+case 6674:
+case 6675:
+case 6676:
+case 6677:
+case 6678:
+case 6679:
+case 6680:
+case 6681:
+case 6682:
+case 6683:
+case 6684:
+case 6685:
+case 6686:
+case 6687:
+case 6688:
+case 6689:
+case 6690:
+case 6691:
+case 6692:
+case 6693:
+case 6694:
+case 6695:
+case 6696:
+case 6697:
+case 6698:
+case 6699:
+case 6700:
+case 6701:
+case 6702:
+case 6703:
+case 6704:
+case 6705:
+case 6706:
+case 6707:
+case 6708:
+case 6709:
+case 6710:
+case 6711:
+case 6712:
+case 6713:
+case 6714:
+case 6715:
+case 6716:
+case 6717:
+case 6718:
+case 6719:
+case 6720:
+case 6721:
+case 6722:
+case 6723:
+case 6724:
+case 6725:
+case 6726:
+case 6727:
+case 6728:
+case 6729:
+case 6730:
+case 6731:
+case 6732:
+case 6733:
+case 6734:
+case 6735:
+case 6736:
+case 6737:
+case 6738:
+case 6739:
+case 6740:
+case 6741:
+case 6742:
+case 6743:
+case 6744:
+case 6745:
+case 6746:
+case 6747:
+case 6748:
+case 6749:
+case 6750:
+case 6751:
+case 6752:
+case 6753:
+case 6754:
+case 6755:
+case 6756:
+case 6757:
+case 6758:
+case 6759:
+case 6760:
+case 6761:
+case 6762:
+case 6763:
+case 6764:
+case 6765:
+case 6766:
+case 6767:
+case 6768:
+case 6769:
+case 6770:
+case 6771:
+case 6772:
+case 6773:
+case 6774:
+case 6775:
+case 6776:
+case 6777:
+case 6778:
+case 6779:
+case 6780:
+case 6781:
+case 6782:
+case 6783:
+case 6784:
+case 6785:
+case 6786:
+case 6787:
+case 6788:
+case 6789:
+case 6790:
+case 6791:
+case 6792:
+case 6793:
+case 6794:
+case 6795:
+case 6796:
+case 6797:
+case 6798:
+case 6799:
+case 6800:
+case 6801:
+case 6802:
+case 6803:
+case 6804:
+case 6805:
+case 6806:
+case 6807:
+case 6808:
+case 6809:
+case 6810:
+case 6811:
+case 6812:
+case 6813:
+case 6814:
+case 6815:
+case 6816:
+case 6817:
+case 6818:
+case 6819:
+case 6820:
+case 6821:
+case 6822:
+case 6823:
+case 6824:
+case 6825:
+case 6826:
+case 6827:
+case 6828:
+case 6829:
+case 6830:
+case 6831:
+case 6832:
+case 6833:
+case 6834:
+case 6835:
+case 6836:
+case 6837:
+case 6838:
+case 6839:
+case 6840:
+case 6841:
+case 6842:
+case 6843:
+case 6844:
+case 6845:
+case 6846:
+case 6847:
+case 6848:
+case 6849:
+case 6850:
+case 6851:
+case 6852:
+case 6853:
+case 6854:
+case 6855:
+case 6856:
+case 6857:
+case 6858:
+case 6859:
+case 6860:
+case 6861:
+case 6862:
+case 6863:
+case 6864:
+case 6865:
+case 6866:
+case 6867:
+case 6868:
+case 6869:
+case 6870:
+case 6871:
+case 6872:
+case 6873:
+case 6874:
+case 6875:
+case 6876:
+case 6877:
+case 6878:
+case 6879:
+case 6880:
+case 6881:
+case 6882:
+case 6883:
+case 6884:
+case 6885:
+case 6886:
+case 6887:
+case 6888:
+case 6889:
+case 6890:
+case 6891:
+case 6892:
+case 6893:
+case 6894:
+case 6895:
+case 6896:
+case 6897:
+case 6898:
+case 6899:
+case 6900:
+case 6901:
+case 6902:
+case 6903:
+case 6904:
+case 6905:
+case 6906:
+case 6907:
+case 6908:
+case 6909:
+case 6910:
+case 6911:
+case 6912:
+case 6913:
+case 6914:
+case 6915:
+case 6916:
+case 6917:
+case 6918:
+case 6919:
+case 6920:
+case 6921:
+case 6922:
+case 6923:
+case 6924:
+case 6925:
+case 6926:
+case 6927:
+case 6928:
+case 6929:
+case 6930:
+case 6931:
+case 6932:
+case 6933:
+case 6934:
+case 6935:
+case 6936:
+case 6937:
+case 6938:
+case 6939:
+case 6940:
+case 6941:
+case 6942:
+case 6943:
+case 6944:
+case 6945:
+case 6946:
+case 6947:
+case 6948:
+case 6949:
+case 6950:
+case 6951:
+case 6952:
+case 6953:
+case 6954:
+case 6955:
+case 6956:
+case 6957:
+case 6958:
+case 6959:
+case 6960:
+case 6961:
+case 6962:
+case 6963:
+case 6964:
+case 6965:
+case 6966:
+case 6967:
+case 6968:
+case 6969:
+case 6970:
+case 6971:
+case 6972:
+case 6973:
+case 6974:
+case 6975:
+case 6976:
+case 6977:
+case 6978:
+case 6979:
+case 6980:
+case 6981:
+case 6982:
+case 6983:
+case 6984:
+case 6985:
+case 6986:
+case 6987:
+case 6988:
+case 6989:
+case 6990:
+case 6991:
+case 6992:
+case 6993:
+case 6994:
+case 6995:
+case 6996:
+case 6997:
+case 6998:
+case 6999:
+case 7000:
+case 7001:
+case 7002:
+case 7003:
+case 7004:
+case 7005:
+case 7006:
+case 7007:
+case 7008:
+case 7009:
+case 7010:
+case 7011:
+case 7012:
+case 7013:
+case 7014:
+case 7015:
+case 7016:
+case 7017:
+case 7018:
+case 7019:
+case 7020:
+case 7021:
+case 7022:
+case 7023:
+case 7024:
+case 7025:
+case 7026:
+case 7027:
+case 7028:
+case 7029:
+case 7030:
+case 7031:
+case 7032:
+case 7033:
+case 7034:
+case 7035:
+case 7036:
+case 7037:
+case 7038:
+case 7039:
+case 7040:
+case 7041:
+case 7042:
+case 7043:
+case 7044:
+case 7045:
+case 7046:
+case 7047:
+case 7048:
+case 7049:
+case 7050:
+case 7051:
+case 7052:
+case 7053:
+case 7054:
+case 7055:
+case 7056:
+case 7057:
+case 7058:
+case 7059:
+case 7060:
+case 7061:
+case 7062:
+case 7063:
+case 7064:
+case 7065:
+case 7066:
+case 7067:
+case 7068:
+case 7069:
+case 7070:
+case 7071:
+case 7072:
+case 7073:
+case 7074:
+case 7075:
+case 7076:
+case 7077:
+case 7078:
+case 7079:
+case 7080:
+case 7081:
+case 7082:
+case 7083:
+case 7084:
+case 7085:
+case 7086:
+case 7087:
+case 7088:
+case 7089:
+case 7090:
+case 7091:
+case 7092:
+case 7093:
+case 7094:
+case 7095:
+case 7096:
+case 7097:
+case 7098:
+case 7099:
+case 7100:
+case 7101:
+case 7102:
+case 7103:
+case 7104:
+case 7105:
+case 7106:
+case 7107:
+case 7108:
+case 7109:
+case 7110:
+case 7111:
+case 7112:
+case 7113:
+case 7114:
+case 7115:
+case 7116:
+case 7117:
+case 7118:
+case 7119:
+case 7120:
+case 7121:
+case 7122:
+case 7123:
+case 7124:
+case 7125:
+case 7126:
+case 7127:
+case 7128:
+case 7129:
+case 7130:
+case 7131:
+case 7132:
+case 7133:
+case 7134:
+case 7135:
+case 7136:
+case 7137:
+case 7138:
+case 7139:
+case 7140:
+case 7141:
+case 7142:
+case 7143:
+case 7144:
+case 7145:
+case 7146:
+case 7147:
+case 7148:
+case 7149:
+case 7150:
+case 7151:
+case 7152:
+case 7153:
+case 7154:
+case 7155:
+case 7156:
+case 7157:
+case 7158:
+case 7159:
+case 7160:
+case 7161:
+case 7162:
+case 7163:
+case 7164:
+case 7165:
+case 7166:
+case 7167:
+case 7168:
+case 7169:
+case 7170:
+case 7171:
+case 7172:
+case 7173:
+case 7174:
+case 7175:
+case 7176:
+case 7177:
+case 7178:
+case 7179:
+case 7180:
+case 7181:
+case 7182:
+case 7183:
+case 7184:
+case 7185:
+case 7186:
+case 7187:
+case 7188:
+case 7189:
+case 7190:
+case 7191:
+case 7192:
+case 7193:
+case 7194:
+case 7195:
+case 7196:
+case 7197:
+case 7198:
+case 7199:
+case 7200:
+case 7201:
+case 7202:
+case 7203:
+case 7204:
+case 7205:
+case 7206:
+case 7207:
+case 7208:
+case 7209:
+case 7210:
+case 7211:
+case 7212:
+case 7213:
+case 7214:
+case 7215:
+case 7216:
+case 7217:
+case 7218:
+case 7219:
+case 7220:
+case 7221:
+case 7222:
+case 7223:
+case 7224:
+case 7225:
+case 7226:
+case 7227:
+case 7228:
+case 7229:
+case 7230:
+case 7231:
+case 7232:
+case 7233:
+case 7234:
+case 7235:
+case 7236:
+case 7237:
+case 7238:
+case 7239:
+case 7240:
+case 7241:
+case 7242:
+case 7243:
+case 7244:
+case 7245:
+case 7246:
+case 7247:
+case 7248:
+case 7249:
+case 7250:
+case 7251:
+case 7252:
+case 7253:
+case 7254:
+case 7255:
+case 7256:
+case 7257:
+case 7258:
+case 7259:
+case 7260:
+case 7261:
+case 7262:
+case 7263:
+case 7264:
+case 7265:
+case 7266:
+case 7267:
+case 7268:
+case 7269:
+case 7270:
+case 7271:
+case 7272:
+case 7273:
+case 7274:
+case 7275:
+case 7276:
+case 7277:
+case 7278:
+case 7279:
+case 7280:
+case 7281:
+case 7282:
+case 7283:
+case 7284:
+case 7285:
+case 7286:
+case 7287:
+case 7288:
+case 7289:
+case 7290:
+case 7291:
+case 7292:
+case 7293:
+case 7294:
+case 7295:
+case 7296:
+case 7297:
+case 7298:
+case 7299:
+case 7300:
+case 7301:
+case 7302:
+case 7303:
+case 7304:
+case 7305:
+case 7306:
+case 7307:
+case 7308:
+case 7309:
+case 7310:
+case 7311:
+case 7312:
+case 7313:
+case 7314:
+case 7315:
+case 7316:
+case 7317:
+case 7318:
+case 7319:
+case 7320:
+case 7321:
+case 7322:
+case 7323:
+case 7324:
+case 7325:
+case 7326:
+case 7327:
+case 7328:
+case 7329:
+case 7330:
+case 7331:
+case 7332:
+case 7333:
+case 7334:
+case 7335:
+case 7336:
+case 7337:
+case 7338:
+case 7339:
+case 7340:
+case 7341:
+case 7342:
+case 7343:
+case 7344:
+case 7345:
+case 7346:
+case 7347:
+case 7348:
+case 7349:
+case 7350:
+case 7351:
+case 7352:
+case 7353:
+case 7354:
+case 7355:
+case 7356:
+case 7357:
+case 7358:
+case 7359:
+case 7360:
+case 7361:
+case 7362:
+case 7363:
+case 7364:
+case 7365:
+case 7366:
+case 7367:
+case 7368:
+case 7369:
+case 7370:
+case 7371:
+case 7372:
+case 7373:
+case 7374:
+case 7375:
+case 7376:
+case 7377:
+case 7378:
+case 7379:
+case 7380:
+case 7381:
+case 7382:
+case 7383:
+case 7384:
+case 7385:
+case 7386:
+case 7387:
+case 7388:
+case 7389:
+case 7390:
+case 7391:
+case 7392:
+case 7393:
+case 7394:
+case 7395:
+case 7396:
+case 7397:
+case 7398:
+case 7399:
+case 7400:
+case 7401:
+case 7402:
+case 7403:
+case 7404:
+case 7405:
+case 7406:
+case 7407:
+case 7408:
+case 7409:
+case 7410:
+case 7411:
+case 7412:
+case 7413:
+case 7414:
+case 7415:
+case 7416:
+case 7417:
+case 7418:
+case 7419:
+case 7420:
+case 7421:
+case 7422:
+case 7423:
+case 7424:
+case 7425:
+case 7426:
+case 7427:
+case 7428:
+case 7429:
+case 7430:
+case 7431:
+case 7432:
+case 7433:
+case 7434:
+case 7435:
+case 7436:
+case 7437:
+case 7438:
+case 7439:
+case 7440:
+case 7441:
+case 7442:
+case 7443:
+case 7444:
+case 7445:
+case 7446:
+case 7447:
+case 7448:
+case 7449:
+case 7450:
+case 7451:
+case 7452:
+case 7453:
+case 7454:
+case 7455:
+case 7456:
+case 7457:
+case 7458:
+case 7459:
+case 7460:
+case 7461:
+case 7462:
+case 7463:
+case 7464:
+case 7465:
+case 7466:
+case 7467:
+case 7468:
+case 7469:
+case 7470:
+case 7471:
+case 7472:
+case 7473:
+case 7474:
+case 7475:
+case 7476:
+case 7477:
+case 7478:
+case 7479:
+case 7480:
+case 7481:
+case 7482:
+case 7483:
+case 7484:
+case 7485:
+case 7486:
+case 7487:
+case 7488:
+case 7489:
+case 7490:
+case 7491:
+case 7492:
+case 7493:
+case 7494:
+case 7495:
+case 7496:
+case 7497:
+case 7498:
+case 7499:
+case 7500:
+case 7501:
+case 7502:
+case 7503:
+case 7504:
+case 7505:
+case 7506:
+case 7507:
+case 7508:
+case 7509:
+case 7510:
+case 7511:
+case 7512:
+case 7513:
+case 7514:
+case 7515:
+case 7516:
+case 7517:
+case 7518:
+case 7519:
+case 7520:
+case 7521:
+case 7522:
+case 7523:
+case 7524:
+case 7525:
+case 7526:
+case 7527:
+case 7528:
+case 7529:
+case 7530:
+case 7531:
+case 7532:
+case 7533:
+case 7534:
+case 7535:
+case 7536:
+case 7537:
+case 7538:
+case 7539:
+case 7540:
+case 7541:
+case 7542:
+case 7543:
+case 7544:
+case 7545:
+case 7546:
+case 7547:
+case 7548:
+case 7549:
+case 7550:
+case 7551:
+case 7552:
+case 7553:
+case 7554:
+case 7555:
+case 7556:
+case 7557:
+case 7558:
+case 7559:
+case 7560:
+case 7561:
+case 7562:
+case 7563:
+case 7564:
+case 7565:
+case 7566:
+case 7567:
+case 7568:
+case 7569:
+case 7570:
+case 7571:
+case 7572:
+case 7573:
+case 7574:
+case 7575:
+case 7576:
+case 7577:
+case 7578:
+case 7579:
+case 7580:
+case 7581:
+case 7582:
+case 7583:
+case 7584:
+case 7585:
+case 7586:
+case 7587:
+case 7588:
+case 7589:
+case 7590:
+case 7591:
+case 7592:
+case 7593:
+case 7594:
+case 7595:
+case 7596:
+case 7597:
+case 7598:
+case 7599:
+case 7600:
+case 7601:
+case 7602:
+case 7603:
+case 7604:
+case 7605:
+case 7606:
+case 7607:
+case 7608:
+case 7609:
+case 7610:
+case 7611:
+case 7612:
+case 7613:
+case 7614:
+case 7615:
+case 7616:
+case 7617:
+case 7618:
+case 7619:
+case 7620:
+case 7621:
+case 7622:
+case 7623:
+case 7624:
+case 7625:
+case 7626:
+case 7627:
+case 7628:
+case 7629:
+case 7630:
+case 7631:
+case 7632:
+case 7633:
+case 7634:
+case 7635:
+case 7636:
+case 7637:
+case 7638:
+case 7639:
+case 7640:
+case 7641:
+case 7642:
+case 7643:
+case 7644:
+case 7645:
+case 7646:
+case 7647:
+case 7648:
+case 7649:
+case 7650:
+case 7651:
+case 7652:
+case 7653:
+case 7654:
+case 7655:
+case 7656:
+case 7657:
+case 7658:
+case 7659:
+case 7660:
+case 7661:
+case 7662:
+case 7663:
+case 7664:
+case 7665:
+case 7666:
+case 7667:
+case 7668:
+case 7669:
+case 7670:
+case 7671:
+case 7672:
+case 7673:
+case 7674:
+case 7675:
+case 7676:
+case 7677:
+case 7678:
+case 7679:
+case 7680:
+case 7681:
+case 7682:
+case 7683:
+case 7684:
+case 7685:
+case 7686:
+case 7687:
+case 7688:
+case 7689:
+case 7690:
+case 7691:
+case 7692:
+case 7693:
+case 7694:
+case 7695:
+case 7696:
+case 7697:
+case 7698:
+case 7699:
+case 7700:
+case 7701:
+case 7702:
+case 7703:
+case 7704:
+case 7705:
+case 7706:
+case 7707:
+case 7708:
+case 7709:
+case 7710:
+case 7711:
+case 7712:
+case 7713:
+case 7714:
+case 7715:
+case 7716:
+case 7717:
+case 7718:
+case 7719:
+case 7720:
+case 7721:
+case 7722:
+case 7723:
+case 7724:
+case 7725:
+case 7726:
+case 7727:
+case 7728:
+case 7729:
+case 7730:
+case 7731:
+case 7732:
+case 7733:
+case 7734:
+case 7735:
+case 7736:
+case 7737:
+case 7738:
+case 7739:
+case 7740:
+case 7741:
+case 7742:
+case 7743:
+case 7744:
+case 7745:
+case 7746:
+case 7747:
+case 7748:
+case 7749:
+case 7750:
+case 7751:
+case 7752:
+case 7753:
+case 7754:
+case 7755:
+case 7756:
+case 7757:
+case 7758:
+case 7759:
+case 7760:
+case 7761:
+case 7762:
+case 7763:
+case 7764:
+case 7765:
+case 7766:
+case 7767:
+case 7768:
+case 7769:
+case 7770:
+case 7771:
+case 7772:
+case 7773:
+case 7774:
+case 7775:
+case 7776:
+case 7777:
+case 7778:
+case 7779:
+case 7780:
+case 7781:
+case 7782:
+case 7783:
+case 7784:
+case 7785:
+case 7786:
+case 7787:
+case 7788:
+case 7789:
+case 7790:
+case 7791:
+case 7792:
+case 7793:
+case 7794:
+case 7795:
+case 7796:
+case 7797:
+case 7798:
+case 7799:
+case 7800:
+case 7801:
+case 7802:
+case 7803:
+case 7804:
+case 7805:
+case 7806:
+case 7807:
+case 7808:
+case 7809:
+case 7810:
+case 7811:
+case 7812:
+case 7813:
+case 7814:
+case 7815:
+case 7816:
+case 7817:
+case 7818:
+case 7819:
+case 7820:
+case 7821:
+case 7822:
+case 7823:
+case 7824:
+case 7825:
+case 7826:
+case 7827:
+case 7828:
+case 7829:
+case 7830:
+case 7831:
+case 7832:
+case 7833:
+case 7834:
+case 7835:
+case 7836:
+case 7837:
+case 7838:
+case 7839:
+case 7840:
+case 7841:
+case 7842:
+case 7843:
+case 7844:
+case 7845:
+case 7846:
+case 7847:
+case 7848:
+case 7849:
+case 7850:
+case 7851:
+case 7852:
+case 7853:
+case 7854:
+case 7855:
+case 7856:
+case 7857:
+case 7858:
+case 7859:
+case 7860:
+case 7861:
+case 7862:
+case 7863:
+case 7864:
+case 7865:
+case 7866:
+case 7867:
+case 7868:
+case 7869:
+case 7870:
+case 7871:
+case 7872:
+case 7873:
+case 7874:
+case 7875:
+case 7876:
+case 7877:
+case 7878:
+case 7879:
+case 7880:
+case 7881:
+case 7882:
+case 7883:
+case 7884:
+case 7885:
+case 7886:
+case 7887:
+case 7888:
+case 7889:
+case 7890:
+case 7891:
+case 7892:
+case 7893:
+case 7894:
+case 7895:
+case 7896:
+case 7897:
+case 7898:
+case 7899:
+case 7900:
+case 7901:
+case 7902:
+case 7903:
+case 7904:
+case 7905:
+case 7906:
+case 7907:
+case 7908:
+case 7909:
+case 7910:
+case 7911:
+case 7912:
+case 7913:
+case 7914:
+case 7915:
+case 7916:
+case 7917:
+case 7918:
+case 7919:
+case 7920:
+case 7921:
+case 7922:
+case 7923:
+case 7924:
+case 7925:
+case 7926:
+case 7927:
+case 7928:
+case 7929:
+case 7930:
+case 7931:
+case 7932:
+case 7933:
+case 7934:
+case 7935:
+case 7936:
+case 7937:
+case 7938:
+case 7939:
+case 7940:
+case 7941:
+case 7942:
+case 7943:
+case 7944:
+case 7945:
+case 7946:
+case 7947:
+case 7948:
+case 7949:
+case 7950:
+case 7951:
+case 7952:
+case 7953:
+case 7954:
+case 7955:
+case 7956:
+case 7957:
+case 7958:
+case 7959:
+case 7960:
+case 7961:
+case 7962:
+case 7963:
+case 7964:
+case 7965:
+case 7966:
+case 7967:
+case 7968:
+case 7969:
+case 7970:
+case 7971:
+case 7972:
+case 7973:
+case 7974:
+case 7975:
+case 7976:
+case 7977:
+case 7978:
+case 7979:
+case 7980:
+case 7981:
+case 7982:
+case 7983:
+case 7984:
+case 7985:
+case 7986:
+case 7987:
+case 7988:
+case 7989:
+case 7990:
+case 7991:
+case 7992:
+case 7993:
+case 7994:
+case 7995:
+case 7996:
+case 7997:
+case 7998:
+case 7999:
+case 8000:
+case 8001:
+case 8002:
+case 8003:
+case 8004:
+case 8005:
+case 8006:
+case 8007:
+case 8008:
+case 8009:
+case 8010:
+case 8011:
+case 8012:
+case 8013:
+case 8014:
+case 8015:
+case 8016:
+case 8017:
+case 8018:
+case 8019:
+case 8020:
+case 8021:
+case 8022:
+case 8023:
+case 8024:
+case 8025:
+case 8026:
+case 8027:
+case 8028:
+case 8029:
+case 8030:
+case 8031:
+case 8032:
+case 8033:
+case 8034:
+case 8035:
+case 8036:
+case 8037:
+case 8038:
+case 8039:
+case 8040:
+case 8041:
+case 8042:
+case 8043:
+case 8044:
+case 8045:
+case 8046:
+case 8047:
+case 8048:
+case 8049:
+case 8050:
+case 8051:
+case 8052:
+case 8053:
+case 8054:
+case 8055:
+case 8056:
+case 8057:
+case 8058:
+case 8059:
+case 8060:
+case 8061:
+case 8062:
+case 8063:
+case 8064:
+case 8065:
+case 8066:
+case 8067:
+case 8068:
+case 8069:
+case 8070:
+case 8071:
+case 8072:
+case 8073:
+case 8074:
+case 8075:
+case 8076:
+case 8077:
+case 8078:
+case 8079:
+case 8080:
+case 8081:
+case 8082:
+case 8083:
+case 8084:
+case 8085:
+case 8086:
+case 8087:
+case 8088:
+case 8089:
+case 8090:
+case 8091:
+case 8092:
+case 8093:
+case 8094:
+case 8095:
+case 8096:
+case 8097:
+case 8098:
+case 8099:
+case 8100:
+case 8101:
+case 8102:
+case 8103:
+case 8104:
+case 8105:
+case 8106:
+case 8107:
+case 8108:
+case 8109:
+case 8110:
+case 8111:
+case 8112:
+case 8113:
+case 8114:
+case 8115:
+case 8116:
+case 8117:
+case 8118:
+case 8119:
+case 8120:
+case 8121:
+case 8122:
+case 8123:
+case 8124:
+case 8125:
+case 8126:
+case 8127:
+case 8128:
+case 8129:
+case 8130:
+case 8131:
+case 8132:
+case 8133:
+case 8134:
+case 8135:
+case 8136:
+case 8137:
+case 8138:
+case 8139:
+case 8140:
+case 8141:
+case 8142:
+case 8143:
+case 8144:
+case 8145:
+case 8146:
+case 8147:
+case 8148:
+case 8149:
+case 8150:
+case 8151:
+case 8152:
+case 8153:
+case 8154:
+case 8155:
+case 8156:
+case 8157:
+case 8158:
+case 8159:
+case 8160:
+case 8161:
+case 8162:
+case 8163:
+case 8164:
+case 8165:
+case 8166:
+case 8167:
+case 8168:
+case 8169:
+case 8170:
+case 8171:
+case 8172:
+case 8173:
+case 8174:
+case 8175:
+case 8176:
+case 8177:
+case 8178:
+case 8179:
+case 8180:
+case 8181:
+case 8182:
+case 8183:
+case 8184:
+case 8185:
+case 8186:
+case 8187:
+case 8188:
+case 8189:
+case 8190:
+case 8191:
+case 8192:
+case 8193:
+case 8194:
+case 8195:
+case 8196:
+case 8197:
+case 8198:
+case 8199:
+case 8200:
+case 8201:
+case 8202:
+case 8203:
+case 8204:
+case 8205:
+case 8206:
+case 8207:
+case 8208:
+case 8209:
+case 8210:
+case 8211:
+case 8212:
+case 8213:
+case 8214:
+case 8215:
+case 8216:
+case 8217:
+case 8218:
+case 8219:
+case 8220:
+case 8221:
+case 8222:
+case 8223:
+case 8224:
+case 8225:
+case 8226:
+case 8227:
+case 8228:
+case 8229:
+case 8230:
+case 8231:
+case 8232:
+case 8233:
+case 8234:
+case 8235:
+case 8236:
+case 8237:
+case 8238:
+case 8239:
+case 8240:
+case 8241:
+case 8242:
+case 8243:
+case 8244:
+case 8245:
+case 8246:
+case 8247:
+case 8248:
+case 8249:
+case 8250:
+case 8251:
+case 8252:
+case 8253:
+case 8254:
+case 8255:
+case 8256:
+case 8257:
+case 8258:
+case 8259:
+case 8260:
+case 8261:
+case 8262:
+case 8263:
+case 8264:
+case 8265:
+case 8266:
+case 8267:
+case 8268:
+case 8269:
+case 8270:
+case 8271:
+case 8272:
+case 8273:
+case 8274:
+case 8275:
+case 8276:
+case 8277:
+case 8278:
+case 8279:
+case 8280:
+case 8281:
+case 8282:
+case 8283:
+case 8284:
+case 8285:
+case 8286:
+case 8287:
+case 8288:
+case 8289:
+case 8290:
+case 8291:
+case 8292:
+case 8293:
+case 8294:
+case 8295:
+case 8296:
+case 8297:
+case 8298:
+case 8299:
+case 8300:
+case 8301:
+case 8302:
+case 8303:
+case 8304:
+case 8305:
+case 8306:
+case 8307:
+case 8308:
+case 8309:
+case 8310:
+case 8311:
+case 8312:
+case 8313:
+case 8314:
+case 8315:
+case 8316:
+case 8317:
+case 8318:
+case 8319:
+case 8320:
+case 8321:
+case 8322:
+case 8323:
+case 8324:
+case 8325:
+case 8326:
+case 8327:
+case 8328:
+case 8329:
+case 8330:
+case 8331:
+case 8332:
+case 8333:
+case 8334:
+case 8335:
+case 8336:
+case 8337:
+case 8338:
+case 8339:
+case 8340:
+case 8341:
+case 8342:
+case 8343:
+case 8344:
+case 8345:
+case 8346:
+case 8347:
+case 8348:
+case 8349:
+case 8350:
+case 8351:
+case 8352:
+case 8353:
+case 8354:
+case 8355:
+case 8356:
+case 8357:
+case 8358:
+case 8359:
+case 8360:
+case 8361:
+case 8362:
+case 8363:
+case 8364:
+case 8365:
+case 8366:
+case 8367:
+case 8368:
+case 8369:
+case 8370:
+case 8371:
+case 8372:
+case 8373:
+case 8374:
+case 8375:
+case 8376:
+case 8377:
+case 8378:
+case 8379:
+case 8380:
+case 8381:
+case 8382:
+case 8383:
+case 8384:
+case 8385:
+case 8386:
+case 8387:
+case 8388:
+case 8389:
+case 8390:
+case 8391:
+case 8392:
+case 8393:
+case 8394:
+case 8395:
+case 8396:
+case 8397:
+case 8398:
+case 8399:
+case 8400:
+case 8401:
+case 8402:
+case 8403:
+case 8404:
+case 8405:
+case 8406:
+case 8407:
+case 8408:
+case 8409:
+case 8410:
+case 8411:
+case 8412:
+case 8413:
+case 8414:
+case 8415:
+case 8416:
+case 8417:
+case 8418:
+case 8419:
+case 8420:
+case 8421:
+case 8422:
+case 8423:
+case 8424:
+case 8425:
+case 8426:
+case 8427:
+case 8428:
+case 8429:
+case 8430:
+case 8431:
+case 8432:
+case 8433:
+case 8434:
+case 8435:
+case 8436:
+case 8437:
+case 8438:
+case 8439:
+case 8440:
+case 8441:
+case 8442:
+case 8443:
+case 8444:
+case 8445:
+case 8446:
+case 8447:
+case 8448:
+case 8449:
+case 8450:
+case 8451:
+case 8452:
+case 8453:
+case 8454:
+case 8455:
+case 8456:
+case 8457:
+case 8458:
+case 8459:
+case 8460:
+case 8461:
+case 8462:
+case 8463:
+case 8464:
+case 8465:
+case 8466:
+case 8467:
+case 8468:
+case 8469:
+case 8470:
+case 8471:
+case 8472:
+case 8473:
+case 8474:
+case 8475:
+case 8476:
+case 8477:
+case 8478:
+case 8479:
+case 8480:
+case 8481:
+case 8482:
+case 8483:
+case 8484:
+case 8485:
+case 8486:
+case 8487:
+case 8488:
+case 8489:
+case 8490:
+case 8491:
+case 8492:
+case 8493:
+case 8494:
+case 8495:
+case 8496:
+case 8497:
+case 8498:
+case 8499:
+case 8500:
+case 8501:
+case 8502:
+case 8503:
+case 8504:
+case 8505:
+case 8506:
+case 8507:
+case 8508:
+case 8509:
+case 8510:
+case 8511:
+case 8512:
+case 8513:
+case 8514:
+case 8515:
+case 8516:
+case 8517:
+case 8518:
+case 8519:
+case 8520:
+case 8521:
+case 8522:
+case 8523:
+case 8524:
+case 8525:
+case 8526:
+case 8527:
+case 8528:
+case 8529:
+case 8530:
+case 8531:
+case 8532:
+case 8533:
+case 8534:
+case 8535:
+case 8536:
+case 8537:
+case 8538:
+case 8539:
+case 8540:
+case 8541:
+case 8542:
+case 8543:
+case 8544:
+case 8545:
+case 8546:
+case 8547:
+case 8548:
+case 8549:
+case 8550:
+case 8551:
+case 8552:
+case 8553:
+case 8554:
+case 8555:
+case 8556:
+case 8557:
+case 8558:
+case 8559:
+case 8560:
+case 8561:
+case 8562:
+case 8563:
+case 8564:
+case 8565:
+case 8566:
+case 8567:
+case 8568:
+case 8569:
+case 8570:
+case 8571:
+case 8572:
+case 8573:
+case 8574:
+case 8575:
+case 8576:
+case 8577:
+case 8578:
+case 8579:
+case 8580:
+case 8581:
+case 8582:
+case 8583:
+case 8584:
+case 8585:
+case 8586:
+case 8587:
+case 8588:
+case 8589:
+case 8590:
+case 8591:
+case 8592:
+case 8593:
+case 8594:
+case 8595:
+case 8596:
+case 8597:
+case 8598:
+case 8599:
+case 8600:
+case 8601:
+case 8602:
+case 8603:
+case 8604:
+case 8605:
+case 8606:
+case 8607:
+case 8608:
+case 8609:
+case 8610:
+case 8611:
+case 8612:
+case 8613:
+case 8614:
+case 8615:
+case 8616:
+case 8617:
+case 8618:
+case 8619:
+case 8620:
+case 8621:
+case 8622:
+case 8623:
+case 8624:
+case 8625:
+case 8626:
+case 8627:
+case 8628:
+case 8629:
+case 8630:
+case 8631:
+case 8632:
+case 8633:
+case 8634:
+case 8635:
+case 8636:
+case 8637:
+case 8638:
+case 8639:
+case 8640:
+case 8641:
+case 8642:
+case 8643:
+case 8644:
+case 8645:
+case 8646:
+case 8647:
+case 8648:
+case 8649:
+case 8650:
+case 8651:
+case 8652:
+case 8653:
+case 8654:
+case 8655:
+case 8656:
+case 8657:
+case 8658:
+case 8659:
+case 8660:
+case 8661:
+case 8662:
+case 8663:
+case 8664:
+case 8665:
+case 8666:
+case 8667:
+case 8668:
+case 8669:
+case 8670:
+case 8671:
+case 8672:
+case 8673:
+case 8674:
+case 8675:
+case 8676:
+case 8677:
+case 8678:
+case 8679:
+case 8680:
+case 8681:
+case 8682:
+case 8683:
+case 8684:
+case 8685:
+case 8686:
+case 8687:
+case 8688:
+case 8689:
+case 8690:
+case 8691:
+case 8692:
+case 8693:
+case 8694:
+case 8695:
+case 8696:
+case 8697:
+case 8698:
+case 8699:
+case 8700:
+case 8701:
+case 8702:
+case 8703:
+case 8704:
+case 8705:
+case 8706:
+case 8707:
+case 8708:
+case 8709:
+case 8710:
+case 8711:
+case 8712:
+case 8713:
+case 8714:
+case 8715:
+case 8716:
+case 8717:
+case 8718:
+case 8719:
+case 8720:
+case 8721:
+case 8722:
+case 8723:
+case 8724:
+case 8725:
+case 8726:
+case 8727:
+case 8728:
+case 8729:
+case 8730:
+case 8731:
+case 8732:
+case 8733:
+case 8734:
+case 8735:
+case 8736:
+case 8737:
+case 8738:
+case 8739:
+case 8740:
+case 8741:
+case 8742:
+case 8743:
+case 8744:
+case 8745:
+case 8746:
+case 8747:
+case 8748:
+case 8749:
+case 8750:
+case 8751:
+case 8752:
+case 8753:
+case 8754:
+case 8755:
+case 8756:
+case 8757:
+case 8758:
+case 8759:
+case 8760:
+case 8761:
+case 8762:
+case 8763:
+case 8764:
+case 8765:
+case 8766:
+case 8767:
+case 8768:
+case 8769:
+case 8770:
+case 8771:
+case 8772:
+case 8773:
+case 8774:
+case 8775:
+case 8776:
+case 8777:
+case 8778:
+case 8779:
+case 8780:
+case 8781:
+case 8782:
+case 8783:
+case 8784:
+case 8785:
+case 8786:
+case 8787:
+case 8788:
+case 8789:
+case 8790:
+case 8791:
+case 8792:
+case 8793:
+case 8794:
+case 8795:
+case 8796:
+case 8797:
+case 8798:
+case 8799:
+case 8800:
+case 8801:
+case 8802:
+case 8803:
+case 8804:
+case 8805:
+case 8806:
+case 8807:
+case 8808:
+case 8809:
+case 8810:
+case 8811:
+case 8812:
+case 8813:
+case 8814:
+case 8815:
+case 8816:
+case 8817:
+case 8818:
+case 8819:
+case 8820:
+case 8821:
+case 8822:
+case 8823:
+case 8824:
+case 8825:
+case 8826:
+case 8827:
+case 8828:
+case 8829:
+case 8830:
+case 8831:
+case 8832:
+case 8833:
+case 8834:
+case 8835:
+case 8836:
+case 8837:
+case 8838:
+case 8839:
+case 8840:
+case 8841:
+case 8842:
+case 8843:
+case 8844:
+case 8845:
+case 8846:
+case 8847:
+case 8848:
+case 8849:
+case 8850:
+case 8851:
+case 8852:
+case 8853:
+case 8854:
+case 8855:
+case 8856:
+case 8857:
+case 8858:
+case 8859:
+case 8860:
+case 8861:
+case 8862:
+case 8863:
+case 8864:
+case 8865:
+case 8866:
+case 8867:
+case 8868:
+case 8869:
+case 8870:
+case 8871:
+case 8872:
+case 8873:
+case 8874:
+case 8875:
+case 8876:
+case 8877:
+case 8878:
+case 8879:
+case 8880:
+case 8881:
+case 8882:
+case 8883:
+case 8884:
+case 8885:
+case 8886:
+case 8887:
+case 8888:
+case 8889:
+case 8890:
+case 8891:
+case 8892:
+case 8893:
+case 8894:
+case 8895:
+case 8896:
+case 8897:
+case 8898:
+case 8899:
+case 8900:
+case 8901:
+case 8902:
+case 8903:
+case 8904:
+case 8905:
+case 8906:
+case 8907:
+case 8908:
+case 8909:
+case 8910:
+case 8911:
+case 8912:
+case 8913:
+case 8914:
+case 8915:
+case 8916:
+case 8917:
+case 8918:
+case 8919:
+case 8920:
+case 8921:
+case 8922:
+case 8923:
+case 8924:
+case 8925:
+case 8926:
+case 8927:
+case 8928:
+case 8929:
+case 8930:
+case 8931:
+case 8932:
+case 8933:
+case 8934:
+case 8935:
+case 8936:
+case 8937:
+case 8938:
+case 8939:
+case 8940:
+case 8941:
+case 8942:
+case 8943:
+case 8944:
+case 8945:
+case 8946:
+case 8947:
+case 8948:
+case 8949:
+case 8950:
+case 8951:
+case 8952:
+case 8953:
+case 8954:
+case 8955:
+case 8956:
+case 8957:
+case 8958:
+case 8959:
+case 8960:
+case 8961:
+case 8962:
+case 8963:
+case 8964:
+case 8965:
+case 8966:
+case 8967:
+case 8968:
+case 8969:
+case 8970:
+case 8971:
+case 8972:
+case 8973:
+case 8974:
+case 8975:
+case 8976:
+case 8977:
+case 8978:
+case 8979:
+case 8980:
+case 8981:
+case 8982:
+case 8983:
+case 8984:
+case 8985:
+case 8986:
+case 8987:
+case 8988:
+case 8989:
+case 8990:
+case 8991:
+case 8992:
+case 8993:
+case 8994:
+case 8995:
+case 8996:
+case 8997:
+case 8998:
+case 8999:
+ actual += 'a';
+}
+expect = 'a';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-003.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-003.js
new file mode 100644
index 0000000000..0bbe062ca9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-74474-003.js
@@ -0,0 +1,9099 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * brendan@mozilla.org, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 09 May 2001
+ *
+ * SUMMARY: Regression test for Bugzilla bug 74474
+ * "switch() misbehaves with duplicated labels"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=74474
+ * See ECMA3 Section 12.11, "The switch Statement"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-74474-003.js';
+var UBound = 0;
+var BUGNUMBER = 74474;
+var summary = 'Test of switch statement that overflows the stack-allocated bitmap';
+var status = '(One duplicated label [8998])';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+var x = 3;
+
+
+switch (x)
+{
+case 0:
+case 1:
+case 2:
+case 3:
+case 4:
+case 5:
+case 6:
+case 7:
+case 8:
+case 9:
+case 10:
+case 11:
+case 12:
+case 13:
+case 14:
+case 15:
+case 16:
+case 17:
+case 18:
+case 19:
+case 20:
+case 21:
+case 22:
+case 23:
+case 24:
+case 25:
+case 26:
+case 27:
+case 28:
+case 29:
+case 30:
+case 31:
+case 32:
+case 33:
+case 34:
+case 35:
+case 36:
+case 37:
+case 38:
+case 39:
+case 40:
+case 41:
+case 42:
+case 43:
+case 44:
+case 45:
+case 46:
+case 47:
+case 48:
+case 49:
+case 50:
+case 51:
+case 52:
+case 53:
+case 54:
+case 55:
+case 56:
+case 57:
+case 58:
+case 59:
+case 60:
+case 61:
+case 62:
+case 63:
+case 64:
+case 65:
+case 66:
+case 67:
+case 68:
+case 69:
+case 70:
+case 71:
+case 72:
+case 73:
+case 74:
+case 75:
+case 76:
+case 77:
+case 78:
+case 79:
+case 80:
+case 81:
+case 82:
+case 83:
+case 84:
+case 85:
+case 86:
+case 87:
+case 88:
+case 89:
+case 90:
+case 91:
+case 92:
+case 93:
+case 94:
+case 95:
+case 96:
+case 97:
+case 98:
+case 99:
+case 100:
+case 101:
+case 102:
+case 103:
+case 104:
+case 105:
+case 106:
+case 107:
+case 108:
+case 109:
+case 110:
+case 111:
+case 112:
+case 113:
+case 114:
+case 115:
+case 116:
+case 117:
+case 118:
+case 119:
+case 120:
+case 121:
+case 122:
+case 123:
+case 124:
+case 125:
+case 126:
+case 127:
+case 128:
+case 129:
+case 130:
+case 131:
+case 132:
+case 133:
+case 134:
+case 135:
+case 136:
+case 137:
+case 138:
+case 139:
+case 140:
+case 141:
+case 142:
+case 143:
+case 144:
+case 145:
+case 146:
+case 147:
+case 148:
+case 149:
+case 150:
+case 151:
+case 152:
+case 153:
+case 154:
+case 155:
+case 156:
+case 157:
+case 158:
+case 159:
+case 160:
+case 161:
+case 162:
+case 163:
+case 164:
+case 165:
+case 166:
+case 167:
+case 168:
+case 169:
+case 170:
+case 171:
+case 172:
+case 173:
+case 174:
+case 175:
+case 176:
+case 177:
+case 178:
+case 179:
+case 180:
+case 181:
+case 182:
+case 183:
+case 184:
+case 185:
+case 186:
+case 187:
+case 188:
+case 189:
+case 190:
+case 191:
+case 192:
+case 193:
+case 194:
+case 195:
+case 196:
+case 197:
+case 198:
+case 199:
+case 200:
+case 201:
+case 202:
+case 203:
+case 204:
+case 205:
+case 206:
+case 207:
+case 208:
+case 209:
+case 210:
+case 211:
+case 212:
+case 213:
+case 214:
+case 215:
+case 216:
+case 217:
+case 218:
+case 219:
+case 220:
+case 221:
+case 222:
+case 223:
+case 224:
+case 225:
+case 226:
+case 227:
+case 228:
+case 229:
+case 230:
+case 231:
+case 232:
+case 233:
+case 234:
+case 235:
+case 236:
+case 237:
+case 238:
+case 239:
+case 240:
+case 241:
+case 242:
+case 243:
+case 244:
+case 245:
+case 246:
+case 247:
+case 248:
+case 249:
+case 250:
+case 251:
+case 252:
+case 253:
+case 254:
+case 255:
+case 256:
+case 257:
+case 258:
+case 259:
+case 260:
+case 261:
+case 262:
+case 263:
+case 264:
+case 265:
+case 266:
+case 267:
+case 268:
+case 269:
+case 270:
+case 271:
+case 272:
+case 273:
+case 274:
+case 275:
+case 276:
+case 277:
+case 278:
+case 279:
+case 280:
+case 281:
+case 282:
+case 283:
+case 284:
+case 285:
+case 286:
+case 287:
+case 288:
+case 289:
+case 290:
+case 291:
+case 292:
+case 293:
+case 294:
+case 295:
+case 296:
+case 297:
+case 298:
+case 299:
+case 300:
+case 301:
+case 302:
+case 303:
+case 304:
+case 305:
+case 306:
+case 307:
+case 308:
+case 309:
+case 310:
+case 311:
+case 312:
+case 313:
+case 314:
+case 315:
+case 316:
+case 317:
+case 318:
+case 319:
+case 320:
+case 321:
+case 322:
+case 323:
+case 324:
+case 325:
+case 326:
+case 327:
+case 328:
+case 329:
+case 330:
+case 331:
+case 332:
+case 333:
+case 334:
+case 335:
+case 336:
+case 337:
+case 338:
+case 339:
+case 340:
+case 341:
+case 342:
+case 343:
+case 344:
+case 345:
+case 346:
+case 347:
+case 348:
+case 349:
+case 350:
+case 351:
+case 352:
+case 353:
+case 354:
+case 355:
+case 356:
+case 357:
+case 358:
+case 359:
+case 360:
+case 361:
+case 362:
+case 363:
+case 364:
+case 365:
+case 366:
+case 367:
+case 368:
+case 369:
+case 370:
+case 371:
+case 372:
+case 373:
+case 374:
+case 375:
+case 376:
+case 377:
+case 378:
+case 379:
+case 380:
+case 381:
+case 382:
+case 383:
+case 384:
+case 385:
+case 386:
+case 387:
+case 388:
+case 389:
+case 390:
+case 391:
+case 392:
+case 393:
+case 394:
+case 395:
+case 396:
+case 397:
+case 398:
+case 399:
+case 400:
+case 401:
+case 402:
+case 403:
+case 404:
+case 405:
+case 406:
+case 407:
+case 408:
+case 409:
+case 410:
+case 411:
+case 412:
+case 413:
+case 414:
+case 415:
+case 416:
+case 417:
+case 418:
+case 419:
+case 420:
+case 421:
+case 422:
+case 423:
+case 424:
+case 425:
+case 426:
+case 427:
+case 428:
+case 429:
+case 430:
+case 431:
+case 432:
+case 433:
+case 434:
+case 435:
+case 436:
+case 437:
+case 438:
+case 439:
+case 440:
+case 441:
+case 442:
+case 443:
+case 444:
+case 445:
+case 446:
+case 447:
+case 448:
+case 449:
+case 450:
+case 451:
+case 452:
+case 453:
+case 454:
+case 455:
+case 456:
+case 457:
+case 458:
+case 459:
+case 460:
+case 461:
+case 462:
+case 463:
+case 464:
+case 465:
+case 466:
+case 467:
+case 468:
+case 469:
+case 470:
+case 471:
+case 472:
+case 473:
+case 474:
+case 475:
+case 476:
+case 477:
+case 478:
+case 479:
+case 480:
+case 481:
+case 482:
+case 483:
+case 484:
+case 485:
+case 486:
+case 487:
+case 488:
+case 489:
+case 490:
+case 491:
+case 492:
+case 493:
+case 494:
+case 495:
+case 496:
+case 497:
+case 498:
+case 499:
+case 500:
+case 501:
+case 502:
+case 503:
+case 504:
+case 505:
+case 506:
+case 507:
+case 508:
+case 509:
+case 510:
+case 511:
+case 512:
+case 513:
+case 514:
+case 515:
+case 516:
+case 517:
+case 518:
+case 519:
+case 520:
+case 521:
+case 522:
+case 523:
+case 524:
+case 525:
+case 526:
+case 527:
+case 528:
+case 529:
+case 530:
+case 531:
+case 532:
+case 533:
+case 534:
+case 535:
+case 536:
+case 537:
+case 538:
+case 539:
+case 540:
+case 541:
+case 542:
+case 543:
+case 544:
+case 545:
+case 546:
+case 547:
+case 548:
+case 549:
+case 550:
+case 551:
+case 552:
+case 553:
+case 554:
+case 555:
+case 556:
+case 557:
+case 558:
+case 559:
+case 560:
+case 561:
+case 562:
+case 563:
+case 564:
+case 565:
+case 566:
+case 567:
+case 568:
+case 569:
+case 570:
+case 571:
+case 572:
+case 573:
+case 574:
+case 575:
+case 576:
+case 577:
+case 578:
+case 579:
+case 580:
+case 581:
+case 582:
+case 583:
+case 584:
+case 585:
+case 586:
+case 587:
+case 588:
+case 589:
+case 590:
+case 591:
+case 592:
+case 593:
+case 594:
+case 595:
+case 596:
+case 597:
+case 598:
+case 599:
+case 600:
+case 601:
+case 602:
+case 603:
+case 604:
+case 605:
+case 606:
+case 607:
+case 608:
+case 609:
+case 610:
+case 611:
+case 612:
+case 613:
+case 614:
+case 615:
+case 616:
+case 617:
+case 618:
+case 619:
+case 620:
+case 621:
+case 622:
+case 623:
+case 624:
+case 625:
+case 626:
+case 627:
+case 628:
+case 629:
+case 630:
+case 631:
+case 632:
+case 633:
+case 634:
+case 635:
+case 636:
+case 637:
+case 638:
+case 639:
+case 640:
+case 641:
+case 642:
+case 643:
+case 644:
+case 645:
+case 646:
+case 647:
+case 648:
+case 649:
+case 650:
+case 651:
+case 652:
+case 653:
+case 654:
+case 655:
+case 656:
+case 657:
+case 658:
+case 659:
+case 660:
+case 661:
+case 662:
+case 663:
+case 664:
+case 665:
+case 666:
+case 667:
+case 668:
+case 669:
+case 670:
+case 671:
+case 672:
+case 673:
+case 674:
+case 675:
+case 676:
+case 677:
+case 678:
+case 679:
+case 680:
+case 681:
+case 682:
+case 683:
+case 684:
+case 685:
+case 686:
+case 687:
+case 688:
+case 689:
+case 690:
+case 691:
+case 692:
+case 693:
+case 694:
+case 695:
+case 696:
+case 697:
+case 698:
+case 699:
+case 700:
+case 701:
+case 702:
+case 703:
+case 704:
+case 705:
+case 706:
+case 707:
+case 708:
+case 709:
+case 710:
+case 711:
+case 712:
+case 713:
+case 714:
+case 715:
+case 716:
+case 717:
+case 718:
+case 719:
+case 720:
+case 721:
+case 722:
+case 723:
+case 724:
+case 725:
+case 726:
+case 727:
+case 728:
+case 729:
+case 730:
+case 731:
+case 732:
+case 733:
+case 734:
+case 735:
+case 736:
+case 737:
+case 738:
+case 739:
+case 740:
+case 741:
+case 742:
+case 743:
+case 744:
+case 745:
+case 746:
+case 747:
+case 748:
+case 749:
+case 750:
+case 751:
+case 752:
+case 753:
+case 754:
+case 755:
+case 756:
+case 757:
+case 758:
+case 759:
+case 760:
+case 761:
+case 762:
+case 763:
+case 764:
+case 765:
+case 766:
+case 767:
+case 768:
+case 769:
+case 770:
+case 771:
+case 772:
+case 773:
+case 774:
+case 775:
+case 776:
+case 777:
+case 778:
+case 779:
+case 780:
+case 781:
+case 782:
+case 783:
+case 784:
+case 785:
+case 786:
+case 787:
+case 788:
+case 789:
+case 790:
+case 791:
+case 792:
+case 793:
+case 794:
+case 795:
+case 796:
+case 797:
+case 798:
+case 799:
+case 800:
+case 801:
+case 802:
+case 803:
+case 804:
+case 805:
+case 806:
+case 807:
+case 808:
+case 809:
+case 810:
+case 811:
+case 812:
+case 813:
+case 814:
+case 815:
+case 816:
+case 817:
+case 818:
+case 819:
+case 820:
+case 821:
+case 822:
+case 823:
+case 824:
+case 825:
+case 826:
+case 827:
+case 828:
+case 829:
+case 830:
+case 831:
+case 832:
+case 833:
+case 834:
+case 835:
+case 836:
+case 837:
+case 838:
+case 839:
+case 840:
+case 841:
+case 842:
+case 843:
+case 844:
+case 845:
+case 846:
+case 847:
+case 848:
+case 849:
+case 850:
+case 851:
+case 852:
+case 853:
+case 854:
+case 855:
+case 856:
+case 857:
+case 858:
+case 859:
+case 860:
+case 861:
+case 862:
+case 863:
+case 864:
+case 865:
+case 866:
+case 867:
+case 868:
+case 869:
+case 870:
+case 871:
+case 872:
+case 873:
+case 874:
+case 875:
+case 876:
+case 877:
+case 878:
+case 879:
+case 880:
+case 881:
+case 882:
+case 883:
+case 884:
+case 885:
+case 886:
+case 887:
+case 888:
+case 889:
+case 890:
+case 891:
+case 892:
+case 893:
+case 894:
+case 895:
+case 896:
+case 897:
+case 898:
+case 899:
+case 900:
+case 901:
+case 902:
+case 903:
+case 904:
+case 905:
+case 906:
+case 907:
+case 908:
+case 909:
+case 910:
+case 911:
+case 912:
+case 913:
+case 914:
+case 915:
+case 916:
+case 917:
+case 918:
+case 919:
+case 920:
+case 921:
+case 922:
+case 923:
+case 924:
+case 925:
+case 926:
+case 927:
+case 928:
+case 929:
+case 930:
+case 931:
+case 932:
+case 933:
+case 934:
+case 935:
+case 936:
+case 937:
+case 938:
+case 939:
+case 940:
+case 941:
+case 942:
+case 943:
+case 944:
+case 945:
+case 946:
+case 947:
+case 948:
+case 949:
+case 950:
+case 951:
+case 952:
+case 953:
+case 954:
+case 955:
+case 956:
+case 957:
+case 958:
+case 959:
+case 960:
+case 961:
+case 962:
+case 963:
+case 964:
+case 965:
+case 966:
+case 967:
+case 968:
+case 969:
+case 970:
+case 971:
+case 972:
+case 973:
+case 974:
+case 975:
+case 976:
+case 977:
+case 978:
+case 979:
+case 980:
+case 981:
+case 982:
+case 983:
+case 984:
+case 985:
+case 986:
+case 987:
+case 988:
+case 989:
+case 990:
+case 991:
+case 992:
+case 993:
+case 994:
+case 995:
+case 996:
+case 997:
+case 998:
+case 999:
+case 1000:
+case 1001:
+case 1002:
+case 1003:
+case 1004:
+case 1005:
+case 1006:
+case 1007:
+case 1008:
+case 1009:
+case 1010:
+case 1011:
+case 1012:
+case 1013:
+case 1014:
+case 1015:
+case 1016:
+case 1017:
+case 1018:
+case 1019:
+case 1020:
+case 1021:
+case 1022:
+case 1023:
+case 1024:
+case 1025:
+case 1026:
+case 1027:
+case 1028:
+case 1029:
+case 1030:
+case 1031:
+case 1032:
+case 1033:
+case 1034:
+case 1035:
+case 1036:
+case 1037:
+case 1038:
+case 1039:
+case 1040:
+case 1041:
+case 1042:
+case 1043:
+case 1044:
+case 1045:
+case 1046:
+case 1047:
+case 1048:
+case 1049:
+case 1050:
+case 1051:
+case 1052:
+case 1053:
+case 1054:
+case 1055:
+case 1056:
+case 1057:
+case 1058:
+case 1059:
+case 1060:
+case 1061:
+case 1062:
+case 1063:
+case 1064:
+case 1065:
+case 1066:
+case 1067:
+case 1068:
+case 1069:
+case 1070:
+case 1071:
+case 1072:
+case 1073:
+case 1074:
+case 1075:
+case 1076:
+case 1077:
+case 1078:
+case 1079:
+case 1080:
+case 1081:
+case 1082:
+case 1083:
+case 1084:
+case 1085:
+case 1086:
+case 1087:
+case 1088:
+case 1089:
+case 1090:
+case 1091:
+case 1092:
+case 1093:
+case 1094:
+case 1095:
+case 1096:
+case 1097:
+case 1098:
+case 1099:
+case 1100:
+case 1101:
+case 1102:
+case 1103:
+case 1104:
+case 1105:
+case 1106:
+case 1107:
+case 1108:
+case 1109:
+case 1110:
+case 1111:
+case 1112:
+case 1113:
+case 1114:
+case 1115:
+case 1116:
+case 1117:
+case 1118:
+case 1119:
+case 1120:
+case 1121:
+case 1122:
+case 1123:
+case 1124:
+case 1125:
+case 1126:
+case 1127:
+case 1128:
+case 1129:
+case 1130:
+case 1131:
+case 1132:
+case 1133:
+case 1134:
+case 1135:
+case 1136:
+case 1137:
+case 1138:
+case 1139:
+case 1140:
+case 1141:
+case 1142:
+case 1143:
+case 1144:
+case 1145:
+case 1146:
+case 1147:
+case 1148:
+case 1149:
+case 1150:
+case 1151:
+case 1152:
+case 1153:
+case 1154:
+case 1155:
+case 1156:
+case 1157:
+case 1158:
+case 1159:
+case 1160:
+case 1161:
+case 1162:
+case 1163:
+case 1164:
+case 1165:
+case 1166:
+case 1167:
+case 1168:
+case 1169:
+case 1170:
+case 1171:
+case 1172:
+case 1173:
+case 1174:
+case 1175:
+case 1176:
+case 1177:
+case 1178:
+case 1179:
+case 1180:
+case 1181:
+case 1182:
+case 1183:
+case 1184:
+case 1185:
+case 1186:
+case 1187:
+case 1188:
+case 1189:
+case 1190:
+case 1191:
+case 1192:
+case 1193:
+case 1194:
+case 1195:
+case 1196:
+case 1197:
+case 1198:
+case 1199:
+case 1200:
+case 1201:
+case 1202:
+case 1203:
+case 1204:
+case 1205:
+case 1206:
+case 1207:
+case 1208:
+case 1209:
+case 1210:
+case 1211:
+case 1212:
+case 1213:
+case 1214:
+case 1215:
+case 1216:
+case 1217:
+case 1218:
+case 1219:
+case 1220:
+case 1221:
+case 1222:
+case 1223:
+case 1224:
+case 1225:
+case 1226:
+case 1227:
+case 1228:
+case 1229:
+case 1230:
+case 1231:
+case 1232:
+case 1233:
+case 1234:
+case 1235:
+case 1236:
+case 1237:
+case 1238:
+case 1239:
+case 1240:
+case 1241:
+case 1242:
+case 1243:
+case 1244:
+case 1245:
+case 1246:
+case 1247:
+case 1248:
+case 1249:
+case 1250:
+case 1251:
+case 1252:
+case 1253:
+case 1254:
+case 1255:
+case 1256:
+case 1257:
+case 1258:
+case 1259:
+case 1260:
+case 1261:
+case 1262:
+case 1263:
+case 1264:
+case 1265:
+case 1266:
+case 1267:
+case 1268:
+case 1269:
+case 1270:
+case 1271:
+case 1272:
+case 1273:
+case 1274:
+case 1275:
+case 1276:
+case 1277:
+case 1278:
+case 1279:
+case 1280:
+case 1281:
+case 1282:
+case 1283:
+case 1284:
+case 1285:
+case 1286:
+case 1287:
+case 1288:
+case 1289:
+case 1290:
+case 1291:
+case 1292:
+case 1293:
+case 1294:
+case 1295:
+case 1296:
+case 1297:
+case 1298:
+case 1299:
+case 1300:
+case 1301:
+case 1302:
+case 1303:
+case 1304:
+case 1305:
+case 1306:
+case 1307:
+case 1308:
+case 1309:
+case 1310:
+case 1311:
+case 1312:
+case 1313:
+case 1314:
+case 1315:
+case 1316:
+case 1317:
+case 1318:
+case 1319:
+case 1320:
+case 1321:
+case 1322:
+case 1323:
+case 1324:
+case 1325:
+case 1326:
+case 1327:
+case 1328:
+case 1329:
+case 1330:
+case 1331:
+case 1332:
+case 1333:
+case 1334:
+case 1335:
+case 1336:
+case 1337:
+case 1338:
+case 1339:
+case 1340:
+case 1341:
+case 1342:
+case 1343:
+case 1344:
+case 1345:
+case 1346:
+case 1347:
+case 1348:
+case 1349:
+case 1350:
+case 1351:
+case 1352:
+case 1353:
+case 1354:
+case 1355:
+case 1356:
+case 1357:
+case 1358:
+case 1359:
+case 1360:
+case 1361:
+case 1362:
+case 1363:
+case 1364:
+case 1365:
+case 1366:
+case 1367:
+case 1368:
+case 1369:
+case 1370:
+case 1371:
+case 1372:
+case 1373:
+case 1374:
+case 1375:
+case 1376:
+case 1377:
+case 1378:
+case 1379:
+case 1380:
+case 1381:
+case 1382:
+case 1383:
+case 1384:
+case 1385:
+case 1386:
+case 1387:
+case 1388:
+case 1389:
+case 1390:
+case 1391:
+case 1392:
+case 1393:
+case 1394:
+case 1395:
+case 1396:
+case 1397:
+case 1398:
+case 1399:
+case 1400:
+case 1401:
+case 1402:
+case 1403:
+case 1404:
+case 1405:
+case 1406:
+case 1407:
+case 1408:
+case 1409:
+case 1410:
+case 1411:
+case 1412:
+case 1413:
+case 1414:
+case 1415:
+case 1416:
+case 1417:
+case 1418:
+case 1419:
+case 1420:
+case 1421:
+case 1422:
+case 1423:
+case 1424:
+case 1425:
+case 1426:
+case 1427:
+case 1428:
+case 1429:
+case 1430:
+case 1431:
+case 1432:
+case 1433:
+case 1434:
+case 1435:
+case 1436:
+case 1437:
+case 1438:
+case 1439:
+case 1440:
+case 1441:
+case 1442:
+case 1443:
+case 1444:
+case 1445:
+case 1446:
+case 1447:
+case 1448:
+case 1449:
+case 1450:
+case 1451:
+case 1452:
+case 1453:
+case 1454:
+case 1455:
+case 1456:
+case 1457:
+case 1458:
+case 1459:
+case 1460:
+case 1461:
+case 1462:
+case 1463:
+case 1464:
+case 1465:
+case 1466:
+case 1467:
+case 1468:
+case 1469:
+case 1470:
+case 1471:
+case 1472:
+case 1473:
+case 1474:
+case 1475:
+case 1476:
+case 1477:
+case 1478:
+case 1479:
+case 1480:
+case 1481:
+case 1482:
+case 1483:
+case 1484:
+case 1485:
+case 1486:
+case 1487:
+case 1488:
+case 1489:
+case 1490:
+case 1491:
+case 1492:
+case 1493:
+case 1494:
+case 1495:
+case 1496:
+case 1497:
+case 1498:
+case 1499:
+case 1500:
+case 1501:
+case 1502:
+case 1503:
+case 1504:
+case 1505:
+case 1506:
+case 1507:
+case 1508:
+case 1509:
+case 1510:
+case 1511:
+case 1512:
+case 1513:
+case 1514:
+case 1515:
+case 1516:
+case 1517:
+case 1518:
+case 1519:
+case 1520:
+case 1521:
+case 1522:
+case 1523:
+case 1524:
+case 1525:
+case 1526:
+case 1527:
+case 1528:
+case 1529:
+case 1530:
+case 1531:
+case 1532:
+case 1533:
+case 1534:
+case 1535:
+case 1536:
+case 1537:
+case 1538:
+case 1539:
+case 1540:
+case 1541:
+case 1542:
+case 1543:
+case 1544:
+case 1545:
+case 1546:
+case 1547:
+case 1548:
+case 1549:
+case 1550:
+case 1551:
+case 1552:
+case 1553:
+case 1554:
+case 1555:
+case 1556:
+case 1557:
+case 1558:
+case 1559:
+case 1560:
+case 1561:
+case 1562:
+case 1563:
+case 1564:
+case 1565:
+case 1566:
+case 1567:
+case 1568:
+case 1569:
+case 1570:
+case 1571:
+case 1572:
+case 1573:
+case 1574:
+case 1575:
+case 1576:
+case 1577:
+case 1578:
+case 1579:
+case 1580:
+case 1581:
+case 1582:
+case 1583:
+case 1584:
+case 1585:
+case 1586:
+case 1587:
+case 1588:
+case 1589:
+case 1590:
+case 1591:
+case 1592:
+case 1593:
+case 1594:
+case 1595:
+case 1596:
+case 1597:
+case 1598:
+case 1599:
+case 1600:
+case 1601:
+case 1602:
+case 1603:
+case 1604:
+case 1605:
+case 1606:
+case 1607:
+case 1608:
+case 1609:
+case 1610:
+case 1611:
+case 1612:
+case 1613:
+case 1614:
+case 1615:
+case 1616:
+case 1617:
+case 1618:
+case 1619:
+case 1620:
+case 1621:
+case 1622:
+case 1623:
+case 1624:
+case 1625:
+case 1626:
+case 1627:
+case 1628:
+case 1629:
+case 1630:
+case 1631:
+case 1632:
+case 1633:
+case 1634:
+case 1635:
+case 1636:
+case 1637:
+case 1638:
+case 1639:
+case 1640:
+case 1641:
+case 1642:
+case 1643:
+case 1644:
+case 1645:
+case 1646:
+case 1647:
+case 1648:
+case 1649:
+case 1650:
+case 1651:
+case 1652:
+case 1653:
+case 1654:
+case 1655:
+case 1656:
+case 1657:
+case 1658:
+case 1659:
+case 1660:
+case 1661:
+case 1662:
+case 1663:
+case 1664:
+case 1665:
+case 1666:
+case 1667:
+case 1668:
+case 1669:
+case 1670:
+case 1671:
+case 1672:
+case 1673:
+case 1674:
+case 1675:
+case 1676:
+case 1677:
+case 1678:
+case 1679:
+case 1680:
+case 1681:
+case 1682:
+case 1683:
+case 1684:
+case 1685:
+case 1686:
+case 1687:
+case 1688:
+case 1689:
+case 1690:
+case 1691:
+case 1692:
+case 1693:
+case 1694:
+case 1695:
+case 1696:
+case 1697:
+case 1698:
+case 1699:
+case 1700:
+case 1701:
+case 1702:
+case 1703:
+case 1704:
+case 1705:
+case 1706:
+case 1707:
+case 1708:
+case 1709:
+case 1710:
+case 1711:
+case 1712:
+case 1713:
+case 1714:
+case 1715:
+case 1716:
+case 1717:
+case 1718:
+case 1719:
+case 1720:
+case 1721:
+case 1722:
+case 1723:
+case 1724:
+case 1725:
+case 1726:
+case 1727:
+case 1728:
+case 1729:
+case 1730:
+case 1731:
+case 1732:
+case 1733:
+case 1734:
+case 1735:
+case 1736:
+case 1737:
+case 1738:
+case 1739:
+case 1740:
+case 1741:
+case 1742:
+case 1743:
+case 1744:
+case 1745:
+case 1746:
+case 1747:
+case 1748:
+case 1749:
+case 1750:
+case 1751:
+case 1752:
+case 1753:
+case 1754:
+case 1755:
+case 1756:
+case 1757:
+case 1758:
+case 1759:
+case 1760:
+case 1761:
+case 1762:
+case 1763:
+case 1764:
+case 1765:
+case 1766:
+case 1767:
+case 1768:
+case 1769:
+case 1770:
+case 1771:
+case 1772:
+case 1773:
+case 1774:
+case 1775:
+case 1776:
+case 1777:
+case 1778:
+case 1779:
+case 1780:
+case 1781:
+case 1782:
+case 1783:
+case 1784:
+case 1785:
+case 1786:
+case 1787:
+case 1788:
+case 1789:
+case 1790:
+case 1791:
+case 1792:
+case 1793:
+case 1794:
+case 1795:
+case 1796:
+case 1797:
+case 1798:
+case 1799:
+case 1800:
+case 1801:
+case 1802:
+case 1803:
+case 1804:
+case 1805:
+case 1806:
+case 1807:
+case 1808:
+case 1809:
+case 1810:
+case 1811:
+case 1812:
+case 1813:
+case 1814:
+case 1815:
+case 1816:
+case 1817:
+case 1818:
+case 1819:
+case 1820:
+case 1821:
+case 1822:
+case 1823:
+case 1824:
+case 1825:
+case 1826:
+case 1827:
+case 1828:
+case 1829:
+case 1830:
+case 1831:
+case 1832:
+case 1833:
+case 1834:
+case 1835:
+case 1836:
+case 1837:
+case 1838:
+case 1839:
+case 1840:
+case 1841:
+case 1842:
+case 1843:
+case 1844:
+case 1845:
+case 1846:
+case 1847:
+case 1848:
+case 1849:
+case 1850:
+case 1851:
+case 1852:
+case 1853:
+case 1854:
+case 1855:
+case 1856:
+case 1857:
+case 1858:
+case 1859:
+case 1860:
+case 1861:
+case 1862:
+case 1863:
+case 1864:
+case 1865:
+case 1866:
+case 1867:
+case 1868:
+case 1869:
+case 1870:
+case 1871:
+case 1872:
+case 1873:
+case 1874:
+case 1875:
+case 1876:
+case 1877:
+case 1878:
+case 1879:
+case 1880:
+case 1881:
+case 1882:
+case 1883:
+case 1884:
+case 1885:
+case 1886:
+case 1887:
+case 1888:
+case 1889:
+case 1890:
+case 1891:
+case 1892:
+case 1893:
+case 1894:
+case 1895:
+case 1896:
+case 1897:
+case 1898:
+case 1899:
+case 1900:
+case 1901:
+case 1902:
+case 1903:
+case 1904:
+case 1905:
+case 1906:
+case 1907:
+case 1908:
+case 1909:
+case 1910:
+case 1911:
+case 1912:
+case 1913:
+case 1914:
+case 1915:
+case 1916:
+case 1917:
+case 1918:
+case 1919:
+case 1920:
+case 1921:
+case 1922:
+case 1923:
+case 1924:
+case 1925:
+case 1926:
+case 1927:
+case 1928:
+case 1929:
+case 1930:
+case 1931:
+case 1932:
+case 1933:
+case 1934:
+case 1935:
+case 1936:
+case 1937:
+case 1938:
+case 1939:
+case 1940:
+case 1941:
+case 1942:
+case 1943:
+case 1944:
+case 1945:
+case 1946:
+case 1947:
+case 1948:
+case 1949:
+case 1950:
+case 1951:
+case 1952:
+case 1953:
+case 1954:
+case 1955:
+case 1956:
+case 1957:
+case 1958:
+case 1959:
+case 1960:
+case 1961:
+case 1962:
+case 1963:
+case 1964:
+case 1965:
+case 1966:
+case 1967:
+case 1968:
+case 1969:
+case 1970:
+case 1971:
+case 1972:
+case 1973:
+case 1974:
+case 1975:
+case 1976:
+case 1977:
+case 1978:
+case 1979:
+case 1980:
+case 1981:
+case 1982:
+case 1983:
+case 1984:
+case 1985:
+case 1986:
+case 1987:
+case 1988:
+case 1989:
+case 1990:
+case 1991:
+case 1992:
+case 1993:
+case 1994:
+case 1995:
+case 1996:
+case 1997:
+case 1998:
+case 1999:
+case 2000:
+case 2001:
+case 2002:
+case 2003:
+case 2004:
+case 2005:
+case 2006:
+case 2007:
+case 2008:
+case 2009:
+case 2010:
+case 2011:
+case 2012:
+case 2013:
+case 2014:
+case 2015:
+case 2016:
+case 2017:
+case 2018:
+case 2019:
+case 2020:
+case 2021:
+case 2022:
+case 2023:
+case 2024:
+case 2025:
+case 2026:
+case 2027:
+case 2028:
+case 2029:
+case 2030:
+case 2031:
+case 2032:
+case 2033:
+case 2034:
+case 2035:
+case 2036:
+case 2037:
+case 2038:
+case 2039:
+case 2040:
+case 2041:
+case 2042:
+case 2043:
+case 2044:
+case 2045:
+case 2046:
+case 2047:
+case 2048:
+case 2049:
+case 2050:
+case 2051:
+case 2052:
+case 2053:
+case 2054:
+case 2055:
+case 2056:
+case 2057:
+case 2058:
+case 2059:
+case 2060:
+case 2061:
+case 2062:
+case 2063:
+case 2064:
+case 2065:
+case 2066:
+case 2067:
+case 2068:
+case 2069:
+case 2070:
+case 2071:
+case 2072:
+case 2073:
+case 2074:
+case 2075:
+case 2076:
+case 2077:
+case 2078:
+case 2079:
+case 2080:
+case 2081:
+case 2082:
+case 2083:
+case 2084:
+case 2085:
+case 2086:
+case 2087:
+case 2088:
+case 2089:
+case 2090:
+case 2091:
+case 2092:
+case 2093:
+case 2094:
+case 2095:
+case 2096:
+case 2097:
+case 2098:
+case 2099:
+case 2100:
+case 2101:
+case 2102:
+case 2103:
+case 2104:
+case 2105:
+case 2106:
+case 2107:
+case 2108:
+case 2109:
+case 2110:
+case 2111:
+case 2112:
+case 2113:
+case 2114:
+case 2115:
+case 2116:
+case 2117:
+case 2118:
+case 2119:
+case 2120:
+case 2121:
+case 2122:
+case 2123:
+case 2124:
+case 2125:
+case 2126:
+case 2127:
+case 2128:
+case 2129:
+case 2130:
+case 2131:
+case 2132:
+case 2133:
+case 2134:
+case 2135:
+case 2136:
+case 2137:
+case 2138:
+case 2139:
+case 2140:
+case 2141:
+case 2142:
+case 2143:
+case 2144:
+case 2145:
+case 2146:
+case 2147:
+case 2148:
+case 2149:
+case 2150:
+case 2151:
+case 2152:
+case 2153:
+case 2154:
+case 2155:
+case 2156:
+case 2157:
+case 2158:
+case 2159:
+case 2160:
+case 2161:
+case 2162:
+case 2163:
+case 2164:
+case 2165:
+case 2166:
+case 2167:
+case 2168:
+case 2169:
+case 2170:
+case 2171:
+case 2172:
+case 2173:
+case 2174:
+case 2175:
+case 2176:
+case 2177:
+case 2178:
+case 2179:
+case 2180:
+case 2181:
+case 2182:
+case 2183:
+case 2184:
+case 2185:
+case 2186:
+case 2187:
+case 2188:
+case 2189:
+case 2190:
+case 2191:
+case 2192:
+case 2193:
+case 2194:
+case 2195:
+case 2196:
+case 2197:
+case 2198:
+case 2199:
+case 2200:
+case 2201:
+case 2202:
+case 2203:
+case 2204:
+case 2205:
+case 2206:
+case 2207:
+case 2208:
+case 2209:
+case 2210:
+case 2211:
+case 2212:
+case 2213:
+case 2214:
+case 2215:
+case 2216:
+case 2217:
+case 2218:
+case 2219:
+case 2220:
+case 2221:
+case 2222:
+case 2223:
+case 2224:
+case 2225:
+case 2226:
+case 2227:
+case 2228:
+case 2229:
+case 2230:
+case 2231:
+case 2232:
+case 2233:
+case 2234:
+case 2235:
+case 2236:
+case 2237:
+case 2238:
+case 2239:
+case 2240:
+case 2241:
+case 2242:
+case 2243:
+case 2244:
+case 2245:
+case 2246:
+case 2247:
+case 2248:
+case 2249:
+case 2250:
+case 2251:
+case 2252:
+case 2253:
+case 2254:
+case 2255:
+case 2256:
+case 2257:
+case 2258:
+case 2259:
+case 2260:
+case 2261:
+case 2262:
+case 2263:
+case 2264:
+case 2265:
+case 2266:
+case 2267:
+case 2268:
+case 2269:
+case 2270:
+case 2271:
+case 2272:
+case 2273:
+case 2274:
+case 2275:
+case 2276:
+case 2277:
+case 2278:
+case 2279:
+case 2280:
+case 2281:
+case 2282:
+case 2283:
+case 2284:
+case 2285:
+case 2286:
+case 2287:
+case 2288:
+case 2289:
+case 2290:
+case 2291:
+case 2292:
+case 2293:
+case 2294:
+case 2295:
+case 2296:
+case 2297:
+case 2298:
+case 2299:
+case 2300:
+case 2301:
+case 2302:
+case 2303:
+case 2304:
+case 2305:
+case 2306:
+case 2307:
+case 2308:
+case 2309:
+case 2310:
+case 2311:
+case 2312:
+case 2313:
+case 2314:
+case 2315:
+case 2316:
+case 2317:
+case 2318:
+case 2319:
+case 2320:
+case 2321:
+case 2322:
+case 2323:
+case 2324:
+case 2325:
+case 2326:
+case 2327:
+case 2328:
+case 2329:
+case 2330:
+case 2331:
+case 2332:
+case 2333:
+case 2334:
+case 2335:
+case 2336:
+case 2337:
+case 2338:
+case 2339:
+case 2340:
+case 2341:
+case 2342:
+case 2343:
+case 2344:
+case 2345:
+case 2346:
+case 2347:
+case 2348:
+case 2349:
+case 2350:
+case 2351:
+case 2352:
+case 2353:
+case 2354:
+case 2355:
+case 2356:
+case 2357:
+case 2358:
+case 2359:
+case 2360:
+case 2361:
+case 2362:
+case 2363:
+case 2364:
+case 2365:
+case 2366:
+case 2367:
+case 2368:
+case 2369:
+case 2370:
+case 2371:
+case 2372:
+case 2373:
+case 2374:
+case 2375:
+case 2376:
+case 2377:
+case 2378:
+case 2379:
+case 2380:
+case 2381:
+case 2382:
+case 2383:
+case 2384:
+case 2385:
+case 2386:
+case 2387:
+case 2388:
+case 2389:
+case 2390:
+case 2391:
+case 2392:
+case 2393:
+case 2394:
+case 2395:
+case 2396:
+case 2397:
+case 2398:
+case 2399:
+case 2400:
+case 2401:
+case 2402:
+case 2403:
+case 2404:
+case 2405:
+case 2406:
+case 2407:
+case 2408:
+case 2409:
+case 2410:
+case 2411:
+case 2412:
+case 2413:
+case 2414:
+case 2415:
+case 2416:
+case 2417:
+case 2418:
+case 2419:
+case 2420:
+case 2421:
+case 2422:
+case 2423:
+case 2424:
+case 2425:
+case 2426:
+case 2427:
+case 2428:
+case 2429:
+case 2430:
+case 2431:
+case 2432:
+case 2433:
+case 2434:
+case 2435:
+case 2436:
+case 2437:
+case 2438:
+case 2439:
+case 2440:
+case 2441:
+case 2442:
+case 2443:
+case 2444:
+case 2445:
+case 2446:
+case 2447:
+case 2448:
+case 2449:
+case 2450:
+case 2451:
+case 2452:
+case 2453:
+case 2454:
+case 2455:
+case 2456:
+case 2457:
+case 2458:
+case 2459:
+case 2460:
+case 2461:
+case 2462:
+case 2463:
+case 2464:
+case 2465:
+case 2466:
+case 2467:
+case 2468:
+case 2469:
+case 2470:
+case 2471:
+case 2472:
+case 2473:
+case 2474:
+case 2475:
+case 2476:
+case 2477:
+case 2478:
+case 2479:
+case 2480:
+case 2481:
+case 2482:
+case 2483:
+case 2484:
+case 2485:
+case 2486:
+case 2487:
+case 2488:
+case 2489:
+case 2490:
+case 2491:
+case 2492:
+case 2493:
+case 2494:
+case 2495:
+case 2496:
+case 2497:
+case 2498:
+case 2499:
+case 2500:
+case 2501:
+case 2502:
+case 2503:
+case 2504:
+case 2505:
+case 2506:
+case 2507:
+case 2508:
+case 2509:
+case 2510:
+case 2511:
+case 2512:
+case 2513:
+case 2514:
+case 2515:
+case 2516:
+case 2517:
+case 2518:
+case 2519:
+case 2520:
+case 2521:
+case 2522:
+case 2523:
+case 2524:
+case 2525:
+case 2526:
+case 2527:
+case 2528:
+case 2529:
+case 2530:
+case 2531:
+case 2532:
+case 2533:
+case 2534:
+case 2535:
+case 2536:
+case 2537:
+case 2538:
+case 2539:
+case 2540:
+case 2541:
+case 2542:
+case 2543:
+case 2544:
+case 2545:
+case 2546:
+case 2547:
+case 2548:
+case 2549:
+case 2550:
+case 2551:
+case 2552:
+case 2553:
+case 2554:
+case 2555:
+case 2556:
+case 2557:
+case 2558:
+case 2559:
+case 2560:
+case 2561:
+case 2562:
+case 2563:
+case 2564:
+case 2565:
+case 2566:
+case 2567:
+case 2568:
+case 2569:
+case 2570:
+case 2571:
+case 2572:
+case 2573:
+case 2574:
+case 2575:
+case 2576:
+case 2577:
+case 2578:
+case 2579:
+case 2580:
+case 2581:
+case 2582:
+case 2583:
+case 2584:
+case 2585:
+case 2586:
+case 2587:
+case 2588:
+case 2589:
+case 2590:
+case 2591:
+case 2592:
+case 2593:
+case 2594:
+case 2595:
+case 2596:
+case 2597:
+case 2598:
+case 2599:
+case 2600:
+case 2601:
+case 2602:
+case 2603:
+case 2604:
+case 2605:
+case 2606:
+case 2607:
+case 2608:
+case 2609:
+case 2610:
+case 2611:
+case 2612:
+case 2613:
+case 2614:
+case 2615:
+case 2616:
+case 2617:
+case 2618:
+case 2619:
+case 2620:
+case 2621:
+case 2622:
+case 2623:
+case 2624:
+case 2625:
+case 2626:
+case 2627:
+case 2628:
+case 2629:
+case 2630:
+case 2631:
+case 2632:
+case 2633:
+case 2634:
+case 2635:
+case 2636:
+case 2637:
+case 2638:
+case 2639:
+case 2640:
+case 2641:
+case 2642:
+case 2643:
+case 2644:
+case 2645:
+case 2646:
+case 2647:
+case 2648:
+case 2649:
+case 2650:
+case 2651:
+case 2652:
+case 2653:
+case 2654:
+case 2655:
+case 2656:
+case 2657:
+case 2658:
+case 2659:
+case 2660:
+case 2661:
+case 2662:
+case 2663:
+case 2664:
+case 2665:
+case 2666:
+case 2667:
+case 2668:
+case 2669:
+case 2670:
+case 2671:
+case 2672:
+case 2673:
+case 2674:
+case 2675:
+case 2676:
+case 2677:
+case 2678:
+case 2679:
+case 2680:
+case 2681:
+case 2682:
+case 2683:
+case 2684:
+case 2685:
+case 2686:
+case 2687:
+case 2688:
+case 2689:
+case 2690:
+case 2691:
+case 2692:
+case 2693:
+case 2694:
+case 2695:
+case 2696:
+case 2697:
+case 2698:
+case 2699:
+case 2700:
+case 2701:
+case 2702:
+case 2703:
+case 2704:
+case 2705:
+case 2706:
+case 2707:
+case 2708:
+case 2709:
+case 2710:
+case 2711:
+case 2712:
+case 2713:
+case 2714:
+case 2715:
+case 2716:
+case 2717:
+case 2718:
+case 2719:
+case 2720:
+case 2721:
+case 2722:
+case 2723:
+case 2724:
+case 2725:
+case 2726:
+case 2727:
+case 2728:
+case 2729:
+case 2730:
+case 2731:
+case 2732:
+case 2733:
+case 2734:
+case 2735:
+case 2736:
+case 2737:
+case 2738:
+case 2739:
+case 2740:
+case 2741:
+case 2742:
+case 2743:
+case 2744:
+case 2745:
+case 2746:
+case 2747:
+case 2748:
+case 2749:
+case 2750:
+case 2751:
+case 2752:
+case 2753:
+case 2754:
+case 2755:
+case 2756:
+case 2757:
+case 2758:
+case 2759:
+case 2760:
+case 2761:
+case 2762:
+case 2763:
+case 2764:
+case 2765:
+case 2766:
+case 2767:
+case 2768:
+case 2769:
+case 2770:
+case 2771:
+case 2772:
+case 2773:
+case 2774:
+case 2775:
+case 2776:
+case 2777:
+case 2778:
+case 2779:
+case 2780:
+case 2781:
+case 2782:
+case 2783:
+case 2784:
+case 2785:
+case 2786:
+case 2787:
+case 2788:
+case 2789:
+case 2790:
+case 2791:
+case 2792:
+case 2793:
+case 2794:
+case 2795:
+case 2796:
+case 2797:
+case 2798:
+case 2799:
+case 2800:
+case 2801:
+case 2802:
+case 2803:
+case 2804:
+case 2805:
+case 2806:
+case 2807:
+case 2808:
+case 2809:
+case 2810:
+case 2811:
+case 2812:
+case 2813:
+case 2814:
+case 2815:
+case 2816:
+case 2817:
+case 2818:
+case 2819:
+case 2820:
+case 2821:
+case 2822:
+case 2823:
+case 2824:
+case 2825:
+case 2826:
+case 2827:
+case 2828:
+case 2829:
+case 2830:
+case 2831:
+case 2832:
+case 2833:
+case 2834:
+case 2835:
+case 2836:
+case 2837:
+case 2838:
+case 2839:
+case 2840:
+case 2841:
+case 2842:
+case 2843:
+case 2844:
+case 2845:
+case 2846:
+case 2847:
+case 2848:
+case 2849:
+case 2850:
+case 2851:
+case 2852:
+case 2853:
+case 2854:
+case 2855:
+case 2856:
+case 2857:
+case 2858:
+case 2859:
+case 2860:
+case 2861:
+case 2862:
+case 2863:
+case 2864:
+case 2865:
+case 2866:
+case 2867:
+case 2868:
+case 2869:
+case 2870:
+case 2871:
+case 2872:
+case 2873:
+case 2874:
+case 2875:
+case 2876:
+case 2877:
+case 2878:
+case 2879:
+case 2880:
+case 2881:
+case 2882:
+case 2883:
+case 2884:
+case 2885:
+case 2886:
+case 2887:
+case 2888:
+case 2889:
+case 2890:
+case 2891:
+case 2892:
+case 2893:
+case 2894:
+case 2895:
+case 2896:
+case 2897:
+case 2898:
+case 2899:
+case 2900:
+case 2901:
+case 2902:
+case 2903:
+case 2904:
+case 2905:
+case 2906:
+case 2907:
+case 2908:
+case 2909:
+case 2910:
+case 2911:
+case 2912:
+case 2913:
+case 2914:
+case 2915:
+case 2916:
+case 2917:
+case 2918:
+case 2919:
+case 2920:
+case 2921:
+case 2922:
+case 2923:
+case 2924:
+case 2925:
+case 2926:
+case 2927:
+case 2928:
+case 2929:
+case 2930:
+case 2931:
+case 2932:
+case 2933:
+case 2934:
+case 2935:
+case 2936:
+case 2937:
+case 2938:
+case 2939:
+case 2940:
+case 2941:
+case 2942:
+case 2943:
+case 2944:
+case 2945:
+case 2946:
+case 2947:
+case 2948:
+case 2949:
+case 2950:
+case 2951:
+case 2952:
+case 2953:
+case 2954:
+case 2955:
+case 2956:
+case 2957:
+case 2958:
+case 2959:
+case 2960:
+case 2961:
+case 2962:
+case 2963:
+case 2964:
+case 2965:
+case 2966:
+case 2967:
+case 2968:
+case 2969:
+case 2970:
+case 2971:
+case 2972:
+case 2973:
+case 2974:
+case 2975:
+case 2976:
+case 2977:
+case 2978:
+case 2979:
+case 2980:
+case 2981:
+case 2982:
+case 2983:
+case 2984:
+case 2985:
+case 2986:
+case 2987:
+case 2988:
+case 2989:
+case 2990:
+case 2991:
+case 2992:
+case 2993:
+case 2994:
+case 2995:
+case 2996:
+case 2997:
+case 2998:
+case 2999:
+case 3000:
+case 3001:
+case 3002:
+case 3003:
+case 3004:
+case 3005:
+case 3006:
+case 3007:
+case 3008:
+case 3009:
+case 3010:
+case 3011:
+case 3012:
+case 3013:
+case 3014:
+case 3015:
+case 3016:
+case 3017:
+case 3018:
+case 3019:
+case 3020:
+case 3021:
+case 3022:
+case 3023:
+case 3024:
+case 3025:
+case 3026:
+case 3027:
+case 3028:
+case 3029:
+case 3030:
+case 3031:
+case 3032:
+case 3033:
+case 3034:
+case 3035:
+case 3036:
+case 3037:
+case 3038:
+case 3039:
+case 3040:
+case 3041:
+case 3042:
+case 3043:
+case 3044:
+case 3045:
+case 3046:
+case 3047:
+case 3048:
+case 3049:
+case 3050:
+case 3051:
+case 3052:
+case 3053:
+case 3054:
+case 3055:
+case 3056:
+case 3057:
+case 3058:
+case 3059:
+case 3060:
+case 3061:
+case 3062:
+case 3063:
+case 3064:
+case 3065:
+case 3066:
+case 3067:
+case 3068:
+case 3069:
+case 3070:
+case 3071:
+case 3072:
+case 3073:
+case 3074:
+case 3075:
+case 3076:
+case 3077:
+case 3078:
+case 3079:
+case 3080:
+case 3081:
+case 3082:
+case 3083:
+case 3084:
+case 3085:
+case 3086:
+case 3087:
+case 3088:
+case 3089:
+case 3090:
+case 3091:
+case 3092:
+case 3093:
+case 3094:
+case 3095:
+case 3096:
+case 3097:
+case 3098:
+case 3099:
+case 3100:
+case 3101:
+case 3102:
+case 3103:
+case 3104:
+case 3105:
+case 3106:
+case 3107:
+case 3108:
+case 3109:
+case 3110:
+case 3111:
+case 3112:
+case 3113:
+case 3114:
+case 3115:
+case 3116:
+case 3117:
+case 3118:
+case 3119:
+case 3120:
+case 3121:
+case 3122:
+case 3123:
+case 3124:
+case 3125:
+case 3126:
+case 3127:
+case 3128:
+case 3129:
+case 3130:
+case 3131:
+case 3132:
+case 3133:
+case 3134:
+case 3135:
+case 3136:
+case 3137:
+case 3138:
+case 3139:
+case 3140:
+case 3141:
+case 3142:
+case 3143:
+case 3144:
+case 3145:
+case 3146:
+case 3147:
+case 3148:
+case 3149:
+case 3150:
+case 3151:
+case 3152:
+case 3153:
+case 3154:
+case 3155:
+case 3156:
+case 3157:
+case 3158:
+case 3159:
+case 3160:
+case 3161:
+case 3162:
+case 3163:
+case 3164:
+case 3165:
+case 3166:
+case 3167:
+case 3168:
+case 3169:
+case 3170:
+case 3171:
+case 3172:
+case 3173:
+case 3174:
+case 3175:
+case 3176:
+case 3177:
+case 3178:
+case 3179:
+case 3180:
+case 3181:
+case 3182:
+case 3183:
+case 3184:
+case 3185:
+case 3186:
+case 3187:
+case 3188:
+case 3189:
+case 3190:
+case 3191:
+case 3192:
+case 3193:
+case 3194:
+case 3195:
+case 3196:
+case 3197:
+case 3198:
+case 3199:
+case 3200:
+case 3201:
+case 3202:
+case 3203:
+case 3204:
+case 3205:
+case 3206:
+case 3207:
+case 3208:
+case 3209:
+case 3210:
+case 3211:
+case 3212:
+case 3213:
+case 3214:
+case 3215:
+case 3216:
+case 3217:
+case 3218:
+case 3219:
+case 3220:
+case 3221:
+case 3222:
+case 3223:
+case 3224:
+case 3225:
+case 3226:
+case 3227:
+case 3228:
+case 3229:
+case 3230:
+case 3231:
+case 3232:
+case 3233:
+case 3234:
+case 3235:
+case 3236:
+case 3237:
+case 3238:
+case 3239:
+case 3240:
+case 3241:
+case 3242:
+case 3243:
+case 3244:
+case 3245:
+case 3246:
+case 3247:
+case 3248:
+case 3249:
+case 3250:
+case 3251:
+case 3252:
+case 3253:
+case 3254:
+case 3255:
+case 3256:
+case 3257:
+case 3258:
+case 3259:
+case 3260:
+case 3261:
+case 3262:
+case 3263:
+case 3264:
+case 3265:
+case 3266:
+case 3267:
+case 3268:
+case 3269:
+case 3270:
+case 3271:
+case 3272:
+case 3273:
+case 3274:
+case 3275:
+case 3276:
+case 3277:
+case 3278:
+case 3279:
+case 3280:
+case 3281:
+case 3282:
+case 3283:
+case 3284:
+case 3285:
+case 3286:
+case 3287:
+case 3288:
+case 3289:
+case 3290:
+case 3291:
+case 3292:
+case 3293:
+case 3294:
+case 3295:
+case 3296:
+case 3297:
+case 3298:
+case 3299:
+case 3300:
+case 3301:
+case 3302:
+case 3303:
+case 3304:
+case 3305:
+case 3306:
+case 3307:
+case 3308:
+case 3309:
+case 3310:
+case 3311:
+case 3312:
+case 3313:
+case 3314:
+case 3315:
+case 3316:
+case 3317:
+case 3318:
+case 3319:
+case 3320:
+case 3321:
+case 3322:
+case 3323:
+case 3324:
+case 3325:
+case 3326:
+case 3327:
+case 3328:
+case 3329:
+case 3330:
+case 3331:
+case 3332:
+case 3333:
+case 3334:
+case 3335:
+case 3336:
+case 3337:
+case 3338:
+case 3339:
+case 3340:
+case 3341:
+case 3342:
+case 3343:
+case 3344:
+case 3345:
+case 3346:
+case 3347:
+case 3348:
+case 3349:
+case 3350:
+case 3351:
+case 3352:
+case 3353:
+case 3354:
+case 3355:
+case 3356:
+case 3357:
+case 3358:
+case 3359:
+case 3360:
+case 3361:
+case 3362:
+case 3363:
+case 3364:
+case 3365:
+case 3366:
+case 3367:
+case 3368:
+case 3369:
+case 3370:
+case 3371:
+case 3372:
+case 3373:
+case 3374:
+case 3375:
+case 3376:
+case 3377:
+case 3378:
+case 3379:
+case 3380:
+case 3381:
+case 3382:
+case 3383:
+case 3384:
+case 3385:
+case 3386:
+case 3387:
+case 3388:
+case 3389:
+case 3390:
+case 3391:
+case 3392:
+case 3393:
+case 3394:
+case 3395:
+case 3396:
+case 3397:
+case 3398:
+case 3399:
+case 3400:
+case 3401:
+case 3402:
+case 3403:
+case 3404:
+case 3405:
+case 3406:
+case 3407:
+case 3408:
+case 3409:
+case 3410:
+case 3411:
+case 3412:
+case 3413:
+case 3414:
+case 3415:
+case 3416:
+case 3417:
+case 3418:
+case 3419:
+case 3420:
+case 3421:
+case 3422:
+case 3423:
+case 3424:
+case 3425:
+case 3426:
+case 3427:
+case 3428:
+case 3429:
+case 3430:
+case 3431:
+case 3432:
+case 3433:
+case 3434:
+case 3435:
+case 3436:
+case 3437:
+case 3438:
+case 3439:
+case 3440:
+case 3441:
+case 3442:
+case 3443:
+case 3444:
+case 3445:
+case 3446:
+case 3447:
+case 3448:
+case 3449:
+case 3450:
+case 3451:
+case 3452:
+case 3453:
+case 3454:
+case 3455:
+case 3456:
+case 3457:
+case 3458:
+case 3459:
+case 3460:
+case 3461:
+case 3462:
+case 3463:
+case 3464:
+case 3465:
+case 3466:
+case 3467:
+case 3468:
+case 3469:
+case 3470:
+case 3471:
+case 3472:
+case 3473:
+case 3474:
+case 3475:
+case 3476:
+case 3477:
+case 3478:
+case 3479:
+case 3480:
+case 3481:
+case 3482:
+case 3483:
+case 3484:
+case 3485:
+case 3486:
+case 3487:
+case 3488:
+case 3489:
+case 3490:
+case 3491:
+case 3492:
+case 3493:
+case 3494:
+case 3495:
+case 3496:
+case 3497:
+case 3498:
+case 3499:
+case 3500:
+case 3501:
+case 3502:
+case 3503:
+case 3504:
+case 3505:
+case 3506:
+case 3507:
+case 3508:
+case 3509:
+case 3510:
+case 3511:
+case 3512:
+case 3513:
+case 3514:
+case 3515:
+case 3516:
+case 3517:
+case 3518:
+case 3519:
+case 3520:
+case 3521:
+case 3522:
+case 3523:
+case 3524:
+case 3525:
+case 3526:
+case 3527:
+case 3528:
+case 3529:
+case 3530:
+case 3531:
+case 3532:
+case 3533:
+case 3534:
+case 3535:
+case 3536:
+case 3537:
+case 3538:
+case 3539:
+case 3540:
+case 3541:
+case 3542:
+case 3543:
+case 3544:
+case 3545:
+case 3546:
+case 3547:
+case 3548:
+case 3549:
+case 3550:
+case 3551:
+case 3552:
+case 3553:
+case 3554:
+case 3555:
+case 3556:
+case 3557:
+case 3558:
+case 3559:
+case 3560:
+case 3561:
+case 3562:
+case 3563:
+case 3564:
+case 3565:
+case 3566:
+case 3567:
+case 3568:
+case 3569:
+case 3570:
+case 3571:
+case 3572:
+case 3573:
+case 3574:
+case 3575:
+case 3576:
+case 3577:
+case 3578:
+case 3579:
+case 3580:
+case 3581:
+case 3582:
+case 3583:
+case 3584:
+case 3585:
+case 3586:
+case 3587:
+case 3588:
+case 3589:
+case 3590:
+case 3591:
+case 3592:
+case 3593:
+case 3594:
+case 3595:
+case 3596:
+case 3597:
+case 3598:
+case 3599:
+case 3600:
+case 3601:
+case 3602:
+case 3603:
+case 3604:
+case 3605:
+case 3606:
+case 3607:
+case 3608:
+case 3609:
+case 3610:
+case 3611:
+case 3612:
+case 3613:
+case 3614:
+case 3615:
+case 3616:
+case 3617:
+case 3618:
+case 3619:
+case 3620:
+case 3621:
+case 3622:
+case 3623:
+case 3624:
+case 3625:
+case 3626:
+case 3627:
+case 3628:
+case 3629:
+case 3630:
+case 3631:
+case 3632:
+case 3633:
+case 3634:
+case 3635:
+case 3636:
+case 3637:
+case 3638:
+case 3639:
+case 3640:
+case 3641:
+case 3642:
+case 3643:
+case 3644:
+case 3645:
+case 3646:
+case 3647:
+case 3648:
+case 3649:
+case 3650:
+case 3651:
+case 3652:
+case 3653:
+case 3654:
+case 3655:
+case 3656:
+case 3657:
+case 3658:
+case 3659:
+case 3660:
+case 3661:
+case 3662:
+case 3663:
+case 3664:
+case 3665:
+case 3666:
+case 3667:
+case 3668:
+case 3669:
+case 3670:
+case 3671:
+case 3672:
+case 3673:
+case 3674:
+case 3675:
+case 3676:
+case 3677:
+case 3678:
+case 3679:
+case 3680:
+case 3681:
+case 3682:
+case 3683:
+case 3684:
+case 3685:
+case 3686:
+case 3687:
+case 3688:
+case 3689:
+case 3690:
+case 3691:
+case 3692:
+case 3693:
+case 3694:
+case 3695:
+case 3696:
+case 3697:
+case 3698:
+case 3699:
+case 3700:
+case 3701:
+case 3702:
+case 3703:
+case 3704:
+case 3705:
+case 3706:
+case 3707:
+case 3708:
+case 3709:
+case 3710:
+case 3711:
+case 3712:
+case 3713:
+case 3714:
+case 3715:
+case 3716:
+case 3717:
+case 3718:
+case 3719:
+case 3720:
+case 3721:
+case 3722:
+case 3723:
+case 3724:
+case 3725:
+case 3726:
+case 3727:
+case 3728:
+case 3729:
+case 3730:
+case 3731:
+case 3732:
+case 3733:
+case 3734:
+case 3735:
+case 3736:
+case 3737:
+case 3738:
+case 3739:
+case 3740:
+case 3741:
+case 3742:
+case 3743:
+case 3744:
+case 3745:
+case 3746:
+case 3747:
+case 3748:
+case 3749:
+case 3750:
+case 3751:
+case 3752:
+case 3753:
+case 3754:
+case 3755:
+case 3756:
+case 3757:
+case 3758:
+case 3759:
+case 3760:
+case 3761:
+case 3762:
+case 3763:
+case 3764:
+case 3765:
+case 3766:
+case 3767:
+case 3768:
+case 3769:
+case 3770:
+case 3771:
+case 3772:
+case 3773:
+case 3774:
+case 3775:
+case 3776:
+case 3777:
+case 3778:
+case 3779:
+case 3780:
+case 3781:
+case 3782:
+case 3783:
+case 3784:
+case 3785:
+case 3786:
+case 3787:
+case 3788:
+case 3789:
+case 3790:
+case 3791:
+case 3792:
+case 3793:
+case 3794:
+case 3795:
+case 3796:
+case 3797:
+case 3798:
+case 3799:
+case 3800:
+case 3801:
+case 3802:
+case 3803:
+case 3804:
+case 3805:
+case 3806:
+case 3807:
+case 3808:
+case 3809:
+case 3810:
+case 3811:
+case 3812:
+case 3813:
+case 3814:
+case 3815:
+case 3816:
+case 3817:
+case 3818:
+case 3819:
+case 3820:
+case 3821:
+case 3822:
+case 3823:
+case 3824:
+case 3825:
+case 3826:
+case 3827:
+case 3828:
+case 3829:
+case 3830:
+case 3831:
+case 3832:
+case 3833:
+case 3834:
+case 3835:
+case 3836:
+case 3837:
+case 3838:
+case 3839:
+case 3840:
+case 3841:
+case 3842:
+case 3843:
+case 3844:
+case 3845:
+case 3846:
+case 3847:
+case 3848:
+case 3849:
+case 3850:
+case 3851:
+case 3852:
+case 3853:
+case 3854:
+case 3855:
+case 3856:
+case 3857:
+case 3858:
+case 3859:
+case 3860:
+case 3861:
+case 3862:
+case 3863:
+case 3864:
+case 3865:
+case 3866:
+case 3867:
+case 3868:
+case 3869:
+case 3870:
+case 3871:
+case 3872:
+case 3873:
+case 3874:
+case 3875:
+case 3876:
+case 3877:
+case 3878:
+case 3879:
+case 3880:
+case 3881:
+case 3882:
+case 3883:
+case 3884:
+case 3885:
+case 3886:
+case 3887:
+case 3888:
+case 3889:
+case 3890:
+case 3891:
+case 3892:
+case 3893:
+case 3894:
+case 3895:
+case 3896:
+case 3897:
+case 3898:
+case 3899:
+case 3900:
+case 3901:
+case 3902:
+case 3903:
+case 3904:
+case 3905:
+case 3906:
+case 3907:
+case 3908:
+case 3909:
+case 3910:
+case 3911:
+case 3912:
+case 3913:
+case 3914:
+case 3915:
+case 3916:
+case 3917:
+case 3918:
+case 3919:
+case 3920:
+case 3921:
+case 3922:
+case 3923:
+case 3924:
+case 3925:
+case 3926:
+case 3927:
+case 3928:
+case 3929:
+case 3930:
+case 3931:
+case 3932:
+case 3933:
+case 3934:
+case 3935:
+case 3936:
+case 3937:
+case 3938:
+case 3939:
+case 3940:
+case 3941:
+case 3942:
+case 3943:
+case 3944:
+case 3945:
+case 3946:
+case 3947:
+case 3948:
+case 3949:
+case 3950:
+case 3951:
+case 3952:
+case 3953:
+case 3954:
+case 3955:
+case 3956:
+case 3957:
+case 3958:
+case 3959:
+case 3960:
+case 3961:
+case 3962:
+case 3963:
+case 3964:
+case 3965:
+case 3966:
+case 3967:
+case 3968:
+case 3969:
+case 3970:
+case 3971:
+case 3972:
+case 3973:
+case 3974:
+case 3975:
+case 3976:
+case 3977:
+case 3978:
+case 3979:
+case 3980:
+case 3981:
+case 3982:
+case 3983:
+case 3984:
+case 3985:
+case 3986:
+case 3987:
+case 3988:
+case 3989:
+case 3990:
+case 3991:
+case 3992:
+case 3993:
+case 3994:
+case 3995:
+case 3996:
+case 3997:
+case 3998:
+case 3999:
+case 4000:
+case 4001:
+case 4002:
+case 4003:
+case 4004:
+case 4005:
+case 4006:
+case 4007:
+case 4008:
+case 4009:
+case 4010:
+case 4011:
+case 4012:
+case 4013:
+case 4014:
+case 4015:
+case 4016:
+case 4017:
+case 4018:
+case 4019:
+case 4020:
+case 4021:
+case 4022:
+case 4023:
+case 4024:
+case 4025:
+case 4026:
+case 4027:
+case 4028:
+case 4029:
+case 4030:
+case 4031:
+case 4032:
+case 4033:
+case 4034:
+case 4035:
+case 4036:
+case 4037:
+case 4038:
+case 4039:
+case 4040:
+case 4041:
+case 4042:
+case 4043:
+case 4044:
+case 4045:
+case 4046:
+case 4047:
+case 4048:
+case 4049:
+case 4050:
+case 4051:
+case 4052:
+case 4053:
+case 4054:
+case 4055:
+case 4056:
+case 4057:
+case 4058:
+case 4059:
+case 4060:
+case 4061:
+case 4062:
+case 4063:
+case 4064:
+case 4065:
+case 4066:
+case 4067:
+case 4068:
+case 4069:
+case 4070:
+case 4071:
+case 4072:
+case 4073:
+case 4074:
+case 4075:
+case 4076:
+case 4077:
+case 4078:
+case 4079:
+case 4080:
+case 4081:
+case 4082:
+case 4083:
+case 4084:
+case 4085:
+case 4086:
+case 4087:
+case 4088:
+case 4089:
+case 4090:
+case 4091:
+case 4092:
+case 4093:
+case 4094:
+case 4095:
+case 4096:
+case 4097:
+case 4098:
+case 4099:
+case 4100:
+case 4101:
+case 4102:
+case 4103:
+case 4104:
+case 4105:
+case 4106:
+case 4107:
+case 4108:
+case 4109:
+case 4110:
+case 4111:
+case 4112:
+case 4113:
+case 4114:
+case 4115:
+case 4116:
+case 4117:
+case 4118:
+case 4119:
+case 4120:
+case 4121:
+case 4122:
+case 4123:
+case 4124:
+case 4125:
+case 4126:
+case 4127:
+case 4128:
+case 4129:
+case 4130:
+case 4131:
+case 4132:
+case 4133:
+case 4134:
+case 4135:
+case 4136:
+case 4137:
+case 4138:
+case 4139:
+case 4140:
+case 4141:
+case 4142:
+case 4143:
+case 4144:
+case 4145:
+case 4146:
+case 4147:
+case 4148:
+case 4149:
+case 4150:
+case 4151:
+case 4152:
+case 4153:
+case 4154:
+case 4155:
+case 4156:
+case 4157:
+case 4158:
+case 4159:
+case 4160:
+case 4161:
+case 4162:
+case 4163:
+case 4164:
+case 4165:
+case 4166:
+case 4167:
+case 4168:
+case 4169:
+case 4170:
+case 4171:
+case 4172:
+case 4173:
+case 4174:
+case 4175:
+case 4176:
+case 4177:
+case 4178:
+case 4179:
+case 4180:
+case 4181:
+case 4182:
+case 4183:
+case 4184:
+case 4185:
+case 4186:
+case 4187:
+case 4188:
+case 4189:
+case 4190:
+case 4191:
+case 4192:
+case 4193:
+case 4194:
+case 4195:
+case 4196:
+case 4197:
+case 4198:
+case 4199:
+case 4200:
+case 4201:
+case 4202:
+case 4203:
+case 4204:
+case 4205:
+case 4206:
+case 4207:
+case 4208:
+case 4209:
+case 4210:
+case 4211:
+case 4212:
+case 4213:
+case 4214:
+case 4215:
+case 4216:
+case 4217:
+case 4218:
+case 4219:
+case 4220:
+case 4221:
+case 4222:
+case 4223:
+case 4224:
+case 4225:
+case 4226:
+case 4227:
+case 4228:
+case 4229:
+case 4230:
+case 4231:
+case 4232:
+case 4233:
+case 4234:
+case 4235:
+case 4236:
+case 4237:
+case 4238:
+case 4239:
+case 4240:
+case 4241:
+case 4242:
+case 4243:
+case 4244:
+case 4245:
+case 4246:
+case 4247:
+case 4248:
+case 4249:
+case 4250:
+case 4251:
+case 4252:
+case 4253:
+case 4254:
+case 4255:
+case 4256:
+case 4257:
+case 4258:
+case 4259:
+case 4260:
+case 4261:
+case 4262:
+case 4263:
+case 4264:
+case 4265:
+case 4266:
+case 4267:
+case 4268:
+case 4269:
+case 4270:
+case 4271:
+case 4272:
+case 4273:
+case 4274:
+case 4275:
+case 4276:
+case 4277:
+case 4278:
+case 4279:
+case 4280:
+case 4281:
+case 4282:
+case 4283:
+case 4284:
+case 4285:
+case 4286:
+case 4287:
+case 4288:
+case 4289:
+case 4290:
+case 4291:
+case 4292:
+case 4293:
+case 4294:
+case 4295:
+case 4296:
+case 4297:
+case 4298:
+case 4299:
+case 4300:
+case 4301:
+case 4302:
+case 4303:
+case 4304:
+case 4305:
+case 4306:
+case 4307:
+case 4308:
+case 4309:
+case 4310:
+case 4311:
+case 4312:
+case 4313:
+case 4314:
+case 4315:
+case 4316:
+case 4317:
+case 4318:
+case 4319:
+case 4320:
+case 4321:
+case 4322:
+case 4323:
+case 4324:
+case 4325:
+case 4326:
+case 4327:
+case 4328:
+case 4329:
+case 4330:
+case 4331:
+case 4332:
+case 4333:
+case 4334:
+case 4335:
+case 4336:
+case 4337:
+case 4338:
+case 4339:
+case 4340:
+case 4341:
+case 4342:
+case 4343:
+case 4344:
+case 4345:
+case 4346:
+case 4347:
+case 4348:
+case 4349:
+case 4350:
+case 4351:
+case 4352:
+case 4353:
+case 4354:
+case 4355:
+case 4356:
+case 4357:
+case 4358:
+case 4359:
+case 4360:
+case 4361:
+case 4362:
+case 4363:
+case 4364:
+case 4365:
+case 4366:
+case 4367:
+case 4368:
+case 4369:
+case 4370:
+case 4371:
+case 4372:
+case 4373:
+case 4374:
+case 4375:
+case 4376:
+case 4377:
+case 4378:
+case 4379:
+case 4380:
+case 4381:
+case 4382:
+case 4383:
+case 4384:
+case 4385:
+case 4386:
+case 4387:
+case 4388:
+case 4389:
+case 4390:
+case 4391:
+case 4392:
+case 4393:
+case 4394:
+case 4395:
+case 4396:
+case 4397:
+case 4398:
+case 4399:
+case 4400:
+case 4401:
+case 4402:
+case 4403:
+case 4404:
+case 4405:
+case 4406:
+case 4407:
+case 4408:
+case 4409:
+case 4410:
+case 4411:
+case 4412:
+case 4413:
+case 4414:
+case 4415:
+case 4416:
+case 4417:
+case 4418:
+case 4419:
+case 4420:
+case 4421:
+case 4422:
+case 4423:
+case 4424:
+case 4425:
+case 4426:
+case 4427:
+case 4428:
+case 4429:
+case 4430:
+case 4431:
+case 4432:
+case 4433:
+case 4434:
+case 4435:
+case 4436:
+case 4437:
+case 4438:
+case 4439:
+case 4440:
+case 4441:
+case 4442:
+case 4443:
+case 4444:
+case 4445:
+case 4446:
+case 4447:
+case 4448:
+case 4449:
+case 4450:
+case 4451:
+case 4452:
+case 4453:
+case 4454:
+case 4455:
+case 4456:
+case 4457:
+case 4458:
+case 4459:
+case 4460:
+case 4461:
+case 4462:
+case 4463:
+case 4464:
+case 4465:
+case 4466:
+case 4467:
+case 4468:
+case 4469:
+case 4470:
+case 4471:
+case 4472:
+case 4473:
+case 4474:
+case 4475:
+case 4476:
+case 4477:
+case 4478:
+case 4479:
+case 4480:
+case 4481:
+case 4482:
+case 4483:
+case 4484:
+case 4485:
+case 4486:
+case 4487:
+case 4488:
+case 4489:
+case 4490:
+case 4491:
+case 4492:
+case 4493:
+case 4494:
+case 4495:
+case 4496:
+case 4497:
+case 4498:
+case 4499:
+case 4500:
+case 4501:
+case 4502:
+case 4503:
+case 4504:
+case 4505:
+case 4506:
+case 4507:
+case 4508:
+case 4509:
+case 4510:
+case 4511:
+case 4512:
+case 4513:
+case 4514:
+case 4515:
+case 4516:
+case 4517:
+case 4518:
+case 4519:
+case 4520:
+case 4521:
+case 4522:
+case 4523:
+case 4524:
+case 4525:
+case 4526:
+case 4527:
+case 4528:
+case 4529:
+case 4530:
+case 4531:
+case 4532:
+case 4533:
+case 4534:
+case 4535:
+case 4536:
+case 4537:
+case 4538:
+case 4539:
+case 4540:
+case 4541:
+case 4542:
+case 4543:
+case 4544:
+case 4545:
+case 4546:
+case 4547:
+case 4548:
+case 4549:
+case 4550:
+case 4551:
+case 4552:
+case 4553:
+case 4554:
+case 4555:
+case 4556:
+case 4557:
+case 4558:
+case 4559:
+case 4560:
+case 4561:
+case 4562:
+case 4563:
+case 4564:
+case 4565:
+case 4566:
+case 4567:
+case 4568:
+case 4569:
+case 4570:
+case 4571:
+case 4572:
+case 4573:
+case 4574:
+case 4575:
+case 4576:
+case 4577:
+case 4578:
+case 4579:
+case 4580:
+case 4581:
+case 4582:
+case 4583:
+case 4584:
+case 4585:
+case 4586:
+case 4587:
+case 4588:
+case 4589:
+case 4590:
+case 4591:
+case 4592:
+case 4593:
+case 4594:
+case 4595:
+case 4596:
+case 4597:
+case 4598:
+case 4599:
+case 4600:
+case 4601:
+case 4602:
+case 4603:
+case 4604:
+case 4605:
+case 4606:
+case 4607:
+case 4608:
+case 4609:
+case 4610:
+case 4611:
+case 4612:
+case 4613:
+case 4614:
+case 4615:
+case 4616:
+case 4617:
+case 4618:
+case 4619:
+case 4620:
+case 4621:
+case 4622:
+case 4623:
+case 4624:
+case 4625:
+case 4626:
+case 4627:
+case 4628:
+case 4629:
+case 4630:
+case 4631:
+case 4632:
+case 4633:
+case 4634:
+case 4635:
+case 4636:
+case 4637:
+case 4638:
+case 4639:
+case 4640:
+case 4641:
+case 4642:
+case 4643:
+case 4644:
+case 4645:
+case 4646:
+case 4647:
+case 4648:
+case 4649:
+case 4650:
+case 4651:
+case 4652:
+case 4653:
+case 4654:
+case 4655:
+case 4656:
+case 4657:
+case 4658:
+case 4659:
+case 4660:
+case 4661:
+case 4662:
+case 4663:
+case 4664:
+case 4665:
+case 4666:
+case 4667:
+case 4668:
+case 4669:
+case 4670:
+case 4671:
+case 4672:
+case 4673:
+case 4674:
+case 4675:
+case 4676:
+case 4677:
+case 4678:
+case 4679:
+case 4680:
+case 4681:
+case 4682:
+case 4683:
+case 4684:
+case 4685:
+case 4686:
+case 4687:
+case 4688:
+case 4689:
+case 4690:
+case 4691:
+case 4692:
+case 4693:
+case 4694:
+case 4695:
+case 4696:
+case 4697:
+case 4698:
+case 4699:
+case 4700:
+case 4701:
+case 4702:
+case 4703:
+case 4704:
+case 4705:
+case 4706:
+case 4707:
+case 4708:
+case 4709:
+case 4710:
+case 4711:
+case 4712:
+case 4713:
+case 4714:
+case 4715:
+case 4716:
+case 4717:
+case 4718:
+case 4719:
+case 4720:
+case 4721:
+case 4722:
+case 4723:
+case 4724:
+case 4725:
+case 4726:
+case 4727:
+case 4728:
+case 4729:
+case 4730:
+case 4731:
+case 4732:
+case 4733:
+case 4734:
+case 4735:
+case 4736:
+case 4737:
+case 4738:
+case 4739:
+case 4740:
+case 4741:
+case 4742:
+case 4743:
+case 4744:
+case 4745:
+case 4746:
+case 4747:
+case 4748:
+case 4749:
+case 4750:
+case 4751:
+case 4752:
+case 4753:
+case 4754:
+case 4755:
+case 4756:
+case 4757:
+case 4758:
+case 4759:
+case 4760:
+case 4761:
+case 4762:
+case 4763:
+case 4764:
+case 4765:
+case 4766:
+case 4767:
+case 4768:
+case 4769:
+case 4770:
+case 4771:
+case 4772:
+case 4773:
+case 4774:
+case 4775:
+case 4776:
+case 4777:
+case 4778:
+case 4779:
+case 4780:
+case 4781:
+case 4782:
+case 4783:
+case 4784:
+case 4785:
+case 4786:
+case 4787:
+case 4788:
+case 4789:
+case 4790:
+case 4791:
+case 4792:
+case 4793:
+case 4794:
+case 4795:
+case 4796:
+case 4797:
+case 4798:
+case 4799:
+case 4800:
+case 4801:
+case 4802:
+case 4803:
+case 4804:
+case 4805:
+case 4806:
+case 4807:
+case 4808:
+case 4809:
+case 4810:
+case 4811:
+case 4812:
+case 4813:
+case 4814:
+case 4815:
+case 4816:
+case 4817:
+case 4818:
+case 4819:
+case 4820:
+case 4821:
+case 4822:
+case 4823:
+case 4824:
+case 4825:
+case 4826:
+case 4827:
+case 4828:
+case 4829:
+case 4830:
+case 4831:
+case 4832:
+case 4833:
+case 4834:
+case 4835:
+case 4836:
+case 4837:
+case 4838:
+case 4839:
+case 4840:
+case 4841:
+case 4842:
+case 4843:
+case 4844:
+case 4845:
+case 4846:
+case 4847:
+case 4848:
+case 4849:
+case 4850:
+case 4851:
+case 4852:
+case 4853:
+case 4854:
+case 4855:
+case 4856:
+case 4857:
+case 4858:
+case 4859:
+case 4860:
+case 4861:
+case 4862:
+case 4863:
+case 4864:
+case 4865:
+case 4866:
+case 4867:
+case 4868:
+case 4869:
+case 4870:
+case 4871:
+case 4872:
+case 4873:
+case 4874:
+case 4875:
+case 4876:
+case 4877:
+case 4878:
+case 4879:
+case 4880:
+case 4881:
+case 4882:
+case 4883:
+case 4884:
+case 4885:
+case 4886:
+case 4887:
+case 4888:
+case 4889:
+case 4890:
+case 4891:
+case 4892:
+case 4893:
+case 4894:
+case 4895:
+case 4896:
+case 4897:
+case 4898:
+case 4899:
+case 4900:
+case 4901:
+case 4902:
+case 4903:
+case 4904:
+case 4905:
+case 4906:
+case 4907:
+case 4908:
+case 4909:
+case 4910:
+case 4911:
+case 4912:
+case 4913:
+case 4914:
+case 4915:
+case 4916:
+case 4917:
+case 4918:
+case 4919:
+case 4920:
+case 4921:
+case 4922:
+case 4923:
+case 4924:
+case 4925:
+case 4926:
+case 4927:
+case 4928:
+case 4929:
+case 4930:
+case 4931:
+case 4932:
+case 4933:
+case 4934:
+case 4935:
+case 4936:
+case 4937:
+case 4938:
+case 4939:
+case 4940:
+case 4941:
+case 4942:
+case 4943:
+case 4944:
+case 4945:
+case 4946:
+case 4947:
+case 4948:
+case 4949:
+case 4950:
+case 4951:
+case 4952:
+case 4953:
+case 4954:
+case 4955:
+case 4956:
+case 4957:
+case 4958:
+case 4959:
+case 4960:
+case 4961:
+case 4962:
+case 4963:
+case 4964:
+case 4965:
+case 4966:
+case 4967:
+case 4968:
+case 4969:
+case 4970:
+case 4971:
+case 4972:
+case 4973:
+case 4974:
+case 4975:
+case 4976:
+case 4977:
+case 4978:
+case 4979:
+case 4980:
+case 4981:
+case 4982:
+case 4983:
+case 4984:
+case 4985:
+case 4986:
+case 4987:
+case 4988:
+case 4989:
+case 4990:
+case 4991:
+case 4992:
+case 4993:
+case 4994:
+case 4995:
+case 4996:
+case 4997:
+case 4998:
+case 4999:
+case 5000:
+case 5001:
+case 5002:
+case 5003:
+case 5004:
+case 5005:
+case 5006:
+case 5007:
+case 5008:
+case 5009:
+case 5010:
+case 5011:
+case 5012:
+case 5013:
+case 5014:
+case 5015:
+case 5016:
+case 5017:
+case 5018:
+case 5019:
+case 5020:
+case 5021:
+case 5022:
+case 5023:
+case 5024:
+case 5025:
+case 5026:
+case 5027:
+case 5028:
+case 5029:
+case 5030:
+case 5031:
+case 5032:
+case 5033:
+case 5034:
+case 5035:
+case 5036:
+case 5037:
+case 5038:
+case 5039:
+case 5040:
+case 5041:
+case 5042:
+case 5043:
+case 5044:
+case 5045:
+case 5046:
+case 5047:
+case 5048:
+case 5049:
+case 5050:
+case 5051:
+case 5052:
+case 5053:
+case 5054:
+case 5055:
+case 5056:
+case 5057:
+case 5058:
+case 5059:
+case 5060:
+case 5061:
+case 5062:
+case 5063:
+case 5064:
+case 5065:
+case 5066:
+case 5067:
+case 5068:
+case 5069:
+case 5070:
+case 5071:
+case 5072:
+case 5073:
+case 5074:
+case 5075:
+case 5076:
+case 5077:
+case 5078:
+case 5079:
+case 5080:
+case 5081:
+case 5082:
+case 5083:
+case 5084:
+case 5085:
+case 5086:
+case 5087:
+case 5088:
+case 5089:
+case 5090:
+case 5091:
+case 5092:
+case 5093:
+case 5094:
+case 5095:
+case 5096:
+case 5097:
+case 5098:
+case 5099:
+case 5100:
+case 5101:
+case 5102:
+case 5103:
+case 5104:
+case 5105:
+case 5106:
+case 5107:
+case 5108:
+case 5109:
+case 5110:
+case 5111:
+case 5112:
+case 5113:
+case 5114:
+case 5115:
+case 5116:
+case 5117:
+case 5118:
+case 5119:
+case 5120:
+case 5121:
+case 5122:
+case 5123:
+case 5124:
+case 5125:
+case 5126:
+case 5127:
+case 5128:
+case 5129:
+case 5130:
+case 5131:
+case 5132:
+case 5133:
+case 5134:
+case 5135:
+case 5136:
+case 5137:
+case 5138:
+case 5139:
+case 5140:
+case 5141:
+case 5142:
+case 5143:
+case 5144:
+case 5145:
+case 5146:
+case 5147:
+case 5148:
+case 5149:
+case 5150:
+case 5151:
+case 5152:
+case 5153:
+case 5154:
+case 5155:
+case 5156:
+case 5157:
+case 5158:
+case 5159:
+case 5160:
+case 5161:
+case 5162:
+case 5163:
+case 5164:
+case 5165:
+case 5166:
+case 5167:
+case 5168:
+case 5169:
+case 5170:
+case 5171:
+case 5172:
+case 5173:
+case 5174:
+case 5175:
+case 5176:
+case 5177:
+case 5178:
+case 5179:
+case 5180:
+case 5181:
+case 5182:
+case 5183:
+case 5184:
+case 5185:
+case 5186:
+case 5187:
+case 5188:
+case 5189:
+case 5190:
+case 5191:
+case 5192:
+case 5193:
+case 5194:
+case 5195:
+case 5196:
+case 5197:
+case 5198:
+case 5199:
+case 5200:
+case 5201:
+case 5202:
+case 5203:
+case 5204:
+case 5205:
+case 5206:
+case 5207:
+case 5208:
+case 5209:
+case 5210:
+case 5211:
+case 5212:
+case 5213:
+case 5214:
+case 5215:
+case 5216:
+case 5217:
+case 5218:
+case 5219:
+case 5220:
+case 5221:
+case 5222:
+case 5223:
+case 5224:
+case 5225:
+case 5226:
+case 5227:
+case 5228:
+case 5229:
+case 5230:
+case 5231:
+case 5232:
+case 5233:
+case 5234:
+case 5235:
+case 5236:
+case 5237:
+case 5238:
+case 5239:
+case 5240:
+case 5241:
+case 5242:
+case 5243:
+case 5244:
+case 5245:
+case 5246:
+case 5247:
+case 5248:
+case 5249:
+case 5250:
+case 5251:
+case 5252:
+case 5253:
+case 5254:
+case 5255:
+case 5256:
+case 5257:
+case 5258:
+case 5259:
+case 5260:
+case 5261:
+case 5262:
+case 5263:
+case 5264:
+case 5265:
+case 5266:
+case 5267:
+case 5268:
+case 5269:
+case 5270:
+case 5271:
+case 5272:
+case 5273:
+case 5274:
+case 5275:
+case 5276:
+case 5277:
+case 5278:
+case 5279:
+case 5280:
+case 5281:
+case 5282:
+case 5283:
+case 5284:
+case 5285:
+case 5286:
+case 5287:
+case 5288:
+case 5289:
+case 5290:
+case 5291:
+case 5292:
+case 5293:
+case 5294:
+case 5295:
+case 5296:
+case 5297:
+case 5298:
+case 5299:
+case 5300:
+case 5301:
+case 5302:
+case 5303:
+case 5304:
+case 5305:
+case 5306:
+case 5307:
+case 5308:
+case 5309:
+case 5310:
+case 5311:
+case 5312:
+case 5313:
+case 5314:
+case 5315:
+case 5316:
+case 5317:
+case 5318:
+case 5319:
+case 5320:
+case 5321:
+case 5322:
+case 5323:
+case 5324:
+case 5325:
+case 5326:
+case 5327:
+case 5328:
+case 5329:
+case 5330:
+case 5331:
+case 5332:
+case 5333:
+case 5334:
+case 5335:
+case 5336:
+case 5337:
+case 5338:
+case 5339:
+case 5340:
+case 5341:
+case 5342:
+case 5343:
+case 5344:
+case 5345:
+case 5346:
+case 5347:
+case 5348:
+case 5349:
+case 5350:
+case 5351:
+case 5352:
+case 5353:
+case 5354:
+case 5355:
+case 5356:
+case 5357:
+case 5358:
+case 5359:
+case 5360:
+case 5361:
+case 5362:
+case 5363:
+case 5364:
+case 5365:
+case 5366:
+case 5367:
+case 5368:
+case 5369:
+case 5370:
+case 5371:
+case 5372:
+case 5373:
+case 5374:
+case 5375:
+case 5376:
+case 5377:
+case 5378:
+case 5379:
+case 5380:
+case 5381:
+case 5382:
+case 5383:
+case 5384:
+case 5385:
+case 5386:
+case 5387:
+case 5388:
+case 5389:
+case 5390:
+case 5391:
+case 5392:
+case 5393:
+case 5394:
+case 5395:
+case 5396:
+case 5397:
+case 5398:
+case 5399:
+case 5400:
+case 5401:
+case 5402:
+case 5403:
+case 5404:
+case 5405:
+case 5406:
+case 5407:
+case 5408:
+case 5409:
+case 5410:
+case 5411:
+case 5412:
+case 5413:
+case 5414:
+case 5415:
+case 5416:
+case 5417:
+case 5418:
+case 5419:
+case 5420:
+case 5421:
+case 5422:
+case 5423:
+case 5424:
+case 5425:
+case 5426:
+case 5427:
+case 5428:
+case 5429:
+case 5430:
+case 5431:
+case 5432:
+case 5433:
+case 5434:
+case 5435:
+case 5436:
+case 5437:
+case 5438:
+case 5439:
+case 5440:
+case 5441:
+case 5442:
+case 5443:
+case 5444:
+case 5445:
+case 5446:
+case 5447:
+case 5448:
+case 5449:
+case 5450:
+case 5451:
+case 5452:
+case 5453:
+case 5454:
+case 5455:
+case 5456:
+case 5457:
+case 5458:
+case 5459:
+case 5460:
+case 5461:
+case 5462:
+case 5463:
+case 5464:
+case 5465:
+case 5466:
+case 5467:
+case 5468:
+case 5469:
+case 5470:
+case 5471:
+case 5472:
+case 5473:
+case 5474:
+case 5475:
+case 5476:
+case 5477:
+case 5478:
+case 5479:
+case 5480:
+case 5481:
+case 5482:
+case 5483:
+case 5484:
+case 5485:
+case 5486:
+case 5487:
+case 5488:
+case 5489:
+case 5490:
+case 5491:
+case 5492:
+case 5493:
+case 5494:
+case 5495:
+case 5496:
+case 5497:
+case 5498:
+case 5499:
+case 5500:
+case 5501:
+case 5502:
+case 5503:
+case 5504:
+case 5505:
+case 5506:
+case 5507:
+case 5508:
+case 5509:
+case 5510:
+case 5511:
+case 5512:
+case 5513:
+case 5514:
+case 5515:
+case 5516:
+case 5517:
+case 5518:
+case 5519:
+case 5520:
+case 5521:
+case 5522:
+case 5523:
+case 5524:
+case 5525:
+case 5526:
+case 5527:
+case 5528:
+case 5529:
+case 5530:
+case 5531:
+case 5532:
+case 5533:
+case 5534:
+case 5535:
+case 5536:
+case 5537:
+case 5538:
+case 5539:
+case 5540:
+case 5541:
+case 5542:
+case 5543:
+case 5544:
+case 5545:
+case 5546:
+case 5547:
+case 5548:
+case 5549:
+case 5550:
+case 5551:
+case 5552:
+case 5553:
+case 5554:
+case 5555:
+case 5556:
+case 5557:
+case 5558:
+case 5559:
+case 5560:
+case 5561:
+case 5562:
+case 5563:
+case 5564:
+case 5565:
+case 5566:
+case 5567:
+case 5568:
+case 5569:
+case 5570:
+case 5571:
+case 5572:
+case 5573:
+case 5574:
+case 5575:
+case 5576:
+case 5577:
+case 5578:
+case 5579:
+case 5580:
+case 5581:
+case 5582:
+case 5583:
+case 5584:
+case 5585:
+case 5586:
+case 5587:
+case 5588:
+case 5589:
+case 5590:
+case 5591:
+case 5592:
+case 5593:
+case 5594:
+case 5595:
+case 5596:
+case 5597:
+case 5598:
+case 5599:
+case 5600:
+case 5601:
+case 5602:
+case 5603:
+case 5604:
+case 5605:
+case 5606:
+case 5607:
+case 5608:
+case 5609:
+case 5610:
+case 5611:
+case 5612:
+case 5613:
+case 5614:
+case 5615:
+case 5616:
+case 5617:
+case 5618:
+case 5619:
+case 5620:
+case 5621:
+case 5622:
+case 5623:
+case 5624:
+case 5625:
+case 5626:
+case 5627:
+case 5628:
+case 5629:
+case 5630:
+case 5631:
+case 5632:
+case 5633:
+case 5634:
+case 5635:
+case 5636:
+case 5637:
+case 5638:
+case 5639:
+case 5640:
+case 5641:
+case 5642:
+case 5643:
+case 5644:
+case 5645:
+case 5646:
+case 5647:
+case 5648:
+case 5649:
+case 5650:
+case 5651:
+case 5652:
+case 5653:
+case 5654:
+case 5655:
+case 5656:
+case 5657:
+case 5658:
+case 5659:
+case 5660:
+case 5661:
+case 5662:
+case 5663:
+case 5664:
+case 5665:
+case 5666:
+case 5667:
+case 5668:
+case 5669:
+case 5670:
+case 5671:
+case 5672:
+case 5673:
+case 5674:
+case 5675:
+case 5676:
+case 5677:
+case 5678:
+case 5679:
+case 5680:
+case 5681:
+case 5682:
+case 5683:
+case 5684:
+case 5685:
+case 5686:
+case 5687:
+case 5688:
+case 5689:
+case 5690:
+case 5691:
+case 5692:
+case 5693:
+case 5694:
+case 5695:
+case 5696:
+case 5697:
+case 5698:
+case 5699:
+case 5700:
+case 5701:
+case 5702:
+case 5703:
+case 5704:
+case 5705:
+case 5706:
+case 5707:
+case 5708:
+case 5709:
+case 5710:
+case 5711:
+case 5712:
+case 5713:
+case 5714:
+case 5715:
+case 5716:
+case 5717:
+case 5718:
+case 5719:
+case 5720:
+case 5721:
+case 5722:
+case 5723:
+case 5724:
+case 5725:
+case 5726:
+case 5727:
+case 5728:
+case 5729:
+case 5730:
+case 5731:
+case 5732:
+case 5733:
+case 5734:
+case 5735:
+case 5736:
+case 5737:
+case 5738:
+case 5739:
+case 5740:
+case 5741:
+case 5742:
+case 5743:
+case 5744:
+case 5745:
+case 5746:
+case 5747:
+case 5748:
+case 5749:
+case 5750:
+case 5751:
+case 5752:
+case 5753:
+case 5754:
+case 5755:
+case 5756:
+case 5757:
+case 5758:
+case 5759:
+case 5760:
+case 5761:
+case 5762:
+case 5763:
+case 5764:
+case 5765:
+case 5766:
+case 5767:
+case 5768:
+case 5769:
+case 5770:
+case 5771:
+case 5772:
+case 5773:
+case 5774:
+case 5775:
+case 5776:
+case 5777:
+case 5778:
+case 5779:
+case 5780:
+case 5781:
+case 5782:
+case 5783:
+case 5784:
+case 5785:
+case 5786:
+case 5787:
+case 5788:
+case 5789:
+case 5790:
+case 5791:
+case 5792:
+case 5793:
+case 5794:
+case 5795:
+case 5796:
+case 5797:
+case 5798:
+case 5799:
+case 5800:
+case 5801:
+case 5802:
+case 5803:
+case 5804:
+case 5805:
+case 5806:
+case 5807:
+case 5808:
+case 5809:
+case 5810:
+case 5811:
+case 5812:
+case 5813:
+case 5814:
+case 5815:
+case 5816:
+case 5817:
+case 5818:
+case 5819:
+case 5820:
+case 5821:
+case 5822:
+case 5823:
+case 5824:
+case 5825:
+case 5826:
+case 5827:
+case 5828:
+case 5829:
+case 5830:
+case 5831:
+case 5832:
+case 5833:
+case 5834:
+case 5835:
+case 5836:
+case 5837:
+case 5838:
+case 5839:
+case 5840:
+case 5841:
+case 5842:
+case 5843:
+case 5844:
+case 5845:
+case 5846:
+case 5847:
+case 5848:
+case 5849:
+case 5850:
+case 5851:
+case 5852:
+case 5853:
+case 5854:
+case 5855:
+case 5856:
+case 5857:
+case 5858:
+case 5859:
+case 5860:
+case 5861:
+case 5862:
+case 5863:
+case 5864:
+case 5865:
+case 5866:
+case 5867:
+case 5868:
+case 5869:
+case 5870:
+case 5871:
+case 5872:
+case 5873:
+case 5874:
+case 5875:
+case 5876:
+case 5877:
+case 5878:
+case 5879:
+case 5880:
+case 5881:
+case 5882:
+case 5883:
+case 5884:
+case 5885:
+case 5886:
+case 5887:
+case 5888:
+case 5889:
+case 5890:
+case 5891:
+case 5892:
+case 5893:
+case 5894:
+case 5895:
+case 5896:
+case 5897:
+case 5898:
+case 5899:
+case 5900:
+case 5901:
+case 5902:
+case 5903:
+case 5904:
+case 5905:
+case 5906:
+case 5907:
+case 5908:
+case 5909:
+case 5910:
+case 5911:
+case 5912:
+case 5913:
+case 5914:
+case 5915:
+case 5916:
+case 5917:
+case 5918:
+case 5919:
+case 5920:
+case 5921:
+case 5922:
+case 5923:
+case 5924:
+case 5925:
+case 5926:
+case 5927:
+case 5928:
+case 5929:
+case 5930:
+case 5931:
+case 5932:
+case 5933:
+case 5934:
+case 5935:
+case 5936:
+case 5937:
+case 5938:
+case 5939:
+case 5940:
+case 5941:
+case 5942:
+case 5943:
+case 5944:
+case 5945:
+case 5946:
+case 5947:
+case 5948:
+case 5949:
+case 5950:
+case 5951:
+case 5952:
+case 5953:
+case 5954:
+case 5955:
+case 5956:
+case 5957:
+case 5958:
+case 5959:
+case 5960:
+case 5961:
+case 5962:
+case 5963:
+case 5964:
+case 5965:
+case 5966:
+case 5967:
+case 5968:
+case 5969:
+case 5970:
+case 5971:
+case 5972:
+case 5973:
+case 5974:
+case 5975:
+case 5976:
+case 5977:
+case 5978:
+case 5979:
+case 5980:
+case 5981:
+case 5982:
+case 5983:
+case 5984:
+case 5985:
+case 5986:
+case 5987:
+case 5988:
+case 5989:
+case 5990:
+case 5991:
+case 5992:
+case 5993:
+case 5994:
+case 5995:
+case 5996:
+case 5997:
+case 5998:
+case 5999:
+case 6000:
+case 6001:
+case 6002:
+case 6003:
+case 6004:
+case 6005:
+case 6006:
+case 6007:
+case 6008:
+case 6009:
+case 6010:
+case 6011:
+case 6012:
+case 6013:
+case 6014:
+case 6015:
+case 6016:
+case 6017:
+case 6018:
+case 6019:
+case 6020:
+case 6021:
+case 6022:
+case 6023:
+case 6024:
+case 6025:
+case 6026:
+case 6027:
+case 6028:
+case 6029:
+case 6030:
+case 6031:
+case 6032:
+case 6033:
+case 6034:
+case 6035:
+case 6036:
+case 6037:
+case 6038:
+case 6039:
+case 6040:
+case 6041:
+case 6042:
+case 6043:
+case 6044:
+case 6045:
+case 6046:
+case 6047:
+case 6048:
+case 6049:
+case 6050:
+case 6051:
+case 6052:
+case 6053:
+case 6054:
+case 6055:
+case 6056:
+case 6057:
+case 6058:
+case 6059:
+case 6060:
+case 6061:
+case 6062:
+case 6063:
+case 6064:
+case 6065:
+case 6066:
+case 6067:
+case 6068:
+case 6069:
+case 6070:
+case 6071:
+case 6072:
+case 6073:
+case 6074:
+case 6075:
+case 6076:
+case 6077:
+case 6078:
+case 6079:
+case 6080:
+case 6081:
+case 6082:
+case 6083:
+case 6084:
+case 6085:
+case 6086:
+case 6087:
+case 6088:
+case 6089:
+case 6090:
+case 6091:
+case 6092:
+case 6093:
+case 6094:
+case 6095:
+case 6096:
+case 6097:
+case 6098:
+case 6099:
+case 6100:
+case 6101:
+case 6102:
+case 6103:
+case 6104:
+case 6105:
+case 6106:
+case 6107:
+case 6108:
+case 6109:
+case 6110:
+case 6111:
+case 6112:
+case 6113:
+case 6114:
+case 6115:
+case 6116:
+case 6117:
+case 6118:
+case 6119:
+case 6120:
+case 6121:
+case 6122:
+case 6123:
+case 6124:
+case 6125:
+case 6126:
+case 6127:
+case 6128:
+case 6129:
+case 6130:
+case 6131:
+case 6132:
+case 6133:
+case 6134:
+case 6135:
+case 6136:
+case 6137:
+case 6138:
+case 6139:
+case 6140:
+case 6141:
+case 6142:
+case 6143:
+case 6144:
+case 6145:
+case 6146:
+case 6147:
+case 6148:
+case 6149:
+case 6150:
+case 6151:
+case 6152:
+case 6153:
+case 6154:
+case 6155:
+case 6156:
+case 6157:
+case 6158:
+case 6159:
+case 6160:
+case 6161:
+case 6162:
+case 6163:
+case 6164:
+case 6165:
+case 6166:
+case 6167:
+case 6168:
+case 6169:
+case 6170:
+case 6171:
+case 6172:
+case 6173:
+case 6174:
+case 6175:
+case 6176:
+case 6177:
+case 6178:
+case 6179:
+case 6180:
+case 6181:
+case 6182:
+case 6183:
+case 6184:
+case 6185:
+case 6186:
+case 6187:
+case 6188:
+case 6189:
+case 6190:
+case 6191:
+case 6192:
+case 6193:
+case 6194:
+case 6195:
+case 6196:
+case 6197:
+case 6198:
+case 6199:
+case 6200:
+case 6201:
+case 6202:
+case 6203:
+case 6204:
+case 6205:
+case 6206:
+case 6207:
+case 6208:
+case 6209:
+case 6210:
+case 6211:
+case 6212:
+case 6213:
+case 6214:
+case 6215:
+case 6216:
+case 6217:
+case 6218:
+case 6219:
+case 6220:
+case 6221:
+case 6222:
+case 6223:
+case 6224:
+case 6225:
+case 6226:
+case 6227:
+case 6228:
+case 6229:
+case 6230:
+case 6231:
+case 6232:
+case 6233:
+case 6234:
+case 6235:
+case 6236:
+case 6237:
+case 6238:
+case 6239:
+case 6240:
+case 6241:
+case 6242:
+case 6243:
+case 6244:
+case 6245:
+case 6246:
+case 6247:
+case 6248:
+case 6249:
+case 6250:
+case 6251:
+case 6252:
+case 6253:
+case 6254:
+case 6255:
+case 6256:
+case 6257:
+case 6258:
+case 6259:
+case 6260:
+case 6261:
+case 6262:
+case 6263:
+case 6264:
+case 6265:
+case 6266:
+case 6267:
+case 6268:
+case 6269:
+case 6270:
+case 6271:
+case 6272:
+case 6273:
+case 6274:
+case 6275:
+case 6276:
+case 6277:
+case 6278:
+case 6279:
+case 6280:
+case 6281:
+case 6282:
+case 6283:
+case 6284:
+case 6285:
+case 6286:
+case 6287:
+case 6288:
+case 6289:
+case 6290:
+case 6291:
+case 6292:
+case 6293:
+case 6294:
+case 6295:
+case 6296:
+case 6297:
+case 6298:
+case 6299:
+case 6300:
+case 6301:
+case 6302:
+case 6303:
+case 6304:
+case 6305:
+case 6306:
+case 6307:
+case 6308:
+case 6309:
+case 6310:
+case 6311:
+case 6312:
+case 6313:
+case 6314:
+case 6315:
+case 6316:
+case 6317:
+case 6318:
+case 6319:
+case 6320:
+case 6321:
+case 6322:
+case 6323:
+case 6324:
+case 6325:
+case 6326:
+case 6327:
+case 6328:
+case 6329:
+case 6330:
+case 6331:
+case 6332:
+case 6333:
+case 6334:
+case 6335:
+case 6336:
+case 6337:
+case 6338:
+case 6339:
+case 6340:
+case 6341:
+case 6342:
+case 6343:
+case 6344:
+case 6345:
+case 6346:
+case 6347:
+case 6348:
+case 6349:
+case 6350:
+case 6351:
+case 6352:
+case 6353:
+case 6354:
+case 6355:
+case 6356:
+case 6357:
+case 6358:
+case 6359:
+case 6360:
+case 6361:
+case 6362:
+case 6363:
+case 6364:
+case 6365:
+case 6366:
+case 6367:
+case 6368:
+case 6369:
+case 6370:
+case 6371:
+case 6372:
+case 6373:
+case 6374:
+case 6375:
+case 6376:
+case 6377:
+case 6378:
+case 6379:
+case 6380:
+case 6381:
+case 6382:
+case 6383:
+case 6384:
+case 6385:
+case 6386:
+case 6387:
+case 6388:
+case 6389:
+case 6390:
+case 6391:
+case 6392:
+case 6393:
+case 6394:
+case 6395:
+case 6396:
+case 6397:
+case 6398:
+case 6399:
+case 6400:
+case 6401:
+case 6402:
+case 6403:
+case 6404:
+case 6405:
+case 6406:
+case 6407:
+case 6408:
+case 6409:
+case 6410:
+case 6411:
+case 6412:
+case 6413:
+case 6414:
+case 6415:
+case 6416:
+case 6417:
+case 6418:
+case 6419:
+case 6420:
+case 6421:
+case 6422:
+case 6423:
+case 6424:
+case 6425:
+case 6426:
+case 6427:
+case 6428:
+case 6429:
+case 6430:
+case 6431:
+case 6432:
+case 6433:
+case 6434:
+case 6435:
+case 6436:
+case 6437:
+case 6438:
+case 6439:
+case 6440:
+case 6441:
+case 6442:
+case 6443:
+case 6444:
+case 6445:
+case 6446:
+case 6447:
+case 6448:
+case 6449:
+case 6450:
+case 6451:
+case 6452:
+case 6453:
+case 6454:
+case 6455:
+case 6456:
+case 6457:
+case 6458:
+case 6459:
+case 6460:
+case 6461:
+case 6462:
+case 6463:
+case 6464:
+case 6465:
+case 6466:
+case 6467:
+case 6468:
+case 6469:
+case 6470:
+case 6471:
+case 6472:
+case 6473:
+case 6474:
+case 6475:
+case 6476:
+case 6477:
+case 6478:
+case 6479:
+case 6480:
+case 6481:
+case 6482:
+case 6483:
+case 6484:
+case 6485:
+case 6486:
+case 6487:
+case 6488:
+case 6489:
+case 6490:
+case 6491:
+case 6492:
+case 6493:
+case 6494:
+case 6495:
+case 6496:
+case 6497:
+case 6498:
+case 6499:
+case 6500:
+case 6501:
+case 6502:
+case 6503:
+case 6504:
+case 6505:
+case 6506:
+case 6507:
+case 6508:
+case 6509:
+case 6510:
+case 6511:
+case 6512:
+case 6513:
+case 6514:
+case 6515:
+case 6516:
+case 6517:
+case 6518:
+case 6519:
+case 6520:
+case 6521:
+case 6522:
+case 6523:
+case 6524:
+case 6525:
+case 6526:
+case 6527:
+case 6528:
+case 6529:
+case 6530:
+case 6531:
+case 6532:
+case 6533:
+case 6534:
+case 6535:
+case 6536:
+case 6537:
+case 6538:
+case 6539:
+case 6540:
+case 6541:
+case 6542:
+case 6543:
+case 6544:
+case 6545:
+case 6546:
+case 6547:
+case 6548:
+case 6549:
+case 6550:
+case 6551:
+case 6552:
+case 6553:
+case 6554:
+case 6555:
+case 6556:
+case 6557:
+case 6558:
+case 6559:
+case 6560:
+case 6561:
+case 6562:
+case 6563:
+case 6564:
+case 6565:
+case 6566:
+case 6567:
+case 6568:
+case 6569:
+case 6570:
+case 6571:
+case 6572:
+case 6573:
+case 6574:
+case 6575:
+case 6576:
+case 6577:
+case 6578:
+case 6579:
+case 6580:
+case 6581:
+case 6582:
+case 6583:
+case 6584:
+case 6585:
+case 6586:
+case 6587:
+case 6588:
+case 6589:
+case 6590:
+case 6591:
+case 6592:
+case 6593:
+case 6594:
+case 6595:
+case 6596:
+case 6597:
+case 6598:
+case 6599:
+case 6600:
+case 6601:
+case 6602:
+case 6603:
+case 6604:
+case 6605:
+case 6606:
+case 6607:
+case 6608:
+case 6609:
+case 6610:
+case 6611:
+case 6612:
+case 6613:
+case 6614:
+case 6615:
+case 6616:
+case 6617:
+case 6618:
+case 6619:
+case 6620:
+case 6621:
+case 6622:
+case 6623:
+case 6624:
+case 6625:
+case 6626:
+case 6627:
+case 6628:
+case 6629:
+case 6630:
+case 6631:
+case 6632:
+case 6633:
+case 6634:
+case 6635:
+case 6636:
+case 6637:
+case 6638:
+case 6639:
+case 6640:
+case 6641:
+case 6642:
+case 6643:
+case 6644:
+case 6645:
+case 6646:
+case 6647:
+case 6648:
+case 6649:
+case 6650:
+case 6651:
+case 6652:
+case 6653:
+case 6654:
+case 6655:
+case 6656:
+case 6657:
+case 6658:
+case 6659:
+case 6660:
+case 6661:
+case 6662:
+case 6663:
+case 6664:
+case 6665:
+case 6666:
+case 6667:
+case 6668:
+case 6669:
+case 6670:
+case 6671:
+case 6672:
+case 6673:
+case 6674:
+case 6675:
+case 6676:
+case 6677:
+case 6678:
+case 6679:
+case 6680:
+case 6681:
+case 6682:
+case 6683:
+case 6684:
+case 6685:
+case 6686:
+case 6687:
+case 6688:
+case 6689:
+case 6690:
+case 6691:
+case 6692:
+case 6693:
+case 6694:
+case 6695:
+case 6696:
+case 6697:
+case 6698:
+case 6699:
+case 6700:
+case 6701:
+case 6702:
+case 6703:
+case 6704:
+case 6705:
+case 6706:
+case 6707:
+case 6708:
+case 6709:
+case 6710:
+case 6711:
+case 6712:
+case 6713:
+case 6714:
+case 6715:
+case 6716:
+case 6717:
+case 6718:
+case 6719:
+case 6720:
+case 6721:
+case 6722:
+case 6723:
+case 6724:
+case 6725:
+case 6726:
+case 6727:
+case 6728:
+case 6729:
+case 6730:
+case 6731:
+case 6732:
+case 6733:
+case 6734:
+case 6735:
+case 6736:
+case 6737:
+case 6738:
+case 6739:
+case 6740:
+case 6741:
+case 6742:
+case 6743:
+case 6744:
+case 6745:
+case 6746:
+case 6747:
+case 6748:
+case 6749:
+case 6750:
+case 6751:
+case 6752:
+case 6753:
+case 6754:
+case 6755:
+case 6756:
+case 6757:
+case 6758:
+case 6759:
+case 6760:
+case 6761:
+case 6762:
+case 6763:
+case 6764:
+case 6765:
+case 6766:
+case 6767:
+case 6768:
+case 6769:
+case 6770:
+case 6771:
+case 6772:
+case 6773:
+case 6774:
+case 6775:
+case 6776:
+case 6777:
+case 6778:
+case 6779:
+case 6780:
+case 6781:
+case 6782:
+case 6783:
+case 6784:
+case 6785:
+case 6786:
+case 6787:
+case 6788:
+case 6789:
+case 6790:
+case 6791:
+case 6792:
+case 6793:
+case 6794:
+case 6795:
+case 6796:
+case 6797:
+case 6798:
+case 6799:
+case 6800:
+case 6801:
+case 6802:
+case 6803:
+case 6804:
+case 6805:
+case 6806:
+case 6807:
+case 6808:
+case 6809:
+case 6810:
+case 6811:
+case 6812:
+case 6813:
+case 6814:
+case 6815:
+case 6816:
+case 6817:
+case 6818:
+case 6819:
+case 6820:
+case 6821:
+case 6822:
+case 6823:
+case 6824:
+case 6825:
+case 6826:
+case 6827:
+case 6828:
+case 6829:
+case 6830:
+case 6831:
+case 6832:
+case 6833:
+case 6834:
+case 6835:
+case 6836:
+case 6837:
+case 6838:
+case 6839:
+case 6840:
+case 6841:
+case 6842:
+case 6843:
+case 6844:
+case 6845:
+case 6846:
+case 6847:
+case 6848:
+case 6849:
+case 6850:
+case 6851:
+case 6852:
+case 6853:
+case 6854:
+case 6855:
+case 6856:
+case 6857:
+case 6858:
+case 6859:
+case 6860:
+case 6861:
+case 6862:
+case 6863:
+case 6864:
+case 6865:
+case 6866:
+case 6867:
+case 6868:
+case 6869:
+case 6870:
+case 6871:
+case 6872:
+case 6873:
+case 6874:
+case 6875:
+case 6876:
+case 6877:
+case 6878:
+case 6879:
+case 6880:
+case 6881:
+case 6882:
+case 6883:
+case 6884:
+case 6885:
+case 6886:
+case 6887:
+case 6888:
+case 6889:
+case 6890:
+case 6891:
+case 6892:
+case 6893:
+case 6894:
+case 6895:
+case 6896:
+case 6897:
+case 6898:
+case 6899:
+case 6900:
+case 6901:
+case 6902:
+case 6903:
+case 6904:
+case 6905:
+case 6906:
+case 6907:
+case 6908:
+case 6909:
+case 6910:
+case 6911:
+case 6912:
+case 6913:
+case 6914:
+case 6915:
+case 6916:
+case 6917:
+case 6918:
+case 6919:
+case 6920:
+case 6921:
+case 6922:
+case 6923:
+case 6924:
+case 6925:
+case 6926:
+case 6927:
+case 6928:
+case 6929:
+case 6930:
+case 6931:
+case 6932:
+case 6933:
+case 6934:
+case 6935:
+case 6936:
+case 6937:
+case 6938:
+case 6939:
+case 6940:
+case 6941:
+case 6942:
+case 6943:
+case 6944:
+case 6945:
+case 6946:
+case 6947:
+case 6948:
+case 6949:
+case 6950:
+case 6951:
+case 6952:
+case 6953:
+case 6954:
+case 6955:
+case 6956:
+case 6957:
+case 6958:
+case 6959:
+case 6960:
+case 6961:
+case 6962:
+case 6963:
+case 6964:
+case 6965:
+case 6966:
+case 6967:
+case 6968:
+case 6969:
+case 6970:
+case 6971:
+case 6972:
+case 6973:
+case 6974:
+case 6975:
+case 6976:
+case 6977:
+case 6978:
+case 6979:
+case 6980:
+case 6981:
+case 6982:
+case 6983:
+case 6984:
+case 6985:
+case 6986:
+case 6987:
+case 6988:
+case 6989:
+case 6990:
+case 6991:
+case 6992:
+case 6993:
+case 6994:
+case 6995:
+case 6996:
+case 6997:
+case 6998:
+case 6999:
+case 7000:
+case 7001:
+case 7002:
+case 7003:
+case 7004:
+case 7005:
+case 7006:
+case 7007:
+case 7008:
+case 7009:
+case 7010:
+case 7011:
+case 7012:
+case 7013:
+case 7014:
+case 7015:
+case 7016:
+case 7017:
+case 7018:
+case 7019:
+case 7020:
+case 7021:
+case 7022:
+case 7023:
+case 7024:
+case 7025:
+case 7026:
+case 7027:
+case 7028:
+case 7029:
+case 7030:
+case 7031:
+case 7032:
+case 7033:
+case 7034:
+case 7035:
+case 7036:
+case 7037:
+case 7038:
+case 7039:
+case 7040:
+case 7041:
+case 7042:
+case 7043:
+case 7044:
+case 7045:
+case 7046:
+case 7047:
+case 7048:
+case 7049:
+case 7050:
+case 7051:
+case 7052:
+case 7053:
+case 7054:
+case 7055:
+case 7056:
+case 7057:
+case 7058:
+case 7059:
+case 7060:
+case 7061:
+case 7062:
+case 7063:
+case 7064:
+case 7065:
+case 7066:
+case 7067:
+case 7068:
+case 7069:
+case 7070:
+case 7071:
+case 7072:
+case 7073:
+case 7074:
+case 7075:
+case 7076:
+case 7077:
+case 7078:
+case 7079:
+case 7080:
+case 7081:
+case 7082:
+case 7083:
+case 7084:
+case 7085:
+case 7086:
+case 7087:
+case 7088:
+case 7089:
+case 7090:
+case 7091:
+case 7092:
+case 7093:
+case 7094:
+case 7095:
+case 7096:
+case 7097:
+case 7098:
+case 7099:
+case 7100:
+case 7101:
+case 7102:
+case 7103:
+case 7104:
+case 7105:
+case 7106:
+case 7107:
+case 7108:
+case 7109:
+case 7110:
+case 7111:
+case 7112:
+case 7113:
+case 7114:
+case 7115:
+case 7116:
+case 7117:
+case 7118:
+case 7119:
+case 7120:
+case 7121:
+case 7122:
+case 7123:
+case 7124:
+case 7125:
+case 7126:
+case 7127:
+case 7128:
+case 7129:
+case 7130:
+case 7131:
+case 7132:
+case 7133:
+case 7134:
+case 7135:
+case 7136:
+case 7137:
+case 7138:
+case 7139:
+case 7140:
+case 7141:
+case 7142:
+case 7143:
+case 7144:
+case 7145:
+case 7146:
+case 7147:
+case 7148:
+case 7149:
+case 7150:
+case 7151:
+case 7152:
+case 7153:
+case 7154:
+case 7155:
+case 7156:
+case 7157:
+case 7158:
+case 7159:
+case 7160:
+case 7161:
+case 7162:
+case 7163:
+case 7164:
+case 7165:
+case 7166:
+case 7167:
+case 7168:
+case 7169:
+case 7170:
+case 7171:
+case 7172:
+case 7173:
+case 7174:
+case 7175:
+case 7176:
+case 7177:
+case 7178:
+case 7179:
+case 7180:
+case 7181:
+case 7182:
+case 7183:
+case 7184:
+case 7185:
+case 7186:
+case 7187:
+case 7188:
+case 7189:
+case 7190:
+case 7191:
+case 7192:
+case 7193:
+case 7194:
+case 7195:
+case 7196:
+case 7197:
+case 7198:
+case 7199:
+case 7200:
+case 7201:
+case 7202:
+case 7203:
+case 7204:
+case 7205:
+case 7206:
+case 7207:
+case 7208:
+case 7209:
+case 7210:
+case 7211:
+case 7212:
+case 7213:
+case 7214:
+case 7215:
+case 7216:
+case 7217:
+case 7218:
+case 7219:
+case 7220:
+case 7221:
+case 7222:
+case 7223:
+case 7224:
+case 7225:
+case 7226:
+case 7227:
+case 7228:
+case 7229:
+case 7230:
+case 7231:
+case 7232:
+case 7233:
+case 7234:
+case 7235:
+case 7236:
+case 7237:
+case 7238:
+case 7239:
+case 7240:
+case 7241:
+case 7242:
+case 7243:
+case 7244:
+case 7245:
+case 7246:
+case 7247:
+case 7248:
+case 7249:
+case 7250:
+case 7251:
+case 7252:
+case 7253:
+case 7254:
+case 7255:
+case 7256:
+case 7257:
+case 7258:
+case 7259:
+case 7260:
+case 7261:
+case 7262:
+case 7263:
+case 7264:
+case 7265:
+case 7266:
+case 7267:
+case 7268:
+case 7269:
+case 7270:
+case 7271:
+case 7272:
+case 7273:
+case 7274:
+case 7275:
+case 7276:
+case 7277:
+case 7278:
+case 7279:
+case 7280:
+case 7281:
+case 7282:
+case 7283:
+case 7284:
+case 7285:
+case 7286:
+case 7287:
+case 7288:
+case 7289:
+case 7290:
+case 7291:
+case 7292:
+case 7293:
+case 7294:
+case 7295:
+case 7296:
+case 7297:
+case 7298:
+case 7299:
+case 7300:
+case 7301:
+case 7302:
+case 7303:
+case 7304:
+case 7305:
+case 7306:
+case 7307:
+case 7308:
+case 7309:
+case 7310:
+case 7311:
+case 7312:
+case 7313:
+case 7314:
+case 7315:
+case 7316:
+case 7317:
+case 7318:
+case 7319:
+case 7320:
+case 7321:
+case 7322:
+case 7323:
+case 7324:
+case 7325:
+case 7326:
+case 7327:
+case 7328:
+case 7329:
+case 7330:
+case 7331:
+case 7332:
+case 7333:
+case 7334:
+case 7335:
+case 7336:
+case 7337:
+case 7338:
+case 7339:
+case 7340:
+case 7341:
+case 7342:
+case 7343:
+case 7344:
+case 7345:
+case 7346:
+case 7347:
+case 7348:
+case 7349:
+case 7350:
+case 7351:
+case 7352:
+case 7353:
+case 7354:
+case 7355:
+case 7356:
+case 7357:
+case 7358:
+case 7359:
+case 7360:
+case 7361:
+case 7362:
+case 7363:
+case 7364:
+case 7365:
+case 7366:
+case 7367:
+case 7368:
+case 7369:
+case 7370:
+case 7371:
+case 7372:
+case 7373:
+case 7374:
+case 7375:
+case 7376:
+case 7377:
+case 7378:
+case 7379:
+case 7380:
+case 7381:
+case 7382:
+case 7383:
+case 7384:
+case 7385:
+case 7386:
+case 7387:
+case 7388:
+case 7389:
+case 7390:
+case 7391:
+case 7392:
+case 7393:
+case 7394:
+case 7395:
+case 7396:
+case 7397:
+case 7398:
+case 7399:
+case 7400:
+case 7401:
+case 7402:
+case 7403:
+case 7404:
+case 7405:
+case 7406:
+case 7407:
+case 7408:
+case 7409:
+case 7410:
+case 7411:
+case 7412:
+case 7413:
+case 7414:
+case 7415:
+case 7416:
+case 7417:
+case 7418:
+case 7419:
+case 7420:
+case 7421:
+case 7422:
+case 7423:
+case 7424:
+case 7425:
+case 7426:
+case 7427:
+case 7428:
+case 7429:
+case 7430:
+case 7431:
+case 7432:
+case 7433:
+case 7434:
+case 7435:
+case 7436:
+case 7437:
+case 7438:
+case 7439:
+case 7440:
+case 7441:
+case 7442:
+case 7443:
+case 7444:
+case 7445:
+case 7446:
+case 7447:
+case 7448:
+case 7449:
+case 7450:
+case 7451:
+case 7452:
+case 7453:
+case 7454:
+case 7455:
+case 7456:
+case 7457:
+case 7458:
+case 7459:
+case 7460:
+case 7461:
+case 7462:
+case 7463:
+case 7464:
+case 7465:
+case 7466:
+case 7467:
+case 7468:
+case 7469:
+case 7470:
+case 7471:
+case 7472:
+case 7473:
+case 7474:
+case 7475:
+case 7476:
+case 7477:
+case 7478:
+case 7479:
+case 7480:
+case 7481:
+case 7482:
+case 7483:
+case 7484:
+case 7485:
+case 7486:
+case 7487:
+case 7488:
+case 7489:
+case 7490:
+case 7491:
+case 7492:
+case 7493:
+case 7494:
+case 7495:
+case 7496:
+case 7497:
+case 7498:
+case 7499:
+case 7500:
+case 7501:
+case 7502:
+case 7503:
+case 7504:
+case 7505:
+case 7506:
+case 7507:
+case 7508:
+case 7509:
+case 7510:
+case 7511:
+case 7512:
+case 7513:
+case 7514:
+case 7515:
+case 7516:
+case 7517:
+case 7518:
+case 7519:
+case 7520:
+case 7521:
+case 7522:
+case 7523:
+case 7524:
+case 7525:
+case 7526:
+case 7527:
+case 7528:
+case 7529:
+case 7530:
+case 7531:
+case 7532:
+case 7533:
+case 7534:
+case 7535:
+case 7536:
+case 7537:
+case 7538:
+case 7539:
+case 7540:
+case 7541:
+case 7542:
+case 7543:
+case 7544:
+case 7545:
+case 7546:
+case 7547:
+case 7548:
+case 7549:
+case 7550:
+case 7551:
+case 7552:
+case 7553:
+case 7554:
+case 7555:
+case 7556:
+case 7557:
+case 7558:
+case 7559:
+case 7560:
+case 7561:
+case 7562:
+case 7563:
+case 7564:
+case 7565:
+case 7566:
+case 7567:
+case 7568:
+case 7569:
+case 7570:
+case 7571:
+case 7572:
+case 7573:
+case 7574:
+case 7575:
+case 7576:
+case 7577:
+case 7578:
+case 7579:
+case 7580:
+case 7581:
+case 7582:
+case 7583:
+case 7584:
+case 7585:
+case 7586:
+case 7587:
+case 7588:
+case 7589:
+case 7590:
+case 7591:
+case 7592:
+case 7593:
+case 7594:
+case 7595:
+case 7596:
+case 7597:
+case 7598:
+case 7599:
+case 7600:
+case 7601:
+case 7602:
+case 7603:
+case 7604:
+case 7605:
+case 7606:
+case 7607:
+case 7608:
+case 7609:
+case 7610:
+case 7611:
+case 7612:
+case 7613:
+case 7614:
+case 7615:
+case 7616:
+case 7617:
+case 7618:
+case 7619:
+case 7620:
+case 7621:
+case 7622:
+case 7623:
+case 7624:
+case 7625:
+case 7626:
+case 7627:
+case 7628:
+case 7629:
+case 7630:
+case 7631:
+case 7632:
+case 7633:
+case 7634:
+case 7635:
+case 7636:
+case 7637:
+case 7638:
+case 7639:
+case 7640:
+case 7641:
+case 7642:
+case 7643:
+case 7644:
+case 7645:
+case 7646:
+case 7647:
+case 7648:
+case 7649:
+case 7650:
+case 7651:
+case 7652:
+case 7653:
+case 7654:
+case 7655:
+case 7656:
+case 7657:
+case 7658:
+case 7659:
+case 7660:
+case 7661:
+case 7662:
+case 7663:
+case 7664:
+case 7665:
+case 7666:
+case 7667:
+case 7668:
+case 7669:
+case 7670:
+case 7671:
+case 7672:
+case 7673:
+case 7674:
+case 7675:
+case 7676:
+case 7677:
+case 7678:
+case 7679:
+case 7680:
+case 7681:
+case 7682:
+case 7683:
+case 7684:
+case 7685:
+case 7686:
+case 7687:
+case 7688:
+case 7689:
+case 7690:
+case 7691:
+case 7692:
+case 7693:
+case 7694:
+case 7695:
+case 7696:
+case 7697:
+case 7698:
+case 7699:
+case 7700:
+case 7701:
+case 7702:
+case 7703:
+case 7704:
+case 7705:
+case 7706:
+case 7707:
+case 7708:
+case 7709:
+case 7710:
+case 7711:
+case 7712:
+case 7713:
+case 7714:
+case 7715:
+case 7716:
+case 7717:
+case 7718:
+case 7719:
+case 7720:
+case 7721:
+case 7722:
+case 7723:
+case 7724:
+case 7725:
+case 7726:
+case 7727:
+case 7728:
+case 7729:
+case 7730:
+case 7731:
+case 7732:
+case 7733:
+case 7734:
+case 7735:
+case 7736:
+case 7737:
+case 7738:
+case 7739:
+case 7740:
+case 7741:
+case 7742:
+case 7743:
+case 7744:
+case 7745:
+case 7746:
+case 7747:
+case 7748:
+case 7749:
+case 7750:
+case 7751:
+case 7752:
+case 7753:
+case 7754:
+case 7755:
+case 7756:
+case 7757:
+case 7758:
+case 7759:
+case 7760:
+case 7761:
+case 7762:
+case 7763:
+case 7764:
+case 7765:
+case 7766:
+case 7767:
+case 7768:
+case 7769:
+case 7770:
+case 7771:
+case 7772:
+case 7773:
+case 7774:
+case 7775:
+case 7776:
+case 7777:
+case 7778:
+case 7779:
+case 7780:
+case 7781:
+case 7782:
+case 7783:
+case 7784:
+case 7785:
+case 7786:
+case 7787:
+case 7788:
+case 7789:
+case 7790:
+case 7791:
+case 7792:
+case 7793:
+case 7794:
+case 7795:
+case 7796:
+case 7797:
+case 7798:
+case 7799:
+case 7800:
+case 7801:
+case 7802:
+case 7803:
+case 7804:
+case 7805:
+case 7806:
+case 7807:
+case 7808:
+case 7809:
+case 7810:
+case 7811:
+case 7812:
+case 7813:
+case 7814:
+case 7815:
+case 7816:
+case 7817:
+case 7818:
+case 7819:
+case 7820:
+case 7821:
+case 7822:
+case 7823:
+case 7824:
+case 7825:
+case 7826:
+case 7827:
+case 7828:
+case 7829:
+case 7830:
+case 7831:
+case 7832:
+case 7833:
+case 7834:
+case 7835:
+case 7836:
+case 7837:
+case 7838:
+case 7839:
+case 7840:
+case 7841:
+case 7842:
+case 7843:
+case 7844:
+case 7845:
+case 7846:
+case 7847:
+case 7848:
+case 7849:
+case 7850:
+case 7851:
+case 7852:
+case 7853:
+case 7854:
+case 7855:
+case 7856:
+case 7857:
+case 7858:
+case 7859:
+case 7860:
+case 7861:
+case 7862:
+case 7863:
+case 7864:
+case 7865:
+case 7866:
+case 7867:
+case 7868:
+case 7869:
+case 7870:
+case 7871:
+case 7872:
+case 7873:
+case 7874:
+case 7875:
+case 7876:
+case 7877:
+case 7878:
+case 7879:
+case 7880:
+case 7881:
+case 7882:
+case 7883:
+case 7884:
+case 7885:
+case 7886:
+case 7887:
+case 7888:
+case 7889:
+case 7890:
+case 7891:
+case 7892:
+case 7893:
+case 7894:
+case 7895:
+case 7896:
+case 7897:
+case 7898:
+case 7899:
+case 7900:
+case 7901:
+case 7902:
+case 7903:
+case 7904:
+case 7905:
+case 7906:
+case 7907:
+case 7908:
+case 7909:
+case 7910:
+case 7911:
+case 7912:
+case 7913:
+case 7914:
+case 7915:
+case 7916:
+case 7917:
+case 7918:
+case 7919:
+case 7920:
+case 7921:
+case 7922:
+case 7923:
+case 7924:
+case 7925:
+case 7926:
+case 7927:
+case 7928:
+case 7929:
+case 7930:
+case 7931:
+case 7932:
+case 7933:
+case 7934:
+case 7935:
+case 7936:
+case 7937:
+case 7938:
+case 7939:
+case 7940:
+case 7941:
+case 7942:
+case 7943:
+case 7944:
+case 7945:
+case 7946:
+case 7947:
+case 7948:
+case 7949:
+case 7950:
+case 7951:
+case 7952:
+case 7953:
+case 7954:
+case 7955:
+case 7956:
+case 7957:
+case 7958:
+case 7959:
+case 7960:
+case 7961:
+case 7962:
+case 7963:
+case 7964:
+case 7965:
+case 7966:
+case 7967:
+case 7968:
+case 7969:
+case 7970:
+case 7971:
+case 7972:
+case 7973:
+case 7974:
+case 7975:
+case 7976:
+case 7977:
+case 7978:
+case 7979:
+case 7980:
+case 7981:
+case 7982:
+case 7983:
+case 7984:
+case 7985:
+case 7986:
+case 7987:
+case 7988:
+case 7989:
+case 7990:
+case 7991:
+case 7992:
+case 7993:
+case 7994:
+case 7995:
+case 7996:
+case 7997:
+case 7998:
+case 7999:
+case 8000:
+case 8001:
+case 8002:
+case 8003:
+case 8004:
+case 8005:
+case 8006:
+case 8007:
+case 8008:
+case 8009:
+case 8010:
+case 8011:
+case 8012:
+case 8013:
+case 8014:
+case 8015:
+case 8016:
+case 8017:
+case 8018:
+case 8019:
+case 8020:
+case 8021:
+case 8022:
+case 8023:
+case 8024:
+case 8025:
+case 8026:
+case 8027:
+case 8028:
+case 8029:
+case 8030:
+case 8031:
+case 8032:
+case 8033:
+case 8034:
+case 8035:
+case 8036:
+case 8037:
+case 8038:
+case 8039:
+case 8040:
+case 8041:
+case 8042:
+case 8043:
+case 8044:
+case 8045:
+case 8046:
+case 8047:
+case 8048:
+case 8049:
+case 8050:
+case 8051:
+case 8052:
+case 8053:
+case 8054:
+case 8055:
+case 8056:
+case 8057:
+case 8058:
+case 8059:
+case 8060:
+case 8061:
+case 8062:
+case 8063:
+case 8064:
+case 8065:
+case 8066:
+case 8067:
+case 8068:
+case 8069:
+case 8070:
+case 8071:
+case 8072:
+case 8073:
+case 8074:
+case 8075:
+case 8076:
+case 8077:
+case 8078:
+case 8079:
+case 8080:
+case 8081:
+case 8082:
+case 8083:
+case 8084:
+case 8085:
+case 8086:
+case 8087:
+case 8088:
+case 8089:
+case 8090:
+case 8091:
+case 8092:
+case 8093:
+case 8094:
+case 8095:
+case 8096:
+case 8097:
+case 8098:
+case 8099:
+case 8100:
+case 8101:
+case 8102:
+case 8103:
+case 8104:
+case 8105:
+case 8106:
+case 8107:
+case 8108:
+case 8109:
+case 8110:
+case 8111:
+case 8112:
+case 8113:
+case 8114:
+case 8115:
+case 8116:
+case 8117:
+case 8118:
+case 8119:
+case 8120:
+case 8121:
+case 8122:
+case 8123:
+case 8124:
+case 8125:
+case 8126:
+case 8127:
+case 8128:
+case 8129:
+case 8130:
+case 8131:
+case 8132:
+case 8133:
+case 8134:
+case 8135:
+case 8136:
+case 8137:
+case 8138:
+case 8139:
+case 8140:
+case 8141:
+case 8142:
+case 8143:
+case 8144:
+case 8145:
+case 8146:
+case 8147:
+case 8148:
+case 8149:
+case 8150:
+case 8151:
+case 8152:
+case 8153:
+case 8154:
+case 8155:
+case 8156:
+case 8157:
+case 8158:
+case 8159:
+case 8160:
+case 8161:
+case 8162:
+case 8163:
+case 8164:
+case 8165:
+case 8166:
+case 8167:
+case 8168:
+case 8169:
+case 8170:
+case 8171:
+case 8172:
+case 8173:
+case 8174:
+case 8175:
+case 8176:
+case 8177:
+case 8178:
+case 8179:
+case 8180:
+case 8181:
+case 8182:
+case 8183:
+case 8184:
+case 8185:
+case 8186:
+case 8187:
+case 8188:
+case 8189:
+case 8190:
+case 8191:
+case 8192:
+case 8193:
+case 8194:
+case 8195:
+case 8196:
+case 8197:
+case 8198:
+case 8199:
+case 8200:
+case 8201:
+case 8202:
+case 8203:
+case 8204:
+case 8205:
+case 8206:
+case 8207:
+case 8208:
+case 8209:
+case 8210:
+case 8211:
+case 8212:
+case 8213:
+case 8214:
+case 8215:
+case 8216:
+case 8217:
+case 8218:
+case 8219:
+case 8220:
+case 8221:
+case 8222:
+case 8223:
+case 8224:
+case 8225:
+case 8226:
+case 8227:
+case 8228:
+case 8229:
+case 8230:
+case 8231:
+case 8232:
+case 8233:
+case 8234:
+case 8235:
+case 8236:
+case 8237:
+case 8238:
+case 8239:
+case 8240:
+case 8241:
+case 8242:
+case 8243:
+case 8244:
+case 8245:
+case 8246:
+case 8247:
+case 8248:
+case 8249:
+case 8250:
+case 8251:
+case 8252:
+case 8253:
+case 8254:
+case 8255:
+case 8256:
+case 8257:
+case 8258:
+case 8259:
+case 8260:
+case 8261:
+case 8262:
+case 8263:
+case 8264:
+case 8265:
+case 8266:
+case 8267:
+case 8268:
+case 8269:
+case 8270:
+case 8271:
+case 8272:
+case 8273:
+case 8274:
+case 8275:
+case 8276:
+case 8277:
+case 8278:
+case 8279:
+case 8280:
+case 8281:
+case 8282:
+case 8283:
+case 8284:
+case 8285:
+case 8286:
+case 8287:
+case 8288:
+case 8289:
+case 8290:
+case 8291:
+case 8292:
+case 8293:
+case 8294:
+case 8295:
+case 8296:
+case 8297:
+case 8298:
+case 8299:
+case 8300:
+case 8301:
+case 8302:
+case 8303:
+case 8304:
+case 8305:
+case 8306:
+case 8307:
+case 8308:
+case 8309:
+case 8310:
+case 8311:
+case 8312:
+case 8313:
+case 8314:
+case 8315:
+case 8316:
+case 8317:
+case 8318:
+case 8319:
+case 8320:
+case 8321:
+case 8322:
+case 8323:
+case 8324:
+case 8325:
+case 8326:
+case 8327:
+case 8328:
+case 8329:
+case 8330:
+case 8331:
+case 8332:
+case 8333:
+case 8334:
+case 8335:
+case 8336:
+case 8337:
+case 8338:
+case 8339:
+case 8340:
+case 8341:
+case 8342:
+case 8343:
+case 8344:
+case 8345:
+case 8346:
+case 8347:
+case 8348:
+case 8349:
+case 8350:
+case 8351:
+case 8352:
+case 8353:
+case 8354:
+case 8355:
+case 8356:
+case 8357:
+case 8358:
+case 8359:
+case 8360:
+case 8361:
+case 8362:
+case 8363:
+case 8364:
+case 8365:
+case 8366:
+case 8367:
+case 8368:
+case 8369:
+case 8370:
+case 8371:
+case 8372:
+case 8373:
+case 8374:
+case 8375:
+case 8376:
+case 8377:
+case 8378:
+case 8379:
+case 8380:
+case 8381:
+case 8382:
+case 8383:
+case 8384:
+case 8385:
+case 8386:
+case 8387:
+case 8388:
+case 8389:
+case 8390:
+case 8391:
+case 8392:
+case 8393:
+case 8394:
+case 8395:
+case 8396:
+case 8397:
+case 8398:
+case 8399:
+case 8400:
+case 8401:
+case 8402:
+case 8403:
+case 8404:
+case 8405:
+case 8406:
+case 8407:
+case 8408:
+case 8409:
+case 8410:
+case 8411:
+case 8412:
+case 8413:
+case 8414:
+case 8415:
+case 8416:
+case 8417:
+case 8418:
+case 8419:
+case 8420:
+case 8421:
+case 8422:
+case 8423:
+case 8424:
+case 8425:
+case 8426:
+case 8427:
+case 8428:
+case 8429:
+case 8430:
+case 8431:
+case 8432:
+case 8433:
+case 8434:
+case 8435:
+case 8436:
+case 8437:
+case 8438:
+case 8439:
+case 8440:
+case 8441:
+case 8442:
+case 8443:
+case 8444:
+case 8445:
+case 8446:
+case 8447:
+case 8448:
+case 8449:
+case 8450:
+case 8451:
+case 8452:
+case 8453:
+case 8454:
+case 8455:
+case 8456:
+case 8457:
+case 8458:
+case 8459:
+case 8460:
+case 8461:
+case 8462:
+case 8463:
+case 8464:
+case 8465:
+case 8466:
+case 8467:
+case 8468:
+case 8469:
+case 8470:
+case 8471:
+case 8472:
+case 8473:
+case 8474:
+case 8475:
+case 8476:
+case 8477:
+case 8478:
+case 8479:
+case 8480:
+case 8481:
+case 8482:
+case 8483:
+case 8484:
+case 8485:
+case 8486:
+case 8487:
+case 8488:
+case 8489:
+case 8490:
+case 8491:
+case 8492:
+case 8493:
+case 8494:
+case 8495:
+case 8496:
+case 8497:
+case 8498:
+case 8499:
+case 8500:
+case 8501:
+case 8502:
+case 8503:
+case 8504:
+case 8505:
+case 8506:
+case 8507:
+case 8508:
+case 8509:
+case 8510:
+case 8511:
+case 8512:
+case 8513:
+case 8514:
+case 8515:
+case 8516:
+case 8517:
+case 8518:
+case 8519:
+case 8520:
+case 8521:
+case 8522:
+case 8523:
+case 8524:
+case 8525:
+case 8526:
+case 8527:
+case 8528:
+case 8529:
+case 8530:
+case 8531:
+case 8532:
+case 8533:
+case 8534:
+case 8535:
+case 8536:
+case 8537:
+case 8538:
+case 8539:
+case 8540:
+case 8541:
+case 8542:
+case 8543:
+case 8544:
+case 8545:
+case 8546:
+case 8547:
+case 8548:
+case 8549:
+case 8550:
+case 8551:
+case 8552:
+case 8553:
+case 8554:
+case 8555:
+case 8556:
+case 8557:
+case 8558:
+case 8559:
+case 8560:
+case 8561:
+case 8562:
+case 8563:
+case 8564:
+case 8565:
+case 8566:
+case 8567:
+case 8568:
+case 8569:
+case 8570:
+case 8571:
+case 8572:
+case 8573:
+case 8574:
+case 8575:
+case 8576:
+case 8577:
+case 8578:
+case 8579:
+case 8580:
+case 8581:
+case 8582:
+case 8583:
+case 8584:
+case 8585:
+case 8586:
+case 8587:
+case 8588:
+case 8589:
+case 8590:
+case 8591:
+case 8592:
+case 8593:
+case 8594:
+case 8595:
+case 8596:
+case 8597:
+case 8598:
+case 8599:
+case 8600:
+case 8601:
+case 8602:
+case 8603:
+case 8604:
+case 8605:
+case 8606:
+case 8607:
+case 8608:
+case 8609:
+case 8610:
+case 8611:
+case 8612:
+case 8613:
+case 8614:
+case 8615:
+case 8616:
+case 8617:
+case 8618:
+case 8619:
+case 8620:
+case 8621:
+case 8622:
+case 8623:
+case 8624:
+case 8625:
+case 8626:
+case 8627:
+case 8628:
+case 8629:
+case 8630:
+case 8631:
+case 8632:
+case 8633:
+case 8634:
+case 8635:
+case 8636:
+case 8637:
+case 8638:
+case 8639:
+case 8640:
+case 8641:
+case 8642:
+case 8643:
+case 8644:
+case 8645:
+case 8646:
+case 8647:
+case 8648:
+case 8649:
+case 8650:
+case 8651:
+case 8652:
+case 8653:
+case 8654:
+case 8655:
+case 8656:
+case 8657:
+case 8658:
+case 8659:
+case 8660:
+case 8661:
+case 8662:
+case 8663:
+case 8664:
+case 8665:
+case 8666:
+case 8667:
+case 8668:
+case 8669:
+case 8670:
+case 8671:
+case 8672:
+case 8673:
+case 8674:
+case 8675:
+case 8676:
+case 8677:
+case 8678:
+case 8679:
+case 8680:
+case 8681:
+case 8682:
+case 8683:
+case 8684:
+case 8685:
+case 8686:
+case 8687:
+case 8688:
+case 8689:
+case 8690:
+case 8691:
+case 8692:
+case 8693:
+case 8694:
+case 8695:
+case 8696:
+case 8697:
+case 8698:
+case 8699:
+case 8700:
+case 8701:
+case 8702:
+case 8703:
+case 8704:
+case 8705:
+case 8706:
+case 8707:
+case 8708:
+case 8709:
+case 8710:
+case 8711:
+case 8712:
+case 8713:
+case 8714:
+case 8715:
+case 8716:
+case 8717:
+case 8718:
+case 8719:
+case 8720:
+case 8721:
+case 8722:
+case 8723:
+case 8724:
+case 8725:
+case 8726:
+case 8727:
+case 8728:
+case 8729:
+case 8730:
+case 8731:
+case 8732:
+case 8733:
+case 8734:
+case 8735:
+case 8736:
+case 8737:
+case 8738:
+case 8739:
+case 8740:
+case 8741:
+case 8742:
+case 8743:
+case 8744:
+case 8745:
+case 8746:
+case 8747:
+case 8748:
+case 8749:
+case 8750:
+case 8751:
+case 8752:
+case 8753:
+case 8754:
+case 8755:
+case 8756:
+case 8757:
+case 8758:
+case 8759:
+case 8760:
+case 8761:
+case 8762:
+case 8763:
+case 8764:
+case 8765:
+case 8766:
+case 8767:
+case 8768:
+case 8769:
+case 8770:
+case 8771:
+case 8772:
+case 8773:
+case 8774:
+case 8775:
+case 8776:
+case 8777:
+case 8778:
+case 8779:
+case 8780:
+case 8781:
+case 8782:
+case 8783:
+case 8784:
+case 8785:
+case 8786:
+case 8787:
+case 8788:
+case 8789:
+case 8790:
+case 8791:
+case 8792:
+case 8793:
+case 8794:
+case 8795:
+case 8796:
+case 8797:
+case 8798:
+case 8799:
+case 8800:
+case 8801:
+case 8802:
+case 8803:
+case 8804:
+case 8805:
+case 8806:
+case 8807:
+case 8808:
+case 8809:
+case 8810:
+case 8811:
+case 8812:
+case 8813:
+case 8814:
+case 8815:
+case 8816:
+case 8817:
+case 8818:
+case 8819:
+case 8820:
+case 8821:
+case 8822:
+case 8823:
+case 8824:
+case 8825:
+case 8826:
+case 8827:
+case 8828:
+case 8829:
+case 8830:
+case 8831:
+case 8832:
+case 8833:
+case 8834:
+case 8835:
+case 8836:
+case 8837:
+case 8838:
+case 8839:
+case 8840:
+case 8841:
+case 8842:
+case 8843:
+case 8844:
+case 8845:
+case 8846:
+case 8847:
+case 8848:
+case 8849:
+case 8850:
+case 8851:
+case 8852:
+case 8853:
+case 8854:
+case 8855:
+case 8856:
+case 8857:
+case 8858:
+case 8859:
+case 8860:
+case 8861:
+case 8862:
+case 8863:
+case 8864:
+case 8865:
+case 8866:
+case 8867:
+case 8868:
+case 8869:
+case 8870:
+case 8871:
+case 8872:
+case 8873:
+case 8874:
+case 8875:
+case 8876:
+case 8877:
+case 8878:
+case 8879:
+case 8880:
+case 8881:
+case 8882:
+case 8883:
+case 8884:
+case 8885:
+case 8886:
+case 8887:
+case 8888:
+case 8889:
+case 8890:
+case 8891:
+case 8892:
+case 8893:
+case 8894:
+case 8895:
+case 8896:
+case 8897:
+case 8898:
+case 8899:
+case 8900:
+case 8901:
+case 8902:
+case 8903:
+case 8904:
+case 8905:
+case 8906:
+case 8907:
+case 8908:
+case 8909:
+case 8910:
+case 8911:
+case 8912:
+case 8913:
+case 8914:
+case 8915:
+case 8916:
+case 8917:
+case 8918:
+case 8919:
+case 8920:
+case 8921:
+case 8922:
+case 8923:
+case 8924:
+case 8925:
+case 8926:
+case 8927:
+case 8928:
+case 8929:
+case 8930:
+case 8931:
+case 8932:
+case 8933:
+case 8934:
+case 8935:
+case 8936:
+case 8937:
+case 8938:
+case 8939:
+case 8940:
+case 8941:
+case 8942:
+case 8943:
+case 8944:
+case 8945:
+case 8946:
+case 8947:
+case 8948:
+case 8949:
+case 8950:
+case 8951:
+case 8952:
+case 8953:
+case 8954:
+case 8955:
+case 8956:
+case 8957:
+case 8958:
+case 8959:
+case 8960:
+case 8961:
+case 8962:
+case 8963:
+case 8964:
+case 8965:
+case 8966:
+case 8967:
+case 8968:
+case 8969:
+case 8970:
+case 8971:
+case 8972:
+case 8973:
+case 8974:
+case 8975:
+case 8976:
+case 8977:
+case 8978:
+case 8979:
+case 8980:
+case 8981:
+case 8982:
+case 8983:
+case 8984:
+case 8985:
+case 8986:
+case 8987:
+case 8988:
+case 8989:
+case 8990:
+case 8991:
+case 8992:
+case 8993:
+case 8994:
+case 8995:
+case 8996:
+case 8997:
+case 8998:
+case 8998: // DUPLICATE LABEL
+ actual += 'a';
+case 8999:
+ actual += 'b';
+}
+expect = 'ab';
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-001.js
new file mode 100644
index 0000000000..8e2bb6b010
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-001.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 01 June 2001
+ *
+ * SUMMARY: Testing that we don't crash on switch case -1...
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=83532
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-83532-001.js';
+var BUGNUMBER = 83532;
+var summary = "Testing that we don't crash on switch case -1";
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ // Just testing that we don't crash on these -
+ function f () {switch(1) {case -1:}}
+ function g(){switch(1){case (-1):}}
+ var h = function() {switch(1) {case -1:}}
+ f();
+ g();
+ h();
+ reportCompare('No Crash', 'No Crash', '');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-002.js
new file mode 100644
index 0000000000..3bd5ce8703
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/regress-83532-002.js
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 01 June 2001
+ *
+ * SUMMARY: Testing that we don't crash on switch case -1...
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=83532
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-83532-002.js';
+var BUGNUMBER = 83532;
+var summary = "Testing that we don't crash on switch case -1";
+var sToEval = '';
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ // Just testing that we don't crash on these -
+ sToEval += 'function f () {switch(1) {case -1:}};';
+ sToEval += 'function g(){switch(1){case (-1):}};';
+ sToEval += 'var h = function() {switch(1) {case -1:}};'
+ sToEval += 'f();';
+ sToEval += 'g();';
+ sToEval += 'h();';
+ eval(sToEval);
+
+ reportCompare('No Crash', 'No Crash', '');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/shell.js
new file mode 100644
index 0000000000..7346f697a5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Statements';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Statements/switch-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Statements/switch-001.js
new file mode 100644
index 0000000000..aae6659cc1
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Statements/switch-001.js
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 07 May 2001
+ *
+ * SUMMARY: Testing the switch statement
+ *
+ * See ECMA3 Section 12.11, "The switch Statement"
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'switch-001.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing the switch statement';
+var cnMatch = 'Match';
+var cnNoMatch = 'NoMatch';
+var status = '';
+var statusitems = [ ];
+var actual = '';
+var actualvalues = [ ];
+var expect= '';
+var expectedvalues = [ ];
+
+
+status = 'Section A of test';
+actual = match(17, f(fInverse(17)), f, fInverse);
+expect = cnMatch;
+addThis();
+
+status = 'Section B of test';
+actual = match(17, 18, f, fInverse);
+expect = cnNoMatch;
+addThis();
+
+status = 'Section C of test';
+actual = match(1, 1, Math.exp, Math.log);
+expect = cnMatch;
+addThis();
+
+status = 'Section D of test';
+actual = match(1, 2, Math.exp, Math.log);
+expect = cnNoMatch;
+addThis();
+
+status = 'Section E of test';
+actual = match(1, 1, Math.sin, Math.cos);
+expect = cnNoMatch;
+addThis();
+
+
+
+//---------------------------------------------------------------------------------
+test();
+//---------------------------------------------------------------------------------
+
+
+
+/*
+ * If F,G are inverse functions and x==y, this should return cnMatch -
+ */
+function match(x, y, F, G)
+{
+ switch (x)
+ {
+ case F(G(y)):
+ return cnMatch;
+
+ default:
+ return cnNoMatch;
+ }
+}
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i = 0; i < UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
+function f(m)
+{
+ return 2*(m+1);
+}
+
+
+function fInverse(n)
+{
+ return (n-2)/2;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.11.js b/tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.11.js
new file mode 100644
index 0000000000..ef518bb9e5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.11.js
@@ -0,0 +1,532 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * <x00000000@freenet.de>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.5.4.11.js';
+var BUGNUMBER = 392378;
+var summary = '15.5.4.11 - String.prototype.replace';
+var rex, f, a, i;
+
+reportCompare(
+ 2,
+ String.prototype.replace.length,
+ "Section 1"
+);
+
+reportCompare(
+ "321",
+ String.prototype.replace.call(123, "123", "321"),
+ "Section 2"
+);
+
+reportCompare(
+ "ok",
+ "ok".replace(),
+ "Section 3"
+);
+
+reportCompare(
+ "undefined**",
+ "***".replace("*"),
+ "Section 4"
+);
+
+reportCompare(
+ "xnullz",
+ "xyz".replace("y", null),
+ "Section 5"
+);
+
+reportCompare(
+ "x123",
+ "xyz".replace("yz", 123),
+ "Section 6"
+);
+
+reportCompare(
+ "/x/g/x/g/x/g",
+ "xxx".replace(/x/g, /x/g),
+ "Section 7"
+);
+
+reportCompare(
+ "ok",
+ "undefined".replace(undefined, "ok"),
+ "Section 8"
+);
+
+reportCompare(
+ "ok",
+ "null".replace(null, "ok"),
+ "Section 9"
+);
+
+reportCompare(
+ "ok",
+ "123".replace(123, "ok"),
+ "Section 10"
+);
+
+reportCompare(
+ "xzyxyz",
+ "xyzxyz".replace("yz", "zy"),
+ "Section 11"
+);
+
+reportCompare(
+ "ok",
+ "(xyz)".replace("(xyz)", "ok"),
+ "Section 12"
+);
+
+reportCompare(
+ "*$&yzxyz",
+ "xyzxyz".replace("x", "*$$&"),
+ "Section 13"
+);
+
+reportCompare(
+ "xy*z*",
+ "xyz".replace("z", "*$&*"),
+ "Section 14"
+);
+
+reportCompare(
+ "xyxyzxyz",
+ "xyzxyzxyz".replace("zxy", "$`"),
+ "Section 15"
+);
+
+reportCompare(
+ "zxyzxyzzxyz",
+ "xyzxyz".replace("xy", "$'xyz"),
+ "Section 16"
+);
+
+reportCompare(
+ "$",
+ "xyzxyz".replace("xyzxyz", "$"),
+ "Section 17"
+);
+
+reportCompare(
+ "x$0$00xyz",
+ "xyzxyz".replace("yz", "$0$00"),
+ "Section 18"
+);
+
+// Result for $1/$01 .. $99 is implementation-defined if searchValue is no
+// regular expression. $+ is a non-standard Mozilla extension.
+
+reportCompare(
+ "$!$\"$-1$*$#$.$xyz$$",
+ "xyzxyz$$".replace("xyz", "$!$\"$-1$*$#$.$"),
+ "Section 19"
+);
+
+reportCompare(
+ "$$$&$$$&$&",
+ "$$$&".replace("$$", "$$$$$$&$&$$&"),
+ "Section 20"
+);
+
+reportCompare(
+ "yxx",
+ "xxx".replace(/x/, "y"),
+ "Section 21"
+);
+
+reportCompare(
+ "yyy",
+ "xxx".replace(/x/g, "y"),
+ "Section 22"
+);
+
+rex = /x/, rex.lastIndex = 1;
+reportCompare(
+ "yxx1",
+ "xxx".replace(rex, "y") + rex.lastIndex,
+ "Section 23"
+);
+
+rex = /x/g, rex.lastIndex = 1;
+reportCompare(
+ "yyy0",
+ "xxx".replace(rex, "y") + rex.lastIndex,
+ "Section 24"
+);
+
+rex = /y/, rex.lastIndex = 1;
+reportCompare(
+ "xxx1",
+ "xxx".replace(rex, "y") + rex.lastIndex,
+ "Section 25"
+);
+
+rex = /y/g, rex.lastIndex = 1;
+reportCompare(
+ "xxx0",
+ "xxx".replace(rex, "y") + rex.lastIndex,
+ "Section 26"
+);
+
+rex = /x?/, rex.lastIndex = 1;
+reportCompare(
+ "(x)xx1",
+ "xxx".replace(rex, "($&)") + rex.lastIndex,
+ "Section 27"
+);
+
+rex = /x?/g, rex.lastIndex = 1;
+reportCompare(
+ "(x)(x)(x)()0",
+ "xxx".replace(rex, "($&)") + rex.lastIndex,
+ "Section 28"
+);
+
+rex = /y?/, rex.lastIndex = 1;
+reportCompare(
+ "()xxx1",
+ "xxx".replace(rex, "($&)") + rex.lastIndex,
+ "Section 29"
+);
+
+rex = /y?/g, rex.lastIndex = 1;
+reportCompare(
+ "()x()x()x()0",
+ "xxx".replace(rex, "($&)") + rex.lastIndex,
+ "Section 30"
+);
+
+reportCompare(
+ "xy$0xy$zxy$zxyz$zxyz",
+ "xyzxyzxyz".replace(/zxy/, "$0$`$$$&$$$'$"),
+ "Section 31"
+);
+
+reportCompare(
+ "xy$0xy$zxy$zxyz$$0xyzxy$zxy$z$z",
+ "xyzxyzxyz".replace(/zxy/g, "$0$`$$$&$$$'$"),
+ "Section 32"
+);
+
+reportCompare(
+ "xyxyxyzxyxyxyz",
+ "xyzxyz".replace(/(((x)(y)()()))()()()(z)/g, "$01$2$3$04$5$6$7$8$09$10"),
+ "Section 33"
+);
+
+rex = RegExp(
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()(y)");
+reportCompare(
+ "x(y)z",
+ "xyz".replace(rex, "($99)"),
+ "Section 34"
+);
+
+rex = RegExp(
+ "()()()()()()()()()(x)" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()(y)");
+reportCompare(
+ "(x0)z",
+ "xyz".replace(rex, "($100)"),
+ "Section 35"
+);
+
+reportCompare(
+ "xyz(XYZ)",
+ "xyzXYZ".replace(/XYZ/g, "($&)"),
+ "Section 36"
+);
+
+reportCompare(
+ "(xyz)(XYZ)",
+ "xyzXYZ".replace(/xYz/gi, "($&)"),
+ "Section 37"
+);
+
+reportCompare(
+ "xyz\rxyz\n",
+ "xyz\rxyz\n".replace(/xyz$/g, "($&)"),
+ "Section 38"
+);
+
+reportCompare(
+ "(xyz)\r(xyz)\n",
+ "xyz\rxyz\n".replace(/xyz$/gm, "($&)"),
+ "Section 39"
+);
+
+f = function () { return "failure" };
+
+reportCompare(
+ "ok",
+ "ok".replace("x", f),
+ "Section 40"
+);
+
+reportCompare(
+ "ok",
+ "ok".replace(/(?=k)ok/, f),
+ "Section 41"
+);
+
+reportCompare(
+ "ok",
+ "ok".replace(/(?!)ok/, f),
+ "Section 42"
+);
+
+reportCompare(
+ "ok",
+ "ok".replace(/ok(?!$)/, f),
+ "Section 43"
+);
+
+f = function (sub, offs, str) {
+ return ["", sub, typeof sub, offs, typeof offs, str, typeof str, ""]
+ .join("|");
+};
+
+reportCompare(
+ "x|y|string|1|number|xyz|string|z",
+ "xyz".replace("y", f),
+ "Section 44"
+);
+
+reportCompare(
+ "x|(y)|string|1|number|x(y)z|string|z",
+ "x(y)z".replace("(y)", f),
+ "Section 45"
+);
+
+reportCompare(
+ "x|y*|string|1|number|xy*z|string|z",
+ "xy*z".replace("y*", f),
+ "Section 46"
+);
+
+reportCompare(
+ "12|3|string|2|number|12345|string|45",
+ String.prototype.replace.call(1.2345e4, 3, f),
+ "Section 47"
+);
+
+reportCompare(
+ "|x|string|0|number|xxx|string|xx",
+ "xxx".replace(/^x/g, f),
+ "Section 48"
+);
+
+reportCompare(
+ "xx|x|string|2|number|xxx|string|",
+ "xxx".replace(/x$/g, f),
+ "Section 49"
+);
+
+f = function (sub, paren, offs, str) {
+ return ["", sub, typeof sub, paren, typeof paren, offs, typeof offs,
+ str, typeof str, ""].join("|");
+};
+
+reportCompare(
+ "xy|z|string|z|string|2|number|xyz|string|",
+ "xyz".replace(/(z)/g, f),
+ "Section 50"
+);
+
+reportCompare(
+ "xyz||string||string|3|number|xyz|string|",
+ "xyz".replace(/($)/g, f),
+ "Section 51"
+);
+
+reportCompare(
+ "|xy|string|y|string|0|number|xyz|string|z",
+ "xyz".replace(/(?:x)(y)/g, f),
+ "Section 52"
+);
+
+reportCompare(
+ "|x|string|x|string|0|number|xyz|string|yz",
+ "xyz".replace(/((?=xy)x)/g, f),
+ "Section 53"
+);
+
+reportCompare(
+ "|x|string|x|string|0|number|xyz|string|yz",
+ "xyz".replace(/(x(?=y))/g, f),
+ "Section 54"
+);
+
+reportCompare(
+ "x|y|string|y|string|1|number|xyz|string|z",
+ "xyz".replace(/((?!x)y)/g, f),
+ "Section 55"
+);
+
+reportCompare(
+ "|x|string|x|string|0|number|xyz|string|" +
+ "|y|string||undefined|1|number|xyz|string|z",
+ "xyz".replace(/y|(x)/g, f),
+ "Section 56"
+);
+
+reportCompare(
+ "xy|z|string||string|2|number|xyz|string|",
+ "xyz".replace(/(z?)z/, f),
+ "Section 57"
+);
+
+reportCompare(
+ "xy|z|string||undefined|2|number|xyz|string|",
+ "xyz".replace(/(z)?z/, f),
+ "Section 58"
+);
+
+reportCompare(
+ "xy|z|string||undefined|2|number|xyz|string|",
+ "xyz".replace(/(z)?\1z/, f),
+ "Section 59"
+);
+
+reportCompare(
+ "xy|z|string||undefined|2|number|xyz|string|",
+ "xyz".replace(/\1(z)?z/, f),
+ "Section 60"
+);
+
+reportCompare(
+ "xy|z|string||string|2|number|xyz|string|",
+ "xyz".replace(/(z?\1)z/, f),
+ "Section 61"
+);
+
+f = function (sub, paren1, paren2, offs, str) {
+ return ["", sub, typeof sub, paren1, typeof paren1, paren2, typeof paren2,
+ offs, typeof offs, str, typeof str, ""].join("|");
+};
+
+reportCompare(
+ "x|y|string|y|string||undefined|1|number|xyz|string|z",
+ "xyz".replace(/(y)(\1)?/, f),
+ "Section 62"
+);
+
+reportCompare(
+ "x|yy|string|y|string|y|string|1|number|xyyz|string|z",
+ "xyyz".replace(/(y)(\1)?/g, f),
+ "Section 63"
+);
+
+reportCompare(
+ "x|y|string|y|string||undefined|1|number|xyyz|string|" +
+ "|y|string|y|string||undefined|2|number|xyyz|string|z",
+ "xyyz".replace(/(y)(\1)??/g, f),
+ "Section 64"
+);
+
+reportCompare(
+ "x|y|string|y|string|y|string|1|number|xyz|string|z",
+ "xyz".replace(/(?=(y))(\1)?/, f),
+ "Section 65"
+);
+
+reportCompare(
+ "xyy|z|string||undefined||string|3|number|xyyz|string|",
+ "xyyz".replace(/(?!(y)y)(\1)z/, f),
+ "Section 66"
+);
+
+rex = RegExp(
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()" +
+ "()()()()()()()()()()(z)?(y)");
+a = ["sub"];
+for (i = 1; i <= 102; ++i)
+ a[i] = "p" + i;
+a[103] = "offs";
+a[104] = "str";
+a[105] = "return ['', sub, typeof sub, offs, typeof offs, str, typeof str, " +
+ "p100, typeof p100, p101, typeof p101, p102, typeof p102, ''].join('|');";
+f = Function.apply(null, a);
+reportCompare(
+ "x|y|string|1|number|xyz|string||string||undefined|y|string|z",
+ "xyz".replace(rex, f),
+ "Section 67"
+);
+
+reportCompare(
+ "undefined",
+ "".replace(/.*/g, function () {}),
+ "Section 68"
+);
+
+reportCompare(
+ "nullxnullynullznull",
+ "xyz".replace(/.??/g, function () { return null; }),
+ "Section 69"
+);
+
+reportCompare(
+ "111",
+ "xyz".replace(/./g, function () { return 1; }),
+ "Section 70"
+);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.14.js b/tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.14.js
new file mode 100644
index 0000000000..aa6c7354c2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/15.5.4.14.js
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Karsten Sperling <spiff@phreax.net>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '15.5.4.14.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 287630;
+var summary = '15.5.4.14 - String.prototype.split(/()/)';
+var actual = '';
+var expect = ['a'].toString();
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+actual = 'a'.split(/()/).toString();
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/String/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-104375.js b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-104375.js
new file mode 100644
index 0000000000..c5593948d7
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-104375.js
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * k.mike@gmx.net, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 12 October 2001
+ *
+ * SUMMARY: Regression test for string.replace bug 104375
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=104375
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-104375.js';
+var UBound = 0;
+var BUGNUMBER = 104375;
+var summary = 'Testing string.replace() with backreferences';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Use the regexp to replace 'uid=31' with 'uid=15'
+ *
+ * In the second parameter of string.replace() method,
+ * "$1" refers to the first backreference: 'uid='
+ */
+var str = 'uid=31';
+var re = /(uid=)(\d+)/;
+
+// try the numeric literal 15
+status = inSection(1);
+actual = str.replace (re, "$1" + 15);
+expect = 'uid=15';
+addThis();
+
+// try the string literal '15'
+status = inSection(2);
+actual = str.replace (re, "$1" + '15');
+expect = 'uid=15';
+addThis();
+
+// try a letter before the '15'
+status = inSection(3);
+actual = str.replace (re, "$1" + 'A15');
+expect = 'uid=A15';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
+
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-189898.js b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-189898.js
new file mode 100644
index 0000000000..c75c081513
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-189898.js
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@icesoft.no, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 21 January 2003
+ * SUMMARY: Regression test for bug 189898
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=189898
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-189898.js';
+var UBound = 0;
+var BUGNUMBER = 189898;
+var summary = 'Regression test for bug 189898';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+status = inSection(1);
+actual = 'XaXY'.replace('XY', '--')
+ expect = 'Xa--';
+addThis();
+
+status = inSection(2);
+actual = '$a$^'.replace('$^', '--')
+ expect = '$a--';
+addThis();
+
+status = inSection(3);
+actual = 'ababc'.replace('abc', '--')
+ expect = 'ab--';
+addThis();
+
+status = inSection(4);
+actual = 'ababc'.replace('abc', '^$')
+ expect = 'ab^$';
+addThis();
+
+
+
+/*
+ * Same as above, but providing a regexp in the first parameter
+ * to String.prototype.replace() instead of a string.
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=83293
+ * for subtleties on this issue -
+ */
+status = inSection(5);
+actual = 'XaXY'.replace(/XY/, '--')
+ expect = 'Xa--';
+addThis();
+
+status = inSection(6);
+actual = 'XaXY'.replace(/XY/g, '--')
+ expect = 'Xa--';
+addThis();
+
+status = inSection(7);
+actual = '$a$^'.replace(/\$\^/, '--')
+ expect = '$a--';
+addThis();
+
+status = inSection(8);
+actual = '$a$^'.replace(/\$\^/g, '--')
+ expect = '$a--';
+addThis();
+
+status = inSection(9);
+actual = 'ababc'.replace(/abc/, '--')
+ expect = 'ab--';
+addThis();
+
+status = inSection(10);
+actual = 'ababc'.replace(/abc/g, '--')
+ expect = 'ab--';
+addThis();
+
+status = inSection(11);
+actual = 'ababc'.replace(/abc/, '^$')
+ expect = 'ab^$';
+addThis();
+
+status = inSection(12);
+actual = 'ababc'.replace(/abc/g, '^$')
+ expect = 'ab^$';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-304376.js b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-304376.js
new file mode 100755
index 0000000000..733cd713d8
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-304376.js
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Blake Kaplan
+ * timeless
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-304376.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 304376;
+var summary = 'String.prototype should be readonly and permanent';
+var actual = '';
+var expect = '';
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+expect = 'TypeError';
+
+var saveString = String;
+
+String = Array;
+
+try
+{
+ // see if we can crash...
+ "".join();
+ String = saveString;
+ actual = 'No Error';
+}
+catch(ex)
+{
+ String = saveString;
+ actual = ex.name;
+ printStatus(ex + '');
+}
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-313567.js b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-313567.js
new file mode 100755
index 0000000000..9610238cc3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-313567.js
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Igor Bukanov
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-313567.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 313567;
+var summary = 'String.prototype.length should not be generic';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var s = new String("1");
+s.toString = function() {
+ return "22";
+}
+ var expect = 1;
+var actual = s.length;
+printStatus("expect="+expect+" actual="+actual);
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js
new file mode 100755
index 0000000000..59564b272e
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-392378.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 392378;
+var summary = 'Regular Expression Non-participating Capture Groups are inaccurate in edge cases';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = ["", undefined, ""] + '';
+ actual = "y".split(/(x)?\1y/) + '';
+ reportCompare(expect, actual, summary + ': "y".split(/(x)?\\1y/)');
+
+ expect = ["", undefined, ""] + '';
+ actual = "y".split(/(x)?y/) + '';
+ reportCompare(expect, actual, summary + ': "y".split(/(x)?y/)');
+
+ expect = 'undefined';
+ actual = "y".replace(/(x)?\1y/, function($0, $1){ return String($1); }) + '';
+ reportCompare(expect, actual, summary + ': "y".replace(/(x)?\\1y/, function($0, $1){ return String($1); })');
+
+ expect = 'undefined';
+ actual = "y".replace(/(x)?y/, function($0, $1){ return String($1); }) + '';
+ reportCompare(expect, actual, summary + ': "y".replace(/(x)?y/, function($0, $1){ return String($1); })');
+
+ expect = 'undefined';
+ actual = "y".replace(/(x)?y/, function($0, $1){ return $1; }) + '';
+ reportCompare(expect, actual, summary + ': "y".replace(/(x)?y/, function($0, $1){ return $1; })');
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-83293.js b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-83293.js
new file mode 100644
index 0000000000..55e74d4dd5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-83293.js
@@ -0,0 +1,216 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com, jim@jibbering.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-83293.js';
+
+/*
+ * Creation Date: 30 May 2001
+ * Correction Date: 14 Aug 2001
+ *
+ * SUMMARY: Regression test for bugs 83293, 103351
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=83293
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=103351
+ * http://bugzilla.mozilla.org/show_bug.cgi?id=92942
+ *
+ *
+ * ******************** CORRECTION !!! *****************************
+ *
+ * When I originally wrote this test, I thought this was true:
+ * str.replace(strA, strB) == str.replace(new RegExp(strA),strB).
+ * See ECMA-262 Final Draft, 15.5.4.11 String.prototype.replace
+ *
+ * However, in http://bugzilla.mozilla.org/show_bug.cgi?id=83293
+ * Jim Ley points out the ECMA-262 Final Edition changed on this.
+ * String.prototype.replace (searchValue, replaceValue), if provided
+ * a searchValue that is not a RegExp, is NO LONGER to replace it with
+ *
+ * new RegExp(searchValue)
+ * but rather:
+ * String(searchValue)
+ *
+ * This puts the replace() method at variance with search() and match(),
+ * which continue to follow the RegExp conversion of the Final Draft.
+ * It also makes most of this testcase, as originally written, invalid.
+ **********************************************************************
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 103351; // <--- (Outgrowth of original bug 83293)
+var summ_OLD = 'Testing str.replace(strA, strB) == str.replace(new RegExp(strA),strB)';
+var summ_NEW = 'Testing String.prototype.replace(x,y) when x is a string';
+var summary = summ_NEW;
+var status = '';
+var actual = '';
+var expect= '';
+var cnEmptyString = '';
+var str = 'abc';
+var strA = cnEmptyString;
+var strB = 'Z';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+/*
+ * In this test, it's important to reportCompare() each other case
+ * BEFORE the last two cases are attempted. Don't store all results
+ * in an array and reportCompare() them at the end, as we usually do.
+ *
+ * When this bug was filed, str.replace(strA, strB) would return no value
+ * whatsoever if strA == cnEmptyString, and no error, either -
+ */
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+/******************* THESE WERE INCORRECT; SEE ABOVE ************************
+ status = 'Section A of test';
+ strA = 'a';
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+ status = 'Section B of test';
+ strA = 'x';
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+ status = 'Section C of test';
+ strA = undefined;
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+ status = 'Section D of test';
+ strA = null;
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+
+ * This example is from jim@jibbering.com (see Bugzilla bug 92942)
+ * It is a variation on the example below.
+ *
+ * Namely, we are using the regexp /$/ instead of the regexp //.
+ * The regexp /$/ means we should match the "empty string" at the
+ * end-boundary of the word, instead of the one at the beginning.
+ *
+ status = 'Section E of test';
+ var strJim = 'aa$aa';
+ strA = '$';
+ actual = strJim.replace(strA, strB); // bug -> 'aaZaa'
+ expect = strJim.replace(new RegExp(strA), strB); // expect 'aa$aaZ'
+ reportCompare(expect, actual, status);
+
+
+ *
+ * Note: 'Zabc' is the result we expect for 'abc'.replace('', 'Z').
+ *
+ * The string '' is supposed to be equivalent to new RegExp('') = //.
+ * The regexp // means we should match the "empty string" conceived of
+ * at the beginning boundary of the word, before the first character.
+ *
+ status = 'Section F of test';
+ strA = cnEmptyString;
+ actual = str.replace(strA, strB);
+ expect = 'Zabc';
+ reportCompare(expect, actual, status);
+
+ status = 'Section G of test';
+ strA = cnEmptyString;
+ actual = str.replace(strA, strB);
+ expect = str.replace(new RegExp(strA), strB);
+ reportCompare(expect, actual, status);
+
+ ************************* END OF INCORRECT CASES ****************************/
+
+
+////////////////////////// OK, LET'S START OVER //////////////////////////////
+
+ status = 'Section 1 of test';
+ actual = 'abc'.replace('a', 'Z');
+ expect = 'Zbc';
+ reportCompare(expect, actual, status);
+
+ status = 'Section 2 of test';
+ actual = 'abc'.replace('b', 'Z');
+ expect = 'aZc';
+ reportCompare(expect, actual, status);
+
+ status = 'Section 3 of test';
+ actual = 'abc'.replace(undefined, 'Z');
+ expect = 'abc'; // String(undefined) == 'undefined'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 4 of test';
+ actual = 'abc'.replace(null, 'Z');
+ expect = 'abc'; // String(null) == 'null'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 5 of test';
+ actual = 'abc'.replace(true, 'Z');
+ expect = 'abc'; // String(true) == 'true'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 6 of test';
+ actual = 'abc'.replace(false, 'Z');
+ expect = 'abc'; // String(false) == 'false'; no replacement possible
+ reportCompare(expect, actual, status);
+
+ status = 'Section 7 of test';
+ actual = 'aa$aa'.replace('$', 'Z');
+ expect = 'aaZaa'; // NOT 'aa$aaZ' as in ECMA Final Draft; see above
+ reportCompare(expect, actual, status);
+
+ status = 'Section 8 of test';
+ actual = 'abc'.replace('.*', 'Z');
+ expect = 'abc'; // not 'Z' as in EMCA Final Draft
+ reportCompare(expect, actual, status);
+
+ status = 'Section 9 of test';
+ actual = 'abc'.replace('', 'Z');
+ expect = 'Zabc'; // Still expect 'Zabc' for this
+ reportCompare(expect, actual, status);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/String/shell.js
new file mode 100644
index 0000000000..7d850446cc
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/String/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'String';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-01.js
new file mode 100755
index 0000000000..bb10ac6f7a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-01.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Martin Honnen
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-352044-01.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 352044;
+var summary = 'issues with Unicode escape sequences in JavaScript source code';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'SyntaxError: illegal character';
+
+ try
+ {
+ var i = 1;
+ eval('i \\u002b= 1');
+ print(i);
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/shell.js
new file mode 100644
index 0000000000..97a64fe83d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/shell.js
@@ -0,0 +1 @@
+gTestsubsuite = 'Unicode';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001-n.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001-n.js
new file mode 100644
index 0000000000..31a13f70e2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001-n.js
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'uc-001-n.js';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode Characters 1C-1F negative test.");
+ printBugNumber (23612);
+
+ reportCompare ("error", eval ("'no'\u001C+' error'"),
+ "Unicode whitespace test (1C.)");
+ reportCompare ("error", eval ("'no'\u001D+' error'"),
+ "Unicode whitespace test (1D.)");
+ reportCompare ("error", eval ("'no'\u001E+' error'"),
+ "Unicode whitespace test (1E.)");
+ reportCompare ("error", eval ("'no'\u001F+' error'"),
+ "Unicode whitespace test (1F.)");
+
+ exitFunc ("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001.js
new file mode 100644
index 0000000000..3fc0c8d927
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-001.js
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'uc-001.js';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode format-control character (Category Cf) test.");
+ printBugNumber (23610);
+
+ reportCompare ("no error", eval('"no\u200E error"'),
+ "Unicode format-control character test (Category Cf.)");
+
+ exitFunc ("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002-n.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002-n.js
new file mode 100644
index 0000000000..f1ae9a749d
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002-n.js
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'uc-002-n.js';
+
+DESCRIPTION = "Non-character escapes in identifiers negative test.";
+EXPECTED = "error";
+
+enterFunc ("test");
+
+printStatus ("Non-character escapes in identifiers negative test.");
+printBugNumber (23607);
+
+eval("\u0020 = 5");
+reportCompare('PASS', 'FAIL', "Previous statement should have thrown an error.");
+
+exitFunc ("test");
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002.js
new file mode 100644
index 0000000000..d19b2c4786
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-002.js
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'uc-002.js';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode non-breaking space character test.");
+ printBugNumber (23613);
+
+ reportCompare ("no error", eval("'no'\u00A0+ ' error'"),
+ "Unicode non-breaking space character test.");
+
+ var str = "\u00A0foo";
+ reportCompare (0, str.search(/^\sfoo$/),
+ "Unicode non-breaking space character regexp test.");
+
+ exitFunc ("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-003.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-003.js
new file mode 100644
index 0000000000..66c3f09860
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-003.js
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'uc-003.js';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ var \u0041 = 5;
+ var A\u03B2 = 15;
+ var c\u0061se = 25;
+
+ printStatus ("Escapes in identifiers test.");
+ printBugNumber (23608);
+ printBugNumber (23607);
+
+ reportCompare (5, eval("\u0041"),
+ "Escaped ASCII Identifier test.");
+ reportCompare (6, eval("++\u0041"),
+ "Escaped ASCII Identifier test");
+ reportCompare (15, eval("A\u03B2"),
+ "Escaped non-ASCII Identifier test");
+ reportCompare (16, eval("++A\u03B2"),
+ "Escaped non-ASCII Identifier test");
+ reportCompare (25, eval("c\\u00" + "61se"),
+ "Escaped keyword Identifier test");
+ reportCompare (26, eval("++c\\u00" + "61se"),
+ "Escaped keyword Identifier test");
+
+ exitFunc ("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-004.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-004.js
new file mode 100644
index 0000000000..a54923c525
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-004.js
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'uc-004.js';
+
+test();
+
+function test()
+{
+ enterFunc ("test");
+
+ printStatus ("Unicode Characters 1C-1F with regexps test.");
+ printBugNumber (23612);
+
+ var ary = ["\u001Cfoo", "\u001Dfoo", "\u001Efoo", "\u001Ffoo"];
+
+ for (var i in ary)
+ {
+ reportCompare (0, ary[Number(i)].search(/^\Sfoo$/),
+ "Unicode characters 1C-1F in regexps, ary[" +
+ i + "] did not match \\S test (it should not.)");
+ reportCompare (-1, ary[Number(i)].search(/^\sfoo$/),
+ "Unicode characters 1C-1F in regexps, ary[" +
+ i + "] matched \\s test (it should not.)");
+ }
+
+ exitFunc ("test");
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-005.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-005.js
new file mode 100644
index 0000000000..3727042046
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/uc-005.js
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * rogerl@netscape.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 15 July 2002
+ * SUMMARY: Testing identifiers with double-byte names
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=58274
+ *
+ * Here is a sample of the problem:
+ *
+ * js> function f\u02B1 () {}
+ *
+ * js> f\u02B1.toSource();
+ * function f¦() {}
+ *
+ * js> f\u02B1.toSource().toSource();
+ * (new String("function f\xB1() {}"))
+ *
+ *
+ * See how the high-byte information (the 02) has been lost?
+ * The same thing was happening with the toString() method:
+ *
+ * js> f\u02B1.toString();
+ *
+ * function f¦() {
+ * }
+ *
+ * js> f\u02B1.toString().toSource();
+ * (new String("\nfunction f\xB1() {\n}\n"))
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'uc-005.js';
+var UBound = 0;
+var BUGNUMBER = 58274;
+var summary = 'Testing identifiers with double-byte names';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Define a function that uses double-byte identifiers in
+ * "every possible way"
+ *
+ * Then recover each double-byte identifier via f.toString().
+ * To make this easier, put a 'Z' token before every one.
+ *
+ * Our eval string will be:
+ *
+ * sEval = "function Z\u02b1(Z\u02b2, b) {
+ * try { Z\u02b3 : var Z\u02b4 = Z\u02b1; }
+ * catch (Z\u02b5) { for (var Z\u02b6 in Z\u02b5)
+ * {for (1; 1<0; Z\u02b7++) {new Array()[Z\u02b6] = 1;} };} }";
+ *
+ * It will be helpful to build this string in stages:
+ */
+var s0 = 'function Z';
+var s1 = '\u02b1(Z';
+var s2 = '\u02b2, b) {try { Z';
+var s3 = '\u02b3 : var Z';
+var s4 = '\u02b4 = Z';
+var s5 = '\u02b1; } catch (Z'
+ var s6 = '\u02b5) { for (var Z';
+var s7 = '\u02b6 in Z';
+var s8 = '\u02b5){for (1; 1<0; Z';
+var s9 = '\u02b7++) {new Array()[Z';
+var s10 = '\u02b6] = 1;} };} }';
+
+
+/*
+ * Concatenate these and eval() to create the function Z\u02b1
+ */
+var sEval = s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
+eval(sEval);
+
+
+/*
+ * Recover all the double-byte identifiers via Z\u02b1.toString().
+ * We'll recover the 1st one as arrID[1], the 2nd one as arrID[2],
+ * and so on ...
+ */
+var arrID = getIdentifiers(Z\u02b1);
+
+
+/*
+ * Now check that we got back what we put in -
+ */
+status = inSection(1);
+actual = arrID[1];
+expect = s1.charAt(0);
+addThis();
+
+status = inSection(2);
+actual = arrID[2];
+expect = s2.charAt(0);
+addThis();
+
+status = inSection(3);
+actual = arrID[3];
+expect = s3.charAt(0);
+addThis();
+
+status = inSection(4);
+actual = arrID[4];
+expect = s4.charAt(0);
+addThis();
+
+status = inSection(5);
+actual = arrID[5];
+expect = s5.charAt(0);
+addThis();
+
+status = inSection(6);
+actual = arrID[6];
+expect = s6.charAt(0);
+addThis();
+
+status = inSection(7);
+actual = arrID[7];
+expect = s7.charAt(0);
+addThis();
+
+status = inSection(8);
+actual = arrID[8];
+expect = s8.charAt(0);
+addThis();
+
+status = inSection(9);
+actual = arrID[9];
+expect = s9.charAt(0);
+addThis();
+
+status = inSection(10);
+actual = arrID[10];
+expect = s10.charAt(0);
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Goal: recover the double-byte identifiers from f.toString()
+ * by getting the very next character after each 'Z' token.
+ *
+ * The return value will be an array |arr| indexed such that
+ * |arr[1]| is the 1st identifier, |arr[2]| the 2nd, and so on.
+ *
+ * Note, however, f.toString() is implementation-independent.
+ * For example, it may begin with '\nfunction' instead of 'function'.
+ *
+ * Rhino uses a Unicode representation for f.toString(); whereas
+ * SpiderMonkey uses an ASCII representation, putting escape sequences
+ * for non-ASCII characters. For example, if a function is called f\u02B1,
+ * then in Rhino the toString() method will present a 2-character Unicode
+ * string for its name, whereas SpiderMonkey will present a 7-character
+ * ASCII string for its name: the string literal 'f\u02B1'.
+ *
+ * So we force the lexer to condense the string before we use it.
+ * This will give uniform results in Rhino and SpiderMonkey.
+ */
+function getIdentifiers(f)
+{
+ var str = condenseStr(f.toString());
+ var arr = str.split('Z');
+
+ /*
+ * The identifiers are the 1st char of each split substring
+ * EXCEPT the first one, which is just ('\n' +) 'function '.
+ *
+ * Thus note the 1st identifier will be stored in |arr[1]|,
+ * the 2nd one in |arr[2]|, etc., making the indexing easy -
+ */
+ for (i in arr)
+ arr[i] = arr[i].charAt(0);
+ return arr;
+}
+
+
+/*
+ * This function is the opposite of a functions like escape(), which take
+ * Unicode characters and return escape sequences for them. Here, we force
+ * the lexer to turn escape sequences back into single characters.
+ *
+ * Note we can't simply do |eval(str)|, since in practice |str| will be an
+ * identifier somewhere in the program (e.g. a function name); thus |eval(str)|
+ * would return the object that the identifier represents: not what we want.
+ *
+ * So we surround |str| lexicographically with quotes to force the lexer to
+ * evaluate it as a string. Have to strip out any linefeeds first, however -
+ */
+function condenseStr(str)
+{
+ /*
+ * You won't be able to do the next step if |str| has
+ * any carriage returns or linefeeds in it. For example:
+ *
+ * js> eval("'" + '\nHello' + "'");
+ * 1: SyntaxError: unterminated string literal:
+ * 1: '
+ * 1: ^
+ *
+ * So replace them with the empty string -
+ */
+ str = str.replace(/[\r\n]/g, '')
+ return eval("'" + str + "'")
+ }
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/browser.js
new file mode 100755
index 0000000000..2339522cb6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/browser.js
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/10.1.3-2.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/10.1.3-2.js
new file mode 100755
index 0000000000..f941cb7800
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/10.1.3-2.js
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 11 Feb 2002
+ * SUMMARY: Testing functions having duplicate formal parameter names
+ *
+ * SpiderMonkey was crashing on each case below if the parameters had
+ * the same name. But duplicate parameter names are permitted by ECMA;
+ * see ECMA-262 3rd Edition Final Section 10.1.3
+ *
+ * NOTE: Rhino does not have toSource() and uneval(); they are non-ECMA
+ * extensions to the language. So we include a test for them at the beginning -
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = '10.1.3-2.js';
+var UBound = 0;
+var BUGNUMBER = '(none)';
+var summary = 'Testing functions having duplicate formal parameter names';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+var OBJ = new Object();
+var OBJ_TYPE = OBJ.toString();
+
+/*
+ * Exit if the implementation doesn't support toSource() or uneval(),
+ * since these are non-ECMA extensions to the language -
+ */
+try
+{
+ if (!OBJ.toSource || !uneval(OBJ))
+ quit();
+}
+catch(e)
+{
+ quit();
+}
+
+
+/*
+ * OK, now begin the test. Just checking that we don't crash on these -
+ */
+function f1(x,x,x,x)
+{
+ var ret = eval(arguments.toSource());
+ return ret.toString();
+}
+status = inSection(1);
+actual = f1(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+/*
+ * Same thing, but preface |arguments| with the function name
+ */
+function f2(x,x,x,x)
+{
+ var ret = eval(f2.arguments.toSource());
+ return ret.toString();
+}
+status = inSection(2);
+actual = f2(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+function f3(x,x,x,x)
+{
+ var ret = eval(uneval(arguments));
+ return ret.toString();
+}
+status = inSection(3);
+actual = f3(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+/*
+ * Same thing, but preface |arguments| with the function name
+ */
+function f4(x,x,x,x)
+{
+ var ret = eval(uneval(f4.arguments));
+ return ret.toString();
+}
+status = inSection(4);
+actual = f4(1,2,3,4);
+expect = OBJ_TYPE;
+addThis();
+
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/7.9.1.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/7.9.1.js
new file mode 100755
index 0000000000..b69e9d065a
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/7.9.1.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = '7.9.1.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 402386;
+var summary = 'Automatic Semicolon insertion in restricted statements';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var code;
+
+ code = '(function() { label1: for (;;) { continue \n label1; }})';
+ expect = '(function() { label1: for (;;) { continue ; label1; }})';
+ actual = uneval(eval(code));
+ compareSource(expect, actual, summary + ': ' + code);
+
+ code = '(function() { label2: for (;;) { break \n label2; }})';
+ expect = '(function() { label2: for (;;) { break ; label2; }})';
+ actual = uneval(eval(code));
+ compareSource(expect, actual, summary + ': ' + code);
+
+ code = '(function() { return \n x++; })';
+ expect = '(function() { return ; x++; })';
+ actual = uneval(eval(code));
+ compareSource(expect, actual, summary + ': ' + code);
+
+ print('see bug 256617');
+ code = '(function() { throw \n x++; })';
+// expect = '(function() { throw ; x++; })';
+ expect = 'SyntaxError: syntax error';
+ try { uneval(eval(code)); } catch(ex) { actual = ex + ''; };
+// compareSource(expect, actual, summary + ': ' + code);
+ reportCompare(expect, actual, summary + ': ' + code);
+
+ exitFunc ('test');
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/browser.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/browser.js
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-103087.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-103087.js
new file mode 100644
index 0000000000..8cef9404e9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-103087.js
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * bedney@technicalpursuit.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 04 October 2001
+ *
+ * SUMMARY: Arose from Bugzilla bug 103087:
+ * "The RegExp MarkupSPE in demo crashes Mozilla"
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=103087
+ * The SpiderMonkey shell crashed on some of these regexps.
+ *
+ * The reported crash was on i=24 below ('MarkupSPE' regexp)
+ * I crashed on that, and also on i=43 ('XML_SPE' regexp)
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-103087.js';
+var UBound = 0;
+var BUGNUMBER = 103087;
+var summary = "Testing that we don't crash on any of these regexps -";
+var re = '';
+var lm = '';
+var lc = '';
+var rc = '';
+
+
+// the regexps are built in pieces -
+var NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]";
+var NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]";
+var Name = "(" + NameStrt + ")(" + NameChar + ")*";
+var TextSE = "[^<]+";
+var UntilHyphen = "[^-]*-";
+var Until2Hyphens = UntilHyphen + "([^-]" + UntilHyphen + ")*-";
+var CommentCE = Until2Hyphens + ">?";
+var UntilRSBs = "[^]]*]([^]]+])*]+";
+var CDATA_CE = UntilRSBs + "([^]>]" + UntilRSBs + ")*>";
+var S = "[ \\n\\t\\r]+";
+var QuoteSE = '"[^"]' + "*" + '"' + "|'[^']*'";
+var DT_IdentSE = S + Name + "(" + S + "(" + Name + "|" + QuoteSE + "))*";
+var MarkupDeclCE = "([^]\"'><]+|" + QuoteSE + ")*>";
+var S1 = "[\\n\\r\\t ]";
+var UntilQMs = "[^?]*\\?+";
+var PI_Tail = "\\?>|" + S1 + UntilQMs + "([^>?]" + UntilQMs + ")*>";
+var DT_ItemSE = "<(!(--" + Until2Hyphens + ">|[^-]" + MarkupDeclCE + ")|\\?" + Name + "(" + PI_Tail + "))|%" + Name + ";|" + S;
+var DocTypeCE = DT_IdentSE + "(" + S + ")?(\\[(" + DT_ItemSE + ")*](" + S + ")?)?>?";
+var DeclCE = "--(" + CommentCE + ")?|\\[CDATA\\[(" + CDATA_CE + ")?|DOCTYPE(" + DocTypeCE + ")?";
+var PI_CE = Name + "(" + PI_Tail + ")?";
+var EndTagCE = Name + "(" + S + ")?>?";
+var AttValSE = '"[^<"]' + "*" + '"' + "|'[^<']*'";
+var ElemTagCE = Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>?";
+var MarkupSPE = "<(!(" + DeclCE + ")?|\\?(" + PI_CE + ")?|/(" + EndTagCE + ")?|(" + ElemTagCE + ")?)";
+var XML_SPE = TextSE + "|" + MarkupSPE;
+var CommentRE = "<!--" + Until2Hyphens + ">";
+var CommentSPE = "<!--(" + CommentCE + ")?";
+var PI_RE = "<\\?" + Name + "(" + PI_Tail + ")";
+var Erroneous_PI_SE = "<\\?[^?]*(\\?[^>]+)*\\?>";
+var PI_SPE = "<\\?(" + PI_CE + ")?";
+var CDATA_RE = "<!\\[CDATA\\[" + CDATA_CE;
+var CDATA_SPE = "<!\\[CDATA\\[(" + CDATA_CE + ")?";
+var ElemTagSE = "<(" + NameStrt + ")([^<>\"']+|" + AttValSE + ")*>";
+var ElemTagRE = "<" + Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>";
+var ElemTagSPE = "<" + ElemTagCE;
+var EndTagRE = "</" + Name + "(" + S + ")?>";
+var EndTagSPE = "</(" + EndTagCE + ")?";
+var DocTypeSPE = "<!DOCTYPE(" + DocTypeCE + ")?";
+var PERef_APE = "%(" + Name + ";?)?";
+var HexPart = "x([0-9a-fA-F]+;?)?";
+var NumPart = "#([0-9]+;?|" + HexPart + ")?";
+var CGRef_APE = "&(" + Name + ";?|" + NumPart + ")?";
+var Text_PE = CGRef_APE + "|[^&]+";
+var EntityValue_PE = CGRef_APE + "|" + PERef_APE + "|[^%&]+";
+
+
+var rePatterns = new Array(AttValSE, CDATA_CE, CDATA_RE, CDATA_SPE, CGRef_APE, CommentCE, CommentRE, CommentSPE, DT_IdentSE, DT_ItemSE, DeclCE, DocTypeCE, DocTypeSPE, ElemTagCE, ElemTagRE, ElemTagSE, ElemTagSPE, EndTagCE, EndTagRE, EndTagSPE, EntityValue_PE, Erroneous_PI_SE, HexPart, MarkupDeclCE, MarkupSPE, Name, NameChar, NameStrt, NumPart, PERef_APE, PI_CE, PI_RE, PI_SPE, PI_Tail, QuoteSE, S, S1, TextSE, Text_PE, Until2Hyphens, UntilHyphen, UntilQMs, UntilRSBs, XML_SPE);
+
+
+// here's a big string to test the regexps on -
+var str = '';
+str += '<html xmlns="http://www.w3.org/1999/xhtml"' + '\n';
+str += ' xmlns:xlink="http://www.w3.org/XML/XLink/0.9">' + '\n';
+str += ' <head><title>Three Namespaces</title></head>' + '\n';
+str += ' <body>' + '\n';
+str += ' <h1 align="center">An Ellipse and a Rectangle</h1>' + '\n';
+str += ' <svg xmlns="http://www.w3.org/Graphics/SVG/SVG-19991203.dtd" ' + '\n';
+str += ' width="12cm" height="10cm">' + '\n';
+str += ' <ellipse rx="110" ry="130" />' + '\n';
+str += ' <rect x="4cm" y="1cm" width="3cm" height="6cm" />' + '\n';
+str += ' </svg>' + '\n';
+str += ' <p xlink:type="simple" xlink:href="ellipses.html">' + '\n';
+str += ' More about ellipses' + '\n';
+str += ' </p>' + '\n';
+str += ' <p xlink:type="simple" xlink:href="rectangles.html">' + '\n';
+str += ' More about rectangles' + '\n';
+str += ' </p>' + '\n';
+str += ' <hr/>' + '\n';
+str += ' <p>Last Modified February 13, 2000</p> ' + '\n';
+str += ' </body>' + '\n';
+str += '</html>';
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ for (var i=0; i<rePatterns.length; i++)
+ {
+ status = inSection(i);
+ re = new RegExp(rePatterns[i]);
+
+ // Test that we don't crash on any of these -
+ re.exec(str);
+ getResults();
+
+ // Just for the heck of it, test the current leftContext
+ re.exec(lc);
+ getResults();
+
+ // Test the current rightContext
+ re.exec(rc);
+ getResults();
+ }
+
+ reportCompare('No Crash', 'No Crash', '');
+
+ exitFunc ('test');
+}
+
+
+function getResults()
+{
+ lm = RegExp.lastMatch;
+ lc = RegExp.leftContext;
+ rc = RegExp.rightContext;
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-01.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-01.js
new file mode 100644
index 0000000000..f09963a7b5
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-01.js
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * scole@planetweb.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-188206-01.js';
+var UBound = 0;
+var BUGNUMBER = 188206;
+var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
+var TEST_PASSED = 'SyntaxError';
+var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
+var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Now do some weird things on the left side of the regexps -
+ */
+status = inSection(7);
+testThis(' /*a/ ');
+
+status = inSection(8);
+testThis(' /**a/ ');
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+/*
+ * Invalid syntax should generate a SyntaxError
+ */
+function testThis(sInvalidSyntax)
+{
+ expect = TEST_PASSED;
+ actual = TEST_FAILED_BADLY;
+
+ try
+ {
+ eval(sInvalidSyntax);
+ }
+ catch(e)
+ {
+ if (e instanceof SyntaxError)
+ actual = TEST_PASSED;
+ else
+ actual = TEST_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-02.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-02.js
new file mode 100644
index 0000000000..3bd079fae6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-188206-02.js
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * scole@planetweb.com, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-188206-02.js';
+var UBound = 0;
+var BUGNUMBER = 188206;
+var summary = 'Invalid use of regexp quantifiers should generate SyntaxErrors';
+var CHECK_PASSED = 'Should not generate an error';
+var CHECK_FAILED = 'Generated an error!';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+
+/*
+ * Misusing the {DecmalDigits} quantifier - according to ECMA,
+ * but not according to Perl.
+ *
+ * ECMA-262 Edition 3 prohibits the use of unescaped braces in
+ * regexp patterns, unless they form part of a quantifier.
+ *
+ * Hovever, Perl does not prohibit this. If not used as part
+ * of a quantifer, Perl treats braces literally.
+ *
+ * We decided to follow Perl on this for backward compatibility.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=190685.
+ *
+ * Therefore NONE of the following ECMA violations should generate
+ * a SyntaxError. Note we use checkThis() instead of testThis().
+ */
+status = inSection(13);
+checkThis(' /a*{/ ');
+
+status = inSection(14);
+checkThis(' /a{}/ ');
+
+status = inSection(15);
+checkThis(' /{a/ ');
+
+status = inSection(16);
+checkThis(' /}a/ ');
+
+status = inSection(17);
+checkThis(' /x{abc}/ ');
+
+status = inSection(18);
+checkThis(' /{{0}/ ');
+
+status = inSection(19);
+checkThis(' /{{1}/ ');
+
+status = inSection(20);
+checkThis(' /x{{0}/ ');
+
+status = inSection(21);
+checkThis(' /x{{1}/ ');
+
+status = inSection(22);
+checkThis(' /x{{0}}/ ');
+
+status = inSection(23);
+checkThis(' /x{{1}}/ ');
+
+status = inSection(24);
+checkThis(' /x{{0}}/ ');
+
+status = inSection(25);
+checkThis(' /x{{1}}/ ');
+
+status = inSection(26);
+checkThis(' /x{{0}}/ ');
+
+status = inSection(27);
+checkThis(' /x{{1}}/ ');
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+/*
+ * Allowed syntax shouldn't generate any errors
+ */
+function checkThis(sAllowedSyntax)
+{
+ expect = CHECK_PASSED;
+ actual = CHECK_PASSED;
+
+ try
+ {
+ eval(sAllowedSyntax);
+ }
+ catch(e)
+ {
+ actual = CHECK_FAILED;
+ }
+
+ statusitems[UBound] = status;
+ expectedvalues[UBound] = expect;
+ actualvalues[UBound] = actual;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-220367-002.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-220367-002.js
new file mode 100644
index 0000000000..7af2a9d63f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-220367-002.js
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * igor@fastmail.fm, pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 26 September 2003
+ * SUMMARY: Regexp conformance test
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=220367
+ *
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-220367-002.js';
+var UBound = 0;
+var BUGNUMBER = 220367;
+var summary = 'Regexp conformance test';
+var status = '';
+var statusitems = [];
+var actual = '';
+var actualvalues = [];
+var expect= '';
+var expectedvalues = [];
+
+var re = /(a)|(b)/;
+
+re.test('a');
+status = inSection(1);
+actual = RegExp.$1;
+expect = 'a';
+addThis();
+
+status = inSection(2);
+actual = RegExp.$2;
+expect = '';
+addThis();
+
+re.test('b');
+status = inSection(3);
+actual = RegExp.$1;
+expect = '';
+addThis();
+
+status = inSection(4);
+actual = RegExp.$2;
+expect = 'b';
+addThis();
+
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusitems[UBound] = status;
+ actualvalues[UBound] = actual;
+ expectedvalues[UBound] = expect;
+ UBound++;
+}
+
+
+function test()
+{
+ enterFunc('test');
+ printBugNumber(BUGNUMBER);
+ printStatus(summary);
+
+ for (var i=0; i<UBound; i++)
+ {
+ reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-228087.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-228087.js
new file mode 100644
index 0000000000..6e16126cc0
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-228087.js
@@ -0,0 +1,352 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License Version
+* 1.1 (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+* for the specific language governing rights and limitations under the
+* License.
+*
+* The Original Code is JavaScript Engine testing utilities.
+*
+* The Initial Developer of the Original Code is
+* Netscape Communications Corp.
+* Portions created by the Initial Developer are Copyright (C) 2003
+* the Initial Developer. All Rights Reserved.
+*
+* Contributor(s):
+* bex@xaotec.com, PhilSchwartau@aol.com
+*
+* Alternatively, the contents of this file may be used under the terms of
+* either the GNU General Public License Version 2 or later (the "GPL"), or
+* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+* in which case the provisions of the GPL or the LGPL are applicable instead
+* of those above. If you wish to allow use of your version of this file only
+* under the terms of either the GPL or the LGPL, and not to allow others to
+* use your version of this file under the terms of the MPL, indicate your
+* decision by deleting the provisions above and replace them with the notice
+* and other provisions required by the GPL or the LGPL. If you do not delete
+* the provisions above, a recipient may use your version of this file under
+* the terms of any one of the MPL, the GPL or the LGPL.
+*
+* ***** END LICENSE BLOCK ***** */
+
+/*
+ *
+ * Date: 12 December 2003
+ * SUMMARY: Testing regexps with unescaped braces
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=228087
+ *
+ * Note: unbalanced, unescaped braces are not permitted by ECMA-262 Ed.3,
+ * but we decided to follow Perl and IE and allow this for compatibility.
+ *
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=188206 and its testcase.
+ * See http://bugzilla.mozilla.org/show_bug.cgi?id=223273 and its testcase.
+ */
+//-----------------------------------------------------------------------------
+var gTestfile = 'regress-228087.js';
+var i = 0;
+var BUGNUMBER = 228087;
+var summary = 'Testing regexps with unescaped braces';
+var status = '';
+var statusmessages = new Array();
+var pattern = '';
+var patterns = new Array();
+var string = '';
+var strings = new Array();
+var actualmatch = '';
+var actualmatches = new Array();
+var expectedmatch = '';
+var expectedmatches = new Array();
+var e;
+
+
+string = 'foo {1} foo {2} foo';
+
+// try an example with the braces escaped
+status = inSection(1);
+try
+{
+ pattern = new RegExp('\{1.*\}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1} foo {2}');
+addThis();
+
+// just like Section 1, without the braces being escaped
+status = inSection(2);
+try
+{
+ pattern = new RegExp('{1.*}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1} foo {2}');
+addThis();
+
+// try an example with the braces escaped
+status = inSection(3);
+try
+{
+ pattern = new RegExp('\{1[.!\}]*\}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1}');
+addThis();
+
+// just like Section 3, without the braces being escaped
+status = inSection(4);
+try
+{
+ pattern = new RegExp('{1[.!}]*}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1}');
+addThis();
+
+
+string = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de';
+
+// use braces in a normal quantifier construct
+status = inSection(5);
+try
+{
+ pattern = new RegExp('c{3}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('ccc');
+addThis();
+
+// now disrupt the quantifer - the braces should now be interpreted literally
+status = inSection(6);
+try
+{
+ pattern = new RegExp('c{3 }');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
+
+status = inSection(7);
+try
+{
+ pattern = new RegExp('c{3.}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
+
+status = inSection(8);
+try
+{
+ // need to escape the \ in \s since
+ // this has been converted to a constructor call
+ // instead of a literal regexp
+ pattern = new RegExp('c{3\\s}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
+
+status = inSection(9);
+try
+{
+ pattern = new RegExp('c{3[ ]}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
+
+status = inSection(10);
+try
+{
+ pattern = new RegExp('c{ 3}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{ 3}');
+addThis();
+
+// using braces in a normal quantifier construct again
+status = inSection(11);
+try
+{
+ pattern = new RegExp('c{3,}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('ccccc');
+addThis();
+
+// now disrupt it - the braces should now be interpreted literally
+status = inSection(12);
+try
+{
+ pattern = new RegExp('c{3, }');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3, }');
+addThis();
+
+status = inSection(13);
+try
+{
+ pattern = new RegExp('c{3 ,}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 ,}');
+addThis();
+
+// using braces in a normal quantifier construct again
+status = inSection(14);
+try
+{
+ pattern = new RegExp('c{3,4}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('cccc');
+addThis();
+
+// now disrupt it - the braces should now be interpreted literally
+status = inSection(15);
+try
+{
+ pattern = new RegExp('c{3 ,4}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 ,4}');
+addThis();
+
+status = inSection(16);
+try
+{
+ pattern = new RegExp('c{3, 4}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3, 4}');
+addThis();
+
+status = inSection(17);
+try
+{
+ pattern = new RegExp('c{3,4 }');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3,4 }');
+addThis();
+
+
+
+
+//-------------------------------------------------------------------------------------------------
+test();
+//-------------------------------------------------------------------------------------------------
+
+
+
+function addThis()
+{
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
+}
+
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-274152.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-274152.js
new file mode 100755
index 0000000000..d7074d9128
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-274152.js
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-274152.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 274152;
+var summary = 'Do not ignore unicode format-control characters';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ expect = 'SyntaxError: illegal character';
+
+ var formatcontrolchars = ['\u200C',
+ '\u200D',
+ '\u200E',
+ '\u0600',
+ '\u0601',
+ '\u0602',
+ '\u0603',
+ '\u06DD',
+ '\u070F'];
+
+ for (var i = 0; i < formatcontrolchars.length; i++)
+ {
+ try
+ {
+ eval("hi" + formatcontrolchars[i] + "there = 'howdie';");
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary + ': ' + i);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-320854.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-320854.js
new file mode 100755
index 0000000000..85e684882f
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-320854.js
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-320854.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 320854;
+var summary = 'o.hasOwnProperty("length") should not lie when o has function in proto chain';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var o = {__proto__:function(){}};
+
+expect = false;
+actual = o.hasOwnProperty('length')
+
+ reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-327170.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-327170.js
new file mode 100755
index 0000000000..5d15ce31a9
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-327170.js
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jonas Jonsson
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-327170.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 327170;
+var summary = 'Reuse of RegExp in string.replace(rx.compile(...), function() { rx.compile(...); }) causes a crash';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+printBugNumber(BUGNUMBER);
+printStatus (summary);
+
+var g_rx = /(?:)/;
+
+"this is a test-string".replace(g_rx.compile("test", "g"),
+ function()
+ {
+ // re-use of the g_rx RegExp object,
+ // that's currently in use by the replace fn.
+ g_rx.compile("string", "g");
+ });
+
+reportCompare(expect, actual, summary);
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-368516.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-368516.js
new file mode 100755
index 0000000000..a5f5fb769b
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-368516.js
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Brendan Eich
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-368516.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 368516;
+var summary = 'Treat unicode BOM characters as whitespace';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ var bomchars = ['\uFFFE',
+ '\uFEFF'];
+
+ for (var i = 0; i < bomchars.length; i++)
+ {
+ expect = 'howdie';
+ actual = '';
+
+ try
+ {
+ eval("var" + bomchars[i] + "hithere = 'howdie';");
+ actual = hithere;
+ }
+ catch(ex)
+ {
+ actual = ex + '';
+ }
+
+ reportCompare(expect, actual, summary + ': ' + i);
+ }
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-385393-03.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-385393-03.js
new file mode 100755
index 0000000000..40c7e8dd81
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-385393-03.js
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-385393-03.js';
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 385393;
+var summary = 'Regression test for bug 385393';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ f = (function() { new (delete y) });
+ eval(uneval(f))
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-429248.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-429248.js
new file mode 100755
index 0000000000..9966269115
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-429248.js
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Jesse Ruderman
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-429248.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 429248;
+var summary = 'Do not assert: 0';
+var actual = 'No Crash';
+var expect = 'No Crash';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function c() { do{}while(0) }
+
+ if (typeof trap == 'function')
+ {
+ trap(c, 0, "");
+ }
+ c + '';
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-430740.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-430740.js
new file mode 100755
index 0000000000..446adb95a6
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/regress-430740.js
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Dave Reed
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'regress-430740.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 430740;
+var summary = 'Do not strip format-control characters from string literals';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ function doevil() {
+ print('evildone');
+ return 'evildone';
+ }
+
+ expect = 'a%E2%80%8D,+doevil()%5D)//';
+ actual += eval("(['a\\\u200d', '+doevil()])//'])");
+ actual = encodeURI(actual);
+ reportCompare(expect, actual, summary);
+
+ expect = 'a%EF%BF%BE,+doevil()%5D)//';
+ actual = eval("(['a\\\ufffe', '+doevil()])//'])");
+ actual = encodeURI(actual);
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/extensions/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/extensions/shell.js
new file mode 100644
index 0000000000..d83e3591af
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/extensions/shell.js
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * pschwartau@netscape.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * Date: 07 February 2001
+ *
+ * Functionality common to RegExp testing -
+ */
+//-----------------------------------------------------------------------------
+
+gTestsubsuite = 'extensions';
+
+var MSG_PATTERN = '\nregexp = ';
+var MSG_STRING = '\nstring = ';
+var MSG_EXPECT = '\nExpect: ';
+var MSG_ACTUAL = '\nActual: ';
+var ERR_LENGTH = '\nERROR !!! match arrays have different lengths:';
+var ERR_MATCH = '\nERROR !!! regexp failed to give expected match array:';
+var ERR_NO_MATCH = '\nERROR !!! regexp FAILED to match anything !!!';
+var ERR_UNEXP_MATCH = '\nERROR !!! regexp MATCHED when we expected it to fail !!!';
+var CHAR_LBRACKET = '[';
+var CHAR_RBRACKET = ']';
+var CHAR_QT_DBL = '"';
+var CHAR_QT = "'";
+var CHAR_NL = '\n';
+var CHAR_COMMA = ',';
+var CHAR_SPACE = ' ';
+var TYPE_STRING = typeof 'abc';
+
+
+
+function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches)
+{
+ var status = '';
+ var pattern = new RegExp();
+ var string = '';
+ var actualmatch = new Array();
+ var expectedmatch = new Array();
+ var state = '';
+ var lActual = -1;
+ var lExpect = -1;
+
+
+ for (var i=0; i != patterns.length; i++)
+ {
+ status = statuses[i];
+ pattern = patterns[i];
+ string = strings[i];
+ actualmatch=actualmatches[i];
+ expectedmatch=expectedmatches[i];
+ state = getState(status, pattern, string);
+
+ description = status;
+
+ if(actualmatch)
+ {
+ actual = formatArray(actualmatch);
+ if(expectedmatch)
+ {
+ // expectedmatch and actualmatch are arrays -
+ lExpect = expectedmatch.length;
+ lActual = actualmatch.length;
+
+ var expected = formatArray(expectedmatch);
+
+ if (lActual != lExpect)
+ {
+ reportCompare(lExpect, lActual,
+ state + ERR_LENGTH +
+ MSG_EXPECT + expected +
+ MSG_ACTUAL + actual +
+ CHAR_NL
+ );
+ continue;
+ }
+
+ // OK, the arrays have same length -
+ if (expected != actual)
+ {
+ reportCompare(expected, actual,
+ state + ERR_MATCH +
+ MSG_EXPECT + expected +
+ MSG_ACTUAL + actual +
+ CHAR_NL
+ );
+ }
+ else
+ {
+ reportCompare(expected, actual, state)
+ }
+
+ }
+ else //expectedmatch is null - that is, we did not expect a match -
+ {
+ expected = expectedmatch;
+ reportCompare(expected, actual,
+ state + ERR_UNEXP_MATCH +
+ MSG_EXPECT + expectedmatch +
+ MSG_ACTUAL + actual +
+ CHAR_NL
+ );
+ }
+
+ }
+ else // actualmatch is null
+ {
+ if (expectedmatch)
+ {
+ actual = actualmatch;
+ reportCompare(expected, actual,
+ state + ERR_NO_MATCH +
+ MSG_EXPECT + expectedmatch +
+ MSG_ACTUAL + actualmatch +
+ CHAR_NL
+ );
+ }
+ else // we did not expect a match
+ {
+ // Being ultra-cautious. Presumably expectedmatch===actualmatch===null
+ expected = expectedmatch;
+ actual = actualmatch;
+ reportCompare (expectedmatch, actualmatch, state);
+ }
+ }
+ }
+}
+
+
+function getState(status, pattern, string)
+{
+ /*
+ * Escape \n's, etc. to make them LITERAL in the presentation string.
+ * We don't have to worry about this in |pattern|; such escaping is
+ * done automatically by pattern.toString(), invoked implicitly below.
+ *
+ * One would like to simply do: string = string.replace(/(\s)/g, '\$1').
+ * However, the backreference $1 is not a literal string value,
+ * so this method doesn't work.
+ *
+ * Also tried string = string.replace(/(\s)/g, escape('$1'));
+ * but this just inserts the escape of the literal '$1', i.e. '%241'.
+ */
+ string = string.replace(/\n/g, '\\n');
+ string = string.replace(/\r/g, '\\r');
+ string = string.replace(/\t/g, '\\t');
+ string = string.replace(/\v/g, '\\v');
+ string = string.replace(/\f/g, '\\f');
+
+ return (status + MSG_PATTERN + pattern + MSG_STRING + singleQuote(string));
+}
+
+
+/*
+ * If available, arr.toSource() gives more detail than arr.toString()
+ *
+ * var arr = Array(1,2,'3');
+ *
+ * arr.toSource()
+ * [1, 2, "3"]
+ *
+ * arr.toString()
+ * 1,2,3
+ *
+ * But toSource() doesn't exist in Rhino, so use our own imitation, below -
+ *
+ */
+function formatArray(arr)
+{
+ try
+ {
+ return arr.toSource();
+ }
+ catch(e)
+ {
+ return toSource(arr);
+ }
+}
+
+
+/*
+ * Imitate SpiderMonkey's arr.toSource() method:
+ *
+ * a) Double-quote each array element that is of string type
+ * b) Represent |undefined| and |null| by empty strings
+ * c) Delimit elements by a comma + single space
+ * d) Do not add delimiter at the end UNLESS the last element is |undefined|
+ * e) Add square brackets to the beginning and end of the string
+ */
+function toSource(arr)
+{
+ var delim = CHAR_COMMA + CHAR_SPACE;
+ var elt = '';
+ var ret = '';
+ var len = arr.length;
+
+ for (i=0; i<len; i++)
+ {
+ elt = arr[i];
+
+ switch(true)
+ {
+ case (typeof elt === TYPE_STRING) :
+ ret += doubleQuote(elt);
+ break;
+
+ case (elt === undefined || elt === null) :
+ break; // add nothing but the delimiter, below -
+
+ default:
+ ret += elt.toString();
+ }
+
+ if ((i < len-1) || (elt === undefined))
+ ret += delim;
+ }
+
+ return CHAR_LBRACKET + ret + CHAR_RBRACKET;
+}
+
+
+function doubleQuote(text)
+{
+ return CHAR_QT_DBL + text + CHAR_QT_DBL;
+}
+
+
+function singleQuote(text)
+{
+ return CHAR_QT + text + CHAR_QT;
+}
+
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/shell.js b/tests/auto/qml/parserstress/tests/ecma_3/shell.js
new file mode 100644
index 0000000000..ea63a51957
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/shell.js
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+gTestsuite = 'ecma_3';
diff --git a/tests/auto/qml/parserstress/tests/ecma_3/template.js b/tests/auto/qml/parserstress/tests/ecma_3/template.js
new file mode 100755
index 0000000000..4dedd5a0e3
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/ecma_3/template.js
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gTestfile = 'template.js';
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 99999;
+var summary = '';
+var actual = '';
+var expect = '';
+
+
+//-----------------------------------------------------------------------------
+test();
+//-----------------------------------------------------------------------------
+
+function test()
+{
+ enterFunc ('test');
+ printBugNumber(BUGNUMBER);
+ printStatus (summary);
+
+ reportCompare(expect, actual, summary);
+
+ exitFunc ('test');
+}
diff --git a/tests/auto/qml/parserstress/tests/shell.js b/tests/auto/qml/parserstress/tests/shell.js
new file mode 100644
index 0000000000..40af0f3799
--- /dev/null
+++ b/tests/auto/qml/parserstress/tests/shell.js
@@ -0,0 +1,886 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rob Ginda rginda@netscape.com
+ * Bob Clary bob@bclary.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// Spidermonkey shell now defaults to 1.8, so set the basic version to
+// 1.5 for backwards compatibility.
+
+if (typeof version != 'undefined')
+{
+ version(150);
+}
+
+var STATUS = "STATUS: ";
+var VERBOSE = false;
+var SECT_PREFIX = 'Section ';
+var SECT_SUFFIX = ' of test - ';
+var callStack = new Array();
+
+var gTestfile;
+var gTestPath;
+var gTestsuite;
+var gTestsubsuite;
+var gDelayTestDriverEnd = false;
+
+var gTestcases = new Array();
+var gTc = gTestcases.length;
+var BUGNUMBER = '';
+var summary = '';
+var description = '';
+var expected = '';
+var actual = '';
+var msg = '';
+
+var SECTION = "";
+var VERSION = "";
+var BUGNUMBER = "";
+
+/*
+ * constant strings
+ */
+var GLOBAL = this + '';
+var PASSED = " PASSED! ";
+var FAILED = " FAILED! ";
+
+var DEBUG = false;
+
+var DESCRIPTION;
+var EXPECTED;
+
+/*
+ * wrapper for test case constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ new TestCase( SECTION, description, expect, actual );
+}
+
+/*
+ * Set up test environment.
+ *
+ */
+function startTest() {
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ print ("BUGNUMBER: " + BUGNUMBER );
+ }
+ if ( typeof version != 'function') {
+ return;
+ }
+
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ else if ( VERSION == "JS_1.8" || gTestsuite == 'js1_8') {
+ version ( "180" );
+ }
+ else if ( VERSION == "JS_1.7" || gTestsuite == 'js1_7') {
+ version ( "170" );
+ }
+ else if ( VERSION == "JS_1.6" || gTestsuite == 'js1_6') {
+ version ( "160" );
+ }
+ else if ( VERSION == "JS_1.5" || gTestsuite == 'js1_5') {
+ version ( "150" );
+ }
+ else if ( VERSION == "JS_1.4" || gTestsuite == 'js1_4') {
+ version ( "140" );
+ }
+ else if ( VERSION == "JS_1.3" || gTestsuite == 'js1_3') {
+ version ( "130" );
+ }
+ else if ( VERSION == "JS_1.2" || gTestsuite == 'js1_2') {
+ version ( "120" );
+ }
+ else if ( VERSION == "JS_1.1" || gTestsuite == 'js1_1') {
+ version ( "110" );
+ }
+}
+
+function TestCase(n, d, e, a)
+{
+ this.path = (typeof gTestPath == 'undefined') ?
+ (gTestsuite + '/' + gTestsubsuite + '/' + gTestfile) :
+ gTestPath;
+ this.file = gTestfile;
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = getTestCaseResult(e, a);
+ this.reason = '';
+ this.bugnumber = typeof(BUGNUMER) != 'undefined' ? BUGNUMBER : '';
+ this.type = (typeof window == 'undefined' ? 'shell' : 'browser');
+ gTestcases[gTc++] = this;
+}
+
+TestCase.prototype.dump = function () {
+ dump('\njstest: ' + this.path + ' ' +
+ 'bug: ' + this.bugnumber + ' ' +
+ 'result: ' + (this.passed ? 'PASSED':'FAILED') + ' ' +
+ 'type: ' + this.type + ' ' +
+ 'description: ' + toPrinted(this.description) + ' ' +
+// 'expected: ' + toPrinted(this.expect) + ' ' +
+// 'actual: ' + toPrinted(this.actual) + ' ' +
+ 'reason: ' + toPrinted(this.reason) + '\n');
+};
+
+/*
+ * The test driver searches for such a phrase in the test output.
+ * If such phrase exists, it will set n as the expected exit code.
+ */
+function expectExitCode(n)
+{
+ print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---');
+}
+
+/*
+ * Statuses current section of a test
+ */
+function inSection(x)
+{
+ return SECT_PREFIX + x + SECT_SUFFIX;
+}
+
+/*
+ * Report a failure in the 'accepted' manner
+ */
+function reportFailure (msg)
+{
+ var lines = msg.split ("\n");
+ var l;
+ var funcName = currentFunc();
+ var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
+
+ for (var i=0; i<lines.length; i++)
+ print (FAILED + prefix + lines[i]);
+}
+
+/*
+ * Print a non-failure message.
+ */
+function printStatus (msg)
+{
+/* js1_6 had...
+ msg = String(msg);
+ msg = msg.toString();
+*/
+ msg = msg.toString();
+ var lines = msg.split ("\n");
+ var l;
+
+ for (var i=0; i<lines.length; i++)
+ print (STATUS + lines[i]);
+}
+
+/*
+ * Print a bugnumber message.
+ */
+function printBugNumber (num)
+{
+ BUGNUMBER = num;
+ print ('BUGNUMBER: ' + num);
+}
+
+function toPrinted(value)
+{
+ if (typeof value == "xml")
+ {
+ value = value.toXMLString();
+ }
+ else
+ {
+ value = String(value);
+ }
+ value = value.replace(/\\n/g, 'NL')
+ .replace(/\n/g, 'NL')
+ .replace(/\\r/g, 'CR')
+ .replace(/[^\x20-\x7E]+/g, escapeString);
+ return value;
+}
+
+function escapeString (str)
+{
+ var a, b, c, d;
+ var len = str.length;
+ var result = "";
+ var digits = ["0", "1", "2", "3", "4", "5", "6", "7",
+ "8", "9", "A", "B", "C", "D", "E", "F"];
+
+ for (var i=0; i<len; i++)
+ {
+ var ch = str.charCodeAt(i);
+
+ a = digits[ch & 0xf];
+ ch >>= 4;
+ b = digits[ch & 0xf];
+ ch >>= 4;
+
+ if (ch)
+ {
+ c = digits[ch & 0xf];
+ ch >>= 4;
+ d = digits[ch & 0xf];
+
+ result += "\\u" + d + c + b + a;
+ }
+ else
+ {
+ result += "\\x" + b + a;
+ }
+ }
+
+ return result;
+}
+
+/*
+ * Compare expected result to actual result, if they differ (in value and/or
+ * type) report a failure. If description is provided, include it in the
+ * failure report.
+ */
+function reportCompare (expected, actual, description) {
+ var expected_t = typeof expected;
+ var actual_t = typeof actual;
+ var output = "";
+
+ if (typeof description == "undefined")
+ {
+ description = '';
+ }
+ else if (VERBOSE)
+ {
+ printStatus ("Comparing '" + description + "'");
+ }
+
+ if (expected_t != actual_t)
+ {
+ output += "Type mismatch, expected type " + expected_t +
+ ", actual type " + actual_t + " ";
+ }
+ else if (VERBOSE)
+ {
+ printStatus ("Expected type '" + expected_t + "' matched actual " +
+ "type '" + actual_t + "'");
+ }
+
+ if (expected != actual)
+ {
+ output += "Expected value '" + toPrinted(expected) +
+ "', Actual value '" + toPrinted(actual) + "' ";
+ }
+ else if (VERBOSE)
+ {
+ printStatus ("Expected value '" + toPrinted(expected) +
+ "' matched actual value '" + toPrinted(actual) + "'");
+ }
+
+ var testcase = new TestCase(gTestfile, description, expected, actual);
+ testcase.reason = output;
+
+ if (testcase.passed)
+ {
+ print(PASSED + description);
+ }
+ else
+ {
+ reportFailure (description + " : " + output);
+ }
+
+ return testcase.passed;
+}
+
+/*
+ * Attempt to match a regular expression describing the result to
+ * the actual result, if they differ (in value and/or
+ * type) report a failure. If description is provided, include it in the
+ * failure report.
+ */
+function reportMatch (expectedRegExp, actual, description) {
+ var expected_t = "string";
+ var actual_t = typeof actual;
+ var output = "";
+
+ if (typeof description == "undefined")
+ {
+ description = '';
+ }
+ else if (VERBOSE)
+ {
+ printStatus ("Comparing '" + description + "'");
+ }
+
+ if (expected_t != actual_t)
+ {
+ output += "Type mismatch, expected type " + expected_t +
+ ", actual type " + actual_t + " ";
+ }
+ else if (VERBOSE)
+ {
+ printStatus ("Expected type '" + expected_t + "' matched actual " +
+ "type '" + actual_t + "'");
+ }
+
+ var matches = expectedRegExp.test(actual);
+ if (!matches)
+ {
+ output += "Expected match to '" + toPrinted(expectedRegExp) +
+ "', Actual value '" + toPrinted(actual) + "' ";
+ }
+ else if (VERBOSE)
+ {
+ printStatus ("Expected match to '" + toPrinted(expectedRegExp) +
+ "' matched actual value '" + toPrinted(actual) + "'");
+ }
+
+ var testcase = new TestCase(gTestfile, description, true, matches);
+ testcase.reason = output;
+
+ if (testcase.passed)
+ {
+ print(PASSED + description);
+ }
+ else
+ {
+ reportFailure (description + " : " + output);
+ }
+
+ return testcase.passed;
+}
+
+/*
+ * Puts funcName at the top of the call stack. This stack is used to show
+ * a function-reported-from field when reporting failures.
+ */
+function enterFunc (funcName)
+{
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ callStack.push(funcName);
+}
+
+/*
+ * Pops the top funcName off the call stack. funcName is optional, and can be
+ * used to check push-pop balance.
+ */
+function exitFunc (funcName)
+{
+ var lastFunc = callStack.pop();
+
+ if (funcName)
+ {
+ if (!funcName.match(/\(\)$/))
+ funcName += "()";
+
+ if (lastFunc != funcName)
+ reportCompare(funcName, lastFunc, "Test driver failure wrong exit function ");
+ }
+}
+
+/*
+ * Peeks at the top of the call stack.
+ */
+function currentFunc()
+{
+ return callStack[callStack.length - 1];
+}
+
+/*
+ Calculate the "order" of a set of data points {X: [], Y: []}
+ by computing successive "derivatives" of the data until
+ the data is exhausted or the derivative is linear.
+*/
+function BigO(data)
+{
+ var order = 0;
+ var origLength = data.X.length;
+
+ while (data.X.length > 2)
+ {
+ var lr = new LinearRegression(data);
+ if (lr.b > 1e-6)
+ {
+ // only increase the order if the slope
+ // is "great" enough
+ order++;
+ }
+
+ if (lr.r > 0.98 || lr.Syx < 1 || lr.b < 1e-6)
+ {
+ // terminate if close to a line lr.r
+ // small error lr.Syx
+ // small slope lr.b
+ break;
+ }
+ data = dataDeriv(data);
+ }
+
+ if (2 == origLength - order)
+ {
+ order = Number.POSITIVE_INFINITY;
+ }
+ return order;
+
+ function LinearRegression(data)
+ {
+ /*
+ y = a + bx
+ for data points (Xi, Yi); 0 <= i < n
+
+ b = (n*SUM(XiYi) - SUM(Xi)*SUM(Yi))/(n*SUM(Xi*Xi) - SUM(Xi)*SUM(Xi))
+ a = (SUM(Yi) - b*SUM(Xi))/n
+ */
+ var i;
+
+ if (data.X.length != data.Y.length)
+ {
+ throw 'LinearRegression: data point length mismatch';
+ }
+ if (data.X.length < 3)
+ {
+ throw 'LinearRegression: data point length < 2';
+ }
+ var n = data.X.length;
+ var X = data.X;
+ var Y = data.Y;
+
+ this.Xavg = 0;
+ this.Yavg = 0;
+
+ var SUM_X = 0;
+ var SUM_XY = 0;
+ var SUM_XX = 0;
+ var SUM_Y = 0;
+ var SUM_YY = 0;
+
+ for (i = 0; i < n; i++)
+ {
+ SUM_X += X[i];
+ SUM_XY += X[i]*Y[i];
+ SUM_XX += X[i]*X[i];
+ SUM_Y += Y[i];
+ SUM_YY += Y[i]*Y[i];
+ }
+
+ this.b = (n * SUM_XY - SUM_X * SUM_Y)/(n * SUM_XX - SUM_X * SUM_X);
+ this.a = (SUM_Y - this.b * SUM_X)/n;
+
+ this.Xavg = SUM_X/n;
+ this.Yavg = SUM_Y/n;
+
+ var SUM_Ydiff2 = 0;
+ var SUM_Xdiff2 = 0;
+ var SUM_XdiffYdiff = 0;
+
+ for (i = 0; i < n; i++)
+ {
+ var Ydiff = Y[i] - this.Yavg;
+ var Xdiff = X[i] - this.Xavg;
+
+ SUM_Ydiff2 += Ydiff * Ydiff;
+ SUM_Xdiff2 += Xdiff * Xdiff;
+ SUM_XdiffYdiff += Xdiff * Ydiff;
+ }
+
+ var Syx2 = (SUM_Ydiff2 - Math.pow(SUM_XdiffYdiff/SUM_Xdiff2, 2))/(n - 2);
+ var r2 = Math.pow((n*SUM_XY - SUM_X * SUM_Y), 2) /
+ ((n*SUM_XX - SUM_X*SUM_X)*(n*SUM_YY-SUM_Y*SUM_Y));
+
+ this.Syx = Math.sqrt(Syx2);
+ this.r = Math.sqrt(r2);
+
+ }
+
+ function dataDeriv(data)
+ {
+ if (data.X.length != data.Y.length)
+ {
+ throw 'length mismatch';
+ }
+ var length = data.X.length;
+
+ if (length < 2)
+ {
+ throw 'length ' + length + ' must be >= 2';
+ }
+ var X = data.X;
+ var Y = data.Y;
+
+ var deriv = {X: [], Y: [] };
+
+ for (var i = 0; i < length - 1; i++)
+ {
+ deriv.X[i] = (X[i] + X[i+1])/2;
+ deriv.Y[i] = (Y[i+1] - Y[i])/(X[i+1] - X[i]);
+ }
+ return deriv;
+ }
+
+ return 0;
+}
+
+function compareSource(expect, actual, summary)
+{
+ // compare source
+ var expectP = expect.
+ replace(/([(){},.:\[\]])/mg, ' $1 ').
+ replace(/(\w+)/mg, ' $1 ').
+ replace(/<(\/)? (\w+) (\/)?>/mg, '<$1$2$3>').
+ replace(/\s+/mg, ' ').
+ replace(/new (\w+)\s*\(\s*\)/mg, 'new $1');
+
+ var actualP = actual.
+ replace(/([(){},.:\[\]])/mg, ' $1 ').
+ replace(/(\w+)/mg, ' $1 ').
+ replace(/<(\/)? (\w+) (\/)?>/mg, '<$1$2$3>').
+ replace(/\s+/mg, ' ').
+ replace(/new (\w+)\s*\(\s*\)/mg, 'new $1');
+
+ print('expect:\n' + expectP);
+ print('actual:\n' + actualP);
+
+ reportCompare(expectP, actualP, summary);
+
+ // actual must be compilable if expect is?
+ try
+ {
+ var expectCompile = 'No Error';
+ var actualCompile;
+
+ eval(expect);
+ try
+ {
+ eval(actual);
+ actualCompile = 'No Error';
+ }
+ catch(ex1)
+ {
+ actualCompile = ex1 + '';
+ }
+ reportCompare(expectCompile, actualCompile,
+ summary + ': compile actual');
+ }
+ catch(ex)
+ {
+ }
+}
+
+function optionsInit() {
+
+ // record initial values to support resetting
+ // options to their initial values
+ options.initvalues = {};
+
+ // record values in a stack to support pushing
+ // and popping options
+ options.stackvalues = [];
+
+ var optionNames = options().split(',');
+
+ for (var i = 0; i < optionNames.length; i++)
+ {
+ var optionName = optionNames[i];
+ if (optionName)
+ {
+ options.initvalues[optionName] = '';
+ }
+ }
+}
+
+function optionsClear() {
+
+ // turn off current settings
+ var optionNames = options().split(',');
+ for (var i = 0; i < optionNames.length; i++)
+ {
+ var optionName = optionNames[i];
+ if (optionName)
+ {
+ options(optionName);
+ }
+ }
+}
+
+function optionsPush()
+{
+ var optionsframe = {};
+
+ options.stackvalues.push(optionsframe);
+
+ var optionNames = options().split(',');
+
+ for (var i = 0; i < optionNames.length; i++)
+ {
+ var optionName = optionNames[i];
+ if (optionName)
+ {
+ optionsframe[optionName] = '';
+ }
+ }
+
+ optionsClear();
+}
+
+function optionsPop()
+{
+ var optionsframe = options.stackvalues.pop();
+
+ optionsClear();
+
+ for (optionName in optionsframe)
+ {
+ options(optionName);
+ }
+
+}
+
+function optionsReset() {
+
+ optionsClear();
+
+ // turn on initial settings
+ for (optionName in options.initvalues)
+ {
+ options(optionName);
+ }
+}
+
+if (typeof options == 'function')
+{
+ optionsInit();
+ optionsClear();
+}
+
+function getTestCaseResult(expected, actual)
+{
+ var expected_t = typeof expected;
+ var actual_t = typeof actual;
+ var passed = true;
+
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual )
+ {
+ if ( actual_t == "object" )
+ {
+ actual = "NaN object";
+ }
+ else
+ {
+ actual = "NaN number";
+ }
+ }
+ if ( expected != expected )
+ {
+ if ( expected_t == "object" )
+ {
+ expected = "NaN object";
+ }
+ else
+ {
+ expected = "NaN number";
+ }
+ }
+
+ if (expected_t != actual_t)
+ {
+ passed = false;
+ }
+ else if (expected != actual)
+ {
+ if (expected_t != 'number' || (Math.abs(actual - expected) > 1E-10))
+ {
+ passed = false;
+ }
+ }
+
+ return passed;
+}
+
+if (typeof dump == 'undefined')
+{
+ if (typeof window == 'undefined' &&
+ typeof print == 'function')
+ {
+ dump = print;
+ }
+ else
+ {
+ dump = (function () {});
+ }
+}
+
+function test() {
+ for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
+ // temporary hack to work around some unknown issue in 1.7
+ try
+ {
+ gTestcases[gTc].passed = writeTestCaseResult(
+ gTestcases[gTc].expect,
+ gTestcases[gTc].actual,
+ gTestcases[gTc].description +" = "+ gTestcases[gTc].actual );
+ gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
+ }
+ catch(e)
+ {
+ print('test(): empty testcase for gTc = ' + gTc + ' ' + e);
+ }
+ }
+ stopTest();
+ return ( gTestcases );
+}
+
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
+}
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = ( passed ? PASSED : FAILED ) + string + ' expected: ' + expect;
+ print(s);
+ return passed;
+}
+
+function writeHeaderToLog( string ) {
+ print( string );
+}
+/* end of print functions */
+
+
+/*
+ * When running in the shell, run the garbage collector after the
+ * test has completed.
+ */
+
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
+}
+
+/*
+ * Convenience function for displaying failed test cases. Useful
+ * when running tests manually.
+ *
+ */
+function getFailedCases() {
+ for ( var i = 0; i < gTestcases.length; i++ ) {
+ if ( ! gTestcases[i].passed ) {
+ print( gTestcases[i].description + " = " +gTestcases[i].actual +
+ " expected: " + gTestcases[i].expect );
+ }
+ }
+}
+
+function jsTestDriverEnd()
+{
+ // gDelayTestDriverEnd is used to
+ // delay collection of the test result and
+ // signal to Spider so that tests can continue
+ // to run after page load has fired. They are
+ // responsible for setting gDelayTestDriverEnd = true
+ // then when completed, setting gDelayTestDriverEnd = false
+ // then calling jsTestDriverEnd()
+
+ if (gDelayTestDriverEnd)
+ {
+ return;
+ }
+
+ try
+ {
+ optionsReset();
+ }
+ catch(ex)
+ {
+ dump('jsTestDriverEnd ' + ex);
+ }
+
+ for (var i = 0; i < gTestcases.length; i++)
+ {
+ gTestcases[i].dump();
+ }
+
+}
+
+function jit(on)
+{
+ if (on && !options().match(/jit/))
+ {
+ options('jit');
+ }
+ else if (!on && options().match(/jit/))
+ {
+ options('jit');
+ }
+}
+
+/*
+ * Some tests need to know if we are in Rhino as opposed to SpiderMonkey
+ */
+function inRhino()
+{
+ return (typeof defineClass == "function");
+}
+
+/* these functions are useful for running tests manually in Rhino */
+
+function GetContext() {
+ return Packages.com.netscape.javascript.Context.getCurrentContext();
+}
+function OptLevel( i ) {
+ i = Number(i);
+ var cx = GetContext();
+ cx.setOptimizationLevel(i);
+}
+/* end of Rhino functions */
+
+
diff --git a/tests/auto/qml/parserstress/tst_parserstress.cpp b/tests/auto/qml/parserstress/tst_parserstress.cpp
new file mode 100644
index 0000000000..afa58f4437
--- /dev/null
+++ b/tests/auto/qml/parserstress/tst_parserstress.cpp
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QDebug>
+#include <QDir>
+#include <QFile>
+
+class tst_parserstress : public QObject
+{
+ Q_OBJECT
+public:
+ tst_parserstress() {}
+
+private slots:
+ void ecmascript_data();
+ void ecmascript();
+
+private:
+ static QStringList findJSFiles(const QDir &);
+ QQmlEngine engine;
+};
+
+QStringList tst_parserstress::findJSFiles(const QDir &d)
+{
+ QStringList rv;
+
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.js"),
+ QDir::Files);
+ foreach (const QString &file, files) {
+ if (file == "browser.js")
+ continue;
+ rv << d.absoluteFilePath(file);
+ }
+
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QDir::NoSymLinks);
+ foreach (const QString &dir, dirs) {
+ QDir sub = d;
+ sub.cd(dir);
+ rv << findJSFiles(sub);
+ }
+
+ return rv;
+}
+
+void tst_parserstress::ecmascript_data()
+{
+ QString testDataDir = QFileInfo(QFINDTESTDATA("tests/shell.js")).absolutePath();
+ QVERIFY2(!testDataDir.isEmpty(), qPrintable("Cannot find testDataDir!"));
+
+ QDir dir(testDataDir);
+ QStringList files = findJSFiles(dir);
+
+ QTest::addColumn<QString>("file");
+ foreach (const QString &file, files) {
+ QTest::newRow(qPrintable(file)) << file;
+ }
+}
+
+void tst_parserstress::ecmascript()
+{
+ QFETCH(QString, file);
+
+ QFile f(file);
+ QVERIFY(f.open(QIODevice::ReadOnly));
+
+ QByteArray data = f.readAll();
+
+ QVERIFY(!data.isEmpty());
+
+ QString dataStr = QString::fromUtf8(data);
+
+ QString qml = "import QtQuick 2.0\n";
+ qml+= "\n";
+ qml+= "QtObject {\n";
+ qml+= " property int test\n";
+ qml+= " test: {\n";
+ qml+= dataStr + "\n";
+ qml+= " return 1;\n";
+ qml+= " }\n";
+ qml+= " function stress() {\n";
+ qml+= dataStr;
+ qml+= " }\n";
+ qml+= "}\n";
+
+ QByteArray qmlData = qml.toUtf8();
+
+ QQmlComponent component(&engine);
+
+ component.setData(qmlData, QUrl());
+
+ QFileInfo info(file);
+
+ if (info.fileName() == QLatin1String("regress-352044-02-n.js")) {
+ QVERIFY(component.isError());
+
+ QCOMPARE(component.errors().length(), 2);
+
+ QCOMPARE(component.errors().at(0).description(), QString("Expected token `;'"));
+ QCOMPARE(component.errors().at(0).line(), 66);
+
+ QCOMPARE(component.errors().at(1).description(), QString("Expected token `;'"));
+ QCOMPARE(component.errors().at(1).line(), 142);
+
+ } else {
+
+ QVERIFY(!component.isError());
+ }
+}
+
+
+QTEST_MAIN(tst_parserstress)
+
+#include "tst_parserstress.moc"
diff --git a/tests/auto/qml/qjsengine/qjsengine.pro b/tests/auto/qml/qjsengine/qjsengine.pro
new file mode 100644
index 0000000000..85b6a07c90
--- /dev/null
+++ b/tests/auto/qml/qjsengine/qjsengine.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qjsengine
+QT += v8-private qml widgets testlib gui-private
+macx:CONFIG -= app_bundle
+SOURCES += tst_qjsengine.cpp
+
+TESTDATA = script/*
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qjsengine/script/com/__init__.js b/tests/auto/qml/qjsengine/script/com/__init__.js
new file mode 100644
index 0000000000..7db3ee4cac
--- /dev/null
+++ b/tests/auto/qml/qjsengine/script/com/__init__.js
@@ -0,0 +1,9 @@
+var wasDefinedAlready = (this["com"] != undefined);
+__setupPackage__("com");
+com.wasDefinedAlready = wasDefinedAlready;
+com.name = __extension__;
+com.level = 1;
+
+com.postInitCallCount = 0;
+com.originalPostInit = __postInit__;
+__postInit__ = function() { ++com.postInitCallCount; };
diff --git a/tests/auto/qml/qjsengine/script/com/trolltech/__init__.js b/tests/auto/qml/qjsengine/script/com/trolltech/__init__.js
new file mode 100644
index 0000000000..a55b1328ba
--- /dev/null
+++ b/tests/auto/qml/qjsengine/script/com/trolltech/__init__.js
@@ -0,0 +1,9 @@
+var wasDefinedAlready = (com["trolltech"] != undefined);
+__setupPackage__("com.trolltech");
+com.trolltech.wasDefinedAlready = wasDefinedAlready;
+com.trolltech.name = __extension__;
+com.trolltech.level = com.level + 1;
+
+com.trolltech.postInitCallCount = 0;
+com.trolltech.originalPostInit = __postInit__;
+__postInit__ = function() { ++com.trolltech.postInitCallCount; };
diff --git a/tests/auto/qml/qjsengine/script/com/trolltech/recursive/__init__.js b/tests/auto/qml/qjsengine/script/com/trolltech/recursive/__init__.js
new file mode 100644
index 0000000000..2f4cad48da
--- /dev/null
+++ b/tests/auto/qml/qjsengine/script/com/trolltech/recursive/__init__.js
@@ -0,0 +1 @@
+__import__("com.trolltech.recursive");
diff --git a/tests/auto/qml/qjsengine/script/com/trolltech/syntaxerror/__init__.js b/tests/auto/qml/qjsengine/script/com/trolltech/syntaxerror/__init__.js
new file mode 100644
index 0000000000..55bc35b5f2
--- /dev/null
+++ b/tests/auto/qml/qjsengine/script/com/trolltech/syntaxerror/__init__.js
@@ -0,0 +1,5 @@
+function () {
+}
+
+0 = 1;
+
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
new file mode 100644
index 0000000000..70b718c4d8
--- /dev/null
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -0,0 +1,2829 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <qjsengine.h>
+#include <qjsvalueiterator.h>
+#include <qgraphicsitem.h>
+#include <qstandarditemmodel.h>
+#include <QtCore/qnumeric.h>
+#include <stdlib.h>
+
+#include <private/v8.h>
+
+Q_DECLARE_METATYPE(QList<int>)
+Q_DECLARE_METATYPE(QObjectList)
+
+// The JavaScriptCore GC marks the C stack. To try to ensure that there is
+// no JSObject* left in stack memory by the compiler, we call this function
+// to zap some bytes of memory before calling collectGarbage().
+static void zapSomeStack()
+{
+ char buf[4096];
+ memset(buf, 0, sizeof(buf));
+}
+
+static void collectGarbage_helper(QJSEngine &eng)
+{
+ zapSomeStack();
+ eng.collectGarbage();
+}
+
+QT_BEGIN_NAMESPACE
+extern Q_QML_EXPORT v8::Local<v8::Context> qt_QJSEngineV8Context(QJSEngine *);
+extern Q_QML_EXPORT v8::Local<v8::Value> qt_QJSValueV8Value(const QJSValue &);
+QT_END_NAMESPACE
+
+class tst_QJSEngine : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSEngine();
+ virtual ~tst_QJSEngine();
+
+private slots:
+ void constructWithParent();
+ void newObject();
+ void newArray();
+ void newArray_HooliganTask218092();
+ void newArray_HooliganTask233836();
+ void newVariant();
+ void newVariant_valueOfToString();
+ void newRegExp();
+ void jsRegExp();
+ void newDate();
+ void jsParseDate();
+ void newQObject();
+ void newQObject_ownership();
+ void newQObject_deletedEngine();
+ void globalObjectProperties();
+ void globalObjectEquals();
+ void globalObjectProperties_enumerate();
+ void createGlobalObjectProperty();
+ void globalObjectWithCustomPrototype();
+ void builtinFunctionNames_data();
+ void builtinFunctionNames();
+ void evaluate_data();
+ void evaluate();
+ void errorMessage_QT679();
+ void valueConversion_basic();
+ void valueConversion_QVariant();
+ void valueConversion_basic2();
+ void valueConversion_dateTime();
+ void valueConversion_regExp();
+ void castWithMultipleInheritance();
+ void collectGarbage();
+ void gcWithNestedDataStructure();
+ void stacktrace();
+ void numberParsing_data();
+ void numberParsing();
+ void automaticSemicolonInsertion();
+ void errorConstructors();
+ void argumentsProperty_globalContext();
+ void argumentsProperty_JS();
+ void jsNumberClass();
+ void jsForInStatement_simple();
+ void jsForInStatement_prototypeProperties();
+ void jsForInStatement_mutateWhileIterating();
+ void jsForInStatement_arrays();
+ void jsForInStatement_nullAndUndefined();
+ void jsFunctionDeclarationAsStatement();
+ void stringObjects();
+ void jsStringPrototypeReplaceBugs();
+ void getterSetterThisObject_global();
+ void getterSetterThisObject_plain();
+ void getterSetterThisObject_prototypeChain();
+ void jsContinueInSwitch();
+ void jsShadowReadOnlyPrototypeProperty();
+ void jsReservedWords_data();
+ void jsReservedWords();
+ void jsFutureReservedWords_data();
+ void jsFutureReservedWords();
+ void jsThrowInsideWithStatement();
+ void reentrancy_globalObjectProperties();
+ void reentrancy_Array();
+ void reentrancy_objectCreation();
+ void jsIncDecNonObjectProperty();
+
+ void qRegExpInport_data();
+ void qRegExpInport();
+ void dateRoundtripJSQtJS();
+ void dateRoundtripQtJSQt();
+ void dateConversionJSQt();
+ void dateConversionQtJS();
+ void functionPrototypeExtensions();
+ void threadedEngine();
+
+ void v8Context_simple();
+ void v8Context_exception();
+ void v8Context_mixAPIs();
+};
+
+tst_QJSEngine::tst_QJSEngine()
+{
+}
+
+tst_QJSEngine::~tst_QJSEngine()
+{
+}
+
+void tst_QJSEngine::constructWithParent()
+{
+ QPointer<QJSEngine> ptr;
+ {
+ QObject obj;
+ QJSEngine *engine = new QJSEngine(&obj);
+ ptr = engine;
+ }
+ QVERIFY(ptr == 0);
+}
+
+void tst_QJSEngine::newObject()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ QVERIFY(!object.isUndefined());
+ QCOMPARE(object.isObject(), true);
+ QCOMPARE(object.isCallable(), false);
+ // prototype should be Object.prototype
+ QVERIFY(!object.prototype().isUndefined());
+ QCOMPARE(object.prototype().isObject(), true);
+ QCOMPARE(object.prototype().strictlyEquals(eng.evaluate("Object.prototype")), true);
+}
+
+void tst_QJSEngine::newArray()
+{
+ QJSEngine eng;
+ QJSValue array = eng.newArray();
+ QVERIFY(!array.isUndefined());
+ QCOMPARE(array.isArray(), true);
+ QCOMPARE(array.isObject(), true);
+ QVERIFY(!array.isCallable());
+ // prototype should be Array.prototype
+ QVERIFY(!array.prototype().isUndefined());
+ QCOMPARE(array.prototype().isArray(), true);
+ QCOMPARE(array.prototype().strictlyEquals(eng.evaluate("Array.prototype")), true);
+}
+
+void tst_QJSEngine::newArray_HooliganTask218092()
+{
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate("[].splice(0, 0, 'a')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt(), 0);
+ }
+ {
+ QJSValue ret = eng.evaluate("['a'].splice(0, 1, 'b')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt(), 1);
+ }
+ {
+ QJSValue ret = eng.evaluate("['a', 'b'].splice(0, 1, 'c')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt(), 1);
+ }
+ {
+ QJSValue ret = eng.evaluate("['a', 'b', 'c'].splice(0, 2, 'd')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt(), 2);
+ }
+ {
+ QJSValue ret = eng.evaluate("['a', 'b', 'c'].splice(1, 2, 'd', 'e', 'f')");
+ QVERIFY(ret.isArray());
+ QCOMPARE(ret.property("length").toInt(), 2);
+ }
+}
+
+void tst_QJSEngine::newArray_HooliganTask233836()
+{
+ QJSEngine eng;
+ {
+ // According to ECMA-262, this should cause a RangeError.
+ QJSValue ret = eng.evaluate("a = new Array(4294967295); a.push('foo')");
+ QVERIFY(ret.isError() && ret.toString().contains(QLatin1String("RangeError")));
+ }
+ {
+ QJSValue ret = eng.newArray(0xFFFFFFFF);
+ QEXPECT_FAIL("", "The maximum length of arrays is defined by v8 currently and differs from QtScript", Abort);
+ QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF));
+ ret.setProperty(0xFFFFFFFF, 123);
+ QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF));
+ QVERIFY(ret.property(0xFFFFFFFF).isNumber());
+ QCOMPARE(ret.property(0xFFFFFFFF).toInt(), 123);
+ ret.setProperty(123, 456);
+ QCOMPARE(ret.property("length").toUInt(), uint(0xFFFFFFFF));
+ QVERIFY(ret.property(123).isNumber());
+ QCOMPARE(ret.property(123).toInt(), 456);
+ }
+}
+
+void tst_QJSEngine::newVariant()
+{
+ QJSEngine eng;
+ {
+ QJSValue opaque = eng.toScriptValue(QVariant(QPoint(1, 2)));
+ QVERIFY(!opaque.isUndefined());
+ QCOMPARE(opaque.isVariant(), true);
+ QVERIFY(!opaque.isCallable());
+ QCOMPARE(opaque.isObject(), true);
+ QVERIFY(!opaque.prototype().isUndefined());
+ QEXPECT_FAIL("", "FIXME: newly created QObject's prototype is an JS Object", Continue);
+ QCOMPARE(opaque.prototype().isVariant(), true);
+ QVERIFY(opaque.property("valueOf").callWithInstance(opaque).equals(opaque));
+ }
+}
+
+void tst_QJSEngine::newVariant_valueOfToString()
+{
+ // valueOf() and toString()
+ QJSEngine eng;
+ {
+ QJSValue object = eng.toScriptValue(QVariant(QPoint(10, 20)));
+ QJSValue value = object.property("valueOf").callWithInstance(object);
+ QVERIFY(value.isObject());
+ QVERIFY(value.strictlyEquals(object));
+ QCOMPARE(object.toString(), QString::fromLatin1("QVariant(QPoint)"));
+ }
+}
+
+void tst_QJSEngine::newRegExp()
+{
+ QJSEngine eng;
+ QJSValue rexp = eng.toScriptValue(QRegExp("foo"));
+ QVERIFY(!rexp.isUndefined());
+ QCOMPARE(rexp.isRegExp(), true);
+ QCOMPARE(rexp.isObject(), true);
+ QCOMPARE(rexp.isCallable(), false);
+ // prototype should be RegExp.prototype
+ QVERIFY(!rexp.prototype().isUndefined());
+ QCOMPARE(rexp.prototype().isObject(), true);
+ QCOMPARE(rexp.prototype().isRegExp(), true);
+ // Get [[Class]] internal property of RegExp Prototype Object.
+ // See ECMA-262 Section 8.6.2, "Object Internal Properties and Methods".
+ // See ECMA-262 Section 15.10.6, "Properties of the RegExp Prototype Object".
+ QJSValue r = eng.evaluate("Object.prototype.toString.call(RegExp.prototype)");
+ QCOMPARE(r.toString(), QString::fromLatin1("[object RegExp]"));
+ QCOMPARE(rexp.prototype().strictlyEquals(eng.evaluate("RegExp.prototype")), true);
+
+ QCOMPARE(qjsvalue_cast<QRegExp>(rexp).pattern(), QRegExp("foo").pattern());
+}
+
+void tst_QJSEngine::jsRegExp()
+{
+ // See ECMA-262 Section 15.10, "RegExp Objects".
+ // These should really be JS-only tests, as they test the implementation's
+ // ECMA-compliance, not the C++ API. Compliance should already be covered
+ // by the Mozilla tests (qscriptjstestsuite).
+ // We can consider updating the expected results of this test if the
+ // RegExp implementation changes.
+
+ QJSEngine eng;
+ QJSValue r = eng.evaluate("/foo/gim");
+ QVERIFY(r.isRegExp());
+ QCOMPARE(r.toString(), QString::fromLatin1("/foo/gim"));
+
+ QJSValue rxCtor = eng.globalObject().property("RegExp");
+ QJSValue r2 = rxCtor.call(QJSValueList() << r);
+ QVERIFY(r2.isRegExp());
+ QVERIFY(r2.strictlyEquals(r));
+
+ QJSValue r3 = rxCtor.call(QJSValueList() << r << "gim");
+ QVERIFY(r3.isError());
+ QVERIFY(r3.toString().contains(QString::fromLatin1("TypeError"))); // Cannot supply flags when constructing one RegExp from another
+
+ QJSValue r4 = rxCtor.call(QJSValueList() << "foo" << "gim");
+ QVERIFY(r4.isRegExp());
+
+ QJSValue r5 = rxCtor.callAsConstructor(QJSValueList() << r);
+ QVERIFY(r5.isRegExp());
+ QCOMPARE(r5.toString(), QString::fromLatin1("/foo/gim"));
+ // In JSC, constructing a RegExp from another produces the same identical object.
+ // This is different from SpiderMonkey and old back-end.
+ QVERIFY(!r5.strictlyEquals(r));
+
+ // See ECMA-262 Section 15.10.4.1, "new RegExp(pattern, flags)".
+ QJSValue r6 = rxCtor.callAsConstructor(QJSValueList() << "foo" << "bar");
+ QVERIFY(r6.isError());
+ QVERIFY(r6.toString().contains(QString::fromLatin1("SyntaxError"))); // Invalid regular expression flag
+
+ QJSValue r7 = eng.evaluate("/foo/gimp");
+ QVERIFY(r7.isError());
+ QVERIFY(r7.toString().contains(QString::fromLatin1("SyntaxError"))); // Invalid regular expression flag
+
+ QJSValue r8 = eng.evaluate("/foo/migmigmig");
+ QVERIFY(r8.isError());
+ QVERIFY(r8.toString().contains(QString::fromLatin1("SyntaxError"))); // Invalid regular expression flag
+
+ QJSValue r9 = rxCtor.callAsConstructor();
+ QVERIFY(r9.isRegExp());
+ QCOMPARE(r9.toString(), QString::fromLatin1("/(?:)/"));
+
+ QJSValue r10 = rxCtor.callAsConstructor(QJSValueList() << "" << "gim");
+ QVERIFY(r10.isRegExp());
+ QCOMPARE(r10.toString(), QString::fromLatin1("/(?:)/gim"));
+
+ QJSValue r11 = rxCtor.callAsConstructor(QJSValueList() << "{1.*}" << "g");
+ QVERIFY(r11.isRegExp());
+ QCOMPARE(r11.toString(), QString::fromLatin1("/{1.*}/g"));
+}
+
+void tst_QJSEngine::newDate()
+{
+ QJSEngine eng;
+
+ {
+ QJSValue date = eng.evaluate("new Date(0)");
+ QVERIFY(!date.isUndefined());
+ QCOMPARE(date.isDate(), true);
+ QCOMPARE(date.isObject(), true);
+ QVERIFY(!date.isCallable());
+ // prototype should be Date.prototype
+ QVERIFY(!date.prototype().isUndefined());
+ QCOMPARE(date.prototype().isDate(), true);
+ QCOMPARE(date.prototype().strictlyEquals(eng.evaluate("Date.prototype")), true);
+ }
+
+ {
+ QDateTime dt = QDateTime(QDate(1, 2, 3), QTime(4, 5, 6, 7), Qt::LocalTime);
+ QJSValue date = eng.toScriptValue(dt);
+ QVERIFY(!date.isUndefined());
+ QCOMPARE(date.isDate(), true);
+ QCOMPARE(date.isObject(), true);
+ // prototype should be Date.prototype
+ QVERIFY(!date.prototype().isUndefined());
+ QCOMPARE(date.prototype().isDate(), true);
+ QCOMPARE(date.prototype().strictlyEquals(eng.evaluate("Date.prototype")), true);
+
+ QCOMPARE(date.toDateTime(), dt);
+ }
+
+ {
+ QDateTime dt = QDateTime(QDate(1, 2, 3), QTime(4, 5, 6, 7), Qt::UTC);
+ QJSValue date = eng.toScriptValue(dt);
+ // toDateTime() result should be in local time
+ QCOMPARE(date.toDateTime(), dt.toLocalTime());
+ }
+}
+
+void tst_QJSEngine::jsParseDate()
+{
+ QJSEngine eng;
+ // Date.parse() should return NaN when it fails
+ {
+ QJSValue ret = eng.evaluate("Date.parse()");
+ QVERIFY(ret.isNumber());
+ QVERIFY(qIsNaN(ret.toNumber()));
+ }
+
+ // Date.parse() should be able to parse the output of Date().toString()
+ {
+ QJSValue ret = eng.evaluate("var x = new Date(); var s = x.toString(); s == new Date(Date.parse(s)).toString()");
+ QVERIFY(ret.isBool());
+ QCOMPARE(ret.toBool(), true);
+ }
+}
+
+void tst_QJSEngine::newQObject()
+{
+ QJSEngine eng;
+ QObject temp;
+
+ {
+ QJSValue qobject = eng.newQObject(0);
+ QCOMPARE(qobject.isNull(), true);
+ QCOMPARE(qobject.isObject(), false);
+ QCOMPARE(qobject.toQObject(), (QObject *)0);
+ }
+ {
+ QJSValue qobject = eng.newQObject(&temp);
+ QVERIFY(!qobject.isUndefined());
+ QCOMPARE(qobject.isQObject(), true);
+ QCOMPARE(qobject.isObject(), true);
+ QCOMPARE(qobject.toQObject(), (QObject *)&temp);
+ QVERIFY(!qobject.isCallable());
+ // prototype should be QObject.prototype
+ QCOMPARE(qobject.prototype().isObject(), true);
+ QEXPECT_FAIL("", "FIXME: newly created QObject's prototype is an JS Object", Continue);
+ QCOMPARE(qobject.prototype().isQObject(), true);
+ }
+}
+
+void tst_QJSEngine::newQObject_ownership()
+{
+ QJSEngine eng;
+ {
+ QPointer<QObject> ptr = new QObject();
+ QVERIFY(ptr != 0);
+ {
+ QJSValue v = eng.newQObject(ptr);
+ }
+ collectGarbage_helper(eng);
+ if (ptr)
+ QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
+ QVERIFY(ptr == 0);
+ }
+ {
+ QPointer<QObject> ptr = new QObject(this);
+ QVERIFY(ptr != 0);
+ {
+ QJSValue v = eng.newQObject(ptr);
+ }
+ QObject *before = ptr;
+ collectGarbage_helper(eng);
+ QVERIFY(ptr == before);
+ delete ptr;
+ }
+ {
+ QObject *parent = new QObject();
+ QObject *child = new QObject(parent);
+ QJSValue v = eng.newQObject(child);
+ QCOMPARE(v.toQObject(), child);
+ delete parent;
+ QCOMPARE(v.toQObject(), (QObject *)0);
+ }
+ {
+ QPointer<QObject> ptr = new QObject();
+ QVERIFY(ptr != 0);
+ {
+ QJSValue v = eng.newQObject(ptr);
+ }
+ collectGarbage_helper(eng);
+ // no parent, so it should be like ScriptOwnership
+ if (ptr)
+ QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
+ QVERIFY(ptr == 0);
+ }
+ {
+ QObject *parent = new QObject();
+ QPointer<QObject> child = new QObject(parent);
+ QVERIFY(child != 0);
+ {
+ QJSValue v = eng.newQObject(child);
+ }
+ collectGarbage_helper(eng);
+ // has parent, so it should be like QtOwnership
+ QVERIFY(child != 0);
+ delete parent;
+ }
+}
+
+void tst_QJSEngine::newQObject_deletedEngine()
+{
+ QJSValue object;
+ QObject *ptr = new QObject();
+ QSignalSpy spy(ptr, SIGNAL(destroyed()));
+ {
+ QJSEngine engine;
+ object = engine.newQObject(ptr);
+ engine.globalObject().setProperty("obj", object);
+ }
+ QTRY_VERIFY(spy.count());
+}
+
+void tst_QJSEngine::globalObjectProperties()
+{
+ // See ECMA-262 Section 15.1, "The Global Object".
+
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
+
+ QVERIFY(global.property("NaN").isNumber());
+ QVERIFY(qIsNaN(global.property("NaN").toNumber()));
+
+ QVERIFY(global.property("Infinity").isNumber());
+ QVERIFY(qIsInf(global.property("Infinity").toNumber()));
+
+ QVERIFY(global.property("undefined").isUndefined());
+
+ QVERIFY(global.property("eval").isCallable());
+
+ QVERIFY(global.property("parseInt").isCallable());
+
+ QVERIFY(global.property("parseFloat").isCallable());
+
+ QVERIFY(global.property("isNaN").isCallable());
+
+ QVERIFY(global.property("isFinite").isCallable());
+
+ QVERIFY(global.property("decodeURI").isCallable());
+
+ QVERIFY(global.property("decodeURIComponent").isCallable());
+
+ QVERIFY(global.property("encodeURI").isCallable());
+
+ QVERIFY(global.property("encodeURIComponent").isCallable());
+
+ QVERIFY(global.property("Object").isCallable());
+ QVERIFY(global.property("Function").isCallable());
+ QVERIFY(global.property("Array").isCallable());
+ QVERIFY(global.property("String").isCallable());
+ QVERIFY(global.property("Boolean").isCallable());
+ QVERIFY(global.property("Number").isCallable());
+ QVERIFY(global.property("Date").isCallable());
+ QVERIFY(global.property("RegExp").isCallable());
+ QVERIFY(global.property("Error").isCallable());
+ QVERIFY(global.property("EvalError").isCallable());
+ QVERIFY(global.property("RangeError").isCallable());
+ QVERIFY(global.property("ReferenceError").isCallable());
+ QVERIFY(global.property("SyntaxError").isCallable());
+ QVERIFY(global.property("TypeError").isCallable());
+ QVERIFY(global.property("URIError").isCallable());
+ QVERIFY(global.property("Math").isObject());
+ QVERIFY(!global.property("Math").isCallable());
+}
+
+void tst_QJSEngine::globalObjectEquals()
+{
+ QJSEngine eng;
+ QJSValue o = eng.globalObject();
+ QVERIFY(o.strictlyEquals(eng.globalObject()));
+ QVERIFY(o.equals(eng.globalObject()));
+}
+
+void tst_QJSEngine::globalObjectProperties_enumerate()
+{
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
+
+ QSet<QString> expectedNames;
+ expectedNames
+ << "isNaN"
+ << "parseFloat"
+ << "String"
+ << "EvalError"
+ << "URIError"
+ << "Math"
+ << "encodeURIComponent"
+ << "RangeError"
+ << "eval"
+ << "isFinite"
+ << "ReferenceError"
+ << "Infinity"
+ << "Function"
+ << "RegExp"
+ << "Number"
+ << "parseInt"
+ << "Object"
+ << "decodeURI"
+ << "TypeError"
+ << "Boolean"
+ << "encodeURI"
+ << "NaN"
+ << "Error"
+ << "decodeURIComponent"
+ << "Date"
+ << "Array"
+ << "escape"
+ << "unescape"
+ << "SyntaxError"
+ << "undefined"
+ // JavaScriptCore
+ << "JSON"
+ ;
+ QSet<QString> actualNames;
+ {
+ QJSValueIterator it(global);
+ while (it.hasNext()) {
+ it.next();
+ actualNames.insert(it.name());
+ }
+ }
+
+ QSet<QString> remainingNames = actualNames;
+ {
+ QSet<QString>::const_iterator it;
+ for (it = expectedNames.constBegin(); it != expectedNames.constEnd(); ++it) {
+ QString name = *it;
+ QVERIFY(actualNames.contains(name));
+ remainingNames.remove(name);
+ }
+ }
+ QVERIFY(remainingNames.isEmpty());
+}
+
+void tst_QJSEngine::createGlobalObjectProperty()
+{
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
+ // create property with no attributes
+ {
+ QString name = QString::fromLatin1("foo");
+ QVERIFY(global.property(name).isUndefined());
+ QJSValue val(123);
+ global.setProperty(name, val);
+ QVERIFY(global.property(name).equals(val));
+ global.deleteProperty(name);
+ QVERIFY(global.property(name).isUndefined());
+ }
+}
+
+void tst_QJSEngine::globalObjectWithCustomPrototype()
+{
+ QJSEngine engine;
+ QJSValue proto = engine.newObject();
+ proto.setProperty("protoProperty", 123);
+ QJSValue global = engine.globalObject();
+ QJSValue originalProto = global.prototype();
+ global.setPrototype(proto);
+ {
+ QJSValue ret = engine.evaluate("protoProperty");
+ QEXPECT_FAIL("", "Replacing the prototype of the global object is currently unsupported (see also v8 issue 1078)", Abort);
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(global.property("protoProperty")));
+ }
+ {
+ QJSValue ret = engine.evaluate("this.protoProperty");
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(global.property("protoProperty")));
+ }
+ {
+ QJSValue ret = engine.evaluate("hasOwnProperty('protoProperty')");
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ }
+ {
+ QJSValue ret = engine.evaluate("this.hasOwnProperty('protoProperty')");
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ }
+
+ // Custom prototype set from JS
+ {
+ QJSValue ret = engine.evaluate("this.__proto__ = { 'a': 123 }; a");
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(global.property("a")));
+ }
+}
+
+void tst_QJSEngine::builtinFunctionNames_data()
+{
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<QString>("expectedName");
+
+ // See ECMA-262 Chapter 15, "Standard Built-in ECMAScript Objects".
+
+ QTest::newRow("parseInt") << QString("parseInt") << QString("parseInt");
+ QTest::newRow("parseFloat") << QString("parseFloat") << QString("parseFloat");
+ QTest::newRow("isNaN") << QString("isNaN") << QString("isNaN");
+ QTest::newRow("isFinite") << QString("isFinite") << QString("isFinite");
+ QTest::newRow("decodeURI") << QString("decodeURI") << QString("decodeURI");
+ QTest::newRow("decodeURIComponent") << QString("decodeURIComponent") << QString("decodeURIComponent");
+ QTest::newRow("encodeURI") << QString("encodeURI") << QString("encodeURI");
+ QTest::newRow("encodeURIComponent") << QString("encodeURIComponent") << QString("encodeURIComponent");
+ QTest::newRow("escape") << QString("escape") << QString("escape");
+ QTest::newRow("unescape") << QString("unescape") << QString("unescape");
+
+ QTest::newRow("Array") << QString("Array") << QString("Array");
+ QTest::newRow("Array.prototype.toString") << QString("Array.prototype.toString") << QString("toString");
+ QTest::newRow("Array.prototype.toLocaleString") << QString("Array.prototype.toLocaleString") << QString("toLocaleString");
+ QTest::newRow("Array.prototype.concat") << QString("Array.prototype.concat") << QString("concat");
+ QTest::newRow("Array.prototype.join") << QString("Array.prototype.join") << QString("join");
+ QTest::newRow("Array.prototype.pop") << QString("Array.prototype.pop") << QString("pop");
+ QTest::newRow("Array.prototype.push") << QString("Array.prototype.push") << QString("push");
+ QTest::newRow("Array.prototype.reverse") << QString("Array.prototype.reverse") << QString("reverse");
+ QTest::newRow("Array.prototype.shift") << QString("Array.prototype.shift") << QString("shift");
+ QTest::newRow("Array.prototype.slice") << QString("Array.prototype.slice") << QString("slice");
+ QTest::newRow("Array.prototype.sort") << QString("Array.prototype.sort") << QString("sort");
+ QTest::newRow("Array.prototype.splice") << QString("Array.prototype.splice") << QString("splice");
+ QTest::newRow("Array.prototype.unshift") << QString("Array.prototype.unshift") << QString("unshift");
+
+ QTest::newRow("Boolean") << QString("Boolean") << QString("Boolean");
+ QTest::newRow("Boolean.prototype.toString") << QString("Boolean.prototype.toString") << QString("toString");
+
+ QTest::newRow("Date") << QString("Date") << QString("Date");
+ QTest::newRow("Date.prototype.toString") << QString("Date.prototype.toString") << QString("toString");
+ QTest::newRow("Date.prototype.toDateString") << QString("Date.prototype.toDateString") << QString("toDateString");
+ QTest::newRow("Date.prototype.toTimeString") << QString("Date.prototype.toTimeString") << QString("toTimeString");
+ QTest::newRow("Date.prototype.toLocaleString") << QString("Date.prototype.toLocaleString") << QString("toLocaleString");
+ QTest::newRow("Date.prototype.toLocaleDateString") << QString("Date.prototype.toLocaleDateString") << QString("toLocaleDateString");
+ QTest::newRow("Date.prototype.toLocaleTimeString") << QString("Date.prototype.toLocaleTimeString") << QString("toLocaleTimeString");
+ QTest::newRow("Date.prototype.valueOf") << QString("Date.prototype.valueOf") << QString("valueOf");
+ QTest::newRow("Date.prototype.getTime") << QString("Date.prototype.getTime") << QString("getTime");
+ QTest::newRow("Date.prototype.getYear") << QString("Date.prototype.getYear") << QString("getYear");
+ QTest::newRow("Date.prototype.getFullYear") << QString("Date.prototype.getFullYear") << QString("getFullYear");
+ QTest::newRow("Date.prototype.getUTCFullYear") << QString("Date.prototype.getUTCFullYear") << QString("getUTCFullYear");
+ QTest::newRow("Date.prototype.getMonth") << QString("Date.prototype.getMonth") << QString("getMonth");
+ QTest::newRow("Date.prototype.getUTCMonth") << QString("Date.prototype.getUTCMonth") << QString("getUTCMonth");
+ QTest::newRow("Date.prototype.getDate") << QString("Date.prototype.getDate") << QString("getDate");
+ QTest::newRow("Date.prototype.getUTCDate") << QString("Date.prototype.getUTCDate") << QString("getUTCDate");
+ QTest::newRow("Date.prototype.getDay") << QString("Date.prototype.getDay") << QString("getDay");
+ QTest::newRow("Date.prototype.getUTCDay") << QString("Date.prototype.getUTCDay") << QString("getUTCDay");
+ QTest::newRow("Date.prototype.getHours") << QString("Date.prototype.getHours") << QString("getHours");
+ QTest::newRow("Date.prototype.getUTCHours") << QString("Date.prototype.getUTCHours") << QString("getUTCHours");
+ QTest::newRow("Date.prototype.getMinutes") << QString("Date.prototype.getMinutes") << QString("getMinutes");
+ QTest::newRow("Date.prototype.getUTCMinutes") << QString("Date.prototype.getUTCMinutes") << QString("getUTCMinutes");
+ QTest::newRow("Date.prototype.getSeconds") << QString("Date.prototype.getSeconds") << QString("getSeconds");
+ QTest::newRow("Date.prototype.getUTCSeconds") << QString("Date.prototype.getUTCSeconds") << QString("getUTCSeconds");
+ QTest::newRow("Date.prototype.getMilliseconds") << QString("Date.prototype.getMilliseconds") << QString("getMilliseconds");
+ QTest::newRow("Date.prototype.getUTCMilliseconds") << QString("Date.prototype.getUTCMilliseconds") << QString("getUTCMilliseconds");
+ QTest::newRow("Date.prototype.getTimezoneOffset") << QString("Date.prototype.getTimezoneOffset") << QString("getTimezoneOffset");
+ QTest::newRow("Date.prototype.setTime") << QString("Date.prototype.setTime") << QString("setTime");
+ QTest::newRow("Date.prototype.setMilliseconds") << QString("Date.prototype.setMilliseconds") << QString("setMilliseconds");
+ QTest::newRow("Date.prototype.setUTCMilliseconds") << QString("Date.prototype.setUTCMilliseconds") << QString("setUTCMilliseconds");
+ QTest::newRow("Date.prototype.setSeconds") << QString("Date.prototype.setSeconds") << QString("setSeconds");
+ QTest::newRow("Date.prototype.setUTCSeconds") << QString("Date.prototype.setUTCSeconds") << QString("setUTCSeconds");
+ QTest::newRow("Date.prototype.setMinutes") << QString("Date.prototype.setMinutes") << QString("setMinutes");
+ QTest::newRow("Date.prototype.setUTCMinutes") << QString("Date.prototype.setUTCMinutes") << QString("setUTCMinutes");
+ QTest::newRow("Date.prototype.setHours") << QString("Date.prototype.setHours") << QString("setHours");
+ QTest::newRow("Date.prototype.setUTCHours") << QString("Date.prototype.setUTCHours") << QString("setUTCHours");
+ QTest::newRow("Date.prototype.setDate") << QString("Date.prototype.setDate") << QString("setDate");
+ QTest::newRow("Date.prototype.setUTCDate") << QString("Date.prototype.setUTCDate") << QString("setUTCDate");
+ QTest::newRow("Date.prototype.setMonth") << QString("Date.prototype.setMonth") << QString("setMonth");
+ QTest::newRow("Date.prototype.setUTCMonth") << QString("Date.prototype.setUTCMonth") << QString("setUTCMonth");
+ QTest::newRow("Date.prototype.setYear") << QString("Date.prototype.setYear") << QString("setYear");
+ QTest::newRow("Date.prototype.setFullYear") << QString("Date.prototype.setFullYear") << QString("setFullYear");
+ QTest::newRow("Date.prototype.setUTCFullYear") << QString("Date.prototype.setUTCFullYear") << QString("setUTCFullYear");
+ QTest::newRow("Date.prototype.toUTCString") << QString("Date.prototype.toUTCString") << QString("toUTCString");
+ QTest::newRow("Date.prototype.toGMTString") << QString("Date.prototype.toGMTString") << QString("toGMTString");
+
+ QTest::newRow("Error") << QString("Error") << QString("Error");
+// QTest::newRow("Error.prototype.backtrace") << QString("Error.prototype.backtrace") << QString("backtrace");
+ QTest::newRow("Error.prototype.toString") << QString("Error.prototype.toString") << QString("toString");
+
+ QTest::newRow("EvalError") << QString("EvalError") << QString("EvalError");
+ QTest::newRow("RangeError") << QString("RangeError") << QString("RangeError");
+ QTest::newRow("ReferenceError") << QString("ReferenceError") << QString("ReferenceError");
+ QTest::newRow("SyntaxError") << QString("SyntaxError") << QString("SyntaxError");
+ QTest::newRow("TypeError") << QString("TypeError") << QString("TypeError");
+ QTest::newRow("URIError") << QString("URIError") << QString("URIError");
+
+ QTest::newRow("Function") << QString("Function") << QString("Function");
+ QTest::newRow("Function.prototype.toString") << QString("Function.prototype.toString") << QString("toString");
+ QTest::newRow("Function.prototype.apply") << QString("Function.prototype.apply") << QString("apply");
+ QTest::newRow("Function.prototype.call") << QString("Function.prototype.call") << QString("call");
+/* In V8, those function are only there for signals
+ QTest::newRow("Function.prototype.connect") << QString("Function.prototype.connect") << QString("connect");
+ QTest::newRow("Function.prototype.disconnect") << QString("Function.prototype.disconnect") << QString("disconnect");*/
+
+ QTest::newRow("Math.abs") << QString("Math.abs") << QString("abs");
+ QTest::newRow("Math.acos") << QString("Math.acos") << QString("acos");
+ QTest::newRow("Math.asin") << QString("Math.asin") << QString("asin");
+ QTest::newRow("Math.atan") << QString("Math.atan") << QString("atan");
+ QTest::newRow("Math.atan2") << QString("Math.atan2") << QString("atan2");
+ QTest::newRow("Math.ceil") << QString("Math.ceil") << QString("ceil");
+ QTest::newRow("Math.cos") << QString("Math.cos") << QString("cos");
+ QTest::newRow("Math.exp") << QString("Math.exp") << QString("exp");
+ QTest::newRow("Math.floor") << QString("Math.floor") << QString("floor");
+ QTest::newRow("Math.log") << QString("Math.log") << QString("log");
+ QTest::newRow("Math.max") << QString("Math.max") << QString("max");
+ QTest::newRow("Math.min") << QString("Math.min") << QString("min");
+ QTest::newRow("Math.pow") << QString("Math.pow") << QString("pow");
+ QTest::newRow("Math.random") << QString("Math.random") << QString("random");
+ QTest::newRow("Math.round") << QString("Math.round") << QString("round");
+ QTest::newRow("Math.sin") << QString("Math.sin") << QString("sin");
+ QTest::newRow("Math.sqrt") << QString("Math.sqrt") << QString("sqrt");
+ QTest::newRow("Math.tan") << QString("Math.tan") << QString("tan");
+
+ QTest::newRow("Number") << QString("Number") << QString("Number");
+ QTest::newRow("Number.prototype.toString") << QString("Number.prototype.toString") << QString("toString");
+ QTest::newRow("Number.prototype.toLocaleString") << QString("Number.prototype.toLocaleString") << QString("toLocaleString");
+ QTest::newRow("Number.prototype.valueOf") << QString("Number.prototype.valueOf") << QString("valueOf");
+ QTest::newRow("Number.prototype.toFixed") << QString("Number.prototype.toFixed") << QString("toFixed");
+ QTest::newRow("Number.prototype.toExponential") << QString("Number.prototype.toExponential") << QString("toExponential");
+ QTest::newRow("Number.prototype.toPrecision") << QString("Number.prototype.toPrecision") << QString("toPrecision");
+
+ QTest::newRow("Object") << QString("Object") << QString("Object");
+ QTest::newRow("Object.prototype.toString") << QString("Object.prototype.toString") << QString("toString");
+ QTest::newRow("Object.prototype.toLocaleString") << QString("Object.prototype.toLocaleString") << QString("toLocaleString");
+ QTest::newRow("Object.prototype.valueOf") << QString("Object.prototype.valueOf") << QString("valueOf");
+ QTest::newRow("Object.prototype.hasOwnProperty") << QString("Object.prototype.hasOwnProperty") << QString("hasOwnProperty");
+ QTest::newRow("Object.prototype.isPrototypeOf") << QString("Object.prototype.isPrototypeOf") << QString("isPrototypeOf");
+ QTest::newRow("Object.prototype.propertyIsEnumerable") << QString("Object.prototype.propertyIsEnumerable") << QString("propertyIsEnumerable");
+ QTest::newRow("Object.prototype.__defineGetter__") << QString("Object.prototype.__defineGetter__") << QString("__defineGetter__");
+ QTest::newRow("Object.prototype.__defineSetter__") << QString("Object.prototype.__defineSetter__") << QString("__defineSetter__");
+
+ QTest::newRow("RegExp") << QString("RegExp") << QString("RegExp");
+ QTest::newRow("RegExp.prototype.exec") << QString("RegExp.prototype.exec") << QString("exec");
+ QTest::newRow("RegExp.prototype.test") << QString("RegExp.prototype.test") << QString("test");
+ QTest::newRow("RegExp.prototype.toString") << QString("RegExp.prototype.toString") << QString("toString");
+
+ QTest::newRow("String") << QString("String") << QString("String");
+ QTest::newRow("String.prototype.toString") << QString("String.prototype.toString") << QString("toString");
+ QTest::newRow("String.prototype.valueOf") << QString("String.prototype.valueOf") << QString("valueOf");
+ QTest::newRow("String.prototype.charAt") << QString("String.prototype.charAt") << QString("charAt");
+ QTest::newRow("String.prototype.charCodeAt") << QString("String.prototype.charCodeAt") << QString("charCodeAt");
+ QTest::newRow("String.prototype.concat") << QString("String.prototype.concat") << QString("concat");
+ QTest::newRow("String.prototype.indexOf") << QString("String.prototype.indexOf") << QString("indexOf");
+ QTest::newRow("String.prototype.lastIndexOf") << QString("String.prototype.lastIndexOf") << QString("lastIndexOf");
+ QTest::newRow("String.prototype.localeCompare") << QString("String.prototype.localeCompare") << QString("localeCompare");
+ QTest::newRow("String.prototype.match") << QString("String.prototype.match") << QString("match");
+ QTest::newRow("String.prototype.replace") << QString("String.prototype.replace") << QString("replace");
+ QTest::newRow("String.prototype.search") << QString("String.prototype.search") << QString("search");
+ QTest::newRow("String.prototype.slice") << QString("String.prototype.slice") << QString("slice");
+ QTest::newRow("String.prototype.split") << QString("String.prototype.split") << QString("split");
+ QTest::newRow("String.prototype.substring") << QString("String.prototype.substring") << QString("substring");
+ QTest::newRow("String.prototype.toLowerCase") << QString("String.prototype.toLowerCase") << QString("toLowerCase");
+ QTest::newRow("String.prototype.toLocaleLowerCase") << QString("String.prototype.toLocaleLowerCase") << QString("toLocaleLowerCase");
+ QTest::newRow("String.prototype.toUpperCase") << QString("String.prototype.toUpperCase") << QString("toUpperCase");
+ QTest::newRow("String.prototype.toLocaleUpperCase") << QString("String.prototype.toLocaleUpperCase") << QString("toLocaleUpperCase");
+}
+
+void tst_QJSEngine::builtinFunctionNames()
+{
+ QFETCH(QString, expression);
+ QFETCH(QString, expectedName);
+ QJSEngine eng;
+ // The "name" property is actually non-standard, but JSC supports it.
+ QJSValue ret = eng.evaluate(QString::fromLatin1("%0.name").arg(expression));
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), expectedName);
+}
+
+void tst_QJSEngine::evaluate_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::addColumn<int>("lineNumber");
+ QTest::addColumn<bool>("expectHadError");
+ QTest::addColumn<int>("expectErrorLineNumber");
+
+ QTest::newRow("(newline)") << QString("\n") << -1 << false << -1;
+ QTest::newRow("0 //") << QString("0 //") << -1 << false << -1;
+ QTest::newRow("/* */") << QString("/* */") << -1 << false << -1;
+ QTest::newRow("//") << QString("//") << -1 << false << -1;
+ QTest::newRow("(spaces)") << QString(" ") << -1 << false << -1;
+ QTest::newRow("(empty)") << QString("") << -1 << false << -1;
+ QTest::newRow("0") << QString("0") << -1 << false << -1;
+ QTest::newRow("0=1") << QString("\n0=1;\n") << -1 << true << 2;
+ QTest::newRow("a=1") << QString("a=1\n") << -1 << false << -1;
+ QTest::newRow("a=1;K") << QString("a=1;\nK") << -1 << true << 2;
+
+ QTest::newRow("f()") << QString("function f()\n"
+ "{\n"
+ " var a;\n"
+ " var b=\";\n" // here's the error
+ "}\n"
+ "f();\n")
+ << -1 << true << 4;
+
+ QTest::newRow("0") << QString("0") << 10 << false << -1;
+ QTest::newRow("0=1") << QString("\n\n0=1\n") << 10 << true << 12;
+ QTest::newRow("a=1") << QString("a=1\n") << 10 << false << -1;
+ QTest::newRow("a=1;K") << QString("a=1;\n\nK") << 10 << true << 12;
+
+ QTest::newRow("f()") << QString("function f()\n"
+ "{\n"
+ " var a;\n"
+ "\n\n"
+ " var b=\";\n" // here's the error
+ "}\n"
+ "f();\n")
+ << 10 << true << 15;
+ QTest::newRow("functionThatDoesntExist()")
+ << QString(";\n;\n;\nfunctionThatDoesntExist()")
+ << -1 << true << 4;
+ QTest::newRow("for (var p in this) { continue labelThatDoesntExist; }")
+ << QString("for (var p in this) {\ncontinue labelThatDoesntExist; }")
+ << 4 << true << 5;
+ QTest::newRow("duplicateLabel: { duplicateLabel: ; }")
+ << QString("duplicateLabel: { duplicateLabel: ; }")
+ << 12 << true << 12;
+
+ QTest::newRow("/=/") << QString("/=/") << -1 << false << -1;
+ QTest::newRow("/=/g") << QString("/=/g") << -1 << false << -1;
+ QTest::newRow("/a/") << QString("/a/") << -1 << false << -1;
+ QTest::newRow("/a/g") << QString("/a/g") << -1 << false << -1;
+ QTest::newRow("/a/gim") << QString("/a/gim") << -1 << false << -1;
+ QTest::newRow("/a/gimp") << QString("/a/gimp") << 1 << true << 1;
+}
+
+void tst_QJSEngine::evaluate()
+{
+ QFETCH(QString, code);
+ QFETCH(int, lineNumber);
+ QFETCH(bool, expectHadError);
+ QFETCH(int, expectErrorLineNumber);
+
+ QJSEngine eng;
+ QJSValue ret;
+ if (lineNumber != -1)
+ ret = eng.evaluate(code, /*fileName =*/QString(), lineNumber);
+ else
+ ret = eng.evaluate(code);
+ QCOMPARE(ret.isError(), expectHadError);
+ if (ret.isError()) {
+ QEXPECT_FAIL("", "we have no more lineNumber property ", Continue);
+ QVERIFY(ret.property("lineNumber").strictlyEquals(eng.toScriptValue(expectErrorLineNumber)));
+ }
+}
+
+void tst_QJSEngine::errorMessage_QT679()
+{
+ QJSEngine engine;
+ engine.globalObject().setProperty("foo", 15);
+ QJSValue error = engine.evaluate("'hello world';\nfoo.bar.blah");
+ QVERIFY(error.isError());
+ QVERIFY(error.toString().startsWith(QString::fromLatin1("TypeError: ")));
+}
+
+struct Foo {
+public:
+ int x, y;
+ Foo() : x(-1), y(-1) { }
+};
+
+Q_DECLARE_METATYPE(Foo)
+Q_DECLARE_METATYPE(Foo*)
+
+Q_DECLARE_METATYPE(QLinkedList<QString>)
+Q_DECLARE_METATYPE(QList<Foo>)
+Q_DECLARE_METATYPE(QVector<QChar>)
+Q_DECLARE_METATYPE(QStack<int>)
+Q_DECLARE_METATYPE(QQueue<char>)
+Q_DECLARE_METATYPE(QLinkedList<QStack<int> >)
+
+void tst_QJSEngine::valueConversion_basic()
+{
+ QJSEngine eng;
+ {
+ QJSValue num = eng.toScriptValue(123);
+ QCOMPARE(num.isNumber(), true);
+ QCOMPARE(num.strictlyEquals(eng.toScriptValue(123)), true);
+
+ int inum = eng.fromScriptValue<int>(num);
+ QCOMPARE(inum, 123);
+
+ QString snum = eng.fromScriptValue<QString>(num);
+ QCOMPARE(snum, QLatin1String("123"));
+ }
+ {
+ QJSValue num = eng.toScriptValue(123);
+ QCOMPARE(num.isNumber(), true);
+ QCOMPARE(num.strictlyEquals(eng.toScriptValue(123)), true);
+
+ int inum = eng.fromScriptValue<int>(num);
+ QCOMPARE(inum, 123);
+
+ QString snum = eng.fromScriptValue<QString>(num);
+ QCOMPARE(snum, QLatin1String("123"));
+ }
+ {
+ QJSValue num = eng.toScriptValue(123);
+ QCOMPARE(eng.fromScriptValue<char>(num), char(123));
+ QCOMPARE(eng.fromScriptValue<unsigned char>(num), (unsigned char)(123));
+ QCOMPARE(eng.fromScriptValue<short>(num), short(123));
+ QCOMPARE(eng.fromScriptValue<unsigned short>(num), (unsigned short)(123));
+ QCOMPARE(eng.fromScriptValue<float>(num), float(123));
+ QCOMPARE(eng.fromScriptValue<double>(num), double(123));
+ QCOMPARE(eng.fromScriptValue<qlonglong>(num), qlonglong(123));
+ QCOMPARE(eng.fromScriptValue<qulonglong>(num), qulonglong(123));
+ }
+ {
+ QJSValue num(123);
+ QCOMPARE(eng.fromScriptValue<char>(num), char(123));
+ QCOMPARE(eng.fromScriptValue<unsigned char>(num), (unsigned char)(123));
+ QCOMPARE(eng.fromScriptValue<short>(num), short(123));
+ QCOMPARE(eng.fromScriptValue<unsigned short>(num), (unsigned short)(123));
+ QCOMPARE(eng.fromScriptValue<float>(num), float(123));
+ QCOMPARE(eng.fromScriptValue<double>(num), double(123));
+ QCOMPARE(eng.fromScriptValue<qlonglong>(num), qlonglong(123));
+ QCOMPARE(eng.fromScriptValue<qulonglong>(num), qulonglong(123));
+ }
+
+ {
+ QJSValue num = eng.toScriptValue(Q_INT64_C(0x100000000));
+ QCOMPARE(eng.fromScriptValue<qlonglong>(num), Q_INT64_C(0x100000000));
+ QCOMPARE(eng.fromScriptValue<qulonglong>(num), Q_UINT64_C(0x100000000));
+ }
+
+ {
+ QChar c = QLatin1Char('c');
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("ciao"));
+ QCOMPARE(eng.fromScriptValue<QChar>(str), c);
+ QJSValue code = eng.toScriptValue(c.unicode());
+ QCOMPARE(eng.fromScriptValue<QChar>(code), c);
+ QCOMPARE(eng.fromScriptValue<QChar>(eng.toScriptValue(c)), c);
+ }
+
+ QVERIFY(eng.toScriptValue(static_cast<void *>(0)).isNull());
+}
+
+void tst_QJSEngine::valueConversion_QVariant()
+{
+ QJSEngine eng;
+ // qScriptValueFromValue() should be "smart" when the argument is a QVariant
+ {
+ QJSValue val = eng.toScriptValue(QVariant());
+ QVERIFY(!val.isVariant());
+ QVERIFY(val.isUndefined());
+ }
+ // Checking nested QVariants
+ {
+ QVariant tmp1;
+ QVariant tmp2(QMetaType::QVariant, &tmp1);
+ QVERIFY(QMetaType::Type(tmp2.type()) == QMetaType::QVariant);
+
+ QJSValue val1 = eng.toScriptValue(tmp1);
+ QJSValue val2 = eng.toScriptValue(tmp2);
+ QVERIFY(val1.isUndefined());
+ QEXPECT_FAIL("", "Variant are unrwapped, maybe we should not...", Continue);
+ QVERIFY(!val2.isUndefined());
+ QVERIFY(!val1.isVariant());
+ QEXPECT_FAIL("", "Variant are unrwapped, maybe we should not...", Continue);
+ QVERIFY(val2.isVariant());
+ }
+ {
+ QVariant tmp1(123);
+ QVariant tmp2(QMetaType::QVariant, &tmp1);
+ QVariant tmp3(QMetaType::QVariant, &tmp2);
+ QVERIFY(QMetaType::Type(tmp1.type()) == QMetaType::Int);
+ QVERIFY(QMetaType::Type(tmp2.type()) == QMetaType::QVariant);
+ QVERIFY(QMetaType::Type(tmp3.type()) == QMetaType::QVariant);
+
+ QJSValue val1 = eng.toScriptValue(tmp2);
+ QJSValue val2 = eng.toScriptValue(tmp3);
+ QVERIFY(!val1.isUndefined());
+ QVERIFY(!val2.isUndefined());
+ QEXPECT_FAIL("", "Variant are unrwapped, maybe we should not...", Continue);
+ QVERIFY(val1.isVariant());
+ QEXPECT_FAIL("", "Variant are unrwapped, maybe we should not...", Continue);
+ QVERIFY(val2.isVariant());
+ QVERIFY(val1.toVariant().toInt() == 123);
+ QVERIFY(eng.toScriptValue(val2.toVariant()).toVariant().toInt() == 123);
+ }
+ {
+ QJSValue val = eng.toScriptValue(QVariant(true));
+ QVERIFY(!val.isVariant());
+ QVERIFY(val.isBool());
+ QCOMPARE(val.toBool(), true);
+ }
+ {
+ QJSValue val = eng.toScriptValue(QVariant(int(123)));
+ QVERIFY(!val.isVariant());
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toNumber(), qreal(123));
+ }
+ {
+ QJSValue val = eng.toScriptValue(QVariant(qreal(1.25)));
+ QVERIFY(!val.isVariant());
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toNumber(), qreal(1.25));
+ }
+ {
+ QString str = QString::fromLatin1("ciao");
+ QJSValue val = eng.toScriptValue(QVariant(str));
+ QVERIFY(!val.isVariant());
+ QVERIFY(val.isString());
+ QCOMPARE(val.toString(), str);
+ }
+ {
+ QJSValue val = eng.toScriptValue(qVariantFromValue((QObject*)this));
+ QVERIFY(!val.isVariant());
+ QVERIFY(val.isQObject());
+ QCOMPARE(val.toQObject(), (QObject*)this);
+ }
+ {
+ QVariant var = qVariantFromValue(QPoint(123, 456));
+ QJSValue val = eng.toScriptValue(var);
+ QVERIFY(val.isVariant());
+ QCOMPARE(val.toVariant(), var);
+ }
+
+ QCOMPARE(qjsvalue_cast<QVariant>(QJSValue(123)), QVariant(123));
+
+ QVERIFY(eng.toScriptValue(QVariant(QMetaType::VoidStar, 0)).isNull());
+}
+
+void tst_QJSEngine::valueConversion_basic2()
+{
+ QJSEngine eng;
+ // more built-in types
+ {
+ QJSValue val = eng.toScriptValue(uint(123));
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toInt(), 123);
+ }
+ {
+ QJSValue val = eng.toScriptValue(qulonglong(123));
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toInt(), 123);
+ }
+ {
+ QJSValue val = eng.toScriptValue(float(123));
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toInt(), 123);
+ }
+ {
+ QJSValue val = eng.toScriptValue(short(123));
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toInt(), 123);
+ }
+ {
+ QJSValue val = eng.toScriptValue(ushort(123));
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toInt(), 123);
+ }
+ {
+ QJSValue val = eng.toScriptValue(char(123));
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toInt(), 123);
+ }
+ {
+ QJSValue val = eng.toScriptValue(uchar(123));
+ QVERIFY(val.isNumber());
+ QCOMPARE(val.toInt(), 123);
+ }
+}
+
+void tst_QJSEngine::valueConversion_dateTime()
+{
+ QJSEngine eng;
+ {
+ QDateTime in = QDateTime::currentDateTime();
+ QJSValue val = eng.toScriptValue(in);
+ QVERIFY(val.isDate());
+ QCOMPARE(val.toDateTime(), in);
+ }
+ {
+ QDate in = QDate::currentDate();
+ QJSValue val = eng.toScriptValue(in);
+ QVERIFY(val.isDate());
+ QCOMPARE(val.toDateTime().date(), in);
+ }
+}
+
+void tst_QJSEngine::valueConversion_regExp()
+{
+ QJSEngine eng;
+ {
+ QRegExp in = QRegExp("foo");
+ QJSValue val = eng.toScriptValue(in);
+ QVERIFY(val.isRegExp());
+ QRegExp out = qjsvalue_cast<QRegExp>(val);
+ QEXPECT_FAIL("", "QTBUG-6136: JSC-based back-end doesn't preserve QRegExp::patternSyntax (always uses RegExp2)", Continue);
+ QCOMPARE(out.patternSyntax(), in.patternSyntax());
+ QCOMPARE(out.pattern(), in.pattern());
+ QCOMPARE(out.caseSensitivity(), in.caseSensitivity());
+ QCOMPARE(out.isMinimal(), in.isMinimal());
+ }
+ {
+ QRegExp in = QRegExp("foo", Qt::CaseSensitive, QRegExp::RegExp2);
+ QJSValue val = eng.toScriptValue(in);
+ QVERIFY(val.isRegExp());
+ QCOMPARE(qjsvalue_cast<QRegExp>(val), in);
+ }
+ {
+ QRegExp in = QRegExp("foo");
+ in.setMinimal(true);
+ QJSValue val = eng.toScriptValue(in);
+ QVERIFY(val.isRegExp());
+ QEXPECT_FAIL("", "QTBUG-6136: JSC-based back-end doesn't preserve QRegExp::minimal (always false)", Continue);
+ QCOMPARE(qjsvalue_cast<QRegExp>(val).isMinimal(), in.isMinimal());
+ }
+}
+
+Q_DECLARE_METATYPE(QGradient)
+Q_DECLARE_METATYPE(QGradient*)
+Q_DECLARE_METATYPE(QLinearGradient)
+
+class Klazz : public QWidget,
+ public QStandardItem,
+ public QGraphicsItem
+{
+ Q_INTERFACES(QGraphicsItem)
+ Q_OBJECT
+public:
+ Klazz(QWidget *parent = 0) : QWidget(parent) { }
+ virtual QRectF boundingRect() const { return QRectF(); }
+ virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { }
+};
+
+Q_DECLARE_METATYPE(Klazz*)
+Q_DECLARE_METATYPE(QStandardItem*)
+
+void tst_QJSEngine::castWithMultipleInheritance()
+{
+ QJSEngine eng;
+ Klazz klz;
+ QJSValue v = eng.newQObject(&klz);
+
+ QCOMPARE(qjsvalue_cast<Klazz*>(v), &klz);
+ QCOMPARE(qjsvalue_cast<QWidget*>(v), (QWidget *)&klz);
+ QCOMPARE(qjsvalue_cast<QObject*>(v), (QObject *)&klz);
+ QCOMPARE(qjsvalue_cast<QStandardItem*>(v), (QStandardItem *)&klz);
+ QCOMPARE(qjsvalue_cast<QGraphicsItem*>(v), (QGraphicsItem *)&klz);
+}
+
+void tst_QJSEngine::collectGarbage()
+{
+ QJSEngine eng;
+ eng.evaluate("a = new Object(); a = new Object(); a = new Object()");
+ QJSValue a = eng.newObject();
+ a = eng.newObject();
+ a = eng.newObject();
+ QPointer<QObject> ptr = new QObject();
+ QVERIFY(ptr != 0);
+ (void)eng.newQObject(ptr);
+ collectGarbage_helper(eng);
+ if (ptr)
+ QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
+ QVERIFY(ptr == 0);
+}
+
+void tst_QJSEngine::gcWithNestedDataStructure()
+{
+ // The GC must be able to traverse deeply nested objects, otherwise this
+ // test would crash.
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate(
+ "function makeList(size)"
+ "{"
+ " var head = { };"
+ " var l = head;"
+ " for (var i = 0; i < size; ++i) {"
+ " l.data = i + \"\";"
+ " l.next = { }; l = l.next;"
+ " }"
+ " l.next = null;"
+ " return head;"
+ "}");
+ QVERIFY(!ret.isError());
+ const int size = 200;
+ QJSValue head = eng.evaluate(QString::fromLatin1("makeList(%0)").arg(size));
+ QVERIFY(!head.isError());
+ for (int x = 0; x < 2; ++x) {
+ if (x == 1)
+ eng.evaluate("gc()");
+ QJSValue l = head;
+ // Make sure all the nodes are still alive.
+ for (int i = 0; i < 200; ++i) {
+ QCOMPARE(l.property("data").toString(), QString::number(i));
+ l = l.property("next");
+ }
+ }
+}
+
+void tst_QJSEngine::stacktrace()
+{
+ QString script = QString::fromLatin1(
+ "function foo(counter) {\n"
+ " switch (counter) {\n"
+ " case 0: foo(counter+1); break;\n"
+ " case 1: foo(counter+1); break;\n"
+ " case 2: foo(counter+1); break;\n"
+ " case 3: foo(counter+1); break;\n"
+ " case 4: foo(counter+1); break;\n"
+ " default:\n"
+ " throw new Error('blah');\n"
+ " }\n"
+ "}\n"
+ "foo(0);");
+
+ const QString fileName("testfile");
+
+ QStringList backtrace;
+ backtrace << "foo(5)@testfile:9"
+ << "foo(4)@testfile:7"
+ << "foo(3)@testfile:6"
+ << "foo(2)@testfile:5"
+ << "foo(1)@testfile:4"
+ << "foo(0)@testfile:3"
+ << "<global>()@testfile:12";
+
+ QJSEngine eng;
+ QJSValue result = eng.evaluate(script, fileName);
+ QVERIFY(result.isError());
+
+ QJSValue stack = result.property("stack");
+
+ QJSValueIterator it(stack);
+ int counter = 5;
+ while (it.hasNext()) {
+ it.next();
+ QJSValue obj = it.value();
+ QJSValue frame = obj.property("frame");
+
+ QCOMPARE(obj.property("fileName").toString(), fileName);
+ if (counter >= 0) {
+ QJSValue callee = frame.property("arguments").property("callee");
+ QVERIFY(callee.strictlyEquals(eng.globalObject().property("foo")));
+ QCOMPARE(obj.property("functionName").toString(), QString("foo"));
+ int line = obj.property("lineNumber").toInt();
+ if (counter == 5)
+ QCOMPARE(line, 9);
+ else
+ QCOMPARE(line, 3 + counter);
+ } else {
+ QVERIFY(frame.strictlyEquals(eng.globalObject()));
+ QVERIFY(obj.property("functionName").toString().isEmpty());
+ }
+
+ --counter;
+ }
+
+ // throw something that isn't an Error object
+ // ###FIXME: No uncaughtExceptionBacktrace: QVERIFY(eng.uncaughtExceptionBacktrace().isEmpty());
+ QString script2 = QString::fromLatin1(
+ "function foo(counter) {\n"
+ " switch (counter) {\n"
+ " case 0: foo(counter+1); break;\n"
+ " case 1: foo(counter+1); break;\n"
+ " case 2: foo(counter+1); break;\n"
+ " case 3: foo(counter+1); break;\n"
+ " case 4: foo(counter+1); break;\n"
+ " default:\n"
+ " throw 'just a string';\n"
+ " }\n"
+ "}\n"
+ "foo(0);");
+
+ QJSValue result2 = eng.evaluate(script2, fileName);
+ QVERIFY(!result2.isError());
+ QVERIFY(result2.isString());
+}
+
+void tst_QJSEngine::numberParsing_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<qreal>("expect");
+
+ QTest::newRow("decimal 0") << QString("0") << qreal(0);
+ QTest::newRow("octal 0") << QString("00") << qreal(00);
+ QTest::newRow("hex 0") << QString("0x0") << qreal(0x0);
+ QTest::newRow("decimal 100") << QString("100") << qreal(100);
+ QTest::newRow("hex 100") << QString("0x100") << qreal(0x100);
+ QTest::newRow("octal 100") << QString("0100") << qreal(0100);
+ QTest::newRow("decimal 4G") << QString("4294967296") << qreal(Q_UINT64_C(4294967296));
+ QTest::newRow("hex 4G") << QString("0x100000000") << qreal(Q_UINT64_C(0x100000000));
+ QTest::newRow("octal 4G") << QString("040000000000") << qreal(Q_UINT64_C(040000000000));
+ QTest::newRow("0.5") << QString("0.5") << qreal(0.5);
+ QTest::newRow("1.5") << QString("1.5") << qreal(1.5);
+ QTest::newRow("1e2") << QString("1e2") << qreal(100);
+}
+
+void tst_QJSEngine::numberParsing()
+{
+ QFETCH(QString, string);
+ QFETCH(qreal, expect);
+
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate(string);
+ QVERIFY(ret.isNumber());
+ qreal actual = ret.toNumber();
+ QCOMPARE(actual, expect);
+}
+
+// see ECMA-262, section 7.9
+// This is testing ECMA compliance, not our C++ API, but it's important that
+// the back-end is conformant in this regard.
+void tst_QJSEngine::automaticSemicolonInsertion()
+{
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate("{ 1 2 } 3");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains("SyntaxError"));
+ }
+ {
+ QJSValue ret = eng.evaluate("{ 1\n2 } 3");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 3);
+ }
+ {
+ QJSValue ret = eng.evaluate("for (a; b\n)");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains("SyntaxError"));
+ }
+ {
+ QJSValue ret = eng.evaluate("(function() { return\n1 + 2 })()");
+ QVERIFY(ret.isUndefined());
+ }
+ {
+ eng.evaluate("c = 2; b = 1");
+ QJSValue ret = eng.evaluate("a = b\n++c");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 3);
+ }
+ {
+ QJSValue ret = eng.evaluate("if (a > b)\nelse c = d");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains("SyntaxError"));
+ }
+ {
+ eng.evaluate("function c() { return { foo: function() { return 5; } } }");
+ eng.evaluate("b = 1; d = 2; e = 3");
+ QJSValue ret = eng.evaluate("a = b + c\n(d + e).foo()");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 6);
+ }
+ {
+ QJSValue ret = eng.evaluate("throw\n1");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains("SyntaxError"));
+ }
+ {
+ QJSValue ret = eng.evaluate("a = Number(1)\n++a");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 2);
+ }
+
+ // "a semicolon is never inserted automatically if the semicolon
+ // would then be parsed as an empty statement"
+ {
+ eng.evaluate("a = 123");
+ QJSValue ret = eng.evaluate("if (0)\n ++a; a");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 123);
+ }
+ {
+ eng.evaluate("a = 123");
+ QJSValue ret = eng.evaluate("if (0)\n --a; a");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 123);
+ }
+ {
+ eng.evaluate("a = 123");
+ QJSValue ret = eng.evaluate("if ((0))\n ++a; a");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 123);
+ }
+ {
+ eng.evaluate("a = 123");
+ QJSValue ret = eng.evaluate("if ((0))\n --a; a");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 123);
+ }
+ {
+ eng.evaluate("a = 123");
+ QJSValue ret = eng.evaluate("if (0\n)\n ++a; a");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 123);
+ }
+ {
+ eng.evaluate("a = 123");
+ QJSValue ret = eng.evaluate("if (0\n ++a; a");
+ QVERIFY(ret.isError());
+ }
+ {
+ eng.evaluate("a = 123");
+ QJSValue ret = eng.evaluate("if (0))\n ++a; a");
+ QVERIFY(ret.isError());
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 0; for (i = 0; i < 10; ++i)\n ++n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 10);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 30; for (i = 0; i < 10; ++i)\n --n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 20);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 0; for (var i = 0; i < 10; ++i)\n ++n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 10);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 30; for (var i = 0; i < 10; ++i)\n --n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 20);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 0; i = 0; while (i++ < 10)\n ++n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 10);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 30; i = 0; while (i++ < 10)\n --n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 20);
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 0; for (i in o)\n ++n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 3);
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 9; for (i in o)\n --n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 6);
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 0; for (var i in o)\n ++n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 3);
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { a: 0, b: 1, c: 2 }; n = 9; for (var i in o)\n --n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 6);
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { n: 3 }; n = 5; with (o)\n ++n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 5);
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { n: 3 }; n = 10; with (o)\n --n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 10);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 5; i = 0; do\n ++n; while (++i < 10); n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 15);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 20; i = 0; do\n --n; while (++i < 10); n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 10);
+ }
+
+ {
+ QJSValue ret = eng.evaluate("n = 1; i = 0; if (n) i\n++n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 2);
+ }
+ {
+ QJSValue ret = eng.evaluate("n = 1; i = 0; if (n) i\n--n; n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 0);
+ }
+
+ {
+ QJSValue ret = eng.evaluate("if (0)");
+ QVERIFY(ret.isError());
+ }
+ {
+ QJSValue ret = eng.evaluate("while (0)");
+ QVERIFY(ret.isError());
+ }
+ {
+ QJSValue ret = eng.evaluate("for (;;)");
+ QVERIFY(ret.isError());
+ }
+ {
+ QJSValue ret = eng.evaluate("for (p in this)");
+ QVERIFY(ret.isError());
+ }
+ {
+ QJSValue ret = eng.evaluate("with (this)");
+ QVERIFY(ret.isError());
+ }
+ {
+ QJSValue ret = eng.evaluate("do");
+ QVERIFY(ret.isError());
+ }
+}
+
+void tst_QJSEngine::errorConstructors()
+{
+ QJSEngine eng;
+ QStringList prefixes;
+ prefixes << "" << "Eval" << "Range" << "Reference" << "Syntax" << "Type" << "URI";
+ for (int x = 0; x < 3; ++x) {
+ for (int i = 0; i < prefixes.size(); ++i) {
+ QString name = prefixes.at(i) + QLatin1String("Error");
+ QString code = QString(i+1, QLatin1Char('\n'));
+ if (x == 0)
+ code += QLatin1String("throw ");
+ else if (x == 1)
+ code += QLatin1String("new ");
+ code += name + QLatin1String("()");
+ QJSValue ret = eng.evaluate(code);
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().startsWith(name));
+ //QTBUG-6138: JSC doesn't assign lineNumber when errors are not thrown
+ QEXPECT_FAIL("", "we have no more lineNumber property ", Continue);
+ QCOMPARE(ret.property("lineNumber").toInt(), i+2);
+ }
+ }
+}
+
+void tst_QJSEngine::argumentsProperty_globalContext()
+{
+ QJSEngine eng;
+ {
+ // Unlike function calls, the global context doesn't have an
+ // arguments property.
+ QJSValue ret = eng.evaluate("arguments");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("ReferenceError")));
+ }
+ eng.evaluate("arguments = 10");
+ {
+ QJSValue ret = eng.evaluate("arguments");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 10);
+ }
+ QVERIFY(eng.evaluate("delete arguments").toBool());
+ QVERIFY(eng.globalObject().property("arguments").isUndefined());
+}
+
+void tst_QJSEngine::argumentsProperty_JS()
+{
+ {
+ QJSEngine eng;
+ eng.evaluate("o = { arguments: 123 }");
+ QJSValue ret = eng.evaluate("with (o) { arguments; }");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 123);
+ }
+ {
+ QJSEngine eng;
+ QVERIFY(eng.globalObject().property("arguments").isUndefined());
+ // This is testing ECMA-262 compliance. In function calls, "arguments"
+ // appears like a local variable, and it can be replaced.
+ QJSValue ret = eng.evaluate("(function() { arguments = 456; return arguments; })()");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 456);
+ QVERIFY(eng.globalObject().property("arguments").isUndefined());
+ }
+}
+
+void tst_QJSEngine::jsNumberClass()
+{
+ // See ECMA-262 Section 15.7, "Number Objects".
+
+ QJSEngine eng;
+
+ QJSValue ctor = eng.globalObject().property("Number");
+ QVERIFY(ctor.property("length").isNumber());
+ QCOMPARE(ctor.property("length").toNumber(), qreal(1));
+ QJSValue proto = ctor.property("prototype");
+ QVERIFY(proto.isObject());
+ {
+ QVERIFY(ctor.property("MAX_VALUE").isNumber());
+ QVERIFY(ctor.property("MIN_VALUE").isNumber());
+ QVERIFY(ctor.property("NaN").isNumber());
+ QVERIFY(ctor.property("NEGATIVE_INFINITY").isNumber());
+ QVERIFY(ctor.property("POSITIVE_INFINITY").isNumber());
+ }
+ QCOMPARE(proto.toNumber(), qreal(0));
+ QVERIFY(proto.property("constructor").strictlyEquals(ctor));
+
+ {
+ QJSValue ret = eng.evaluate("Number()");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toNumber(), qreal(0));
+ }
+ {
+ QJSValue ret = eng.evaluate("Number(123)");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toNumber(), qreal(123));
+ }
+ {
+ QJSValue ret = eng.evaluate("Number('456')");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toNumber(), qreal(456));
+ }
+ {
+ QJSValue ret = eng.evaluate("new Number()");
+ QVERIFY(!ret.isNumber());
+ QVERIFY(ret.isObject());
+ QCOMPARE(ret.toNumber(), qreal(0));
+ }
+ {
+ QJSValue ret = eng.evaluate("new Number(123)");
+ QVERIFY(!ret.isNumber());
+ QVERIFY(ret.isObject());
+ QCOMPARE(ret.toNumber(), qreal(123));
+ }
+ {
+ QJSValue ret = eng.evaluate("new Number('456')");
+ QVERIFY(!ret.isNumber());
+ QVERIFY(ret.isObject());
+ QCOMPARE(ret.toNumber(), qreal(456));
+ }
+
+ QVERIFY(proto.property("toString").isCallable());
+ {
+ QJSValue ret = eng.evaluate("new Number(123).toString()");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("123"));
+ }
+ {
+ QJSValue ret = eng.evaluate("new Number(123).toString(8)");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("173"));
+ }
+ {
+ QJSValue ret = eng.evaluate("new Number(123).toString(16)");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("7b"));
+ }
+ QVERIFY(proto.property("toLocaleString").isCallable());
+ {
+ QJSValue ret = eng.evaluate("new Number(123).toLocaleString()");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("123"));
+ }
+ QVERIFY(proto.property("valueOf").isCallable());
+ {
+ QJSValue ret = eng.evaluate("new Number(123).valueOf()");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toNumber(), qreal(123));
+ }
+ QVERIFY(proto.property("toExponential").isCallable());
+ {
+ QJSValue ret = eng.evaluate("new Number(123).toExponential()");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("1.23e+2"));
+ }
+ QVERIFY(proto.property("toFixed").isCallable());
+ {
+ QJSValue ret = eng.evaluate("new Number(123).toFixed()");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("123"));
+ }
+ QVERIFY(proto.property("toPrecision").isCallable());
+ {
+ QJSValue ret = eng.evaluate("new Number(123).toPrecision()");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("123"));
+ }
+}
+
+void tst_QJSEngine::jsForInStatement_simple()
+{
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate("o = { }; r = []; for (var p in o) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QVERIFY(lst.isEmpty());
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { p: 123 }; r = [];"
+ "for (var p in o) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 1);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { p: 123, q: 456 }; r = [];"
+ "for (var p in o) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 2);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ QCOMPARE(lst.at(1), QString::fromLatin1("q"));
+ }
+}
+
+void tst_QJSEngine::jsForInStatement_prototypeProperties()
+{
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate("o = { }; o.__proto__ = { p: 123 }; r = [];"
+ "for (var p in o) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 1);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { p: 123 }; o.__proto__ = { q: 456 }; r = [];"
+ "for (var p in o) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 2);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ QCOMPARE(lst.at(1), QString::fromLatin1("q"));
+ }
+ {
+ // shadowed property
+ QJSValue ret = eng.evaluate("o = { p: 123 }; o.__proto__ = { p: 456 }; r = [];"
+ "for (var p in o) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 1);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ }
+
+}
+
+void tst_QJSEngine::jsForInStatement_mutateWhileIterating()
+{
+ QJSEngine eng;
+ // deleting property during enumeration
+ {
+ QJSValue ret = eng.evaluate("o = { p: 123 }; r = [];"
+ "for (var p in o) { r[r.length] = p; delete r[p]; } r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 1);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ }
+ {
+ QJSValue ret = eng.evaluate("o = { p: 123, q: 456 }; r = [];"
+ "for (var p in o) { r[r.length] = p; delete o.q; } r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 1);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ }
+
+ // adding property during enumeration
+ {
+ QJSValue ret = eng.evaluate("o = { p: 123 }; r = [];"
+ "for (var p in o) { r[r.length] = p; o.q = 456; } r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 1);
+ QCOMPARE(lst.at(0), QString::fromLatin1("p"));
+ }
+
+}
+
+void tst_QJSEngine::jsForInStatement_arrays()
+{
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate("a = [123, 456]; r = [];"
+ "for (var p in a) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 2);
+ QCOMPARE(lst.at(0), QString::fromLatin1("0"));
+ QCOMPARE(lst.at(1), QString::fromLatin1("1"));
+ }
+ {
+ QJSValue ret = eng.evaluate("a = [123, 456]; a.foo = 'bar'; r = [];"
+ "for (var p in a) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 3);
+ QCOMPARE(lst.at(0), QString::fromLatin1("0"));
+ QCOMPARE(lst.at(1), QString::fromLatin1("1"));
+ QCOMPARE(lst.at(2), QString::fromLatin1("foo"));
+ }
+ {
+ QJSValue ret = eng.evaluate("a = [123, 456]; a.foo = 'bar';"
+ "b = [111, 222, 333]; b.bar = 'baz';"
+ "a.__proto__ = b; r = [];"
+ "for (var p in a) r[r.length] = p; r");
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), 5);
+ QCOMPARE(lst.at(0), QString::fromLatin1("0"));
+ QCOMPARE(lst.at(1), QString::fromLatin1("1"));
+ QCOMPARE(lst.at(2), QString::fromLatin1("foo"));
+ QCOMPARE(lst.at(3), QString::fromLatin1("2"));
+ QCOMPARE(lst.at(4), QString::fromLatin1("bar"));
+ }
+}
+
+void tst_QJSEngine::jsForInStatement_nullAndUndefined()
+{
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate("r = true; for (var p in undefined) r = false; r");
+ QVERIFY(ret.isBool());
+ QVERIFY(ret.toBool());
+ }
+ {
+ QJSValue ret = eng.evaluate("r = true; for (var p in null) r = false; r");
+ QVERIFY(ret.isBool());
+ QVERIFY(ret.toBool());
+ }
+}
+
+void tst_QJSEngine::jsFunctionDeclarationAsStatement()
+{
+ // ECMA-262 does not allow function declarations to be used as statements,
+ // but several popular implementations (including JSC) do. See the NOTE
+ // at the beginning of chapter 12 in ECMA-262 5th edition, where it's
+ // recommended that implementations either disallow this usage or issue
+ // a warning.
+ // Since we had a bug report long ago about QtScript not supporting this
+ // "feature" (and thus deviating from other implementations), we still
+ // check this behavior.
+
+ QJSEngine eng;
+ QVERIFY(eng.globalObject().property("bar").isUndefined());
+ eng.evaluate("function foo(arg) {\n"
+ " if (arg == 'bar')\n"
+ " function bar() { return 'bar'; }\n"
+ " else\n"
+ " function baz() { return 'baz'; }\n"
+ " return (arg == 'bar') ? bar : baz;\n"
+ "}");
+ QVERIFY(eng.globalObject().property("bar").isUndefined());
+ QVERIFY(eng.globalObject().property("baz").isUndefined());
+ QVERIFY(eng.evaluate("foo").isCallable());
+ {
+ QJSValue ret = eng.evaluate("foo('bar')");
+ QVERIFY(ret.isCallable());
+ QJSValue ret2 = ret.call();
+ QCOMPARE(ret2.toString(), QString::fromLatin1("bar"));
+ QVERIFY(eng.globalObject().property("bar").isUndefined());
+ QVERIFY(eng.globalObject().property("baz").isUndefined());
+ }
+ {
+ QJSValue ret = eng.evaluate("foo('baz')");
+ QVERIFY(ret.isCallable());
+ QJSValue ret2 = ret.call();
+ QCOMPARE(ret2.toString(), QString::fromLatin1("baz"));
+ QVERIFY(eng.globalObject().property("bar").isUndefined());
+ QVERIFY(eng.globalObject().property("baz").isUndefined());
+ }
+}
+
+void tst_QJSEngine::stringObjects()
+{
+ // See ECMA-262 Section 15.5, "String Objects".
+
+ QJSEngine eng;
+ QString str("ciao");
+ // in C++
+ {
+ QJSValue obj = eng.evaluate(QString::fromLatin1("new String('%0')").arg(str));
+ QCOMPARE(obj.property("length").toInt(), str.length());
+ for (int i = 0; i < str.length(); ++i) {
+ QString pname = QString::number(i);
+ QVERIFY(obj.property(pname).isString());
+ QCOMPARE(obj.property(pname).toString(), QString(str.at(i)));
+ QVERIFY(!obj.deleteProperty(pname));
+ obj.setProperty(pname, 123);
+ QVERIFY(obj.property(pname).isString());
+ QCOMPARE(obj.property(pname).toString(), QString(str.at(i)));
+ }
+ QVERIFY(obj.property("-1").isUndefined());
+ QVERIFY(obj.property(QString::number(str.length())).isUndefined());
+
+ QJSValue val = eng.toScriptValue(123);
+ obj.setProperty("-1", val);
+ QVERIFY(obj.property("-1").strictlyEquals(val));
+ obj.setProperty("100", val);
+ QVERIFY(obj.property("100").strictlyEquals(val));
+ }
+
+ {
+ QJSValue ret = eng.evaluate("s = new String('ciao'); r = []; for (var p in s) r.push(p); r");
+ QVERIFY(ret.isArray());
+ QStringList lst = qjsvalue_cast<QStringList>(ret);
+ QCOMPARE(lst.size(), str.length());
+ for (int i = 0; i < str.length(); ++i)
+ QCOMPARE(lst.at(i), QString::number(i));
+
+ QJSValue ret2 = eng.evaluate("s[0] = 123; s[0]");
+ QVERIFY(ret2.isString());
+ QCOMPARE(ret2.toString().length(), 1);
+ QCOMPARE(ret2.toString().at(0), str.at(0));
+
+ QJSValue ret3 = eng.evaluate("s[-1] = 123; s[-1]");
+ QVERIFY(ret3.isNumber());
+ QCOMPARE(ret3.toInt(), 123);
+
+ QJSValue ret4 = eng.evaluate("s[s.length] = 456; s[s.length]");
+ QVERIFY(ret4.isNumber());
+ QCOMPARE(ret4.toInt(), 456);
+
+ QJSValue ret5 = eng.evaluate("delete s[0]");
+ QVERIFY(ret5.isBool());
+ QVERIFY(!ret5.toBool());
+
+ QJSValue ret6 = eng.evaluate("delete s[-1]");
+ QVERIFY(ret6.isBool());
+ QVERIFY(ret6.toBool());
+
+ QJSValue ret7 = eng.evaluate("delete s[s.length]");
+ QVERIFY(ret7.isBool());
+ QVERIFY(ret7.toBool());
+ }
+}
+
+void tst_QJSEngine::jsStringPrototypeReplaceBugs()
+{
+ QJSEngine eng;
+ // task 212440
+ {
+ QJSValue ret = eng.evaluate("replace_args = []; \"a a a\".replace(/(a)/g, function() { replace_args.push(arguments); }); replace_args");
+ QVERIFY(ret.isArray());
+ int len = ret.property("length").toInt();
+ QCOMPARE(len, 3);
+ for (int i = 0; i < len; ++i) {
+ QJSValue args = ret.property(i);
+ QCOMPARE(args.property("length").toInt(), 4);
+ QCOMPARE(args.property(0).toString(), QString::fromLatin1("a")); // matched string
+ QCOMPARE(args.property(1).toString(), QString::fromLatin1("a")); // capture
+ QVERIFY(args.property(2).isNumber());
+ QCOMPARE(args.property(2).toInt(), i*2); // index of match
+ QCOMPARE(args.property(3).toString(), QString::fromLatin1("a a a"));
+ }
+ }
+ // task 212501
+ {
+ QJSValue ret = eng.evaluate("\"foo\".replace(/a/g, function() {})");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
+ }
+}
+
+void tst_QJSEngine::getterSetterThisObject_global()
+{
+ {
+ QJSEngine eng;
+ // read
+ eng.evaluate("__defineGetter__('x', function() { return this; });");
+ {
+ QJSValue ret = eng.evaluate("x");
+ QVERIFY(ret.equals(eng.globalObject()));
+ }
+ {
+ QJSValue ret = eng.evaluate("(function() { return x; })()");
+ QVERIFY(ret.equals(eng.globalObject()));
+ }
+ {
+ QJSValue ret = eng.evaluate("with (this) x");
+ QVERIFY(ret.equals(eng.globalObject()));
+ }
+ {
+ QJSValue ret = eng.evaluate("with ({}) x");
+ QVERIFY(ret.equals(eng.globalObject()));
+ }
+ {
+ QJSValue ret = eng.evaluate("(function() { with ({}) return x; })()");
+ QVERIFY(ret.equals(eng.globalObject()));
+ }
+ // write
+ eng.evaluate("__defineSetter__('x', function() { return this; });");
+ {
+ QJSValue ret = eng.evaluate("x = 'foo'");
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
+ }
+ {
+ QJSValue ret = eng.evaluate("(function() { return x = 'foo'; })()");
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
+ }
+ {
+ QJSValue ret = eng.evaluate("with (this) x = 'foo'");
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
+ }
+ {
+ QJSValue ret = eng.evaluate("with ({}) x = 'foo'");
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
+ }
+ {
+ QJSValue ret = eng.evaluate("(function() { with ({}) return x = 'foo'; })()");
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("foo"));
+ }
+ }
+}
+
+void tst_QJSEngine::getterSetterThisObject_plain()
+{
+ {
+ QJSEngine eng;
+ eng.evaluate("o = {}");
+ // read
+ eng.evaluate("o.__defineGetter__('x', function() { return this; })");
+ QVERIFY(eng.evaluate("o.x === o").toBool());
+ QVERIFY(eng.evaluate("with (o) x").equals(eng.evaluate("o")));
+ QVERIFY(eng.evaluate("(function() { with (o) return x; })() === o").toBool());
+ eng.evaluate("q = {}; with (o) with (q) x").equals(eng.evaluate("o"));
+ // write
+ eng.evaluate("o.__defineSetter__('x', function() { return this; });");
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(eng.evaluate("(o.x = 'foo') === 'foo'").toBool());
+ QVERIFY(eng.evaluate("with (o) x = 'foo'").equals("foo"));
+ QVERIFY(eng.evaluate("with (o) with (q) x = 'foo'").equals("foo"));
+ }
+}
+
+void tst_QJSEngine::getterSetterThisObject_prototypeChain()
+{
+ {
+ QJSEngine eng;
+ eng.evaluate("o = {}; p = {}; o.__proto__ = p");
+ // read
+ eng.evaluate("p.__defineGetter__('x', function() { return this; })");
+ QVERIFY(eng.evaluate("o.x === o").toBool());
+ QVERIFY(eng.evaluate("with (o) x").equals(eng.evaluate("o")));
+ QVERIFY(eng.evaluate("(function() { with (o) return x; })() === o").toBool());
+ eng.evaluate("q = {}; with (o) with (q) x").equals(eng.evaluate("o"));
+ eng.evaluate("with (q) with (o) x").equals(eng.evaluate("o"));
+ // write
+ eng.evaluate("o.__defineSetter__('x', function() { return this; });");
+ // SpiderMonkey says setter return value, JSC says RHS.
+ QVERIFY(eng.evaluate("(o.x = 'foo') === 'foo'").toBool());
+ QVERIFY(eng.evaluate("with (o) x = 'foo'").equals("foo"));
+ QVERIFY(eng.evaluate("with (o) with (q) x = 'foo'").equals("foo"));
+ }
+}
+
+void tst_QJSEngine::jsContinueInSwitch()
+{
+ // This is testing ECMA-262 compliance, not C++ API.
+
+ QJSEngine eng;
+ // switch - continue
+ {
+ QJSValue ret = eng.evaluate("switch (1) { default: continue; }");
+ QVERIFY(ret.isError());
+ }
+ // for - switch - case - continue
+ {
+ QJSValue ret = eng.evaluate("j = 0; for (i = 0; i < 100000; ++i) {\n"
+ " switch (i) {\n"
+ " case 1: ++j; continue;\n"
+ " case 100: ++j; continue;\n"
+ " case 1000: ++j; continue;\n"
+ " }\n"
+ "}; j");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 3);
+ }
+ // for - switch - case - default - continue
+ {
+ QJSValue ret = eng.evaluate("j = 0; for (i = 0; i < 100000; ++i) {\n"
+ " switch (i) {\n"
+ " case 1: ++j; continue;\n"
+ " case 100: ++j; continue;\n"
+ " case 1000: ++j; continue;\n"
+ " default: if (i < 50000) break; else continue;\n"
+ " }\n"
+ "}; j");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 3);
+ }
+ // switch - for - continue
+ {
+ QJSValue ret = eng.evaluate("j = 123; switch (j) {\n"
+ " case 123:\n"
+ " for (i = 0; i < 100000; ++i) {\n"
+ " continue;\n"
+ " }\n"
+ "}; i\n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 100000);
+ }
+ // switch - switch - continue
+ {
+ QJSValue ret = eng.evaluate("i = 1; switch (i) { default: switch (i) { case 1: continue; } }");
+ QVERIFY(ret.isError());
+ }
+ // for - switch - switch - continue
+ {
+ QJSValue ret = eng.evaluate("j = 0; for (i = 0; i < 100000; ++i) {\n"
+ " switch (i) {\n"
+ " case 1:\n"
+ " switch (i) {\n"
+ " case 1: ++j; continue;\n"
+ " }\n"
+ " }\n"
+ "}; j");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 1);
+ }
+ // switch - for - switch - continue
+ {
+ QJSValue ret = eng.evaluate("j = 123; switch (j) {\n"
+ " case 123:\n"
+ " for (i = 0; i < 100000; ++i) {\n"
+ " switch (i) {\n"
+ " case 1:\n"
+ " ++j; continue;\n"
+ " }\n"
+ " }\n"
+ "}; i\n");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 100000);
+ }
+}
+
+void tst_QJSEngine::jsShadowReadOnlyPrototypeProperty()
+{
+ QJSEngine eng;
+ QVERIFY(eng.evaluate("o = {}; o.__proto__ = parseInt; o.length").isNumber());
+ QVERIFY(eng.evaluate("o.length = 123; o.length").toInt() != 123);
+ QVERIFY(!eng.evaluate("o.hasOwnProperty('length')").toBool());
+}
+
+void tst_QJSEngine::jsReservedWords_data()
+{
+ QTest::addColumn<QString>("word");
+ QTest::newRow("break") << QString("break");
+ QTest::newRow("case") << QString("case");
+ QTest::newRow("catch") << QString("catch");
+ QTest::newRow("continue") << QString("continue");
+ QTest::newRow("default") << QString("default");
+ QTest::newRow("delete") << QString("delete");
+ QTest::newRow("do") << QString("do");
+ QTest::newRow("else") << QString("else");
+ QTest::newRow("false") << QString("false");
+ QTest::newRow("finally") << QString("finally");
+ QTest::newRow("for") << QString("for");
+ QTest::newRow("function") << QString("function");
+ QTest::newRow("if") << QString("if");
+ QTest::newRow("in") << QString("in");
+ QTest::newRow("instanceof") << QString("instanceof");
+ QTest::newRow("new") << QString("new");
+ QTest::newRow("null") << QString("null");
+ QTest::newRow("return") << QString("return");
+ QTest::newRow("switch") << QString("switch");
+ QTest::newRow("this") << QString("this");
+ QTest::newRow("throw") << QString("throw");
+ QTest::newRow("true") << QString("true");
+ QTest::newRow("try") << QString("try");
+ QTest::newRow("typeof") << QString("typeof");
+ QTest::newRow("var") << QString("var");
+ QTest::newRow("void") << QString("void");
+ QTest::newRow("while") << QString("while");
+ QTest::newRow("with") << QString("with");
+}
+
+void tst_QJSEngine::jsReservedWords()
+{
+ // See ECMA-262 Section 7.6.1, "Reserved Words".
+ // We prefer that the implementation is less strict than the spec; e.g.
+ // it's good to allow reserved words as identifiers in object literals,
+ // and when accessing properties using dot notation.
+
+ QFETCH(QString, word);
+ {
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate(word + " = 123");
+ QVERIFY(ret.isError());
+ QString str = ret.toString();
+ QVERIFY(str.startsWith("SyntaxError") || str.startsWith("ReferenceError"));
+ }
+ {
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("var " + word + " = 123");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().startsWith("SyntaxError"));
+ }
+ {
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("o = {}; o." + word + " = 123");
+ // in the old back-end, in SpiderMonkey and in v8, this is allowed, but not in JSC
+ QVERIFY(!ret.isError());
+ QVERIFY(ret.strictlyEquals(eng.evaluate("o." + word)));
+ }
+ {
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("o = { " + word + ": 123 }");
+ // in the old back-end, in SpiderMonkey and in v8, this is allowed, but not in JSC
+ QVERIFY(!ret.isError());
+ QVERIFY(ret.property(word).isNumber());
+ }
+ {
+ // SpiderMonkey allows this, but we don't
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("function " + word + "() {}");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().startsWith("SyntaxError"));
+ }
+}
+
+void tst_QJSEngine::jsFutureReservedWords_data()
+{
+ QTest::addColumn<QString>("word");
+ QTest::addColumn<bool>("allowed");
+ QTest::newRow("abstract") << QString("abstract") << true;
+ QTest::newRow("boolean") << QString("boolean") << true;
+ QTest::newRow("byte") << QString("byte") << true;
+ QTest::newRow("char") << QString("char") << true;
+ QTest::newRow("class") << QString("class") << false;
+ QTest::newRow("const") << QString("const") << false;
+ QTest::newRow("debugger") << QString("debugger") << false;
+ QTest::newRow("double") << QString("double") << true;
+ QTest::newRow("enum") << QString("enum") << false;
+ QTest::newRow("export") << QString("export") << false;
+ QTest::newRow("extends") << QString("extends") << false;
+ QTest::newRow("final") << QString("final") << true;
+ QTest::newRow("float") << QString("float") << true;
+ QTest::newRow("goto") << QString("goto") << true;
+ QTest::newRow("implements") << QString("implements") << true;
+ QTest::newRow("import") << QString("import") << false;
+ QTest::newRow("int") << QString("int") << true;
+ QTest::newRow("interface") << QString("interface") << true;
+ QTest::newRow("long") << QString("long") << true;
+ QTest::newRow("native") << QString("native") << true;
+ QTest::newRow("package") << QString("package") << true;
+ QTest::newRow("private") << QString("private") << true;
+ QTest::newRow("protected") << QString("protected") << true;
+ QTest::newRow("public") << QString("public") << true;
+ QTest::newRow("short") << QString("short") << true;
+ QTest::newRow("static") << QString("static") << true;
+ QTest::newRow("super") << QString("super") << false;
+ QTest::newRow("synchronized") << QString("synchronized") << true;
+ QTest::newRow("throws") << QString("throws") << true;
+ QTest::newRow("transient") << QString("transient") << true;
+ QTest::newRow("volatile") << QString("volatile") << true;
+}
+
+void tst_QJSEngine::jsFutureReservedWords()
+{
+ // See ECMA-262 Section 7.6.1.2, "Future Reserved Words".
+ // In real-world implementations, most of these words are
+ // actually allowed as normal identifiers.
+
+ QFETCH(QString, word);
+ QFETCH(bool, allowed);
+ {
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate(word + " = 123");
+ QCOMPARE(!ret.isError(), allowed);
+ }
+ {
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("var " + word + " = 123");
+ QCOMPARE(!ret.isError(), allowed);
+ }
+ {
+ // this should probably be allowed (see task 162567)
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("o = {}; o." + word + " = 123");
+
+ QEXPECT_FAIL("class", "QTBUG-27193", Abort);
+ QEXPECT_FAIL("const", "QTBUG-27193", Abort);
+ QEXPECT_FAIL("debugger", "QTBUG-27193", Abort);
+ QEXPECT_FAIL("enum", "QTBUG-27193", Abort);
+ QEXPECT_FAIL("export", "QTBUG-27193", Abort);
+ QEXPECT_FAIL("extends", "QTBUG-27193", Abort);
+ QEXPECT_FAIL("import", "QTBUG-27193", Abort);
+ QEXPECT_FAIL("super", "QTBUG-27193", Abort);
+
+ QCOMPARE(ret.isNumber(), allowed);
+ QCOMPARE(!ret.isError(), allowed);
+ }
+ {
+ // this should probably be allowed (see task 162567)
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("o = { " + word + ": 123 }");
+ QCOMPARE(!ret.isError(), allowed);
+ }
+}
+
+void tst_QJSEngine::jsThrowInsideWithStatement()
+{
+ // This is testing ECMA-262 compliance, not C++ API.
+
+ // task 209988
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate(
+ "try {"
+ " o = { bad : \"bug\" };"
+ " with (o) {"
+ " throw 123;"
+ " }"
+ "} catch (e) {"
+ " bad;"
+ "}");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("ReferenceError")));
+ }
+ {
+ QJSValue ret = eng.evaluate(
+ "try {"
+ " o = { bad : \"bug\" };"
+ " with (o) {"
+ " throw 123;"
+ " }"
+ "} finally {"
+ " bad;"
+ "}");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("ReferenceError")));
+ }
+ {
+ QJSValue ret = eng.evaluate(
+ "o = { bug : \"no bug\" };"
+ "with (o) {"
+ " try {"
+ " throw 123;"
+ " } finally {"
+ " bug;"
+ " }"
+ "}");
+ QVERIFY(!ret.isError());
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 123);
+ }
+ {
+ QJSValue ret = eng.evaluate(
+ "o = { bug : \"no bug\" };"
+ "with (o) {"
+ " throw 123;"
+ "}");
+ QVERIFY(ret.isNumber());
+ QJSValue ret2 = eng.evaluate("bug");
+ QVERIFY(ret2.isError());
+ QVERIFY(ret2.toString().contains(QString::fromLatin1("ReferenceError")));
+ }
+}
+
+void tst_QJSEngine::reentrancy_globalObjectProperties()
+{
+ QJSEngine eng1;
+ QJSEngine eng2;
+ QVERIFY(eng2.globalObject().property("a").isUndefined());
+ eng1.evaluate("a = 10");
+ QVERIFY(eng1.globalObject().property("a").isNumber());
+ QVERIFY(eng2.globalObject().property("a").isUndefined());
+ eng2.evaluate("a = 20");
+ QVERIFY(eng2.globalObject().property("a").isNumber());
+ QCOMPARE(eng1.globalObject().property("a").toInt(), 10);
+}
+
+void tst_QJSEngine::reentrancy_Array()
+{
+ // weird bug with JSC backend
+ {
+ QJSEngine eng;
+ QCOMPARE(eng.evaluate("Array()").toString(), QString());
+ eng.evaluate("Array.prototype.toString");
+ QCOMPARE(eng.evaluate("Array()").toString(), QString());
+ }
+ {
+ QJSEngine eng;
+ QCOMPARE(eng.evaluate("Array()").toString(), QString());
+ }
+}
+
+void tst_QJSEngine::reentrancy_objectCreation()
+{
+ // Owned by JS engine, as newQObject() sets JS ownership explicitly
+ QObject *temp = new QObject();
+
+ QJSEngine eng1;
+ QJSEngine eng2;
+ {
+ QDateTime dt = QDateTime::currentDateTime();
+ QJSValue d1 = eng1.toScriptValue(dt);
+ QJSValue d2 = eng2.toScriptValue(dt);
+ QCOMPARE(d1.toDateTime(), d2.toDateTime());
+ QCOMPARE(d2.toDateTime(), d1.toDateTime());
+ }
+ {
+ QJSValue r1 = eng1.evaluate("new RegExp('foo', 'gim')");
+ QJSValue r2 = eng2.evaluate("new RegExp('foo', 'gim')");
+ QCOMPARE(qjsvalue_cast<QRegExp>(r1), qjsvalue_cast<QRegExp>(r2));
+ QCOMPARE(qjsvalue_cast<QRegExp>(r2), qjsvalue_cast<QRegExp>(r1));
+ }
+ {
+ QJSValue o1 = eng1.newQObject(temp);
+ QJSValue o2 = eng2.newQObject(temp);
+ QCOMPARE(o1.toQObject(), o2.toQObject());
+ QCOMPARE(o2.toQObject(), o1.toQObject());
+ }
+}
+
+void tst_QJSEngine::jsIncDecNonObjectProperty()
+{
+ // This is testing ECMA-262 compliance, not C++ API.
+
+ QJSEngine eng;
+ {
+ QJSValue ret = eng.evaluate("var a; a.n++");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a; a.n--");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a = null; a.n++");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a = null; a.n--");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a; ++a.n");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a; --a.n");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a; a.n += 1");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a; a.n -= 1");
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError")));
+ }
+ {
+ QJSValue ret = eng.evaluate("var a = 'ciao'; a.length++");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 4);
+ }
+ {
+ QJSValue ret = eng.evaluate("var a = 'ciao'; a.length--");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 4);
+ }
+ {
+ QJSValue ret = eng.evaluate("var a = 'ciao'; ++a.length");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 5);
+ }
+ {
+ QJSValue ret = eng.evaluate("var a = 'ciao'; --a.length");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt(), 3);
+ }
+}
+
+static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; }
+
+void tst_QJSEngine::qRegExpInport_data()
+{
+ QTest::addColumn<QRegExp>("rx");
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<QString>("matched");
+
+ QTest::newRow("normal") << QRegExp("(test|foo)") << "test _ foo _ test _ Foo";
+ QTest::newRow("normal2") << QRegExp("(Test|Foo)") << "test _ foo _ test _ Foo";
+ QTest::newRow("case insensitive)") << QRegExp("(test|foo)", Qt::CaseInsensitive) << "test _ foo _ test _ Foo";
+ QTest::newRow("case insensitive2)") << QRegExp("(Test|Foo)", Qt::CaseInsensitive) << "test _ foo _ test _ Foo";
+ QTest::newRow("b(a*)(b*)") << QRegExp("b(a*)(b*)", Qt::CaseInsensitive) << "aaabbBbaAabaAaababaaabbaaab";
+ QTest::newRow("greedy") << QRegExp("a*(a*)", Qt::CaseInsensitive, QRegExp::RegExp2) << "aaaabaaba";
+ QTest::newRow("willcard") << QRegExp("*.txt", Qt::CaseSensitive, QRegExp::Wildcard) << "file.txt";
+ QTest::newRow("willcard 2") << QRegExp("a?b.txt", Qt::CaseSensitive, QRegExp::Wildcard) << "ab.txt abb.rtc acb.txt";
+ QTest::newRow("slash") << QRegExp("g/.*/s", Qt::CaseInsensitive, QRegExp::RegExp2) << "string/string/string";
+ QTest::newRow("slash2") << QRegExp("g / .* / s", Qt::CaseInsensitive, QRegExp::RegExp2) << "string / string / string";
+ QTest::newRow("fixed") << QRegExp("a*aa.a(ba)*a\\ba", Qt::CaseInsensitive, QRegExp::FixedString) << "aa*aa.a(ba)*a\\ba";
+ QTest::newRow("fixed insensitive") << QRegExp("A*A", Qt::CaseInsensitive, QRegExp::FixedString) << "a*A A*a A*A a*a";
+ QTest::newRow("fixed sensitive") << QRegExp("A*A", Qt::CaseSensitive, QRegExp::FixedString) << "a*A A*a A*A a*a";
+ QTest::newRow("html") << QRegExp("<b>(.*)</b>", Qt::CaseSensitive, QRegExp::RegExp2) << "<b>bold</b><i>italic</i><b>bold</b>";
+ QTest::newRow("html minimal") << minimal(QRegExp("<b>(.*)</b>", Qt::CaseSensitive, QRegExp::RegExp2)) << "<b>bold</b><i>italic</i><b>bold</b>";
+ QTest::newRow("aaa") << QRegExp("a{2,5}") << "aAaAaaaaaAa";
+ QTest::newRow("aaa minimal") << minimal(QRegExp("a{2,5}")) << "aAaAaaaaaAa";
+ QTest::newRow("minimal") << minimal(QRegExp(".*\\} [*8]")) << "}?} ?} *";
+ QTest::newRow(".? minimal") << minimal(QRegExp(".?")) << ".?";
+ QTest::newRow(".+ minimal") << minimal(QRegExp(".+")) << ".+";
+ QTest::newRow("[.?] minimal") << minimal(QRegExp("[.?]")) << ".?";
+ QTest::newRow("[.+] minimal") << minimal(QRegExp("[.+]")) << ".+";
+}
+
+void tst_QJSEngine::qRegExpInport()
+{
+ QFETCH(QRegExp, rx);
+ QFETCH(QString, string);
+
+ QJSEngine eng;
+ QJSValue rexp;
+ rexp = eng.toScriptValue(rx);
+
+ QCOMPARE(rexp.isRegExp(), true);
+ QCOMPARE(rexp.isCallable(), false);
+
+ QJSValue func = eng.evaluate("(function(string, regexp) { return string.match(regexp); })");
+ QJSValue result = func.call(QJSValueList() << string << rexp);
+
+ rx.indexIn(string);
+ for (int i = 0; i <= rx.captureCount(); i++) {
+ QCOMPARE(result.property(i).toString(), rx.cap(i));
+ }
+}
+
+// QScriptValue::toDateTime() returns a local time, whereas JS dates
+// are always stored as UTC. QtScript must respect the current time
+// zone, and correctly adjust for daylight saving time that may be in
+// effect at a given date (QTBUG-9770).
+void tst_QJSEngine::dateRoundtripJSQtJS()
+{
+ uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t();
+ QJSEngine eng;
+ for (int i = 0; i < 8000; ++i) {
+ QJSValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0));
+ QDateTime qtDate = jsDate.toDateTime();
+ QJSValue jsDate2 = eng.toScriptValue(qtDate);
+ if (jsDate2.toNumber() != jsDate.toNumber())
+ QFAIL(qPrintable(jsDate.toString()));
+ secs += 2*60*60;
+ }
+}
+
+void tst_QJSEngine::dateRoundtripQtJSQt()
+{
+ QDateTime qtDate = QDateTime(QDate(2009, 1, 1));
+ QJSEngine eng;
+ for (int i = 0; i < 8000; ++i) {
+ QJSValue jsDate = eng.toScriptValue(qtDate);
+ QDateTime qtDate2 = jsDate.toDateTime();
+ if (qtDate2 != qtDate)
+ QFAIL(qPrintable(qtDate.toString()));
+ qtDate = qtDate.addSecs(2*60*60);
+ }
+}
+
+void tst_QJSEngine::dateConversionJSQt()
+{
+ uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t();
+ QJSEngine eng;
+ for (int i = 0; i < 8000; ++i) {
+ QJSValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0));
+ QDateTime qtDate = jsDate.toDateTime();
+ QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate);
+ QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString();
+ jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000")
+ if (qtUTCDateStr != jsUTCDateStr)
+ QFAIL(qPrintable(jsDate.toString()));
+ secs += 2*60*60;
+ }
+}
+
+void tst_QJSEngine::dateConversionQtJS()
+{
+ QDateTime qtDate = QDateTime(QDate(2009, 1, 1));
+ QJSEngine eng;
+ for (int i = 0; i < 8000; ++i) {
+ QJSValue jsDate = eng.toScriptValue(qtDate);
+ QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString();
+ jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000")
+ QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate);
+ if (jsUTCDateStr != qtUTCDateStr)
+ QFAIL(qPrintable(qtDate.toString()));
+ qtDate = qtDate.addSecs(2*60*60);
+ }
+}
+
+void tst_QJSEngine::functionPrototypeExtensions()
+{
+ // QJS adds connect and disconnect properties to Function.prototype.
+ QJSEngine eng;
+ QJSValue funProto = eng.globalObject().property("Function").property("prototype");
+ QVERIFY(funProto.isCallable());
+ QVERIFY(funProto.property("connect").isCallable());
+ QVERIFY(funProto.property("disconnect").isCallable());
+
+ // No properties should appear in for-in statements.
+ QJSValue props = eng.evaluate("props = []; for (var p in Function.prototype) props.push(p); props");
+ QVERIFY(props.isArray());
+ QCOMPARE(props.property("length").toInt(), 0);
+}
+
+class ThreadedTestEngine : public QThread {
+ Q_OBJECT;
+
+public:
+ int result;
+
+ ThreadedTestEngine()
+ : result(0) {}
+
+ void run() {
+ QJSEngine firstEngine;
+ QJSEngine secondEngine;
+ QJSValue value = firstEngine.evaluate("1");
+ result = secondEngine.evaluate("1 + " + QString::number(value.toInt())).toInt();
+ }
+};
+
+void tst_QJSEngine::threadedEngine()
+{
+ ThreadedTestEngine thread1;
+ ThreadedTestEngine thread2;
+ thread1.start();
+ thread2.start();
+ thread1.wait();
+ thread2.wait();
+ QCOMPARE(thread1.result, 2);
+ QCOMPARE(thread2.result, 2);
+}
+
+void tst_QJSEngine::v8Context_simple()
+{
+ QJSEngine eng;
+
+ v8::HandleScope handleScope;
+ v8::Local<v8::Context> context = QT_PREPEND_NAMESPACE(qt_QJSEngineV8Context(&eng));
+ v8::Context::Scope contextScope(context);
+
+ v8::Local<v8::Script> script = v8::Script::Compile(
+ v8::String::New("({ foo: 123, bar: 'ciao', baz: true })"));
+
+ v8::TryCatch tc;
+ v8::Local<v8::Value> result = script->Run();
+
+ QVERIFY(!tc.HasCaught());
+ QVERIFY(result->IsObject());
+
+ v8::Local<v8::Object> object = result.As<v8::Object>();
+ QVERIFY(object->Get(v8::String::New("foo"))->Equals(v8::Number::New(123)));
+ QVERIFY(object->Get(v8::String::New("bar"))->Equals(v8::String::New("ciao")));
+ QVERIFY(object->Get(v8::String::New("baz"))->IsTrue());
+}
+
+void tst_QJSEngine::v8Context_exception()
+{
+ QJSEngine eng;
+
+ v8::HandleScope handleScope;
+ v8::Local<v8::Context> context = qt_QJSEngineV8Context(&eng);
+ v8::Context::Scope contextScope(context);
+
+ int startLineNumber = 42;
+ v8::ScriptOrigin origin(v8::String::New("test.js"), v8::Integer::New(startLineNumber));
+ v8::Local<v8::Script> script = v8::Script::Compile(
+ v8::String::New(
+ "function foo(i) {\n"
+ " if (i > 5)\n"
+ " throw Error('Catch me if you can');\n"
+ " foo(i + 1);\n"
+ "}\n"
+ "foo(0);"),
+ &origin);
+
+// QJS does this for us:
+// v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
+
+ v8::TryCatch tc;
+ v8::Local<v8::Value> result = script->Run();
+
+ QVERIFY(tc.HasCaught());
+ QVERIFY(result.IsEmpty());
+
+ v8::Local<v8::Message> message = tc.Message();
+ QVERIFY(!message.IsEmpty());
+ QCOMPARE(*v8::String::AsciiValue(message->Get()), "Uncaught Error: Catch me if you can");
+ QCOMPARE(*v8::String::AsciiValue(message->GetScriptResourceName()), "test.js");
+ QCOMPARE(message->GetLineNumber(), startLineNumber + 3);
+}
+
+void tst_QJSEngine::v8Context_mixAPIs()
+{
+ QJSEngine eng;
+
+ v8::HandleScope handleScope;
+ v8::Local<v8::Context> context = qt_QJSEngineV8Context(&eng);
+ v8::Context::Scope contextScope(context);
+
+ QJSValue globalQJS = eng.globalObject();
+ v8::Local<v8::Value> globalV8Value = qt_QJSValueV8Value(globalQJS);
+ QVERIFY(!globalV8Value.IsEmpty());
+ QVERIFY(globalV8Value->IsObject());
+ v8::Local<v8::Object> globalV8 = globalV8Value.As<v8::Object>();
+
+ QVERIFY(globalQJS.property("foo").isUndefined());
+ QVERIFY(globalV8->Get(v8::String::New("foo"))->IsUndefined());
+
+ globalQJS.setProperty("foo", 123);
+ QVERIFY(globalV8->Get(v8::String::New("foo"))->Equals(v8::Number::New(123)));
+
+ globalV8->Set(v8::String::New("bar"), v8::String::New("ciao"));
+ QVERIFY(globalQJS.property("bar").equals("ciao"));
+
+ QJSValue arrayQJS = eng.newArray(10);
+ v8::Local<v8::Value> arrayV8Value = qt_QJSValueV8Value(arrayQJS);
+ QVERIFY(!arrayV8Value.IsEmpty());
+ QVERIFY(arrayV8Value->IsArray());
+ v8::Local<v8::Array> arrayV8 = arrayV8Value.As<v8::Array>();
+
+ QCOMPARE(int(arrayV8->Length()), 10);
+ arrayV8->Set(5, v8::Null());
+ QVERIFY(arrayQJS.property(5).isNull());
+}
+
+QTEST_MAIN(tst_QJSEngine)
+
+#include "tst_qjsengine.moc"
+
diff --git a/tests/auto/qml/qjsonbinding/data/array.0.json b/tests/auto/qml/qjsonbinding/data/array.0.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/array.0.json
@@ -0,0 +1 @@
+[]
diff --git a/tests/auto/qml/qjsonbinding/data/array.1.json b/tests/auto/qml/qjsonbinding/data/array.1.json
new file mode 100644
index 0000000000..3214bfe58c
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/array.1.json
@@ -0,0 +1 @@
+[123]
diff --git a/tests/auto/qml/qjsonbinding/data/array.2.json b/tests/auto/qml/qjsonbinding/data/array.2.json
new file mode 100644
index 0000000000..7fd87cd054
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/array.2.json
@@ -0,0 +1 @@
+[true,false,null,"hello"]
diff --git a/tests/auto/qml/qjsonbinding/data/array.3.json b/tests/auto/qml/qjsonbinding/data/array.3.json
new file mode 100644
index 0000000000..3b418fce74
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/array.3.json
@@ -0,0 +1 @@
+[{"a":42}]
diff --git a/tests/auto/qml/qjsonbinding/data/array.4.json b/tests/auto/qml/qjsonbinding/data/array.4.json
new file mode 100644
index 0000000000..55e9fdce97
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/array.4.json
@@ -0,0 +1 @@
+[[[42]],[]]
diff --git a/tests/auto/qml/qjsonbinding/data/empty.json b/tests/auto/qml/qjsonbinding/data/empty.json
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/empty.json
diff --git a/tests/auto/qml/qjsonbinding/data/false.json b/tests/auto/qml/qjsonbinding/data/false.json
new file mode 100644
index 0000000000..c508d5366f
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/false.json
@@ -0,0 +1 @@
+false
diff --git a/tests/auto/qml/qjsonbinding/data/null.json b/tests/auto/qml/qjsonbinding/data/null.json
new file mode 100644
index 0000000000..19765bd501
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/null.json
@@ -0,0 +1 @@
+null
diff --git a/tests/auto/qml/qjsonbinding/data/number.0.json b/tests/auto/qml/qjsonbinding/data/number.0.json
new file mode 100644
index 0000000000..190a18037c
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/number.0.json
@@ -0,0 +1 @@
+123
diff --git a/tests/auto/qml/qjsonbinding/data/number.1.json b/tests/auto/qml/qjsonbinding/data/number.1.json
new file mode 100644
index 0000000000..c07e7a1490
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/number.1.json
@@ -0,0 +1 @@
+42.35
diff --git a/tests/auto/qml/qjsonbinding/data/object.0.json b/tests/auto/qml/qjsonbinding/data/object.0.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/object.0.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/qml/qjsonbinding/data/object.1.json b/tests/auto/qml/qjsonbinding/data/object.1.json
new file mode 100644
index 0000000000..bde58e7952
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/object.1.json
@@ -0,0 +1 @@
+{"foo":123}
diff --git a/tests/auto/qml/qjsonbinding/data/object.2.json b/tests/auto/qml/qjsonbinding/data/object.2.json
new file mode 100644
index 0000000000..d6f25a1488
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/object.2.json
@@ -0,0 +1 @@
+{"a":true,"b":false,"c":null,"d":"hello"}
diff --git a/tests/auto/qml/qjsonbinding/data/object.3.json b/tests/auto/qml/qjsonbinding/data/object.3.json
new file mode 100644
index 0000000000..9b7611740f
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/object.3.json
@@ -0,0 +1 @@
+{"a":{"b":{"c":42}}}
diff --git a/tests/auto/qml/qjsonbinding/data/object.4.json b/tests/auto/qml/qjsonbinding/data/object.4.json
new file mode 100644
index 0000000000..377313739d
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/object.4.json
@@ -0,0 +1 @@
+{"a":[],"b":[42],"c":{"d":null}}
diff --git a/tests/auto/qml/qjsonbinding/data/string.0.json b/tests/auto/qml/qjsonbinding/data/string.0.json
new file mode 100644
index 0000000000..3580093b9d
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/string.0.json
@@ -0,0 +1 @@
+"hello"
diff --git a/tests/auto/qml/qjsonbinding/data/true.json b/tests/auto/qml/qjsonbinding/data/true.json
new file mode 100644
index 0000000000..27ba77ddaf
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/data/true.json
@@ -0,0 +1 @@
+true
diff --git a/tests/auto/qml/qjsonbinding/qjsonbinding.pro b/tests/auto/qml/qjsonbinding/qjsonbinding.pro
new file mode 100644
index 0000000000..a54eab198b
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/qjsonbinding.pro
@@ -0,0 +1,17 @@
+CONFIG += testcase
+TARGET = tst_qjsonbinding
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qjsonbinding.cpp
+INCLUDEPATH += ../../shared
+
+include (../../shared/util.pri)
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+QT += core qml testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp b/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp
new file mode 100644
index 0000000000..b89192130e
--- /dev/null
+++ b/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp
@@ -0,0 +1,532 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <QtQml/QtQml>
+#include "../../shared/util.h"
+
+Q_DECLARE_METATYPE(QJsonValue::Type)
+
+class JsonPropertyObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QJsonValue value READ value WRITE setValue)
+ Q_PROPERTY(QJsonObject object READ object WRITE setObject)
+ Q_PROPERTY(QJsonArray array READ array WRITE setArray)
+public:
+ QJsonValue value() const { return m_value; }
+ void setValue(const QJsonValue &v) { m_value = v; }
+ QJsonObject object() const { return m_object; }
+ void setObject(const QJsonObject &o) { m_object = o; }
+ QJsonArray array() const { return m_array; }
+ void setArray(const QJsonArray &a) { m_array = a; }
+
+private:
+ QJsonValue m_value;
+ QJsonObject m_object;
+ QJsonArray m_array;
+};
+
+class tst_qjsonbinding : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qjsonbinding() {}
+
+private slots:
+ void cppJsConversion_data();
+ void cppJsConversion();
+
+ void readValueProperty_data();
+ void readValueProperty();
+ void readObjectOrArrayProperty_data();
+ void readObjectOrArrayProperty();
+
+ void writeValueProperty_data();
+ void writeValueProperty();
+ void writeObjectOrArrayProperty_data();
+ void writeObjectOrArrayProperty();
+
+ void writeProperty_incompatibleType_data();
+ void writeProperty_incompatibleType();
+
+ void writeProperty_javascriptExpression_data();
+ void writeProperty_javascriptExpression();
+
+private:
+ QByteArray readAsUtf8(const QString &fileName);
+ static QJsonValue valueFromJson(const QByteArray &json);
+
+ void addPrimitiveDataTestFiles();
+ void addObjectDataTestFiles();
+ void addArrayDataTestFiles();
+};
+
+QByteArray tst_qjsonbinding::readAsUtf8(const QString &fileName)
+{
+ QFile file(testFile(fileName));
+ file.open(QIODevice::ReadOnly);
+ QTextStream stream(&file);
+ return stream.readAll().trimmed().toUtf8();
+}
+
+QJsonValue tst_qjsonbinding::valueFromJson(const QByteArray &json)
+{
+ if (json.isEmpty())
+ return QJsonValue(QJsonValue::Undefined);
+
+ QJsonDocument doc = QJsonDocument::fromJson(json);
+ if (!doc.isEmpty())
+ return doc.isObject() ? QJsonValue(doc.object()) : QJsonValue(doc.array());
+
+ // QJsonDocument::fromJson() only handles objects and arrays...
+ // Wrap the JSON inside a dummy object and extract the value.
+ QByteArray wrappedJson = "{\"prop\":" + json + "}";
+ doc = QJsonDocument::fromJson(wrappedJson);
+ Q_ASSERT(doc.isObject());
+ return doc.object().value("prop");
+}
+
+void tst_qjsonbinding::addPrimitiveDataTestFiles()
+{
+ QTest::newRow("true") << "true.json";
+ QTest::newRow("false") << "false.json";
+
+ QTest::newRow("null") << "null.json";
+
+ QTest::newRow("number.0") << "number.0.json";
+ QTest::newRow("number.1") << "number.1.json";
+
+ QTest::newRow("string.0") << "string.0.json";
+
+ QTest::newRow("undefined") << "empty.json";
+}
+
+void tst_qjsonbinding::addObjectDataTestFiles()
+{
+ QTest::newRow("object.0") << "object.0.json";
+ QTest::newRow("object.1") << "object.1.json";
+ QTest::newRow("object.2") << "object.2.json";
+ QTest::newRow("object.3") << "object.3.json";
+ QTest::newRow("object.4") << "object.4.json";
+}
+
+void tst_qjsonbinding::addArrayDataTestFiles()
+{
+ QTest::newRow("array.0") << "array.0.json";
+ QTest::newRow("array.1") << "array.1.json";
+ QTest::newRow("array.2") << "array.2.json";
+ QTest::newRow("array.3") << "array.3.json";
+ QTest::newRow("array.4") << "array.4.json";
+}
+
+void tst_qjsonbinding::cppJsConversion_data()
+{
+ QTest::addColumn<QString>("fileName");
+
+ addPrimitiveDataTestFiles();
+ addObjectDataTestFiles();
+ addArrayDataTestFiles();
+}
+
+void tst_qjsonbinding::cppJsConversion()
+{
+ QFETCH(QString, fileName);
+
+ QByteArray json = readAsUtf8(fileName);
+ QJsonValue jsonValue = valueFromJson(json);
+
+ QJSEngine eng;
+ QJSValue stringify = eng.globalObject().property("JSON").property("stringify");
+ QVERIFY(stringify.isCallable());
+
+ {
+ QJSValue jsValue = eng.toScriptValue(jsonValue);
+ QVERIFY(!jsValue.isVariant());
+ switch (jsonValue.type()) {
+ case QJsonValue::Null:
+ QVERIFY(jsValue.isNull());
+ break;
+ case QJsonValue::Bool:
+ QVERIFY(jsValue.isBool());
+ QCOMPARE(jsValue.toBool(), jsonValue.toBool());
+ break;
+ case QJsonValue::Double:
+ QVERIFY(jsValue.isNumber());
+ QCOMPARE(jsValue.toNumber(), jsonValue.toDouble());
+ break;
+ case QJsonValue::String:
+ QVERIFY(jsValue.isString());
+ QCOMPARE(jsValue.toString(), jsonValue.toString());
+ break;
+ case QJsonValue::Array:
+ QVERIFY(jsValue.isArray());
+ break;
+ case QJsonValue::Object:
+ QVERIFY(jsValue.isObject());
+ break;
+ case QJsonValue::Undefined:
+ QVERIFY(jsValue.isUndefined());
+ break;
+ }
+
+ if (jsValue.isUndefined()) {
+ QVERIFY(json.isEmpty());
+ } else {
+ QJSValue stringified = stringify.call(QJSValueList() << jsValue);
+ QVERIFY(!stringified.isError());
+ QCOMPARE(stringified.toString().toUtf8(), json);
+ }
+
+ QJsonValue roundtrip = qjsvalue_cast<QJsonValue>(jsValue);
+ // Workarounds for QTBUG-25164
+ if (jsonValue.isObject() && jsonValue.toObject().isEmpty())
+ QVERIFY(roundtrip.isObject() && roundtrip.toObject().isEmpty());
+ else if (jsonValue.isArray() && jsonValue.toArray().isEmpty())
+ QVERIFY(roundtrip.isArray() && roundtrip.toArray().isEmpty());
+ else
+ QCOMPARE(roundtrip, jsonValue);
+ }
+
+ if (jsonValue.isObject()) {
+ QJsonObject jsonObject = jsonValue.toObject();
+ QJSValue jsObject = eng.toScriptValue(jsonObject);
+ QVERIFY(!jsObject.isVariant());
+ QVERIFY(jsObject.isObject());
+
+ QJSValue stringified = stringify.call(QJSValueList() << jsObject);
+ QVERIFY(!stringified.isError());
+ QCOMPARE(stringified.toString().toUtf8(), json);
+
+ QJsonObject roundtrip = qjsvalue_cast<QJsonObject>(jsObject);
+ QCOMPARE(roundtrip, jsonObject);
+ } else if (jsonValue.isArray()) {
+ QJsonArray jsonArray = jsonValue.toArray();
+ QJSValue jsArray = eng.toScriptValue(jsonArray);
+ QVERIFY(!jsArray.isVariant());
+ QVERIFY(jsArray.isArray());
+
+ QJSValue stringified = stringify.call(QJSValueList() << jsArray);
+ QVERIFY(!stringified.isError());
+ QCOMPARE(stringified.toString().toUtf8(), json);
+
+ QJsonArray roundtrip = qjsvalue_cast<QJsonArray>(jsArray);
+ QCOMPARE(roundtrip, jsonArray);
+ }
+}
+
+void tst_qjsonbinding::readValueProperty_data()
+{
+ cppJsConversion_data();
+}
+
+void tst_qjsonbinding::readValueProperty()
+{
+ QFETCH(QString, fileName);
+
+ QByteArray json = readAsUtf8(fileName);
+ QJsonValue jsonValue = valueFromJson(json);
+
+ QJSEngine eng;
+ JsonPropertyObject obj;
+ obj.setValue(jsonValue);
+ eng.globalObject().setProperty("obj", eng.newQObject(&obj));
+ QJSValue stringified = eng.evaluate(
+ "var v = obj.value; (typeof v == 'undefined') ? '' : JSON.stringify(v)");
+ QVERIFY(!stringified.isError());
+ QCOMPARE(stringified.toString().toUtf8(), json);
+}
+
+void tst_qjsonbinding::readObjectOrArrayProperty_data()
+{
+ QTest::addColumn<QString>("fileName");
+
+ addObjectDataTestFiles();
+ addArrayDataTestFiles();
+}
+
+void tst_qjsonbinding::readObjectOrArrayProperty()
+{
+ QFETCH(QString, fileName);
+
+ QByteArray json = readAsUtf8(fileName);
+ QJsonValue jsonValue = valueFromJson(json);
+ QVERIFY(jsonValue.isObject() || jsonValue.isArray());
+
+ QJSEngine eng;
+ JsonPropertyObject obj;
+ if (jsonValue.isObject())
+ obj.setObject(jsonValue.toObject());
+ else
+ obj.setArray(jsonValue.toArray());
+ eng.globalObject().setProperty("obj", eng.newQObject(&obj));
+
+ QJSValue stringified = eng.evaluate(
+ QString::fromLatin1("JSON.stringify(obj.%0)").arg(
+ jsonValue.isObject() ? "object" : "array"));
+ QVERIFY(!stringified.isError());
+ QCOMPARE(stringified.toString().toUtf8(), json);
+}
+
+void tst_qjsonbinding::writeValueProperty_data()
+{
+ readValueProperty_data();
+}
+
+void tst_qjsonbinding::writeValueProperty()
+{
+ QFETCH(QString, fileName);
+
+ QByteArray json = readAsUtf8(fileName);
+ QJsonValue jsonValue = valueFromJson(json);
+
+ QJSEngine eng;
+ JsonPropertyObject obj;
+ eng.globalObject().setProperty("obj", eng.newQObject(&obj));
+
+ QJSValue fun = eng.evaluate(
+ "(function(json) {"
+ " void(obj.value = (json == '') ? undefined : JSON.parse(json));"
+ "})");
+ QVERIFY(fun.isCallable());
+
+ QVERIFY(obj.value().isNull());
+ QVERIFY(fun.call(QJSValueList() << QString::fromUtf8(json)).isUndefined());
+
+ // Workarounds for QTBUG-25164
+ if (jsonValue.isObject() && jsonValue.toObject().isEmpty())
+ QVERIFY(obj.value().isObject() && obj.value().toObject().isEmpty());
+ else if (jsonValue.isArray() && jsonValue.toArray().isEmpty())
+ QVERIFY(obj.value().isArray() && obj.value().toArray().isEmpty());
+ else
+ QCOMPARE(obj.value(), jsonValue);
+}
+
+void tst_qjsonbinding::writeObjectOrArrayProperty_data()
+{
+ readObjectOrArrayProperty_data();
+}
+
+void tst_qjsonbinding::writeObjectOrArrayProperty()
+{
+ QFETCH(QString, fileName);
+
+ QByteArray json = readAsUtf8(fileName);
+ QJsonValue jsonValue = valueFromJson(json);
+ QVERIFY(jsonValue.isObject() || jsonValue.isArray());
+
+ QJSEngine eng;
+ JsonPropertyObject obj;
+ eng.globalObject().setProperty("obj", eng.newQObject(&obj));
+
+ QJSValue fun = eng.evaluate(
+ QString::fromLatin1(
+ "(function(json) {"
+ " void(obj.%0 = JSON.parse(json));"
+ "})").arg(jsonValue.isObject() ? "object" : "array")
+ );
+ QVERIFY(fun.isCallable());
+
+ QVERIFY(obj.object().isEmpty() && obj.array().isEmpty());
+ QVERIFY(fun.call(QJSValueList() << QString::fromUtf8(json)).isUndefined());
+
+ if (jsonValue.isObject())
+ QCOMPARE(obj.object(), jsonValue.toObject());
+ else
+ QCOMPARE(obj.array(), jsonValue.toArray());
+}
+
+void tst_qjsonbinding::writeProperty_incompatibleType_data()
+{
+ QTest::addColumn<QString>("property");
+ QTest::addColumn<QString>("expression");
+
+ QTest::newRow("value=function") << "value" << "(function(){})";
+
+ QTest::newRow("object=undefined") << "object" << "undefined";
+ QTest::newRow("object=null") << "object" << "null";
+ QTest::newRow("object=false") << "object" << "false";
+ QTest::newRow("object=true") << "object" << "true";
+ QTest::newRow("object=123") << "object" << "123";
+ QTest::newRow("object=42.35") << "object" << "42.35";
+ QTest::newRow("object='foo'") << "object" << "'foo'";
+ QTest::newRow("object=[]") << "object" << "[]";
+ QTest::newRow("object=function") << "object" << "(function(){})";
+
+ QTest::newRow("array=undefined") << "array" << "undefined";
+ QTest::newRow("array=null") << "array" << "null";
+ QTest::newRow("array=false") << "array" << "false";
+ QTest::newRow("array=true") << "array" << "true";
+ QTest::newRow("array=123") << "array" << "123";
+ QTest::newRow("array=42.35") << "array" << "42.35";
+ QTest::newRow("array='foo'") << "array" << "'foo'";
+ QTest::newRow("array={}") << "array" << "{}";
+ QTest::newRow("array=function") << "array" << "(function(){})";
+}
+
+void tst_qjsonbinding::writeProperty_incompatibleType()
+{
+ QFETCH(QString, property);
+ QFETCH(QString, expression);
+
+ QJSEngine eng;
+ JsonPropertyObject obj;
+ eng.globalObject().setProperty("obj", eng.newQObject(&obj));
+
+ QJSValue ret = eng.evaluate(QString::fromLatin1("obj.%0 = %1")
+ .arg(property).arg(expression));
+ QVERIFY(ret.isError());
+ QVERIFY(ret.toString().contains("Cannot assign"));
+}
+
+void tst_qjsonbinding::writeProperty_javascriptExpression_data()
+{
+ QTest::addColumn<QString>("property");
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<QString>("expectedJson");
+
+ // Function properties should be omitted.
+ QTest::newRow("value = object with function property")
+ << "value" << "{ foo: function() {} }" << "{}";
+ QTest::newRow("object = object with function property")
+ << "object" << "{ foo: function() {} }" << "{}";
+ QTest::newRow("array = array with function property")
+ << "array" << "[function() {}]" << "[]";
+
+ // Inherited properties should not be included.
+ QTest::newRow("value = object with inherited property")
+ << "value" << "{ __proto__: { proto_foo: 123 } }"
+ << "{}";
+ QTest::newRow("value = object with inherited property 2")
+ << "value" << "{ foo: 123, __proto__: { proto_foo: 456 } }"
+ << "{\"foo\":123}";
+ QTest::newRow("value = array with inherited property")
+ << "value" << "(function() { var a = []; a.__proto__ = { proto_foo: 123 }; return a; })()"
+ << "[]";
+ QTest::newRow("value = array with inherited property 2")
+ << "value" << "(function() { var a = [10, 20]; a.__proto__ = { proto_foo: 123 }; return a; })()"
+ << "[10,20]";
+
+ QTest::newRow("object = object with inherited property")
+ << "object" << "{ __proto__: { proto_foo: 123 } }"
+ << "{}";
+ QTest::newRow("object = object with inherited property 2")
+ << "object" << "{ foo: 123, __proto__: { proto_foo: 456 } }"
+ << "{\"foo\":123}";
+ QTest::newRow("array = array with inherited property")
+ << "array" << "(function() { var a = []; a.__proto__ = { proto_foo: 123 }; return a; })()"
+ << "[]";
+ QTest::newRow("array = array with inherited property 2")
+ << "array" << "(function() { var a = [10, 20]; a.__proto__ = { proto_foo: 123 }; return a; })()"
+ << "[10,20]";
+
+ // Non-enumerable properties should be included.
+ QTest::newRow("value = object with non-enumerable property")
+ << "value" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })"
+ << "{\"foo\":123}";
+ QTest::newRow("object = object with non-enumerable property")
+ << "object" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })"
+ << "{\"foo\":123}";
+
+ // Cyclic data structures are permitted, but the cyclic links become
+ // empty objects.
+ QTest::newRow("value = cyclic object")
+ << "value" << "(function() { var o = { foo: 123 }; o.o = o; return o; })()"
+ << "{\"foo\":123,\"o\":{}}";
+ QTest::newRow("value = cyclic array")
+ << "value" << "(function() { var a = [10, 20]; a.push(a); return a; })()"
+ << "[10,20,[]]";
+ QTest::newRow("object = cyclic object")
+ << "object" << "(function() { var o = { bar: true }; o.o = o; return o; })()"
+ << "{\"bar\":true,\"o\":{}}";
+ QTest::newRow("array = cyclic array")
+ << "array" << "(function() { var a = [30, 40]; a.unshift(a); return a; })()"
+ << "[[],30,40]";
+
+ // Properties with undefined value are excluded.
+ QTest::newRow("value = { foo: undefined }")
+ << "value" << "{ foo: undefined }" << "{}";
+ QTest::newRow("value = { foo: undefined, bar: 123 }")
+ << "value" << "{ foo: undefined, bar: 123 }" << "{\"bar\":123}";
+ QTest::newRow("value = { foo: 456, bar: undefined }")
+ << "value" << "{ foo: 456, bar: undefined }" << "{\"foo\":456}";
+
+ QTest::newRow("object = { foo: undefined }")
+ << "object" << "{ foo: undefined }" << "{}";
+ QTest::newRow("object = { foo: undefined, bar: 123 }")
+ << "object" << "{ foo: undefined, bar: 123 }" << "{\"bar\":123}";
+ QTest::newRow("object = { foo: 456, bar: undefined }")
+ << "object" << "{ foo: 456, bar: undefined }" << "{\"foo\":456}";
+
+ // QJsonArray::append() implicitly converts undefined values to null.
+ QTest::newRow("value = [undefined]")
+ << "value" << "[undefined]" << "[null]";
+ QTest::newRow("value = [undefined, 10]")
+ << "value" << "[undefined, 10]" << "[null,10]";
+ QTest::newRow("value = [10, undefined, 20]")
+ << "value" << "[10, undefined, 20]" << "[10,null,20]";
+
+ QTest::newRow("array = [undefined]")
+ << "array" << "[undefined]" << "[null]";
+ QTest::newRow("array = [undefined, 10]")
+ << "array" << "[undefined, 10]" << "[null,10]";
+ QTest::newRow("array = [10, undefined, 20]")
+ << "array" << "[10, undefined, 20]" << "[10,null,20]";
+}
+
+void tst_qjsonbinding::writeProperty_javascriptExpression()
+{
+ QFETCH(QString, property);
+ QFETCH(QString, expression);
+ QFETCH(QString, expectedJson);
+
+ QJSEngine eng;
+ JsonPropertyObject obj;
+ eng.globalObject().setProperty("obj", eng.newQObject(&obj));
+
+ QJSValue ret = eng.evaluate(QString::fromLatin1("obj.%0 = %1; JSON.stringify(obj.%0)")
+ .arg(property).arg(expression));
+ QVERIFY(!ret.isError());
+ QCOMPARE(ret.toString(), expectedJson);
+}
+
+QTEST_MAIN(tst_qjsonbinding)
+
+#include "tst_qjsonbinding.moc"
diff --git a/tests/auto/qml/qjsvalue/qjsvalue.pro b/tests/auto/qml/qjsvalue/qjsvalue.pro
new file mode 100644
index 0000000000..d914d40762
--- /dev/null
+++ b/tests/auto/qml/qjsvalue/qjsvalue.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qjsvalue
+macx:CONFIG -= app_bundle
+QT += qml widgets testlib gui-private
+SOURCES += tst_qjsvalue.cpp
+HEADERS += tst_qjsvalue.h
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
new file mode 100644
index 0000000000..49e66c08dd
--- /dev/null
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
@@ -0,0 +1,2572 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tst_qjsvalue.h"
+#include <QtWidgets/QPushButton>
+
+QT_BEGIN_NAMESPACE
+extern bool qt_script_isJITEnabled();
+QT_END_NAMESPACE
+
+tst_QJSValue::tst_QJSValue()
+ : engine(0)
+{
+}
+
+tst_QJSValue::~tst_QJSValue()
+{
+ if (engine)
+ delete engine;
+}
+
+void tst_QJSValue::ctor_invalid()
+{
+ QJSEngine eng;
+ {
+ QJSValue v;
+ QVERIFY(v.isUndefined());
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+ }
+}
+
+void tst_QJSValue::ctor_undefinedWithEngine()
+{
+ QJSEngine eng;
+ {
+ QJSValue v = eng.toScriptValue(QVariant());
+ QVERIFY(v.isUndefined());
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), &eng);
+ }
+}
+
+void tst_QJSValue::ctor_nullWithEngine()
+{
+ QJSEngine eng;
+ {
+ QJSValue v = eng.evaluate("null");
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNull(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), &eng);
+ }
+}
+
+void tst_QJSValue::ctor_boolWithEngine()
+{
+ QJSEngine eng;
+ {
+ QJSValue v = eng.toScriptValue(false);
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isBool(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toBool(), false);
+ QCOMPARE(v.engine(), &eng);
+ }
+}
+
+void tst_QJSValue::ctor_intWithEngine()
+{
+ QJSEngine eng;
+ {
+ QJSValue v = eng.toScriptValue(int(1));
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), &eng);
+ }
+}
+
+void tst_QJSValue::ctor_int()
+{
+ {
+ QJSValue v(int(0x43211234));
+ QVERIFY(v.isNumber());
+ QCOMPARE(v.toInt(), 0x43211234);
+ }
+ {
+ QJSValue v(int(1));
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+ }
+}
+
+void tst_QJSValue::ctor_uintWithEngine()
+{
+ QJSEngine eng;
+ {
+ QJSValue v = eng.toScriptValue(uint(1));
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), &eng);
+ }
+}
+
+void tst_QJSValue::ctor_uint()
+{
+ {
+ QJSValue v(uint(0x43211234));
+ QVERIFY(v.isNumber());
+ QCOMPARE(v.toUInt(), uint(0x43211234));
+ }
+ {
+ QJSValue v(uint(1));
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+ }
+}
+
+void tst_QJSValue::ctor_floatWithEngine()
+{
+ QJSEngine eng;
+ {
+ QJSValue v = eng.toScriptValue(float(1.0));
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), &eng);
+ }
+}
+
+void tst_QJSValue::ctor_float()
+{
+ {
+ QJSValue v(12345678910.5);
+ QVERIFY(v.isNumber());
+ QCOMPARE(v.toNumber(), 12345678910.5);
+ }
+ {
+ QJSValue v(1.0);
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNumber(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toNumber(), 1.0);
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+ }
+}
+
+void tst_QJSValue::ctor_stringWithEngine()
+{
+ QJSEngine eng;
+ {
+ QJSValue v = eng.toScriptValue(QString::fromLatin1("ciao"));
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isString(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toString(), QLatin1String("ciao"));
+ QCOMPARE(v.engine(), &eng);
+ }
+}
+
+void tst_QJSValue::ctor_string()
+{
+ {
+ QJSValue v(QString("ciao"));
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isString(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toString(), QLatin1String("ciao"));
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+ }
+ {
+ QJSValue v("ciao");
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isString(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toString(), QLatin1String("ciao"));
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+ }
+}
+
+void tst_QJSValue::ctor_copyAndAssignWithEngine()
+{
+ QJSEngine eng;
+ // copy constructor, operator=
+ {
+ QJSValue v = eng.toScriptValue(1.0);
+ QJSValue v2(v);
+ QCOMPARE(v2.strictlyEquals(v), true);
+ QCOMPARE(v2.engine(), &eng);
+
+ QJSValue v3(v);
+ QCOMPARE(v3.strictlyEquals(v), true);
+ QCOMPARE(v3.strictlyEquals(v2), true);
+ QCOMPARE(v3.engine(), &eng);
+
+ QJSValue v4 = eng.toScriptValue(2.0);
+ QCOMPARE(v4.strictlyEquals(v), false);
+ v3 = v4;
+ QCOMPARE(v3.strictlyEquals(v), false);
+ QCOMPARE(v3.strictlyEquals(v4), true);
+
+ v2 = QJSValue();
+ QCOMPARE(v2.strictlyEquals(v), false);
+ QCOMPARE(v.toNumber(), 1.0);
+
+ QJSValue v5(v);
+ QCOMPARE(v5.strictlyEquals(v), true);
+ v = QJSValue();
+ QCOMPARE(v5.strictlyEquals(v), false);
+ QCOMPARE(v5.toNumber(), 1.0);
+ }
+}
+
+void tst_QJSValue::ctor_undefined()
+{
+ QJSValue v(QJSValue::UndefinedValue);
+ QVERIFY(v.isUndefined());
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+}
+
+void tst_QJSValue::ctor_null()
+{
+ QJSValue v(QJSValue::NullValue);
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isNull(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+}
+
+void tst_QJSValue::ctor_bool()
+{
+ QJSValue v(false);
+ QVERIFY(!v.isUndefined());
+ QCOMPARE(v.isBool(), true);
+ QCOMPARE(v.isBool(), true);
+ QCOMPARE(v.isObject(), false);
+ QCOMPARE(v.toBool(), false);
+ QCOMPARE(v.engine(), (QJSEngine *)0);
+}
+
+void tst_QJSValue::ctor_copyAndAssign()
+{
+ QJSValue v(1.0);
+ QJSValue v2(v);
+ QCOMPARE(v2.strictlyEquals(v), true);
+ QCOMPARE(v2.engine(), (QJSEngine *)0);
+
+ QJSValue v3(v);
+ QCOMPARE(v3.strictlyEquals(v), true);
+ QCOMPARE(v3.strictlyEquals(v2), true);
+ QCOMPARE(v3.engine(), (QJSEngine *)0);
+
+ QJSValue v4(2.0);
+ QCOMPARE(v4.strictlyEquals(v), false);
+ v3 = v4;
+ QCOMPARE(v3.strictlyEquals(v), false);
+ QCOMPARE(v3.strictlyEquals(v4), true);
+
+ v2 = QJSValue();
+ QCOMPARE(v2.strictlyEquals(v), false);
+ QCOMPARE(v.toNumber(), 1.0);
+
+ QJSValue v5(v);
+ QCOMPARE(v5.strictlyEquals(v), true);
+ v = QJSValue();
+ QCOMPARE(v5.strictlyEquals(v), false);
+ QCOMPARE(v5.toNumber(), 1.0);
+}
+
+void tst_QJSValue::toString()
+{
+ QJSEngine eng;
+
+ QJSValue undefined = eng.toScriptValue(QVariant());
+ QCOMPARE(undefined.toString(), QString("undefined"));
+ QCOMPARE(qjsvalue_cast<QString>(undefined), QString());
+
+ QJSValue null = eng.evaluate("null");
+ QCOMPARE(null.toString(), QString("null"));
+ QCOMPARE(qjsvalue_cast<QString>(null), QString());
+
+ {
+ QJSValue falskt = eng.toScriptValue(false);
+ QCOMPARE(falskt.toString(), QString("false"));
+ QCOMPARE(qjsvalue_cast<QString>(falskt), QString("false"));
+
+ QJSValue sant = eng.toScriptValue(true);
+ QCOMPARE(sant.toString(), QString("true"));
+ QCOMPARE(qjsvalue_cast<QString>(sant), QString("true"));
+ }
+ {
+ QJSValue number = eng.toScriptValue(123);
+ QCOMPARE(number.toString(), QString("123"));
+ QCOMPARE(qjsvalue_cast<QString>(number), QString("123"));
+ }
+ {
+ QJSValue number = eng.toScriptValue(6.37e-8);
+ QCOMPARE(number.toString(), QString("6.37e-8"));
+ }
+ {
+ QJSValue number = eng.toScriptValue(-6.37e-8);
+ QCOMPARE(number.toString(), QString("-6.37e-8"));
+
+ QJSValue str = eng.toScriptValue(QString("ciao"));
+ QCOMPARE(str.toString(), QString("ciao"));
+ QCOMPARE(qjsvalue_cast<QString>(str), QString("ciao"));
+ }
+
+ QJSValue object = eng.newObject();
+ QCOMPARE(object.toString(), QString("[object Object]"));
+ QCOMPARE(qjsvalue_cast<QString>(object), QString("[object Object]"));
+
+ // toString() that throws exception
+ {
+ QJSValue objectObject = eng.evaluate(
+ "(function(){"
+ " o = { };"
+ " o.toString = function() { throw new Error('toString'); };"
+ " return o;"
+ "})()");
+ QCOMPARE(objectObject.toString(), QLatin1String("Error: toString"));
+ }
+ {
+ QJSValue objectObject = eng.evaluate(
+ "(function(){"
+ " var f = function() {};"
+ " f.prototype = Date;"
+ " return new f;"
+ "})()");
+ QVERIFY(!objectObject.isError());
+ QVERIFY(objectObject.isObject());
+ QCOMPARE(objectObject.toString(), QString::fromLatin1("TypeError: Function.prototype.toString is not generic"));
+ }
+
+ QJSValue inv = QJSValue();
+ QCOMPARE(inv.toString(), QString::fromLatin1("undefined"));
+
+ // V2 constructors
+ {
+ QJSValue falskt = QJSValue(false);
+ QCOMPARE(falskt.toString(), QString("false"));
+ QCOMPARE(qjsvalue_cast<QString>(falskt), QString("false"));
+
+ QJSValue sant = QJSValue(true);
+ QCOMPARE(sant.toString(), QString("true"));
+ QCOMPARE(qjsvalue_cast<QString>(sant), QString("true"));
+
+ QJSValue number = QJSValue(123);
+ QCOMPARE(number.toString(), QString("123"));
+ QCOMPARE(qjsvalue_cast<QString>(number), QString("123"));
+
+ QJSValue number2(int(0x43211234));
+ QCOMPARE(number2.toString(), QString("1126240820"));
+
+ QJSValue str = QJSValue(QString("ciao"));
+ QCOMPARE(str.toString(), QString("ciao"));
+ QCOMPARE(qjsvalue_cast<QString>(str), QString("ciao"));
+ }
+
+ // variant should use internal valueOf(), then fall back to QVariant::toString(),
+ // then fall back to "QVariant(typename)"
+ QJSValue variant = eng.toScriptValue(QPoint(10, 20));
+ QVERIFY(variant.isVariant());
+ QCOMPARE(variant.toString(), QString::fromLatin1("QVariant(QPoint)"));
+ variant = eng.toScriptValue(QUrl());
+ QVERIFY(variant.isVariant());
+ QVERIFY(variant.toString().isEmpty());
+}
+
+void tst_QJSValue::toNumber()
+{
+ QJSEngine eng;
+
+ QJSValue undefined = eng.toScriptValue(QVariant());
+ QCOMPARE(qIsNaN(undefined.toNumber()), true);
+ QCOMPARE(qIsNaN(qjsvalue_cast<qreal>(undefined)), true);
+
+ QJSValue null = eng.evaluate("null");
+ QCOMPARE(null.toNumber(), 0.0);
+ QCOMPARE(qjsvalue_cast<qreal>(null), 0.0);
+
+ {
+ QJSValue falskt = eng.toScriptValue(false);
+ QCOMPARE(falskt.toNumber(), 0.0);
+ QCOMPARE(qjsvalue_cast<qreal>(falskt), 0.0);
+
+ QJSValue sant = eng.toScriptValue(true);
+ QCOMPARE(sant.toNumber(), 1.0);
+ QCOMPARE(qjsvalue_cast<qreal>(sant), 1.0);
+
+ QJSValue number = eng.toScriptValue(123.0);
+ QCOMPARE(number.toNumber(), 123.0);
+ QCOMPARE(qjsvalue_cast<qreal>(number), 123.0);
+
+ QJSValue str = eng.toScriptValue(QString("ciao"));
+ QCOMPARE(qIsNaN(str.toNumber()), true);
+ QCOMPARE(qIsNaN(qjsvalue_cast<qreal>(str)), true);
+
+ QJSValue str2 = eng.toScriptValue(QString("123"));
+ QCOMPARE(str2.toNumber(), 123.0);
+ QCOMPARE(qjsvalue_cast<qreal>(str2), 123.0);
+ }
+
+ QJSValue object = eng.newObject();
+ QCOMPARE(qIsNaN(object.toNumber()), true);
+ QCOMPARE(qIsNaN(qjsvalue_cast<qreal>(object)), true);
+
+ QJSValue inv = QJSValue();
+ QVERIFY(qIsNaN(inv.toNumber()));
+ QVERIFY(qIsNaN(qjsvalue_cast<qreal>(inv)));
+
+ // V2 constructors
+ {
+ QJSValue falskt = QJSValue(false);
+ QCOMPARE(falskt.toNumber(), 0.0);
+ QCOMPARE(qjsvalue_cast<qreal>(falskt), 0.0);
+
+ QJSValue sant = QJSValue(true);
+ QCOMPARE(sant.toNumber(), 1.0);
+ QCOMPARE(qjsvalue_cast<qreal>(sant), 1.0);
+
+ QJSValue number = QJSValue(123.0);
+ QCOMPARE(number.toNumber(), 123.0);
+ QCOMPARE(qjsvalue_cast<qreal>(number), 123.0);
+
+ QJSValue number2(int(0x43211234));
+ QCOMPARE(number2.toNumber(), 1126240820.0);
+
+ QJSValue str = QJSValue(QString("ciao"));
+ QCOMPARE(qIsNaN(str.toNumber()), true);
+ QCOMPARE(qIsNaN(qjsvalue_cast<qreal>(str)), true);
+
+ QJSValue str2 = QJSValue(QString("123"));
+ QCOMPARE(str2.toNumber(), 123.0);
+ QCOMPARE(qjsvalue_cast<qreal>(str2), 123.0);
+ }
+}
+
+void tst_QJSValue::toBoolean() // deprecated
+{
+ QJSEngine eng;
+
+ QJSValue undefined = eng.toScriptValue(QVariant());
+ QCOMPARE(undefined.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(undefined), false);
+
+ QJSValue null = eng.evaluate("null");
+ QCOMPARE(null.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(null), false);
+
+ {
+ QJSValue falskt = eng.toScriptValue(false);
+ QCOMPARE(falskt.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(falskt), false);
+
+ QJSValue sant = eng.toScriptValue(true);
+ QCOMPARE(sant.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(sant), true);
+
+ QJSValue number = eng.toScriptValue(0.0);
+ QCOMPARE(number.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number), false);
+
+ QJSValue number2 = eng.toScriptValue(qSNaN());
+ QCOMPARE(number2.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number2), false);
+
+ QJSValue number3 = eng.toScriptValue(123.0);
+ QCOMPARE(number3.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number3), true);
+
+ QJSValue number4 = eng.toScriptValue(-456.0);
+ QCOMPARE(number4.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number4), true);
+
+ QJSValue str = eng.toScriptValue(QString(""));
+ QCOMPARE(str.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(str), false);
+
+ QJSValue str2 = eng.toScriptValue(QString("123"));
+ QCOMPARE(str2.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(str2), true);
+ }
+
+ QJSValue object = eng.newObject();
+ QCOMPARE(object.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(object), true);
+
+ QJSValue inv = QJSValue();
+ QCOMPARE(inv.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(inv), false);
+
+ // V2 constructors
+ {
+ QJSValue falskt = QJSValue(false);
+ QCOMPARE(falskt.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(falskt), false);
+
+ QJSValue sant = QJSValue(true);
+ QCOMPARE(sant.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(sant), true);
+
+ QJSValue number = QJSValue(0.0);
+ QCOMPARE(number.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number), false);
+
+ QJSValue number2 = QJSValue(qSNaN());
+ QCOMPARE(number2.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number2), false);
+
+ QJSValue number3 = QJSValue(123.0);
+ QCOMPARE(number3.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number3), true);
+
+ QJSValue number4 = QJSValue(-456.0);
+ QCOMPARE(number4.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number4), true);
+
+ QJSValue number5 = QJSValue(0x43211234);
+ QCOMPARE(number5.toBool(), true);
+
+ QJSValue str = QJSValue(QString(""));
+ QCOMPARE(str.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(str), false);
+
+ QJSValue str2 = QJSValue(QString("123"));
+ QCOMPARE(str2.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(str2), true);
+ }
+}
+
+void tst_QJSValue::toBool()
+{
+ QJSEngine eng;
+
+ QJSValue undefined = eng.toScriptValue(QVariant());
+ QCOMPARE(undefined.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(undefined), false);
+
+ QJSValue null = eng.evaluate("null");
+ QCOMPARE(null.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(null), false);
+
+ {
+ QJSValue falskt = eng.toScriptValue(false);
+ QCOMPARE(falskt.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(falskt), false);
+
+ QJSValue sant = eng.toScriptValue(true);
+ QCOMPARE(sant.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(sant), true);
+
+ QJSValue number = eng.toScriptValue(0.0);
+ QCOMPARE(number.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number), false);
+
+ QJSValue number2 = eng.toScriptValue(qSNaN());
+ QCOMPARE(number2.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number2), false);
+
+ QJSValue number3 = eng.toScriptValue(123.0);
+ QCOMPARE(number3.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number3), true);
+
+ QJSValue number4 = eng.toScriptValue(-456.0);
+ QCOMPARE(number4.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number4), true);
+
+ QJSValue str = eng.toScriptValue(QString(""));
+ QCOMPARE(str.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(str), false);
+
+ QJSValue str2 = eng.toScriptValue(QString("123"));
+ QCOMPARE(str2.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(str2), true);
+ }
+
+ QJSValue object = eng.newObject();
+ QCOMPARE(object.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(object), true);
+
+ QJSValue inv = QJSValue();
+ QCOMPARE(inv.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(inv), false);
+
+ // V2 constructors
+ {
+ QJSValue falskt = QJSValue(false);
+ QCOMPARE(falskt.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(falskt), false);
+
+ QJSValue sant = QJSValue(true);
+ QCOMPARE(sant.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(sant), true);
+
+ QJSValue number = QJSValue(0.0);
+ QCOMPARE(number.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number), false);
+
+ QJSValue number2 = QJSValue(qSNaN());
+ QCOMPARE(number2.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(number2), false);
+
+ QJSValue number3 = QJSValue(123.0);
+ QCOMPARE(number3.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number3), true);
+
+ QJSValue number4 = QJSValue(-456.0);
+ QCOMPARE(number4.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(number4), true);
+
+ QJSValue number5 = QJSValue(0x43211234);
+ QCOMPARE(number5.toBool(), true);
+
+ QJSValue str = QJSValue(QString(""));
+ QCOMPARE(str.toBool(), false);
+ QCOMPARE(qjsvalue_cast<bool>(str), false);
+
+ QJSValue str2 = QJSValue(QString("123"));
+ QCOMPARE(str2.toBool(), true);
+ QCOMPARE(qjsvalue_cast<bool>(str2), true);
+ }
+}
+
+void tst_QJSValue::toInt()
+{
+ QJSEngine eng;
+
+ {
+ QJSValue zer0 = eng.toScriptValue(0.0);
+ QCOMPARE(zer0.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(zer0), 0);
+
+ QJSValue number = eng.toScriptValue(123.0);
+ QCOMPARE(number.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(number), 123);
+
+ QJSValue number2 = eng.toScriptValue(qSNaN());
+ QCOMPARE(number2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number2), 0);
+
+ QJSValue number3 = eng.toScriptValue(+qInf());
+ QCOMPARE(number3.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number3), 0);
+
+ QJSValue number3_2 = eng.toScriptValue(-qInf());
+ QCOMPARE(number3_2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number3_2), 0);
+
+ QJSValue number4 = eng.toScriptValue(0.5);
+ QCOMPARE(number4.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number4), 0);
+
+ QJSValue number5 = eng.toScriptValue(123.5);
+ QCOMPARE(number5.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(number5), 123);
+
+ QJSValue number6 = eng.toScriptValue(-456.5);
+ QCOMPARE(number6.toInt(), -456);
+ QCOMPARE(qjsvalue_cast<qint32>(number6), -456);
+
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("123.0"));
+ QCOMPARE(str.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(str), 123);
+
+ QJSValue str2 = eng.toScriptValue(QString::fromLatin1("NaN"));
+ QCOMPARE(str2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str2), 0);
+
+ QJSValue str3 = eng.toScriptValue(QString::fromLatin1("Infinity"));
+ QCOMPARE(str3.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str3), 0);
+
+ QJSValue str3_2 = eng.toScriptValue(QString::fromLatin1("-Infinity"));
+ QCOMPARE(str3_2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str3_2), 0);
+
+ QJSValue str4 = eng.toScriptValue(QString::fromLatin1("0.5"));
+ QCOMPARE(str4.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str4), 0);
+
+ QJSValue str5 = eng.toScriptValue(QString::fromLatin1("123.5"));
+ QCOMPARE(str5.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(str5), 123);
+
+ QJSValue str6 = eng.toScriptValue(QString::fromLatin1("-456.5"));
+ QCOMPARE(str6.toInt(), -456);
+ QCOMPARE(qjsvalue_cast<qint32>(str6), -456);
+ }
+ // V2 constructors
+ {
+ QJSValue zer0 = QJSValue(0.0);
+ QCOMPARE(zer0.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(zer0), 0);
+
+ QJSValue number = QJSValue(123.0);
+ QCOMPARE(number.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(number), 123);
+
+ QJSValue number2 = QJSValue(qSNaN());
+ QCOMPARE(number2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number2), 0);
+
+ QJSValue number3 = QJSValue(+qInf());
+ QCOMPARE(number3.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number3), 0);
+
+ QJSValue number3_2 = QJSValue(-qInf());
+ QCOMPARE(number3_2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number3_2), 0);
+
+ QJSValue number4 = QJSValue(0.5);
+ QCOMPARE(number4.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(number4), 0);
+
+ QJSValue number5 = QJSValue(123.5);
+ QCOMPARE(number5.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(number5), 123);
+
+ QJSValue number6 = QJSValue(-456.5);
+ QCOMPARE(number6.toInt(), -456);
+ QCOMPARE(qjsvalue_cast<qint32>(number6), -456);
+
+ QJSValue number7 = QJSValue(0x43211234);
+ QCOMPARE(number7.toInt(), 0x43211234);
+
+ QJSValue str = QJSValue("123.0");
+ QCOMPARE(str.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(str), 123);
+
+ QJSValue str2 = QJSValue("NaN");
+ QCOMPARE(str2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str2), 0);
+
+ QJSValue str3 = QJSValue("Infinity");
+ QCOMPARE(str3.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str3), 0);
+
+ QJSValue str3_2 = QJSValue("-Infinity");
+ QCOMPARE(str3_2.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str3_2), 0);
+
+ QJSValue str4 = QJSValue("0.5");
+ QCOMPARE(str4.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(str4), 0);
+
+ QJSValue str5 = QJSValue("123.5");
+ QCOMPARE(str5.toInt(), 123);
+ QCOMPARE(qjsvalue_cast<qint32>(str5), 123);
+
+ QJSValue str6 = QJSValue("-456.5");
+ QCOMPARE(str6.toInt(), -456);
+ QCOMPARE(qjsvalue_cast<qint32>(str6), -456);
+ }
+
+ QJSValue inv;
+ QCOMPARE(inv.toInt(), 0);
+ QCOMPARE(qjsvalue_cast<qint32>(inv), 0);
+}
+
+void tst_QJSValue::toUInt()
+{
+ QJSEngine eng;
+
+ {
+ QJSValue zer0 = eng.toScriptValue(0.0);
+ QCOMPARE(zer0.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(zer0), quint32(0));
+
+ QJSValue number = eng.toScriptValue(123.0);
+ QCOMPARE(number.toUInt(), quint32(123));
+ QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123));
+
+ QJSValue number2 = eng.toScriptValue(qSNaN());
+ QCOMPARE(number2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0));
+
+ QJSValue number3 = eng.toScriptValue(+qInf());
+ QCOMPARE(number3.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(number3), quint32(0));
+
+ QJSValue number3_2 = eng.toScriptValue(-qInf());
+ QCOMPARE(number3_2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(number3_2), quint32(0));
+
+ QJSValue number4 = eng.toScriptValue(0.5);
+ QCOMPARE(number4.toUInt(), quint32(0));
+
+ QJSValue number5 = eng.toScriptValue(123.5);
+ QCOMPARE(number5.toUInt(), quint32(123));
+
+ QJSValue number6 = eng.toScriptValue(-456.5);
+ QCOMPARE(number6.toUInt(), quint32(-456));
+ QCOMPARE(qjsvalue_cast<quint32>(number6), quint32(-456));
+
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("123.0"));
+ QCOMPARE(str.toUInt(), quint32(123));
+ QCOMPARE(qjsvalue_cast<quint32>(str), quint32(123));
+
+ QJSValue str2 = eng.toScriptValue(QString::fromLatin1("NaN"));
+ QCOMPARE(str2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str2), quint32(0));
+
+ QJSValue str3 = eng.toScriptValue(QString::fromLatin1("Infinity"));
+ QCOMPARE(str3.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str3), quint32(0));
+
+ QJSValue str3_2 = eng.toScriptValue(QString::fromLatin1("-Infinity"));
+ QCOMPARE(str3_2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str3_2), quint32(0));
+
+ QJSValue str4 = eng.toScriptValue(QString::fromLatin1("0.5"));
+ QCOMPARE(str4.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str4), quint32(0));
+
+ QJSValue str5 = eng.toScriptValue(QString::fromLatin1("123.5"));
+ QCOMPARE(str5.toUInt(), quint32(123));
+ QCOMPARE(qjsvalue_cast<quint32>(str5), quint32(123));
+
+ QJSValue str6 = eng.toScriptValue(QString::fromLatin1("-456.5"));
+ QCOMPARE(str6.toUInt(), quint32(-456));
+ QCOMPARE(qjsvalue_cast<quint32>(str6), quint32(-456));
+ }
+ // V2 constructors
+ {
+ QJSValue zer0 = QJSValue(0.0);
+ QCOMPARE(zer0.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(zer0), quint32(0));
+
+ QJSValue number = QJSValue(123.0);
+ QCOMPARE(number.toUInt(), quint32(123));
+ QCOMPARE(qjsvalue_cast<quint32>(number), quint32(123));
+
+ QJSValue number2 = QJSValue(qSNaN());
+ QCOMPARE(number2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(number2), quint32(0));
+
+ QJSValue number3 = QJSValue(+qInf());
+ QCOMPARE(number3.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(number3), quint32(0));
+
+ QJSValue number3_2 = QJSValue(-qInf());
+ QCOMPARE(number3_2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(number3_2), quint32(0));
+
+ QJSValue number4 = QJSValue(0.5);
+ QCOMPARE(number4.toUInt(), quint32(0));
+
+ QJSValue number5 = QJSValue(123.5);
+ QCOMPARE(number5.toUInt(), quint32(123));
+
+ QJSValue number6 = QJSValue(-456.5);
+ QCOMPARE(number6.toUInt(), quint32(-456));
+ QCOMPARE(qjsvalue_cast<quint32>(number6), quint32(-456));
+
+ QJSValue number7 = QJSValue(0x43211234);
+ QCOMPARE(number7.toUInt(), quint32(0x43211234));
+
+ QJSValue str = QJSValue(QLatin1String("123.0"));
+ QCOMPARE(str.toUInt(), quint32(123));
+ QCOMPARE(qjsvalue_cast<quint32>(str), quint32(123));
+
+ QJSValue str2 = QJSValue(QLatin1String("NaN"));
+ QCOMPARE(str2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str2), quint32(0));
+
+ QJSValue str3 = QJSValue(QLatin1String("Infinity"));
+ QCOMPARE(str3.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str3), quint32(0));
+
+ QJSValue str3_2 = QJSValue(QLatin1String("-Infinity"));
+ QCOMPARE(str3_2.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str3_2), quint32(0));
+
+ QJSValue str4 = QJSValue(QLatin1String("0.5"));
+ QCOMPARE(str4.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(str4), quint32(0));
+
+ QJSValue str5 = QJSValue(QLatin1String("123.5"));
+ QCOMPARE(str5.toUInt(), quint32(123));
+ QCOMPARE(qjsvalue_cast<quint32>(str5), quint32(123));
+
+ QJSValue str6 = QJSValue(QLatin1String("-456.5"));
+ QCOMPARE(str6.toUInt(), quint32(-456));
+ QCOMPARE(qjsvalue_cast<quint32>(str6), quint32(-456));
+ }
+
+ QJSValue inv;
+ QCOMPARE(inv.toUInt(), quint32(0));
+ QCOMPARE(qjsvalue_cast<quint32>(inv), quint32(0));
+}
+
+#if defined Q_CC_MSVC && _MSC_VER < 1300
+Q_DECLARE_METATYPE(QVariant)
+#endif
+
+void tst_QJSValue::toVariant()
+{
+ QJSEngine eng;
+ QObject temp;
+
+ QJSValue undefined = eng.toScriptValue(QVariant());
+ QCOMPARE(undefined.toVariant(), QVariant());
+ QCOMPARE(qjsvalue_cast<QVariant>(undefined), QVariant());
+
+ QJSValue null = eng.evaluate("null");
+ QCOMPARE(null.toVariant(), QVariant(QMetaType::VoidStar, 0));
+ QCOMPARE(qjsvalue_cast<QVariant>(null), QVariant(QMetaType::VoidStar, 0));
+
+ {
+ QJSValue number = eng.toScriptValue(123.0);
+ QCOMPARE(number.toVariant(), QVariant(123.0));
+ QCOMPARE(qjsvalue_cast<QVariant>(number), QVariant(123.0));
+
+ QJSValue intNumber = eng.toScriptValue((qint32)123);
+ QCOMPARE(intNumber.toVariant().type(), QVariant((qint32)123).type());
+ QCOMPARE((qjsvalue_cast<QVariant>(number)).type(), QVariant((qint32)123).type());
+
+ QJSValue falskt = eng.toScriptValue(false);
+ QCOMPARE(falskt.toVariant(), QVariant(false));
+ QCOMPARE(qjsvalue_cast<QVariant>(falskt), QVariant(false));
+
+ QJSValue sant = eng.toScriptValue(true);
+ QCOMPARE(sant.toVariant(), QVariant(true));
+ QCOMPARE(qjsvalue_cast<QVariant>(sant), QVariant(true));
+
+ QJSValue str = eng.toScriptValue(QString("ciao"));
+ QCOMPARE(str.toVariant(), QVariant(QString("ciao")));
+ QCOMPARE(qjsvalue_cast<QVariant>(str), QVariant(QString("ciao")));
+ }
+
+ QJSValue object = eng.newObject();
+ QCOMPARE(object.toVariant(), QVariant(QVariantMap()));
+
+ QJSValue qobject = eng.newQObject(&temp);
+ {
+ QVariant var = qobject.toVariant();
+ QCOMPARE(var.userType(), int(QMetaType::QObjectStar));
+ QCOMPARE(qVariantValue<QObject*>(var), (QObject *)&temp);
+ }
+
+ {
+ QDateTime dateTime = QDateTime(QDate(1980, 10, 4));
+ QJSValue dateObject = eng.toScriptValue(dateTime);
+ QVariant var = dateObject.toVariant();
+ QCOMPARE(var, QVariant(dateTime));
+ }
+
+ {
+ QRegExp rx = QRegExp("[0-9a-z]+", Qt::CaseSensitive, QRegExp::RegExp2);
+ QJSValue rxObject = eng.toScriptValue(rx);
+ QVERIFY(rxObject.isRegExp());
+ QVariant var = rxObject.toVariant();
+ QCOMPARE(var, QVariant(rx));
+ }
+
+ QJSValue inv;
+ QCOMPARE(inv.toVariant(), QVariant());
+ QCOMPARE(qjsvalue_cast<QVariant>(inv), QVariant());
+
+ // V2 constructors
+ {
+ QJSValue number = QJSValue(123.0);
+ QCOMPARE(number.toVariant(), QVariant(123.0));
+ QCOMPARE(qjsvalue_cast<QVariant>(number), QVariant(123.0));
+
+ QJSValue falskt = QJSValue(false);
+ QCOMPARE(falskt.toVariant(), QVariant(false));
+ QCOMPARE(qjsvalue_cast<QVariant>(falskt), QVariant(false));
+
+ QJSValue sant = QJSValue(true);
+ QCOMPARE(sant.toVariant(), QVariant(true));
+ QCOMPARE(qjsvalue_cast<QVariant>(sant), QVariant(true));
+
+ QJSValue str = QJSValue(QString("ciao"));
+ QCOMPARE(str.toVariant(), QVariant(QString("ciao")));
+ QCOMPARE(qjsvalue_cast<QVariant>(str), QVariant(QString("ciao")));
+
+ QJSValue undef = QJSValue(QJSValue::UndefinedValue);
+ QCOMPARE(undef.toVariant(), QVariant());
+ QCOMPARE(qjsvalue_cast<QVariant>(undef), QVariant());
+
+ QJSValue nil = QJSValue(QJSValue::NullValue);
+ QCOMPARE(nil.toVariant(), QVariant(QMetaType::VoidStar, 0));
+ QCOMPARE(qjsvalue_cast<QVariant>(nil), QVariant(QMetaType::VoidStar, 0));
+ }
+
+ // array
+ {
+ QVariantList listIn;
+ listIn << 123 << "hello";
+ QJSValue array = eng.toScriptValue(listIn);
+ QVERIFY(array.isArray());
+ QCOMPARE(array.property("length").toInt(), 2);
+ QVariant ret = array.toVariant();
+ QCOMPARE(ret.type(), QVariant::List);
+ QVariantList listOut = ret.toList();
+ QCOMPARE(listOut.size(), listIn.size());
+ for (int i = 0; i < listIn.size(); ++i)
+ QVERIFY(listOut.at(i) == listIn.at(i));
+ // round-trip conversion
+ QJSValue array2 = eng.toScriptValue(ret);
+ QVERIFY(array2.isArray());
+ QCOMPARE(array2.property("length").toInt(), array.property("length").toInt());
+ for (int i = 0; i < array.property("length").toInt(); ++i)
+ QVERIFY(array2.property(i).strictlyEquals(array.property(i)));
+ }
+
+}
+
+void tst_QJSValue::toQObject_nonQObject_data()
+{
+ newEngine();
+ QTest::addColumn<QJSValue>("value");
+
+ QTest::newRow("invalid") << QJSValue();
+ QTest::newRow("bool(false)") << QJSValue(false);
+ QTest::newRow("bool(true)") << QJSValue(true);
+ QTest::newRow("int") << QJSValue(123);
+ QTest::newRow("string") << QJSValue(QString::fromLatin1("ciao"));
+ QTest::newRow("undefined") << QJSValue(QJSValue::UndefinedValue);
+ QTest::newRow("null") << QJSValue(QJSValue::NullValue);
+
+ QTest::newRow("bool bound(false)") << engine->toScriptValue(false);
+ QTest::newRow("bool bound(true)") << engine->toScriptValue(true);
+ QTest::newRow("int bound") << engine->toScriptValue(123);
+ QTest::newRow("string bound") << engine->toScriptValue(QString::fromLatin1("ciao"));
+ QTest::newRow("undefined bound") << engine->toScriptValue(QVariant());
+ QTest::newRow("null bound") << engine->evaluate("null");
+ QTest::newRow("object") << engine->newObject();
+ QTest::newRow("array") << engine->newArray();
+ QTest::newRow("date") << engine->evaluate("new Date(124)");
+ QTest::newRow("variant(12345)") << engine->toScriptValue(QVariant(12345));
+ QTest::newRow("variant((QObject*)0)") << engine->toScriptValue(qVariantFromValue((QObject*)0));
+ QTest::newRow("newQObject(0)") << engine->newQObject(0);
+}
+
+
+void tst_QJSValue::toQObject_nonQObject()
+{
+ QFETCH(QJSValue, value);
+ QCOMPARE(value.toQObject(), (QObject *)0);
+ QCOMPARE(qjsvalue_cast<QObject*>(value), (QObject *)0);
+}
+
+// unfortunately, this is necessary in order to do qscriptvalue_cast<QPushButton*>(...)
+Q_DECLARE_METATYPE(QPushButton*);
+
+void tst_QJSValue::toQObject()
+{
+ QJSEngine eng;
+ QObject temp;
+
+ QJSValue qobject = eng.newQObject(&temp);
+ QCOMPARE(qobject.toQObject(), (QObject *)&temp);
+ QCOMPARE(qjsvalue_cast<QObject*>(qobject), (QObject *)&temp);
+ QCOMPARE(qjsvalue_cast<QWidget*>(qobject), (QWidget *)0);
+
+ QWidget widget;
+ QJSValue qwidget = eng.newQObject(&widget);
+ QCOMPARE(qwidget.toQObject(), (QObject *)&widget);
+ QCOMPARE(qjsvalue_cast<QObject*>(qwidget), (QObject *)&widget);
+ QCOMPARE(qjsvalue_cast<QWidget*>(qwidget), &widget);
+
+ QPushButton button;
+ QJSValue qbutton = eng.newQObject(&button);
+ QCOMPARE(qbutton.toQObject(), (QObject *)&button);
+ QCOMPARE(qjsvalue_cast<QObject*>(qbutton), (QObject *)&button);
+ QCOMPARE(qjsvalue_cast<QWidget*>(qbutton), (QWidget *)&button);
+ QCOMPARE(qjsvalue_cast<QPushButton*>(qbutton), &button);
+}
+
+void tst_QJSValue::toDateTime()
+{
+ QJSEngine eng;
+ QDateTime dt = eng.evaluate("new Date(0)").toDateTime();
+ QVERIFY(dt.isValid());
+ QCOMPARE(dt.timeSpec(), Qt::LocalTime);
+ QCOMPARE(dt.toUTC(), QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0), Qt::UTC));
+
+ QVERIFY(!eng.evaluate("[]").toDateTime().isValid());
+ QVERIFY(!eng.evaluate("{}").toDateTime().isValid());
+ QVERIFY(!eng.globalObject().toDateTime().isValid());
+ QVERIFY(!QJSValue().toDateTime().isValid());
+ QVERIFY(!QJSValue(123).toDateTime().isValid());
+ QVERIFY(!QJSValue(false).toDateTime().isValid());
+ QVERIFY(!eng.evaluate("null").toDateTime().isValid());
+ QVERIFY(!eng.toScriptValue(QVariant()).toDateTime().isValid());
+}
+
+void tst_QJSValue::toRegExp()
+{
+ QJSEngine eng;
+ {
+ QRegExp rx = qjsvalue_cast<QRegExp>(eng.evaluate("/foo/"));
+ QVERIFY(rx.isValid());
+ QCOMPARE(rx.patternSyntax(), QRegExp::RegExp2);
+ QCOMPARE(rx.pattern(), QString::fromLatin1("foo"));
+ QCOMPARE(rx.caseSensitivity(), Qt::CaseSensitive);
+ QVERIFY(!rx.isMinimal());
+ }
+ {
+ QRegExp rx = qjsvalue_cast<QRegExp>(eng.evaluate("/bar/gi"));
+ QVERIFY(rx.isValid());
+ QCOMPARE(rx.patternSyntax(), QRegExp::RegExp2);
+ QCOMPARE(rx.pattern(), QString::fromLatin1("bar"));
+ QCOMPARE(rx.caseSensitivity(), Qt::CaseInsensitive);
+ QVERIFY(!rx.isMinimal());
+ }
+
+ QVERIFY(qjsvalue_cast<QRegExp>(eng.evaluate("[]")).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(eng.evaluate("{}")).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(eng.globalObject()).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(QJSValue()).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(QJSValue(123)).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(QJSValue(false)).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(eng.evaluate("null")).isEmpty());
+ QVERIFY(qjsvalue_cast<QRegExp>(eng.toScriptValue(QVariant())).isEmpty());
+}
+
+void tst_QJSValue::isArray_data()
+{
+ newEngine();
+
+ QTest::addColumn<QJSValue>("value");
+ QTest::addColumn<bool>("array");
+
+ QTest::newRow("[]") << engine->evaluate("[]") << true;
+ QTest::newRow("{}") << engine->evaluate("{}") << false;
+ QTest::newRow("globalObject") << engine->globalObject() << false;
+ QTest::newRow("invalid") << QJSValue() << false;
+ QTest::newRow("number") << QJSValue(123) << false;
+ QTest::newRow("bool") << QJSValue(false) << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
+ QTest::newRow("undefined") << engine->toScriptValue(QVariant()) << false;
+}
+
+void tst_QJSValue::isArray()
+{
+ QFETCH(QJSValue, value);
+ QFETCH(bool, array);
+
+ QCOMPARE(value.isArray(), array);
+}
+
+void tst_QJSValue::isDate_data()
+{
+ newEngine();
+
+ QTest::addColumn<QJSValue>("value");
+ QTest::addColumn<bool>("date");
+
+ QTest::newRow("date") << engine->evaluate("new Date()") << true;
+ QTest::newRow("[]") << engine->evaluate("[]") << false;
+ QTest::newRow("{}") << engine->evaluate("{}") << false;
+ QTest::newRow("globalObject") << engine->globalObject() << false;
+ QTest::newRow("invalid") << QJSValue() << false;
+ QTest::newRow("number") << QJSValue(123) << false;
+ QTest::newRow("bool") << QJSValue(false) << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
+ QTest::newRow("undefined") << engine->toScriptValue(QVariant()) << false;
+}
+
+void tst_QJSValue::isDate()
+{
+ QFETCH(QJSValue, value);
+ QFETCH(bool, date);
+
+ QCOMPARE(value.isDate(), date);
+}
+
+void tst_QJSValue::isError_propertiesOfGlobalObject()
+{
+ QStringList errors;
+ errors << "Error"
+ << "EvalError"
+ << "RangeError"
+ << "ReferenceError"
+ << "SyntaxError"
+ << "TypeError"
+ << "URIError";
+ QJSEngine eng;
+ for (int i = 0; i < errors.size(); ++i) {
+ QJSValue ctor = eng.globalObject().property(errors.at(i));
+ QVERIFY(ctor.isCallable());
+ QVERIFY(ctor.property("prototype").isError());
+ }
+}
+
+void tst_QJSValue::isError_data()
+{
+ newEngine();
+
+ QTest::addColumn<QJSValue>("value");
+ QTest::addColumn<bool>("error");
+
+ QTest::newRow("syntax error") << engine->evaluate("%fsdg's") << true;
+ QTest::newRow("[]") << engine->evaluate("[]") << false;
+ QTest::newRow("{}") << engine->evaluate("{}") << false;
+ QTest::newRow("globalObject") << engine->globalObject() << false;
+ QTest::newRow("invalid") << QJSValue() << false;
+ QTest::newRow("number") << QJSValue(123) << false;
+ QTest::newRow("bool") << QJSValue(false) << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
+ QTest::newRow("undefined") << engine->toScriptValue(QVariant()) << false;
+ QTest::newRow("newObject") << engine->newObject() << false;
+ QTest::newRow("new Object") << engine->evaluate("new Object()") << false;
+}
+
+void tst_QJSValue::isError()
+{
+ QFETCH(QJSValue, value);
+ QFETCH(bool, error);
+
+ QCOMPARE(value.isError(), error);
+}
+
+void tst_QJSValue::isRegExp_data()
+{
+ newEngine();
+
+ QTest::addColumn<QJSValue>("value");
+ QTest::addColumn<bool>("regexp");
+
+ QTest::newRow("/foo/") << engine->evaluate("/foo/") << true;
+ QTest::newRow("[]") << engine->evaluate("[]") << false;
+ QTest::newRow("{}") << engine->evaluate("{}") << false;
+ QTest::newRow("globalObject") << engine->globalObject() << false;
+ QTest::newRow("invalid") << QJSValue() << false;
+ QTest::newRow("number") << QJSValue(123) << false;
+ QTest::newRow("bool") << QJSValue(false) << false;
+ QTest::newRow("null") << engine->evaluate("null") << false;
+ QTest::newRow("undefined") << engine->toScriptValue(QVariant()) << false;
+}
+
+void tst_QJSValue::isRegExp()
+{
+ QFETCH(QJSValue, value);
+ QFETCH(bool, regexp);
+
+ QCOMPARE(value.isRegExp(), regexp);
+}
+
+void tst_QJSValue::hasProperty_basic()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ QVERIFY(obj.hasProperty("hasOwnProperty")); // inherited from Object.prototype
+ QVERIFY(!obj.hasOwnProperty("hasOwnProperty"));
+
+ QVERIFY(!obj.hasProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+ obj.setProperty("foo", 123);
+ QVERIFY(obj.hasProperty("foo"));
+ QVERIFY(obj.hasOwnProperty("foo"));
+
+ QVERIFY(!obj.hasProperty("bar"));
+ QVERIFY(!obj.hasOwnProperty("bar"));
+}
+
+void tst_QJSValue::hasProperty_globalObject()
+{
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
+ QVERIFY(global.hasProperty("Math"));
+ QVERIFY(global.hasOwnProperty("Math"));
+ QVERIFY(!global.hasProperty("NoSuchStandardProperty"));
+ QVERIFY(!global.hasOwnProperty("NoSuchStandardProperty"));
+
+ QVERIFY(!global.hasProperty("foo"));
+ QVERIFY(!global.hasOwnProperty("foo"));
+ global.setProperty("foo", 123);
+ QVERIFY(global.hasProperty("foo"));
+ QVERIFY(global.hasOwnProperty("foo"));
+}
+
+void tst_QJSValue::hasProperty_changePrototype()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ QJSValue proto = eng.newObject();
+ obj.setPrototype(proto);
+
+ QVERIFY(!obj.hasProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+ proto.setProperty("foo", 123);
+ QVERIFY(obj.hasProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+
+ obj.setProperty("foo", 456); // override prototype property
+ QVERIFY(obj.hasProperty("foo"));
+ QVERIFY(obj.hasOwnProperty("foo"));
+}
+
+void tst_QJSValue::deleteProperty_basic()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ // deleteProperty() behavior matches JS delete operator
+ QVERIFY(obj.deleteProperty("foo"));
+
+ obj.setProperty("foo", 123);
+ QVERIFY(obj.deleteProperty("foo"));
+ QVERIFY(!obj.hasOwnProperty("foo"));
+}
+
+void tst_QJSValue::deleteProperty_globalObject()
+{
+ QJSEngine eng;
+ QJSValue global = eng.globalObject();
+ // deleteProperty() behavior matches JS delete operator
+ QVERIFY(global.deleteProperty("foo"));
+
+ global.setProperty("foo", 123);
+ QVERIFY(global.deleteProperty("foo"));
+ QVERIFY(!global.hasProperty("foo"));
+
+ QVERIFY(global.deleteProperty("Math"));
+ QVERIFY(!global.hasProperty("Math"));
+
+ QVERIFY(!global.deleteProperty("NaN")); // read-only
+ QVERIFY(global.hasProperty("NaN"));
+}
+
+void tst_QJSValue::deleteProperty_inPrototype()
+{
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ QJSValue proto = eng.newObject();
+ obj.setPrototype(proto);
+
+ proto.setProperty("foo", 123);
+ QVERIFY(obj.hasProperty("foo"));
+ // deleteProperty() behavior matches JS delete operator
+ QVERIFY(obj.deleteProperty("foo"));
+ QVERIFY(obj.hasProperty("foo"));
+}
+
+void tst_QJSValue::getSetProperty_HooliganTask162051()
+{
+ QJSEngine eng;
+ // task 162051 -- detecting whether the property is an array index or not
+ QVERIFY(eng.evaluate("a = []; a['00'] = 123; a['00']").strictlyEquals(eng.toScriptValue(123)));
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(eng.toScriptValue(0)));
+ QVERIFY(eng.evaluate("a.hasOwnProperty('00')").strictlyEquals(eng.toScriptValue(true)));
+ QVERIFY(eng.evaluate("a.hasOwnProperty('0')").strictlyEquals(eng.toScriptValue(false)));
+ QVERIFY(eng.evaluate("a[0]").isUndefined());
+ QVERIFY(eng.evaluate("a[0.5] = 456; a[0.5]").strictlyEquals(eng.toScriptValue(456)));
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(eng.toScriptValue(0)));
+ QVERIFY(eng.evaluate("a.hasOwnProperty('0.5')").strictlyEquals(eng.toScriptValue(true)));
+ QVERIFY(eng.evaluate("a[0]").isUndefined());
+ QVERIFY(eng.evaluate("a[0] = 789; a[0]").strictlyEquals(eng.toScriptValue(789)));
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(eng.toScriptValue(1)));
+}
+
+void tst_QJSValue::getSetProperty_HooliganTask183072()
+{
+ QJSEngine eng;
+ // task 183072 -- 0x800000000 is not an array index
+ eng.evaluate("a = []; a[0x800000000] = 123");
+ QVERIFY(eng.evaluate("a.length").strictlyEquals(eng.toScriptValue(0)));
+ QVERIFY(eng.evaluate("a[0]").isUndefined());
+ QVERIFY(eng.evaluate("a[0x800000000]").strictlyEquals(eng.toScriptValue(123)));
+}
+
+void tst_QJSValue::getSetProperty_propertyRemoval()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("bar"));
+ QJSValue num = eng.toScriptValue(123.0);
+
+ object.setProperty("foo", num);
+ QCOMPARE(object.property("foo").strictlyEquals(num), true);
+ object.setProperty("bar", str);
+ QCOMPARE(object.property("bar").strictlyEquals(str), true);
+ QVERIFY(object.deleteProperty("foo"));
+ QVERIFY(!object.hasOwnProperty("foo"));
+ QCOMPARE(object.property("bar").strictlyEquals(str), true);
+ object.setProperty("foo", num);
+ QCOMPARE(object.property("foo").strictlyEquals(num), true);
+ QCOMPARE(object.property("bar").strictlyEquals(str), true);
+ QVERIFY(object.deleteProperty("bar"));
+ QVERIFY(!object.hasOwnProperty("bar"));
+ QCOMPARE(object.property("foo").strictlyEquals(num), true);
+ QVERIFY(object.deleteProperty("foo"));
+ QVERIFY(!object.hasOwnProperty("foo"));
+
+ eng.globalObject().setProperty("object3", object);
+ QCOMPARE(eng.evaluate("object3.hasOwnProperty('foo')")
+ .strictlyEquals(eng.toScriptValue(false)), true);
+ object.setProperty("foo", num);
+ QCOMPARE(eng.evaluate("object3.hasOwnProperty('foo')")
+ .strictlyEquals(eng.toScriptValue(true)), true);
+ QVERIFY(eng.globalObject().deleteProperty("object3"));
+ QCOMPARE(eng.evaluate("this.hasOwnProperty('object3')")
+ .strictlyEquals(eng.toScriptValue(false)), true);
+}
+
+void tst_QJSValue::getSetProperty_resolveMode()
+{
+ // test ResolveMode
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ QJSValue prototype = eng.newObject();
+ object.setPrototype(prototype);
+ QJSValue num2 = eng.toScriptValue(456.0);
+ prototype.setProperty("propertyInPrototype", num2);
+ // default is ResolvePrototype
+ QCOMPARE(object.property("propertyInPrototype")
+ .strictlyEquals(num2), true);
+#if 0 // FIXME: ResolveFlags removed from API
+ QCOMPARE(object.property("propertyInPrototype", QJSValue::ResolvePrototype)
+ .strictlyEquals(num2), true);
+ QCOMPARE(object.property("propertyInPrototype", QJSValue::ResolveLocal)
+ .isValid(), false);
+ QCOMPARE(object.property("propertyInPrototype", QJSValue::ResolveScope)
+ .strictlyEquals(num2), false);
+ QCOMPARE(object.property("propertyInPrototype", QJSValue::ResolveFull)
+ .strictlyEquals(num2), true);
+#endif
+}
+
+void tst_QJSValue::getSetProperty_twoEngines()
+{
+ QJSEngine engine;
+ QJSValue object = engine.newObject();
+
+ QJSEngine otherEngine;
+ QJSValue otherNum = otherEngine.toScriptValue(123);
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::setProperty(oof) failed: cannot set value created in a different engine");
+ object.setProperty("oof", otherNum);
+ QVERIFY(!object.hasOwnProperty("oof"));
+ QVERIFY(object.property("oof").isUndefined());
+}
+
+void tst_QJSValue::getSetProperty_gettersAndSettersThrowErrorJS()
+{
+ // getter/setter that throws an error (from js function)
+ QJSEngine eng;
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("bar"));
+
+ eng.evaluate("o = new Object; "
+ "o.__defineGetter__('foo', function() { throw new Error('get foo') }); "
+ "o.__defineSetter__('foo', function() { throw new Error('set foo') }); ");
+ QJSValue object = eng.evaluate("o");
+ QVERIFY(!object.isError());
+ QJSValue ret = object.property("foo");
+ QVERIFY(ret.isError());
+ QCOMPARE(ret.toString(), QLatin1String("Error: get foo"));
+ QVERIFY(!eng.evaluate("Object").isError()); // clear exception state...
+ object.setProperty("foo", str);
+// ### No way to check whether setProperty() threw an exception
+// QVERIFY(eng.hasUncaughtException());
+// QCOMPARE(eng.uncaughtException().toString(), QLatin1String("Error: set foo"));
+}
+
+void tst_QJSValue::getSetProperty_array()
+{
+ QJSEngine eng;
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("bar"));
+ QJSValue num = eng.toScriptValue(123.0);
+ QJSValue array = eng.newArray();
+
+ QVERIFY(array.isArray());
+ array.setProperty(0, num);
+ QCOMPARE(array.property(0).toNumber(), num.toNumber());
+ QCOMPARE(array.property("0").toNumber(), num.toNumber());
+ QCOMPARE(array.property("length").toUInt(), quint32(1));
+ array.setProperty(1, str);
+ QCOMPARE(array.property(1).toString(), str.toString());
+ QCOMPARE(array.property("1").toString(), str.toString());
+ QCOMPARE(array.property("length").toUInt(), quint32(2));
+ array.setProperty("length", eng.toScriptValue(1));
+ QCOMPARE(array.property("length").toUInt(), quint32(1));
+ QVERIFY(array.property(1).isUndefined());
+}
+
+void tst_QJSValue::getSetProperty()
+{
+ QJSEngine eng;
+
+ QJSValue object = eng.newObject();
+
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("bar"));
+ object.setProperty("foo", str);
+ QCOMPARE(object.property("foo").toString(), str.toString());
+
+ QJSValue num = eng.toScriptValue(123.0);
+ object.setProperty("baz", num);
+ QCOMPARE(object.property("baz").toNumber(), num.toNumber());
+
+ QJSValue strstr = QJSValue("bar");
+ QCOMPARE(strstr.engine(), (QJSEngine *)0);
+ object.setProperty("foo", strstr);
+ QCOMPARE(object.property("foo").toString(), strstr.toString());
+ QCOMPARE(strstr.engine(), &eng); // the value has been bound to the engine
+
+ QJSValue numnum = QJSValue(123.0);
+ object.setProperty("baz", numnum);
+ QCOMPARE(object.property("baz").toNumber(), numnum.toNumber());
+
+ QJSValue inv;
+ inv.setProperty("foo", num);
+ QCOMPARE(inv.property("foo").isUndefined(), true);
+
+ eng.globalObject().setProperty("object", object);
+
+ // Setting index property on non-Array
+ object.setProperty(13, num);
+ QVERIFY(object.property(13).equals(num));
+}
+
+void tst_QJSValue::getSetPrototype_cyclicPrototype()
+{
+ QJSEngine eng;
+ QJSValue prototype = eng.newObject();
+ QJSValue object = eng.newObject();
+ object.setPrototype(prototype);
+
+ QJSValue previousPrototype = prototype.prototype();
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::setPrototype() failed: cyclic prototype value");
+ prototype.setPrototype(prototype);
+ QCOMPARE(prototype.prototype().strictlyEquals(previousPrototype), true);
+
+ object.setPrototype(prototype);
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::setPrototype() failed: cyclic prototype value");
+ prototype.setPrototype(object);
+ QCOMPARE(prototype.prototype().strictlyEquals(previousPrototype), true);
+
+}
+
+void tst_QJSValue::getSetPrototype_evalCyclicPrototype()
+{
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("o = { }; p = { }; o.__proto__ = p; p.__proto__ = o");
+ QCOMPARE(ret.isError(), true);
+ QCOMPARE(ret.toString(), QLatin1String("Error: Cyclic __proto__ value"));
+}
+
+void tst_QJSValue::getSetPrototype_eval()
+{
+ QJSEngine eng;
+ QJSValue ret = eng.evaluate("p = { }; p.__proto__ = { }");
+ QCOMPARE(ret.isError(), false);
+}
+
+void tst_QJSValue::getSetPrototype_invalidPrototype()
+{
+ QJSEngine eng;
+ QJSValue inv;
+ QJSValue object = eng.newObject();
+ QJSValue proto = object.prototype();
+ QVERIFY(object.prototype().strictlyEquals(proto));
+ inv.setPrototype(object);
+ QVERIFY(inv.prototype().isUndefined());
+ object.setPrototype(inv);
+ QVERIFY(object.prototype().strictlyEquals(proto));
+}
+
+void tst_QJSValue::getSetPrototype_twoEngines()
+{
+ QJSEngine eng;
+ QJSValue prototype = eng.newObject();
+ QJSValue object = eng.newObject();
+ object.setPrototype(prototype);
+ QJSEngine otherEngine;
+ QJSValue newPrototype = otherEngine.newObject();
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::setPrototype() failed: cannot set a prototype created in a different engine");
+ object.setPrototype(newPrototype);
+ QCOMPARE(object.prototype().strictlyEquals(prototype), true);
+
+}
+
+void tst_QJSValue::getSetPrototype_null()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ object.setPrototype(QJSValue(QJSValue::NullValue));
+ QVERIFY(object.prototype().isNull());
+
+ QJSValue newProto = eng.newObject();
+ object.setPrototype(newProto);
+ QVERIFY(object.prototype().equals(newProto));
+
+ object.setPrototype(eng.evaluate("null"));
+ QVERIFY(object.prototype().isNull());
+}
+
+void tst_QJSValue::getSetPrototype_notObjectOrNull()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ QJSValue originalProto = object.prototype();
+
+ // bool
+ object.setPrototype(true);
+ QVERIFY(object.prototype().equals(originalProto));
+ object.setPrototype(eng.toScriptValue(true));
+ QVERIFY(object.prototype().equals(originalProto));
+
+ // number
+ object.setPrototype(123);
+ QVERIFY(object.prototype().equals(originalProto));
+ object.setPrototype(eng.toScriptValue(123));
+ QVERIFY(object.prototype().equals(originalProto));
+
+ // string
+ object.setPrototype("foo");
+ QVERIFY(object.prototype().equals(originalProto));
+ object.setPrototype(eng.toScriptValue(QString::fromLatin1("foo")));
+ QVERIFY(object.prototype().equals(originalProto));
+
+ // undefined
+ object.setPrototype(QJSValue(QJSValue::UndefinedValue));
+ QVERIFY(object.prototype().equals(originalProto));
+ object.setPrototype(eng.toScriptValue(QVariant()));
+ QVERIFY(object.prototype().equals(originalProto));
+}
+
+void tst_QJSValue::getSetPrototype()
+{
+ QJSEngine eng;
+ QJSValue prototype = eng.newObject();
+ QJSValue object = eng.newObject();
+ object.setPrototype(prototype);
+ QCOMPARE(object.prototype().strictlyEquals(prototype), true);
+}
+
+void tst_QJSValue::call_function()
+{
+ QJSEngine eng;
+ QJSValue fun = eng.evaluate("(function() { return 1; })");
+ QVERIFY(fun.isCallable());
+ QJSValue result = fun.call();
+ QVERIFY(result.isNumber());
+ QCOMPARE(result.toInt(), 1);
+}
+
+void tst_QJSValue::call_object()
+{
+ QJSEngine eng;
+ QJSValue Object = eng.evaluate("Object");
+ QCOMPARE(Object.isCallable(), true);
+ QJSValue result = Object.callWithInstance(Object);
+ QCOMPARE(result.isObject(), true);
+}
+
+void tst_QJSValue::call_newObjects()
+{
+ QJSEngine eng;
+ // test that call() doesn't construct new objects
+ QJSValue Number = eng.evaluate("Number");
+ QJSValue Object = eng.evaluate("Object");
+ QCOMPARE(Object.isCallable(), true);
+ QJSValueList args;
+ args << eng.toScriptValue(123);
+ QJSValue result = Number.callWithInstance(Object, args);
+ QCOMPARE(result.strictlyEquals(args.at(0)), true);
+}
+
+void tst_QJSValue::call_this()
+{
+ QJSEngine eng;
+ // test that correct "this" object is used
+ QJSValue fun = eng.evaluate("(function() { return this; })");
+ QCOMPARE(fun.isCallable(), true);
+
+ QJSValue numberObject = eng.evaluate("new Number(123)");
+ QJSValue result = fun.callWithInstance(numberObject);
+ QCOMPARE(result.isObject(), true);
+ QCOMPARE(result.toNumber(), 123.0);
+}
+
+void tst_QJSValue::call_arguments()
+{
+ QJSEngine eng;
+ // test that correct arguments are passed
+
+ QJSValue fun = eng.evaluate("(function() { return arguments[0]; })");
+ QCOMPARE(fun.isCallable(), true);
+ {
+ QJSValue result = fun.callWithInstance(eng.toScriptValue(QVariant()));
+ QCOMPARE(result.isUndefined(), true);
+ }
+ {
+ QJSValueList args;
+ args << eng.toScriptValue(123.0);
+ QJSValue result = fun.callWithInstance(eng.toScriptValue(QVariant()), args);
+ QCOMPARE(result.isNumber(), true);
+ QCOMPARE(result.toNumber(), 123.0);
+ }
+ // V2 constructors
+ {
+ QJSValueList args;
+ args << QJSValue(123.0);
+ QJSValue result = fun.callWithInstance(eng.toScriptValue(QVariant()), args);
+ QCOMPARE(result.isNumber(), true);
+ QCOMPARE(result.toNumber(), 123.0);
+ }
+}
+
+void tst_QJSValue::call()
+{
+ QJSEngine eng;
+ {
+ QJSValue fun = eng.evaluate("(function() { return arguments[1]; })");
+ QCOMPARE(fun.isCallable(), true);
+
+ {
+ QJSValueList args;
+ args << eng.toScriptValue(123.0) << eng.toScriptValue(456.0);
+ QJSValue result = fun.callWithInstance(eng.toScriptValue(QVariant()), args);
+ QCOMPARE(result.isNumber(), true);
+ QCOMPARE(result.toNumber(), 456.0);
+ }
+ }
+ {
+ QJSValue fun = eng.evaluate("(function() { throw new Error('foo'); })");
+ QCOMPARE(fun.isCallable(), true);
+ QVERIFY(!fun.isError());
+
+ {
+ QJSValue result = fun.call();
+ QCOMPARE(result.isError(), true);
+ }
+ }
+}
+
+void tst_QJSValue::call_twoEngines()
+{
+ QJSEngine eng;
+ QJSValue object = eng.evaluate("Object");
+ QJSEngine otherEngine;
+ QJSValue fun = otherEngine.evaluate("(function() { return 1; })");
+ QVERIFY(fun.isCallable());
+ QTest::ignoreMessage(QtWarningMsg, "JSValue can't be rassigned to an another engine.");
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: "
+ "cannot call function with thisObject created in "
+ "a different engine");
+ QVERIFY(fun.callWithInstance(object).isUndefined());
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: "
+ "cannot call function with argument created in "
+ "a different engine");
+ QVERIFY(fun.call(QJSValueList() << eng.toScriptValue(123)).isUndefined());
+ {
+ QJSValue fun = eng.evaluate("Object");
+ QVERIFY(fun.isCallable());
+ QJSEngine eng2;
+ QJSValue objectInDifferentEngine = eng2.newObject();
+ QJSValueList args;
+ args << objectInDifferentEngine;
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::call() failed: cannot call function with argument created in a different engine");
+ fun.call(args);
+ }
+}
+
+void tst_QJSValue::call_nonFunction_data()
+{
+ newEngine();
+ QTest::addColumn<QJSValue>("value");
+
+ QTest::newRow("invalid") << QJSValue();
+ QTest::newRow("bool") << QJSValue(false);
+ QTest::newRow("int") << QJSValue(123);
+ QTest::newRow("string") << QJSValue(QString::fromLatin1("ciao"));
+ QTest::newRow("undefined") << QJSValue(QJSValue::UndefinedValue);
+ QTest::newRow("null") << QJSValue(QJSValue::NullValue);
+
+ QTest::newRow("bool bound") << engine->toScriptValue(false);
+ QTest::newRow("int bound") << engine->toScriptValue(123);
+ QTest::newRow("string bound") << engine->toScriptValue(QString::fromLatin1("ciao"));
+ QTest::newRow("undefined bound") << engine->toScriptValue(QVariant());
+ QTest::newRow("null bound") << engine->evaluate("null");
+}
+
+void tst_QJSValue::call_nonFunction()
+{
+ // calling things that are not functions
+ QFETCH(QJSValue, value);
+ QVERIFY(value.call().isUndefined());
+}
+
+void tst_QJSValue::construct_nonFunction_data()
+{
+ newEngine();
+ QTest::addColumn<QJSValue>("value");
+
+ QTest::newRow("invalid") << QJSValue();
+ QTest::newRow("bool") << QJSValue(false);
+ QTest::newRow("int") << QJSValue(123);
+ QTest::newRow("string") << QJSValue(QString::fromLatin1("ciao"));
+ QTest::newRow("undefined") << QJSValue(QJSValue::UndefinedValue);
+ QTest::newRow("null") << QJSValue(QJSValue::NullValue);
+
+ QTest::newRow("bool bound") << engine->toScriptValue(false);
+ QTest::newRow("int bound") << engine->toScriptValue(123);
+ QTest::newRow("string bound") << engine->toScriptValue(QString::fromLatin1("ciao"));
+ QTest::newRow("undefined bound") << engine->toScriptValue(QVariant());
+ QTest::newRow("null bound") << engine->evaluate("null");
+}
+
+void tst_QJSValue::construct_nonFunction()
+{
+ QFETCH(QJSValue, value);
+ QVERIFY(value.callAsConstructor().isUndefined());
+}
+
+void tst_QJSValue::construct_simple()
+{
+ QJSEngine eng;
+ QJSValue fun = eng.evaluate("(function () { this.foo = 123; })");
+ QVERIFY(fun.isCallable());
+ QJSValue ret = fun.callAsConstructor();
+ QVERIFY(!ret.isUndefined());
+ QVERIFY(ret.isObject());
+ QVERIFY(ret.prototype().strictlyEquals(fun.property("prototype")));
+ QCOMPARE(ret.property("foo").toInt(), 123);
+}
+
+void tst_QJSValue::construct_newObjectJS()
+{
+ QJSEngine eng;
+ // returning a different object overrides the default-constructed one
+ QJSValue fun = eng.evaluate("(function () { return { bar: 456 }; })");
+ QVERIFY(fun.isCallable());
+ QJSValue ret = fun.callAsConstructor();
+ QVERIFY(ret.isObject());
+ QVERIFY(!ret.prototype().strictlyEquals(fun.property("prototype")));
+ QCOMPARE(ret.property("bar").toInt(), 456);
+}
+
+void tst_QJSValue::construct_arg()
+{
+ QJSEngine eng;
+ QJSValue Number = eng.evaluate("Number");
+ QCOMPARE(Number.isCallable(), true);
+ QJSValueList args;
+ args << eng.toScriptValue(123);
+ QJSValue ret = Number.callAsConstructor(args);
+ QCOMPARE(ret.isObject(), true);
+ QCOMPARE(ret.toNumber(), args.at(0).toNumber());
+}
+
+void tst_QJSValue::construct_proto()
+{
+ QJSEngine eng;
+ // test that internal prototype is set correctly
+ QJSValue fun = eng.evaluate("(function() { return this.__proto__; })");
+ QCOMPARE(fun.isCallable(), true);
+ QCOMPARE(fun.property("prototype").isObject(), true);
+ QJSValue ret = fun.callAsConstructor();
+ QCOMPARE(fun.property("prototype").strictlyEquals(ret), true);
+}
+
+void tst_QJSValue::construct_returnInt()
+{
+ QJSEngine eng;
+ // test that we return the new object even if a non-object value is returned from the function
+ QJSValue fun = eng.evaluate("(function() { return 123; })");
+ QCOMPARE(fun.isCallable(), true);
+ QJSValue ret = fun.callAsConstructor();
+ QCOMPARE(ret.isObject(), true);
+}
+
+void tst_QJSValue::construct_throw()
+{
+ QJSEngine eng;
+ QJSValue fun = eng.evaluate("(function() { throw new Error('foo'); })");
+ QCOMPARE(fun.isCallable(), true);
+ QJSValue ret = fun.callAsConstructor();
+ QCOMPARE(ret.isError(), true);
+}
+
+void tst_QJSValue::construct_twoEngines()
+{
+ QJSEngine engine;
+ QJSEngine otherEngine;
+ QJSValue ctor = engine.evaluate("(function (a, b) { this.foo = 123; })");
+ QJSValue arg = otherEngine.toScriptValue(124567);
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine");
+ QVERIFY(ctor.callAsConstructor(QJSValueList() << arg).isUndefined());
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine");
+ QVERIFY(ctor.callAsConstructor(QJSValueList() << arg << otherEngine.newObject()).isUndefined());
+}
+
+void tst_QJSValue::construct_constructorThrowsPrimitive()
+{
+ QJSEngine eng;
+ QJSValue fun = eng.evaluate("(function() { throw 123; })");
+ QVERIFY(fun.isCallable());
+ // construct(QJSValueList)
+ {
+ QJSValue ret = fun.callAsConstructor();
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toNumber(), 123.0);
+ QVERIFY(!ret.isError());
+ }
+}
+
+void tst_QJSValue::equals()
+{
+ QJSEngine eng;
+ QObject temp;
+
+ QVERIFY(QJSValue().equals(QJSValue()));
+
+ QJSValue num = eng.toScriptValue(123);
+ QCOMPARE(num.equals(eng.toScriptValue(123)), true);
+ QCOMPARE(num.equals(eng.toScriptValue(321)), false);
+ QCOMPARE(num.equals(eng.toScriptValue(QString::fromLatin1("123"))), true);
+ QCOMPARE(num.equals(eng.toScriptValue(QString::fromLatin1("321"))), false);
+ QCOMPARE(num.equals(eng.evaluate("new Number(123)")), true);
+ QCOMPARE(num.equals(eng.evaluate("new Number(321)")), false);
+ QCOMPARE(num.equals(eng.evaluate("new String('123')")), true);
+ QCOMPARE(num.equals(eng.evaluate("new String('321')")), false);
+ QVERIFY(eng.evaluate("new Number(123)").equals(num));
+ QCOMPARE(num.equals(QJSValue()), false);
+
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("123"));
+ QCOMPARE(str.equals(eng.toScriptValue(QString::fromLatin1("123"))), true);
+ QCOMPARE(str.equals(eng.toScriptValue(QString::fromLatin1("321"))), false);
+ QCOMPARE(str.equals(eng.toScriptValue(123)), true);
+ QCOMPARE(str.equals(eng.toScriptValue(321)), false);
+ QCOMPARE(str.equals(eng.evaluate("new String('123')")), true);
+ QCOMPARE(str.equals(eng.evaluate("new String('321')")), false);
+ QCOMPARE(str.equals(eng.evaluate("new Number(123)")), true);
+ QCOMPARE(str.equals(eng.evaluate("new Number(321)")), false);
+ QVERIFY(eng.evaluate("new String('123')").equals(str));
+ QCOMPARE(str.equals(QJSValue()), false);
+
+ QJSValue num2 = QJSValue(123);
+ QCOMPARE(num2.equals(QJSValue(123)), true);
+ QCOMPARE(num2.equals(QJSValue(321)), false);
+ QCOMPARE(num2.equals(QJSValue("123")), true);
+ QCOMPARE(num2.equals(QJSValue("321")), false);
+ QCOMPARE(num2.equals(QJSValue()), false);
+
+ QJSValue str2 = QJSValue("123");
+ QCOMPARE(str2.equals(QJSValue("123")), true);
+ QCOMPARE(str2.equals(QJSValue("321")), false);
+ QCOMPARE(str2.equals(QJSValue(123)), true);
+ QCOMPARE(str2.equals(QJSValue(321)), false);
+ QCOMPARE(str2.equals(QJSValue()), false);
+
+ QJSValue date1 = eng.toScriptValue(QDateTime(QDate(2000, 1, 1)));
+ QJSValue date2 = eng.toScriptValue(QDateTime(QDate(1999, 1, 1)));
+ QCOMPARE(date1.equals(date2), false);
+ QCOMPARE(date1.equals(date1), true);
+ QCOMPARE(date2.equals(date2), true);
+
+ QJSValue undefined = eng.toScriptValue(QVariant());
+ QJSValue null = eng.evaluate("null");
+ QCOMPARE(undefined.equals(undefined), true);
+ QCOMPARE(null.equals(null), true);
+ QCOMPARE(undefined.equals(null), true);
+ QCOMPARE(null.equals(undefined), true);
+ QVERIFY(undefined.equals(QJSValue()));
+ QVERIFY(null.equals(QJSValue()));
+ QVERIFY(!null.equals(num));
+ QVERIFY(!undefined.equals(num));
+
+ QJSValue sant = eng.toScriptValue(true);
+ QVERIFY(sant.equals(eng.toScriptValue(1)));
+ QVERIFY(sant.equals(eng.toScriptValue(QString::fromLatin1("1"))));
+ QVERIFY(sant.equals(sant));
+ QVERIFY(sant.equals(eng.evaluate("new Number(1)")));
+ QVERIFY(sant.equals(eng.evaluate("new String('1')")));
+ QVERIFY(sant.equals(eng.evaluate("new Boolean(true)")));
+ QVERIFY(eng.evaluate("new Boolean(true)").equals(sant));
+ QVERIFY(!sant.equals(eng.toScriptValue(0)));
+ QVERIFY(!sant.equals(undefined));
+ QVERIFY(!sant.equals(null));
+
+ QJSValue falskt = eng.toScriptValue(false);
+ QVERIFY(falskt.equals(eng.toScriptValue(0)));
+ QVERIFY(falskt.equals(eng.toScriptValue(QString::fromLatin1("0"))));
+ QVERIFY(falskt.equals(falskt));
+ QVERIFY(falskt.equals(eng.evaluate("new Number(0)")));
+ QVERIFY(falskt.equals(eng.evaluate("new String('0')")));
+ QVERIFY(falskt.equals(eng.evaluate("new Boolean(false)")));
+ QVERIFY(eng.evaluate("new Boolean(false)").equals(falskt));
+ QVERIFY(!falskt.equals(sant));
+ QVERIFY(!falskt.equals(undefined));
+ QVERIFY(!falskt.equals(null));
+
+ QJSValue obj1 = eng.newObject();
+ QJSValue obj2 = eng.newObject();
+ QCOMPARE(obj1.equals(obj2), false);
+ QCOMPARE(obj2.equals(obj1), false);
+ QCOMPARE(obj1.equals(obj1), true);
+ QCOMPARE(obj2.equals(obj2), true);
+
+ QJSValue qobj1 = eng.newQObject(&temp);
+ QJSValue qobj2 = eng.newQObject(&temp);
+ QJSValue qobj3 = eng.newQObject(0);
+
+ // FIXME: No ScriptOwnership: QJSValue qobj4 = eng.newQObject(new QObject(), QScriptEngine::ScriptOwnership);
+ QJSValue qobj4 = eng.newQObject(new QObject());
+
+ QVERIFY(qobj1.equals(qobj2)); // compares the QObject pointers
+ QVERIFY(!qobj2.equals(qobj4)); // compares the QObject pointers
+ QVERIFY(!qobj2.equals(obj2)); // compares the QObject pointers
+
+ QJSValue compareFun = eng.evaluate("(function(a, b) { return a == b; })");
+ QVERIFY(compareFun.isCallable());
+ {
+ QJSValue ret = compareFun.call(QJSValueList() << qobj1 << qobj2);
+ QVERIFY(ret.isBool());
+ ret = compareFun.call(QJSValueList() << qobj1 << qobj3);
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ ret = compareFun.call(QJSValueList() << qobj1 << qobj4);
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ ret = compareFun.call(QJSValueList() << qobj1 << obj1);
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ }
+
+ {
+ QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2)));
+ QJSValue var2 = eng.toScriptValue(QVariant(QPoint(1, 2)));
+ QEXPECT_FAIL("", "FIXME: QVariant comparison does not work with v8", Continue);
+ QVERIFY(var1.equals(var2));
+ }
+ {
+ QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2)));
+ QJSValue var2 = eng.toScriptValue(QVariant(QPoint(3, 4)));
+ QVERIFY(!var1.equals(var2));
+ }
+
+ QJSEngine otherEngine;
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::equals: "
+ "cannot compare to a value created in "
+ "a different engine");
+ QCOMPARE(date1.equals(otherEngine.toScriptValue(123)), false);
+}
+
+void tst_QJSValue::strictlyEquals()
+{
+ QJSEngine eng;
+ QObject temp;
+
+ QVERIFY(QJSValue().strictlyEquals(QJSValue()));
+
+ QJSValue num = eng.toScriptValue(123);
+ QCOMPARE(num.strictlyEquals(eng.toScriptValue(123)), true);
+ QCOMPARE(num.strictlyEquals(eng.toScriptValue(321)), false);
+ QCOMPARE(num.strictlyEquals(eng.toScriptValue(QString::fromLatin1("123"))), false);
+ QCOMPARE(num.strictlyEquals(eng.toScriptValue(QString::fromLatin1("321"))), false);
+ QCOMPARE(num.strictlyEquals(eng.evaluate("new Number(123)")), false);
+ QCOMPARE(num.strictlyEquals(eng.evaluate("new Number(321)")), false);
+ QCOMPARE(num.strictlyEquals(eng.evaluate("new String('123')")), false);
+ QCOMPARE(num.strictlyEquals(eng.evaluate("new String('321')")), false);
+ QVERIFY(!eng.evaluate("new Number(123)").strictlyEquals(num));
+ QVERIFY(!num.strictlyEquals(QJSValue()));
+ QVERIFY(!QJSValue().strictlyEquals(num));
+
+ QJSValue str = eng.toScriptValue(QString::fromLatin1("123"));
+ QCOMPARE(str.strictlyEquals(eng.toScriptValue(QString::fromLatin1("123"))), true);
+ QCOMPARE(str.strictlyEquals(eng.toScriptValue(QString::fromLatin1("321"))), false);
+ QCOMPARE(str.strictlyEquals(eng.toScriptValue(123)), false);
+ QCOMPARE(str.strictlyEquals(eng.toScriptValue(321)), false);
+ QCOMPARE(str.strictlyEquals(eng.evaluate("new String('123')")), false);
+ QCOMPARE(str.strictlyEquals(eng.evaluate("new String('321')")), false);
+ QCOMPARE(str.strictlyEquals(eng.evaluate("new Number(123)")), false);
+ QCOMPARE(str.strictlyEquals(eng.evaluate("new Number(321)")), false);
+ QVERIFY(!eng.evaluate("new String('123')").strictlyEquals(str));
+ QVERIFY(!str.strictlyEquals(QJSValue()));
+
+ QJSValue num2 = QJSValue(123);
+ QCOMPARE(num2.strictlyEquals(QJSValue(123)), true);
+ QCOMPARE(num2.strictlyEquals(QJSValue(321)), false);
+ QCOMPARE(num2.strictlyEquals(QJSValue("123")), false);
+ QCOMPARE(num2.strictlyEquals(QJSValue("321")), false);
+ QVERIFY(!num2.strictlyEquals(QJSValue()));
+
+ QJSValue str2 = QJSValue("123");
+ QCOMPARE(str2.strictlyEquals(QJSValue("123")), true);
+ QCOMPARE(str2.strictlyEquals(QJSValue("321")), false);
+ QCOMPARE(str2.strictlyEquals(QJSValue(123)), false);
+ QCOMPARE(str2.strictlyEquals(QJSValue(321)), false);
+ QVERIFY(!str2.strictlyEquals(QJSValue()));
+
+ QJSValue date1 = eng.toScriptValue(QDateTime(QDate(2000, 1, 1)));
+ QJSValue date2 = eng.toScriptValue(QDateTime(QDate(1999, 1, 1)));
+ QCOMPARE(date1.strictlyEquals(date2), false);
+ QCOMPARE(date1.strictlyEquals(date1), true);
+ QCOMPARE(date2.strictlyEquals(date2), true);
+ QVERIFY(!date1.strictlyEquals(QJSValue()));
+
+ QJSValue undefined = eng.toScriptValue(QVariant());
+ QJSValue null = eng.evaluate("null");
+ QCOMPARE(undefined.strictlyEquals(undefined), true);
+ QCOMPARE(null.strictlyEquals(null), true);
+ QCOMPARE(undefined.strictlyEquals(null), false);
+ QCOMPARE(null.strictlyEquals(undefined), false);
+ QVERIFY(!null.strictlyEquals(QJSValue()));
+
+ QJSValue sant = eng.toScriptValue(true);
+ QVERIFY(!sant.strictlyEquals(eng.toScriptValue(1)));
+ QVERIFY(!sant.strictlyEquals(eng.toScriptValue(QString::fromLatin1("1"))));
+ QVERIFY(sant.strictlyEquals(sant));
+ QVERIFY(!sant.strictlyEquals(eng.evaluate("new Number(1)")));
+ QVERIFY(!sant.strictlyEquals(eng.evaluate("new String('1')")));
+ QVERIFY(!sant.strictlyEquals(eng.evaluate("new Boolean(true)")));
+ QVERIFY(!eng.evaluate("new Boolean(true)").strictlyEquals(sant));
+ QVERIFY(!sant.strictlyEquals(eng.toScriptValue(0)));
+ QVERIFY(!sant.strictlyEquals(undefined));
+ QVERIFY(!sant.strictlyEquals(null));
+ QVERIFY(!sant.strictlyEquals(QJSValue()));
+
+ QJSValue falskt = eng.toScriptValue(false);
+ QVERIFY(!falskt.strictlyEquals(eng.toScriptValue(0)));
+ QVERIFY(!falskt.strictlyEquals(eng.toScriptValue(QString::fromLatin1("0"))));
+ QVERIFY(falskt.strictlyEquals(falskt));
+ QVERIFY(!falskt.strictlyEquals(eng.evaluate("new Number(0)")));
+ QVERIFY(!falskt.strictlyEquals(eng.evaluate("new String('0')")));
+ QVERIFY(!falskt.strictlyEquals(eng.evaluate("new Boolean(false)")));
+ QVERIFY(!eng.evaluate("new Boolean(false)").strictlyEquals(falskt));
+ QVERIFY(!falskt.strictlyEquals(sant));
+ QVERIFY(!falskt.strictlyEquals(undefined));
+ QVERIFY(!falskt.strictlyEquals(null));
+ QVERIFY(!falskt.strictlyEquals(QJSValue()));
+
+ QVERIFY(!QJSValue(false).strictlyEquals(123));
+ QVERIFY(!QJSValue(QJSValue::UndefinedValue).strictlyEquals(123));
+ QVERIFY(!QJSValue(QJSValue::NullValue).strictlyEquals(123));
+ QVERIFY(!QJSValue(false).strictlyEquals("ciao"));
+ QVERIFY(!QJSValue(QJSValue::UndefinedValue).strictlyEquals("ciao"));
+ QVERIFY(!QJSValue(QJSValue::NullValue).strictlyEquals("ciao"));
+ QVERIFY(eng.toScriptValue(QString::fromLatin1("ciao")).strictlyEquals("ciao"));
+ QVERIFY(QJSValue("ciao").strictlyEquals(eng.toScriptValue(QString::fromLatin1("ciao"))));
+ QVERIFY(!QJSValue("ciao").strictlyEquals(123));
+ QVERIFY(!QJSValue("ciao").strictlyEquals(eng.toScriptValue(123)));
+ QVERIFY(!QJSValue(123).strictlyEquals("ciao"));
+ QVERIFY(!QJSValue(123).strictlyEquals(eng.toScriptValue(QString::fromLatin1("ciao"))));
+ QVERIFY(!eng.toScriptValue(123).strictlyEquals("ciao"));
+
+ QJSValue obj1 = eng.newObject();
+ QJSValue obj2 = eng.newObject();
+ QCOMPARE(obj1.strictlyEquals(obj2), false);
+ QCOMPARE(obj2.strictlyEquals(obj1), false);
+ QCOMPARE(obj1.strictlyEquals(obj1), true);
+ QCOMPARE(obj2.strictlyEquals(obj2), true);
+ QVERIFY(!obj1.strictlyEquals(QJSValue()));
+
+ QJSValue qobj1 = eng.newQObject(&temp);
+ QJSValue qobj2 = eng.newQObject(&temp);
+ QVERIFY(qobj1.strictlyEquals(qobj2));
+
+ {
+ QJSValue var1 = eng.toScriptValue(QVariant(QStringList() << "a"));
+ QJSValue var2 = eng.toScriptValue(QVariant(QStringList() << "a"));
+ QVERIFY(var1.isArray());
+ QVERIFY(var2.isArray());
+ QVERIFY(!var1.strictlyEquals(var2));
+ }
+ {
+ QJSValue var1 = eng.toScriptValue(QVariant(QStringList() << "a"));
+ QJSValue var2 = eng.toScriptValue(QVariant(QStringList() << "b"));
+ QVERIFY(!var1.strictlyEquals(var2));
+ }
+ {
+ QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2)));
+ QJSValue var2 = eng.toScriptValue(QVariant(QPoint(1, 2)));
+ QVERIFY(!var1.strictlyEquals(var2));
+ }
+ {
+ QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2)));
+ QJSValue var2 = eng.toScriptValue(QVariant(QPoint(3, 4)));
+ QVERIFY(!var1.strictlyEquals(var2));
+ }
+
+ QJSEngine otherEngine;
+ QTest::ignoreMessage(QtWarningMsg, "QJSValue::strictlyEquals: "
+ "cannot compare to a value created in "
+ "a different engine");
+ QCOMPARE(date1.strictlyEquals(otherEngine.toScriptValue(123)), false);
+}
+
+Q_DECLARE_METATYPE(int*)
+Q_DECLARE_METATYPE(double*)
+Q_DECLARE_METATYPE(QColor*)
+Q_DECLARE_METATYPE(QBrush*)
+
+void tst_QJSValue::castToPointer()
+{
+ QJSEngine eng;
+ {
+ QColor c(123, 210, 231);
+ QJSValue v = eng.toScriptValue(c);
+ QColor *cp = qjsvalue_cast<QColor*>(v);
+ QVERIFY(cp != 0);
+ QCOMPARE(*cp, c);
+
+ QBrush *bp = qjsvalue_cast<QBrush*>(v);
+ QVERIFY(bp == 0);
+
+ QJSValue v2 = eng.toScriptValue(qVariantFromValue(cp));
+ QCOMPARE(qjsvalue_cast<QColor*>(v2), cp);
+ }
+}
+
+void tst_QJSValue::prettyPrinter_data()
+{
+ QTest::addColumn<QString>("function");
+ QTest::addColumn<QString>("expected");
+ QTest::newRow("function() { }") << QString("function() { }") << QString("function () { }");
+ QTest::newRow("function foo() { }") << QString("(function foo() { })") << QString("function foo() { }");
+ QTest::newRow("function foo(bar) { }") << QString("(function foo(bar) { })") << QString("function foo(bar) { }");
+ QTest::newRow("function foo(bar, baz) { }") << QString("(function foo(bar, baz) { })") << QString("function foo(bar, baz) { }");
+ QTest::newRow("this") << QString("function() { this; }") << QString("function () { this; }");
+ QTest::newRow("identifier") << QString("function(a) { a; }") << QString("function (a) { a; }");
+ QTest::newRow("null") << QString("function() { null; }") << QString("function () { null; }");
+ QTest::newRow("true") << QString("function() { true; }") << QString("function () { true; }");
+ QTest::newRow("false") << QString("function() { false; }") << QString("function () { false; }");
+ QTest::newRow("string") << QString("function() { 'test'; }") << QString("function () { \'test\'; }");
+ QTest::newRow("string") << QString("function() { \"test\"; }") << QString("function () { \"test\"; }");
+ QTest::newRow("number") << QString("function() { 123; }") << QString("function () { 123; }");
+ QTest::newRow("number") << QString("function() { 123.456; }") << QString("function () { 123.456; }");
+ QTest::newRow("regexp") << QString("function() { /hello/; }") << QString("function () { /hello/; }");
+ QTest::newRow("regexp") << QString("function() { /hello/gim; }") << QString("function () { /hello/gim; }");
+ QTest::newRow("array") << QString("function() { []; }") << QString("function () { []; }");
+ QTest::newRow("array") << QString("function() { [10]; }") << QString("function () { [10]; }");
+ QTest::newRow("array") << QString("function() { [10, 20, 30]; }") << QString("function () { [10, 20, 30]; }");
+ QTest::newRow("array") << QString("function() { [10, 20, , 40]; }") << QString("function () { [10, 20, , 40]; }");
+ QTest::newRow("array") << QString("function() { [,]; }") << QString("function () { [,]; }");
+ QTest::newRow("array") << QString("function() { [, 10]; }") << QString("function () { [, 10]; }");
+ QTest::newRow("array") << QString("function() { [, 10, ]; }") << QString("function () { [, 10, ]; }");
+ QTest::newRow("array") << QString("function() { [, 10, ,]; }") << QString("function () { [, 10, ,]; }");
+ QTest::newRow("array") << QString("function() { [[10], [20]]; }") << QString("function () { [[10], [20]]; }");
+ QTest::newRow("member") << QString("function() { a.b; }") << QString("function () { a.b; }");
+ QTest::newRow("member") << QString("function() { a.b.c; }") << QString("function () { a.b.c; }");
+ QTest::newRow("call") << QString("function() { f(); }") << QString("function () { f(); }");
+ QTest::newRow("call") << QString("function() { f(a); }") << QString("function () { f(a); }");
+ QTest::newRow("call") << QString("function() { f(a, b); }") << QString("function () { f(a, b); }");
+ QTest::newRow("new") << QString("function() { new C(); }") << QString("function () { new C(); }");
+ QTest::newRow("new") << QString("function() { new C(a); }") << QString("function () { new C(a); }");
+ QTest::newRow("new") << QString("function() { new C(a, b); }") << QString("function () { new C(a, b); }");
+ QTest::newRow("++") << QString("function() { a++; }") << QString("function () { a++; }");
+ QTest::newRow("++") << QString("function() { ++a; }") << QString("function () { ++a; }");
+ QTest::newRow("--") << QString("function() { a--; }") << QString("function () { a--; }");
+ QTest::newRow("--") << QString("function() { --a; }") << QString("function () { --a; }");
+ QTest::newRow("delete") << QString("function() { delete a; }") << QString("function () { delete a; }");
+ QTest::newRow("void") << QString("function() { void a; }") << QString("function () { void a; }");
+ QTest::newRow("typeof") << QString("function() { typeof a; }") << QString("function () { typeof a; }");
+ QTest::newRow("+") << QString("function() { +a; }") << QString("function () { +a; }");
+ QTest::newRow("-") << QString("function() { -a; }") << QString("function () { -a; }");
+ QTest::newRow("~") << QString("function() { ~a; }") << QString("function () { ~a; }");
+ QTest::newRow("!") << QString("function() { !a; }") << QString("function () { !a; }");
+ QTest::newRow("+") << QString("function() { a + b; }") << QString("function () { a + b; }");
+ QTest::newRow("&&") << QString("function() { a && b; }") << QString("function () { a && b; }");
+ QTest::newRow("&=") << QString("function() { a &= b; }") << QString("function () { a &= b; }");
+ QTest::newRow("=") << QString("function() { a = b; }") << QString("function () { a = b; }");
+ QTest::newRow("&") << QString("function() { a & b; }") << QString("function () { a & b; }");
+ QTest::newRow("|") << QString("function() { a | b; }") << QString("function () { a | b; }");
+ QTest::newRow("^") << QString("function() { a ^ b; }") << QString("function () { a ^ b; }");
+ QTest::newRow("-=") << QString("function() { a -= b; }") << QString("function () { a -= b; }");
+ QTest::newRow("/") << QString("function() { a / b; }") << QString("function () { a / b; }");
+ QTest::newRow("/=") << QString("function() { a /= b; }") << QString("function () { a /= b; }");
+ QTest::newRow("==") << QString("function() { a == b; }") << QString("function () { a == b; }");
+ QTest::newRow(">=") << QString("function() { a >= b; }") << QString("function () { a >= b; }");
+ QTest::newRow(">") << QString("function() { a > b; }") << QString("function () { a > b; }");
+ QTest::newRow("in") << QString("function() { a in b; }") << QString("function () { a in b; }");
+ QTest::newRow("+=") << QString("function() { a += b; }") << QString("function () { a += b; }");
+ QTest::newRow("instanceof") << QString("function() { a instanceof b; }") << QString("function () { a instanceof b; }");
+ QTest::newRow("<=") << QString("function() { a <= b; }") << QString("function () { a <= b; }");
+ QTest::newRow("<<") << QString("function() { a << b; }") << QString("function () { a << b; }");
+ QTest::newRow("<<=") << QString("function() { a <<= b; }") << QString("function () { a <<= b; }");
+ QTest::newRow("<") << QString("function() { a < b; }") << QString("function () { a < b; }");
+ QTest::newRow("%") << QString("function() { a % b; }") << QString("function () { a % b; }");
+ QTest::newRow("%=") << QString("function() { a %= b; }") << QString("function () { a %= b; }");
+ QTest::newRow("*") << QString("function() { a * b; }") << QString("function () { a * b; }");
+ QTest::newRow("*=") << QString("function() { a *= b; }") << QString("function () { a *= b; }");
+ QTest::newRow("!=") << QString("function() { a != b; }") << QString("function () { a != b; }");
+ QTest::newRow("||") << QString("function() { a || b; }") << QString("function () { a || b; }");
+ QTest::newRow("|=") << QString("function() { a |= b; }") << QString("function () { a |= b; }");
+ QTest::newRow(">>") << QString("function() { a >> b; }") << QString("function () { a >> b; }");
+ QTest::newRow(">>=") << QString("function() { a >>= b; }") << QString("function () { a >>= b; }");
+ QTest::newRow("===") << QString("function() { a === b; }") << QString("function () { a === b; }");
+ QTest::newRow("!==") << QString("function() { a !== b; }") << QString("function () { a !== b; }");
+ QTest::newRow("-") << QString("function() { a - b; }") << QString("function () { a - b; }");
+ QTest::newRow(">>>") << QString("function() { a >>> b; }") << QString("function () { a >>> b; }");
+ QTest::newRow(">>>=") << QString("function() { a >>>= b; }") << QString("function () { a >>>= b; }");
+ QTest::newRow("^=") << QString("function() { a ^= b; }") << QString("function () { a ^= b; }");
+ QTest::newRow("? :") << QString("function() { a ? b : c; }") << QString("function () { a ? b : c; }");
+ QTest::newRow("a; b; c") << QString("function() { a; b; c; }") << QString("function () { a; b; c; }");
+ QTest::newRow("var a;") << QString("function() { var a; }") << QString("function () { var a; }");
+ QTest::newRow("var a, b;") << QString("function() { var a, b; }") << QString("function () { var a, b; }");
+ QTest::newRow("var a = 10;") << QString("function() { var a = 10; }") << QString("function () { var a = 10; }");
+ QTest::newRow("var a, b = 20;") << QString("function() { var a, b = 20; }") << QString("function () { var a, b = 20; }");
+ QTest::newRow("var a = 10, b = 20;") << QString("function() { var a = 10, b = 20; }") << QString("function () { var a = 10, b = 20; }");
+ QTest::newRow("if") << QString("function() { if (a) b; }") << QString("function () { if (a) b; }");
+ QTest::newRow("if") << QString("function() { if (a) { b; c; } }") << QString("function () { if (a) { b; c; } }");
+ QTest::newRow("if-else") << QString("function() { if (a) b; else c; }") << QString("function () { if (a) b; else c; }");
+ QTest::newRow("if-else") << QString("function() { if (a) { b; c; } else { d; e; } }") << QString("function () { if (a) { b; c; } else { d; e; } }");
+ QTest::newRow("do-while") << QString("function() { do { a; } while (b); }") << QString("function () { do { a; } while (b); }");
+ QTest::newRow("do-while") << QString("function() { do { a; b; c; } while (d); }") << QString("function () { do { a; b; c; } while (d); }");
+ QTest::newRow("while") << QString("function() { while (a) { b; } }") << QString("function () { while (a) { b; } }");
+ QTest::newRow("while") << QString("function() { while (a) { b; c; } }") << QString("function () { while (a) { b; c; } }");
+ QTest::newRow("for") << QString("function() { for (a; b; c) { } }") << QString("function () { for (a; b; c) { } }");
+ QTest::newRow("for") << QString("function() { for (; a; b) { } }") << QString("function () { for (; a; b) { } }");
+ QTest::newRow("for") << QString("function() { for (; ; a) { } }") << QString("function () { for (; ; a) { } }");
+ QTest::newRow("for") << QString("function() { for (; ; ) { } }") << QString("function () { for (; ; ) { } }");
+ QTest::newRow("for") << QString("function() { for (var a; b; c) { } }") << QString("function () { for (var a; b; c) { } }");
+ QTest::newRow("for") << QString("function() { for (var a, b, c; d; e) { } }") << QString("function () { for (var a, b, c; d; e) { } }");
+ QTest::newRow("continue") << QString("function() { for (; ; ) { continue; } }") << QString("function () { for (; ; ) { continue; } }");
+ QTest::newRow("break") << QString("function() { for (; ; ) { break; } }") << QString("function () { for (; ; ) { break; } }");
+ QTest::newRow("return") << QString("function() { return; }") << QString("function () { return; }");
+ QTest::newRow("return") << QString("function() { return 10; }") << QString("function () { return 10; }");
+ QTest::newRow("with") << QString("function() { with (a) { b; } }") << QString("function () { with (a) { b; } }");
+ QTest::newRow("with") << QString("function() { with (a) { b; c; } }") << QString("function () { with (a) { b; c; } }");
+ QTest::newRow("switch") << QString("function() { switch (a) { } }") << QString("function () { switch (a) { } }");
+ QTest::newRow("switch") << QString("function() { switch (a) { case 1: ; } }") << QString("function () { switch (a) { case 1: ; } }");
+ QTest::newRow("switch") << QString("function() { switch (a) { case 1: b; break; } }") << QString("function () { switch (a) { case 1: b; break; } }");
+ QTest::newRow("switch") << QString("function() { switch (a) { case 1: b; break; case 2: break; } }") << QString("function () { switch (a) { case 1: b; break; case 2: break; } }");
+ QTest::newRow("switch") << QString("function() { switch (a) { case 1: case 2: ; } }") << QString("function () { switch (a) { case 1: case 2: ; } }");
+ QTest::newRow("switch") << QString("function() { switch (a) { case 1: default: ; } }") << QString("function () { switch (a) { case 1: default: ; } }");
+ QTest::newRow("switch") << QString("function() { switch (a) { case 1: default: ; case 3: ; } }") << QString("function () { switch (a) { case 1: default: ; case 3: ; } }");
+ QTest::newRow("label") << QString("function() { a: b; }") << QString("function () { a: b; }");
+ QTest::newRow("throw") << QString("function() { throw a; }") << QString("function () { throw a; }");
+ QTest::newRow("try-catch") << QString("function() { try { a; } catch (e) { b; } }") << QString("function () { try { a; } catch (e) { b; } }");
+ QTest::newRow("try-finally") << QString("function() { try { a; } finally { b; } }") << QString("function () { try { a; } finally { b; } }");
+ QTest::newRow("try-catch-finally") << QString("function() { try { a; } catch (e) { b; } finally { c; } }") << QString("function () { try { a; } catch (e) { b; } finally { c; } }");
+ QTest::newRow("a + b + c + d") << QString("function() { a + b + c + d; }") << QString("function () { a + b + c + d; }");
+ QTest::newRow("a + b - c") << QString("function() { a + b - c; }") << QString("function () { a + b - c; }");
+ QTest::newRow("a + -b") << QString("function() { a + -b; }") << QString("function () { a + -b; }");
+ QTest::newRow("a + ~b") << QString("function() { a + ~b; }") << QString("function () { a + ~b; }");
+ QTest::newRow("a + !b") << QString("function() { a + !b; }") << QString("function () { a + !b; }");
+ QTest::newRow("a + +b") << QString("function() { a + +b; }") << QString("function () { a + +b; }");
+ QTest::newRow("(a + b) - c") << QString("function() { (a + b) - c; }") << QString("function () { (a + b) - c; }");
+ QTest::newRow("(a - b + c") << QString("function() { a - b + c; }") << QString("function () { a - b + c; }");
+ QTest::newRow("(a - (b + c)") << QString("function() { a - (b + c); }") << QString("function () { a - (b + c); }");
+ QTest::newRow("a + -(b + c)") << QString("function() { a + -(b + c); }") << QString("function () { a + -(b + c); }");
+ QTest::newRow("a + ~(b + c)") << QString("function() { a + ~(b + c); }") << QString("function () { a + ~(b + c); }");
+ QTest::newRow("a + !(b + c)") << QString("function() { a + !(b + c); }") << QString("function () { a + !(b + c); }");
+ QTest::newRow("a + +(b + c)") << QString("function() { a + +(b + c); }") << QString("function () { a + +(b + c); }");
+ QTest::newRow("a + b * c") << QString("function() { a + b * c; }") << QString("function () { a + b * c; }");
+ QTest::newRow("(a + b) * c") << QString("function() { (a + b) * c; }") << QString("function () { (a + b) * c; }");
+ QTest::newRow("(a + b) * (c + d)") << QString("function() { (a + b) * (c + d); }") << QString("function () { (a + b) * (c + d); }");
+ QTest::newRow("a + (b * c)") << QString("function() { a + (b * c); }") << QString("function () { a + (b * c); }");
+ QTest::newRow("a + (b / c)") << QString("function() { a + (b / c); }") << QString("function () { a + (b / c); }");
+ QTest::newRow("(a / b) * c") << QString("function() { (a / b) * c; }") << QString("function () { (a / b) * c; }");
+ QTest::newRow("a / (b * c)") << QString("function() { a / (b * c); }") << QString("function () { a / (b * c); }");
+ QTest::newRow("a / (b % c)") << QString("function() { a / (b % c); }") << QString("function () { a / (b % c); }");
+ QTest::newRow("a && b || c") << QString("function() { a && b || c; }") << QString("function () { a && b || c; }");
+ QTest::newRow("a && (b || c)") << QString("function() { a && (b || c); }") << QString("function () { a && (b || c); }");
+ QTest::newRow("a & b | c") << QString("function() { a & b | c; }") << QString("function () { a & b | c; }");
+ QTest::newRow("a & (b | c)") << QString("function() { a & (b | c); }") << QString("function () { a & (b | c); }");
+ QTest::newRow("a & b | c ^ d") << QString("function() { a & b | c ^ d; }") << QString("function () { a & b | c ^ d; }");
+ QTest::newRow("a & (b | c ^ d)") << QString("function() { a & (b | c ^ d); }") << QString("function () { a & (b | c ^ d); }");
+ QTest::newRow("(a & b | c) ^ d") << QString("function() { (a & b | c) ^ d; }") << QString("function () { (a & b | c) ^ d; }");
+ QTest::newRow("a << b + c") << QString("function() { a << b + c; }") << QString("function () { a << b + c; }");
+ QTest::newRow("(a << b) + c") << QString("function() { (a << b) + c; }") << QString("function () { (a << b) + c; }");
+ QTest::newRow("a >> b + c") << QString("function() { a >> b + c; }") << QString("function () { a >> b + c; }");
+ QTest::newRow("(a >> b) + c") << QString("function() { (a >> b) + c; }") << QString("function () { (a >> b) + c; }");
+ QTest::newRow("a >>> b + c") << QString("function() { a >>> b + c; }") << QString("function () { a >>> b + c; }");
+ QTest::newRow("(a >>> b) + c") << QString("function() { (a >>> b) + c; }") << QString("function () { (a >>> b) + c; }");
+ QTest::newRow("a == b || c != d") << QString("function() { a == b || c != d; }") << QString("function () { a == b || c != d; }");
+ QTest::newRow("a == (b || c != d)") << QString("function() { a == (b || c != d); }") << QString("function () { a == (b || c != d); }");
+ QTest::newRow("a === b || c !== d") << QString("function() { a === b || c !== d; }") << QString("function () { a === b || c !== d; }");
+ QTest::newRow("a === (b || c !== d)") << QString("function() { a === (b || c !== d); }") << QString("function () { a === (b || c !== d); }");
+ QTest::newRow("a &= b + c") << QString("function() { a &= b + c; }") << QString("function () { a &= b + c; }");
+ QTest::newRow("debugger") << QString("function() { debugger; }") << QString("function () { debugger; }");
+}
+
+void tst_QJSValue::prettyPrinter()
+{
+ QFETCH(QString, function);
+ QFETCH(QString, expected);
+ QJSEngine eng;
+ QJSValue val = eng.evaluate("(" + function + ")");
+ QVERIFY(val.isCallable());
+ QString actual = val.toString();
+ int count = qMin(actual.size(), expected.size());
+ for (int i = 0; i < count; ++i) {
+ QCOMPARE(actual.at(i), expected.at(i));
+ }
+ QCOMPARE(actual.size(), expected.size());
+}
+
+void tst_QJSValue::engineDeleted()
+{
+ QJSEngine *eng = new QJSEngine;
+ QObject *temp = new QObject(); // Owned by JS engine, as newQObject() sets JS ownership explicitly
+ QJSValue v1 = eng->toScriptValue(123);
+ QVERIFY(v1.isNumber());
+ QJSValue v2 = eng->toScriptValue(QString("ciao"));
+ QVERIFY(v2.isString());
+ QJSValue v3 = eng->newObject();
+ QVERIFY(v3.isObject());
+ QJSValue v4 = eng->newQObject(temp);
+ QVERIFY(v4.isQObject());
+ QJSValue v5 = "Hello";
+ QVERIFY(v2.isString());
+
+ delete eng;
+
+ QVERIFY(v1.isUndefined());
+ QVERIFY(v1.engine() == 0);
+ QVERIFY(v2.isUndefined());
+ QVERIFY(v2.engine() == 0);
+ QVERIFY(v3.isUndefined());
+ QVERIFY(v3.engine() == 0);
+ QVERIFY(v4.isUndefined());
+ QVERIFY(v4.engine() == 0);
+ QVERIFY(v5.isString()); // was not bound to engine
+ QVERIFY(v5.engine() == 0);
+
+ QVERIFY(v3.property("foo").isUndefined());
+}
+
+void tst_QJSValue::valueOfWithClosure()
+{
+ QJSEngine eng;
+ // valueOf()
+ {
+ QJSValue obj = eng.evaluate("o = {}; (function(foo) { o.valueOf = function() { return foo; } })(123); o");
+ QVERIFY(obj.isObject());
+ QCOMPARE(obj.toInt(), 123);
+ }
+ // toString()
+ {
+ QJSValue obj = eng.evaluate("o = {}; (function(foo) { o.toString = function() { return foo; } })('ciao'); o");
+ QVERIFY(obj.isObject());
+ QCOMPARE(obj.toString(), QString::fromLatin1("ciao"));
+ }
+}
+
+void tst_QJSValue::nestedObjectToVariant_data()
+{
+ QTest::addColumn<QString>("program");
+ QTest::addColumn<QVariant>("expected");
+
+ // Array literals
+ QTest::newRow("[[]]")
+ << QString::fromLatin1("[[]]")
+ << QVariant(QVariantList() << (QVariant(QVariantList())));
+ QTest::newRow("[[123]]")
+ << QString::fromLatin1("[[123]]")
+ << QVariant(QVariantList() << (QVariant(QVariantList() << 123)));
+ QTest::newRow("[[], 123]")
+ << QString::fromLatin1("[[], 123]")
+ << QVariant(QVariantList() << QVariant(QVariantList()) << 123);
+
+ // Cyclic arrays
+ QTest::newRow("var a=[]; a.push(a)")
+ << QString::fromLatin1("var a=[]; a.push(a); a")
+ << QVariant(QVariantList() << QVariant(QVariantList()));
+ QTest::newRow("var a=[]; a.push(123, a)")
+ << QString::fromLatin1("var a=[]; a.push(123, a); a")
+ << QVariant(QVariantList() << 123 << QVariant(QVariantList()));
+ QTest::newRow("var a=[]; var b=[]; a.push(b); b.push(a)")
+ << QString::fromLatin1("var a=[]; var b=[]; a.push(b); b.push(a); a")
+ << QVariant(QVariantList() << QVariant(QVariantList() << QVariant(QVariantList())));
+ QTest::newRow("var a=[]; var b=[]; a.push(123, b); b.push(456, a)")
+ << QString::fromLatin1("var a=[]; var b=[]; a.push(123, b); b.push(456, a); a")
+ << QVariant(QVariantList() << 123 << QVariant(QVariantList() << 456 << QVariant(QVariantList())));
+
+ // Object literals
+ {
+ QVariantMap m;
+ QTest::newRow("{}")
+ << QString::fromLatin1("({})")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m;
+ m["a"] = QVariantMap();
+ QTest::newRow("{ a:{} }")
+ << QString::fromLatin1("({ a:{} })")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m, m2;
+ m2["b"] = 10;
+ m2["c"] = 20;
+ m["a"] = m2;
+ QTest::newRow("{ a:{b:10, c:20} }")
+ << QString::fromLatin1("({ a:{b:10, c:20} })")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m;
+ m["a"] = 10;
+ m["b"] = QVariantList() << 20 << 30;
+ QTest::newRow("{ a:10, b:[20, 30]}")
+ << QString::fromLatin1("({ a:10, b:[20,30]})")
+ << QVariant(m);
+ }
+
+ // Cyclic objects
+ {
+ QVariantMap m;
+ m["p"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=o")
+ << QString::fromLatin1("var o={}; o.p=o; o")
+ << QVariant(m);
+ }
+ {
+ QVariantMap m;
+ m["p"] = 123;
+ m["q"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=123; o.q=o")
+ << QString::fromLatin1("var o={}; o.p=123; o.q=o; o")
+ << QVariant(m);
+ }
+}
+
+void tst_QJSValue::nestedObjectToVariant()
+{
+ QJSEngine eng;
+ QFETCH(QString, program);
+ QFETCH(QVariant, expected);
+ QJSValue o = eng.evaluate(program);
+ QVERIFY(!o.isError());
+ QVERIFY(o.isObject());
+ QCOMPARE(o.toVariant(), expected);
+}
+
+QTEST_MAIN(tst_QJSValue)
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.h b/tests/auto/qml/qjsvalue/tst_qjsvalue.h
new file mode 100644
index 0000000000..02333d0139
--- /dev/null
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.h
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TST_QJSVALUE_H
+#define TST_QJSVALUE_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qnumeric.h>
+#include <qjsengine.h>
+#include <qjsvalue.h>
+#include <QtTest/QtTest>
+
+Q_DECLARE_METATYPE(QVariant)
+
+class tst_QJSValue : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSValue();
+ virtual ~tst_QJSValue();
+
+private slots:
+ void ctor_invalid();
+ void ctor_undefinedWithEngine();
+ void ctor_undefined();
+ void ctor_nullWithEngine();
+ void ctor_null();
+ void ctor_boolWithEngine();
+ void ctor_bool();
+ void ctor_intWithEngine();
+ void ctor_int();
+ void ctor_uintWithEngine();
+ void ctor_uint();
+ void ctor_floatWithEngine();
+ void ctor_float();
+ void ctor_stringWithEngine();
+ void ctor_string();
+ void ctor_copyAndAssignWithEngine();
+ void ctor_copyAndAssign();
+
+ void toString();
+ void toNumber();
+ void toBoolean();
+ void toBool();
+ void toInt();
+ void toUInt();
+ void toVariant();
+ void toQObject_nonQObject_data();
+ void toQObject_nonQObject();
+ void toQObject();
+ void toDateTime();
+ void toRegExp();
+ void isArray_data();
+ void isArray();
+ void isDate();
+ void isDate_data();
+ void isError_propertiesOfGlobalObject();
+ void isError_data();
+ void isError();
+ void isRegExp_data();
+ void isRegExp();
+
+ void equals();
+ void strictlyEquals();
+
+ void hasProperty_basic();
+ void hasProperty_globalObject();
+ void hasProperty_changePrototype();
+
+ void deleteProperty_basic();
+ void deleteProperty_globalObject();
+ void deleteProperty_inPrototype();
+
+ void getSetPrototype_cyclicPrototype();
+ void getSetPrototype_evalCyclicPrototype();
+ void getSetPrototype_eval();
+ void getSetPrototype_invalidPrototype();
+ void getSetPrototype_twoEngines();
+ void getSetPrototype_null();
+ void getSetPrototype_notObjectOrNull();
+ void getSetPrototype();
+ void getSetProperty_HooliganTask162051();
+ void getSetProperty_HooliganTask183072();
+ void getSetProperty_propertyRemoval();
+ void getSetProperty_resolveMode();
+ void getSetProperty_twoEngines();
+ void getSetProperty_gettersAndSettersThrowErrorJS();
+ void getSetProperty_array();
+ void getSetProperty();
+
+ void call_function();
+ void call_object();
+ void call_newObjects();
+ void call_this();
+ void call_arguments();
+ void call();
+ void call_twoEngines();
+ void call_nonFunction_data();
+ void call_nonFunction();
+ void construct_nonFunction_data();
+ void construct_nonFunction();
+ void construct_simple();
+ void construct_newObjectJS();
+ void construct_arg();
+ void construct_proto();
+ void construct_returnInt();
+ void construct_throw();
+ void construct_twoEngines();
+ void construct_constructorThrowsPrimitive();
+ void castToPointer();
+ void prettyPrinter_data();
+ void prettyPrinter();
+ void engineDeleted();
+ void valueOfWithClosure();
+ void nestedObjectToVariant_data();
+ void nestedObjectToVariant();
+
+private:
+ void newEngine()
+ {
+ if (engine)
+ delete engine;
+ engine = new QJSEngine();
+ }
+ QJSEngine *engine;
+};
+
+#endif
diff --git a/tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro b/tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro
new file mode 100644
index 0000000000..9f4d4fb371
--- /dev/null
+++ b/tests/auto/qml/qjsvalueiterator/qjsvalueiterator.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qjsvalueiterator
+macx:CONFIG -= app_bundle
+QT = core qml testlib
+SOURCES += tst_qjsvalueiterator.cpp
+
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp b/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp
new file mode 100644
index 0000000000..fa6ac3249b
--- /dev/null
+++ b/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp
@@ -0,0 +1,520 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QJSEngine>
+#include <QJSValue>
+#include <QJSValueIterator>
+
+class tst_QJSValueIterator : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSValueIterator();
+ virtual ~tst_QJSValueIterator();
+
+private slots:
+ void iterateForward_data();
+ void iterateForward();
+ void iterateArray_data();
+ void iterateArray();
+ void iterateString();
+#if 0
+ void iterateGetterSetter();
+#endif
+ void assignObjectToIterator();
+ void iterateNonObject();
+ void iterateOverObjectFromDeletedEngine();
+};
+
+tst_QJSValueIterator::tst_QJSValueIterator()
+{
+}
+
+tst_QJSValueIterator::~tst_QJSValueIterator()
+{
+}
+
+void tst_QJSValueIterator::iterateForward_data()
+{
+ QTest::addColumn<QStringList>("propertyNames");
+ QTest::addColumn<QStringList>("propertyValues");
+
+ QTest::newRow("no properties")
+ << QStringList() << QStringList();
+ QTest::newRow("foo=bar")
+ << (QStringList() << "foo")
+ << (QStringList() << "bar");
+ QTest::newRow("foo=bar, baz=123")
+ << (QStringList() << "foo" << "baz")
+ << (QStringList() << "bar" << "123");
+ QTest::newRow("foo=bar, baz=123, rab=oof")
+ << (QStringList() << "foo" << "baz" << "rab")
+ << (QStringList() << "bar" << "123" << "oof");
+}
+
+void tst_QJSValueIterator::iterateForward()
+{
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QStringList, propertyValues);
+ QMap<QString, QString> pmap;
+ QVERIFY(propertyNames.size() == propertyValues.size());
+
+ QJSEngine engine;
+ QJSValue object = engine.newObject();
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ QString name = propertyNames.at(i);
+ QString value = propertyValues.at(i);
+ pmap.insert(name, value);
+ object.setProperty(name, engine.toScriptValue(value));
+ }
+ QJSValue otherObject = engine.newObject();
+ otherObject.setProperty("foo", engine.toScriptValue(123456));
+ otherObject.setProperty("protoProperty", engine.toScriptValue(654321));
+ object.setPrototype(otherObject); // should not affect iterator
+
+ QStringList lst;
+ QJSValueIterator it(object);
+ while (!pmap.isEmpty()) {
+ QCOMPARE(it.hasNext(), true);
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QString name = it.name();
+ QCOMPARE(pmap.contains(name), true);
+ QCOMPARE(it.name(), name);
+ QCOMPARE(it.value().strictlyEquals(engine.toScriptValue(pmap.value(name))), true);
+ pmap.remove(name);
+ lst.append(name);
+ }
+
+ QCOMPARE(it.hasNext(), false);
+ QCOMPARE(it.hasNext(), false);
+
+ it = object;
+ for (int i = 0; i < lst.count(); ++i) {
+ QCOMPARE(it.hasNext(), true);
+ it.next();
+ QCOMPARE(it.name(), lst.at(i));
+ }
+}
+
+void tst_QJSValueIterator::iterateArray_data()
+{
+ QTest::addColumn<QStringList>("propertyNames");
+ QTest::addColumn<QStringList>("propertyValues");
+
+ QTest::newRow("no elements") << QStringList() << QStringList();
+
+ QTest::newRow("0=foo, 1=barr")
+ << (QStringList() << "0" << "1")
+ << (QStringList() << "foo" << "bar");
+
+
+ QTest::newRow("0=foo, 3=barr")
+ << (QStringList() << "0" << "1" << "2" << "3")
+ << (QStringList() << "foo" << "" << "" << "bar");
+}
+
+void tst_QJSValueIterator::iterateArray()
+{
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QStringList, propertyValues);
+
+ QJSEngine engine;
+ QJSValue array = engine.newArray();
+
+ // Fill the array
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ array.setProperty(propertyNames.at(i), propertyValues.at(i));
+ }
+
+ // Iterate thru array properties. Note that the QJSValueIterator doesn't guarantee
+ // any order on the iteration!
+ int length = array.property("length").toInt();
+ QCOMPARE(length, propertyNames.size());
+
+ bool iteratedThruLength = false;
+ QHash<QString, QJSValue> arrayProperties;
+ QJSValueIterator it(array);
+
+ // Iterate forward
+ while (it.hasNext()) {
+ it.next();
+
+ const QString name = it.name();
+ if (name == QString::fromLatin1("length")) {
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt(), length);
+ QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
+ iteratedThruLength = true;
+ continue;
+ }
+
+ // Storing the properties we iterate in a hash to compare with test data.
+ QVERIFY2(!arrayProperties.contains(name), "property appeared more than once during iteration.");
+ arrayProperties.insert(name, it.value());
+ QVERIFY(it.value().strictlyEquals(array.property(name)));
+ }
+
+ // Verify properties
+ QVERIFY(iteratedThruLength);
+ QCOMPARE(arrayProperties.size(), propertyNames.size());
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ QVERIFY(arrayProperties.contains(propertyNames.at(i)));
+ QCOMPARE(arrayProperties.value(propertyNames.at(i)).toString(), propertyValues.at(i));
+ }
+
+#if 0
+
+ // Iterate backwards
+ arrayProperties.clear();
+ iteratedThruLength = false;
+ it.toBack();
+
+ while (it.hasPrevious()) {
+ it.previous();
+
+ const QString name = it.name();
+ if (name == QString::fromLatin1("length")) {
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt(), length);
+ QCOMPARE(it.flags(), QScriptValue::SkipInEnumeration | QScriptValue::Undeletable);
+ QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
+ iteratedThruLength = true;
+ continue;
+ }
+
+ // Storing the properties we iterate in a hash to compare with test data.
+ QVERIFY2(!arrayProperties.contains(name), "property appeared more than once during iteration.");
+ arrayProperties.insert(name, it.value());
+ QCOMPARE(it.flags(), array.propertyFlags(name));
+ QVERIFY(it.value().strictlyEquals(array.property(name)));
+ }
+
+ // Verify properties
+ QVERIFY(iteratedThruLength);
+ QCOMPARE(arrayProperties.size(), propertyNames.size());
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ QVERIFY(arrayProperties.contains(propertyNames.at(i)));
+ QCOMPARE(arrayProperties.value(propertyNames.at(i)).toString(), propertyValues.at(i));
+ }
+
+ // ### Do we still need this test?
+ // Forward test again but as object
+ arrayProperties.clear();
+ iteratedThruLength = false;
+ QJSValue arrayObject = engine.toObject(array);
+ QJSValueIterator it2(arrayObject);
+
+ while (it2.hasNext()) {
+ it2.next();
+
+ const QString name = it2.name();
+ if (name == QString::fromLatin1("length")) {
+ QVERIFY(it2.value().isNumber());
+ QCOMPARE(it2.value().toInt(), length);
+ QCOMPARE(it2.flags(), QScriptValue::SkipInEnumeration | QScriptValue::Undeletable);
+ QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
+ iteratedThruLength = true;
+ continue;
+ }
+
+ // Storing the properties we iterate in a hash to compare with test data.
+ QVERIFY2(!arrayProperties.contains(name), "property appeared more than once during iteration.");
+ arrayProperties.insert(name, it2.value());
+ QCOMPARE(it2.flags(), arrayObject.propertyFlags(name));
+ QVERIFY(it2.value().strictlyEquals(arrayObject.property(name)));
+ }
+
+ // Verify properties
+ QVERIFY(iteratedThruLength);
+ QCOMPARE(arrayProperties.size(), propertyNames.size());
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ QVERIFY(arrayProperties.contains(propertyNames.at(i)));
+ QCOMPARE(arrayProperties.value(propertyNames.at(i)).toString(), propertyValues.at(i));
+ }
+#endif
+}
+
+void tst_QJSValueIterator::iterateString()
+{
+ QJSEngine engine;
+ QJSValue obj = engine.evaluate("new String('ciao')");
+ QVERIFY(obj.property("length").isNumber());
+ int length = obj.property("length").toInt();
+ QCOMPARE(length, 4);
+
+ QJSValueIterator it(obj);
+ QHash<QString, QJSValue> stringProperties;
+ bool iteratedThruLength = false;
+
+ while (it.hasNext()) {
+ it.next();
+ const QString name = it.name();
+
+ if (name == QString::fromLatin1("length")) {
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt(), length);
+ QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
+ iteratedThruLength = true;
+ continue;
+ }
+
+ QVERIFY2(!stringProperties.contains(name), "property appeared more than once during iteration.");
+ stringProperties.insert(name, it.value());
+ QVERIFY(it.value().strictlyEquals(obj.property(name)));
+ }
+
+ QVERIFY(iteratedThruLength);
+ QCOMPARE(stringProperties.size(), length);
+#if 0
+ // And going backwards
+ iteratedThruLength = false;
+ stringProperties.clear();
+ it.toBack();
+
+ while (it.hasPrevious()) {
+ it.previous();
+ const QString name = it.name();
+
+ if (name == QString::fromLatin1("length")) {
+ QVERIFY(it.value().isNumber());
+ QCOMPARE(it.value().toInt(), length);
+ QVERIFY2(!iteratedThruLength, "'length' appeared more than once during iteration.");
+ iteratedThruLength = true;
+ continue;
+ }
+
+ QVERIFY2(!stringProperties.contains(name), "property appeared more than once during iteration.");
+ stringProperties.insert(name, it.value());
+ QVERIFY(it.value().strictlyEquals(obj.property(name)));
+ }
+#endif
+}
+
+#if 0 // FIXME what we should to keep from here?
+static QJSValue myGetterSetter(QScriptContext *ctx, QJSEngine *)
+{
+ if (ctx->argumentCount() == 1)
+ ctx->thisObject().setProperty("bar", ctx->argument(0));
+ return ctx->thisObject().property("bar");
+}
+
+static QJSValue myGetter(QScriptContext *ctx, QJSEngine *)
+{
+ return ctx->thisObject().property("bar");
+}
+
+static QJSValue mySetter(QScriptContext *ctx, QJSEngine *)
+{
+ ctx->thisObject().setProperty("bar", ctx->argument(0));
+ return ctx->argument(0);
+}
+
+void tst_QJSValueIterator::iterateGetterSetter()
+{
+ // unified getter/setter function
+ {
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ obj.setProperty("foo", eng.newFunction(myGetterSetter),
+ QScriptValue::PropertyGetter | QScriptValue::PropertySetter);
+ QJSValue val(&eng, 123);
+ obj.setProperty("foo", val);
+ QVERIFY(obj.property("bar").strictlyEquals(val));
+ QVERIFY(obj.property("foo").strictlyEquals(val));
+
+ QJSValueIterator it(obj);
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+ QCOMPARE(it.flags(), QScriptValue::PropertyFlags(QScriptValue::PropertyGetter | QScriptValue::PropertySetter));
+ QVERIFY(it.value().strictlyEquals(val));
+ QJSValue val2(&eng, 456);
+ it.setValue(val2);
+ QVERIFY(obj.property("bar").strictlyEquals(val2));
+ QVERIFY(obj.property("foo").strictlyEquals(val2));
+
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+ QVERIFY(!it.hasNext());
+
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+ QCOMPARE(it.flags(), QScriptValue::PropertyFlags(QScriptValue::PropertyGetter | QScriptValue::PropertySetter));
+ QVERIFY(it.value().strictlyEquals(val2));
+ it.setValue(val);
+ QVERIFY(obj.property("bar").strictlyEquals(val));
+ QVERIFY(obj.property("foo").strictlyEquals(val));
+ }
+ // separate getter/setter function
+ for (int x = 0; x < 2; ++x) {
+ QJSEngine eng;
+ QJSValue obj = eng.newObject();
+ if (x == 0) {
+ obj.setProperty("foo", eng.newFunction(myGetter), QScriptValue::PropertyGetter);
+ obj.setProperty("foo", eng.newFunction(mySetter), QScriptValue::PropertySetter);
+ } else {
+ obj.setProperty("foo", eng.newFunction(mySetter), QScriptValue::PropertySetter);
+ obj.setProperty("foo", eng.newFunction(myGetter), QScriptValue::PropertyGetter);
+ }
+ QJSValue val(&eng, 123);
+ obj.setProperty("foo", val);
+ QVERIFY(obj.property("bar").strictlyEquals(val));
+ QVERIFY(obj.property("foo").strictlyEquals(val));
+
+ QJSValueIterator it(obj);
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+ QVERIFY(it.value().strictlyEquals(val));
+ QJSValue val2(&eng, 456);
+ it.setValue(val2);
+ QVERIFY(obj.property("bar").strictlyEquals(val2));
+ QVERIFY(obj.property("foo").strictlyEquals(val2));
+
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+ QVERIFY(!it.hasNext());
+
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+ QVERIFY(it.hasPrevious());
+ it.previous();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+ QVERIFY(it.value().strictlyEquals(val2));
+ it.setValue(val);
+ QVERIFY(obj.property("bar").strictlyEquals(val));
+ QVERIFY(obj.property("foo").strictlyEquals(val));
+ }
+}
+#endif
+
+void tst_QJSValueIterator::assignObjectToIterator()
+{
+ QJSEngine eng;
+ QJSValue obj1 = eng.newObject();
+ obj1.setProperty("foo", 123);
+ QJSValue obj2 = eng.newObject();
+ obj2.setProperty("bar", 456);
+
+ QJSValueIterator it(obj1);
+ QVERIFY(it.hasNext());
+ it.next();
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj1;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("foo"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+
+ it = obj2;
+ QVERIFY(it.hasNext());
+ it.next();
+ QCOMPARE(it.name(), QString::fromLatin1("bar"));
+}
+
+void tst_QJSValueIterator::iterateNonObject()
+{
+ QJSValueIterator it(123);
+ QVERIFY(!it.hasNext());
+ it.next();
+ it.name();
+ it.value();
+ QJSValue num(5);
+ it = num;
+ QVERIFY(!it.hasNext());
+}
+
+void tst_QJSValueIterator::iterateOverObjectFromDeletedEngine()
+{
+ QJSEngine *engine = new QJSEngine;
+ QJSValue objet = engine->newObject();
+
+ // populate object with properties
+ QHash<QString, int> properties;
+ properties.insert("foo",1235);
+ properties.insert("oof",5321);
+ properties.insert("ofo",3521);
+ QHash<QString, int>::const_iterator i = properties.constBegin();
+ for (; i != properties.constEnd(); ++i) {
+ objet.setProperty(i.key(), i.value());
+ }
+
+ // start iterating
+ QJSValueIterator it(objet);
+ it.next();
+ QVERIFY(properties.contains(it.name()));
+
+ delete engine;
+
+ QVERIFY(objet.isUndefined());
+ QVERIFY(it.name().isEmpty());
+ QVERIFY(it.value().isUndefined());
+
+ QVERIFY(!it.hasNext());
+ it.next();
+
+ QVERIFY(it.name().isEmpty());
+ QVERIFY(it.value().isUndefined());
+
+}
+
+QTEST_MAIN(tst_QJSValueIterator)
+#include "tst_qjsvalueiterator.moc"
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
new file mode 100644
index 0000000000..b973d44012
--- /dev/null
+++ b/tests/auto/qml/qml.pro
@@ -0,0 +1,71 @@
+TEMPLATE = subdirs
+
+METATYPETESTS += \
+ qqmlmetatype
+
+PUBLICTESTS += \
+ parserstress \
+ qjsvalueiterator \
+ qjsonbinding \
+ qmlmin \
+ qmlplugindump \
+ qqmlcomponent \
+ qqmlconsole \
+ qqmlengine \
+ qqmlerror \
+ qqmlincubator \
+ qqmlinfo \
+ qqmllistreference \
+ qqmllocale \
+ qqmlmetaobject \
+ qqmlmoduleplugin \
+ qqmlnotifier \
+ qqmlqt \
+ qqmltranslation \
+ qqmlxmlhttprequest \
+ qtqmlmodules \
+ qquickfolderlistmodel \
+ qqmlapplicationengine
+
+PRIVATETESTS += \
+ animation \
+ qqmlcpputils \
+ qqmlecmascript \
+ qqmlcontext \
+ qqmlexpression \
+ qqmlglobal \
+ qqmlinstruction \
+ qqmllanguage \
+ qqmlproperty \
+ qqmlpropertycache \
+ qqmlpropertymap \
+ qqmlsqldatabase \
+ qqmlvaluetypes \
+ qqmlvaluetypeproviders \
+ qqmlbinding \
+ qqmlchangeset \
+ qqmlconnections \
+ qqmllistcompositor \
+ qqmllistmodel \
+ qqmllistmodelworkerscript \
+ qqmlparser \
+ qquickworkerscript \
+ qqmlbundle \
+ qrcqml \
+ v4 \
+ qqmltimer \
+ qqmlinstantiator
+
+qtHaveModule(widgets) {
+ PUBLICTESTS += \
+ qjsengine \
+ qjsvalue
+}
+
+SUBDIRS += $$PUBLICTESTS
+SUBDIRS += $$METATYPETESTS
+SUBDIRS += debugger
+
+contains(QT_CONFIG, private_tests) {
+ SUBDIRS += $$PRIVATETESTS
+}
diff --git a/tests/auto/qml/qmlmin/qmlmin.pro b/tests/auto/qml/qmlmin/qmlmin.pro
new file mode 100644
index 0000000000..03b60aea19
--- /dev/null
+++ b/tests/auto/qml/qmlmin/qmlmin.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qmlmin
+QT += qml testlib gui-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qmlmin.cpp
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+cross_compile: DEFINES += QTEST_CROSS_COMPILED
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
new file mode 100644
index 0000000000..65549efddc
--- /dev/null
+++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
@@ -0,0 +1,218 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QLibraryInfo>
+#include <QDir>
+#include <QProcess>
+#include <QDebug>
+#include <QQmlError>
+#include <cstdlib>
+
+class tst_qmlmin : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlmin();
+
+private slots:
+ void initTestCase();
+#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
+ void qmlMinify_data();
+ void qmlMinify();
+#endif
+
+private:
+ QString qmlminPath;
+ QStringList excludedDirs;
+ QStringList invalidFiles;
+
+ QStringList findFiles(const QDir &);
+ bool isInvalidFile(const QFileInfo &fileName) const;
+};
+
+tst_qmlmin::tst_qmlmin()
+{
+}
+
+void tst_qmlmin::initTestCase()
+{
+ qmlminPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmlmin");
+#ifdef Q_OS_WIN
+ qmlminPath += QLatin1String(".exe");
+#endif
+ if (!QFileInfo(qmlminPath).exists()) {
+ QString message = QString::fromLatin1("qmlmin executable not found (looked for %0)")
+ .arg(qmlminPath);
+ QFAIL(qPrintable(message));
+ }
+
+ // Add directories you want excluded here
+
+ // These snippets are not expected to run on their own.
+ excludedDirs << "doc/src/snippets/qml/visualdatamodel_rootindex";
+ excludedDirs << "doc/src/snippets/qml/qtbinding";
+ excludedDirs << "doc/src/snippets/qml/imports";
+ excludedDirs << "doc/src/snippets/qtquick1/visualdatamodel_rootindex";
+ excludedDirs << "doc/src/snippets/qtquick1/qtbinding";
+ excludedDirs << "doc/src/snippets/qtquick1/imports";
+
+ // Add invalid files (i.e. files with syntax errors)
+ invalidFiles << "tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.2.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.3.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.5.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/property.4.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/empty.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/missingObject.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml";
+ invalidFiles << "tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml";
+ invalidFiles << "tests/auto/qml/qquickfolderlistmodel/data/dummy.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/qtbug_22843.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.js";
+ invalidFiles << "tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js";
+ invalidFiles << "tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-02-n.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.js";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml";
+ invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml";
+}
+
+QStringList tst_qmlmin::findFiles(const QDir &d)
+{
+ for (int ii = 0; ii < excludedDirs.count(); ++ii) {
+ QString s = excludedDirs.at(ii);
+ if (d.absolutePath().endsWith(s))
+ return QStringList();
+ }
+
+ QStringList rv;
+
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"),
+ QDir::Files);
+ foreach (const QString &file, files) {
+ rv << d.absoluteFilePath(file);
+ }
+
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QDir::NoSymLinks);
+ foreach (const QString &dir, dirs) {
+ QDir sub = d;
+ sub.cd(dir);
+ rv << findFiles(sub);
+ }
+
+ return rv;
+}
+
+bool tst_qmlmin::isInvalidFile(const QFileInfo &fileName) const
+{
+ foreach (const QString &invalidFile, invalidFiles) {
+ if (fileName.absoluteFilePath().endsWith(invalidFile))
+ return true;
+ }
+ return false;
+}
+
+/*
+This test runs all the examples in the QtQml UI source tree and ensures
+that they start and exit cleanly.
+
+Examples are any .qml files under the examples/ directory that start
+with a lower case letter.
+*/
+
+#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
+void tst_qmlmin::qmlMinify_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QString examples = QLatin1String(SRCDIR) + "/../../../../examples/";
+ QString tests = QLatin1String(SRCDIR) + "/../../../../tests/";
+
+ QStringList files;
+ files << findFiles(QDir(examples));
+ files << findFiles(QDir(tests));
+
+ foreach (const QString &file, files)
+ QTest::newRow(qPrintable(file)) << file;
+}
+#endif
+
+#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
+void tst_qmlmin::qmlMinify()
+{
+ QFETCH(QString, file);
+
+ QProcess qmlminify;
+
+ // Restrict line width to 100 characters
+ qmlminify.start(qmlminPath, QStringList() << QLatin1String("--verify-only") << QLatin1String("-w100") << file);
+ qmlminify.waitForFinished();
+
+ QCOMPARE(qmlminify.error(), QProcess::UnknownError);
+ QCOMPARE(qmlminify.exitStatus(), QProcess::NormalExit);
+
+ if (isInvalidFile(file))
+ QCOMPARE(qmlminify.exitCode(), EXIT_FAILURE); // cannot minify files with syntax errors
+ else
+ QCOMPARE(qmlminify.exitCode(), 0);
+}
+#endif
+
+QTEST_MAIN(tst_qmlmin)
+
+#include "tst_qmlmin.moc"
diff --git a/tests/auto/qml/qmlplugindump/qmlplugindump.pro b/tests/auto/qml/qmlplugindump/qmlplugindump.pro
new file mode 100644
index 0000000000..902bcad585
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/qmlplugindump.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+TARGET = tst_qmlplugindump
+QT += testlib gui-private
+macx:CONFIG -= app_bundle
+CONFIG += parallel_test
+
+SOURCES += tst_qmlplugindump.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
new file mode 100644
index 0000000000..6aca47656b
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QLibraryInfo>
+#include <QDir>
+#include <QProcess>
+#include <QDebug>
+#include <cstdlib>
+
+class tst_qmlplugindump : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlplugindump();
+
+private slots:
+ void initTestCase();
+ void builtins();
+
+private:
+ QString qmlplugindumpPath;
+};
+
+tst_qmlplugindump::tst_qmlplugindump()
+{
+}
+
+void tst_qmlplugindump::initTestCase()
+{
+ qmlplugindumpPath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
+
+#if defined(Q_OS_MAC)
+ qmlplugindumpPath += QLatin1String("/qmlplugindump.app/Contents/MacOS/qmlplugindump");
+#elif defined(Q_OS_WIN)
+ qmlplugindumpPath += QLatin1String("/qmlplugindump.exe");
+#else
+ qmlplugindumpPath += QLatin1String("/qmlplugindump");
+#endif
+
+ if (!QFileInfo(qmlplugindumpPath).exists()) {
+ QString message = QString::fromLatin1("qmlplugindump executable not found (looked for %0)")
+ .arg(qmlplugindumpPath);
+ QFAIL(qPrintable(message));
+ }
+}
+
+void tst_qmlplugindump::builtins()
+{
+ QProcess dumper;
+ QStringList args;
+ args += QLatin1String("-builtins");
+ dumper.start(qmlplugindumpPath, args);
+ dumper.waitForFinished();
+
+ if (dumper.error() != QProcess::UnknownError
+ || dumper.exitStatus() != QProcess::NormalExit) {
+ qWarning() << QString("Error while running '%1 %2'").arg(
+ qmlplugindumpPath, args.join(QLatin1String(" ")));
+ }
+
+ if (dumper.error() == QProcess::FailedToStart) {
+ QFAIL("failed to start");
+ }
+ if (dumper.error() == QProcess::Crashed) {
+ qWarning() << "stderr:\n" << dumper.readAllStandardError();
+ QFAIL("crashed");
+ }
+
+ QCOMPARE(dumper.error(), QProcess::UnknownError);
+ QCOMPARE(dumper.exitStatus(), QProcess::NormalExit);
+
+ const QString &result = dumper.readAllStandardOutput();
+ QVERIFY(result.contains(QLatin1String("Module {")));
+}
+
+QTEST_MAIN(tst_qmlplugindump)
+
+#include "tst_qmlplugindump.moc"
diff --git a/tests/auto/qml/qqmlapplicationengine/data/TestItem.qml b/tests/auto/qml/qqmlapplicationengine/data/TestItem.qml
new file mode 100644
index 0000000000..e879577e10
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/TestItem.qml
@@ -0,0 +1,4 @@
+import QtQml 2.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml
new file mode 100644
index 0000000000..2a1b4fbf57
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml
@@ -0,0 +1,14 @@
+import QtQml 2.0
+
+QtObject {
+ property string originalName
+ property string originalVersion
+ property string currentName: Qt.application.name
+ property string currentVersion: Qt.application.version
+ Component.onCompleted: {
+ originalName = Qt.application.name
+ originalVersion = Qt.application.version
+ Qt.application.name = "Test B"
+ Qt.application.version = "0.0B"
+ }
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/data/basicTest.qml b/tests/auto/qml/qqmlapplicationengine/data/basicTest.qml
new file mode 100644
index 0000000000..837835f6df
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/data/basicTest.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property bool success: true
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/qqmlapplicationengine.pro b/tests/auto/qml/qqmlapplicationengine/qqmlapplicationengine.pro
new file mode 100644
index 0000000000..4a2dde7c47
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/qqmlapplicationengine.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = tst_qqmlapplicationengine.pro \
+ testapp
diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/main.cpp b/tests/auto/qml/qqmlapplicationengine/testapp/main.cpp
new file mode 100644
index 0000000000..fe64bb35ad
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/testapp/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QQmlApplicationEngine>
+
+int main (int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+ QQmlApplicationEngine e(QUrl("qrc:///main.qml"));
+ return app.exec();
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/main.qml b/tests/auto/qml/qqmlapplicationengine/testapp/main.qml
new file mode 100644
index 0000000000..c75485a7f7
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/testapp/main.qml
@@ -0,0 +1,11 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+ property Timer t: Timer { interval: 1; running: true; onTriggered: Qt.quit(); }
+ property Connections c: Connections {
+ target: Qt.application
+ onAboutToQuit: console.log("End");
+ }
+ Component.onCompleted: console.log("Start: " + Qt.application.arguments[1]);
+}
diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/main.qrc b/tests/auto/qml/qqmlapplicationengine/testapp/main.qrc
new file mode 100644
index 0000000000..5f6483ac33
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/testapp/main.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/testapp.pro b/tests/auto/qml/qqmlapplicationengine/testapp/testapp.pro
new file mode 100644
index 0000000000..34d2718178
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/testapp/testapp.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+TARGET = testapp
+DESTDIR = ./
+CONFIG -= app_bundle
+CONFIG += console
+
+QT += qml
+
+# Input
+SOURCES += main.cpp
+RESOURCES += main.qrc
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
new file mode 100644
index 0000000000..1c11fcbc73
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../shared/util.h"
+#include <QQmlApplicationEngine>
+#include <QSignalSpy>
+#include <QProcess>
+#include <QDebug>
+
+class tst_qqmlapplicationengine : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlapplicationengine() {}
+
+
+private slots:
+ void initTestCase();
+ void basicLoading();
+ void application();
+ void applicationProperties();
+private:
+ QString buildDir;
+ QString srcDir;
+};
+
+void tst_qqmlapplicationengine::initTestCase()
+{
+ buildDir = QDir::currentPath();
+ QQmlDataTest::initTestCase(); //Changes current path to src dir
+ srcDir = QDir::currentPath();
+}
+
+void tst_qqmlapplicationengine::basicLoading()
+{
+ int size = 0;
+
+ QQmlApplicationEngine *test = new QQmlApplicationEngine(testFileUrl("basicTest.qml"));
+ QCOMPARE(test->rootObjects().size(), ++size);
+ QVERIFY(test->rootObjects()[size -1]);
+ QVERIFY(test->rootObjects()[size -1]->property("success").toBool());
+
+ QSignalSpy objectCreated(test, SIGNAL(objectCreated(QObject*,const QUrl&)));
+ test->load(testFileUrl("basicTest.qml"));
+ QCOMPARE(objectCreated.count(), size);//one less than rootObjects().size() because we missed the first one
+ QCOMPARE(test->rootObjects().size(), ++size);
+ QVERIFY(test->rootObjects()[size -1]);
+ QVERIFY(test->rootObjects()[size -1]->property("success").toBool());
+
+ QByteArray testQml("import QtQml 2.0; QtObject{property bool success: true; property TestItem t: TestItem{}}");
+ test->loadData(testQml, testFileUrl("dynamicTest.qml"));
+ QCOMPARE(objectCreated.count(), size);
+ QCOMPARE(test->rootObjects().size(), ++size);
+ QVERIFY(test->rootObjects()[size -1]);
+ QVERIFY(test->rootObjects()[size -1]->property("success").toBool());
+
+ delete test;
+}
+
+void tst_qqmlapplicationengine::application()
+{
+ /* This test batches together some tests about running an external application
+ written with QQmlApplicationEngine. The application tests the following functionality
+ which is easier to do by watching a separate process:
+ -Loads relative paths from the working directory
+ -quits when quit is called
+ -emits aboutToQuit after quit is called
+ -has access to application command line arguments
+
+ Note that checking the output means that on builds with extra debugging, this might fail with a false positive.
+ Also the testapp is automatically built and installed in shadow builds, so it does NOT use testData
+ */
+ QDir::setCurrent(buildDir);
+ QProcess *testProcess = new QProcess(this);
+ QTest::ignoreMessage(QtWarningMsg, "Don't know how to handle 'QProcess::ExitStatus', use qRegisterMetaType to register it.");
+ QSignalSpy processFinished(testProcess, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QStringList args;
+ args << QLatin1String("testData");
+ testProcess->start(QLatin1String("testapp/testapp"), args);
+ QTRY_VERIFY(processFinished.count());//Application should immediately exit
+ QCOMPARE(processFinished[0][0].toInt(), 0);
+ QByteArray test_stdout = testProcess->readAllStandardOutput();
+ QByteArray test_stderr = testProcess->readAllStandardError();
+ QByteArray test_stderr_target("Start: testData\nEnd\n");
+#ifdef Q_OS_WIN
+ test_stderr_target.replace('\n', QByteArray("\r\n"));
+#endif
+ QCOMPARE(test_stdout, QByteArray(""));
+ QCOMPARE(test_stderr, test_stderr_target);
+ delete testProcess;
+ QDir::setCurrent(srcDir);
+}
+
+void tst_qqmlapplicationengine::applicationProperties()
+{
+ QCoreApplication* coreApp = QCoreApplication::instance();
+ QString originalName = coreApp->applicationName();
+ QString originalVersion = coreApp->applicationVersion();
+ QString firstName = QLatin1String("Test A");
+ QString firstVersion = QLatin1String("0.0A");
+ QString secondName = QLatin1String("Test B");
+ QString secondVersion = QLatin1String("0.0B");
+
+ coreApp->setApplicationName(firstName);
+ coreApp->setApplicationVersion(firstVersion);
+
+ QQmlApplicationEngine *test = new QQmlApplicationEngine(testFileUrl("applicationTest.qml"));
+ QObject* root = test->rootObjects().at(0);
+ QVERIFY(root);
+ QCOMPARE(root->property("originalName").toString(), firstName);
+ QCOMPARE(root->property("originalVersion").toString(), firstVersion);
+ QCOMPARE(root->property("currentName").toString(), secondName);
+ QCOMPARE(root->property("currentVersion").toString(), secondVersion);
+ QCOMPARE(coreApp->applicationName(), secondName);
+ QCOMPARE(coreApp->applicationVersion(), secondVersion);
+
+ coreApp->setApplicationName(originalName);
+ coreApp->setApplicationVersion(originalVersion);
+ delete test;
+}
+
+QTEST_MAIN(tst_qqmlapplicationengine)
+
+#include "tst_qqmlapplicationengine.moc"
diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro
new file mode 100644
index 0000000000..18c38a80b6
--- /dev/null
+++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qqmlapplicationengine
+macx:CONFIG -= app_bundle
+
+
+SOURCES += tst_qqmlapplicationengine.cpp
+TESTDATA += data/*
+
+include (../../shared/util.pri)
+QT += core-private gui-private qml-private network testlib
diff --git a/tests/auto/qml/qqmlbinding/data/deletedObject.qml b/tests/auto/qml/qqmlbinding/data/deletedObject.qml
new file mode 100644
index 0000000000..f9cf869ba3
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/deletedObject.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 400
+ height: 400
+
+ property bool activateBinding: false
+
+ Binding {
+ id: binding
+ target: Qt.createQmlObject('import QtQuick 2.0; Item { property real value: 10 }', wrapper)
+ property: "value"
+ when: activateBinding
+ value: x + y
+ }
+
+ Component.onCompleted: binding.target.destroy();
+
+// MouseArea {
+// anchors.fill: parent
+// onClicked: activateBinding = true;
+// }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/restoreBinding.qml b/tests/auto/qml/qqmlbinding/data/restoreBinding.qml
new file mode 100644
index 0000000000..9491c0f1d3
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/restoreBinding.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: myItem
+ objectName: "myItem"
+ width: 100
+ height: 100
+ color: "green"
+ x: 100 - myItem.y
+
+ Binding on x {
+ when: myItem.y > 50
+ value: myItem.y
+ }
+
+ /*NumberAnimation on y {
+ loops: Animation.Infinite
+ to: 100
+ duration: 1000
+ }*/
+ }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/restoreBindingWithLoop.qml b/tests/auto/qml/qqmlbinding/data/restoreBindingWithLoop.qml
new file mode 100644
index 0000000000..ee07104817
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/restoreBindingWithLoop.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ property bool activateBinding: false
+
+ Rectangle {
+ id: myItem
+ objectName: "myItem"
+ width: 100
+ height: 100
+ color: "green"
+ x: myItem.y + 100
+ onXChanged: { if (x == 188) y = 90; } //create binding loop
+
+ Binding on x {
+ when: activateBinding
+ value: myItem.y
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml b/tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml
new file mode 100644
index 0000000000..0c63a16213
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ states: State {
+ name: "state1"
+ PropertyChanges {
+ target: myItem
+ x: 200 - myItem.y
+ }
+ }
+
+ Rectangle {
+ id: myItem
+ objectName: "myItem"
+ width: 100
+ height: 100
+ color: "green"
+ x: 100 - myItem.y
+
+ Binding on x {
+ when: myItem.y > 50
+ value: myItem.y
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/test-binding.qml b/tests/auto/qml/qqmlbinding/data/test-binding.qml
new file mode 100644
index 0000000000..87aabe975a
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/test-binding.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: screen
+ width: 320; height: 240
+ property string text
+ property bool changeColor: false
+
+ Text { id: s1; text: "Hello" }
+ Rectangle { id: r1; width: 1; height: 1; color: "yellow" }
+ Rectangle { id: r2; width: 1; height: 1; color: "red" }
+
+ Binding { target: screen; property: "text"; value: s1.text; objectName: "binding1" }
+ Binding { target: screen; property: "color"; value: r1.color }
+ Binding { target: screen; property: "color"; when: screen.changeColor == true; value: r2.color; objectName: "binding3" }
+}
diff --git a/tests/auto/qml/qqmlbinding/data/test-binding2.qml b/tests/auto/qml/qqmlbinding/data/test-binding2.qml
new file mode 100644
index 0000000000..4a08141d11
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/data/test-binding2.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: screen
+ width: 320; height: 240
+ property string text
+ property bool changeColor: false
+
+ Text { id: s1; text: "Hello" }
+ Rectangle { id: r1; width: 1; height: 1; color: "yellow" }
+ Rectangle { id: r2; width: 1; height: 1; color: "red" }
+
+ Binding { target: screen; property: "text"; value: s1.text }
+ Binding { target: screen; property: "color"; value: r1.color }
+ Binding { target: screen; property: "color"; value: r2.color; when: screen.changeColor == true }
+}
diff --git a/tests/auto/qml/qqmlbinding/qqmlbinding.pro b/tests/auto/qml/qqmlbinding/qqmlbinding.pro
new file mode 100644
index 0000000000..35a5f1ca74
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/qqmlbinding.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlbinding
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlbinding.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
new file mode 100644
index 0000000000..dfe5c6937a
--- /dev/null
+++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <private/qqmlbind_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include "../../shared/util.h"
+
+class tst_qqmlbinding : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlbinding();
+
+private slots:
+ void binding();
+ void whenAfterValue();
+ void restoreBinding();
+ void restoreBindingWithLoop();
+ void restoreBindingWithoutCrash();
+ void deletedObject();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qqmlbinding::tst_qqmlbinding()
+{
+}
+
+void tst_qqmlbinding::binding()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-binding.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQmlBind *binding3 = qobject_cast<QQmlBind*>(rect->findChild<QQmlBind*>("binding3"));
+ QVERIFY(binding3 != 0);
+
+ QCOMPARE(rect->color(), QColor("yellow"));
+ QCOMPARE(rect->property("text").toString(), QString("Hello"));
+ QCOMPARE(binding3->when(), false);
+
+ rect->setProperty("changeColor", true);
+ QCOMPARE(rect->color(), QColor("red"));
+
+ QCOMPARE(binding3->when(), true);
+
+ QQmlBind *binding = qobject_cast<QQmlBind*>(rect->findChild<QQmlBind*>("binding1"));
+ QVERIFY(binding != 0);
+ QCOMPARE(binding->object(), qobject_cast<QObject*>(rect));
+ QCOMPARE(binding->property(), QLatin1String("text"));
+ QCOMPARE(binding->value().toString(), QLatin1String("Hello"));
+
+ delete rect;
+}
+
+void tst_qqmlbinding::whenAfterValue()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-binding2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+
+ QVERIFY(rect != 0);
+ QCOMPARE(rect->color(), QColor("yellow"));
+ QCOMPARE(rect->property("text").toString(), QString("Hello"));
+
+ rect->setProperty("changeColor", true);
+ QCOMPARE(rect->color(), QColor("red"));
+
+ delete rect;
+}
+
+void tst_qqmlbinding::restoreBinding()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("restoreBinding.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *myItem = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("myItem"));
+ QVERIFY(myItem != 0);
+
+ myItem->setY(25);
+ QCOMPARE(myItem->x(), qreal(100-25));
+
+ myItem->setY(13);
+ QCOMPARE(myItem->x(), qreal(100-13));
+
+ //Binding takes effect
+ myItem->setY(51);
+ QCOMPARE(myItem->x(), qreal(51));
+
+ myItem->setY(88);
+ QCOMPARE(myItem->x(), qreal(88));
+
+ //original binding restored
+ myItem->setY(49);
+ QCOMPARE(myItem->x(), qreal(100-49));
+
+ delete rect;
+}
+
+void tst_qqmlbinding::restoreBindingWithLoop()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("restoreBindingWithLoop.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *myItem = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("myItem"));
+ QVERIFY(myItem != 0);
+
+ myItem->setY(25);
+ QCOMPARE(myItem->x(), qreal(25 + 100));
+
+ myItem->setY(13);
+ QCOMPARE(myItem->x(), qreal(13 + 100));
+
+ //Binding takes effect
+ rect->setProperty("activateBinding", true);
+ myItem->setY(51);
+ QCOMPARE(myItem->x(), qreal(51));
+
+ myItem->setY(88);
+ QCOMPARE(myItem->x(), qreal(88));
+
+ //original binding restored
+ QString warning = c.url().toString() + QLatin1String(":9:5: QML Rectangle: Binding loop detected for property \"x\"");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ rect->setProperty("activateBinding", false);
+ QCOMPARE(myItem->x(), qreal(88 + 100)); //if loop handling changes this could be 90 + 100
+
+ myItem->setY(49);
+ QCOMPARE(myItem->x(), qreal(49 + 100));
+
+ delete rect;
+}
+
+void tst_qqmlbinding::restoreBindingWithoutCrash()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("restoreBindingWithoutCrash.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *myItem = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("myItem"));
+ QVERIFY(myItem != 0);
+
+ myItem->setY(25);
+ QCOMPARE(myItem->x(), qreal(100-25));
+
+ myItem->setY(13);
+ QCOMPARE(myItem->x(), qreal(100-13));
+
+ //Binding takes effect
+ myItem->setY(51);
+ QCOMPARE(myItem->x(), qreal(51));
+
+ myItem->setY(88);
+ QCOMPARE(myItem->x(), qreal(88));
+
+ //state sets a new binding
+ rect->setState("state1");
+ //this binding temporarily takes effect. We may want to change this behavior in the future
+ QCOMPARE(myItem->x(), qreal(112));
+
+ //Binding still controls this value
+ myItem->setY(104);
+ QCOMPARE(myItem->x(), qreal(104));
+
+ //original binding restored
+ myItem->setY(49);
+ QCOMPARE(myItem->x(), qreal(100-49));
+
+ delete rect;
+}
+
+//QTBUG-20692
+void tst_qqmlbinding::deletedObject()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("deletedObject.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QGuiApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+
+ //don't crash
+ rect->setProperty("activateBinding", true);
+
+ delete rect;
+}
+
+QTEST_MAIN(tst_qqmlbinding)
+
+#include "tst_qqmlbinding.moc"
diff --git a/tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.1.qml b/tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.1.qml
new file mode 100644
index 0000000000..b87ba9c808
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.1.qml
@@ -0,0 +1,4 @@
+import "bundle://mybundle"
+
+MyType {
+}
diff --git a/tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.2.qml b/tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.2.qml
new file mode 100644
index 0000000000..0c0622e95d
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/bundleImport/bundleImport.2.qml
@@ -0,0 +1,4 @@
+import "bundle://mybundle/subdir"
+
+MySubType {
+}
diff --git a/tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/MyType.qml b/tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/MyType.qml
new file mode 100644
index 0000000000..c473560849
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/MyType.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property real test1: 1918
+ property string test2: "Hello world!"
+}
diff --git a/tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/subdir/MySubType.qml b/tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/subdir/MySubType.qml
new file mode 100644
index 0000000000..ce136f213b
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/bundleImport/bundledata/subdir/MySubType.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property real test1: 1432
+ property string test2: "Jeronimo"
+}
+
diff --git a/tests/auto/qml/qqmlbundle/data/componentFromBundle/bundledata/test.qml b/tests/auto/qml/qqmlbundle/data/componentFromBundle/bundledata/test.qml
new file mode 100644
index 0000000000..ce81efe86b
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/componentFromBundle/bundledata/test.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test1: 11
+ property bool test2: true
+}
diff --git a/tests/auto/qml/qqmlbundle/data/import.qml b/tests/auto/qml/qqmlbundle/data/import.qml
new file mode 100644
index 0000000000..af527199a7
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/import.qml
@@ -0,0 +1,4 @@
+import bundletest 2.0
+
+MyPluginType {
+}
diff --git a/tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/qmldir b/tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/qmldir
new file mode 100644
index 0000000000..febddf6a47
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/qmldir
@@ -0,0 +1,2 @@
+module bundletest
+plugin plugin1
diff --git a/tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/subdir/qmldir b/tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/subdir/qmldir
new file mode 100644
index 0000000000..305d075dc7
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/imports/bundletest/bundledata/subdir/qmldir
@@ -0,0 +1 @@
+plugin plugin2
diff --git a/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin.cpp b/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin.cpp
new file mode 100644
index 0000000000..f0f13173b1
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent), v(32)
+ {
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
+
diff --git a/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro b/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro
new file mode 100644
index 0000000000..934bb2d591
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro
@@ -0,0 +1,7 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES += plugin.cpp
+QT = core qml
+
+DESTDIR = ./
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/qmldir b/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/qmldir
new file mode 100644
index 0000000000..628edcbfa3
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/qmldir
@@ -0,0 +1 @@
+MySubdirType 1.0 st.qml
diff --git a/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/st.qml b/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/st.qml
new file mode 100644
index 0000000000..496eda83d1
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/subdir/st.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test1: 67
+ property real test2: 88
+}
diff --git a/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/test.qml b/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/test.qml
new file mode 100644
index 0000000000..1046b8859f
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/relativeQmldir/bundledata/test.qml
@@ -0,0 +1,4 @@
+import "subdir"
+
+MySubdirType {
+}
diff --git a/tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/MyType.qml b/tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/MyType.qml
new file mode 100644
index 0000000000..ce81efe86b
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/MyType.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test1: 11
+ property bool test2: true
+}
diff --git a/tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/test.qml b/tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/test.qml
new file mode 100644
index 0000000000..2e753d2dbc
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/relativeResolution.1/bundledata/test.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+MyType {
+}
diff --git a/tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/MyType.qml b/tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/MyType.qml
new file mode 100644
index 0000000000..ce81efe86b
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/MyType.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test1: 11
+ property bool test2: true
+}
diff --git a/tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/test.qml b/tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/test.qml
new file mode 100644
index 0000000000..2e753d2dbc
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/data/relativeResolution.2/bundledata/subdir/test.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+MyType {
+}
diff --git a/tests/auto/qml/qqmlbundle/qqmlbundle.pro b/tests/auto/qml/qqmlbundle/qqmlbundle.pro
new file mode 100644
index 0000000000..ec81e3f234
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/qqmlbundle.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS += tst_qqmlbundle.pro data/imports/bundletest/plugin1.pro
diff --git a/tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp b/tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp
new file mode 100644
index 0000000000..1ddadcc81f
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// Lookup of libraries
+// Test bundle as a qmldir
+
+#include <qtest.h>
+#include <QDebug>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include "../../shared/util.h"
+#include <private/qqmlbundle_p.h>
+
+class tst_qqmlbundle : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlbundle() {}
+
+private slots:
+ void initTestCase();
+
+ void componentFromBundle();
+ void relativeResolution();
+ void bundleImport();
+ void relativeQmldir();
+
+ void import();
+
+private:
+ QStringList findFiles(const QDir &d);
+ bool makeBundle(const QString &path, const QString &name);
+};
+
+void tst_qqmlbundle::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+}
+
+// Test we create a QQmlComponent for a file inside a bundle
+void tst_qqmlbundle::componentFromBundle()
+{
+ QVERIFY(makeBundle(testFile("componentFromBundle"), "my.bundle"));
+
+ QQmlEngine engine;
+ engine.addNamedBundle("mybundle", testFile("componentFromBundle/my.bundle"));
+
+ QQmlComponent component(&engine, QUrl("bundle://mybundle/test.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toInt(), 11);
+ QCOMPARE(o->property("test2").toBool(), true);
+
+ delete o;
+}
+
+// Tests that relative QML components are resolved without a qmldir
+void tst_qqmlbundle::relativeResolution()
+{
+ // Root of the bundle
+ {
+ QVERIFY(makeBundle(testFile("relativeResolution.1"), "my.bundle"));
+
+ QQmlEngine engine;
+ engine.addNamedBundle("mybundle", testFile("relativeResolution.1/my.bundle"));
+
+ QQmlComponent component(&engine, QUrl("bundle://mybundle/test.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toInt(), 11);
+ QCOMPARE(o->property("test2").toBool(), true);
+
+ delete o;
+ }
+
+ // Non-root of the bundle
+ {
+ QVERIFY(makeBundle(testFile("relativeResolution.2"), "my.bundle"));
+
+ QQmlEngine engine;
+ engine.addNamedBundle("mybundle", testFile("relativeResolution.2/my.bundle"));
+
+ QQmlComponent component(&engine, QUrl("bundle://mybundle/subdir/test.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toInt(), 11);
+ QCOMPARE(o->property("test2").toBool(), true);
+
+ delete o;
+ }
+}
+
+// Test that a bundle can be imported explicitly from outside a bundle
+void tst_qqmlbundle::bundleImport()
+{
+ QVERIFY(makeBundle(testFile("bundleImport"), "my.bundle"));
+
+ QQmlEngine engine;
+ engine.addNamedBundle("mybundle", testFile("bundleImport/my.bundle"));
+
+ {
+ QQmlComponent component(&engine, testFileUrl("bundleImport/bundleImport.1.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(1918));
+ QCOMPARE(o->property("test2").toString(), QString("Hello world!"));
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("bundleImport/bundleImport.2.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(1432));
+ QCOMPARE(o->property("test2").toString(), QString("Jeronimo"));
+
+ delete o;
+ }
+}
+
+// Test a relative import inside a bundle uses qmldir
+void tst_qqmlbundle::relativeQmldir()
+{
+ QVERIFY(makeBundle(testFile("relativeQmldir"), "my.bundle"));
+
+ QQmlEngine engine;
+ engine.addNamedBundle("mybundle", testFile("relativeQmldir/my.bundle"));
+
+ QQmlComponent component(&engine, QUrl("bundle://mybundle/test.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(67));
+ QCOMPARE(o->property("test2").toReal(), qreal(88));
+
+ delete o;
+}
+
+// Test C++ plugins are resolved relative to the bundle container file
+void tst_qqmlbundle::import()
+{
+ QVERIFY(makeBundle(testFile("imports/bundletest"), "qmldir"));
+
+ QQmlEngine engine;
+ engine.addImportPath(testFile("imports"));
+
+ QQmlComponent component(&engine, testFileUrl("import.qml"));
+ QVERIFY2(component.isReady(), QQmlDataTest::msgComponentError(component, &engine));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("value").toInt(), 32);
+
+ delete o;
+}
+
+// Transform the data available under <path>/bundledata to a bundle named <path>/<name>
+bool tst_qqmlbundle::makeBundle(const QString &path, const QString &name)
+{
+ QDir dir(path);
+ dir.remove(name);
+
+ QDir bundleDir = dir;
+ if (!bundleDir.cd("bundledata"))
+ return false;
+
+ QStringList fileNames = findFiles(bundleDir);
+
+ QString bundleFile = dir.absolutePath() + QDir::separator() + name;
+
+ QQmlBundle bundle(bundleFile);
+ if (!bundle.open(QFile::WriteOnly))
+ return false;
+
+ foreach (const QString &fileName, fileNames) {
+ QString shortFileName = fileName.mid(bundleDir.absolutePath().length() + 1);
+ bundle.add(shortFileName, fileName);
+ }
+
+ return true;
+}
+
+QStringList tst_qqmlbundle::findFiles(const QDir &d)
+{
+ QStringList rv;
+
+ QStringList files = d.entryList(QDir::Files);
+ foreach (const QString &file, files)
+ rv << d.absoluteFilePath(file);
+
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
+ foreach (const QString &dir, dirs) {
+ QDir sub = d;
+ sub.cd(dir);
+ rv << findFiles(sub);
+ }
+
+ return rv;
+}
+
+QTEST_MAIN(tst_qqmlbundle)
+
+#include "tst_qqmlbundle.moc"
diff --git a/tests/auto/qml/qqmlbundle/tst_qqmlbundle.pro b/tests/auto/qml/qqmlbundle/tst_qqmlbundle.pro
new file mode 100644
index 0000000000..1a6d1e3a8f
--- /dev/null
+++ b/tests/auto/qml/qqmlbundle/tst_qqmlbundle.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qqmlbundle
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlbundle.cpp
+HEADERS +=
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += qml-private testlib gui-private
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro b/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro
new file mode 100644
index 0000000000..b65e58c0b3
--- /dev/null
+++ b/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qqmlhangeset
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlchangeset.cpp
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp
new file mode 100644
index 0000000000..0f09de26d3
--- /dev/null
+++ b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp
@@ -0,0 +1,1574 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <private/qqmlchangeset_p.h>
+
+class tst_qqmlchangeset : public QObject
+{
+ Q_OBJECT
+private slots:
+ void sequence_data();
+ void sequence();
+
+ void apply_data();
+ void apply();
+
+ void removeConsecutive_data();
+ void removeConsecutive();
+ void insertConsecutive_data();
+ void insertConsecutive();
+
+ void copy();
+ void debug();
+
+ // These create random sequences and verify a list with the reordered changes applied is the
+ // same as one with the unordered changes applied.
+private:
+ void random_data();
+ void random();
+
+public:
+ enum {
+ MoveOp = 0,
+ InsertOp = -1,
+ RemoveOp = -2
+ };
+
+ struct Signal
+ {
+ int index;
+ int count;
+ int to;
+ int moveId;
+ int offset;
+
+ bool isInsert() const { return to == -1; }
+ bool isRemove() const { return to == -2; }
+ bool isChange() const { return to == -3; }
+ bool isMove() const { return to >= 0; }
+ };
+
+ static Signal Insert(int index, int count) {
+ Signal signal = { index, count, -1, -1, 0 }; return signal; }
+ static Signal Insert(int index, int count, int moveId, int moveOffset) {
+ Signal signal = { index, count, -1, moveId, moveOffset }; return signal; }
+ static Signal Remove(int index, int count) {
+ Signal signal = { index, count, -2, -1, 0 }; return signal; }
+ static Signal Remove(int index, int count, int moveId, int moveOffset) {
+ Signal signal = { index, count, -2, moveId, moveOffset }; return signal; }
+ static Signal Move(int from, int to, int count, int moveId) {
+ Signal signal = { from, count, to, moveId, 0 }; return signal; }
+ static Signal Change(int index, int count) {
+ Signal signal = { index, count, -3, -1, 0 }; return signal; }
+
+ typedef QVector<Signal> SignalList;
+ typedef QVector<SignalList> SignalListList;
+
+ template<typename T>
+ void move(int from, int to, int n, T *items)
+ {
+ if (from > to) {
+ // Only move forwards - flip if backwards moving
+ int tfrom = from;
+ int tto = to;
+ from = tto;
+ to = tto+n;
+ n = tfrom-tto;
+ }
+
+ T replaced;
+ int i=0;
+ typename T::ConstIterator it=items->begin(); it += from+n;
+ for (; i<to-from; ++i,++it)
+ replaced.append(*it);
+ i=0;
+ it=items->begin(); it += from;
+ for (; i<n; ++i,++it)
+ replaced.append(*it);
+ typename T::ConstIterator f=replaced.begin();
+ typename T::Iterator t=items->begin(); t += from;
+ for (; f != replaced.end(); ++f, ++t)
+ *t = *f;
+ }
+
+ bool applyChanges(QVector<int> &list, const QVector<QVector<Signal> > &changes)
+ {
+ foreach (const SignalList &sl, changes) {
+ if (!applyChanges(list, sl))
+ return false;
+ }
+ return true;
+ }
+
+ bool applyChanges(QVector<int> &list, const QVector<Signal> &changes)
+ {
+ QHash<QQmlChangeSet::MoveKey, int> removedValues;
+ foreach (const Signal &signal, changes) {
+ if (signal.isInsert()) {
+ if (signal.index < 0 || signal.index > list.count()) {
+ qDebug() << "insert out of range" << signal.index << list.count();
+ return false;
+ }
+ if (signal.moveId != -1) {
+ QQmlChangeSet::Insert insert(signal.index, signal.count, signal.moveId, signal.offset);
+ for (int i = insert.start(); i < insert.end(); ++i)
+ list.insert(i, removedValues.take(insert.moveKey(i)));
+ } else {
+ list.insert(signal.index, signal.count, 100);
+ }
+ } else if (signal.isRemove()) {
+ if (signal.index < 0 || signal.index + signal.count > list.count()) {
+ qDebug() << "remove out of range" << signal.index << signal.count << list.count();
+ return false;
+ }
+ if (signal.moveId != -1) {
+ QQmlChangeSet::Remove remove(signal.index, signal.count, signal.moveId, signal.offset);
+ for (int i = remove.start(); i < remove.end(); ++i)
+ removedValues.insert(remove.moveKey(i), list.at(i));
+ }
+ list.erase(list.begin() + signal.index, list.begin() + signal.index + signal.count);
+ } else if (signal.isMove()) {
+ if (signal.index < 0
+ || signal.to < 0
+ || signal.index + signal.count > list.count()
+ || signal.to + signal.count > list.count()) {
+ qDebug() << "move out of range" << signal.index << signal.to << signal.count << list.count();
+ return false;
+ }
+ move(signal.index, signal.to, signal.count, &list);
+ } else if (signal.isChange()) {
+ for (int i = signal.index; i < signal.index + signal.count; ++i)
+ list[i] = 100;
+ }
+ }
+ return true;
+ }
+
+};
+
+bool operator ==(const tst_qqmlchangeset::Signal &left, const tst_qqmlchangeset::Signal &right)
+{
+ return left.index == right.index
+ && left.count == right.count
+ && left.to == right.to
+ && left.moveId == right.moveId
+ && (left.moveId == -1 || left.offset == right.offset);
+}
+
+QT_BEGIN_NAMESPACE
+bool operator ==(const QQmlChangeSet::Change &left, const QQmlChangeSet::Change &right)
+{
+ return left.index == right.index && left.count == right.count && left.moveId == right.moveId;
+}
+QT_END_NAMESPACE
+
+QDebug operator <<(QDebug debug, const tst_qqmlchangeset::Signal &signal)
+{
+ if (signal.isInsert() && signal.moveId == -1)
+ debug.nospace() << "Insert(" << signal.index << "," << signal.count << ")";
+ else if (signal.isInsert())
+ debug.nospace() << "Insert(" << signal.index << "," << signal.count << "," << signal.moveId << "," << signal.offset << ")";
+ else if (signal.isRemove() && signal.moveId == -1)
+ debug.nospace() << "Remove(" << signal.index << "," << signal.count << ")";
+ else if (signal.isRemove())
+ debug.nospace() << "Remove(" << signal.index << "," << signal.count << "," << signal.moveId << "," << signal.offset << ")";
+ else if (signal.isMove())
+ debug.nospace() << "Move(" << signal.index << "," << signal.to << "," << signal.count << "," << signal.moveId << ")";
+ else if (signal.isChange())
+ debug.nospace() << "Change(" << signal.index << "," << signal.count << ")";
+ return debug;
+}
+
+Q_DECLARE_METATYPE(tst_qqmlchangeset::SignalList)
+Q_DECLARE_METATYPE(tst_qqmlchangeset::SignalListList)
+
+#if 0
+# define VERIFY_EXPECTED_OUTPUT \
+ QVector<int> inputList; \
+ for (int i = 0; i < 40; ++i) \
+ inputList.append(i); \
+ QVector<int> outputList = inputList; \
+ if (!applyChanges(inputList, input)) { \
+ qDebug() << input; \
+ qDebug() << output; \
+ qDebug() << changes; \
+ QVERIFY(false); \
+ } else if (!applyChanges(outputList, output)) { \
+ qDebug() << input; \
+ qDebug() << output; \
+ qDebug() << changes; \
+ QVERIFY(false); \
+ } else if (outputList != inputList /* || changes != output*/) { \
+ qDebug() << input; \
+ qDebug() << output; \
+ qDebug() << changes; \
+ qDebug() << inputList; \
+ qDebug() << outputList; \
+ QVERIFY(false); \
+ } else if (changes != output) { \
+ qDebug() << output; \
+ qDebug() << changes; \
+ QCOMPARE(outputList, inputList); \
+ }
+#else
+# define VERIFY_EXPECTED_OUTPUT \
+ if (changes != output) { \
+ qDebug() << output; \
+ qDebug() << changes; \
+ }
+#endif
+
+void tst_qqmlchangeset::sequence_data()
+{
+ QTest::addColumn<SignalList>("input");
+ QTest::addColumn<SignalList>("output");
+
+ // Insert
+ QTest::newRow("i(12,5)")
+ << (SignalList() << Insert(12,5))
+ << (SignalList() << Insert(12,5));
+ QTest::newRow("i(2,3),i(12,5)")
+ << (SignalList() << Insert(2,3) << Insert(12,5))
+ << (SignalList() << Insert(2,3) << Insert(12,5));
+ QTest::newRow("i(12,5),i(2,3)")
+ << (SignalList() << Insert(12,5) << Insert(2,3))
+ << (SignalList() << Insert(2,3) << Insert(15,5));
+ QTest::newRow("i(12,5),i(12,3)")
+ << (SignalList() << Insert(12,5) << Insert(12,3))
+ << (SignalList() << Insert(12,8));
+ QTest::newRow("i(12,5),i(17,3)")
+ << (SignalList() << Insert(12,5) << Insert(17,3))
+ << (SignalList() << Insert(12,8));
+ QTest::newRow("i(12,5),i(15,3)")
+ << (SignalList() << Insert(12,5) << Insert(15,3))
+ << (SignalList() << Insert(12,8));
+
+ // Remove
+ QTest::newRow("r(3,9)")
+ << (SignalList() << Remove(3,9))
+ << (SignalList() << Remove(3,9));
+ QTest::newRow("r(3,4),r(3,2)")
+ << (SignalList() << Remove(3,4) << Remove(3,2))
+ << (SignalList() << Remove(3,6));
+ QTest::newRow("r(4,3),r(14,5)")
+ << (SignalList() << Remove(4,3) << Remove(14,5))
+ << (SignalList() << Remove(4,3) << Remove(14,5));
+ QTest::newRow("r(14,5),r(4,3)")
+ << (SignalList() << Remove(14,5) << Remove(4,3))
+ << (SignalList() << Remove(4,3) << Remove(11,5));
+ QTest::newRow("r(4,3),r(2,9)")
+ << (SignalList() << Remove(4,3) << Remove(2,9))
+ << (SignalList() << Remove(2,12));
+
+ // Move
+ QTest::newRow("m(8-10,2)")
+ << (SignalList() << Move(8,10,2,0))
+ << (SignalList() << Remove(8,2,0,0) << Insert(10,2,0,0));
+
+ QTest::newRow("m(23-12,6),m(13-15,5)")
+ << (SignalList() << Move(23,12,6,0) << Move(13,15,5,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(12,1,0,0) << Insert(15,5,0,1));
+ QTest::newRow("m(23-12,6),m(13-15,2)")
+ << (SignalList() << Move(23,12,6,0) << Move(13,20,2,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(12,1,0,0) << Insert(13,3,0,3) << Insert(20,2,0,1));
+ QTest::newRow("m(23-12,6),m(13-2,2)")
+ << (SignalList() << Move(23,12,6,0) << Move(13,2,2,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(2,2,0,1) << Insert(14,1,0,0) << Insert(15,3,0,3));
+ QTest::newRow("m(23-12,6),m(12-6,5)")
+ << (SignalList() << Move(23,12,6,0) << Move(12,6,5,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(6,5,0,0) << Insert(17,1,0,5));
+ QTest::newRow("m(23-12,6),m(10-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(10,5,4,1))
+ << (SignalList() << Remove(10,2,1,0) << Remove(21,6,0,0) << Insert(5,2,1,0) << Insert(7,2,0,0) << Insert(14,4,0,2));
+ QTest::newRow("m(23-12,6),m(16-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(16,5,4,1))
+ << (SignalList() << Remove(12,2,1,2) << Remove(21,6,0,0) << Insert(5,2,0,4) << Insert(7,2,1,2) << Insert(16,4,0,0));
+ QTest::newRow("m(23-12,6),m(13-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(13,5,4,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(5,4,0,1) << Insert(16,1,0,0) << Insert(17,1,0,5));
+ QTest::newRow("m(23-12,6),m(14-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(14,5,4,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(5,4,0,2) << Insert(16,2,0,0));
+ QTest::newRow("m(23-12,6),m(12-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(12,5,4,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(5,4,0,0) << Insert(16,2,0,4));
+ QTest::newRow("m(23-12,6),m(11-5,8)")
+ << (SignalList() << Move(23,12,6,0) << Move(11,5,8,1))
+ << (SignalList() << Remove(11,1,1,0) << Remove(11,1,1,7) << Remove(21,6,0,0) << Insert(5,1,1,0) << Insert(6,6,0,0) << Insert(12,1,1,7));
+ QTest::newRow("m(23-12,6),m(8-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(8,5,4,1))
+ << (SignalList() << Remove(8,4,1,0) << Remove(19,6,0,0) << Insert(5,4,1,0) << Insert(12,6,0,0));
+ QTest::newRow("m(23-12,6),m(2-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(2,5,4,1))
+ << (SignalList() << Remove(2,4,1,0) << Remove(19,6,0,0) << Insert(5,4,1,0) << Insert(12,6,0,0));
+ QTest::newRow("m(23-12,6),m(18-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(18,5,4,1))
+ << (SignalList() << Remove(12,4,1,0) << Remove(19,6,0,0) << Insert(5,4,1,0) << Insert(16,6,0,0));
+ QTest::newRow("m(23-12,6),m(20-5,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(20,5,4,1))
+ << (SignalList() << Remove(14,4,1,0) << Remove(19,6,0,0) << Insert(5,4,1,0) << Insert(16,6,0,0));
+
+ QTest::newRow("m(23-12,6),m(5-13,11)")
+ << (SignalList() << Move(23,12,6,0) << Move(5,13,11,1))
+ << (SignalList() << Remove(5,7,1,0) << Remove(16,6,0,0) << Insert(5,2,0,4) << Insert(13,7,1,0) << Insert(20,4,0,0));
+
+ QTest::newRow("m(23-12,6),m(12-23,6)")
+ << (SignalList() << Move(23,12,6,0) << Move(12,23,6,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(23,6,0,0)); // ### These cancel out.
+ QTest::newRow("m(23-12,6),m(10-23,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(10,23,4,1))
+ << (SignalList() << Remove(10,2,1,0) << Remove(21,6,0,0) << Insert(10,4,0,2) << Insert(23,2,1,0) << Insert(25,2,0,0));
+ QTest::newRow("m(23-12,6),m(16-23.4)")
+ << (SignalList() << Move(23,12,6,0) << Move(16,23,4,1))
+ << (SignalList() << Remove(12,2,1,2) << Remove(21,6,0,0) << Insert(12,4,0,0) << Insert(23,2,0,4) << Insert(25,2,1,2));
+ QTest::newRow("m(23-12,6),m(13-23,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(13,23,4,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(12,1,0,0) << Insert(13,1,0,5) << Insert(23,4,0,1));
+ QTest::newRow("m(23-12,6),m(14-23,)")
+ << (SignalList() << Move(23,12,6,0) << Move(14,23,4,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(12,2,0,0) << Insert(23,4,0,2));
+ QTest::newRow("m(23-12,6),m(12-23,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(12,23,4,1))
+ << (SignalList() << Remove(23,6,0,0) << Insert(12,2,0,4) << Insert(23,4,0,0));
+ QTest::newRow("m(23-12,6),m(11-23,8)")
+ << (SignalList() << Move(23,12,6,0) << Move(11,23,8,1))
+ << (SignalList() << Remove(11,1,1,0) << Remove(11,1,1,7) << Remove(21,6,0,0) << Insert(23,1,1,0) << Insert(24,6,0,0) << Insert(30,1,1,7));
+ QTest::newRow("m(23-12,6),m(8-23,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(8,23,4,1))
+ << (SignalList() << Remove(8,4,1,0) << Remove(19,6,0,0) << Insert(8,6,0,0) << Insert(23,4,1,0));
+ QTest::newRow("m(23-12,6),m(2-23,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(2,23,4,1))
+ << (SignalList() << Remove(2,4,1,0) << Remove(19,6,0,0) << Insert(8,6,0,0) << Insert(23,4,1,0));
+ QTest::newRow("m(23-12,6),m(18-23,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(18,23,4,1))
+ << (SignalList() << Remove(12,4,1,0) << Remove(19,6,0,0) << Insert(12,6,0,0) << Insert(23,4,1,0));
+ QTest::newRow("m(23-12,6),m(20-23,4)")
+ << (SignalList() << Move(23,12,6,0) << Move(20,23,4,1))
+ << (SignalList() << Remove(14,4,1,0) << Remove(19,6,0,0) << Insert(12,6,0,0) << Insert(23,4,1,0));
+
+ QTest::newRow("m(23-12,6),m(11-23,10)")
+ << (SignalList() << Move(23,12,6,0) << Move(11,23,10,1))
+ << (SignalList() << Remove(11,1,1,0) << Remove(11,3,1,7) << Remove(19,6,0,0) << Insert(23,1,1,0) << Insert(24,6,0,0) << Insert(30,3,1,7));
+
+ QTest::newRow("m(3-9,12),m(13-5,12)")
+ << (SignalList() << Move(3,9,12,0) << Move(13,15,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,4,0,0) << Insert(13,2,0,9) << Insert(15,5,0,4) << Insert(20,1,0,11));
+ QTest::newRow("m(3-9,12),m(13-15,20)")
+ << (SignalList() << Move(3,9,12,0) << Move(13,15,20,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(9,12,1,8) << Insert(9,4,0,0) << Insert(15,8,0,4) << Insert(23,12,1,8));
+ QTest::newRow("m(3-9,12),m(13-15,2)")
+ << (SignalList() << Move(3,9,12,0) << Move(13,15,2,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,4,0,0) << Insert(13,2,0,6) << Insert(15,2,0,4) << Insert(17,4,0,8));
+ QTest::newRow("m(3-9,12),m(12-5,6)")
+ << (SignalList() << Move(3,9,12,0) << Move(12,5,6,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(5,6,0,3) << Insert(15,3,0,0) << Insert(18,3,0,9));
+ QTest::newRow("m(3-9,12),m(10-14,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(10,14,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,1,0,0) << Insert(10,4,0,6) << Insert(14,5,0,1) << Insert(19,2,0,10));
+ QTest::newRow("m(3-9,12),m(16-20,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(16,20,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,7,0,0) << Insert(20,5,0,7));
+ QTest::newRow("m(3-9,12),m(13-17,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(13,17,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,4,0,0) << Insert(13,3,0,9) << Insert(17,5,0,4));
+ QTest::newRow("m(3-9,12),m(14-18,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(14,18,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,5,0,0) << Insert(14,2,0,10) << Insert(18,5,0,5));
+ QTest::newRow("m(3-9,12),m(12-16,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(12,16,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,3,0,0) << Insert(12,4,0,8) << Insert(16,5,0,3));
+ QTest::newRow("m(3-9,12),m(11-19,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(11,19,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,2,0,0) << Insert(11,5,0,7) << Insert(19,5,0,2));
+ QTest::newRow("m(3-9,12),m(8-12,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(8,12,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(8,1,1,0) << Insert(8,4,0,4) << Insert(12,1,1,0) << Insert(13,4,0,0) << Insert(17,4,0,8));
+ QTest::newRow("m(3-9,12),m(2-6,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(2,6,5,1))
+ << (SignalList() << Remove(2,1,1,0) << Remove(2,12,0,0) << Remove(2,4,1,1) << Insert(4,2,0,0) << Insert(6,5,1,0) << Insert(11,10,0,2));
+ QTest::newRow("m(3-9,12),m(18-22,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(18,22,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(9,2,1,3) << Insert(9,9,0,0) << Insert(22,3,0,9) << Insert(25,2,1,3));
+ QTest::newRow("m(3-9,12),m(20-24,5)")
+ << (SignalList() << Move(3,9,12,0) << Move(20,24,5,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(9,4,1,1) << Insert(9,11,0,0) << Insert(24,1,0,11) << Insert(25,4,1,1));
+
+ QTest::newRow("m(3-9,12),m(5-11,8)")
+ << (SignalList() << Move(3,9,12,0) << Move(5,11,8,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(5,4,1,0) << Insert(5,6,0,4) << Insert(11,4,1,0) << Insert(15,4,0,0) << Insert(19,2,0,10));
+
+ QTest::newRow("m(3-9,12),m(12-23,6)")
+ << (SignalList() << Move(3,9,12,0) << Move(12,23,6,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,3,0,0) << Insert(12,3,0,9) << Insert(23,6,0,3));
+ QTest::newRow("m(3-9,12),m(10-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(10,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,1,0,0) << Insert(10,7,0,5) << Insert(23,4,0,1));
+ QTest::newRow("m(3-9,12),m(16-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(16,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,7,0,0) << Insert(16,1,0,11) << Insert(23,4,0,7));
+ QTest::newRow("m(3-9,12),m(13-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(13,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,4,0,0) << Insert(13,4,0,8) << Insert(23,4,0,4));
+ QTest::newRow("m(3-9,12),m(14-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(14,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,5,0,0) << Insert(14,3,0,9) << Insert(23,4,0,5));
+ QTest::newRow("m(3-9,12),m(12-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(12,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,3,0,0) << Insert(12,5,0,7) << Insert(23,4,0,3));
+ QTest::newRow("m(3-9,12),m(11-23,8)")
+ << (SignalList() << Move(3,9,12,0) << Move(11,23,8,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,2,0,0) << Insert(11,2,0,10) << Insert(23,8,0,2));
+ QTest::newRow("m(3-9,12),m(8-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(8,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(8,1,1,0) << Insert(8,9,0,3) << Insert(23,1,1,0) << Insert(24,3,0,0));
+ QTest::newRow("m(3-9,12),m(2-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(2,23,4,1))
+ << (SignalList() << Remove(2,1,1,0) << Remove(2,12,0,0) << Remove(2,3,1,1) << Insert(5,12,0,0) << Insert(23,4,1,0));
+ QTest::newRow("m(3-9,12),m(18-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(18,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(9,1,1,3) << Insert(9,9,0,0) << Insert(23,3,0,9) << Insert(26,1,1,3));
+ QTest::newRow("m(3-9,12),m(20-23,4)")
+ << (SignalList() << Move(3,9,12,0) << Move(20,23,4,1))
+ << (SignalList() << Remove(3,12,0,0) << Remove(9,3,1,1) << Insert(9,11,0,0) << Insert(23,1,0,11) << Insert(24,3,1,1));
+
+ QTest::newRow("m(3-9,12),m(11-23,10)")
+ << (SignalList() << Move(3,9,12,0) << Move(11,23,10,1))
+ << (SignalList() << Remove(3,12,0,0) << Insert(9,2,0,0) << Insert(23,10,0,2));
+
+ // Change
+ QTest::newRow("c(4,5)")
+ << (SignalList() << Change(4,5))
+ << (SignalList() << Change(4,5));
+ QTest::newRow("c(4,5),c(12,2)")
+ << (SignalList() << Change(4,5) << Change(12,2))
+ << (SignalList() << Change(4,5) << Change(12,2));
+ QTest::newRow("c(12,2),c(4,5)")
+ << (SignalList() << Change(12,2) << Change(4,5))
+ << (SignalList() << Change(4,5) << Change(12,2));
+ QTest::newRow("c(4,5),c(2,2)")
+ << (SignalList() << Change(4,5) << Change(2,2))
+ << (SignalList() << Change(2,7));
+ QTest::newRow("c(4,5),c(9,2)")
+ << (SignalList() << Change(4,5) << Change(9,2))
+ << (SignalList() << Change(4,7));
+ QTest::newRow("c(4,5),c(3,2)")
+ << (SignalList() << Change(4,5) << Change(3,2))
+ << (SignalList() << Change(3,6));
+ QTest::newRow("c(4,5),c(8,2)")
+ << (SignalList() << Change(4,5) << Change(8,2))
+ << (SignalList() << Change(4,6));
+ QTest::newRow("c(4,5),c(3,2)")
+ << (SignalList() << Change(4,5) << Change(3,2))
+ << (SignalList() << Change(3,6));
+ QTest::newRow("c(4,5),c(2,9)")
+ << (SignalList() << Change(4,5) << Change(2,9))
+ << (SignalList() << Change(2,9));
+ QTest::newRow("c(4,5),c(12,3),c(8,6)")
+ << (SignalList() << Change(4,5) << Change(12,3) << Change(8,6))
+ << (SignalList() << Change(4,11));
+
+ // Insert,then remove.
+ QTest::newRow("i(12,6),r(12,6)")
+ << (SignalList() << Insert(12,6) << Remove(12,6))
+ << (SignalList());
+ QTest::newRow("i(12,6),r(10,4)")
+ << (SignalList() << Insert(12,6) << Remove(10,4))
+ << (SignalList() << Remove(10,2) << Insert(10,4));
+ QTest::newRow("i(12,6),r(16,4)")
+ << (SignalList() << Insert(12,6) << Remove(16,4))
+ << (SignalList() << Remove(12,2) << Insert(12,4));
+ QTest::newRow("i(12,6),r(13,4)")
+ << (SignalList() << Insert(12,6) << Remove(13,4))
+ << (SignalList() << Insert(12,2));
+ QTest::newRow("i(12,6),r(14,4)")
+ << (SignalList() << Insert(12,6) << Remove(14,4))
+ << (SignalList() << Insert(12,2));
+ QTest::newRow("i(12,6),r(12,4)")
+ << (SignalList() << Insert(12,6) << Remove(12,4))
+ << (SignalList() << Insert(12,2));
+ QTest::newRow("i(12,6),r(11,8)")
+ << (SignalList() << Insert(12,6) << Remove(11,8))
+ << (SignalList() << Remove(11,2));
+ QTest::newRow("i(12,6),r(8,4)")
+ << (SignalList() << Insert(12,6) << Remove(8,4))
+ << (SignalList() << Remove(8,4) << Insert(8,6));
+ QTest::newRow("i(12,6),r(2,4)")
+ << (SignalList() << Insert(12,6) << Remove(2,4))
+ << (SignalList() << Remove(2,4) << Insert(8,6));
+ QTest::newRow("i(12,6),r(18,4)")
+ << (SignalList() << Insert(12,6) << Remove(18,4))
+ << (SignalList() << Remove(12,4) << Insert(12,6));
+ QTest::newRow("i(12,6),r(20,4)")
+ << (SignalList() << Insert(12,6) << Remove(20,4))
+ << (SignalList() << Remove(14,4) << Insert(12,6));
+
+ // Insert,then change
+ QTest::newRow("i(12,6),c(12,6)")
+ << (SignalList() << Insert(12,6) << Change(12,6))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(10,6)")
+ << (SignalList() << Insert(12,6) << Change(10,6))
+ << (SignalList() << Insert(12,6) << Change(10,2));
+ QTest::newRow("i(12,6),c(16,4)")
+ << (SignalList() << Insert(12,6) << Change(16,4))
+ << (SignalList() << Insert(12,6) << Change(18,2));
+ QTest::newRow("i(12,6),c(13,4)")
+ << (SignalList() << Insert(12,6) << Change(13,4))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(14,4)")
+ << (SignalList() << Insert(12,6) << Change(14,4))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(12,4)")
+ << (SignalList() << Insert(12,6) << Change(12,4))
+ << (SignalList() << Insert(12,6));
+ QTest::newRow("i(12,6),c(11,8)")
+ << (SignalList() << Insert(12,6) << Change(11,8))
+ << (SignalList() << Insert(12,6) << Change(11,1) << Change(18,1));
+ QTest::newRow("i(12,6),c(8,4)")
+ << (SignalList() << Insert(12,6) << Change(8,4))
+ << (SignalList() << Insert(12,6) << Change(8,4));
+ QTest::newRow("i(12,6),c(2,4)")
+ << (SignalList() << Insert(12,6) << Change(2,4))
+ << (SignalList() << Insert(12,6) << Change(2,4));
+ QTest::newRow("i(12,6),c(18,4)")
+ << (SignalList() << Insert(12,6) << Change(18,4))
+ << (SignalList() << Insert(12,6) << Change(18,4));
+ QTest::newRow("i(12,6),c(20,4)")
+ << (SignalList() << Insert(12,6) << Change(20,4))
+ << (SignalList() << Insert(12,6) << Change(20,4));
+
+ // Insert,then move
+ QTest::newRow("i(12,6),m(12-5,6)")
+ << (SignalList() << Insert(12,6) << Move(12,5,6,0))
+ << (SignalList() << Insert(5,6));
+ QTest::newRow("i(12,6),m(10-5,4)")
+ << (SignalList() << Insert(12,6) << Move(10,5,4,0))
+ << (SignalList() << Remove(10,2,0,0) << Insert(5,2,0,0) << Insert(7,2) << Insert(14,4));
+ QTest::newRow("i(12,6),m(16-5,4)")
+ << (SignalList() << Insert(12,6) << Move(16,5,4,0))
+ << (SignalList() << Remove(12,2,0,2) << Insert(5,2) << Insert(7,2,0,2) << Insert(16,4));
+ QTest::newRow("i(12,6),m(13-5,4)")
+ << (SignalList() << Insert(12,6) << Move(13,5,4,0))
+ << (SignalList() << Insert(5,4) << Insert(16,2));
+ QTest::newRow("i(12,6),m(14-5,4)")
+ << (SignalList() << Insert(12,6) << Move(14,5,4,0))
+ << (SignalList() << Insert(5,4) << Insert(16,2));
+ QTest::newRow("i(12,6),m(12-5,4)")
+ << (SignalList() << Insert(12,6) << Move(12,5,4,0))
+ << (SignalList() << Insert(5,4) << Insert(16,2));
+ QTest::newRow("i(12,6),m(11-5,8)")
+ << (SignalList() << Insert(12,6) << Move(11,5,8,0))
+ << (SignalList() << Remove(11,1,0,0) << Remove(11,1,0,7) << Insert(5,1,0,0) << Insert(6,6) << Insert(12,1,0,7));
+ QTest::newRow("i(12,6),m(8-5,4)")
+ << (SignalList() << Insert(12,6) << Move(8,5,4,0))
+ << (SignalList() << Remove(8,4,0,0) << Insert(5,4,0,0) << Insert(12,6));
+ QTest::newRow("i(12,6),m(2-5,4)")
+ << (SignalList() << Insert(12,6) << Move(2,5,4,0))
+ << (SignalList() << Remove(2,4,0,0) << Insert(5,4,0,0) << Insert(12,6));
+ QTest::newRow("i(12,6),m(18-5,4)")
+ << (SignalList() << Insert(12,6) << Move(18,5,4,0))
+ << (SignalList() << Remove(12,4,0,0) << Insert(5,4,0,0) << Insert(16,6));
+ QTest::newRow("i(12,6),m(20-5,4)")
+ << (SignalList() << Insert(12,6) << Move(20,5,4,0))
+ << (SignalList() << Remove(14,4,0,0) << Insert(5,4,0,0) << Insert(16,6));
+
+ QTest::newRow("i(12,6),m(5-13,11)")
+ << (SignalList() << Insert(12,6) << Move(5,11,8,0))
+ << (SignalList() << Remove(5,7,0,0) << Insert(5,5) << Insert(11,7,0,0) << Insert(18,1));
+
+ QTest::newRow("i(12,6),m(12-23,6)")
+ << (SignalList() << Insert(12,6) << Move(12,23,6,0))
+ << (SignalList() << Insert(23,6));
+ QTest::newRow("i(12,6),m(10-23,4)")
+ << (SignalList() << Insert(12,6) << Move(10,23,4,0))
+ << (SignalList() << Remove(10,2,0,0) << Insert(10,4) << Insert(23,2,0,0) << Insert(25,2));
+ QTest::newRow("i(12,6),m(16-23,4)")
+ << (SignalList() << Insert(12,6) << Move(16,23,4,0))
+ << (SignalList() << Remove(12,2,0,2) << Insert(12,4) << Insert(23,2) << Insert(25,2,0,2));
+ QTest::newRow("i(12,6),m(13-23,4)")
+ << (SignalList() << Insert(12,6) << Move(13,23,4,0))
+ << (SignalList() << Insert(12,2) << Insert(23,4));
+ QTest::newRow("i(12,6),m(14-23,4)")
+ << (SignalList() << Insert(12,6) << Move(14,23,4,0))
+ << (SignalList() << Insert(12,2) << Insert(23,4));
+ QTest::newRow("i(12,6),m(12-23,4)")
+ << (SignalList() << Insert(12,6) << Move(12,23,4,0))
+ << (SignalList() << Insert(12,2) << Insert(23,4));
+ QTest::newRow("i(12,6),m(11-23,8)")
+ << (SignalList() << Insert(12,6) << Move(11,23,8,0))
+ << (SignalList() << Remove(11,1,0,0) << Remove(11,1,0,7) << Insert(23,1,0,0)<< Insert(24,6) << Insert(30,1,0,7));
+ QTest::newRow("i(12,6),m(8-23,4)")
+ << (SignalList() << Insert(12,6) << Move(8,23,4,0))
+ << (SignalList() << Remove(8,4,0,0) << Insert(8,6) << Insert(23,4,0,0));
+ QTest::newRow("i(12,6),m(2-23,4)")
+ << (SignalList() << Insert(12,6) << Move(2,23,4,0))
+ << (SignalList() << Remove(2,4,0,0) << Insert(8,6) << Insert(23,4,0,0));
+ QTest::newRow("i(12,6),m(18-23,4)")
+ << (SignalList() << Insert(12,6) << Move(18,23,4,0))
+ << (SignalList() << Remove(12,4,0,0) << Insert(12,6) << Insert(23,4,0,0));
+ QTest::newRow("i(12,6),m(20-23,4)")
+ << (SignalList() << Insert(12,6) << Move(20,23,4,0))
+ << (SignalList() << Remove(14,4,0,0) << Insert(12,6) << Insert(23,4,0,0));
+
+ QTest::newRow("i(12,6),m(11-23,10)")
+ << (SignalList() << Insert(12,6) << Move(11,23,10,0))
+ << (SignalList() << Remove(11,1,0,0) << Remove(11,3,0,7) << Insert(23,1,0,0) << Insert(24,6) << Insert(30,3,0,7));
+
+ // Remove,then insert
+ QTest::newRow("r(12,6),i(12,6)")
+ << (SignalList() << Remove(12,6) << Insert(12,6))
+ << (SignalList() << Remove(12,6) << Insert(12,6));
+ QTest::newRow("r(12,6),i(10,4)")
+ << (SignalList() << Remove(12,6) << Insert(10,14))
+ << (SignalList() << Remove(12,6) << Insert(10,14));
+ QTest::newRow("r(12,6),i(16,4)")
+ << (SignalList() << Remove(12,6) << Insert(16,4))
+ << (SignalList() << Remove(12,6) << Insert(16,4));
+ QTest::newRow("r(12,6),i(13,4)")
+ << (SignalList() << Remove(12,6) << Insert(13,4))
+ << (SignalList() << Remove(12,6) << Insert(13,4));
+ QTest::newRow("r(12,6),i(14,4)")
+ << (SignalList() << Remove(12,6) << Insert(14,4))
+ << (SignalList() << Remove(12,6) << Insert(14,4));
+ QTest::newRow("r(12,6),i(12,4)")
+ << (SignalList() << Remove(12,6) << Insert(12,4))
+ << (SignalList() << Remove(12,6) << Insert(12,4));
+ QTest::newRow("r(12,6),i(11,8)")
+ << (SignalList() << Remove(12,6) << Insert(11,8))
+ << (SignalList() << Remove(12,6) << Insert(11,8));
+ QTest::newRow("r(12,6),i(8,4)")
+ << (SignalList() << Remove(12,6) << Insert(8,4))
+ << (SignalList() << Remove(12,6) << Insert(8,4));
+ QTest::newRow("r(12,6),i(2,4)")
+ << (SignalList() << Remove(12,6) << Insert(2,4))
+ << (SignalList() << Remove(12,6) << Insert(2,4));
+ QTest::newRow("r(12,6),i(18,4)")
+ << (SignalList() << Remove(12,6) << Insert(18,4))
+ << (SignalList() << Remove(12,6) << Insert(18,4));
+ QTest::newRow("r(12,6),i(20,4)")
+ << (SignalList() << Remove(12,6) << Insert(20,4))
+ << (SignalList() << Remove(12,6) << Insert(20,4));
+
+ // Move,then insert
+ QTest::newRow("m(12-5,6),i(12,6)")
+ << (SignalList() << Move(12,5,6,0) << Insert(12,6))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(12,6));
+ QTest::newRow("m(12-5,6),i(10,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(10,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,5,0,0) << Insert(10,4) << Insert(14,1,0,5));
+ QTest::newRow("m(12-5,6),i(16,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(16,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(16,4));
+ QTest::newRow("m(12-5,6),i(13,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(13,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(13,4));
+ QTest::newRow("m(12-5,6),i(14,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(14,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(14,4));
+ QTest::newRow("m(12-5,6),i(12,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(12,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(12,4));
+ QTest::newRow("m(12-5,6),i(11,8)")
+ << (SignalList() << Move(12,5,6,0) << Insert(11,8))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(11,8));
+ QTest::newRow("m(12-5,6),i(8,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(8,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,3,0,0) << Insert(8,4) << Insert(12,3,0,3));
+ QTest::newRow("m(12-5,6),i(2,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(2,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(2,4) << Insert(9,6,0,0));
+ QTest::newRow("m(12-5,6),i(18,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(18,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(18,4));
+ QTest::newRow("m(12-5,6),i(20,4)")
+ << (SignalList() << Move(12,5,6,0) << Insert(20,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,6,0,0) << Insert(20,4));
+
+ QTest::newRow("m(12-23,6),i(12,6)")
+ << (SignalList() << Move(12,23,6,0) << Insert(12,6))
+ << (SignalList() << Remove(12,6,0,0) << Insert(12,6) << Insert(29,6,0,0));
+ QTest::newRow("m(12-23,6),i(10,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(10,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(10,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(16,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(16,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(16,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(13,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(13,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(13,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(14,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(14,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(14,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(12,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(12,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(12,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(11,8)")
+ << (SignalList() << Move(12,23,6,0) << Insert(11,8))
+ << (SignalList() << Remove(12,6,0,0) << Insert(11,8) << Insert(31,6,0,0));
+ QTest::newRow("m(12-23,6),i(8,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(8,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(8,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(2,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(2,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(2,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(18,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(18,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(18,4) << Insert(27,6,0,0));
+ QTest::newRow("m(12-23,6),i(20,4)")
+ << (SignalList() << Move(12,23,6,0) << Insert(20,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(20,4) << Insert(27,6,0,0));
+
+ // Move,then remove
+ QTest::newRow("m(12-5,6),r(12,6)")
+ << (SignalList() << Move(12,5,6,0) << Remove(12,6))
+ << (SignalList() << Remove(6,6) << Remove(6,6,0,0) << Insert(5,6,0,0));
+ QTest::newRow("m(12-5,6),r(10,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(10,4)) // ###
+ << (SignalList() << Remove(5,3) << Remove(9,6,0,0) << Insert(5,5,0,0));
+ QTest::newRow("m(12-5,6),r(16,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(16,4))
+ << (SignalList() << Remove(10,2) << Remove(10,6,0,0) << Remove(10,2) << Insert(5,6,0,0));
+ QTest::newRow("m(12-5,6),r(13,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(13,4))
+ << (SignalList() << Remove(7,4) << Remove(8,6,0,0) << Insert(5,6,0,0));
+ QTest::newRow("m(12-5,6),r(14,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(14,4))
+ << (SignalList() << Remove(8,4) << Remove(8,6,0,0) << Insert(5,6,0,0));
+ QTest::newRow("m(12-5,6),r(12,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(12,4))
+ << (SignalList() << Remove(6,4) << Remove(8,6,0,0) << Insert(5,6,0,0));
+ QTest::newRow("m(12-5,6),r(11,8)")
+ << (SignalList() << Move(12,5,6,0) << Remove(11,8))
+ << (SignalList() << Remove(5,7) << Remove(5,6,0,0) << Remove(5,1) << Insert(5,6,0,0));
+ QTest::newRow("m(12-5,6),r(8,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(8,4)) // ###
+ << (SignalList() << Remove(5,1) << Remove(11,6,0,0) << Insert(5,3,0,0));
+ QTest::newRow("m(12-5,6),r(2,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(2,4))
+ << (SignalList() << Remove(2,3) << Remove(9,6,0,0) << Insert(2,5,0,1));
+ QTest::newRow("m(12-5,6),r(6,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(6,4))
+ << (SignalList() << Remove(12,6,0,0) << Insert(5,1,0,0) << Insert(6,1,0,5));
+ QTest::newRow("m(12-5,6),r(18,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(18,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(12,4) << Insert(5,6,0,0));
+ QTest::newRow("m(12-5,6),r(20,4)")
+ << (SignalList() << Move(12,5,6,0) << Remove(20,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(14,4) << Insert(5,6,0,0));
+
+ QTest::newRow("m(12-23,6),r(12,6)")
+ << (SignalList() << Move(12,23,6,0) << Remove(12,6))
+ << (SignalList() << Remove(12,6,0,0) << Remove(12,6) << Insert(17,6,0,0));
+ QTest::newRow("m(12-23,6),r(10,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(10,4))
+ << (SignalList() << Remove(10,2) << Remove(10,6,0,0) << Remove(10,2) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(16,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(16,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(16,4) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(13,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(13,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(13,4) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(14,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(14,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(14,4) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(12,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(12,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(12,4) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(11,8)")
+ << (SignalList() << Move(12,23,6,0) << Remove(11,8))
+ << (SignalList() << Remove(11,1) << Remove(11,6,0,0) << Remove(11,7) << Insert(15,6,0,0));
+ QTest::newRow("m(12-23,6),r(8,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(8,4))
+ << (SignalList() << Remove(8,4) << Remove(8,6,0,0) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(2,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(2,4))
+ << (SignalList() << Remove(2,4) << Remove(8,6,0,0) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(18,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(18,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(18,4) << Insert(19,6,0,0));
+ QTest::newRow("m(12-23,6),r(20,4)")
+ << (SignalList() << Move(12,23,6,0) << Remove(20,4))
+ << (SignalList() << Remove(12,6,0,0) << Remove(20,3) << Insert(20,5,0,1));
+
+
+ // Complex
+ QTest::newRow("r(15,1),r(22,1)")
+ << (SignalList() << Remove(15,1) << Remove(22,1))
+ << (SignalList() << Remove(15,1) << Remove(22,1));
+ QTest::newRow("r(15,1),r(22,1),r(25,1)")
+ << (SignalList() << Remove(15,1) << Remove(22,1) << Remove(25,1))
+ << (SignalList() << Remove(15,1) << Remove(22,1) << Remove(25,1));
+ QTest::newRow("r(15,1),r(22,1),r(25,1),r(15,1)")
+ << (SignalList() << Remove(15,1) << Remove(22,1) << Remove(25,1) << Remove(15,1))
+ << (SignalList() << Remove(15,2) << Remove(21,1) << Remove(24,1));
+ QTest::newRow("r(15,1),r(22,1),r(25,1),r(15,1),r(13,1)")
+ << (SignalList() << Remove(15,1) << Remove(22,1) << Remove(25,1) << Remove(15,1) << Remove(13,1))
+ << (SignalList() << Remove(13,1) << Remove(14,2) << Remove(20,1) << Remove(23,1));
+ QTest::newRow("r(15,1),r(22,1),r(25,1),r(15,1),r(13,1),r(13,1)")
+ << (SignalList() << Remove(15,1) << Remove(22,1) << Remove(25,1) << Remove(15,1) << Remove(13,1) << Remove(13,1))
+ << (SignalList() << Remove(13,4) << Remove(19,1) << Remove(22,1));
+ QTest::newRow("r(15,1),r(22,1),r(25,1),r(15,1),r(13,1),r(13,1),m(12,13,1)")
+ << (SignalList() << Remove(15,1) << Remove(22,1) << Remove(25,1) << Remove(15,1) << Remove(13,1) << Remove(13,1) << Move(12,13,1,0))
+ << (SignalList() << Remove(12,1,0,0) << Remove(12,4) << Remove(18,1) << Remove(21,1) << Insert(13,1,0,0));
+
+ QTest::newRow("r(12,18),r(3,0)")
+ << (SignalList() << Remove(12,18) << Remove(3,0))
+ << (SignalList() << Remove(12,18));
+ QTest::newRow("r(12,18),r(3,0),r(1,2)")
+ << (SignalList() << Remove(12,18) << Remove(3,0) << Remove(1,2))
+ << (SignalList() << Remove(1,2) << Remove(10,18));
+ QTest::newRow("r(12,18),r(3,0),r(1,2),m(4,0,11)")
+ << (SignalList() << Remove(12,18) << Remove(3,0) << Remove(1,2) << Move(4,0,11,0))
+ << (SignalList() << Remove(1,2) << Remove(4,6,0,0) << Remove(4,18) << Remove(4,5,0,6) << Insert(0,11,0,0));
+ QTest::newRow("r(12,18),r(3,0),r(1,2),m(4,0,11),r(14,3)")
+ << (SignalList() << Remove(12,18) << Remove(3,0) << Remove(1,2) << Move(4,0,11,0) << Remove(14,3))
+ << (SignalList() << Remove(1,2) << Remove(3,1) << Remove(3,6,0,0) << Remove(3,18) << Remove(3,5,0,6) << Remove(3,2) << Insert(0,11,0,0));
+
+ QTest::newRow("m(9,11,14),i(16,1)")
+ << (SignalList() << Move(9,11,14,0) << Insert(16,1))
+ << (SignalList() << Remove(9,14,0,0) << Insert(11,5,0,0) << Insert(16,1) << Insert(17,9,0,5));
+ QTest::newRow("m(9,11,14),i(16,1),m(22,38,3)")
+ << (SignalList() << Move(9,11,14,0) << Insert(16,1) << Move(22,38,3,1))
+ << (SignalList() << Remove(9,14,0,0) << Insert(11,5,0,0) << Insert(16,1) << Insert(17,5,0,5) << Insert(22,1,0,13) << Insert(38,3,0,10));
+
+ QTest::newRow("i(28,2),m(7,5,22)")
+ << (SignalList() << Insert(28,2) << Move(7,5,22,0))
+ << (SignalList() << Remove(7,21,0,0) << Insert(5,21,0,0) << Insert(26,1) << Insert(29,1));
+
+ QTest::newRow("i(16,3),m(18,28,15)")
+ << (SignalList() << Insert(16,3) << Move(18,28,15,0))
+ << (SignalList() << Remove(16,14,0,1) << Insert(16,2) << Insert(28,1) << Insert(29,14,0,1));
+
+ QTest::newRow("m(33,12,6),m(18,20,20)")
+ << (SignalList() << Move(22,12,6,0) << Move(18,20,20,1))
+ << (SignalList() << Remove(12,10,1,0) << Remove(12,6,0,0) << Remove(12,10,1,10)
+ << Insert(12,6,0,0) << Insert(20,20,1,0));
+ QTest::newRow("m(33,12,6),m(18,20,20),m(38,19,1)")
+ << (SignalList() << Move(22,12,6,0) << Move(18,20,20,1) << Move(28,19,1,2))
+ << (SignalList() << Remove(12,10,1,0) << Remove(12,6,0,0) << Remove(12,10,1,10)
+ << Insert(12,6,0,0) << Insert(19,1,1,8) << Insert(21,8,1,0) << Insert(29,11,1,9));
+ QTest::newRow("m(33,12,6),m(18,20,20),m(38,19,1),r(34,4)")
+ << (SignalList() << Move(22,12,6,0) << Move(18,20,20,1) << Move(28,19,1,2) << Remove(34,4))
+ << (SignalList() << Remove(12,10,1,0) << Remove(12,6,0,0) << Remove(12,10,1,10)
+ << Insert(12,6,0,0) << Insert(19,1,1,8) << Insert(21,8,1,0) << Insert(29,5,1,9) << Insert(34,2,1,18));
+ QTest::newRow("m(33,12,6),m(18,20,20),m(38,19,1),r(34,4),m(13,9,15)")
+ << (SignalList() << Move(22,12,6,0) << Move(18,20,20,1) << Move(28,19,1,2) << Remove(34,4) << Move(13,9,15,3))
+ << (SignalList() << Remove(12,10,1,0) << Remove(12,6,0,0) << Remove(12,10,1,10) << Remove(12,1,3,5) << Remove(12,1,3,7)
+ << Insert(9,5,0,1) << Insert(14,1,3,5) << Insert(15,1,1,8) << Insert(16,1,3,7) << Insert(17,7,1,0) << Insert(27,1,0,0) << Insert(28,1,1,7) << Insert(29,5,1,9) << Insert(34,2,1,18));
+
+ QTest::newRow("i(8,5),m(14,26,14)")
+ << (SignalList() << Insert(8,5) << Move(14,26,14,0))
+ << (SignalList() << Remove(9,14,0,0) << Insert(8,5) << Insert(26,14,0,0));
+ QTest::newRow("i(8,5),m(14,26,14),r(45,0)")
+ << (SignalList() << Insert(8,5) << Move(14,26,14,0) << Remove(45,0))
+ << (SignalList() << Remove(9,14,0,0) << Insert(8,5) << Insert(26,14,0,0));
+ QTest::newRow("i(8,5),m(14,26,14),r(45,0),m(5,8,21)")
+ << (SignalList() << Insert(8,5) << Move(14,26,14,0) << Remove(45,0) << Move(5,8,21,1))
+ << (SignalList() << Remove(5,3,1,0) << Remove(5,1,1,8) << Remove(5,14,0,0) << Remove(5,12,1,9)
+ << Insert(5,3,0,0) << Insert(8,3,1,0) << Insert(11,5) << Insert(16,13,1,8) << Insert(29,11,0,3));
+
+ QTest::newRow("i(35,1),r(5,31)")
+ << (SignalList() << Insert(35,1) << Remove(5,31))
+ << (SignalList() << Remove(5,30));
+ QTest::newRow("i(35,1),r(5,31),m(9,8,1)")
+ << (SignalList() << Insert(35,1) << Remove(5,31) << Move(9,8,1,0))
+ << (SignalList() << Remove(5,30) << Remove(9,1,0,0) << Insert(8,1,0,0));
+ QTest::newRow("i(35,1),r(5,31),m(9,8,1),i(7,2)")
+ << (SignalList() << Insert(35,1) << Remove(5,31) << Move(9,8,1,0) << Insert(7,2))
+ << (SignalList() << Remove(5,30) << Remove(9,1,0,0) << Insert(7,2) << Insert(10,1,0,0));
+ QTest::newRow("i(35,1),r(5,31),m(9,8,1),i(7,2),r(4,3)")
+ << (SignalList() << Insert(35,1) << Remove(5,31) << Move(9,8,1,0) << Insert(7,2) << Remove(4,3))
+ << (SignalList() << Remove(4,33) << Remove(6,1,0,0) << Insert(4,2) << Insert(7,1,0,0));
+
+ QTest::newRow("r(37,0),r(21,1)")
+ << (SignalList() << Remove(37,0) << Remove(21,1))
+ << (SignalList() << Remove(21,1));
+ QTest::newRow("r(37,0),r(21,1),m(27,35,2)")
+ << (SignalList() << Remove(37,0) << Remove(21,1) << Move(27,35,2,0))
+ << (SignalList() << Remove(21,1) << Remove(27,2,0,0) << Insert(35,2,0,0));
+ QTest::newRow("r(37,0),r(21,1),m(27,35,2),i(31,5)")
+ << (SignalList() << Remove(37,0) << Remove(21,1) << Move(27,35,2,0) << Insert(31,5))
+ << (SignalList() << Remove(21,1) << Remove(27,2,0,0) << Insert(31,5) << Insert(40,2,0,0));
+ QTest::newRow("r(37,0),r(21,1),m(27,35,2),i(31,5),r(10,31)")
+ << (SignalList() << Remove(37,0) << Remove(21,1) << Move(27,35,2,0) << Insert(31,5) << Remove(10,31))
+ << (SignalList() << Remove(10, 18) << Remove(10,2,0,0) << Remove(10,8) << Insert(10,1,0,1));
+
+ QTest::newRow("m(1,1,39),r(26,10)")
+ << (SignalList() << Move(1,1,39,0) << Remove(26,10))
+ << (SignalList() << Remove(1,39,0,0) << Insert(1,25,0,0) << Insert(26,4,0,35));
+ QTest::newRow("m(1,1,39),r(26,10),i(10,5)")
+ << (SignalList() << Move(1,1,39,0) << Remove(26,10) << Insert(10,5))
+ << (SignalList() << Remove(1,39,0,0) << Insert(1,9,0,0) << Insert(10,5) << Insert(15,16,0,9) << Insert(31,4,0,35));
+ QTest::newRow("m(1,1,39),r(26,10),i(10,5),i(27,3)")
+ << (SignalList() << Move(1,1,39,0) << Remove(26,10) << Insert(10,5) << Insert(27,3))
+ << (SignalList() << Remove(1,39,0,0)
+ << Insert(1,9,0,0) << Insert(10,5) << Insert(15,12,0,9) << Insert(27,3) << Insert(30,4,0,21) << Insert(34,4,0,35));
+ QTest::newRow("m(1,1,39),r(26,10),i(10,5),i(27,3),r(28,5)")
+ << (SignalList() << Move(1,1,39,0) << Remove(26,10) << Insert(10,5) << Insert(27,3) << Remove(28,5))
+ << (SignalList() << Remove(1,39,0,0)
+ << Insert(1,9,0,0) << Insert(10,5) << Insert(15,12,0,9) << Insert(27,1) << Insert(28,1,0,24) << Insert(29,4,0,35));
+
+ QTest::newRow("i(36,4)m(25,39,5)")
+ << (SignalList() << Insert(36,4) << Move(25,39,5,0))
+ << (SignalList() << Remove(25,5,0,0) << Insert(31,4) << Insert(39,5,0,0));
+ QTest::newRow("i(36,4)m(25,39,5),i(16,5)")
+ << (SignalList() << Insert(36,4) << Move(25,39,5,0) << Insert(16,5))
+ << (SignalList() << Remove(25,5,0,0) << Insert(16,5) << Insert(36,4) << Insert(44,5,0,0));
+ QTest::newRow("i(36,4)m(25,39,5),i(16,5),i(37,5)")
+ << (SignalList() << Insert(36,4) << Move(25,39,5,0) << Insert(16,5) << Insert(37,5))
+ << (SignalList() << Remove(25,5,0,0) << Insert(16,5) << Insert(36,9) << Insert(49,5,0,0));
+ QTest::newRow("i(36,4)m(25,39,5),i(16,5),i(37,5),m(40,21,11)")
+ << (SignalList() << Insert(36,4) << Move(25,39,5,0) << Insert(16,5) << Insert(37,5) << Move(40,21,11,1))
+ << (SignalList() << Remove(25,5,0,0) << Remove(31,4,1,5)
+ << Insert(16,10) << Insert(26,4,1,5) << Insert(30,2,0,0) << Insert(47,4) << Insert(51,3,0,2));
+
+ QTest::newRow("i(24,1),r(33,4)")
+ << (SignalList() << Insert(24,1) << Remove(33,4))
+ << (SignalList() << Remove(32,4) << Insert(24,1));
+ QTest::newRow("i(24,1),r(33,4),r(15,15)")
+ << (SignalList() << Insert(24,1) << Remove(33,4) << Remove(15,15))
+ << (SignalList() << Remove(15,14) << Remove(18,4));
+ QTest::newRow("i(24,1),r(33,4),r(15,15),m(8,10,2)")
+ << (SignalList() << Insert(24,1) << Remove(33,4) << Remove(15,15) << Move(8,10,2,0))
+ << (SignalList() << Remove(8,2,0,0) << Remove(13,14) << Remove(16,4) << Insert(10,2,0,0));
+ QTest::newRow("i(24,1),r(33,4),r(15,15),m(8,10,2),r(2,19)")
+ << (SignalList() << Insert(24,1) << Remove(33,4) << Remove(15,15) << Move(8,10,2,0) << Remove(2,19))
+ << (SignalList() << Remove(2,6) << Remove(2,2,0,0) << Remove(2,29));
+
+ QTest::newRow("r(1,35),i(3,4),m(4,2,2)")
+ << (SignalList() << Remove(1,35) << Insert(3,4) << Move(4,2,2,0))
+ << (SignalList() << Remove(1,35) <<Insert(2,2) << Insert(5,2));
+ QTest::newRow("r(1,35),i(3,4),m(4,2,2),r(7,1)")
+ << (SignalList() << Remove(1,35) << Insert(3,4) << Move(4,2,2,0) << Remove(7,1))
+ << (SignalList() << Remove(1,35) << Remove(3,1) << Insert(2,2) << Insert(5,2));
+
+ QTest::newRow("i(30,4),m(7,28,16),m(6,7,13)")
+ << (SignalList() << Insert(30,4) << Move(7,28,16,0))
+ << (SignalList() << Remove(7,16,0,0) << Insert(14,4) << Insert(28,16,0,0));
+ QTest::newRow("(i(30,4),m(7,28,16),m(6,7,13),m(41,35,2)")
+ << (SignalList() << Insert(30,4) << Move(7,28,16,0) << Move(6,7,13,1) << Move(41,35,2,2))
+ << (SignalList() << Remove(6,1,1,0) << Remove(6,16,0,0) << Remove(6,7,1,1) << Remove(6,1,1,12)
+ << Insert(7,8,1,0) << Insert(15,4) << Insert(19,1,1,12) << Insert(28,7,0,0) << Insert(35,2,0,13) << Insert(37,6,0,7) << Insert(43,1,0,15));
+
+ QTest::newRow("(i(35,2),r(39,0))(r(25,11))")
+ << (SignalList() << Insert(35,2) << Remove(39,0) << Remove(25,11))
+ << (SignalList() << Remove(25,10) << Insert(25,1));
+ QTest::newRow("(i(35,2),r(39,0))(r(25,11),m(28,8,7))")
+ << (SignalList() << Insert(35,2) << Remove(39,0) << Remove(25,11) << Move(24,8,7,0))
+ << (SignalList() << Remove(24,1,0,0) << Remove(24,10) << Remove(24,5,0,2)
+ << Insert(8,1,0,0) << Insert(9,1) << Insert(10,5,0,2));
+
+ QTest::newRow("i(26,1),i(39,1)")
+ << (SignalList() << Insert(26,1) << Insert(39,1))
+ << (SignalList() << Insert(26,1) << Insert(39,1));
+ QTest::newRow("i(26,1),i(39,1),m(31,34,2)")
+ << (SignalList() << Insert(26,1) << Insert(39,1) << Move(31,34,2,0))
+ << (SignalList() << Remove(30,2,0,0) << Insert(26,1) << Insert(34,2,0,0) << Insert(39,1));
+ QTest::newRow("i(26,1),i(39,1),m(31,34,2),r(15,27)")
+ << (SignalList() << Insert(26,1) << Insert(39,1) << Move(31,34,2,0) << Remove(15,27))
+ << (SignalList() << Remove(15,15) << Remove(15,2,0,0) << Remove(15,8));
+
+ QTest::newRow("i(19,1),i(2,3)")
+ << (SignalList() << Insert(19,1) << Insert(2,3))
+ << (SignalList() << Insert(2,3) << Insert(22,1));
+ QTest::newRow("i(19,1),i(2,3),r(38,4)")
+ << (SignalList() << Insert(19,1) << Insert(2,3) << Remove(38,4))
+ << (SignalList() << Remove(34,4) << Insert(2,3) << Insert(22,1));
+ QTest::newRow("i(19,1),(2,3),r(38,4),m(2,20,3")
+ << (SignalList() << Insert(19,1) << Insert(2,3) << Remove(38,4) << Move(2,20,3,0))
+ << (SignalList() << Remove(34,4) << Insert(19,4));
+
+ QTest::newRow("i(4,3),i(19,1)")
+ << (SignalList() << Insert(4,3) << Insert(19,1))
+ << (SignalList() << Insert(4,3) << Insert(19,1));
+ QTest::newRow("i(4,3),i(19,1),i(31,3)")
+ << (SignalList() << Insert(4,3) << Insert(19,1) << Insert(31,3))
+ << (SignalList() << Insert(4,3) << Insert(19,1) << Insert(31,3));
+ QTest::newRow("i(4,3),i(19,1),i(31,3),m(8,10,29)")
+ << (SignalList() << Insert(4,3) << Insert(19,1) << Insert(31,3) << Move(8,10,29,0))
+ << (SignalList() << Remove(5,11,0,0) << Remove(5,11,0,12) << Remove(5,3,0,26)
+ << Insert(4,3) << Insert(10,11,0,0) << Insert(21,1) << Insert(22,11,0,12) << Insert(33,3) << Insert(36,3,0,26));
+
+ QTest::newRow("m(18,15,16),i(0,1)")
+ << (SignalList() << Move(18,15,16,0) << Insert(0,1))
+ << (SignalList() << Remove(18,16,0,0) << Insert(0,1) << Insert(16,16,0,0));
+ QTest::newRow("m(18,15,16),i(0,1),i(32,2)")
+ << (SignalList() << Move(18,15,16,0) << Insert(0,1) << Insert(32,2))
+ << (SignalList() << Remove(18,16,0,0) << Insert(0,1) << Insert(16,16,0,0) << Insert(32,2));
+ QTest::newRow("m(18,15,16),i(0,1),i(32,2),i(29,2)")
+ << (SignalList() << Move(18,15,16,0) << Insert(0,1) << Insert(32,2) << Insert(29,2))
+ << (SignalList() << Remove(18,16,0,0) << Insert(0,1) << Insert(16,13,0,0) << Insert(29,2) << Insert(31,3,0,13) << Insert(34,2));
+
+ QTest::newRow("i(38,5),i(12,5)")
+ << (SignalList() << Insert(38,5) << Insert(12,5))
+ << (SignalList() << Insert(12,5) << Insert(43,5));
+ QTest::newRow("i(38,5),i(12,5),i(48,3)")
+ << (SignalList() << Insert(38,5) << Insert(12,5) << Insert(48,3))
+ << (SignalList() << Insert(12,5) << Insert(43,8));
+ QTest::newRow("i(38,5),i(12,5),i(48,3),m(28,6,6)")
+ << (SignalList() << Insert(38,5) << Insert(12,5) << Insert(48,3) << Move(28,6,6,0))
+ << (SignalList() << Remove(23,6,0,0) << Insert(6,6,0,0) << Insert(18,5) << Insert(43,8));
+
+ QTest::newRow("r(8,9),m(7,10,18)")
+ << (SignalList() << Remove(8,9) << Move(7,10,18,0))
+ << (SignalList() << Remove(7,1,0,0) << Remove(7,9) << Remove(7,17,0,1) << Insert(10,18,0,0));
+ QTest::newRow("r(8,9),m(7,10,18),m(8,10,18)")
+ << (SignalList() << Remove(8,9) << Move(7,10,18,0) << Move(8,10,18,1))
+ << (SignalList() << Remove(7,1,0,0) << Remove(7,9) << Remove(7,17,0,1) << Remove(8,2,1,0) << Insert(8,2,0,16) << Insert(10,2,1,0) << Insert(12,16,0,0));
+ QTest::newRow("r(8,9),m(7,10,18),m(8,10,18),i(17,2)")
+ << (SignalList() << Remove(8,9) << Move(7,10,18,0) << Move(8,10,18,1) << Insert(17,2))
+ << (SignalList() << Remove(7,1,0,0) << Remove(7,9) << Remove(7,17,0,1) << Remove(8,2,1,0) << Insert(8,2,0,16) << Insert(10,2,1,0) << Insert(12,5,0,0) << Insert(17,2) << Insert(19,11,0,5));
+
+ QTest::newRow("r(39,0),m(18,1,21)")
+ << (SignalList() << Remove(39,0) << Move(18,1,21,0))
+ << (SignalList() << Remove(18,21,0,0) << Insert(1,21,0,0));
+ QTest::newRow("r(39,0),m(18,1,21),m(2,6,31)")
+ << (SignalList() << Remove(39,0) << Move(18,1,21,0) << Move(2,6,31,1))
+ << (SignalList() << Remove(1,11,1,20) << Remove(7,21,0,0) << Insert(1,1,0,0) << Insert(6,20,0,1) << Insert(26,11,1,20));
+ QTest::newRow("r(39,0),m(18,1,21),m(2,6,31),r(9,4)")
+ << (SignalList() << Remove(39,0) << Move(18,1,21,0) << Move(2,6,31,1) << Remove(9,4))
+ << (SignalList() << Remove(1,11,1,20) << Remove(7,21,0,0) << Insert(1,1,0,0) << Insert(6,3,0,1) << Insert(9,13,0,8) << Insert(22,11,1,20));
+
+ QTest::newRow("i(1,1),m(9,32,3)")
+ << (SignalList()
+ << Insert(1,1) << Move(9,32,3,0))
+ << (SignalList() << Remove(8,3,0,0) << Insert(1,1) << Insert(32,3,0,0));
+ QTest::newRow("i(1,1),m(9,32,3),r(22,1)")
+ << (SignalList()
+ << Insert(1,1) << Move(9,32,3,0) << Remove(22,1))
+ << (SignalList() << Remove(8,3,0,0) << Remove(21,1) << Insert(1,1) << Insert(31,3,0,0));
+ QTest::newRow("i(1,1),m(9,32,3),r(22,1),i(29,3)")
+ << (SignalList()
+ << Insert(1,1) << Move(9,32,3,0) << Remove(22,1) << Insert(29,3))
+ << (SignalList() << Remove(8,3,0,0) << Remove(21,1) << Insert(1,1) << Insert(29,3) << Insert(34,3,0,0));
+ QTest::newRow("i(1,1),m(9,32,3),r(22,1),i(29,3),m(7,15,23)")
+ << (SignalList()
+ << Insert(1,1) << Move(9,32,3,0) << Remove(22,1) << Insert(29,3) << Move(7,15,23,1))
+ << (SignalList() << Remove(6,2,1,0) << Remove(6,3,0,0) << Remove(6,13,1,2) << Remove(6,1) << Remove(6,7,1,15) << Insert(1,1) << Insert(7,2) << Insert(11,3,0,0) << Insert(15,22,1,0) << Insert(37,1));
+
+ QTest::newRow("r(36,4),m(3,2,14)")
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0))
+ << (SignalList() << Remove(3,14,0,0) << Remove(22,4) << Insert(2,14,0,0));
+ QTest::newRow("r(36,4),m(3,2,14),i(36,3)")
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3))
+ << (SignalList() << Remove(3,14,0,0) << Remove(22,4) << Insert(2,14,0,0) << Insert(36,3));
+ QTest::newRow("r(36,4),m(3,2,14),i(36,3),r(30,7)")
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7))
+ << (SignalList() << Remove(3,14,0,0) << Remove(16,10) << Insert(2,14,0,0) << Insert(30,2)); // ###
+ QTest::newRow("r(36,4),m(3,2,14),i(36,3),r(30,7),i(3,5)")
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Remove(3,14,0,0) << Remove(16,10) << Insert(2,1,0,0) << Insert(3,5) << Insert(8,13,0,1) << Insert(35,2)); // ###
+
+ QTest::newRow("3*5 (10)")
+ << (SignalList()
+ << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5)
+ << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2))
+ << (SignalList()
+ << Remove(2,1,2,12) << Remove(2,14,0,0) << Remove(2,2,2,13) << Remove(2,1)
+ << Remove(2,7,2,15) << Remove(5,10) << Insert(1,1) << Insert(3,1,0,0)
+ << Insert(4,3) << Insert(7,2) << Insert(11,3,0,1) << Insert(15,2)
+ << Insert(17,10,0,4) << Insert(27,10,2,12) << Insert(37,3));
+ QTest::newRow("3*5 (11)")
+ << (SignalList()
+ << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5)
+ << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2)
+ << Move(38,23,1,3))
+ << (SignalList()
+ << Remove(2,1,2,12) << Remove(2,14,0,0) << Remove(2,2,2,13)
+ << Remove(2,1) << Remove(2,7,2,15) << Remove(5,10) << Insert(1,1)
+ << Insert(3,1,0,0) << Insert(4,3) << Insert(7,2) << Insert(11,3,0,1) << Insert(15,2)
+ << Insert(17,6,0,4) << Insert(23,1) << Insert(24,4,0,10) << Insert(28,10,2,12)
+ << Insert(38,2));
+ QTest::newRow("3*5 (12)")
+ << (SignalList()
+ << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5)
+ << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2)
+ << Move(38,23,1,3) << Move(38,31,0,4))
+ << (SignalList()
+ << Remove(2,1,2,12) << Remove(2,14,0,0) << Remove(2,2,2,13) << Remove(2,1)
+ << Remove(2,7,2,15) << Remove(5,10) << Insert(1,1) << Insert(3,1,0,0)
+ << Insert(4,3) << Insert(7,2) << Insert(11,3,0,1) << Insert(15,2) << Insert(17,6,0,4)
+ << Insert(23,1) << Insert(24,4,0,10) << Insert(28,10,2,12) << Insert(38,2));
+ QTest::newRow("3*5 (13)")
+ << (SignalList()
+ << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5)
+ << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2)
+ << Move(38,23,1,3) << Move(38,31,0,4) << Remove(26,11))
+ << (SignalList()
+ << Remove(2,1,2,12) << Remove(2,14,0,0) << Remove(2,2,2,13) << Remove(2,1)
+ << Remove(2,7,2,15) << Remove(5,10) << Insert(1,1) << Insert(3,1,0,0)
+ << Insert(4,3) << Insert(7,2) << Insert(11,3,0,1) << Insert(15,2) << Insert(17,6,0,4)
+ << Insert(23,1) << Insert(24,2,0,10) << Insert(26,1,2,21) << Insert(27,2));
+ QTest::newRow("3*5 (14)")
+ << (SignalList()
+ << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5)
+ << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2)
+ << Move(38,23,1,3) << Move(38,31,0,4) << Remove(26,11) << Move(5,7,18,5))
+ << (SignalList()
+ << Remove(2,1,2,12) << Remove(2,14,0,0) << Remove(2,2,2,13) << Remove(2,1)
+ << Remove(2,7,2,15) << Remove(2,2,5,4) << Remove(2,1,5,9) << Remove(2,10)
+ << Insert(1,1) << Insert(3,1,0,0) << Insert(4,1) << Insert(5,1)
+ << Insert(6,1,0,10) << Insert(7,4) << Insert(11,2,5,4)
+ << Insert(13,3,0,1) << Insert(16,1,5,9) << Insert(17,2) << Insert(19,6,0,4)
+ << Insert(25,1,0,11) << Insert(26,1,2,21) << Insert(27,2));
+ QTest::newRow("3*5 (15)")
+ << (SignalList()
+ << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5)
+ << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2)
+ << Move(38,23,1,3) << Move(38,31,0,4) << Remove(26,11) << Move(5,7,18,5) << Move(19,0,8,6))
+ << (SignalList()
+ << Remove(2,1,2,12) << Remove(2,14,0,0) << Remove(2,2,2,13) << Remove(2,1)
+ << Remove(2,7,2,15) << Remove(2,2,5,4) << Remove(2,1,5,9) << Remove(2,10)
+ << Insert(0,6,0,4) << Insert(6,1,0,11) << Insert(7,1,2,21) << Insert(9,1)
+ << Insert(11,1,0,0) << Insert(12,1) << Insert(13,1) << Insert(14,1,0,10)
+ << Insert(15,4) << Insert(19,2,5,4) << Insert(21,3,0,1)
+ << Insert(24,1,5,9) << Insert(25,2) << Insert(27,2));
+}
+
+void tst_qqmlchangeset::sequence()
+{
+ QFETCH(SignalList, input);
+ QFETCH(SignalList, output);
+
+ QQmlChangeSet set;
+
+ foreach (const Signal &signal, input) {
+ if (signal.isRemove())
+ set.remove(signal.index, signal.count);
+ else if (signal.isInsert())
+ set.insert(signal.index, signal.count);
+ else if (signal.isMove())
+ set.move(signal.index, signal.to, signal.count, signal.moveId);
+ else if (signal.isChange())
+ set.change(signal.index, signal.count);
+ }
+
+ SignalList changes;
+ foreach (const QQmlChangeSet::Remove &remove, set.removes())
+ changes << Remove(remove.index, remove.count, remove.moveId, remove.offset);
+ foreach (const QQmlChangeSet::Insert &insert, set.inserts())
+ changes << Insert(insert.index, insert.count, insert.moveId, insert.offset);
+ foreach (const QQmlChangeSet::Change &change, set.changes())
+ changes << Change(change.index, change.count);
+
+ VERIFY_EXPECTED_OUTPUT
+ QCOMPARE(changes, output);
+}
+
+void tst_qqmlchangeset::apply_data()
+{
+ QTest::addColumn<SignalListList>("input");
+
+ QTest::newRow("(r(1,35),i(3,4)),(m(4,2,2),r(7,1))")
+ << (SignalListList()
+ << (SignalList() << Remove(1,35) << Insert(3,4))
+ << (SignalList() << Move(4,2,2,0) << Remove(7,1)));
+
+ QTest::newRow("(i(30,4),m(7,28,16))(m(6,7,13),m(41,35,2))")
+ << (SignalListList()
+ << (SignalList() << Insert(30,4) << Move(7,28,16,0))
+ << (SignalList() << Move(6,7,13,1) << Move(41,35,2,2)));
+
+ QTest::newRow("(i(35,2),r(39,0))(r(25,11),m(24,8,7))")
+ << (SignalListList()
+ << (SignalList() << Insert(35,2) << Remove(39,0))
+ << (SignalList() << Remove(25,11) << Move(24,8,7,0)));
+
+ QTest::newRow("i(26,1),i(39,1),m(31,34,2),r(15,27)")
+ << (SignalListList()
+ << (SignalList() << Insert(26,1) << Insert(39,1))
+ << (SignalList() << Move(31,34,2,0) << Remove(15,27)));
+
+ QTest::newRow("i(19,1),(2,3),r(38,4),m(2,20,3)")
+ << (SignalListList()
+ << (SignalList() << Insert(19,1) << Insert(2,3))
+ << (SignalList() << Remove(38,4) << Move(2,20,3,0)));
+
+ QTest::newRow("i(4,3),i(19,1),i(31,3),m(8,10,29)")
+ << (SignalListList()
+ << (SignalList() << Insert(4,3) << Insert(19,1))
+ << (SignalList() << Insert(31,3) << Move(8,10,29,0)));
+
+ QTest::newRow("m(18,15,16),i(0,1),i(32,2),i(29,2)")
+ << (SignalListList()
+ << (SignalList() << Move(18,15,16,0) << Insert(0,1))
+ << (SignalList() << Insert(32,2) << Insert(29,2)));
+
+ QTest::newRow("i(38,5),i(12,5),i(48,3),m(28,6,6)")
+ << (SignalListList()
+ << (SignalList() << Insert(38,5) << Insert(12,5))
+ << (SignalList() << Insert(48,3) << Move(28,6,6,0)));
+
+ QTest::newRow("r(8,9),m(7,10,18),m(8,10,18),i(17,2)")
+ << (SignalListList()
+ << (SignalList() << Remove(8,9) << Move(7,10,18,0))
+ << (SignalList() << Move(8,10,18,1) << Insert(17,2)));
+
+ QTest::newRow("r(39,0),m(18,1,21),m(2,6,31),r(9,4)")
+ << (SignalListList()
+ << (SignalList() << Remove(39,0) << Move(18,1,21,0))
+ << (SignalList() << Move(2,6,31,1) << Remove(9,4)));
+
+ QTest::newRow("3*5 (5)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5)));
+ QTest::newRow("3*5 (6)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1)));
+ QTest::newRow("3*5 (7)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1)));
+ QTest::newRow("3*5 (8)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1)));
+ QTest::newRow("3*5 (9)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3)));
+ QTest::newRow("3*5 (10)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2)));
+ QTest::newRow("3*5 (11)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2))
+ << (SignalList() << Move(38,23,1,3)));
+ QTest::newRow("3*5 (12)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2))
+ << (SignalList() << Move(38,23,1,3) << Move(38,31,0,4)));
+ QTest::newRow("3*5 (13)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2))
+ << (SignalList() << Move(38,23,1,3) << Move(38,31,0,4) << Remove(26,11)));
+ QTest::newRow("3*5 (14)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2))
+ << (SignalList() << Move(38,23,1,3) << Move(38,31,0,4) << Remove(26,11) << Move(5,7,18,5)));
+ QTest::newRow("3*5 (15)")
+ << (SignalListList()
+ << (SignalList() << Remove(36,4) << Move(3,2,14,0) << Insert(36,3) << Remove(30,7) << Insert(3,5))
+ << (SignalList() << Insert(1,1) << Move(9,32,3,1) << Remove(22,1) << Insert(29,3) << Move(7,15,23,2))
+ << (SignalList() << Move(38,23,1,3) << Move(38,31,0,4) << Remove(26,11) << Move(5,7,18,5) << Move(19,0,8,6)));
+}
+
+void tst_qqmlchangeset::apply()
+{
+ QFETCH(SignalListList, input);
+
+ QQmlChangeSet set;
+ QQmlChangeSet linearSet;
+
+ foreach (const SignalList &list, input) {
+ QQmlChangeSet intermediateSet;
+ foreach (const Signal &signal, list) {
+ if (signal.isRemove()) {
+ intermediateSet.remove(signal.index, signal.count);
+ linearSet.remove(signal.index, signal.count);
+ } else if (signal.isInsert()) {
+ intermediateSet.insert(signal.index, signal.count);
+ linearSet.insert(signal.index, signal.count);
+ } else if (signal.isMove()) {
+ intermediateSet.move(signal.index, signal.to, signal.count, signal.moveId);
+ linearSet.move(signal.index, signal.to, signal.count, signal.moveId);
+ }
+ }
+ set.apply(intermediateSet);
+ }
+
+ SignalList changes;
+ foreach (const QQmlChangeSet::Remove &remove, set.removes())
+ changes << Remove(remove.index, remove.count, remove.moveId, remove.offset);
+ foreach (const QQmlChangeSet::Insert &insert, set.inserts())
+ changes << Insert(insert.index, insert.count, insert.moveId, insert.offset);
+
+ SignalList linearChanges;
+ foreach (const QQmlChangeSet::Remove &remove, linearSet.removes())
+ linearChanges << Remove(remove.index, remove.count, remove.moveId, remove.offset);
+ foreach (const QQmlChangeSet::Insert &insert, linearSet.inserts())
+ linearChanges << Insert(insert.index, insert.count, insert.moveId, insert.offset);
+
+ // The output in the failing tests isn't incorrect, merely sub-optimal.
+ QEXPECT_FAIL("3*5 (10)", "inserts not joined when dividing space removed", Abort);
+ QEXPECT_FAIL("3*5 (11)", "inserts not joined when dividing space removed", Abort);
+ QEXPECT_FAIL("3*5 (12)", "inserts not joined when dividing space removed", Abort);
+ QEXPECT_FAIL("3*5 (13)", "inserts not joined when dividing space removed", Abort);
+ QEXPECT_FAIL("3*5 (14)", "inserts not joined when dividing space removed", Abort);
+ QEXPECT_FAIL("3*5 (15)", "inserts not joined when dividing space removed", Abort);
+ QCOMPARE(changes, linearChanges);
+}
+
+void tst_qqmlchangeset::removeConsecutive_data()
+{
+ QTest::addColumn<SignalList>("input");
+ QTest::addColumn<SignalList>("output");
+
+ QTest::newRow("at start")
+ << (SignalList() << Remove(0,2) << Remove(0,1) << Remove(0,5))
+ << (SignalList() << Remove(0,8));
+ QTest::newRow("offset")
+ << (SignalList() << Remove(3,2) << Remove(3,1) << Remove(3,5))
+ << (SignalList() << Remove(3,8));
+ QTest::newRow("with move")
+ << (SignalList() << Remove(0,2) << Remove(0,1,0,0) << Remove(0,5))
+ << (SignalList() << Remove(0,2) << Remove(0,1,0,0) << Remove(0,5));
+}
+
+void tst_qqmlchangeset::removeConsecutive()
+{
+ QFETCH(SignalList, input);
+ QFETCH(SignalList, output);
+
+ QVector<QQmlChangeSet::Remove> removes;
+ foreach (const Signal &signal, input) {
+ QVERIFY(signal.isRemove());
+ removes.append(QQmlChangeSet::Remove(signal.index, signal.count, signal.moveId, signal.offset));
+ }
+
+ QQmlChangeSet set;
+ set.remove(removes);
+
+ SignalList changes;
+ foreach (const QQmlChangeSet::Remove &remove, set.removes())
+ changes << Remove(remove.index, remove.count, remove.moveId, remove.offset);
+ QVERIFY(set.inserts().isEmpty());
+ QVERIFY(set.changes().isEmpty());
+
+ VERIFY_EXPECTED_OUTPUT
+ QCOMPARE(changes, output);
+}
+
+void tst_qqmlchangeset::insertConsecutive_data()
+{
+ QTest::addColumn<SignalList>("input");
+ QTest::addColumn<SignalList>("output");
+
+ QTest::newRow("at start")
+ << (SignalList() << Insert(0,2) << Insert(2,1) << Insert(3,5))
+ << (SignalList() << Insert(0,8));
+ QTest::newRow("offset")
+ << (SignalList() << Insert(3,2) << Insert(5,1) << Insert(6,5))
+ << (SignalList() << Insert(3,8));
+ QTest::newRow("with move")
+ << (SignalList() << Insert(0,2) << Insert(2,1,0,0) << Insert(3,5))
+ << (SignalList() << Insert(0,2) << Insert(2,1,0,0) << Insert(3,5));
+}
+
+void tst_qqmlchangeset::insertConsecutive()
+{
+ QFETCH(SignalList, input);
+ QFETCH(SignalList, output);
+
+ QVector<QQmlChangeSet::Insert> inserts;
+ foreach (const Signal &signal, input) {
+ QVERIFY(signal.isInsert());
+ inserts.append(QQmlChangeSet::Insert(signal.index, signal.count, signal.moveId, signal.offset));
+ }
+
+ QQmlChangeSet set;
+ set.insert(inserts);
+
+ SignalList changes;
+ foreach (const QQmlChangeSet::Insert &insert, set.inserts())
+ changes << Insert(insert.index, insert.count, insert.moveId, insert.offset);
+ QVERIFY(set.removes().isEmpty());
+ QVERIFY(set.changes().isEmpty());
+
+ VERIFY_EXPECTED_OUTPUT
+ QCOMPARE(changes, output);
+}
+
+void tst_qqmlchangeset::copy()
+{
+ QQmlChangeSet changeSet;
+ changeSet.remove(0, 12);
+ changeSet.remove(5, 4);
+ changeSet.insert(3, 9);
+ changeSet.insert(15, 2);
+ changeSet.change(24, 8);
+ changeSet.move(3, 5, 9, 0);
+
+ QQmlChangeSet copy(changeSet);
+
+ QQmlChangeSet assign;
+ assign = changeSet;
+
+ copy.move(4, 2, 5, 1);
+ assign.move(4, 2, 5, 1);
+ changeSet.move(4, 2, 5, 1);
+
+ QCOMPARE(copy.removes(), changeSet.removes());
+ QCOMPARE(copy.inserts(), changeSet.inserts());
+ QCOMPARE(copy.changes(), changeSet.changes());
+ QCOMPARE(copy.difference(), changeSet.difference());
+
+ QCOMPARE(assign.removes(), changeSet.removes());
+ QCOMPARE(assign.inserts(), changeSet.inserts());
+ QCOMPARE(assign.changes(), changeSet.changes());
+ QCOMPARE(assign.difference(), changeSet.difference());
+}
+
+void tst_qqmlchangeset::debug()
+{
+ QQmlChangeSet changeSet;
+ changeSet.remove(0, 12);
+ changeSet.remove(5, 4);
+ changeSet.insert(3, 9);
+ changeSet.insert(15, 2);
+ changeSet.change(24, 8);
+
+ QTest::ignoreMessage(QtDebugMsg, "QQmlChangeSet(Remove(0,12) Remove(5,4) Insert(3,9) Insert(15,2) Change(24,8) )");
+ qDebug() << changeSet;
+
+ changeSet.clear();
+
+ QTest::ignoreMessage(QtDebugMsg, "QQmlChangeSet(Remove(12,4,0,0) Insert(5,4,0,0) )");
+
+ changeSet.move(12, 5, 4, 0);
+ qDebug() << changeSet;
+}
+
+void tst_qqmlchangeset::random_data()
+{
+ QTest::addColumn<int>("seed");
+ QTest::addColumn<int>("combinations");
+ QTest::addColumn<int>("depth");
+ QTest::newRow("1*5") << 32 << 1 << 5;
+ QTest::newRow("2*2") << 32 << 2 << 2;
+ QTest::newRow("3*2") << 32 << 3 << 2;
+ QTest::newRow("3*5") << 32 << 3 << 5;
+}
+
+void tst_qqmlchangeset::random()
+{
+ QFETCH(int, seed);
+ QFETCH(int, combinations);
+ QFETCH(int, depth);
+
+ qsrand(seed);
+
+ int failures = 0;
+ for (int i = 0; i < 20000; ++i) {
+ QQmlChangeSet accumulatedSet;
+ SignalList input;
+
+ int modelCount = 40;
+ int moveCount = 0;
+
+ for (int j = 0; j < combinations; ++j) {
+ QQmlChangeSet set;
+ for (int k = 0; k < depth; ++k) {
+ switch (-(qrand() % 3)) {
+ case InsertOp: {
+ int index = qrand() % (modelCount + 1);
+ int count = qrand() % 5 + 1;
+ set.insert(index, count);
+ input.append(Insert(index, count));
+ modelCount += count;
+ break;
+ }
+ case RemoveOp: {
+ const int index = qrand() % (modelCount + 1);
+ const int count = qrand() % (modelCount - index + 1);
+ set.remove(index, count);
+ input.append(Remove(index, count));
+ modelCount -= count;
+ break;
+ }
+ case MoveOp: {
+ const int from = qrand() % (modelCount + 1);
+ const int count = qrand() % (modelCount - from + 1);
+ const int to = qrand() % (modelCount - count + 1);
+ const int moveId = moveCount++;
+ set.move(from, to, count, moveId);
+ input.append(Move(from, to, count, moveId));
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ accumulatedSet.apply(set);
+ }
+
+ SignalList output;
+ foreach (const QQmlChangeSet::Remove &remove, accumulatedSet.removes())
+ output << Remove(remove.index, remove.count, remove.moveId, remove.offset);
+ foreach (const QQmlChangeSet::Insert &insert, accumulatedSet.inserts())
+ output << Insert(insert.index, insert.count, insert.moveId, insert.offset);
+
+ QVector<int> inputList;
+ for (int i = 0; i < 40; ++i)
+ inputList.append(i);
+ QVector<int> outputList = inputList;
+ if (!applyChanges(inputList, input)) {
+ qDebug() << "Invalid input list";
+ qDebug() << input;
+ qDebug() << inputList;
+ ++failures;
+ } else if (!applyChanges(outputList, output)) {
+ qDebug() << "Invalid output list";
+ qDebug() << input;
+ qDebug() << output;
+ qDebug() << outputList;
+ ++failures;
+ } else if (outputList != inputList) {
+ qDebug() << "Input/output mismatch";
+ qDebug() << input;
+ qDebug() << output;
+ qDebug() << inputList;
+ qDebug() << outputList;
+ ++failures;
+ }
+ }
+ QCOMPARE(failures, 0);
+}
+
+QTEST_MAIN(tst_qqmlchangeset)
+
+#include "tst_qqmlchangeset.moc"
diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NDTLC.qml b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NDTLC.qml
new file mode 100644
index 0000000000..b966cb30d1
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NDTLC.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import "NestedDirOne"
+import "NestedDirOne/NestedDirTwo/../../../SpecificComponent"
+
+// NestedDirectoriesTopLevelComponent
+
+Item {
+ id: ndtlcId
+ property NDComponentOne a: NDComponentOne { }
+ property NDComponentOne b: NDComponentOne { }
+ property SpecificComponent scOne: SpecificComponent { }
+ property SpecificComponent scTwo
+
+ function assignScTwo() {
+ // It seems that doing this in onCompleted doesn't work,
+ // since that handler will be evaluated after the
+ // componentUrlCanonicalization.3.qml onCompleted handler.
+ // So, call this function manually....
+ var c1 = Qt.createComponent("NestedDirOne/NestedDirTwo/NDComponentTwo.qml");
+ var o1 = c1.createObject(ndtlcId);
+ scTwo = o1.sc;
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NDComponentOne.qml b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NDComponentOne.qml
new file mode 100644
index 0000000000..2cfcd47737
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NDComponentOne.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import "../../SpecificComponent"
+import "NestedDirTwo"
+
+Item {
+ property int a
+ property NDComponentTwo b: NDComponentTwo { }
+ property SpecificComponent sc: SpecificComponent { }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/NDComponentTwo.qml b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/NDComponentTwo.qml
new file mode 100644
index 0000000000..d2df36adc4
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/NDComponentTwo.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import "../../../SpecificComponent"
+
+Item {
+ property SpecificComponent sc: SpecificComponent { }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/qmldir b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/qmldir
new file mode 100644
index 0000000000..11c6fdd311
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/NestedDirTwo/qmldir
@@ -0,0 +1 @@
+NDComponentTwo 1.0 NDComponentTwo.qml
diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/qmldir b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/qmldir
new file mode 100644
index 0000000000..5ef4d13c15
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/NestedDirOne/qmldir
@@ -0,0 +1 @@
+NDComponentOne 1.0 NDComponentOne.qml
diff --git a/tests/auto/qml/qqmlcomponent/data/NestedDirectories/qmldir b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/qmldir
new file mode 100644
index 0000000000..adb0fdcbae
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/NestedDirectories/qmldir
@@ -0,0 +1 @@
+NDTLC 1.0 NDTLC.qml
diff --git a/tests/auto/qml/qqmlcomponent/data/OtherComponent/OtherComponent.qml b/tests/auto/qml/qqmlcomponent/data/OtherComponent/OtherComponent.qml
new file mode 100644
index 0000000000..0b6623d467
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/OtherComponent/OtherComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import "../SpecificComponent"
+
+Item {
+ property SpecificComponent sc: SpecificComponent { }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/OtherComponent/qmldir b/tests/auto/qml/qqmlcomponent/data/OtherComponent/qmldir
new file mode 100644
index 0000000000..c592dc6ff0
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/OtherComponent/qmldir
@@ -0,0 +1 @@
+OtherComponent 1.0 OtherComponent.qml
diff --git a/tests/auto/qml/qqmlcomponent/data/RecursiveComponent.qml b/tests/auto/qml/qqmlcomponent/data/RecursiveComponent.qml
new file mode 100644
index 0000000000..eec17a772d
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/RecursiveComponent.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ id: inner
+ property Item innermost: null
+
+ Component.onCompleted: {
+ innermost = Qt.createComponent("./RecursiveComponent.qml").createObject();
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/SpecificComponent/SpecificComponent.qml b/tests/auto/qml/qqmlcomponent/data/SpecificComponent/SpecificComponent.qml
new file mode 100644
index 0000000000..0086737970
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/SpecificComponent/SpecificComponent.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ // ensure we have a dynamic meta object
+ property int someInt: 5
+ property var someVar: 12
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/SpecificComponent/qmldir b/tests/auto/qml/qqmlcomponent/data/SpecificComponent/qmldir
new file mode 100644
index 0000000000..1f961788be
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/SpecificComponent/qmldir
@@ -0,0 +1 @@
+SpecificComponent 1.0 SpecificComponent.qml
diff --git a/tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml b/tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml
new file mode 100644
index 0000000000..fca43fe2dc
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/TestComponent.2.qml
@@ -0,0 +1,591 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + 1
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ Item {
+ id: c3
+ objectName: "c3"
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ }
+
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+ if (c3.children.length != 500) success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/TestComponent.qml b/tests/auto/qml/qqmlcomponent/data/TestComponent.qml
new file mode 100644
index 0000000000..64cec1cd06
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/TestComponent.qml
@@ -0,0 +1,534 @@
+import QtQuick 2.0
+
+Item {
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml
new file mode 100644
index 0000000000..2e2d2de400
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import "SpecificComponent"
+
+Item {
+ id: root
+ property SpecificComponent first
+ property SpecificComponent second
+
+ property bool success: false
+
+ Component.onCompleted: {
+ var c1 = Qt.createComponent("./SpecificComponent/SpecificComponent.qml");
+ var o1 = c1.createObject(root);
+ first = o1;
+
+ var c2 = Qt.createComponent("./OtherComponent/OtherComponent.qml");
+ var o2 = c2.createObject(root);
+ second = o2.sc;
+
+ var ft = first.toString().substr(0, first.toString().indexOf('('));
+ var st = second.toString().substr(0, second.toString().indexOf('('));
+ if (ft == st) success = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.3.qml b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.3.qml
new file mode 100644
index 0000000000..b520b7d0ec
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.3.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+import "SpecificComponent"
+import "OtherComponent"
+import "NestedDirectories"
+
+Item {
+ id: root
+
+ property SpecificComponent scOne
+ property SpecificComponent scTwo
+ property SpecificComponent scThree
+ property SpecificComponent scFour
+ property SpecificComponent scFive
+ property SpecificComponent scSix
+ property SpecificComponent scSeven
+ property SpecificComponent scEight
+
+ property OtherComponent ocOne: OtherComponent { }
+ property NDTLC ndtlc: NDTLC { }
+
+ property bool success: false
+
+ Component.onCompleted: {
+ var c1 = Qt.createComponent("./SpecificComponent/SpecificComponent.qml");
+ var o1 = c1.createObject(root);
+ scOne = o1;
+ scTwo = ocOne.sc;
+ scThree = ndtlc.a.sc;
+ scFour = ndtlc.b.sc;
+ scFive = ndtlc.a.b.sc;
+ scSix = ndtlc.b.b.sc;
+ scSeven = ndtlc.scOne;
+ ndtlc.assignScTwo(); // XXX should be able to do this in NDTLC.onCompleted handler?!
+ scEight = ndtlc.scTwo;
+
+ // in our case, the type string should be:
+ // SpecificComponent_QMLTYPE_0
+ var t1 = scOne.toString().substr(0, scOne.toString().indexOf('('));
+ var t2 = scTwo.toString().substr(0, scTwo.toString().indexOf('('));
+ var t3 = scThree.toString().substr(0, scThree.toString().indexOf('('));
+ var t4 = scFour.toString().substr(0, scFour.toString().indexOf('('));
+ var t5 = scFive.toString().substr(0, scFive.toString().indexOf('('));
+ var t6 = scSix.toString().substr(0, scSix.toString().indexOf('('));
+ var t7 = scSeven.toString().substr(0, scSeven.toString().indexOf('('));
+ var t8 = scEight.toString().substr(0, scEight.toString().indexOf('('));
+
+ if (t1 == t2 && t2 == t3 && t3 == t4 && t4 == t5 && t5 == t6 && t6 == t7 && t7 == t8) {
+ success = true;
+ } else {
+ success = false;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.4.qml b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.4.qml
new file mode 100644
index 0000000000..cddaf6480d
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.4.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import "SpecificComponent"
+import "./SpecificComponent"
+import "././SpecificComponent"
+import "./././SpecificComponent"
+import "SpecificComponent/."
+import "SpecificComponent/./"
+import "SpecificComponent/./."
+import "SpecificComponent/././"
+import "SpecificComponent/././."
+import "SpecificComponent/./././"
+import "../data/SpecificComponent"
+import "./../data/SpecificComponent"
+import ".././data/SpecificComponent"
+import "SpecificComponent/nonexistent/../."
+import "SpecificComponent/nonexistent/.././"
+import "SpecificComponent/nonexistent/./.."
+import "SpecificComponent/nonexistent/./../"
+import "SpecificComponent/nonexistent/nonexistent/../.."
+import "SpecificComponent/nonexistent/nonexistent/../../"
+import "SpecificComponent/nonexistent/nonexistent/nonexistent/../../.."
+import "SpecificComponent/nonexistent/nonexistent/nonexistent/../../../"
+import "SpecificComponent/.././SpecificComponent"
+import "SpecificComponent/./../SpecificComponent"
+
+Item {
+ property bool success : true
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.5.qml b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.5.qml
new file mode 100644
index 0000000000..66993ab56d
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.5.qml
@@ -0,0 +1,4 @@
+import "../../../../../../Invalid"
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.qml b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.qml
new file mode 100644
index 0000000000..ad4cbbd2a9
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/componentUrlCanonicalization.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import "SpecificComponent"
+import "OtherComponent"
+
+Item {
+ id: root
+ property SpecificComponent first
+ property SpecificComponent second
+ property OtherComponent oc: OtherComponent { }
+
+ property bool success: false
+
+ Component.onCompleted: {
+ var c1 = Qt.createComponent("./SpecificComponent/SpecificComponent.qml");
+ var o1 = c1.createObject(root);
+ first = o1;
+ second = oc.sc;
+
+ // We want to ensure that the types are the same, ie, that the
+ // component hasn't been registered twice due to failed
+ // canonicalization of the component path when importing.
+ // The type is reported in the toString() output prior to the
+ // instance pointer value.
+
+ // in our case, the type string should be:
+ // SpecificComponent_QMLTYPE_0
+ var ft = first.toString().substr(0, first.toString().indexOf('('));
+ var st = second.toString().substr(0, second.toString().indexOf('('));
+ if (ft == st) success = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/createObject.qml b/tests/auto/qml/qqmlcomponent/data/createObject.qml
new file mode 100644
index 0000000000..da5db8e8e6
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/createObject.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item{
+ id: root
+ property QtObject qobject : null
+ property QtObject declarativeitem : null
+ Component{id: a; QtObject{} }
+ Component{id: b; Item{} }
+ Component.onCompleted: {
+ root.qobject = a.createObject(root);
+ root.declarativeitem = b.createObject(root);
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml b/tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml
new file mode 100644
index 0000000000..989b295cb5
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Item{
+ id: root
+ property QtObject declarativerectangle : null
+ property QtObject declarativeitem : null
+
+ property QtObject bindingTestObject : null
+ property QtObject bindingThisTestObject : null
+
+ Component{
+ id: a
+ Rectangle {
+ property Rectangle innerRect: Rectangle { border.width: 20 }
+ }
+ }
+ Component{
+ id: b
+ Item{
+ property bool testBool: false
+ property int testInt: null
+ property QtObject testObject: null
+ }
+ }
+
+ // test passing in bindings
+ width: 100
+ Component {
+ id: c
+ Item {
+ property int testValue
+ width: 300
+ }
+ }
+
+ Component.onCompleted: {
+ root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white", "border.width":3, "innerRect.border.width": 20});
+ root.declarativeitem = b.createObject(root, {"x":17,"y":17,"testBool":true,"testInt":17,"testObject":root});
+
+ root.bindingTestObject = c.createObject(root, {'testValue': Qt.binding(function(){return width * 3}) }) // use root.width
+ root.bindingThisTestObject = c.createObject(root, {'testValue': Qt.binding(function(){return this.width * 3}) }) // use width of Item within 'c'
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/createParentReference.qml b/tests/auto/qml/qqmlcomponent/data/createParentReference.qml
new file mode 100644
index 0000000000..daa5d3c167
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/createParentReference.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 100
+ height: 100
+
+ function createChild() {
+ Qt.createQmlObject("import QtQuick 2.0;" +
+ "Item { width: parent.width; }", root);
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/incubateObject.qml b/tests/auto/qml/qqmlcomponent/data/incubateObject.qml
new file mode 100644
index 0000000000..c11319db30
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/incubateObject.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item{
+ id: root
+
+ property bool test1: false
+ property bool test2: false
+
+ property var i
+
+ Component{
+ id: component
+ Item {
+ property int dummy: 13
+ property int dummy2: 26
+ }
+ }
+
+ Component.onCompleted: {
+ i = component.incubateObject(null, { dummy2: 19 });
+
+ if (i.status != Component.Loading) return;
+ if (i.object != null) return;
+
+ i.onStatusChanged = function(status) {
+ if (status != Component.Ready) return;
+ if (i.object == null) return;
+ if (i.object.dummy != 13) return;
+ if (i.object.dummy2 != 19) return;
+ test2 = true;
+ }
+
+ test1 = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlcomponent/data/onDestructionCount.qml b/tests/auto/qml/qqmlcomponent/data/onDestructionCount.qml
new file mode 100644
index 0000000000..3938acf6a5
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/onDestructionCount.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ Component {
+ id: internalComponent
+
+ Item {
+ Component.onDestruction: console.warn('Component.onDestruction')
+ }
+ }
+
+ Component.onCompleted: {
+ internalComponent.createObject()
+ gc()
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/onDestructionLookup.qml b/tests/auto/qml/qqmlcomponent/data/onDestructionLookup.qml
new file mode 100644
index 0000000000..a49a86e1f3
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/onDestructionLookup.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property bool success: false
+
+ Component {
+ id: internalComponent
+
+ Item {
+ id: internalRoot
+
+ property string foo: ''
+
+ Component.onCompleted: { internalRoot.foo = 'bar' }
+ Component.onDestruction: { root.success = (internalRoot.foo == 'bar') }
+ }
+ }
+
+ Component.onCompleted: {
+ internalComponent.createObject()
+ gc()
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/recursion.qml b/tests/auto/qml/qqmlcomponent/data/recursion.qml
new file mode 100644
index 0000000000..d7f9471a43
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/recursion.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property RecursiveComponent myInner: RecursiveComponent {}
+ property bool success: false
+
+ Component.onCompleted: {
+ success = (myInner.innermost != null)
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml b/tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml
new file mode 100644
index 0000000000..a10afd3ebe
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/data/recursionContinuation.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property bool success: false
+
+ Component.onCompleted: {
+ for (var i = 0; i < 10; ++i) {
+ Qt.createComponent("RecursiveComponent.qml").createObject(root)
+ }
+
+ var o = Qt.createComponent("TestComponent.qml").createObject(root)
+ root.success = (o != null)
+ }
+}
diff --git a/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro b/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro
new file mode 100644
index 0000000000..8151bacd75
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/qqmlcomponent.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qqmlcomponent
+macx:CONFIG -= app_bundle
+
+INCLUDEPATH += ../../shared/
+SOURCES += tst_qqmlcomponent.cpp \
+ ../../shared/testhttpserver.cpp
+
+HEADERS += ../../shared/testhttpserver.h
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
new file mode 100644
index 0000000000..697c8103b0
--- /dev/null
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -0,0 +1,437 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QDebug>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlproperty.h>
+#include <QtQml/qqmlincubator.h>
+#include <QtQuick>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquickmousearea_p.h>
+#include <qcolor.h>
+#include "../../shared/util.h"
+#include "testhttpserver.h"
+
+#define SERVER_PORT 14450
+
+class MyIC : public QObject, public QQmlIncubationController
+{
+ Q_OBJECT
+public:
+ MyIC() { startTimer(5); }
+protected:
+ virtual void timerEvent(QTimerEvent*) {
+ incubateFor(5);
+ }
+};
+
+class ComponentWatcher : public QObject
+{
+ Q_OBJECT
+public:
+ ComponentWatcher(QQmlComponent *comp) : loading(0), error(0), ready(0) {
+ connect(comp, SIGNAL(statusChanged(QQmlComponent::Status)),
+ this, SLOT(statusChanged(QQmlComponent::Status)));
+ }
+
+ int loading;
+ int error;
+ int ready;
+
+public slots:
+ void statusChanged(QQmlComponent::Status status) {
+ switch (status) {
+ case QQmlComponent::Loading:
+ ++loading;
+ break;
+ case QQmlComponent::Error:
+ ++error;
+ break;
+ case QQmlComponent::Ready:
+ ++ready;
+ break;
+ default:
+ break;
+ }
+ }
+};
+
+class tst_qqmlcomponent : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlcomponent() { engine.setIncubationController(&ic); }
+
+private slots:
+ void null();
+ void loadEmptyUrl();
+ void qmlCreateObject();
+ void qmlCreateObjectWithProperties();
+ void qmlIncubateObject();
+ void qmlCreateParentReference();
+ void async();
+ void asyncHierarchy();
+ void componentUrlCanonicalization();
+ void onDestructionLookup();
+ void onDestructionCount();
+ void recursion();
+ void recursionContinuation();
+
+private:
+ QQmlEngine engine;
+ MyIC ic;
+};
+
+void tst_qqmlcomponent::null()
+{
+ {
+ QQmlComponent c;
+ QVERIFY(c.isNull());
+ }
+
+ {
+ QQmlComponent c(&engine);
+ QVERIFY(c.isNull());
+ }
+}
+
+
+void tst_qqmlcomponent::loadEmptyUrl()
+{
+ QQmlComponent c(&engine);
+ c.loadUrl(QUrl());
+
+ QVERIFY(c.isError());
+ QCOMPARE(c.errors().count(), 1);
+ QQmlError error = c.errors().first();
+ QCOMPARE(error.url(), QUrl());
+ QCOMPARE(error.line(), -1);
+ QCOMPARE(error.column(), -1);
+ QCOMPARE(error.description(), QLatin1String("Invalid empty URL"));
+}
+
+void tst_qqmlcomponent::qmlIncubateObject()
+{
+ QQmlComponent component(&engine, testFileUrl("incubateObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), false);
+
+ QTRY_VERIFY(object->property("test2").toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlcomponent::qmlCreateObject()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *testObject1 = object->property("qobject").value<QObject*>();
+ QVERIFY(testObject1);
+ QVERIFY(testObject1->parent() == object);
+
+ QObject *testObject2 = object->property("declarativeitem").value<QObject*>();
+ QVERIFY(testObject2);
+ QVERIFY(testObject2->parent() == object);
+ QCOMPARE(testObject2->metaObject()->className(), "QQuickItem");
+}
+
+void tst_qqmlcomponent::qmlCreateObjectWithProperties()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createObjectWithScript.qml"));
+ QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *testObject1 = object->property("declarativerectangle").value<QObject*>();
+ QVERIFY(testObject1);
+ QVERIFY(testObject1->parent() == object);
+ QCOMPARE(testObject1->property("x").value<int>(), 17);
+ QCOMPARE(testObject1->property("y").value<int>(), 17);
+ QCOMPARE(testObject1->property("color").value<QColor>(), QColor(255,255,255));
+ QCOMPARE(QQmlProperty::read(testObject1,"border.width").toInt(), 3);
+ QCOMPARE(QQmlProperty::read(testObject1,"innerRect.border.width").toInt(), 20);
+ delete testObject1;
+
+ QObject *testObject2 = object->property("declarativeitem").value<QObject*>();
+ QVERIFY(testObject2);
+ QVERIFY(testObject2->parent() == object);
+ //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
+ QCOMPARE(testObject2->property("x").value<int>(), 17);
+ QCOMPARE(testObject2->property("y").value<int>(), 17);
+ QCOMPARE(testObject2->property("testBool").value<bool>(), true);
+ QCOMPARE(testObject2->property("testInt").value<int>(), 17);
+ QCOMPARE(testObject2->property("testObject").value<QObject*>(), object);
+ delete testObject2;
+
+ QObject *testBindingObj = object->property("bindingTestObject").value<QObject*>();
+ QVERIFY(testBindingObj);
+ QCOMPARE(testBindingObj->parent(), object);
+ QCOMPARE(testBindingObj->property("testValue").value<int>(), 300);
+ object->setProperty("width", 150);
+ QCOMPARE(testBindingObj->property("testValue").value<int>(), 150 * 3);
+ delete testBindingObj;
+
+ QObject *testBindingThisObj = object->property("bindingThisTestObject").value<QObject*>();
+ QVERIFY(testBindingThisObj);
+ QCOMPARE(testBindingThisObj->parent(), object);
+ QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 900);
+ testBindingThisObj->setProperty("width", 200);
+ QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 200 * 3);
+ delete testBindingThisObj;
+}
+
+void tst_qqmlcomponent::qmlCreateParentReference()
+{
+ QQmlEngine engine;
+
+ QCOMPARE(engine.outputWarningsToStandardError(), true);
+
+ QQmlTestMessageHandler messageHandler;
+
+ QQmlComponent component(&engine, testFileUrl("createParentReference.qml"));
+ QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(object, "createChild"));
+ delete object;
+
+ engine.setOutputWarningsToStandardError(false);
+ QCOMPARE(engine.outputWarningsToStandardError(), false);
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+}
+
+void tst_qqmlcomponent::async()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine);
+ ComponentWatcher watcher(&component);
+ component.loadUrl(QUrl("http://127.0.0.1:14450/TestComponent.qml"), QQmlComponent::Asynchronous);
+ QCOMPARE(watcher.loading, 1);
+ QTRY_VERIFY(component.isReady());
+ QCOMPARE(watcher.ready, 1);
+ QCOMPARE(watcher.error, 0);
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+
+void tst_qqmlcomponent::asyncHierarchy()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ // ensure that the item hierarchy is compiled correctly.
+ QQmlComponent component(&engine);
+ ComponentWatcher watcher(&component);
+ component.loadUrl(QUrl("http://127.0.0.1:14450/TestComponent.2.qml"), QQmlComponent::Asynchronous);
+ QCOMPARE(watcher.loading, 1);
+ QTRY_VERIFY(component.isReady());
+ QCOMPARE(watcher.ready, 1);
+ QCOMPARE(watcher.error, 0);
+
+ QObject *root = component.create();
+ QVERIFY(root != 0);
+
+ // ensure that the parent-child relationship hierarchy is correct
+ // (use QQuickItem* for all children rather than types which are not publicly exported)
+ QQuickItem *c1 = root->findChild<QQuickItem*>("c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1);
+ QQuickItem *c1c1 = c1->findChild<QQuickItem*>("c1c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1c1);
+ QQuickItem *c1c2 = c1->findChild<QQuickItem*>("c1c2", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1c2);
+ QQuickItem *c1c2c3 = c1c2->findChild<QQuickItem*>("c1c2c3", Qt::FindDirectChildrenOnly);
+ QVERIFY(c1c2c3);
+ QQuickItem *c2 = root->findChild<QQuickItem*>("c2", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2);
+ QQuickItem *c2c1 = c2->findChild<QQuickItem*>("c2c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2c1);
+ QQuickItem *c2c1c1 = c2c1->findChild<QQuickItem*>("c2c1c1", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2c1c1);
+ QQuickItem *c2c1c2 = c2c1->findChild<QQuickItem*>("c2c1c2", Qt::FindDirectChildrenOnly);
+ QVERIFY(c2c1c2);
+
+ // ensure that values and bindings are assigned correctly
+ QVERIFY(root->property("success").toBool());
+
+ delete root;
+}
+
+void tst_qqmlcomponent::componentUrlCanonicalization()
+{
+ // ensure that url canonicalization succeeds so that type information
+ // is not generated multiple times for the same component.
+ {
+ // load components via import
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ }
+
+ {
+ // load one of the components dynamically, which would trigger
+ // import of the other if it were not already loaded.
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.2.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ }
+
+ {
+ // load components with more deeply nested imports
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.3.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ }
+
+ {
+ // load components with unusually specified import paths
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.4.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ }
+
+ {
+ // Do not crash with various nonsense import paths
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.5.qml"));
+ QTest::ignoreMessage(QtWarningMsg, QLatin1String("QQmlComponent: Component is not ready").data());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object == 0);
+ }
+}
+
+void tst_qqmlcomponent::onDestructionLookup()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("onDestructionLookup.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+}
+
+void tst_qqmlcomponent::onDestructionCount()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("onDestructionCount.qml"));
+
+ QLatin1String warning("Component.onDestruction");
+
+ {
+ // Warning should be emitted during create()
+ QTest::ignoreMessage(QtWarningMsg, warning.data());
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ }
+
+ // Warning should not be emitted any further
+ QCOMPARE(engine.outputWarningsToStandardError(), true);
+
+ QStringList warnings;
+ {
+ QQmlTestMessageHandler messageHandler;
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ warnings = messageHandler.messages();
+ }
+
+ engine.setOutputWarningsToStandardError(false);
+ QCOMPARE(engine.outputWarningsToStandardError(), false);
+
+ QCOMPARE(warnings.count(), 0);
+}
+
+void tst_qqmlcomponent::recursion()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("recursion.qml"));
+
+ QTest::ignoreMessage(QtWarningMsg, QLatin1String("QQmlComponent: Component creation is recursing - aborting").data());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+
+ // Sub-object creation does not succeed
+ QCOMPARE(object->property("success").toBool(), false);
+}
+
+void tst_qqmlcomponent::recursionContinuation()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("recursionContinuation.qml"));
+
+ for (int i = 0; i < 10; ++i)
+ QTest::ignoreMessage(QtWarningMsg, QLatin1String("QQmlComponent: Component creation is recursing - aborting").data());
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+
+ // Eventual sub-object creation succeeds
+ QVERIFY(object->property("success").toBool());
+}
+
+QTEST_MAIN(tst_qqmlcomponent)
+
+#include "tst_qqmlcomponent.moc"
diff --git a/tests/auto/qml/qqmlconnections/data/connection-targetchange.qml b/tests/auto/qml/qqmlconnections/data/connection-targetchange.qml
new file mode 100644
index 0000000000..154c309c9c
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/connection-targetchange.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ Component {
+ id: item1
+ Item {
+ objectName: "item1"
+ }
+ }
+ Component {
+ id: item2
+ Item {
+ objectName: "item2"
+ }
+ }
+ Loader {
+ id: loader
+ sourceComponent: item1
+ }
+ Connections {
+ objectName: "connections"
+ target: loader.item
+ onWidthChanged: loader.sourceComponent = item2
+ }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-ignored.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-ignored.qml
new file mode 100644
index 0000000000..0780dd1509
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-ignored.qml
@@ -0,0 +1,8 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+
+ property Connections c1: Connections { target: root; onNotFooBar1: {} ignoreUnknownSignals: true }
+ property Connections c2: Connections { objectName: "connections"; onNotFooBar2: {} ignoreUnknownSignals: true }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-notarget.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-notarget.qml
new file mode 100644
index 0000000000..3da3e0f5d1
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-notarget.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property Connections c1: Connections { objectName: "connections"; target: null; onNotFooBar: {} }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-parent.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-parent.qml
new file mode 100644
index 0000000000..2c55215579
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-parent.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property Connections c1: Connections { objectName: "connections"; onFooBar: {} }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals.qml
new file mode 100644
index 0000000000..a351016b4a
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals.qml
@@ -0,0 +1,7 @@
+import QtQml 2.0
+
+QtObject {
+ id: screen
+
+ property Connections c1: Connections { objectName: "connections"; target: screen; onFooBar: {} }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/error-object.qml b/tests/auto/qml/qqmlconnections/data/error-object.qml
new file mode 100644
index 0000000000..8594811aa1
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/error-object.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+Connections {
+ onClicked: Timer {}
+}
diff --git a/tests/auto/qml/qqmlconnections/data/error-property.qml b/tests/auto/qml/qqmlconnections/data/error-property.qml
new file mode 100644
index 0000000000..b08a4a504a
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/error-property.qml
@@ -0,0 +1,3 @@
+import QtQml 2.0
+
+Connections { fakeProperty: {} }
diff --git a/tests/auto/qml/qqmlconnections/data/error-property2.qml b/tests/auto/qml/qqmlconnections/data/error-property2.qml
new file mode 100644
index 0000000000..fcfbf5b412
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/error-property2.qml
@@ -0,0 +1,3 @@
+import QtQml 2.0
+
+Connections { onfakeProperty: {} }
diff --git a/tests/auto/qml/qqmlconnections/data/error-syntax.qml b/tests/auto/qml/qqmlconnections/data/error-syntax.qml
new file mode 100644
index 0000000000..62c841bdb1
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/error-syntax.qml
@@ -0,0 +1,7 @@
+import QtQml 2.0
+
+Connections {
+ onClicked {
+ onPressed: {}
+ }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/rewriteError-global.qml b/tests/auto/qml/qqmlconnections/data/rewriteError-global.qml
new file mode 100644
index 0000000000..1d0b557069
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/rewriteError-global.qml
@@ -0,0 +1,8 @@
+import QtQml 2.0
+import Test 1.0
+
+TestObject {
+ property QtObject connection: Connections {
+ onSignalWithGlobalName: { ran = true }
+ }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/rewriteError-unnamed.qml b/tests/auto/qml/qqmlconnections/data/rewriteError-unnamed.qml
new file mode 100644
index 0000000000..a4849e994b
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/rewriteError-unnamed.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import Test 1.0
+
+TestObject {
+ property QtObject connection: Connections {
+ onUnnamedArgumentSignal: { ran = true }
+ }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/singletontype-target.qml b/tests/auto/qml/qqmlconnections/data/singletontype-target.qml
new file mode 100644
index 0000000000..7de488c2dd
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/singletontype-target.qml
@@ -0,0 +1,22 @@
+import QtQml 2.0
+import MyTestSingletonType 1.0 as MyTestSingletonType
+
+QtObject {
+ id: rootObject
+ objectName: "rootObject"
+ property int newIntPropValue: 12
+
+ property int moduleIntPropChangedCount: 0
+ property int moduleOtherSignalCount: 0
+
+ function setModuleIntProp() {
+ MyTestSingletonType.Api.intProp = newIntPropValue;
+ newIntPropValue = newIntPropValue + 1;
+ }
+
+ property Connections c: Connections {
+ target: MyTestSingletonType.Api
+ onIntPropChanged: moduleIntPropChangedCount = moduleIntPropChangedCount + 1;
+ onOtherSignal: moduleOtherSignalCount = moduleOtherSignalCount + 1;
+ }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/test-connection.qml b/tests/auto/qml/qqmlconnections/data/test-connection.qml
new file mode 100644
index 0000000000..ce851fc3db
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/test-connection.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ id: screen; width: 50
+
+ property bool tested: false
+ signal testMe
+
+ Connections { target: screen; onWidthChanged: screen.tested = true }
+}
diff --git a/tests/auto/qml/qqmlconnections/data/test-connection2.qml b/tests/auto/qml/qqmlconnections/data/test-connection2.qml
new file mode 100644
index 0000000000..a7e264c332
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/test-connection2.qml
@@ -0,0 +1,3 @@
+import QtQml 2.0
+
+Connections { id: connection; target: connection; onTargetChanged: 1 == 1 }
diff --git a/tests/auto/qml/qqmlconnections/data/test-connection3.qml b/tests/auto/qml/qqmlconnections/data/test-connection3.qml
new file mode 100644
index 0000000000..9aaca2213a
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/test-connection3.qml
@@ -0,0 +1,3 @@
+import QtQml 2.0
+
+Connections {}
diff --git a/tests/auto/qml/qqmlconnections/data/trimming.qml b/tests/auto/qml/qqmlconnections/data/trimming.qml
new file mode 100644
index 0000000000..4c37eb22af
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/trimming.qml
@@ -0,0 +1,10 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+
+ property string tested
+ signal testMe(int param1, string param2)
+
+ property Connections c: Connections { target: root; onTestMe: root.tested = param2 + param1 }
+}
diff --git a/tests/auto/qml/qqmlconnections/qqmlconnections.pro b/tests/auto/qml/qqmlconnections/qqmlconnections.pro
new file mode 100644
index 0000000000..52f85f6219
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/qqmlconnections.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlconnections
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlconnections.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
new file mode 100644
index 0000000000..dbf48779d6
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -0,0 +1,343 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <private/qqmlconnections_p.h>
+#include <private/qquickitem_p.h>
+#include "../../shared/util.h"
+#include <QtQml/qqmlscriptstring.h>
+
+class tst_qqmlconnections : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlconnections();
+
+private slots:
+ void defaultValues();
+ void properties();
+ void connection();
+ void trimming();
+ void targetChanged();
+ void unknownSignals_data();
+ void unknownSignals();
+ void errors_data();
+ void errors();
+ void rewriteErrors();
+ void singletonTypeTarget();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qqmlconnections::tst_qqmlconnections()
+{
+}
+
+void tst_qqmlconnections::defaultValues()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-connection3.qml"));
+ QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create());
+
+ QVERIFY(item != 0);
+ QVERIFY(item->target() == 0);
+
+ delete item;
+}
+
+void tst_qqmlconnections::properties()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-connection2.qml"));
+ QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create());
+
+ QVERIFY(item != 0);
+
+ QVERIFY(item != 0);
+ QVERIFY(item->target() == item);
+
+ delete item;
+}
+
+void tst_qqmlconnections::connection()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-connection.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+
+ QVERIFY(item != 0);
+
+ QCOMPARE(item->property("tested").toBool(), false);
+ QCOMPARE(item->width(), 50.);
+ emit item->setWidth(100.);
+ QCOMPARE(item->width(), 100.);
+ QCOMPARE(item->property("tested").toBool(), true);
+
+ delete item;
+}
+
+void tst_qqmlconnections::trimming()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("trimming.qml"));
+ QObject *object = c.create();
+
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("tested").toString(), QString(""));
+ int index = object->metaObject()->indexOfSignal("testMe(int,QString)");
+ QMetaMethod method = object->metaObject()->method(index);
+ method.invoke(object,
+ Qt::DirectConnection,
+ Q_ARG(int, 5),
+ Q_ARG(QString, "worked"));
+ QCOMPARE(object->property("tested").toString(), QString("worked5"));
+
+ delete object;
+}
+
+// Confirm that target can be changed by one of our signal handlers
+void tst_qqmlconnections::targetChanged()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("connection-targetchange.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(item != 0);
+
+ QQmlConnections *connections = item->findChild<QQmlConnections*>("connections");
+ QVERIFY(connections);
+
+ QQuickItem *item1 = item->findChild<QQuickItem*>("item1");
+ QVERIFY(item1);
+
+ item1->setWidth(200);
+
+ QQuickItem *item2 = item->findChild<QQuickItem*>("item2");
+ QVERIFY(item2);
+ QVERIFY(connections->target() == item2);
+
+ // If we don't crash then we're OK
+
+ delete item;
+}
+
+void tst_qqmlconnections::unknownSignals_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("basic") << "connection-unknownsignals.qml" << ":6:30: QML Connections: Cannot assign to non-existent property \"onFooBar\"";
+ QTest::newRow("parent") << "connection-unknownsignals-parent.qml" << ":4:30: QML Connections: Cannot assign to non-existent property \"onFooBar\"";
+ QTest::newRow("ignored") << "connection-unknownsignals-ignored.qml" << ""; // should be NO error
+ QTest::newRow("notarget") << "connection-unknownsignals-notarget.qml" << ""; // should be NO error
+}
+
+void tst_qqmlconnections::unknownSignals()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, error);
+
+ QUrl url = testFileUrl(file);
+ if (!error.isEmpty()) {
+ QTest::ignoreMessage(QtWarningMsg, (url.toString() + error).toLatin1());
+ } else {
+ // QTest has no way to insist no message (i.e. fail)
+ }
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, url);
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+
+ // check that connection is created (they are all runtime errors)
+ QQmlConnections *connections = object->findChild<QQmlConnections*>("connections");
+ QVERIFY(connections);
+
+ if (file == "connection-unknownsignals-ignored.qml")
+ QVERIFY(connections->ignoreUnknownSignals());
+
+ delete object;
+}
+
+void tst_qqmlconnections::errors_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("no \"on\"") << "error-property.qml" << "Cannot assign to non-existent property \"fakeProperty\"";
+ QTest::newRow("3rd letter lowercase") << "error-property2.qml" << "Cannot assign to non-existent property \"onfakeProperty\"";
+ QTest::newRow("child object") << "error-object.qml" << "Connections: nested objects not allowed";
+ QTest::newRow("grouped object") << "error-syntax.qml" << "Connections: syntax error";
+}
+
+void tst_qqmlconnections::errors()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, error);
+
+ QUrl url = testFileUrl(file);
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, url);
+ QVERIFY(c.isError() == true);
+ QList<QQmlError> errors = c.errors();
+ QVERIFY(errors.count() == 1);
+ QCOMPARE(errors.at(0).description(), error);
+}
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool ran READ ran WRITE setRan)
+
+public:
+ TestObject(QObject *parent = 0) : QObject(parent), m_ran(false) {}
+ ~TestObject() {}
+
+ bool ran() const { return m_ran; }
+ void setRan(bool arg) { m_ran = arg; }
+
+signals:
+ void unnamedArgumentSignal(int a, qreal, QString c);
+ void signalWithGlobalName(int parseInt);
+
+private:
+ bool m_ran;
+};
+
+void tst_qqmlconnections::rewriteErrors()
+{
+ qmlRegisterType<TestObject>("Test", 1, 0, "TestObject");
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("rewriteError-unnamed.qml"));
+ TestObject *obj = qobject_cast<TestObject*>(c.create());
+ QVERIFY(obj != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, (c.url().toString() + ":5:35: QML Connections: Signal uses unnamed parameter followed by named parameter.").toLatin1());
+ obj->unnamedArgumentSignal(1, .5, "hello");
+ QCOMPARE(obj->ran(), false);
+
+ delete obj;
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("rewriteError-global.qml"));
+ TestObject *obj = qobject_cast<TestObject*>(c.create());
+ QVERIFY(obj != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, (c.url().toString() + ":5:35: QML Connections: Signal parameter \"parseInt\" hides global variable.").toLatin1());
+ obj->signalWithGlobalName(10);
+ QCOMPARE(obj->ran(), false);
+
+ delete obj;
+ }
+}
+
+
+class MyTestSingletonType : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(int intProp READ intProp WRITE setIntProp NOTIFY intPropChanged)
+
+public:
+ MyTestSingletonType(QObject *parent = 0) : QObject(parent), m_intProp(0), m_changeCount(0) {}
+ ~MyTestSingletonType() {}
+
+ Q_INVOKABLE int otherMethod(int val) { return val + 4; }
+
+ int intProp() const { return m_intProp; }
+ void setIntProp(int val)
+ {
+ if (++m_changeCount % 3 == 0) emit otherSignal();
+ m_intProp = val; emit intPropChanged();
+ }
+
+signals:
+ void intPropChanged();
+ void otherSignal();
+
+private:
+ int m_intProp;
+ int m_changeCount;
+};
+
+static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+ MyTestSingletonType *api = new MyTestSingletonType();
+ return api;
+}
+
+// QTBUG-20937
+void tst_qqmlconnections::singletonTypeTarget()
+{
+ qmlRegisterSingletonType<MyTestSingletonType>("MyTestSingletonType", 1, 0, "Api", module_api_factory);
+ QQmlComponent component(&engine, testFileUrl("singletontype-target.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("moduleIntPropChangedCount").toInt(), 0);
+ QCOMPARE(object->property("moduleOtherSignalCount").toInt(), 0);
+
+ QMetaObject::invokeMethod(object, "setModuleIntProp");
+ QCOMPARE(object->property("moduleIntPropChangedCount").toInt(), 1);
+ QCOMPARE(object->property("moduleOtherSignalCount").toInt(), 0);
+
+ QMetaObject::invokeMethod(object, "setModuleIntProp");
+ QCOMPARE(object->property("moduleIntPropChangedCount").toInt(), 2);
+ QCOMPARE(object->property("moduleOtherSignalCount").toInt(), 0);
+
+ // the singleton Type emits otherSignal every 3 times the int property changes.
+ QMetaObject::invokeMethod(object, "setModuleIntProp");
+ QCOMPARE(object->property("moduleIntPropChangedCount").toInt(), 3);
+ QCOMPARE(object->property("moduleOtherSignalCount").toInt(), 1);
+
+ delete object;
+}
+
+QTEST_MAIN(tst_qqmlconnections)
+
+#include "tst_qqmlconnections.moc"
diff --git a/tests/auto/qml/qqmlconsole/data/assert.qml b/tests/auto/qml/qqmlconsole/data/assert.qml
new file mode 100644
index 0000000000..fb62ee68f9
--- /dev/null
+++ b/tests/auto/qml/qqmlconsole/data/assert.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ property int q:1
+ function assertFail() {
+ console.assert(0, "This will fail too")
+ }
+
+ Component.onCompleted: {
+ var x = 12;
+ console.assert(x == 12, "This will pass");
+ try {
+ console.assert(x < 12, "This will fail");
+ } catch (e) {
+ console.log(e);
+ }
+ console.assert("x < 12", "This will pass too")
+ assertFail();
+ console.assert(1)
+ }
+}
diff --git a/tests/auto/qml/qqmlconsole/data/exception.qml b/tests/auto/qml/qqmlconsole/data/exception.qml
new file mode 100644
index 0000000000..7faa36664e
--- /dev/null
+++ b/tests/auto/qml/qqmlconsole/data/exception.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ function exceptionFail() {
+ console.exception("Exception 2")
+ }
+
+ Component.onCompleted: {
+ try {
+ console.exception("Exception 1")
+ } catch (e) {
+ console.log(e);
+ }
+
+ exceptionFail();
+ }
+}
diff --git a/tests/auto/qml/qqmlconsole/data/logging.qml b/tests/auto/qml/qqmlconsole/data/logging.qml
new file mode 100644
index 0000000000..d54d714d8d
--- /dev/null
+++ b/tests/auto/qml/qqmlconsole/data/logging.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.0
+
+QtObject {
+ id:root
+
+ function consoleCount() {
+ console.count("console.count", "Ignore additional argument");
+ console.count();
+ }
+
+ Component.onCompleted: {
+ console.debug("console.debug");
+ console.log("console.log");
+ console.info("console.info");
+ console.warn("console.warn");
+ console.error("console.error");
+
+ consoleCount();
+ consoleCount();
+
+ var a = [1, 2];
+ var b = {a: "hello", d: 1 };
+ b.toString = function() { return JSON.stringify(b) }
+ var c
+ var d = 12;
+ var e = function() { return 5;};
+ var f = true;
+ var g = {toString: function() { throw new Error('toString'); }};
+
+ console.log(a);
+ console.log(b);
+ console.log(c);
+ console.log(d);
+ console.log(e);
+ console.log(f);
+ console.log(root);
+ console.log(g);
+ console.log(1, "pong!", new Object);
+ console.log(1, ["ping","pong"], new Object, 2);
+
+ try {
+ console.log(exception);
+ } catch (e) {
+ return;
+ }
+
+ throw ("console.log(exception) should have raised an exception");
+ }
+}
diff --git a/tests/auto/qml/qqmlconsole/data/profiling.qml b/tests/auto/qml/qqmlconsole/data/profiling.qml
new file mode 100644
index 0000000000..1f09c66612
--- /dev/null
+++ b/tests/auto/qml/qqmlconsole/data/profiling.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: {
+ console.profile("profile1");
+ console.time("timer1");
+ console.timeEnd("timer1");
+ console.profileEnd("profile1");
+ }
+}
diff --git a/tests/auto/qml/qqmlconsole/data/tracing.qml b/tests/auto/qml/qqmlconsole/data/tracing.qml
new file mode 100644
index 0000000000..4ce5f34441
--- /dev/null
+++ b/tests/auto/qml/qqmlconsole/data/tracing.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+// moving lines in here requires fixing tst_qqmlconsole.cpp
+QtObject {
+ id: root
+
+ function tracing()
+ {
+ console.trace();
+ }
+
+ Component.onCompleted: {
+ tracing();
+ }
+}
diff --git a/tests/auto/qml/qqmlconsole/qqmlconsole.pro b/tests/auto/qml/qqmlconsole/qqmlconsole.pro
new file mode 100644
index 0000000000..0f3f10bd89
--- /dev/null
+++ b/tests/auto/qml/qqmlconsole/qqmlconsole.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlconsole
+SOURCES += tst_qqmlconsole.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += qml testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
new file mode 100644
index 0000000000..561602fda5
--- /dev/null
+++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QDebug>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include "../../shared/util.h"
+
+class tst_qqmlconsole : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlconsole() {}
+
+private slots:
+ void logging();
+ void tracing();
+ void profiling();
+ void assert();
+ void exception();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qqmlconsole::logging()
+{
+ QUrl testUrl = testFileUrl("logging.qml");
+
+ QTest::ignoreMessage(QtDebugMsg, "console.debug");
+ QTest::ignoreMessage(QtDebugMsg, "console.log");
+ QTest::ignoreMessage(QtDebugMsg, "console.info");
+ QTest::ignoreMessage(QtWarningMsg, "console.warn");
+ QTest::ignoreMessage(QtCriticalMsg, "console.error");
+
+ QTest::ignoreMessage(QtDebugMsg, "console.count: 1");
+ QTest::ignoreMessage(QtDebugMsg, ": 1");
+ QTest::ignoreMessage(QtDebugMsg, "console.count: 2");
+ QTest::ignoreMessage(QtDebugMsg, ": 2");
+
+ QTest::ignoreMessage(QtDebugMsg, "[1,2]");
+ QTest::ignoreMessage(QtDebugMsg, "{\"a\":\"hello\",\"d\":1}");
+ QTest::ignoreMessage(QtDebugMsg, "undefined");
+ QTest::ignoreMessage(QtDebugMsg, "12");
+ QTest::ignoreMessage(QtDebugMsg, "function () { return 5;}");
+ QTest::ignoreMessage(QtDebugMsg, "true");
+ // Printing QML object prints out the class/type of QML object with the memory address
+// QTest::ignoreMessage(QtDebugMsg, "QtObject_QML_0(0xABCD..)");
+ QTest::ignoreMessage(QtDebugMsg, "[object Object]");
+ QTest::ignoreMessage(QtDebugMsg, "1 pong! [object Object]");
+ QTest::ignoreMessage(QtDebugMsg, "1 [ping,pong] [object Object] 2");
+
+ QQmlComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlconsole::tracing()
+{
+ QUrl testUrl = testFileUrl("tracing.qml");
+
+ QString traceText =
+ QString::fromLatin1("tracing (%1:%2:%3)\n").arg(testUrl.toString()).arg(50).arg(17) +
+ QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(54).arg(9);
+
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(traceText));
+
+ QQmlComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlconsole::profiling()
+{
+ QUrl testUrl = testFileUrl("profiling.qml");
+
+ // profiling()
+ QTest::ignoreMessage(QtDebugMsg, "Profiling started.");
+ QTest::ignoreMessage(QtDebugMsg, "Profiling ended.");
+
+ QQmlComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlconsole::assert()
+{
+ QUrl testUrl = testFileUrl("assert.qml");
+
+ // assert()
+ QString assert1 = "This will fail\n" +
+ QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(54).arg(17);
+
+ QString assert2 = "This will fail too\n" +
+ QString::fromLatin1("assertFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(47).arg(17) +
+ QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(59).arg(9);
+
+ QTest::ignoreMessage(QtCriticalMsg, qPrintable(assert1));
+ QTest::ignoreMessage(QtCriticalMsg, qPrintable(assert2));
+
+ QQmlComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlconsole::exception()
+{
+ QUrl testUrl = testFileUrl("exception.qml");
+
+ // exception()
+ QString exception1 = "Exception 1\n" +
+ QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(51).arg(21);
+
+ QString exception2 = "Exception 2\n" +
+ QString::fromLatin1("exceptionFail (%1:%2:%3)\n").arg(testUrl.toString()).arg(46).arg(17) +
+ QString::fromLatin1("onCompleted (%1:%2:%3)").arg(testUrl.toString()).arg(56).arg(9);
+
+ QTest::ignoreMessage(QtCriticalMsg, qPrintable(exception1));
+ QTest::ignoreMessage(QtCriticalMsg, qPrintable(exception2));
+
+ QQmlComponent component(&engine, testUrl);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+QTEST_MAIN(tst_qqmlconsole)
+
+#include "tst_qqmlconsole.moc"
diff --git a/tests/auto/qml/qqmlcontext/data/ContainerComponent.qml b/tests/auto/qml/qqmlcontext/data/ContainerComponent.qml
new file mode 100644
index 0000000000..ae90c20cf8
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/ContainerComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ function doSomething() { if (333 == 666) console.log('doSomething') }
+}
diff --git a/tests/auto/qml/qqmlcontext/data/ContentComponent.qml b/tests/auto/qml/qqmlcontext/data/ContentComponent.qml
new file mode 100644
index 0000000000..f937b196ed
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/ContentComponent.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ property int count: 0
+ property bool hasValidParent: parent && parent.children.length != 0
+
+ onHasValidParentChanged: {
+ if (++count > 1) parent.doSomething()
+ }
+}
diff --git a/tests/auto/qml/qqmlcontext/data/Object_22535.qml b/tests/auto/qml/qqmlcontext/data/Object_22535.qml
new file mode 100644
index 0000000000..294c744317
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/Object_22535.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+
+ function goodBye()
+ {
+ }
+}
diff --git a/tests/auto/qml/qqmlcontext/data/RefreshExpressionsType.qml b/tests/auto/qml/qqmlcontext/data/RefreshExpressionsType.qml
new file mode 100644
index 0000000000..b7c3427c85
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/RefreshExpressionsType.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property var dummy: countCommand.doCommand();
+}
diff --git a/tests/auto/qml/qqmlcontext/data/evalAfterInvalidate.qml b/tests/auto/qml/qqmlcontext/data/evalAfterInvalidate.qml
new file mode 100644
index 0000000000..27879c48bf
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/evalAfterInvalidate.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ Component.onCompleted: {
+ var i = containerComponent.createObject(root);
+ contentComponent.createObject(i);
+ i.destroy()
+ }
+
+ property Component containerComponent: ContainerComponent {}
+ property Component contentComponent: ContentComponent {}
+}
diff --git a/tests/auto/qml/qqmlcontext/data/qtbug_22535.qml b/tests/auto/qml/qqmlcontext/data/qtbug_22535.qml
new file mode 100644
index 0000000000..3553f6c03b
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/qtbug_22535.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 64
+ height: 64
+
+ Object_22535 { id:o }
+
+ Component.onDestruction: o.goodBye()
+}
diff --git a/tests/auto/qml/qqmlcontext/data/refreshExpressions.qml b/tests/auto/qml/qqmlcontext/data/refreshExpressions.qml
new file mode 100644
index 0000000000..01e503f8dc
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/refreshExpressions.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant v1: RefreshExpressionsType {}
+ property variant v2: RefreshExpressionsType {}
+}
diff --git a/tests/auto/qml/qqmlcontext/data/refreshExpressionsRootContext.qml b/tests/auto/qml/qqmlcontext/data/refreshExpressionsRootContext.qml
new file mode 100644
index 0000000000..bd82cd9552
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/refreshExpressionsRootContext.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property var dummy: countCommand.doCommand(), unresolvedName
+}
+
diff --git a/tests/auto/qml/qqmlcontext/qqmlcontext.pro b/tests/auto/qml/qqmlcontext/qqmlcontext.pro
new file mode 100644
index 0000000000..48c0b5767c
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/qqmlcontext.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlcontext
+SOURCES += tst_qqmlcontext.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private testlib v8-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
new file mode 100644
index 0000000000..b1f92e3f34
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
@@ -0,0 +1,664 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QDebug>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QQmlComponent>
+#include <QQmlExpression>
+#include <private/qqmlcontext_p.h>
+#include "../../shared/util.h"
+
+class tst_qqmlcontext : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlcontext() {}
+
+private slots:
+ void baseUrl();
+ void resolvedUrl();
+ void engineMethod();
+ void parentContext();
+ void setContextProperty();
+ void setContextObject();
+ void destruction();
+ void idAsContextProperty();
+ void readOnlyContexts();
+ void nameForObject();
+
+ void refreshExpressions();
+ void refreshExpressionsCrash();
+ void refreshExpressionsRootContext();
+
+ void qtbug_22535();
+ void evalAfterInvalidate();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qqmlcontext::baseUrl()
+{
+ QQmlContext ctxt(&engine);
+
+ QCOMPARE(ctxt.baseUrl(), QUrl());
+
+ ctxt.setBaseUrl(QUrl("http://www.nokia.com/"));
+
+ QCOMPARE(ctxt.baseUrl(), QUrl("http://www.nokia.com/"));
+}
+
+void tst_qqmlcontext::resolvedUrl()
+{
+ // Relative to the component
+ {
+ QQmlContext ctxt(&engine);
+ ctxt.setBaseUrl(QUrl("http://www.nokia.com/"));
+
+ QCOMPARE(ctxt.resolvedUrl(QUrl("main.qml")), QUrl("http://www.nokia.com/main.qml"));
+ }
+
+ // Relative to a parent
+ {
+ QQmlContext ctxt(&engine);
+ ctxt.setBaseUrl(QUrl("http://www.nokia.com/"));
+
+ QQmlContext ctxt2(&ctxt);
+ QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl("http://www.nokia.com/main2.qml"));
+ }
+
+ // Relative to the engine
+ {
+ QQmlContext ctxt(&engine);
+ QCOMPARE(ctxt.resolvedUrl(QUrl("main.qml")), engine.baseUrl().resolved(QUrl("main.qml")));
+ }
+
+ // Relative to a deleted parent
+ {
+ QQmlContext *ctxt = new QQmlContext(&engine);
+ ctxt->setBaseUrl(QUrl("http://www.nokia.com/"));
+
+ QQmlContext ctxt2(ctxt);
+ QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl("http://www.nokia.com/main2.qml"));
+
+ delete ctxt; ctxt = 0;
+
+ QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl());
+ }
+
+ // Absolute
+ {
+ QQmlContext ctxt(&engine);
+
+ QCOMPARE(ctxt.resolvedUrl(QUrl("http://www.nokia.com/main2.qml")), QUrl("http://www.nokia.com/main2.qml"));
+ QCOMPARE(ctxt.resolvedUrl(QUrl("file:///main2.qml")), QUrl("file:///main2.qml"));
+ }
+}
+
+void tst_qqmlcontext::engineMethod()
+{
+ QQmlEngine *engine = new QQmlEngine;
+
+ QQmlContext ctxt(engine);
+ QQmlContext ctxt2(&ctxt);
+ QQmlContext ctxt3(&ctxt2);
+ QQmlContext ctxt4(&ctxt2);
+
+ QCOMPARE(ctxt.engine(), engine);
+ QCOMPARE(ctxt2.engine(), engine);
+ QCOMPARE(ctxt3.engine(), engine);
+ QCOMPARE(ctxt4.engine(), engine);
+
+ delete engine; engine = 0;
+
+ QCOMPARE(ctxt.engine(), engine);
+ QCOMPARE(ctxt2.engine(), engine);
+ QCOMPARE(ctxt3.engine(), engine);
+ QCOMPARE(ctxt4.engine(), engine);
+}
+
+void tst_qqmlcontext::parentContext()
+{
+ QQmlEngine *engine = new QQmlEngine;
+
+ QCOMPARE(engine->rootContext()->parentContext(), (QQmlContext *)0);
+
+ QQmlContext *ctxt = new QQmlContext(engine);
+ QQmlContext *ctxt2 = new QQmlContext(ctxt);
+ QQmlContext *ctxt3 = new QQmlContext(ctxt2);
+ QQmlContext *ctxt4 = new QQmlContext(ctxt2);
+ QQmlContext *ctxt5 = new QQmlContext(ctxt);
+ QQmlContext *ctxt6 = new QQmlContext(engine);
+ QQmlContext *ctxt7 = new QQmlContext(engine->rootContext());
+
+ QCOMPARE(ctxt->parentContext(), engine->rootContext());
+ QCOMPARE(ctxt2->parentContext(), ctxt);
+ QCOMPARE(ctxt3->parentContext(), ctxt2);
+ QCOMPARE(ctxt4->parentContext(), ctxt2);
+ QCOMPARE(ctxt5->parentContext(), ctxt);
+ QCOMPARE(ctxt6->parentContext(), engine->rootContext());
+ QCOMPARE(ctxt7->parentContext(), engine->rootContext());
+
+ delete ctxt2; ctxt2 = 0;
+
+ QCOMPARE(ctxt->parentContext(), engine->rootContext());
+ QCOMPARE(ctxt3->parentContext(), (QQmlContext *)0);
+ QCOMPARE(ctxt4->parentContext(), (QQmlContext *)0);
+ QCOMPARE(ctxt5->parentContext(), ctxt);
+ QCOMPARE(ctxt6->parentContext(), engine->rootContext());
+ QCOMPARE(ctxt7->parentContext(), engine->rootContext());
+
+ delete engine; engine = 0;
+
+ QCOMPARE(ctxt->parentContext(), (QQmlContext *)0);
+ QCOMPARE(ctxt3->parentContext(), (QQmlContext *)0);
+ QCOMPARE(ctxt4->parentContext(), (QQmlContext *)0);
+ QCOMPARE(ctxt5->parentContext(), (QQmlContext *)0);
+ QCOMPARE(ctxt6->parentContext(), (QQmlContext *)0);
+ QCOMPARE(ctxt7->parentContext(), (QQmlContext *)0);
+
+ delete ctxt7;
+ delete ctxt6;
+ delete ctxt5;
+ delete ctxt4;
+ delete ctxt3;
+ delete ctxt;
+}
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int a READ a NOTIFY aChanged)
+ Q_PROPERTY(int b READ b NOTIFY bChanged)
+ Q_PROPERTY(int c READ c NOTIFY cChanged)
+
+public:
+ TestObject() : _a(10), _b(10), _c(10) {}
+
+ int a() const { return _a; }
+ void setA(int a) { _a = a; emit aChanged(); }
+
+ int b() const { return _b; }
+ void setB(int b) { _b = b; emit bChanged(); }
+
+ int c() const { return _c; }
+ void setC(int c) { _c = c; emit cChanged(); }
+
+signals:
+ void aChanged();
+ void bChanged();
+ void cChanged();
+
+private:
+ int _a;
+ int _b;
+ int _c;
+};
+
+#define TEST_CONTEXT_PROPERTY(ctxt, name, value) \
+{ \
+ QQmlComponent component(&engine); \
+ component.setData("import QtQuick 2.0; QtObject { property variant test: " #name " }", QUrl()); \
+\
+ QObject *obj = component.create(ctxt); \
+\
+ QCOMPARE(obj->property("test"), value); \
+\
+ delete obj; \
+}
+
+void tst_qqmlcontext::setContextProperty()
+{
+ QQmlContext ctxt(&engine);
+ QQmlContext ctxt2(&ctxt);
+
+ TestObject obj1;
+ obj1.setA(3345);
+ TestObject obj2;
+ obj2.setA(-19);
+
+ // Static context properties
+ ctxt.setContextProperty("a", QVariant(10));
+ ctxt.setContextProperty("b", QVariant(9));
+ ctxt2.setContextProperty("d", &obj2);
+ ctxt2.setContextProperty("b", QVariant(19));
+ ctxt2.setContextProperty("c", QVariant(QString("Hello World!")));
+ ctxt.setContextProperty("d", &obj1);
+ ctxt.setContextProperty("e", &obj1);
+
+ TEST_CONTEXT_PROPERTY(&ctxt2, a, QVariant(10));
+ TEST_CONTEXT_PROPERTY(&ctxt2, b, QVariant(19));
+ TEST_CONTEXT_PROPERTY(&ctxt2, c, QVariant(QString("Hello World!")));
+ TEST_CONTEXT_PROPERTY(&ctxt2, d.a, QVariant(-19));
+ TEST_CONTEXT_PROPERTY(&ctxt2, e.a, QVariant(3345));
+
+ ctxt.setContextProperty("a", QVariant(13));
+ ctxt.setContextProperty("b", QVariant(4));
+ ctxt2.setContextProperty("b", QVariant(8));
+ ctxt2.setContextProperty("c", QVariant(QString("Hi World!")));
+ ctxt2.setContextProperty("d", &obj1);
+ obj1.setA(12);
+
+ TEST_CONTEXT_PROPERTY(&ctxt2, a, QVariant(13));
+ TEST_CONTEXT_PROPERTY(&ctxt2, b, QVariant(8));
+ TEST_CONTEXT_PROPERTY(&ctxt2, c, QVariant(QString("Hi World!")));
+ TEST_CONTEXT_PROPERTY(&ctxt2, d.a, QVariant(12));
+ TEST_CONTEXT_PROPERTY(&ctxt2, e.a, QVariant(12));
+
+ // Changes in context properties
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property variant test: a }", QUrl());
+
+ QObject *obj = component.create(&ctxt2);
+
+ QCOMPARE(obj->property("test"), QVariant(13));
+ ctxt.setContextProperty("a", QVariant(19));
+ QCOMPARE(obj->property("test"), QVariant(19));
+
+ delete obj;
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property variant test: b }", QUrl());
+
+ QObject *obj = component.create(&ctxt2);
+
+ QCOMPARE(obj->property("test"), QVariant(8));
+ ctxt.setContextProperty("b", QVariant(5));
+ QCOMPARE(obj->property("test"), QVariant(8));
+ ctxt2.setContextProperty("b", QVariant(1912));
+ QCOMPARE(obj->property("test"), QVariant(1912));
+
+ delete obj;
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property variant test: e.a }", QUrl());
+
+ QObject *obj = component.create(&ctxt2);
+
+ QCOMPARE(obj->property("test"), QVariant(12));
+ obj1.setA(13);
+ QCOMPARE(obj->property("test"), QVariant(13));
+
+ delete obj;
+ }
+
+ // New context properties
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property variant test: a }", QUrl());
+
+ QObject *obj = component.create(&ctxt2);
+
+ QCOMPARE(obj->property("test"), QVariant(19));
+ ctxt2.setContextProperty("a", QVariant(1945));
+ QCOMPARE(obj->property("test"), QVariant(1945));
+
+ delete obj;
+ }
+
+ // Setting an object-variant context property
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl());
+
+ QQmlContext ctxt(engine.rootContext());
+ ctxt.setContextProperty("ctxtProp", QVariant());
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: TypeError: Cannot read property 'a' of undefined");
+ QObject *obj = component.create(&ctxt);
+
+ QVariant v = obj->property("obj");
+
+ ctxt.setContextProperty("ctxtProp", v);
+
+ QCOMPARE(obj->property("test"), QVariant(10));
+
+ delete obj;
+ }
+}
+
+void tst_qqmlcontext::setContextObject()
+{
+ QQmlContext ctxt(&engine);
+
+ TestObject to;
+
+ to.setA(2);
+ to.setB(192);
+ to.setC(18);
+
+ ctxt.setContextObject(&to);
+ ctxt.setContextProperty("c", QVariant(9));
+
+ // Static context properties
+ TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(2));
+ TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(192));
+ TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(9));
+
+ to.setA(12);
+ to.setB(100);
+ to.setC(7);
+ ctxt.setContextProperty("c", QVariant(3));
+
+ TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(12));
+ TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(100));
+ TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(3));
+
+ // Changes in context properties
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property variant test: a }", QUrl());
+
+ QObject *obj = component.create(&ctxt);
+
+ QCOMPARE(obj->property("test"), QVariant(12));
+ to.setA(14);
+ QCOMPARE(obj->property("test"), QVariant(14));
+
+ delete obj;
+ }
+}
+
+void tst_qqmlcontext::destruction()
+{
+ QQmlContext *ctxt = new QQmlContext(&engine);
+
+ QObject obj;
+ QQmlEngine::setContextForObject(&obj, ctxt);
+ QQmlExpression expr(ctxt, 0, "a");
+
+ QCOMPARE(ctxt, QQmlEngine::contextForObject(&obj));
+ QCOMPARE(ctxt, expr.context());
+
+ delete ctxt; ctxt = 0;
+
+ QCOMPARE(ctxt, QQmlEngine::contextForObject(&obj));
+ QCOMPARE(ctxt, expr.context());
+}
+
+void tst_qqmlcontext::idAsContextProperty()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl());
+
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ QVariant a = obj->property("a");
+ QVERIFY(a.userType() == QMetaType::QObjectStar);
+
+ QVariant ctxt = qmlContext(obj)->contextProperty("myObject");
+ QVERIFY(ctxt.userType() == QMetaType::QObjectStar);
+
+ QVERIFY(a == ctxt);
+
+ delete obj;
+}
+
+// Internal contexts should be read-only
+void tst_qqmlcontext::readOnlyContexts()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { id: me }", QUrl());
+
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ QQmlContext *context = qmlContext(obj);
+ QVERIFY(context);
+
+ QVERIFY(qvariant_cast<QObject*>(context->contextProperty("me")) == obj);
+ QVERIFY(context->contextObject() == obj);
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlContext: Cannot set property on internal context.");
+ context->setContextProperty("hello", 12);
+ QVERIFY(context->contextProperty("hello") == QVariant());
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlContext: Cannot set property on internal context.");
+ context->setContextProperty("hello", obj);
+ QVERIFY(context->contextProperty("hello") == QVariant());
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlContext: Cannot set context object for internal context.");
+ context->setContextObject(0);
+ QVERIFY(context->contextObject() == obj);
+
+ delete obj;
+}
+
+void tst_qqmlcontext::nameForObject()
+{
+ QObject o1;
+ QObject o2;
+ QObject o3;
+
+ QQmlEngine engine;
+
+ // As a context property
+ engine.rootContext()->setContextProperty("o1", &o1);
+ engine.rootContext()->setContextProperty("o2", &o2);
+ engine.rootContext()->setContextProperty("o1_2", &o1);
+
+ QCOMPARE(engine.rootContext()->nameForObject(&o1), QString("o1"));
+ QCOMPARE(engine.rootContext()->nameForObject(&o2), QString("o2"));
+ QCOMPARE(engine.rootContext()->nameForObject(&o3), QString());
+
+ // As an id
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { id: root; property QtObject o: QtObject { id: nested } }", QUrl());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(qmlContext(o)->nameForObject(o), QString("root"));
+ QCOMPARE(qmlContext(o)->nameForObject(qvariant_cast<QObject*>(o->property("o"))), QString("nested"));
+ QCOMPARE(qmlContext(o)->nameForObject(&o1), QString());
+
+ delete o;
+}
+
+class DeleteCommand : public QObject
+{
+Q_OBJECT
+public:
+ DeleteCommand() : object(0) {}
+
+ QObject *object;
+
+public slots:
+ void doCommand() { if (object) delete object; object = 0; }
+};
+
+// Calling refresh expressions would crash if an expression or context was deleted during
+// the refreshing
+void tst_qqmlcontext::refreshExpressionsCrash()
+{
+ {
+ QQmlEngine engine;
+
+ DeleteCommand command;
+ engine.rootContext()->setContextProperty("deleteCommand", &command);
+ // We use a fresh context here to bypass any root-context optimizations in
+ // the engine
+ QQmlContext ctxt(engine.rootContext());
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property var binding: deleteCommand.doCommand() }", QUrl());
+ QVERIFY(component.isReady());
+
+ QObject *o1 = component.create(&ctxt);
+ QObject *o2 = component.create(&ctxt);
+
+ command.object = o2;
+
+ QQmlContextData::get(&ctxt)->refreshExpressions();
+
+ delete o1;
+ }
+ {
+ QQmlEngine engine;
+
+ DeleteCommand command;
+ engine.rootContext()->setContextProperty("deleteCommand", &command);
+ // We use a fresh context here to bypass any root-context optimizations in
+ // the engine
+ QQmlContext ctxt(engine.rootContext());
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { property var binding: deleteCommand.doCommand() }", QUrl());
+ QVERIFY(component.isReady());
+
+ QObject *o1 = component.create(&ctxt);
+ QObject *o2 = component.create(&ctxt);
+
+ command.object = o1;
+
+ QQmlContextData::get(&ctxt)->refreshExpressions();
+
+ delete o2;
+ }
+}
+
+class CountCommand : public QObject
+{
+Q_OBJECT
+public:
+ CountCommand() : count(0) {}
+
+ int count;
+
+public slots:
+ void doCommand() { ++count; }
+};
+
+
+// Test that calling refresh expressions causes all the expressions to refresh
+void tst_qqmlcontext::refreshExpressions()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("refreshExpressions.qml"));
+ QQmlComponent component2(&engine, testFileUrl("RefreshExpressionsType.qml"));
+
+ CountCommand command;
+ engine.rootContext()->setContextProperty("countCommand", &command);
+
+ // We use a fresh context here to bypass any root-context optimizations in
+ // the engine
+ QQmlContext context(engine.rootContext());
+ QQmlContext context2(&context);
+
+ QObject *o1 = component.create(&context);
+ QObject *o2 = component.create(&context2);
+ QObject *o3 = component2.create(&context);
+
+ QCOMPARE(command.count, 5);
+
+ QQmlContextData::get(&context)->refreshExpressions();
+
+ QCOMPARE(command.count, 10);
+
+ delete o3;
+ delete o2;
+ delete o1;
+}
+
+// Test that updating the root context, only causes expressions in contexts with an
+// unresolved name to reevaluate
+void tst_qqmlcontext::refreshExpressionsRootContext()
+{
+ QQmlEngine engine;
+
+ CountCommand command;
+ engine.rootContext()->setContextProperty("countCommand", &command);
+
+ QQmlComponent component(&engine, testFileUrl("refreshExpressions.qml"));
+ QQmlComponent component2(&engine, testFileUrl("refreshExpressionsRootContext.qml"));
+
+ QQmlContext context(engine.rootContext());
+ QQmlContext context2(engine.rootContext());
+
+ QString warning = component2.url().toString() + QLatin1String(":4: ReferenceError: unresolvedName is not defined");
+
+ QObject *o1 = component.create(&context);
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QObject *o2 = component2.create(&context2);
+
+ QCOMPARE(command.count, 3);
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QQmlContextData::get(engine.rootContext())->refreshExpressions();
+
+ QCOMPARE(command.count, 4);
+
+ delete o2;
+ delete o1;
+}
+
+void tst_qqmlcontext::qtbug_22535()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("qtbug_22535.qml"));
+ QQmlContext context(engine.rootContext());
+
+ QObject *o = component.create(&context);
+
+ // Don't crash!
+ delete o;
+}
+
+void tst_qqmlcontext::evalAfterInvalidate()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("evalAfterInvalidate.qml"));
+ QScopedPointer<QObject> o(component.create());
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+}
+
+QTEST_MAIN(tst_qqmlcontext)
+
+#include "tst_qqmlcontext.moc"
diff --git a/tests/auto/qml/qqmlcpputils/qqmlcpputils.pro b/tests/auto/qml/qqmlcpputils/qqmlcpputils.pro
new file mode 100644
index 0000000000..a3951da821
--- /dev/null
+++ b/tests/auto/qml/qqmlcpputils/qqmlcpputils.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qqmlcpputils
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlcpputils.cpp
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private testlib v8-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp
new file mode 100644
index 0000000000..8d58ac88e4
--- /dev/null
+++ b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <qsignalspy.h>
+#include <private/qqmlglobal_p.h>
+
+class tst_qqmlcpputils : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qqmlcpputils() {}
+
+private slots:
+ void fastConnect();
+ void fastCast();
+};
+
+class MyObject : public QObject {
+ Q_OBJECT
+public:
+ MyObject() : slotCount(0) {}
+ friend class tst_qqmlcpputils;
+
+ int slotCount;
+
+signals:
+ void signal1();
+ void signal2();
+
+public slots:
+ void slot1() { slotCount++; }
+};
+
+void tst_qqmlcpputils::fastConnect()
+{
+ {
+ MyObject *obj = new MyObject;
+ qmlobject_connect(obj, MyObject, SIGNAL(signal1()), obj, MyObject, SLOT(slot1()));
+
+ obj->signal1();
+ QCOMPARE(obj->slotCount, 1);
+
+ delete obj;
+ }
+
+ {
+ MyObject obj;
+ qmlobject_connect(&obj, MyObject, SIGNAL(signal1()), &obj, MyObject, SLOT(slot1()))
+
+ obj.signal1();
+ QCOMPARE(obj.slotCount, 1);
+ }
+
+ {
+ MyObject *obj = new MyObject;
+ QSignalSpy spy(obj, SIGNAL(signal2()));
+ qmlobject_connect(obj, MyObject, SIGNAL(signal1()), obj, MyObject, SIGNAL(signal2()));
+
+ obj->signal1();
+ QCOMPARE(spy.count(), 1);
+
+ delete obj;
+ }
+}
+
+void tst_qqmlcpputils::fastCast()
+{
+ {
+ QObject *myObj = new MyObject;
+ MyObject *obj = qmlobject_cast<MyObject*>(myObj);
+ QVERIFY(obj);
+ QCOMPARE(obj->metaObject(), myObj->metaObject());
+ obj->slot1();
+ QCOMPARE(obj->slotCount, 1);
+ delete myObj;
+ }
+
+ {
+ QObject *nullObj = 0;
+ QObject *obj = qmlobject_cast<QObject *>(nullObj);
+ QCOMPARE(obj, nullObj); // shouldn't crash/assert.
+ }
+}
+
+QTEST_MAIN(tst_qqmlcpputils)
+
+#include "tst_qqmlcpputils.moc"
diff --git a/tests/auto/qml/qqmldirparser/data/empty/qmldir b/tests/auto/qml/qqmldirparser/data/empty/qmldir
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/empty/qmldir
diff --git a/tests/auto/qml/qqmldirparser/data/excessive-module/qmldir b/tests/auto/qml/qqmldirparser/data/excessive-module/qmldir
new file mode 100644
index 0000000000..c4fdbd4e35
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/excessive-module/qmldir
@@ -0,0 +1 @@
+module foo bar
diff --git a/tests/auto/qml/qqmldirparser/data/excessive-plugin/qmldir b/tests/auto/qml/qqmldirparser/data/excessive-plugin/qmldir
new file mode 100644
index 0000000000..4acde714ac
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/excessive-plugin/qmldir
@@ -0,0 +1 @@
+plugin foo bar baz
diff --git a/tests/auto/qml/qqmldirparser/data/four-sections/qmldir b/tests/auto/qml/qqmldirparser/data/four-sections/qmldir
new file mode 100644
index 0000000000..03b37a0d27
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/four-sections/qmldir
@@ -0,0 +1 @@
+foo bar baz qux
diff --git a/tests/auto/qml/qqmldirparser/data/incomplete-module/qmldir b/tests/auto/qml/qqmldirparser/data/incomplete-module/qmldir
new file mode 100644
index 0000000000..0cca093d7a
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/incomplete-module/qmldir
@@ -0,0 +1 @@
+module
diff --git a/tests/auto/qml/qqmldirparser/data/incomplete-plugin/qmldir b/tests/auto/qml/qqmldirparser/data/incomplete-plugin/qmldir
new file mode 100644
index 0000000000..8cb205e9b3
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/incomplete-plugin/qmldir
@@ -0,0 +1 @@
+plugin
diff --git a/tests/auto/qml/qqmldirparser/data/invalid-versioned-component/qmldir b/tests/auto/qml/qqmldirparser/data/invalid-versioned-component/qmldir
new file mode 100644
index 0000000000..c322b0f278
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/invalid-versioned-component/qmldir
@@ -0,0 +1 @@
+foo 100 bar
diff --git a/tests/auto/qml/qqmldirparser/data/multiple/qmldir b/tests/auto/qml/qqmldirparser/data/multiple/qmldir
new file mode 100644
index 0000000000..e74bad5617
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/multiple/qmldir
@@ -0,0 +1,15 @@
+
+#
+# Comment
+
+module ModuleNamespace
+
+plugin PluginA plugina.so # More comment
+
+ComponentA 1.0 componenta-1_0.qml
+ScriptA 1.0 scripta-1_0.js
+
+#
+ComponentA 1.5 componenta-1_5.qml
+ComponentB 1.5 componentb-1_5.qml
+
diff --git a/tests/auto/qml/qqmldirparser/data/name-path-plugin/qmldir b/tests/auto/qml/qqmldirparser/data/name-path-plugin/qmldir
new file mode 100644
index 0000000000..5cf8bd345d
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/name-path-plugin/qmldir
@@ -0,0 +1 @@
+plugin foo bar
diff --git a/tests/auto/qml/qqmldirparser/data/name-plugin/qmldir b/tests/auto/qml/qqmldirparser/data/name-plugin/qmldir
new file mode 100644
index 0000000000..fb12cab37d
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/name-plugin/qmldir
@@ -0,0 +1 @@
+plugin foo
diff --git a/tests/auto/qml/qqmldirparser/data/no-content/qmldir b/tests/auto/qml/qqmldirparser/data/no-content/qmldir
new file mode 100644
index 0000000000..3ce87ada21
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/no-content/qmldir
@@ -0,0 +1,4 @@
+
+# only empty lines
+ # and comments
+
diff --git a/tests/auto/qml/qqmldirparser/data/non-first-module/qmldir b/tests/auto/qml/qqmldirparser/data/non-first-module/qmldir
new file mode 100644
index 0000000000..932e43a94c
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/non-first-module/qmldir
@@ -0,0 +1,2 @@
+plugin foo
+module bar
diff --git a/tests/auto/qml/qqmldirparser/data/one-section/qmldir b/tests/auto/qml/qqmldirparser/data/one-section/qmldir
new file mode 100644
index 0000000000..257cc5642c
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/one-section/qmldir
@@ -0,0 +1 @@
+foo
diff --git a/tests/auto/qml/qqmldirparser/data/repeated-module/qmldir b/tests/auto/qml/qqmldirparser/data/repeated-module/qmldir
new file mode 100644
index 0000000000..80c3e0c750
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/repeated-module/qmldir
@@ -0,0 +1,2 @@
+module foo
+module bar
diff --git a/tests/auto/qml/qqmldirparser/data/unversioned-component/qmldir b/tests/auto/qml/qqmldirparser/data/unversioned-component/qmldir
new file mode 100644
index 0000000000..d675fa44e5
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/unversioned-component/qmldir
@@ -0,0 +1 @@
+foo bar
diff --git a/tests/auto/qml/qqmldirparser/data/versioned-component/qmldir b/tests/auto/qml/qqmldirparser/data/versioned-component/qmldir
new file mode 100644
index 0000000000..a2afd1835e
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/versioned-component/qmldir
@@ -0,0 +1 @@
+foo 33.66 bar
diff --git a/tests/auto/qml/qqmldirparser/data/versioned-script/qmldir b/tests/auto/qml/qqmldirparser/data/versioned-script/qmldir
new file mode 100644
index 0000000000..1345a6855b
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/data/versioned-script/qmldir
@@ -0,0 +1 @@
+foo 33.66 bar.js
diff --git a/tests/auto/qml/qqmldirparser/qqmldirparser.pro b/tests/auto/qml/qqmldirparser/qqmldirparser.pro
new file mode 100644
index 0000000000..2abb4bd448
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/qqmldirparser.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qqmldirparser
+QT += qml testlib v8-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmldirparser.cpp
+
+include (../../shared/util.pri)
+
+CONFIG += parallel_test
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
new file mode 100644
index 0000000000..cd8f050d2d
--- /dev/null
+++ b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
@@ -0,0 +1,288 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../shared/util.h"
+
+#include <qtest.h>
+#include <QObject>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <private/v8.h>
+#include <private/qqmldirparser_p.h>
+#include <QDebug>
+
+// Test the parsing of qmldir files
+
+class tst_qqmldirparser : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmldirparser();
+
+private slots:
+ void parse_data();
+ void parse();
+};
+
+tst_qqmldirparser::tst_qqmldirparser()
+{
+}
+
+namespace {
+
+ QStringList toStringList(const QList<QQmlError> &errors)
+ {
+ QStringList rv;
+
+ foreach (const QQmlError &e, errors)
+ rv.append(e.toString());
+
+ return rv;
+ }
+
+ QString toString(const QQmlDirParser::Plugin &p)
+ {
+ return p.name + "|" + p.path;
+ }
+
+ QStringList toStringList(const QList<QQmlDirParser::Plugin> &plugins)
+ {
+ QStringList rv;
+
+ foreach (const QQmlDirParser::Plugin &p, plugins)
+ rv.append(toString(p));
+
+ return rv;
+ }
+
+ QString toString(const QQmlDirParser::Component &c)
+ {
+ return c.typeName + "|" + c.fileName + "|" + QString::number(c.majorVersion) + "|" + QString::number(c.minorVersion) + "|" + (c.internal ? "true" : "false");
+ }
+
+ QStringList toStringList(const QQmlDirComponents &components)
+ {
+ QStringList rv;
+
+ foreach (const QQmlDirParser::Component &c, components.values())
+ rv.append(toString(c));
+
+ qSort(rv);
+ return rv;
+ }
+
+ QString toString(const QQmlDirParser::Script &s)
+ {
+ return s.nameSpace + "|" + s.fileName + "|" + QString::number(s.majorVersion) + "|" + QString::number(s.minorVersion);
+ }
+
+ QStringList toStringList(const QList<QQmlDirParser::Script> &scripts)
+ {
+ QStringList rv;
+
+ foreach (const QQmlDirParser::Script &s, scripts)
+ rv.append(toString(s));
+
+ return rv;
+ }
+}
+
+void tst_qqmldirparser::parse_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QStringList>("errors");
+ QTest::addColumn<QStringList>("plugins");
+ QTest::addColumn<QStringList>("components");
+ QTest::addColumn<QStringList>("scripts");
+
+ QTest::newRow("empty")
+ << "empty/qmldir"
+ << QStringList()
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("no-content")
+ << "no-content/qmldir"
+ << QStringList()
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("one-section")
+ << "one-section/qmldir"
+ << (QStringList() << "qmldir:1: a component declaration requires two or three arguments, but 1 were provided")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("four-sections")
+ << "four-sections/qmldir"
+ << (QStringList() << "qmldir:1:12: unexpected token"
+ << "qmldir:1: invalid qmldir directive contains too many tokens")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("incomplete-module")
+ << "incomplete-module/qmldir"
+ << (QStringList() << "qmldir:1: module identifier directive requires one argument, but 0 were provided")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("excessive-module")
+ << "excessive-module/qmldir"
+ << (QStringList() << "qmldir:1: module identifier directive requires one argument, but 2 were provided")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("repeated-module")
+ << "repeated-module/qmldir"
+ << (QStringList() << "qmldir:2: only one module identifier directive may be defined in a qmldir file")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("non-first-module")
+ << "non-first-module/qmldir"
+ << (QStringList() << "qmldir:2: module identifier directive must be the first directive in a qmldir file")
+ << (QStringList() << "foo|")
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("incomplete-plugin")
+ << "incomplete-plugin/qmldir"
+ << (QStringList() << "qmldir:1: plugin directive requires one or two arguments, but 0 were provided")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("excessive-plugin")
+ << "excessive-plugin/qmldir"
+ << (QStringList() << "qmldir:1:15: unexpected token"
+ << "qmldir:1: invalid qmldir directive contains too many tokens")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("name-plugin")
+ << "name-plugin/qmldir"
+ << QStringList()
+ << (QStringList() << "foo|")
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("name-path-plugin")
+ << "name-path-plugin/qmldir"
+ << QStringList()
+ << (QStringList() << "foo|bar")
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("unversioned-component")
+ << "unversioned-component/qmldir"
+ << QStringList()
+ << QStringList()
+ << (QStringList() << "foo|bar|-1|-1|false")
+ << QStringList();
+
+ QTest::newRow("invalid-versioned-component")
+ << "invalid-versioned-component/qmldir"
+ << (QStringList() << "qmldir:1: expected '.'")
+ << QStringList()
+ << QStringList()
+ << QStringList();
+
+ QTest::newRow("versioned-component")
+ << "versioned-component/qmldir"
+ << QStringList()
+ << QStringList()
+ << (QStringList() << "foo|bar|33|66|false")
+ << QStringList();
+
+ QTest::newRow("versioned-script")
+ << "versioned-script/qmldir"
+ << QStringList()
+ << QStringList()
+ << QStringList()
+ << (QStringList() << "foo|bar.js|33|66");
+
+ QTest::newRow("multiple")
+ << "multiple/qmldir"
+ << QStringList()
+ << (QStringList() << "PluginA|plugina.so")
+ << (QStringList() << "ComponentA|componenta-1_0.qml|1|0|false"
+ << "ComponentA|componenta-1_5.qml|1|5|false"
+ << "ComponentB|componentb-1_5.qml|1|5|false")
+ << (QStringList() << "ScriptA|scripta-1_0.js|1|0");
+}
+
+void tst_qqmldirparser::parse()
+{
+ QFETCH(QString, file);
+ QFETCH(QStringList, errors);
+ QFETCH(QStringList, plugins);
+ QFETCH(QStringList, components);
+ QFETCH(QStringList, scripts);
+
+ QFile f(testFile(file));
+ f.open(QIODevice::ReadOnly);
+
+ QQmlDirParser p;
+ p.parse(f.readAll());
+
+ if (errors.isEmpty()) {
+ QCOMPARE(p.hasError(), false);
+ } else {
+ QCOMPARE(p.hasError(), true);
+ QCOMPARE(toStringList(p.errors("qmldir")), errors);
+ }
+
+ QCOMPARE(toStringList(p.plugins()), plugins);
+ QCOMPARE(toStringList(p.components()), components);
+ QCOMPARE(toStringList(p.scripts()), scripts);
+}
+
+QTEST_MAIN(tst_qqmldirparser)
+
+#include "tst_qqmldirparser.moc"
diff --git a/tests/auto/qml/qqmlecmascript/data/AliasBindingsAssignCorrectlyType.qml b/tests/auto/qml/qqmlecmascript/data/AliasBindingsAssignCorrectlyType.qml
new file mode 100644
index 0000000000..e8e108fa44
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/AliasBindingsAssignCorrectlyType.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property real realProperty
+ property alias aliasProperty: root.realProperty
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType.qml b/tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType.qml
new file mode 100644
index 0000000000..062772106b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyTypeObject {
+ id: root
+
+ property int data: 7
+
+ property int targetProperty: root.data * 43 - root.data
+ property alias aliasProperty: root.targetProperty
+
+ pointProperty: Qt.point(data, data);
+ property alias pointAliasProperty: root.pointProperty
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType3.qml b/tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType3.qml
new file mode 100644
index 0000000000..823c0ef367
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/AliasBindingsOverrideTargetType3.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property int testProperty
+ property alias aliasProperty: root.testProperty
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType1.qml b/tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType1.qml
new file mode 100644
index 0000000000..cef8ae09ea
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType1.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property alias group: obj
+ property variant foo: AliasToCompositeElementType2 { id: obj }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType2.qml b/tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType2.qml
new file mode 100644
index 0000000000..4a45535a50
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/AliasToCompositeElementType2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int value
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/BaseComponent.qml b/tests/auto/qml/qqmlecmascript/data/BaseComponent.qml
new file mode 100644
index 0000000000..bad4bf8975
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/BaseComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property Item baz: Item { width: 100 }
+ property string bar: baz.width
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml b/tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml
new file mode 100644
index 0000000000..4f99a3db68
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/BaseComponent2.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ id: base
+
+ property int directProperty: 333
+ function getDirectFromBase() { return directProperty }
+
+ property alias baseDirectAlias: base.directProperty
+
+ property Item objectProperty: Item { width: 333 }
+
+ property int optimizedBoundProperty: objectProperty.width
+ function getOptimizedBoundFromBase() { return optimizedBoundProperty }
+
+ property alias baseOptimizedBoundAlias: base.optimizedBoundProperty
+
+ property int unoptimizedBoundProperty: if (true) objectProperty.width
+ function getUnoptimizedBoundFromBase() { return unoptimizedBoundProperty }
+
+ property alias baseUnoptimizedBoundAlias: base.unoptimizedBoundProperty
+
+ property int baseDirectPropertyChangedValue: 0
+ onDirectPropertyChanged: baseDirectPropertyChangedValue = directProperty
+
+ property int baseOptimizedBoundPropertyChangedValue: 0
+ onOptimizedBoundPropertyChanged: baseOptimizedBoundPropertyChangedValue = optimizedBoundProperty
+
+ property int baseUnoptimizedBoundPropertyChangedValue: 0
+ onUnoptimizedBoundPropertyChanged: baseUnoptimizedBoundPropertyChangedValue = unoptimizedBoundProperty
+
+ function setDirectFromBase(n) { directProperty = n }
+ function setBoundFromBase(n) { objectProperty.width = n }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml b/tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml
new file mode 100644
index 0000000000..3105b8c79f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ComponentWithVarProp.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property var varprop: true
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ConstantsOverrideBindings.qml b/tests/auto/qml/qqmlecmascript/data/ConstantsOverrideBindings.qml
new file mode 100644
index 0000000000..07bb16b0d8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ConstantsOverrideBindings.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int c1: 0
+ property int c2: c1
+ property alias c3: inner.ic1
+
+ objectProperty: MyQmlObject {
+ id: inner
+ property int ic1: c1
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ContainerComponent.qml b/tests/auto/qml/qqmlecmascript/data/ContainerComponent.qml
new file mode 100644
index 0000000000..459c82afbb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ContainerComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ContentComponent.qml b/tests/auto/qml/qqmlecmascript/data/ContentComponent.qml
new file mode 100644
index 0000000000..7710624cc2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ContentComponent.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ property bool validParentChildCount: parent && (parent.children.length > 0)
+
+ onValidParentChildCountChanged: {
+ if (!validParentChildCount) console.warn('WARNING: Invalid parent child count')
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/CustomObject.qml b/tests/auto/qml/qqmlecmascript/data/CustomObject.qml
new file mode 100644
index 0000000000..aa1a1d6061
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/CustomObject.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property string greeting: "hello world"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml b/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml
new file mode 100644
index 0000000000..1d5dbe88d5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentBase.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as ModApi
+
+Rectangle {
+ id: base
+ color: "red"
+
+ function flipOwnership() {
+ ModApi.QObject.trackObject(base);
+ ModApi.QObject.trackedObject(); // flip the ownership.
+ if (!ModApi.QObject.trackedObjectHasJsOwnership())
+ derived.testConditionsMet = false;
+ else
+ derived.testConditionsMet = true;
+ }
+
+ onColorChanged: {
+ // will be triggered during beginCreate of derived
+ flipOwnership();
+ gc();
+ gc();
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentDerived.qml b/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentDerived.qml
new file mode 100644
index 0000000000..c6273465d7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/DeleteRootObjectInCreationComponentDerived.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+DeleteRootObjectInCreationComponentBase {
+ id: derived
+ color: "black" // will trigger change signal during beginCreate.
+
+ property bool testConditionsMet: false // will be set by base
+ function setTestConditionsMet(obj) {
+ obj.testConditionsMet = derived.testConditionsMet;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ElementAssignType.qml b/tests/auto/qml/qqmlecmascript/data/ElementAssignType.qml
new file mode 100644
index 0000000000..4a45535a50
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ElementAssignType.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int value
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/HRMDPComponent.qml b/tests/auto/qml/qqmlecmascript/data/HRMDPComponent.qml
new file mode 100644
index 0000000000..fab55fa0d1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/HRMDPComponent.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as QObjectApi
+
+Item {
+ property int variantCanary: 5
+ property var varCanary: 12
+
+ Component.onCompleted: {
+ QObjectApi.QObject.qobjectTestWritableProperty = 42;
+ }
+
+ Component.onDestruction: {
+ QObjectApi.QObject.qobjectTestWritableProperty = 43;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/InnerObject.qml b/tests/auto/qml/qqmlecmascript/data/InnerObject.qml
new file mode 100644
index 0000000000..a8ed9593d1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/InnerObject.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+QtObject {
+ property int foo1: 100
+ property int foo2: 100
+ property int foo3: { return 100; }
+ property int foo4: { return 100; }
+
+ property string bar1: 'Hello'
+ property string bar2: 'Hello'
+ property string bar3: { return 'Hello'; }
+ property string bar4: { return 'Hello'; }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/MethodsObject.qml b/tests/auto/qml/qqmlecmascript/data/MethodsObject.qml
new file mode 100644
index 0000000000..eaca0a7f92
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/MethodsObject.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ function testFunction() { return 19; }
+ function testFunction2() { return 18; }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/NestedTypeTransientErrors.qml b/tests/auto/qml/qqmlecmascript/data/NestedTypeTransientErrors.qml
new file mode 100644
index 0000000000..3b3e84a900
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/NestedTypeTransientErrors.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+QtObject {
+ property int b: obj.prop.a
+
+ property variant prop;
+ prop: QtObject {
+ property int a: 10
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/OnDestructionComponent.qml b/tests/auto/qml/qqmlecmascript/data/OnDestructionComponent.qml
new file mode 100644
index 0000000000..76e0ec3793
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/OnDestructionComponent.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test 1.0 as ModApi
+
+Item {
+ id: sec
+
+ property int a: 10
+ Component.onDestruction: ModApi.QObject.setSpecificProperty(sec, "a", 20);
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/OuterObject.qml b/tests/auto/qml/qqmlecmascript/data/OuterObject.qml
new file mode 100644
index 0000000000..da571a9732
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/OuterObject.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property InnerObject inner: InnerObject {}
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyQJSValueBaseItem.qml b/tests/auto/qml/qqmlecmascript/data/PropertyQJSValueBaseItem.qml
new file mode 100644
index 0000000000..4a695a0727
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyQJSValueBaseItem.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ qjsvalue: null
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarBaseItem.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarBaseItem.qml
new file mode 100644
index 0000000000..5f28833fe7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarBaseItem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property var random: null
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent.qml
new file mode 100644
index 0000000000..36c025401f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property var vp: Item {
+ id: second
+ property var vp: Item {
+ id: third
+ property var vp: Item {
+ id: fourth
+ property var vp: Item {
+ id: fifth
+ property int fifthCanary: 5
+ property var circ: third.vp
+ property MyScarceResourceObject srp;
+ srp: MyScarceResourceObject { id: scarceResourceProvider }
+ property variant memoryHog: scarceResourceProvider.newScarceResource()
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent2.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent2.qml
new file mode 100644
index 0000000000..6a49cb9317
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent2.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// Similar to PVCC.qml except that it has another var property
+// It will have a different metaobject.
+Item {
+ id: first
+ property var anotherVp: 6
+ property var vp: Item {
+ id: second
+ property var vp: Item {
+ id: third
+ property var vp: Item {
+ id: fourth
+ property var vp: Item {
+ id: fifth
+ property int fifthCanary: 5
+ property var circ: third.vp
+ property MyScarceResourceObject srp;
+ srp: MyScarceResourceObject { id: scarceResourceProvider }
+ property variant memoryHog2: scarceResourceProvider.newScarceResource()
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent3.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent3.qml
new file mode 100644
index 0000000000..a90725016e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent3.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: rectangle // will have JS ownership
+ objectName: "rectangle"
+ width: 10
+ height: 10
+ property var rectCanary: 5
+
+ Text {
+ id: text // will have Eventual-JS ownership
+ objectName: "text"
+ property var vp: rectangle
+ property var textCanary: 10
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent4.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent4.qml
new file mode 100644
index 0000000000..9273a52f54
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent4.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: rectangle // will have JS ownership
+ objectName: "rectangle"
+ width: 10
+ height: 10
+ property var rectCanary: 5
+
+ Text {
+ id: text // will have Eventual-JS ownership
+ objectName: "text"
+ property var vp
+ property var textCanary: 10
+
+ // The varProperties array of "text" is weak
+ // (due to eventual JS ownership since parent is JS owned)
+ // but nonetheless, the reference to the created QObject
+ // should cause that QObject to NOT be collected.
+ function constructQObject() {
+ var component = Qt.createComponent("PropertyVarCircularComponent5.qml");
+ if (component.status == Component.Ready) {
+ text.vp = component.createObject(null); // has JavaScript ownership
+ }
+ gc();
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent5.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent5.qml
new file mode 100644
index 0000000000..94ef338792
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarCircularComponent5.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Image {
+ id: image
+ objectName: "image"
+ property var imageCanary: 13
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarInheritanceComponent.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarInheritanceComponent.qml
new file mode 100644
index 0000000000..b01cf6ed84
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarInheritanceComponent.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+PropertyVarCircularComponent {
+ id: inheritanceComponent
+ property int inheritanceIntProperty: 6
+ property var inheritanceVarProperty
+
+ function constructGarbage() {
+ var retn = 1;
+ var component = Qt.createComponent("PropertyVarCircularComponent2.qml");
+ if (component.status == Component.Ready) {
+ retn = component.createObject(null); // has JavaScript ownership
+ }
+ return retn;
+ }
+
+ Component.onCompleted: {
+ inheritanceVarProperty = constructGarbage();
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/PropertyVarOwnershipComponent.qml b/tests/auto/qml/qqmlecmascript/data/PropertyVarOwnershipComponent.qml
new file mode 100644
index 0000000000..c1f73d3bac
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/PropertyVarOwnershipComponent.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: rectangle // will have JS ownership
+ objectName: "rectangle"
+ width: 10
+ height: 10
+ property var rectCanary: 5
+
+ Text {
+ id: textOne // will have Eventual-JS ownership
+ objectName: "textOne"
+ property var textCanary: 11
+ property var vp
+ }
+
+ Text {
+ id: textTwo
+ objectName: "textTwo"
+ property var textCanary: 12
+ property var vp
+
+ function constructQObject() {
+ var component = Qt.createComponent("PropertyVarCircularComponent5.qml");
+ if (component.status == Component.Ready) {
+ textTwo.vp = component.createObject(null); // has JavaScript ownership
+ }
+ gc();
+ }
+
+ function deassignVp() {
+ textTwo.textCanary = 22;
+ textTwo.vp = textTwo.textCanary;
+ gc();
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent.qml b/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent.qml
new file mode 100644
index 0000000000..f5c0ce6b18
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property int a: 50
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Base.qml b/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Base.qml
new file mode 100644
index 0000000000..a93fe69ef3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Base.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as ModApi
+
+Rectangle {
+ id: base
+ x: 1
+ color: "red"
+ property bool testConditionsMet: false
+
+ onXChanged: {
+ ModApi.QObject.trackObject(base);
+ ModApi.QObject.trackedObject(); // flip the ownership.
+ if (!ModApi.QObject.trackedObjectHasJsOwnership())
+ testConditionsMet = false;
+ else
+ testConditionsMet = true;
+ }
+
+ onColorChanged: {
+ // will be triggered during beginCreate of derived
+ test.testConditionsMet = testConditionsMet;
+ gc();
+ gc();
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Derived.qml b/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Derived.qml
new file mode 100644
index 0000000000..b736e70dea
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/QQmlDataDestroyedComponent2Derived.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QQmlDataDestroyedComponent2Base {
+ id: derived
+ color: "black" // will trigger change signal during beginCreate.
+ x: 2 // flip ownership of base
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/RootObject.qml b/tests/auto/qml/qqmlecmascript/data/RootObject.qml
new file mode 100644
index 0000000000..bf46155c96
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/RootObject.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color:"red"
+ property bool rootIndestructible:false
+ property bool childDestructible:child === null
+ onColorChanged: {
+ try {
+ root.destroy();
+ gc();
+ } catch(e) {
+ rootIndestructible = true;
+ }
+ }
+
+ QtObject {
+ id:child
+ }
+ Component.onCompleted: child.destroy();
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVar.qml b/tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVar.qml
new file mode 100644
index 0000000000..d56bd41a99
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVar.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property var scarceResourceCopy
+ property int width: 5
+ signal testSignal
+ signal testSignal2
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVariant.qml b/tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVariant.qml
new file mode 100644
index 0000000000..e10fcfe36a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ScarceResourceSignalComponentVariant.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant scarceResourceCopy
+ property int width: 5
+ signal testSignal
+ signal testSignal2
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/ScarceResourceVarComponent.qml b/tests/auto/qml/qqmlecmascript/data/ScarceResourceVarComponent.qml
new file mode 100644
index 0000000000..2cf6b4223b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ScarceResourceVarComponent.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property var vp: Item {
+ id: second
+ property MyScarceResourceObject srp;
+ srp: MyScarceResourceObject { id: scarceResourceProvider }
+ property var sr: scarceResourceProvider.scarceResource
+ property var canary: 5
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/Scope6Nested.qml b/tests/auto/qml/qqmlecmascript/data/Scope6Nested.qml
new file mode 100644
index 0000000000..a3794df22b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/Scope6Nested.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ function runtest(obj) {
+ return obj.MyQmlObject.value == 19;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ScopeObject.qml b/tests/auto/qml/qqmlecmascript/data/ScopeObject.qml
new file mode 100644
index 0000000000..f341cce3c9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ScopeObject.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ property int a: 3
+ property int binding: myFunction();
+ property int binding2: myCompFunction();
+
+ function myCompFunction() {
+ return a;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/SequenceConversionComponent.qml b/tests/auto/qml/qqmlecmascript/data/SequenceConversionComponent.qml
new file mode 100644
index 0000000000..0c7f60b062
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/SequenceConversionComponent.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MySequenceConversionObject {
+ id: sccmsco
+ objectName: "sccmsco"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/SignalEmittedComponent.qml b/tests/auto/qml/qqmlecmascript/data/SignalEmittedComponent.qml
new file mode 100644
index 0000000000..a291e7b275
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/SignalEmittedComponent.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0 as ModApi
+
+Item {
+ id: sec
+ property int a: 10
+ Component.onDestruction: {
+ ModApi.QObject.setSpecificProperty(sec, "a", 20);
+ }
+
+ function setSuccessPropertyOf(obj, val) {
+ obj.success = val;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/SpuriousWarning.qml b/tests/auto/qml/qqmlecmascript/data/SpuriousWarning.qml
new file mode 100644
index 0000000000..f6398d254d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/SpuriousWarning.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property int children: root.children.length
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/TypeForDynamicCreation.qml b/tests/auto/qml/qqmlecmascript/data/TypeForDynamicCreation.qml
new file mode 100644
index 0000000000..56e06252c4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/TypeForDynamicCreation.qml
@@ -0,0 +1,2 @@
+import Qt.test 1.0
+MyQmlObject{objectName:"objectThree"}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml b/tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml
new file mode 100644
index 0000000000..ff6c553c31
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasBindingsAssignCorrectly.qml
@@ -0,0 +1,59 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property bool test: false
+
+ property real testData: 9
+ property real testData2: 9
+
+ states: State {
+ name: "change"
+ PropertyChanges {
+ target: myType
+ realProperty: if (testData2 > 3) 9; else 11;
+ }
+ }
+
+ AliasBindingsAssignCorrectlyType {
+ id: myType
+
+ aliasProperty: if (testData > 3) 14; else 12;
+ }
+
+ Component.onCompleted: {
+ // Check original binding works
+ if (myType.aliasProperty != 14) return;
+
+ testData = 2;
+ if (myType.aliasProperty != 12) return;
+
+ // Change binding indirectly by modifying the "realProperty"
+ root.state = "change";
+ if (myType.aliasProperty != 9) return;
+
+ // Check the new binding works
+ testData2 = 1;
+ if (myType.aliasProperty != 11) return;
+
+ // Try and trigger the old binding (that should have been removed)
+ testData = 6;
+ if (myType.aliasProperty != 11) return;
+
+ // Restore the original binding
+ root.state = "";
+ if (myType.aliasProperty != 14) return;
+
+ // Test the restored binding works
+ testData = 0;
+ if (myType.aliasProperty != 12) return;
+
+ // Test the old binding isn't somehow hanging around and still in effect
+ testData2 = 13;
+ if (myType.aliasProperty != 12) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.2.qml b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.2.qml
new file mode 100644
index 0000000000..bba9033235
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.2.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ id: me
+ property bool test: false
+
+ property int value: 9
+
+ AliasBindingsOverrideTargetType {
+ id: aliasType
+ pointAliasProperty.x: me.value
+ }
+
+ Component.onCompleted: {
+ if (aliasType.pointAliasProperty.x != 9) return;
+
+ me.value = 11;
+ if (aliasType.pointAliasProperty.x != 11) return;
+
+ aliasType.data = 8;
+ if (aliasType.pointAliasProperty.x != 11) return;
+
+ me.value = 4;
+ if (aliasType.pointAliasProperty.x != 4) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml
new file mode 100644
index 0000000000..3e4cda6ba3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.3.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool test: false;
+
+ property int value1: 10
+ property int value2: 11
+
+ AliasBindingsOverrideTargetType3 {
+ id: obj
+
+ testProperty: root.value1 * 9
+ aliasProperty: root.value2 * 10
+ }
+
+ Component.onCompleted: {
+ if (obj.testProperty != 110) return;
+ if (obj.aliasProperty != 110) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.qml b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.qml
new file mode 100644
index 0000000000..de5f49ffc5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasBindingsOverrideTarget.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Item {
+ id: me
+ property bool test: false
+
+ property int value: 9
+
+ AliasBindingsOverrideTargetType {
+ id: aliasType
+ aliasProperty: me.value
+ }
+
+ Component.onCompleted: {
+ if (aliasType.aliasProperty != 9) return;
+
+ me.value = 11;
+ if (aliasType.aliasProperty != 11) return;
+
+ aliasType.data = 8;
+ if (aliasType.aliasProperty != 11) return;
+
+ me.value = 4;
+ if (aliasType.aliasProperty != 4) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml b/tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml
new file mode 100644
index 0000000000..f228b2c19f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasPropertyAndBinding.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property alias c1: myObject.c1
+ property int c2: 3
+ property int c3: c2
+ objectProperty: QtObject {
+ id: myObject
+ property int c1
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasToCompositeElement.qml b/tests/auto/qml/qqmlecmascript/data/aliasToCompositeElement.qml
new file mode 100644
index 0000000000..79d6e6887c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasToCompositeElement.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+AliasToCompositeElementType1 {
+ group.value: 13
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.2.qml b/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.2.qml
new file mode 100644
index 0000000000..b5bc280d11
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.2.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ id: me
+ property bool test: false
+
+ property int value: 9
+
+ AliasBindingsOverrideTargetType {
+ id: aliasType
+ }
+
+ Component.onCompleted: {
+ if (aliasType.aliasProperty != 294) return;
+
+ aliasType.data = 8;
+ if (aliasType.aliasProperty != 336) return;
+
+ aliasType.aliasProperty = 4;
+ if (aliasType.aliasProperty != 4) return;
+
+ aliasType.data = 7;
+ if (aliasType.aliasProperty != 4) return;
+
+ test = true;
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.3.qml b/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.3.qml
new file mode 100644
index 0000000000..6c16ff5604
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.3.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ id: me
+ property bool test: false
+
+ property int value: 9
+
+ AliasBindingsOverrideTargetType {
+ id: aliasType
+ pointAliasProperty.x: 9
+ }
+
+ Component.onCompleted: {
+ if (aliasType.pointAliasProperty.x != 9) return;
+
+ aliasType.data = 8;
+ if (aliasType.pointAliasProperty.x != 9) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.qml b/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.qml
new file mode 100644
index 0000000000..441098bd39
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasWritesOverrideBindings.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ id: me
+ property bool test: false
+
+ property int value: 9
+
+ AliasBindingsOverrideTargetType {
+ id: aliasType
+ aliasProperty: 11
+ }
+
+ Component.onCompleted: {
+ if (aliasType.aliasProperty != 11) return;
+
+ aliasType.data = 8;
+ if (aliasType.aliasProperty != 11) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasreset/AliasPropertyComponent.qml b/tests/auto/qml/qqmlecmascript/data/aliasreset/AliasPropertyComponent.qml
new file mode 100644
index 0000000000..9135e79469
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasreset/AliasPropertyComponent.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ id: apc
+ property alias sourceComponent: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: redSquare
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.1.qml b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.1.qml
new file mode 100644
index 0000000000..b855a183ee
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.1.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool aliasIsUndefined: false
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ sourceComponent: redSquare
+ }
+
+ function resetAliased() {
+ loader.sourceComponent = undefined;
+ aliasIsUndefined = (sourceComponentAlias == undefined);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.2.qml b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.2.qml
new file mode 100644
index 0000000000..b0bb3681cf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.2.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool loaderSourceComponentIsUndefined: false
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ sourceComponent: redSquare
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined;
+ loaderSourceComponentIsUndefined = (loader.sourceComponent == undefined);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.3.qml b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.3.qml
new file mode 100644
index 0000000000..b318af0138
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.3.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool loaderTwoSourceComponentIsUndefined: false
+ property bool loaderOneSourceComponentIsUndefined: false
+ property alias sourceComponentAlias: loaderOne.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loaderOne
+ sourceComponent: loaderTwo.sourceComponent
+ }
+
+ Loader {
+ id: loaderTwo
+ sourceComponent: redSquare
+ x: 15
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined; // loaderOne.sourceComponent should be set to undefined instead of l2.sc
+ loaderOneSourceComponentIsUndefined = (loaderOne.sourceComponent == undefined); // should be true
+ loaderTwoSourceComponentIsUndefined = (loaderTwo.sourceComponent == undefined); // should be false
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.4.qml b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.4.qml
new file mode 100644
index 0000000000..c5f56a8798
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.4.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: redSquare
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined; // ensure we don't crash after deletion of loader.
+ }
+
+ function setAlias() {
+ sourceComponentAlias = redSquare;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.5.qml b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.5.qml
new file mode 100644
index 0000000000..b07db8ba40
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.5.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+
+ AliasPropertyComponent {
+ sourceComponent: returnsUndefined()
+ }
+
+ function returnsUndefined() {
+ return undefined;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.error.1.qml b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.error.1.qml
new file mode 100644
index 0000000000..35c9d6fd5d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/aliasreset/aliasPropertyReset.error.1.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: first
+ property bool aliasedIntIsUndefined: false
+ property alias intAlias: objprop.intp
+
+ objectProperty: QtObject {
+ id: objprop
+ property int intp: 12
+ }
+
+ function resetAlias() {
+ intAlias = undefined; // should error
+ aliasedIntIsUndefined = (objprop.intp == undefined);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml
new file mode 100644
index 0000000000..ff6d7311a1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.2.qml
@@ -0,0 +1,27 @@
+import Qt.test 1.0
+
+MyTypeObject {
+ flagProperty: if(1) "FlagVal1 | FlagVal3"
+ enumProperty: if(1) "EnumVal2"
+ relatedEnumProperty: if(1) "RelatedValue"
+ stringProperty: if(1) "Hello World!"
+ uintProperty: if(1) 10
+ intProperty: if(1) -19
+ realProperty: if(1) 23.2
+ doubleProperty: if(1) -19.75
+ floatProperty: if(1) 8.5
+ colorProperty: if(1) "red"
+ dateProperty: if(1) "1982-11-25"
+ timeProperty: if(1) "11:11:32"
+ dateTimeProperty: if(1) "2009-05-12T13:22:01"
+ pointProperty: if(1) "99,13"
+ pointFProperty: if(1) "-10.1,12.3"
+ sizeProperty: if(1) "99x13"
+ sizeFProperty: if(1) "0.1x0.2"
+ rectProperty: if(1) "9,7,100x200"
+ rectFProperty: if(1) "1000.1,-10.9,400x90.99"
+ boolProperty: if(1) true
+ variantProperty: if(1) "Hello World!"
+ vectorProperty: if(1) "10,1,2.2"
+ urlProperty: if(1) "main.qml"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml
new file mode 100644
index 0000000000..ce3511f72a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignBasicTypes.qml
@@ -0,0 +1,30 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ Component.onCompleted: {
+ flagProperty = "FlagVal1 | FlagVal3"
+ enumProperty = "EnumVal2"
+ relatedEnumProperty = "RelatedValue"
+ stringProperty = "Hello World!"
+ uintProperty = 10
+ intProperty = -19
+ realProperty = 23.2
+ doubleProperty = -19.75
+ floatProperty = 8.5
+ colorProperty = "red"
+ dateProperty = "1982-11-25"
+ 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!"
+ vectorProperty = "10,1,2.2"
+ urlProperty = "main.qml"
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.1.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.1.qml
new file mode 100644
index 0000000000..efca6cdb80
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignDate.1.qml
@@ -0,0 +1,35 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ Component.onCompleted: {
+ var dateVar = new Date(Date.UTC(2009, 4, 12))
+ var dateTimeVar = new Date(Date.UTC(2009, 4, 12, 0, 0, 1))
+ var dateTimeVar2 = new Date(Date.UTC(2009, 4, 12, 23, 59, 59))
+
+ dateProperty = dateVar
+ dateTimeProperty = dateTimeVar
+ dateTimeProperty2 = dateTimeVar2
+
+ // Commented properties do not currently test true:
+ boolProperty = //(dateProperty.getTime() == dateVar.getTime()) &&
+ (dateProperty.getFullYear() == 2009) &&
+ (dateProperty.getMonth() == 5-1) &&
+ //(dateProperty.getDate() == 12) &&
+ (dateProperty.getHours() == 0) &&
+ (dateTimeProperty.getTime() == dateTimeVar.getTime()) &&
+ (dateTimeProperty.getFullYear() == 2009) &&
+ (dateTimeProperty.getMonth() == 5-1) &&
+ //(dateTimeProperty.getDate() == 12) &&
+ //(dateTimeProperty.getHours() == 0) &&
+ (dateTimeProperty.getMinutes() == 0) &&
+ (dateTimeProperty.getSeconds() == 1) &&
+ (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) &&
+ (dateTimeProperty2.getFullYear() == 2009) &&
+ (dateTimeProperty2.getMonth() == 5-1) &&
+ //(dateTimeProperty2.getDate() == 12) &&
+ //(dateTimeProperty2.getHours() == 23) &&
+ (dateTimeProperty2.getMinutes() == 59) &&
+ (dateTimeProperty2.getSeconds() == 59)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.2.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.2.qml
new file mode 100644
index 0000000000..71dd188f05
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignDate.2.qml
@@ -0,0 +1,36 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ dateProperty: if (1) new Date("2009-05-12")
+ dateTimeProperty: if (1) new Date("2009-05-12T00:00:01")
+ dateTimeProperty2: if (1) new Date("2009-05-12T23:59:59")
+
+ boolProperty: false
+ Component.onCompleted: {
+ var dateVar = new Date("2009-05-12")
+ var dateTimeVar = new Date("2009-05-12T00:00:01")
+ var dateTimeVar2 = new Date("2009-05-12T23:59:59")
+
+ // Commented properties do not currently test true:
+ boolProperty = //(dateProperty.getTime() == dateVar.getTime()) &&
+ (dateProperty.getFullYear() == 2009) &&
+ (dateProperty.getMonth() == 5-1) &&
+ //(dateProperty.getDate() == 12) &&
+ (dateProperty.getHours() == 0) &&
+ (dateTimeProperty.getTime() == dateTimeVar.getTime()) &&
+ (dateTimeProperty.getFullYear() == 2009) &&
+ (dateTimeProperty.getMonth() == 5-1) &&
+ //(dateTimeProperty.getDate() == 12) &&
+ //(dateTimeProperty.getHours() == 0) &&
+ (dateTimeProperty.getMinutes() == 0) &&
+ (dateTimeProperty.getSeconds() == 1) &&
+ (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) &&
+ (dateTimeProperty2.getFullYear() == 2009) &&
+ (dateTimeProperty2.getMonth() == 5-1) &&
+ //(dateTimeProperty2.getDate() == 12) &&
+ //(dateTimeProperty2.getHours() == 23) &&
+ (dateTimeProperty2.getMinutes() == 59) &&
+ (dateTimeProperty2.getSeconds() == 59)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.3.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.3.qml
new file mode 100644
index 0000000000..2cf740645c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignDate.3.qml
@@ -0,0 +1,36 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ dateProperty: if (1) "2009-05-12Z"
+ dateTimeProperty: if (1) "2009-05-12T00:00:01Z"
+ dateTimeProperty2: if (1) "2009-05-12T23:59:59Z"
+
+ boolProperty: false
+ Component.onCompleted: {
+ var dateVar = new Date("2009-05-12Z")
+ var dateTimeVar = new Date("2009-05-12T00:00:01Z")
+ var dateTimeVar2 = new Date("2009-05-12T23:59:59Z")
+
+ // Commented properties do not currently test true:
+ boolProperty = //(dateProperty.getTime() == dateVar.getTime()) &&
+ (dateProperty.getFullYear() == 2009) &&
+ (dateProperty.getMonth() == 5-1) &&
+ //(dateProperty.getDate() == 12) &&
+ (dateProperty.getHours() == 0) &&
+ (dateTimeProperty.getTime() == dateTimeVar.getTime()) &&
+ (dateTimeProperty.getFullYear() == 2009) &&
+ (dateTimeProperty.getMonth() == 5-1) &&
+ //(dateTimeProperty.getDate() == 12) &&
+ //(dateTimeProperty.getHours() == 0) &&
+ (dateTimeProperty.getMinutes() == 0) &&
+ (dateTimeProperty.getSeconds() == 1) &&
+ (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) &&
+ (dateTimeProperty2.getFullYear() == 2009) &&
+ (dateTimeProperty2.getMonth() == 5-1) &&
+ //(dateTimeProperty2.getDate() == 12) &&
+ //(dateTimeProperty2.getHours() == 23) &&
+ (dateTimeProperty2.getMinutes() == 59) &&
+ (dateTimeProperty2.getSeconds() == 59)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.4.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.4.qml
new file mode 100644
index 0000000000..9b4975c833
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignDate.4.qml
@@ -0,0 +1,36 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ dateProperty: if (1) new Date("2009-05-12Z")
+ dateTimeProperty: if (1) new Date("2009-05-12T00:00:01Z")
+ dateTimeProperty2: if (1) new Date("2009-05-12T23:59:59Z")
+
+ boolProperty: false
+ Component.onCompleted: {
+ var dateVar = new Date("2009-05-12Z")
+ var dateTimeVar = new Date("2009-05-12T00:00:01Z")
+ var dateTimeVar2 = new Date("2009-05-12T23:59:59Z")
+
+ // Commented properties do not currently test true:
+ boolProperty = //(dateProperty.getTime() == dateVar.getTime()) &&
+ (dateProperty.getFullYear() == 2009) &&
+ (dateProperty.getMonth() == 5-1) &&
+ //(dateProperty.getDate() == 12) &&
+ (dateProperty.getHours() == 0) &&
+ (dateTimeProperty.getTime() == dateTimeVar.getTime()) &&
+ (dateTimeProperty.getFullYear() == 2009) &&
+ (dateTimeProperty.getMonth() == 5-1) &&
+ //(dateTimeProperty.getDate() == 12) &&
+ //(dateTimeProperty.getHours() == 0) &&
+ (dateTimeProperty.getMinutes() == 0) &&
+ (dateTimeProperty.getSeconds() == 1) &&
+ (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) &&
+ (dateTimeProperty2.getFullYear() == 2009) &&
+ (dateTimeProperty2.getMonth() == 5-1) &&
+ //(dateTimeProperty2.getDate() == 12) &&
+ //(dateTimeProperty2.getHours() == 23) &&
+ (dateTimeProperty2.getMinutes() == 59) &&
+ (dateTimeProperty2.getSeconds() == 59)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.5.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.5.qml
new file mode 100644
index 0000000000..2cf740645c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignDate.5.qml
@@ -0,0 +1,36 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ dateProperty: if (1) "2009-05-12Z"
+ dateTimeProperty: if (1) "2009-05-12T00:00:01Z"
+ dateTimeProperty2: if (1) "2009-05-12T23:59:59Z"
+
+ boolProperty: false
+ Component.onCompleted: {
+ var dateVar = new Date("2009-05-12Z")
+ var dateTimeVar = new Date("2009-05-12T00:00:01Z")
+ var dateTimeVar2 = new Date("2009-05-12T23:59:59Z")
+
+ // Commented properties do not currently test true:
+ boolProperty = //(dateProperty.getTime() == dateVar.getTime()) &&
+ (dateProperty.getFullYear() == 2009) &&
+ (dateProperty.getMonth() == 5-1) &&
+ //(dateProperty.getDate() == 12) &&
+ (dateProperty.getHours() == 0) &&
+ (dateTimeProperty.getTime() == dateTimeVar.getTime()) &&
+ (dateTimeProperty.getFullYear() == 2009) &&
+ (dateTimeProperty.getMonth() == 5-1) &&
+ //(dateTimeProperty.getDate() == 12) &&
+ //(dateTimeProperty.getHours() == 0) &&
+ (dateTimeProperty.getMinutes() == 0) &&
+ (dateTimeProperty.getSeconds() == 1) &&
+ (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) &&
+ (dateTimeProperty2.getFullYear() == 2009) &&
+ (dateTimeProperty2.getMonth() == 5-1) &&
+ //(dateTimeProperty2.getDate() == 12) &&
+ //(dateTimeProperty2.getHours() == 23) &&
+ (dateTimeProperty2.getMinutes() == 59) &&
+ (dateTimeProperty2.getSeconds() == 59)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.6.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.6.qml
new file mode 100644
index 0000000000..73e26db0c8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignDate.6.qml
@@ -0,0 +1,36 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ dateProperty: if (1) new Date("2009-05-12")
+ dateTimeProperty: if (1) new Date("2009-05-12T02:00:01+02:00")
+ dateTimeProperty2: if (1) new Date("2009-05-13T01:59:59+02:00")
+
+ boolProperty: false
+ Component.onCompleted: {
+ var dateVar = new Date("2009-05-12")
+ var dateTimeVar = new Date("2009-05-12T02:00:01+02:00")
+ var dateTimeVar2 = new Date("2009-05-13T01:59:59+02:00")
+
+ // Commented properties do not currently test true:
+ boolProperty = //(dateProperty.getTime() == dateVar.getTime()) &&
+ (dateProperty.getFullYear() == 2009) &&
+ (dateProperty.getMonth() == 5-1) &&
+ //(dateProperty.getDate() == 12) &&
+ (dateProperty.getHours() == 0) &&
+ (dateTimeProperty.getTime() == dateTimeVar.getTime()) &&
+ (dateTimeProperty.getFullYear() == 2009) &&
+ (dateTimeProperty.getMonth() == 5-1) &&
+ //(dateTimeProperty.getDate() == 12) &&
+ //(dateTimeProperty.getHours() == 0) &&
+ (dateTimeProperty.getMinutes() == 0) &&
+ (dateTimeProperty.getSeconds() == 1) &&
+ (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) &&
+ (dateTimeProperty2.getFullYear() == 2009) &&
+ (dateTimeProperty2.getMonth() == 5-1) &&
+ //(dateTimeProperty2.getDate() == 12) &&
+ //(dateTimeProperty2.getHours() == 23) &&
+ (dateTimeProperty2.getMinutes() == 59) &&
+ (dateTimeProperty2.getSeconds() == 59)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.qml
new file mode 100644
index 0000000000..14fe20787b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignDate.qml
@@ -0,0 +1,35 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ Component.onCompleted: {
+ var dateVar = new Date("2009-05-12")
+ var dateTimeVar = new Date("2009-05-12T00:00:01")
+ var dateTimeVar2 = new Date("2009-05-12T23:59:59")
+
+ dateProperty = dateVar
+ dateTimeProperty = dateTimeVar
+ dateTimeProperty2 = dateTimeVar2
+
+ // Commented properties do not currently test true:
+ boolProperty = //(dateProperty.getTime() == dateVar.getTime()) &&
+ (dateProperty.getFullYear() == 2009) &&
+ (dateProperty.getMonth() == 5-1) &&
+ //(dateProperty.getDate() == 12) &&
+ (dateProperty.getHours() == 0) &&
+ (dateTimeProperty.getTime() == dateTimeVar.getTime()) &&
+ (dateTimeProperty.getFullYear() == 2009) &&
+ (dateTimeProperty.getMonth() == 5-1) &&
+ //(dateTimeProperty.getDate() == 12) &&
+ //(dateTimeProperty.getHours() == 0) &&
+ (dateTimeProperty.getMinutes() == 0) &&
+ (dateTimeProperty.getSeconds() == 1) &&
+ (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) &&
+ (dateTimeProperty2.getFullYear() == 2009) &&
+ (dateTimeProperty2.getMonth() == 5-1) &&
+ //(dateTimeProperty2.getDate() == 12) &&
+ //(dateTimeProperty2.getHours() == 23) &&
+ (dateTimeProperty2.getMinutes() == 59) &&
+ (dateTimeProperty2.getSeconds() == 59)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.1.qml b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.1.qml
new file mode 100644
index 0000000000..be283fdda1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.1.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MySequenceConversionObject {
+ intListProperty: [1, 2]
+ qrealListProperty: [1.1, 2.2]
+ boolListProperty: [false, true]
+ urlListProperty: [ "http://www.example1.com", "http://www.example2.com" ]
+ stringListProperty: [ "one", "two" ]
+ qstringListProperty: [ "one", "two" ]
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.2.qml b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.2.qml
new file mode 100644
index 0000000000..c8fb28b04e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.2.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MySequenceConversionObject {
+ intListProperty: 1
+ qrealListProperty: 1.1
+ boolListProperty: false
+ urlListProperty: "http://www.example1.com"
+ stringListProperty: "one"
+ qstringListProperty: "two"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.3.qml b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.3.qml
new file mode 100644
index 0000000000..ad8a92e317
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.3.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MySequenceConversionObject {
+ intListProperty: 1
+ qrealListProperty: 1.1
+ boolListProperty: false
+ urlListProperty: Qt.resolvedUrl("example.html")
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.4.qml b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.4.qml
new file mode 100644
index 0000000000..a9f2e642d1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.4.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MySequenceConversionObject {
+ Component.onCompleted: {
+ intListProperty = [1, 2]
+ qrealListProperty = [1.1, 2.2]
+ boolListProperty = [false, true]
+ urlListProperty = [ "http://www.example1.com", "http://www.example2.com" ]
+ stringListProperty = [ "one", "two" ]
+ qstringListProperty = [ "one", "two" ]
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.5.qml b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.5.qml
new file mode 100644
index 0000000000..b8697e4290
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.5.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MySequenceConversionObject {
+ Component.onCompleted: {
+ intListProperty = 1;
+ qrealListProperty = 1.1;
+ boolListProperty = false;
+ urlListProperty = "http://www.example1.com";
+ stringListProperty = "one";
+ qstringListProperty = "two";
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.6.qml b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.6.qml
new file mode 100644
index 0000000000..7a794eb694
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.6.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MySequenceConversionObject {
+ Component.onCompleted: {
+ intListProperty = 1;
+ qrealListProperty = 1.1;
+ boolListProperty = false;
+ urlListProperty = Qt.resolvedUrl("example.html");
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.7.qml b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.7.qml
new file mode 100644
index 0000000000..96c0684939
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/assignSequenceTypes.7.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ // single url assignment to url list property
+ MySequenceConversionObject {
+ id: msco1
+ objectName: "msco1"
+ }
+
+ // single url binding to url list property
+ MySequenceConversionObject {
+ id: msco2
+ objectName: "msco2"
+ urlListProperty: "example.html"
+ }
+
+ // multiple url assignment to url list property
+ MySequenceConversionObject {
+ id: msco3
+ objectName: "msco3"
+ }
+
+ // multiple url binding to url list property
+ MySequenceConversionObject {
+ id: msco4
+ objectName: "msco4"
+ urlListProperty: [ "example.html", "example2.html" ]
+ }
+
+ // multiple url binding to url list property - already resolved
+ MySequenceConversionObject {
+ id: msco5
+ objectName: "msco5"
+ urlListProperty: [ Qt.resolvedUrl("example.html"), Qt.resolvedUrl("example2.html") ]
+ }
+
+ Component.onCompleted: {
+ msco1.urlListProperty = "example.html";
+ msco3.urlListProperty = [ "example.html", "example2.html" ];
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/attachedProperty.2.qml b/tests/auto/qml/qqmlecmascript/data/attachedProperty.2.qml
new file mode 100644
index 0000000000..a7184c9200
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/attachedProperty.2.qml
@@ -0,0 +1,22 @@
+import Qt.test 1.0
+import Qt.test 1.0 as Namespace
+
+MyQmlObject {
+ property alias a: me.a
+ property alias b: me.a
+ property alias c: me.a
+ property alias d: me.a
+
+ property MyQmlObject obj
+ obj: MyQmlObject {
+ MyQmlObject.value2: 13
+
+ id: me
+ property int a: MyQmlObject.value2 * 2
+ property int b: Namespace.MyQmlObject.value2 * 2
+ property int c: me.Namespace.MyQmlObject.value * 2
+ property int d: me.Namespace.MyQmlObject.value * 2
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlecmascript/data/attachedProperty.qml b/tests/auto/qml/qqmlecmascript/data/attachedProperty.qml
new file mode 100644
index 0000000000..061eda0e54
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/attachedProperty.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+import Qt.test 1.0 as Namespace
+
+MyQmlObject {
+ id: me
+ property int a: MyQmlObject.value
+ property int b: Namespace.MyQmlObject.value
+ property int c: me.Namespace.MyQmlObject.value
+ property int d: me.Namespace.MyQmlObject.value
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/attachedPropertyScope.qml b/tests/auto/qml/qqmlecmascript/data/attachedPropertyScope.qml
new file mode 100644
index 0000000000..11fb7ccad2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/attachedPropertyScope.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ property int value: 9
+ property int value2
+
+ MyQmlObject.onMySignal: value2 = value
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/automaticSemicolon.qml b/tests/auto/qml/qqmlecmascript/data/automaticSemicolon.qml
new file mode 100644
index 0000000000..6db68f2328
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/automaticSemicolon.qml
@@ -0,0 +1,11 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ if (1) {
+ var a;
+ function f1(){}a=1;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/bindingLoop.qml b/tests/auto/qml/qqmlecmascript/data/bindingLoop.qml
new file mode 100644
index 0000000000..80545cf72b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/bindingLoop.qml
@@ -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/qml/qqmlecmascript/data/bindingSuppression.qml b/tests/auto/qml/qqmlecmascript/data/bindingSuppression.qml
new file mode 100644
index 0000000000..2d3bfa1c54
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/bindingSuppression.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Component.onCompleted: {
+ var container = containerComponent.createObject(root)
+ contentComponent.createObject(container)
+ container.destroy();
+
+ pendingEvents.process()
+ }
+
+ property Component containerComponent: ContainerComponent {}
+ property Component contentComponent: ContentComponent {}
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/blank.js b/tests/auto/qml/qqmlecmascript/data/blank.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/blank.js
diff --git a/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml
new file mode 100644
index 0000000000..3147f63989
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ stringProperty: trueProperty?'pass':'fail'
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml
new file mode 100644
index 0000000000..c89bb49b45
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ stringProperty: falseProperty?'fail':'pass'
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/booleanConversion.qml b/tests/auto/qml/qqmlecmascript/data/booleanConversion.qml
new file mode 100644
index 0000000000..a363cf4dd1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/booleanConversion.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property bool test_true1: false
+ property bool test_true2: false
+ property bool test_true3: false
+ property bool test_true4: false
+ property bool test_true5: false
+
+ property bool test_false1: true
+ property bool test_false2: true
+ property bool test_false3: true
+
+
+ Component.onCompleted: {
+ test_true1 = 11
+ test_true2 = "Hello"
+ test_true3 = root
+ test_true4 = { a: 10, b: 11 }
+ test_true5 = true
+
+ test_false1 = 0
+ test_false2 = null
+ test_false3 = false
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/bug.1.qml b/tests/auto/qml/qqmlecmascript/data/bug.1.qml
new file mode 100644
index 0000000000..31f7c44fcc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/bug.1.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a: 10
+ property bool b: false
+
+ property int test
+
+ test: ((a == 10)?(a + 1):0) + ((b == true)?9:3)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.1.qml b/tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.1.qml
new file mode 100644
index 0000000000..3fd9131b2f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.1.qml
@@ -0,0 +1,9 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool runTest: false
+
+ property variant a: MyQmlObject {}
+
+ objectProperty: (runTest == false)?a:null
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.2.qml b/tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.2.qml
new file mode 100644
index 0000000000..3fbf931fca
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/canAssignNullToQObject.2.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ objectProperty: MyQmlObject {}
+
+ Component.onCompleted: {
+ objectProperty = null;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.1.qml b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.1.qml
new file mode 100644
index 0000000000..1e92aca825
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.1.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ property int changeCount: 0
+
+ property bool _nameWithUnderscore: false
+
+ // this should error, since the first alpha isn't capitalised.
+ on_nameWithUnderscoreChanged: {
+ changeCount = changeCount + 2;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.2.qml b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.2.qml
new file mode 100644
index 0000000000..3549d8c556
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.2.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ property int changeCount: 0
+
+ property bool ____nameWithUnderscores: false
+
+ // this should error, since the first alpha isn't capitalised
+ on____nameWithUnderscoresChanged: {
+ changeCount = changeCount + 3;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.3.qml b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.3.qml
new file mode 100644
index 0000000000..d611e0fe30
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.3.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ property int changeCount: 0
+
+ // invalid property name - we don't allow $
+ property bool $nameWithDollarsign: false
+
+ on$NameWithDollarsignChanged: {
+ changeCount = changeCount + 4;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.4.qml b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.4.qml
new file mode 100644
index 0000000000..a6862517c6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlotErrors.4.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ property int changeCount: 0
+
+ property bool _6nameWithUnderscoreNumber: false
+
+ // invalid property name - the first character after an underscore must be a letter
+ on_6NameWithUnderscoreNumberChanged: {
+ changeCount = changeCount + 3;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlots.qml b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlots.qml
new file mode 100644
index 0000000000..f91fb71f1f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/changeslots/propertyChangeSlots.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ property int changeCount: 0
+
+ property bool normalName: false
+ property bool _nameWithUnderscore: false
+ property bool ____nameWithUnderscores: false
+
+ onNormalNameChanged: {
+ changeCount = changeCount + 1;
+ }
+
+ on_NameWithUnderscoreChanged: {
+ changeCount = changeCount + 2;
+ }
+
+ on____NameWithUnderscoresChanged: {
+ changeCount = changeCount + 3;
+ }
+
+ Component.onCompleted: {
+ normalName = true;
+ _nameWithUnderscore = true;
+ ____nameWithUnderscores = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml b/tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml
new file mode 100644
index 0000000000..594a1b3605
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml
@@ -0,0 +1,13 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+
+ // Not correct according to ECMA 5.1, but JSC and V8 accept the following:
+ do {
+ ;
+ } while (false) true
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/compiled.qml b/tests/auto/qml/qqmlecmascript/data/compiled.qml
new file mode 100644
index 0000000000..7c46306772
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/compiled.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+QtObject {
+ //real
+ property real test1: a + b
+ property real test2: a - b
+ property bool test3: (a < b)
+ property bool test4: (a > b)
+ property bool test5: (a == b)
+ property bool test6: (a != b)
+
+ //int
+ property int test7: c + d
+ property int test8: d - c
+ property bool test9: (c < d)
+ property bool test10: (c > d)
+ property bool test11: (c == d)
+ property bool test12: (c != d)
+
+ //string
+ property string test13: e + f
+ property string test14: e + " " + f
+ property bool test15: (e == f)
+ property bool test16: (e != f)
+
+ //type conversion
+ property int test17: a
+ property real test18: d
+ property int test19: g
+ property real test20: g
+ property string test21: g
+ property string test22: h
+ property bool test23: i
+ property color test24: j
+ property color test25: k
+
+ property real a: 4.5
+ property real b: 11.2
+ property int c: 9
+ property int d: 176
+ property string e: "Hello"
+ property string f: "World"
+ property variant g: 6.7
+ property variant h: "!"
+ property variant i: true
+ property string j: "#112233"
+ property string k: "#aa112233"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/componentCreation.qml b/tests/auto/qml/qqmlecmascript/data/componentCreation.qml
new file mode 100644
index 0000000000..d21301ea13
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/componentCreation.qml
@@ -0,0 +1,52 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject{
+ id: obj
+ objectName: "obj"
+
+ function url()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml');
+ }
+
+ function urlMode()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous);
+ }
+
+ function urlParent()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', obj);
+ }
+
+ function urlNullParent()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', null);
+ }
+
+ function urlModeParent()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous, obj);
+ }
+
+ function urlModeNullParent()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous, null);
+ }
+
+ function invalidSecondArg()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', 'Bad argument');
+ }
+
+ function invalidThirdArg()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', Component.PreferSynchronous, 'Bad argument');
+ }
+
+ function invalidMode()
+ {
+ obj.componentProperty = Qt.createComponent('dynamicCreation.helper.qml', -666);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/compositePropertyType.qml b/tests/auto/qml/qqmlecmascript/data/compositePropertyType.qml
new file mode 100644
index 0000000000..e97b75c8d0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/compositePropertyType.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property CustomObject myObject
+ myObject: CustomObject { }
+
+ Component.onCompleted: console.log(myObject.greeting)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/concatenatedStringPropertyAccess.qml b/tests/auto/qml/qqmlecmascript/data/concatenatedStringPropertyAccess.qml
new file mode 100644
index 0000000000..573ad431e1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/concatenatedStringPropertyAccess.qml
@@ -0,0 +1,127 @@
+import QtQuick 2.0
+
+// this used to trigger crash: see QTBUG-23126
+Item {
+ id: root
+ property bool success: false
+
+ // each of these property names have partial strings
+ // which are prehashed by v8 (random, cos, sin, ...)
+ property int randomProperty: 4
+ property real cosProperty: 1
+ property real cossin: 1
+ property real propertycos: 1
+ property real cos: 1
+
+ // these property names are entirely "new".
+ property string kqwpald: "hello"
+ property bool poiuyt: false
+
+ Component.onCompleted: {
+ success = true;
+
+ // 1: ensure that we can access the properties by name
+
+ if (root["random" + "Property"] != 4) {
+ success = false;
+ return;
+ }
+
+ if (root["cos" + "Property"] != 1) {
+ success = false;
+ return;
+ }
+
+ if (root["cos" + "sin"] != 1) {
+ success = false;
+ return;
+ }
+
+ if (root["property" + "cos"] != 1) {
+ success = false;
+ return;
+ }
+
+ if (root["" + "cos"] != 1) {
+ success = false;
+ return;
+ }
+
+ if (root["cos" + ""] != 1) {
+ success = false;
+ return;
+ }
+
+ if (root["kq" + "wpald"] != "hello") {
+ success = false;
+ return;
+ }
+
+ if (root["poiu" + "yt"] != false) {
+ success = false;
+ return;
+ }
+
+ // 2: ensure that similarly named properties don't cause crash
+
+ if (root["random" + "property"] == 4) {
+ success = false;
+ return;
+ }
+
+ if (root["cos" + "property"] == 1) {
+ success = false;
+ return;
+ }
+
+ if (root["cos" + "Sin"] == 1) {
+ success = false;
+ return;
+ }
+
+ if (root["property" + "Cos"] == 1) {
+ success = false;
+ return;
+ }
+
+ if (root["" + "Cos"] == 1) {
+ success = false;
+ return;
+ }
+
+ if (root["Cos" + ""] == 1) {
+ success = false;
+ return;
+ }
+
+ if (root["kq" + "Wpald"] == "hello") {
+ success = false;
+ return;
+ }
+
+ if (root["poiu" + "Yt"] == false) {
+ success = false;
+ return;
+ }
+
+ // 3: ensure that toString doesn't crash
+
+ root["random" + "Property"].toString();
+ root["cos" + "Property"].toString();
+ root["cos" + "Sin"] ? root["cos" + "Sin"].toString() : "";
+ root["property" + "Cos"] ? root["property" + "Cos"].toString() : "";
+ root["Cos" + ""] ? root["Cos" + ""].toString() : "";
+ root["" + "Cos"] ? root["" + "Cos"].toString() : "";
+ root["kq" + "Wpald"] ? root["kq" + "Wpald"].toString() : "";
+ root["poiu" + "Yt"] ? root["poiu" + "Yt"].toString() : "";
+
+ root["random" + "property"] ? root["random" + "property"].toString() : "";
+ root["cos" + "property"] ? root["cos" + "property"].toString() : "";
+ root["cos" + "sin"] ? root["cos" + "sin"].toString() : "";
+ root["property" + "cos"] ? root["property" + "cos"].toString() : "";
+ root["cos" + ""] ? root["cos" + ""].toString() : "";
+ root["" + "cos"] ? root["" + "cos"].toString() : "";
+ root["kq" + "wpald"] ? root["kq" + "wpald"].toString() : "";
+ root["poiu" + "yt"] ? root["poiu" + "yt"].toString() : "";
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.1.qml b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.1.qml
new file mode 100644
index 0000000000..13c5ae5fff
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.1.qml
@@ -0,0 +1,8 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int c1: 0
+ property int c2: c1
+
+ onBasicSignal: c2 = 13
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml
new file mode 100644
index 0000000000..207a06b700
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.2.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property alias c1: myConstants.c1
+ property alias c2: myConstants.c2
+
+ objectProperty: ConstantsOverrideBindings {
+ id: myConstants
+ c2: 10
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.3.qml b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.3.qml
new file mode 100644
index 0000000000..ca9d1d8ab9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.3.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int c1: 0
+ property int c2: c1
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml
new file mode 100644
index 0000000000..5a2091f71c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/constantsOverrideBindings.4.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property alias c1: myConstants.c1
+ property alias c3: myConstants.c3
+
+ objectProperty: ConstantsOverrideBindings {
+ id: myConstants
+ c3: 10
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/deferredProperties.qml b/tests/auto/qml/qqmlecmascript/data/deferredProperties.qml
new file mode 100644
index 0000000000..e01f708a07
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deferredProperties.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+
+MyDeferredObject {
+ id: root
+ value: 10
+ objectProperty: MyQmlObject {
+ value: root.value
+ }
+ objectProperty2: MyQmlObject { id: blah }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/deferredPropertiesErrors.qml b/tests/auto/qml/qqmlecmascript/data/deferredPropertiesErrors.qml
new file mode 100644
index 0000000000..308a01ce6f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deferredPropertiesErrors.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyDeferredObject {
+ value: undefined // error is resolved before complete
+ objectProperty: undefined // immediate error
+ objectProperty2: QtObject {
+ Component.onCompleted: value = 10
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/deleteLater.qml b/tests/auto/qml/qqmlecmascript/data/deleteLater.qml
new file mode 100644
index 0000000000..2a9ce44b20
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deleteLater.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ property bool test: false
+
+ Component.onCompleted: {
+ try {
+ root.deleteLater()
+ } catch(e) {
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/deleteLaterObjectMethodCall.qml b/tests/auto/qml/qqmlecmascript/data/deleteLaterObjectMethodCall.qml
new file mode 100644
index 0000000000..d1418e57a1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deleteLaterObjectMethodCall.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ property var fn
+
+ property var c: Component {
+ MyQmlObject {
+ function go() {
+ try { methodNoArgs(); } catch(e) { }
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ var f = c.createObject().go;
+
+ gc();
+
+ f();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.2.qml b/tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.2.qml
new file mode 100644
index 0000000000..b67e8bb7d8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ id: test
+ property bool testConditionsMet: false
+ Component.onCompleted: {
+ var c = Qt.createComponent("DeleteRootObjectInCreationComponentDerived.qml")
+ c.createObject(null).setTestConditionsMet(test); // JS ownership, but it will be a RootObjectInCreation until finished beginCreate.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.qml b/tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.qml
new file mode 100644
index 0000000000..fbb7d24471
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deleteRootObjectInCreation.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+RootObject {
+ color:"black"
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/deleteWhileBindingRunning.qml b/tests/auto/qml/qqmlecmascript/data/deleteWhileBindingRunning.qml
new file mode 100644
index 0000000000..b5cc59e2c0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deleteWhileBindingRunning.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyDeleteObject {
+ property int result: nestedObject.intProperty + deleteNestedObject
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/deletedEngine.qml b/tests/auto/qml/qqmlecmascript/data/deletedEngine.qml
new file mode 100644
index 0000000000..97acddf5fc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deletedEngine.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+QtObject {
+ function calculate() {
+ return b * 13;
+ }
+
+ property int a: calculate()
+ property int b: 3
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/deletedObject.qml b/tests/auto/qml/qqmlecmascript/data/deletedObject.qml
new file mode 100644
index 0000000000..24c12bf694
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/deletedObject.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ property variant obj
+ obj: MyQmlObject {
+ id: myObject
+ value: 92
+ }
+
+ property bool test1: false
+ property bool test2: false
+ property bool test3: false
+ property bool test4: false
+
+ Component.onCompleted: {
+ test1 = myObject.value == 92;
+ test2 = obj.value == 92;
+
+ myObject.deleteOnSet = 1;
+
+ test3 = myObject == null
+ test4 = obj == null
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/destroyedSignal.qml b/tests/auto/qml/qqmlecmascript/data/destroyedSignal.qml
new file mode 100644
index 0000000000..ac2df17ae8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/destroyedSignal.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ onDestroyed: {} //this should cause an error (destroyed should be hidden)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/doubleEvaluate.qml b/tests/auto/qml/qqmlecmascript/data/doubleEvaluate.qml
new file mode 100644
index 0000000000..0532715432
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/doubleEvaluate.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+WriteCounter {
+ property int x: 0
+ value: if (1) x + x
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicCreation.helper.qml b/tests/auto/qml/qqmlecmascript/data/dynamicCreation.helper.qml
new file mode 100644
index 0000000000..d790d634e9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicCreation.helper.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject{
+ objectName: "objectTwo"
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicCreation.qml b/tests/auto/qml/qqmlecmascript/data/dynamicCreation.qml
new file mode 100644
index 0000000000..7b132e1edf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicCreation.qml
@@ -0,0 +1,27 @@
+import Qt.test 1.0
+
+MyQmlObject{
+ id: obj
+ objectName: "obj"
+ function createOne()
+ {
+ obj.objectProperty = Qt.createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"objectOne"}', obj);
+ }
+
+ function createTwo()
+ {
+ var component = Qt.createComponent('dynamicCreation.helper.qml');
+ obj.objectProperty = component.createObject(obj);
+ }
+
+ function createThree()
+ {
+ obj.objectProperty = Qt.createQmlObject('TypeForDynamicCreation{}', obj);
+ }
+
+ function dontCrash()
+ {
+ var component = Qt.createComponent('file-doesnt-exist.qml');
+ obj.objectProperty = component.createObject(obj);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicCreationOwnership.qml b/tests/auto/qml/qqmlecmascript/data/dynamicCreationOwnership.qml
new file mode 100644
index 0000000000..ed396d49b0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicCreationOwnership.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: obj
+ objectName: "obj"
+
+ MyDynamicCreationDestructionObject {
+ id: mdcdo
+ objectName: "mdcdo"
+ }
+
+ function dynamicallyCreateJsOwnedObject() {
+ mdcdo.createNew();
+ }
+
+ function performGc() {
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml
new file mode 100644
index 0000000000..9a5732c194
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.2.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property QtObject objectProperty
+
+ property Component c: Component {
+ id: componentObject
+ QtObject {
+ }
+ }
+
+ function create() {
+ objectProperty = c.createObject(root);
+ }
+
+ function destroy() {
+ objectProperty.destroy();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml
new file mode 100644
index 0000000000..3739150bc4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.3.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ property bool test: false
+ property QtObject objectProperty
+
+ onObjectPropertyChanged: {
+ root.test = true;
+ }
+
+ property Component c: Component {
+ id: dynamicComponent
+ QtObject {
+ id: dynamicObject
+ }
+ }
+
+ function create() {
+ root.objectProperty = root.c.createObject(root);
+ }
+
+ function destroy() {
+ root.test = false; // reset test
+ root.objectProperty.destroy(100);
+ // in cpp, wait objectProperty deletion, inspect "test" and "objectProperty"
+ // test should be true and value of objectProperty should be zero.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.qml b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.qml
new file mode 100644
index 0000000000..f41e5262fd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicDeletion.qml
@@ -0,0 +1,20 @@
+import Qt.test 1.0
+
+MyQmlObject{
+ id: obj
+ objectName: "obj"
+ function create()
+ {
+ obj.objectProperty = Qt.createQmlObject('import Qt.test 1.0; MyQmlObject{objectName:"emptyObject"}', obj);
+ }
+
+ function killOther()
+ {
+ obj.objectProperty.destroy(500);
+ }
+
+ function killMe()
+ {
+ obj.destroy();//Must not segfault
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/dynamicString.qml b/tests/auto/qml/qqmlecmascript/data/dynamicString.qml
new file mode 100644
index 0000000000..5693794c71
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/dynamicString.qml
@@ -0,0 +1,16 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ stringProperty:"string:%0 false:%1 true:%2 uint32:%3 int32:%4 double:%5 date:%6!"
+ Component.onCompleted: {
+ var date = new Date();
+ date.setDate(11);
+ date.setMonth(1);
+ date.setFullYear(2011);
+ date.setHours(5);
+ date.setMinutes(30);
+ date.setSeconds(50);
+ stringProperty = stringProperty.arg("Hello World").arg(false).arg(true).arg(100).arg(-100).arg(3.1415926).arg(Qt.formatDateTime(date, "yyyy-MM-dd hh::mm:ss"));
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/elementAssign.qml b/tests/auto/qml/qqmlecmascript/data/elementAssign.qml
new file mode 100644
index 0000000000..0d75cbf6fc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/elementAssign.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property bool test: bound.value == 1923
+
+ property ElementAssignType element: ElementAssignType { value: 1923 }
+ property ElementAssignType bound: root.element
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/enums.1.qml b/tests/auto/qml/qqmlecmascript/data/enums.1.qml
new file mode 100644
index 0000000000..b9295c5c89
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/enums.1.qml
@@ -0,0 +1,38 @@
+import Qt.test 1.0
+import Qt.test 1.0 as Namespace
+
+MyQmlObject {
+ // Enum property type
+ enumProperty: MyQmlObject.EnumValue2
+
+ // Enum property whose value is from a related type
+ relatedEnumProperty: MyQmlObject.RelatedValue
+
+ // Enum property whose value is defined in an unrelated type
+ unrelatedEnumProperty: MyTypeObject.RelatedValue
+
+ // Enum property whose value is defined in the Qt namespace
+ qtEnumProperty: Qt.CaseInsensitive
+
+ // 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
+
+ // Enums from a related type
+ property int k: MyQmlObject.RelatedValue
+
+ // Enum values defined both in a type and a related type
+ property int l: MyQmlObject.MultiplyDefined
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/enums.2.qml b/tests/auto/qml/qqmlecmascript/data/enums.2.qml
new file mode 100644
index 0000000000..ffb9fa668f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/enums.2.qml
@@ -0,0 +1,37 @@
+import Qt.test 1.0
+import Qt.test 1.0 as Namespace
+
+MyQmlObject {
+ id: root
+
+ property int a: MyQmlObject.EnumValue10
+ property int b: Namespace.MyQmlObject.EnumValue10
+ property int c: child.enumProperty
+
+ // test binding codepath
+ property MyUnregisteredEnumTypeObject child: MyUnregisteredEnumTypeObject {
+ enumProperty: undefined
+ }
+
+ // test assignment codepaths
+ function testAssignmentOne() {
+ child.enumProperty = function() { return "Hello, world!" }; // cannot assign function to non-var prop.
+ }
+ function testAssignmentTwo() {
+ child.enumProperty = MyUnregisteredEnumTypeObject.Firstvalue; // note: incorrect capitalisation
+ }
+ function testAssignmentThree() {
+ child.enumProperty = undefined; // directly set undefined value
+ }
+
+
+
+ property int d: 5
+ property MyUnregisteredEnumTypeObject child2: MyUnregisteredEnumTypeObject {
+ enumProperty: root.d
+ }
+ function testAssignmentFour() {
+ child2.enumProperty = root.d;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/enums.3.qml b/tests/auto/qml/qqmlecmascript/data/enums.3.qml
new file mode 100644
index 0000000000..aaa6a333b7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/enums.3.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import Qt.test 1.0 as Namespace
+
+Item {
+ // Enums from type
+ property int a: Item.Center
+ property int b: Item.Right
+
+ // Enums from Qt
+ property int c: Qt.blue
+ property int d: Qt.darkRed
+
+ // Enums from other type
+ property int e: MyQmlObject.EnumValue3
+ property int f: MyQmlObject.EnumValue4
+
+ // Enums from namespaced other type
+ property int h: Namespace.MyQmlObject.EnumValue3
+ property int i: Namespace.MyQmlObject.EnumValue4
+
+ // -1 enum
+ property int j: MyQmlObject.EnumValue5
+
+ // Enums from a related type
+ property int k: MyQmlObject.RelatedValue
+
+ // Count the onChanged signals to see whether
+ // they're assigned as literals or via bindings
+ property int ac: 0
+ property int bc: 0
+ property int cc: 0
+ property int dc: 0
+ property int ec: 0
+ property int fc: 0
+ property int hc: 0
+ property int ic: 0
+ property int jc: 0
+ property int kc: 0
+
+ onAChanged: ac++
+ onBChanged: bc++
+ onCChanged: cc++
+ onDChanged: dc++
+ onEChanged: ec++
+ onFChanged: fc++
+ onHChanged: hc++
+ onIChanged: ic++
+ onJChanged: jc++
+ onKChanged: kc++
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/eval.qml b/tests/auto/qml/qqmlecmascript/data/eval.qml
new file mode 100644
index 0000000000..a752b8c0d3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/eval.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test1: false;
+ property bool test2: false;
+ property bool test3: false;
+ property bool test4: false;
+ property bool test5: false;
+
+
+ property int a: 7
+ property int b: 8
+
+ Component.onCompleted: {
+ var b = 9;
+
+ test1 = (eval("a") == 7);
+ test2 = (eval("b") == 9);
+ try {
+ eval("c");
+ } catch(e) {
+ test3 = true;
+ }
+ test4 = (eval("console") == console);
+ test5 = (eval("Qt") == Qt);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exception.js b/tests/auto/qml/qqmlecmascript/data/exception.js
new file mode 100644
index 0000000000..160bbfa5b6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exception.js
@@ -0,0 +1 @@
+throw("Whoops!");
diff --git a/tests/auto/qml/qqmlecmascript/data/exceptionClearsOnReeval.qml b/tests/auto/qml/qqmlecmascript/data/exceptionClearsOnReeval.qml
new file mode 100644
index 0000000000..a2f0d1a8b7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exceptionClearsOnReeval.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: objectProperty.objectProperty.trueProperty
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning.qml b/tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning.qml
new file mode 100644
index 0000000000..b8d5e5e60f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ Component.onCompleted:
+ { throw(new Error("JS exception")) }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning2.qml b/tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning2.qml
new file mode 100644
index 0000000000..a4ce55e245
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exceptionProducesWarning2.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ value: { throw(new Error("JS exception")) }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.2.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.2.qml
new file mode 100644
index 0000000000..4420cf846c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.2.qml
@@ -0,0 +1,33 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 23:59:59 (local time)
+ var compare = new Date(2009, 5-1, 12, 23, 59, 59)
+ var compareOffset = compare.getTimezoneOffset()
+
+ // The date is already in local time, so we can use the partial values directly
+ var dtAdjusted = dt
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == compareOffset) &&
+ (timespec == 'LocalTime') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 23) &&
+ (dtAdjusted.getMinutes() == 59) &&
+ (dtAdjusted.getSeconds() == 59) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.3.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.3.qml
new file mode 100644
index 0000000000..2ba1cc6607
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.3.qml
@@ -0,0 +1,39 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 00:00:01 (UTC)
+ var compare = new Date(Date.UTC(2009, 5-1, 12, 0, 0, 1))
+ var compareOffset = 0
+
+ // Adjust for timezone to extract correct partial values
+ var dtAdjusted = new Date(dt.getUTCFullYear(),
+ dt.getUTCMonth(),
+ dt.getUTCDate(),
+ dt.getUTCHours(),
+ dt.getUTCMinutes(),
+ dt.getUTCSeconds(),
+ dt.getUTCMilliseconds())
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == compareOffset) &&
+ (timespec == 'UTC') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 0) &&
+ (dtAdjusted.getMinutes() == 0) &&
+ (dtAdjusted.getSeconds() == 1) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.4.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.4.qml
new file mode 100644
index 0000000000..c5b2388df2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.4.qml
@@ -0,0 +1,39 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 23:59:59 (UTC)
+ var compare = new Date(Date.UTC(2009, 5-1, 12, 23, 59, 59))
+ var compareOffset = 0
+
+ // Adjust for timezone to extract correct partial values
+ var dtAdjusted = new Date(dt.getUTCFullYear(),
+ dt.getUTCMonth(),
+ dt.getUTCDate(),
+ dt.getUTCHours(),
+ dt.getUTCMinutes(),
+ dt.getUTCSeconds(),
+ dt.getUTCMilliseconds())
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == compareOffset) &&
+ (timespec == 'UTC') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 23) &&
+ (dtAdjusted.getMinutes() == 59) &&
+ (dtAdjusted.getSeconds() == 59) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.5.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.5.qml
new file mode 100644
index 0000000000..6da3a4a8e0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.5.qml
@@ -0,0 +1,39 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 00:00:01 (UTC+11:30)
+ var compare = new Date('2009-05-12T00:00:01+11:30')
+
+ // Adjust for timezone to extract correct partial values
+ var dtUtc = new Date(dt.getTime() + (offset * 60000))
+ var dtAdjusted = new Date(dtUtc.getUTCFullYear(),
+ dtUtc.getUTCMonth(),
+ dtUtc.getUTCDate(),
+ dtUtc.getUTCHours(),
+ dtUtc.getUTCMinutes(),
+ dtUtc.getUTCSeconds(),
+ dtUtc.getUTCMilliseconds())
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == ((11 * 60) + 30)) &&
+ (timespec == '+11:30') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 0) &&
+ (dtAdjusted.getMinutes() == 0) &&
+ (dtAdjusted.getSeconds() == 1) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.6.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.6.qml
new file mode 100644
index 0000000000..9980af4afe
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.6.qml
@@ -0,0 +1,39 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 23:59:59 (UTC+11:30)
+ var compare = new Date('2009-05-12T23:59:59+11:30')
+
+ // Adjust for timezone to extract correct partial values
+ var dtUtc = new Date(dt.getTime() + (offset * 60000))
+ var dtAdjusted = new Date(dtUtc.getUTCFullYear(),
+ dtUtc.getUTCMonth(),
+ dtUtc.getUTCDate(),
+ dtUtc.getUTCHours(),
+ dtUtc.getUTCMinutes(),
+ dtUtc.getUTCSeconds(),
+ dtUtc.getUTCMilliseconds())
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == ((11 * 60) + 30)) &&
+ (timespec == '+11:30') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 23) &&
+ (dtAdjusted.getMinutes() == 59) &&
+ (dtAdjusted.getSeconds() == 59) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.7.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.7.qml
new file mode 100644
index 0000000000..d1de970cc5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.7.qml
@@ -0,0 +1,39 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 00:00:01 (UTC-11:30)
+ var compare = new Date('2009-05-12T00:00:01-11:30')
+
+ // Adjust for timezone to extract correct partial values
+ var dtUtc = new Date(dt.getTime() + (offset * 60000))
+ var dtAdjusted = new Date(dtUtc.getUTCFullYear(),
+ dtUtc.getUTCMonth(),
+ dtUtc.getUTCDate(),
+ dtUtc.getUTCHours(),
+ dtUtc.getUTCMinutes(),
+ dtUtc.getUTCSeconds(),
+ dtUtc.getUTCMilliseconds())
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == -((11 * 60) + 30)) &&
+ (timespec == '-11:30') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 0) &&
+ (dtAdjusted.getMinutes() == 0) &&
+ (dtAdjusted.getSeconds() == 1) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.8.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.8.qml
new file mode 100644
index 0000000000..6459ca8bcd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.8.qml
@@ -0,0 +1,39 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 23:59:59 (UTC-11:30)
+ var compare = new Date('2009-05-12T23:59:59-11:30')
+
+ // Adjust for timezone to extract correct partial values
+ var dtUtc = new Date(dt.getTime() + (offset * 60000))
+ var dtAdjusted = new Date(dtUtc.getUTCFullYear(),
+ dtUtc.getUTCMonth(),
+ dtUtc.getUTCDate(),
+ dtUtc.getUTCHours(),
+ dtUtc.getUTCMinutes(),
+ dtUtc.getUTCSeconds(),
+ dtUtc.getUTCMilliseconds())
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == -((11 * 60) + 30)) &&
+ (timespec == '-11:30') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 23) &&
+ (dtAdjusted.getMinutes() == 59) &&
+ (dtAdjusted.getSeconds() == 59) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/exportDate.qml b/tests/auto/qml/qqmlecmascript/data/exportDate.qml
new file mode 100644
index 0000000000..c42b092fc7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/exportDate.qml
@@ -0,0 +1,33 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ boolProperty: false
+
+ Component.onCompleted: {
+ var dt = datetimeExporter.getDateTime()
+ var offset = datetimeExporter.getDateTimeOffset()
+ var date = datetimeExporter.getDate()
+ var timespec = datetimeExporter.getTimeSpec()
+
+ // The test date is 2009-5-12 00:00:01 (local time)
+ var compare = new Date(2009, 5-1, 12, 0, 0, 1)
+ var compareOffset = compare.getTimezoneOffset()
+
+ // The date is already in local time, so we can use the partial values directly
+ var dtAdjusted = dt
+
+ boolProperty = (dt.getTime() == compare.getTime()) &&
+ (offset == compareOffset) &&
+ (timespec == 'LocalTime') &&
+ (dtAdjusted.getFullYear() == 2009) &&
+ (dtAdjusted.getMonth() == 5-1) &&
+ (dtAdjusted.getDate() == 12) &&
+ (dtAdjusted.getHours() == 0) &&
+ (dtAdjusted.getMinutes() == 0) &&
+ (dtAdjusted.getSeconds() == 1) &&
+ (date.getFullYear() == 2009) &&
+ (date.getMonth() == 5-1) &&
+ (date.getDate() == 12)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup.qml b/tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup.qml
new file mode 100644
index 0000000000..2c382e871a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup.qml
@@ -0,0 +1,8 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property MyExtendedObject a;
+ a: MyExtendedObject { id: root }
+ property int b: Math.max(root.extendedProperty, 0)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup2.qml b/tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup2.qml
new file mode 100644
index 0000000000..e4af3359d0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/extendedObjectPropertyLookup2.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ property MyExtendedObject a;
+ a: MyExtendedObject {
+ id: obj
+ extendedProperty: 42;
+ }
+ function getValue() {
+ return obj.extendedProperty;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/extensionObjects.qml b/tests/auto/qml/qqmlecmascript/data/extensionObjects.qml
new file mode 100644
index 0000000000..7734a11dd8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/extensionObjects.qml
@@ -0,0 +1,19 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyExtendedObject
+{
+ baseProperty: baseExtendedProperty
+ baseExtendedProperty: 13
+
+ coreProperty: extendedProperty
+ extendedProperty: 9
+
+ property QtObject nested: MyExtendedObject {
+ baseProperty: baseExtendedProperty
+ baseExtendedProperty: 13
+
+ coreProperty: extendedProperty
+ extendedProperty: 9
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/extensionObjectsPropertyOverride.qml b/tests/auto/qml/qqmlecmascript/data/extensionObjectsPropertyOverride.qml
new file mode 100644
index 0000000000..3c443cb975
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/extensionObjectsPropertyOverride.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+OverrideDefaultPropertyObject
+{
+ MyBaseExtendedObject {
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.1.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.1.qml
new file mode 100644
index 0000000000..8de6607999
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.1.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ BaseComponent {
+ id: foo
+ }
+
+ Component.onCompleted: success = (foo.bar == '100')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml
new file mode 100644
index 0000000000..7cfc9a39e0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.2.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ BaseComponent {
+ id: foo
+ property Text baz: Text { width: 200 }
+ }
+
+ // With contextual lookup, 'bar' is resolved in the BaseComponent context,
+ // and refers to the 'baz' defined there; in this context, however, 'baz'
+ // resolves to the override defined in 'foo'
+ Component.onCompleted: success = (foo.bar == 100) && (foo.baz.width == 200)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.3.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.3.qml
new file mode 100644
index 0000000000..ee7a7e8448
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.3.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsObject 1.0 as SingletonType
+
+Item {
+ property bool success: false
+ property string foo: SingletonType.Fallback.test
+
+ Component.onCompleted: success = (foo == '100')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.4.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.4.qml
new file mode 100644
index 0000000000..1a6c694bf7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.4.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsDerived 1.0 as SingletonType
+
+Item {
+ property bool success: false
+ property string foo: SingletonType.Fallback.test
+
+ Component.onCompleted: success = (foo == 'hello')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.5.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.5.qml
new file mode 100644
index 0000000000..3e869c17d9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.5.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsObject 1.0
+
+Item {
+ property bool success: false
+ property string foo: FallbackBindingsType.test
+
+ Component.onCompleted: success = (foo == '100')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.6.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.6.qml
new file mode 100644
index 0000000000..138216127b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.6.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsDerived 1.0
+
+Item {
+ property bool success: false
+ property string foo: FallbackBindingsType.test
+
+ Component.onCompleted: success = (foo == 'hello')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml
new file mode 100644
index 0000000000..2fc272decd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.7.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsItem 1.0
+
+Item {
+ property bool success: false
+
+ property FallbackBindingsType foo: FallbackBindingsType {}
+ property var test: foo.test
+
+ Component.onCompleted: success = (test == 100)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml
new file mode 100644
index 0000000000..14aeed9e60
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/fallbackBindings.8.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test.fallbackBindingsItem 1.0
+
+Item {
+ property bool success: false
+
+ property FallbackBindingsType foo: FallbackBindingsDerivedType {}
+ property var test: foo.test
+
+ Component.onCompleted: success = (test == 'hello')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/forInLoop.qml b/tests/auto/qml/qqmlecmascript/data/forInLoop.qml
new file mode 100644
index 0000000000..f14367f177
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/forInLoop.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+QtObject {
+ property list<QtObject> objects
+ objects: [QtObject { objectName: "obj1" }, QtObject { objectName: "obj2" }, QtObject { objectName: "obj3" }]
+ property string listResult
+
+ function listProperty() {
+ for (var i in objects)
+ listResult += i + "=" + objects[i].objectName + "|"
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/function.qml b/tests/auto/qml/qqmlecmascript/data/function.qml
new file mode 100644
index 0000000000..af2da7023c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/function.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test1: false;
+ property bool test2: false;
+ property bool test3: false;
+
+ Component.onCompleted: {
+ var a = 10;
+
+ var func1 = new Function("a", "return a + 7");
+ var func2 = new Function("a", "return Qt.atob(a)");
+ var func3 = new Function("return a");
+
+ test1 = (func1(4) == 11);
+ test2 = (func2("Hello World!") == Qt.atob("Hello World!"));
+ try {
+ func3();
+ } catch(e) {
+ test3 = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/functionAssignment.1.qml b/tests/auto/qml/qqmlecmascript/data/functionAssignment.1.qml
new file mode 100644
index 0000000000..d97613a875
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/functionAssignment.1.qml
@@ -0,0 +1,8 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property variant a: function myFunction() { return 2; }
+ property variant b: Qt.binding(function() { return 2; })
+ property var c: Qt.binding(function() { return 2; })
+ qjsvalue: Qt.binding(function() { return 2; })
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/functionAssignment.2.qml b/tests/auto/qml/qqmlecmascript/data/functionAssignment.2.qml
new file mode 100644
index 0000000000..3d8fd85a88
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/functionAssignment.2.qml
@@ -0,0 +1,73 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+import "functionAssignment.js" as Script
+
+MyQmlObject {
+ property variant a
+ property int aNumber: 10
+
+ property bool assignToProperty: false
+ property bool assignToPropertyFromJsFile: false
+
+ property bool assignWithThis: false
+ property bool assignWithThisFromJsFile: false
+
+ property bool assignToValueType: false
+
+ property bool assignFuncWithoutReturn: false
+ property bool assignWrongType: false
+ property bool assignWrongTypeToValueType: false
+
+
+ onAssignToPropertyChanged: {
+ function myFunction() {
+ return aNumber * 10;
+ }
+ a = Qt.binding(myFunction);
+ }
+
+ property QtObject obj: QtObject {
+ property int aNumber: 4212
+ function myFunction() {
+ return this.aNumber * 10; // should use the aNumber from root, not this object
+ }
+ }
+ onAssignWithThisChanged: {
+ a = Qt.binding(obj.myFunction);
+ }
+
+ onAssignToPropertyFromJsFileChanged: {
+ Script.bindPropertyWithThis()
+ }
+
+ onAssignWithThisFromJsFileChanged: {
+ Script.bindProperty()
+ }
+
+ property Text text: Text { }
+ onAssignToValueTypeChanged: {
+ text.font.pixelSize = Qt.binding(function() { return aNumber * 10; })
+ a = Qt.binding(function() { return text.font.pixelSize; })
+ }
+
+
+ // detecting errors:
+
+ onAssignFuncWithoutReturnChanged: {
+ function myFunction() {
+ }
+ a = Qt.binding(myFunction);
+ }
+
+ onAssignWrongTypeChanged: {
+ function myFunction() {
+ return 'a string';
+ }
+ aNumber = Qt.binding(myFunction);
+ }
+
+ onAssignWrongTypeToValueTypeChanged: {
+ text.font.pixelSize = Qt.binding(function() { return 'a string'; })
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/functionAssignment.3.qml b/tests/auto/qml/qqmlecmascript/data/functionAssignment.3.qml
new file mode 100644
index 0000000000..c34a868949
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/functionAssignment.3.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ property int t1: 1
+ property int t2: 2
+
+ function randomNumber() {
+ return 4;
+ }
+
+ Component.onCompleted: {
+ // shouldn't "convert" the randomNumber function into a binding permanently
+ t1 = Qt.binding(randomNumber)
+
+ // therefore, the following assignment should fail.
+ t2 = randomNumber
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/functionAssignment.js b/tests/auto/qml/qqmlecmascript/data/functionAssignment.js
new file mode 100644
index 0000000000..3ba4e193e6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/functionAssignment.js
@@ -0,0 +1,17 @@
+function bindProperty()
+{
+ a = Qt.binding(function(){ return aNumber * 10 })
+}
+
+
+function TestObject() { }
+TestObject.prototype.aNumber = 928349
+TestObject.prototype.bindFunction = function() {
+ return this.aNumber * 10 // this should not use the TestObject's aNumber
+}
+var testObj = new TestObject()
+
+function bindPropertyWithThis()
+{
+ a = Qt.binding(testObj.bindFunction)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/functionErrors.qml b/tests/auto/qml/qqmlecmascript/data/functionErrors.qml
new file mode 100644
index 0000000000..230a626600
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/functionErrors.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ function myFunction() {
+ a = 10;
+ }
+
+ Component.onCompleted: myFunction();
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/getSet.qml b/tests/auto/qml/qqmlecmascript/data/getSet.qml
new file mode 100644
index 0000000000..2987986b38
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/getSet.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ function get(x) { return 1; }
+ function set(x) { return 1; }
+ function code() {
+ var get = 0;
+ var set = 1;
+ var o = {
+ get foo() { return 2; },
+ set foo(x) { 1; }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.2.qml b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.2.qml
new file mode 100644
index 0000000000..83eecf1703
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.2.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as QObjectApi
+
+Item {
+ property bool success: true
+ property Item testProp: null
+
+ // first we create an object and reference it via a dynamic variant property
+ function createReference() {
+ var c = Qt.createComponent("HRMDPComponent.qml");
+ testProp = c.createObject(null); // QML ownership.
+ }
+
+ // after a gc, it should not have been collected.
+ function ensureReference() {
+ if (testProp == null) success = false; // should not have triggered delete notify / zeroed testProp value
+ if (testProp.variantCanary != 5) success = false; // should not have deleted vmemo of object referenced by testProp
+ if (testProp.varCanary != 12) success = false; // should not have collected vmemo vmeProperties
+ if (QObjectApi.QObject.qobjectTestWritableProperty != 42) success = false; // should not have been set to 43.
+ }
+
+ // then we remove the reference.
+ function removeReference() {
+ testProp = null; // allow original object to be released.
+ }
+
+ // after a gc (and deferred deletion process) the object should be gone
+ function ensureDeletion() {
+ if (QObjectApi.QObject.qobjectTestWritableProperty != 43) success = false; // should have been set to 43.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.3.qml b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.3.qml
new file mode 100644
index 0000000000..6eaa54a8dc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.3.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as QObjectApi
+
+Item {
+ property bool success: true
+ property Item testProp: null
+
+ // first we create an object and reference it via a dynamic variant property
+ function createReference() {
+ var c = Qt.createComponent("HRMDPComponent.qml");
+ testProp = c.createObject(null); // QML ownership.
+ }
+
+ // after a gc, it should not have been collected.
+ function ensureReference() {
+ if (testProp == null) success = false; // should not have triggered delete notify / zeroed testProp value
+ if (testProp.variantCanary != 5) success = false; // should not have deleted vmemo of object referenced by testProp
+ if (testProp.varCanary != 12) success = false; // should not have collected vmemo vmeProperties
+ if (QObjectApi.QObject.qobjectTestWritableProperty != 42) success = false; // should not have been set to 43.
+ }
+
+ // then we manually delete the item being referenced
+ function manuallyDelete() {
+ QObjectApi.QObject.deleteQObject(testProp);
+ if (QObjectApi.QObject.qobjectTestWritableProperty != 43) success = false; // should have been set to 43.
+ }
+
+ // after a gc (and deferred deletion process) the object should be gone
+ function ensureDeleted() {
+ // a crash should not have occurred during the previous gc due to the
+ // VMEMO attempting to keep a previously deleted QObject alive.
+ if (testProp != null) success = false; // delete notify should have zeroed testProp value.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.qml b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.qml
new file mode 100644
index 0000000000..be914fa676
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.dynprop.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as QObjectApi
+
+Item {
+ property bool success: true
+ property variant testProp: null
+
+ // first we create an object and reference it via a dynamic variant property
+ function createReference() {
+ var c = Qt.createComponent("HRMDPComponent.qml");
+ testProp = c.createObject(null); // QML ownership.
+ }
+
+ // after a gc, it should not have been collected.
+ function ensureReference() {
+ if (testProp == null) success = false; // should not have triggered delete notify / zeroed testProp value
+ if (testProp.variantCanary != 5) success = false; // should not have deleted vmemo of object referenced by testProp
+ if (testProp.varCanary != 12) success = false; // should not have collected vmemo vmeProperties
+ if (QObjectApi.QObject.qobjectTestWritableProperty != 42) success = false; // should not have been set to 43.
+ }
+
+ // then we remove the reference.
+ function removeReference() {
+ testProp = null; // allow original object to be released.
+ }
+
+ // after a gc (and deferred deletion process) the object should be gone
+ function ensureDeletion() {
+ if (QObjectApi.QObject.qobjectTestWritableProperty != 43) success = false; // should have been set to 43.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.1.qml b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.1.qml
new file mode 100644
index 0000000000..8a06c30d8c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.1.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: obj
+ objectName: "obj"
+ property CircularReferenceHandle first
+ property CircularReferenceHandle second
+
+ CircularReferenceHandle {
+ id: crh
+ objectName: "crh"
+ }
+
+ function createReference() {
+ first = crh.generate(crh);
+ second = crh.generate(crh);
+ // NOTE: manually add reference from first to second
+ // in unit test prior reparenting and gc.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.2.qml b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.2.qml
new file mode 100644
index 0000000000..d0999134a8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.handle.2.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: obj
+ objectName: "obj"
+ property CircularReferenceHandle first
+ property CircularReferenceHandle second
+
+ CircularReferenceHandle {
+ id: crh
+ objectName: "crh"
+ }
+
+ function circularReference() {
+ // generate the circularly referential pair
+ first = crh.generate(crh);
+ second = crh.generate(crh);
+ // note: must manually reparent in unit test
+ // after setting the handle references, and
+ // then set the "first" and "second" property
+ // values to null (removing references from obj
+ // to the generated objects).
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.1.qml b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.1.qml
new file mode 100644
index 0000000000..70e8390677
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.1.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: obj
+ objectName: "obj"
+
+ property CircularReferenceObject first
+ property CircularReferenceObject second
+
+
+ CircularReferenceObject {
+ id: cro
+ objectName: "cro"
+ }
+
+ function createReference() {
+ // generate the objects
+ first = cro.generate(cro); // has parent, so won't be collected
+ second = cro.generate(); // no parent, but will be kept alive by first's reference
+ first.addReference(second);
+
+ // remove top level references
+ first = cro;
+ second = cro;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.2.qml b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.2.qml
new file mode 100644
index 0000000000..2ddb9253eb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/handleReferenceManagement.object.2.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: obj
+ objectName: "obj"
+
+ property CircularReferenceObject first
+ property CircularReferenceObject second
+
+
+ CircularReferenceObject {
+ id: cro
+ objectName: "cro"
+ }
+
+ function circularReference() {
+ // generate the circularly referential pair - they should still be collected
+ first = cro.generate(); // no parent, so should be collected
+ second = cro.generate(); // no parent, so should be collected
+ first.addReference(second);
+ second.addReference(first);
+
+ // remove top level references
+ first = cro;
+ second = cro;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.1.qml b/tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.1.qml
new file mode 100644
index 0000000000..ece23269f1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.1.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ objectProperty: if(1) otherObject
+
+ property variant obj
+
+ obj: QtObject {
+ id: otherObject
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.qml b/tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.qml
new file mode 100644
index 0000000000..650ed7c73e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/idShortcutInvalidates.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ objectProperty: otherObject
+
+ property variant obj
+
+ obj: QtObject {
+ id: otherObject
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/importScope.1.js b/tests/auto/qml/qqmlecmascript/data/importScope.1.js
new file mode 100644
index 0000000000..4c556f9e96
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/importScope.1.js
@@ -0,0 +1 @@
+var value = 240
diff --git a/tests/auto/qml/qqmlecmascript/data/importScope.2.js b/tests/auto/qml/qqmlecmascript/data/importScope.2.js
new file mode 100644
index 0000000000..291fb9d2cc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/importScope.2.js
@@ -0,0 +1,3 @@
+function getValue() {
+ return ImportScope1.value
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/importScope.qml b/tests/auto/qml/qqmlecmascript/data/importScope.qml
new file mode 100644
index 0000000000..9b907f11f9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/importScope.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import "importScope.1.js" as ImportScope1
+import "importScope.2.js" as ImportScope2
+
+QtObject {
+ property int test: ImportScope2.getValue()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/in.qml b/tests/auto/qml/qqmlecmascript/data/in.qml
new file mode 100644
index 0000000000..f84c9a1481
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/in.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool test1: "x" in root
+ property bool test2: !("foo" in root)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/include.js b/tests/auto/qml/qqmlecmascript/data/include.js
new file mode 100644
index 0000000000..232fd808f8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include.js
@@ -0,0 +1,8 @@
+var test1 = true
+var test2 = false
+var test3 = false
+
+function go() {
+ Qt.include("js/include2.js");
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/include.qml b/tests/auto/qml/qqmlecmascript/data/include.qml
new file mode 100644
index 0000000000..5ce2ed78ec
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import "include.js" as IncludeTest
+
+QtObject {
+ property int test0: 0
+ property bool test1: false
+ property bool test2: false
+ property bool test2_1: false
+ property bool test3: false
+ property bool test3_1: false
+
+ property int testValue: 99
+
+ Component.onCompleted: {
+ IncludeTest.go();
+ test0 = IncludeTest.value
+ test1 = IncludeTest.test1
+ test2 = IncludeTest.test2
+ test2_1 = IncludeTest.test2_1
+ test3 = IncludeTest.test3
+ test3_1 = IncludeTest.test3_1
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/include_callback.js b/tests/auto/qml/qqmlecmascript/data/include_callback.js
new file mode 100644
index 0000000000..ea19eba300
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_callback.js
@@ -0,0 +1,11 @@
+function go() {
+ var a = Qt.include("missing.js", function(o) { test2 = o.status == o.NETWORK_ERROR });
+ test1 = a.status == a.NETWORK_ERROR
+
+ var b = Qt.include("blank.js", function(o) { test4 = o.status == o.OK });
+ test3 = b.status == b.OK
+
+ var c = Qt.include("exception.js", function(o) { test6 = o.status == o.EXCEPTION });
+ test5 = c.status == c.EXCEPTION
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/include_callback.qml b/tests/auto/qml/qqmlecmascript/data/include_callback.qml
new file mode 100644
index 0000000000..fbebcdcd58
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_callback.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import "include_callback.js" as IncludeTest
+
+QtObject {
+ property bool test1: false
+ property bool test2: false
+ property bool test3: false
+ property bool test4: false
+ property bool test5: false
+ property bool test6: false
+
+ Component.onCompleted: {
+ IncludeTest.go();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/include_pragma.qml b/tests/auto/qml/qqmlecmascript/data/include_pragma.qml
new file mode 100644
index 0000000000..7b23c76baa
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_pragma.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import "include_pragma_outer.js" as Script
+
+Item {
+ property int test1
+
+ Component.onCompleted: {
+ test1 = Script.callFunction()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/include_pragma_inner.js b/tests/auto/qml/qqmlecmascript/data/include_pragma_inner.js
new file mode 100644
index 0000000000..a0380a25df
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_pragma_inner.js
@@ -0,0 +1,5 @@
+.pragma library
+
+function getValue() {
+ return 100;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/include_pragma_outer.js b/tests/auto/qml/qqmlecmascript/data/include_pragma_outer.js
new file mode 100644
index 0000000000..d87bafc816
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_pragma_outer.js
@@ -0,0 +1,6 @@
+Qt.include("include_pragma_inner.js")
+
+function callFunction() {
+ return getValue();
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/include_remote.js b/tests/auto/qml/qqmlecmascript/data/include_remote.js
new file mode 100644
index 0000000000..e6a4676819
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_remote.js
@@ -0,0 +1,26 @@
+var myvar = 10;
+
+function go()
+{
+ var a = Qt.include("http://127.0.0.1:8111/remote_file.js",
+ function(o) {
+ test2 = o.status == o.OK
+ test3 = a.status == a.OK
+ test4 = myvar == 13
+
+ done = true;
+ });
+ test1 = a.status == a.LOADING
+
+
+ var b = Qt.include("http://127.0.0.1:8111/exception.js",
+ function(o) {
+ test7 = o.status == o.EXCEPTION
+ test8 = b.status == a.EXCEPTION
+ test9 = b.exception.toString() == "Whoops!";
+ test10 = o.exception.toString() == "Whoops!";
+
+ done2 = true;
+ });
+ test6 = b.status == b.LOADING
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/include_remote.qml b/tests/auto/qml/qqmlecmascript/data/include_remote.qml
new file mode 100644
index 0000000000..fe020a55df
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_remote.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+import "include_remote.js" as IncludeTest
+
+QtObject {
+ property bool done: false
+ property bool done2: false
+
+ property bool test1: false
+ property bool test2: false
+ property bool test3: false
+ property bool test4: false
+ property bool test5: false
+
+ property bool test6: false
+ property bool test7: false
+ property bool test8: false
+ property bool test9: false
+ property bool test10: false
+
+ Component.onCompleted: IncludeTest.go();
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/include_remote_missing.js b/tests/auto/qml/qqmlecmascript/data/include_remote_missing.js
new file mode 100644
index 0000000000..cc90860cc9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_remote_missing.js
@@ -0,0 +1,13 @@
+function go()
+{
+ var a = Qt.include("http://127.0.0.1:8111/missing.js",
+ function(o) {
+ test2 = o.status == o.NETWORK_ERROR
+ test3 = a.status == a.NETWORK_ERROR
+
+ done = true;
+ });
+
+ test1 = a.status == a.LOADING
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/include_remote_missing.qml b/tests/auto/qml/qqmlecmascript/data/include_remote_missing.qml
new file mode 100644
index 0000000000..e8ef609fed
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_remote_missing.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import "include_remote_missing.js" as IncludeTest
+
+QtObject {
+ property bool done: false
+
+ property bool test1: false
+ property bool test2: false
+ property bool test3: false
+
+ Component.onCompleted: IncludeTest.go();
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/include_shared.js b/tests/auto/qml/qqmlecmascript/data/include_shared.js
new file mode 100644
index 0000000000..a49c07bbfc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_shared.js
@@ -0,0 +1,12 @@
+.pragma library
+
+var test1 = true
+var test2 = false
+var test3 = false
+
+var testValue = 99;
+
+function go() {
+ Qt.include("js/include2.js");
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/include_shared.qml b/tests/auto/qml/qqmlecmascript/data/include_shared.qml
new file mode 100644
index 0000000000..28b1003fd4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/include_shared.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import "include_shared.js" as IncludeTest
+
+QtObject {
+ property int test0: 0
+ property bool test1: false
+ property bool test2: false
+ property bool test2_1: false
+ property bool test3: false
+ property bool test3_1: false
+
+ Component.onCompleted: {
+ IncludeTest.go();
+ test0 = IncludeTest.value
+ test1 = IncludeTest.test1
+ test2 = IncludeTest.test2
+ test2_1 = IncludeTest.test2_1
+ test3 = IncludeTest.test3
+ test3_1 = IncludeTest.test3_1
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml
new file mode 100644
index 0000000000..b9a30ef8b5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+QtObject {
+
+ // PLEASE NOTE: the function below is whitespace and newline sensitive,
+ // because that is what the test is all about.
+ //
+ // So: DO NOT REFORMAT THE CODE BELOW!
+
+ function code() {
+var x=0, y=0;
+var z=
+x
++
+++
+y
+
+//////////////////////////////////////////////////////////////////////////////
+if (false) {
+ ;
+}
+//////////////////////////////////////////////////////////////////////////////
+
+z=
+x
++ ++
+y
+
+//////////////////////////////////////////////////////////////////////////////
+if (false) {
+ ;
+}
+//////////////////////////////////////////////////////////////////////////////
+
+z=
+x
++ ++
+y
+
+//////////////////////////////////////////////////////////////////////////////
+if (false) {
+ ;
+}
+
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml
new file mode 100644
index 0000000000..717cdb5715
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+QtObject {
+
+ // PLEASE NOTE: the function below is whitespace and newline sensitive,
+ // because that is what the test is all about.
+ //
+ // So: DO NOT REFORMAT THE CODE BELOW!
+
+ function code() {
+var a, b, c;
+a=b
+++c
+
+if (a === b) {
+}
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml
new file mode 100644
index 0000000000..710729cbfe
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+QtObject {
+
+ // PLEASE NOTE: the function below is whitespace and newline sensitive,
+ // because that is what the test is all about.
+ //
+ // So: DO NOT REFORMAT THE CODE BELOW!
+
+ function code() {
+var x=0, y=0;
+var z=
+x
+++
+++
+y
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/invokableEnumRet.qml b/tests/auto/qml/qqmlecmascript/data/invokableEnumRet.qml
new file mode 100644
index 0000000000..21dfd6ae35
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/invokableEnumRet.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ id: root
+ property bool test: false
+ Component.onCompleted: {
+ test = (root.getEnumValue() == 3)
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/invokableObjectArg.qml b/tests/auto/qml/qqmlecmascript/data/invokableObjectArg.qml
new file mode 100644
index 0000000000..160a90b574
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/invokableObjectArg.qml
@@ -0,0 +1,9 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ id: root
+ Component.onCompleted: {
+ root.myinvokable(root);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/invokableObjectRet.qml b/tests/auto/qml/qqmlecmascript/data/invokableObjectRet.qml
new file mode 100644
index 0000000000..4612273727
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/invokableObjectRet.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ id: root
+ property bool test: false
+ Component.onCompleted: {
+ test = (root.returnme() == root)
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/js/include2.js b/tests/auto/qml/qqmlecmascript/data/js/include2.js
new file mode 100644
index 0000000000..2a0c039dfa
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/js/include2.js
@@ -0,0 +1,4 @@
+test2 = true
+var test2_1 = true
+
+Qt.include("include3.js");
diff --git a/tests/auto/qml/qqmlecmascript/data/js/include3.js b/tests/auto/qml/qqmlecmascript/data/js/include3.js
new file mode 100644
index 0000000000..84b2770b6f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/js/include3.js
@@ -0,0 +1,3 @@
+test3 = true
+var test3_1 = true
+var value = testValue
diff --git a/tests/auto/qml/qqmlecmascript/data/jsObject.qml b/tests/auto/qml/qqmlecmascript/data/jsObject.qml
new file mode 100644
index 0000000000..4223c25f31
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsObject.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test
+
+ Component.onCompleted: {
+ var o = new Object;
+ o.test = 92;
+ test = o.test;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/jsOwnedObjectsDeletedOnEngineDestroy.qml b/tests/auto/qml/qqmlecmascript/data/jsOwnedObjectsDeletedOnEngineDestroy.qml
new file mode 100644
index 0000000000..e1c4cc9d6d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsOwnedObjectsDeletedOnEngineDestroy.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property var jsOwnedObject1: deleteObject.object1()
+ property var jsOwnedObject2: deleteObject.object2
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleOne.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleOne.qml
new file mode 100644
index 0000000000..97c72bd9a6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleOne.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+import "importPragmaLibrary.js" as TestPragmaLibraryImport
+
+Rectangle {
+ width: TestPragmaLibraryImport.importIncrementedValue()
+ height: width + 15
+ color: "red"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleTwo.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleTwo.qml
new file mode 100644
index 0000000000..d006343782
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/SpecialRectangleTwo.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+import "importPragmaLibrary.js" as TestPragmaLibraryImport
+
+Rectangle {
+ width: TestPragmaLibraryImport.importIncrementedValue()
+ height: width + 5
+ color: "blue"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importFive.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importFive.js
new file mode 100644
index 0000000000..e458094552
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importFive.js
@@ -0,0 +1,3 @@
+function importFiveFunction() {
+ return '5';
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importFour.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importFour.js
new file mode 100644
index 0000000000..faddc15c9d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importFour.js
@@ -0,0 +1,9 @@
+.pragma library
+
+function importFourFunction() {
+ return '4';
+}
+
+function greetingString() {
+ return 'Hello, World!';
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importOne.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importOne.js
new file mode 100644
index 0000000000..338c4e042f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importOne.js
@@ -0,0 +1,13 @@
+.import "importTwo.js" as ImportTwoJs
+.import "importThree.js" as ImportThreeJs
+
+function greetingString() {
+ if (ImportTwoJs.greetingString().length > 0) {
+ return ImportTwoJs.greetingString();
+ }
+ return ImportThreeJs.greetingString();
+}
+
+function importOneFunction() {
+ return '1';
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibrary.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibrary.js
new file mode 100644
index 0000000000..c746fef14b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibrary.js
@@ -0,0 +1,9 @@
+.pragma library
+
+var i = 4;
+
+// .pragma library, so should be callable from multiple .qml with shared i.
+function importIncrementedValue() {
+ i = i + 1;
+ return i;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithImports.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithImports.js
new file mode 100644
index 0000000000..3f2e6589dd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithImports.js
@@ -0,0 +1,9 @@
+.pragma library
+.import "importFive.js" as ImportFive
+
+var i = 4;
+
+function importIncrementedValue() {
+ i = i + 1;
+ return (i + ImportFive.importFiveFunction()); // i + '5' (not i+5)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithPragmaLibraryImports.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithPragmaLibraryImports.js
new file mode 100644
index 0000000000..fa6497d99b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importPragmaLibraryWithPragmaLibraryImports.js
@@ -0,0 +1,11 @@
+.pragma library
+.import "importPragmaLibrary.js" as LibraryImport
+
+var i = 10;
+
+function importIncrementedValue() {
+ i = i + 1;
+ // because LibraryImport is shared, and used in previous tests,
+ // the value will be large (already incremented a bunch of times).
+ return (i + LibraryImport.importIncrementedValue());
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importSingletonType.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importSingletonType.js
new file mode 100644
index 0000000000..6c53a0c47d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importSingletonType.js
@@ -0,0 +1,5 @@
+.import Qt.test 1.0 as QObjectSingletonType
+
+function testFunc() {
+ return QObjectSingletonType.QObject.qobjectTestProperty
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importThree.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importThree.js
new file mode 100644
index 0000000000..3917134ee2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importThree.js
@@ -0,0 +1,9 @@
+.import "importFour.js" as ImportFourJs
+
+function greetingString() {
+ return ImportFourJs.greetingString();
+}
+
+function importThreeFunction() {
+ return '3';
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importTwo.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importTwo.js
new file mode 100644
index 0000000000..45b3c9a74d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importTwo.js
@@ -0,0 +1,10 @@
+.import "importFour.js" as ImportFourJs
+.import "importFive.js" as ImportFiveJs
+
+function greetingString() {
+ return ImportFourJs.greetingString();
+}
+
+function importTwoFunction() {
+ return '2';
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/importWithNoImports.js b/tests/auto/qml/qqmlecmascript/data/jsimport/importWithNoImports.js
new file mode 100644
index 0000000000..83426c425c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/importWithNoImports.js
@@ -0,0 +1,11 @@
+// This js file has no imports, and so should inherit
+// scope from the QML file which includes it.
+
+function componentError() {
+ var i = 5;
+ var errorIsOne = Component.error == 1;
+ if (errorIsOne == true) {
+ i = i + 7;
+ }
+ return i;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testImport.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testImport.qml
new file mode 100644
index 0000000000..456a10c7f0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testImport.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+import "testScriptImport.js" as TestScriptImport
+import "testModuleImport.js" as TestModuleImport
+
+QtObject {
+ id: testQtObject
+
+ property string importedScriptStringValue: TestScriptImport.greetingText
+ property int importedScriptFunctionValue: TestScriptImport.randomInteger(1, 20)
+
+ property int importedModuleAttachedPropertyValue: TestModuleImport.importedAttachedPropertyValue(testQtObject)
+ property int importedModuleEnumValue: TestModuleImport.importedEnumValue
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibrary.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibrary.qml
new file mode 100644
index 0000000000..29de15c197
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibrary.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+// We use the components specified in SpecialRectangleOne.qml and SpecialRectangleTwo.qml
+
+QtObject {
+ id: testQtObject
+
+ property SpecialRectangleOne a;
+ property SpecialRectangleTwo b;
+
+ a: SpecialRectangleOne {
+ id: rectangleOne
+ }
+ b: SpecialRectangleTwo {
+ id: rectangleTwo
+ }
+
+ // this should be: (5 + 15) + (6 + 5) == 31
+ property int testValue: rectangleOne.height + rectangleTwo.height
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithImports.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithImports.qml
new file mode 100644
index 0000000000..6a7459d3bb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithImports.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import "importPragmaLibraryWithImports.js" as LibraryImport
+
+QtObject {
+ id: root
+ property int testValue: LibraryImport.importIncrementedValue(); // valueOf(4 + 1 + '5') = valueOf('55') = 55
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithPragmaLibraryImports.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithPragmaLibraryImports.qml
new file mode 100644
index 0000000000..01f08dbdc3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportPragmaLibraryWithPragmaLibraryImports.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import "importPragmaLibraryWithPragmaLibraryImports.js" as LibraryImport
+
+QtObject {
+ id: root
+ property int testValue: LibraryImport.importIncrementedValue(); // 10 + 1 + (7 due to previous tests) = 18
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testImportScoping.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportScoping.qml
new file mode 100644
index 0000000000..aff61cc436
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportScoping.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+// For backward compatibility, importing a script which has no imports,
+// should run the script in the parent context. See QTBUG-17518.
+
+import "importWithNoImports.js" as TestNoImportScoping
+
+QtObject {
+ id: testQtObject
+ property int componentError: TestNoImportScoping.componentError()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testImportSingletonType.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportSingletonType.qml
new file mode 100644
index 0000000000..f817fbf135
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testImportSingletonType.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+import "importSingletonType.js" as Script
+
+Item {
+ property variant testValue: 5
+
+ Component.onCompleted: {
+ testValue = Script.testFunc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testJsImport.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsImport.qml
new file mode 100644
index 0000000000..ae43e90210
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsImport.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+import com.nokia.JsModule 1.0
+import com.nokia.JsModule 1.0 as RenamedModule
+import "testJsModuleImport.js" as TestJsModuleImport
+
+QtObject {
+ id: testQtObject
+
+ property string importedScriptStringValue: ScriptAPI.greeting();
+ property string renamedScriptStringValue: RenamedModule.ScriptAPI.greeting();
+ property string reimportedScriptStringValue: TestJsModuleImport.importedValue();
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleImport.js b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleImport.js
new file mode 100644
index 0000000000..2d21953d2c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleImport.js
@@ -0,0 +1,5 @@
+.import com.nokia.JsModule 1.0 as JsModule
+
+function importedValue() {
+ return JsModule.ScriptAPI.greeting();
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleRemoteImport.js b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleRemoteImport.js
new file mode 100644
index 0000000000..e6e41bc6b2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsModuleRemoteImport.js
@@ -0,0 +1,5 @@
+.import com.nokia.JsRemoteModule 1.0 as JsModule
+
+function importedValue() {
+ return JsModule.ScriptAPI.greeting();
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testJsRemoteImport.qml b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsRemoteImport.qml
new file mode 100644
index 0000000000..4199bb022d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testJsRemoteImport.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+import com.nokia.JsModule 1.0
+import com.nokia.JsModule 1.0 as RenamedModule
+import "testJsModuleRemoteImport.js" as TestJsModuleImport
+
+QtObject {
+ id: testQtObject
+
+ property string importedScriptStringValue: ScriptAPI.greeting();
+ property string renamedScriptStringValue: RenamedModule.ScriptAPI.greeting();
+ property string reimportedScriptStringValue: TestJsModuleImport.importedValue();
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testModuleImport.js b/tests/auto/qml/qqmlecmascript/data/jsimport/testModuleImport.js
new file mode 100644
index 0000000000..69bc1c9887
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testModuleImport.js
@@ -0,0 +1,8 @@
+.import Qt.test 1.0 as JsQtTest // test that we can import elements from .js files
+
+function importedAttachedPropertyValue(obj) {
+ return obj.JsQtTest.MyQmlObject.value; // attached property, value = 19.
+}
+
+var importedEnumValue = JsQtTest.MyQmlObject.EnumValue3 // the actual value of this enum value is "2"
+
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimport/testScriptImport.js b/tests/auto/qml/qqmlecmascript/data/jsimport/testScriptImport.js
new file mode 100644
index 0000000000..2ecccd8816
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimport/testScriptImport.js
@@ -0,0 +1,11 @@
+.import "importOne.js" as ImportOneJs // test that we can import scripts from .js files
+
+var greetingText = ImportOneJs.greetingString()
+
+function randomInteger(min, max) {
+ if (max > min) {
+ if (min > 10) return min;
+ return max;
+ }
+ return min;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/failFive.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failFive.qml
new file mode 100644
index 0000000000..73193a35a5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failFive.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+// This should fail, since if the script does have imports
+// of its own, it should run in its own context.
+
+import "importWithImports.js" as TestImportScoping
+
+QtObject {
+ id: testQtObject
+ property int componentError: TestImportScoping.componentError()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/failFour.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failFour.qml
new file mode 100644
index 0000000000..ef2fc591b3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failFour.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+import "testModuleImport.js" as TestModuleImport
+
+QtObject {
+ property int importedModuleEnumValue: JsQtTest.MyQmlObject.EnumValue3 // should fail - the typenames available in TestModuleImport should not be available in this scope
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/failOne.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failOne.qml
new file mode 100644
index 0000000000..d0c37ad9ba
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failOne.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+import "testScriptImport.js" as TestScriptImport
+
+QtObject {
+ property string importScriptFunctionValue: TestScriptImport.ImportOneJs.greetingString() // should fail - the context of TestScriptImport is private to TestScriptImport.
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/failThree.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failThree.qml
new file mode 100644
index 0000000000..edd103bd82
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failThree.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+import "testModuleImport.js" as TestModuleImport
+
+QtObject {
+ id: testQtObject
+ property int importedModuleAttachedPropertyValue: testQtObject.TestModuleImport.JsQtTest.MyQmlObject.value // should fail - the context of TestScriptImport is private to TestScriptImport.
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/failTwo.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failTwo.qml
new file mode 100644
index 0000000000..28e2026f8d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/failTwo.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+import "testScriptImport.js" as TestScriptImport
+
+QtObject {
+ property string importScriptFunctionValue: ImportOneJs.greetingString() // should fail - the typenames in TestScriptImport should not be visible from this scope
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/importOne.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/importOne.js
new file mode 100644
index 0000000000..45fd9c75dd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/importOne.js
@@ -0,0 +1,7 @@
+function greetingString() {
+ return 'Hello, World!';
+}
+
+function importOneFunction() {
+ return '1';
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/importPragmaLibrary.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/importPragmaLibrary.js
new file mode 100644
index 0000000000..ad0e6946a2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/importPragmaLibrary.js
@@ -0,0 +1,11 @@
+.pragma library
+
+// .pragma library, so shouldn't inherit imports from any .qml file.
+function importValue() {
+ var i = 3;
+ var errorIsOne = Component.error == 1; // this line should fail.
+ if (errorIsOne == true) {
+ i = i + 4;
+ }
+ return i;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/importWithImports.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/importWithImports.js
new file mode 100644
index 0000000000..6d77ceccb1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/importWithImports.js
@@ -0,0 +1,13 @@
+.import "importOne.js" as ImportOne
+
+// This js file has imports, so should not inherit
+// scope from the QML file which includes it.
+
+function componentError() {
+ var i = 3;
+ var errorIsOne = Component.error == 1; // this line should fail.
+ if (errorIsOne == true) {
+ i = i + 4;
+ }
+ return i;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.js
new file mode 100644
index 0000000000..cd06f25ac3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.js
@@ -0,0 +1,3 @@
+.import "other.qml" as Other
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.qml
new file mode 100644
index 0000000000..d9ccc4277f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedFile.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.js
new file mode 100644
index 0000000000..96ec83666b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.js
@@ -0,0 +1,3 @@
+.import "other.js" as other
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.qml
new file mode 100644
index 0000000000..88c3af7675
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedFileQualifier.2.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.js
new file mode 100644
index 0000000000..2eb7afc664
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.js
@@ -0,0 +1,3 @@
+.import "other.js" Other
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.qml
new file mode 100644
index 0000000000..928e883df8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedFileQualifier.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.js
new file mode 100644
index 0000000000..c56c82226c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.js
@@ -0,0 +1,3 @@
+.impooooort QtQuick 2.0 as QQ
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.qml
new file mode 100644
index 0000000000..84f62a3536
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedImport.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.js
new file mode 100644
index 0000000000..6affc4e93e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.js
@@ -0,0 +1,3 @@
+.import QtQuick.++ 2.0 as QQ
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.qml
new file mode 100644
index 0000000000..1170594e79
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedModule.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.js
new file mode 100644
index 0000000000..eced64f9dd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.js
@@ -0,0 +1,3 @@
+.import QtQuick 2.0 as qq
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.qml
new file mode 100644
index 0000000000..e65eb5c8d0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedModuleQualifier.2.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.js
new file mode 100644
index 0000000000..f1116fb55a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.js
@@ -0,0 +1,3 @@
+.import QtQuick 2.0 QQ
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.qml
new file mode 100644
index 0000000000..68cb61cdbd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedModuleQualifier.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.js
new file mode 100644
index 0000000000..8ecc977768
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.js
@@ -0,0 +1,3 @@
+.import QtQuick latest as QQ
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.qml
new file mode 100644
index 0000000000..dc3b8d8d61
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "malformedModuleVersion.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.js
new file mode 100644
index 0000000000..a21f3b1837
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.js
@@ -0,0 +1,3 @@
+.import "other.js"
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.qml
new file mode 100644
index 0000000000..f600e4a9ab
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "missingFileQualifier.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.js
new file mode 100644
index 0000000000..eb71776c89
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.js
@@ -0,0 +1,3 @@
+.import QtQuick 2.0
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.qml
new file mode 100644
index 0000000000..b23d6c19b9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "missingModuleQualifier.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.js
new file mode 100644
index 0000000000..0ad75fa900
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.js
@@ -0,0 +1,3 @@
+.import QtQuick as QQ
+
+function foo() { return 'bar' }
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.qml
new file mode 100644
index 0000000000..e818c8ed49
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import "missingModuleVersion.js" as JS
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/testImportPragmaLibrary.qml b/tests/auto/qml/qqmlecmascript/data/jsimportfail/testImportPragmaLibrary.qml
new file mode 100644
index 0000000000..f04ce007d8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/testImportPragmaLibrary.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+import "importPragmaLibrary.js" as ImportPragmaLibrary
+
+QtObject {
+ id: testQtObject
+ property int testValue: ImportPragmaLibrary.importValue()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/testModuleImport.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/testModuleImport.js
new file mode 100644
index 0000000000..69bc1c9887
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/testModuleImport.js
@@ -0,0 +1,8 @@
+.import Qt.test 1.0 as JsQtTest // test that we can import elements from .js files
+
+function importedAttachedPropertyValue(obj) {
+ return obj.JsQtTest.MyQmlObject.value; // attached property, value = 19.
+}
+
+var importedEnumValue = JsQtTest.MyQmlObject.EnumValue3 // the actual value of this enum value is "2"
+
diff --git a/tests/auto/qml/qqmlecmascript/data/jsimportfail/testScriptImport.js b/tests/auto/qml/qqmlecmascript/data/jsimportfail/testScriptImport.js
new file mode 100644
index 0000000000..2ecccd8816
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/jsimportfail/testScriptImport.js
@@ -0,0 +1,11 @@
+.import "importOne.js" as ImportOneJs // test that we can import scripts from .js files
+
+var greetingText = ImportOneJs.greetingString()
+
+function randomInteger(min, max) {
+ if (max > min) {
+ if (min > 10) return min;
+ return max;
+ }
+ return min;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/ScriptAPI.js b/tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/ScriptAPI.js
new file mode 100644
index 0000000000..b90033eeb4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/ScriptAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 0
+
+function greeting() { return "Hello" }
+
diff --git a/tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/qmldir b/tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/qmldir
new file mode 100644
index 0000000000..c33d1e7a0d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/lib/com/nokia/JsModule/qmldir
@@ -0,0 +1 @@
+ScriptAPI 1.0 ScriptAPI.js
diff --git a/tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.js b/tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.js
new file mode 100644
index 0000000000..3ffdb339ad
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.js
@@ -0,0 +1,6 @@
+.pragma library
+
+function test(target)
+{
+ var a = target.a;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.qml b/tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.qml
new file mode 100644
index 0000000000..5884e2719b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/libraryScriptAssert.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import "libraryScriptAssert.js" as Test
+
+QtObject {
+ id: root
+ Component.onCompleted: Test.test(root);
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/listAssignment.qml b/tests/auto/qml/qqmlecmascript/data/listAssignment.qml
new file mode 100644
index 0000000000..6e6039715b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/listAssignment.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ width: 640
+ height: 480
+
+ property int list1length: list1.length
+
+ property list<MyQmlObject> list1
+ property list<MyQmlObject> list2: [
+ MyQmlObject { id: one; value: 100 },
+ MyQmlObject { id: two; value: 300 }
+ ]
+
+ Component.onCompleted: {
+ root.list1 = root.list2;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/listProperties.qml b/tests/auto/qml/qqmlecmascript/data/listProperties.qml
new file mode 100644
index 0000000000..bdb1265a21
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/listProperties.qml
@@ -0,0 +1,24 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ id: root
+
+ objectListProperty: [
+ QtObject { property int a: 10 },
+ QtObject { property int a: 11 }
+ ]
+
+ function calcTest1() {
+ var rv = 0;
+ for (var ii = 0; ii < root.objectListProperty.length; ++ii) {
+ rv += root.objectListProperty[ii].a;
+ }
+ return rv;
+ }
+
+ property int test1: calcTest1();
+ property int test2: root.objectListProperty.length
+ property bool test3: root.objectListProperty[1] != undefined
+ property bool test4: root.objectListProperty[100] == undefined
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/listToVariant.qml b/tests/auto/qml/qqmlecmascript/data/listToVariant.qml
new file mode 100644
index 0000000000..690024b928
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/listToVariant.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test: children
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevision.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision.qml
new file mode 100644
index 0000000000..77accd80de
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.1
+
+MyRevisionedClass
+{
+ prop1: prop2
+ onSignal1: method2()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevision2.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision2.qml
new file mode 100644
index 0000000000..36057cb902
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision2.qml
@@ -0,0 +1,9 @@
+import Qt.test 1.1
+
+MyRevisionedSubclass
+{
+ prop1: prop3
+ onSignal1: method2()
+ prop3: prop4
+ onSignal3: method4()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevision3.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision3.qml
new file mode 100644
index 0000000000..81769e98f7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision3.qml
@@ -0,0 +1,8 @@
+import Qt.test 1.0
+
+MyRevisionedSubclass
+{
+ prop1: prop3
+ onSignal1: method1()
+ onSignal3: method3()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevision4.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision4.qml
new file mode 100644
index 0000000000..6ebe4790bb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision4.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.1
+import QtQuick 2.0
+
+QtObject {
+ property variant a
+ property real test
+
+ a: MyRevisionedClass {
+ prop2: 11
+
+ Component.onCompleted: test = prop2
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors.qml
new file mode 100644
index 0000000000..8a7e24d788
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRevisionedClass
+{
+ // Will not hit optimizer
+ property real p1: prop1 % 3
+ property real p2: prop2 % 3
+
+ // Should hit optimizer
+ property real p3: prop2
+
+ Component.onCompleted: method2()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors2.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors2.qml
new file mode 100644
index 0000000000..43e87948cd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRevisionedSubclass
+{
+ // Will not hit optimizer
+ property real p1: prop1 % 3
+ property real p2: prop2 % 3
+ property real p3: prop3 % 3
+ property real p4: prop4 % 3
+
+ // Should hit optimizer
+ property real p5: prop1
+ property real p6: prop2
+ property real p7: prop3
+ property real p8: prop4
+
+ Component.onCompleted: {
+ method1()
+ method2()
+ method3()
+ method4()
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors3.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors3.qml
new file mode 100644
index 0000000000..2f82d685fa
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevisionErrors3.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+import Qt.test 1.1
+
+MyRevisionedSubclass
+{
+ // Will not hit optimizer
+ property real pA: propA % 3
+ property real pB: propB % 3
+ property real pC: propC % 3
+ property real pD: propD % 3
+ property real p1: prop1 % 3
+ property real p2: prop2 % 3
+ property real p3: prop3 % 3
+ property real p4: prop4 % 3
+
+ // Should hit optimizer
+ property real pE: propA
+ property real pF: propB
+ property real pG: propC
+ property real pH: propD
+ property real p5: prop1
+ property real p6: prop2
+ property real p7: prop3
+ property real p8: prop4
+
+ Component.onCompleted: {
+ methodA()
+ methodB()
+ methodC()
+ methodD()
+ method1()
+ method2()
+ method3()
+ method4()
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/methods.1.qml b/tests/auto/qml/qqmlecmascript/data/methods.1.qml
new file mode 100644
index 0000000000..0bbee16df8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/methods.1.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: myObject
+ onBasicSignal: myObject.methodNoArgs()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/methods.2.qml b/tests/auto/qml/qqmlecmascript/data/methods.2.qml
new file mode 100644
index 0000000000..9f0c6b15fe
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/methods.2.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: myObject
+ onBasicSignal: myObject.method(163)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/methods.3.qml b/tests/auto/qml/qqmlecmascript/data/methods.3.qml
new file mode 100644
index 0000000000..365780a560
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/methods.3.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ function testFunction() { return 19; }
+
+ property int test: testFunction()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/methods.4.qml b/tests/auto/qml/qqmlecmascript/data/methods.4.qml
new file mode 100644
index 0000000000..a3bd7bebf8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/methods.4.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+MethodsObject {
+ function testFunction2() { return 17; }
+ function testFunction3() { return 16; }
+
+ property int test: testFunction()
+ property int test2: testFunction2()
+ property int test3: testFunction3()
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/methods.5.qml b/tests/auto/qml/qqmlecmascript/data/methods.5.qml
new file mode 100644
index 0000000000..ede2759e2e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/methods.5.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ property alias blah: item.x
+ Item { id: item }
+
+ function testFunction() { return 9; }
+ property int test: testFunction();
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/multiEngineObject.qml b/tests/auto/qml/qqmlecmascript/data/multiEngineObject.qml
new file mode 100644
index 0000000000..e349ced98f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/multiEngineObject.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property string test: thing.stringProperty
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.2.qml b/tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.2.qml
new file mode 100644
index 0000000000..23276f778d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Item {}
+
+ SpuriousWarning {}
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.qml b/tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.qml
new file mode 100644
index 0000000000..b4a417e04e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/noSpuriousWarningsAtShutdown.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property int childrenCount: root.children.length
+
+ Item {}
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/nonExistentAttachedObject.qml b/tests/auto/qml/qqmlecmascript/data/nonExistentAttachedObject.qml
new file mode 100644
index 0000000000..f9585db009
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/nonExistentAttachedObject.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ stringProperty: MyQmlContainer.prop
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/nonNotifyable.qml b/tests/auto/qml/qqmlecmascript/data/nonNotifyable.qml
new file mode 100644
index 0000000000..2b8b113c34
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/nonNotifyable.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+ property int test: root.value
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/nonscriptable.qml b/tests/auto/qml/qqmlecmascript/data/nonscriptable.qml
new file mode 100644
index 0000000000..e96df6b40e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/nonscriptable.qml
@@ -0,0 +1,19 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ id: root
+
+ property bool readOk: false;
+ property bool writeOk: false
+
+ Component.onCompleted: {
+ readOk = (root.nonscriptable == undefined);
+
+ try {
+ root.nonscriptable = 10
+ } catch (e) {
+ writeOk = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/nullObjectBinding.qml b/tests/auto/qml/qqmlecmascript/data/nullObjectBinding.qml
new file mode 100644
index 0000000000..1aee7a1670
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/nullObjectBinding.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject test
+ test: if (1) model
+ property ListModel model
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberAssignment.qml b/tests/auto/qml/qqmlecmascript/data/numberAssignment.qml
new file mode 100644
index 0000000000..30a77e8aed
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberAssignment.qml
@@ -0,0 +1,18 @@
+import Qt.test 1.0
+
+NumberAssignment {
+ test1: if (1) 6.7
+ test2: if (1) "6.7"
+ test3: if (1) 6
+ test4: if (1) "6"
+
+ test5: if (1) 6.7
+ test6: if (1) "6.7"
+ test7: if (1) 6
+ test8: if (1) "6"
+
+ test9: if (1) 6.7
+ test10: if (1) "6.7"
+ test11: if (1) 6
+ test12: if (1) "6"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.1.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.1.qml
new file mode 100644
index 0000000000..1b83a1be0b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.1.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 0;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.2.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.2.qml
new file mode 100644
index 0000000000..77f13178c3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.2.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 1.01;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.3.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.3.qml
new file mode 100644
index 0000000000..f20baf305a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.3.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 1e-10;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.4.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.4.qml
new file mode 100644
index 0000000000..e115dbbbb1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.4.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = -1.2;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.5.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.5.qml
new file mode 100644
index 0000000000..c3db17602a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.5.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = .4e-5;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.6.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.6.qml
new file mode 100644
index 0000000000..471db8708a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.6.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 0x1;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.7.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.7.qml
new file mode 100644
index 0000000000..f8f8e1aae8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.7.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 0Xa;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml
new file mode 100644
index 0000000000..61233cbd5b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 0x;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml
new file mode 100644
index 0000000000..45195452ca
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = 0X;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/objectConversion.qml b/tests/auto/qml/qqmlecmascript/data/objectConversion.qml
new file mode 100644
index 0000000000..67fc342db3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/objectConversion.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 360
+ height: 360
+
+ function circularObject() {
+ var a = {}
+ var b = {}
+
+ a.test = 100;
+ a.c = b;
+ b.c = a;
+ return a;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/objectName.qml b/tests/auto/qml/qqmlecmascript/data/objectName.qml
new file mode 100644
index 0000000000..20b9ec2935
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/objectName.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ objectName: "hello"
+
+ property string test1: objectName
+ property string test2: objectName.substr(1, 3)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/objectNameChangedSignal.qml b/tests/auto/qml/qqmlecmascript/data/objectNameChangedSignal.qml
new file mode 100644
index 0000000000..a2ac7019e4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/objectNameChangedSignal.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ property bool test: false
+
+ onObjectNameChanged: test = true
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/objectsCompareAsEqual.qml b/tests/auto/qml/qqmlecmascript/data/objectsCompareAsEqual.qml
new file mode 100644
index 0000000000..845f74b1aa
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/objectsCompareAsEqual.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property variant item: child
+ Item { id: child }
+
+ property bool test1: child == child
+ property bool test2: child.parent == root
+ property bool test3: root != child
+ property bool test4: item == child
+ property bool test5: item != root
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/objectsPassThroughSignals.qml b/tests/auto/qml/qqmlecmascript/data/objectsPassThroughSignals.qml
new file mode 100644
index 0000000000..98f9e05bdf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/objectsPassThroughSignals.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property bool test: false
+
+ signal mysignal(variant object);
+ function myslot(object)
+ {
+ test = (object == root);
+ }
+
+ Component.onCompleted: {
+ mysignal.connect(this, myslot);
+ mysignal(root);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/onDestruction.qml b/tests/auto/qml/qqmlecmascript/data/onDestruction.qml
new file mode 100644
index 0000000000..b2963a1d41
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/onDestruction.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property Component comp: OnDestructionComponent {
+ property int b: 50
+ onParentChanged: b += a
+ }
+
+ property Item compInstance
+
+ Component.onCompleted: {
+ compInstance = comp.createObject(root);
+ compInstance.destroy();
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml b/tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml
new file mode 100644
index 0000000000..090c948f26
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/outerBindingOverridesInnerBinding.qml
@@ -0,0 +1,15 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: obj
+ property alias c1: myConstants.c1
+ property alias c2: myConstants.c2
+ property int c3: 0
+
+ objectProperty: ConstantsOverrideBindings {
+ id: myConstants
+ c2: obj.c3
+ }
+
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/overrideDataAssert.qml b/tests/auto/qml/qqmlecmascript/data/overrideDataAssert.qml
new file mode 100644
index 0000000000..e419bd3beb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/overrideDataAssert.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ signal routeStatusChanged
+ function onRouteStatusChanged() { }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ownership.qml b/tests/auto/qml/qqmlecmascript/data/ownership.qml
new file mode 100644
index 0000000000..855a264995
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ownership.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: { var a = getObject(); a = null; }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ownershipConsistency.qml b/tests/auto/qml/qqmlecmascript/data/ownershipConsistency.qml
new file mode 100644
index 0000000000..7ae099e32e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ownershipConsistency.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ Loader {
+ source: "PropertyVarBaseItem.qml"
+ onLoaded: item.destroy()
+ }
+ Loader {
+ Component.onCompleted: setSource("PropertyVarBaseItem.qml", { random: "" })
+ onLoaded: item.destroy()
+ }
+
+ Repeater {
+ model: 1
+ Item { Component.onCompleted: destroy() }
+ }
+ Repeater {
+ model: 1
+ Item { id: me; Component.onCompleted: { setObject(me); getObject().destroy() } }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml b/tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml
new file mode 100644
index 0000000000..6f536b27ca
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property QtObject incubatedItem
+
+ Component.onCompleted: {
+ var component = Qt.createComponent("PropertyVarBaseItem.qml");
+
+ var incubator = component.incubateObject(root);
+ if (incubator.status != Component.Ready) {
+ incubator.onStatusChanged = function(status) {
+ if (status == Component.Ready) {
+ incubatedItem = incubator.object;
+ }
+ }
+ } else {
+ incubatedItem = incubator.object;
+ }
+ }
+
+ function deleteIncubatedItem() {
+ incubatedItem.destroy();
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/ownershipRootObject.qml b/tests/auto/qml/qqmlecmascript/data/ownershipRootObject.qml
new file mode 100644
index 0000000000..b1b0b72a87
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/ownershipRootObject.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ Component.onCompleted: { setObject(root); getObject() }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyAssignmentErrors.qml b/tests/auto/qml/qqmlecmascript/data/propertyAssignmentErrors.qml
new file mode 100644
index 0000000000..34523ec1c7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyAssignmentErrors.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property int a
+ property variant b
+
+ property bool test1: false;
+ property bool test2: false;
+
+ Component.onCompleted: {
+ try {
+ root.a = undefined;
+ } catch(e) {
+ if (e.message == "Cannot assign [undefined] to int" &&
+ e.stack.indexOf("propertyAssignmentErrors.qml:14") != -1)
+ root.test1 = true;
+ }
+
+ try {
+ root.a = "Hello";
+ } catch(e) {
+ if (e.message == "Cannot assign QString to int" &&
+ e.stack.indexOf("propertyAssignmentErrors.qml:22") != -1)
+ root.test2 = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyOverride.qml b/tests/auto/qml/qqmlecmascript/data/propertyOverride.qml
new file mode 100644
index 0000000000..bd3fed479b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyOverride.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ BaseComponent2 {
+ id: foo
+
+ // Override the properties of the base component
+ property string directProperty: 'hello'
+ function getDirectFromExtension() { return directProperty }
+
+ property alias extensionDirectAlias: foo.directProperty
+
+ property Text objectProperty: Text { width: 666 }
+
+ property int optimizedBoundProperty: objectProperty.width
+ function getOptimizedBoundFromExtension() { return optimizedBoundProperty }
+
+ property alias extensionOptimizedBoundAlias: foo.optimizedBoundProperty
+
+ property int unoptimizedBoundProperty: if (true) objectProperty.width
+ function getUnoptimizedBoundFromExtension() { return unoptimizedBoundProperty }
+
+ property alias extensionUnoptimizedBoundAlias: foo.unoptimizedBoundProperty
+
+ property string extensionDirectPropertyChangedValue: ''
+ onDirectPropertyChanged: extensionDirectPropertyChangedValue = directProperty
+
+ property int extensionOptimizedBoundPropertyChangedValue: 0
+ onOptimizedBoundPropertyChanged: extensionOptimizedBoundPropertyChangedValue = optimizedBoundProperty
+
+ property int extensionUnoptimizedBoundPropertyChangedValue: 0
+ onUnoptimizedBoundPropertyChanged: extensionUnoptimizedBoundPropertyChangedValue = unoptimizedBoundProperty
+
+ function setDirectFromExtension(n) { directProperty = n }
+ function setBoundFromExtension(n) { objectProperty.width = n }
+ }
+
+ Component.onCompleted: {
+ // In the base component, overriding should not affect resolution
+ if (foo.getDirectFromBase() != 333) return
+ if (foo.getOptimizedBoundFromBase() != 333) return
+ if (foo.getUnoptimizedBoundFromBase() != 333) return
+
+ // In the extension component overriding should occur
+ if (foo.getDirectFromExtension() != 'hello') return
+ if (foo.getOptimizedBoundFromExtension() != 666) return
+ if (foo.getUnoptimizedBoundFromExtension() != 666) return
+
+ // External access should yield extension component scoping
+ if (foo.directProperty != 'hello') return
+ if (foo.optimizedBoundProperty != 666) return
+ if (foo.unoptimizedBoundProperty != 666) return
+
+ // Verify alias properties bind to the correct target
+ if (foo.baseDirectAlias != 333) return
+ if (foo.baseOptimizedBoundAlias != 333) return
+ if (foo.baseUnoptimizedBoundAlias != 333) return
+
+ if (foo.extensionDirectAlias != 'hello') return
+ if (foo.extensionOptimizedBoundAlias != 666) return
+ if (foo.extensionUnoptimizedBoundAlias != 666) return
+
+ foo.baseDirectPropertyChangedValue = 0
+ foo.baseOptimizedBoundPropertyChangedValue = 0
+ foo.baseUnoptimizedBoundPropertyChangedValue = 0
+ foo.extensionDirectPropertyChangedValue = ''
+ foo.extensionOptimizedBoundPropertyChangedValue = 0
+ foo.extensionUnoptimizedBoundPropertyChangedValue = 0
+
+ // Verify that the correct onChanged signal is emitted
+ foo.setDirectFromBase(999)
+ if (foo.getDirectFromBase() != 999) return
+ if (foo.baseDirectPropertyChangedValue != 999) return
+ if (foo.extensionDirectPropertyChangedValue != '') return
+
+ foo.setDirectFromExtension('goodbye')
+ if (foo.getDirectFromExtension() != 'goodbye') return
+ if (foo.extensionDirectPropertyChangedValue != 'goodbye') return
+ if (foo.baseDirectPropertyChangedValue != 999) return
+
+ foo.setBoundFromBase(999)
+ if (foo.getOptimizedBoundFromBase() != 999) return
+ if (foo.getUnoptimizedBoundFromBase() != 999) return
+ if (foo.baseOptimizedBoundPropertyChangedValue != 999) return
+ if (foo.baseUnoptimizedBoundPropertyChangedValue != 999) return
+ if (foo.extensionOptimizedBoundPropertyChangedValue != 0) return
+ if (foo.extensionUnoptimizedBoundPropertyChangedValue != 0) return
+
+ foo.baseOptimizedBoundPropertyChangedValue = 0
+ foo.baseUnoptimizedBoundPropertyChangedValue = 0
+
+ foo.setBoundFromExtension(123)
+ if (foo.getOptimizedBoundFromExtension() != 123) return
+ if (foo.getUnoptimizedBoundFromExtension() != 123) return
+ if (foo.extensionOptimizedBoundPropertyChangedValue != 123) return
+ if (foo.extensionUnoptimizedBoundPropertyChangedValue != 123) return
+ if (foo.baseOptimizedBoundPropertyChangedValue != 0) return
+ if (foo.baseUnoptimizedBoundPropertyChangedValue != 0) return
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.1.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.1.qml
new file mode 100644
index 0000000000..4e532ccf36
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.1.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+ property bool test: false
+
+ qjsvalue: new vehicle(4);
+ property int wheelCount: qjsvalue.wheels
+
+ function vehicle(wheels) {
+ this.wheels = wheels;
+ }
+
+ Component.onCompleted: {
+ qjsvalue.wheels = 6; // not bindable, wheelCount shouldn't update
+
+ if (qjsvalue.wheels != 6) return;
+ if (wheelCount != 4) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.10.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.10.qml
new file mode 100644
index 0000000000..39036ea7c6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.10.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+PropertyQJSValueBaseItem {
+ property bool test: false
+ Component.onCompleted: {
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.11.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.11.qml
new file mode 100644
index 0000000000..2ccab7345c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.11.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ property bool test: false
+
+ MyQmlObject { id: fnResultObj; qjsvalue: testFunction(5) }
+ MyQmlObject { id: f1Obj; qjsvalue: testFunction }
+ MyQmlObject { id: f2Obj; qjsvalue: testFunction }
+
+
+ property alias fnResult: fnResultObj.qjsvalue;
+ property alias f1: f1Obj.qjsvalue
+ property alias f2: f2Obj.qjsvalue
+
+ function testFunction(x) {
+ return x;
+ }
+
+ Component.onCompleted: {
+ f2 = testFunction;
+ if (fnResult != 5) return;
+ if (f1(6) != 6) return;
+ if (f2(7) != 7) return;
+ if (f1 != f2) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml
new file mode 100644
index 0000000000..78390a0a6d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.12.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ property bool test: false
+
+ MyQmlObject { id: nullOneObj; qjsvalue: null }
+ MyQmlObject { id: nullTwoObj; }
+ MyQmlObject { id: undefOneObj; qjsvalue: undefined }
+ MyQmlObject { id: undefTwoObj }
+
+ property alias nullOne: nullOneObj.qjsvalue
+ property alias nullTwo: nullTwoObj.qjsvalue
+ property alias undefOne: undefOneObj.qjsvalue
+ property alias undefTwo: undefTwoObj.qjsvalue
+
+ Component.onCompleted: {
+ nullTwo = null;
+ undefTwo = undefined;
+ if (nullOne != null) return;
+ if (nullOne != nullTwo) return;
+ if (undefOne != undefined) return;
+ if (undefOne != undefTwo) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.13.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.13.qml
new file mode 100644
index 0000000000..5ece89bd55
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.13.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ property bool test: false
+ property var f: b + 12
+ property int a: 100
+ property int b: testFunction()
+
+ function testFunction() {
+ return a * 3;
+ }
+
+ Component.onCompleted: {
+ if (f != 312) return;
+ a = 120;
+ if (f != 372) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.14.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.14.qml
new file mode 100644
index 0000000000..1c1c038d4c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.14.qml
@@ -0,0 +1,22 @@
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+ property int a: 100
+ property int b
+
+ function testFunction() {
+ return a * 3;
+ }
+
+ Component.onCompleted: {
+ b = Qt.binding(testFunction);
+ qjsvalue = Qt.binding(function() { return b + 12; });
+ if (qjsvalue != 312) return;
+ a = 120;
+ if (qjsvalue != 372) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.15.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.15.qml
new file mode 100644
index 0000000000..acbfd6e106
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.15.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+ qjsvalue: [ Qt.binding(function() { return testFunction() + 12; }) ]
+ property int a: 100
+ property int b
+
+ function testFunction() {
+ return a * 3;
+ }
+
+ Component.onCompleted: {
+ b = qjsvalue[0];
+ if (b != 312) return;
+ a = 120;
+ if (b != 372) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.16.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.16.qml
new file mode 100644
index 0000000000..7c691435ea
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.16.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+ property string string1
+
+ qjsvalue: function () {
+ string1 = "Test case 1"
+ return 100;
+ }
+
+ Component.onCompleted: {
+ if (qjsvalue() != 100)
+ return
+
+ if (string1 != "Test case 1")
+ return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.2.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.2.qml
new file mode 100644
index 0000000000..21a3e78da8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.2.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+ property bool test: false
+
+ qjsvalue: new vehicle(8);
+ property int wheelCount: qjsvalue.wheels
+
+ function vehicle(wheels) {
+ this.wheels = wheels;
+ }
+
+ Component.onCompleted: {
+ if (wheelCount != 8) return;
+
+ // not bindable, but wheelCount will update because truck itself changed.
+ qjsvalue = new vehicle(12);
+
+ if (wheelCount != 12) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.3.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.3.qml
new file mode 100644
index 0000000000..fc0a09ac88
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.3.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+ property bool test: false
+
+ qjsvalue: 4
+ property int bound: qjsvalue + 5
+
+ Component.onCompleted: {
+ if (bound != 9) return;
+
+ qjsvalue = qjsvalue + 1;
+
+ if (bound != 10) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.4.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.4.qml
new file mode 100644
index 0000000000..18691d1ea9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.4.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+
+ qjsvalue: [1, 2, 3, "four", "five"]
+ property int bound: qjsvalue[0]
+
+ Component.onCompleted: {
+ if (bound != 1) return;
+
+ qjsvalue[0] = 10 // bound should remain 1
+
+ if (bound != 1) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.5.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.5.qml
new file mode 100644
index 0000000000..485a5fee7d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.5.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+
+ qjsvalue: { 'color': 'red', 'width': 100 }
+ property int bound: qjsvalue.width
+
+ Component.onCompleted: {
+ if (bound != 100) return;
+
+ qjsvalue.width = 200 // bound should remain 100
+
+ if (bound != 100) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.6.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.6.qml
new file mode 100644
index 0000000000..255bebfafb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.6.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ property bool test: false
+
+ MyQmlObject { id: itemsObj; qjsvalue: [1, 2, 3, "four", "five"] }
+ MyQmlObject { id: funcsObj; qjsvalue: [(function() { return 6; })] }
+
+ property alias items: itemsObj.qjsvalue
+ property int bound: itemsObj.qjsvalue[0]
+ property alias funcs: funcsObj.qjsvalue
+ property int bound2: funcsObj.qjsvalue[0]()
+
+ function returnTwenty() {
+ return 20;
+ }
+
+ Component.onCompleted: {
+ if (bound != 1) return false;
+ if (bound2 != 6) return false;
+
+ items = [10, 2, 3, "four", "five"] // bound should now be 10
+ funcs = [returnTwenty] // bound2 should now be 20
+
+ if (bound != 10) return false;
+ if (bound2 != 20) return false;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.7.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.7.qml
new file mode 100644
index 0000000000..09be338732
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.7.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+
+ qjsvalue: { 'color': 'red', 'width': 100 }
+ property int bound: qjsvalue.width
+
+ Component.onCompleted: {
+ if (bound != 100) return;
+
+ qjsvalue = { 'color': 'blue', 'width': 200 } // bound should now be 200
+
+ if (bound != 200) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.8.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.8.qml
new file mode 100644
index 0000000000..73074ca684
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.8.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+
+ qjsvalue: 6
+
+ Component.onCompleted: {
+ if (qjsvalue != 6) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.9.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.9.qml
new file mode 100644
index 0000000000..5c776fcc83
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.9.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool test: false
+
+ property MyQmlObject obj: MyQmlObject {
+ id: qmlobject
+ intProperty: 5
+ }
+ qjsvalue: qmlobject
+ property int bound: qjsvalue.intProperty
+
+ Component.onCompleted: {
+ if (bound != 5) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.bindingreset.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.bindingreset.qml
new file mode 100644
index 0000000000..598bdd395d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.bindingreset.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+ property bool test: false
+
+ property bool doReset: false
+ qjsvalueWithReset: if (doReset) return undefined; else return 9
+
+ Component.onCompleted: {
+ if (qjsvalueWithReset != 9) return;
+ doReset = true
+
+ if (qjsvalueWithReset != "Reset!") return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.reset.qml b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.reset.qml
new file mode 100644
index 0000000000..76685456cc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyQJSValue.reset.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+ property bool test: false
+
+ qjsvalueWithReset: 9
+
+ Component.onCompleted: {
+ qjsvalueWithReset = undefined
+
+ if (qjsvalueWithReset != "Reset!") return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertySplicing.qml b/tests/auto/qml/qqmlecmascript/data/propertySplicing.qml
new file mode 100644
index 0000000000..53711db3f4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertySplicing.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyDerivedObject {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = intProperty()
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.1.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.1.qml
new file mode 100644
index 0000000000..219e61bf91
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.1.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool test: false
+
+ property var car: new vehicle(4);
+ property int wheelCount: car.wheels
+
+ function vehicle(wheels) {
+ this.wheels = wheels;
+ }
+
+ Component.onCompleted: {
+ car.wheels = 6; // not bindable, wheelCount shouldn't update
+
+ if (car.wheels != 6) return;
+ if (wheelCount != 4) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.10.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.10.qml
new file mode 100644
index 0000000000..ac7f2bed57
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.10.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+PropertyVarBaseItem {
+ property bool test: false
+ Component.onCompleted: {
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.11.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.11.qml
new file mode 100644
index 0000000000..63be26717e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.11.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ property var fnResult: testFunction(5)
+ property var f1: testFunction
+ property var f2
+
+ function testFunction(x) {
+ return x;
+ }
+
+ Component.onCompleted: {
+ f2 = testFunction;
+ if (fnResult != 5) return;
+ if (f1(6) != 6) return;
+ if (f2(7) != 7) return;
+ if (f1 != f2) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.12.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.12.qml
new file mode 100644
index 0000000000..3510bd2350
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.12.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ property var nullOne: null
+ property var nullTwo
+ property var undefOne: undefined
+ property var undefTwo
+
+ Component.onCompleted: {
+ nullTwo = null;
+ undefTwo = undefined;
+ if (nullOne != null) return;
+ if (nullOne != nullTwo) return;
+ if (undefOne != undefined) return;
+ if (undefOne != undefTwo) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.13.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.13.qml
new file mode 100644
index 0000000000..14c7c677ae
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.13.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ property var f: b + 12
+ property int a: 100
+ property int b: testFunction()
+
+ function testFunction() {
+ return a * 3;
+ }
+
+ Component.onCompleted: {
+ if (f != 312) return;
+ a = 120;
+ if (f != 372) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.14.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.14.qml
new file mode 100644
index 0000000000..a1e26661bb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.14.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ property var f
+ property int a: 100
+ property int b
+
+ function testFunction() {
+ return a * 3;
+ }
+
+ Component.onCompleted: {
+ b = Qt.binding(testFunction);
+ f = Qt.binding(function() { return b + 12; });
+ if (f != 312) return;
+ a = 120;
+ if (f != 372) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.15.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.15.qml
new file mode 100644
index 0000000000..5e5071fc2d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.15.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ property var storedBinding: [ Qt.binding(function() { return testFunction() + 12; }) ]
+ property int a: 100
+ property int b
+
+ function testFunction() {
+ return a * 3;
+ }
+
+ Component.onCompleted: {
+ b = storedBinding[0];
+ if (b != 312) return;
+ a = 120;
+ if (b != 372) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.16.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.16.qml
new file mode 100644
index 0000000000..e208c98766
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.16.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ property string string1
+ property string string2
+
+ property var f1 : function () {
+ string1 = "Test case 1"
+ return 100;
+ }
+
+ property var f2;
+ function testcase2() {
+ string2 = "Test case 2"
+ return 100;
+ }
+
+ f2: testcase2
+
+ Component.onCompleted: {
+ if (f1() != 100)
+ return
+
+ if (f2() != 100)
+ return;
+
+ if (string1 != "Test case 1")
+ return;
+
+ if (string2 != "Test case 2")
+ return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml
new file mode 100644
index 0000000000..2ac4807ec5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool test: false
+
+ property var truck: new vehicle(8);
+ property int wheelCount: truck.wheels
+
+ function vehicle(wheels) {
+ this.wheels = wheels;
+ }
+
+ Component.onCompleted: {
+ if (wheelCount != 8) return;
+
+ // not bindable, but wheelCount will update because truck itself changed.
+ truck = new vehicle(12);
+
+ if (wheelCount != 12) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.3.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.3.qml
new file mode 100644
index 0000000000..cf6a651639
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.3.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool test: false
+
+ property var jsint: 4
+ property int bound: jsint + 5
+
+ Component.onCompleted: {
+ if (bound != 9) return;
+
+ jsint = jsint + 1;
+
+ if (bound != 10) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.4.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.4.qml
new file mode 100644
index 0000000000..82fc225e71
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.4.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ property var items: [1, 2, 3, "four", "five"]
+ property int bound: items[0]
+
+ Component.onCompleted: {
+ if (bound != 1) return;
+
+ items[0] = 10 // bound should remain 1
+
+ if (bound != 1) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.5.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.5.qml
new file mode 100644
index 0000000000..a5c7812289
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.5.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ property var attributes: { 'color': 'red', 'width': 100 }
+ property int bound: attributes.width
+
+ Component.onCompleted: {
+ if (bound != 100) return;
+
+ attributes.width = 200 // bound should remain 100
+
+ if (bound != 100) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.6.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.6.qml
new file mode 100644
index 0000000000..060d24e7bc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.6.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ property var items: [1, 2, 3, "four", "five"]
+ property int bound: items[0]
+ property var funcs: [(function() { return 6; })]
+ property int bound2: funcs[0]()
+
+ function returnTwenty() {
+ return 20;
+ }
+
+ Component.onCompleted: {
+ if (bound != 1) return false;
+ if (bound2 != 6) return false;
+
+ items = [10, 2, 3, "four", "five"] // bound should now be 10
+ funcs = [returnTwenty] // bound2 should now be 20
+
+ if (bound != 10) return false;
+ if (bound2 != 20) return false;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.7.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.7.qml
new file mode 100644
index 0000000000..1d6c8c0a37
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.7.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ property var attributes: { 'color': 'red', 'width': 100 }
+ property int bound: attributes.width
+
+ Component.onCompleted: {
+ if (bound != 100) return;
+
+ attributes = { 'color': 'blue', 'width': 200 } // bound should now be 200
+
+ if (bound != 200) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.8.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.8.qml
new file mode 100644
index 0000000000..a9f73db402
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.8.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ property var literalValue: 6
+
+ Component.onCompleted: {
+ if (literalValue != 6) return;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.9.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.9.qml
new file mode 100644
index 0000000000..f5aca28417
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.9.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ property bool test: false
+
+ MyQmlObject {
+ id: qmlobject
+ intProperty: 5
+ }
+ property var qobjectVar: qmlobject
+ property int bound: qobjectVar.intProperty
+
+ Component.onCompleted: {
+ if (bound != 5) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.circular.2.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.circular.2.qml
new file mode 100644
index 0000000000..93c44afcc9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.circular.2.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "separateRootObject"
+ property var vp
+
+ function constructGarbage() {
+ var retn = 1;
+ var component = Qt.createComponent("PropertyVarCircularComponent3.qml");
+ if (component.status == Component.Ready) {
+ retn = component.createObject(null); // has JavaScript ownership
+ }
+ return retn;
+ }
+
+ function assignCircular() {
+ vp = constructGarbage();
+ gc();
+ }
+
+ function deassignCircular() {
+ vp = 2;
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.circular.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.circular.qml
new file mode 100644
index 0000000000..171d7747cd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.circular.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: testCircular
+
+ property var varProperty
+ property variant canaryResource
+ property int canaryInt
+
+ function constructGarbage() {
+ var retn = 1;
+ var component = Qt.createComponent("PropertyVarCircularComponent.qml");
+ if (component.status == Component.Ready) {
+ retn = component.createObject(null); // has JavaScript ownership
+ }
+ return retn;
+ }
+
+ function deassignCanaryResource() {
+ canaryResource = 1;
+ gc();
+ }
+
+ function assignCircular() {
+ varProperty = constructGarbage();
+ canaryResource = varProperty.vp.vp.vp.vp.memoryHog;
+ canaryInt = varProperty.vp.vp.vp.vp.fifthCanary; // == 5
+ gc();
+ }
+
+ function deassignCircular() {
+ canaryInt = 2;
+ varProperty = 2;
+ gc();
+ }
+
+ function assignThenDeassign() {
+ varProperty = constructGarbage();
+ varProperty = 2;
+ gc();
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.inherit.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.inherit.qml
new file mode 100644
index 0000000000..abd0dd7c04
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.inherit.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: testInheritance
+
+ property var varProperty
+
+ function constructGarbage() {
+ var retn = 1;
+ var component = Qt.createComponent("PropertyVarInheritanceComponent.qml");
+ if (component.status == Component.Ready) {
+ retn = component.createObject(null); // has JavaScript ownership
+ }
+ return retn;
+ }
+
+ function assignCircular() {
+ varProperty = constructGarbage();
+ gc();
+ }
+
+ function deassignCircular() {
+ varProperty = 2;
+ gc();
+ }
+
+ function assignThenDeassign() {
+ varProperty = constructGarbage();
+ varProperty = 2;
+ gc();
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVar.reparent.qml b/tests/auto/qml/qqmlecmascript/data/propertyVar.reparent.qml
new file mode 100644
index 0000000000..7b3df674f1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVar.reparent.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "separateRootObject"
+ property var vp
+
+ function constructGarbage() {
+ var retn = 1;
+ var component = Qt.createComponent("PropertyVarOwnershipComponent.qml");
+ if (component.status == Component.Ready) {
+ retn = component.createObject(null); // has JavaScript ownership
+ }
+ return retn;
+ }
+
+ function assignVarProp() {
+ vp = constructGarbage();
+ gc();
+ }
+
+ function deassignVarProp() {
+ vp = 2;
+ gc();
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarCpp.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarCpp.qml
new file mode 100644
index 0000000000..cd3147f565
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarCpp.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: testOwnership
+ property int intProperty: 10
+ property var varProperty: intProperty
+ property var varProperty2: false
+ property var varBound: varProperty + 5
+ property int intBound: varProperty + 5
+ property var jsobject: new vehicle(4)
+
+ function vehicle(wheels) {
+ this.wheels = wheels;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarImplicitOwnership.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarImplicitOwnership.qml
new file mode 100644
index 0000000000..9cebded932
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarImplicitOwnership.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "separateRootObject"
+ property var vp
+
+ function constructGarbage() {
+ var retn = 1;
+ var component = Qt.createComponent("PropertyVarCircularComponent4.qml");
+ if (component.status == Component.Ready) {
+ retn = component.createObject(null); // has JavaScript ownership
+ }
+ return retn;
+ }
+
+ function assignCircular() {
+ vp = constructGarbage();
+ gc();
+ }
+
+ function deassignCircular() {
+ vp = 2;
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml
new file mode 100644
index 0000000000..14d4f9fd27
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: testOwnership
+ property bool test: false
+
+ property int dummyProperty // Tests for non-interference of other properties
+ property var varProperty
+
+ function runTest() {
+ if (varProperty != undefined) return;
+ varProperty = { a: 10, b: 11 }
+ if (varProperty.a != 10) return;
+
+ gc(); // Shouldn't collect
+
+ if (varProperty.a != 10) return;
+
+ test = true;
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml
new file mode 100644
index 0000000000..d5b449c938
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Item {
+ property var object
+
+ property bool test1: false
+ property bool test2: false
+
+ // Test methods are executed in sequential order
+
+ function runTest() {
+ var c = Qt.createComponent("propertyVarOwnership.3.type.qml");
+ object = c.createObject();
+
+ if (object.dummy != 10) return;
+ test1 = true;
+ }
+
+ // Run gc() from C++
+
+ function runTest2() {
+ if (object.dummy != 10) return;
+
+ object = undefined;
+ if (object != undefined) return;
+
+ test2 = true;
+ }
+
+ // Run gc() from C++ - QObject should be collected
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.type.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.type.qml
new file mode 100644
index 0000000000..3406553b91
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.3.type.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int dummy: 10
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.qml
new file mode 100644
index 0000000000..1eba36ce81
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property var object
+
+ property bool test: false
+
+ Component.onCompleted: {
+ var c = Qt.createComponent("propertyVarOwnership.4.type1.qml");
+ object = c.createObject();
+
+ if (object.dummy != 10) return;
+ if (object.test != true) return;
+
+ object.creatorRef = root;
+
+ test = true;
+ }
+
+ function runTest() {
+ object = null;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type1.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type1.qml
new file mode 100644
index 0000000000..9a29b6e17f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type1.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+// Has a self reference in selfRef, and a reference to propertyVarOwnership.4.qml in creatorRef
+Item {
+ id: root
+
+ property var creatorRef
+ property var selfRef
+ property var object
+
+ property int dummy: 10
+ property bool test: false
+
+ Component.onCompleted: {
+ selfRef = root;
+
+ var c = Qt.createComponent("propertyVarOwnership.4.type2.qml");
+ object = c.createObject();
+ object.creatorRef = root;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type2.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type2.qml
new file mode 100644
index 0000000000..f82b8a1c1e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.4.type2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+// Has a reference to propertyVarOwnership.4.type1.qml in creatorRef
+Item {
+ property var creatorRef
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml
new file mode 100644
index 0000000000..1143eaf919
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.5.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import Qt.test 1.0 as SingletonType
+
+Item {
+ id: testOwnership
+ property bool test: false
+
+ function runTest() {
+ var o;
+ var c = Qt.createComponent("ComponentWithVarProp.qml");
+ if (c.status == Component.Ready) {
+ o = c.createObject();
+ } else {
+ return; // failed to create component.
+ }
+ o.varprop = true; // causes initialization of varProperties.
+ SingletonType.QObject.trackObject(o); // stores QObject ptr
+ if (SingletonType.QObject.trackedObject() == null) return; // is still valid, should have a valid v8object.
+ o = new Date(); // causes object to be gc-able.
+ gc(); // collect object's v8object + varProperties, queues deleteLater.
+ if (SingletonType.QObject.trackedObject() != null) return; // v8object was previously collected.
+ SingletonType.QObject.setTrackedObjectProperty("varprop"); // deferences varProperties of object.
+ test = !(SingletonType.QObject.trackedObjectProperty("varprop")); // deferences varProperties of object.
+ // if we didn't crash, success.
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml
new file mode 100644
index 0000000000..7b99c4b6ad
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/propertyVarOwnership.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: testOwnership
+ property bool test: false
+
+ property var varProperty
+
+ function runTest() {
+ if (varProperty != undefined) return;
+ varProperty = { a: 10, b: 11 }
+ if (varProperty.a != 10) return;
+
+ gc(); // Shouldn't collect
+
+ if (varProperty.a != 10) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/qlistqobjectMethods.qml b/tests/auto/qml/qqmlecmascript/data/qlistqobjectMethods.qml
new file mode 100644
index 0000000000..3c1986d721
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qlistqobjectMethods.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test: getObjects().length
+ property bool test2: getObjects()[0].trueProperty
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qmlHasOwnProperty.qml b/tests/auto/qml/qqmlecmascript/data/qmlHasOwnProperty.qml
new file mode 100644
index 0000000000..384971b59c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qmlHasOwnProperty.qml
@@ -0,0 +1,72 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import Qt.test.qobjectApi 1.0 as QtTestQObjectApi
+
+Item {
+ id: obj
+ objectName: "objName"
+ property int someIntProperty: 10
+ property bool result: false
+
+ function testHasOwnPropertySuccess()
+ {
+ obj.result = obj.hasOwnProperty("someIntProperty");
+ }
+
+ function testHasOwnPropertyFailure()
+ {
+ obj.result = obj.hasOwnProperty("someNonexistentProperty");
+ }
+
+ MyTypeObject {
+ id: typeObj
+ objectName: "typeObj"
+ pointProperty: Qt.point(34, 29)
+ variantProperty: Qt.vector3d(1, 2, 3)
+ stringProperty: "test string"
+ property list<Rectangle> listProperty: [ Rectangle { width: 10; height: 10 } ]
+ property list<Rectangle> emptyListProperty
+
+ property bool valueTypeHasOwnProperty
+ property bool valueTypeHasOwnProperty2
+ property bool variantTypeHasOwnProperty
+ property bool stringTypeHasOwnProperty
+ property bool listTypeHasOwnProperty
+ property bool listAtValidHasOwnProperty
+ property bool emptyListTypeHasOwnProperty
+ property bool enumTypeHasOwnProperty
+ property bool typenameHasOwnProperty
+ property bool typenameHasOwnProperty2
+ property bool singletonTypeTypeHasOwnProperty
+ property bool singletonTypePropertyTypeHasOwnProperty
+ function testHasOwnPropertySuccess() {
+ valueTypeHasOwnProperty = !typeObj.pointProperty.hasOwnProperty("nonexistentpropertyname");
+ valueTypeHasOwnProperty2 = typeObj.pointProperty.hasOwnProperty("x"); // should be true
+ variantTypeHasOwnProperty = !typeObj.variantProperty.hasOwnProperty("nonexistentpropertyname");
+ stringTypeHasOwnProperty = !typeObj.stringProperty.hasOwnProperty("nonexistentpropertyname");
+ listTypeHasOwnProperty = !typeObj.listProperty.hasOwnProperty("nonexistentpropertyname");
+ listAtValidHasOwnProperty = !typeObj.listProperty[0].hasOwnProperty("nonexistentpropertyname");
+ emptyListTypeHasOwnProperty = !typeObj.emptyListProperty.hasOwnProperty("nonexistentpropertyname");
+ enumTypeHasOwnProperty = !MyTypeObject.EnumVal1.hasOwnProperty("nonexistentpropertyname");
+ typenameHasOwnProperty = !MyTypeObject.hasOwnProperty("nonexistentpropertyname");
+ typenameHasOwnProperty2 = MyTypeObject.hasOwnProperty("EnumVal1"); // should be true.
+ singletonTypeTypeHasOwnProperty = !QtTestQObjectApi.QObject.hasOwnProperty("nonexistentpropertyname");
+ singletonTypePropertyTypeHasOwnProperty = !QtTestQObjectApi.QObject.qobjectTestProperty.hasOwnProperty("nonexistentpropertyname");
+ }
+
+ property bool enumNonValueHasOwnProperty
+ function testHasOwnPropertyFailureOne() {
+ enumNonValueHasOwnProperty = !MyTypeObject.NonexistentEnumVal.hasOwnProperty("nonexistentpropertyname");
+ }
+
+ property bool singletonTypeNonPropertyHasOwnProperty
+ function testHasOwnPropertyFailureTwo() {
+ singletonTypeNonPropertyHasOwnProperty = !QtTestQObjectApi.QObject.someNonexistentProperty.hasOwnProperty("nonexistentpropertyname");
+ }
+
+ property bool listAtInvalidHasOwnProperty
+ function testHasOwnPropertyFailureThree() {
+ listAtInvalidHasOwnProperty = !typeObj.listProperty[5].hasOwnProperty("nonexistentpropertyname");
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qmlToString.qml b/tests/auto/qml/qqmlecmascript/data/qmlToString.qml
new file mode 100644
index 0000000000..ac296ce293
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qmlToString.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+
+MyQmlObject{
+ id: obj
+ objectName: "objName"
+ function testToString()
+ {
+ obj.stringProperty = obj.toString();
+ }
+
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qobjectConnectionListExceptionHandling.qml b/tests/auto/qml/qqmlecmascript/data/qobjectConnectionListExceptionHandling.qml
new file mode 100644
index 0000000000..acd512a2be
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qobjectConnectionListExceptionHandling.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int first: 5
+ property bool test: false
+
+ Item {
+ id: exceptional
+ function exceptionalFunction() {
+ var obj = undefined;
+ var prop = undefined;
+ return obj[prop];
+ }
+ }
+
+ Component.onCompleted: {
+ root["firstChanged"].connect(exceptional.exceptionalFunction);
+ root["firstChanged"].connect(exceptional.exceptionalFunction);
+ root["firstChanged"].connect(exceptional.exceptionalFunction);
+ first = 6;
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qobjectDerivedArgument.qml b/tests/auto/qml/qqmlecmascript/data/qobjectDerivedArgument.qml
new file mode 100644
index 0000000000..bf4ab6fd7a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qobjectDerivedArgument.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+ stringProperty: 'hello'
+ property var child
+
+ property bool result: false
+
+ Component.onCompleted: {
+ child = invokable.createMyQmlObject('goodbye');
+
+ result = (invokable.getStringProperty(root) == 'hello') &&
+ (invokable.getStringProperty(child) == 'goodbye');
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.2.qml b/tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.2.qml
new file mode 100644
index 0000000000..19222712cd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ id: test
+ property bool testConditionsMet: false
+ Component.onCompleted: {
+ var c = Qt.createComponent("QQmlDataDestroyedComponent2Derived.qml")
+ c.createObject(test); // Cpp ownership, but it will be a RootObjectInCreation until finished beginCreate.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.qml b/tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.qml
new file mode 100644
index 0000000000..84308ec46e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qqmldataDestroyed.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Item {
+ Component.onCompleted: {
+ var c = Qt.createComponent("QQmlDataDestroyedComponent.qml")
+ var o = c.createObject(null); // JS ownership
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_10696.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_10696.qml
new file mode 100644
index 0000000000..90263e5124
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_10696.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+QtObject {
+ property string test: "aaaa"
+ + "bbbb"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc"
+ + "cccc";
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_11600.js b/tests/auto/qml/qqmlecmascript/data/qtbug_11600.js
new file mode 100644
index 0000000000..092bc2b041
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_11600.js
@@ -0,0 +1 @@
+;
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_11600.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_11600.qml
new file mode 100644
index 0000000000..6c7e8806e6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_11600.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import "qtbug_11600.js" as Test
+
+QtObject {
+ id: goo
+
+ property bool test: undefined == goo.Test
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_11606.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_11606.qml
new file mode 100644
index 0000000000..b1b062ed35
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_11606.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+ Component.onCompleted: {
+ try {
+ console.log(sorryNoSuchProperty);
+ } catch (e) {
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_20344.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_20344.qml
new file mode 100644
index 0000000000..f490848caf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_20344.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ Component.onCompleted: v8function()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_21580.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_21580.qml
new file mode 100644
index 0000000000..dc0066ba3f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_21580.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+
+ property list<QtObject> objects: [
+ QtObject {
+ id: first
+ property alias myAlias: other.myProperty
+ onMyAliasChanged: if (myAlias == 20) test = true
+ },
+ QtObject {
+ id: other
+ property real myProperty
+ }
+ ]
+
+ Component.onCompleted: {
+ other.myProperty = 20;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_21864.js b/tests/auto/qml/qqmlecmascript/data/qtbug_21864.js
new file mode 100644
index 0000000000..e1a688ebbe
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_21864.js
@@ -0,0 +1,2 @@
+var a = { b: 10 }
+var test = (typeof a) == "object"
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_21864.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_21864.qml
new file mode 100644
index 0000000000..0f972d5459
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_21864.qml
@@ -0,0 +1,6 @@
+import "qtbug_21864.js" as Test
+import QtQuick 2.0
+
+QtObject {
+ property bool test: Test.test
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_22464.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_22464.qml
new file mode 100644
index 0000000000..19f26736f1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_22464.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+QtObject {
+ property alias value: inner.value
+ property bool test: false
+
+ property variant dummy: QtObject {
+ id: inner
+ property variant value: Qt.rgba(1, 1, 0, 1);
+ }
+
+ Component.onCompleted: {
+ test = (value == Qt.rgba(1, 1, 0, 1));
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_22679.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_22679.qml
new file mode 100644
index 0000000000..b38a84b4c0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_22679.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ function accessContextProperty() {
+ for (var i = 0; i < contextProp.stringProperty.length; ++i) ;
+ }
+
+ Component.onCompleted: {
+ for (var i = 0; i < 1000; ++i)
+ accessContextProperty();
+ // Shouldn't cause "Illegal invocation" error.
+ gc();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_22843.js b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.js
new file mode 100644
index 0000000000..6d19fe0571
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.js
@@ -0,0 +1,5 @@
+
+function func()
+{
+ isFinite() )
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.js b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.js
new file mode 100644
index 0000000000..1a7c8a2e6e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.js
@@ -0,0 +1,5 @@
+.pragma library
+function func()
+{
+ isFinite() )
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.qml
new file mode 100644
index 0000000000..281765bff6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.qml
@@ -0,0 +1,6 @@
+import "qtbug_22843.library.js" as MyScript
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: MyScript.func()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_22843.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.qml
new file mode 100644
index 0000000000..90a47c0f4b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_22843.qml
@@ -0,0 +1,6 @@
+import "qtbug_22843.js" as MyScript
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: MyScript.func()
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_24448.js b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.js
new file mode 100644
index 0000000000..eefe00337c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.js
@@ -0,0 +1,6 @@
+var test = false;
+try {
+ eval(foo);
+} catch (e) {
+ test = (typeof foo) === "undefined";
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml
new file mode 100644
index 0000000000..d8d305d104
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_24448.qml
@@ -0,0 +1,7 @@
+import "qtbug_24448.js" as Test
+import QtQuick 2.0
+
+QtObject {
+ property bool test: Test.test
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_9792.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_9792.qml
new file mode 100644
index 0000000000..9ac44308c6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_9792.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onBasicSignal: print("Hello world!");
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/qtcreatorbug_1289.qml b/tests/auto/qml/qqmlecmascript/data/qtcreatorbug_1289.qml
new file mode 100644
index 0000000000..90711c8d09
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtcreatorbug_1289.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ property QtObject object: QtObject {
+ id: nested
+ property QtObject nestedObject
+ }
+
+ Component.onCompleted: {
+ nested.nestedObject = root;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/readonlyDeclaration.qml b/tests/auto/qml/qqmlecmascript/data/readonlyDeclaration.qml
new file mode 100644
index 0000000000..5377d2dcbf
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/readonlyDeclaration.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+QtObject {
+ property int dummy: 13
+
+ readonly property int test1: 19
+ readonly property int test2: dummy * 49
+ readonly property alias test3: other.test
+
+ property bool test: false
+
+ property var dummyObj: QtObject {
+ id: other
+ property int test: 9
+ }
+
+ Component.onCompleted: {
+ if (test1 != 19) return;
+ if (test2 != 637) return;
+ if (test3 != 9) return;
+
+ var caught = false;
+
+ caught = false;
+ try { test1 = 13 } catch (e) { caught = true; }
+ if (!caught) return;
+
+ caught = false;
+ try { test2 = 13 } catch (e) { caught = true; }
+ if (!caught) return;
+
+ caught = false;
+ try { test3 = 13 } catch (e) { caught = true; }
+ if (!caught) return;
+
+ other.test = 13;
+ dummy = 9;
+
+ if (test1 != 19) return;
+ if (test2 != 441) return;
+ if (test3 != 13) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/realToInt.qml b/tests/auto/qml/qqmlecmascript/data/realToInt.qml
new file mode 100644
index 0000000000..a9e7dd2a95
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/realToInt.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ function test1() {
+ value = 4.2
+ }
+ function test2() {
+ value = 7.9
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml b/tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml
new file mode 100644
index 0000000000..524478887e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml
@@ -0,0 +1,22 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property real test: 1234567890
+ property real test2
+ property real test3
+ property real test4: test3
+ property real test5: func()
+ property real test6: test2 + test3
+
+ signal sig(real arg)
+
+ Component.onCompleted: {
+ test2 = 1234567890;
+ sig(1234567890)
+ }
+
+ onSig: { test3 = arg; }
+
+ function func() { return 1234567890; }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/regExp.2.qml b/tests/auto/qml/qqmlecmascript/data/regExp.2.qml
new file mode 100644
index 0000000000..68cca5733b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/regExp.2.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+MyQmlObject{
+ id: obj
+ objectName: "obj"
+ regExp: "[a-zA-z]"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/regExp.qml b/tests/auto/qml/qqmlecmascript/data/regExp.qml
new file mode 100644
index 0000000000..0dc404b5db
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/regExp.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+MyQmlObject{
+ id: obj
+ objectName: "obj"
+ regExp: /[a-zA-z]/
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/registeredFlagMethod.qml b/tests/auto/qml/qqmlecmascript/data/registeredFlagMethod.qml
new file mode 100644
index 0000000000..b323b49662
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/registeredFlagMethod.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onBasicSignal: registeredFlagMethod(Qt.RightButton)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/ScriptAPI.js b/tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/ScriptAPI.js
new file mode 100644
index 0000000000..b90033eeb4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/ScriptAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 0
+
+function greeting() { return "Hello" }
+
diff --git a/tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/qmldir b/tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/qmldir
new file mode 100644
index 0000000000..c33d1e7a0d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/remote/com/nokia/JsRemoteModule/qmldir
@@ -0,0 +1 @@
+ScriptAPI 1.0 ScriptAPI.js
diff --git a/tests/auto/qml/qqmlecmascript/data/remote_file.js b/tests/auto/qml/qqmlecmascript/data/remote_file.js
new file mode 100644
index 0000000000..1b123aee61
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/remote_file.js
@@ -0,0 +1,2 @@
+myvar = 13;
+test5 = true;
diff --git a/tests/auto/qml/qqmlecmascript/data/replaceBinding.qml b/tests/auto/qml/qqmlecmascript/data/replaceBinding.qml
new file mode 100644
index 0000000000..670231a144
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/replaceBinding.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+OuterObject {
+ property bool success: false
+
+ inner.foo1: 200
+ inner.foo2: { return 200; }
+ inner.foo3: 200
+ inner.foo4: { return 200; }
+
+ inner.bar1: 'Goodbye'
+ inner.bar2: { return 'Goodbye' }
+ inner.bar3: 'Goodbye'
+ inner.bar4: { return 'Goodbye' }
+
+ Component.onCompleted: {
+ success = (inner.foo1 == 200 &&
+ inner.foo2 == 200 &&
+ inner.foo3 == 200 &&
+ inner.foo4 == 200 &&
+ inner.bar1 == 'Goodbye' &&
+ inner.bar2 == 'Goodbye' &&
+ inner.bar3 == 'Goodbye' &&
+ inner.bar4 == 'Goodbye');
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings.qml b/tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings.qml
new file mode 100644
index 0000000000..1ae1b162b2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Item {
+ id: root;
+ property bool test: str == str2 && (txt != null && txt.str == root.str)
+ property Text txt: null
+ //Constant doesn't hit rewriter
+ property string str: 'same
+multiline
+string 5 !'
+ property string str2: '';
+ Component {
+ id: comp
+ Text {
+ property var value: 1
+ property string str: 'same
+multiline
+string ' + value + " !"
+ Component.onCompleted: { //Separate codepath for signal handers in rewriter
+ root.str2 = 'same
+multiline
+string ' + value + " !"
+ }
+ }
+ }
+ Component.onCompleted: txt = comp.createObject(root,{"value" : 5})
+ /*
+ Timer {
+ interval: 1000
+ running: true
+ repeat: true
+ onTriggered: console.debug( "Test: " + test + '\n' + str + '\n:\n' + str2 + "\n:\n" + txt.str)
+ }
+ */
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings_crlf.1.qml b/tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings_crlf.1.qml
new file mode 100644
index 0000000000..f84ba8c722
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/rewriteMultiLineStrings_crlf.1.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ Component.onCompleted: {
+ var o = Qt.createQmlObject("import QtQuick 2.0; \
+ \
+ Item { \
+ property bool b: true; \
+ }", root, "Instance")
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.var.qml
new file mode 100644
index 0000000000..805655fc17
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.var.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// Here we import a scarce resource directly.
+// The instance has a property which is a copy
+// of the scarce resource, so it should not be
+// detached (but we should automatically release
+// the resource from our engine internal list).
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property var scarceResourceCopy: scarceResourceProvider.scarceResource
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.variant.qml
new file mode 100644
index 0000000000..ee5b05b28a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopy.variant.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// Here we import a scarce resource directly.
+// The instance has a property which is a copy
+// of the scarce resource, so it should not be
+// detached (but we should automatically release
+// the resource from our engine internal list).
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property variant scarceResourceCopy: scarceResourceProvider.scarceResource
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.var.qml
new file mode 100644
index 0000000000..09868e5e7c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.var.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.var.js" as ScarceResourceProviderJs
+
+// Here we import a scarce resource directly, from JS module.
+// It is not preserved or released manually, so it should be
+// automatically released once evaluation of the binding
+// is complete.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property var scarceResourceCopy: ScarceResourceProviderJs.importScarceResource(scarceResourceProvider)
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.variant.qml
new file mode 100644
index 0000000000..a1ebeb4073
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyFromJs.variant.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.variant.js" as ScarceResourceProviderJs
+
+// Here we import a scarce resource directly, from JS module.
+// It is not preserved or released manually, so it should be
+// automatically released once evaluation of the binding
+// is complete.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property variant scarceResourceCopy: ScarceResourceProviderJs.importScarceResource(scarceResourceProvider)
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.js
new file mode 100644
index 0000000000..468a6b4f2e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.js
@@ -0,0 +1,25 @@
+.import Qt.test 1.0 as JsQtTest
+
+// In this case, the "retn" variable will be evaluated during import.
+// Since the "importScarceResource()" function depends on this variable,
+// we must explicitly preserve the "retn" variable or the scarce
+// resource would automatically be released after import completes
+// but before the binding is evaluated.
+
+var component = Qt.createComponent("scarceResourceCopy.var.qml");
+var scarceResourceElement = component.createObject(null);
+var scarceResourceProvider = scarceResourceElement.a;
+var retn = scarceResourceProvider.scarceResource;
+retn.preserve(); // must preserve manually or it will be released!
+
+function importScarceResource() {
+ // if called prior to calling destroyScarceResource(),
+ // this function should return the preserved scarce resource.
+ // otherwise, it should return an invalid variant.
+ return retn;
+}
+
+function destroyScarceResource() {
+ retn.destroy();
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.qml
new file mode 100644
index 0000000000..9321481f45
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.var.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceCopyImport.var.js" as ScarceResourceCopyImportJs
+
+QtObject {
+ // this binding is evaluated once, prior to the resource being released
+ property var scarceResourceImportedCopy: ScarceResourceCopyImportJs.importScarceResource()
+
+ property bool arePropertiesEqual
+ property var scarceResourceAssignedCopyOne;
+ property var scarceResourceAssignedCopyTwo;
+ Component.onCompleted: {
+ scarceResourceAssignedCopyOne = ScarceResourceCopyImportJs.importScarceResource();
+ arePropertiesEqual = (scarceResourceAssignedCopyOne == scarceResourceImportedCopy);
+ ScarceResourceCopyImportJs.destroyScarceResource(); // makes all properties invalid.
+ scarceResourceAssignedCopyTwo = ScarceResourceCopyImportJs.importScarceResource();
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.js
new file mode 100644
index 0000000000..9aeb507487
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.js
@@ -0,0 +1,25 @@
+.import Qt.test 1.0 as JsQtTest
+
+// In this case, the "retn" variable will be evaluated during import.
+// Since the "importScarceResource()" function depends on this variable,
+// we must explicitly preserve the "retn" variable or the scarce
+// resource would automatically be released after import completes
+// but before the binding is evaluated.
+
+var component = Qt.createComponent("scarceResourceCopy.variant.qml");
+var scarceResourceElement = component.createObject(null);
+var scarceResourceProvider = scarceResourceElement.a;
+var retn = scarceResourceProvider.scarceResource;
+retn.preserve(); // must preserve manually or it will be released!
+
+function importScarceResource() {
+ // if called prior to calling destroyScarceResource(),
+ // this function should return the preserved scarce resource.
+ // otherwise, it should return an invalid variant.
+ return retn;
+}
+
+function destroyScarceResource() {
+ retn.destroy();
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.qml
new file mode 100644
index 0000000000..e8b53979dd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImport.variant.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceCopyImport.variant.js" as ScarceResourceCopyImportJs
+
+QtObject {
+ // this binding is evaluated once, prior to the resource being released
+ property variant scarceResourceImportedCopy: ScarceResourceCopyImportJs.importScarceResource()
+
+ // this code is evaluated on completion, and so copy one should be valid, copy two invalid.
+ property variant scarceResourceAssignedCopyOne;
+ property variant scarceResourceAssignedCopyTwo;
+ Component.onCompleted: {
+ scarceResourceAssignedCopyOne = ScarceResourceCopyImportJs.importScarceResource();
+ ScarceResourceCopyImportJs.destroyScarceResource();
+ scarceResourceAssignedCopyTwo = ScarceResourceCopyImportJs.importScarceResource();
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.js
new file mode 100644
index 0000000000..000eeddb34
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.js
@@ -0,0 +1,19 @@
+.import Qt.test 1.0 as JsQtTest
+
+// In this case, we create the returned scarce resource each call,
+// so the object will be different every time it is returned.
+
+var mostRecent
+
+function importScarceResource() {
+ var component = Qt.createComponent("scarceResourceCopy.var.qml");
+ var scarceResourceElement = component.createObject(null);
+ var scarceResourceProvider = scarceResourceElement.a;
+ var retn = scarceResourceProvider.scarceResource;
+ mostRecent = retn;
+ return retn;
+}
+
+function destroyScarceResource() {
+ mostRecent.destroy();
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.qml
new file mode 100644
index 0000000000..082d132c24
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportDifferent.var.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceCopyImportDifferent.var.js" as ScarceResourceCopyImportJs
+
+// in this case, the ScarceResourceCopyImportJs returns a _new_, different
+// scarce resource each time. Invalidating one will not invalidate the others.
+
+QtObject {
+ // this binding is evaluated once, prior to the resource being released
+ property var scarceResourceImportedCopy: ScarceResourceCopyImportJs.importScarceResource()
+
+ // the following properties are assigned on component completion.
+ property bool arePropertiesEqual
+ property var scarceResourceAssignedCopyOne;
+ property var scarceResourceAssignedCopyTwo;
+ Component.onCompleted: {
+ scarceResourceAssignedCopyOne = ScarceResourceCopyImportJs.importScarceResource();
+ arePropertiesEqual = (scarceResourceAssignedCopyOne != scarceResourceImportedCopy); // they're not the same object.
+ ScarceResourceCopyImportJs.destroyScarceResource(); // makes the MOST RECENT resource invalid (ie, assignedCopyOne).
+ scarceResourceAssignedCopyTwo = ScarceResourceCopyImportJs.importScarceResource();
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.js
new file mode 100644
index 0000000000..ba52b323f0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.js
@@ -0,0 +1,19 @@
+.import Qt.test 1.0 as JsQtTest
+
+// In this case, the "retn" variable will be evaluated during import.
+// Since the importScarceResource() function depends on this variable,
+// because we DO NOT call "retn.preserve()", the scarce resource will
+// be released after the import completes but prior to evaluation of
+// any binding which calls "importScarceResource()".
+// Thus, "importScarceResource()" will return a released (invalid)
+// scarce resource.
+
+var component = Qt.createComponent("scarceResourceCopy.var.qml");
+var scarceResourceElement = component.createObject(null);
+var scarceResourceProvider = scarceResourceElement.a;
+var retn = scarceResourceProvider.scarceResource;
+
+function importScarceResource() {
+ return retn; // should return a released (invalid) scarce resource
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.qml
new file mode 100644
index 0000000000..a1a3c1d66f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.var.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceCopyImportFail.var.js" as ScarceResourceCopyImportFailJs
+
+QtObject {
+ property var scarceResourceCopy: ScarceResourceCopyImportFailJs.importScarceResource()
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.js
new file mode 100644
index 0000000000..b59b5b1fa9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.js
@@ -0,0 +1,19 @@
+.import Qt.test 1.0 as JsQtTest
+
+// In this case, the "retn" variable will be evaluated during import.
+// Since the importScarceResource() function depends on this variable,
+// because we DO NOT call "retn.preserve()", the scarce resource will
+// be released after the import completes but prior to evaluation of
+// any binding which calls "importScarceResource()".
+// Thus, "importScarceResource()" will return a released (invalid)
+// scarce resource.
+
+var component = Qt.createComponent("scarceResourceCopy.variant.qml");
+var scarceResourceElement = component.createObject(null);
+var scarceResourceProvider = scarceResourceElement.a;
+var retn = scarceResourceProvider.scarceResource;
+
+function importScarceResource() {
+ return retn; // should return a released (invalid) scarce resource
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.qml
new file mode 100644
index 0000000000..8f6dcd6603
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportFail.variant.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceCopyImportFail.variant.js" as ScarceResourceCopyImportFailJs
+
+QtObject {
+ property variant scarceResourceCopy: ScarceResourceCopyImportFailJs.importScarceResource()
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.js
new file mode 100644
index 0000000000..130199f78a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.js
@@ -0,0 +1,15 @@
+.import Qt.test 1.0 as JsQtTest
+
+// In this case, the "retn" variable will be evaluated during import.
+// Since the importScarceResource() function depends on this variable,
+// because we DO NOT call "retn.preserve()", the scarce resource will
+// be released after the import completes but prior to evaluation of
+// any binding which calls "importScarceResource()".
+// Thus, "importScarceResource()" will return a released (invalid)
+// scarce resource.
+
+var component = Qt.createComponent("scarceResourceCopyNoBinding.var.qml");
+var scarceResourceElement = component.createObject(null);
+var scarceResourceProvider = scarceResourceElement.a;
+var retn = scarceResourceProvider.scarceResource;
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.qml
new file mode 100644
index 0000000000..5284b40cc8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.var.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// the following js import doesn't manually preserve or destroy any resources
+import "scarceResourceCopyImportNoBinding.var.js" as ScarceResourceCopyImportNoBindingJs
+
+QtObject {
+ // in this case, there is an import but no binding evaluated.
+ // nonetheless, any resources which are not preserved, should
+ // be automatically released by the engine.
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.js
new file mode 100644
index 0000000000..14a36a19ea
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.js
@@ -0,0 +1,15 @@
+.import Qt.test 1.0 as JsQtTest
+
+// In this case, the "retn" variable will be evaluated during import.
+// Since the importScarceResource() function depends on this variable,
+// because we DO NOT call "retn.preserve()", the scarce resource will
+// be released after the import completes but prior to evaluation of
+// any binding which calls "importScarceResource()".
+// Thus, "importScarceResource()" will return a released (invalid)
+// scarce resource.
+
+var component = Qt.createComponent("scarceResourceCopyNoBinding.variant.qml");
+var scarceResourceElement = component.createObject(null);
+var scarceResourceProvider = scarceResourceElement.a;
+var retn = scarceResourceProvider.scarceResource;
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.qml
new file mode 100644
index 0000000000..826cbe49fc
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyImportNoBinding.variant.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// the following js import doesn't manually preserve or destroy any resources
+import "scarceResourceCopyImportNoBinding.variant.js" as ScarceResourceCopyImportNoBindingJs
+
+QtObject {
+ // in this case, there is an import but no binding evaluated.
+ // nonetheless, any resources which are not preserved, should
+ // be automatically released by the engine.
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.var.qml
new file mode 100644
index 0000000000..4adef39980
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.var.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ // this component doesn't bind any property to a scarce
+ // resource from the scarce resource provider,
+ // so the binding evaluation resource cleanup
+ // codepath shouldn't be activated; so if the resources
+ // are released, it will be due to the import evaluation
+ // resource cleanup codepath being activated correctly.
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.variant.qml
new file mode 100644
index 0000000000..4adef39980
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceCopyNoBinding.variant.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ // this component doesn't bind any property to a scarce
+ // resource from the scarce resource provider,
+ // so the binding evaluation resource cleanup
+ // codepath shouldn't be activated; so if the resources
+ // are released, it will be due to the import evaluation
+ // resource cleanup codepath being activated correctly.
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.var.qml
new file mode 100644
index 0000000000..500f5d5bd7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.var.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.var.js" as ScarceResourceProviderJs
+
+// In this case, following the evaluation of the binding,
+// the scarceResourceTest value should be an invalid variant,
+// since the scarce resource will have been released.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property var scarceResourceCopy: ScarceResourceProviderJs.importReleasedScarceResource(scarceResourceProvider);
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.variant.qml
new file mode 100644
index 0000000000..7a3b845247
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceDestroyedCopy.variant.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.variant.js" as ScarceResourceProviderJs
+
+// In this case, following the evaluation of the binding,
+// the scarceResourceTest value should be an invalid variant,
+// since the scarce resource will have been released.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property variant scarceResourceCopy: ScarceResourceProviderJs.importReleasedScarceResource(scarceResourceProvider);
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.var.qml
new file mode 100644
index 0000000000..23e4c8d15e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.var.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// Here we import a scarce resource directly.
+// The copy is only assigned when retrieveScarceResource()
+// is called, and so should be detached prior to that.
+// The copy should be released when releaseScarceResource()
+// is called, and so should be detached after that.
+
+QtObject {
+ id: root
+ property MyScarceResourceObject a: MyScarceResourceObject { id: scarceResourceProvider }
+ property var scarceResourceCopy;
+
+ function retrieveScarceResource() {
+ root.scarceResourceCopy = scarceResourceProvider.scarceResource;
+ }
+
+ function releaseScarceResource() {
+ root.scarceResourceCopy = null;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.variant.qml
new file mode 100644
index 0000000000..fe3707b5d3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunction.variant.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// Here we import a scarce resource directly.
+// The copy is only assigned when retrieveScarceResource()
+// is called, and so should be detached prior to that.
+// The copy should be released when releaseScarceResource()
+// is called, and so should be detached after that.
+
+QtObject {
+ id: root
+ property MyScarceResourceObject a: MyScarceResourceObject { id: scarceResourceProvider }
+ property variant scarceResourceCopy;
+
+ function retrieveScarceResource() {
+ root.scarceResourceCopy = scarceResourceProvider.scarceResource;
+ }
+
+ function releaseScarceResource() {
+ root.scarceResourceCopy = null;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.var.qml
new file mode 100644
index 0000000000..9b4b1e6fd9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.var.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// In this example, a common syntax error will only be "caught"
+// when the function is called via:
+// QQmlVMEMetaObject::metaCall->invokeMetaMethod()
+// We would like to ensure that a useful error message is printed.
+
+QtObject {
+ id: root
+ property MyScarceResourceObject a: MyScarceResourceObject { id: scarceResourceProvider }
+ property var scarceResourceCopy;
+ property string srp_name: a.toString();
+
+ function retrieveScarceResource() {
+ root.scarceResourceCopy = scarceResourceProvider.scarceResource(); // common syntax error, should throw exception
+ }
+
+ function releaseScarceResource() {
+ root.scarceResourceCopy = null;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.variant.qml
new file mode 100644
index 0000000000..57673de3f3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceFunctionFail.variant.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// In this example, a common syntax error will only be "caught"
+// when the function is called via:
+// QQmlVMEMetaObject::metaCall->invokeMetaMethod()
+// We would like to ensure that a useful error message is printed.
+
+QtObject {
+ id: root
+ property MyScarceResourceObject a: MyScarceResourceObject { id: scarceResourceProvider }
+ property variant scarceResourceCopy;
+ property string srp_name: a.toString();
+
+ function retrieveScarceResource() {
+ root.scarceResourceCopy = scarceResourceProvider.scarceResource(); // common syntax error, should throw exception
+ }
+
+ function releaseScarceResource() {
+ root.scarceResourceCopy = null;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.js
new file mode 100644
index 0000000000..217f693456
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.js
@@ -0,0 +1,14 @@
+.import Qt.test 1.0 as JsQtTest
+
+function importScarceResource() {
+ var component = Qt.createComponent("scarceResourceCopy.var.qml");
+ var scarceResourceElement = component.createObject(null);
+ var scarceResourceProvider = scarceResourceElement.a;
+ var retn = scarceResourceProvider.scarceResource;
+ retn.preserve();
+ return retn;
+}
+
+function releaseScarceResource(resource) {
+ resource.destroy();
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.qml
new file mode 100644
index 0000000000..205131661f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleDifferentNoBinding.var.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceMultipleDifferentNoBinding.var.js" as ScarceResourcesMultipleDifferentNoBinding
+
+QtObject {
+ property var resourceOne
+ property var resourceTwo
+
+ Component.onCompleted: {
+ resourceOne = ScarceResourcesMultipleDifferentNoBinding.importScarceResource();
+ resourceTwo = ScarceResourcesMultipleDifferentNoBinding.importScarceResource();
+ ScarceResourcesMultipleDifferentNoBinding.releaseScarceResource(resourceTwo);
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.js
new file mode 100644
index 0000000000..5b2494c8e6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.js
@@ -0,0 +1,15 @@
+.import Qt.test 1.0 as JsQtTest
+
+var component = Qt.createComponent("scarceResourceCopy.var.qml");
+var scarceResourceElement = component.createObject(null);
+var scarceResourceProvider = scarceResourceElement.a;
+var retn = scarceResourceProvider.scarceResource;
+retn.preserve();
+
+function importScarceResource() {
+ return retn;
+}
+
+function releaseScarceResource(resource) {
+ resource.destroy();
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.qml
new file mode 100644
index 0000000000..e7f6d7868f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameNoBinding.var.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceMultipleSameNoBinding.var.js" as ScarceResourcesMultipleSameNoBinding
+
+QtObject {
+ property var resourceOne
+ property var resourceTwo
+
+ Component.onCompleted: {
+ resourceOne = ScarceResourcesMultipleSameNoBinding.importScarceResource();
+ resourceTwo = ScarceResourcesMultipleSameNoBinding.importScarceResource();
+ ScarceResourcesMultipleSameNoBinding.releaseScarceResource(resourceTwo);
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameWithBinding.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameWithBinding.var.qml
new file mode 100644
index 0000000000..34cb97f39c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceMultipleSameWithBinding.var.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceMultipleDifferentNoBinding.var.js" as ScarceResourcesMultipleDifferentNoBinding
+
+QtObject {
+ property var resourceOne: ScarceResourcesMultipleDifferentNoBinding.importScarceResource()
+ property var resourceTwo: resourceOne
+
+ Component.onCompleted: {
+ ScarceResourcesMultipleDifferentNoBinding.releaseScarceResource(resourceTwo);
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceObjectGc.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceObjectGc.var.qml
new file mode 100644
index 0000000000..7ec98e6619
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceObjectGc.var.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: testScarce
+
+ property var varProperty
+
+ property var canary: 4
+
+ // constructs an Item which contains a scarce resource.
+ function constructScarceObject() {
+ var retn = 1;
+ var component = Qt.createComponent("ScarceResourceVarComponent.qml");
+ if (component.status == Component.Ready) {
+ retn = component.createObject(null); // has JavaScript ownership
+ }
+ return retn;
+ }
+
+ function assignVarProperty() {
+ varProperty = constructScarceObject();
+ gc();
+ }
+
+ function deassignVarProperty() {
+ varProperty = 2; // causes the original object to be garbage collected.
+ gc(); // image should be detached; ep->sr should be empty!
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.var.qml
new file mode 100644
index 0000000000..0b30e88fa8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.var.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ id: root
+
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+
+ property ScarceResourceSignalComponentVar b;
+ b: ScarceResourceSignalComponentVar {
+ objectName: "srsc"
+
+ onTestSignal: {
+ // this signal will be invoked manually in the test.
+ // the scarce resource should be released automatically after evaluation
+ // and since we don't keep a copy of it, the pixmap will be detached.
+ width = (scarceResourceProvider.scarceResource,10)
+ }
+
+ onTestSignal2: {
+ // this signal will be invoked manually in the test.
+ // the scarce resource should be released automatically after evaluation
+ // but since we assign it to a property, the pixmap won't be detached.
+ scarceResourceCopy = scarceResourceProvider.scarceResource
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.variant.qml
new file mode 100644
index 0000000000..1011c7e240
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceSignal.variant.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ id: root
+
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+
+ property ScarceResourceSignalComponentVariant b;
+ b: ScarceResourceSignalComponentVariant {
+ objectName: "srsc"
+
+ onTestSignal: {
+ // this signal will be invoked manually in the test.
+ // the scarce resource should be released automatically after evaluation
+ // and since we don't keep a copy of it, the pixmap will be detached.
+ width = (scarceResourceProvider.scarceResource,10)
+ }
+
+ onTestSignal2: {
+ // this signal will be invoked manually in the test.
+ // the scarce resource should be released automatically after evaluation
+ // but since we assign it to a property, the pixmap won't be detached.
+ scarceResourceCopy = scarceResourceProvider.scarceResource
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.js
new file mode 100644
index 0000000000..c904eb3564
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.js
@@ -0,0 +1,48 @@
+.import Qt.test 1.0 as JsQtTest
+
+function importScarceResource(scarceResourceProvider) {
+ // the scarce resource should be automatically released
+ // after the binding is evaluated if preserve is not
+ // called.
+ return scarceResourceProvider.scarceResource;
+}
+
+function importPreservedScarceResource(scarceResourceProvider) {
+ // the scarce resource is manually preserved
+ // during the evaluation of the binding.
+ // it should not be released.
+ var scarceResource = scarceResourceProvider.scarceResource;
+ scarceResource.preserve();
+ return scarceResource;
+}
+
+function importReleasedScarceResource(scarceResourceProvider) {
+ // release the scarce resource during the
+ // evaluation of the binding. The returned
+ // variant will therefore be invalid.
+ var scarceResource = scarceResourceProvider.scarceResource;
+ scarceResource.destroy();
+ return scarceResource;
+}
+
+function importPreservedScarceResourceFromMultiple(scarceResourceProvider) {
+ // some scarce resources are manually preserved,
+ // some of them are manually destroyed,
+ // and some are automatically managed.
+ // We return a preserved resource
+ var sr1 = scarceResourceProvider.scarceResource; // preserved/destroyed.
+ sr1.preserve();
+ var sr2 = scarceResourceProvider.scarceResource; // preserved/destroyed
+ sr2.preserve();
+ var sr3 = scarceResourceProvider.scarceResource; // automatic.
+ var sr4 = scarceResourceProvider.scarceResource; // automatic and returned.
+ var sr5 = scarceResourceProvider.scarceResource; // destroyed
+ sr5.destroy();
+ sr2.destroy();
+ var sr6 = scarceResourceProvider.scarceResource; // destroyed
+ var sr7 = scarceResourceProvider.scarceResource; // automatic
+ sr1.destroy();
+ sr6.destroy();
+ return sr4;
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.qml
new file mode 100644
index 0000000000..1d4e67055e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.var.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// Here we import a scarce resource directly, and use it in a binding.
+// It is not preserved or released manually, so it should be
+// automatically released once evaluation of the binding
+// is complete.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property int scarceResourceTest: scarceResourceProvider.scarceResource,100 // return 100, but include the scarceResource in the binding to be evaluated.
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.js b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.js
new file mode 100644
index 0000000000..c904eb3564
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.js
@@ -0,0 +1,48 @@
+.import Qt.test 1.0 as JsQtTest
+
+function importScarceResource(scarceResourceProvider) {
+ // the scarce resource should be automatically released
+ // after the binding is evaluated if preserve is not
+ // called.
+ return scarceResourceProvider.scarceResource;
+}
+
+function importPreservedScarceResource(scarceResourceProvider) {
+ // the scarce resource is manually preserved
+ // during the evaluation of the binding.
+ // it should not be released.
+ var scarceResource = scarceResourceProvider.scarceResource;
+ scarceResource.preserve();
+ return scarceResource;
+}
+
+function importReleasedScarceResource(scarceResourceProvider) {
+ // release the scarce resource during the
+ // evaluation of the binding. The returned
+ // variant will therefore be invalid.
+ var scarceResource = scarceResourceProvider.scarceResource;
+ scarceResource.destroy();
+ return scarceResource;
+}
+
+function importPreservedScarceResourceFromMultiple(scarceResourceProvider) {
+ // some scarce resources are manually preserved,
+ // some of them are manually destroyed,
+ // and some are automatically managed.
+ // We return a preserved resource
+ var sr1 = scarceResourceProvider.scarceResource; // preserved/destroyed.
+ sr1.preserve();
+ var sr2 = scarceResourceProvider.scarceResource; // preserved/destroyed
+ sr2.preserve();
+ var sr3 = scarceResourceProvider.scarceResource; // automatic.
+ var sr4 = scarceResourceProvider.scarceResource; // automatic and returned.
+ var sr5 = scarceResourceProvider.scarceResource; // destroyed
+ sr5.destroy();
+ sr2.destroy();
+ var sr6 = scarceResourceProvider.scarceResource; // destroyed
+ var sr7 = scarceResourceProvider.scarceResource; // automatic
+ sr1.destroy();
+ sr6.destroy();
+ return sr4;
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.qml
new file mode 100644
index 0000000000..1d4e67055e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTest.variant.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+// Here we import a scarce resource directly, and use it in a binding.
+// It is not preserved or released manually, so it should be
+// automatically released once evaluation of the binding
+// is complete.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property int scarceResourceTest: scarceResourceProvider.scarceResource,100 // return 100, but include the scarceResource in the binding to be evaluated.
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.var.qml
new file mode 100644
index 0000000000..7b30b843f8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.var.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.var.js" as ScarceResourceProviderJs
+
+// In this case, multiple scarce resource are explicitly preserved
+// and then explicitly destroyed, while others are automatically
+// managed. Since none are manually preserved without subsequently
+// being destroyed, after the evaluation of the binding the
+// scarce resource should be detached.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property int scarceResourceTest: ScarceResourceProviderJs.importPreservedScarceResourceFromMultiple(scarceResourceProvider), 100
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.variant.qml
new file mode 100644
index 0000000000..4b9ff84146
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestMultiple.variant.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.variant.js" as ScarceResourceProviderJs
+
+// In this case, multiple scarce resource are explicitly preserved
+// and then explicitly destroyed, while others are automatically
+// managed. Since none are manually preserved without subsequently
+// being destroyed, after the evaluation of the binding the
+// scarce resource should be detached.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property int scarceResourceTest: ScarceResourceProviderJs.importPreservedScarceResourceFromMultiple(scarceResourceProvider), 100
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.var.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.var.qml
new file mode 100644
index 0000000000..786f38e666
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.var.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.var.js" as ScarceResourceProviderJs
+
+// In this case, the scarce resource is explicitly preserved.
+// It should not be automatically released after the evaluation
+// of the binding is complete, but instead will be kept in
+// memory until the JS garbage collector runs.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property int scarceResourceTest: ScarceResourceProviderJs.importPreservedScarceResource(scarceResourceProvider),100 // return 100, but the resource should be preserved.
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.variant.qml b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.variant.qml
new file mode 100644
index 0000000000..a27dab33cb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scarceResourceTestPreserve.variant.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test 1.0
+import "scarceResourceTest.variant.js" as ScarceResourceProviderJs
+
+// In this case, the scarce resource is explicitly preserved.
+// It should not be automatically released after the evaluation
+// of the binding is complete, but instead will be kept in
+// memory until the JS garbage collector runs.
+
+QtObject {
+ property MyScarceResourceObject a;
+ a: MyScarceResourceObject { id: scarceResourceProvider }
+ property int scarceResourceTest: ScarceResourceProviderJs.importPreservedScarceResource(scarceResourceProvider),100 // return 100, but the resource should be preserved.
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scope.2.qml b/tests/auto/qml/qqmlecmascript/data/scope.2.qml
new file mode 100644
index 0000000000..fe1c4c7931
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scope.2.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property int a: 0
+ property int b: 14
+
+ function b() { return 11; }
+ function c() { return 33; }
+
+ QtObject {
+ id: a
+ property int value: 19
+ }
+
+ QtObject {
+ id: c
+ property int value: 24
+ }
+
+ QtObject {
+ id: nested
+ property int a: 1
+ property int test: a.value
+ property int test2: b
+ property int test3: c.value
+ }
+
+
+ // id takes precedence over local, and root properties
+ property int test1: a.value
+ property alias test2: nested.test
+
+ // properties takes precedence over local, and root methods
+ property int test3: b
+ property alias test4: nested.test2
+
+ // id takes precedence over methods
+ property int test5: c.value
+ property alias test6: nested.test3
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scope.3.qml b/tests/auto/qml/qqmlecmascript/data/scope.3.qml
new file mode 100644
index 0000000000..9add81809c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scope.3.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: root
+
+ property int foo: 12
+
+ property bool test1: foo == 12
+ property bool test2: console != 11
+ property bool test3: root.console == 11
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scope.4.qml b/tests/auto/qml/qqmlecmascript/data/scope.4.qml
new file mode 100644
index 0000000000..d65b6e7c7c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scope.4.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: a
+ property int b: 9
+
+ property int test
+ property string test2
+
+ // Should resolve to signal arguments, not to other elements in the file
+ onArgumentSignal: { test = a; test2 = b; }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scope.5.qml b/tests/auto/qml/qqmlecmascript/data/scope.5.qml
new file mode 100644
index 0000000000..6dbcbe2a40
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scope.5.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ property bool test1: false;
+ property bool test2: false;
+
+ property int a: 10
+
+ Item {
+ id: nested
+ property int a: 11
+
+ function mynestedfunction() {
+ return a;
+ }
+ }
+
+ function myouterfunction() {
+ return a;
+ }
+
+ Component.onCompleted: {
+ test1 = (myouterfunction() == 10);
+ test2 = (nested.mynestedfunction() == 11);
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scope.6.qml b/tests/auto/qml/qqmlecmascript/data/scope.6.qml
new file mode 100644
index 0000000000..5897b533d7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scope.6.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ id: me
+ property bool test: nested.runtest(me);
+
+ Scope6Nested {
+ id: nested
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scope.qml b/tests/auto/qml/qqmlecmascript/data/scope.qml
new file mode 100644
index 0000000000..a00352b684
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scope.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property int a: 1
+ property int binding: a
+ property string binding2: a + "Test"
+ property int binding3: myFunction()
+ property int binding4: nestedObject.myNestedFunction()
+
+ function myFunction() {
+ return a;
+ }
+
+ Item {
+ id: nestedObject
+
+ function myNestedFunction() {
+ return a;
+ }
+
+ property int a: 2
+ property int binding: a
+ property string binding2: a + "Test"
+ property int binding3: myFunction()
+ property int binding4: myNestedFunction()
+ }
+
+ ScopeObject {
+ id: compObject
+ }
+
+ property alias test1: root.binding
+ property alias test2: nestedObject.binding
+ property alias test3: root.binding2
+ property alias test4: nestedObject.binding2
+ property alias test5: root.binding3
+ property alias test6: nestedObject.binding3
+ property alias test7: root.binding4
+ property alias test8: nestedObject.binding4
+ property alias test9: compObject.binding
+ property alias test10: compObject.binding2
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.js b/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.js
new file mode 100644
index 0000000000..54284fea47
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.js
@@ -0,0 +1,4 @@
+function testFunction() {
+ test = true;
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml
new file mode 100644
index 0000000000..ace473756e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.1.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+import QtQuick 2.0
+import "scriptConnect.1.js" as Script
+MyQmlObject {
+ property bool test: false
+
+ id: root
+
+ Component.onCompleted: root.argumentSignal.connect(Script.testFunction);
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.js b/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.js
new file mode 100644
index 0000000000..595c778aa7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.js
@@ -0,0 +1,5 @@
+function testFunction() {
+ if (this.b == 12)
+ test = true;
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml
new file mode 100644
index 0000000000..cdf2d6ad98
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.2.qml
@@ -0,0 +1,16 @@
+import Qt.test 1.0
+import QtQuick 2.0
+import "scriptConnect.2.js" as Script
+
+MyQmlObject {
+ property bool test: false
+
+ id: root
+
+ Component.onCompleted: {
+ var a = new Object;
+ a.b = 12;
+ root.argumentSignal.connect(a, Script.testFunction);
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml
new file mode 100644
index 0000000000..b0e40565c0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.3.qml
@@ -0,0 +1,15 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ property bool test: false
+
+ id: root
+
+ function testFunction() {
+ test = true;
+ }
+
+ Component.onCompleted: root.argumentSignal.connect(testFunction);
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml
new file mode 100644
index 0000000000..ef5331c94a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.4.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ property bool test: false
+
+ id: root
+
+ Component.onCompleted: root.argumentSignal.connect(methodNoArgs);
+}
+
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml
new file mode 100644
index 0000000000..8dcacbcbb7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.5.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ property bool test: false
+
+ id: root
+
+ Component.onCompleted: root.argumentSignal.connect(root, methodNoArgs);
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.js b/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.js
new file mode 100644
index 0000000000..71bdd088a2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.js
@@ -0,0 +1,3 @@
+function testFunction() {
+ test++;
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml
new file mode 100644
index 0000000000..06b6f0fa62
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.6.qml
@@ -0,0 +1,15 @@
+import Qt.test 1.0
+import QtQuick 2.0
+import "scriptConnect.6.js" as Script
+
+MyQmlObject {
+ property int test: 0
+
+ id: root
+
+ Component.onCompleted: {
+ root.argumentSignal.connect(Script.testFunction);
+ root.argumentSignal.connect(Script.testFunction);
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.js b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.js
new file mode 100644
index 0000000000..407426fcd1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.js
@@ -0,0 +1,6 @@
+function testFunction() {
+ test++;
+}
+
+function otherFunction() {
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml
new file mode 100644
index 0000000000..e546ee44d8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.1.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+import QtQuick 2.0
+import "scriptDisconnect.1.js" as Script
+
+MyQmlObject {
+ property int test: 0
+
+ id: root
+
+ Component.onCompleted: root.argumentSignal.connect(Script.testFunction);
+
+ onBasicSignal: root.argumentSignal.disconnect(Script.testFunction);
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml
new file mode 100644
index 0000000000..e70cd8b900
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.2.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+import QtQuick 2.0
+import "scriptDisconnect.1.js" as Script
+
+MyQmlObject {
+ property int test: 0
+
+ id: root
+
+ Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction);
+
+ onBasicSignal: root.argumentSignal.disconnect(root, Script.testFunction);
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml
new file mode 100644
index 0000000000..6f47776ea5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.3.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+import QtQuick 2.0
+import "scriptDisconnect.1.js" as Script
+
+MyQmlObject {
+ property int test: 0
+
+ id: root
+
+ Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction);
+
+ onBasicSignal: root.argumentSignal.disconnect(Script.testFunction);
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml
new file mode 100644
index 0000000000..b3887545fb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptDisconnect.4.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+import QtQuick 2.0
+import "scriptDisconnect.1.js" as Script
+
+MyQmlObject {
+ property int test: 0
+
+ id: root
+
+ Component.onCompleted: root.argumentSignal.connect(Script.testFunction);
+
+ onBasicSignal: root.argumentSignal.disconnect(Script.otherFunction);
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptErrors.js b/tests/auto/qml/qqmlecmascript/data/scriptErrors.js
new file mode 100644
index 0000000000..d22f623edb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptErrors.js
@@ -0,0 +1,4 @@
+// Comment
+a = 10
+
+function getValue() { a = 10; return 0; }
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptErrors.qml b/tests/auto/qml/qqmlecmascript/data/scriptErrors.qml
new file mode 100644
index 0000000000..4998f63929
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/scriptErrors.qml
@@ -0,0 +1,18 @@
+import Qt.test 1.0
+import "scriptErrors.js" as Script
+
+MyQmlObject {
+ property int t: a.value
+ property int w: Script.getValue();
+ property int d: undefined
+ ? 0 // multi-line binding
+ : 1
+ property int x: undefined
+ property int y: (a.value, undefinedObject)
+
+ onBasicSignal: { console.log(a.value); }
+ id: myObj
+ onAnotherBasicSignal: myObj.trueProperty = false;
+ onThirdBasicSignal: myObj.fakeProperty = "";
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/secondAlias.qml b/tests/auto/qml/qqmlecmascript/data/secondAlias.qml
new file mode 100644
index 0000000000..d818be34b2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/secondAlias.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property int prop1: 100
+ property int prop2: 100
+
+ property alias alias1: root.prop1
+ property alias alias2: root.prop2
+
+ property int test: root.alias2
+
+ Component.onCompleted: root.prop2 = 200
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml b/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml
new file mode 100644
index 0000000000..58cf8051f0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.2.qml
@@ -0,0 +1,17 @@
+import Qt.test 1.0
+
+MyQmlContainer {
+ property bool triggerDelete: false
+
+ children: [
+ MyQmlObject {
+ // Will trigger deletion on binding assignment
+ deleteOnSet: Math.max(0, 1)
+ },
+
+ MyQmlObject {
+ // Will trigger deletion on binding assignment, but after component creation
+ deleteOnSet: if (triggerDelete) 1; else 0;
+ }
+ ]
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.qml b/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.qml
new file mode 100644
index 0000000000..074851a67b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/selfDeletingBinding.qml
@@ -0,0 +1,18 @@
+import Qt.test 1.0
+
+MyQmlContainer {
+ property bool triggerDelete: false
+
+ children: [
+ MyQmlObject {
+ // Will trigger deletion during binding evaluation
+ stringProperty: {deleteMe(), "Hello"}
+ },
+
+ MyQmlObject {
+ // Will trigger deletion during binding evaluation, but after component creation
+ stringProperty: if (triggerDelete) { deleteMe(), "Hello" } else { "World" }
+ }
+
+ ]
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
new file mode 100644
index 0000000000..52abda1e55
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
@@ -0,0 +1,193 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ property bool success: false
+
+ property variant intList
+ property variant qrealList
+ property variant boolList
+ property variant stringList
+
+ function indexedAccess() {
+ intList = msco.intListProperty;
+ var jsIntList = msco.intListProperty;
+ qrealList = msco.qrealListProperty;
+ var jsQrealList = msco.qrealListProperty;
+ boolList = msco.boolListProperty;
+ var jsBoolList = msco.boolListProperty;
+ stringList = msco.stringListProperty;
+ var jsStringList = msco.stringListProperty;
+
+ // Three cases: direct property modification, variant copy modification, js var reference modification.
+ // Only the first and third should "write back" to the original QObject Q_PROPERTY; the second one
+ // should have no effect whatsoever to maintain "property variant" semantics (see e.g., valuetype).
+ success = true;
+
+ msco.intListProperty[1] = 33;
+ if (msco.intListProperty[1] != 33) success = false; // ensure write back
+ intList[1] = 44;
+ if (intList[1] == 44) success = false; // ensure no effect
+ jsIntList[1] = 55;
+ if (jsIntList[1] != 55
+ || jsIntList[1] != msco.intListProperty[1]) success = false; // ensure write back
+
+ msco.qrealListProperty[1] = 33.3;
+ if (msco.qrealListProperty[1] != 33.3) success = false; // ensure write back
+ qrealList[1] = 44.4;
+ if (qrealList[1] == 44.4) success = false; // ensure no effect
+ jsQrealList[1] = 55.5;
+ if (jsQrealList[1] != 55.5
+ || jsQrealList[1] != msco.qrealListProperty[1]) success = false; // ensure write back
+
+ msco.boolListProperty[1] = true;
+ if (msco.boolListProperty[1] != true) success = false; // ensure write back
+ boolList[1] = true;
+ if (boolList[1] != false) success = false; // ensure no effect
+ jsBoolList[1] = false;
+ if (jsBoolList[1] != false
+ || jsBoolList[1] != msco.boolListProperty[1]) success = false; // ensure write back
+
+ msco.stringListProperty[1] = "changed";
+ if (msco.stringListProperty[1] != "changed") success = false; // ensure write back
+ stringList[1] = "changed";
+ if (stringList[1] != "second") success = false; // ensure no effect
+ jsStringList[1] = "different";
+ if (jsStringList[1] != "different"
+ || jsStringList[1] != msco.stringListProperty[1]) success = false; // ensure write back
+ }
+
+ function arrayOperations() {
+ success = true;
+ var expected = 0;
+ var expectedStr = "";
+
+ // ecma262r3 defines array as implementing Length and Put. Test put here.
+ msco.intListProperty.asdf = 5; // shouldn't work, only indexes are valid names.
+ if (msco.intListProperty.asdf == 5) success = false;
+ msco.intListProperty[3] = 38; // should work.
+ if (msco.intListProperty[3] != 38) success = false;
+ msco.intListProperty[199] = 200; // should work, and should set length to 200.
+ if (msco.intListProperty[199] != 200) success = false;
+ if (msco.intListProperty.length != 200) success = false;
+
+ // test indexed deleter
+ msco.intListProperty = [ 1, 2, 3, 4, 5 ];
+ delete msco.intListProperty[-1];
+ expected = [ 1, 2, 3, 4, 5 ];
+ if (msco.intListProperty.toString() != expected.toString()) success = false;
+ delete msco.intListProperty[0];
+ expected = [ 0, 2, 3, 4, 5 ];
+ if (msco.intListProperty.toString() != expected.toString()) success = false;
+ delete msco.intListProperty[2];
+ expected = [ 0, 2, 0, 4, 5 ];
+ if (msco.intListProperty.toString() != expected.toString()) success = false;
+ delete msco.intListProperty[7];
+ expected = [ 0, 2, 0, 4, 5 ];
+ if (msco.intListProperty.toString() != expected.toString()) success = false;
+
+ // other operations are defined on the array prototype; see if they work.
+
+ // splice
+ msco.intListProperty = [ 0, 1, 2, 3, 4, 5, 6, 7 ];
+ msco.intListProperty.splice(1,3, 33, 44, 55, 66);
+ expected = [ 0, 33, 44, 55, 66, 4, 5, 6, 7 ];
+ if (msco.intListProperty.toString() != expected.toString()) success = false;
+ msco.intListProperty = [ 0, 1, 2, 3, 4, 5, 6, 7 ];
+ msco.intListProperty.splice(1, 3);
+ expected = [ 0, 4, 5, 6, 7 ];
+ if (msco.intListProperty.toString() != expected.toString()) success = false;
+
+ msco.qrealListProperty = [ 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1 ];
+ msco.qrealListProperty.splice(1,3, 33.33, 44.44, 55.55, 66.66);
+ expected = [ 0.1, 33.33, 44.44, 55.55, 66.66, 4.1, 5.1, 6.1, 7.1 ];
+ if (msco.qrealListProperty.toString() != expected.toString()) success = false;
+ msco.qrealListProperty = [ 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1 ];
+ msco.qrealListProperty.splice(1,3);
+ expected = [ 0.1, 4.1, 5.1, 6.1, 7.1 ];
+ if (msco.qrealListProperty.toString() != expected.toString()) success = false;
+
+ msco.boolListProperty = [ false, true, true, false, false, true, false, true ];
+ msco.boolListProperty.splice(1,3, false, true, false, false);
+ expected = [ false, false, true, false, false, false, true, false, true ];
+ if (msco.boolListProperty.toString() != expected.toString()) success = false;
+ msco.boolListProperty = [ false, true, true, false, false, true, false, true ];
+ msco.boolListProperty.splice(1,3);
+ expected = [ false, false, true, false, true ];
+ if (msco.boolListProperty.toString() != expected.toString()) success = false;
+
+ msco.stringListProperty = [ "one", "two", "three", "four", "five", "six", "seven", "eight" ];
+ msco.stringListProperty.splice(1,3, "nine", "ten", "eleven", "twelve");
+ expected = [ "one", "nine", "ten", "eleven", "twelve", "five", "six", "seven", "eight" ];
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+ msco.stringListProperty = [ "one", "two", "three", "four", "five", "six", "seven", "eight" ];
+ msco.stringListProperty.splice(0,3);
+ expected = [ "four", "five", "six", "seven", "eight" ];
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+
+ // pop
+ msco.intListProperty = [ 0, 1, 2, 3, 4, 5, 6, 7 ];
+ var poppedVal = msco.intListProperty.pop();
+ expected = [ 0, 1, 2, 3, 4, 5, 6 ];
+ if (msco.intListProperty.toString() != expected.toString()) success = false;
+ expected = 7;
+ if (poppedVal != expected) success = false;
+ }
+
+ property variant variantList: [ 1, 2, 3, 4, 5 ];
+ property variant variantList2: [ 1, 2, 3, 4, 5 ];
+ function testEqualitySemantics() {
+ // ensure equality semantics match JS array equality semantics
+ success = true;
+
+ msco.intListProperty = [ 1, 2, 3, 4, 5 ];
+ msco.intListProperty2 = [ 1, 2, 3, 4, 5 ];
+ var jsIntList = [ 1, 2, 3, 4, 5 ];
+ var jsIntList2 = [ 1, 2, 3, 4, 5 ];
+
+ if (jsIntList != jsIntList) success = false;
+ if (jsIntList == jsIntList2) success = false;
+ if (jsIntList == msco.intListProperty) success = false;
+ if (jsIntList == variantList) success = false;
+
+ if (msco.intListProperty != msco.intListProperty) success = false;
+ if (msco.intListProperty == msco.intListProperty2) success = false;
+ if (msco.intListProperty == jsIntList) success = false;
+ if (msco.intListProperty == variantList) success = false;
+
+ if (variantList == variantList) return false;
+ if (variantList == variantList2) return false;
+ if (variantList == msco.intListProperty) return false;
+ if (variantList == jsIntList) return false;
+
+ if ((jsIntList == jsIntList2) != (jsIntList == msco.intListProperty)) success = false;
+ if ((jsIntList == jsIntList2) != (msco.intListProperty == msco.intListProperty2)) success = false;
+ if ((jsIntList == jsIntList) != (msco.intListProperty == msco.intListProperty)) success = false;
+ if ((jsIntList == variantList) != (msco.intListProperty == variantList)) success = false;
+ if ((variantList == jsIntList) != (variantList == msco.intListProperty)) success = false;
+ if ((msco.intListProperty == variantList) != (variantList == msco.intListProperty)) success = false;
+ }
+
+ property bool referenceDeletion: false
+ function testReferenceDeletion() {
+ referenceDeletion = true;
+ var testObj = msco.generateTestObject();
+ testObj.intListProperty = [1, 2, 3, 4, 5];
+ var testSequence = testObj.intListProperty;
+ var prevString = testSequence.toString();
+ var prevValueOf = testSequence.valueOf();
+ var prevLength = testSequence.length;
+ msco.deleteTestObject(testObj); // delete referenced object.
+ if (testSequence.toString() == prevString) referenceDeletion = false;
+ if (testSequence.valueOf() == prevValueOf) referenceDeletion = false;
+ if (testSequence.length == prevLength) referenceDeletion = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.error.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.error.qml
new file mode 100644
index 0000000000..9c87dd293e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.error.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ intListProperty: [ 1, 2, 3, 6, 7 ]
+ }
+
+ MySequenceConversionObject {
+ id: mscoTwo
+ objectName: "mscoTwo"
+ boolListProperty: msco.intListProperty
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.qml
new file mode 100644
index 0000000000..8d83e9f9f5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.bindings.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ intListProperty: [ 1, 2, 3, 6, 7 ]
+ }
+
+ MySequenceConversionObject {
+ id: mscoTwo
+ objectName: "mscoTwo"
+ intListProperty: msco.intListProperty
+ }
+
+ property variant boundSequence: msco.intListProperty
+ property int boundElement: msco.intListProperty[3]
+ property variant boundSequenceTwo: mscoTwo.intListProperty
+
+ Component.onCompleted: {
+ msco.intListProperty[3] = 12;
+ mscoTwo.intListProperty[4] = 14;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml
new file mode 100644
index 0000000000..088e240ad4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml
@@ -0,0 +1,183 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ property bool success: true
+
+ property variant intList
+ property variant qrealList
+ property variant boolList
+ property variant stringList
+ property variant urlList
+ property variant qstringList
+
+ // this test ensures that the "copy resource" codepaths work
+ function testCopySequences() {
+ success = true;
+
+ // create "copy resource" sequences
+ var jsIntList = msco.generateIntSequence();
+ var jsQrealList = msco.generateQrealSequence();
+ var jsBoolList = msco.generateBoolSequence();
+ var jsStringList = msco.generateStringSequence();
+ var jsUrlList = msco.generateUrlSequence();
+ var jsQStringList = msco.generateQStringSequence();
+
+ if (jsIntList.toString() != [1, 2, 3].toString())
+ success = false;
+ if (jsQrealList.toString() != [1.1, 2.2, 3.3].toString())
+ success = false;
+ if (jsBoolList.toString() != [true, false, true].toString())
+ success = false;
+ if (jsStringList.toString() != ["one", "two", "three"].toString())
+ success = false;
+ if (jsUrlList.toString() != ["http://www.example1.com", "http://www.example2.com", "http://www.example3.com"].toString())
+ success = false;
+ if (jsQStringList.toString() != ["one", "two", "three"].toString())
+ success = false;
+
+ // copy the sequence; should result in a new copy
+ intList = jsIntList;
+ qrealList = jsQrealList;
+ boolList = jsBoolList;
+ stringList = jsStringList;
+ urlList = jsUrlList;
+ qstringList = jsQStringList;
+
+ // these operations shouldn't modify either variables - because
+ // we don't handle writing to the intermediate variant at list[index]
+ // for variant properties.
+ intList[1] = 8;
+ qrealList[1] = 8.8;
+ boolList[1] = true;
+ stringList[1] = "eight";
+ urlList[1] = "http://www.example8.com";
+ qstringList[1] = "eight";
+
+ if (jsIntList[1] == 8)
+ success = false;
+ if (jsQrealList[1] == 8.8)
+ success = false;
+ if (jsBoolList[1] == true)
+ success = false;
+ if (jsStringList[1] == "eight")
+ success = false;
+ if (jsUrlList[1] == "http://www.example8.com")
+ success = false;
+ if (jsQStringList[1] == "eight")
+ success = false;
+
+ // assign a "copy resource" sequence to a QObject Q_PROPERTY
+ msco.intListProperty = intList;
+ msco.qrealListProperty = qrealList;
+ msco.boolListProperty = boolList;
+ msco.stringListProperty = stringList;
+ msco.urlListProperty = urlList;
+ msco.qstringListProperty = qstringList;
+
+ if (msco.intListProperty.toString() != [1, 2, 3].toString())
+ success = false;
+ if (msco.qrealListProperty.toString() != [1.1, 2.2, 3.3].toString())
+ success = false;
+ if (msco.boolListProperty.toString() != [true, false, true].toString())
+ success = false;
+ if (msco.stringListProperty.toString() != ["one", "two", "three"].toString())
+ success = false;
+ if (msco.urlListProperty.toString() != ["http://www.example1.com", "http://www.example2.com", "http://www.example3.com"].toString())
+ success = false;
+ if (msco.qstringListProperty.toString() != ["one", "two", "three"].toString())
+ success = false;
+
+ // now modify the QObject Q_PROPERTY (reference resource) sequences - shouldn't modify the copy resource sequences.
+ msco.intListProperty[2] = 9;
+ msco.qrealListProperty[2] = 9.9;
+ msco.boolListProperty[2] = false;
+ msco.stringListProperty[2] = "nine";
+ msco.urlListProperty[2] = "http://www.example9.com";
+ msco.qstringListProperty[2] = "nine";
+
+ if (intList[2] == 9)
+ success = false;
+ if (qrealList[2] == 9.9)
+ success = false;
+ if (boolList[2] == false)
+ success = false;
+ if (stringList[2] == "nine")
+ success = false;
+ if (urlList[2] == "http://www.example9.com")
+ success = false;
+ if (qstringList[2] == "nine")
+ success = false;
+ }
+
+ property int intVal
+ property real qrealVal
+ property bool boolVal
+ property string stringVal
+
+ // this test ensures that indexed access works for copy resource sequences.
+ function readSequenceCopyElements() {
+ success = true;
+
+ var jsIntList = msco.generateIntSequence();
+ var jsQrealList = msco.generateQrealSequence();
+ var jsBoolList = msco.generateBoolSequence();
+ var jsStringList = msco.generateStringSequence();
+
+ intVal = jsIntList[1];
+ qrealVal = jsQrealList[1];
+ boolVal = jsBoolList[1];
+ stringVal = jsStringList[1];
+
+ if (intVal != 2)
+ success = false;
+ if (qrealVal != 2.2)
+ success = false;
+ if (boolVal != false)
+ success = false;
+ if (stringVal != "two")
+ success = false;
+ }
+
+ // this test ensures that equality works for copy resource sequences.
+ function testEqualitySemantics() {
+ success = true;
+
+ var jsIntList = msco.generateIntSequence();
+ var jsIntList2 = msco.generateIntSequence();
+
+ if (jsIntList == jsIntList2) success = false;
+ if (jsIntList != jsIntList) success = false;
+ }
+
+ // this test ensures that copy resource sequences can be passed as parameters
+ function testCopyParameters() {
+ success = false;
+
+ var jsIntList = msco.generateIntSequence();
+ success = msco.parameterEqualsGeneratedIntSequence(jsIntList);
+ if (success == false) return;
+
+ // here we construct something which should be converted to a copy sequence automatically.
+ success = msco.parameterEqualsGeneratedIntSequence([1,2,3]);
+ }
+
+ // this test ensures that reference resource sequences are converted
+ // to copy resource sequences when passed as parameters.
+ function testReferenceParameters() {
+ success = false;
+
+ msco.intListProperty = msco.generateIntSequence();
+ var jsIntList = msco.intListProperty
+ success = msco.parameterEqualsGeneratedIntSequence(jsIntList);
+ if (success == false) return;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
new file mode 100644
index 0000000000..962e8dd474
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
@@ -0,0 +1,75 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ property bool success: false
+
+ function verifyExpected(array, idx) {
+ for (var i = 0; i < idx; ++i) {
+ if (array[i] != i) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function indexedAccess() {
+ success = true;
+
+ msco.intListProperty = [ 0, 1, 2, 3, 4 ];
+ var expectedLength = msco.intListProperty.length;
+ var maxIndex = msco.maxIndex;
+ var tooBigIndex = msco.tooBigIndex;
+ var negativeIndex = msco.negativeIndex;
+
+ // shouldn't be able to set the length > maxIndex.
+ msco.intListProperty.length = tooBigIndex;
+ if (msco.intListProperty.length != expectedLength)
+ success = false;
+ if (!verifyExpected(msco.intListProperty, 4))
+ success = false;
+
+ // shouldn't be able to set any index > maxIndex.
+ msco.intListProperty[tooBigIndex] = 12;
+ if (msco.intListProperty.length != expectedLength)
+ success = false;
+ if (!verifyExpected(msco.intListProperty, 4))
+ success = false;
+
+ // shouldn't be able to access any index > maxIndex.
+ var valueAtTBI = msco.intListProperty[tooBigIndex];
+ if (valueAtTBI != undefined)
+ success = false;
+ if (!verifyExpected(msco.intListProperty, 4))
+ success = false;
+
+ // shouldn't be able to set the length to < 0
+ msco.intListProperty.length = negativeIndex;
+ if (msco.intListProperty.length != expectedLength)
+ success = false; // shouldn't have changed.
+ if (!verifyExpected(msco.intListProperty, 4))
+ success = false;
+
+ // shouldn't be able to set any index < 0.
+ msco.intListProperty[negativeIndex] = 12;
+ if (msco.intListProperty.length != expectedLength)
+ success = false;
+ if (!verifyExpected(msco.intListProperty, 4))
+ success = false;
+
+ // shouldn't be able to access any index < 0.
+ var valueAtNI = msco.intListProperty[negativeIndex];
+ if (valueAtNI != undefined)
+ success = false;
+ if (!verifyExpected(msco.intListProperty, 4))
+ success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.error.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.error.qml
new file mode 100644
index 0000000000..dd110d20ee
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.error.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ property int typeListLength: 0
+ property variant typeList
+
+ function performTest() {
+ // we have NOT registered QList<NonRegisteredType> as a type
+ typeListLength = msco.typeListProperty.length;
+ typeList = msco.typeListProperty;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.qml
new file mode 100644
index 0000000000..4a8a4a17b2
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.read.qml
@@ -0,0 +1,105 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ property int intListLength: 0
+ property variant intList
+ property int qrealListLength: 0
+ property variant qrealList
+ property int boolListLength: 0
+ property variant boolList
+ property int stringListLength: 0
+ property variant stringList
+ property int urlListLength: 0
+ property variant urlList
+ property int qstringListLength: 0
+ property variant qstringList
+
+ function readSequences() {
+ intListLength = msco.intListProperty.length;
+ intList = msco.intListProperty;
+ qrealListLength = msco.qrealListProperty.length;
+ qrealList = msco.qrealListProperty;
+ boolListLength = msco.boolListProperty.length;
+ boolList = msco.boolListProperty;
+ stringListLength = msco.stringListProperty.length;
+ stringList = msco.stringListProperty;
+ urlListLength = msco.urlListProperty.length;
+ urlList = msco.urlListProperty;
+ qstringListLength = msco.qstringListProperty.length;
+ qstringList = msco.qstringListProperty;
+ }
+
+ property int intVal
+ property real qrealVal
+ property bool boolVal
+ property string stringVal
+ property url urlVal
+ property string qstringVal
+
+ function readSequenceElements() {
+ intVal = msco.intListProperty[1];
+ qrealVal = msco.qrealListProperty[1];
+ boolVal = msco.boolListProperty[1];
+ stringVal = msco.stringListProperty[1];
+ urlVal = msco.urlListProperty[1];
+ qstringVal = msco.qstringListProperty[1];
+ }
+
+ property bool enumerationMatches
+ function enumerateSequenceElements() {
+ var jsIntList = [1, 2, 3, 4, 5];
+ msco.intListProperty = [1, 2, 3, 4, 5];
+
+ var jsIntListProps = []
+ var seqIntListProps = []
+
+ enumerationMatches = true;
+ for (var i in jsIntList) {
+ jsIntListProps.push(i);
+ if (jsIntList[i] != msco.intListProperty[i]) {
+ enumerationMatches = false;
+ }
+ }
+ for (var j in msco.intListProperty) {
+ seqIntListProps.push(j);
+ if (jsIntList[j] != msco.intListProperty[j]) {
+ enumerationMatches = false;
+ }
+ }
+
+ if (jsIntListProps.length != seqIntListProps.length) {
+ enumerationMatches = false;
+ }
+
+ var emptyList = [];
+ msco.stringListProperty = []
+ if (emptyList.toString() != msco.stringListProperty.toString()) {
+ enumerationMatches = false;
+ }
+ if (emptyList.valueOf() != msco.stringListProperty.valueOf()) {
+ enumerationMatches = false;
+ }
+ }
+
+ property bool referenceDeletion: false
+ function testReferenceDeletion() {
+ referenceDeletion = true;
+ var testObj = msco.generateTestObject();
+ testObj.intListProperty = [1, 2, 3, 4, 5];
+ var testSequence = testObj.intListProperty;
+ if (testSequence[4] != 5)
+ referenceDeletion = false;
+ msco.deleteTestObject(testObj); // delete referenced object.
+ if (testSequence[4] == 5)
+ referenceDeletion = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.threads.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.threads.qml
new file mode 100644
index 0000000000..aefad89ca4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.threads.qml
@@ -0,0 +1,74 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ property bool success: false
+ property bool finished: false
+
+ function testIntSequence() {
+ msco.intListProperty = [ 0, 1, 2, 3, 4, 5, 6, 7 ];
+ worker.sendSequence(msco.intListProperty);
+ }
+
+ function testQrealSequence() {
+ msco.qrealListProperty = [ 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1 ];
+ worker.sendSequence(msco.qrealListProperty);
+ }
+
+ function testBoolSequence() {
+ msco.boolListProperty = [ false, true, true, false, false, true, false, true ];
+ worker.sendSequence(msco.boolListProperty);
+ }
+
+ function testStringSequence() {
+ msco.stringListProperty = [ "one", "two", "three", "four" ];
+ worker.sendSequence(msco.stringListProperty);
+ }
+
+ function testQStringSequence() {
+ msco.qstringListProperty = [ "one", "two", "three", "four" ];
+ worker.sendSequence(msco.qstringListProperty);
+ }
+
+ function testUrlSequence() {
+ msco.urlListProperty = [ "www.example1.com", "www.example2.com", "www.example3.com", "www.example4.com" ];
+ worker.sendSequence(msco.urlListProperty);
+ }
+
+ function testVariantSequence() {
+ msco.variantListProperty = [ "one", true, 3, "four" ];
+ worker.sendSequence(msco.variantListProperty);
+ }
+
+ WorkerScript {
+ id: worker
+ source: "threadScript.js"
+
+ property variant expected
+ property variant response
+
+ function sendSequence(seq) {
+ root.success = false;
+ root.finished = false;
+ worker.expected = seq;
+ worker.sendMessage(seq);
+ }
+
+ onMessage: {
+ worker.response = messageObject;
+ if (worker.response.toString() == worker.expected.toString())
+ root.success = true;
+ else
+ root.success = false;
+ root.finished = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml
new file mode 100644
index 0000000000..75beafd1ee
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.error.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ function performTest() {
+ // we have NOT registered QList<QPoint> as a type
+ var pointList = [ Qt.point(7,7), Qt.point(8,8), Qt.point(9,9) ];
+ msco.pointListProperty = pointList; // error.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.qml
new file mode 100644
index 0000000000..812de043b7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.write.qml
@@ -0,0 +1,109 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: root
+ objectName: "root"
+
+ MySequenceConversionObject {
+ id: msco
+ objectName: "msco"
+ }
+
+ property bool success
+
+ function writeSequences() {
+ success = true;
+
+ var intList = [ 9, 8, 7, 6 ];
+ msco.intListProperty = intList;
+ var qrealList = [ 9.9, 8.8, 7.7, 6.6 ];
+ msco.qrealListProperty = qrealList;
+ var boolList = [ false, false, false, true ];
+ msco.boolListProperty = boolList;
+ var stringList = [ "nine", "eight", "seven", "six" ]
+ msco.stringListProperty = stringList;
+ var urlList = [ "http://www.example9.com", "http://www.example8.com", "http://www.example7.com", "http://www.example6.com" ]
+ msco.urlListProperty = urlList;
+ var qstringList = [ "nine", "eight", "seven", "six" ]
+ msco.qstringListProperty = qstringList;
+
+ if (msco.intListProperty[0] != 9 || msco.intListProperty[1] != 8 || msco.intListProperty[2] != 7 || msco.intListProperty[3] != 6)
+ success = false;
+ if (msco.qrealListProperty[0] != 9.9 || msco.qrealListProperty[1] != 8.8 || msco.qrealListProperty[2] != 7.7 || msco.qrealListProperty[3] != 6.6)
+ success = false;
+ if (msco.boolListProperty[0] != false || msco.boolListProperty[1] != false || msco.boolListProperty[2] != false || msco.boolListProperty[3] != true)
+ success = false;
+ if (msco.stringListProperty[0] != "nine" || msco.stringListProperty[1] != "eight" || msco.stringListProperty[2] != "seven" || msco.stringListProperty[3] != "six")
+ success = false;
+ if (msco.urlListProperty[0] != "http://www.example9.com" || msco.urlListProperty[1] != "http://www.example8.com" || msco.urlListProperty[2] != "http://www.example7.com" || msco.urlListProperty[3] != "http://www.example6.com")
+ success = false;
+ if (msco.qstringListProperty[0] != "nine" || msco.qstringListProperty[1] != "eight" || msco.qstringListProperty[2] != "seven" || msco.qstringListProperty[3] != "six")
+ success = false;
+ }
+
+ function writeSequenceElements() {
+ // set up initial conditions.
+ writeSequences();
+ success = true;
+
+ // element set.
+ msco.intListProperty[3] = 2;
+ msco.qrealListProperty[3] = 2.2;
+ msco.boolListProperty[3] = false;
+ msco.stringListProperty[3] = "changed";
+ msco.urlListProperty[3] = "http://www.examplechanged.com";
+ msco.qstringListProperty[3] = "changed";
+
+ if (msco.intListProperty[0] != 9 || msco.intListProperty[1] != 8 || msco.intListProperty[2] != 7 || msco.intListProperty[3] != 2)
+ success = false;
+ if (msco.qrealListProperty[0] != 9.9 || msco.qrealListProperty[1] != 8.8 || msco.qrealListProperty[2] != 7.7 || msco.qrealListProperty[3] != 2.2)
+ success = false;
+ if (msco.boolListProperty[0] != false || msco.boolListProperty[1] != false || msco.boolListProperty[2] != false || msco.boolListProperty[3] != false)
+ success = false;
+ if (msco.stringListProperty[0] != "nine" || msco.stringListProperty[1] != "eight" || msco.stringListProperty[2] != "seven" || msco.stringListProperty[3] != "changed")
+ success = false;
+ if (msco.urlListProperty[0] != "http://www.example9.com" || msco.urlListProperty[1] != "http://www.example8.com" || msco.urlListProperty[2] != "http://www.example7.com" || msco.urlListProperty[3] != "http://www.examplechanged.com")
+ success = false;
+ if (msco.qstringListProperty[0] != "nine" || msco.qstringListProperty[1] != "eight" || msco.qstringListProperty[2] != "seven" || msco.qstringListProperty[3] != "changed")
+ success = false;
+ }
+
+ function writeOtherElements() {
+ success = true;
+ var jsIntList = [1, 2, 3, 4, 5];
+ msco.intListProperty = [1, 2, 3, 4, 5];
+
+ jsIntList[8] = 8;
+ msco.intListProperty[8] = 8;
+ if (jsIntList[8] != msco.intListProperty[8])
+ success = false;
+ if (jsIntList.length != msco.intListProperty.length)
+ success = false;
+
+ // NOTE: we can't exactly match the spec here -- we fill the sequence with a default (rather than empty) value
+ if (msco.intListProperty[5] != 0 || msco.intListProperty[6] != 0 || msco.intListProperty[7] != 0)
+ success = false;
+
+ // should have no effect
+ var currLength = jsIntList.length;
+ jsIntList.someThing = 9;
+ msco.intListProperty.someThing = 9;
+ if (msco.intListProperty.length != currLength)
+ success = false;
+ }
+
+ property bool referenceDeletion: false
+ function testReferenceDeletion() {
+ referenceDeletion = true;
+ var testObj = msco.generateTestObject();
+ testObj.intListProperty = [1, 2, 3, 4, 5];
+ var testSequence = testObj.intListProperty;
+ if (testSequence[4] != 5)
+ referenceDeletion = false;
+ msco.deleteTestObject(testObj); // delete referenced object.
+ testSequence[4] = 5; // shouldn't work, since referenced object no longer exists.
+ if (testSequence[4] == 5)
+ referenceDeletion = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml b/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml
new file mode 100644
index 0000000000..5e2892a31d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml
@@ -0,0 +1,95 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+
+ MyStringClass {
+ id: msc
+ }
+
+ function compare(a0, a1) {
+ var compareOk = a0.length === a1.length;
+
+ if (compareOk === true) {
+ for (var i=0 ; i < a0.length ; ++i) {
+ if (a0[i] != a1[i]) {
+ compareOk = false;
+ break;
+ }
+ }
+ }
+
+ return compareOk;
+ }
+
+ function compareStrings(a, b) {
+ return (a < b) ? 1 : -1;
+ }
+
+ function compareNumbers(a, b) {
+ return a - b;
+ }
+
+ function createExpected(list, sortFn) {
+ var expected = []
+ for (var i=0 ; i < list.length ; ++i)
+ expected.push(list[i]);
+ if (sortFn === null)
+ expected.sort();
+ else
+ expected.sort(sortFn);
+ return expected;
+ }
+
+ function checkResults(expected, actual, sortFn) {
+ if (sortFn === null)
+ actual.sort();
+ else
+ actual.sort(sortFn);
+ return compare(expected, actual);
+ }
+
+ function doStringTest(stringList, fn) {
+ var expected = createExpected(stringList, fn);
+ var actual = msc.strings(stringList);
+ return checkResults(expected, actual, fn);
+ }
+ function doIntTest(intList, fn) {
+ var expected = createExpected(intList, fn);
+ var actual = msc.integers(intList);
+ return checkResults(expected, actual, fn);
+ }
+ function doRealTest(realList, fn) {
+ var expected = createExpected(realList, fn);
+ var actual = msc.reals(realList);
+ return checkResults(expected, actual, fn);
+ }
+
+ function test_qtbug_25269(useCustomCompare) {
+ return doStringTest( [ "one", "two", "three" ], null );
+ }
+ function test_alphabet_insertionSort(useCustomCompare) {
+ var fn = useCustomCompare ? compareStrings : null;
+ return doStringTest( [ "z", "y", "M", "a", "c", "B" ], fn );
+ }
+ function test_alphabet_quickSort(useCustomCompare) {
+ var fn = useCustomCompare ? compareStrings : null;
+ return doStringTest( [ "z", "y", "m", "a", "c", "B", "gG", "u", "bh", "lk", "GW", "Z", "n", "nm", "oi", "njk", "f", "dd", "ooo", "3des", "num123", "ojh", "lkj", "a6^^", "bl!!", "!o" ], fn );
+ }
+ function test_numbers_insertionSort(useCustomCompare) {
+ var fn = useCustomCompare ? compareNumbers : null;
+ return doIntTest( [ 7, 3, 9, 1, 0, -1, 20, -11 ], fn );
+ }
+ function test_numbers_quickSort(useCustomCompare) {
+ var fn = useCustomCompare ? compareNumbers : null;
+ return doIntTest( [ 7, 3, 37, 9, 1, 0, -1, 20, -11, -300, -87, 1, 3, -2, 100, 108, 96, 9, 99999, 12, 11, 11, 12, 11, 13, -13, 10, 10, 10, 8, 12 ], fn );
+ }
+ function test_reals_insertionSort(useCustomCompare) {
+ var fn = useCustomCompare ? compareNumbers : null;
+ return doRealTest( [ -3.4, 1, 10, 4.23, -30.1, 4.24, 4.21, -1, -1 ], fn );
+ }
+ function test_reals_quickSort(useCustomCompare) {
+ var fn = useCustomCompare ? compareNumbers : null;
+ return doRealTest( [ -3.4, 1, 10, 4.23, -30.1, 4.24, 4.21, -1, -1, 12, -100, 87.4, 101.3, -8.88888, 7.76, 10.10, 1.1, -1.1, -0, 11, 12.8, 0.001, -11, -0.75, 99999.99, 11.12, 32.3, 3.333333, 9.876 ], fn );
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/sharedAttachedObject.qml b/tests/auto/qml/qqmlecmascript/data/sharedAttachedObject.qml
new file mode 100644
index 0000000000..b967f0984c
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/sharedAttachedObject.qml
@@ -0,0 +1,16 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ id: root
+ property bool test1: false
+ property bool test2: false
+
+ MyQmlObject.value2: 7
+
+ Component.onCompleted: {
+ test1 = root.MyQmlObject.value2 == 7;
+ test2 = root.MyQmlObjectAlias.value2 == 7;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/shutdownErrors.qml b/tests/auto/qml/qqmlecmascript/data/shutdownErrors.qml
new file mode 100644
index 0000000000..b30aa8b4cd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/shutdownErrors.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ property int test: myObject.object.a
+
+ Item {
+ id: myObject
+ property QtObject object;
+ object: QtObject {
+ property int a: 10
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalArguments.1.qml b/tests/auto/qml/qqmlecmascript/data/signalArguments.1.qml
new file mode 100644
index 0000000000..3ab714b800
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalArguments.1.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int argumentCount: -1
+ property bool calleeCorrect: false
+ onBasicSignal: {
+ argumentCount = arguments.length
+ calleeCorrect = (arguments.callee === onBasicSignal)
+ setString('pass')
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalArguments.2.qml b/tests/auto/qml/qqmlecmascript/data/signalArguments.2.qml
new file mode 100644
index 0000000000..8ecb8df6ee
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalArguments.2.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int argumentCount: -1
+ property bool calleeCorrect: false
+
+ onArgumentSignal: {
+ argumentCount = arguments.length
+ calleeCorrect = (arguments.callee === onArgumentSignal)
+ setString('pass ' + arguments[0] + ' ' + arguments[1] + ' '
+ + arguments[2] + ' ' + arguments[3] + ' '
+ + arguments[4])
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml b/tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml
new file mode 100644
index 0000000000..fbd09142f7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalAssignment.1.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onBasicSignal: setString('pass')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml b/tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml
new file mode 100644
index 0000000000..6467c42bb9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalAssignment.2.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onArgumentSignal: setString('pass ' + a + ' ' + b + ' ' + c + ' ' + d + ' ' + e)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalAssignment.3.qml b/tests/auto/qml/qqmlecmascript/data/signalAssignment.3.qml
new file mode 100644
index 0000000000..690b7cf216
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalAssignment.3.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onUnnamedArgumentSignal: setString('pass ' + a + ' ' + c)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalAssignment.4.qml b/tests/auto/qml/qqmlecmascript/data/signalAssignment.4.qml
new file mode 100644
index 0000000000..0e1e728a86
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalAssignment.4.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+
+MyQmlObject {
+ onSignalWithGlobalName: setString('pass ' + parseInt("5"))
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalEmitted.2.qml b/tests/auto/qml/qqmlecmascript/data/signalEmitted.2.qml
new file mode 100644
index 0000000000..8b2daa2a52
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalEmitted.2.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+import Qt.test 1.0 as ModApi
+
+Item {
+ id: root
+
+ property bool success: false
+ property bool c1HasBeenDestroyed: false
+
+ SignalEmittedComponent {
+ id: c1
+ }
+
+ SignalEmittedComponent {
+ id: c2
+ property int c1a: if (c1) c1.a; else 0; // will change during onDestruction handler of c1.
+ onC1aChanged: {
+ // this should still be called, after c1 has been destroyed.
+ if (root.c1HasBeenDestroyed && c1a == 20) c1.setSuccessPropertyOf(root, true);
+ }
+ }
+
+ Component.onCompleted: {
+ // destroy c1 directly
+ c1HasBeenDestroyed = true;
+ c1.destroy();
+ // return to event loop.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalEmitted.3.qml b/tests/auto/qml/qqmlecmascript/data/signalEmitted.3.qml
new file mode 100644
index 0000000000..8a09414478
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalEmitted.3.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+import Qt.test 1.0 as ModApi
+
+Item {
+ id: root
+
+ property bool success: false
+ property bool c1HasBeenDestroyed: false
+
+ SignalEmittedComponent {
+ id: c2
+ function c1aChangedHandler() {
+ // this should still be called, after c1 has been destroyed by gc,
+ // because the onDestruction handler of c1 will be triggered prior
+ // to when c1 will be invalidated.
+ if (root.c1HasBeenDestroyed)
+ root.success = true;
+ // note: cannot call c1::setSuccessPropertyOf(root, true), since any
+ // reference to c1 would have kept c1 alive. So, set it directly.
+ }
+ }
+
+ Component.onCompleted: {
+ // dynamically construct sibling. When it goes out of scope, it should be gc'd.
+ // note that the gc() will call weakqobjectcallback which will set queued for
+ // deletion flag -- thus QQmlData::wasDeleted() will return true for that object..
+ var comp = Qt.createComponent("SignalEmittedComponent.qml", root);
+ var c1 = comp.createObject(null); // JS ownership
+ c1.onAChanged.connect(c2.c1aChangedHandler);
+ c1HasBeenDestroyed = true; // gc will collect c1.
+ // return to event loop.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml b/tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml
new file mode 100644
index 0000000000..764ed6e6ca
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalEmitted.4.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+import Qt.test 1.0 as ModApi
+
+Item {
+ id: root
+
+ property bool success: false
+ property bool c1HasBeenDestroyed: false
+
+ SignalEmittedComponent {
+ id: c2
+ function c1aChangedHandler() {
+ // this should still be called, after c1 has been destroyed by gc,
+ // because the onDestruction handler of c1 will be triggered prior
+ // to when c1 will be invalidated.
+ if (root.c1HasBeenDestroyed)
+ root.success = true;
+ }
+ }
+
+ Component.onCompleted: {
+ // dynamically construct sibling. When it goes out of scope, it should be gc'd.
+ // note that the gc() will call weakqobjectcallback which will set queued for
+ // deletion flag -- thus QQmlData::wasDeleted() will return true for that object..
+ var comp = Qt.createComponent("SignalEmittedComponent.qml", root);
+ var c1 = comp.createObject(null); // JS ownership
+ c1.onAChanged.connect(c2.c1aChangedHandler);
+ c1HasBeenDestroyed = true; // gc will collect c1.
+ // return to event loop.
+ }
+
+ function destroyC2() {
+ // we must gc() c1 first, then destroy c2, then handle events.
+ c2.destroy();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
new file mode 100644
index 0000000000..975be1b2ad
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
@@ -0,0 +1,60 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property int count: 0
+ signal testSignal
+ onTestSignal: count++
+
+ property int funcCount: 0
+ function testFunction() {
+ funcCount++;
+ }
+
+ //should increment count
+ function testSignalCall() {
+ testSignal()
+ }
+
+ //should NOT increment count, and should throw an exception
+ property string errorString
+ function testSignalHandlerCall() {
+ try {
+ onTestSignal()
+ } catch (error) {
+ errorString = error.toString();
+ }
+ }
+
+ //should increment funcCount once
+ function testSignalConnection() {
+ testSignal.connect(testFunction)
+ testSignal();
+ testSignal.disconnect(testFunction)
+ testSignal();
+ }
+
+ //should increment funcCount once
+ function testSignalHandlerConnection() {
+ onTestSignal.connect(testFunction)
+ testSignal();
+ onTestSignal.disconnect(testFunction)
+ testSignal();
+ }
+
+ //should be defined
+ property bool definedResult: false
+ function testSignalDefined() {
+ if (testSignal !== undefined)
+ definedResult = true;
+ }
+
+ //should be defined
+ property bool definedHandlerResult: false
+ function testSignalHandlerDefined() {
+ if (onTestSignal !== undefined)
+ definedHandlerResult = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
new file mode 100644
index 0000000000..4fc2dab943
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml
@@ -0,0 +1,18 @@
+import Qt.test 1.0
+
+MyQmlObject
+{
+ id: root
+ property int intProperty
+ property real realProperty
+ property color colorProperty
+ property variant variantProperty
+ property int enumProperty
+ property int qtEnumProperty
+
+ signal mySignal(int a, real b, color c, variant d, int e, int f)
+
+ onMySignal: { intProperty = a; realProperty = b; colorProperty = c; variantProperty = d; enumProperty = e; qtEnumProperty = f; }
+
+ onBasicSignal: root.mySignal(10, 19.2, Qt.rgba(1, 1, 0, 1), Qt.rgba(1, 0, 1, 1), MyQmlObject.EnumValue3, Qt.LeftButton)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml b/tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml
new file mode 100644
index 0000000000..d98d7e9c81
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalTriggeredBindings.qml
@@ -0,0 +1,20 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ property real base: 50
+ property alias test1: myObject.test1
+ property alias test2: myObject.test2
+
+ objectProperty: QtObject {
+ id: myObject
+ property real test1: base
+ property real test2: Math.max(0, base)
+ }
+
+ // Signal with no args
+ onBasicSignal: base = 200
+ // Signal with args
+ onArgumentSignal: base = 400
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/signalWithJSValueInVariant.qml b/tests/auto/qml/qqmlecmascript/data/signalWithJSValueInVariant.qml
new file mode 100644
index 0000000000..a6f1aa381a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalWithJSValueInVariant.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property string expression
+ property string compare
+ property bool pass: false
+ onSignalWithVariant:
+ {
+ var expected = eval(expression);
+ pass = eval(compare)(arg, expected);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalWithQJSValue.qml b/tests/auto/qml/qqmlecmascript/data/signalWithQJSValue.qml
new file mode 100644
index 0000000000..36f481d533
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalWithQJSValue.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property string expression
+ property string compare
+ property bool pass: false
+
+ onSignalWithQJSValue:
+ {
+ qjsvalueMethod(arg);
+ var expected = eval(expression);
+ pass = eval(compare)(arg, expected);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalWithUnknownTypes.qml b/tests/auto/qml/qqmlecmascript/data/signalWithUnknownTypes.qml
new file mode 100644
index 0000000000..5b73430aa3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/signalWithUnknownTypes.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onSignalWithUnknownType: variantMethod(arg);
+ onSignalWithCompletelyUnknownType: variantMethod(arg)
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml b/tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml
new file mode 100644
index 0000000000..ae84f028a5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ MyQmlObject {
+ value: if (1) 3
+ }
+
+ MyQmlObject {
+ value: { deleteMe(), 2 }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonType.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonType.qml
new file mode 100644
index 0000000000..012890f12f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonType.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+import Qt.test 1.0 as QtTest // singleton Type installed into existing uri
+import Qt.test.qobjectApi 1.0 as QtTestQObjectApi // qobject singleton Type installed into new uri
+import Qt.test.qobjectApi 1.3 as QtTestMinorVersionQObjectApi // qobject singleton Type installed into existing uri with new minor version
+import Qt.test.qobjectApi 2.0 as QtTestMajorVersionQObjectApi // qobject singleton Type installed into existing uri with new major version
+import Qt.test.qobjectApiParented 1.0 as QtTestParentedQObjectApi // qobject (with parent) singleton Type installed into a new uri
+
+QtObject {
+ property int existingUriTest: QtTest.QObject.qobjectTestProperty
+ property int qobjectTest: QtTestQObjectApi.QObject.qobjectTestProperty
+ property int qobjectMethodTest: 3
+ property int qobjectMinorVersionMethodTest: 3
+ property int qobjectMinorVersionTest: QtTestMinorVersionQObjectApi.QObject.qobjectTestProperty
+ property int qobjectMajorVersionTest: QtTestMajorVersionQObjectApi.QObject.qobjectTestProperty
+ property int qobjectParentedTest: QtTestParentedQObjectApi.QObject.qobjectTestProperty
+
+ Component.onCompleted: {
+ qobjectMethodTest = QtTestQObjectApi.QObject.qobjectTestMethod(); // should be 1
+ qobjectMethodTest = QtTestQObjectApi.QObject.qobjectTestMethod(); // should be 2
+ qobjectMinorVersionMethodTest = QtTestMinorVersionQObjectApi.QObject.qobjectTestMethod(); // should be 1
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeCaching.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeCaching.qml
new file mode 100644
index 0000000000..94921ab4e0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeCaching.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+import Qt.test 1.0 as QtTest // singleton Type installed into existing uri
+import Qt.test.qobjectApiParented 1.0 as QtTestParentedQObjectApi // qobject (with parent) singleton Type installed into a new uri
+
+QtObject {
+ property int existingUriTest: QtTest.QObject.qobjectTestWritableProperty
+ property int qobjectParentedTest: QtTestParentedQObjectApi.QObject.qobjectTestWritableProperty
+
+ function modifyValues() {
+ QtTest.QObject.qobjectTestWritableProperty = 50;
+ QtTestParentedQObjectApi.QObject.qobjectTestWritableProperty = 65;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeEnums.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeEnums.qml
new file mode 100644
index 0000000000..2bd14d14a6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeEnums.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import Qt.test.qobjectApi 1.0 as QtTestQObjectApi // qobject singleton Type installed into new uri
+
+QtObject {
+ property int enumValue: QtTestQObjectApi.QObject.EnumValue2;
+ property int enumMethod: QtTestQObjectApi.QObject.qobjectEnumTestMethod(QtTestQObjectApi.QObject.EnumValue1);
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeNoQualifier.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeNoQualifier.qml
new file mode 100644
index 0000000000..50a356568e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeNoQualifier.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ property int qobjectPropertyTest: QObject.qobjectTestProperty
+ property int qobjectMethodTest: 2
+
+ Component.onCompleted: {
+ qobjectMethodTest = QObject.qobjectTestMethod();
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml
new file mode 100644
index 0000000000..6870027d72
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/qobjectSingletonTypeWriting.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+import Qt.test 1.0 as QtTest // qobject singleton Type installed into existing uri
+
+QtObject {
+ property int firstProperty: 1
+ property int secondProperty: 2
+ property int readOnlyProperty: QtTest.QObject.qobjectTestProperty
+ property int writableProperty: QtTest.QObject.qobjectTestWritableProperty
+ property int writableFinalProperty: QtTest.QObject.qobjectTestWritableFinalProperty
+
+ onFirstPropertyChanged: {
+ // In this case, we want to attempt to set the singleton Type property.
+ // This should fail, as the singleton Type property is read only.
+ if (firstProperty != QtTest.QObject.qobjectTestProperty) {
+ QtTest.QObject.qobjectTestProperty = firstProperty; // should silently fail.
+ }
+ }
+
+ onSecondPropertyChanged: {
+ // In this case, we want to attempt to set the singleton Type properties.
+ // This should succeed, as the singleton Type properties are writable.
+ if (secondProperty != QtTest.QObject.qobjectTestWritableProperty) {
+ QtTest.QObject.qobjectTestWritableProperty = secondProperty; // should succeed.
+ }
+ if (secondProperty != QtTest.QObject.qobjectTestWritableFinalProperty) {
+ QtTest.QObject.qobjectTestWritableFinalProperty = secondProperty; // should succeed.
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonType.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonType.qml
new file mode 100644
index 0000000000..6197bbcfd8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonType.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import Qt.test.scriptApi 1.0 as QtTestScriptApi // script singleton Type installed into new uri
+
+QtObject {
+ property int scriptTest: QtTestScriptApi.Script.scriptTestProperty // script singleton types only provide properties.
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeCaching.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeCaching.qml
new file mode 100644
index 0000000000..81ba9a66e4
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeCaching.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Qt.test.scriptApi 1.0 as QtTestScriptApi // script singleton Type installed into new uri
+
+QtObject {
+ property int scriptTest: QtTestScriptApi.Script.scriptTestProperty
+
+ function modifyValues() {
+ // the constructor function of the script singleton will modify
+ // the value if it were called again (via the static int increment).
+ // So, we don't need to do anything in this function.
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeNoQualifier.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeNoQualifier.qml
new file mode 100644
index 0000000000..13896d9683
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeNoQualifier.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import Qt.test.scriptApi 1.0
+
+QtObject {
+ property int scriptTest: Script.scriptTestProperty // script singleton type's only provide properties.
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeWriting.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeWriting.qml
new file mode 100644
index 0000000000..ba98ea66bb
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/scriptSingletonTypeWriting.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+import Qt.test.scriptApi 1.0 as QtTestScriptApi
+import Qt.test.scriptApi 2.0 as QtTestScriptApi2
+
+QtObject {
+ property int firstProperty
+ property int readBack
+
+ property int secondProperty
+ property int unchanged
+
+ onFirstPropertyChanged: {
+ if (QtTestScriptApi.Script.scriptTestProperty != firstProperty) {
+ QtTestScriptApi.Script.scriptTestProperty = firstProperty;
+ readBack = QtTestScriptApi.Script.scriptTestProperty;
+ }
+ }
+
+ onSecondPropertyChanged: {
+ if (QtTestScriptApi2.Script.scriptTestProperty != secondProperty) {
+ QtTestScriptApi2.Script.scriptTestProperty = secondProperty;
+ unchanged = QtTestScriptApi2.Script.scriptTestProperty;
+ }
+ }
+
+ Component.onCompleted: {
+ firstProperty = QtTestScriptApi.Script.scriptTestProperty;
+ readBack = QtTestScriptApi.Script.scriptTestProperty;
+ secondProperty = QtTestScriptApi2.Script.scriptTestProperty;
+ unchanged = QtTestScriptApi2.Script.scriptTestProperty;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeImportOrder.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeImportOrder.qml
new file mode 100644
index 0000000000..9b0b648b0d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeImportOrder.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import Qt.test.importOrderApi1 1.0
+import Qt.test.importOrderApi2 1.0
+
+QtObject {
+ property int v: Data.value
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMajorVersionFail.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMajorVersionFail.qml
new file mode 100644
index 0000000000..af20f8c77f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMajorVersionFail.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+// this qml file attempts to import an invalid version of a qobject singleton Type.
+
+import Qt.test.qobjectApi 4.0 as QtTestMajorVersionQObjectApi // qobject singleton Type installed into existing uri with nonexistent major version
+
+QtObject {
+ property int qobjectMajorVersionTest: QtTestMajorVersionQObjectApi.qobjectTestProperty
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMinorVersionFail.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMinorVersionFail.qml
new file mode 100644
index 0000000000..6746388e21
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMinorVersionFail.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+// this qml file attempts to import an invalid version of a qobject singleton Type.
+
+import Qt.test.qobjectApi 1.7 as QtTestMinorVersionQObjectApi // qobject singleton Type installed into existing uri with nonexistent minor version
+
+QtObject {
+ property int qobjectMinorVersionTest: QtTestMinorVersionedQObjectApi.qobjectTestProperty
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMultiple.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMultiple.qml
new file mode 100644
index 0000000000..cbb43dfa89
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeMultiple.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Qt.test.qobjectApis 1.0
+
+Item {
+ property int first: One.qobjectTestWritableProperty
+ property int second: Two.twoTestProperty
+
+ Component.onCompleted: {
+ One.qobjectTestWritableProperty = 35;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeResolution.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeResolution.qml
new file mode 100644
index 0000000000..f58149bd62
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonTypeResolution.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import Qt.test.importOrderApi 1.0
+import Qt.test.importOrderApi 1.0 as Namespace
+import NamespaceAndType 1.0
+import NamespaceAndType 1.0 as NamespaceAndType
+
+QtObject {
+ property bool success: false
+
+ Component.onCompleted: {
+ var s0 = Data.value === 37 && Namespace.Data.value === 37 && Data.value === Namespace.Data.value;
+ var s1 = NamespaceAndType.NamespaceAndType.value === 37; // qualifier should shadow typename.
+ var s2 = NamespaceAndType.value === undefined; // should resolve to the qualifier, not the singleton type.
+ success = (s0 === true) && (s1 === true) && (s2 === true);
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/strictlyEquals.qml b/tests/auto/qml/qqmlecmascript/data/strictlyEquals.qml
new file mode 100644
index 0000000000..e709e3a8bd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/strictlyEquals.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test1: (a === true)
+ property bool test2: !(a === false)
+ property bool test3: (b === 11.2)
+ property bool test4: !(b === 9)
+ property bool test5: (c === 9)
+ property bool test6: !(c === 13)
+ property bool test7: (d === "Hello world")
+ property bool test8: !(d === "Hi")
+
+ property bool a: true
+ property real b: 11.2
+ property int c: 9
+ property string d: "Hello world"
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/stringArg.qml b/tests/auto/qml/qqmlecmascript/data/stringArg.qml
new file mode 100644
index 0000000000..7019af9da5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringArg.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool returnValue: false
+
+ property string first
+ property string second
+ property string third
+ property string fourth
+ property string fifth
+ property string sixth
+ property string seventh
+ property string eighth
+ property string ninth
+
+ function success() {
+ var a = "Value is %1";
+ for (var ii = 0; ii < 10; ++ii) {
+ first = a.arg("string");
+ second = a.arg(1);
+ third = a.arg(true);
+ fourth = a.arg(3.345);
+ fifth = a.arg(undefined);
+ sixth = a.arg(null);
+ seventh = a.arg({"test":5});
+ eighth = a.arg({"test":5, "again":6});
+ }
+
+ if (first != "Value is string") returnValue = false;
+ if (second != "Value is 1") returnValue = false;
+ if (third != "Value is true") returnValue = false;
+ if (fourth != "Value is 3.345") returnValue = false;
+ if (fifth != "Value is undefined") returnValue = false;
+ if (sixth != "Value is null") returnValue = false;
+ if (seventh != "Value is [Object object]") returnValue = false;
+ if (eighth != "Value is [Object object]") returnValue = false;
+ returnValue = true;
+ }
+
+ function failure() {
+ returnValue = true;
+ var a = "Value is %1";
+ for (var ii = 0; ii < 10; ++ii) {
+ ninth = a.arg(1,2,3,4);
+ }
+ returnValue = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml
new file mode 100644
index 0000000000..71b82b956d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = "\01";
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml
new file mode 100644
index 0000000000..787f1d86c7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = "\1a";
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml
new file mode 100644
index 0000000000..9954617b6b
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = "\012";
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml
new file mode 100644
index 0000000000..5bf41f0c1a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = "\00a";
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml
new file mode 100644
index 0000000000..563e01a995
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ var x = "\u000G";
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml
new file mode 100644
index 0000000000..8ee5b59d9e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml
@@ -0,0 +1,9 @@
+
+import QtQuick 2.0
+
+QtObject {
+ function code() {
+ "\x0G"
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/switchStatement.1.qml b/tests/auto/qml/qqmlecmascript/data/switchStatement.1.qml
new file mode 100644
index 0000000000..3c7870839d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/switchStatement.1.qml
@@ -0,0 +1,33 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ value: {
+ var value = 0
+ switch (stringProperty) {
+ case "A":
+ value = value + 1
+ value = value + 1
+ /* should fall through */
+ case "S":
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ case "D": { // with curly braces
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ }
+ case "F": {
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ }
+ /* should fall through */
+ default:
+ value = value + 1
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/switchStatement.2.qml b/tests/auto/qml/qqmlecmascript/data/switchStatement.2.qml
new file mode 100644
index 0000000000..928d36be1f
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/switchStatement.2.qml
@@ -0,0 +1,33 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ value: {
+ var value = 0
+ switch (stringProperty) {
+ case "A":
+ value = value + 1
+ value = value + 1
+ /* should fall through */
+ case "S":
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ default:
+ value = value + 1
+ case "D": { // with curly braces
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ }
+ case "F": {
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ }
+ /* should fall through */
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/switchStatement.3.qml b/tests/auto/qml/qqmlecmascript/data/switchStatement.3.qml
new file mode 100644
index 0000000000..5b05d88767
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/switchStatement.3.qml
@@ -0,0 +1,33 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ value: {
+ var value = 0
+ switch (stringProperty) {
+ default:
+ value = value + 1
+ case "A":
+ value = value + 1
+ value = value + 1
+ /* should fall through */
+ case "S":
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ case "D": { // with curly braces
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ }
+ case "F": {
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ }
+ /* should fall through */
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/switchStatement.4.qml b/tests/auto/qml/qqmlecmascript/data/switchStatement.4.qml
new file mode 100644
index 0000000000..43ba199a04
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/switchStatement.4.qml
@@ -0,0 +1,31 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ value: {
+ var value = 0
+ switch (stringProperty) {
+ case "A":
+ value = value + 1
+ value = value + 1
+ /* should fall through */
+ case "S":
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ case "D": { // with curly braces
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ break;
+ }
+ case "F": {
+ value = value + 1
+ value = value + 1
+ value = value + 1
+ }
+ /* should fall through */
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/switchStatement.5.qml b/tests/auto/qml/qqmlecmascript/data/switchStatement.5.qml
new file mode 100644
index 0000000000..e0fc62e392
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/switchStatement.5.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ value: {
+ var value = 0
+ switch (stringProperty) {
+ default:
+ value = value + 1
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/switchStatement.6.qml b/tests/auto/qml/qqmlecmascript/data/switchStatement.6.qml
new file mode 100644
index 0000000000..6fb71eb345
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/switchStatement.6.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ function one(kind) { return 123 }
+ function two(kind) { return 321 }
+
+ value: switch (stringProperty) {
+ case "A": case "S": one(stringProperty); break;
+ case "D": case "F": two(stringProperty); break;
+ default: 0
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/threadScript.js b/tests/auto/qml/qqmlecmascript/data/threadScript.js
new file mode 100644
index 0000000000..9f94de1bc1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/threadScript.js
@@ -0,0 +1,4 @@
+WorkerScript.onMessage = function(msg) {
+ WorkerScript.sendMessage(msg);
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml b/tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml
new file mode 100644
index 0000000000..99bdbf6015
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/threadSignal.2.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyWorkerObject {
+ property bool passed: false
+ onDone: passed = (result == 'good')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/threadSignal.qml b/tests/auto/qml/qqmlecmascript/data/threadSignal.qml
new file mode 100644
index 0000000000..8f0e13b735
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/threadSignal.qml
@@ -0,0 +1,8 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyWorkerObject {
+ property bool passed: false
+ Component.onCompleted: doIt()
+ onDone: passed = (result == 'good')
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/transientErrors.2.qml b/tests/auto/qml/qqmlecmascript/data/transientErrors.2.qml
new file mode 100644
index 0000000000..c44acf4fd1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/transientErrors.2.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property variant a: 10
+ property int x: 10
+ property int test: a.x
+
+ Component.onCompleted: {
+ a = 11;
+ a = root;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/transientErrors.qml b/tests/auto/qml/qqmlecmascript/data/transientErrors.qml
new file mode 100644
index 0000000000..451bb51996
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/transientErrors.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant obj: nested
+
+ property variant obj2
+ obj2: NestedTypeTransientErrors {
+ id: nested
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/tryStatement.1.qml b/tests/auto/qml/qqmlecmascript/data/tryStatement.1.qml
new file mode 100644
index 0000000000..71cc67a941
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/tryStatement.1.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ undefinedObject.method() // this call will throw an exception
+ return 321
+ }
+
+ value: try { go() } catch(e) { defaultValue }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/tryStatement.2.qml b/tests/auto/qml/qqmlecmascript/data/tryStatement.2.qml
new file mode 100644
index 0000000000..e7fca0bff7
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/tryStatement.2.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ return 321
+ }
+
+ value: try { go() } catch(e) { defaultValue }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/tryStatement.3.qml b/tests/auto/qml/qqmlecmascript/data/tryStatement.3.qml
new file mode 100644
index 0000000000..04b39f73d5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/tryStatement.3.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ undefinedObject.method() // this call will throw an exception
+ return 321
+ }
+
+ value: try { var p = go() } catch(e) { var p = defaultValue } finally { p == 123 }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/tryStatement.4.qml b/tests/auto/qml/qqmlecmascript/data/tryStatement.4.qml
new file mode 100644
index 0000000000..231aaf0683
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/tryStatement.4.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property int defaultValue: 123
+
+ function go() {
+ return 321
+ }
+
+ value: try { var p = go() } catch(e) { var p = defaultValue } finally { p == 321 }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/typeOf.js b/tests/auto/qml/qqmlecmascript/data/typeOf.js
new file mode 100644
index 0000000000..16a34234c0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/typeOf.js
@@ -0,0 +1,25 @@
+var test1 = typeof a
+
+var b = {}
+var test2 = typeof b
+
+var c = 5
+var test3 = typeof c
+
+var d = "hello world"
+var test4 = typeof d
+
+var e = function() {}
+var test5 = typeof e
+
+var f = null
+var test6 = typeof f
+
+var g = undefined
+var test7 = typeof g
+
+var h = true
+var test8 = typeof h
+
+var i = []
+var test9 = typeof i
diff --git a/tests/auto/qml/qqmlecmascript/data/typeOf.qml b/tests/auto/qml/qqmlecmascript/data/typeOf.qml
new file mode 100644
index 0000000000..28f7debed5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/typeOf.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import "typeOf.js" as TypeOf
+
+QtObject {
+ property string test1
+ property string test2
+ property string test3
+ property string test4
+ property string test5
+ property string test6
+ property string test7
+ property string test8
+ property string test9
+
+ Component.onCompleted: {
+ test1 = TypeOf.test1
+ test2 = TypeOf.test2
+ test3 = TypeOf.test3
+ test4 = TypeOf.test4
+ test5 = TypeOf.test5
+ test6 = TypeOf.test6
+ test7 = TypeOf.test7
+ test8 = TypeOf.test8
+ test9 = TypeOf.test9
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/unaryExpression.qml b/tests/auto/qml/qqmlecmascript/data/unaryExpression.qml
new file mode 100644
index 0000000000..0d40bec710
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/unaryExpression.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+
+ Component.onCompleted:
+++bar
+
+ property int bar: 0
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.2.qml b/tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.2.qml
new file mode 100644
index 0000000000..e73d38e2ce
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.2.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ resettableProperty: 19
+
+ function doReset() {
+ resettableProperty = undefined;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.qml b/tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.qml
new file mode 100644
index 0000000000..eceff60aa1
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/undefinedResetsProperty.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool setUndefined: false
+
+ resettableProperty: setUndefined?undefined:92
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/urlListProperty.qml b/tests/auto/qml/qqmlecmascript/data/urlListProperty.qml
new file mode 100644
index 0000000000..eeb0815f09
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/urlListProperty.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ // single url assignment to url list property
+ MySequenceConversionObject {
+ id: msco1
+ objectName: "msco1"
+ }
+
+ // single url binding to url list property
+ MySequenceConversionObject {
+ id: msco2
+ objectName: "msco2"
+ urlListProperty: "http://qt-project.org/?get%3cDATA%3e";
+ }
+
+ // multiple url assignment to url list property
+ MySequenceConversionObject {
+ id: msco3
+ objectName: "msco3"
+ }
+
+ // multiple url binding to url list property
+ MySequenceConversionObject {
+ id: msco4
+ objectName: "msco4"
+ urlListProperty: [
+ "http://qt-project.org/?get%3cDATA%3e",
+ "http://qt-project.org/?get%3cDATA%3e"
+ ];
+ }
+
+ Component.onCompleted: {
+ msco1.urlListProperty = "http://qt-project.org/?get%3cDATA%3e";
+ msco3.urlListProperty = [
+ "http://qt-project.org/?get%3cDATA%3e",
+ "http://qt-project.org/?get%3cDATA%3e"
+ ];
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/urlProperty.1.qml b/tests/auto/qml/qqmlecmascript/data/urlProperty.1.qml
new file mode 100644
index 0000000000..451cb03206
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/urlProperty.1.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool result
+ urlProperty: stringProperty + "/index.html"
+ intProperty: if (urlProperty) 123; else 321
+ value: urlProperty == stringProperty + "/index.html"
+ result: urlProperty == urlProperty
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/urlProperty.2.qml b/tests/auto/qml/qqmlecmascript/data/urlProperty.2.qml
new file mode 100644
index 0000000000..0e8bdaec96
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/urlProperty.2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ property bool result
+ stringProperty: "http://example.org"
+ urlProperty: stringProperty + "/?get%3cDATA%3e"
+ value: urlProperty == stringProperty + "/?get%3cDATA%3e"
+ result: urlProperty == urlProperty
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/v8bindingException.qml b/tests/auto/qml/qqmlecmascript/data/v8bindingException.qml
new file mode 100644
index 0000000000..ff203e23e3
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/v8bindingException.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+// This test uses a multi-line string which has \r-terminated
+// string fragments. The expression rewriter deliberately doesn't
+// handle \r-terminated string fragments (see QTBUG-24064) and thus
+// this test ensures that we don't crash when we encounter a
+// non-compilable binding such as this one.
+
+Item {
+ id: root
+
+ Component {
+ id: comp
+ Text {
+ property var value: ","
+ text: 'multi line ' + value + 'str ings'
+ }
+ }
+
+ Component.onCompleted: comp.createObject(root, { "value": undefined })
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/v8functionException.qml b/tests/auto/qml/qqmlecmascript/data/v8functionException.qml
new file mode 100644
index 0000000000..51df1c65d8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/v8functionException.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+// This test uses a multi-line string which has \r-terminated
+// string fragments. The expression rewriter deliberately doesn't
+// handle \r-terminated string fragments (see QTBUG-24064) and thus
+// this test ensures that we don't crash when the client attempts
+// to invoke a non-compiled dynamic slot.
+
+Item {
+ id: root
+
+ function dynamicSlot() {
+ var someString = "Hello, this is a multiline string";
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/valueTypeFunctions.qml b/tests/auto/qml/qqmlecmascript/data/valueTypeFunctions.qml
new file mode 100644
index 0000000000..33b4a68c40
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/valueTypeFunctions.qml
@@ -0,0 +1,6 @@
+import Qt.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/qml/qqmlecmascript/data/varAlias.qml b/tests/auto/qml/qqmlecmascript/data/varAlias.qml
new file mode 100644
index 0000000000..4d1aee2e6d
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/varAlias.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property int test: root.aliasProperty.value
+ property alias aliasProperty: root.varProperty
+ property var varProperty: new Object({ value: 192 });
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/variantsAssignedUndefined.qml b/tests/auto/qml/qqmlecmascript/data/variantsAssignedUndefined.qml
new file mode 100644
index 0000000000..6aa8480365
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/variantsAssignedUndefined.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool runTest: false
+ onRunTestChanged: test1 = undefined
+
+ property variant test1: 10
+ property variant test2: (runTest == false)?11:undefined
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/withStatement.1.qml b/tests/auto/qml/qqmlecmascript/data/withStatement.1.qml
new file mode 100644
index 0000000000..28f0c08451
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/withStatement.1.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ property var other: MyQmlObject {
+ intProperty: 123
+
+ function go() {
+ return intProperty;
+ }
+ }
+
+ value: with(other) go()
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/writeAttachedProperty.qml b/tests/auto/qml/qqmlecmascript/data/writeAttachedProperty.qml
new file mode 100644
index 0000000000..3854b069a0
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/writeAttachedProperty.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+QtObject {
+ function writeValue2() { MyQmlObject.value2 = 9 }
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/writeRemovesBinding.qml b/tests/auto/qml/qqmlecmascript/data/writeRemovesBinding.qml
new file mode 100644
index 0000000000..a1ba5df071
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/writeRemovesBinding.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property bool test: false
+
+ property real data: 9
+ property real binding: data
+
+ property alias aliasProperty: root.aliasBinding
+ property real aliasBinding: data
+
+ Component.onCompleted: {
+ // Non-aliased properties
+ if (binding != 9) return;
+
+ data = 11;
+ if (binding != 11) return;
+
+ binding = 6;
+ if (binding != 6) return;
+
+ data = 3;
+ if (binding != 6) return;
+
+
+ // Writing through an aliased property
+ if (aliasProperty != 3) return;
+ if (aliasBinding != 3) return;
+
+ data = 4;
+ if (aliasProperty != 4) return;
+ if (aliasBinding != 4) return;
+
+ aliasProperty = 19;
+ if (aliasProperty != 19) return;
+ if (aliasBinding != 19) return;
+
+ data = 5;
+ if (aliasProperty != 19) return;
+ if (aliasBinding != 19) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
new file mode 100644
index 0000000000..bc55ed9376
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
@@ -0,0 +1,22 @@
+CONFIG += testcase
+TARGET = tst_qqmlecmascript
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlecmascript.cpp \
+ testtypes.cpp \
+ ../../shared/testhttpserver.cpp
+HEADERS += testtypes.h \
+ ../../shared/testhttpserver.h
+INCLUDEPATH += ../../shared
+
+include (../../shared/util.pri)
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private network testlib
+qtHaveModule(widgets): QT += widgets
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp
new file mode 100644
index 0000000000..8b0278373a
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp
@@ -0,0 +1,329 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+#ifndef QT_NO_WIDGETS
+# include <QWidget>
+# include <QPlainTextEdit>
+#endif
+#include <QQmlEngine>
+#include <QJSEngine>
+#include <QThread>
+
+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;
+};
+
+class DefaultPropertyExtensionObject : public QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("DefaultProperty", "firstProperty")
+public:
+ DefaultPropertyExtensionObject(QObject *parent) : QObject(parent) {}
+};
+
+class QWidgetDeclarativeUI : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
+
+signals:
+ void widthChanged();
+
+public:
+ QWidgetDeclarativeUI(QObject *other) : QObject(other) { }
+
+public:
+ int width() const { return 0; }
+ void setWidth(int) { }
+};
+
+void MyQmlObject::v8function(QQmlV8Function *)
+{
+ const char *error = "Exception thrown from within QObject slot";
+ v8::ThrowException(v8::Exception::Error(v8::String::New(error)));
+}
+
+static QJSValue script_api(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+
+ static int testProperty = 13;
+ QJSValue v = scriptEngine->newObject();
+ v.setProperty("scriptTestProperty", testProperty++);
+ return v;
+}
+
+static QJSValue readonly_script_api(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+
+ static int testProperty = 42;
+ QJSValue v = scriptEngine->newObject();
+ v.setProperty("scriptTestProperty", testProperty++);
+
+ // now freeze it so that it's read-only
+ QJSValue freezeFunction = scriptEngine->evaluate("(function(obj) { return Object.freeze(obj); })");
+ v = freezeFunction.call(QJSValueList() << v);
+
+ return v;
+}
+
+static QObject *testImportOrder_api(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ testImportOrderApi *o = new testImportOrderApi(37);
+ return o;
+}
+
+static QObject *testImportOrder_api1(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ testImportOrderApi *o = new testImportOrderApi(1);
+ return o;
+}
+
+static QObject *testImportOrder_api2(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ testImportOrderApi *o = new testImportOrderApi(2);
+ return o;
+}
+
+static QObject *qobject_api(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ testQObjectApi *o = new testQObjectApi();
+ o->setQObjectTestProperty(20);
+ o->setQObjectTestWritableProperty(50);
+ o->setQObjectTestWritableFinalProperty(10);
+ return o;
+}
+
+static QObject *qobject_api_two(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ testQObjectApiTwo *o = new testQObjectApiTwo;
+ return o;
+}
+
+static QObject *qobject_api_engine_parent(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(scriptEngine)
+
+ static int testProperty = 26;
+ testQObjectApi *o = new testQObjectApi(engine);
+ o->setQObjectTestProperty(testProperty++);
+ return o;
+}
+
+static QObject *fallback_bindings_object(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ return new FallbackBindingsObject();
+}
+
+static QObject *fallback_bindings_derived(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ return new FallbackBindingsDerived();
+}
+
+class MyWorkerObjectThread : public QThread
+{
+public:
+ MyWorkerObjectThread(MyWorkerObject *o) : QThread(o), o(o) { start(); }
+
+ virtual void run() {
+ emit o->done(QLatin1String("good"));
+ }
+
+ MyWorkerObject *o;
+};
+
+void MyWorkerObject::doIt()
+{
+ new MyWorkerObjectThread(this);
+}
+
+class MyStringClass : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE QStringList strings(QStringList stringList) const
+ {
+ return stringList;
+ }
+ Q_INVOKABLE QList<int> integers(QList<int> v) const
+ {
+ return v;
+ }
+ Q_INVOKABLE QList<qreal> reals(QList<qreal> v) const
+ {
+ return v;
+ }
+ Q_INVOKABLE QList<bool> bools(QList<bool> v) const
+ {
+ return v;
+ }
+};
+
+void registerTypes()
+{
+ qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObjectAlias");
+ qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObject");
+ qmlRegisterType<MyDeferredObject>("Qt.test", 1,0, "MyDeferredObject");
+ qmlRegisterType<MyQmlContainer>("Qt.test", 1,0, "MyQmlContainer");
+ qmlRegisterExtendedType<MyBaseExtendedObject, BaseExtensionObject>("Qt.test", 1,0, "MyBaseExtendedObject");
+ qmlRegisterExtendedType<MyExtendedObject, ExtensionObject>("Qt.test", 1,0, "MyExtendedObject");
+ qmlRegisterType<MyTypeObject>("Qt.test", 1,0, "MyTypeObject");
+ qmlRegisterType<MyDerivedObject>("Qt.test", 1,0, "MyDerivedObject");
+ qmlRegisterType<NumberAssignment>("Qt.test", 1,0, "NumberAssignment");
+ qmlRegisterExtendedType<DefaultPropertyExtendedObject, DefaultPropertyExtensionObject>("Qt.test", 1,0, "DefaultPropertyExtendedObject");
+ qmlRegisterType<OverrideDefaultPropertyObject>("Qt.test", 1,0, "OverrideDefaultPropertyObject");
+ qmlRegisterType<MyRevisionedClass>("Qt.test",1,0,"MyRevisionedClass");
+ qmlRegisterType<MyDeleteObject>("Qt.test", 1,0, "MyDeleteObject");
+ qmlRegisterType<MyRevisionedClass,1>("Qt.test",1,1,"MyRevisionedClass");
+ qmlRegisterType<MyWorkerObject>("Qt.test", 1,0, "MyWorkerObject");
+
+ // test scarce resource property binding post-evaluation optimization
+ // and for testing memory usage in property var circular reference test
+ qmlRegisterType<ScarceResourceObject>("Qt.test", 1,0, "MyScarceResourceObject");
+
+ // Register the uncreatable base class
+ qmlRegisterRevision<MyRevisionedBaseClassRegistered,1>("Qt.test",1,1);
+ // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0
+ qmlRegisterType<MyRevisionedSubclass>("Qt.test",1,0,"MyRevisionedSubclass");
+ // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
+ qmlRegisterType<MyRevisionedSubclass,1>("Qt.test",1,1,"MyRevisionedSubclass");
+
+#ifndef QT_NO_WIDGETS
+ qmlRegisterExtendedType<QWidget,QWidgetDeclarativeUI>("Qt.test",1,0,"QWidget");
+ qmlRegisterType<QPlainTextEdit>("Qt.test",1,0,"QPlainTextEdit");
+#endif
+
+ qRegisterMetaType<MyQmlObject::MyType>("MyQmlObject::MyType");
+
+ qmlRegisterSingletonType("Qt.test",1,0,"Script",script_api); // register (script) singleton Type for an existing uri which contains elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test",1,0,"QObject",qobject_api); // register (qobject) for an existing uri for which another singleton Type was previously regd. Should replace!
+ qmlRegisterSingletonType("Qt.test.scriptApi",1,0,"Script",script_api); // register (script) singleton Type for a uri which doesn't contain elements
+ qmlRegisterSingletonType("Qt.test.scriptApi",2,0,"Script",readonly_script_api); // register (script) singleton Type for a uri which doesn't contain elements - will be made read-only
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,0,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,3,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, minor version set
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",2,0,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, major version set
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApiParented",1,0,"QObject",qobject_api_engine_parent); // register (parented qobject) singleton Type for a uri which doesn't contain elements
+
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApis",1,0,"One",qobject_api); // register multiple qobject singleton types in a single namespace
+ qmlRegisterSingletonType<testQObjectApiTwo>("Qt.test.qobjectApis",1,0,"Two",qobject_api_two); // register multiple qobject singleton types in a single namespace
+
+ qRegisterMetaType<MyQmlObject::MyEnum2>("MyEnum2");
+ qRegisterMetaType<Qt::MouseButtons>("Qt::MouseButtons");
+
+ qmlRegisterType<CircularReferenceObject>("Qt.test", 1, 0, "CircularReferenceObject");
+ qmlRegisterType<CircularReferenceHandle>("Qt.test", 1, 0, "CircularReferenceHandle");
+
+ qmlRegisterType<MyDynamicCreationDestructionObject>("Qt.test", 1, 0, "MyDynamicCreationDestructionObject");
+ qmlRegisterType<WriteCounter>("Qt.test", 1, 0, "WriteCounter");
+
+ qmlRegisterType<MySequenceConversionObject>("Qt.test", 1, 0, "MySequenceConversionObject");
+
+ qmlRegisterType<MyUnregisteredEnumTypeObject>("Qt.test", 1, 0, "MyUnregisteredEnumTypeObject");
+
+ qmlRegisterSingletonType<FallbackBindingsObject>("Qt.test.fallbackBindingsObject", 1, 0, "Fallback", fallback_bindings_object);
+ qmlRegisterSingletonType<FallbackBindingsObject>("Qt.test.fallbackBindingsDerived", 1, 0, "Fallback", fallback_bindings_derived);
+
+ qmlRegisterType<FallbackBindingsObject>("Qt.test.fallbackBindingsItem", 1, 0, "FallbackBindingsType");
+ qmlRegisterType<FallbackBindingsDerived>("Qt.test.fallbackBindingsItem", 1, 0, "FallbackBindingsDerivedType");
+
+ qmlRegisterType<FallbackBindingsTypeObject>("Qt.test.fallbackBindingsObject", 1, 0, "FallbackBindingsType");
+ qmlRegisterType<FallbackBindingsTypeDerived>("Qt.test.fallbackBindingsDerived", 1, 0, "FallbackBindingsType");
+
+ qmlRegisterType<MyStringClass>("Qt.test", 1, 0, "MyStringClass");
+
+ qmlRegisterSingletonType<testImportOrderApi>("Qt.test.importOrderApi",1,0,"Data",testImportOrder_api);
+ qmlRegisterSingletonType<testImportOrderApi>("NamespaceAndType",1,0,"NamespaceAndType",testImportOrder_api);
+ qmlRegisterSingletonType<testImportOrderApi>("Qt.test.importOrderApi1",1,0,"Data",testImportOrder_api1);
+ qmlRegisterSingletonType<testImportOrderApi>("Qt.test.importOrderApi2",1,0,"Data",testImportOrder_api2);
+}
+
+#include "testtypes.moc"
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
new file mode 100644
index 0000000000..e4dd1e3e18
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -0,0 +1,1657 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qsize.h>
+#include <QtQml/qqmllist.h>
+#include <QtCore/qrect.h>
+#include <QtGui/qmatrix.h>
+#include <QtGui/qcolor.h>
+#include <QtGui/qvector3d.h>
+#include <QtGui/QFont>
+#include <QtGui/QPixmap>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qjsonarray.h>
+#include <QtCore/qjsonobject.h>
+#include <QtCore/qjsonvalue.h>
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qqmlscriptstring.h>
+#include <QtQml/qqmlcomponent.h>
+
+#include <private/qqmlengine_p.h>
+#include <private/qv8engine_p.h>
+
+class MyQmlAttachedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value CONSTANT)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2 NOTIFY value2Changed)
+public:
+ MyQmlAttachedObject(QObject *parent) : QObject(parent), m_value2(0) {}
+
+ int value() const { return 19; }
+ int value2() const { return m_value2; }
+ void setValue2(int v) { if (m_value2 == v) return; m_value2 = v; emit value2Changed(); }
+
+ void emitMySignal() { emit mySignal(); }
+
+signals:
+ void value2Changed();
+ void mySignal();
+
+private:
+ int m_value2;
+};
+
+class MyEnumContainer : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(RelatedEnum)
+
+public:
+ enum RelatedEnum { RelatedInvalid = -1, RelatedValue = 42, MultiplyDefined = 666 };
+};
+
+class MyQmlObject : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(MyEnum)
+ Q_ENUMS(MyEnum2)
+ Q_ENUMS(MyEnum3)
+ Q_ENUMS(MyEnumContainer::RelatedEnum)
+ Q_PROPERTY(int deleteOnSet READ deleteOnSet WRITE setDeleteOnSet)
+ Q_PROPERTY(bool trueProperty READ trueProperty CONSTANT)
+ Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT)
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int console READ console CONSTANT)
+ Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged)
+ Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty NOTIFY urlChanged)
+ Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged)
+ Q_PROPERTY(QQmlListProperty<QObject> objectListProperty READ objectListProperty CONSTANT)
+ Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty)
+ Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp)
+ Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false)
+ Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty NOTIFY intChanged)
+ Q_PROPERTY(QJSValue qjsvalue READ qjsvalue WRITE setQJSValue NOTIFY qjsvalueChanged)
+ Q_PROPERTY(QJSValue qjsvalueWithReset READ qjsvalue WRITE setQJSValue RESET resetQJSValue NOTIFY qjsvalueChanged)
+ Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty)
+ Q_PROPERTY(MyEnumContainer::RelatedEnum relatedEnumProperty READ relatedEnumProperty WRITE setRelatedEnumProperty)
+ Q_PROPERTY(MyEnumContainer::RelatedEnum unrelatedEnumProperty READ unrelatedEnumProperty WRITE setUnrelatedEnumProperty)
+ Q_PROPERTY(MyEnum qtEnumProperty READ qtEnumProperty WRITE setQtEnumProperty)
+
+public:
+ MyQmlObject(): myinvokableObject(0), m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13), m_intProperty(0), m_buttons(0) {}
+
+ enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 };
+ enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3, EnumValue5 = -1 };
+ enum MyEnum3 { MultiplyDefined = 333 };
+
+ 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();
+ }
+
+ QUrl urlProperty() const { return m_url; }
+ void setUrlProperty(const QUrl &url)
+ {
+ if (url == m_url)
+ return;
+ m_url = url;
+ emit urlChanged();
+ }
+
+ QObject *objectProperty() const { return m_object; }
+ void setObjectProperty(QObject *obj) {
+ if (obj == m_object)
+ return;
+ m_object = obj;
+ emit objectChanged();
+ }
+
+ QQmlListProperty<QObject> objectListProperty() { return QQmlListProperty<QObject>(this, m_objectQList); }
+
+ bool methodCalled() const { return m_methodCalled; }
+ bool methodIntCalled() const { return m_methodIntCalled; }
+
+ QString string() const { return m_string; }
+
+ static MyQmlAttachedObject *qmlAttachedProperties(QObject *o) {
+ return new MyQmlAttachedObject(o);
+ }
+
+ int deleteOnSet() const { return 1; }
+ void setDeleteOnSet(int v) { if(v) delete this; }
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; }
+
+ int resettableProperty() const { return m_resetProperty; }
+ void setResettableProperty(int v) { m_resetProperty = v; }
+ void resetProperty() { m_resetProperty = 13; }
+
+ QRegExp regExp() { return m_regExp; }
+ void setRegExp(const QRegExp &regExp) { m_regExp = regExp; }
+
+ int console() const { return 11; }
+
+ int nonscriptable() const { return 0; }
+ void setNonscriptable(int) {}
+
+ MyQmlObject *myinvokableObject;
+ Q_INVOKABLE MyQmlObject *returnme() { return this; }
+
+ struct MyType {
+ int value;
+ };
+ struct MyOtherType {
+ int value;
+ };
+ QVariant variant() const { return m_variant; }
+ QJSValue qjsvalue() const { return m_qjsvalue; }
+ void setQJSValue(const QJSValue &value) { m_qjsvalue = value; emit qjsvalueChanged(); }
+ void resetQJSValue() { m_qjsvalue = QJSValue(QLatin1String("Reset!")); emit qjsvalueChanged(); }
+
+ Qt::MouseButtons buttons() const { return m_buttons; }
+
+ int intProperty() const { return m_intProperty; }
+ void setIntProperty(int i) { m_intProperty = i; emit intChanged(); }
+
+ Q_INVOKABLE MyEnum2 getEnumValue() const { return EnumValue4; }
+
+ MyEnum enumPropertyValue;
+ MyEnum enumProperty() const {
+ return enumPropertyValue;
+ }
+ void setEnumProperty(MyEnum v) {
+ enumPropertyValue = v;
+ }
+
+ MyEnumContainer::RelatedEnum relatedEnumPropertyValue;
+ MyEnumContainer::RelatedEnum relatedEnumProperty() const {
+ return relatedEnumPropertyValue;
+ }
+ void setRelatedEnumProperty(MyEnumContainer::RelatedEnum v) {
+ relatedEnumPropertyValue = v;
+ }
+
+ MyEnumContainer::RelatedEnum unrelatedEnumPropertyValue;
+ MyEnumContainer::RelatedEnum unrelatedEnumProperty() const {
+ return unrelatedEnumPropertyValue;
+ }
+ void setUnrelatedEnumProperty(MyEnumContainer::RelatedEnum v) {
+ unrelatedEnumPropertyValue = v;
+ }
+
+ MyEnum qtEnumPropertyValue;
+ MyEnum qtEnumProperty() const {
+ return qtEnumPropertyValue;
+ }
+ void setQtEnumProperty(MyEnum v) {
+ qtEnumPropertyValue = v;
+ }
+
+signals:
+ void basicSignal();
+ void argumentSignal(int a, QString b, qreal c, MyEnum2 d, Qt::MouseButtons e);
+ void unnamedArgumentSignal(int a, qreal, QString c);
+ void stringChanged();
+ void urlChanged();
+ void objectChanged();
+ void anotherBasicSignal();
+ void thirdBasicSignal();
+ void signalWithUnknownType(const MyQmlObject::MyType &arg);
+ void signalWithCompletelyUnknownType(const MyQmlObject::MyOtherType &arg);
+ void signalWithVariant(const QVariant &arg);
+ void signalWithQJSValue(const QJSValue &arg);
+ void signalWithGlobalName(int parseInt);
+ void intChanged();
+ void qjsvalueChanged();
+
+public slots:
+ void deleteMe() { delete this; }
+ void methodNoArgs() { m_methodCalled = true; }
+ void method(int a) { if(a == 163) m_methodIntCalled = true; }
+ void setString(const QString &s) { m_string = s; }
+ void myinvokable(MyQmlObject *o) { myinvokableObject = o; }
+ void variantMethod(const QVariant &v) { m_variant = v; }
+ void qjsvalueMethod(const QJSValue &v) { m_qjsvalue = v; }
+ void v8function(QQmlV8Function*);
+ void registeredFlagMethod(Qt::MouseButtons v) { m_buttons = v; }
+
+private:
+ friend class tst_qqmlecmascript;
+ bool m_methodCalled;
+ bool m_methodIntCalled;
+
+ QObject *m_object;
+ QString m_string;
+ QUrl m_url;
+ QList<QObject *> m_objectQList;
+ int m_value;
+ int m_resetProperty;
+ QRegExp m_regExp;
+ QVariant m_variant;
+ QJSValue m_qjsvalue;
+ int m_intProperty;
+ Qt::MouseButtons m_buttons;
+};
+Q_DECLARE_METATYPE(QQmlListProperty<MyQmlObject>)
+
+QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
+
+class MyQmlContainer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<MyQmlObject> children READ children CONSTANT)
+public:
+ MyQmlContainer() {}
+
+ QQmlListProperty<MyQmlObject> children() { return QQmlListProperty<MyQmlObject>(this, m_children); }
+
+private:
+ QList<MyQmlObject*> m_children;
+};
+
+
+class MyExpression : public QQmlExpression
+{
+ Q_OBJECT
+public:
+ MyExpression(QQmlContext *ctxt, const QString &expr)
+ : QQmlExpression(ctxt, 0, expr), changed(false)
+ {
+ QObject::connect(this, SIGNAL(valueChanged()), this, SLOT(expressionValueChanged()));
+ setNotifyOnValueChanged(true);
+ }
+
+ bool changed;
+
+public slots:
+ void expressionValueChanged() {
+ changed = true;
+ }
+};
+
+
+class MyDefaultObject1 : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int horseLegs READ horseLegs CONSTANT)
+ Q_PROPERTY(int antLegs READ antLegs CONSTANT)
+ Q_PROPERTY(int emuLegs READ emuLegs CONSTANT)
+public:
+ int horseLegs() const { return 4; }
+ int antLegs() const { return 6; }
+ int emuLegs() const { return 2; }
+};
+
+class MyDefaultObject3 : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int antLegs READ antLegs CONSTANT)
+ Q_PROPERTY(int humanLegs READ humanLegs CONSTANT)
+public:
+ int antLegs() const { return 7; } // Mutant
+ int humanLegs() const { return 2; }
+ int millipedeLegs() const { return 1000; }
+};
+
+class MyDeferredObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
+ Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty)
+ Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2)
+ Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2")
+
+public:
+ MyDeferredObject() : m_value(0), m_object(0), m_object2(0) {}
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; emit valueChanged(); }
+
+ QObject *objectProperty() const { return m_object; }
+ void setObjectProperty(QObject *obj) { m_object = obj; }
+
+ QObject *objectProperty2() const { return m_object2; }
+ void setObjectProperty2(QObject *obj) { m_object2 = obj; }
+
+signals:
+ void valueChanged();
+
+private:
+ int m_value;
+ QObject *m_object;
+ QObject *m_object2;
+};
+
+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;
+};
+
+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;
+};
+
+class MyTypeObject : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(MyEnum)
+ Q_ENUMS(MyEnumContainer::RelatedEnum)
+ Q_FLAGS(MyFlags)
+
+ Q_PROPERTY(QString id READ id WRITE setId)
+ Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty)
+ Q_PROPERTY(QQmlComponent *componentProperty READ componentProperty WRITE setComponentProperty)
+ Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty)
+ Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty)
+ Q_PROPERTY(MyEnumContainer::RelatedEnum relatedEnumProperty READ relatedEnumProperty WRITE setRelatedEnumProperty)
+ Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty)
+ Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty)
+ Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty)
+ Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty)
+ Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty)
+ Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty)
+ Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty)
+ Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty)
+ Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty)
+ Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty)
+ Q_PROPERTY(QDateTime dateTimeProperty2 READ dateTimeProperty2 WRITE setDateTimeProperty2)
+ Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty)
+ Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty)
+ Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty)
+ Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty)
+ Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged)
+ Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2)
+ Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty)
+ Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty)
+ Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty)
+ Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty)
+ Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty)
+
+ Q_PROPERTY(QQmlScriptString scriptProperty READ scriptProperty WRITE setScriptProperty)
+
+public:
+ MyTypeObject()
+ : objectPropertyValue(0), componentPropertyValue(0) {}
+
+ QString idValue;
+ QString id() const {
+ return idValue;
+ }
+ void setId(const QString &v) {
+ idValue = v;
+ }
+
+ QObject *objectPropertyValue;
+ QObject *objectProperty() const {
+ return objectPropertyValue;
+ }
+ void setObjectProperty(QObject *v) {
+ objectPropertyValue = v;
+ }
+
+ QQmlComponent *componentPropertyValue;
+ QQmlComponent *componentProperty() const {
+ return componentPropertyValue;
+ }
+ void setComponentProperty(QQmlComponent *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;
+ }
+
+ MyEnumContainer::RelatedEnum relatedEnumPropertyValue;
+ MyEnumContainer::RelatedEnum relatedEnumProperty() const {
+ return relatedEnumPropertyValue;
+ }
+ void setRelatedEnumProperty(MyEnumContainer::RelatedEnum v) {
+ relatedEnumPropertyValue = v;
+ }
+
+ QString stringPropertyValue;
+ QString stringProperty() const {
+ return stringPropertyValue;
+ }
+ void setStringProperty(const QString &v) {
+ stringPropertyValue = v;
+ }
+
+ uint uintPropertyValue;
+ uint uintProperty() const {
+ return uintPropertyValue;
+ }
+ void setUintProperty(const uint &v) {
+ uintPropertyValue = v;
+ }
+
+ int intPropertyValue;
+ int intProperty() const {
+ return intPropertyValue;
+ }
+ void setIntProperty(const int &v) {
+ intPropertyValue = v;
+ }
+
+ qreal realPropertyValue;
+ qreal realProperty() const {
+ return realPropertyValue;
+ }
+ void setRealProperty(const qreal &v) {
+ realPropertyValue = v;
+ }
+
+ double doublePropertyValue;
+ double doubleProperty() const {
+ return doublePropertyValue;
+ }
+ void setDoubleProperty(const double &v) {
+ doublePropertyValue = v;
+ }
+
+ float floatPropertyValue;
+ float floatProperty() const {
+ return floatPropertyValue;
+ }
+ void setFloatProperty(const float &v) {
+ floatPropertyValue = v;
+ }
+
+ QColor colorPropertyValue;
+ QColor colorProperty() const {
+ return colorPropertyValue;
+ }
+ void setColorProperty(const QColor &v) {
+ colorPropertyValue = v;
+ }
+
+ QDate datePropertyValue;
+ QDate dateProperty() const {
+ return datePropertyValue;
+ }
+ void setDateProperty(const QDate &v) {
+ datePropertyValue = v;
+ }
+
+ QTime timePropertyValue;
+ QTime timeProperty() const {
+ return timePropertyValue;
+ }
+ void setTimeProperty(const QTime &v) {
+ timePropertyValue = v;
+ }
+
+ QDateTime dateTimePropertyValue;
+ QDateTime dateTimeProperty() const {
+ return dateTimePropertyValue;
+ }
+ void setDateTimeProperty(const QDateTime &v) {
+ dateTimePropertyValue = v;
+ }
+
+ QDateTime dateTimePropertyValue2;
+ QDateTime dateTimeProperty2() const {
+ return dateTimePropertyValue2;
+ }
+ void setDateTimeProperty2(const QDateTime &v) {
+ dateTimePropertyValue2 = v;
+ }
+
+ QPoint pointPropertyValue;
+ QPoint pointProperty() const {
+ return pointPropertyValue;
+ }
+ void setPointProperty(const QPoint &v) {
+ pointPropertyValue = v;
+ }
+
+ QPointF pointFPropertyValue;
+ QPointF pointFProperty() const {
+ return pointFPropertyValue;
+ }
+ void setPointFProperty(const QPointF &v) {
+ pointFPropertyValue = v;
+ }
+
+ QSize sizePropertyValue;
+ QSize sizeProperty() const {
+ return sizePropertyValue;
+ }
+ void setSizeProperty(const QSize &v) {
+ sizePropertyValue = v;
+ }
+
+ QSizeF sizeFPropertyValue;
+ QSizeF sizeFProperty() const {
+ return sizeFPropertyValue;
+ }
+ void setSizeFProperty(const QSizeF &v) {
+ sizeFPropertyValue = v;
+ }
+
+ QRect rectPropertyValue;
+ QRect rectProperty() const {
+ return rectPropertyValue;
+ }
+ void setRectProperty(const QRect &v) {
+ rectPropertyValue = v;
+ emit rectPropertyChanged();
+ }
+
+ QRect rectPropertyValue2;
+ QRect rectProperty2() const {
+ return rectPropertyValue2;
+ }
+ void setRectProperty2(const QRect &v) {
+ rectPropertyValue2 = v;
+ }
+
+ QRectF rectFPropertyValue;
+ QRectF rectFProperty() const {
+ return rectFPropertyValue;
+ }
+ void setRectFProperty(const QRectF &v) {
+ rectFPropertyValue = v;
+ }
+
+ bool boolPropertyValue;
+ bool boolProperty() const {
+ return boolPropertyValue;
+ }
+ void setBoolProperty(const bool &v) {
+ boolPropertyValue = v;
+ }
+
+ QVariant variantPropertyValue;
+ QVariant variantProperty() const {
+ return variantPropertyValue;
+ }
+ void setVariantProperty(const QVariant &v) {
+ variantPropertyValue = v;
+ }
+
+ QVector3D vectorPropertyValue;
+ QVector3D vectorProperty() const {
+ return vectorPropertyValue;
+ }
+ void setVectorProperty(const QVector3D &v) {
+ vectorPropertyValue = v;
+ }
+
+ QUrl urlPropertyValue;
+ QUrl urlProperty() const {
+ return urlPropertyValue;
+ }
+ void setUrlProperty(const QUrl &v) {
+ urlPropertyValue = v;
+ }
+
+ QQmlScriptString scriptPropertyValue;
+ QQmlScriptString scriptProperty() const {
+ return scriptPropertyValue;
+ }
+ void setScriptProperty(const QQmlScriptString &v) {
+ scriptPropertyValue = v;
+ }
+
+ void doAction() { emit action(); }
+signals:
+ void action();
+ void rectPropertyChanged();
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
+
+class MyDerivedObject : public MyTypeObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE bool intProperty() const {
+ return true;
+ }
+};
+
+class MyInvokableBaseObject : public QObject
+{
+ Q_OBJECT
+public:
+ inline ~MyInvokableBaseObject() = 0;
+
+ Q_INVOKABLE inline void method_inherited(int a);
+ Q_INVOKABLE inline void method_overload();
+};
+
+struct NonRegisteredType
+{
+
+};
+
+class MyInvokableObject : public MyInvokableBaseObject
+{
+ Q_OBJECT
+ Q_ENUMS(TestEnum)
+public:
+ enum TestEnum { EnumValue1, EnumValue2 };
+ MyInvokableObject() { reset(); }
+
+ int invoked() const { return m_invoked; }
+ bool error() const { return m_invokedError; }
+ const QVariantList &actuals() const { return m_actuals; }
+ void reset() { m_invoked = -1; m_invokedError = false; m_actuals.clear(); }
+
+ Q_INVOKABLE QPointF method_get_QPointF() { return QPointF(99.3, -10.2); }
+ Q_INVOKABLE QPoint method_get_QPoint() { return QPoint(9, 12); }
+
+ Q_INVOKABLE void method_NoArgs() { invoke(0); }
+ Q_INVOKABLE int method_NoArgs_int() { invoke(1); return 6; }
+ Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.75; }
+ Q_INVOKABLE QPointF method_NoArgs_QPointF() { invoke(3); return QPointF(123, 4.5); }
+ Q_INVOKABLE QObject *method_NoArgs_QObject() { invoke(4); return this; }
+ Q_INVOKABLE MyInvokableObject *method_NoArgs_unknown() { invoke(5); return this; }
+ Q_INVOKABLE QJSValue method_NoArgs_QScriptValue() { invoke(6); return QJSValue("Hello world"); }
+ Q_INVOKABLE QVariant method_NoArgs_QVariant() { invoke(7); return QVariant("QML rocks"); }
+
+ Q_INVOKABLE void method_int(int a) { invoke(8); m_actuals << a; }
+ Q_INVOKABLE void method_intint(int a, int b) { invoke(9); m_actuals << a << b; }
+ Q_INVOKABLE void method_real(qreal a) { invoke(10); m_actuals << a; }
+ Q_INVOKABLE void method_QString(QString a) { invoke(11); m_actuals << a; }
+ Q_INVOKABLE void method_QPointF(QPointF a) { invoke(12); m_actuals << a; }
+ Q_INVOKABLE void method_QObject(QObject *a) { invoke(13); m_actuals << qVariantFromValue(a); }
+ Q_INVOKABLE void method_QScriptValue(QJSValue a) { invoke(14); m_actuals << qVariantFromValue(a); }
+ Q_INVOKABLE void method_intQScriptValue(int a, QJSValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); }
+
+ Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; }
+ Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; }
+ Q_INVOKABLE void method_overload(QString a) { invoke(18); m_actuals << a; }
+
+ Q_INVOKABLE void method_with_enum(TestEnum e) { invoke(19); m_actuals << (int)e; }
+
+ Q_INVOKABLE int method_default(int a, int b = 19) { invoke(20); m_actuals << a << b; return b; }
+
+ Q_INVOKABLE void method_QVariant(QVariant a, QVariant b = QVariant()) { invoke(21); m_actuals << a << b; }
+
+ Q_INVOKABLE void method_QJsonObject(const QJsonObject &a) { invoke(22); m_actuals << QVariant::fromValue(a); }
+ Q_INVOKABLE void method_QJsonArray(const QJsonArray &a) { invoke(23); m_actuals << QVariant::fromValue(a); }
+ Q_INVOKABLE void method_QJsonValue(const QJsonValue &a) { invoke(24); m_actuals << QVariant::fromValue(a); }
+
+ Q_INVOKABLE void method_overload(const QJsonObject &a) { invoke(25); m_actuals << QVariant::fromValue(a); }
+ Q_INVOKABLE void method_overload(const QJsonArray &a) { invoke(26); m_actuals << QVariant::fromValue(a); }
+ Q_INVOKABLE void method_overload(const QJsonValue &a) { invoke(27); m_actuals << QVariant::fromValue(a); }
+
+ Q_INVOKABLE void method_unknown(NonRegisteredType) { invoke(28); }
+
+private:
+ friend class MyInvokableBaseObject;
+ void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;}
+ int m_invoked;
+ bool m_invokedError;
+ QVariantList m_actuals;
+};
+
+MyInvokableBaseObject::~MyInvokableBaseObject() {}
+
+void MyInvokableBaseObject::method_inherited(int a)
+{
+ static_cast<MyInvokableObject *>(this)->invoke(-3);
+ static_cast<MyInvokableObject *>(this)->m_actuals << a;
+}
+
+// This is a hidden overload of the MyInvokableObject::method_overload() method
+void MyInvokableBaseObject::method_overload()
+{
+ static_cast<MyInvokableObject *>(this)->invoke(-2);
+}
+
+class NumberAssignment : public QObject
+{
+ Q_OBJECT
+public:
+ Q_PROPERTY(qreal test1 READ test1 WRITE setTest1)
+ qreal _test1;
+ qreal test1() const { return _test1; }
+ void setTest1(qreal v) { _test1 = v; }
+
+ Q_PROPERTY(qreal test2 READ test2 WRITE setTest2)
+ qreal _test2;
+ qreal test2() const { return _test2; }
+ void setTest2(qreal v) { _test2 = v; }
+
+ Q_PROPERTY(qreal test3 READ test3 WRITE setTest3)
+ qreal _test3;
+ qreal test3() const { return _test3; }
+ void setTest3(qreal v) { _test3 = v; }
+
+ Q_PROPERTY(qreal test4 READ test4 WRITE setTest4)
+ qreal _test4;
+ qreal test4() const { return _test4; }
+ void setTest4(qreal v) { _test4 = v; }
+
+ Q_PROPERTY(int test5 READ test5 WRITE setTest5)
+ int _test5;
+ int test5() const { return _test5; }
+ void setTest5(int v) { _test5 = v; }
+
+ Q_PROPERTY(int test6 READ test6 WRITE setTest6)
+ int _test6;
+ int test6() const { return _test6; }
+ void setTest6(int v) { _test6 = v; }
+
+ Q_PROPERTY(int test7 READ test7 WRITE setTest7)
+ int _test7;
+ int test7() const { return _test7; }
+ void setTest7(int v) { _test7 = v; }
+
+ Q_PROPERTY(int test8 READ test8 WRITE setTest8)
+ int _test8;
+ int test8() const { return _test8; }
+ void setTest8(int v) { _test8 = v; }
+
+ Q_PROPERTY(unsigned int test9 READ test9 WRITE setTest9)
+ unsigned int _test9;
+ unsigned int test9() const { return _test9; }
+ void setTest9(unsigned int v) { _test9 = v; }
+
+ Q_PROPERTY(unsigned int test10 READ test10 WRITE setTest10)
+ unsigned int _test10;
+ unsigned int test10() const { return _test10; }
+ void setTest10(unsigned int v) { _test10 = v; }
+
+ Q_PROPERTY(unsigned int test11 READ test11 WRITE setTest11)
+ unsigned int _test11;
+ unsigned int test11() const { return _test11; }
+ void setTest11(unsigned int v) { _test11 = v; }
+
+ Q_PROPERTY(unsigned int test12 READ test12 WRITE setTest12)
+ unsigned int _test12;
+ unsigned int test12() const { return _test12; }
+ void setTest12(unsigned int v) { _test12 = v; }
+};
+
+class DefaultPropertyExtendedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *firstProperty READ firstProperty WRITE setFirstProperty)
+ Q_PROPERTY(QObject *secondProperty READ secondProperty WRITE setSecondProperty)
+public:
+ DefaultPropertyExtendedObject(QObject *parent = 0) : QObject(parent), m_firstProperty(0), m_secondProperty(0) {}
+
+ QObject *firstProperty() const { return m_firstProperty; }
+ QObject *secondProperty() const { return m_secondProperty; }
+ void setFirstProperty(QObject *property) { m_firstProperty = property; }
+ void setSecondProperty(QObject *property) { m_secondProperty = property; }
+private:
+ QObject* m_firstProperty;
+ QObject* m_secondProperty;
+};
+
+class OverrideDefaultPropertyObject : public DefaultPropertyExtendedObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("DefaultProperty", "secondProperty")
+public:
+ OverrideDefaultPropertyObject() {}
+};
+
+class MyRevisionedBaseClassRegistered : public QObject
+{
+Q_OBJECT
+ Q_PROPERTY(qreal propA READ propA WRITE setPropA NOTIFY propAChanged)
+ Q_PROPERTY(qreal propB READ propB WRITE setPropB NOTIFY propBChanged REVISION 1)
+
+public:
+ MyRevisionedBaseClassRegistered() : m_pa(1), m_pb(2) {}
+
+ qreal propA() const { return m_pa; }
+ void setPropA(qreal p) {
+ if (p != m_pa) {
+ m_pa = p;
+ emit propAChanged();
+ }
+ }
+ qreal propB() const { return m_pb; }
+ void setPropB(qreal p) {
+ if (p != m_pb) {
+ m_pb = p;
+ emit propBChanged();
+ }
+ }
+
+ Q_INVOKABLE void methodA() { }
+ Q_INVOKABLE Q_REVISION(1) void methodB() { }
+
+signals:
+ void propAChanged();
+ void propBChanged();
+
+ void signalA();
+ Q_REVISION(1) void signalB();
+
+protected:
+ qreal m_pa;
+ qreal m_pb;
+};
+
+class MyRevisionedBaseClassUnregistered : public MyRevisionedBaseClassRegistered
+{
+Q_OBJECT
+ Q_PROPERTY(qreal propC READ propC WRITE setPropC NOTIFY propCChanged)
+ Q_PROPERTY(qreal propD READ propD WRITE setPropD NOTIFY propDChanged REVISION 1)
+
+public:
+ MyRevisionedBaseClassUnregistered() : m_pc(1), m_pd(2) {}
+
+ qreal propC() const { return m_pc; }
+ void setPropC(qreal p) {
+ if (p != m_pc) {
+ m_pc = p;
+ emit propCChanged();
+ }
+ }
+ qreal propD() const { return m_pd; }
+ void setPropD(qreal p) {
+ if (p != m_pd) {
+ m_pd = p;
+ emit propDChanged();
+ }
+ }
+
+ Q_INVOKABLE void methodC() { }
+ Q_INVOKABLE Q_REVISION(1) void methodD() { }
+
+signals:
+ void propCChanged();
+ void propDChanged();
+
+ void signalC();
+ Q_REVISION(1) void signalD();
+
+protected:
+ qreal m_pc;
+ qreal m_pd;
+};
+
+class MyRevisionedClass : public MyRevisionedBaseClassUnregistered
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal prop1 READ prop1 WRITE setProp1 NOTIFY prop1Changed)
+ Q_PROPERTY(qreal prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed REVISION 1)
+
+public:
+ MyRevisionedClass() {}
+
+ qreal prop1() const { return m_p1; }
+ void setProp1(qreal p) {
+ if (p != m_p1) {
+ m_p1 = p;
+ emit prop1Changed();
+ }
+ }
+ qreal prop2() const { return m_p2; }
+ void setProp2(qreal p) {
+ if (p != m_p2) {
+ m_p2 = p;
+ emit prop2Changed();
+ }
+ }
+
+ Q_INVOKABLE void method1() { }
+ Q_INVOKABLE Q_REVISION(1) void method2() { }
+
+signals:
+ void prop1Changed();
+ void prop2Changed();
+
+ void signal1();
+ Q_REVISION(1) void signal2();
+
+protected:
+ qreal m_p1;
+ qreal m_p2;
+};
+
+class MyRevisionedSubclass : public MyRevisionedClass
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal prop3 READ prop3 WRITE setProp3 NOTIFY prop3Changed)
+ Q_PROPERTY(qreal prop4 READ prop4 WRITE setProp4 NOTIFY prop4Changed REVISION 1)
+
+public:
+ MyRevisionedSubclass() : m_p3(3), m_p4(4) {}
+
+ qreal prop3() const { return m_p3; }
+ void setProp3(qreal p) {
+ if (p != m_p3) {
+ m_p3 = p;
+ emit prop3Changed();
+ }
+ }
+ qreal prop4() const { return m_p4; }
+ void setProp4(qreal p) {
+ if (p != m_p4) {
+ m_p4 = p;
+ emit prop4Changed();
+ }
+ }
+
+ Q_INVOKABLE void method3() { }
+ Q_INVOKABLE Q_REVISION(1) void method4() { }
+
+signals:
+ void prop3Changed();
+ void prop4Changed();
+
+ void signal3();
+ Q_REVISION(1) void signal4();
+
+protected:
+ qreal m_p3;
+ qreal m_p4;
+};
+
+QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered)
+QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered)
+QML_DECLARE_TYPE(MyRevisionedClass)
+QML_DECLARE_TYPE(MyRevisionedSubclass)
+Q_DECLARE_METATYPE(MyQmlObject::MyType)
+
+
+class ScarceResourceObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QPixmap scarceResource READ scarceResource WRITE setScarceResource NOTIFY scarceResourceChanged)
+public:
+ ScarceResourceObject(QObject *parent = 0) : QObject(parent), m_value(100, 100) { m_value.fill(Qt::blue); }
+ ~ScarceResourceObject() {}
+
+ QPixmap scarceResource() const { return m_value; }
+ void setScarceResource(QPixmap v) { m_value = v; emit scarceResourceChanged(); }
+
+ bool scarceResourceIsDetached() const { return m_value.isDetached(); }
+
+ // this particular one returns a new one each time
+ // this means that every Scarce Resource Copy will
+ // consume resources (so that we can track disposal
+ // of v8 handles with circular references).
+ Q_INVOKABLE QPixmap newScarceResource() const
+ {
+ QPixmap retn(800, 600);
+ retn.fill(QColor(100, 110, 120, 45));
+ return retn;
+ }
+
+signals:
+ void scarceResourceChanged();
+
+private:
+ QPixmap m_value;
+};
+QML_DECLARE_TYPE(ScarceResourceObject)
+
+class testQObjectApi : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(MyEnum)
+ Q_PROPERTY (int qobjectTestProperty READ qobjectTestProperty NOTIFY qobjectTestPropertyChanged)
+ Q_PROPERTY (int qobjectTestWritableProperty READ qobjectTestWritableProperty WRITE setQObjectTestWritableProperty NOTIFY qobjectTestWritablePropertyChanged)
+ Q_PROPERTY (int qobjectTestWritableFinalProperty READ qobjectTestWritableFinalProperty WRITE setQObjectTestWritableFinalProperty NOTIFY qobjectTestWritableFinalPropertyChanged FINAL)
+
+public:
+ testQObjectApi(QObject* parent = 0)
+ : QObject(parent), m_testProperty(0), m_testWritableProperty(0), m_testWritableFinalProperty(0), m_methodCallCount(0), m_trackedObject(0)
+ {
+ }
+
+ ~testQObjectApi() {}
+
+ enum MyEnum { EnumValue1 = 25, EnumValue2 = 42 };
+ Q_INVOKABLE int qobjectEnumTestMethod(MyEnum val) { return (static_cast<int>(val) + 5); }
+ Q_INVOKABLE int qobjectTestMethod(int increment = 1) { m_methodCallCount += increment; return m_methodCallCount; }
+
+ Q_INVOKABLE void trackObject(QObject *obj) { m_trackedObject = obj; }
+ Q_INVOKABLE QObject *trackedObject() const { return m_trackedObject; }
+ Q_INVOKABLE void setTrackedObjectProperty(const QString &propName) const { m_trackedObject->setProperty(qPrintable(propName), QVariant(5)); }
+ Q_INVOKABLE QVariant trackedObjectProperty(const QString &propName) const { return m_trackedObject->property(qPrintable(propName)); }
+
+ Q_INVOKABLE void setSpecificProperty(QObject *obj, const QString & propName, const QVariant & v) const { obj->setProperty(qPrintable(propName), v); }
+ Q_INVOKABLE void changeQObjectParent(QObject *obj) { obj->setParent(this); }
+
+ int qobjectTestProperty() const { return m_testProperty; }
+ void setQObjectTestProperty(int tp) { m_testProperty = tp; emit qobjectTestPropertyChanged(tp); }
+
+ int qobjectTestWritableProperty() const { return m_testWritableProperty; }
+ void setQObjectTestWritableProperty(int tp) { m_testWritableProperty = tp; emit qobjectTestWritablePropertyChanged(tp); }
+
+ int qobjectTestWritableFinalProperty() const { return m_testWritableFinalProperty; }
+ void setQObjectTestWritableFinalProperty(int tp) { m_testWritableFinalProperty = tp; emit qobjectTestWritableFinalPropertyChanged(); }
+
+ Q_INVOKABLE bool trackedObjectHasJsOwnership() {
+ QObject * object = m_trackedObject;
+
+ if (!object)
+ return false;
+
+ QQmlData *ddata = QQmlData::get(object, false);
+ if (!ddata)
+ return false;
+ else
+ return ddata->indestructible?false:true;
+ }
+
+ Q_INVOKABLE void deleteQObject(QObject *obj) { delete obj; }
+
+signals:
+ void qobjectTestPropertyChanged(int testProperty);
+ void qobjectTestWritablePropertyChanged(int testWritableProperty);
+ void qobjectTestWritableFinalPropertyChanged();
+
+private:
+ int m_testProperty;
+ int m_testWritableProperty;
+ int m_testWritableFinalProperty;
+ int m_methodCallCount;
+ QObject *m_trackedObject;
+};
+
+class testQObjectApiTwo : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int twoTestProperty READ twoTestProperty WRITE setTwoTestProperty NOTIFY twoTestPropertyChanged)
+
+public:
+ testQObjectApiTwo(QObject *parent = 0) : QObject(parent), m_ttp(42) {}
+ ~testQObjectApiTwo() {}
+
+ void setTwoTestProperty(int v) { m_ttp = v; emit twoTestPropertyChanged(); }
+ int twoTestProperty() const { return m_ttp; }
+
+signals:
+ void twoTestPropertyChanged();
+
+private:
+ int m_ttp;
+};
+
+class testImportOrderApi : public QObject
+{
+ Q_OBJECT
+
+public:
+ testImportOrderApi(int value, QObject *parent = 0) : QObject(parent), m_value(value) {}
+
+ Q_PROPERTY(int value READ value)
+
+ int value() const { return m_value; }
+
+private:
+ int m_value;
+};
+
+class CircularReferenceObject : public QObject,
+ public QV8GCCallback::Node
+{
+ Q_OBJECT
+
+public:
+ CircularReferenceObject(QObject *parent = 0)
+ : QObject(parent), QV8GCCallback::Node(callback), m_referenced(0), m_dtorCount(0)
+ {
+ QV8GCCallback::addGcCallbackNode(this);
+ }
+
+ ~CircularReferenceObject()
+ {
+ if (m_dtorCount) *m_dtorCount = *m_dtorCount + 1;
+ }
+
+ Q_INVOKABLE void setDtorCount(int *dtorCount)
+ {
+ m_dtorCount = dtorCount;
+ }
+
+ Q_INVOKABLE CircularReferenceObject *generate(QObject *parent = 0)
+ {
+ CircularReferenceObject *retn = new CircularReferenceObject(parent);
+ retn->m_dtorCount = m_dtorCount;
+ retn->m_engine = m_engine;
+ return retn;
+ }
+
+ Q_INVOKABLE void addReference(QObject *other)
+ {
+ m_referenced = other;
+ }
+
+ static void callback(QV8GCCallback::Node *n)
+ {
+ CircularReferenceObject *cro = static_cast<CircularReferenceObject*>(n);
+ if (cro->m_referenced) {
+ cro->m_engine->addRelationshipForGC(cro, cro->m_referenced);
+ }
+ }
+
+ void setEngine(QQmlEngine* declarativeEngine)
+ {
+ m_engine = QQmlEnginePrivate::get(declarativeEngine)->v8engine();
+ }
+
+private:
+ QObject *m_referenced;
+ int *m_dtorCount;
+ QV8Engine* m_engine;
+};
+Q_DECLARE_METATYPE(CircularReferenceObject*)
+
+class CircularReferenceHandle : public QObject,
+ public QV8GCCallback::Node
+{
+ Q_OBJECT
+
+public:
+ CircularReferenceHandle(QObject *parent = 0)
+ : QObject(parent), QV8GCCallback::Node(gccallback), m_dtorCount(0), m_engine(0)
+ {
+ QV8GCCallback::addGcCallbackNode(this);
+ }
+
+ ~CircularReferenceHandle()
+ {
+ if (m_dtorCount) *m_dtorCount = *m_dtorCount + 1;
+ }
+
+ Q_INVOKABLE void setDtorCount(int *dtorCount)
+ {
+ m_dtorCount = dtorCount;
+ }
+
+ Q_INVOKABLE CircularReferenceHandle *generate(QObject *parent = 0)
+ {
+ CircularReferenceHandle *retn = new CircularReferenceHandle(parent);
+ retn->m_dtorCount = m_dtorCount;
+ retn->m_engine = m_engine;
+ return retn;
+ }
+
+ Q_INVOKABLE void addReference(v8::Persistent<v8::Value> handle)
+ {
+ m_referenced = qPersistentNew(handle);
+ m_referenced.MakeWeak(static_cast<void*>(this), wrcallback);
+ }
+
+ static void wrcallback(v8::Persistent<v8::Value> handle, void *)
+ {
+ qPersistentDispose(handle);
+ }
+
+ static void gccallback(QV8GCCallback::Node *n)
+ {
+ CircularReferenceHandle *crh = static_cast<CircularReferenceHandle*>(n);
+ crh->m_engine->addRelationshipForGC(crh, crh->m_referenced);
+ }
+
+ void setEngine(QQmlEngine* declarativeEngine)
+ {
+ m_engine = QQmlEnginePrivate::get(declarativeEngine)->v8engine();
+ }
+
+private:
+ v8::Persistent<v8::Value> m_referenced;
+ int *m_dtorCount;
+ QV8Engine* m_engine;
+};
+Q_DECLARE_METATYPE(CircularReferenceHandle*)
+
+class MyDynamicCreationDestructionObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY (int intProperty READ intProperty WRITE setIntProperty NOTIFY intPropertyChanged)
+
+public:
+ MyDynamicCreationDestructionObject(QObject *parent = 0) : QObject(parent), m_intProperty(0), m_dtorCount(0)
+ {
+ }
+
+ ~MyDynamicCreationDestructionObject()
+ {
+ if (m_dtorCount) {
+ (*m_dtorCount)++;
+ }
+ }
+
+ int intProperty() const { return m_intProperty; }
+ void setIntProperty(int val) { m_intProperty = val; emit intPropertyChanged(); }
+
+ Q_INVOKABLE MyDynamicCreationDestructionObject *createNew()
+ {
+ // no parent == ownership transfers to JS; same dtor counter.
+ MyDynamicCreationDestructionObject *retn = new MyDynamicCreationDestructionObject;
+ retn->setDtorCount(m_dtorCount);
+ return retn;
+ }
+
+ void setDtorCount(int *dtorCount)
+ {
+ m_dtorCount = dtorCount;
+ }
+
+signals:
+ void intPropertyChanged();
+
+private:
+ int m_intProperty;
+ int *m_dtorCount;
+};
+
+class WriteCounter : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue);
+public:
+ WriteCounter() : m_value(0), m_count(0) {}
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; ++m_count; }
+
+ int count() const { return m_count; }
+
+private:
+ int m_value;
+ int m_count;
+};
+
+class MySequenceConversionObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY (QList<int> intListProperty READ intListProperty WRITE setIntListProperty NOTIFY intListPropertyChanged)
+ Q_PROPERTY (QList<int> intListProperty2 READ intListProperty2 WRITE setIntListProperty2 NOTIFY intListProperty2Changed)
+ Q_PROPERTY (QList<qreal> qrealListProperty READ qrealListProperty WRITE setQrealListProperty NOTIFY qrealListPropertyChanged)
+ Q_PROPERTY (QList<bool> boolListProperty READ boolListProperty WRITE setBoolListProperty NOTIFY boolListPropertyChanged)
+ Q_PROPERTY (QList<QString> stringListProperty READ stringListProperty WRITE setStringListProperty NOTIFY stringListPropertyChanged)
+ Q_PROPERTY (QList<QUrl> urlListProperty READ urlListProperty WRITE setUrlListProperty NOTIFY urlListPropertyChanged)
+ Q_PROPERTY (QStringList qstringListProperty READ qstringListProperty WRITE setQStringListProperty NOTIFY qstringListPropertyChanged)
+
+ Q_PROPERTY (QList<QPoint> pointListProperty READ pointListProperty WRITE setPointListProperty NOTIFY pointListPropertyChanged)
+ Q_PROPERTY (QList<NonRegisteredType> typeListProperty READ typeListProperty WRITE setTypeListProperty NOTIFY typeListPropertyChanged)
+ Q_PROPERTY (QList<QVariant> variantListProperty READ variantListProperty WRITE setVariantListProperty NOTIFY variantListPropertyChanged)
+
+ Q_PROPERTY (qint32 maxIndex READ maxIndex CONSTANT)
+ Q_PROPERTY (quint32 tooBigIndex READ tooBigIndex CONSTANT)
+ Q_PROPERTY (qint32 negativeIndex READ negativeIndex CONSTANT)
+
+public:
+ MySequenceConversionObject()
+ {
+ m_intList << 1 << 2 << 3 << 4;
+ m_intList2 << 1 << 2 << 3 << 4;
+ m_qrealList << 1.1 << 2.2 << 3.3 << 4.4;
+ m_boolList << true << false << true << false;
+ m_stringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth");
+ m_urlList << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com");
+ m_qstringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth");
+
+ m_pointList << QPoint(1, 2) << QPoint(3, 4) << QPoint(5, 6);
+ m_variantList << QVariant(QLatin1String("one")) << QVariant(true) << QVariant(3);
+ }
+
+ ~MySequenceConversionObject() {}
+
+ qint32 maxIndex() const
+ {
+ return INT_MAX;
+ }
+ quint32 tooBigIndex() const
+ {
+ quint32 retn = 7;
+ retn += INT_MAX;
+ return retn;
+ }
+ qint32 negativeIndex() const
+ {
+ return -5;
+ }
+
+ QList<int> intListProperty() const { return m_intList; }
+ void setIntListProperty(const QList<int> &list) { m_intList = list; emit intListPropertyChanged(); }
+ QList<int> intListProperty2() const { return m_intList2; }
+ void setIntListProperty2(const QList<int> &list) { m_intList2 = list; emit intListProperty2Changed(); }
+ QList<qreal> qrealListProperty() const { return m_qrealList; }
+ void setQrealListProperty(const QList<qreal> &list) { m_qrealList = list; emit qrealListPropertyChanged(); }
+ QList<bool> boolListProperty() const { return m_boolList; }
+ void setBoolListProperty(const QList<bool> &list) { m_boolList = list; emit boolListPropertyChanged(); }
+ QList<QString> stringListProperty() const { return m_stringList; }
+ void setStringListProperty(const QList<QString> &list) { m_stringList = list; emit stringListPropertyChanged(); }
+ QList<QUrl> urlListProperty() const { return m_urlList; }
+ void setUrlListProperty(const QList<QUrl> &list) { m_urlList = list; emit urlListPropertyChanged(); }
+ QStringList qstringListProperty() const { return m_qstringList; }
+ void setQStringListProperty(const QStringList &list) { m_qstringList = list; emit qstringListPropertyChanged(); }
+ QList<QPoint> pointListProperty() const { return m_pointList; }
+ void setPointListProperty(const QList<QPoint> &list) { m_pointList = list; emit pointListPropertyChanged(); }
+ QList<NonRegisteredType> typeListProperty() const { return m_typeList; }
+ void setTypeListProperty(const QList<NonRegisteredType> &list) { m_typeList = list; emit typeListPropertyChanged(); }
+ QList<QVariant> variantListProperty() const { return m_variantList; }
+ void setVariantListProperty(const QList<QVariant> &list) { m_variantList = list; emit variantListPropertyChanged(); }
+
+ // now for "copy resource" sequences:
+ Q_INVOKABLE QList<int> generateIntSequence() const { QList<int> retn; retn << 1 << 2 << 3; return retn; }
+ Q_INVOKABLE QList<qreal> generateQrealSequence() const { QList<qreal> retn; retn << 1.1 << 2.2 << 3.3; return retn; }
+ Q_INVOKABLE QList<bool> generateBoolSequence() const { QList<bool> retn; retn << true << false << true; return retn; }
+ Q_INVOKABLE QList<QString> generateStringSequence() const { QList<QString> retn; retn << "one" << "two" << "three"; return retn; }
+ Q_INVOKABLE QList<QUrl> generateUrlSequence() const { QList<QUrl> retn; retn << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com"); return retn; }
+ Q_INVOKABLE QStringList generateQStringSequence() const { QStringList retn; retn << "one" << "two" << "three"; return retn; }
+ Q_INVOKABLE bool parameterEqualsGeneratedIntSequence(const QList<int>& param) const { return (param == generateIntSequence()); }
+
+ // "reference resource" underlying qobject deletion test:
+ Q_INVOKABLE MySequenceConversionObject *generateTestObject() const { return new MySequenceConversionObject; }
+ Q_INVOKABLE void deleteTestObject(QObject *object) const { delete object; }
+
+signals:
+ void intListPropertyChanged();
+ void intListProperty2Changed();
+ void qrealListPropertyChanged();
+ void boolListPropertyChanged();
+ void stringListPropertyChanged();
+ void urlListPropertyChanged();
+ void qstringListPropertyChanged();
+ void pointListPropertyChanged();
+ void typeListPropertyChanged();
+ void variantListPropertyChanged();
+
+private:
+ QList<int> m_intList;
+ QList<int> m_intList2;
+ QList<qreal> m_qrealList;
+ QList<bool> m_boolList;
+ QList<QString> m_stringList;
+ QList<QUrl> m_urlList;
+ QStringList m_qstringList;
+
+ QList<QPoint> m_pointList;
+ QList<NonRegisteredType> m_typeList; // not a supported sequence type
+ QList<QVariant> m_variantList; // not a supported sequence type, but QVariantList support is hardcoded.
+};
+
+class MyDeleteObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *nestedObject READ nestedObject NOTIFY nestedObjectChanged)
+ Q_PROPERTY(int deleteNestedObject READ deleteNestedObject NOTIFY deleteNestedObjectChanged)
+ Q_PROPERTY(QObject *object2 READ object2 NOTIFY object2Changed)
+
+public:
+ MyDeleteObject() : m_nestedObject(new MyQmlObject), m_object1(0), m_object2(0) {}
+
+ Q_INVOKABLE QObject *object1() const { return m_object1; }
+ Q_INVOKABLE QObject *object2() const { return m_object2; }
+ void setObject1(QObject *object) { m_object1 = object; }
+ void setObject2(QObject *object) { m_object2 = object; emit object2Changed(); }
+ QObject *nestedObject() const { return m_nestedObject; }
+ int deleteNestedObject() { delete m_nestedObject; m_nestedObject = 0; return 1; }
+
+signals:
+ void nestedObjectChanged();
+ void deleteNestedObjectChanged();
+ void object2Changed();
+
+private:
+ MyQmlObject *m_nestedObject;
+ QObject *m_object1;
+ QObject *m_object2;
+};
+
+class DateTimeExporter : public QObject
+{
+ Q_OBJECT
+
+public:
+ DateTimeExporter(const QDateTime &dt) : m_datetime(dt), m_offset(0), m_timespec("UTC")
+ {
+ switch (m_datetime.timeSpec()) {
+ case Qt::LocalTime:
+ {
+ QDateTime utc(m_datetime.toUTC());
+ utc.setTimeSpec(Qt::LocalTime);
+ m_offset = m_datetime.secsTo(utc) / 60;
+ m_timespec = "LocalTime";
+ }
+ break;
+ case Qt::OffsetFromUTC:
+ m_offset = m_datetime.utcOffset() / 60;
+ m_timespec = QString("%1%2:%3").arg(m_offset < 0 ? '-' : '+')
+ .arg(abs(m_offset) / 60)
+ .arg(abs(m_offset) % 60);
+ default:
+ break;
+ }
+ }
+
+ Q_INVOKABLE QDate getDate() const { return m_datetime.date(); }
+ Q_INVOKABLE QDateTime getDateTime() const { return m_datetime; }
+ Q_INVOKABLE int getDateTimeOffset() const { return m_offset; }
+ Q_INVOKABLE QString getTimeSpec() const { return m_timespec; }
+
+private:
+ QDateTime m_datetime;
+ int m_offset;
+ QString m_timespec;
+};
+
+class MyWorkerObject : public QObject
+{
+ Q_OBJECT
+
+public Q_SLOTS:
+ void doIt();
+
+Q_SIGNALS:
+ void done(const QString &result);
+};
+
+class MyUnregisteredEnumTypeObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty)
+
+public:
+ MyUnregisteredEnumTypeObject() : QObject(), m_ev(FirstValue) {}
+ ~MyUnregisteredEnumTypeObject() {}
+
+ enum MyEnum {
+ FirstValue = 1,
+ SecondValue = 2
+ };
+
+ MyEnum enumProperty() const { return m_ev; }
+ void setEnumProperty(MyEnum v) { m_ev = v; }
+
+private:
+ MyEnum m_ev;
+};
+
+class FallbackBindingsObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY (int test READ test NOTIFY testChanged)
+public:
+ FallbackBindingsObject(QObject* parent = 0)
+ : QObject(parent), m_test(100)
+ {
+ }
+
+ int test() const { return m_test; }
+
+Q_SIGNALS:
+ void testChanged();
+
+private:
+ int m_test;
+};
+
+class FallbackBindingsDerived : public FallbackBindingsObject
+{
+ Q_OBJECT
+ Q_PROPERTY (QString test READ test NOTIFY testChanged)
+public:
+ FallbackBindingsDerived(QObject* parent = 0)
+ : FallbackBindingsObject(parent), m_test("hello")
+ {
+ }
+
+ QString test() const { return m_test; }
+
+Q_SIGNALS:
+ void testChanged();
+
+private:
+ QString m_test;
+};
+
+class FallbackBindingsAttachedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY (int test READ test NOTIFY testChanged)
+public:
+ FallbackBindingsAttachedObject(QObject *parent) : QObject(parent), m_test(100) {}
+
+ int test() const { return m_test; }
+
+Q_SIGNALS:
+ void testChanged();
+
+private:
+ int m_test;
+};
+
+class FallbackBindingsAttachedDerived : public FallbackBindingsAttachedObject
+{
+ Q_OBJECT
+ Q_PROPERTY (QString test READ test NOTIFY testChanged)
+public:
+ FallbackBindingsAttachedDerived(QObject* parent = 0)
+ : FallbackBindingsAttachedObject(parent), m_test("hello")
+ {
+ }
+
+ QString test() const { return m_test; }
+
+Q_SIGNALS:
+ void testChanged();
+
+private:
+ QString m_test;
+};
+
+class FallbackBindingsTypeObject : public QObject
+{
+ Q_OBJECT
+public:
+ FallbackBindingsTypeObject() : QObject() {}
+
+ static FallbackBindingsAttachedObject *qmlAttachedProperties(QObject *o) {
+ return new FallbackBindingsAttachedObject(o);
+ }
+};
+
+class FallbackBindingsTypeDerived : public QObject
+{
+ Q_OBJECT
+public:
+ FallbackBindingsTypeDerived() : QObject() {}
+
+ static FallbackBindingsAttachedObject *qmlAttachedProperties(QObject *o) {
+ return new FallbackBindingsAttachedDerived(o);
+ }
+};
+
+QML_DECLARE_TYPEINFO(FallbackBindingsTypeObject, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPEINFO(FallbackBindingsTypeDerived, QML_HAS_ATTACHED_PROPERTIES)
+
+void registerTypes();
+
+#endif // TESTTYPES_H
+
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
new file mode 100644
index 0000000000..06590f0ad6
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -0,0 +1,7397 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdebug.h>
+#include <QtQml/private/qqmlguard_p.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qnumeric.h>
+#include <private/qqmlengine_p.h>
+#include <private/qqmlvmemetaobject_p.h>
+#include <private/qv4compiler_p.h>
+#include "testtypes.h"
+#include "testhttpserver.h"
+#include "../../shared/util.h"
+
+/*
+This test covers evaluation of ECMAScript expressions and bindings from within
+QML. This does not include static QML language issues.
+
+Static QML language issues are covered in qmllanguage
+*/
+
+class tst_qqmlecmascript : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlecmascript() {}
+
+private slots:
+ void initTestCase();
+ void assignBasicTypes();
+ void assignDate_data();
+ void assignDate();
+ void exportDate_data();
+ void exportDate();
+ void idShortcutInvalidates();
+ void boolPropertiesEvaluateAsBool();
+ void methods();
+ void signalAssignment();
+ void signalArguments();
+ void bindingLoop();
+ void basicExpressions();
+ void basicExpressions_data();
+ void arrayExpressions();
+ void contextPropertiesTriggerReeval();
+ void objectPropertiesTriggerReeval();
+ void deferredProperties();
+ void deferredPropertiesErrors();
+ void extensionObjects();
+ void overrideExtensionProperties();
+ void attachedProperties();
+ void enums();
+ void valueTypeFunctions();
+ void constantsOverrideBindings();
+ void outerBindingOverridesInnerBinding();
+ void aliasPropertyAndBinding();
+ void aliasPropertyReset();
+ void nonExistentAttachedObject();
+ void scope();
+ void importScope();
+ void signalParameterTypes();
+ void objectsCompareAsEqual();
+ void componentCreation_data();
+ void componentCreation();
+ void dynamicCreation_data();
+ void dynamicCreation();
+ void dynamicDestruction();
+ void objectToString();
+ void objectHasOwnProperty();
+ void selfDeletingBinding();
+ void extendedObjectPropertyLookup();
+ void extendedObjectPropertyLookup2();
+ void scriptErrors();
+ void functionErrors();
+ void propertyAssignmentErrors();
+ void signalTriggeredBindings();
+ void listProperties();
+ void exceptionClearsOnReeval();
+ void exceptionSlotProducesWarning();
+ void exceptionBindingProducesWarning();
+ void compileInvalidBinding();
+ void transientErrors();
+ void shutdownErrors();
+ void compositePropertyType();
+ void jsObject();
+ void undefinedResetsProperty();
+ void listToVariant();
+ void listAssignment();
+ void multiEngineObject();
+ void deletedObject();
+ void attachedPropertyScope();
+ void scriptConnect();
+ void scriptDisconnect();
+ void ownership();
+ void cppOwnershipReturnValue();
+ void ownershipCustomReturnValue();
+ void ownershipRootObject();
+ void ownershipConsistency();
+ void ownershipQmlIncubated();
+ void qlistqobjectMethods();
+ void strictlyEquals();
+ void compiled();
+ void numberAssignment();
+ void propertySplicing();
+ void signalWithUnknownTypes();
+ void signalWithJSValueInVariant_data();
+ void signalWithJSValueInVariant();
+ void signalWithJSValueInVariant_twoEngines_data();
+ void signalWithJSValueInVariant_twoEngines();
+ void signalWithQJSValue_data();
+ void signalWithQJSValue();
+ void singletonType_data();
+ void singletonType();
+ void singletonTypeCaching_data();
+ void singletonTypeCaching();
+ void singletonTypeImportOrder();
+ void singletonTypeResolution();
+ void importScripts_data();
+ void importScripts();
+ void scarceResources();
+ void scarceResources_data();
+ void scarceResources_other();
+ void propertyChangeSlots();
+ void propertyVar_data();
+ void propertyVar();
+ void propertyQJSValue_data();
+ void propertyQJSValue();
+ void propertyVarCpp();
+ void propertyVarOwnership();
+ void propertyVarImplicitOwnership();
+ void propertyVarReparent();
+ void propertyVarReparentNullContext();
+ void propertyVarCircular();
+ void propertyVarCircular2();
+ void propertyVarInheritance();
+ void propertyVarInheritance2();
+ void elementAssign();
+ void objectPassThroughSignals();
+ void objectConversion();
+ void booleanConversion();
+ void handleReferenceManagement();
+ void stringArg();
+ void readonlyDeclaration();
+ void sequenceConversionRead();
+ void sequenceConversionWrite();
+ void sequenceConversionArray();
+ void sequenceConversionIndexes();
+ void sequenceConversionThreads();
+ void sequenceConversionBindings();
+ void sequenceConversionCopy();
+ void assignSequenceTypes();
+ void sequenceSort_data();
+ void sequenceSort();
+ void qtbug_22464();
+ void qtbug_21580();
+ void singleV8BindingDestroyedDuringEvaluation();
+ void bug1();
+#ifndef QT_NO_WIDGETS
+ void bug2();
+#endif
+ void dynamicCreationCrash();
+ void dynamicCreationOwnership();
+ void regExpBug();
+ void nullObjectBinding();
+ void deletedEngine();
+ void libraryScriptAssert();
+ void variantsAssignedUndefined();
+ void qtbug_9792();
+ void qtcreatorbug_1289();
+ void noSpuriousWarningsAtShutdown();
+ void canAssignNullToQObject();
+ void functionAssignment_fromBinding();
+ void functionAssignment_fromJS();
+ void functionAssignment_fromJS_data();
+ void functionAssignmentfromJS_invalid();
+ void functionAssignment_afterBinding();
+ void eval();
+ void function();
+ void functionException();
+ void qtbug_10696();
+ void qtbug_11606();
+ void qtbug_11600();
+ void qtbug_21864();
+ void qobjectConnectionListExceptionHandling();
+ void nonscriptable();
+ void deleteLater();
+ void objectNameChangedSignal();
+ void destroyedSignal();
+ void in();
+ void typeOf();
+ void qtbug_24448();
+ void sharedAttachedObject();
+ void objectName();
+ void writeRemovesBinding();
+ void aliasBindingsAssignCorrectly();
+ void aliasBindingsOverrideTarget();
+ void aliasWritesOverrideBindings();
+ void aliasToCompositeElement();
+ void realToInt();
+ void urlProperty();
+ void urlPropertyWithEncoding();
+ void urlListPropertyWithEncoding();
+ void dynamicString();
+ void include();
+ void signalHandlers();
+ void doubleEvaluate();
+ void forInLoop();
+ void nonNotifyable();
+ void deleteWhileBindingRunning();
+ void callQtInvokables();
+ void invokableObjectArg();
+ void invokableObjectRet();
+ void invokableEnumRet();
+ void qtbug_20344();
+ void qtbug_22679();
+ void qtbug_22843_data();
+ void qtbug_22843();
+ void rewriteMultiLineStrings();
+ void revisionErrors();
+ void revision();
+ void invokableWithQObjectDerived();
+ void realTypePrecision();
+ void registeredFlagMethod();
+ void deleteLaterObjectMethodCall();
+ void automaticSemicolon();
+ void compatibilitySemicolon();
+ void incrDecrSemicolon1();
+ void incrDecrSemicolon2();
+ void incrDecrSemicolon_error1();
+ void unaryExpression();
+ void switchStatement();
+ void withStatement();
+ void tryStatement();
+ void replaceBinding();
+ void deleteRootObjectInCreation();
+ void onDestruction();
+ void bindingSuppression();
+ void signalEmitted();
+ void threadSignal();
+ void qqmldataDestroyed();
+ void secondAlias();
+ void varAlias();
+ void overrideDataAssert();
+ void fallbackBindings_data();
+ void fallbackBindings();
+ void propertyOverride();
+ void concatenatedStringPropertyAccess();
+ void jsOwnedObjectsDeletedOnEngineDestroy();
+ void numberParsing();
+ void stringParsing();
+
+private:
+ static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
+ static void verifyContextLifetime(QQmlContextData *ctxt);
+ QQmlEngine engine;
+};
+
+void tst_qqmlecmascript::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ registerTypes();
+
+ QString dataDir(dataDirectory() + QLatin1Char('/') + QLatin1String("lib"));
+ engine.addImportPath(dataDir);
+}
+
+void tst_qqmlecmascript::assignBasicTypes()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("assignBasicTypes.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3);
+ QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2);
+ QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue);
+ 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.75));
+ QCOMPARE((float)object->floatProperty(), float(8.5));
+ QCOMPARE(object->colorProperty(), QColor("red"));
+ QCOMPARE(object->dateProperty(), QDate(1982, 11, 25));
+ QCOMPARE(object->timeProperty(), QTime(11, 11, 32));
+ QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1), Qt::UTC));
+ QCOMPARE(object->pointProperty(), QPoint(99,13));
+ QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3));
+ QCOMPARE(object->sizeProperty(), QSize(99, 13));
+ QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2));
+ QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200));
+ QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99));
+ QCOMPARE(object->boolProperty(), true);
+ QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
+ QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
+ QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml")));
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("assignBasicTypes.2.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3);
+ QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2);
+ QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue);
+ 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.75));
+ QCOMPARE((float)object->floatProperty(), float(8.5));
+ QCOMPARE(object->colorProperty(), QColor("red"));
+ QCOMPARE(object->dateProperty(), QDate(1982, 11, 25));
+ QCOMPARE(object->timeProperty(), QTime(11, 11, 32));
+ QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1), Qt::UTC));
+ QCOMPARE(object->pointProperty(), QPoint(99,13));
+ QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3));
+ QCOMPARE(object->sizeProperty(), QSize(99, 13));
+ QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2));
+ QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200));
+ QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99));
+ QCOMPARE(object->boolProperty(), true);
+ QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
+ QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
+ QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml")));
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::assignDate_data()
+{
+ QTest::addColumn<QUrl>("source");
+
+ QTest::newRow("Component.onComplete JS Parse") << testFileUrl("assignDate.qml");
+ QTest::newRow("Component.onComplete JS") << testFileUrl("assignDate.1.qml");
+ QTest::newRow("Binding JS") << testFileUrl("assignDate.2.qml");
+ QTest::newRow("Binding UTC") << testFileUrl("assignDate.3.qml");
+ QTest::newRow("Binding JS UTC") << testFileUrl("assignDate.4.qml");
+ QTest::newRow("Binding UTC+2") << testFileUrl("assignDate.5.qml");
+ QTest::newRow("Binding JS UTC+2 ") << testFileUrl("assignDate.6.qml");
+}
+
+void tst_qqmlecmascript::assignDate()
+{
+ QFETCH(QUrl, source);
+
+ QQmlComponent component(&engine, source);
+ QScopedPointer<QObject> obj(component.create());
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(obj.data());
+ QVERIFY(object != 0);
+
+ // Dates received from JS are automatically converted to local time
+ QDate expectedDate(QDateTime(QDate(2009, 5, 12), QTime(0, 0, 0), Qt::UTC).toLocalTime().date());
+ QDateTime expectedDateTime(QDateTime(QDate(2009, 5, 12), QTime(0, 0, 1), Qt::UTC).toLocalTime());
+ QDateTime expectedDateTime2(QDateTime(QDate(2009, 5, 12), QTime(23, 59, 59), Qt::UTC).toLocalTime());
+
+ QCOMPARE(object->dateProperty(), expectedDate);
+ QCOMPARE(object->dateTimeProperty(), expectedDateTime);
+ QCOMPARE(object->dateTimeProperty2(), expectedDateTime2);
+ QCOMPARE(object->boolProperty(), true);
+}
+
+void tst_qqmlecmascript::exportDate_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<QDateTime>("datetime");
+
+ // Verify that we can export datetime information to QML and that consumers can access
+ // the data correctly provided they know the TZ info associated with the value
+
+ const QDate date(2009, 5, 12);
+ const QTime early(0, 0, 1);
+ const QTime late(23, 59, 59);
+ const int offset(((11 * 60) + 30) * 60);
+
+ QTest::newRow("Localtime early") << testFileUrl("exportDate.qml") << QDateTime(date, early, Qt::LocalTime);
+ QTest::newRow("Localtime late") << testFileUrl("exportDate.2.qml") << QDateTime(date, late, Qt::LocalTime);
+ QTest::newRow("UTC early") << testFileUrl("exportDate.3.qml") << QDateTime(date, early, Qt::UTC);
+ QTest::newRow("UTC late") << testFileUrl("exportDate.4.qml") << QDateTime(date, late, Qt::UTC);
+ {
+ QDateTime dt(date, early, Qt::OffsetFromUTC);
+ dt.setUtcOffset(offset);
+ QTest::newRow("+11:30 early") << testFileUrl("exportDate.5.qml") << dt;
+ }
+ {
+ QDateTime dt(date, late, Qt::OffsetFromUTC);
+ dt.setUtcOffset(offset);
+ QTest::newRow("+11:30 late") << testFileUrl("exportDate.6.qml") << dt;
+ }
+ {
+ QDateTime dt(date, early, Qt::OffsetFromUTC);
+ dt.setUtcOffset(-offset);
+ QTest::newRow("-11:30 early") << testFileUrl("exportDate.7.qml") << dt;
+ }
+ {
+ QDateTime dt(date, late, Qt::OffsetFromUTC);
+ dt.setUtcOffset(-offset);
+ QTest::newRow("-11:30 late") << testFileUrl("exportDate.8.qml") << dt;
+ }
+}
+
+void tst_qqmlecmascript::exportDate()
+{
+ QFETCH(QUrl, source);
+ QFETCH(QDateTime, datetime);
+
+ DateTimeExporter exporter(datetime);
+
+ QQmlEngine e;
+ e.rootContext()->setContextProperty("datetimeExporter", &exporter);
+
+ QQmlComponent component(&e, source);
+ QScopedPointer<QObject> obj(component.create());
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(obj.data());
+ QVERIFY(object != 0);
+ QCOMPARE(object->boolProperty(), true);
+}
+
+void tst_qqmlecmascript::idShortcutInvalidates()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("idShortcutInvalidates.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->objectProperty() != 0);
+ delete object->objectProperty();
+ QVERIFY(object->objectProperty() == 0);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("idShortcutInvalidates.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->objectProperty() != 0);
+ delete object->objectProperty();
+ QVERIFY(object->objectProperty() == 0);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::boolPropertiesEvaluateAsBool()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->stringProperty(), QLatin1String("pass"));
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->stringProperty(), QLatin1String("pass"));
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::signalAssignment()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("signalAssignment.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->string(), QString());
+ emit object->basicSignal();
+ QCOMPARE(object->string(), QString("pass"));
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("signalAssignment.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->string(), QString());
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25 3 2"));
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("signalAssignment.3.qml"));
+ QVERIFY(component.isError());
+ QString expectedErrorString = component.url().toString() + QLatin1String(":4 Signal uses unnamed parameter followed by named parameter.\n");
+ QCOMPARE(component.errorString(), expectedErrorString);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("signalAssignment.4.qml"));
+ QVERIFY(component.isError());
+ QString expectedErrorString = component.url().toString() + QLatin1String(":5 Signal parameter \"parseInt\" hides global variable.\n");
+ QCOMPARE(component.errorString(), expectedErrorString);
+ }
+}
+
+void tst_qqmlecmascript::signalArguments()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("signalArguments.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->string(), QString());
+ emit object->basicSignal();
+ QCOMPARE(object->string(), QString("pass"));
+ QCOMPARE(object->property("argumentCount").toInt(), 0);
+ QCOMPARE(object->property("calleeCorrect").toBool(), true);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("signalArguments.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->string(), QString());
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25 3 2"));
+ QCOMPARE(object->property("argumentCount").toInt(), 5);
+ QCOMPARE(object->property("calleeCorrect").toBool(), true);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::methods()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("methods.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->methodCalled(), false);
+ QCOMPARE(object->methodIntCalled(), false);
+ emit object->basicSignal();
+ QCOMPARE(object->methodCalled(), true);
+ QCOMPARE(object->methodIntCalled(), false);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("methods.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->methodCalled(), false);
+ QCOMPARE(object->methodIntCalled(), false);
+ emit object->basicSignal();
+ QCOMPARE(object->methodCalled(), false);
+ QCOMPARE(object->methodIntCalled(), true);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("methods.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toInt(), 19);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("methods.4.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toInt(), 19);
+ QCOMPARE(object->property("test2").toInt(), 17);
+ QCOMPARE(object->property("test3").toInt(), 16);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("methods.5.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toInt(), 9);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::bindingLoop()
+{
+ QQmlComponent component(&engine, testFileUrl("bindingLoop.qml"));
+ QString warning = component.url().toString() + ":9:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\"";
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlecmascript::basicExpressions_data()
+{
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<QVariant>("result");
+ QTest::addColumn<bool>("nest");
+
+ QTest::newRow("Syntax error (self test)") << "{console.log({'a':1'}.a)}" << QVariant() << false;
+ QTest::newRow("Context property") << "a" << QVariant(1944) << false;
+ QTest::newRow("Context property") << "a" << QVariant(1944) << true;
+ QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << false;
+ QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << true;
+ QTest::newRow("Overridden context property") << "b" << QVariant("Milk") << false;
+ QTest::newRow("Overridden context property") << "b" << QVariant("Cow") << true;
+ QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << false;
+ QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << true;
+ QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object2") << false;
+ QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object3") << true;
+ QTest::newRow("Default object property") << "horseLegs" << QVariant(4) << false;
+ QTest::newRow("Default object property") << "antLegs" << QVariant(6) << false;
+ QTest::newRow("Default object property") << "emuLegs" << QVariant(2) << false;
+ QTest::newRow("Nested default object property") << "horseLegs" << QVariant(4) << true;
+ QTest::newRow("Nested default object property") << "antLegs" << QVariant(7) << true;
+ QTest::newRow("Nested default object property") << "emuLegs" << QVariant(2) << true;
+ QTest::newRow("Nested default object property") << "humanLegs" << QVariant(2) << true;
+ QTest::newRow("Context property override default object property") << "millipedeLegs" << QVariant(100) << true;
+}
+
+void tst_qqmlecmascript::basicExpressions()
+{
+ QFETCH(QString, expression);
+ QFETCH(QVariant, result);
+ QFETCH(bool, nest);
+
+ MyQmlObject object1;
+ MyQmlObject object2;
+ MyQmlObject object3;
+ MyDefaultObject1 default1;
+ MyDefaultObject3 default3;
+ object1.setStringProperty("Object1");
+ object2.setStringProperty("Object2");
+ object3.setStringProperty("Object3");
+
+ QQmlContext context(engine.rootContext());
+ QQmlContext nestedContext(&context);
+
+ context.setContextObject(&default1);
+ context.setContextProperty("a", QVariant(1944));
+ context.setContextProperty("b", QVariant("Milk"));
+ context.setContextProperty("object", &object1);
+ context.setContextProperty("objectOverride", &object2);
+ nestedContext.setContextObject(&default3);
+ nestedContext.setContextProperty("b", QVariant("Cow"));
+ nestedContext.setContextProperty("objectOverride", &object3);
+ nestedContext.setContextProperty("millipedeLegs", QVariant(100));
+
+ MyExpression expr(nest?&nestedContext:&context, expression);
+ QCOMPARE(expr.evaluate(), result);
+}
+
+void tst_qqmlecmascript::arrayExpressions()
+{
+ QObject obj1;
+ QObject obj2;
+ QObject obj3;
+
+ QQmlContext 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.evaluate();
+ QCOMPARE(result.userType(), qMetaTypeId<QVariantList>());
+ QVariantList list = qvariant_cast<QVariantList>(result);
+ QCOMPARE(list.count(), 4);
+ QCOMPARE(list.at(0).value<QObject*>(), &obj1);
+ QCOMPARE(list.at(1).value<QObject*>(), &obj2);
+ QCOMPARE(list.at(2).value<QObject*>(), &obj3);
+ QCOMPARE(list.at(3).value<int>(), 10);
+}
+
+// Tests that modifying a context property will reevaluate expressions
+void tst_qqmlecmascript::contextPropertiesTriggerReeval()
+{
+ QQmlContext 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.evaluate(), QVariant(2));
+
+ context.setContextProperty("testProp", QVariant(2));
+ QCOMPARE(expr.changed, true);
+ QCOMPARE(expr.evaluate(), QVariant(3));
+ }
+
+ {
+ MyExpression expr(&context, "testProp + testProp + testProp");
+ QCOMPARE(expr.changed, false);
+ QCOMPARE(expr.evaluate(), QVariant(6));
+
+ context.setContextProperty("testProp", QVariant(4));
+ QCOMPARE(expr.changed, true);
+ QCOMPARE(expr.evaluate(), QVariant(12));
+ }
+
+ {
+ MyExpression expr(&context, "testObj.stringProperty");
+ QCOMPARE(expr.changed, false);
+ QCOMPARE(expr.evaluate(), QVariant("Hello"));
+
+ context.setContextProperty("testObj", &object2);
+ QCOMPARE(expr.changed, true);
+ QCOMPARE(expr.evaluate(), QVariant("World"));
+ }
+
+ {
+ MyExpression expr(&context, "testObj.stringProperty /**/");
+ QCOMPARE(expr.changed, false);
+ QCOMPARE(expr.evaluate(), QVariant("World"));
+
+ context.setContextProperty("testObj", &object1);
+ QCOMPARE(expr.changed, true);
+ QCOMPARE(expr.evaluate(), QVariant("Hello"));
+ }
+
+ {
+ MyExpression expr(&context, "testObj2");
+ QCOMPARE(expr.changed, false);
+ QCOMPARE(expr.evaluate(), QVariant::fromValue((QObject *)object3));
+ }
+
+ delete object3;
+}
+
+void tst_qqmlecmascript::objectPropertiesTriggerReeval()
+{
+ QQmlContext 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.evaluate(), QVariant("Hello"));
+
+ object1.setStringProperty(QLatin1String("World"));
+ QCOMPARE(expr.changed, true);
+ QCOMPARE(expr.evaluate(), QVariant("World"));
+ }
+
+ {
+ MyExpression expr(&context, "testObj.objectProperty.stringProperty");
+ QCOMPARE(expr.changed, false);
+ QCOMPARE(expr.evaluate(), QVariant());
+
+ object1.setObjectProperty(&object2);
+ QCOMPARE(expr.changed, true);
+ expr.changed = false;
+ QCOMPARE(expr.evaluate(), QVariant("Dog"));
+
+ object1.setObjectProperty(&object3);
+ QCOMPARE(expr.changed, true);
+ expr.changed = false;
+ QCOMPARE(expr.evaluate(), QVariant("Cat"));
+
+ object1.setObjectProperty(0);
+ QCOMPARE(expr.changed, true);
+ expr.changed = false;
+ QCOMPARE(expr.evaluate(), QVariant());
+
+ object1.setObjectProperty(&object3);
+ QCOMPARE(expr.changed, true);
+ expr.changed = false;
+ QCOMPARE(expr.evaluate(), QVariant("Cat"));
+
+ object3.setStringProperty("Donkey");
+ QCOMPARE(expr.changed, true);
+ expr.changed = false;
+ QCOMPARE(expr.evaluate(), QVariant("Donkey"));
+ }
+}
+
+void tst_qqmlecmascript::deferredProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("deferredProperties.qml"));
+ MyDeferredObject *object =
+ qobject_cast<MyDeferredObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->value(), 0);
+ QVERIFY(object->objectProperty() == 0);
+ QVERIFY(object->objectProperty2() != 0);
+ qmlExecuteDeferred(object);
+ QCOMPARE(object->value(), 10);
+ QVERIFY(object->objectProperty() != 0);
+ MyQmlObject *qmlObject =
+ qobject_cast<MyQmlObject *>(object->objectProperty());
+ QVERIFY(qmlObject != 0);
+ QCOMPARE(qmlObject->value(), 10);
+ object->setValue(19);
+ QCOMPARE(qmlObject->value(), 19);
+
+ delete object;
+}
+
+// Check errors on deferred properties are correctly emitted
+void tst_qqmlecmascript::deferredPropertiesErrors()
+{
+ QQmlComponent component(&engine, testFileUrl("deferredPropertiesErrors.qml"));
+ MyDeferredObject *object =
+ qobject_cast<MyDeferredObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->value(), 0);
+ QVERIFY(object->objectProperty() == 0);
+ QVERIFY(object->objectProperty2() == 0);
+
+ QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QObject*";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ qmlExecuteDeferred(object);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::extensionObjects()
+{
+ QQmlComponent component(&engine, testFileUrl("extensionObjects.qml"));
+ MyExtendedObject *object =
+ qobject_cast<MyExtendedObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->baseProperty(), 13);
+ QCOMPARE(object->coreProperty(), 9);
+ object->setProperty("extendedProperty", QVariant(11));
+ object->setProperty("baseExtendedProperty", QVariant(92));
+ QCOMPARE(object->coreProperty(), 11);
+ QCOMPARE(object->baseProperty(), 92);
+
+ MyExtendedObject *nested = qobject_cast<MyExtendedObject*>(qvariant_cast<QObject *>(object->property("nested")));
+ QVERIFY(nested);
+ QCOMPARE(nested->baseProperty(), 13);
+ QCOMPARE(nested->coreProperty(), 9);
+ nested->setProperty("extendedProperty", QVariant(11));
+ nested->setProperty("baseExtendedProperty", QVariant(92));
+ QCOMPARE(nested->coreProperty(), 11);
+ QCOMPARE(nested->baseProperty(), 92);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::overrideExtensionProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("extensionObjectsPropertyOverride.qml"));
+ OverrideDefaultPropertyObject *object =
+ qobject_cast<OverrideDefaultPropertyObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->secondProperty() != 0);
+ QVERIFY(object->firstProperty() == 0);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::attachedProperties()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("attachedProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("a").toInt(), 19);
+ QCOMPARE(object->property("b").toInt(), 19);
+ QCOMPARE(object->property("c").toInt(), 19);
+ QCOMPARE(object->property("d").toInt(), 19);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("attachedProperty.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("a").toInt(), 26);
+ QCOMPARE(object->property("b").toInt(), 26);
+ QCOMPARE(object->property("c").toInt(), 26);
+ QCOMPARE(object->property("d").toInt(), 26);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("writeAttachedProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, "writeValue2");
+
+ MyQmlAttachedObject *attached =
+ qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object));
+ QVERIFY(attached != 0);
+
+ QCOMPARE(attached->value2(), 9);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::enums()
+{
+ // Existent enums
+ {
+ QQmlComponent component(&engine, testFileUrl("enums.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("enumProperty").toInt(), (int)MyQmlObject::EnumValue2);
+ QCOMPARE(object->property("relatedEnumProperty").toInt(), (int)MyEnumContainer::RelatedValue);
+ QCOMPARE(object->property("unrelatedEnumProperty").toInt(), (int)MyEnumContainer::RelatedValue);
+ QCOMPARE(object->property("qtEnumProperty").toInt(), (int)Qt::CaseInsensitive);
+ 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);
+ QCOMPARE(object->property("k").toInt(), 42);
+ QCOMPARE(object->property("l").toInt(), 333);
+
+ delete object;
+ }
+ // Non-existent enums
+ {
+ QUrl file = testFileUrl("enums.2.qml");
+ QString w1 = QLatin1String("QMetaProperty::read: Unable to handle unregistered datatype 'MyEnum' for property 'MyUnregisteredEnumTypeObject::enumProperty'");
+ QString w2 = QLatin1String("QQmlExpression: Expression ") + testFileUrl("enums.2.qml").toString() + QLatin1String(":9 depends on non-NOTIFYable properties:");
+ QString w3 = QLatin1String(" MyUnregisteredEnumTypeObject::enumProperty");
+ QString w4 = file.toString() + ":7: Unable to assign [undefined] to int";
+ QString w5 = file.toString() + ":8: Unable to assign [undefined] to int";
+ QString w6 = file.toString() + ":9: Unable to assign [undefined] to int";
+ QString w7 = file.toString() + ":13: Unable to assign [undefined] to [unknown property type]";
+ QString w8 = file.toString() + ":31: Unable to assign int to [unknown property type]";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w3));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w4));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w5));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w6));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w7));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w8));
+
+ QQmlComponent component(&engine, testFileUrl("enums.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("a").toInt(), 0);
+ QCOMPARE(object->property("b").toInt(), 0);
+ QCOMPARE(object->property("c").toInt(), 0);
+
+ QString w9 = file.toString() + ":18: Error: Cannot assign JavaScript function to [unknown property type]";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w9));
+ QMetaObject::invokeMethod(object, "testAssignmentOne");
+
+ QString w10 = file.toString() + ":21: Error: Cannot assign [undefined] to [unknown property type]";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w10));
+ QMetaObject::invokeMethod(object, "testAssignmentTwo");
+
+ QString w11 = file.toString() + ":24: Error: Cannot assign [undefined] to [unknown property type]";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w11));
+ QMetaObject::invokeMethod(object, "testAssignmentThree");
+
+ QString w12 = file.toString() + ":34: Error: Cannot assign int to an unregistered type";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w12));
+ QMetaObject::invokeMethod(object, "testAssignmentFour");
+
+ delete object;
+ }
+ // Enums as literals
+ {
+ QQmlComponent component(&engine, testFileUrl("enums.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ // check the values are what we expect
+ QCOMPARE(object->property("a").toInt(), 4);
+ QCOMPARE(object->property("b").toInt(), 5);
+ QCOMPARE(object->property("c").toInt(), 9);
+ QCOMPARE(object->property("d").toInt(), 13);
+ QCOMPARE(object->property("e").toInt(), 2);
+ QCOMPARE(object->property("f").toInt(), 3);
+ QCOMPARE(object->property("h").toInt(), 2);
+ QCOMPARE(object->property("i").toInt(), 3);
+ QCOMPARE(object->property("j").toInt(), -1);
+ QCOMPARE(object->property("k").toInt(), 42);
+
+ // count of change signals
+ QCOMPARE(object->property("ac").toInt(), 0);
+ QCOMPARE(object->property("bc").toInt(), 0);
+ QCOMPARE(object->property("cc").toInt(), 0);
+ QCOMPARE(object->property("dc").toInt(), 0);
+ QCOMPARE(object->property("ec").toInt(), 0);
+ QCOMPARE(object->property("fc").toInt(), 0);
+ QCOMPARE(object->property("hc").toInt(), 1); // namespace -> binding
+ QCOMPARE(object->property("ic").toInt(), 1); // namespace -> binding
+ QCOMPARE(object->property("jc").toInt(), 0);
+ QCOMPARE(object->property("kc").toInt(), 0);
+
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::valueTypeFunctions()
+{
+ QQmlComponent component(&engine, testFileUrl("valueTypeFunctions.qml"));
+ MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->rectProperty(), QRect(0,0,100,100));
+ QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5));
+
+ delete obj;
+}
+
+/*
+Tests that writing a constant to a property with a binding on it disables the
+binding.
+*/
+void tst_qqmlecmascript::constantsOverrideBindings()
+{
+ // From ECMAScript
+ {
+ QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("c2").toInt(), 0);
+ object->setProperty("c1", QVariant(9));
+ QCOMPARE(object->property("c2").toInt(), 9);
+
+ emit object->basicSignal();
+
+ QCOMPARE(object->property("c2").toInt(), 13);
+ object->setProperty("c1", QVariant(8));
+ QCOMPARE(object->property("c2").toInt(), 13);
+
+ delete object;
+ }
+
+ // During construction
+ {
+ QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("c1").toInt(), 0);
+ QCOMPARE(object->property("c2").toInt(), 10);
+ object->setProperty("c1", QVariant(9));
+ QCOMPARE(object->property("c1").toInt(), 9);
+ QCOMPARE(object->property("c2").toInt(), 10);
+
+ delete object;
+ }
+
+#if 0
+ // From C++
+ {
+ QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.3.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("c2").toInt(), 0);
+ object->setProperty("c1", QVariant(9));
+ QCOMPARE(object->property("c2").toInt(), 9);
+
+ object->setProperty("c2", QVariant(13));
+ QCOMPARE(object->property("c2").toInt(), 13);
+ object->setProperty("c1", QVariant(7));
+ QCOMPARE(object->property("c1").toInt(), 7);
+ QCOMPARE(object->property("c2").toInt(), 13);
+
+ delete object;
+ }
+#endif
+
+ // Using an alias
+ {
+ QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.4.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("c1").toInt(), 0);
+ QCOMPARE(object->property("c3").toInt(), 10);
+ object->setProperty("c1", QVariant(9));
+ QCOMPARE(object->property("c1").toInt(), 9);
+ QCOMPARE(object->property("c3").toInt(), 10);
+
+ delete object;
+ }
+}
+
+/*
+Tests that assigning a binding to a property that already has a binding causes
+the original binding to be disabled.
+*/
+void tst_qqmlecmascript::outerBindingOverridesInnerBinding()
+{
+ QQmlComponent component(&engine,
+ testFileUrl("outerBindingOverridesInnerBinding.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("c1").toInt(), 0);
+ QCOMPARE(object->property("c2").toInt(), 0);
+ QCOMPARE(object->property("c3").toInt(), 0);
+
+ object->setProperty("c1", QVariant(9));
+ QCOMPARE(object->property("c1").toInt(), 9);
+ QCOMPARE(object->property("c2").toInt(), 0);
+ QCOMPARE(object->property("c3").toInt(), 0);
+
+ object->setProperty("c3", QVariant(8));
+ QCOMPARE(object->property("c1").toInt(), 9);
+ QCOMPARE(object->property("c2").toInt(), 8);
+ QCOMPARE(object->property("c3").toInt(), 8);
+
+ delete object;
+}
+
+/*
+Access a non-existent attached object.
+
+Tests for a regression where this used to crash.
+*/
+void tst_qqmlecmascript::nonExistentAttachedObject()
+{
+ QQmlComponent component(&engine, testFileUrl("nonExistentAttachedObject.qml"));
+
+ QString warning = component.url().toString() + ":4: Unable to assign [undefined] to QString";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::scope()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("scope.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toInt(), 1);
+ QCOMPARE(object->property("test2").toInt(), 2);
+ QCOMPARE(object->property("test3").toString(), QString("1Test"));
+ QCOMPARE(object->property("test4").toString(), QString("2Test"));
+ QCOMPARE(object->property("test5").toInt(), 1);
+ QCOMPARE(object->property("test6").toInt(), 1);
+ QCOMPARE(object->property("test7").toInt(), 2);
+ QCOMPARE(object->property("test8").toInt(), 2);
+ QCOMPARE(object->property("test9").toInt(), 1);
+ QCOMPARE(object->property("test10").toInt(), 3);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scope.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toInt(), 19);
+ QCOMPARE(object->property("test2").toInt(), 19);
+ QCOMPARE(object->property("test3").toInt(), 14);
+ QCOMPARE(object->property("test4").toInt(), 14);
+ QCOMPARE(object->property("test5").toInt(), 24);
+ QCOMPARE(object->property("test6").toInt(), 24);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scope.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+
+ delete object;
+ }
+
+ // Signal argument scope
+ {
+ QQmlComponent component(&engine, testFileUrl("scope.4.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ QCOMPARE(object->property("test2").toString(), QString());
+
+ emit object->argumentSignal(13, "Argument Scope", 9, MyQmlObject::EnumValue4, Qt::RightButton);
+
+ QCOMPARE(object->property("test").toInt(), 13);
+ QCOMPARE(object->property("test2").toString(), QString("Argument Scope"));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scope.5.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scope.6.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+}
+
+// In 4.7, non-library javascript files that had no imports shared the imports of their
+// importing context
+void tst_qqmlecmascript::importScope()
+{
+ QQmlComponent component(&engine, testFileUrl("importScope.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toInt(), 240);
+
+ delete o;
+}
+
+/*
+Tests that "any" type passes through a synthesized signal parameter. This
+is essentially a test of QQmlMetaType::copy()
+*/
+void tst_qqmlecmascript::signalParameterTypes()
+{
+ QQmlComponent component(&engine, testFileUrl("signalParameterTypes.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ emit object->basicSignal();
+
+ QCOMPARE(object->property("intProperty").toInt(), 10);
+ QCOMPARE(object->property("realProperty").toReal(), 19.2);
+ QVERIFY(object->property("colorProperty").value<QColor>() == QColor(255, 255, 0, 255));
+ QVERIFY(object->property("variantProperty") == QVariant::fromValue(QColor(255, 0, 255, 255)));
+ QVERIFY(object->property("enumProperty") == MyQmlObject::EnumValue3);
+ QVERIFY(object->property("qtEnumProperty") == Qt::LeftButton);
+
+ delete object;
+}
+
+/*
+Test that two JS objects for the same QObject compare as equal.
+*/
+void tst_qqmlecmascript::objectsCompareAsEqual()
+{
+ QQmlComponent component(&engine, testFileUrl("objectsCompareAsEqual.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), true);
+ QCOMPARE(object->property("test5").toBool(), true);
+
+ delete object;
+}
+
+/*
+Confirm bindings and alias properties can coexist.
+
+Tests for a regression where the binding would not reevaluate.
+*/
+void tst_qqmlecmascript::aliasPropertyAndBinding()
+{
+ QQmlComponent component(&engine, testFileUrl("aliasPropertyAndBinding.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("c2").toInt(), 3);
+ QCOMPARE(object->property("c3").toInt(), 3);
+
+ object->setProperty("c2", QVariant(19));
+
+ QCOMPARE(object->property("c2").toInt(), 19);
+ QCOMPARE(object->property("c3").toInt(), 19);
+
+ delete object;
+}
+
+/*
+Ensure that we can write undefined value to an alias property,
+and that the aliased property is reset correctly if possible.
+*/
+void tst_qqmlecmascript::aliasPropertyReset()
+{
+ QObject *object = 0;
+
+ // test that a manual write (of undefined) to a resettable aliased property succeeds
+ QQmlComponent c1(&engine, testFileUrl("aliasreset/aliasPropertyReset.1.qml"));
+ object = c1.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0);
+ QCOMPARE(object->property("aliasIsUndefined"), QVariant(false));
+ QMetaObject::invokeMethod(object, "resetAliased");
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0);
+ QCOMPARE(object->property("aliasIsUndefined"), QVariant(true));
+ delete object;
+
+ // test that a manual write (of undefined) to a resettable alias property succeeds
+ QQmlComponent c2(&engine, testFileUrl("aliasreset/aliasPropertyReset.2.qml"));
+ object = c2.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0);
+ QCOMPARE(object->property("loaderSourceComponentIsUndefined"), QVariant(false));
+ QMetaObject::invokeMethod(object, "resetAlias");
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0);
+ QCOMPARE(object->property("loaderSourceComponentIsUndefined"), QVariant(true));
+ delete object;
+
+ // test that an alias to a bound property works correctly
+ QQmlComponent c3(&engine, testFileUrl("aliasreset/aliasPropertyReset.3.qml"));
+ object = c3.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0);
+ QCOMPARE(object->property("loaderOneSourceComponentIsUndefined"), QVariant(false));
+ QCOMPARE(object->property("loaderTwoSourceComponentIsUndefined"), QVariant(false));
+ QMetaObject::invokeMethod(object, "resetAlias");
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0);
+ QCOMPARE(object->property("loaderOneSourceComponentIsUndefined"), QVariant(true));
+ QCOMPARE(object->property("loaderTwoSourceComponentIsUndefined"), QVariant(false));
+ delete object;
+
+ // test that a manual write (of undefined) to a resettable alias property
+ // whose aliased property's object has been deleted, does not crash.
+ QQmlComponent c4(&engine, testFileUrl("aliasreset/aliasPropertyReset.4.qml"));
+ object = c4.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0);
+ QObject *loader = object->findChild<QObject*>("loader");
+ QVERIFY(loader != 0);
+ delete loader;
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0); // deletion should have caused value unset.
+ QMetaObject::invokeMethod(object, "resetAlias"); // shouldn't crash.
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0);
+ QMetaObject::invokeMethod(object, "setAlias"); // shouldn't crash, and shouldn't change value (since it's no longer referencing anything).
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0);
+ delete object;
+
+ // test that binding an alias property to an undefined value works correctly
+ QQmlComponent c5(&engine, testFileUrl("aliasreset/aliasPropertyReset.5.qml"));
+ object = c5.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0); // bound to undefined value.
+ delete object;
+
+ // test that a manual write (of undefined) to a non-resettable property fails properly
+ QUrl url = testFileUrl("aliasreset/aliasPropertyReset.error.1.qml");
+ QString warning1 = url.toString() + QLatin1String(":15: Error: Cannot assign [undefined] to int");
+ QQmlComponent e1(&engine, url);
+ object = e1.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("intAlias").value<int>(), 12);
+ QCOMPARE(object->property("aliasedIntIsUndefined"), QVariant(false));
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QMetaObject::invokeMethod(object, "resetAlias");
+ QCOMPARE(object->property("intAlias").value<int>(), 12);
+ QCOMPARE(object->property("aliasedIntIsUndefined"), QVariant(false));
+ delete object;
+}
+
+void tst_qqmlecmascript::componentCreation_data()
+{
+ QTest::addColumn<QString>("method");
+ QTest::addColumn<QString>("creationError");
+ QTest::addColumn<QString>("createdParent");
+
+ QTest::newRow("url")
+ << "url"
+ << ""
+ << "";
+ QTest::newRow("urlMode")
+ << "urlMode"
+ << ""
+ << "";
+ QTest::newRow("urlParent")
+ << "urlParent"
+ << ""
+ << "obj";
+ QTest::newRow("urlNullParent")
+ << "urlNullParent"
+ << ""
+ << "null";
+ QTest::newRow("urlModeParent")
+ << "urlModeParent"
+ << ""
+ << "obj";
+ QTest::newRow("urlModeNullParent")
+ << "urlModeNullParent"
+ << ""
+ << "null";
+ QTest::newRow("invalidSecondArg")
+ << "invalidSecondArg"
+ << ":40: Error: Qt.createComponent(): Invalid arguments"
+ << "";
+ QTest::newRow("invalidThirdArg")
+ << "invalidThirdArg"
+ << ":45: Error: Qt.createComponent(): Invalid parent object"
+ << "";
+ QTest::newRow("invalidMode")
+ << "invalidMode"
+ << ":50: Error: Qt.createComponent(): Invalid arguments"
+ << "";
+}
+
+/*
+Test using createComponent to dynamically generate a component.
+*/
+void tst_qqmlecmascript::componentCreation()
+{
+ QFETCH(QString, method);
+ QFETCH(QString, creationError);
+ QFETCH(QString, createdParent);
+
+ QUrl testUrl(testFileUrl("componentCreation.qml"));
+
+ if (!creationError.isEmpty()) {
+ QString warning = testUrl.toString() + creationError;
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ }
+
+ QQmlComponent component(&engine, testUrl);
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, method.toUtf8());
+ QQmlComponent *created = object->componentProperty();
+
+ if (creationError.isEmpty()) {
+ QVERIFY(created);
+
+ QObject *expectedParent = reinterpret_cast<QObject *>(quintptr(-1));
+ if (createdParent == QLatin1String("obj")) {
+ expectedParent = object;
+ } else if ((createdParent == QLatin1String("null")) || createdParent.isEmpty()) {
+ expectedParent = 0;
+ }
+ QCOMPARE(created->parent(), expectedParent);
+ }
+}
+
+void tst_qqmlecmascript::dynamicCreation_data()
+{
+ QTest::addColumn<QString>("method");
+ QTest::addColumn<QString>("createdName");
+
+ QTest::newRow("One") << "createOne" << "objectOne";
+ QTest::newRow("Two") << "createTwo" << "objectTwo";
+ QTest::newRow("Three") << "createThree" << "objectThree";
+}
+
+/*
+Test using createQmlObject to dynamically generate an item
+Also using createComponent is tested.
+*/
+void tst_qqmlecmascript::dynamicCreation()
+{
+ QFETCH(QString, method);
+ QFETCH(QString, createdName);
+
+ QQmlComponent component(&engine, testFileUrl("dynamicCreation.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, method.toUtf8());
+ QObject *created = object->objectProperty();
+ QVERIFY(created);
+ QCOMPARE(created->objectName(), createdName);
+
+ delete object;
+}
+
+/*
+ Tests the destroy function
+*/
+void tst_qqmlecmascript::dynamicDestruction()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("dynamicDeletion.qml"));
+ QQmlGuard<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ QQmlGuard<QObject> createdQmlObject = 0;
+
+ QMetaObject::invokeMethod(object, "create");
+ createdQmlObject = object->objectProperty();
+ QVERIFY(createdQmlObject);
+ QCOMPARE(createdQmlObject->objectName(), QString("emptyObject"));
+
+ QMetaObject::invokeMethod(object, "killOther");
+ QVERIFY(createdQmlObject);
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QVERIFY(createdQmlObject);
+ for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up
+ if (createdQmlObject) {
+ QTest::qWait(100);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ }
+ }
+ QVERIFY(!createdQmlObject);
+
+ QQmlEngine::setObjectOwnership(object, QQmlEngine::JavaScriptOwnership);
+ QMetaObject::invokeMethod(object, "killMe");
+ QVERIFY(object);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QVERIFY(!object);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("dynamicDeletion.2.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0);
+
+ QMetaObject::invokeMethod(o, "create");
+
+ QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) != 0);
+
+ QMetaObject::invokeMethod(o, "destroy");
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0);
+
+ delete o;
+ }
+
+ {
+ // QTBUG-23451
+ QQmlGuard<QObject> createdQmlObject = 0;
+ QQmlComponent component(&engine, testFileUrl("dynamicDeletion.3.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0);
+ QMetaObject::invokeMethod(o, "create");
+ createdQmlObject = qvariant_cast<QObject*>(o->property("objectProperty"));
+ QVERIFY(createdQmlObject);
+ QMetaObject::invokeMethod(o, "destroy");
+ QVERIFY(qvariant_cast<bool>(o->property("test")) == false);
+ for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up
+ QTest::qWait(100);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ }
+ QVERIFY(qvariant_cast<QObject*>(o->property("objectProperty")) == 0);
+ QVERIFY(qvariant_cast<bool>(o->property("test")) == true);
+ delete o;
+ }
+}
+
+/*
+ tests that id.toString() works
+*/
+void tst_qqmlecmascript::objectToString()
+{
+ QQmlComponent component(&engine, testFileUrl("qmlToString.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "testToString");
+ QVERIFY(object->stringProperty().startsWith("MyQmlObject_QML_"));
+ QVERIFY(object->stringProperty().endsWith(", \"objName\")"));
+
+ delete object;
+}
+
+/*
+ tests that id.hasOwnProperty() works
+*/
+void tst_qqmlecmascript::objectHasOwnProperty()
+{
+ QUrl url = testFileUrl("qmlHasOwnProperty.qml");
+ QString warning1 = url.toString() + ":59: TypeError: Cannot call method 'hasOwnProperty' of undefined";
+ QString warning2 = url.toString() + ":64: TypeError: Cannot call method 'hasOwnProperty' of undefined";
+ QString warning3 = url.toString() + ":69: TypeError: Cannot call method 'hasOwnProperty' of undefined";
+
+ QQmlComponent component(&engine, url);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ // test QObjects in QML
+ QMetaObject::invokeMethod(object, "testHasOwnPropertySuccess");
+ QVERIFY(object->property("result").value<bool>() == true);
+ QMetaObject::invokeMethod(object, "testHasOwnPropertyFailure");
+ QVERIFY(object->property("result").value<bool>() == false);
+
+ // now test other types in QML
+ QObject *child = object->findChild<QObject*>("typeObj");
+ QVERIFY(child != 0);
+ QMetaObject::invokeMethod(child, "testHasOwnPropertySuccess");
+ QCOMPARE(child->property("valueTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("valueTypeHasOwnProperty2").toBool(), true);
+ QCOMPARE(child->property("variantTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("stringTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("listTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("emptyListTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("enumTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("typenameHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("typenameHasOwnProperty2").toBool(), true);
+ QCOMPARE(child->property("singletonTypeTypeHasOwnProperty").toBool(), true);
+ QCOMPARE(child->property("singletonTypePropertyTypeHasOwnProperty").toBool(), true);
+
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QMetaObject::invokeMethod(child, "testHasOwnPropertyFailureOne");
+ QCOMPARE(child->property("enumNonValueHasOwnProperty").toBool(), false);
+ QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
+ QMetaObject::invokeMethod(child, "testHasOwnPropertyFailureTwo");
+ QCOMPARE(child->property("singletonTypeNonPropertyHasOwnProperty").toBool(), false);
+ QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
+ QMetaObject::invokeMethod(child, "testHasOwnPropertyFailureThree");
+ QCOMPARE(child->property("listAtInvalidHasOwnProperty").toBool(), false);
+
+ delete object;
+}
+
+/*
+Tests bindings that indirectly cause their own deletion work.
+
+This test is best run under valgrind to ensure no invalid memory access occur.
+*/
+void tst_qqmlecmascript::selfDeletingBinding()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("selfDeletingBinding.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ object->setProperty("triggerDelete", true);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("selfDeletingBinding.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ object->setProperty("triggerDelete", true);
+ delete object;
+ }
+}
+
+/*
+Test that extended object properties can be accessed.
+
+This test a regression where this used to crash. The issue was specificially
+for extended objects that did not include a synthesized meta object (so non-root
+and no synthesiszed properties).
+*/
+void tst_qqmlecmascript::extendedObjectPropertyLookup()
+{
+ QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+/*
+Test that extended object properties can be accessed correctly.
+*/
+void tst_qqmlecmascript::extendedObjectPropertyLookup2()
+{
+ QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVariant returnValue;
+ QVERIFY(QMetaObject::invokeMethod(object, "getValue", Q_RETURN_ARG(QVariant, returnValue)));
+ QCOMPARE(returnValue.toInt(), 42);
+
+ delete object;
+}
+/*
+Test file/lineNumbers for binding/Script errors.
+*/
+void tst_qqmlecmascript::scriptErrors()
+{
+ QQmlComponent component(&engine, testFileUrl("scriptErrors.qml"));
+ QString url = component.url().toString();
+
+ QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\"";
+ QString warning2 = url + ":5: ReferenceError: a is not defined";
+ QString warning3 = url.left(url.length() - 3) + "js:4: Error: Invalid write to global property \"a\"";
+ QString warning4 = url + ":13: ReferenceError: a is not defined";
+ QString warning5 = url + ":11: ReferenceError: a is not defined";
+ QString warning6 = url + ":10: Unable to assign [undefined] to int";
+ QString warning7 = url + ":15: Error: Cannot assign to read-only property \"trueProperty\"";
+ QString warning8 = url + ":16: Error: Cannot assign to non-existent property \"fakeProperty\"";
+
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning6.toLatin1().constData());
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData());
+ emit object->basicSignal();
+
+ QTest::ignoreMessage(QtWarningMsg, warning7.toLatin1().constData());
+ emit object->anotherBasicSignal();
+
+ QTest::ignoreMessage(QtWarningMsg, warning8.toLatin1().constData());
+ emit object->thirdBasicSignal();
+
+ delete object;
+}
+
+/*
+Test file/lineNumbers for inline functions.
+*/
+void tst_qqmlecmascript::functionErrors()
+{
+ QQmlComponent component(&engine, testFileUrl("functionErrors.qml"));
+ QString url = component.url().toString();
+
+ QString warning = url + ":5: Error: Invalid write to global property \"a\"";
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+
+ // test that if an exception occurs while invoking js function from cpp, it is reported as expected.
+ QQmlComponent componentTwo(&engine, testFileUrl("scarceResourceFunctionFail.var.qml"));
+ url = componentTwo.url().toString();
+ object = componentTwo.create();
+ QVERIFY(object != 0);
+
+ warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function");
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed.
+ QMetaObject::invokeMethod(object, "retrieveScarceResource");
+ delete object;
+}
+
+/*
+Test various errors that can occur when assigning a property from script
+*/
+void tst_qqmlecmascript::propertyAssignmentErrors()
+{
+ QQmlComponent component(&engine, testFileUrl("propertyAssignmentErrors.qml"));
+
+ QString url = component.url().toString();
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+
+ delete object;
+}
+
+/*
+Test bindings still work when the reeval is triggered from within
+a signal script.
+*/
+void tst_qqmlecmascript::signalTriggeredBindings()
+{
+ QQmlComponent component(&engine, testFileUrl("signalTriggeredBindings.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("base").toReal(), 50.);
+ QCOMPARE(object->property("test1").toReal(), 50.);
+ QCOMPARE(object->property("test2").toReal(), 50.);
+
+ object->basicSignal();
+
+ QCOMPARE(object->property("base").toReal(), 200.);
+ QCOMPARE(object->property("test1").toReal(), 200.);
+ QCOMPARE(object->property("test2").toReal(), 200.);
+
+ object->argumentSignal(10, QString(), 10, MyQmlObject::EnumValue4, Qt::RightButton);
+
+ QCOMPARE(object->property("base").toReal(), 400.);
+ QCOMPARE(object->property("test1").toReal(), 400.);
+ QCOMPARE(object->property("test2").toReal(), 400.);
+
+ delete object;
+}
+
+/*
+Test that list properties can be iterated from ECMAScript
+*/
+void tst_qqmlecmascript::listProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("listProperties.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toInt(), 21);
+ QCOMPARE(object->property("test2").toInt(), 2);
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::exceptionClearsOnReeval()
+{
+ QQmlComponent component(&engine, testFileUrl("exceptionClearsOnReeval.qml"));
+ QString url = component.url().toString();
+
+ QString warning = url + ":4: TypeError: Cannot read property 'objectProperty' of null";
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), false);
+
+ MyQmlObject object2;
+ MyQmlObject object3;
+ object2.setObjectProperty(&object3);
+ object->setObjectProperty(&object2);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::exceptionSlotProducesWarning()
+{
+ QQmlComponent component(&engine, testFileUrl("exceptionProducesWarning.qml"));
+ QString url = component.url().toString();
+
+ QString warning = component.url().toString() + ":6: Error: JS exception";
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlecmascript::exceptionBindingProducesWarning()
+{
+ QQmlComponent component(&engine, testFileUrl("exceptionProducesWarning2.qml"));
+ QString url = component.url().toString();
+
+ QString warning = component.url().toString() + ":5: Error: JS exception";
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlecmascript::compileInvalidBinding()
+{
+ // QTBUG-23387: ensure that invalid bindings don't cause a crash.
+ QQmlComponent component(&engine, testFileUrl("v8bindingException.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+// Check that transient binding errors are not displayed
+void tst_qqmlecmascript::transientErrors()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("transientErrors.qml"));
+
+ QQmlTestMessageHandler messageHandler;
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+
+ delete object;
+ }
+
+ // One binding erroring multiple times, but then resolving
+ {
+ QQmlComponent component(&engine, testFileUrl("transientErrors.2.qml"));
+
+ QQmlTestMessageHandler messageHandler;
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+
+ delete object;
+ }
+}
+
+// Check that errors during shutdown are minimized
+void tst_qqmlecmascript::shutdownErrors()
+{
+ QQmlComponent component(&engine, testFileUrl("shutdownErrors.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QQmlTestMessageHandler messageHandler;
+
+ delete object;
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+}
+
+void tst_qqmlecmascript::compositePropertyType()
+{
+ QQmlComponent component(&engine, testFileUrl("compositePropertyType.qml"));
+
+ QTest::ignoreMessage(QtDebugMsg, "hello world");
+ QObject *object = qobject_cast<QObject *>(component.create());
+ delete object;
+}
+
+// QTBUG-5759
+void tst_qqmlecmascript::jsObject()
+{
+ QQmlComponent component(&engine, testFileUrl("jsObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 92);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::undefinedResetsProperty()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("undefinedResetsProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("resettableProperty").toInt(), 92);
+
+ object->setProperty("setUndefined", true);
+
+ QCOMPARE(object->property("resettableProperty").toInt(), 13);
+
+ object->setProperty("setUndefined", false);
+
+ QCOMPARE(object->property("resettableProperty").toInt(), 92);
+
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("undefinedResetsProperty.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("resettableProperty").toInt(), 19);
+
+ QMetaObject::invokeMethod(object, "doReset");
+
+ QCOMPARE(object->property("resettableProperty").toInt(), 13);
+
+ delete object;
+ }
+}
+
+// Aliases to variant properties should work
+void tst_qqmlecmascript::qtbug_22464()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_22464.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::qtbug_21580()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_21580.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// Causes a v8 binding, but not all v8 bindings to be destroyed during evaluation
+void tst_qqmlecmascript::singleV8BindingDestroyedDuringEvaluation()
+{
+ QQmlComponent component(&engine, testFileUrl("singleV8BindingDestroyedDuringEvaluation.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+// QTBUG-6781
+void tst_qqmlecmascript::bug1()
+{
+ QQmlComponent component(&engine, testFileUrl("bug.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 14);
+
+ object->setProperty("a", 11);
+
+ QCOMPARE(object->property("test").toInt(), 3);
+
+ object->setProperty("b", true);
+
+ QCOMPARE(object->property("test").toInt(), 9);
+
+ delete object;
+}
+
+#ifndef QT_NO_WIDGETS
+void tst_qqmlecmascript::bug2()
+{
+ QQmlComponent component(&engine);
+ component.setData("import Qt.test 1.0;\nQPlainTextEdit { width: 100 }", QUrl());
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+#endif
+
+// Don't crash in createObject when the component has errors.
+void tst_qqmlecmascript::dynamicCreationCrash()
+{
+ QQmlComponent component(&engine, testFileUrl("dynamicCreation.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ QMetaObject::invokeMethod(object, "dontCrash");
+ QObject *created = object->objectProperty();
+ QVERIFY(created == 0);
+
+ delete object;
+}
+
+// ownership transferred to JS, ensure that GC runs the dtor
+void tst_qqmlecmascript::dynamicCreationOwnership()
+{
+ int dtorCount = 0;
+ int expectedDtorCount = 1; // start at 1 since we expect mdcdo to dtor too.
+
+ // allow the engine to go out of scope too.
+ {
+ QQmlEngine dcoEngine;
+ QQmlComponent component(&dcoEngine, testFileUrl("dynamicCreationOwnership.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MyDynamicCreationDestructionObject *mdcdo = object->findChild<MyDynamicCreationDestructionObject*>("mdcdo");
+ QVERIFY(mdcdo != 0);
+ mdcdo->setDtorCount(&dtorCount);
+
+ for (int i = 1; i < 105; ++i, ++expectedDtorCount) {
+ QMetaObject::invokeMethod(object, "dynamicallyCreateJsOwnedObject");
+ if (i % 90 == 0) {
+ // we do this once manually, but it should be done automatically
+ // when the engine goes out of scope (since it should gc in dtor)
+ QMetaObject::invokeMethod(object, "performGc");
+ }
+ if (i % 10 == 0) {
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ }
+ }
+
+ delete object;
+ }
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, expectedDtorCount);
+}
+
+void tst_qqmlecmascript::regExpBug()
+{
+ //QTBUG-9367
+ {
+ QQmlComponent component(&engine, testFileUrl("regExp.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->regExp().pattern(), QLatin1String("[a-zA-z]"));
+ delete object;
+ }
+
+ //QTBUG-23068
+ {
+ QString err = QString(QLatin1String("%1:6 Invalid property assignment: regular expression expected; use /pattern/ syntax\n")).arg(testFileUrl("regExp.2.qml").toString());
+ QQmlComponent component(&engine, testFileUrl("regExp.2.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(!object);
+ QCOMPARE(component.errorString(), err);
+ }
+}
+
+static inline bool evaluate_error(QV8Engine *engine, v8::Handle<v8::Object> o, const char *source)
+{
+ QString functionSource = QLatin1String("(function(object) { return ") +
+ QLatin1String(source) + QLatin1String(" })");
+ v8::TryCatch tc;
+ v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ if (tc.HasCaught())
+ return false;
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
+ if (function.IsEmpty())
+ return false;
+ v8::Handle<v8::Value> args[] = { o };
+ function->Call(engine->global(), 1, args);
+ return tc.HasCaught();
+}
+
+static inline bool evaluate_value(QV8Engine *engine, v8::Handle<v8::Object> o,
+ const char *source, v8::Handle<v8::Value> result)
+{
+ QString functionSource = QLatin1String("(function(object) { return ") +
+ QLatin1String(source) + QLatin1String(" })");
+ v8::TryCatch tc;
+ v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ if (tc.HasCaught())
+ return false;
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
+ if (function.IsEmpty())
+ return false;
+ v8::Handle<v8::Value> args[] = { o };
+
+ v8::Handle<v8::Value> value = function->Call(engine->global(), 1, args);
+
+ if (tc.HasCaught())
+ return false;
+
+ return value->StrictEquals(result);
+}
+
+static inline v8::Handle<v8::Value> evaluate(QV8Engine *engine, v8::Handle<v8::Object> o,
+ const char *source)
+{
+ QString functionSource = QLatin1String("(function(object) { return ") +
+ QLatin1String(source) + QLatin1String(" })");
+ v8::TryCatch tc;
+ v8::Local<v8::Script> program = v8::Script::Compile(engine->toString(functionSource));
+ if (tc.HasCaught())
+ return v8::Handle<v8::Value>();
+ v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(program->Run());
+ if (function.IsEmpty())
+ return v8::Handle<v8::Value>();
+ v8::Handle<v8::Value> args[] = { o };
+
+ v8::Handle<v8::Value> value = function->Call(engine->global(), 1, args);
+
+ if (tc.HasCaught())
+ return v8::Handle<v8::Value>();
+ return value;
+}
+
+#define EVALUATE_ERROR(source) evaluate_error(engine, object, source)
+#define EVALUATE_VALUE(source, result) evaluate_value(engine, object, source, result)
+#define EVALUATE(source) evaluate(engine, object, source)
+
+void tst_qqmlecmascript::callQtInvokables()
+{
+ // This object has JS ownership, as the call to method_NoArgs_QObject() in this test will return
+ // it, which will set the indestructible flag to false.
+ MyInvokableObject *o = new MyInvokableObject();
+
+ QQmlEngine qmlengine;
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(&qmlengine);
+
+ QV8Engine *engine = ep->v8engine();
+
+ v8::HandleScope handle_scope;
+ v8::Context::Scope scope(engine->context());
+
+ v8::Local<v8::Object> object = engine->newQObject(o)->ToObject();
+
+ // Non-existent methods
+ o->reset();
+ QVERIFY(EVALUATE_ERROR("object.method_nonexistent()"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -1);
+ QCOMPARE(o->actuals().count(), 0);
+
+ o->reset();
+ QVERIFY(EVALUATE_ERROR("object.method_nonexistent(10, 11)"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -1);
+ QCOMPARE(o->actuals().count(), 0);
+
+ // Insufficient arguments
+ o->reset();
+ QVERIFY(EVALUATE_ERROR("object.method_int()"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -1);
+ QCOMPARE(o->actuals().count(), 0);
+
+ o->reset();
+ QVERIFY(EVALUATE_ERROR("object.method_intint(10)"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -1);
+ QCOMPARE(o->actuals().count(), 0);
+
+ // Excessive arguments
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_int(10, 11)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 8);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(10));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_intint(10, 11, 12)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 9);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(10));
+ QCOMPARE(o->actuals().at(1), QVariant(11));
+
+ // Test return types
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs()", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 0);
+ QCOMPARE(o->actuals().count(), 0);
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs_int()", v8::Integer::New(6)));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 1);
+ QCOMPARE(o->actuals().count(), 0);
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs_real()", v8::Number::New(19.75)));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 2);
+ QCOMPARE(o->actuals().count(), 0);
+
+ o->reset();
+ {
+ v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QPointF()");
+ QVERIFY(!ret.IsEmpty());
+ QCOMPARE(engine->toVariant(ret, -1), QVariant(QPointF(123, 4.5)));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 3);
+ QCOMPARE(o->actuals().count(), 0);
+ }
+
+ o->reset();
+ {
+ v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QObject()");
+ QCOMPARE(engine->toQObject(ret), (QObject *)o);
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 4);
+ QCOMPARE(o->actuals().count(), 0);
+ }
+
+ o->reset();
+ QVERIFY(EVALUATE_ERROR("object.method_NoArgs_unknown()"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -1);
+ QCOMPARE(o->actuals().count(), 0);
+
+ o->reset();
+ {
+ v8::Handle<v8::Value> ret = EVALUATE("object.method_NoArgs_QScriptValue()");
+ QVERIFY(ret->IsString());
+ QCOMPARE(engine->toString(ret), QString("Hello world"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 6);
+ QCOMPARE(o->actuals().count(), 0);
+ }
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_NoArgs_QVariant()", engine->toString("QML rocks")));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 7);
+ QCOMPARE(o->actuals().count(), 0);
+
+ // Test arg types
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_int(94)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 8);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(94));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_int(\"94\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 8);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(94));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_int(\"not a number\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 8);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_int(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 8);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_int(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 8);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_int(object)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 8);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_intint(122, 9)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 9);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(122));
+ QCOMPARE(o->actuals().at(1), QVariant(9));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_real(94.3)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 10);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(94.3));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_real(\"94.3\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 10);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(94.3));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_real(\"not a number\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 10);
+ QCOMPARE(o->actuals().count(), 1);
+ QVERIFY(qIsNaN(o->actuals().at(0).toDouble()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_real(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 10);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_real(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 10);
+ QCOMPARE(o->actuals().count(), 1);
+ QVERIFY(qIsNaN(o->actuals().at(0).toDouble()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_real(object)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 10);
+ QCOMPARE(o->actuals().count(), 1);
+ QVERIFY(qIsNaN(o->actuals().at(0).toDouble()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QString(\"Hello world\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 11);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant("Hello world"));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QString(19)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 11);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant("19"));
+
+ o->reset();
+ {
+ QString expected = "MyInvokableObject(0x" + QString::number((quintptr)o, 16) + ")";
+ QVERIFY(EVALUATE_VALUE("object.method_QString(object)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 11);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(expected));
+ }
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QString(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 11);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QString()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QString(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 11);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QString()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(0)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 12);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QPointF()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 12);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QPointF()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 12);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QPointF()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(object)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 12);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QPointF()));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPointF())", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 12);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QPointF(99.3, -10.2)));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPoint())", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 12);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QPointF(9, 12)));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(0)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 13);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(\"Hello world\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 13);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 13);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 13);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 13);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)o));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 14);
+ QCOMPARE(o->actuals().count(), 1);
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isNull());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 14);
+ QCOMPARE(o->actuals().count(), 1);
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isUndefined());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(19)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 14);
+ QCOMPARE(o->actuals().count(), 1);
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).strictlyEquals(QJSValue(19)));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QScriptValue([19, 20])", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 14);
+ QCOMPARE(o->actuals().count(), 1);
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isArray());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(4, null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 15);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(4));
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isNull());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(8, undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 15);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(8));
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isUndefined());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(3, 19)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 15);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(3));
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).strictlyEquals(QJSValue(19)));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(44, [19, 20])", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 15);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(44));
+ QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isArray());
+
+ o->reset();
+ QVERIFY(EVALUATE_ERROR("object.method_overload()"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -1);
+ QCOMPARE(o->actuals().count(), 0);
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_overload(10)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 16);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(10));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_overload(10, 11)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 17);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(10));
+ QCOMPARE(o->actuals().at(1), QVariant(11));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_overload(\"Hello\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 18);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(QString("Hello")));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_with_enum(9)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 19);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(9));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_default(10)", v8::Integer::New(19)));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 20);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(10));
+ QCOMPARE(o->actuals().at(1), QVariant(19));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_default(10, 13)", v8::Integer::New(13)));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 20);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(10));
+ QCOMPARE(o->actuals().at(1), QVariant(13));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_inherited(9)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -3);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(o->actuals().at(0), QVariant(9));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QVariant(9)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 21);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(9));
+ QCOMPARE(o->actuals().at(1), QVariant());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QVariant(\"Hello\", \"World\")", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 21);
+ QCOMPARE(o->actuals().count(), 2);
+ QCOMPARE(o->actuals().at(0), QVariant(QString("Hello")));
+ QCOMPARE(o->actuals().at(1), QVariant(QString("World")));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonObject({foo:123})", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 22);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonObject>(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonArray([123])", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 23);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonArray>(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(123)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 24);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(123));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(42.35)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 24);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(42.35));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonValue('ciao')", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 24);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QStringLiteral("ciao")));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(true)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 24);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(true));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(false)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 24);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(false));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 24);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Null));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 24);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Undefined));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_overload({foo:123})", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 25);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonObject>(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_overload([123])", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 26);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonArray>(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array());
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_overload(null)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 27);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Null));
+
+ o->reset();
+ QVERIFY(EVALUATE_VALUE("object.method_overload(undefined)", v8::Undefined()));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), 27);
+ QCOMPARE(o->actuals().count(), 1);
+ QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Undefined));
+
+ o->reset();
+ QVERIFY(EVALUATE_ERROR("object.method_unknown(null)"));
+ QCOMPARE(o->error(), false);
+ QCOMPARE(o->invoked(), -1);
+ QCOMPARE(o->actuals().count(), 0);
+}
+
+// QTBUG-13047 (check that you can pass registered object types as args)
+void tst_qqmlecmascript::invokableObjectArg()
+{
+ QQmlComponent component(&engine, testFileUrl("invokableObjectArg.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o);
+ MyQmlObject *qmlobject = qobject_cast<MyQmlObject *>(o);
+ QVERIFY(qmlobject);
+ QCOMPARE(qmlobject->myinvokableObject, qmlobject);
+
+ delete o;
+}
+
+// QTBUG-13047 (check that you can return registered object types from methods)
+void tst_qqmlecmascript::invokableObjectRet()
+{
+ QQmlComponent component(&engine, testFileUrl("invokableObjectRet.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+void tst_qqmlecmascript::invokableEnumRet()
+{
+ QQmlComponent component(&engine, testFileUrl("invokableEnumRet.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+// QTBUG-5675
+void tst_qqmlecmascript::listToVariant()
+{
+ QQmlComponent component(&engine, testFileUrl("listToVariant.qml"));
+
+ MyQmlContainer container;
+
+ QQmlContext context(engine.rootContext());
+ context.setContextObject(&container);
+
+ QObject *object = component.create(&context);
+ QVERIFY(object != 0);
+
+ QVariant v = object->property("test");
+ QCOMPARE(v.userType(), qMetaTypeId<QQmlListReference>());
+ QVERIFY(qvariant_cast<QQmlListReference>(v).object() == &container);
+
+ delete object;
+}
+
+// QTBUG-16316
+void tst_qqmlecmascript::listAssignment()
+{
+ QQmlComponent component(&engine, testFileUrl("listAssignment.qml"));
+ QObject *obj = component.create();
+ QCOMPARE(obj->property("list1length").toInt(), 2);
+ QQmlListProperty<MyQmlObject> list1 = obj->property("list1").value<QQmlListProperty<MyQmlObject> >();
+ QQmlListProperty<MyQmlObject> list2 = obj->property("list2").value<QQmlListProperty<MyQmlObject> >();
+ QCOMPARE(list1.count(&list1), list2.count(&list2));
+ QCOMPARE(list1.at(&list1, 0), list2.at(&list2, 0));
+ QCOMPARE(list1.at(&list1, 1), list2.at(&list2, 1));
+ delete obj;
+}
+
+// QTBUG-7957
+void tst_qqmlecmascript::multiEngineObject()
+{
+ MyQmlObject obj;
+ obj.setStringProperty("Howdy planet");
+
+ QQmlEngine e1;
+ e1.rootContext()->setContextProperty("thing", &obj);
+ QQmlComponent c1(&e1, testFileUrl("multiEngineObject.qml"));
+
+ QQmlEngine e2;
+ e2.rootContext()->setContextProperty("thing", &obj);
+ QQmlComponent c2(&e2, testFileUrl("multiEngineObject.qml"));
+
+ QObject *o1 = c1.create();
+ QObject *o2 = c2.create();
+
+ QCOMPARE(o1->property("test").toString(), QString("Howdy planet"));
+ QCOMPARE(o2->property("test").toString(), QString("Howdy planet"));
+
+ delete o2;
+ delete o1;
+}
+
+// Test that references to QObjects are cleanup when the object is destroyed
+void tst_qqmlecmascript::deletedObject()
+{
+ QQmlComponent component(&engine, testFileUrl("deletedObject.qml"));
+
+ QObject *object = component.create();
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::attachedPropertyScope()
+{
+ QQmlComponent component(&engine, testFileUrl("attachedPropertyScope.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ MyQmlAttachedObject *attached =
+ qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object));
+ QVERIFY(attached != 0);
+
+ QCOMPARE(object->property("value2").toInt(), 0);
+
+ attached->emitMySignal();
+
+ QCOMPARE(object->property("value2").toInt(), 9);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::scriptConnect()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptConnect.1.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), false);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptConnect.2.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), false);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptConnect.3.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), false);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptConnect.4.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->methodCalled(), false);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->methodCalled(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptConnect.5.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->methodCalled(), false);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->methodCalled(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptConnect.6.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 2);
+
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::scriptDisconnect()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptDisconnect.1.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 1);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->basicSignal();
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 2);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptDisconnect.2.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 1);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->basicSignal();
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 2);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptDisconnect.3.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 1);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->basicSignal();
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 3);
+
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptDisconnect.4.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 1);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->basicSignal();
+ QCOMPARE(object->property("test").toInt(), 2);
+ emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton);
+ QCOMPARE(object->property("test").toInt(), 3);
+
+ delete object;
+ }
+}
+
+class OwnershipObject : public QObject
+{
+ Q_OBJECT
+public:
+ OwnershipObject() { object = new QObject; }
+
+ QPointer<QObject> object;
+
+public slots:
+ QObject *getObject() { return object; }
+};
+
+void tst_qqmlecmascript::ownership()
+{
+ OwnershipObject own;
+ QQmlContext *context = new QQmlContext(engine.rootContext());
+ context->setContextObject(&own);
+
+ {
+ QQmlComponent component(&engine, testFileUrl("ownership.qml"));
+
+ QVERIFY(own.object != 0);
+
+ QObject *object = component.create(context);
+
+ engine.collectGarbage();
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(own.object == 0);
+
+ delete object;
+ }
+
+ own.object = new QObject(&own);
+
+ {
+ QQmlComponent component(&engine, testFileUrl("ownership.qml"));
+
+ QVERIFY(own.object != 0);
+
+ QObject *object = component.create(context);
+
+ engine.collectGarbage();
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(own.object != 0);
+
+ delete object;
+ }
+
+ delete context;
+}
+
+class CppOwnershipReturnValue : public QObject
+{
+ Q_OBJECT
+public:
+ CppOwnershipReturnValue() : value(0) {}
+ ~CppOwnershipReturnValue() { delete value; }
+
+ Q_INVOKABLE QObject *create() {
+ value = new QObject;
+ QQmlEngine::setObjectOwnership(value, QQmlEngine::CppOwnership);
+ return value;
+ }
+
+ Q_INVOKABLE MyQmlObject *createQmlObject() {
+ MyQmlObject *rv = new MyQmlObject;
+ value = rv;
+ return rv;
+ }
+
+ QPointer<QObject> value;
+};
+
+// QTBUG-15695.
+// Test setObjectOwnership(CppOwnership) works even when there is no QQmlData
+void tst_qqmlecmascript::cppOwnershipReturnValue()
+{
+ CppOwnershipReturnValue source;
+
+ {
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("source", &source);
+
+ QVERIFY(source.value == 0);
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nQtObject {\nComponent.onCompleted: { var a = source.create(); }\n}\n", QUrl());
+
+ QObject *object = component.create();
+
+ QVERIFY(object != 0);
+ QVERIFY(source.value != 0);
+
+ delete object;
+ }
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(source.value != 0);
+}
+
+// QTBUG-15697
+void tst_qqmlecmascript::ownershipCustomReturnValue()
+{
+ CppOwnershipReturnValue source;
+
+ {
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("source", &source);
+
+ QVERIFY(source.value == 0);
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nQtObject {\nComponent.onCompleted: { var a = source.createQmlObject(); }\n}\n", QUrl());
+
+ QObject *object = component.create();
+
+ QVERIFY(object != 0);
+ QVERIFY(source.value != 0);
+
+ delete object;
+ }
+
+ engine.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(source.value == 0);
+}
+
+//the return value from getObject will be JS ownership,
+//unless strong Cpp ownership has been set
+class OwnershipChangingObject : public QObject
+{
+ Q_OBJECT
+public:
+ OwnershipChangingObject(): object(0) { }
+
+ QPointer<QObject> object;
+
+public slots:
+ QObject *getObject() { return object; }
+ void setObject(QObject *obj) { object = obj; }
+};
+
+void tst_qqmlecmascript::ownershipRootObject()
+{
+ OwnershipChangingObject own;
+ QQmlContext *context = new QQmlContext(engine.rootContext());
+ context->setContextObject(&own);
+
+ QQmlComponent component(&engine, testFileUrl("ownershipRootObject.qml"));
+ QQmlGuard<QObject> object = component.create(context);
+ QVERIFY(object);
+
+ engine.collectGarbage();
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(own.object != 0);
+
+ delete context;
+ delete object;
+}
+
+void tst_qqmlecmascript::ownershipConsistency()
+{
+ OwnershipChangingObject own;
+ QQmlContext *context = new QQmlContext(engine.rootContext());
+ context->setContextObject(&own);
+
+ QString expectedWarning = testFileUrl("ownershipConsistency.qml").toString() + QLatin1String(":19: Error: Invalid attempt to destroy() an indestructible object");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
+ expectedWarning = testFileUrl("ownershipConsistency.qml").toString() + QLatin1String(":15: Error: Invalid attempt to destroy() an indestructible object");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
+ expectedWarning = testFileUrl("ownershipConsistency.qml").toString() + QLatin1String(":6: Error: Invalid attempt to destroy() an indestructible object");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
+ expectedWarning = testFileUrl("ownershipConsistency.qml").toString() + QLatin1String(":10: Error: Invalid attempt to destroy() an indestructible object");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
+
+ QQmlComponent component(&engine, testFileUrl("ownershipConsistency.qml"));
+ QQmlGuard<QObject> object = component.create(context);
+ QVERIFY(object);
+
+ engine.collectGarbage();
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(own.object != 0);
+
+ delete context;
+ delete object;
+}
+
+void tst_qqmlecmascript::ownershipQmlIncubated()
+{
+ QQmlComponent component(&engine, testFileUrl("ownershipQmlIncubated.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+
+ QTRY_VERIFY(object->property("incubatedItem").value<QObject*>() != 0);
+
+ QMetaObject::invokeMethod(object, "deleteIncubatedItem");
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(object->property("incubatedItem").value<QObject*>() == 0);
+
+ delete object;
+}
+
+class QListQObjectMethodsObject : public QObject
+{
+ Q_OBJECT
+public:
+ QListQObjectMethodsObject() {
+ m_objects.append(new MyQmlObject());
+ m_objects.append(new MyQmlObject());
+ }
+
+ ~QListQObjectMethodsObject() {
+ qDeleteAll(m_objects);
+ }
+
+public slots:
+ QList<QObject *> getObjects() { return m_objects; }
+
+private:
+ QList<QObject *> m_objects;
+};
+
+// Tests that returning a QList<QObject*> from a method works
+void tst_qqmlecmascript::qlistqobjectMethods()
+{
+ QListQObjectMethodsObject obj;
+ QQmlContext *context = new QQmlContext(engine.rootContext());
+ context->setContextObject(&obj);
+
+ QQmlComponent component(&engine, testFileUrl("qlistqobjectMethods.qml"));
+
+ QObject *object = component.create(context);
+
+ QCOMPARE(object->property("test").toInt(), 2);
+ QCOMPARE(object->property("test2").toBool(), true);
+
+ delete object;
+ delete context;
+}
+
+// QTBUG-9205
+void tst_qqmlecmascript::strictlyEquals()
+{
+ QQmlComponent component(&engine, testFileUrl("strictlyEquals.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), true);
+ QCOMPARE(object->property("test5").toBool(), true);
+ QCOMPARE(object->property("test6").toBool(), true);
+ QCOMPARE(object->property("test7").toBool(), true);
+ QCOMPARE(object->property("test8").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::compiled()
+{
+ QQmlComponent component(&engine, testFileUrl("compiled.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toReal(), qreal(15.7));
+ QCOMPARE(object->property("test2").toReal(), qreal(-6.7));
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), false);
+ QCOMPARE(object->property("test5").toBool(), false);
+ QCOMPARE(object->property("test6").toBool(), true);
+
+ QCOMPARE(object->property("test7").toInt(), 185);
+ QCOMPARE(object->property("test8").toInt(), 167);
+ QCOMPARE(object->property("test9").toBool(), true);
+ QCOMPARE(object->property("test10").toBool(), false);
+ QCOMPARE(object->property("test11").toBool(), false);
+ QCOMPARE(object->property("test12").toBool(), true);
+
+ QCOMPARE(object->property("test13").toString(), QLatin1String("HelloWorld"));
+ QCOMPARE(object->property("test14").toString(), QLatin1String("Hello World"));
+ QCOMPARE(object->property("test15").toBool(), false);
+ QCOMPARE(object->property("test16").toBool(), true);
+
+ QCOMPARE(object->property("test17").toInt(), 5);
+ QCOMPARE(object->property("test18").toReal(), qreal(176));
+ QCOMPARE(object->property("test19").toInt(), 7);
+ QCOMPARE(object->property("test20").toReal(), qreal(6.7));
+ QCOMPARE(object->property("test21").toString(), QLatin1String("6.7"));
+ QCOMPARE(object->property("test22").toString(), QLatin1String("!"));
+ QCOMPARE(object->property("test23").toBool(), true);
+ QCOMPARE(qvariant_cast<QColor>(object->property("test24")), QColor(0x11,0x22,0x33));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test25")), QColor(0x11,0x22,0x33,0xAA));
+
+ delete object;
+}
+
+// Test that numbers assigned in bindings as strings work consistently
+void tst_qqmlecmascript::numberAssignment()
+{
+ QQmlComponent component(&engine, testFileUrl("numberAssignment.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1"), QVariant((qreal)6.7));
+ QCOMPARE(object->property("test2"), QVariant((qreal)6.7));
+ QCOMPARE(object->property("test2"), QVariant((qreal)6.7));
+ QCOMPARE(object->property("test3"), QVariant((qreal)6));
+ QCOMPARE(object->property("test4"), QVariant((qreal)6));
+
+ QCOMPARE(object->property("test5"), QVariant((int)7));
+ QCOMPARE(object->property("test6"), QVariant((int)7));
+ QCOMPARE(object->property("test7"), QVariant((int)6));
+ QCOMPARE(object->property("test8"), QVariant((int)6));
+
+ QCOMPARE(object->property("test9"), QVariant((unsigned int)7));
+ QCOMPARE(object->property("test10"), QVariant((unsigned int)7));
+ QCOMPARE(object->property("test11"), QVariant((unsigned int)6));
+ QCOMPARE(object->property("test12"), QVariant((unsigned int)6));
+
+ delete object;
+}
+
+void tst_qqmlecmascript::propertySplicing()
+{
+ QQmlComponent component(&engine, testFileUrl("propertySplicing.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// QTBUG-16683
+void tst_qqmlecmascript::signalWithUnknownTypes()
+{
+ QQmlComponent component(&engine, testFileUrl("signalWithUnknownTypes.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ MyQmlObject::MyType type;
+ type.value = 0x8971123;
+ emit object->signalWithUnknownType(type);
+
+ MyQmlObject::MyType result = qvariant_cast<MyQmlObject::MyType>(object->variant());
+
+ QCOMPARE(result.value, type.value);
+
+ MyQmlObject::MyOtherType othertype;
+ othertype.value = 17;
+ emit object->signalWithCompletelyUnknownType(othertype);
+
+ QVERIFY(!object->variant().isValid());
+
+ delete object;
+}
+
+void tst_qqmlecmascript::signalWithJSValueInVariant_data()
+{
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<QString>("compare");
+
+ QString compareStrict("(function(a, b) { return a === b; })");
+ QTest::newRow("true") << "true" << compareStrict;
+ QTest::newRow("undefined") << "undefined" << compareStrict;
+ QTest::newRow("null") << "null" << compareStrict;
+ QTest::newRow("123") << "123" << compareStrict;
+ QTest::newRow("'ciao'") << "'ciao'" << compareStrict;
+
+ QString comparePropertiesStrict(
+ "(function(a, b) {"
+ " if (typeof b != 'object')"
+ " return a === b;"
+ " var props = Object.getOwnPropertyNames(b);"
+ " for (var i = 0; i < props.length; ++i) {"
+ " var p = props[i];"
+ " return arguments.callee(a[p], b[p]);"
+ " }"
+ "})");
+ QTest::newRow("{ foo: 'bar' }") << "({ foo: 'bar' })" << comparePropertiesStrict;
+ QTest::newRow("[10,20,30]") << "[10,20,30]" << comparePropertiesStrict;
+}
+
+void tst_qqmlecmascript::signalWithJSValueInVariant()
+{
+ QFETCH(QString, expression);
+ QFETCH(QString, compare);
+
+ QQmlComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml"));
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create()));
+ QVERIFY(object != 0);
+
+ QJSValue value = engine.evaluate(expression);
+ QVERIFY(!value.isError());
+ object->setProperty("expression", expression);
+ object->setProperty("compare", compare);
+ object->setProperty("pass", false);
+
+ emit object->signalWithVariant(QVariant::fromValue(value));
+ QVERIFY(object->property("pass").toBool());
+}
+
+void tst_qqmlecmascript::signalWithJSValueInVariant_twoEngines_data()
+{
+ signalWithJSValueInVariant_data();
+}
+
+void tst_qqmlecmascript::signalWithJSValueInVariant_twoEngines()
+{
+ QFETCH(QString, expression);
+ QFETCH(QString, compare);
+
+ QQmlComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml"));
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create()));
+ QVERIFY(object != 0);
+
+ QJSEngine engine2;
+ QJSValue value = engine2.evaluate(expression);
+ QVERIFY(!value.isError());
+ object->setProperty("expression", expression);
+ object->setProperty("compare", compare);
+ object->setProperty("pass", false);
+
+ QTest::ignoreMessage(QtWarningMsg, "JSValue can't be rassigned to an another engine.");
+ emit object->signalWithVariant(QVariant::fromValue(value));
+ QVERIFY(!object->property("pass").toBool());
+}
+
+void tst_qqmlecmascript::signalWithQJSValue_data()
+{
+ signalWithJSValueInVariant_data();
+}
+
+void tst_qqmlecmascript::signalWithQJSValue()
+{
+ QFETCH(QString, expression);
+ QFETCH(QString, compare);
+
+ QQmlComponent component(&engine, testFileUrl("signalWithQJSValue.qml"));
+ QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create()));
+ QVERIFY(object != 0);
+
+ QJSValue value = engine.evaluate(expression);
+ QVERIFY(!value.isError());
+ object->setProperty("expression", expression);
+ object->setProperty("compare", compare);
+ object->setProperty("pass", false);
+
+ emit object->signalWithQJSValue(value);
+
+ QVERIFY(object->property("pass").toBool());
+ QVERIFY(object->qjsvalue().strictlyEquals(value));
+}
+
+void tst_qqmlecmascript::singletonType_data()
+{
+ QTest::addColumn<QUrl>("testfile");
+ QTest::addColumn<QString>("errorMessage");
+ QTest::addColumn<QStringList>("warningMessages");
+ QTest::addColumn<QStringList>("readProperties");
+ QTest::addColumn<QVariantList>("readExpectedValues");
+ QTest::addColumn<QStringList>("writeProperties");
+ QTest::addColumn<QVariantList>("writeValues");
+ QTest::addColumn<QStringList>("readBackProperties");
+ QTest::addColumn<QVariantList>("readBackExpectedValues");
+
+ QTest::newRow("qobject, register + read + method [no qualifier]")
+ << testFileUrl("singletontype/qobjectSingletonTypeNoQualifier.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << "qobjectPropertyTest" << "qobjectMethodTest")
+ << (QVariantList() << 20 << 1)
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("script, register + read [no qualifier]")
+ << testFileUrl("singletontype/scriptSingletonTypeNoQualifier.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << "scriptTest")
+ << (QVariantList() << 13)
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("qobject, register + read + method")
+ << testFileUrl("singletontype/qobjectSingletonType.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << "existingUriTest" << "qobjectTest" << "qobjectMethodTest"
+ << "qobjectMinorVersionMethodTest" << "qobjectMinorVersionTest"
+ << "qobjectMajorVersionTest" << "qobjectParentedTest")
+ << (QVariantList() << 20 << 20 << 2 << 1 << 20 << 20 << 26)
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("script, register + read")
+ << testFileUrl("singletontype/scriptSingletonType.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << "scriptTest")
+ << (QVariantList() << 14) // will have incremented, since we create a new engine each row in this test.
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("qobject, writing + readonly constraints")
+ << testFileUrl("singletontype/qobjectSingletonTypeWriting.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("singletontype/qobjectSingletonTypeWriting.qml").toString() + QLatin1String(":15: Error: Cannot assign to read-only property \"qobjectTestProperty\"")))
+ << (QStringList() << "readOnlyProperty" << "writableProperty" << "writableFinalProperty")
+ << (QVariantList() << 20 << 50 << 10)
+ << (QStringList() << "firstProperty" << "secondProperty")
+ << (QVariantList() << 30 << 30)
+ << (QStringList() << "readOnlyProperty" << "writableProperty" << "writableFinalProperty")
+ << (QVariantList() << 20 << 30 << 30);
+
+ QTest::newRow("script, writing + readonly constraints")
+ << testFileUrl("singletontype/scriptSingletonTypeWriting.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("singletontype/scriptSingletonTypeWriting.qml").toString() + QLatin1String(":21: Error: Cannot assign to read-only property \"scriptTestProperty\"")))
+ << (QStringList() << "readBack" << "unchanged")
+ << (QVariantList() << 15 << 42)
+ << (QStringList() << "firstProperty" << "secondProperty")
+ << (QVariantList() << 30 << 30)
+ << (QStringList() << "readBack" << "unchanged")
+ << (QVariantList() << 30 << 42);
+
+ QTest::newRow("qobject singleton Type enum values in JS")
+ << testFileUrl("singletontype/qobjectSingletonTypeEnums.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << "enumValue" << "enumMethod")
+ << (QVariantList() << 42 << 30)
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("qobject, invalid major version fail")
+ << testFileUrl("singletontype/singletonTypeMajorVersionFail.qml")
+ << QString("QQmlComponent: Component is not ready")
+ << QStringList()
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("qobject, invalid minor version fail")
+ << testFileUrl("singletontype/singletonTypeMinorVersionFail.qml")
+ << QString("QQmlComponent: Component is not ready")
+ << QStringList()
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("qobject, multiple in namespace")
+ << testFileUrl("singletontype/singletonTypeMultiple.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << "first" << "second")
+ << (QVariantList() << 35 << 42)
+ << QStringList()
+ << QVariantList()
+ << QStringList()
+ << QVariantList();
+}
+
+void tst_qqmlecmascript::singletonType()
+{
+ QFETCH(QUrl, testfile);
+ QFETCH(QString, errorMessage);
+ QFETCH(QStringList, warningMessages);
+ QFETCH(QStringList, readProperties);
+ QFETCH(QVariantList, readExpectedValues);
+ QFETCH(QStringList, writeProperties);
+ QFETCH(QVariantList, writeValues);
+ QFETCH(QStringList, readBackProperties);
+ QFETCH(QVariantList, readBackExpectedValues);
+
+ QQmlEngine cleanEngine; // so tests don't interfere which each other, as singleton types are engine-singletons only.
+ QQmlComponent component(&cleanEngine, testfile);
+
+ if (!errorMessage.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, errorMessage.toLatin1().constData());
+
+ if (warningMessages.size())
+ foreach (const QString &warning, warningMessages)
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+
+ QObject *object = component.create();
+ if (!errorMessage.isEmpty()) {
+ QVERIFY(object == 0);
+ } else {
+ QVERIFY(object != 0);
+ for (int i = 0; i < readProperties.size(); ++i)
+ QCOMPARE(object->property(readProperties.at(i).toLatin1().constData()), readExpectedValues.at(i));
+ for (int i = 0; i < writeProperties.size(); ++i)
+ QVERIFY(object->setProperty(writeProperties.at(i).toLatin1().constData(), writeValues.at(i)));
+ for (int i = 0; i < readBackProperties.size(); ++i)
+ QCOMPARE(object->property(readBackProperties.at(i).toLatin1().constData()), readBackExpectedValues.at(i));
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::singletonTypeCaching_data()
+{
+ QTest::addColumn<QUrl>("testfile");
+ QTest::addColumn<QStringList>("readProperties");
+
+ QTest::newRow("qobject, caching + read")
+ << testFileUrl("singletontype/qobjectSingletonTypeCaching.qml")
+ << (QStringList() << "existingUriTest" << "qobjectParentedTest");
+
+ QTest::newRow("script, caching + read")
+ << testFileUrl("singletontype/scriptSingletonTypeCaching.qml")
+ << (QStringList() << "scriptTest");
+}
+
+void tst_qqmlecmascript::singletonTypeCaching()
+{
+ QFETCH(QUrl, testfile);
+ QFETCH(QStringList, readProperties);
+
+ // ensure that the singleton type instances are cached per-engine.
+
+ QQmlEngine cleanEngine;
+ QQmlComponent component(&cleanEngine, testfile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QList<QVariant> firstValues;
+ QMetaObject::invokeMethod(object, "modifyValues");
+ for (int i = 0; i < readProperties.size(); ++i)
+ firstValues << object->property(readProperties.at(i).toLatin1().constData());
+ delete object;
+
+ QQmlComponent component2(&cleanEngine, testfile);
+ QObject *object2 = component2.create();
+ QVERIFY(object2 != 0);
+ for (int i = 0; i < readProperties.size(); ++i)
+ QCOMPARE(object2->property(readProperties.at(i).toLatin1().constData()), firstValues.at(i)); // cached, shouldn't have changed.
+ delete object2;
+}
+
+void tst_qqmlecmascript::singletonTypeImportOrder()
+{
+ QQmlComponent component(&engine, testFileUrl("singletontype/singletonTypeImportOrder.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+ QVERIFY(object->property("v") == 1);
+ delete object;
+}
+
+void tst_qqmlecmascript::singletonTypeResolution()
+{
+ QQmlComponent component(&engine, testFileUrl("singletontype/singletonTypeResolution.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+ QVERIFY(object->property("success") == true);
+ delete object;
+}
+
+void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
+ QQmlContextData *childCtxt = ctxt->childContexts;
+
+ if (!ctxt->importedScripts.isEmpty()) {
+ QV8Engine *engine = QV8Engine::get(ctxt->engine);
+ foreach (v8::Persistent<v8::Object> qmlglobal, ctxt->importedScripts) {
+ QQmlContextData *scriptContext, *newContext;
+
+ if (qmlglobal.IsEmpty())
+ continue;
+
+ scriptContext = engine->contextWrapper()->context(qmlglobal);
+
+ {
+ v8::HandleScope handle_scope;
+ v8::Persistent<v8::Context> context = v8::Context::New();
+ v8::Context::Scope context_scope(context);
+ v8::Local<v8::Object> temporaryScope = engine->qmlScope(scriptContext, NULL);
+ Q_UNUSED(temporaryScope)
+
+ context.Dispose();
+ }
+
+ QV8Engine::gc();
+ newContext = engine->contextWrapper()->context(qmlglobal);
+ QVERIFY(scriptContext == newContext);
+ }
+ }
+
+ while (childCtxt) {
+ verifyContextLifetime(childCtxt);
+
+ childCtxt = childCtxt->nextChild;
+ }
+}
+
+void tst_qqmlecmascript::importScripts_data()
+{
+ QTest::addColumn<QUrl>("testfile");
+ QTest::addColumn<QString>("errorMessage");
+ QTest::addColumn<QStringList>("warningMessages");
+ QTest::addColumn<QStringList>("propertyNames");
+ QTest::addColumn<QVariantList>("propertyValues");
+
+ QTest::newRow("basic functionality")
+ << testFileUrl("jsimport/testImport.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("importedScriptStringValue")
+ << QLatin1String("importedScriptFunctionValue")
+ << QLatin1String("importedModuleAttachedPropertyValue")
+ << QLatin1String("importedModuleEnumValue"))
+ << (QVariantList() << QVariant(QLatin1String("Hello, World!"))
+ << QVariant(20)
+ << QVariant(19)
+ << QVariant(2));
+
+ QTest::newRow("import scoping")
+ << testFileUrl("jsimport/testImportScoping.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("componentError"))
+ << (QVariantList() << QVariant(5));
+
+ QTest::newRow("parent scope shouldn't be inherited by import with imports")
+ << testFileUrl("jsimportfail/failOne.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("jsimportfail/failOne.qml").toString() + QLatin1String(":6: TypeError: Cannot call method 'greetingString' of undefined")))
+ << (QStringList() << QLatin1String("importScriptFunctionValue"))
+ << (QVariantList() << QVariant(QString()));
+
+ QTest::newRow("javascript imports in an import should be private to the import scope")
+ << testFileUrl("jsimportfail/failTwo.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("jsimportfail/failTwo.qml").toString() + QLatin1String(":6: ReferenceError: ImportOneJs is not defined")))
+ << (QStringList() << QLatin1String("importScriptFunctionValue"))
+ << (QVariantList() << QVariant(QString()));
+
+ QTest::newRow("module imports in an import should be private to the import scope")
+ << testFileUrl("jsimportfail/failThree.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("jsimportfail/failThree.qml").toString() + QLatin1String(":7: TypeError: Cannot read property 'JsQtTest' of undefined")))
+ << (QStringList() << QLatin1String("importedModuleAttachedPropertyValue"))
+ << (QVariantList() << QVariant(false));
+
+ QTest::newRow("typenames in an import should be private to the import scope")
+ << testFileUrl("jsimportfail/failFour.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("jsimportfail/failFour.qml").toString() + QLatin1String(":6: ReferenceError: JsQtTest is not defined")))
+ << (QStringList() << QLatin1String("importedModuleEnumValue"))
+ << (QVariantList() << QVariant(0));
+
+ QTest::newRow("import with imports has it's own activation scope")
+ << testFileUrl("jsimportfail/failFive.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("jsimportfail/importWithImports.js").toString() + QLatin1String(":8: ReferenceError: Component is not defined")))
+ << (QStringList() << QLatin1String("componentError"))
+ << (QVariantList() << QVariant(0));
+
+ QTest::newRow("import pragma library script")
+ << testFileUrl("jsimport/testImportPragmaLibrary.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("testValue"))
+ << (QVariantList() << QVariant(31));
+
+ QTest::newRow("pragma library imports shouldn't inherit parent imports or scope")
+ << testFileUrl("jsimportfail/testImportPragmaLibrary.qml")
+ << QString()
+ << (QStringList() << QString(testFileUrl("jsimportfail/importPragmaLibrary.js").toString() + QLatin1String(":6: ReferenceError: Component is not defined")))
+ << (QStringList() << QLatin1String("testValue"))
+ << (QVariantList() << QVariant(0));
+
+ QTest::newRow("import pragma library script which has an import")
+ << testFileUrl("jsimport/testImportPragmaLibraryWithImports.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("testValue"))
+ << (QVariantList() << QVariant(55));
+
+ QTest::newRow("import pragma library script which has a pragma library import")
+ << testFileUrl("jsimport/testImportPragmaLibraryWithPragmaLibraryImports.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("testValue"))
+ << (QVariantList() << QVariant(18));
+
+ QTest::newRow("import singleton type into js import")
+ << testFileUrl("jsimport/testImportSingletonType.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("testValue"))
+ << (QVariantList() << QVariant(20));
+
+ QTest::newRow("import module which exports a script")
+ << testFileUrl("jsimport/testJsImport.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("importedScriptStringValue")
+ << QLatin1String("renamedScriptStringValue")
+ << QLatin1String("reimportedScriptStringValue"))
+ << (QVariantList() << QVariant(QString("Hello"))
+ << QVariant(QString("Hello"))
+ << QVariant(QString("Hello")));
+
+ QTest::newRow("import module which exports a script which imports a remote module")
+ << testFileUrl("jsimport/testJsRemoteImport.qml")
+ << QString()
+ << QStringList()
+ << (QStringList() << QLatin1String("importedScriptStringValue")
+ << QLatin1String("renamedScriptStringValue")
+ << QLatin1String("reimportedScriptStringValue"))
+ << (QVariantList() << QVariant(QString("Hello"))
+ << QVariant(QString("Hello"))
+ << QVariant(QString("Hello")));
+
+ QTest::newRow("malformed import statement")
+ << testFileUrl("jsimportfail/malformedImport.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedImport.js").toString() + QLatin1String(":1: SyntaxError: Unexpected token ."))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("malformed file name")
+ << testFileUrl("jsimportfail/malformedFile.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedFile.js").toString() + QLatin1String(":1:9: Imported file must be a script"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("missing file qualifier")
+ << testFileUrl("jsimportfail/missingFileQualifier.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/missingFileQualifier.js").toString() + QLatin1String(":1:1: File import requires a qualifier"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("malformed file qualifier")
+ << testFileUrl("jsimportfail/malformedFileQualifier.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedFileQualifier.js").toString() + QLatin1String(":1:20: File import requires a qualifier"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("malformed module qualifier 2")
+ << testFileUrl("jsimportfail/malformedFileQualifier.2.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedFileQualifier.2.js").toString() + QLatin1String(":1:1: Invalid import qualifier"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("malformed module uri")
+ << testFileUrl("jsimportfail/malformedModule.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedModule.js").toString() + QLatin1String(":1:17: Invalid module URI"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("missing module version")
+ << testFileUrl("jsimportfail/missingModuleVersion.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/missingModuleVersion.js").toString() + QLatin1String(":1:17: Module import requires a version"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("malformed module version")
+ << testFileUrl("jsimportfail/malformedModuleVersion.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedModuleVersion.js").toString() + QLatin1String(":1:17: Module import requires a version"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("missing module qualifier")
+ << testFileUrl("jsimportfail/missingModuleQualifier.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/missingModuleQualifier.js").toString() + QLatin1String(":1:1: Module import requires a qualifier"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("malformed module qualifier")
+ << testFileUrl("jsimportfail/malformedModuleQualifier.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedModuleQualifier.js").toString() + QLatin1String(":1:21: Module import requires a qualifier"))
+ << QStringList()
+ << QVariantList();
+
+ QTest::newRow("malformed module qualifier 2")
+ << testFileUrl("jsimportfail/malformedModuleQualifier.2.qml")
+ << QString()
+ << (QStringList() << testFileUrl("jsimportfail/malformedModuleQualifier.2.js").toString() + QLatin1String(":1:1: Invalid import qualifier"))
+ << QStringList()
+ << QVariantList();
+}
+
+void tst_qqmlecmascript::importScripts()
+{
+ QFETCH(QUrl, testfile);
+ QFETCH(QString, errorMessage);
+ QFETCH(QStringList, warningMessages);
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QVariantList, propertyValues);
+
+ TestHTTPServer server(8111);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory() + "/remote");
+
+ QStringList importPathList = engine.importPathList();
+
+ QString remotePath(QLatin1String("http://127.0.0.1:8111/"));
+ engine.addImportPath(remotePath);
+
+ QQmlComponent component(&engine, testfile);
+
+ if (!errorMessage.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, errorMessage.toLatin1().constData());
+
+ if (warningMessages.size())
+ foreach (const QString &warning, warningMessages)
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+
+ QTRY_VERIFY(component.isReady());
+
+ QObject *object = component.create();
+ if (!errorMessage.isEmpty()) {
+ QVERIFY(object == 0);
+ } else {
+ QVERIFY(object != 0);
+
+ QQmlContextData *ctxt = QQmlContextData::get(engine.rootContext());
+ tst_qqmlecmascript::verifyContextLifetime(ctxt);
+
+ for (int i = 0; i < propertyNames.size(); ++i)
+ QCOMPARE(object->property(propertyNames.at(i).toLatin1().constData()), propertyValues.at(i));
+ delete object;
+ }
+
+ engine.setImportPathList(importPathList);
+}
+
+void tst_qqmlecmascript::scarceResources_other()
+{
+ /* These tests require knowledge of state, since we test values after
+ performing signal or function invocation. */
+
+ QPixmap origPixmap(100, 100);
+ origPixmap.fill(Qt::blue);
+ QString srp_name, expectedWarning;
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(&engine);
+ ScarceResourceObject *eo = 0;
+ QObject *srsc = 0;
+ QObject *object = 0;
+
+ /* property var semantics */
+
+ // test that scarce resources are handled properly in signal invocation
+ QQmlComponent varComponentTen(&engine, testFileUrl("scarceResourceSignal.var.qml"));
+ object = varComponentTen.create();
+ srsc = object->findChild<QObject*>("srsc");
+ QVERIFY(srsc);
+ QVERIFY(!srsc->property("scarceResourceCopy").isValid()); // hasn't been instantiated yet.
+ QCOMPARE(srsc->property("width"), QVariant(5)); // default value is 5.
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QMetaObject::invokeMethod(srsc, "testSignal");
+ QVERIFY(!srsc->property("scarceResourceCopy").isValid()); // still hasn't been instantiated
+ QCOMPARE(srsc->property("width"), QVariant(10)); // but width was assigned to 10.
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should still be no other copies of it at this stage.
+ QMetaObject::invokeMethod(srsc, "testSignal2"); // assigns scarceResourceCopy to the scarce pixmap.
+ QVERIFY(srsc->property("scarceResourceCopy").isValid());
+ QCOMPARE(srsc->property("scarceResourceCopy").value<QPixmap>(), origPixmap);
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(!(eo->scarceResourceIsDetached())); // should be another copy of the resource now.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
+ delete object;
+
+ // test that scarce resources are handled properly from js functions in qml files
+ QQmlComponent varComponentEleven(&engine, testFileUrl("scarceResourceFunction.var.qml"));
+ object = varComponentEleven.create();
+ QVERIFY(object != 0);
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QMetaObject::invokeMethod(object, "retrieveScarceResource");
+ QVERIFY(object->property("scarceResourceCopy").isValid()); // assigned, so should be valid.
+ QCOMPARE(object->property("scarceResourceCopy").value<QPixmap>(), origPixmap);
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(!eo->scarceResourceIsDetached()); // should be a copy of the resource at this stage.
+ QMetaObject::invokeMethod(object, "releaseScarceResource");
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // just released, so should not be valid
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
+ delete object;
+
+ // test that if an exception occurs while invoking js function from cpp, that the resources are released.
+ QQmlComponent varComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.var.qml"));
+ object = varComponentTwelve.create();
+ QVERIFY(object != 0);
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
+ QMetaObject::invokeMethod(object, "retrieveScarceResource");
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
+ delete object;
+
+ // test that if an Item which has JS ownership but has a scarce resource property is garbage collected,
+ // that the scarce resource is removed from the engine's list of scarce resources to clean up.
+ QQmlComponent varComponentThirteen(&engine, testFileUrl("scarceResourceObjectGc.var.qml"));
+ object = varComponentThirteen.create();
+ QVERIFY(object != 0);
+ QVERIFY(!object->property("varProperty").isValid()); // not assigned yet
+ QMetaObject::invokeMethod(object, "assignVarProperty");
+ QVERIFY(ep->scarceResources.isEmpty()); // the scarce resource is a VME property.
+ QMetaObject::invokeMethod(object, "deassignVarProperty");
+ QVERIFY(ep->scarceResources.isEmpty()); // should still be empty; the resource should have been released on gc.
+ delete object;
+
+ /* property variant semantics */
+
+ // test that scarce resources are handled properly in signal invocation
+ QQmlComponent variantComponentTen(&engine, testFileUrl("scarceResourceSignal.variant.qml"));
+ object = variantComponentTen.create();
+ QVERIFY(object != 0);
+ srsc = object->findChild<QObject*>("srsc");
+ QVERIFY(srsc);
+ QVERIFY(!srsc->property("scarceResourceCopy").isValid()); // hasn't been instantiated yet.
+ QCOMPARE(srsc->property("width"), QVariant(5)); // default value is 5.
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QMetaObject::invokeMethod(srsc, "testSignal");
+ QVERIFY(!srsc->property("scarceResourceCopy").isValid()); // still hasn't been instantiated
+ QCOMPARE(srsc->property("width"), QVariant(10)); // but width was assigned to 10.
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should still be no other copies of it at this stage.
+ QMetaObject::invokeMethod(srsc, "testSignal2"); // assigns scarceResourceCopy to the scarce pixmap.
+ QVERIFY(srsc->property("scarceResourceCopy").isValid());
+ QCOMPARE(srsc->property("scarceResourceCopy").value<QPixmap>(), origPixmap);
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(!(eo->scarceResourceIsDetached())); // should be another copy of the resource now.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
+ delete object;
+
+ // test that scarce resources are handled properly from js functions in qml files
+ QQmlComponent variantComponentEleven(&engine, testFileUrl("scarceResourceFunction.variant.qml"));
+ object = variantComponentEleven.create();
+ QVERIFY(object != 0);
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QMetaObject::invokeMethod(object, "retrieveScarceResource");
+ QVERIFY(object->property("scarceResourceCopy").isValid()); // assigned, so should be valid.
+ QCOMPARE(object->property("scarceResourceCopy").value<QPixmap>(), origPixmap);
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(!eo->scarceResourceIsDetached()); // should be a copy of the resource at this stage.
+ QMetaObject::invokeMethod(object, "releaseScarceResource");
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // just released, so should not be valid
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
+ delete object;
+
+ // test that if an exception occurs while invoking js function from cpp, that the resources are released.
+ QQmlComponent variantComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.variant.qml"));
+ object = variantComponentTwelve.create();
+ QVERIFY(object != 0);
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
+ QMetaObject::invokeMethod(object, "retrieveScarceResource");
+ QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
+ QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point.
+ delete object;
+}
+
+void tst_qqmlecmascript::scarceResources_data()
+{
+ QTest::addColumn<QUrl>("qmlFile");
+ QTest::addColumn<bool>("readDetachStatus");
+ QTest::addColumn<bool>("expectedDetachStatus");
+ QTest::addColumn<QStringList>("propertyNames");
+ QTest::addColumn<QVariantList>("expectedValidity");
+ QTest::addColumn<QVariantList>("expectedValues");
+ QTest::addColumn<QStringList>("expectedErrors");
+
+ QPixmap origPixmap(100, 100);
+ origPixmap.fill(Qt::blue);
+
+ /* property var semantics */
+
+ // in the following three cases, the instance created from the component
+ // has a property which is a copy of the scarce resource; hence, the
+ // resource should NOT be detached prior to deletion of the object instance,
+ // unless the resource is destroyed explicitly.
+ QTest::newRow("var: import scarce resource copy directly")
+ << testFileUrl("scarceResourceCopy.var.qml")
+ << true
+ << false // won't be detached, because assigned to property and not explicitly released
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << origPixmap)
+ << QStringList();
+
+ QTest::newRow("var: import scarce resource copy from JS")
+ << testFileUrl("scarceResourceCopyFromJs.var.qml")
+ << true
+ << false // won't be detached, because assigned to property and not explicitly released
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << origPixmap)
+ << QStringList();
+
+ QTest::newRow("var: import released scarce resource copy from JS")
+ << testFileUrl("scarceResourceDestroyedCopy.var.qml")
+ << true
+ << true // explicitly released, so it will be detached
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << false)
+ << (QList<QVariant>() << QVariant())
+ << QStringList();
+
+ // in the following three cases, no other copy should exist in memory,
+ // and so it should be detached (unless explicitly preserved).
+ QTest::newRow("var: import auto-release SR from JS in binding side-effect")
+ << testFileUrl("scarceResourceTest.var.qml")
+ << true
+ << true // auto released, so it will be detached
+ << (QStringList() << QLatin1String("scarceResourceTest"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << QVariant(100))
+ << QStringList();
+ QTest::newRow("var: import explicit-preserve SR from JS in binding side-effect")
+ << testFileUrl("scarceResourceTestPreserve.var.qml")
+ << true
+ << false // won't be detached because we explicitly preserve it
+ << (QStringList() << QLatin1String("scarceResourceTest"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << QVariant(100))
+ << QStringList();
+ QTest::newRow("var: import explicit-preserve SR from JS in binding side-effect")
+ << testFileUrl("scarceResourceTestMultiple.var.qml")
+ << true
+ << true // will be detached because all resources were released manually or automatically.
+ << (QStringList() << QLatin1String("scarceResourceTest"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << QVariant(100))
+ << QStringList();
+
+ // In the following three cases, test that scarce resources are handled
+ // correctly for imports.
+ QTest::newRow("var: import with no binding")
+ << testFileUrl("scarceResourceCopyImportNoBinding.var.qml")
+ << false // cannot check detach status.
+ << false
+ << QStringList()
+ << QList<QVariant>()
+ << QList<QVariant>()
+ << QStringList();
+ QTest::newRow("var: import with binding without explicit preserve")
+ << testFileUrl("scarceResourceCopyImportNoBinding.var.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << false) // will have been released prior to evaluation of binding.
+ << (QList<QVariant>() << QVariant())
+ << QStringList();
+ QTest::newRow("var: import with explicit release after binding evaluation")
+ << testFileUrl("scarceResourceCopyImport.var.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("scarceResourceImportedCopy") << QLatin1String("scarceResourceAssignedCopyOne") << QLatin1String("scarceResourceAssignedCopyTwo") << QLatin1String("arePropertiesEqual"))
+ << (QList<QVariant>() << false << false << false << true) // since property var = JS object reference, by releasing the provider's resource, all handles are invalidated.
+ << (QList<QVariant>() << QVariant() << QVariant() << QVariant() << QVariant(true))
+ << QStringList();
+ QTest::newRow("var: import with different js objects")
+ << testFileUrl("scarceResourceCopyImportDifferent.var.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("scarceResourceAssignedCopyOne") << QLatin1String("scarceResourceAssignedCopyTwo") << QLatin1String("arePropertiesEqual"))
+ << (QList<QVariant>() << false << true << true) // invalidating one shouldn't invalidate the other, because they're not references to the same JS object.
+ << (QList<QVariant>() << QVariant() << QVariant(origPixmap) << QVariant(false))
+ << QStringList();
+ QTest::newRow("var: import with different js objects and explicit release")
+ << testFileUrl("scarceResourceMultipleDifferentNoBinding.var.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("resourceOne") << QLatin1String("resourceTwo"))
+ << (QList<QVariant>() << true << false) // invalidating one shouldn't invalidate the other, because they're not references to the same JS object.
+ << (QList<QVariant>() << QVariant(origPixmap) << QVariant())
+ << QStringList();
+ QTest::newRow("var: import with same js objects and explicit release")
+ << testFileUrl("scarceResourceMultipleSameNoBinding.var.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("resourceOne") << QLatin1String("resourceTwo"))
+ << (QList<QVariant>() << false << false) // invalidating one should invalidate the other, because they're references to the same JS object.
+ << (QList<QVariant>() << QVariant() << QVariant())
+ << QStringList();
+ QTest::newRow("var: binding with same js objects and explicit release")
+ << testFileUrl("scarceResourceMultipleSameWithBinding.var.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("resourceOne") << QLatin1String("resourceTwo"))
+ << (QList<QVariant>() << false << false) // invalidating one should invalidate the other, because they're references to the same JS object.
+ << (QList<QVariant>() << QVariant() << QVariant())
+ << QStringList();
+
+
+ /* property variant semantics */
+
+ // in the following three cases, the instance created from the component
+ // has a property which is a copy of the scarce resource; hence, the
+ // resource should NOT be detached prior to deletion of the object instance,
+ // unless the resource is destroyed explicitly.
+ QTest::newRow("variant: import scarce resource copy directly")
+ << testFileUrl("scarceResourceCopy.variant.qml")
+ << true
+ << false // won't be detached, because assigned to property and not explicitly released
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << origPixmap)
+ << QStringList();
+
+ QTest::newRow("variant: import scarce resource copy from JS")
+ << testFileUrl("scarceResourceCopyFromJs.variant.qml")
+ << true
+ << false // won't be detached, because assigned to property and not explicitly released
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << origPixmap)
+ << QStringList();
+
+ QTest::newRow("variant: import released scarce resource copy from JS")
+ << testFileUrl("scarceResourceDestroyedCopy.variant.qml")
+ << true
+ << true // explicitly released, so it will be detached
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << false)
+ << (QList<QVariant>() << QVariant())
+ << QStringList();
+
+ // in the following three cases, no other copy should exist in memory,
+ // and so it should be detached (unless explicitly preserved).
+ QTest::newRow("variant: import auto-release SR from JS in binding side-effect")
+ << testFileUrl("scarceResourceTest.variant.qml")
+ << true
+ << true // auto released, so it will be detached
+ << (QStringList() << QLatin1String("scarceResourceTest"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << QVariant(100))
+ << QStringList();
+ QTest::newRow("variant: import explicit-preserve SR from JS in binding side-effect")
+ << testFileUrl("scarceResourceTestPreserve.variant.qml")
+ << true
+ << false // won't be detached because we explicitly preserve it
+ << (QStringList() << QLatin1String("scarceResourceTest"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << QVariant(100))
+ << QStringList();
+ QTest::newRow("variant: import multiple scarce resources")
+ << testFileUrl("scarceResourceTestMultiple.variant.qml")
+ << true
+ << true // will be detached because all resources were released manually or automatically.
+ << (QStringList() << QLatin1String("scarceResourceTest"))
+ << (QList<QVariant>() << true)
+ << (QList<QVariant>() << QVariant(100))
+ << QStringList();
+
+ // In the following three cases, test that scarce resources are handled
+ // correctly for imports.
+ QTest::newRow("variant: import with no binding")
+ << testFileUrl("scarceResourceCopyImportNoBinding.variant.qml")
+ << false // cannot check detach status.
+ << false
+ << QStringList()
+ << QList<QVariant>()
+ << QList<QVariant>()
+ << QStringList();
+ QTest::newRow("variant: import with binding without explicit preserve")
+ << testFileUrl("scarceResourceCopyImportNoBinding.variant.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("scarceResourceCopy"))
+ << (QList<QVariant>() << false) // will have been released prior to evaluation of binding.
+ << (QList<QVariant>() << QVariant())
+ << QStringList();
+ QTest::newRow("variant: import with explicit release after binding evaluation")
+ << testFileUrl("scarceResourceCopyImport.variant.qml")
+ << false
+ << false
+ << (QStringList() << QLatin1String("scarceResourceImportedCopy") << QLatin1String("scarceResourceAssignedCopyOne") << QLatin1String("scarceResourceAssignedCopyTwo"))
+ << (QList<QVariant>() << true << true << false) // since property variant = variant copy, releasing the provider's resource does not invalidate previously assigned copies.
+ << (QList<QVariant>() << origPixmap << origPixmap << QVariant())
+ << QStringList();
+}
+
+void tst_qqmlecmascript::scarceResources()
+{
+ QFETCH(QUrl, qmlFile);
+ QFETCH(bool, readDetachStatus);
+ QFETCH(bool, expectedDetachStatus);
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QVariantList, expectedValidity);
+ QFETCH(QVariantList, expectedValues);
+ QFETCH(QStringList, expectedErrors);
+
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(&engine);
+ ScarceResourceObject *eo = 0;
+ QObject *object = 0;
+
+ QQmlComponent c(&engine, qmlFile);
+ object = c.create();
+ QVERIFY(object != 0);
+ for (int i = 0; i < propertyNames.size(); ++i) {
+ QString prop = propertyNames.at(i);
+ bool validity = expectedValidity.at(i).toBool();
+ QVariant value = expectedValues.at(i);
+
+ QCOMPARE(object->property(prop.toLatin1().constData()).isValid(), validity);
+ if (value.type() == QVariant::Int) {
+ QCOMPARE(object->property(prop.toLatin1().constData()).toInt(), value.toInt());
+ } else if (value.type() == QVariant::Pixmap) {
+ QCOMPARE(object->property(prop.toLatin1().constData()).value<QPixmap>(), value.value<QPixmap>());
+ }
+ }
+
+ if (readDetachStatus) {
+ eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
+ QCOMPARE(eo->scarceResourceIsDetached(), expectedDetachStatus);
+ }
+
+ QVERIFY(ep->scarceResources.isEmpty());
+ delete object;
+}
+
+void tst_qqmlecmascript::propertyChangeSlots()
+{
+ // ensure that allowable property names are allowed and onPropertyNameChanged slots are generated correctly.
+ QQmlComponent component(&engine, testFileUrl("changeslots/propertyChangeSlots.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+
+ // ensure that invalid property names fail properly.
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ QQmlComponent e1(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.1.qml"));
+ QString expectedErrorString = e1.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on_nameWithUnderscoreChanged\"");
+ QCOMPARE(e1.errors().at(0).toString(), expectedErrorString);
+ object = e1.create();
+ QVERIFY(object == 0);
+ delete object;
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ QQmlComponent e2(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.2.qml"));
+ expectedErrorString = e2.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on____nameWithUnderscoresChanged\"");
+ QCOMPARE(e2.errors().at(0).toString(), expectedErrorString);
+ object = e2.create();
+ QVERIFY(object == 0);
+ delete object;
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ QQmlComponent e3(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.3.qml"));
+ expectedErrorString = e3.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on$NameWithDollarsignChanged\"");
+ QCOMPARE(e3.errors().at(0).toString(), expectedErrorString);
+ object = e3.create();
+ QVERIFY(object == 0);
+ delete object;
+
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ QQmlComponent e4(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.4.qml"));
+ expectedErrorString = e4.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on_6NameWithUnderscoreNumberChanged\"");
+ QCOMPARE(e4.errors().at(0).toString(), expectedErrorString);
+ object = e4.create();
+ QVERIFY(object == 0);
+ delete object;
+}
+
+void tst_qqmlecmascript::propertyVar_data()
+{
+ QTest::addColumn<QUrl>("qmlFile");
+
+ // valid
+ QTest::newRow("non-bindable object subproperty changed") << testFileUrl("propertyVar.1.qml");
+ QTest::newRow("non-bindable object changed") << testFileUrl("propertyVar.2.qml");
+ QTest::newRow("primitive changed") << testFileUrl("propertyVar.3.qml");
+ QTest::newRow("javascript array modification") << testFileUrl("propertyVar.4.qml");
+ QTest::newRow("javascript map modification") << testFileUrl("propertyVar.5.qml");
+ QTest::newRow("javascript array assignment") << testFileUrl("propertyVar.6.qml");
+ QTest::newRow("javascript map assignment") << testFileUrl("propertyVar.7.qml");
+ QTest::newRow("literal property assignment") << testFileUrl("propertyVar.8.qml");
+ QTest::newRow("qobject property assignment") << testFileUrl("propertyVar.9.qml");
+ QTest::newRow("base class var property assignment") << testFileUrl("propertyVar.10.qml");
+ QTest::newRow("javascript function assignment") << testFileUrl("propertyVar.11.qml");
+ QTest::newRow("javascript special assignment") << testFileUrl("propertyVar.12.qml");
+ QTest::newRow("declarative binding assignment") << testFileUrl("propertyVar.13.qml");
+ QTest::newRow("imperative binding assignment") << testFileUrl("propertyVar.14.qml");
+ QTest::newRow("stored binding assignment") << testFileUrl("propertyVar.15.qml");
+ QTest::newRow("function expression binding assignment") << testFileUrl("propertyVar.16.qml");
+}
+
+void tst_qqmlecmascript::propertyVar()
+{
+ QFETCH(QUrl, qmlFile);
+
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::propertyQJSValue_data()
+{
+ QTest::addColumn<QUrl>("qmlFile");
+
+ // valid
+ QTest::newRow("non-bindable object subproperty changed") << testFileUrl("propertyQJSValue.1.qml");
+ QTest::newRow("non-bindable object changed") << testFileUrl("propertyQJSValue.2.qml");
+ QTest::newRow("primitive changed") << testFileUrl("propertyQJSValue.3.qml");
+ QTest::newRow("javascript array modification") << testFileUrl("propertyQJSValue.4.qml");
+ QTest::newRow("javascript map modification") << testFileUrl("propertyQJSValue.5.qml");
+ QTest::newRow("javascript array assignment") << testFileUrl("propertyQJSValue.6.qml");
+ QTest::newRow("javascript map assignment") << testFileUrl("propertyQJSValue.7.qml");
+ QTest::newRow("literal property assignment") << testFileUrl("propertyQJSValue.8.qml");
+ QTest::newRow("qobject property assignment") << testFileUrl("propertyQJSValue.9.qml");
+ QTest::newRow("base class var property assignment") << testFileUrl("propertyQJSValue.10.qml");
+ QTest::newRow("javascript function assignment") << testFileUrl("propertyQJSValue.11.qml");
+ QTest::newRow("javascript special assignment") << testFileUrl("propertyQJSValue.12.qml");
+ QTest::newRow("declarative binding assignment") << testFileUrl("propertyQJSValue.13.qml");
+ QTest::newRow("imperative binding assignment") << testFileUrl("propertyQJSValue.14.qml");
+ QTest::newRow("stored binding assignment") << testFileUrl("propertyQJSValue.15.qml");
+ QTest::newRow("javascript function binding") << testFileUrl("propertyQJSValue.16.qml");
+
+ QTest::newRow("reset property") << testFileUrl("propertyQJSValue.reset.qml");
+ QTest::newRow("reset property in binding") << testFileUrl("propertyQJSValue.bindingreset.qml");
+}
+
+void tst_qqmlecmascript::propertyQJSValue()
+{
+ QFETCH(QUrl, qmlFile);
+
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// Tests that we can write QVariant values to var properties from C++
+void tst_qqmlecmascript::propertyVarCpp()
+{
+ QObject *object = 0;
+
+ // ensure that writing to and reading from a var property from cpp works as required.
+ // Literal values stored in var properties can be read and written as QVariants
+ // of a specific type, whereas object values are read as QVariantMaps.
+ QQmlComponent component(&engine, testFileUrl("propertyVarCpp.qml"));
+ object = component.create();
+ QVERIFY(object != 0);
+ // assign int to property var that currently has int assigned
+ QVERIFY(object->setProperty("varProperty", QVariant::fromValue(10)));
+ QCOMPARE(object->property("varBound"), QVariant(15));
+ QCOMPARE(object->property("intBound"), QVariant(15));
+ QCOMPARE(object->property("varProperty").userType(), (int)QVariant::Int);
+ QCOMPARE(object->property("varBound").userType(), (int)QVariant::Int);
+ // assign string to property var that current has bool assigned
+ QCOMPARE(object->property("varProperty2").userType(), (int)QVariant::Bool);
+ QVERIFY(object->setProperty("varProperty2", QVariant(QLatin1String("randomString"))));
+ QCOMPARE(object->property("varProperty2"), QVariant(QLatin1String("randomString")));
+ QCOMPARE(object->property("varProperty2").userType(), (int)QVariant::String);
+ // now enforce behaviour when accessing JavaScript objects from cpp.
+ QCOMPARE(object->property("jsobject").userType(), (int)QVariant::Map);
+ delete object;
+}
+
+static void gc(QQmlEngine &engine)
+{
+ engine.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+}
+
+void tst_qqmlecmascript::propertyVarOwnership()
+{
+ // Referenced JS objects are not collected
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toBool(), false);
+ QMetaObject::invokeMethod(object, "runTest");
+ QCOMPARE(object->property("test").toBool(), true);
+ delete object;
+ }
+ // Referenced JS objects are not collected
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toBool(), false);
+ QMetaObject::invokeMethod(object, "runTest");
+ QCOMPARE(object->property("test").toBool(), true);
+ delete object;
+ }
+ // Qt objects are not collected until they've been dereferenced
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toBool(), false);
+ QCOMPARE(object->property("test2").toBool(), false);
+
+ QMetaObject::invokeMethod(object, "runTest");
+ QCOMPARE(object->property("test1").toBool(), true);
+
+ QPointer<QObject> referencedObject = object->property("object").value<QObject*>();
+ QVERIFY(!referencedObject.isNull());
+ gc(engine);
+ QVERIFY(!referencedObject.isNull());
+
+ QMetaObject::invokeMethod(object, "runTest2");
+ QCOMPARE(object->property("test2").toBool(), true);
+ gc(engine);
+ QVERIFY(referencedObject.isNull());
+
+ delete object;
+ }
+ // Self reference does not prevent Qt object collection
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.4.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ QPointer<QObject> referencedObject = object->property("object").value<QObject*>();
+ QVERIFY(!referencedObject.isNull());
+ gc(engine);
+ QVERIFY(!referencedObject.isNull());
+
+ QMetaObject::invokeMethod(object, "runTest");
+ gc(engine);
+ QVERIFY(referencedObject.isNull());
+
+ delete object;
+ }
+ // Garbage collection cannot result in attempted dereference of empty handle
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.5.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "runTest");
+ QCOMPARE(object->property("test").toBool(), true);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::propertyVarImplicitOwnership()
+{
+ // The childObject has a reference to a different QObject. We want to ensure
+ // that the different item will not be cleaned up until required. IE, the childObject
+ // has implicit ownership of the constructed QObject.
+ QQmlComponent component(&engine, testFileUrl("propertyVarImplicitOwnership.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "assignCircular");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QObject *rootObject = object->property("vp").value<QObject*>();
+ QVERIFY(rootObject != 0);
+ QObject *childObject = rootObject->findChild<QObject*>("text");
+ QVERIFY(childObject != 0);
+ QCOMPARE(rootObject->property("rectCanary").toInt(), 5);
+ QCOMPARE(childObject->property("textCanary").toInt(), 10);
+ QMetaObject::invokeMethod(childObject, "constructQObject"); // creates a reference to a constructed QObject.
+ QWeakPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events.
+ QVERIFY(!qobjectGuard.isNull());
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QVERIFY(!qobjectGuard.isNull());
+ QMetaObject::invokeMethod(object, "deassignCircular");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QVERIFY(qobjectGuard.isNull()); // should have been collected now.
+ delete object;
+}
+
+void tst_qqmlecmascript::propertyVarReparent()
+{
+ // ensure that nothing breaks if we re-parent objects
+ QQmlComponent component(&engine, testFileUrl("propertyVar.reparent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "assignVarProp");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QObject *rect = object->property("vp").value<QObject*>();
+ QObject *text = rect->findChild<QObject*>("textOne");
+ QObject *text2 = rect->findChild<QObject*>("textTwo");
+ QWeakPointer<QObject> rectGuard(rect);
+ QWeakPointer<QObject> textGuard(text);
+ QWeakPointer<QObject> text2Guard(text2);
+ QVERIFY(!rectGuard.isNull());
+ QVERIFY(!textGuard.isNull());
+ QVERIFY(!text2Guard.isNull());
+ QCOMPARE(text->property("textCanary").toInt(), 11);
+ QCOMPARE(text2->property("textCanary").toInt(), 12);
+ // now construct an image which we will reparent.
+ QMetaObject::invokeMethod(text2, "constructQObject");
+ QObject *image = text2->property("vp").value<QObject*>();
+ QWeakPointer<QObject> imageGuard(image);
+ QVERIFY(!imageGuard.isNull());
+ QCOMPARE(image->property("imageCanary").toInt(), 13);
+ // now reparent the "Image" object (currently, it has JS ownership)
+ image->setParent(text); // shouldn't be collected after deassignVp now, since has a parent.
+ QMetaObject::invokeMethod(text2, "deassignVp");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QCOMPARE(text->property("textCanary").toInt(), 11);
+ QCOMPARE(text2->property("textCanary").toInt(), 22);
+ QVERIFY(!imageGuard.isNull()); // should still be alive.
+ QCOMPARE(image->property("imageCanary").toInt(), 13); // still able to access var properties
+ QMetaObject::invokeMethod(object, "deassignVarProp"); // now deassign the root-object's vp, causing gc of rect+text+text2
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QVERIFY(imageGuard.isNull()); // should now have been deleted, due to parent being deleted.
+ delete object;
+}
+
+void tst_qqmlecmascript::propertyVarReparentNullContext()
+{
+ // sometimes reparenting can cause problems
+ // (eg, if the ctxt is collected, varproperties are no longer available)
+ // this test ensures that no crash occurs in that situation.
+ QQmlComponent component(&engine, testFileUrl("propertyVar.reparent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "assignVarProp");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QObject *rect = object->property("vp").value<QObject*>();
+ QObject *text = rect->findChild<QObject*>("textOne");
+ QObject *text2 = rect->findChild<QObject*>("textTwo");
+ QWeakPointer<QObject> rectGuard(rect);
+ QWeakPointer<QObject> textGuard(text);
+ QWeakPointer<QObject> text2Guard(text2);
+ QVERIFY(!rectGuard.isNull());
+ QVERIFY(!textGuard.isNull());
+ QVERIFY(!text2Guard.isNull());
+ QCOMPARE(text->property("textCanary").toInt(), 11);
+ QCOMPARE(text2->property("textCanary").toInt(), 12);
+ // now construct an image which we will reparent.
+ QMetaObject::invokeMethod(text2, "constructQObject");
+ QObject *image = text2->property("vp").value<QObject*>();
+ QWeakPointer<QObject> imageGuard(image);
+ QVERIFY(!imageGuard.isNull());
+ QCOMPARE(image->property("imageCanary").toInt(), 13);
+ // now reparent the "Image" object (currently, it has JS ownership)
+ image->setParent(object); // reparented to base object. after deassignVarProp, the ctxt will be invalid.
+ QMetaObject::invokeMethod(object, "deassignVarProp"); // now deassign the root-object's vp, causing gc of rect+text+text2
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QVERIFY(!imageGuard.isNull()); // should still be alive.
+ QVERIFY(!image->property("imageCanary").isValid()); // but varProperties won't be available (null context).
+ delete object;
+ QVERIFY(imageGuard.isNull()); // should now be dead.
+}
+
+void tst_qqmlecmascript::propertyVarCircular()
+{
+ // enforce behaviour regarding circular references - ensure qdvmemo deletion.
+ QQmlComponent component(&engine, testFileUrl("propertyVar.circular.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QCOMPARE(object->property("canaryInt"), QVariant(5));
+ QVariant canaryResourceVariant = object->property("canaryResource");
+ QVERIFY(canaryResourceVariant.isValid());
+ QPixmap canaryResourcePixmap = canaryResourceVariant.value<QPixmap>();
+ canaryResourceVariant = QVariant(); // invalidate it to remove one copy of the pixmap from memory.
+ QMetaObject::invokeMethod(object, "deassignCanaryResource"); // remove one copy of the pixmap from memory
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QVERIFY(!canaryResourcePixmap.isDetached()); // two copies extant - this and the propertyVar.vp.vp.vp.vp.memoryHog.
+ QMetaObject::invokeMethod(object, "deassignCircular"); // cause deassignment and gc
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QCOMPARE(object->property("canaryInt"), QVariant(2));
+ QCOMPARE(object->property("canaryResource"), QVariant(1));
+ QVERIFY(canaryResourcePixmap.isDetached()); // now detached, since orig copy was member of qdvmemo which was deleted.
+ delete object;
+}
+
+void tst_qqmlecmascript::propertyVarCircular2()
+{
+ // track deletion of JS-owned parent item with Cpp-owned child
+ // where the child has a var property referencing its parent.
+ QQmlComponent component(&engine, testFileUrl("propertyVar.circular.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "assignCircular");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QObject *rootObject = object->property("vp").value<QObject*>();
+ QVERIFY(rootObject != 0);
+ QObject *childObject = rootObject->findChild<QObject*>("text");
+ QVERIFY(childObject != 0);
+ QWeakPointer<QObject> rootObjectTracker(rootObject);
+ QVERIFY(!rootObjectTracker.isNull());
+ QWeakPointer<QObject> childObjectTracker(childObject);
+ QVERIFY(!childObjectTracker.isNull());
+ gc(engine);
+ QCOMPARE(rootObject->property("rectCanary").toInt(), 5);
+ QCOMPARE(childObject->property("textCanary").toInt(), 10);
+ QMetaObject::invokeMethod(object, "deassignCircular");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QVERIFY(rootObjectTracker.isNull()); // should have been collected
+ QVERIFY(childObjectTracker.isNull()); // should have been collected
+ delete object;
+}
+
+void tst_qqmlecmascript::propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter)
+{
+ *(int*)(parameter) += 1;
+ qPersistentDispose(object);
+}
+
+void tst_qqmlecmascript::propertyVarInheritance()
+{
+ int propertyVarWeakRefCallbackCount = 0;
+
+ // enforce behaviour regarding element inheritance - ensure handle disposal.
+ // The particular component under test here has a chain of references.
+ QQmlComponent component(&engine, testFileUrl("propertyVar.inherit.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ // we want to be able to track when the varProperties array of the last metaobject is disposed
+ QObject *cco5 = object->property("varProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>();
+ QObject *ico5 = object->property("varProperty").value<QObject*>()->property("inheritanceVarProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>();
+ QQmlVMEMetaObject *icovmemo = QQmlVMEMetaObject::get(ico5);
+ QQmlVMEMetaObject *ccovmemo = QQmlVMEMetaObject::get(cco5);
+ v8::Persistent<v8::Value> icoCanaryHandle;
+ v8::Persistent<v8::Value> ccoCanaryHandle;
+ {
+ v8::HandleScope hs;
+ // XXX NOTE: this is very implementation dependent. QDVMEMO->vmeProperty() is the only
+ // public function which can return us a handle to something in the varProperties array.
+ icoCanaryHandle = qPersistentNew(icovmemo->vmeProperty(ico5->metaObject()->indexOfProperty("circ")));
+ ccoCanaryHandle = qPersistentNew(ccovmemo->vmeProperty(cco5->metaObject()->indexOfProperty("circ")));
+ // we make them weak and invoke the gc, but we should not hit the weak-callback yet
+ // as the varproperties array of each vmemo still references the resource.
+ icoCanaryHandle.MakeWeak(&propertyVarWeakRefCallbackCount, propertyVarWeakRefCallback);
+ ccoCanaryHandle.MakeWeak(&propertyVarWeakRefCallbackCount, propertyVarWeakRefCallback);
+ gc(engine);
+ QVERIFY(propertyVarWeakRefCallbackCount == 0);
+ }
+ // now we deassign the var prop, which should trigger collection of item subtrees.
+ QMetaObject::invokeMethod(object, "deassignCircular"); // cause deassignment and gc
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ // ensure that there are only weak handles to the underlying varProperties array remaining.
+ gc(engine);
+ QCOMPARE(propertyVarWeakRefCallbackCount, 2); // should have been called for both, since all refs should be weak.
+ delete object;
+ // since there are no parent vmemo's to keep implicit references alive, and the only handles
+ // to what remains are weak, all varProperties arrays must have been collected.
+}
+
+void tst_qqmlecmascript::propertyVarInheritance2()
+{
+ int propertyVarWeakRefCallbackCount = 0;
+
+ // The particular component under test here does NOT have a chain of references; the
+ // only link between rootObject and childObject is that rootObject is the parent of childObject.
+ QQmlComponent component(&engine, testFileUrl("propertyVar.circular.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "assignCircular");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QObject *rootObject = object->property("vp").value<QObject*>();
+ QVERIFY(rootObject != 0);
+ QObject *childObject = rootObject->findChild<QObject*>("text");
+ QVERIFY(childObject != 0);
+ QCOMPARE(rootObject->property("rectCanary").toInt(), 5);
+ QCOMPARE(childObject->property("textCanary").toInt(), 10);
+ v8::Persistent<v8::Value> childObjectVarArrayValueHandle;
+ {
+ v8::HandleScope hs;
+ propertyVarWeakRefCallbackCount = 0; // reset callback count.
+ childObjectVarArrayValueHandle = qPersistentNew(QQmlVMEMetaObject::get(childObject)->vmeProperty(childObject->metaObject()->indexOfProperty("vp")));
+ childObjectVarArrayValueHandle.MakeWeak(&propertyVarWeakRefCallbackCount, propertyVarWeakRefCallback);
+ gc(engine);
+ QVERIFY(propertyVarWeakRefCallbackCount == 0); // should not have been collected yet.
+ QCOMPARE(childObject->property("vp").value<QObject*>(), rootObject);
+ QCOMPARE(childObject->property("textCanary").toInt(), 10);
+ }
+ QMetaObject::invokeMethod(object, "deassignCircular");
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper.
+ QCoreApplication::processEvents();
+ QVERIFY(propertyVarWeakRefCallbackCount == 1); // should have been collected now.
+ delete object;
+}
+
+// Ensure that QObject type conversion works on binding assignment
+void tst_qqmlecmascript::elementAssign()
+{
+ QQmlComponent component(&engine, testFileUrl("elementAssign.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// QTBUG-12457
+void tst_qqmlecmascript::objectPassThroughSignals()
+{
+ QQmlComponent component(&engine, testFileUrl("objectsPassThroughSignals.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// QTBUG-21626
+void tst_qqmlecmascript::objectConversion()
+{
+ QQmlComponent component(&engine, testFileUrl("objectConversion.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVariant retn;
+ QMetaObject::invokeMethod(object, "circularObject", Q_RETURN_ARG(QVariant, retn));
+ QCOMPARE(retn.value<QVariantMap>().value("test"), QVariant(100));
+
+ delete object;
+}
+
+
+// QTBUG-20242
+void tst_qqmlecmascript::booleanConversion()
+{
+ QQmlComponent component(&engine, testFileUrl("booleanConversion.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test_true1").toBool(), true);
+ QCOMPARE(object->property("test_true2").toBool(), true);
+ QCOMPARE(object->property("test_true3").toBool(), true);
+ QCOMPARE(object->property("test_true4").toBool(), true);
+ QCOMPARE(object->property("test_true5").toBool(), true);
+
+ QCOMPARE(object->property("test_false1").toBool(), false);
+ QCOMPARE(object->property("test_false2").toBool(), false);
+ QCOMPARE(object->property("test_false3").toBool(), false);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::handleReferenceManagement()
+{
+
+ int dtorCount = 0;
+ {
+ // Linear QObject reference
+ QQmlEngine hrmEngine;
+ QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro");
+ cro->setEngine(&hrmEngine);
+ cro->setDtorCount(&dtorCount);
+ QMetaObject::invokeMethod(object, "createReference");
+ gc(engine);
+ QCOMPARE(dtorCount, 0); // second has JS ownership, kept alive by first's reference
+ delete object;
+ hrmEngine.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 3);
+ }
+
+ dtorCount = 0;
+ {
+ // Circular QObject reference
+ QQmlEngine hrmEngine;
+ QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro");
+ cro->setEngine(&hrmEngine);
+ cro->setDtorCount(&dtorCount);
+ QMetaObject::invokeMethod(object, "circularReference");
+ gc(engine);
+ QCOMPARE(dtorCount, 2); // both should be cleaned up, since circular references shouldn't keep alive.
+ delete object;
+ hrmEngine.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 3);
+ }
+
+ dtorCount = 0;
+ {
+ // Linear handle reference
+ QQmlEngine hrmEngine;
+ QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ CircularReferenceHandle *crh = object->findChild<CircularReferenceHandle*>("crh");
+ QVERIFY(crh != 0);
+ crh->setEngine(&hrmEngine);
+ crh->setDtorCount(&dtorCount);
+ QMetaObject::invokeMethod(object, "createReference");
+ CircularReferenceHandle *first = object->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second = object->property("second").value<CircularReferenceHandle*>();
+ QVERIFY(first != 0);
+ QVERIFY(second != 0);
+ first->addReference(QQmlData::get(second)->v8object); // create reference
+ // now we have to reparent second and make second owned by JS.
+ second->setParent(0);
+ QQmlEngine::setObjectOwnership(second, QQmlEngine::JavaScriptOwnership);
+ gc(engine);
+ QCOMPARE(dtorCount, 0); // due to reference from first to second, second shouldn't be collected.
+ delete object;
+ hrmEngine.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 3);
+ }
+
+ dtorCount = 0;
+ {
+ // Circular handle reference
+ QQmlEngine hrmEngine;
+ QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.handle.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ CircularReferenceHandle *crh = object->findChild<CircularReferenceHandle*>("crh");
+ QVERIFY(crh != 0);
+ crh->setEngine(&hrmEngine);
+ crh->setDtorCount(&dtorCount);
+ QMetaObject::invokeMethod(object, "circularReference");
+ CircularReferenceHandle *first = object->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second = object->property("second").value<CircularReferenceHandle*>();
+ QVERIFY(first != 0);
+ QVERIFY(second != 0);
+ first->addReference(QQmlData::get(second)->v8object); // create circular reference
+ second->addReference(QQmlData::get(first)->v8object); // note: must be weak.
+ // now we have to reparent and change ownership, and unset the property references.
+ first->setParent(0);
+ second->setParent(0);
+ QQmlEngine::setObjectOwnership(first, QQmlEngine::JavaScriptOwnership);
+ QQmlEngine::setObjectOwnership(second, QQmlEngine::JavaScriptOwnership);
+ object->setProperty("first", QVariant::fromValue<QObject*>(0));
+ object->setProperty("second", QVariant::fromValue<QObject*>(0));
+ gc(engine);
+ QCOMPARE(dtorCount, 2); // despite circular references, both will be collected.
+ delete object;
+ hrmEngine.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 3);
+ }
+
+ dtorCount = 0;
+ {
+ // multiple engine interaction - linear reference
+ QQmlEngine hrmEngine1;
+ QQmlEngine hrmEngine2;
+ QQmlComponent component1(&hrmEngine1, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QQmlComponent component2(&hrmEngine2, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QObject *object1 = component1.create();
+ QObject *object2 = component2.create();
+ QVERIFY(object1 != 0);
+ QVERIFY(object2 != 0);
+ CircularReferenceHandle *crh1 = object1->findChild<CircularReferenceHandle*>("crh");
+ CircularReferenceHandle *crh2 = object2->findChild<CircularReferenceHandle*>("crh");
+ QVERIFY(crh1 != 0);
+ QVERIFY(crh2 != 0);
+ crh1->setEngine(&hrmEngine1);
+ crh2->setEngine(&hrmEngine2);
+ crh1->setDtorCount(&dtorCount);
+ crh2->setDtorCount(&dtorCount);
+ QMetaObject::invokeMethod(object1, "createReference");
+ QMetaObject::invokeMethod(object2, "createReference");
+ CircularReferenceHandle *first1 = object1->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second1 = object1->property("second").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *first2 = object2->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second2 = object2->property("second").value<CircularReferenceHandle*>();
+ QVERIFY(first1 != 0);
+ QVERIFY(second1 != 0);
+ QVERIFY(first2 != 0);
+ QVERIFY(second2 != 0);
+ first1->addReference(QQmlData::get(second2)->v8object); // create reference across engines
+ // now we have to reparent second2 and make second2 owned by JS.
+ second2->setParent(0);
+ QQmlEngine::setObjectOwnership(second2, QQmlEngine::JavaScriptOwnership);
+ gc(engine);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 0); // due to reference from first1 to second2, second2 shouldn't be collected.
+ delete object1;
+ delete object2;
+ hrmEngine1.collectGarbage();
+ hrmEngine2.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 6);
+ }
+
+ dtorCount = 0;
+ {
+ // multiple engine interaction - circular reference
+ QQmlEngine hrmEngine1;
+ QQmlEngine hrmEngine2;
+ QQmlComponent component1(&hrmEngine1, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QQmlComponent component2(&hrmEngine2, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QObject *object1 = component1.create();
+ QObject *object2 = component2.create();
+ QVERIFY(object1 != 0);
+ QVERIFY(object2 != 0);
+ CircularReferenceHandle *crh1 = object1->findChild<CircularReferenceHandle*>("crh");
+ CircularReferenceHandle *crh2 = object2->findChild<CircularReferenceHandle*>("crh");
+ QVERIFY(crh1 != 0);
+ QVERIFY(crh2 != 0);
+ crh1->setEngine(&hrmEngine1);
+ crh2->setEngine(&hrmEngine2);
+ crh1->setDtorCount(&dtorCount);
+ crh2->setDtorCount(&dtorCount);
+ QMetaObject::invokeMethod(object1, "createReference");
+ QMetaObject::invokeMethod(object2, "createReference");
+ CircularReferenceHandle *first1 = object1->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second1 = object1->property("second").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *first2 = object2->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second2 = object2->property("second").value<CircularReferenceHandle*>();
+ QVERIFY(first1 != 0);
+ QVERIFY(second1 != 0);
+ QVERIFY(first2 != 0);
+ QVERIFY(second2 != 0);
+ first1->addReference(QQmlData::get(second1)->v8object); // create linear reference within engine1
+ second1->addReference(QQmlData::get(second2)->v8object); // create linear reference across engines
+ second2->addReference(QQmlData::get(first2)->v8object); // create linear reference within engine2
+ first2->addReference(QQmlData::get(first1)->v8object); // close the loop - circular ref across engines
+ // now we have to reparent and change ownership to JS, and remove property references.
+ first1->setParent(0);
+ second1->setParent(0);
+ first2->setParent(0);
+ second2->setParent(0);
+ QQmlEngine::setObjectOwnership(first1, QQmlEngine::JavaScriptOwnership);
+ QQmlEngine::setObjectOwnership(second1, QQmlEngine::JavaScriptOwnership);
+ QQmlEngine::setObjectOwnership(first2, QQmlEngine::JavaScriptOwnership);
+ QQmlEngine::setObjectOwnership(second2, QQmlEngine::JavaScriptOwnership);
+ object1->setProperty("first", QVariant::fromValue<QObject*>(0));
+ object1->setProperty("second", QVariant::fromValue<QObject*>(0));
+ object2->setProperty("first", QVariant::fromValue<QObject*>(0));
+ object2->setProperty("second", QVariant::fromValue<QObject*>(0));
+ gc(engine);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 4); // circular references shouldn't keep them alive.
+ delete object1;
+ delete object2;
+ hrmEngine1.collectGarbage();
+ hrmEngine2.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 6);
+ }
+
+ dtorCount = 0;
+ {
+ // multiple engine interaction - linear reference with engine deletion
+ QQmlEngine *hrmEngine1 = new QQmlEngine;
+ QQmlEngine *hrmEngine2 = new QQmlEngine;
+ QQmlComponent component1(hrmEngine1, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QQmlComponent component2(hrmEngine2, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QObject *object1 = component1.create();
+ QObject *object2 = component2.create();
+ QVERIFY(object1 != 0);
+ QVERIFY(object2 != 0);
+ CircularReferenceHandle *crh1 = object1->findChild<CircularReferenceHandle*>("crh");
+ CircularReferenceHandle *crh2 = object2->findChild<CircularReferenceHandle*>("crh");
+ QVERIFY(crh1 != 0);
+ QVERIFY(crh2 != 0);
+ crh1->setEngine(hrmEngine1);
+ crh2->setEngine(hrmEngine2);
+ crh1->setDtorCount(&dtorCount);
+ crh2->setDtorCount(&dtorCount);
+ QMetaObject::invokeMethod(object1, "createReference");
+ QMetaObject::invokeMethod(object2, "createReference");
+ CircularReferenceHandle *first1 = object1->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second1 = object1->property("second").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *first2 = object2->property("first").value<CircularReferenceHandle*>();
+ CircularReferenceHandle *second2 = object2->property("second").value<CircularReferenceHandle*>();
+ QVERIFY(first1 != 0);
+ QVERIFY(second1 != 0);
+ QVERIFY(first2 != 0);
+ QVERIFY(second2 != 0);
+ first1->addReference(QQmlData::get(second1)->v8object); // create linear reference within engine1
+ second1->addReference(QQmlData::get(second2)->v8object); // create linear reference across engines
+ second2->addReference(QQmlData::get(first2)->v8object); // create linear reference within engine2
+ // now we have to reparent and change ownership to JS.
+ first1->setParent(crh1);
+ second1->setParent(0);
+ first2->setParent(0);
+ second2->setParent(0);
+ QQmlEngine::setObjectOwnership(second1, QQmlEngine::JavaScriptOwnership);
+ QQmlEngine::setObjectOwnership(first2, QQmlEngine::JavaScriptOwnership);
+ QQmlEngine::setObjectOwnership(second2, QQmlEngine::JavaScriptOwnership);
+ gc(*hrmEngine1);
+ gc(*hrmEngine2);
+ QCOMPARE(dtorCount, 0);
+ delete hrmEngine2; // should trigger deletion of objects with JS ownership tracked by this engine
+ gc(*hrmEngine1);
+ QCOMPARE(dtorCount, 2); // first2 and second2 should have been deleted.
+ delete object1;
+ delete object2;
+ gc(*hrmEngine1);
+ QCOMPARE(dtorCount, 6); // deleting object1 and object2 should trigger deletion of first1 and first2.
+ delete hrmEngine1;
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QCOMPARE(dtorCount, 6); // all objects should have been cleaned up prior to deleting hrmEngine1.
+ }
+
+ {
+ // Dynamic variant property reference keeps target alive
+ QQmlEngine hrmEngine;
+ QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "createReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "ensureReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "removeReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "ensureDeletion");
+ QCOMPARE(object->property("success").toBool(), true);
+ delete object;
+ }
+
+ {
+ // Dynamic Item property reference keeps target alive
+ QQmlEngine hrmEngine;
+ QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "createReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "ensureReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "removeReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "ensureDeletion");
+ QCOMPARE(object->property("success").toBool(), true);
+ delete object;
+ }
+
+ {
+ // Item property reference to deleted item doesn't crash
+ QQmlEngine hrmEngine;
+ QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "createReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "ensureReference");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "manuallyDelete");
+ gc(engine);
+ QMetaObject::invokeMethod(object, "ensureDeleted");
+ QCOMPARE(object->property("success").toBool(), true);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::stringArg()
+{
+ QQmlComponent component(&engine, testFileUrl("stringArg.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "success");
+ QVERIFY(object->property("returnValue").toBool());
+
+ QString w1 = testFileUrl("stringArg.qml").toString() + QLatin1String(":45: Error: String.arg(): Invalid arguments");
+ QTest::ignoreMessage(QtWarningMsg, w1.toLatin1().constData());
+ QMetaObject::invokeMethod(object, "failure");
+ QVERIFY(object->property("returnValue").toBool());
+
+ delete object;
+}
+
+void tst_qqmlecmascript::readonlyDeclaration()
+{
+ QQmlComponent component(&engine, testFileUrl("readonlyDeclaration.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+Q_DECLARE_METATYPE(QList<int>)
+Q_DECLARE_METATYPE(QList<qreal>)
+Q_DECLARE_METATYPE(QList<bool>)
+Q_DECLARE_METATYPE(QList<QString>)
+Q_DECLARE_METATYPE(QList<QUrl>)
+void tst_qqmlecmascript::sequenceConversionRead()
+{
+ {
+ QUrl qmlFile = testFileUrl("sequenceConversion.read.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco");
+ QVERIFY(seq != 0);
+
+ QMetaObject::invokeMethod(object, "readSequences");
+ QList<int> intList; intList << 1 << 2 << 3 << 4;
+ QCOMPARE(object->property("intListLength").toInt(), intList.length());
+ QCOMPARE(object->property("intList").value<QList<int> >(), intList);
+ QList<qreal> qrealList; qrealList << 1.1 << 2.2 << 3.3 << 4.4;
+ QCOMPARE(object->property("qrealListLength").toInt(), qrealList.length());
+ QCOMPARE(object->property("qrealList").value<QList<qreal> >(), qrealList);
+ QList<bool> boolList; boolList << true << false << true << false;
+ QCOMPARE(object->property("boolListLength").toInt(), boolList.length());
+ QCOMPARE(object->property("boolList").value<QList<bool> >(), boolList);
+ QList<QString> stringList; stringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth");
+ QCOMPARE(object->property("stringListLength").toInt(), stringList.length());
+ QCOMPARE(object->property("stringList").value<QList<QString> >(), stringList);
+ QList<QUrl> urlList; urlList << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com");
+ QCOMPARE(object->property("urlListLength").toInt(), urlList.length());
+ QCOMPARE(object->property("urlList").value<QList<QUrl> >(), urlList);
+ QStringList qstringList; qstringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth");
+ QCOMPARE(object->property("qstringListLength").toInt(), qstringList.length());
+ QCOMPARE(object->property("qstringList").value<QStringList>(), qstringList);
+
+ QMetaObject::invokeMethod(object, "readSequenceElements");
+ QCOMPARE(object->property("intVal").toInt(), 2);
+ QCOMPARE(object->property("qrealVal").toReal(), 2.2);
+ QCOMPARE(object->property("boolVal").toBool(), false);
+ QCOMPARE(object->property("stringVal").toString(), QString(QLatin1String("second")));
+ QCOMPARE(object->property("urlVal").toUrl(), QUrl("http://www.example2.com"));
+ QCOMPARE(object->property("qstringVal").toString(), QString(QLatin1String("second")));
+
+ QMetaObject::invokeMethod(object, "enumerateSequenceElements");
+ QCOMPARE(object->property("enumerationMatches").toBool(), true);
+
+ intList.clear(); intList << 1 << 2 << 3 << 4 << 5; // set by the enumerateSequenceElements test.
+ QQmlProperty seqProp(seq, "intListProperty");
+ QCOMPARE(seqProp.read().value<QList<int> >(), intList);
+ QQmlProperty seqProp2(seq, "intListProperty", &engine);
+ QCOMPARE(seqProp2.read().value<QList<int> >(), intList);
+
+ QMetaObject::invokeMethod(object, "testReferenceDeletion");
+ QCOMPARE(object->property("referenceDeletion").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QUrl qmlFile = testFileUrl("sequenceConversion.read.error.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco");
+ QVERIFY(seq != 0);
+
+ // we haven't registered QList<NonRegisteredType> as a sequence type.
+ QString warningOne = QLatin1String("QMetaProperty::read: Unable to handle unregistered datatype 'QList<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'");
+ QString warningTwo = qmlFile.toString() + QLatin1String(":18: TypeError: Cannot read property 'length' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, warningOne.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warningTwo.toLatin1().constData());
+
+ QMetaObject::invokeMethod(object, "performTest");
+
+ // QList<NonRegisteredType> has not been registered as a sequence type.
+ QCOMPARE(object->property("pointListLength").toInt(), 0);
+ QVERIFY(!object->property("pointList").isValid());
+ QTest::ignoreMessage(QtWarningMsg, "QMetaProperty::read: Unable to handle unregistered datatype 'QList<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'");
+ QQmlProperty seqProp(seq, "typeListProperty", &engine);
+ QVERIFY(!seqProp.read().isValid()); // not a valid/known sequence type
+
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::sequenceConversionWrite()
+{
+ {
+ QUrl qmlFile = testFileUrl("sequenceConversion.write.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco");
+ QVERIFY(seq != 0);
+
+ QMetaObject::invokeMethod(object, "writeSequences");
+ QCOMPARE(object->property("success").toBool(), true);
+
+ QMetaObject::invokeMethod(object, "writeSequenceElements");
+ QCOMPARE(object->property("success").toBool(), true);
+
+ QMetaObject::invokeMethod(object, "writeOtherElements");
+ QCOMPARE(object->property("success").toBool(), true);
+
+ QMetaObject::invokeMethod(object, "testReferenceDeletion");
+ QCOMPARE(object->property("referenceDeletion").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QUrl qmlFile = testFileUrl("sequenceConversion.write.error.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco");
+ QVERIFY(seq != 0);
+
+ // we haven't registered QList<QPoint> as a sequence type, so writing shouldn't work.
+ QString warningOne = qmlFile.toString() + QLatin1String(":16: Error: Cannot assign QVariantList to an unregistered type");
+ QTest::ignoreMessage(QtWarningMsg, warningOne.toLatin1().constData());
+
+ QMetaObject::invokeMethod(object, "performTest");
+
+ QList<QPoint> pointList; pointList << QPoint(1, 2) << QPoint(3, 4) << QPoint(5, 6); // original values, shouldn't have changed
+ QCOMPARE(seq->pointListProperty(), pointList);
+
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::sequenceConversionArray()
+{
+ // ensure that in JS the returned sequences act just like normal JS Arrays.
+ QUrl qmlFile = testFileUrl("sequenceConversion.array.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "indexedAccess");
+ QVERIFY(object->property("success").toBool());
+ QMetaObject::invokeMethod(object, "arrayOperations");
+ QVERIFY(object->property("success").toBool());
+ QMetaObject::invokeMethod(object, "testEqualitySemantics");
+ QVERIFY(object->property("success").toBool());
+ QMetaObject::invokeMethod(object, "testReferenceDeletion");
+ QCOMPARE(object->property("referenceDeletion").toBool(), true);
+ delete object;
+}
+
+
+void tst_qqmlecmascript::sequenceConversionIndexes()
+{
+ // ensure that we gracefully fail if unsupported index values are specified.
+ // Qt container classes only support non-negative, signed integer index values.
+ QUrl qmlFile = testFileUrl("sequenceConversion.indexes.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QString w1 = qmlFile.toString() + QLatin1String(":34: Index out of range during length set");
+ QString w2 = qmlFile.toString() + QLatin1String(":41: Index out of range during indexed set");
+ QString w3 = qmlFile.toString() + QLatin1String(":48: Index out of range during indexed get");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w3));
+ QMetaObject::invokeMethod(object, "indexedAccess");
+ QVERIFY(object->property("success").toBool());
+ delete object;
+}
+
+void tst_qqmlecmascript::sequenceConversionThreads()
+{
+ // ensure that sequence conversion operations work correctly in a worker thread
+ // and that serialisation between the main and worker thread succeeds.
+ QUrl qmlFile = testFileUrl("sequenceConversion.threads.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, "testIntSequence");
+ QTRY_VERIFY(object->property("finished").toBool());
+ QVERIFY(object->property("success").toBool());
+
+ QMetaObject::invokeMethod(object, "testQrealSequence");
+ QTRY_VERIFY(object->property("finished").toBool());
+ QVERIFY(object->property("success").toBool());
+
+ QMetaObject::invokeMethod(object, "testBoolSequence");
+ QTRY_VERIFY(object->property("finished").toBool());
+ QVERIFY(object->property("success").toBool());
+
+ QMetaObject::invokeMethod(object, "testStringSequence");
+ QTRY_VERIFY(object->property("finished").toBool());
+ QVERIFY(object->property("success").toBool());
+
+ QMetaObject::invokeMethod(object, "testQStringSequence");
+ QTRY_VERIFY(object->property("finished").toBool());
+ QVERIFY(object->property("success").toBool());
+
+ QMetaObject::invokeMethod(object, "testUrlSequence");
+ QTRY_VERIFY(object->property("finished").toBool());
+ QVERIFY(object->property("success").toBool());
+
+ QMetaObject::invokeMethod(object, "testVariantSequence");
+ QTRY_VERIFY(object->property("finished").toBool());
+ QVERIFY(object->property("success").toBool());
+
+ delete object;
+}
+
+void tst_qqmlecmascript::sequenceConversionBindings()
+{
+ {
+ QUrl qmlFile = testFileUrl("sequenceConversion.bindings.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QList<int> intList; intList << 1 << 2 << 3 << 12 << 7;
+ QCOMPARE(object->property("boundSequence").value<QList<int> >(), intList);
+ QCOMPARE(object->property("boundElement").toInt(), intList.at(3));
+ QList<int> intListTwo; intListTwo << 1 << 2 << 3 << 12 << 14;
+ QCOMPARE(object->property("boundSequenceTwo").value<QList<int> >(), intListTwo);
+ delete object;
+ }
+
+ {
+ QUrl qmlFile = testFileUrl("sequenceConversion.bindings.error.qml");
+ QString warning = QString(QLatin1String("%1:17: Unable to assign QList<int> to QList<bool>")).arg(qmlFile.toString());
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::sequenceConversionCopy()
+{
+ QUrl qmlFile = testFileUrl("sequenceConversion.copy.qml");
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QMetaObject::invokeMethod(object, "testCopySequences");
+ QCOMPARE(object->property("success").toBool(), true);
+ QMetaObject::invokeMethod(object, "readSequenceCopyElements");
+ QCOMPARE(object->property("success").toBool(), true);
+ QMetaObject::invokeMethod(object, "testEqualitySemantics");
+ QCOMPARE(object->property("success").toBool(), true);
+ QMetaObject::invokeMethod(object, "testCopyParameters");
+ QCOMPARE(object->property("success").toBool(), true);
+ QMetaObject::invokeMethod(object, "testReferenceParameters");
+ QCOMPARE(object->property("success").toBool(), true);
+ delete object;
+}
+
+void tst_qqmlecmascript::assignSequenceTypes()
+{
+ // test binding array to sequence type property
+ {
+ QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.1.qml"));
+ MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2));
+ QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1 << 2.2));
+ QCOMPARE(object->boolListProperty(), (QList<bool>() << false << true));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl("http://www.example1.com") << QUrl("http://www.example2.com")));
+ QCOMPARE(object->stringListProperty(), (QList<QString>() << QLatin1String("one") << QLatin1String("two")));
+ QCOMPARE(object->qstringListProperty(), (QStringList() << QLatin1String("one") << QLatin1String("two")));
+ delete object;
+ }
+
+ // test binding literal to sequence type property
+ {
+ QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.2.qml"));
+ MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->intListProperty(), (QList<int>() << 1));
+ QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1));
+ QCOMPARE(object->boolListProperty(), (QList<bool>() << false));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl("http://www.example1.com")));
+ QCOMPARE(object->stringListProperty(), (QList<QString>() << QLatin1String("one")));
+ QCOMPARE(object->qstringListProperty(), (QStringList() << QLatin1String("two")));
+ delete object;
+ }
+
+ // test binding single value to sequence type property
+ {
+ QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.3.qml"));
+ MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->intListProperty(), (QList<int>() << 1));
+ QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1));
+ QCOMPARE(object->boolListProperty(), (QList<bool>() << false));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
+ delete object;
+ }
+
+ // test assigning array to sequence type property in js function
+ {
+ QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.4.qml"));
+ MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2));
+ QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1 << 2.2));
+ QCOMPARE(object->boolListProperty(), (QList<bool>() << false << true));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl("http://www.example1.com") << QUrl("http://www.example2.com")));
+ QCOMPARE(object->stringListProperty(), (QList<QString>() << QLatin1String("one") << QLatin1String("two")));
+ QCOMPARE(object->qstringListProperty(), (QStringList() << QLatin1String("one") << QLatin1String("two")));
+ delete object;
+ }
+
+ // test assigning literal to sequence type property in js function
+ {
+ QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.5.qml"));
+ MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->intListProperty(), (QList<int>() << 1));
+ QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1));
+ QCOMPARE(object->boolListProperty(), (QList<bool>() << false));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl("http://www.example1.com")));
+ QCOMPARE(object->stringListProperty(), (QList<QString>() << QLatin1String("one")));
+ QCOMPARE(object->qstringListProperty(), (QStringList() << QLatin1String("two")));
+ delete object;
+ }
+
+ // test assigning single value to sequence type property in js function
+ {
+ QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.6.qml"));
+ MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->intListProperty(), (QList<int>() << 1));
+ QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1));
+ QCOMPARE(object->boolListProperty(), (QList<bool>() << false));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
+ delete object;
+ }
+
+ // test QList<QUrl> literal assignment and binding assignment causes url resolution when required
+ {
+ QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.7.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1"));
+ MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2"));
+ MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3"));
+ MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4"));
+ MySequenceConversionObject *msco5 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco5"));
+ QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0 && msco5 != 0);
+ QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
+ QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
+ QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html"))));
+ QCOMPARE(msco4->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html"))));
+ QCOMPARE(msco5->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html"))));
+ delete object;
+ }
+}
+
+// Test that assigning a null object works
+// Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4
+void tst_qqmlecmascript::nullObjectBinding()
+{
+ QQmlComponent component(&engine, testFileUrl("nullObjectBinding.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(object->property("test") == QVariant::fromValue((QObject *)0));
+
+ delete object;
+}
+
+// Test that bindings don't evaluate once the engine has been destroyed
+void tst_qqmlecmascript::deletedEngine()
+{
+ QQmlEngine *engine = new QQmlEngine;
+ QQmlComponent component(engine, testFileUrl("deletedEngine.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("a").toInt(), 39);
+ object->setProperty("b", QVariant(9));
+ QCOMPARE(object->property("a").toInt(), 117);
+
+ delete engine;
+
+ QCOMPARE(object->property("a").toInt(), 117);
+ object->setProperty("b", QVariant(10));
+ QCOMPARE(object->property("a").toInt(), 117);
+
+ delete object;
+}
+
+// Test the crashing part of QTBUG-9705
+void tst_qqmlecmascript::libraryScriptAssert()
+{
+ QQmlComponent component(&engine, testFileUrl("libraryScriptAssert.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::variantsAssignedUndefined()
+{
+ QQmlComponent component(&engine, testFileUrl("variantsAssignedUndefined.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toInt(), 10);
+ QCOMPARE(object->property("test2").toInt(), 11);
+
+ object->setProperty("runTest", true);
+
+ QCOMPARE(object->property("test1"), QVariant());
+ QCOMPARE(object->property("test2"), QVariant());
+
+
+ delete object;
+}
+
+void tst_qqmlecmascript::qtbug_9792()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_9792.qml"));
+
+ QQmlContext *context = new QQmlContext(engine.rootContext());
+
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create(context));
+ QVERIFY(object != 0);
+
+ QTest::ignoreMessage(QtDebugMsg, "Hello world!");
+ object->basicSignal();
+
+ delete context;
+
+ QQmlTestMessageHandler messageHandler;
+
+ object->basicSignal();
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+
+ delete object;
+}
+
+// Verifies that QQmlGuard<>s used in the vmemetaobject are cleaned correctly
+void tst_qqmlecmascript::qtcreatorbug_1289()
+{
+ QQmlComponent component(&engine, testFileUrl("qtcreatorbug_1289.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QObject *nested = qvariant_cast<QObject *>(o->property("object"));
+ QVERIFY(nested != 0);
+
+ QVERIFY(qvariant_cast<QObject *>(nested->property("nestedObject")) == o);
+
+ delete nested;
+ nested = qvariant_cast<QObject *>(o->property("object"));
+ QVERIFY(nested == 0);
+
+ // If the bug is present, the next line will crash
+ delete o;
+}
+
+// Test that we shut down without stupid warnings
+void tst_qqmlecmascript::noSpuriousWarningsAtShutdown()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("noSpuriousWarningsAtShutdown.qml"));
+
+ QObject *o = component.create();
+
+ QQmlTestMessageHandler messageHandler;
+
+ delete o;
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ }
+
+
+ {
+ QQmlComponent component(&engine, testFileUrl("noSpuriousWarningsAtShutdown.2.qml"));
+
+ QObject *o = component.create();
+
+ QQmlTestMessageHandler messageHandler;
+
+ delete o;
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ }
+}
+
+void tst_qqmlecmascript::canAssignNullToQObject()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("canAssignNullToQObject.1.qml"));
+
+ MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(o != 0);
+
+ QVERIFY(o->objectProperty() != 0);
+
+ o->setProperty("runTest", true);
+
+ QVERIFY(o->objectProperty() == 0);
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("canAssignNullToQObject.2.qml"));
+
+ MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(o != 0);
+
+ QVERIFY(o->objectProperty() == 0);
+
+ delete o;
+ }
+}
+
+void tst_qqmlecmascript::functionAssignment_fromBinding()
+{
+ QQmlComponent component(&engine, testFileUrl("functionAssignment.1.qml"));
+
+ QString url = component.url().toString();
+ QString w1 = url + ":4:25: Unable to assign a function to a property of any type other than var.";
+ QString w2 = url + ":5:25: Invalid use of Qt.binding() in a binding declaration.";
+ QString w3 = url + ":6:21: Invalid use of Qt.binding() in a binding declaration.";
+ QString w4 = url + ":7:15: Invalid use of Qt.binding() in a binding declaration.";
+ QTest::ignoreMessage(QtWarningMsg, w1.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, w2.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, w3.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, w4.toLatin1().constData());
+
+ MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(o != 0);
+
+ QVERIFY(!o->property("a").isValid());
+
+ delete o;
+}
+
+void tst_qqmlecmascript::functionAssignment_fromJS()
+{
+ QFETCH(QString, triggerProperty);
+
+ QQmlComponent component(&engine, testFileUrl("functionAssignment.2.qml"));
+ QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
+
+ MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(o != 0);
+ QVERIFY(!o->property("a").isValid());
+
+ o->setProperty("aNumber", QVariant(5));
+ o->setProperty(triggerProperty.toUtf8().constData(), true);
+ QCOMPARE(o->property("a"), QVariant(50));
+
+ o->setProperty("aNumber", QVariant(10));
+ QCOMPARE(o->property("a"), QVariant(100));
+
+ delete o;
+}
+
+void tst_qqmlecmascript::functionAssignment_fromJS_data()
+{
+ QTest::addColumn<QString>("triggerProperty");
+
+ QTest::newRow("assign to property") << "assignToProperty";
+ QTest::newRow("assign to property, from JS file") << "assignToPropertyFromJsFile";
+
+ QTest::newRow("assign to value type") << "assignToValueType";
+
+ QTest::newRow("use 'this'") << "assignWithThis";
+ QTest::newRow("use 'this' from JS file") << "assignWithThisFromJsFile";
+}
+
+void tst_qqmlecmascript::functionAssignmentfromJS_invalid()
+{
+ QQmlComponent component(&engine, testFileUrl("functionAssignment.2.qml"));
+ QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
+
+ MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(o != 0);
+ QVERIFY(!o->property("a").isValid());
+
+ o->setProperty("assignFuncWithoutReturn", true);
+ QVERIFY(!o->property("a").isValid());
+
+ QString url = component.url().toString();
+ QString warning = url + ":67:17: Unable to assign QString to int";
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ o->setProperty("assignWrongType", true);
+
+ warning = url + ":71:29: Unable to assign QString to int";
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+ o->setProperty("assignWrongTypeToValueType", true);
+
+ delete o;
+}
+
+void tst_qqmlecmascript::functionAssignment_afterBinding()
+{
+ QQmlComponent component(&engine, testFileUrl("functionAssignment.3.qml"));
+
+ QString url = component.url().toString();
+ QString w1 = url + ":16: Error: Cannot assign JavaScript function to int";
+ QTest::ignoreMessage(QtWarningMsg, w1.toLatin1().constData());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("t1"), QVariant::fromValue<int>(4)); // should have bound
+ QCOMPARE(o->property("t2"), QVariant::fromValue<int>(2)); // should not have changed
+
+ delete o;
+}
+
+void tst_qqmlecmascript::eval()
+{
+ QQmlComponent component(&engine, testFileUrl("eval.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+
+ delete o;
+}
+
+void tst_qqmlecmascript::function()
+{
+ QQmlComponent component(&engine, testFileUrl("function.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+
+ delete o;
+}
+
+void tst_qqmlecmascript::functionException()
+{
+ // QTBUG-24037 - shouldn't crash.
+ QString errstr = testFileUrl("v8functionException.qml").toString() + QLatin1String(":13: SyntaxError: Unexpected token ILLEGAL");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(errstr));
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Exception occurred during compilation of function: dynamicSlot()");
+ QQmlComponent component(&engine, testFileUrl("v8functionException.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QMetaObject::invokeMethod(o, "dynamicSlot");
+ delete o;
+}
+
+// Test the "Qt.include" method
+void tst_qqmlecmascript::include()
+{
+ // Non-library relative include
+ {
+ QQmlComponent component(&engine, testFileUrl("include.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test0").toInt(), 99);
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test2_1").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test3_1").toBool(), true);
+
+ delete o;
+ }
+
+ // Library relative include
+ {
+ QQmlComponent component(&engine, testFileUrl("include_shared.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test0").toInt(), 99);
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test2_1").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test3_1").toBool(), true);
+
+ delete o;
+ }
+
+ // Callback
+ {
+ QQmlComponent component(&engine, testFileUrl("include_callback.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toBool(), true);
+
+ delete o;
+ }
+
+ // Including file with ".pragma library"
+ {
+ QQmlComponent component(&engine, testFileUrl("include_pragma.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toInt(), 100);
+
+ delete o;
+ }
+
+ // Remote - success
+ {
+ TestHTTPServer server(8111);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine, testFileUrl("include_remote.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QTRY_VERIFY(o->property("done").toBool() == true);
+ QTRY_VERIFY(o->property("done2").toBool() == true);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+
+ QCOMPARE(o->property("test6").toBool(), true);
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toBool(), true);
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+
+ delete o;
+ }
+
+ // Remote - error
+ {
+ TestHTTPServer server(8111);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine, testFileUrl("include_remote_missing.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QTRY_VERIFY(o->property("done").toBool() == true);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+
+ delete o;
+ }
+}
+
+void tst_qqmlecmascript::signalHandlers()
+{
+ QQmlComponent component(&engine, testFileUrl("signalHandlers.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QVERIFY(o->property("count").toInt() == 0);
+ QMetaObject::invokeMethod(o, "testSignalCall");
+ QCOMPARE(o->property("count").toInt(), 1);
+
+ QMetaObject::invokeMethod(o, "testSignalHandlerCall");
+ QCOMPARE(o->property("count").toInt(), 1);
+ QCOMPARE(o->property("errorString").toString(), QLatin1String("TypeError: Property 'onTestSignal' of object [object Object] is not a function"));
+
+ QVERIFY(o->property("funcCount").toInt() == 0);
+ QMetaObject::invokeMethod(o, "testSignalConnection");
+ QCOMPARE(o->property("funcCount").toInt(), 1);
+
+ QMetaObject::invokeMethod(o, "testSignalHandlerConnection");
+ QCOMPARE(o->property("funcCount").toInt(), 2);
+
+ QMetaObject::invokeMethod(o, "testSignalDefined");
+ QCOMPARE(o->property("definedResult").toBool(), true);
+
+ QMetaObject::invokeMethod(o, "testSignalHandlerDefined");
+ QCOMPARE(o->property("definedHandlerResult").toBool(), true);
+
+ delete o;
+}
+
+void tst_qqmlecmascript::qtbug_10696()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_10696.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ delete o;
+}
+
+void tst_qqmlecmascript::qtbug_11606()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_11606.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+void tst_qqmlecmascript::qtbug_11600()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_11600.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+void tst_qqmlecmascript::qtbug_21864()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_21864.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+void tst_qqmlecmascript::rewriteMultiLineStrings()
+{
+ {
+ // QTBUG-23387
+ QQmlComponent component(&engine, testFileUrl("rewriteMultiLineStrings.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QTRY_COMPARE(o->property("test").toBool(), true);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("rewriteMultiLineStrings_crlf.1.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ delete o;
+ }
+}
+
+void tst_qqmlecmascript::qobjectConnectionListExceptionHandling()
+{
+ // QTBUG-23375
+ QQmlComponent component(&engine, testFileUrl("qobjectConnectionListExceptionHandling.qml"));
+ QString warning = component.url().toString() + QLatin1String(":13: TypeError: Cannot read property 'undefined' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+// Reading and writing non-scriptable properties should fail
+void tst_qqmlecmascript::nonscriptable()
+{
+ QQmlComponent component(&engine, testFileUrl("nonscriptable.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("readOk").toBool(), true);
+ QCOMPARE(o->property("writeOk").toBool(), true);
+ delete o;
+}
+
+// deleteLater() should not be callable from QML
+void tst_qqmlecmascript::deleteLater()
+{
+ QQmlComponent component(&engine, testFileUrl("deleteLater.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+// objectNameChanged() should be usable from QML
+void tst_qqmlecmascript::objectNameChangedSignal()
+{
+ QQmlComponent component(&engine, testFileUrl("objectNameChangedSignal.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), false);
+ o->setObjectName("obj");
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+// destroyed() should not be usable from QML
+void tst_qqmlecmascript::destroyedSignal()
+{
+ QQmlComponent component(&engine, testFileUrl("destroyedSignal.qml"));
+ QVERIFY(component.isError());
+
+ QString expectedErrorString = component.url().toString() + QLatin1String(":5:5: Cannot assign to non-existent property \"onDestroyed\"");
+ QCOMPARE(component.errors().at(0).toString(), expectedErrorString);
+}
+
+void tst_qqmlecmascript::in()
+{
+ QQmlComponent component(&engine, testFileUrl("in.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ delete o;
+}
+
+void tst_qqmlecmascript::typeOf()
+{
+ QQmlComponent component(&engine, testFileUrl("typeOf.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toString(), QLatin1String("undefined"));
+ QCOMPARE(o->property("test2").toString(), QLatin1String("object"));
+ QCOMPARE(o->property("test3").toString(), QLatin1String("number"));
+ QCOMPARE(o->property("test4").toString(), QLatin1String("string"));
+ QCOMPARE(o->property("test5").toString(), QLatin1String("function"));
+ QCOMPARE(o->property("test6").toString(), QLatin1String("object"));
+ QCOMPARE(o->property("test7").toString(), QLatin1String("undefined"));
+ QCOMPARE(o->property("test8").toString(), QLatin1String("boolean"));
+ QCOMPARE(o->property("test9").toString(), QLatin1String("object"));
+
+ delete o;
+}
+
+void tst_qqmlecmascript::qtbug_24448()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_24448.qml"));
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o != 0);
+ QVERIFY(o->property("test").toBool());
+}
+
+void tst_qqmlecmascript::sharedAttachedObject()
+{
+ QQmlComponent component(&engine, testFileUrl("sharedAttachedObject.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ delete o;
+}
+
+// QTBUG-13999
+void tst_qqmlecmascript::objectName()
+{
+ QQmlComponent component(&engine, testFileUrl("objectName.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toString(), QString("hello"));
+ QCOMPARE(o->property("test2").toString(), QString("ell"));
+
+ o->setObjectName("world");
+
+ QCOMPARE(o->property("test1").toString(), QString("world"));
+ QCOMPARE(o->property("test2").toString(), QString("orl"));
+
+ delete o;
+}
+
+void tst_qqmlecmascript::writeRemovesBinding()
+{
+ QQmlComponent component(&engine, testFileUrl("writeRemovesBinding.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+}
+
+// Test bindings assigned to alias properties actually assign to the alias' target
+void tst_qqmlecmascript::aliasBindingsAssignCorrectly()
+{
+ QQmlComponent component(&engine, testFileUrl("aliasBindingsAssignCorrectly.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+}
+
+// Test bindings assigned to alias properties override a binding on the target (QTBUG-13719)
+void tst_qqmlecmascript::aliasBindingsOverrideTarget()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.2.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.3.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+}
+
+// Test that writes to alias properties override bindings on the alias target (QTBUG-13719)
+void tst_qqmlecmascript::aliasWritesOverrideBindings()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.2.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.3.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+}
+
+// Allow an alais to a composite element
+// QTBUG-20200
+void tst_qqmlecmascript::aliasToCompositeElement()
+{
+ QQmlComponent component(&engine, testFileUrl("aliasToCompositeElement.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::qtbug_20344()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_20344.qml"));
+
+ QString warning = component.url().toString() + ":5: Error: Exception thrown from within QObject slot";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::revisionErrors()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevisionErrors.qml"));
+ QString url = component.url().toString();
+
+ QString warning1 = url + ":8: ReferenceError: prop2 is not defined";
+ QString warning2 = url + ":11: ReferenceError: prop2 is not defined";
+ QString warning3 = url + ":13: ReferenceError: method2 is not defined";
+
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
+ MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevisionErrors2.qml"));
+ QString url = component.url().toString();
+
+ // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0
+ // method2, prop2 from MyRevisionedClass not available
+ // method4, prop4 from MyRevisionedSubclass not available
+ QString warning1 = url + ":8: ReferenceError: prop2 is not defined";
+ QString warning2 = url + ":14: ReferenceError: prop2 is not defined";
+ QString warning3 = url + ":10: ReferenceError: prop4 is not defined";
+ QString warning4 = url + ":16: ReferenceError: prop4 is not defined";
+ QString warning5 = url + ":20: ReferenceError: method2 is not defined";
+
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData());
+ MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevisionErrors3.qml"));
+ QString url = component.url().toString();
+
+ // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
+ // All properties/methods available, except MyRevisionedBaseClassUnregistered rev 1
+ QString warning1 = url + ":30: ReferenceError: methodD is not defined";
+ QString warning2 = url + ":10: ReferenceError: propD is not defined";
+ QString warning3 = url + ":20: ReferenceError: propD is not defined";
+ QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData());
+ MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::revision()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevision.qml"));
+ QString url = component.url().toString();
+
+ MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevision2.qml"));
+ QString url = component.url().toString();
+
+ MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevision3.qml"));
+ QString url = component.url().toString();
+
+ MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
+ QVERIFY(object != 0);
+ delete object;
+ }
+ // Test that non-root classes can resolve revisioned methods
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevision4.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toReal(), 11.);
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::realToInt()
+{
+ QQmlComponent component(&engine, testFileUrl("realToInt.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, "test1");
+ QCOMPARE(object->value(), int(4));
+ QMetaObject::invokeMethod(object, "test2");
+ QCOMPARE(object->value(), int(8));
+}
+
+void tst_qqmlecmascript::urlProperty()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("urlProperty.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ object->setStringProperty("http://qt-project.org");
+ QCOMPARE(object->urlProperty(), QUrl("http://qt-project.org/index.html"));
+ QCOMPARE(object->intProperty(), 123);
+ QCOMPARE(object->value(), 1);
+ QCOMPARE(object->property("result").toBool(), true);
+ }
+}
+
+void tst_qqmlecmascript::urlPropertyWithEncoding()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("urlProperty.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ object->setStringProperty("http://qt-project.org");
+ QUrl encoded;
+ encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode);
+ QCOMPARE(object->urlProperty(), encoded);
+ QCOMPARE(object->value(), 0); // Interpreting URL as string yields canonicalised version
+ QCOMPARE(object->property("result").toBool(), true);
+ }
+}
+
+void tst_qqmlecmascript::urlListPropertyWithEncoding()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("urlListProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1"));
+ MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2"));
+ MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3"));
+ MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4"));
+ QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0);
+ QUrl encoded;
+ encoded.setEncodedUrl("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode);
+ QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << encoded));
+ QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << encoded));
+ QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << encoded << encoded));
+ QCOMPARE(msco4->urlListProperty(), (QList<QUrl>() << encoded << encoded));
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::dynamicString()
+{
+ QQmlComponent component(&engine, testFileUrl("dynamicString.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("stringProperty").toString(),
+ QString::fromLatin1("string:Hello World false:0 true:1 uint32:100 int32:-100 double:3.14159 date:2011-02-11 05::30:50!"));
+}
+
+void tst_qqmlecmascript::deleteLaterObjectMethodCall()
+{
+ QQmlComponent component(&engine, testFileUrl("deleteLaterObjectMethodCall.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qqmlecmascript::automaticSemicolon()
+{
+ QQmlComponent component(&engine, testFileUrl("automaticSemicolon.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qqmlecmascript::compatibilitySemicolon()
+{
+ QQmlComponent component(&engine, testFileUrl("compatibilitySemicolon.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qqmlecmascript::incrDecrSemicolon1()
+{
+ QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qqmlecmascript::incrDecrSemicolon2()
+{
+ QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qqmlecmascript::incrDecrSemicolon_error1()
+{
+ QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon_error1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object == 0);
+}
+
+void tst_qqmlecmascript::unaryExpression()
+{
+ QQmlComponent component(&engine, testFileUrl("unaryExpression.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+// Makes sure that a binding isn't double re-evaluated when it depends on the same variable twice
+void tst_qqmlecmascript::doubleEvaluate()
+{
+ QQmlComponent component(&engine, testFileUrl("doubleEvaluate.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ WriteCounter *wc = qobject_cast<WriteCounter *>(object);
+ QVERIFY(wc != 0);
+ QCOMPARE(wc->count(), 1);
+
+ wc->setProperty("x", 9);
+
+ QCOMPARE(wc->count(), 2);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::nonNotifyable()
+{
+ QV4Compiler::enableV4(false);
+ QQmlComponent component(&engine, testFileUrl("nonNotifyable.qml"));
+ QV4Compiler::enableV4(true);
+
+ QQmlTestMessageHandler messageHandler;
+
+ QObject *object = component.create();
+
+ QVERIFY(object != 0);
+
+ QString expected1 = QLatin1String("QQmlExpression: Expression ") +
+ component.url().toString() +
+ QLatin1String(":5 depends on non-NOTIFYable properties:");
+ QString expected2 = QLatin1String(" ") +
+ QLatin1String(object->metaObject()->className()) +
+ QLatin1String("::value");
+
+ QCOMPARE(messageHandler.messages().length(), 2);
+ QCOMPARE(messageHandler.messages().at(0), expected1);
+ QCOMPARE(messageHandler.messages().at(1), expected2);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::forInLoop()
+{
+ QQmlComponent component(&engine, testFileUrl("forInLoop.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, "listProperty");
+
+ QStringList r = object->property("listResult").toString().split("|", QString::SkipEmptyParts);
+ QCOMPARE(r.size(), 3);
+ QCOMPARE(r[0],QLatin1String("0=obj1"));
+ QCOMPARE(r[1],QLatin1String("1=obj2"));
+ QCOMPARE(r[2],QLatin1String("2=obj3"));
+
+ //TODO: should test for in loop for other objects (such as QObjects) as well.
+
+ delete object;
+}
+
+// An object the binding depends on is deleted while the binding is still running
+void tst_qqmlecmascript::deleteWhileBindingRunning()
+{
+ QQmlComponent component(&engine, testFileUrl("deleteWhileBindingRunning.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlecmascript::qtbug_22679()
+{
+ MyQmlObject object;
+ object.setStringProperty(QLatin1String("Please work correctly"));
+ engine.rootContext()->setContextProperty("contextProp", &object);
+
+ QQmlComponent component(&engine, testFileUrl("qtbug_22679.qml"));
+ qRegisterMetaType<QList<QQmlError> >("QList<QQmlError>");
+ QSignalSpy warningsSpy(&engine, SIGNAL(warnings(QList<QQmlError>)));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(warningsSpy.count(), 0);
+ delete o;
+}
+
+void tst_qqmlecmascript::qtbug_22843_data()
+{
+ QTest::addColumn<bool>("library");
+
+ QTest::newRow("without .pragma library") << false;
+ QTest::newRow("with .pragma library") << true;
+}
+
+void tst_qqmlecmascript::qtbug_22843()
+{
+ QFETCH(bool, library);
+
+ QString fileName("qtbug_22843");
+ if (library)
+ fileName += QLatin1String(".library");
+ fileName += QLatin1String(".qml");
+
+ QQmlComponent component(&engine, testFileUrl(fileName));
+ QString url = component.url().toString();
+ QString warning1 = url.left(url.length()-3) + QLatin1String("js:4: SyntaxError: Unexpected token )");
+ QString warning2 = url + QLatin1String(":5: TypeError: Object [object Object] has no method 'func'");
+
+ qRegisterMetaType<QList<QQmlError> >("QList<QQmlError>");
+ QSignalSpy warningsSpy(&engine, SIGNAL(warnings(QList<QQmlError>)));
+ for (int x = 0; x < 3; ++x) {
+ warningsSpy.clear();
+ // For libraries, only the first import attempt should produce a
+ // SyntaxError warning; subsequent component creation should not
+ // attempt to reload the script.
+ bool expectSyntaxError = !library || (x == 0);
+ if (expectSyntaxError)
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(warningsSpy.count(), 1 + (expectSyntaxError?1:0));
+ delete object;
+ }
+}
+
+
+void tst_qqmlecmascript::switchStatement()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("switchStatement.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ // `object->value()' is the number of executed statements
+
+ object->setStringProperty("A");
+ QCOMPARE(object->value(), 5);
+
+ object->setStringProperty("S");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("D");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("F");
+ QCOMPARE(object->value(), 4);
+
+ object->setStringProperty("something else");
+ QCOMPARE(object->value(), 1);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("switchStatement.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ // `object->value()' is the number of executed statements
+
+ object->setStringProperty("A");
+ QCOMPARE(object->value(), 5);
+
+ object->setStringProperty("S");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("D");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("F");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("something else");
+ QCOMPARE(object->value(), 4);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("switchStatement.3.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ // `object->value()' is the number of executed statements
+
+ object->setStringProperty("A");
+ QCOMPARE(object->value(), 5);
+
+ object->setStringProperty("S");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("D");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("F");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("something else");
+ QCOMPARE(object->value(), 6);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("switchStatement.4.qml"));
+
+ QString warning = component.url().toString() + ":4: Unable to assign [undefined] to int";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ // `object->value()' is the number of executed statements
+
+ object->setStringProperty("A");
+ QCOMPARE(object->value(), 5);
+
+ object->setStringProperty("S");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("D");
+ QCOMPARE(object->value(), 3);
+
+ object->setStringProperty("F");
+ QCOMPARE(object->value(), 3);
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ object->setStringProperty("something else");
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("switchStatement.5.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ // `object->value()' is the number of executed statements
+
+ object->setStringProperty("A");
+ QCOMPARE(object->value(), 1);
+
+ object->setStringProperty("S");
+ QCOMPARE(object->value(), 1);
+
+ object->setStringProperty("D");
+ QCOMPARE(object->value(), 1);
+
+ object->setStringProperty("F");
+ QCOMPARE(object->value(), 1);
+
+ object->setStringProperty("something else");
+ QCOMPARE(object->value(), 1);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("switchStatement.6.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ // `object->value()' is the number of executed statements
+
+ object->setStringProperty("A");
+ QCOMPARE(object->value(), 123);
+
+ object->setStringProperty("S");
+ QCOMPARE(object->value(), 123);
+
+ object->setStringProperty("D");
+ QCOMPARE(object->value(), 321);
+
+ object->setStringProperty("F");
+ QCOMPARE(object->value(), 321);
+
+ object->setStringProperty("something else");
+ QCOMPARE(object->value(), 0);
+ }
+}
+
+void tst_qqmlecmascript::withStatement()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("withStatement.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->value(), 123);
+ }
+}
+
+void tst_qqmlecmascript::tryStatement()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("tryStatement.1.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->value(), 123);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("tryStatement.2.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->value(), 321);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("tryStatement.3.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->value(), 1);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("tryStatement.4.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->value(), 1);
+ }
+}
+
+class CppInvokableWithQObjectDerived : public QObject
+{
+ Q_OBJECT
+public:
+ CppInvokableWithQObjectDerived() {}
+ ~CppInvokableWithQObjectDerived() {}
+
+ Q_INVOKABLE MyQmlObject *createMyQmlObject(QString data)
+ {
+ MyQmlObject *obj = new MyQmlObject();
+ obj->setStringProperty(data);
+ return obj;
+ }
+
+ Q_INVOKABLE QString getStringProperty(MyQmlObject *obj)
+ {
+ return obj->stringProperty();
+ }
+};
+
+void tst_qqmlecmascript::invokableWithQObjectDerived()
+{
+ CppInvokableWithQObjectDerived invokable;
+
+ {
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("invokable", &invokable);
+
+ QQmlComponent component(&engine, testFileUrl("qobjectDerivedArgument.qml"));
+
+ QObject *object = component.create();
+
+ QVERIFY(object != 0);
+ QVERIFY(object->property("result").value<bool>() == true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::realTypePrecision()
+{
+ // Properties and signal parameters of type real should have double precision.
+ QQmlComponent component(&engine, testFileUrl("realTypePrecision.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toDouble(), 1234567890.);
+ QCOMPARE(object->property("test2").toDouble(), 1234567890.);
+ QCOMPARE(object->property("test3").toDouble(), 1234567890.);
+ QCOMPARE(object->property("test4").toDouble(), 1234567890.);
+ QCOMPARE(object->property("test5").toDouble(), 1234567890.);
+ QCOMPARE(object->property("test6").toDouble(), 1234567890.*2);
+}
+
+void tst_qqmlecmascript::registeredFlagMethod()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("registeredFlagMethod.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->buttons(), 0);
+ emit object->basicSignal();
+ QCOMPARE(object->buttons(), Qt::RightButton);
+
+ delete object;
+}
+
+// QTBUG-23138
+void tst_qqmlecmascript::replaceBinding()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("replaceBinding.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+
+ QVERIFY(obj->property("success").toBool());
+ delete obj;
+}
+
+void tst_qqmlecmascript::deleteRootObjectInCreation()
+{
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("deleteRootObjectInCreation.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+ QVERIFY(obj->property("rootIndestructible").toBool());
+ QVERIFY(!obj->property("childDestructible").toBool());
+ QTest::qWait(1);
+ QVERIFY(obj->property("childDestructible").toBool());
+ delete obj;
+ }
+
+ {
+ QQmlComponent c(&engine, testFileUrl("deleteRootObjectInCreation.2.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("testConditionsMet").toBool());
+ delete object;
+ }
+}
+
+void tst_qqmlecmascript::onDestruction()
+{
+ {
+ // Delete object manually to invoke the associated handlers,
+ // prior to engine destruction.
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("onDestruction.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+ delete obj;
+ }
+
+ {
+ // In this case, the teardown of the engine causes deletion
+ // of contexts and child items. This triggers the
+ // onDestruction handler of a (previously .destroy()ed)
+ // component instance. This shouldn't crash.
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("onDestruction.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+ }
+}
+
+struct EventProcessor : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE void process()
+ {
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ }
+};
+
+void tst_qqmlecmascript::bindingSuppression()
+{
+ QQmlEngine engine;
+ EventProcessor processor;
+ engine.rootContext()->setContextProperty("pendingEvents", &processor);
+
+ QQmlTestMessageHandler messageHandler;
+
+ QQmlComponent c(&engine, testFileUrl("bindingSuppression.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+ delete obj;
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+}
+
+void tst_qqmlecmascript::signalEmitted()
+{
+ {
+ // calling destroy on the sibling.
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("signalEmitted.2.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+ QTRY_VERIFY(obj->property("success").toBool());
+ delete obj;
+ }
+
+ {
+ // allowing gc to clean up the sibling.
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("signalEmitted.3.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+ gc(engine); // should collect c1.
+ QTRY_VERIFY(obj->property("success").toBool());
+ delete obj;
+ }
+
+ {
+ // allowing gc to clean up the sibling after manually destroying target.
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("signalEmitted.4.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+ gc(engine); // should collect c1.
+ QMetaObject::invokeMethod(obj, "destroyC2");
+ QTRY_VERIFY(obj->property("success").toBool()); // handles events (incl. delete later).
+ delete obj;
+ }
+}
+
+// QTBUG-25647
+void tst_qqmlecmascript::threadSignal()
+{
+ {
+ QQmlComponent c(&engine, testFileUrl("threadSignal.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ QTRY_VERIFY(object->property("passed").toBool());
+ delete object;
+ }
+ {
+ QQmlComponent c(&engine, testFileUrl("threadSignal.2.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ QSignalSpy doneSpy(object, SIGNAL(done(const QString &)));
+ QMetaObject::invokeMethod(object, "doIt");
+ QTRY_VERIFY(object->property("passed").toBool());
+ QCOMPARE(doneSpy.count(), 1);
+ delete object;
+ }
+}
+
+// ensure that the qqmldata::destroyed() handler doesn't cause problems
+void tst_qqmlecmascript::qqmldataDestroyed()
+{
+ // gc cleans up a qobject, later the qqmldata destroyed handler will run.
+ {
+ QQmlComponent c(&engine, testFileUrl("qqmldataDestroyed.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ // now gc causing the collection of the dynamically constructed object.
+ engine.collectGarbage();
+ engine.collectGarbage();
+ // now process events to allow deletion (calling qqmldata::destroyed())
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ // shouldn't crash.
+ delete object;
+ }
+
+ // in this case, the object has CPP ownership, and the gc will
+ // be triggered during its beginCreate stage.
+ {
+ QQmlComponent c(&engine, testFileUrl("qqmldataDestroyed.2.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("testConditionsMet").toBool());
+ // the gc() within the handler will have triggered the weak
+ // qobject reference callback. If that incorrectly disposes
+ // the handle, when the qqmldata::destroyed() handler is
+ // called due to object deletion we will see a crash.
+ delete object;
+ // shouldn't have crashed.
+ }
+}
+
+void tst_qqmlecmascript::secondAlias()
+{
+ QQmlComponent c(&engine, testFileUrl("secondAlias.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toInt(), 200);
+ delete object;
+}
+
+// An alias to a var property works
+void tst_qqmlecmascript::varAlias()
+{
+ QQmlComponent c(&engine, testFileUrl("varAlias.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toInt(), 192);
+ delete object;
+}
+
+// Used to trigger an assert in the lazy meta object creation stage
+void tst_qqmlecmascript::overrideDataAssert()
+{
+ QQmlComponent c(&engine, testFileUrl("overrideDataAssert.qml"));
+ QObject *object = c.create();
+ QVERIFY(object != 0);
+ object->metaObject();
+ delete object;
+}
+
+void tst_qqmlecmascript::fallbackBindings_data()
+{
+ QTest::addColumn<QString>("source");
+
+ QTest::newRow("Property without fallback") << "fallbackBindings.1.qml";
+ QTest::newRow("Property fallback") << "fallbackBindings.2.qml";
+ QTest::newRow("SingletonType without fallback") << "fallbackBindings.3.qml";
+ QTest::newRow("SingletonType fallback") << "fallbackBindings.4.qml";
+ QTest::newRow("Attached without fallback") << "fallbackBindings.5.qml";
+ QTest::newRow("Attached fallback") << "fallbackBindings.6.qml";
+ QTest::newRow("Subproperty without fallback") << "fallbackBindings.7.qml";
+ QTest::newRow("Subproperty fallback") << "fallbackBindings.8.qml";
+}
+
+void tst_qqmlecmascript::fallbackBindings()
+{
+ QFETCH(QString, source);
+
+ QQmlComponent component(&engine, testFileUrl(source));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("success").toBool(), true);
+}
+
+void tst_qqmlecmascript::propertyOverride()
+{
+ QQmlComponent component(&engine, testFileUrl("propertyOverride.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("success").toBool(), true);
+}
+
+void tst_qqmlecmascript::sequenceSort_data()
+{
+ QTest::addColumn<QString>("function");
+ QTest::addColumn<bool>("useComparer");
+
+ QTest::newRow("qtbug_25269") << "test_qtbug_25269" << false;
+
+ const char *types[] = { "alphabet", "numbers", "reals" };
+ const char *sort[] = { "insertionSort", "quickSort" };
+
+ for (size_t t=0 ; t < sizeof(types)/sizeof(types[0]) ; ++t) {
+ for (size_t s=0 ; s < sizeof(sort)/sizeof(sort[0]) ; ++s) {
+ for (int c=0 ; c < 2 ; ++c) {
+ QString testName = QLatin1String(types[t]) + QLatin1String("_") + QLatin1String(sort[s]);
+ QString fnName = QLatin1String("test_") + testName;
+ bool useComparer = c != 0;
+ testName += useComparer ? QLatin1String("[custom]") : QLatin1String("[default]");
+ QTest::newRow(testName.toAscii().constData()) << fnName << useComparer;
+ }
+ }
+ }
+}
+
+void tst_qqmlecmascript::sequenceSort()
+{
+ QFETCH(QString, function);
+ QFETCH(bool, useComparer);
+
+ QQmlComponent component(&engine, testFileUrl("sequenceSort.qml"));
+
+ QObject *object = component.create();
+ if (object == 0)
+ qDebug() << component.errorString();
+ QVERIFY(object != 0);
+
+ QVariant q;
+ QMetaObject::invokeMethod(object, function.toAscii().constData(), Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, useComparer));
+ QVERIFY(q.toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::concatenatedStringPropertyAccess()
+{
+ QQmlComponent component(&engine, testFileUrl("concatenatedStringPropertyAccess.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+}
+
+void tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy()
+{
+ QQmlEngine *myEngine = new QQmlEngine;
+
+ MyDeleteObject deleteObject;
+ deleteObject.setObjectName("deleteObject");
+ QObject * const object1 = new QObject;
+ QObject * const object2 = new QObject;
+ object1->setObjectName("object1");
+ object2->setObjectName("object2");
+ deleteObject.setObject1(object1);
+ deleteObject.setObject2(object2);
+
+ // Objects returned by function calls get marked as destructible, but objects returned by
+ // property getters do not - therefore we explicitly set the object as destructible.
+ QQmlEngine::setObjectOwnership(object2, QQmlEngine::JavaScriptOwnership);
+
+ myEngine->rootContext()->setContextProperty("deleteObject", &deleteObject);
+ QQmlComponent component(myEngine, testFileUrl("jsOwnedObjectsDeletedOnEngineDestroy.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+
+ // Destroying the engine should delete all JS owned QObjects
+ QSignalSpy spy1(object1, SIGNAL(destroyed()));
+ QSignalSpy spy2(object2, SIGNAL(destroyed()));
+ delete myEngine;
+ QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy2.count(), 1);
+
+ delete object;
+}
+
+void tst_qqmlecmascript::numberParsing()
+{
+ for (int i = 1; i < 8; ++i) {
+ QString file("numberParsing.%1.qml");
+ file = file.arg(i);
+ QQmlComponent component(&engine, testFileUrl(file));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ }
+ for (int i = 1; i < 3; ++i) {
+ QString file("numberParsing_error.%1.qml");
+ file = file.arg(i);
+ QQmlComponent component(&engine, testFileUrl(file));
+ QVERIFY(!component.errors().isEmpty());
+ }
+}
+
+void tst_qqmlecmascript::stringParsing()
+{
+ for (int i = 1; i < 7; ++i) {
+ QString file("stringParsing_error.%1.qml");
+ file = file.arg(i);
+ QQmlComponent component(&engine, testFileUrl(file));
+ QObject *object = component.create();
+ QVERIFY(object == 0);
+ }
+}
+
+QTEST_MAIN(tst_qqmlecmascript)
+
+#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml
new file mode 100644
index 0000000000..76a0e32335
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyAggregateEmptyComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ EmptyComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml
new file mode 100644
index 0000000000..7e6821ee48
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyAggregateVMEComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ VMEComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyComponent.qml
new file mode 100644
index 0000000000..459c82afbb
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml
new file mode 100644
index 0000000000..728b8e7798
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyExtendEmptyComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+EmptyComponent {
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml
new file mode 100644
index 0000000000..88efc731a0
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyExtendVMEComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+VMEComponent {
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml
new file mode 100644
index 0000000000..293a8e713e
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyPropertyEmptyComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property EmptyComponent p: EmptyComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml b/tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml
new file mode 100644
index 0000000000..8444edc829
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/EmptyPropertyVMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property VMEComponent p: VMEComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml
new file mode 100644
index 0000000000..728b8e7798
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/NestedEmptyComponent.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+EmptyComponent {
+}
diff --git a/tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml b/tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml
new file mode 100644
index 0000000000..fd4f15482c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/NestedVMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+VMEComponent {
+ property real pi: 3.1415927
+}
diff --git a/tests/auto/qml/qqmlengine/data/ScriptComponent.qml b/tests/auto/qml/qqmlengine/data/ScriptComponent.qml
new file mode 100644
index 0000000000..3fb9a10e85
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/ScriptComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import "script.js" as JS
+
+VMEExtendVMEComponent {
+ function getSomething() { return JS.getSomething() }
+}
diff --git a/tests/auto/qml/qqmlengine/data/TopLevelComponent.qml b/tests/auto/qml/qqmlengine/data/TopLevelComponent.qml
new file mode 100644
index 0000000000..dea8a9ce2e
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/TopLevelComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Component {
+ VMEExtendVMEComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml
new file mode 100644
index 0000000000..a34a036471
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEAggregateEmptyComponent.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Item {
+ property string bar: 'baz'
+
+ EmptyComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml
new file mode 100644
index 0000000000..4bacdf8042
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEAggregateVMEComponent.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+
+ VMEComponent {
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEComponent.qml
new file mode 100644
index 0000000000..0a43a08711
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml
new file mode 100644
index 0000000000..df81f6bb88
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEExtendEmptyComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+EmptyComponent {
+ property string bar: 'baz'
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml
new file mode 100644
index 0000000000..bf7a2ecdc2
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEExtendVMEComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+VMEComponent {
+ property string bar: 'baz'
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml
new file mode 100644
index 0000000000..4ead1e0088
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEPropertyEmptyComponent.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+
+ property EmptyComponent p: EmptyComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml
new file mode 100644
index 0000000000..88867f29fc
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMEPropertyVMEComponent.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ property string foo: 'bar'
+
+ property VMEComponent p: VMEComponent {}
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml b/tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml
new file mode 100644
index 0000000000..487025f67f
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMETransientEmptyComponent.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ property var p: null
+
+ Component.onCompleted: {
+ var c = Qt.createComponent('EmptyComponent.qml')
+ p = c.createObject()
+ c.destroy()
+ }
+
+ Component.onDestruction: {
+ p.destroy()
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml b/tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml
new file mode 100644
index 0000000000..8f29b53ca5
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/VMETransientVMEComponent.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ property var p: null
+
+ Component.onCompleted: {
+ var c = Qt.createComponent('VMEComponent.qml')
+ p = c.createObject()
+ c.destroy()
+ }
+
+ Component.onDestruction: {
+ p.destroy()
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/failedCompilation.1.qml b/tests/auto/qml/qqmlengine/data/failedCompilation.1.qml
new file mode 100644
index 0000000000..0bd3cd0254
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/failedCompilation.1.qml
@@ -0,0 +1,4 @@
+// No imports - intentional
+
+Item {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.1.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.1.qml
new file mode 100644
index 0000000000..e879577e10
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.1.qml
@@ -0,0 +1,4 @@
+import QtQml 2.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.2.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.2.qml
new file mode 100644
index 0000000000..6cbe96b1ee
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.2.qml
@@ -0,0 +1,4 @@
+import QtQml 3.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.3.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.3.qml
new file mode 100644
index 0000000000..1160c2827c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.3.qml
@@ -0,0 +1,4 @@
+import QtQml 1.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml
new file mode 100644
index 0000000000..9b9b7922da
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.4.qml
@@ -0,0 +1,4 @@
+import QtQml 2.5
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml
new file mode 100644
index 0000000000..26018b5782
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml
@@ -0,0 +1,8 @@
+import QtQml 2.0
+
+QtObject {
+ property Component c
+ property Timer timer
+ property Connections connections: Connections {}
+ property Binding binding
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.6.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.6.qml
new file mode 100644
index 0000000000..e8cc22fd5b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.6.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+import QtQuick 2.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.7.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.7.qml
new file mode 100644
index 0000000000..619489b22e
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.7.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import QtQml 2.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.8.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.8.qml
new file mode 100644
index 0000000000..59bf31662c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.8.qml
@@ -0,0 +1,5 @@
+// deliberately no imports
+
+// should fail
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.9.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.9.qml
new file mode 100644
index 0000000000..cbf90b9dd1
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.9.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+// Should fail.
+Item {
+}
diff --git a/tests/auto/qml/qqmlengine/data/repeatedCompilation.qml b/tests/auto/qml/qqmlengine/data/repeatedCompilation.qml
new file mode 100644
index 0000000000..797381e54c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/repeatedCompilation.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+VMEExtendVMEComponent {
+ property bool success: false
+
+ Component.onCompleted: {
+ success = (foo == 'bar') && (bar == 'baz')
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/script.js b/tests/auto/qml/qqmlengine/data/script.js
new file mode 100644
index 0000000000..616de3ddd7
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/script.js
@@ -0,0 +1 @@
+function getSomething() { return 'https://example.org/' }
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml
new file mode 100644
index 0000000000..812242f146
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.1.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml
new file mode 100644
index 0000000000..a171ee6b28
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateEmptyComponent.2.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml
new file mode 100644
index 0000000000..de40284452
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml
new file mode 100644
index 0000000000..4939087b31
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyAggregateVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.x == undefined) return reportError('Invalid object 5')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml
new file mode 100644
index 0000000000..5cee0341fe
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyComponent.1.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml
new file mode 100644
index 0000000000..2a13822fab
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyComponent.2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml
new file mode 100644
index 0000000000..2f238175fa
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.1.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml
new file mode 100644
index 0000000000..d36e95fec3
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendEmptyComponent.2.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml
new file mode 100644
index 0000000000..53dd5a17e9
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.foo != 'bar') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml
new file mode 100644
index 0000000000..e5cd7d60de
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyExtendVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.foo != 'bar') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.x == undefined) return reportError('Invalid object 5')
+ if (obj.foo != 'bar') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyExtendVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml
new file mode 100644
index 0000000000..d98aef2932
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml
new file mode 100644
index 0000000000..7f438aa995
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyEmptyComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.x == undefined) return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml
new file mode 100644
index 0000000000..83d6226e83
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml
new file mode 100644
index 0000000000..98dfb7241b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testEmptyPropertyVMEComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('EmptyPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testEmptyPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('EmptyPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml b/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml
new file mode 100644
index 0000000000..50af9c4f16
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testIncubatedComponent.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var c = Qt.createComponent('VMEExtendVMEComponent.qml')
+ var i = c.incubateObject(null, {}, Qt.Asynchronous)
+
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 1')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ c.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ i.onStatusChanged = function(status) {
+ if (status != Component.Ready) return;
+ if (i.object == null) return reportError('Extend component not created')
+ if (i.object.foo != 'bar') return reportError('Invalid object')
+ if (i.object.bar != 'baz') return reportError('Invalid object 2')
+
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded 2')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded 2')
+
+ i.object.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testIncubatedComponent.qml')) return reportError('Test component unloaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+
+ componentCache.beginIncubation()
+ componentCache.waitForIncubation();
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml b/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml
new file mode 100644
index 0000000000..a04ca41c26
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testLoaderComponent.qml
@@ -0,0 +1,62 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ loader.source = 'VMEExtendVMEComponent.qml'
+ }
+
+ Loader {
+ id: loader
+
+ property bool previouslyLoaded: false
+ onLoaded: {
+ if (!previouslyLoaded) {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ if (!item) return reportError('Invalid item')
+ if (item.foo != 'bar') return reportError('Invalid item 2')
+ if (item.bar != 'baz') return reportError('Invalid item 3')
+
+ loader.source = ''
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 3')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+ if (item) return reportError('Item not invalidated')
+
+ previouslyLoaded = true
+ loader.source = 'VMEExtendVMEComponent.qml'
+ } else {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 4')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not reloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not reloaded')
+
+ if (!item) return reportError('Invalid item 4')
+ if (item.foo != 'bar') return reportError('Invalid item 5')
+ if (item.bar != 'baz') return reportError('Invalid item 6')
+
+ loader.source = ''
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testLoaderComponent.qml')) return reportError('Test component not loaded 5')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded 2')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded 2')
+ if (item) return reportError('Item not invalidated 2')
+
+ success = true
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testReloadComponent.qml b/tests/auto/qml/qqmlengine/data/testReloadComponent.qml
new file mode 100644
index 0000000000..74442108cd
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testReloadComponent.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 3')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 4')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not reloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not reloaded')
+
+ obj = comp.createObject()
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testReloadComponent.qml')) return reportError('Test component not loaded 5')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded 2')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded 2')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testScriptComponent.qml b/tests/auto/qml/qqmlengine/data/testScriptComponent.qml
new file mode 100644
index 0000000000..b33eb48461
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testScriptComponent.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testScriptComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('ScriptComponent.qml')) return reportError('Script component already loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+ if (componentCache.isScriptLoaded('script.js')) return reportError('Script file already loaded')
+
+ var comp = Qt.createComponent('ScriptComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testScriptComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('ScriptComponent.qml')) return reportError('Script component not loaded')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+ if (!componentCache.isScriptLoaded('script.js')) return reportError('Script file not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+ if (obj.getSomething() != 'https://example.org/') return reportError('Invalid object 4')
+
+ obj.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testScriptComponent.qml')) return reportError('Test component not loaded 3')
+ if (componentCache.isTypeLoaded('ScriptComponent.qml')) return reportError('Script component not unloaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ // Script unloading is not currently implemented
+ //if (componentCache.isScriptLoaded('script.js')) return reportError('Script file already loaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml b/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml
new file mode 100644
index 0000000000..6cf8ec4203
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testTopLevelComponent.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component already loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('TopLevelComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component not loaded')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var internalComp = comp.createObject()
+ if (!internalComp) return reportError('Invalid component')
+
+ var obj = internalComp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ internalComp.destroy()
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTopLevelComponent.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('TopLevelComponent.qml')) return reportError('Top-level component not unloaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml b/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml
new file mode 100644
index 0000000000..d3e6ffd7cf
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testTransientComponent.1.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return
+ if (obj.foo != 'bar') return reportError('Invalid object')
+ if (obj.bar != 'baz') return reportError('Invalid object 2')
+
+ obj.destroy()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml b/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml
new file mode 100644
index 0000000000..acb0113e61
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testTransientComponent.2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return
+ if (obj.foo != 'bar') return reportError('Invalid object')
+ if (obj.bar != 'baz') return reportError('Invalid object 2')
+
+ comp.destroy()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component already unloaded')
+ if (obj.foo != 'bar') return reportError('Invalid object 3')
+ if (obj.bar != 'baz') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testTransientComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Transient component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml
new file mode 100644
index 0000000000..a5beede469
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.children[0].x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml
new file mode 100644
index 0000000000..4c8e52f251
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateEmptyComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.children[0].x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.children[0].x == undefined) return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateEmptyComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml
new file mode 100644
index 0000000000..983d6e824c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml
new file mode 100644
index 0000000000..fc8e5a0cd4
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEAggregateVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Aggregate component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEAggregateVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object r4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.children[0].foo != 'bar') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEAggregateVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEAggregateVMEComponent.qml')) return reportError('Aggregate component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml
new file mode 100644
index 0000000000..fcfd05c51f
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEComponent.1.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml
new file mode 100644
index 0000000000..f434406eec
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEComponent.2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 3')
+ if (obj.foo != 'bar') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml
new file mode 100644
index 0000000000..1dcaec90e6
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml
new file mode 100644
index 0000000000..fd7d7e454c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendEmptyComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.x == undefined) return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendEmptyComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml
new file mode 100644
index 0000000000..d2dab32fc9
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.1.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml
new file mode 100644
index 0000000000..813e43896c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEExtendVMEComponent.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEExtendVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.bar != 'baz') return reportError('Invalid object 3')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 4')
+ if (obj.foo != 'bar') return reportError('Invalid object 5')
+ if (obj.bar != 'baz') return reportError('Invalid object 6')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEExtendVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEExtendVMEComponent.qml')) return reportError('Extend component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml
new file mode 100644
index 0000000000..c6f0b7928b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml
new file mode 100644
index 0000000000..255138520c
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyEmptyComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.foo != 'bar') return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.x == undefined) return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyEmptyComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml
new file mode 100644
index 0000000000..0ad59b32d3
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml
new file mode 100644
index 0000000000..60f72a92fe
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMEPropertyVMEComponent.2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMEPropertyVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not loaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.foo != 'bar') return reportError('Invalid object 2')
+ if (obj.p == undefined) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.foo != 'bar') return reportError('Invalid object 6')
+ if (obj.p == undefined) return reportError('Invalid object 7')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMEPropertyVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMEPropertyVMEComponent.qml')) return reportError('Property component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml
new file mode 100644
index 0000000000..6c7f959f49
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.1.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMETransientEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded 2')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml
new file mode 100644
index 0000000000..86060c3998
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientEmptyComponent.2.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var comp = Qt.createComponent('VMETransientEmptyComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.x == undefined) return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not loaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component already unloaded')
+ if (!componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (!obj.p) return reportError('Invalid object 7')
+ if (obj.p.x == undefined) return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientEmptyComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientEmptyComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('EmptyComponent.qml')) return reportError('Empty component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml
new file mode 100644
index 0000000000..c50fd70dec
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.1.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMETransientVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.1.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded 2')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml
new file mode 100644
index 0000000000..120d249bc0
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testVMETransientVMEComponent.2.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ function reportError(s) { console.warn(s) }
+
+ Component.onCompleted: {
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var comp = Qt.createComponent('VMETransientVMEComponent.qml')
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded 2')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not loaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already loaded')
+
+ var obj = comp.createObject()
+ if (!obj) return reportError('Invalid object')
+ if (obj.x == undefined) return reportError('Invalid object 2')
+ if (!obj.p) return reportError('Invalid object 3')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 4')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not loaded')
+
+ comp.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded 3')
+ if (!componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component already unloaded')
+ if (!componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component already unloaded')
+ if (!obj) return reportError('Invalid object 5')
+ if (obj.x == undefined) return reportError('Invalid object 6')
+ if (!obj.p) return reportError('Invalid object 7')
+ if (obj.p.foo != 'bar') return reportError('Invalid object 8')
+
+ obj.destroy()
+ componentCache.trim()
+ if (!componentCache.isTypeLoaded('testVMETransientVMEComponent.2.qml')) return reportError('Test component not loaded 4')
+ if (componentCache.isTypeLoaded('VMETransientVMEComponent.qml')) return reportError('Transient component not unloaded')
+ if (componentCache.isTypeLoaded('VMEComponent.qml')) return reportError('VME component not unloaded')
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/qqmlengine.pro b/tests/auto/qml/qqmlengine/qqmlengine.pro
new file mode 100644
index 0000000000..8c6610158b
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/qqmlengine.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qqmlengine
+macx:CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+
+SOURCES += tst_qqmlengine.cpp
+
+QT += core-private gui-private qml-private v8-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
new file mode 100644
index 0000000000..9177ff58f7
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -0,0 +1,679 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../shared/util.h"
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QNetworkAccessManager>
+#include <QPointer>
+#include <QDir>
+#include <QStandardPaths>
+#include <QSignalSpy>
+#include <QDebug>
+#include <QBuffer>
+#include <QQmlComponent>
+#include <QQmlNetworkAccessManagerFactory>
+#include <QQmlExpression>
+#include <QQmlIncubationController>
+#include <private/qqmlengine_p.h>
+
+class tst_qqmlengine : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlengine() {}
+
+private slots:
+ void rootContext();
+ void networkAccessManager();
+ void synchronousNetworkAccessManager();
+ void baseUrl();
+ void contextForObject();
+ void offlineStoragePath();
+ void clearComponentCache();
+ void trimComponentCache();
+ void trimComponentCache_data();
+ void repeatedCompilation();
+ void failedCompilation();
+ void failedCompilation_data();
+ void outputWarningsToStandardError();
+ void objectOwnership();
+ void multipleEngines();
+ void qtqmlModule_data();
+ void qtqmlModule();
+
+public slots:
+ QObject *createAQObjectForOwnershipTest ()
+ {
+ static QObject *ptr = new QObject();
+ return ptr;
+ }
+};
+
+void tst_qqmlengine::rootContext()
+{
+ QQmlEngine engine;
+
+ QVERIFY(engine.rootContext());
+
+ QCOMPARE(engine.rootContext()->engine(), &engine);
+ QVERIFY(engine.rootContext()->parentContext() == 0);
+}
+
+class NetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory
+{
+public:
+ NetworkAccessManagerFactory() : manager(0) {}
+
+ QNetworkAccessManager *create(QObject *parent) {
+ manager = new QNetworkAccessManager(parent);
+ return manager;
+ }
+
+ QNetworkAccessManager *manager;
+};
+
+void tst_qqmlengine::networkAccessManager()
+{
+ QQmlEngine *engine = new QQmlEngine;
+
+ // Test QQmlEngine created manager
+ QPointer<QNetworkAccessManager> manager = engine->networkAccessManager();
+ QVERIFY(manager != 0);
+ delete engine;
+
+ // Test factory created manager
+ engine = new QQmlEngine;
+ NetworkAccessManagerFactory factory;
+ engine->setNetworkAccessManagerFactory(&factory);
+ QVERIFY(engine->networkAccessManagerFactory() == &factory);
+ QVERIFY(engine->networkAccessManager() == factory.manager);
+ delete engine;
+}
+
+class ImmediateReply : public QNetworkReply {
+
+ Q_OBJECT
+
+public:
+ ImmediateReply() {
+ setFinished(true);
+ }
+ virtual qint64 readData(char* , qint64 ) {
+ return 0;
+ }
+ virtual void abort() { }
+};
+
+class ImmediateManager : public QNetworkAccessManager {
+
+ Q_OBJECT
+
+public:
+ ImmediateManager(QObject *parent = 0) : QNetworkAccessManager(parent) {
+ }
+
+ QNetworkReply *createRequest(Operation, const QNetworkRequest & , QIODevice * outgoingData = 0) {
+ Q_UNUSED(outgoingData);
+ return new ImmediateReply;
+ }
+};
+
+class ImmediateFactory : public QQmlNetworkAccessManagerFactory {
+
+public:
+ QNetworkAccessManager *create(QObject *) {
+ return new ImmediateManager;
+ }
+};
+
+void tst_qqmlengine::synchronousNetworkAccessManager()
+{
+ ImmediateFactory factory;
+ QQmlEngine engine;
+ engine.setNetworkAccessManagerFactory(&factory);
+ QQmlComponent c(&engine, QUrl("myScheme://test.qml"));
+ // reply is finished, so should not be in loading state.
+ QVERIFY(!c.isLoading());
+}
+
+
+void tst_qqmlengine::baseUrl()
+{
+ QQmlEngine engine;
+
+ QUrl cwd = QUrl::fromLocalFile(QDir::currentPath() + QDir::separator());
+
+ QCOMPARE(engine.baseUrl(), cwd);
+ QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd.resolved(QUrl("main.qml")));
+
+ QDir dir = QDir::current();
+ dir.cdUp();
+ QVERIFY(dir != QDir::current());
+ QDir::setCurrent(dir.path());
+ QVERIFY(QDir::current() == dir);
+
+ QUrl cwd2 = QUrl::fromLocalFile(QDir::currentPath() + QDir::separator());
+ QCOMPARE(engine.baseUrl(), cwd2);
+ QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd2.resolved(QUrl("main.qml")));
+
+ engine.setBaseUrl(cwd);
+ QCOMPARE(engine.baseUrl(), cwd);
+ QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd.resolved(QUrl("main.qml")));
+}
+
+void tst_qqmlengine::contextForObject()
+{
+ QQmlEngine *engine = new QQmlEngine;
+
+ // Test null-object
+ QVERIFY(QQmlEngine::contextForObject(0) == 0);
+
+ // Test an object with no context
+ QObject object;
+ QVERIFY(QQmlEngine::contextForObject(&object) == 0);
+
+ // Test setting null-object
+ QQmlEngine::setContextForObject(0, engine->rootContext());
+
+ // Test setting null-context
+ QQmlEngine::setContextForObject(&object, 0);
+
+ // Test setting context
+ QQmlEngine::setContextForObject(&object, engine->rootContext());
+ QVERIFY(QQmlEngine::contextForObject(&object) == engine->rootContext());
+
+ QQmlContext context(engine->rootContext());
+
+ // Try changing context
+ QTest::ignoreMessage(QtWarningMsg, "QQmlEngine::setContextForObject(): Object already has a QQmlContext");
+ QQmlEngine::setContextForObject(&object, &context);
+ QVERIFY(QQmlEngine::contextForObject(&object) == engine->rootContext());
+
+ // Delete context
+ delete engine; engine = 0;
+ QVERIFY(QQmlEngine::contextForObject(&object) == 0);
+}
+
+void tst_qqmlengine::offlineStoragePath()
+{
+ // Without these set, QDesktopServices::storageLocation returns
+ // strings with extra "//" at the end. We set them to ignore this problem.
+ qApp->setApplicationName("tst_qqmlengine");
+ qApp->setOrganizationName("Nokia");
+ qApp->setOrganizationDomain("nokia.com");
+
+ QQmlEngine engine;
+
+ QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+
+ QCOMPARE(dataLocation.isEmpty(), engine.offlineStoragePath().isEmpty());
+
+ QDir dir(dataLocation);
+ dir.mkpath("QML");
+ dir.cd("QML");
+ dir.mkpath("OfflineStorage");
+ dir.cd("OfflineStorage");
+
+ QCOMPARE(QDir::fromNativeSeparators(engine.offlineStoragePath()), dir.path());
+
+ engine.setOfflineStoragePath(QDir::homePath());
+ QCOMPARE(engine.offlineStoragePath(), QDir::homePath());
+}
+
+void tst_qqmlengine::clearComponentCache()
+{
+ QQmlEngine engine;
+
+ // Create original qml file
+ {
+ QFile file("temp.qml");
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ file.write("import QtQuick 2.0\nQtObject {\nproperty int test: 10\n}\n");
+ file.close();
+ }
+
+ // Test "test" property
+ {
+ QQmlComponent component(&engine, "temp.qml");
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("test").toInt(), 10);
+ delete obj;
+ }
+
+ // Modify qml file
+ {
+ QFile file("temp.qml");
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ file.write("import QtQuick 2.0\nQtObject {\nproperty int test: 11\n}\n");
+ file.close();
+ }
+
+ // Test cache hit
+ {
+ QQmlComponent component(&engine, "temp.qml");
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("test").toInt(), 10);
+ delete obj;
+ }
+
+ // Clear cache
+ engine.clearComponentCache();
+
+ // Test cache refresh
+ {
+ QQmlComponent component(&engine, "temp.qml");
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("test").toInt(), 11);
+ delete obj;
+ }
+}
+
+struct ComponentCacheFunctions : public QObject, public QQmlIncubationController
+{
+ Q_OBJECT
+public:
+ QQmlEngine *engine;
+
+ ComponentCacheFunctions(QQmlEngine &e) : engine(&e) {}
+
+ Q_INVOKABLE void trim()
+ {
+ // Wait for any pending deletions to occur
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ engine->trimComponentCache();
+ }
+
+ Q_INVOKABLE bool isTypeLoaded(QString file)
+ {
+ return QQmlEnginePrivate::get(engine)->isTypeLoaded(tst_qqmlengine::instance()->testFileUrl(file));
+ }
+
+ Q_INVOKABLE bool isScriptLoaded(QString file)
+ {
+ return QQmlEnginePrivate::get(engine)->isScriptLoaded(tst_qqmlengine::instance()->testFileUrl(file));
+ }
+
+ Q_INVOKABLE void beginIncubation()
+ {
+ startTimer(0);
+ }
+
+ Q_INVOKABLE void waitForIncubation()
+ {
+ while (incubatingObjectCount() > 0) {
+ QCoreApplication::processEvents();
+ }
+ }
+
+private:
+ virtual void timerEvent(QTimerEvent *)
+ {
+ incubateFor(1000);
+ }
+};
+
+void tst_qqmlengine::trimComponentCache()
+{
+ QFETCH(QString, file);
+
+ QQmlEngine engine;
+ ComponentCacheFunctions componentCache(engine);
+ engine.rootContext()->setContextProperty("componentCache", &componentCache);
+ engine.setIncubationController(&componentCache);
+
+ QQmlComponent component(&engine, testFileUrl(file));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+}
+
+void tst_qqmlengine::trimComponentCache_data()
+{
+ QTest::addColumn<QString>("file");
+
+ // The various tests here are for two types of components: those that are
+ // empty apart from their inherited elements, and those that define new properties.
+ // For each there are five types of composition: extension, aggregation,
+ // aggregation via component, property and object-created-via-transient-component.
+ foreach (const QString &test, (QStringList() << "EmptyComponent"
+ << "VMEComponent"
+ << "EmptyExtendEmptyComponent"
+ << "VMEExtendEmptyComponent"
+ << "EmptyExtendVMEComponent"
+ << "VMEExtendVMEComponent"
+ << "EmptyAggregateEmptyComponent"
+ << "VMEAggregateEmptyComponent"
+ << "EmptyAggregateVMEComponent"
+ << "VMEAggregateVMEComponent"
+ << "EmptyPropertyEmptyComponent"
+ << "VMEPropertyEmptyComponent"
+ << "EmptyPropertyVMEComponent"
+ << "VMEPropertyVMEComponent"
+ << "VMETransientEmptyComponent"
+ << "VMETransientVMEComponent")) {
+ // For these cases, we first test that the component instance keeps the components
+ // referenced, and then that the instantiated object keeps the components referenced
+ for (int i = 1; i <= 2; ++i) {
+ QString name(QString("%1-%2").arg(test).arg(i));
+ QString file(QString("test%1.%2.qml").arg(test).arg(i));
+ QTest::newRow(name.toLatin1().constData()) << file;
+ }
+ }
+
+ // Test that a transient component is correctly referenced
+ QTest::newRow("TransientComponent-1") << "testTransientComponent.1.qml";
+ QTest::newRow("TransientComponent-2") << "testTransientComponent.2.qml";
+
+ // Test that components can be reloaded after unloading
+ QTest::newRow("ReloadComponent") << "testReloadComponent.qml";
+
+ // Test that components are correctly referenced when dynamically loaded
+ QTest::newRow("LoaderComponent") << "testLoaderComponent.qml";
+
+ // Test that components are correctly referenced when incubated
+ QTest::newRow("IncubatedComponent") << "testIncubatedComponent.qml";
+
+ // Test that a top-level omponents is correctly referenced
+ QTest::newRow("TopLevelComponent") << "testTopLevelComponent.qml";
+
+ // TODO:
+ // Test that scripts are unloaded when no longer referenced
+ QTest::newRow("ScriptComponent") << "testScriptComponent.qml";
+}
+
+void tst_qqmlengine::repeatedCompilation()
+{
+ QQmlEngine engine;
+
+ for (int i = 0; i < 100; ++i) {
+ engine.collectGarbage();
+ engine.trimComponentCache();
+
+ QQmlComponent component(&engine, testFileUrl("repeatedCompilation.qml"));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+ }
+}
+
+void tst_qqmlengine::failedCompilation()
+{
+ QFETCH(QString, file);
+
+ QQmlEngine engine;
+
+ QQmlComponent component(&engine, testFileUrl(file));
+ QVERIFY(!component.isReady());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object == 0);
+
+ engine.collectGarbage();
+ engine.trimComponentCache();
+ engine.clearComponentCache();
+}
+
+void tst_qqmlengine::failedCompilation_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QTest::newRow("Invalid URL") << "failedCompilation.does.not.exist.qml";
+ QTest::newRow("Invalid content") << "failedCompilation.1.qml";
+}
+
+void tst_qqmlengine::outputWarningsToStandardError()
+{
+ QQmlEngine engine;
+
+ QCOMPARE(engine.outputWarningsToStandardError(), true);
+
+ QQmlComponent c(&engine);
+ c.setData("import QtQuick 2.0; QtObject { property int a: undefined }", QUrl());
+
+ QVERIFY(c.isReady() == true);
+
+ QQmlTestMessageHandler messageHandler;
+
+ QObject *o = c.create();
+
+ QVERIFY(o != 0);
+ delete o;
+
+ QCOMPARE(messageHandler.messages().count(), 1);
+ QCOMPARE(messageHandler.messages().at(0), QLatin1String("<Unknown File>: Unable to assign [undefined] to int"));
+ messageHandler.clear();
+
+ engine.setOutputWarningsToStandardError(false);
+ QCOMPARE(engine.outputWarningsToStandardError(), false);
+
+ o = c.create();
+
+ QVERIFY(o != 0);
+ delete o;
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+}
+
+void tst_qqmlengine::objectOwnership()
+{
+ {
+ QCOMPARE(QQmlEngine::objectOwnership(0), QQmlEngine::CppOwnership);
+ QQmlEngine::setObjectOwnership(0, QQmlEngine::JavaScriptOwnership);
+ QCOMPARE(QQmlEngine::objectOwnership(0), QQmlEngine::CppOwnership);
+ }
+
+ {
+ QObject o;
+ QCOMPARE(QQmlEngine::objectOwnership(&o), QQmlEngine::CppOwnership);
+ QQmlEngine::setObjectOwnership(&o, QQmlEngine::CppOwnership);
+ QCOMPARE(QQmlEngine::objectOwnership(&o), QQmlEngine::CppOwnership);
+ QQmlEngine::setObjectOwnership(&o, QQmlEngine::JavaScriptOwnership);
+ QCOMPARE(QQmlEngine::objectOwnership(&o), QQmlEngine::JavaScriptOwnership);
+ QQmlEngine::setObjectOwnership(&o, QQmlEngine::CppOwnership);
+ QCOMPARE(QQmlEngine::objectOwnership(&o), QQmlEngine::CppOwnership);
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine);
+ c.setData("import QtQuick 2.0; QtObject { property QtObject object: QtObject {} }", QUrl());
+
+ QObject *o = c.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(QQmlEngine::objectOwnership(o), QQmlEngine::CppOwnership);
+
+ QObject *o2 = qvariant_cast<QObject *>(o->property("object"));
+ QCOMPARE(QQmlEngine::objectOwnership(o2), QQmlEngine::JavaScriptOwnership);
+
+ delete o;
+ }
+ {
+ QObject *ptr = createAQObjectForOwnershipTest();
+ QSignalSpy spy(ptr, SIGNAL(destroyed()));
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine);
+ engine.rootContext()->setContextProperty("test", this);
+ QQmlEngine::setObjectOwnership(ptr, QQmlEngine::JavaScriptOwnership);
+ c.setData("import QtQuick 2.0; Item { property int data: test.createAQObjectForOwnershipTest() ? 0 : 1 }", QUrl());
+ QVERIFY(c.isReady());
+ QObject *o = c.create();
+ QVERIFY(o != 0);
+ }
+ QTRY_VERIFY(spy.count());
+ }
+ {
+ QObject *ptr = new QObject();
+ QSignalSpy spy(ptr, SIGNAL(destroyed()));
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine);
+ engine.rootContext()->setContextProperty("test", ptr);
+ QQmlEngine::setObjectOwnership(ptr, QQmlEngine::JavaScriptOwnership);
+ c.setData("import QtQuick 2.0; QtObject { property var object: { var i = test; test ? 0 : 1 } }", QUrl());
+ QVERIFY(c.isReady());
+ QObject *o = c.create();
+ QVERIFY(o != 0);
+ engine.rootContext()->setContextProperty("test", 0);
+ }
+ QTRY_VERIFY(spy.count());
+ }
+}
+
+// Test an object can be accessed by multiple engines
+void tst_qqmlengine::multipleEngines()
+{
+ QObject o;
+ o.setObjectName("TestName");
+
+ // Simultaneous engines
+ {
+ QQmlEngine engine1;
+ QQmlEngine engine2;
+ engine1.rootContext()->setContextProperty("object", &o);
+ engine2.rootContext()->setContextProperty("object", &o);
+
+ QQmlExpression expr1(engine1.rootContext(), 0, QString("object.objectName"));
+ QQmlExpression expr2(engine2.rootContext(), 0, QString("object.objectName"));
+
+ QCOMPARE(expr1.evaluate().toString(), QString("TestName"));
+ QCOMPARE(expr2.evaluate().toString(), QString("TestName"));
+ }
+
+ // Serial engines
+ {
+ QQmlEngine engine1;
+ engine1.rootContext()->setContextProperty("object", &o);
+ QQmlExpression expr1(engine1.rootContext(), 0, QString("object.objectName"));
+ QCOMPARE(expr1.evaluate().toString(), QString("TestName"));
+ }
+ {
+ QQmlEngine engine1;
+ engine1.rootContext()->setContextProperty("object", &o);
+ QQmlExpression expr1(engine1.rootContext(), 0, QString("object.objectName"));
+ QCOMPARE(expr1.evaluate().toString(), QString("TestName"));
+ }
+}
+
+void tst_qqmlengine::qtqmlModule_data()
+{
+ QTest::addColumn<QUrl>("testFile");
+ QTest::addColumn<QString>("expectedError");
+ QTest::addColumn<QStringList>("expectedWarnings");
+
+ QTest::newRow("import QtQml of correct version (2.0)")
+ << testFileUrl("qtqmlModule.1.qml")
+ << QString()
+ << QStringList();
+
+ QTest::newRow("import QtQml of incorrect version (3.0)")
+ << testFileUrl("qtqmlModule.2.qml")
+ << QString(testFileUrl("qtqmlModule.2.qml").toString() + QLatin1String(":1 module \"QtQml\" version 3.0 is not installed\n"))
+ << QStringList();
+
+ QTest::newRow("import QtQml of incorrect version (1.0)")
+ << testFileUrl("qtqmlModule.3.qml")
+ << QString(testFileUrl("qtqmlModule.3.qml").toString() + QLatin1String(":1 module \"QtQml\" version 1.0 is not installed\n"))
+ << QStringList();
+
+ QTest::newRow("import QtQml of incorrect version (2.5)")
+ << testFileUrl("qtqmlModule.4.qml")
+ << QString(testFileUrl("qtqmlModule.4.qml").toString() + QLatin1String(":1 module \"QtQml\" version 2.5 is not installed\n"))
+ << QStringList();
+
+ QTest::newRow("QtQml 2.0 module provides Component, QtObject, Connections, Binding and Timer")
+ << testFileUrl("qtqmlModule.5.qml")
+ << QString()
+ << QStringList();
+
+ QTest::newRow("can import QtQml then QtQuick")
+ << testFileUrl("qtqmlModule.6.qml")
+ << QString()
+ << QStringList();
+
+ QTest::newRow("can import QtQuick then QtQml")
+ << testFileUrl("qtqmlModule.7.qml")
+ << QString()
+ << QStringList();
+
+ QTest::newRow("no import results in no QtObject availability")
+ << testFileUrl("qtqmlModule.8.qml")
+ << QString(testFileUrl("qtqmlModule.8.qml").toString() + QLatin1String(":4 QtObject is not a type\n"))
+ << QStringList();
+
+ QTest::newRow("importing QtQml only results in no Item availability")
+ << testFileUrl("qtqmlModule.9.qml")
+ << QString(testFileUrl("qtqmlModule.9.qml").toString() + QLatin1String(":4 Item is not a type\n"))
+ << QStringList();
+}
+
+// Test that the engine registers the QtQml module
+void tst_qqmlengine::qtqmlModule()
+{
+ QFETCH(QUrl, testFile);
+ QFETCH(QString, expectedError);
+ QFETCH(QStringList, expectedWarnings);
+
+ foreach (const QString &w, expectedWarnings)
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w));
+
+ QQmlEngine e;
+ QQmlComponent c(&e, testFile);
+ if (expectedError.isEmpty()) {
+ QObject *o = c.create();
+ QVERIFY(o);
+ delete o;
+ } else {
+ QCOMPARE(c.errorString(), expectedError);
+ }
+}
+
+QTEST_MAIN(tst_qqmlengine)
+
+#include "tst_qqmlengine.moc"
diff --git a/tests/auto/qml/qqmlerror/.gitattributes b/tests/auto/qml/qqmlerror/.gitattributes
new file mode 100644
index 0000000000..f50af65222
--- /dev/null
+++ b/tests/auto/qml/qqmlerror/.gitattributes
@@ -0,0 +1 @@
+data/test.txt eol=lf
diff --git a/tests/auto/qml/qqmlerror/data/test.txt b/tests/auto/qml/qqmlerror/data/test.txt
new file mode 100644
index 0000000000..cdafd9ed82
--- /dev/null
+++ b/tests/auto/qml/qqmlerror/data/test.txt
@@ -0,0 +1,3 @@
+Line Content
+Line2 Content
+Line3 Content
diff --git a/tests/auto/qml/qqmlerror/qqmlerror.pro b/tests/auto/qml/qqmlerror/qqmlerror.pro
new file mode 100644
index 0000000000..5339f8740b
--- /dev/null
+++ b/tests/auto/qml/qqmlerror/qqmlerror.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlerror
+SOURCES += tst_qqmlerror.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+CONFIG += parallel_test
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
new file mode 100644
index 0000000000..6f24210823
--- /dev/null
+++ b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
@@ -0,0 +1,243 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlError>
+#include <QDebug>
+#include "../../shared/util.h"
+
+class tst_qqmlerror : public QQmlDataTest
+{
+ Q_OBJECT
+private slots:
+ void url();
+ void description();
+ void line();
+ void column();
+ void toString();
+
+ void copy();
+ void debug();
+};
+
+void tst_qqmlerror::url()
+{
+ QQmlError error;
+
+ QCOMPARE(error.url(), QUrl());
+
+ error.setUrl(QUrl("http://www.nokia.com/main.qml"));
+
+ QCOMPARE(error.url(), QUrl("http://www.nokia.com/main.qml"));
+
+ QQmlError error2 = error;
+
+ QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml"));
+
+ error.setUrl(QUrl("http://qt.nokia.com/main.qml"));
+
+ QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml"));
+ QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml"));
+}
+
+void tst_qqmlerror::description()
+{
+ QQmlError error;
+
+ QCOMPARE(error.description(), QString());
+
+ error.setDescription("An Error");
+
+ QCOMPARE(error.description(), QString("An Error"));
+
+ QQmlError error2 = error;
+
+ QCOMPARE(error2.description(), QString("An Error"));
+
+ error.setDescription("Another Error");
+
+ QCOMPARE(error.description(), QString("Another Error"));
+ QCOMPARE(error2.description(), QString("An Error"));
+}
+
+void tst_qqmlerror::line()
+{
+ QQmlError error;
+
+ QCOMPARE(error.line(), -1);
+
+ error.setLine(102);
+
+ QCOMPARE(error.line(), 102);
+
+ QQmlError error2 = error;
+
+ QCOMPARE(error2.line(), 102);
+
+ error.setLine(4);
+
+ QCOMPARE(error.line(), 4);
+ QCOMPARE(error2.line(), 102);
+}
+
+void tst_qqmlerror::column()
+{
+ QQmlError error;
+
+ QCOMPARE(error.column(), -1);
+
+ error.setColumn(16);
+
+ QCOMPARE(error.column(), 16);
+
+ QQmlError error2 = error;
+
+ QCOMPARE(error2.column(), 16);
+
+ error.setColumn(3);
+
+ QCOMPARE(error.column(), 3);
+ QCOMPARE(error2.column(), 16);
+}
+
+void tst_qqmlerror::toString()
+{
+ {
+ QQmlError error;
+ error.setUrl(QUrl("http://www.nokia.com/main.qml"));
+ error.setDescription("An Error");
+ error.setLine(92);
+ error.setColumn(13);
+
+ QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92:13: An Error"));
+ }
+
+ {
+ QQmlError error;
+ error.setUrl(QUrl("http://www.nokia.com/main.qml"));
+ error.setDescription("An Error");
+ error.setLine(92);
+
+ QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92: An Error"));
+ }
+}
+
+void tst_qqmlerror::copy()
+{
+ QQmlError error;
+ error.setUrl(QUrl("http://www.nokia.com/main.qml"));
+ error.setDescription("An Error");
+ error.setLine(92);
+ error.setColumn(13);
+
+ QQmlError error2(error);
+ QQmlError error3;
+ error3 = error;
+
+ error.setUrl(QUrl("http://qt.nokia.com/main.qml"));
+ error.setDescription("Another Error");
+ error.setLine(2);
+ error.setColumn(33);
+
+ QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml"));
+ QCOMPARE(error.description(), QString("Another Error"));
+ QCOMPARE(error.line(), 2);
+ QCOMPARE(error.column(), 33);
+
+ QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml"));
+ QCOMPARE(error2.description(), QString("An Error"));
+ QCOMPARE(error2.line(), 92);
+ QCOMPARE(error2.column(), 13);
+
+ QCOMPARE(error3.url(), QUrl("http://www.nokia.com/main.qml"));
+ QCOMPARE(error3.description(), QString("An Error"));
+ QCOMPARE(error3.line(), 92);
+ QCOMPARE(error3.column(), 13);
+
+}
+
+void tst_qqmlerror::debug()
+{
+ {
+ QQmlError error;
+ error.setUrl(QUrl("http://www.nokia.com/main.qml"));
+ error.setDescription("An Error");
+ error.setLine(92);
+ error.setColumn(13);
+
+ QTest::ignoreMessage(QtWarningMsg, "http://www.nokia.com/main.qml:92:13: An Error ");
+ qWarning() << error;
+ }
+
+ {
+ QUrl url(dataDirectoryUrl().resolved(QUrl("test.txt")));
+ QQmlError error;
+ error.setUrl(url);
+ error.setDescription("An Error");
+ error.setLine(2);
+ error.setColumn(5);
+
+ QString out = url.toString() + ":2:5: An Error \n Line2 Content \n ^ ";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(out));
+
+ qWarning() << error;
+ }
+
+ {
+ QUrl url(dataDirectoryUrl().resolved(QUrl("foo.txt")));
+ QQmlError error;
+ error.setUrl(url);
+ error.setDescription("An Error");
+ error.setLine(2);
+ error.setColumn(5);
+
+ QString out = url.toString() + ":2:5: An Error ";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(out));
+
+ qWarning() << error;
+ }
+}
+
+
+
+QTEST_MAIN(tst_qqmlerror)
+
+#include "tst_qqmlerror.moc"
diff --git a/tests/auto/qml/qqmlexpression/data/scriptString.qml b/tests/auto/qml/qqmlexpression/data/scriptString.qml
new file mode 100644
index 0000000000..38c3d1b456
--- /dev/null
+++ b/tests/auto/qml/qqmlexpression/data/scriptString.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Test 1.0
+
+TestObject {
+ property int value1: 10
+ property int value2: 5
+ scriptString: value1 + value2
+ scriptStringError: value3 * 5
+}
diff --git a/tests/auto/qml/qqmlexpression/qqmlexpression.pro b/tests/auto/qml/qqmlexpression/qqmlexpression.pro
new file mode 100644
index 0000000000..45545b084e
--- /dev/null
+++ b/tests/auto/qml/qqmlexpression/qqmlexpression.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlexpression
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlexpression.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
new file mode 100644
index 0000000000..b137623e61
--- /dev/null
+++ b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlscriptstring.h>
+#include "../../shared/util.h"
+
+class tst_qqmlexpression : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlexpression() {}
+
+private slots:
+ void scriptString();
+ void syntaxError();
+};
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlScriptString scriptString READ scriptString WRITE setScriptString)
+ Q_PROPERTY(QQmlScriptString scriptStringError READ scriptStringError WRITE setScriptStringError)
+public:
+ TestObject(QObject *parent = 0) : QObject(parent) {}
+
+ QQmlScriptString scriptString() const { return m_scriptString; }
+ void setScriptString(QQmlScriptString scriptString) { m_scriptString = scriptString; }
+
+ QQmlScriptString scriptStringError() const { return m_scriptStringError; }
+ void setScriptStringError(QQmlScriptString scriptString) { m_scriptStringError = scriptString; }
+
+private:
+ QQmlScriptString m_scriptString;
+ QQmlScriptString m_scriptStringError;
+};
+
+QML_DECLARE_TYPE(TestObject)
+
+void tst_qqmlexpression::scriptString()
+{
+ qmlRegisterType<TestObject>("Test", 1, 0, "TestObject");
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("scriptString.qml"));
+ TestObject *testObj = qobject_cast<TestObject*>(c.create());
+ QVERIFY(testObj != 0);
+
+ QQmlScriptString script = testObj->scriptString();
+ QVERIFY(!script.isEmpty());
+
+ QQmlExpression expression(script);
+ QVariant value = expression.evaluate();
+ QCOMPARE(value.toInt(), 15);
+
+ QQmlScriptString scriptError = testObj->scriptStringError();
+ QVERIFY(!scriptError.isEmpty());
+
+ //verify that the expression has the correct error location information
+ QQmlExpression expressionError(scriptError);
+ QVariant valueError = expressionError.evaluate();
+ QVERIFY(!valueError.isValid());
+ QVERIFY(expressionError.hasError());
+ QQmlError error = expressionError.error();
+ QCOMPARE(error.url(), c.url());
+ QCOMPARE(error.line(), 8);
+}
+
+// QTBUG-21310 - crash test
+void tst_qqmlexpression::syntaxError()
+{
+ QQmlEngine engine;
+ QQmlExpression expression(engine.rootContext(), 0, "asd asd");
+ QVariant v = expression.evaluate();
+ QCOMPARE(v, QVariant());
+}
+
+QTEST_MAIN(tst_qqmlexpression)
+
+#include "tst_qqmlexpression.moc"
diff --git a/tests/auto/qml/qqmlglobal/qqmlglobal.pro b/tests/auto/qml/qqmlglobal/qqmlglobal.pro
new file mode 100644
index 0000000000..2715b44fad
--- /dev/null
+++ b/tests/auto/qml/qqmlglobal/qqmlglobal.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+TARGET = tst_qqmlglobal
+SOURCES += tst_qqmlglobal.cpp
+macx:CONFIG -= app_bundle
+
+CONFIG += parallel_test
+QT += qml-private testlib v8-private core-private gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
new file mode 100644
index 0000000000..793da64734
--- /dev/null
+++ b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <qqml.h>
+
+#include <private/qqmlglobal_p.h>
+
+class tst_qqmlglobal : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qqmlglobal() {}
+
+private slots:
+ void initTestCase();
+
+ void colorProviderWarning();
+ void noGuiProviderWarning();
+};
+
+void tst_qqmlglobal::initTestCase()
+{
+}
+
+void tst_qqmlglobal::colorProviderWarning()
+{
+ const QLatin1String expected("Warning: QQml_colorProvider: no color provider has been set! ");
+ QTest::ignoreMessage(QtWarningMsg, expected.data());
+ QQml_colorProvider();
+}
+
+void tst_qqmlglobal::noGuiProviderWarning()
+{
+ QVERIFY(QQml_guiProvider()); //No GUI provider, so a default non-zero application instance is returned.
+}
+
+QTEST_MAIN(tst_qqmlglobal)
+
+#include "tst_qqmlglobal.moc"
diff --git a/tests/auto/qml/qqmlincubator/data/AsynchronousIfNestedType.qml b/tests/auto/qml/qqmlincubator/data/AsynchronousIfNestedType.qml
new file mode 100644
index 0000000000..8a3f46ee72
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/AsynchronousIfNestedType.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+SelfRegistering {
+ property int dummy1: 11
+ property int dummy2: 19
+}
+
diff --git a/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.1.qml b/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.1.qml
new file mode 100644
index 0000000000..18ff4aabb7
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a: 10
+}
diff --git a/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.2.qml b/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.2.qml
new file mode 100644
index 0000000000..3f6cd932de
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject o: AsynchronousIfNestedType { }
+ property int dummy: 11
+}
diff --git a/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.3.qml b/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.3.qml
new file mode 100644
index 0000000000..7e5ee7cf5c
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/asynchronousIfNested.3.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+CallbackRegistering {
+ value: 19
+}
diff --git a/tests/auto/qml/qqmlincubator/data/chainInCompletion.qml b/tests/auto/qml/qqmlincubator/data/chainInCompletion.qml
new file mode 100644
index 0000000000..e79fed356a
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/chainInCompletion.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+SelfRegistering {
+ property variant a: CompletionCallback {}
+}
diff --git a/tests/auto/qml/qqmlincubator/data/chainedAsynchronousIfNested.qml b/tests/auto/qml/qqmlincubator/data/chainedAsynchronousIfNested.qml
new file mode 100644
index 0000000000..1300426cfa
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/chainedAsynchronousIfNested.qml
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+SelfRegistering {
+ property int dummy: 10
+}
diff --git a/tests/auto/qml/qqmlincubator/data/clear.qml b/tests/auto/qml/qqmlincubator/data/clear.qml
new file mode 100644
index 0000000000..f00f975923
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/clear.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ SelfRegistering {
+ value: 11
+ }
+}
diff --git a/tests/auto/qml/qqmlincubator/data/clearDuringCompletion.qml b/tests/auto/qml/qqmlincubator/data/clearDuringCompletion.qml
new file mode 100644
index 0000000000..556f460d58
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/clearDuringCompletion.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+SelfRegistering {
+ property variant a: CompletionRegistering {}
+ property variant b: CompletionRegistering {}
+}
diff --git a/tests/auto/qml/qqmlincubator/data/contextDelete.qml b/tests/auto/qml/qqmlincubator/data/contextDelete.qml
new file mode 100644
index 0000000000..c3952074f1
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/contextDelete.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int dummy: 12
+}
diff --git a/tests/auto/qml/qqmlincubator/data/forceCompletion.qml b/tests/auto/qml/qqmlincubator/data/forceCompletion.qml
new file mode 100644
index 0000000000..9b76701c1b
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/forceCompletion.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ property int testValue: 3499
+ SelfRegistering {
+ property int testValue2: 19
+ }
+}
diff --git a/tests/auto/qml/qqmlincubator/data/nestedComponent.js b/tests/auto/qml/qqmlincubator/data/nestedComponent.js
new file mode 100644
index 0000000000..4b6b0bde43
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/nestedComponent.js
@@ -0,0 +1 @@
+var value = 19988
diff --git a/tests/auto/qml/qqmlincubator/data/nestedComponent.qml b/tests/auto/qml/qqmlincubator/data/nestedComponent.qml
new file mode 100644
index 0000000000..dd20707456
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/nestedComponent.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+import "nestedComponent.js" as NestedJS
+
+QtObject {
+ property Component c: Component {
+ QtObject {
+ property int value: NestedJS.value
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlincubator/data/noIncubationController.qml b/tests/auto/qml/qqmlincubator/data/noIncubationController.qml
new file mode 100644
index 0000000000..7d93e856f0
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/noIncubationController.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int testValue: 1913
+}
diff --git a/tests/auto/qml/qqmlincubator/data/objectDeleted.errors.txt b/tests/auto/qml/qqmlincubator/data/objectDeleted.errors.txt
new file mode 100644
index 0000000000..eeda289d35
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/objectDeleted.errors.txt
@@ -0,0 +1 @@
+-1:-1:Object destroyed during incubation
diff --git a/tests/auto/qml/qqmlincubator/data/objectDeleted.qml b/tests/auto/qml/qqmlincubator/data/objectDeleted.qml
new file mode 100644
index 0000000000..f00f975923
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/objectDeleted.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ SelfRegistering {
+ value: 11
+ }
+}
diff --git a/tests/auto/qml/qqmlincubator/data/recursiveClear.1.qml b/tests/auto/qml/qqmlincubator/data/recursiveClear.1.qml
new file mode 100644
index 0000000000..748a3f0cbf
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/recursiveClear.1.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "switchMe"
+ signal switchMe
+ width: 100; height: 100
+ color: "green"
+ Component.onCompleted: switchMe()
+}
diff --git a/tests/auto/qml/qqmlincubator/data/recursiveClear.2.qml b/tests/auto/qml/qqmlincubator/data/recursiveClear.2.qml
new file mode 100644
index 0000000000..e96ac00f21
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/recursiveClear.2.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "blue"
+ width: 100
+ height: 100
+ color: "blue"
+}
diff --git a/tests/auto/qml/qqmlincubator/data/selfDelete.qml b/tests/auto/qml/qqmlincubator/data/selfDelete.qml
new file mode 100644
index 0000000000..c3952074f1
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/selfDelete.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int dummy: 12
+}
diff --git a/tests/auto/qml/qqmlincubator/data/setInitialState.qml b/tests/auto/qml/qqmlincubator/data/setInitialState.qml
new file mode 100644
index 0000000000..0fd61abfd2
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/setInitialState.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test1: (testData1 * 32 + 99) / testData2
+ property int test2: myValueFunction()
+
+ property bool myValueFunctionCalled: false
+
+ property int testData1: 19
+ property int testData2: 13
+
+ function myValueFunction() {
+ myValueFunctionCalled = true;
+ return 13;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlincubator/data/statusChanged.nested.qml b/tests/auto/qml/qqmlincubator/data/statusChanged.nested.qml
new file mode 100644
index 0000000000..3a496ea6fe
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/statusChanged.nested.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property bool test: false
+
+ Component.onCompleted: {
+ var c = Qt.createComponent("statusChanged.qml");
+ c.incubateObject(root, null, Qt.Synchronous);
+ }
+}
diff --git a/tests/auto/qml/qqmlincubator/data/statusChanged.qml b/tests/auto/qml/qqmlincubator/data/statusChanged.qml
new file mode 100644
index 0000000000..18ff4aabb7
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/data/statusChanged.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a: 10
+}
diff --git a/tests/auto/qml/qqmlincubator/qqmlincubator.pro b/tests/auto/qml/qqmlincubator/qqmlincubator.pro
new file mode 100644
index 0000000000..780b69f379
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/qqmlincubator.pro
@@ -0,0 +1,17 @@
+CONFIG += testcase
+TARGET = tst_qqmlincubator
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlincubator.cpp \
+ testtypes.cpp
+
+HEADERS += testtypes.h
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlincubator/testtypes.cpp b/tests/auto/qml/qqmlincubator/testtypes.cpp
new file mode 100644
index 0000000000..d926b6ae9b
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/testtypes.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+#include <QtQml/qqml.h>
+
+SelfRegisteringType *SelfRegisteringType::m_me = 0;
+SelfRegisteringType::SelfRegisteringType()
+: m_v(0)
+{
+ m_me = this;
+}
+
+SelfRegisteringType *SelfRegisteringType::me()
+{
+ return m_me;
+}
+
+void SelfRegisteringType::clearMe()
+{
+ m_me = 0;
+}
+
+CompletionRegisteringType *CompletionRegisteringType::m_me = 0;
+CompletionRegisteringType::CompletionRegisteringType()
+{
+}
+
+void CompletionRegisteringType::classBegin()
+{
+}
+
+void CompletionRegisteringType::componentComplete()
+{
+ m_me = this;
+}
+
+CompletionRegisteringType *CompletionRegisteringType::me()
+{
+ return m_me;
+}
+
+void CompletionRegisteringType::clearMe()
+{
+ m_me = 0;
+}
+
+CallbackRegisteringType::callback CallbackRegisteringType::m_callback = 0;
+void *CallbackRegisteringType::m_data = 0;
+CallbackRegisteringType::CallbackRegisteringType()
+: m_v(0)
+{
+}
+
+void CallbackRegisteringType::clearCallback()
+{
+ m_callback = 0;
+ m_data = 0;
+}
+
+void CallbackRegisteringType::registerCallback(callback c, void *d)
+{
+ m_callback = c;
+ m_data = d;
+}
+
+CompletionCallbackType::callback CompletionCallbackType::m_callback = 0;
+void *CompletionCallbackType::m_data = 0;
+CompletionCallbackType::CompletionCallbackType()
+{
+}
+
+void CompletionCallbackType::classBegin()
+{
+}
+
+void CompletionCallbackType::componentComplete()
+{
+ if (m_callback) m_callback(this, m_data);
+}
+
+void CompletionCallbackType::clearCallback()
+{
+ m_callback = 0;
+ m_data = 0;
+}
+
+void CompletionCallbackType::registerCallback(callback c, void *d)
+{
+ m_callback = c;
+ m_data = d;
+}
+
+void registerTypes()
+{
+ qmlRegisterType<SelfRegisteringType>("Qt.test", 1,0, "SelfRegistering");
+ qmlRegisterType<CompletionRegisteringType>("Qt.test", 1,0, "CompletionRegistering");
+ qmlRegisterType<CallbackRegisteringType>("Qt.test", 1,0, "CallbackRegistering");
+ qmlRegisterType<CompletionCallbackType>("Qt.test", 1,0, "CompletionCallback");
+}
diff --git a/tests/auto/qml/qqmlincubator/testtypes.h b/tests/auto/qml/qqmlincubator/testtypes.h
new file mode 100644
index 0000000000..fedff61510
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/testtypes.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QQmlParserStatus>
+
+class SelfRegisteringType : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(int value READ value WRITE setValue);
+public:
+ SelfRegisteringType();
+
+ int value() const { return m_v; }
+ void setValue(int v) { m_v = v; }
+
+ static SelfRegisteringType *me();
+ static void clearMe();
+
+private:
+ static SelfRegisteringType *m_me;
+
+ int m_v;
+};
+
+class CallbackRegisteringType : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(int value READ value WRITE setValue)
+public:
+ CallbackRegisteringType();
+
+ int value() const { return m_v; }
+ void setValue(int v) { if (m_callback) m_callback(this, m_data); m_v = v; }
+
+ typedef void (*callback)(CallbackRegisteringType *, void *);
+ static void clearCallback();
+ static void registerCallback(callback, void *);
+
+private:
+ static callback m_callback;
+ static void *m_data;
+
+ int m_v;
+};
+
+class CompletionRegisteringType : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+public:
+ CompletionRegisteringType();
+
+ virtual void classBegin();
+ virtual void componentComplete();
+
+ static CompletionRegisteringType *me();
+ static void clearMe();
+
+private:
+ static CompletionRegisteringType *m_me;
+};
+
+class CompletionCallbackType : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+public:
+ CompletionCallbackType();
+
+ virtual void classBegin();
+ virtual void componentComplete();
+
+ typedef void (*callback)(CompletionCallbackType *, void *);
+ static void clearCallback();
+ static void registerCallback(callback, void *);
+
+private:
+ static callback m_callback;
+ static void *m_data;
+};
+
+void registerTypes();
+
+#endif // TESTTYPES_H
diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
new file mode 100644
index 0000000000..ce3710f530
--- /dev/null
+++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp
@@ -0,0 +1,1147 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+
+#include <QUrl>
+#include <QDir>
+#include <QDebug>
+#include <qtest.h>
+#include <QPointer>
+#include <QFileInfo>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QQmlProperty>
+#include <QQmlComponent>
+#include <QQmlIncubator>
+#include "../../shared/util.h"
+
+class tst_qqmlincubator : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlincubator() {}
+
+private slots:
+ void initTestCase();
+
+ void incubationMode();
+ void objectDeleted();
+ void clear();
+ void noIncubationController();
+ void forceCompletion();
+ void setInitialState();
+ void clearDuringCompletion();
+ void objectDeletionAfterInit();
+ void recursiveClear();
+ void statusChanged();
+ void asynchronousIfNested();
+ void nestedComponent();
+ void chainedAsynchronousIfNested();
+ void chainedAsynchronousIfNestedOnCompleted();
+ void chainedAsynchronousClear();
+ void selfDelete();
+ void contextDelete();
+
+private:
+ QQmlIncubationController controller;
+ QQmlEngine engine;
+};
+
+#define VERIFY_ERRORS(component, errorfile) \
+ if (!errorfile) { \
+ if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \
+ qWarning() << "Unexpected Errors:" << component.errors(); \
+ QVERIFY(!component.isError()); \
+ QVERIFY(component.errors().isEmpty()); \
+ } else { \
+ QFile file(QQmlDataTest::instance()->testFile(errorfile)); \
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
+ QByteArray data = file.readAll(); \
+ file.close(); \
+ QList<QByteArray> expected = data.split('\n'); \
+ expected.removeAll(QByteArray("")); \
+ QList<QQmlError> errors = component.errors(); \
+ QList<QByteArray> actual; \
+ for (int ii = 0; ii < errors.count(); ++ii) { \
+ const QQmlError &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); \
+ }
+
+void tst_qqmlincubator::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ registerTypes();
+ engine.setIncubationController(&controller);
+}
+
+void tst_qqmlincubator::incubationMode()
+{
+ {
+ QQmlIncubator incubator;
+ QCOMPARE(incubator.incubationMode(), QQmlIncubator::Asynchronous);
+ }
+ {
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ QCOMPARE(incubator.incubationMode(), QQmlIncubator::Asynchronous);
+ }
+ {
+ QQmlIncubator incubator(QQmlIncubator::Synchronous);
+ QCOMPARE(incubator.incubationMode(), QQmlIncubator::Synchronous);
+ }
+ {
+ QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested);
+ QCOMPARE(incubator.incubationMode(), QQmlIncubator::AsynchronousIfNested);
+ }
+}
+
+void tst_qqmlincubator::objectDeleted()
+{
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("objectDeleted.qml"));
+ QVERIFY(component.isReady());
+
+ QQmlIncubator incubator;
+ component.create(incubator);
+
+ QCOMPARE(incubator.status(), QQmlIncubator::Loading);
+ QVERIFY(SelfRegisteringType::me() == 0);
+
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ delete SelfRegisteringType::me();
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isError());
+ VERIFY_ERRORS(incubator, "objectDeleted.errors.txt");
+ QVERIFY(incubator.object() == 0);
+}
+
+void tst_qqmlincubator::clear()
+{
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("clear.qml"));
+ QVERIFY(component.isReady());
+
+ // Clear in null state
+ {
+ QQmlIncubator incubator;
+ QVERIFY(incubator.isNull());
+ incubator.clear(); // no effect
+ QVERIFY(incubator.isNull());
+ }
+
+ // Clear in loading state
+ {
+ QQmlIncubator incubator;
+ component.create(incubator);
+ QVERIFY(incubator.isLoading());
+ incubator.clear();
+ QVERIFY(incubator.isNull());
+ }
+
+ // Clear mid load
+ {
+ QQmlIncubator incubator;
+ component.create(incubator);
+
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QPointer<SelfRegisteringType> srt = SelfRegisteringType::me();
+
+ incubator.clear();
+ QVERIFY(incubator.isNull());
+ QVERIFY(srt.isNull());
+ }
+
+ // Clear in ready state
+ {
+ QQmlIncubator incubator;
+ component.create(incubator);
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object() != 0);
+ QPointer<QObject> obj = incubator.object();
+
+ incubator.clear();
+ QVERIFY(incubator.isNull());
+ QVERIFY(incubator.object() == 0);
+ QVERIFY(!obj.isNull());
+
+ delete obj;
+ QVERIFY(obj.isNull());
+ }
+}
+
+void tst_qqmlincubator::noIncubationController()
+{
+ // All incubators should behave synchronously when there is no controller
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("noIncubationController.qml"));
+
+ QVERIFY(component.isReady());
+
+ {
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object());
+ QCOMPARE(incubator.object()->property("testValue").toInt(), 1913);
+ delete incubator.object();
+ }
+
+ {
+ QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested);
+ component.create(incubator);
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object());
+ QCOMPARE(incubator.object()->property("testValue").toInt(), 1913);
+ delete incubator.object();
+ }
+
+ {
+ QQmlIncubator incubator(QQmlIncubator::Synchronous);
+ component.create(incubator);
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object());
+ QCOMPARE(incubator.object()->property("testValue").toInt(), 1913);
+ delete incubator.object();
+ }
+}
+
+void tst_qqmlincubator::forceCompletion()
+{
+ QQmlComponent component(&engine, testFileUrl("forceCompletion.qml"));
+ QVERIFY(component.isReady());
+
+ {
+ // forceCompletion on a null incubator does nothing
+ QQmlIncubator incubator;
+ QVERIFY(incubator.isNull());
+ incubator.forceCompletion();
+ QVERIFY(incubator.isNull());
+ }
+
+ {
+ // forceCompletion immediately after creating an asynchronous object completes it
+ QQmlIncubator incubator;
+ QVERIFY(incubator.isNull());
+ component.create(incubator);
+ QVERIFY(incubator.isLoading());
+
+ incubator.forceCompletion();
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object() != 0);
+ QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
+
+ delete incubator.object();
+ }
+
+ {
+ // forceCompletion during creation completes it
+ SelfRegisteringType::clearMe();
+
+ QQmlIncubator incubator;
+ QVERIFY(incubator.isNull());
+ component.create(incubator);
+ QVERIFY(incubator.isLoading());
+
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ incubator.forceCompletion();
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object() != 0);
+ QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
+
+ delete incubator.object();
+ }
+
+ {
+ // forceCompletion on a ready incubator has no effect
+ QQmlIncubator incubator;
+ QVERIFY(incubator.isNull());
+ component.create(incubator);
+ QVERIFY(incubator.isLoading());
+
+ incubator.forceCompletion();
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object() != 0);
+ QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
+
+ incubator.forceCompletion();
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object() != 0);
+ QCOMPARE(incubator.object()->property("testValue").toInt(), 3499);
+
+ delete incubator.object();
+ }
+}
+
+void tst_qqmlincubator::setInitialState()
+{
+ QQmlComponent component(&engine, testFileUrl("setInitialState.qml"));
+ QVERIFY(component.isReady());
+
+ struct MyIncubator : public QQmlIncubator
+ {
+ MyIncubator(QQmlIncubator::IncubationMode mode)
+ : QQmlIncubator(mode) {}
+
+ virtual void setInitialState(QObject *o) {
+ QQmlProperty::write(o, "test2", 19);
+ QQmlProperty::write(o, "testData1", 201);
+ }
+ };
+
+ {
+ MyIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+ QVERIFY(incubator.isLoading());
+ bool b = true;
+ controller.incubateWhile(&b);
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object());
+ QCOMPARE(incubator.object()->property("myValueFunctionCalled").toBool(), false);
+ QCOMPARE(incubator.object()->property("test1").toInt(), 502);
+ QCOMPARE(incubator.object()->property("test2").toInt(), 19);
+ delete incubator.object();
+ }
+
+ {
+ MyIncubator incubator(QQmlIncubator::Synchronous);
+ component.create(incubator);
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object());
+ QCOMPARE(incubator.object()->property("myValueFunctionCalled").toBool(), false);
+ QCOMPARE(incubator.object()->property("test1").toInt(), 502);
+ QCOMPARE(incubator.object()->property("test2").toInt(), 19);
+ delete incubator.object();
+ }
+}
+
+void tst_qqmlincubator::clearDuringCompletion()
+{
+ CompletionRegisteringType::clearMe();
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("clearDuringCompletion.qml"));
+ QVERIFY(component.isReady());
+
+ QQmlIncubator incubator;
+ component.create(incubator);
+
+ QCOMPARE(incubator.status(), QQmlIncubator::Loading);
+ QVERIFY(CompletionRegisteringType::me() == 0);
+
+ while (CompletionRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(CompletionRegisteringType::me() != 0);
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ QPointer<QObject> srt = SelfRegisteringType::me();
+
+ incubator.clear();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QVERIFY(incubator.isNull());
+ QVERIFY(srt.isNull());
+}
+
+void tst_qqmlincubator::objectDeletionAfterInit()
+{
+ QQmlComponent component(&engine, testFileUrl("clear.qml"));
+ QVERIFY(component.isReady());
+
+ struct MyIncubator : public QQmlIncubator
+ {
+ MyIncubator(QQmlIncubator::IncubationMode mode)
+ : QQmlIncubator(mode), obj(0) {}
+
+ virtual void setInitialState(QObject *o) {
+ obj = o;
+ }
+
+ QObject *obj;
+ };
+
+ SelfRegisteringType::clearMe();
+ MyIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ while (!incubator.obj && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(SelfRegisteringType::me() != 0);
+
+ delete incubator.obj;
+
+ incubator.clear();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QVERIFY(incubator.isNull());
+}
+
+class Switcher : public QObject
+{
+ Q_OBJECT
+public:
+ Switcher(QQmlEngine *e) : QObject(), engine(e) { }
+
+ struct MyIncubator : public QQmlIncubator
+ {
+ MyIncubator(QQmlIncubator::IncubationMode mode, QObject *s)
+ : QQmlIncubator(mode), switcher(s) {}
+
+ virtual void setInitialState(QObject *o) {
+ if (o->objectName() == "switchMe")
+ connect(o, SIGNAL(switchMe()), switcher, SLOT(switchIt()));
+ }
+
+ QObject *switcher;
+ };
+
+ void start()
+ {
+ incubator = new MyIncubator(QQmlIncubator::Synchronous, this);
+ component = new QQmlComponent(engine, QQmlDataTest::instance()->testFileUrl("recursiveClear.1.qml"));
+ component->create(*incubator);
+ }
+
+ QQmlEngine *engine;
+ MyIncubator *incubator;
+ QQmlComponent *component;
+
+public slots:
+ void switchIt() {
+ component->deleteLater();
+ incubator->clear();
+ component = new QQmlComponent(engine, QQmlDataTest::instance()->testFileUrl("recursiveClear.2.qml"));
+ component->create(*incubator);
+ }
+};
+
+void tst_qqmlincubator::recursiveClear()
+{
+ Switcher switcher(&engine);
+ switcher.start();
+}
+
+void tst_qqmlincubator::statusChanged()
+{
+ class MyIncubator : public QQmlIncubator
+ {
+ public:
+ MyIncubator(QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous)
+ : QQmlIncubator(mode) {}
+
+ QList<int> statuses;
+ protected:
+ virtual void statusChanged(Status s) { statuses << s; }
+ virtual void setInitialState(QObject *) { statuses << -1; }
+ };
+
+ {
+ QQmlComponent component(&engine, testFileUrl("statusChanged.qml"));
+ QVERIFY(component.isReady());
+
+ MyIncubator incubator(QQmlIncubator::Synchronous);
+ component.create(incubator);
+ QVERIFY(incubator.isReady());
+ QCOMPARE(incubator.statuses.count(), 3);
+ QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading));
+ QCOMPARE(incubator.statuses.at(1), -1);
+ QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready));
+ delete incubator.object();
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("statusChanged.qml"));
+ QVERIFY(component.isReady());
+
+ MyIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+ QVERIFY(incubator.isLoading());
+ QCOMPARE(incubator.statuses.count(), 1);
+ QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading));
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QCOMPARE(incubator.statuses.count(), 3);
+ QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading));
+ QCOMPARE(incubator.statuses.at(1), -1);
+ QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready));
+ delete incubator.object();
+ }
+
+ {
+ QQmlComponent component2(&engine, testFileUrl("statusChanged.nested.qml"));
+ QVERIFY(component2.isReady());
+
+ MyIncubator incubator(QQmlIncubator::Asynchronous);
+ component2.create(incubator);
+ QVERIFY(incubator.isLoading());
+ QCOMPARE(incubator.statuses.count(), 1);
+ QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading));
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isReady());
+ QCOMPARE(incubator.statuses.count(), 3);
+ QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading));
+ QCOMPARE(incubator.statuses.at(1), -1);
+ QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready));
+ delete incubator.object();
+ }
+}
+
+void tst_qqmlincubator::asynchronousIfNested()
+{
+ // Asynchronous if nested within a finalized context behaves synchronously
+ {
+ QQmlComponent component(&engine, testFileUrl("asynchronousIfNested.1.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("a").toInt(), 10);
+
+ QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested);
+ component.create(incubator, 0, qmlContext(object));
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object());
+ QCOMPARE(incubator.object()->property("a").toInt(), 10);
+ delete incubator.object();
+ delete object;
+ }
+
+ // Asynchronous if nested within an executing context behaves asynchronously, but prevents
+ // the parent from finishing
+ {
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("asynchronousIfNested.2.qml"));
+ QVERIFY(component.isReady());
+
+ QQmlIncubator incubator;
+ component.create(incubator);
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(SelfRegisteringType::me() == 0);
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ QQmlIncubator nested(QQmlIncubator::AsynchronousIfNested);
+ component.create(nested, 0, qmlContext(SelfRegisteringType::me()));
+ QVERIFY(nested.isLoading());
+
+ while (nested.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(nested.isReady());
+ QVERIFY(incubator.isLoading());
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(nested.isReady());
+ QVERIFY(incubator.isReady());
+
+ delete nested.object();
+ delete incubator.object();
+ }
+
+ // AsynchronousIfNested within a synchronous AsynchronousIfNested behaves synchronously
+ {
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("asynchronousIfNested.3.qml"));
+ QVERIFY(component.isReady());
+
+ struct CallbackData {
+ CallbackData(QQmlEngine *e) : engine(e), pass(false) {}
+ QQmlEngine *engine;
+ bool pass;
+ static void callback(CallbackRegisteringType *o, void *data) {
+ CallbackData *d = (CallbackData *)data;
+
+ QQmlComponent c(d->engine, QQmlDataTest::instance()->testFileUrl("asynchronousIfNested.1.qml"));
+ if (!c.isReady()) return;
+
+ QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested);
+ c.create(incubator, 0, qmlContext(o));
+
+ if (!incubator.isReady()) return;
+
+ if (incubator.object()->property("a").toInt() != 10) return;
+
+ d->pass = true;
+ }
+ };
+
+ CallbackData cd(&engine);
+ CallbackRegisteringType::registerCallback(&CallbackData::callback, &cd);
+
+ QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested);
+ component.create(incubator);
+
+ QVERIFY(incubator.isReady());
+ QCOMPARE(cd.pass, true);
+
+ delete incubator.object();
+ }
+}
+
+void tst_qqmlincubator::nestedComponent()
+{
+ QQmlComponent component(&engine, testFileUrl("nestedComponent.qml"));
+ QVERIFY(component.isReady());
+
+ QObject *object = component.create();
+
+ QQmlComponent *nested = object->property("c").value<QQmlComponent*>();
+ QVERIFY(nested);
+ QVERIFY(nested->isReady());
+
+ // Test without incubator
+ {
+ QObject *nestedObject = nested->create();
+ QCOMPARE(nestedObject->property("value").toInt(), 19988);
+ delete nestedObject;
+ }
+
+ // Test with incubator
+ {
+ QQmlIncubator incubator(QQmlIncubator::Synchronous);
+ nested->create(incubator);
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator.object());
+ QCOMPARE(incubator.object()->property("value").toInt(), 19988);
+ delete incubator.object();
+ }
+
+ delete object;
+}
+
+// Checks that a new AsynchronousIfNested incubator can be correctly started in the
+// statusChanged() callback of another.
+void tst_qqmlincubator::chainedAsynchronousIfNested()
+{
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("chainedAsynchronousIfNested.qml"));
+ QVERIFY(component.isReady());
+
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(SelfRegisteringType::me() == 0);
+
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ struct MyIncubator : public QQmlIncubator {
+ MyIncubator(MyIncubator *next, QQmlComponent *component, QQmlContext *ctxt)
+ : QQmlIncubator(AsynchronousIfNested), next(next), component(component), ctxt(ctxt) {}
+
+ protected:
+ virtual void statusChanged(Status s) {
+ if (s == Ready && next)
+ component->create(*next, 0, ctxt);
+ }
+
+ private:
+ MyIncubator *next;
+ QQmlComponent *component;
+ QQmlContext *ctxt;
+ };
+
+ MyIncubator incubator2(0, &component, 0);
+ MyIncubator incubator1(&incubator2, &component, qmlContext(SelfRegisteringType::me()));
+
+ component.create(incubator1, 0, qmlContext(SelfRegisteringType::me()));
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+
+ while (incubator1.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+
+ while (incubator2.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+}
+
+// Checks that new AsynchronousIfNested incubators can be correctly chained if started in
+// componentCompleted().
+void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted()
+{
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("chainInCompletion.qml"));
+ QVERIFY(component.isReady());
+
+ QQmlComponent c1(&engine, testFileUrl("chainedAsynchronousIfNested.qml"));
+ QVERIFY(c1.isReady());
+
+ struct MyIncubator : public QQmlIncubator {
+ MyIncubator(MyIncubator *next, QQmlComponent *component, QQmlContext *ctxt)
+ : QQmlIncubator(AsynchronousIfNested), next(next), component(component), ctxt(ctxt) {}
+
+ protected:
+ virtual void statusChanged(Status s) {
+ if (s == Ready && next) {
+ component->create(*next, 0, ctxt);
+ }
+ }
+
+ private:
+ MyIncubator *next;
+ QQmlComponent *component;
+ QQmlContext *ctxt;
+ };
+
+ struct CallbackData {
+ CallbackData(QQmlComponent *c, MyIncubator *i, QQmlContext *ct)
+ : component(c), incubator(i), ctxt(ct) {}
+ QQmlComponent *component;
+ MyIncubator *incubator;
+ QQmlContext *ctxt;
+ static void callback(CompletionCallbackType *, void *data) {
+ CallbackData *d = (CallbackData *)data;
+ d->component->create(*d->incubator, 0, d->ctxt);
+ }
+ };
+
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(SelfRegisteringType::me() == 0);
+
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ MyIncubator incubator3(0, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator2(&incubator3, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator1(&incubator2, &c1, qmlContext(SelfRegisteringType::me()));
+
+ // start incubator1 in componentComplete
+ CallbackData cd(&c1, &incubator1, qmlContext(SelfRegisteringType::me()));
+ CompletionCallbackType::registerCallback(&CallbackData::callback, &cd);
+
+ while (!incubator1.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ while (incubator1.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+ QVERIFY(incubator3.isNull());
+
+ while (incubator2.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+ QVERIFY(incubator3.isLoading());
+
+ while (incubator3.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+ QVERIFY(incubator3.isLoading());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isReady());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+ QVERIFY(incubator3.isReady());
+}
+
+// Checks that new AsynchronousIfNested incubators can be correctly cleared if started in
+// componentCompleted().
+void tst_qqmlincubator::chainedAsynchronousClear()
+{
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("chainInCompletion.qml"));
+ QVERIFY(component.isReady());
+
+ QQmlComponent c1(&engine, testFileUrl("chainedAsynchronousIfNested.qml"));
+ QVERIFY(c1.isReady());
+
+ struct MyIncubator : public QQmlIncubator {
+ MyIncubator(MyIncubator *next, QQmlComponent *component, QQmlContext *ctxt)
+ : QQmlIncubator(AsynchronousIfNested), next(next), component(component), ctxt(ctxt) {}
+
+ protected:
+ virtual void statusChanged(Status s) {
+ if (s == Ready && next) {
+ component->create(*next, 0, ctxt);
+ }
+ }
+
+ private:
+ MyIncubator *next;
+ QQmlComponent *component;
+ QQmlContext *ctxt;
+ };
+
+ struct CallbackData {
+ CallbackData(QQmlComponent *c, MyIncubator *i, QQmlContext *ct)
+ : component(c), incubator(i), ctxt(ct) {}
+ QQmlComponent *component;
+ MyIncubator *incubator;
+ QQmlContext *ctxt;
+ static void callback(CompletionCallbackType *, void *data) {
+ CallbackData *d = (CallbackData *)data;
+ d->component->create(*d->incubator, 0, d->ctxt);
+ }
+ };
+
+ QQmlIncubator incubator(QQmlIncubator::Asynchronous);
+ component.create(incubator);
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(SelfRegisteringType::me() == 0);
+
+ while (SelfRegisteringType::me() == 0 && incubator.isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator.isLoading());
+
+ MyIncubator incubator3(0, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator2(&incubator3, &c1, qmlContext(SelfRegisteringType::me()));
+ MyIncubator incubator1(&incubator2, &c1, qmlContext(SelfRegisteringType::me()));
+
+ // start incubator1 in componentComplete
+ CallbackData cd(&c1, &incubator1, qmlContext(SelfRegisteringType::me()));
+ CompletionCallbackType::registerCallback(&CallbackData::callback, &cd);
+
+ while (!incubator1.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ while (incubator1.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isLoading());
+ QVERIFY(incubator2.isNull());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+ QVERIFY(incubator3.isNull());
+
+ while (incubator2.isLoading()) {
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isLoading());
+ QVERIFY(incubator3.isNull());
+
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isLoading());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+ QVERIFY(incubator3.isLoading());
+
+ // Any in loading state will become null when cleared.
+ incubator.clear();
+
+ QVERIFY(incubator.isNull());
+ QVERIFY(incubator1.isReady());
+ QVERIFY(incubator2.isReady());
+ QVERIFY(incubator3.isNull());
+}
+
+void tst_qqmlincubator::selfDelete()
+{
+ struct MyIncubator : public QQmlIncubator {
+ MyIncubator(bool *done, Status status, IncubationMode mode)
+ : QQmlIncubator(mode), done(done), status(status) {}
+
+ protected:
+ virtual void statusChanged(Status s) {
+ if (s == status) {
+ *done = true;
+ if (s == Ready) delete object();
+ delete this;
+ }
+ }
+
+ private:
+ bool *done;
+ Status status;
+ };
+
+ {
+ QQmlComponent component(&engine, testFileUrl("selfDelete.qml"));
+
+#define DELETE_TEST(status, mode) { \
+ bool done = false; \
+ component.create(*(new MyIncubator(&done, status, mode))); \
+ bool True = true; \
+ controller.incubateWhile(&True); \
+ QVERIFY(done == true); \
+ }
+
+ DELETE_TEST(QQmlIncubator::Loading, QQmlIncubator::Synchronous);
+ DELETE_TEST(QQmlIncubator::Ready, QQmlIncubator::Synchronous);
+ DELETE_TEST(QQmlIncubator::Loading, QQmlIncubator::Asynchronous);
+ DELETE_TEST(QQmlIncubator::Ready, QQmlIncubator::Asynchronous);
+
+#undef DELETE_TEST
+ }
+
+ // Delete within error status
+ {
+ SelfRegisteringType::clearMe();
+
+ QQmlComponent component(&engine, testFileUrl("objectDeleted.qml"));
+ QVERIFY(component.isReady());
+
+ bool done = false;
+ MyIncubator *incubator = new MyIncubator(&done, QQmlIncubator::Error,
+ QQmlIncubator::Asynchronous);
+ component.create(*incubator);
+
+ QCOMPARE(incubator->QQmlIncubator::status(), QQmlIncubator::Loading);
+ QVERIFY(SelfRegisteringType::me() == 0);
+
+ while (SelfRegisteringType::me() == 0 && incubator->isLoading()) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(SelfRegisteringType::me() != 0);
+ QVERIFY(incubator->isLoading());
+
+ delete SelfRegisteringType::me();
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(done);
+ }
+}
+
+// Test that QML doesn't crash if the context is deleted prior to the incubator
+// first executing.
+void tst_qqmlincubator::contextDelete()
+{
+ QQmlContext *context = new QQmlContext(engine.rootContext());
+ QQmlComponent component(&engine, testFileUrl("contextDelete.qml"));
+
+ QQmlIncubator incubator;
+ component.create(incubator, context);
+
+ delete context;
+
+ {
+ bool b = false;
+ controller.incubateWhile(&b);
+ }
+}
+
+QTEST_MAIN(tst_qqmlincubator)
+
+#include "tst_qqmlincubator.moc"
diff --git a/tests/auto/qml/qqmlinfo/data/NestedComponent.qml b/tests/auto/qml/qqmlinfo/data/NestedComponent.qml
new file mode 100644
index 0000000000..cfe47589df
--- /dev/null
+++ b/tests/auto/qml/qqmlinfo/data/NestedComponent.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant nested
+ property variant nested2: nested.nested
+
+ property variant component
+ component: Component {
+ id: myComponent
+ NestedObject { property string testProp: "test" }
+ }
+
+ property variant component2
+ component2: Component {
+ id: myComponent2
+ Image { property string testProp: "test" }
+ }
+
+ Component.onCompleted: {
+ nested = myComponent.createObject(0);
+ nested2 = myComponent2.createObject(0);
+ }
+}
diff --git a/tests/auto/qml/qqmlinfo/data/NestedObject.qml b/tests/auto/qml/qqmlinfo/data/NestedObject.qml
new file mode 100644
index 0000000000..4b19b11699
--- /dev/null
+++ b/tests/auto/qml/qqmlinfo/data/NestedObject.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant nested
+
+ nested: QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmlinfo/data/nestedQmlObject.qml b/tests/auto/qml/qqmlinfo/data/nestedQmlObject.qml
new file mode 100644
index 0000000000..d199a612c4
--- /dev/null
+++ b/tests/auto/qml/qqmlinfo/data/nestedQmlObject.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant nested
+ nested: NestedObject { }
+ property variant nested2: nested.nested
+}
+
diff --git a/tests/auto/qml/qqmlinfo/data/qmlObject.qml b/tests/auto/qml/qqmlinfo/data/qmlObject.qml
new file mode 100644
index 0000000000..6a8e2fbc90
--- /dev/null
+++ b/tests/auto/qml/qqmlinfo/data/qmlObject.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant nested
+
+ nested: QtObject {
+ }
+}
diff --git a/tests/auto/qml/qqmlinfo/qqmlinfo.pro b/tests/auto/qml/qqmlinfo/qqmlinfo.pro
new file mode 100644
index 0000000000..e813982210
--- /dev/null
+++ b/tests/auto/qml/qqmlinfo/qqmlinfo.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+TARGET = tst_qqmlinfo
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlinfo.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
new file mode 100644
index 0000000000..c0fb13c932
--- /dev/null
+++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QTimer>
+#include <QQmlContext>
+#include <qqmlinfo.h>
+#include "../../shared/util.h"
+
+class tst_qqmlinfo : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlinfo() {}
+
+private slots:
+ void qmlObject();
+ void nestedQmlObject();
+ void nestedComponent();
+ void nonQmlObject();
+ void nullObject();
+ void nonQmlContextedObject();
+ void types();
+ void chaining();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qqmlinfo::qmlObject()
+{
+ QQmlComponent component(&engine, testFileUrl("qmlObject.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QString message = component.url().toString() + ":3:1: QML QtObject: Test Message";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ qmlInfo(object) << "Test Message";
+
+ QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
+ QVERIFY(nested != 0);
+
+ message = component.url().toString() + ":6:13: QML QtObject: Second Test Message";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ qmlInfo(nested) << "Second Test Message";
+}
+
+void tst_qqmlinfo::nestedQmlObject()
+{
+ QQmlComponent component(&engine, testFileUrl("nestedQmlObject.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
+ QVERIFY(nested != 0);
+ QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2"));
+ QVERIFY(nested2 != 0);
+
+ QString message = component.url().toString() + ":5:13: QML NestedObject: Outer Object";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ qmlInfo(nested) << "Outer Object";
+
+ message = testFileUrl("NestedObject.qml").toString() + ":6:14: QML QtObject: Inner Object";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ qmlInfo(nested2) << "Inner Object";
+}
+
+void tst_qqmlinfo::nestedComponent()
+{
+ QQmlComponent component(&engine, testFileUrl("NestedComponent.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
+ QVERIFY(nested != 0);
+ QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2"));
+ QVERIFY(nested2 != 0);
+
+ QString message = component.url().toString() + ":10:9: QML NestedObject: Complex Object";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ qmlInfo(nested) << "Complex Object";
+
+ message = component.url().toString() + ":16:9: QML Image: Simple Object";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ qmlInfo(nested2) << "Simple Object";
+}
+
+void tst_qqmlinfo::nonQmlObject()
+{
+ QObject object;
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
+ qmlInfo(&object) << "Test Message";
+
+ QTimer nonQmlObject;
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QTimer: Test Message");
+ qmlInfo(&nonQmlObject) << "Test Message";
+}
+
+void tst_qqmlinfo::nullObject()
+{
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Null Object Test Message");
+ qmlInfo(0) << "Null Object Test Message";
+}
+
+void tst_qqmlinfo::nonQmlContextedObject()
+{
+ QObject object;
+ QQmlContext context(&engine);
+ QQmlEngine::setContextForObject(&object, &context);
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
+ qmlInfo(&object) << "Test Message";
+}
+
+void tst_qqmlinfo::types()
+{
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false");
+ qmlInfo(0) << false;
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.1");
+ qmlInfo(0) << 1.1;
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 1.2");
+ qmlInfo(0) << 1.2f;
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 15");
+ qmlInfo(0) << 15;
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: 'b'");
+ qmlInfo(0) << QChar('b');
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: \"Qt\"");
+ qmlInfo(0) << QByteArray("Qt");
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: true");
+ qmlInfo(0) << bool(true);
+
+ //### do we actually want QUrl to show up in the output?
+ //### why the extra space at the end?
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QUrl(\"http://qt.nokia.com\") ");
+ qmlInfo(0) << QUrl("http://qt.nokia.com");
+
+ //### should this be quoted?
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: hello");
+ qmlInfo(0) << QLatin1String("hello");
+
+ //### should this be quoted?
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: World");
+ QString str("Hello World");
+ QStringRef ref(&str, 6, 5);
+ qmlInfo(0) << ref;
+
+ //### should this be quoted?
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Quick");
+ qmlInfo(0) << QString ("Quick");
+}
+
+void tst_qqmlinfo::chaining()
+{
+ //### should more of these be automatically inserting spaces?
+ QString str("Hello World");
+ QStringRef ref(&str, 6, 5);
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' QUrl(\"http://qt.nokia.com\") World \"Qt\" true Quick ");
+ qmlInfo(0) << false << ' '
+ << 1.1 << ' '
+ << 1.2f << ' '
+ << 15 << ' '
+ << QLatin1String("hello") << ' '
+ << QChar('b') << ' '
+ << QUrl("http://qt.nokia.com")
+ << ref
+ << QByteArray("Qt")
+ << bool(true)
+ << QString ("Quick");
+}
+
+QTEST_MAIN(tst_qqmlinfo)
+
+#include "tst_qqmlinfo.moc"
diff --git a/tests/auto/qml/qqmlinstantiator/data/createMultiple.qml b/tests/auto/qml/qqmlinstantiator/data/createMultiple.qml
new file mode 100644
index 0000000000..facfadfb50
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/data/createMultiple.qml
@@ -0,0 +1,9 @@
+import QtQml 2.1
+
+Instantiator {
+ model: 10
+ delegate: QtObject {
+ property bool success: true
+ property int idx: index
+ }
+}
diff --git a/tests/auto/qml/qqmlinstantiator/data/createNone.qml b/tests/auto/qml/qqmlinstantiator/data/createNone.qml
new file mode 100644
index 0000000000..275e27c4b6
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/data/createNone.qml
@@ -0,0 +1,12 @@
+import QtQml 2.1
+
+Instantiator {
+ model: 0
+ property bool success: true
+ QtObject {
+ property bool success: true
+ property int idx: index
+ }
+ onObjectChanged: success = false;//Don't create intermediate objects
+ onCountChanged: success = false;//Don't create intermediate objects
+}
diff --git a/tests/auto/qml/qqmlinstantiator/data/createSingle.qml b/tests/auto/qml/qqmlinstantiator/data/createSingle.qml
new file mode 100644
index 0000000000..b04e62eb48
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/data/createSingle.qml
@@ -0,0 +1,8 @@
+import QtQml 2.1
+
+Instantiator {
+ QtObject {
+ property bool success: true
+ property int idx: index
+ }
+}
diff --git a/tests/auto/qml/qqmlinstantiator/data/inactive.qml b/tests/auto/qml/qqmlinstantiator/data/inactive.qml
new file mode 100644
index 0000000000..8f5e21f990
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/data/inactive.qml
@@ -0,0 +1,9 @@
+import QtQml 2.1
+
+Instantiator {
+ active: false
+ QtObject {
+ property bool success: true
+ property int idx: index
+ }
+}
diff --git a/tests/auto/qml/qqmlinstantiator/data/stringModel.qml b/tests/auto/qml/qqmlinstantiator/data/stringModel.qml
new file mode 100644
index 0000000000..ede2705df7
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/data/stringModel.qml
@@ -0,0 +1,9 @@
+import QtQml 2.1
+
+Instantiator {
+ model: ["alpha", "beta", "gamma", "delta"]
+ delegate: QtObject {
+ property bool success: index == 1 ? datum.length == 4 : datum.length == 5
+ property string datum: modelData
+ }
+}
diff --git a/tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro b/tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro
new file mode 100644
index 0000000000..aa83da1509
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/qqmlinstantiator.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qqmlinstantiator
+macx:CONFIG -= app_bundle
+
+INCLUDEPATH += ../../shared/
+SOURCES += tst_qqmlinstantiator.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private testlib
diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
new file mode 100644
index 0000000000..3e90eb2cbe
--- /dev/null
+++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QDebug>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/private/qqmlinstantiator_p.h>
+#include "../../shared/util.h"
+
+class tst_qqmlinstantiator: public QQmlDataTest
+{
+ Q_OBJECT
+
+private slots:
+ void createNone();
+ void createSingle();
+ void createMultiple();
+ void stringModel();
+ void activeProperty();
+ void intModelChange();
+};
+
+void tst_qqmlinstantiator::createNone()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createNone.qml"));
+ QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create());
+ QVERIFY(instantiator != 0);
+ QCOMPARE(instantiator->isActive(), true);
+ QCOMPARE(instantiator->count(), 0);
+ QCOMPARE(instantiator->property("success").toBool(), true);
+ QVERIFY(instantiator->delegate()->isReady());
+}
+
+void tst_qqmlinstantiator::createSingle()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createSingle.qml"));
+ QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create());
+ QVERIFY(instantiator != 0);
+ QCOMPARE(instantiator->isActive(), true);
+ QCOMPARE(instantiator->count(), 1);
+ QVERIFY(instantiator->delegate()->isReady());
+
+ QObject *object = instantiator->object();
+ QVERIFY(object);
+ QCOMPARE(object->parent(), instantiator);
+ QCOMPARE(object->property("success").toBool(), true);
+ QCOMPARE(object->property("idx").toInt(), 0);
+}
+
+void tst_qqmlinstantiator::createMultiple()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createMultiple.qml"));
+ QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create());
+ QVERIFY(instantiator != 0);
+ QCOMPARE(instantiator->isActive(), true);
+ QCOMPARE(instantiator->count(), 10);
+
+ for (int i=0; i<10; i++) {
+ QObject *object = instantiator->objectAt(i);
+ QVERIFY(object);
+ QCOMPARE(object->parent(), instantiator);
+ QCOMPARE(object->property("success").toBool(), true);
+ QCOMPARE(object->property("idx").toInt(), i);
+ }
+}
+
+void tst_qqmlinstantiator::stringModel()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stringModel.qml"));
+ QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create());
+ QVERIFY(instantiator != 0);
+ QCOMPARE(instantiator->isActive(), true);
+ QCOMPARE(instantiator->count(), 4);
+
+ for (int i=0; i<4; i++) {
+ QObject *object = instantiator->objectAt(i);
+ QVERIFY(object);
+ QCOMPARE(object->parent(), instantiator);
+ QCOMPARE(object->property("success").toBool(), true);
+ }
+}
+
+void tst_qqmlinstantiator::activeProperty()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("inactive.qml"));
+ QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create());
+ QVERIFY(instantiator != 0);
+ QSignalSpy activeSpy(instantiator, SIGNAL(activeChanged()));
+ QSignalSpy countSpy(instantiator, SIGNAL(countChanged()));
+ QSignalSpy objectSpy(instantiator, SIGNAL(objectChanged()));
+ QSignalSpy modelSpy(instantiator, SIGNAL(modelChanged()));
+ QCOMPARE(instantiator->isActive(), false);
+ QCOMPARE(instantiator->count(), 0);
+ QVERIFY(instantiator->delegate()->isReady());
+
+ QCOMPARE(activeSpy.count(), 0);
+ QCOMPARE(countSpy.count(), 0);
+ QCOMPARE(objectSpy.count(), 0);
+ QCOMPARE(modelSpy.count(), 0);
+
+ instantiator->setActive(true);
+ QCOMPARE(instantiator->isActive(), true);
+ QCOMPARE(instantiator->count(), 1);
+
+ QCOMPARE(activeSpy.count(), 1);
+ QCOMPARE(countSpy.count(), 1);
+ QCOMPARE(objectSpy.count(), 1);
+ QCOMPARE(modelSpy.count(), 0);
+
+ QObject *object = instantiator->object();
+ QVERIFY(object);
+ QCOMPARE(object->parent(), instantiator);
+ QCOMPARE(object->property("success").toBool(), true);
+ QCOMPARE(object->property("idx").toInt(), 0);
+}
+
+void tst_qqmlinstantiator::intModelChange()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("createMultiple.qml"));
+ QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create());
+ QVERIFY(instantiator != 0);
+ QSignalSpy activeSpy(instantiator, SIGNAL(activeChanged()));
+ QSignalSpy countSpy(instantiator, SIGNAL(countChanged()));
+ QSignalSpy objectSpy(instantiator, SIGNAL(objectChanged()));
+ QSignalSpy modelSpy(instantiator, SIGNAL(modelChanged()));
+ QCOMPARE(instantiator->count(), 10);
+
+ QCOMPARE(activeSpy.count(), 0);
+ QCOMPARE(countSpy.count(), 0);
+ QCOMPARE(objectSpy.count(), 0);
+ QCOMPARE(modelSpy.count(), 0);
+
+ instantiator->setModel(QVariant(2));
+ QCOMPARE(instantiator->count(), 2);
+
+ QCOMPARE(activeSpy.count(), 0);
+ QCOMPARE(countSpy.count(), 1);
+ QCOMPARE(objectSpy.count(), 2);
+ QCOMPARE(modelSpy.count(), 1);
+
+ for (int i=0; i<2; i++) {
+ QObject *object = instantiator->objectAt(i);
+ QVERIFY(object);
+ QCOMPARE(object->parent(), instantiator);
+ QCOMPARE(object->property("success").toBool(), true);
+ QCOMPARE(object->property("idx").toInt(), i);
+ }
+}
+
+QTEST_MAIN(tst_qqmlinstantiator)
+
+#include "tst_qqmlinstantiator.moc"
diff --git a/tests/auto/qml/qqmlinstruction/qqmlinstruction.pro b/tests/auto/qml/qqmlinstruction/qqmlinstruction.pro
new file mode 100644
index 0000000000..73f29ab973
--- /dev/null
+++ b/tests/auto/qml/qqmlinstruction/qqmlinstruction.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qqmlinstruction
+SOURCES += tst_qqmlinstruction.cpp
+macx:CONFIG -= app_bundle
+
+CONFIG += parallel_test
+
+include (../../shared/util.pri)
+
+QT += core-private gui-private v8-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
new file mode 100644
index 0000000000..8d8b913df7
--- /dev/null
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -0,0 +1,709 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include "../../shared/util.h"
+#include <private/qqmlcompiler_p.h>
+
+#include <QVector3D>
+#include <QVector4D>
+
+class tst_qqmlinstruction : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qqmlinstruction() {}
+
+private slots:
+ void dump();
+
+ void point();
+ void pointf();
+ void size();
+ void sizef();
+ void rect();
+ void rectf();
+ void vector3d();
+ void vector4d();
+ void time();
+};
+
+void tst_qqmlinstruction::dump()
+{
+ QQmlEngine engine;
+ QQmlCompiledData *data = new QQmlCompiledData(&engine);
+
+ {
+ QQmlCompiledData::Instruction::Init i;
+ i.bindingsSize = 0;
+ i.parserStatusSize = 3;
+ i.contextCache = -1;
+ i.compiledBinding = -1;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::CreateCppObject i;
+ i.type = 0;
+ i.data = -1;
+ i.column = 10;
+ data->addInstruction(i);
+ }
+
+ {
+ data->primitives << "testId";
+
+ QQmlCompiledData::Instruction::SetId i;
+ i.value = data->primitives.count() - 1;
+ i.index = 0;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::SetDefault i;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::CreateComponent i;
+ i.count = 3;
+ i.column = 4;
+ i.endLine = 14;
+ i.metaObject = 0;
+
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreMetaObject i;
+ i.aliasData = 6;
+ i.propertyCache = 7;
+
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreFloat i;
+ i.propertyIndex = 3;
+ i.value = 11.3f;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreDouble i;
+ i.propertyIndex = 4;
+ i.value = 14.8f;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreInteger i;
+ i.propertyIndex = 5;
+ i.value = 9;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreBool i;
+ i.propertyIndex = 6;
+ i.value = true;
+
+ data->addInstruction(i);
+ }
+
+ {
+ data->primitives << "Test String";
+ QQmlCompiledData::Instruction::StoreString i;
+ i.propertyIndex = 7;
+ i.value = data->primitives.count() - 1;
+ data->addInstruction(i);
+ }
+
+ {
+ data->urls << QUrl("http://www.nokia.com");
+ QQmlCompiledData::Instruction::StoreUrl i;
+ i.propertyIndex = 8;
+ i.value = data->urls.count() - 1;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreColor i;
+ i.propertyIndex = 9;
+ i.value = 0xFF00FF00;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreDate i;
+ i.propertyIndex = 10;
+ i.value = 9;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreTime i;
+ i.propertyIndex = 11;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreDateTime i;
+ i.propertyIndex = 12;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StorePoint i;
+ i.propertyIndex = 13;
+ i.point.xp = 3;
+ i.point.yp = 7;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StorePointF i;
+ i.propertyIndex = 13;
+ i.point.xp = 3;
+ i.point.yp = 7;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreSize i;
+ i.propertyIndex = 15;
+ i.size.wd = 8;
+ i.size.ht = 11;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreSizeF i;
+ i.propertyIndex = 15;
+ i.size.wd = 8;
+ i.size.ht = 11;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreRect i;
+ i.propertyIndex = 17;
+ i.rect.x1 = 7;
+ i.rect.y1 = 9;
+ i.rect.x2 = 11;
+ i.rect.y2 = 13;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreRectF i;
+ i.propertyIndex = 18;
+ i.rect.xp = 11.3;
+ i.rect.yp = 9.8;
+ i.rect.w = 3;
+ i.rect.h = 2.1;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVector3D i;
+ i.propertyIndex = 19;
+ i.vector.xp = 9;
+ i.vector.yp = 3;
+ i.vector.zp = 92;
+ data->addInstruction(i);
+ }
+
+ {
+ data->primitives << "color(1, 1, 1, 1)";
+ QQmlCompiledData::Instruction::StoreVariant i;
+ i.propertyIndex = 20;
+ i.value = data->primitives.count() - 1;
+
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreObject i;
+ i.propertyIndex = 21;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVariantObject i;
+ i.propertyIndex = 22;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreInterface i;
+ i.propertyIndex = 23;
+ data->addInstruction(i);
+ }
+
+ {
+ data->primitives << "console.log(1921)";
+
+ QQmlCompiledData::Instruction::StoreSignal i;
+ i.signalIndex = 2;
+ i.value = data->primitives.count() - 1;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreScriptString i;
+ i.propertyIndex = 24;
+ i.value = 3;
+ i.scope = 1;
+ i.bindingId = 4;
+ data->addInstruction(i);
+ }
+
+ {
+ data->primitives << "mySignal";
+
+ QQmlCompiledData::Instruction::AssignSignalObject i;
+ i.signal = data->primitives.count() - 1;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::AssignCustomType i;
+ i.propertyIndex = 25;
+ i.primitive = 6;
+ i.type = 9;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreBinding i;
+ i.property.coreIndex = 26;
+ i.value = 3;
+ i.context = 2;
+ i.owner = 0;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreV4Binding i;
+ i.property = 27;
+ i.value = 2;
+ i.context = 4;
+ i.owner = 0;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreValueSource i;
+ i.property.coreIndex = 29;
+ i.castValue = 4;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreValueInterceptor i;
+ i.property.coreIndex = 30;
+ i.castValue = -4;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::BeginObject i;
+ i.castValue = 4;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreObjectQList i;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::AssignObjectList i;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::FetchAttached i;
+ i.id = 23;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::FetchQList i;
+ i.property = 32;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::FetchObject i;
+ i.property = 33;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::FetchValueType i;
+ i.property = 34;
+ i.type = 6;
+ i.bindingSkipList = 7;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::PopFetchedObject i;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::PopQList i;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::PopValueType i;
+ i.property = 35;
+ i.type = 8;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::Defer i;
+ i.deferCount = 7;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::Defer i;
+ i.deferCount = 7;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreImportedScript i;
+ i.value = 2;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVariantInteger i;
+ i.value = 11;
+ i.propertyIndex = 32;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVariantDouble i;
+ i.value = 33.7;
+ i.propertyIndex = 19;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::Done i;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreTrString i;
+ i.propertyIndex = 99;
+ i.context = 3;
+ i.text = 14;
+ i.comment = 14;
+ i.n = 2;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreTrIdString i;
+ i.propertyIndex = 78;
+ i.text = 7;
+ i.n = -1;
+ data->addInstruction(i);
+ }
+
+ {
+ data->primitives << "color(1, 1, 1, 1)";
+ QQmlCompiledData::Instruction::StoreVar i;
+ i.propertyIndex = 79;
+ i.value = data->primitives.count() - 1;
+
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVarObject i;
+ i.propertyIndex = 80;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVarInteger i;
+ i.value = 23;
+ i.propertyIndex = 81;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVarDouble i;
+ i.value = 66.3;
+ i.propertyIndex = 82;
+ data->addInstruction(i);
+ }
+
+ {
+ QQmlCompiledData::Instruction::StoreVarBool i;
+ i.value = true;
+ i.propertyIndex = 83;
+ data->addInstruction(i);
+ }
+
+ QStringList expect;
+ expect
+ << "Index\tOperation\t\tData1\tData2\tData3\tComments"
+ << "-------------------------------------------------------------------------------"
+ << "0\t\tINIT\t\t\t0\t3\t-1\t-1"
+ << "1\t\tCREATECPP\t\t\t0"
+ << "2\t\tSETID\t\t\t0\t\t\t\"testId\""
+ << "3\t\tSET_DEFAULT"
+ << "4\t\tCREATE_COMPONENT\t3"
+ << "5\t\tSTORE_META\t\t"
+ << "6\t\tSTORE_FLOAT\t\t3\t11.3"
+ << "7\t\tSTORE_DOUBLE\t\t4\t14.8"
+ << "8\t\tSTORE_INTEGER\t\t5\t9"
+ << "9\t\tSTORE_BOOL\t\t6\ttrue"
+ << "10\t\tSTORE_STRING\t\t7\t1\t\t\"Test String\""
+ << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.nokia.com\") "
+ << "12\t\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\""
+ << "13\t\tSTORE_DATE\t\t10\t9"
+ << "14\t\tSTORE_TIME\t\t11"
+ << "15\t\tSTORE_DATETIME\t\t12"
+ << "16\t\tSTORE_POINT\t\t13\t3\t7"
+ << "17\t\tSTORE_POINTF\t\t13\t3\t7"
+ << "18\t\tSTORE_SIZE\t\t15\t8\t11"
+ << "19\t\tSTORE_SIZEF\t\t15\t8\t11"
+ << "20\t\tSTORE_RECT\t\t17\t7\t9\t11\t13"
+ << "21\t\tSTORE_RECTF\t\t18\t11.3\t9.8\t3\t2.1"
+ << "22\t\tSTORE_VECTOR3D\t\t19\t9\t3\t92"
+ << "23\t\tSTORE_VARIANT\t\t20\t2\t\t\"color(1, 1, 1, 1)\""
+ << "24\t\tSTORE_OBJECT\t\t21"
+ << "25\t\tSTORE_VARIANT_OBJECT\t22"
+ << "26\t\tSTORE_INTERFACE\t\t23"
+ << "27\t\tSTORE_SIGNAL\t\t2\t3"
+ << "28\t\tSTORE_SCRIPT_STRING\t24\t3\t1\t4"
+ << "29\t\tASSIGN_SIGNAL_OBJECT\t4"
+ << "30\t\tASSIGN_CUSTOMTYPE\t25\t6\t9"
+ << "31\t\tSTORE_BINDING\t26\t3\t2"
+ << "32\t\tSTORE_COMPILED_BINDING\t27\t2\t4"
+ << "33\t\tSTORE_VALUE_SOURCE\t29\t4"
+ << "34\t\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
+ << "35\t\tBEGIN\t\t\t4"
+ << "36\t\tSTORE_OBJECT_QLIST"
+ << "37\t\tASSIGN_OBJECT_LIST"
+ << "38\t\tFETCH_ATTACHED\t\t23"
+ << "39\t\tFETCH_QLIST\t\t32"
+ << "40\t\tFETCH\t\t\t33"
+ << "41\t\tFETCH_VALUE\t\t34\t6\t7"
+ << "42\t\tPOP"
+ << "43\t\tPOP_QLIST"
+ << "44\t\tPOP_VALUE\t\t35\t8"
+ << "45\t\tDEFER\t\t\t7"
+ << "46\t\tDEFER\t\t\t7"
+ << "47\t\tSTORE_IMPORTED_SCRIPT\t2"
+ << "48\t\tSTORE_VARIANT_INTEGER\t\t32\t11"
+ << "49\t\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
+ << "50\t\tDONE"
+ << "51\t\tSTORE_TR_STRING\t99\t3\t14\t14\t2"
+ << "52\t\tSTORE_TRID_STRING\t78\t7\t-1"
+ << "53\t\tSTORE_VAR\t\t79\t5\t\t\"color(1, 1, 1, 1)\""
+ << "54\t\tSTORE_VAR_OBJECT\t80"
+ << "55\t\tSTORE_VAR_INTEGER\t81\t23"
+ << "56\t\tSTORE_VAR_DOUBLE\t82\t66.3"
+ << "57\t\tSTORE_VAR_BOOL\t\t83\ttrue"
+ << "-------------------------------------------------------------------------------";
+
+ QQmlTestMessageHandler messageHandler;
+
+ data->dumpInstructions();
+
+ const int messageCount = messageHandler.messages().count();
+ QCOMPARE(messageCount, expect.count());
+ for (int ii = 0; ii < messageCount; ++ii) {
+ QCOMPARE(messageHandler.messages().at(ii), expect.at(ii));
+ }
+
+ data->release();
+}
+
+void tst_qqmlinstruction::point()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storePoint::QPoint), sizeof(QPoint));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storePoint::QPoint), Q_ALIGNOF(QPoint));
+
+ QQmlInstruction i;
+ i.storePoint.point.xp = 8;
+ i.storePoint.point.yp = 11;
+
+ const QPoint &point = (const QPoint &)(i.storePoint.point);
+ QCOMPARE(point.x(), 8);
+ QCOMPARE(point.y(), 11);
+}
+
+void tst_qqmlinstruction::pointf()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storePointF::QPointF), sizeof(QPointF));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storePointF::QPointF), Q_ALIGNOF(QPointF));
+
+ QQmlInstruction i;
+ i.storePointF.point.xp = 8.7;
+ i.storePointF.point.yp = 11.3;
+
+ const QPointF &point = (const QPointF &)(i.storePointF.point);
+ QCOMPARE(point.x(), 8.7);
+ QCOMPARE(point.y(), 11.3);
+}
+
+void tst_qqmlinstruction::size()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storeSize::QSize), sizeof(QSize));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeSize::QSize), Q_ALIGNOF(QSize));
+
+ QQmlInstruction i;
+ i.storeSize.size.wd = 8;
+ i.storeSize.size.ht = 11;
+
+ const QSize &size = (const QSize &)(i.storeSize.size);
+ QCOMPARE(size.width(), 8);
+ QCOMPARE(size.height(), 11);
+}
+
+void tst_qqmlinstruction::sizef()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storeSizeF::QSizeF), sizeof(QSizeF));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeSizeF::QSizeF), Q_ALIGNOF(QSizeF));
+
+ QQmlInstruction i;
+ i.storeSizeF.size.wd = 8;
+ i.storeSizeF.size.ht = 11;
+
+ const QSizeF &size = (const QSizeF &)(i.storeSizeF.size);
+ QCOMPARE(size.width(), (qreal)8);
+ QCOMPARE(size.height(), (qreal)11);
+}
+
+void tst_qqmlinstruction::rect()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storeRect::QRect), sizeof(QRect));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeRect::QRect), Q_ALIGNOF(QRect));
+
+ QQmlInstruction i;
+ i.storeRect.rect.x1 = 8;
+ i.storeRect.rect.y1 = 11;
+ i.storeRect.rect.x2 = 13;
+ i.storeRect.rect.y2 = 19;
+
+ const QRect &rect = (const QRect &)(i.storeRect.rect);
+ QCOMPARE(rect.left(), 8);
+ QCOMPARE(rect.top(), 11);
+ QCOMPARE(rect.right(), 13);
+ QCOMPARE(rect.bottom(), 19);
+}
+
+void tst_qqmlinstruction::rectf()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storeRectF::QRectF), sizeof(QRectF));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeRectF::QRectF), Q_ALIGNOF(QRectF));
+
+ QQmlInstruction i;
+ i.storeRectF.rect.xp = 8;
+ i.storeRectF.rect.yp = 11;
+ i.storeRectF.rect.w = 13;
+ i.storeRectF.rect.h = 19;
+
+ const QRectF &rect = (const QRectF &)(i.storeRectF.rect);
+ QCOMPARE(rect.left(), (qreal)8);
+ QCOMPARE(rect.top(), (qreal)11);
+ QCOMPARE(rect.width(), (qreal)13);
+ QCOMPARE(rect.height(), (qreal)19);
+}
+
+void tst_qqmlinstruction::vector3d()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storeVector3D::QVector3D), sizeof(QVector3D));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector3D::QVector3D), Q_ALIGNOF(QVector3D));
+
+ QQmlInstruction i;
+ i.storeVector3D.vector.xp = 8.2f;
+ i.storeVector3D.vector.yp = 99.3f;
+ i.storeVector3D.vector.zp = 12.0;
+
+ const QVector3D &vector = (const QVector3D &)(i.storeVector3D.vector);
+ QCOMPARE(vector.x(), (qreal)(float)8.2);
+ QCOMPARE(vector.y(), (qreal)(float)99.3);
+ QCOMPARE(vector.z(), (qreal)(float)12.0);
+}
+
+void tst_qqmlinstruction::vector4d()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storeVector4D::QVector4D), sizeof(QVector4D));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector4D::QVector4D), Q_ALIGNOF(QVector4D));
+
+ QQmlInstruction i;
+ i.storeVector4D.vector.xp = 8.2f;
+ i.storeVector4D.vector.yp = 99.3f;
+ i.storeVector4D.vector.zp = 12.0;
+ i.storeVector4D.vector.wp = 121.1f;
+
+ const QVector4D &vector = (const QVector4D &)(i.storeVector4D.vector);
+ QCOMPARE(vector.x(), (qreal)(float)8.2);
+ QCOMPARE(vector.y(), (qreal)(float)99.3);
+ QCOMPARE(vector.z(), (qreal)(float)12.0);
+ QCOMPARE(vector.w(), (qreal)(float)121.1);
+}
+
+void tst_qqmlinstruction::time()
+{
+ QCOMPARE(sizeof(QQmlInstruction::instr_storeTime::QTime), sizeof(QTime));
+ QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeTime::QTime), Q_ALIGNOF(QTime));
+}
+
+QTEST_MAIN(tst_qqmlinstruction)
+
+#include "tst_qqmlinstruction.moc"
diff --git a/tests/auto/qml/qqmllanguage/data/Alias.qml b/tests/auto/qml/qqmllanguage/data/Alias.qml
new file mode 100644
index 0000000000..2cb7cbe2e0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/Alias.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ property int value: 1892
+ property alias aliasValue: root.value
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/Alias2.qml b/tests/auto/qml/qqmllanguage/data/Alias2.qml
new file mode 100644
index 0000000000..134e1440b5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/Alias2.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property variant other
+ other: MyTypeObject { id: obj }
+ property alias enumAlias: obj.enumProperty;
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/Alias3.qml b/tests/auto/qml/qqmllanguage/data/Alias3.qml
new file mode 100644
index 0000000000..54b548e049
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/Alias3.qml
@@ -0,0 +1,12 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property alias obj : otherObj
+ property variant child
+ child: QtObject {
+ id: otherObj
+ property int myValue: 10
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/Alias4.qml b/tests/auto/qml/qqmllanguage/data/Alias4.qml
new file mode 100644
index 0000000000..e09eca2ff3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/Alias4.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import QtQuick 2.0
+
+Alias3 {}
+
diff --git a/tests/auto/qml/qqmllanguage/data/AliasPropertyChangeSignalsType.qml b/tests/auto/qml/qqmllanguage/data/AliasPropertyChangeSignalsType.qml
new file mode 100644
index 0000000000..9265ffb1df
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/AliasPropertyChangeSignalsType.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ signal sig1
+ signal sig2
+ signal sig3
+ signal sig4
+
+ property alias aliasProperty: root.realProperty
+
+ property int realProperty: 0
+
+ property bool test: false
+
+ Component.onCompleted: {
+ root.realProperty = 10;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml b/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml
new file mode 100644
index 0000000000..889450b565
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/ComponentComposite.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Component {
+ QtObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType.qml b/tests/auto/qml/qqmllanguage/data/CompositeType.qml
new file mode 100644
index 0000000000..addc4265a9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/CompositeType.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType2.qml b/tests/auto/qml/qqmllanguage/data/CompositeType2.qml
new file mode 100644
index 0000000000..86210e9072
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/CompositeType2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyQmlObject {
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType3.qml b/tests/auto/qml/qqmllanguage/data/CompositeType3.qml
new file mode 100644
index 0000000000..f48a77598c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/CompositeType3.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a
+}
diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType4.qml b/tests/auto/qml/qqmllanguage/data/CompositeType4.qml
new file mode 100644
index 0000000000..a6a8168d8f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/CompositeType4.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyQmlObject {
+ property int a
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType5.qml b/tests/auto/qml/qqmllanguage/data/CompositeType5.qml
new file mode 100644
index 0000000000..564468ce90
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/CompositeType5.qml
@@ -0,0 +1,2 @@
+CompositeType {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType6.qml b/tests/auto/qml/qqmllanguage/data/CompositeType6.qml
new file mode 100644
index 0000000000..a8a2af9318
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/CompositeType6.qml
@@ -0,0 +1,2 @@
+CompositeType2 {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/DontDoubleCallClassBeginItem.qml b/tests/auto/qml/qqmllanguage/data/DontDoubleCallClassBeginItem.qml
new file mode 100644
index 0000000000..1f8eac8a3b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/DontDoubleCallClassBeginItem.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+
+MyParserStatus {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/DynamicPropertiesNestedType.qml b/tests/auto/qml/qqmllanguage/data/DynamicPropertiesNestedType.qml
new file mode 100644
index 0000000000..4667adda14
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/DynamicPropertiesNestedType.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int super_a: 10
+ property int super_c: 14
+}
diff --git a/tests/auto/qml/qqmllanguage/data/HelperAlias.qml b/tests/auto/qml/qqmllanguage/data/HelperAlias.qml
new file mode 100644
index 0000000000..c2ab70ffd6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/HelperAlias.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property variant child
+ child: QtObject { id: obj }
+ property alias objAlias: obj;
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/I18n.qml b/tests/auto/qml/qqmllanguage/data/I18n.qml
new file mode 100644
index 0000000000..558c836e52
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/I18n.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ property int áâãäå: 10
+ stringProperty: "Test áâãäå: " + áâãäå
+}
diff --git a/tests/auto/qml/qqmllanguage/data/I18nType30.qml b/tests/auto/qml/qqmllanguage/data/I18nType30.qml
new file mode 100644
index 0000000000..42dbc69044
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/I18nType30.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ stringProperty: "Test áâãäå: 30"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType.qml b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType.qml
new file mode 100644
index 0000000000..42513e463f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property InlineAssignmentsOverrideBindingsType2 nested: InlineAssignmentsOverrideBindingsType2 {
+ value: 19 * 33
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType2.qml b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType2.qml
new file mode 100644
index 0000000000..4a45535a50
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/InlineAssignmentsOverrideBindingsType2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int value
+}
diff --git a/tests/auto/qml/qqmllanguage/data/LocalLast.qml b/tests/auto/qml/qqmllanguage/data/LocalLast.qml
new file mode 100644
index 0000000000..59df88216e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/LocalLast.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Text {}
diff --git a/tests/auto/qml/qqmllanguage/data/LocalLast2.qml b/tests/auto/qml/qqmllanguage/data/LocalLast2.qml
new file mode 100644
index 0000000000..a6acfcde7c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/LocalLast2.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+MouseArea {}
diff --git a/tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml b/tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml
new file mode 100644
index 0000000000..dda4c486b2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/MyBaseComponent.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ id: base
+
+ property bool baseSuccess: false
+
+ property string baseProperty: 'foo'
+ property string boundProperty: baseProperty
+ property alias aliasProperty: base.baseProperty
+
+ function basePropertiesTest(expected) {
+ return (baseProperty == expected &&
+ boundProperty == expected &&
+ aliasProperty == expected);
+ }
+
+ Component.onCompleted: {
+ if (basePropertiesTest('foo')) {
+ baseProperty = 'bar';
+ baseSuccess = basePropertiesTest('bar');
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/MyComponent.qml b/tests/auto/qml/qqmllanguage/data/MyComponent.qml
new file mode 100644
index 0000000000..1a23277ff8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/MyComponent.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyQmlObject {
+ property real x;
+ property real y;
+}
diff --git a/tests/auto/qml/qqmllanguage/data/MyCompositeValueSource.qml b/tests/auto/qml/qqmllanguage/data/MyCompositeValueSource.qml
new file mode 100644
index 0000000000..e620e26490
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/MyCompositeValueSource.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyPropertyValueSource {
+ property int x
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/MyContainerComponent.qml b/tests/auto/qml/qqmllanguage/data/MyContainerComponent.qml
new file mode 100644
index 0000000000..61f54c5eb8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/MyContainerComponent.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyContainer {
+ property int x
+}
diff --git a/tests/auto/qml/qqmllanguage/data/NestedAlias.qml b/tests/auto/qml/qqmllanguage/data/NestedAlias.qml
new file mode 100644
index 0000000000..7d49b0ac98
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/NestedAlias.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject o1
+ property QtObject o2
+
+ property alias a: object2.a
+
+ o1: QtObject { id: object1 }
+ o2: QtObject {
+ id: object2
+ property int a: 1923
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/NestedComponentRoot.qml b/tests/auto/qml/qqmllanguage/data/NestedComponentRoot.qml
new file mode 100644
index 0000000000..887d7fae50
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/NestedComponentRoot.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Component {
+ Item {
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/NestedErrorsType.qml b/tests/auto/qml/qqmllanguage/data/NestedErrorsType.qml
new file mode 100644
index 0000000000..06a3212916
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/NestedErrorsType.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ x: "You can't assign a string to a real!"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml b/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml
new file mode 100644
index 0000000000..947f14811f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/OnCompletedType.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ property int a: Math.max(10, 9)
+ property int b: 11
+ Component.onCompleted: console.log("Completed " + a + " " + b);
+}
diff --git a/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml b/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml
new file mode 100644
index 0000000000..11fb9d9578
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/OnDestructionType.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ property int a: Math.max(10, 9)
+ property int b: 11
+ Component.onDestruction: console.log("Destruction " + a + " " + b);
+}
diff --git a/tests/auto/qml/qqmllanguage/data/OtherSignalParam.qml b/tests/auto/qml/qqmllanguage/data/OtherSignalParam.qml
new file mode 100644
index 0000000000..5707f5e08b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/OtherSignalParam.qml
@@ -0,0 +1,6 @@
+import QtQml 2.0
+
+QtObject {
+ property string testProperty: "Hello, World"
+ property int answer: 42
+}
diff --git a/tests/auto/qml/qqmllanguage/data/OverrideSignalComponent.qml b/tests/auto/qml/qqmllanguage/data/OverrideSignalComponent.qml
new file mode 100644
index 0000000000..f984e70fc5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/OverrideSignalComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property int test: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/ReadOnlyType.qml b/tests/auto/qml/qqmllanguage/data/ReadOnlyType.qml
new file mode 100644
index 0000000000..456ac762fc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/ReadOnlyType.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ readonly property int readOnlyProperty: 19
+}
diff --git a/tests/auto/qml/qqmllanguage/data/SignalEmitter.qml b/tests/auto/qml/qqmllanguage/data/SignalEmitter.qml
new file mode 100644
index 0000000000..259f45b7d2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/SignalEmitter.qml
@@ -0,0 +1,25 @@
+import QtQml 2.0
+
+QtObject {
+ // these two need to be set by the test qml
+ property QtObject testObject
+ property bool handleSignal
+
+ property SignalParam p: SignalParam { }
+ property OtherSignalParam op: OtherSignalParam { }
+ signal testSignal(SignalParam spp);
+
+ function emitTestSignal() {
+ testObject.expectNull = true;
+ testSignal(op);
+
+ testObject.expectNull = false;
+ testSignal(p);
+ }
+
+ onTestSignal: {
+ if (handleSignal == true) {
+ testObject.determineSuccess(spp);
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/SignalParam.qml b/tests/auto/qml/qqmllanguage/data/SignalParam.qml
new file mode 100644
index 0000000000..8139b20268
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/SignalParam.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property int testProperty: 42
+}
diff --git a/tests/auto/qml/qqmllanguage/data/alias.1.qml b/tests/auto/qml/qqmllanguage/data/alias.1.qml
new file mode 100644
index 0000000000..dbb3f06d32
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.1.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ id: root
+ property int value: 10
+ property alias valueAlias: root.value
+}
diff --git a/tests/auto/qml/qqmllanguage/data/alias.10.qml b/tests/auto/qml/qqmllanguage/data/alias.10.qml
new file mode 100644
index 0000000000..bf6352e82b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.10.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias valueAlias: root.rectProperty
+
+ rectProperty: "10,11,9x8"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/alias.11.qml b/tests/auto/qml/qqmllanguage/data/alias.11.qml
new file mode 100644
index 0000000000..fbd50d9dc9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.11.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+
+ property alias aliasProperty: root.rectProperty.x
+ rectProperty: "19,13,100x120"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/alias.2.qml b/tests/auto/qml/qqmllanguage/data/alias.2.qml
new file mode 100644
index 0000000000..5c922709fe
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/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/qml/qqmllanguage/data/alias.3.qml b/tests/auto/qml/qqmllanguage/data/alias.3.qml
new file mode 100644
index 0000000000..16a6d9d903
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.3.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant other
+ other: Alias { id: myAliasObject }
+
+ property alias value: myAliasObject.aliasValue
+ property alias value2: myAliasObject.value
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/alias.4.qml b/tests/auto/qml/qqmllanguage/data/alias.4.qml
new file mode 100644
index 0000000000..bd6a769367
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.4.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+Alias2 {
+ enumAlias: MyTypeObject.EnumVal2
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/alias.5.qml b/tests/auto/qml/qqmllanguage/data/alias.5.qml
new file mode 100644
index 0000000000..cee2a88cf7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.5.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import Test 1.0
+
+QtObject {
+ property alias otherAlias: otherObject
+
+ property variant other
+ other: MyQmlObject {
+ id: otherObject
+ value: 10
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/alias.6.qml b/tests/auto/qml/qqmllanguage/data/alias.6.qml
new file mode 100644
index 0000000000..54d3c320e0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.6.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject o;
+ property alias a: object.a
+ o: NestedAlias { id: object }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/alias.7.qml b/tests/auto/qml/qqmllanguage/data/alias.7.qml
new file mode 100644
index 0000000000..0dc54d6787
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.7.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject object
+ property alias aliasedObject: target.object
+
+ object: QtObject {
+ id: target
+
+ property QtObject object
+ object: QtObject {}
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/alias.8.qml b/tests/auto/qml/qqmllanguage/data/alias.8.qml
new file mode 100644
index 0000000000..3cb280ef47
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.8.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant other
+ other: Alias3 { id: myAliasObject }
+
+ property int value: myAliasObject.obj.myValue
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/alias.9.qml b/tests/auto/qml/qqmllanguage/data/alias.9.qml
new file mode 100644
index 0000000000..01cf9142b2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/alias.9.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant other
+ other: Alias4 { id: myAliasObject }
+
+ property int value: myAliasObject.obj.myValue
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/aliasPropertiesAndSignals.qml b/tests/auto/qml/qqmllanguage/data/aliasPropertiesAndSignals.qml
new file mode 100644
index 0000000000..60e66921d2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/aliasPropertiesAndSignals.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property bool test: false
+ property alias myalias: root.objectName
+ signal go
+ onGo: test = true
+
+ Component.onCompleted: {
+ root.go();
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.2.qml b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.2.qml
new file mode 100644
index 0000000000..089130d14c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+AliasPropertyChangeSignalsType {
+ id: root
+ onAliasPropertyChanged: root.test = true
+
+ function blah() {}
+ property int a
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.qml b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.qml
new file mode 100644
index 0000000000..4e11b9174a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/aliasPropertyChangeSignals.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property alias aliasProperty: root.realProperty
+ onAliasPropertyChanged: root.test = true
+
+ property int realProperty: 0
+
+ property bool test: false
+
+ Component.onCompleted: {
+ root.realProperty = 10;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/allowedRevisionOverloads.qml b/tests/auto/qml/qqmllanguage/data/allowedRevisionOverloads.qml
new file mode 100644
index 0000000000..64acbd1576
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/allowedRevisionOverloads.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyRevisionedLegalOverload
+{
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml
new file mode 100644
index 0000000000..4d54bc83c1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignBasicTypes.qml
@@ -0,0 +1,39 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ flagProperty: "FlagVal1 | FlagVal3"
+ enumProperty: "EnumVal2"
+ qtEnumProperty: Qt.RichText
+ mirroredEnumProperty: Qt.AlignHCenter
+ relatedEnumProperty: "RelatedValue"
+ stringProperty: "Hello World!"
+ uintProperty: 10
+ intProperty: -19
+ realProperty: 23.2
+ doubleProperty: -19.7
+ floatProperty: 8.5
+ colorProperty: "red"
+ dateProperty: "1982-11-25"
+ 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!"
+ vectorProperty: "10,1,2.2"
+ vector4Property: "10,1,2.2,2.3"
+ urlProperty: "main.qml?with%3cencoded%3edata"
+
+ objectProperty: MyTypeObject { intProperty: 8 }
+
+ property bool qtEnumTriggeredChange: false
+ onQtEnumPropertyChanged: qtEnumTriggeredChange = true
+
+ property bool mirroredEnumTriggeredChange: false
+ onMirroredEnumPropertyChanged: mirroredEnumTriggeredChange = true
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml b/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml
new file mode 100644
index 0000000000..4034849df8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import Test 1.0
+
+QtObject {
+ property QtObject myProperty
+ property QtObject myProperty2
+ property QtObject myProperty3
+ property QtObject myProperty4
+ property MyQmlObject myProperty5
+ property MyQmlObject myProperty6
+ property CompositeType myProperty7
+ property CompositeType myProperty8
+ property CompositeType2 myProperty9
+ property CompositeType2 myPropertyA
+
+ myProperty: CompositeType {}
+ myProperty2: CompositeType2 {}
+ myProperty3: CompositeType3 {}
+ myProperty4: CompositeType4 {}
+ myProperty5: CompositeType2 {}
+ myProperty6: CompositeType4 {}
+ myProperty7: CompositeType {}
+ myProperty8: CompositeType5 {}
+ myProperty9: CompositeType2 {}
+ myPropertyA: CompositeType6 {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignLiteralSignalProperty.qml b/tests/auto/qml/qqmllanguage/data/assignLiteralSignalProperty.qml
new file mode 100644
index 0000000000..399fcea04d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignLiteralSignalProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ onLiteralSignal: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignLiteralToJSValue.qml b/tests/auto/qml/qqmllanguage/data/assignLiteralToJSValue.qml
new file mode 100644
index 0000000000..fce248a381
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignLiteralToJSValue.qml
@@ -0,0 +1,109 @@
+// This tests assigning literals to QJSValue properties.
+// These properties store JavaScript object references.
+
+import QtQuick 2.0
+import Test 1.0
+
+QtObject {
+ property list<QtObject> resources: [
+ MyQmlObject { id: testObj1; objectName: "test1"; qjsvalue: 1 },
+ MyQmlObject { id: testObj2; objectName: "test2"; qjsvalue: 1.7 },
+ MyQmlObject { id: testObj3; objectName: "test3"; qjsvalue: "Hello world!" },
+ MyQmlObject { id: testObj4; objectName: "test4"; qjsvalue: "#FF008800" },
+ MyQmlObject { id: testObj5; objectName: "test5"; qjsvalue: "10,10,10x10" },
+ MyQmlObject { id: testObj6; objectName: "test6"; qjsvalue: "10,10" },
+ MyQmlObject { id: testObj7; objectName: "test7"; qjsvalue: "10x10" },
+ MyQmlObject { id: testObj8; objectName: "test8"; qjsvalue: "100,100,100" },
+ MyQmlObject { id: testObj9; objectName: "test9"; qjsvalue: String("#FF008800") },
+ MyQmlObject { id: testObj10; objectName: "test10"; qjsvalue: true },
+ MyQmlObject { id: testObj11; objectName: "test11"; qjsvalue: false },
+ MyQmlObject { id: testObj12; objectName: "test12"; qjsvalue: Qt.rgba(0.2, 0.3, 0.4, 0.5) },
+ MyQmlObject { id: testObj13; objectName: "test13"; qjsvalue: Qt.rect(10, 10, 10, 10) },
+ MyQmlObject { id: testObj14; objectName: "test14"; qjsvalue: Qt.point(10, 10) },
+ MyQmlObject { id: testObj15; objectName: "test15"; qjsvalue: Qt.size(10, 10) },
+ MyQmlObject { id: testObj16; objectName: "test16"; qjsvalue: Qt.vector3d(100, 100, 100); },
+ MyQmlObject { id: testObj17; objectName: "test17"; qjsvalue: "1" },
+ MyQmlObject { id: testObj18; objectName: "test18"; qjsvalue: "1.7" },
+ MyQmlObject { id: testObj19; objectName: "test19"; qjsvalue: "true" },
+ MyQmlObject { id: testObj20; objectName: "test20"; qjsvalue: function(val) { return val * 3; } },
+ MyQmlObject { id: testObj21; objectName: "test21"; qjsvalue: undefined },
+ MyQmlObject { id: testObj22; objectName: "test22"; qjsvalue: null },
+ MyQmlObject { id: testObj1Bound; objectName: "test1Bound"; qjsvalue: testObj1.qjsvalue + 4 }, // 1 + 4 + 4 = 9
+ MyQmlObject { id: testObj20Bound; objectName: "test20Bound"; qjsvalue: testObj20.qjsvalue(testObj1Bound.qjsvalue) }, // 9 * 3 = 27
+ QtObject {
+ id: varProperties
+ objectName: "varProperties"
+ property var test1: testObj1.qjsvalue
+ property var test2: testObj2.qjsvalue
+ property var test3: testObj3.qjsvalue
+ property var test4: testObj4.qjsvalue
+ property var test5: testObj5.qjsvalue
+ property var test6: testObj6.qjsvalue
+ property var test7: testObj7.qjsvalue
+ property var test8: testObj8.qjsvalue
+ property var test9: testObj9.qjsvalue
+ property var test10: testObj10.qjsvalue
+ property var test11: testObj11.qjsvalue
+ property var test12: testObj12.qjsvalue
+ property var test13: testObj13.qjsvalue
+ property var test14: testObj14.qjsvalue
+ property var test15: testObj15.qjsvalue
+ property var test16: testObj16.qjsvalue
+ property var test20: testObj20.qjsvalue
+
+ property var test1Bound: testObj1.qjsvalue + 4 // 1 + 4 + 4 = 9
+ property var test20Bound: testObj20.qjsvalue(test1Bound) // 9 * 3 = 27
+ },
+ QtObject {
+ id: variantProperties
+ objectName: "variantProperties"
+ property variant test1: testObj1.qjsvalue
+ property variant test2: testObj2.qjsvalue
+ property variant test3: testObj3.qjsvalue
+ property variant test4: testObj4.qjsvalue
+ property variant test5: testObj5.qjsvalue
+ property variant test6: testObj6.qjsvalue
+ property variant test7: testObj7.qjsvalue
+ property variant test8: testObj8.qjsvalue
+ property variant test9: testObj9.qjsvalue
+ property variant test10: testObj10.qjsvalue
+ property variant test11: testObj11.qjsvalue
+ property variant test12: testObj12.qjsvalue
+ property variant test13: testObj13.qjsvalue
+ property variant test14: testObj14.qjsvalue
+ property variant test15: testObj15.qjsvalue
+ property variant test16: testObj16.qjsvalue
+
+ property variant test1Bound: testObj1.qjsvalue + 4 // 1 + 4 + 4 = 9
+ property variant test20Bound: testObj20.qjsvalue(test1Bound) // 9 * 3 = 27
+ },
+ MyTypeObject {
+ objectName: "typedProperties"
+ intProperty: testObj1.qjsvalue
+ doubleProperty: testObj2.qjsvalue
+ stringProperty: testObj3.qjsvalue
+ boolProperty: testObj10.qjsvalue
+ colorProperty: testObj12.qjsvalue
+ rectFProperty: testObj13.qjsvalue
+ pointFProperty: testObj14.qjsvalue
+ sizeFProperty: testObj15.qjsvalue
+ vectorProperty: testObj16.qjsvalue
+ },
+ MyTypeObject {
+ objectName: "stringProperties"
+ intProperty: testObj17.qjsvalue
+ doubleProperty: testObj18.qjsvalue
+ stringProperty: testObj3.qjsvalue
+ boolProperty: testObj19.qjsvalue
+ colorProperty: testObj4.qjsvalue
+ rectFProperty: testObj5.qjsvalue
+ pointFProperty: testObj6.qjsvalue
+ sizeFProperty: testObj7.qjsvalue
+ vectorProperty: testObj8.qjsvalue
+ }
+ ]
+
+ Component.onCompleted: {
+ testObj1.qjsvalue = testObj1.qjsvalue + 4
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignLiteralToVar.qml b/tests/auto/qml/qqmllanguage/data/assignLiteralToVar.qml
new file mode 100644
index 0000000000..89e66c6172
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignLiteralToVar.qml
@@ -0,0 +1,32 @@
+// This tests assigning literals to "var" properties.
+// These properties store JavaScript object references.
+
+import QtQuick 2.0
+
+QtObject {
+ property var test1: 1
+ property var test2: 1.7
+ property var test3: "Hello world!"
+ property var test4: "#FF008800"
+ property var test5: "10,10,10x10"
+ property var test6: "10,10"
+ property var test7: "10x10"
+ property var test8: "100,100,100"
+ property var test9: String("#FF008800")
+ property var test10: true
+ property var test11: false
+
+ property variant variantTest1Bound: test1 + 4 // 1 + 4 + 4 = 9
+
+ property var test12: Qt.rgba(0.2, 0.3, 0.4, 0.5)
+ property var test13: Qt.rect(10, 10, 10, 10)
+ property var test14: Qt.point(10, 10)
+ property var test15: Qt.size(10, 10)
+ property var test16: Qt.vector3d(100, 100, 100)
+
+ property var test1Bound: test1 + 6 // 1 + 4 + 6 = 11
+
+ Component.onCompleted: {
+ test1 = test1 + 4;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignLiteralToVariant.qml b/tests/auto/qml/qqmllanguage/data/assignLiteralToVariant.qml
new file mode 100644
index 0000000000..f6f9a139dc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignLiteralToVariant.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: 1
+ property variant test2: 1.7
+ property variant test3: "Hello world!"
+ property variant test4: "#FF008800"
+ property variant test5: "10,10,10x10"
+ property variant test6: "10,10"
+ property variant test7: "10x10"
+ property variant test8: "100,100,100"
+ property variant test9: String("#FF008800")
+ property variant test10: true
+ property variant test11: false
+ property variant test12: "100,100,100,100"
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/assignObjectToSignal.qml b/tests/auto/qml/qqmllanguage/data/assignObjectToSignal.qml
new file mode 100644
index 0000000000..789cc66215
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignObjectToSignal.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ onBasicSignal: MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignObjectToVariant.qml b/tests/auto/qml/qqmllanguage/data/assignObjectToVariant.qml
new file mode 100644
index 0000000000..1f731c539c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignObjectToVariant.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property variant a;
+ a: MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignQmlComponent.qml b/tests/auto/qml/qqmllanguage/data/assignQmlComponent.qml
new file mode 100644
index 0000000000..20bdc559c1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignQmlComponent.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ MyComponent { x: 10; y: 11; }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignSignal.qml b/tests/auto/qml/qqmllanguage/data/assignSignal.qml
new file mode 100644
index 0000000000..2a48df8fcf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignSignal.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ onBasicSignal: basicSlot()
+ onBasicParameterizedSignal: basicSlotWithArgs(parameter)
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignToNamespace.errors.txt b/tests/auto/qml/qqmllanguage/data/assignToNamespace.errors.txt
new file mode 100644
index 0000000000..78aa4713fb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignToNamespace.errors.txt
@@ -0,0 +1 @@
+4:5:Invalid use of namespace
diff --git a/tests/auto/qml/qqmllanguage/data/assignToNamespace.qml b/tests/auto/qml/qqmllanguage/data/assignToNamespace.qml
new file mode 100644
index 0000000000..54fef61ef0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignToNamespace.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0 as Qt47
+
+Qt47.QtObject {
+ Qt47: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignTypeExtremes.qml b/tests/auto/qml/qqmllanguage/data/assignTypeExtremes.qml
new file mode 100644
index 0000000000..60ede525e4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignTypeExtremes.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ uintProperty: 4000000000
+ intProperty: -2000000000
+}
diff --git a/tests/auto/qml/qqmllanguage/data/assignValueToSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.errors.txt
new file mode 100644
index 0000000000..eb1430a715
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign a value to a signal (expecting a script to be run)
diff --git a/tests/auto/qml/qqmllanguage/data/assignValueToSignal.qml b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.qml
new file mode 100644
index 0000000000..6fa1259f39
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/assignValueToSignal.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyQmlObject {
+ onBasicSignal: "hello world"
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/attachedProperties.qml b/tests/auto/qml/qqmllanguage/data/attachedProperties.qml
new file mode 100644
index 0000000000..3637ded26f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/attachedProperties.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import Test 1.0 as Namespace
+import QtQuick 2.0
+
+QtObject {
+ MyQmlObject.value: 10
+ Namespace.MyQmlObject.value2: 13
+}
diff --git a/tests/auto/qml/qqmllanguage/data/autoComponentCreation.qml b/tests/auto/qml/qqmllanguage/data/autoComponentCreation.qml
new file mode 100644
index 0000000000..5d00144eaf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/autoComponentCreation.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ componentProperty : MyTypeObject { realProperty: 9 }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/autoNotifyConnection.qml b/tests/auto/qml/qqmllanguage/data/autoNotifyConnection.qml
new file mode 100644
index 0000000000..640fb54f99
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/autoNotifyConnection.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyQmlObject {
+ property bool receivedNotify : false
+ onPropertyWithNotifyChanged: { receivedNotify = true; }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.errors.txt b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.errors.txt
new file mode 100644
index 0000000000..7a75447a62
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.errors.txt
@@ -0,0 +1,2 @@
+3:1:Type RegisteredCompositeType2 unavailable
+-1:-1:File not found
diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.qml b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.qml
new file mode 100644
index 0000000000..915a6138d9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.qml
@@ -0,0 +1,3 @@
+import Test 1.0
+
+RegisteredCompositeType2 {}
diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.errors.txt b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.errors.txt
new file mode 100644
index 0000000000..0272619404
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.errors.txt
@@ -0,0 +1,2 @@
+3:1:Type RegisteredCompositeType3 unavailable
+1:1:Expected a qualified name id
diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.qml b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.qml
new file mode 100644
index 0000000000..43d7f3ee95
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.qml
@@ -0,0 +1,3 @@
+import Test 1.0
+
+RegisteredCompositeType3 {}
diff --git a/tests/auto/qml/qqmllanguage/data/bindTypeToJSValue.qml b/tests/auto/qml/qqmllanguage/data/bindTypeToJSValue.qml
new file mode 100644
index 0000000000..ff724a4162
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/bindTypeToJSValue.qml
@@ -0,0 +1,60 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ flagProperty: "FlagVal1 | FlagVal3"
+ enumProperty: "EnumVal2"
+ stringProperty: "Hello World!"
+ uintProperty: 10
+ intProperty: -19
+ realProperty: 23.2
+ doubleProperty: -19.7
+ floatProperty: 8.5
+ colorProperty: "red"
+ dateProperty: "1982-11-25"
+ 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!"
+ vectorProperty: "10,1,2.2"
+ vector4Property: "10,1,2.2,2.3"
+ urlProperty: "main.qml?with%3cencoded%3edata"
+
+ objectProperty: MyTypeObject {}
+
+ property var varProperty: "Hello World!"
+
+ property list<MyQmlObject> resources: [
+ MyQmlObject { objectName: "flagProperty"; qjsvalue: flagProperty },
+ MyQmlObject { objectName: "enumProperty"; qjsvalue: enumProperty },
+ MyQmlObject { objectName: "stringProperty"; qjsvalue: stringProperty },
+ MyQmlObject { objectName: "uintProperty"; qjsvalue: uintProperty },
+ MyQmlObject { objectName: "intProperty"; qjsvalue: intProperty },
+ MyQmlObject { objectName: "realProperty"; qjsvalue: realProperty },
+ MyQmlObject { objectName: "doubleProperty"; qjsvalue: doubleProperty },
+ MyQmlObject { objectName: "floatProperty"; qjsvalue: floatProperty },
+ MyQmlObject { objectName: "colorProperty"; qjsvalue: colorProperty },
+ MyQmlObject { objectName: "dateProperty"; qjsvalue: dateProperty },
+ MyQmlObject { objectName: "timeProperty"; qjsvalue: timeProperty },
+ MyQmlObject { objectName: "dateTimeProperty"; qjsvalue: dateTimeProperty },
+ MyQmlObject { objectName: "pointProperty"; qjsvalue: pointProperty },
+ MyQmlObject { objectName: "pointFProperty"; qjsvalue: pointFProperty },
+ MyQmlObject { objectName: "sizeProperty"; qjsvalue: sizeProperty },
+ MyQmlObject { objectName: "sizeFProperty"; qjsvalue: sizeFProperty },
+ MyQmlObject { objectName: "rectProperty"; qjsvalue: rectProperty },
+ MyQmlObject { objectName: "rectFProperty"; qjsvalue: rectFProperty },
+ MyQmlObject { objectName: "boolProperty"; qjsvalue: boolProperty },
+ MyQmlObject { objectName: "variantProperty"; qjsvalue: variantProperty },
+ MyQmlObject { objectName: "vectorProperty"; qjsvalue: vectorProperty },
+ MyQmlObject { objectName: "vector4Property"; qjsvalue: vector4Property },
+ MyQmlObject { objectName: "urlProperty"; qjsvalue: urlProperty },
+ MyQmlObject { objectName: "objectProperty"; qjsvalue: objectProperty },
+ MyQmlObject { objectName: "varProperty"; qjsvalue: varProperty }
+ ]
+}
diff --git a/tests/auto/qml/qqmllanguage/data/component.1.errors.txt b/tests/auto/qml/qqmllanguage/data/component.1.errors.txt
new file mode 100644
index 0000000000..091aad61fa
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.1.errors.txt
@@ -0,0 +1 @@
+3:1:Cannot create empty component specification
diff --git a/tests/auto/qml/qqmllanguage/data/component.1.qml b/tests/auto/qml/qqmllanguage/data/component.1.qml
new file mode 100644
index 0000000000..a22772bd89
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.1.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Component {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/component.2.errors.txt b/tests/auto/qml/qqmllanguage/data/component.2.errors.txt
new file mode 100644
index 0000000000..76e7656a62
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.2.errors.txt
@@ -0,0 +1 @@
+6:9:id is not unique
diff --git a/tests/auto/qml/qqmllanguage/data/component.2.qml b/tests/auto/qml/qqmllanguage/data/component.2.qml
new file mode 100644
index 0000000000..fbe315f771
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.2.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ id: myId
+ Component {
+ id: myId
+ QtObject {}
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/component.3.errors.txt b/tests/auto/qml/qqmllanguage/data/component.3.errors.txt
new file mode 100644
index 0000000000..450fc163bd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.3.errors.txt
@@ -0,0 +1 @@
+6:9:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/component.3.qml b/tests/auto/qml/qqmllanguage/data/component.3.qml
new file mode 100644
index 0000000000..bac23ef903
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.3.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ Component {
+ id: myId
+ id: myId2
+ QtObject {}
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/component.4.errors.txt b/tests/auto/qml/qqmllanguage/data/component.4.errors.txt
new file mode 100644
index 0000000000..2ab18685c8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.4.errors.txt
@@ -0,0 +1 @@
+3:1:Invalid component body specification
diff --git a/tests/auto/qml/qqmllanguage/data/component.4.qml b/tests/auto/qml/qqmllanguage/data/component.4.qml
new file mode 100644
index 0000000000..d07695477d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.4.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Component {
+ QtObject {}
+ QtObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/component.5.errors.txt b/tests/auto/qml/qqmllanguage/data/component.5.errors.txt
new file mode 100644
index 0000000000..e3c2df755f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.5.errors.txt
@@ -0,0 +1 @@
+4:5:Component elements may not contain properties other than id
diff --git a/tests/auto/qml/qqmllanguage/data/component.5.qml b/tests/auto/qml/qqmllanguage/data/component.5.qml
new file mode 100644
index 0000000000..9867377bb9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.5.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Component {
+ x: 10
+ QtObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/component.6.errors.txt b/tests/auto/qml/qqmllanguage/data/component.6.errors.txt
new file mode 100644
index 0000000000..2b1c6ca606
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.6.errors.txt
@@ -0,0 +1 @@
+4:5:Invalid component id specification
diff --git a/tests/auto/qml/qqmllanguage/data/component.6.qml b/tests/auto/qml/qqmllanguage/data/component.6.qml
new file mode 100644
index 0000000000..010949a35f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.6.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Component {
+ id: QtObject {}
+ QtObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/component.7.errors.txt b/tests/auto/qml/qqmllanguage/data/component.7.errors.txt
new file mode 100644
index 0000000000..b144814a70
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.7.errors.txt
@@ -0,0 +1 @@
+3:1:Component objects cannot declare new properties.
diff --git a/tests/auto/qml/qqmllanguage/data/component.7.qml b/tests/auto/qml/qqmllanguage/data/component.7.qml
new file mode 100644
index 0000000000..b1a31195eb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.7.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Component {
+ property int a
+ QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/component.8.errors.txt b/tests/auto/qml/qqmllanguage/data/component.8.errors.txt
new file mode 100644
index 0000000000..6f2d0d201d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.8.errors.txt
@@ -0,0 +1 @@
+3:1:Component objects cannot declare new signals.
diff --git a/tests/auto/qml/qqmllanguage/data/component.8.qml b/tests/auto/qml/qqmllanguage/data/component.8.qml
new file mode 100644
index 0000000000..fb7a079d39
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.8.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Component {
+ signal a
+ QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/component.9.errors.txt b/tests/auto/qml/qqmllanguage/data/component.9.errors.txt
new file mode 100644
index 0000000000..92f1456895
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.9.errors.txt
@@ -0,0 +1 @@
+3:1:Component objects cannot declare new functions.
diff --git a/tests/auto/qml/qqmllanguage/data/component.9.qml b/tests/auto/qml/qqmllanguage/data/component.9.qml
new file mode 100644
index 0000000000..17824b4ede
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/component.9.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Component {
+ function a() {}
+ QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/componentCompositeType.qml b/tests/auto/qml/qqmllanguage/data/componentCompositeType.qml
new file mode 100644
index 0000000000..232b320fb0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/componentCompositeType.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test
+
+ test: ComponentComposite {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/cppnamespace.2.qml b/tests/auto/qml/qqmllanguage/data/cppnamespace.2.qml
new file mode 100644
index 0000000000..e3b32ca5d8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/cppnamespace.2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MySecondNamespacedType {
+ list: [ MyNamespacedType {} ]
+}
diff --git a/tests/auto/qml/qqmllanguage/data/cppnamespace.qml b/tests/auto/qml/qqmllanguage/data/cppnamespace.qml
new file mode 100644
index 0000000000..e1daf3b78f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/cppnamespace.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+
+MyNamespacedType {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/crash2.qml b/tests/auto/qml/qqmllanguage/data/crash2.qml
new file mode 100644
index 0000000000..2b8d285348
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/crash2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ objectName: "Hello" + "World"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/customOnProperty.qml b/tests/auto/qml/qqmllanguage/data/customOnProperty.qml
new file mode 100644
index 0000000000..57241ffc28
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/customOnProperty.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property int on
+
+ Component.onCompleted: on = 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.errors.txt b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.errors.txt
new file mode 100644
index 0000000000..43a8bb28b3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.errors.txt
@@ -0,0 +1 @@
+4:19:ListElement: cannot use reserved "id" property
diff --git a/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.qml b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.qml
new file mode 100644
index 0000000000..c42173ddfb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/customParserIdNotAllowed.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+ListModel {
+ ListElement { a: 10 }
+ ListElement { id: foo; a: 12 }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/customParserTypes.qml b/tests/auto/qml/qqmllanguage/data/customParserTypes.qml
new file mode 100644
index 0000000000..76a8a4773f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/customParserTypes.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+ListModel {
+ ListElement { a: 10 }
+ ListElement { a: 12 }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/customVariantTypes.qml b/tests/auto/qml/qqmllanguage/data/customVariantTypes.qml
new file mode 100644
index 0000000000..0263ed20f2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/customVariantTypes.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ customType: "10"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/declaredPropertyValues.qml b/tests/auto/qml/qqmllanguage/data/declaredPropertyValues.qml
new file mode 100644
index 0000000000..03f5c1ff7e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/declaredPropertyValues.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a: 10
+ property int b: 10 + a
+ property QtObject c: QtObject {}
+ property list<QtObject> d: [ QtObject {}, QtObject {} ]
+}
diff --git a/tests/auto/qml/qqmllanguage/data/defaultGrouped.errors.txt b/tests/auto/qml/qqmllanguage/data/defaultGrouped.errors.txt
new file mode 100644
index 0000000000..32055f6608
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/defaultGrouped.errors.txt
@@ -0,0 +1 @@
+7:9:Cannot assign a value directly to a grouped property
diff --git a/tests/auto/qml/qqmllanguage/data/defaultGrouped.qml b/tests/auto/qml/qqmllanguage/data/defaultGrouped.qml
new file mode 100644
index 0000000000..66a78eb67f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/defaultGrouped.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ grouped {
+ script: console.log(1921)
+ QtObject {}
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml b/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml
new file mode 100644
index 0000000000..31d17fd55f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/defaultPropertyListOrder.qml
@@ -0,0 +1,29 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyContainer {
+ QtObject {
+ property int index: 0
+ }
+
+ QtObject {
+ property int index: 1
+ }
+
+ children: [
+ QtObject {
+ property int index: 2
+ },
+ QtObject {
+ property int index: 3
+ }
+ ]
+
+ QtObject {
+ property int index: 4
+ }
+
+ QtObject {
+ property int index: 5
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/destroyedSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/destroyedSignal.errors.txt
new file mode 100644
index 0000000000..3348494a8f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/destroyedSignal.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign to non-existent property "onDestroyed"
diff --git a/tests/auto/qml/qqmllanguage/data/destroyedSignal.qml b/tests/auto/qml/qqmllanguage/data/destroyedSignal.qml
new file mode 100644
index 0000000000..b5b29148a2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/destroyedSignal.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ onDestroyed: print("Hello World!")
+}
diff --git a/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.errors.txt b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.errors.txt
new file mode 100644
index 0000000000..e9b449d8d9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.errors.txt
@@ -0,0 +1 @@
+3:1:Type Test/MyRevisionedIllegalOverload 1.0 contains an illegal property "propA". This is an error in the type's implementation.
diff --git a/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.qml b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.qml
new file mode 100644
index 0000000000..612bcfe0ea
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/disallowedRevisionOverloads.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyRevisionedIllegalOverload
+{
+}
+
+
diff --git a/tests/auto/qml/qqmllanguage/data/dontDoubleCallClassBegin.qml b/tests/auto/qml/qqmllanguage/data/dontDoubleCallClassBegin.qml
new file mode 100644
index 0000000000..905ee48e0b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dontDoubleCallClassBegin.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property QtObject object: DontDoubleCallClassBeginItem {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/doubleSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/doubleSignal.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/doubleSignal.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/doubleSignal.qml b/tests/auto/qml/qqmllanguage/data/doubleSignal.qml
new file mode 100644
index 0000000000..fb07b9f659
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/doubleSignal.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyQmlObject {
+ onBasicSignal: console.log(1921)
+ onBasicSignal: console.log(1921)
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/duplicateIDs.errors.txt b/tests/auto/qml/qqmllanguage/data/duplicateIDs.errors.txt
new file mode 100644
index 0000000000..66241cf1f2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/duplicateIDs.errors.txt
@@ -0,0 +1 @@
+4:19:id is not unique
diff --git a/tests/auto/qml/qqmllanguage/data/duplicateIDs.qml b/tests/auto/qml/qqmllanguage/data/duplicateIDs.qml
new file mode 100644
index 0000000000..a993abdd37
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/duplicateIDs.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainer {
+ MyQmlObject { id: myID }
+ MyQmlObject { id: myID }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.errors.txt
new file mode 100644
index 0000000000..1f9f9169e9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.errors.txt
@@ -0,0 +1 @@
+5:5:Duplicate default property
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.qml
new file mode 100644
index 0000000000..3dbd5b0b2e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.1.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ default property QtObject a
+ default property QtObject b
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.errors.txt
new file mode 100644
index 0000000000..713d5f6272
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.errors.txt
@@ -0,0 +1 @@
+5:19:Duplicate property name
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.qml
new file mode 100644
index 0000000000..5d4efeebb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a
+ property bool a
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.errors.txt
new file mode 100644
index 0000000000..8226c16a1e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.errors.txt
@@ -0,0 +1 @@
+5:12:Duplicate signal name
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.qml
new file mode 100644
index 0000000000..f084947eaf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.3.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ signal a
+ signal a
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.errors.txt
new file mode 100644
index 0000000000..028e25c37f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.errors.txt
@@ -0,0 +1 @@
+5:14:Duplicate method name
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.qml
new file mode 100644
index 0000000000..3691529aa9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.4.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ function a() {}
+ function a() {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.errors.txt b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.errors.txt
new file mode 100644
index 0000000000..015d55b03b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.errors.txt
@@ -0,0 +1 @@
+3:1:UnknownType is not a type
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.qml b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.qml
new file mode 100644
index 0000000000..64ba907415
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicMeta.5.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property UnknownType a
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObject.1.qml b/tests/auto/qml/qqmllanguage/data/dynamicObject.1.qml
new file mode 100644
index 0000000000..2214bacda0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicObject.1.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import QtQuick 2.0
+MyCustomParserType {
+ propa: a + 10
+ propb: Math.min(a, 10)
+ propc: MyPropertyValueSource {}
+ onPropA: a
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml
new file mode 100644
index 0000000000..6f822ba157
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.2.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import QtQuick 2.0 as Qt47
+
+Qt.QtObject {
+ property Qt47.QtObject objectProperty
+ property list<Qt47.QtObject> objectPropertyList
+
+ objectProperty: QtObject {}
+ objectPropertyList: QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml
new file mode 100644
index 0000000000..5d072b160a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicObjectProperties.qml
@@ -0,0 +1,13 @@
+import Test 1.0
+import QtQuick 2.0
+import QtQuick 2.0 as Qt47
+
+QtObject {
+ property QtObject objectProperty
+ property QtObject objectProperty2
+ objectProperty2: QtObject {}
+
+ property MyComponent myComponentProperty
+ property MyComponent myComponentProperty2
+ myComponentProperty2: MyComponent {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicProperties.qml b/tests/auto/qml/qqmllanguage/data/dynamicProperties.qml
new file mode 100644
index 0000000000..cd403b3d46
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicProperties.qml
@@ -0,0 +1,13 @@
+import Test 1.0
+import QtQuick 2.0
+QtObject {
+ 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 url urlProperty: "main.qml"
+ property date dateProperty: "1945-09-02"
+ property variant varProperty: "Hello World!"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicPropertiesNested.qml b/tests/auto/qml/qqmllanguage/data/dynamicPropertiesNested.qml
new file mode 100644
index 0000000000..b86e89b5e7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicPropertiesNested.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+DynamicPropertiesNestedType {
+ property int a: 13
+ property int b: 12
+
+ super_a: 11
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/dynamicSignalsAndSlots.qml b/tests/auto/qml/qqmllanguage/data/dynamicSignalsAndSlots.qml
new file mode 100644
index 0000000000..d80d94be09
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/dynamicSignalsAndSlots.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+QtObject {
+ signal signal1
+ function slot1() {}
+ signal signal2
+ function slot2() {}
+
+ property int test: 0
+ function slot3(a) { console.log(1921); test = a; }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/empty.errors.txt b/tests/auto/qml/qqmllanguage/data/empty.errors.txt
new file mode 100644
index 0000000000..620db2bbba
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/empty.errors.txt
@@ -0,0 +1,2 @@
+1:1:Expected token `numeric literal'
+1:1:Expected a qualified name id
diff --git a/tests/auto/qml/qqmllanguage/data/empty.qml b/tests/auto/qml/qqmllanguage/data/empty.qml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/empty.qml
diff --git a/tests/auto/qml/qqmllanguage/data/emptySignal.errors.txt b/tests/auto/qml/qqmllanguage/data/emptySignal.errors.txt
new file mode 100644
index 0000000000..8b20434973
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/emptySignal.errors.txt
@@ -0,0 +1 @@
+4:5:Incorrectly specified signal assignment
diff --git a/tests/auto/qml/qqmllanguage/data/emptySignal.qml b/tests/auto/qml/qqmllanguage/data/emptySignal.qml
new file mode 100644
index 0000000000..c84fea3fe6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/emptySignal.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyQmlObject {
+ onBasicSignal {
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/enumTypes.errors.txt b/tests/auto/qml/qqmllanguage/data/enumTypes.errors.txt
new file mode 100644
index 0000000000..d4e0cc0bc4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/enumTypes.errors.txt
@@ -0,0 +1 @@
+3:1:Element is not creatable.
diff --git a/tests/auto/qml/qqmllanguage/data/enumTypes.qml b/tests/auto/qml/qqmllanguage/data/enumTypes.qml
new file mode 100644
index 0000000000..ff083250f0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/enumTypes.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Font {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/failingComponent.errors.txt b/tests/auto/qml/qqmllanguage/data/failingComponent.errors.txt
new file mode 100644
index 0000000000..364ca6747f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/failingComponent.errors.txt
@@ -0,0 +1 @@
+3:5:FailingComponent is not a type
diff --git a/tests/auto/qml/qqmllanguage/data/failingComponentTest.qml b/tests/auto/qml/qqmllanguage/data/failingComponentTest.qml
new file mode 100644
index 0000000000..74a6acfc49
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/failingComponentTest.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ FailingComponent {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/fakeDotProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.errors.txt
new file mode 100644
index 0000000000..30748234bc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid grouped property access
diff --git a/tests/auto/qml/qqmllanguage/data/fakeDotProperty.qml b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.qml
new file mode 100644
index 0000000000..d971eee4d0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/fakeDotProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value.something: "hello"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/finalOverride.errors.txt b/tests/auto/qml/qqmllanguage/data/finalOverride.errors.txt
new file mode 100644
index 0000000000..49e06cbdf5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/finalOverride.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot override FINAL property
diff --git a/tests/auto/qml/qqmllanguage/data/finalOverride.qml b/tests/auto/qml/qqmllanguage/data/finalOverride.qml
new file mode 100644
index 0000000000..a84393af94
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/finalOverride.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ property int value: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/globalEnums.qml b/tests/auto/qml/qqmllanguage/data/globalEnums.qml
new file mode 100644
index 0000000000..fa248d544d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/globalEnums.qml
@@ -0,0 +1,55 @@
+import QtQuick 2.0
+import Test 1.0
+
+Item {
+ MyEnum1Class {
+ id: enum1Class
+ objectName: "enum1Class"
+ }
+
+ MyEnumDerivedClass {
+ id: enumDerivedClass
+ objectName: "enumDerivedClass"
+
+ onValueAChanged: {
+ aValue = newValue;
+ }
+
+ onValueBChanged: {
+ bValue = newValue;
+ }
+
+ onValueCChanged: {
+ cValue = newValue;
+ }
+
+ onValueDChanged: {
+ dValue = newValue;
+ }
+
+ onValueEChanged: {
+ eValue = newValue;
+ }
+
+ onValueE2Changed: {
+ e2Value = newValue;
+ }
+
+ property int aValue: 0
+ property int bValue: 0
+ property int cValue: 0
+ property int dValue: 0
+ property int eValue: 0
+ property int e2Value: 0
+ }
+
+ function setEnumValues() {
+ enum1Class.setValue(MyEnum1Class.A_13);
+ enumDerivedClass.setValueA(MyEnum1Class.A_11);
+ enumDerivedClass.setValueB(MyEnum2Class.B_37);
+ enumDerivedClass.setValueC(Qt.RichText);
+ enumDerivedClass.setValueD(Qt.ElideMiddle);
+ enumDerivedClass.setValueE(MyEnum2Class.E_14);
+ enumDerivedClass.setValueE2(MyEnum2Class.E_76);
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyNames.qml b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyNames.qml
new file mode 100644
index 0000000000..558c836e52
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyNames.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ property int áâãäå: 10
+ stringProperty: "Test áâãäå: " + áâãäå
+}
diff --git a/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyUse.qml b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyUse.qml
new file mode 100644
index 0000000000..74918e2764
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/i18nDeclaredPropertyUse.qml
@@ -0,0 +1,3 @@
+I18n {
+ áâãäå: 15
+}
diff --git a/tests/auto/qml/qqmllanguage/data/i18nNameSpace.qml b/tests/auto/qml/qqmllanguage/data/i18nNameSpace.qml
new file mode 100644
index 0000000000..c0b2f94857
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/i18nNameSpace.qml
@@ -0,0 +1,5 @@
+import Test 1.0 as Ãâãäå
+
+Ãâãäå.MyTypeObject {
+ stringProperty: "Test áâãäå: 40"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/i18nScript.qml b/tests/auto/qml/qqmllanguage/data/i18nScript.qml
new file mode 100644
index 0000000000..e77cb52074
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/i18nScript.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ function val() {
+ var áâãäå = 20
+ return "Test áâãäå: " + áâãäå
+ }
+ stringProperty: val()
+}
diff --git a/tests/auto/qml/qqmllanguage/data/i18nStrings.qml b/tests/auto/qml/qqmllanguage/data/i18nStrings.qml
new file mode 100644
index 0000000000..764c92639a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/i18nStrings.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ stringProperty: "Test áâãäå (5 accented 'a' letters)"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/i18nType.qml b/tests/auto/qml/qqmllanguage/data/i18nType.qml
new file mode 100644
index 0000000000..d7954ef718
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/i18nType.qml
@@ -0,0 +1 @@
+I18nTypeÃâãäå { }
diff --git a/tests/auto/qml/qqmllanguage/data/idProperty.qml b/tests/auto/qml/qqmllanguage/data/idProperty.qml
new file mode 100644
index 0000000000..bf048ea60a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/idProperty.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+MyContainer {
+ property variant object : myObjectId
+
+ MyTypeObject {
+ id: "myObjectId"
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importFile.errors.txt b/tests/auto/qml/qqmllanguage/data/importFile.errors.txt
new file mode 100644
index 0000000000..3fdac0921e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importFile.errors.txt
@@ -0,0 +1 @@
+1:1:"MyComponent.qml": no such directory
diff --git a/tests/auto/qml/qqmllanguage/data/importFile.qml b/tests/auto/qml/qqmllanguage/data/importFile.qml
new file mode 100644
index 0000000000..a0d8410ca3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importFile.qml
@@ -0,0 +1,3 @@
+import "MyComponent.qml" 1.0
+
+MyComponent { text: "Hello" }
diff --git a/tests/auto/qml/qqmllanguage/data/importIncorrectCase.qml b/tests/auto/qml/qqmllanguage/data/importIncorrectCase.qml
new file mode 100644
index 0000000000..804e76b932
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importIncorrectCase.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+import com.Nokia.installedtest 1.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.1.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.1.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.1.errors.txt
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.1.qml b/tests/auto/qml/qqmllanguage/data/importJs.1.qml
new file mode 100644
index 0000000000..89344c02cc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.1.qml
@@ -0,0 +1,12 @@
+import org.qtproject.PureJsModule 1.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Hello") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.10.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.10.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.10.errors.txt
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.10.qml b/tests/auto/qml/qqmllanguage/data/importJs.10.qml
new file mode 100644
index 0000000000..c0bb730ac7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.10.qml
@@ -0,0 +1,16 @@
+import org.qtproject.PureJsModule 1.0 as PJM
+import org.qtproject.PureJsModule 1.0 as AnotherName
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((PJM.FirstAPI.greeting() == "Hello") &&
+ (PJM.FirstAPI.major == 1) &&
+ (PJM.FirstAPI.minor == 0) &&
+ (AnotherName.FirstAPI.greeting() == "Hello") &&
+ (AnotherName.FirstAPI.major == 1) &&
+ (AnotherName.FirstAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.2.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.2.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.2.errors.txt
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.2.qml b/tests/auto/qml/qqmllanguage/data/importJs.2.qml
new file mode 100644
index 0000000000..5a0659fb26
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.2.qml
@@ -0,0 +1,12 @@
+import org.qtproject.VersionedOnlyJsModule 9.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((SomeAPI.greeting() == "Hey hey hey") &&
+ (SomeAPI.major == 9) &&
+ (SomeAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.3.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.3.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.3.errors.txt
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.3.qml b/tests/auto/qml/qqmllanguage/data/importJs.3.qml
new file mode 100644
index 0000000000..e241d610ae
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.3.qml
@@ -0,0 +1,16 @@
+import org.qtproject.PureJsModule 1.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Hello") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 0) &&
+ (SecondAPI.greeting() == "Howdy") &&
+ (SecondAPI.major == 1) &&
+ (SecondAPI.minor == 5))
+
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.4.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.4.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.4.errors.txt
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.4.qml b/tests/auto/qml/qqmllanguage/data/importJs.4.qml
new file mode 100644
index 0000000000..d323cfab3b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.4.qml
@@ -0,0 +1,15 @@
+import org.qtproject.PureJsModule 1.6
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Good news, everybody!") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 6) &&
+ (SecondAPI.greeting() == "Howdy") &&
+ (SecondAPI.major == 1) &&
+ (SecondAPI.minor == 5))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.5.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.5.errors.txt
new file mode 100644
index 0000000000..7f8648bace
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.5.errors.txt
@@ -0,0 +1 @@
+1:1:module "org.qtproject.VersionedOnlyJsModule" is not installed
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.5.qml b/tests/auto/qml/qqmllanguage/data/importJs.5.qml
new file mode 100644
index 0000000000..c0a77dada2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.5.qml
@@ -0,0 +1,6 @@
+import org.qtproject.VersionedOnlyJsModule 1.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.6.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.6.errors.txt
new file mode 100644
index 0000000000..53b7ade8bf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.6.errors.txt
@@ -0,0 +1 @@
+2:1:"org.qtproject.VersionedOnlyJsModule" is ambiguous.
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.6.qml b/tests/auto/qml/qqmllanguage/data/importJs.6.qml
new file mode 100644
index 0000000000..e5f2e13f10
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.6.qml
@@ -0,0 +1,13 @@
+import org.qtproject.VersionedOnlyJsModule 9.0
+import org.qtproject.VersionedOnlyJsModule 9.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((SomeAPI.greeting() == "Hey hey hey") &&
+ (SomeAPI.major == 9) &&
+ (SomeAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.7.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.7.errors.txt
new file mode 100644
index 0000000000..8a5f3c6721
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.7.errors.txt
@@ -0,0 +1 @@
+2:1:"org.qtproject.PureJsModule" is ambiguous.
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.7.qml b/tests/auto/qml/qqmllanguage/data/importJs.7.qml
new file mode 100644
index 0000000000..7b3501ad8f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.7.qml
@@ -0,0 +1,13 @@
+import org.qtproject.PureJsModule 1.0
+import org.qtproject.PureJsModule 1.6
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((FirstAPI.greeting() == "Hello") &&
+ (FirstAPI.major == 1) &&
+ (FirstAPI.minor == 0))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.8.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.8.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.8.errors.txt
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.8.qml b/tests/auto/qml/qqmllanguage/data/importJs.8.qml
new file mode 100644
index 0000000000..0d5ad052e7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.8.qml
@@ -0,0 +1,15 @@
+import org.qtproject.PureJsModule 1.5 as PJM
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((PJM.FirstAPI.greeting() == "Hello") &&
+ (PJM.FirstAPI.major == 1) &&
+ (PJM.FirstAPI.minor == 0) &&
+ (PJM.SecondAPI.greeting() == "Howdy") &&
+ (PJM.SecondAPI.major == 1) &&
+ (PJM.SecondAPI.minor == 5))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.9.errors.txt b/tests/auto/qml/qqmllanguage/data/importJs.9.errors.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.9.errors.txt
diff --git a/tests/auto/qml/qqmllanguage/data/importJs.9.qml b/tests/auto/qml/qqmllanguage/data/importJs.9.qml
new file mode 100644
index 0000000000..9b6dc1e073
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importJs.9.qml
@@ -0,0 +1,19 @@
+import org.qtproject.PureJsModule 1.5 as PJM_1_5
+import org.qtproject.PureJsModule 1.6 as PJM_1_6
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ Component.onCompleted: {
+ test = ((PJM_1_5.FirstAPI.greeting() == "Hello") &&
+ (PJM_1_5.FirstAPI.major == 1) &&
+ (PJM_1_5.FirstAPI.minor == 0) &&
+ (PJM_1_5.SecondAPI.greeting() == "Howdy") &&
+ (PJM_1_5.SecondAPI.major == 1) &&
+ (PJM_1_5.SecondAPI.minor == 5) &&
+ (PJM_1_6.FirstAPI.greeting() == "Good news, everybody!") &&
+ (PJM_1_6.FirstAPI.major == 1) &&
+ (PJM_1_6.FirstAPI.minor == 6))
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.errors.txt b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.errors.txt
new file mode 100644
index 0000000000..231998daf7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.errors.txt
@@ -0,0 +1 @@
+4:1:Namespace Rectangle cannot be used as a type
diff --git a/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.qml b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.qml
new file mode 100644
index 0000000000..45ad40501b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNamespaceConflict.qml
@@ -0,0 +1,4 @@
+import Test 1.0 as Rectangle
+import QtQuick 2.0
+
+Rectangle { }
diff --git a/tests/auto/qml/qqmllanguage/data/importNewerVersion.errors.txt b/tests/auto/qml/qqmllanguage/data/importNewerVersion.errors.txt
new file mode 100644
index 0000000000..413f096384
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNewerVersion.errors.txt
@@ -0,0 +1 @@
+1:1:module "Test" version 2.0 is not installed
diff --git a/tests/auto/qml/qqmllanguage/data/importNewerVersion.qml b/tests/auto/qml/qqmllanguage/data/importNewerVersion.qml
new file mode 100644
index 0000000000..c4a0d386a4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNewerVersion.qml
@@ -0,0 +1,3 @@
+import Test 2.0
+
+MyTypeObject { }
diff --git a/tests/auto/qml/qqmllanguage/data/importNonExist.errors.txt b/tests/auto/qml/qqmllanguage/data/importNonExist.errors.txt
new file mode 100644
index 0000000000..1baf05cee0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNonExist.errors.txt
@@ -0,0 +1 @@
+2:1:"will-not-be-found": no such directory
diff --git a/tests/auto/qml/qqmllanguage/data/importNonExist.qml b/tests/auto/qml/qqmllanguage/data/importNonExist.qml
new file mode 100644
index 0000000000..5cbee0264b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNonExist.qml
@@ -0,0 +1,5 @@
+// imports...
+import "will-not-be-found"
+import QtQuick 2.0
+
+Rectangle { }
diff --git a/tests/auto/qml/qqmllanguage/data/importNonExistOlder.errors.txt b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.errors.txt
new file mode 100644
index 0000000000..dfa7a369ff
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.errors.txt
@@ -0,0 +1 @@
+1:1:module "Test" version 0.1 is not installed
diff --git a/tests/auto/qml/qqmllanguage/data/importNonExistOlder.qml b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.qml
new file mode 100644
index 0000000000..18514b1efa
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importNonExistOlder.qml
@@ -0,0 +1,3 @@
+import Test 0.1
+
+MyTypeObject { }
diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.errors.txt b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.errors.txt
new file mode 100644
index 0000000000..c7d880e79e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.errors.txt
@@ -0,0 +1 @@
+1:16:Library import requires a version
diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.qml b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.qml
new file mode 100644
index 0000000000..23ed566e15
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingBuiltIn.qml
@@ -0,0 +1,7 @@
+import Test as S
+
+S.MyQmlObject {
+ property real x;
+ property real y;
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.errors.txt b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.errors.txt
new file mode 100644
index 0000000000..59b0b87477
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.errors.txt
@@ -0,0 +1 @@
+1:39:Library import requires a version
diff --git a/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.qml b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.qml
new file mode 100644
index 0000000000..6ad2a812e9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importVersionMissingInstalled.qml
@@ -0,0 +1,3 @@
+import org.qtproject.installedtest as T
+
+T.InstalledTest {}
diff --git a/tests/auto/qml/qqmllanguage/data/importscript.1.errors.txt b/tests/auto/qml/qqmllanguage/data/importscript.1.errors.txt
new file mode 100644
index 0000000000..ebc936d153
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importscript.1.errors.txt
@@ -0,0 +1 @@
+1:8:Script import requires a qualifier
diff --git a/tests/auto/qml/qqmllanguage/data/importscript.1.qml b/tests/auto/qml/qqmllanguage/data/importscript.1.qml
new file mode 100644
index 0000000000..2b2ab6ba0d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/importscript.1.qml
@@ -0,0 +1,3 @@
+import "test.js"
+
+Item { }
diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.insensitive.txt b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.insensitive.txt
new file mode 100644
index 0000000000..3813680562
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.insensitive.txt
@@ -0,0 +1,2 @@
+3:1:Type IncorrectCaseType unavailable
+-1:-1:File name case mismatch
diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.sensitive.txt b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.sensitive.txt
new file mode 100644
index 0000000000..abed1a73f5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/incorrectCase.errors.sensitive.txt
@@ -0,0 +1 @@
+3:1:IncorrectCaseType is not a type
diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCase.qml b/tests/auto/qml/qqmllanguage/data/incorrectCase.qml
new file mode 100644
index 0000000000..15b6dc3a6e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/incorrectCase.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+IncorrectCaseType {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/incorrectCaseType.qml b/tests/auto/qml/qqmllanguage/data/incorrectCaseType.qml
new file mode 100644
index 0000000000..addc4265a9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/incorrectCaseType.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/inlineAssignmentsOverrideBindings.qml b/tests/auto/qml/qqmllanguage/data/inlineAssignmentsOverrideBindings.qml
new file mode 100644
index 0000000000..4390d22d45
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/inlineAssignmentsOverrideBindings.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+InlineAssignmentsOverrideBindingsType {
+ property int test: nested.value
+ nested.value: 11
+}
diff --git a/tests/auto/qml/qqmllanguage/data/inlineQmlComponents.qml b/tests/auto/qml/qqmllanguage/data/inlineQmlComponents.qml
new file mode 100644
index 0000000000..a6f277adb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/inlineQmlComponents.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+import QtQuick 2.0
+MyContainer {
+ Component {
+ id: myComponent
+ MyQmlObject {
+ value: 11
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.errors.txt b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.errors.txt
new file mode 100644
index 0000000000..651009cf05
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.errors.txt
@@ -0,0 +1 @@
+9:5:Expected a qualified name id
diff --git a/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml
new file mode 100644
index 0000000000..4e561b48b2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+
+MyQmlObject {
+ function foo()
+ {
+ return
+ }
+
+ 1223
+}
diff --git a/tests/auto/qml/qqmllanguage/data/interfaceProperty.qml b/tests/auto/qml/qqmllanguage/data/interfaceProperty.qml
new file mode 100644
index 0000000000..f85e3e4e5b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/interfaceProperty.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import QtQuick 2.0
+MyQmlObject {
+ interfaceProperty: MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/interfaceQList.qml b/tests/auto/qml/qqmllanguage/data/interfaceQList.qml
new file mode 100644
index 0000000000..c87dfae785
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/interfaceQList.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+MyContainer {
+ qlistInterfaces: [
+ MyQmlObject {},
+ MyQmlObject {}
+ ]
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.errors.txt
new file mode 100644
index 0000000000..9848e48579
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.errors.txt
@@ -0,0 +1 @@
+3:1:No property alias location
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.1.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.qml
new file mode 100644
index 0000000000..8aab61e49e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property alias a
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt
new file mode 100644
index 0000000000..93652a7042
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias location
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.10.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.qml
new file mode 100644
index 0000000000..3ff7b16fd8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.10.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: root.rectProperty.blah
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.errors.txt
new file mode 100644
index 0000000000..3e15628a13
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.errors.txt
@@ -0,0 +1 @@
+4:23:Invalid alias location
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.2.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.qml
new file mode 100644
index 0000000000..b85b2584eb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property alias a: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.errors.txt
new file mode 100644
index 0000000000..fbf1b580e2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property>
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.3.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.qml
new file mode 100644
index 0000000000..a363373734
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.3.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: root.rectProperty.x.y
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.errors.txt
new file mode 100644
index 0000000000..fbf1b580e2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property>
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.4.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.qml
new file mode 100644
index 0000000000..cfdfca0590
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.4.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: print("Hello!")
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.errors.txt
new file mode 100644
index 0000000000..6f78e599d4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias reference. Unable to find id "otherroot"
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.5.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.qml
new file mode 100644
index 0000000000..0c1d5d7ef1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.5.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: otherroot
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt
new file mode 100644
index 0000000000..93652a7042
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias location
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.6.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.qml
new file mode 100644
index 0000000000..edfdb24bcc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.6.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: root.foobar
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt
new file mode 100644
index 0000000000..93652a7042
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias location
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.7.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.qml
new file mode 100644
index 0000000000..2a09648d57
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.7.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: root.nonScriptable
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt
new file mode 100644
index 0000000000..93652a7042
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias location
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.8.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.qml
new file mode 100644
index 0000000000..4faa52d250
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.8.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: root.imaginary.x
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt
new file mode 100644
index 0000000000..93652a7042
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt
@@ -0,0 +1 @@
+5:23:Invalid alias location
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAlias.9.qml b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.qml
new file mode 100644
index 0000000000..f1839127b0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAlias.9.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ id: root
+ property alias a: root.floatProperty.x
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.errors.txt
new file mode 100644
index 0000000000..492bbb48fa
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.errors.txt
@@ -0,0 +1 @@
+5:17:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.qml
new file mode 100644
index 0000000000..20864b9a41
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.1.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ MyQmlObject.foo: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.errors.txt
new file mode 100644
index 0000000000..ff2409bd2d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.errors.txt
@@ -0,0 +1 @@
+5:15:Non-existent attached object
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.qml
new file mode 100644
index 0000000000..20906de606
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.10.qml
@@ -0,0 +1,6 @@
+import Test 1.0 as Namespace
+import QtQuick 2.0
+
+QtObject {
+ Namespace.MadeUpClass.foo: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt
new file mode 100644
index 0000000000..fee5050743
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.errors.txt
@@ -0,0 +1 @@
+5:15:Not an attached property name
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.qml
new file mode 100644
index 0000000000..95add15147
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.11.qml
@@ -0,0 +1,7 @@
+import Test 1.0 as Namespace
+import QtQuick 2.0
+
+QtObject {
+ Namespace.madeUpClass.foo: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.errors.txt
new file mode 100644
index 0000000000..189a795837
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.errors.txt
@@ -0,0 +1 @@
+4:13:Attached properties cannot be used here
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.qml
new file mode 100644
index 0000000000..7de503e766
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.12.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped.MyQmlObject.value: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.errors.txt
new file mode 100644
index 0000000000..46d7be2ac3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.errors.txt
@@ -0,0 +1 @@
+5:9:Attached properties cannot be used here
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.qml
new file mode 100644
index 0000000000..986ab855c5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.13.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped {
+ MyQmlObject.value: 10
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.errors.txt
new file mode 100644
index 0000000000..34de769e13
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.errors.txt
@@ -0,0 +1 @@
+5:27:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.qml
new file mode 100644
index 0000000000..050e619ff2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0 as Namespace
+import QtQuick 2.0
+
+QtObject {
+ Namespace.MyQmlObject.foo: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.errors.txt
new file mode 100644
index 0000000000..05161c4d10
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.errors.txt
@@ -0,0 +1 @@
+5:5:Invalid attached object assignment
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.qml
new file mode 100644
index 0000000000..24b09a53d5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.3.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ MyQmlObject: 10
+}
+
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.errors.txt
new file mode 100644
index 0000000000..a208bcfaa7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.errors.txt
@@ -0,0 +1 @@
+5:15:Invalid attached object assignment
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.qml
new file mode 100644
index 0000000000..fb38ee9536
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.4.qml
@@ -0,0 +1,7 @@
+import Test 1.0 as Namespace
+import QtQuick 2.0
+
+QtObject {
+ Namespace.MyQmlObject: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.errors.txt
new file mode 100644
index 0000000000..05161c4d10
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.errors.txt
@@ -0,0 +1 @@
+5:5:Invalid attached object assignment
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.qml
new file mode 100644
index 0000000000..789e42f7ef
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.5.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ MyQmlObject: QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.errors.txt
new file mode 100644
index 0000000000..6770e1f30b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.errors.txt
@@ -0,0 +1 @@
+5:5:Non-existent attached object
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.qml
new file mode 100644
index 0000000000..9060a55d00
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.6.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ Test.MyQmlObject: QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.errors.txt
new file mode 100644
index 0000000000..6770e1f30b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.errors.txt
@@ -0,0 +1 @@
+5:5:Non-existent attached object
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.qml
new file mode 100644
index 0000000000..47b6cc37d8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.7.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ MyTypeObject.foo: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.errors.txt
new file mode 100644
index 0000000000..ff2409bd2d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.errors.txt
@@ -0,0 +1 @@
+5:15:Non-existent attached object
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.qml
new file mode 100644
index 0000000000..146934f7ac
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.8.qml
@@ -0,0 +1,6 @@
+import Test 1.0 as Namespace
+import QtQuick 2.0
+
+QtObject {
+ Namespace.MyTypeObject.foo: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.errors.txt
new file mode 100644
index 0000000000..6770e1f30b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.errors.txt
@@ -0,0 +1 @@
+5:5:Non-existent attached object
diff --git a/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.qml b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.qml
new file mode 100644
index 0000000000..73724aa6e7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidAttachedProperty.9.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ MadeUpClass.foo: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt
new file mode 100644
index 0000000000..810fd31b41
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt
@@ -0,0 +1 @@
+5:5:Invalid grouped property access
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml
new file mode 100644
index 0000000000..fa46b8242a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant o;
+ o.blah: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.errors.txt
new file mode 100644
index 0000000000..1fcb1b65f5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.errors.txt
@@ -0,0 +1 @@
+4:14:Cannot assign a value directly to a grouped property
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.qml
new file mode 100644
index 0000000000..41aa3e2923
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.10.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped: "10x10"
+ grouped.value: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.errors.txt
new file mode 100644
index 0000000000..810fd31b41
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.errors.txt
@@ -0,0 +1 @@
+5:5:Invalid grouped property access
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml
new file mode 100644
index 0000000000..3e516738d6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.2.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property int o;
+ o.blah: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt
new file mode 100644
index 0000000000..f6d6f29fbf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt
@@ -0,0 +1 @@
+4:5:Invalid grouped property access
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.qml
new file mode 100644
index 0000000000..0bbfc4f529
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyQmlObject {
+ customType.x: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.errors.txt
new file mode 100644
index 0000000000..69c68716d9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.qml
new file mode 100644
index 0000000000..134fef9b0a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.4.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyQmlObject {
+ foo.x: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.errors.txt
new file mode 100644
index 0000000000..2c8a970da7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.errors.txt
@@ -0,0 +1 @@
+4:18:Property assignment expected
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.qml
new file mode 100644
index 0000000000..55cefe66b9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.5.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.x.foo: 100
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.qml
new file mode 100644
index 0000000000..9ec33abe7b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.6.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.x: 100
+ rectProperty.x: 101
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt
new file mode 100644
index 0000000000..4a7e3830a8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt
@@ -0,0 +1 @@
+4:-1:Cannot set properties on nullGrouped as it is null
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.qml
new file mode 100644
index 0000000000..977539a357
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ nullGrouped.script: console.log(1921)
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.errors.txt
new file mode 100644
index 0000000000..fa0da21c55
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.errors.txt
@@ -0,0 +1 @@
+5:19:Property has already been assigned a value
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.qml
new file mode 100644
index 0000000000..56fca9b990
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.8.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ pointProperty: "10x10"
+ pointProperty.x: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.errors.txt
new file mode 100644
index 0000000000..6d837a7222
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.errors.txt
@@ -0,0 +1 @@
+5:20:Property has already been assigned a value
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.qml b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.qml
new file mode 100644
index 0000000000..982ab26051
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.9.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ pointProperty.x: 10
+ pointProperty: "10x10"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.2.errors.txt
new file mode 100644
index 0000000000..2c6b8bf0f3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.2.errors.txt
@@ -0,0 +1,2 @@
+3:9:Invalid empty ID
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.2.qml b/tests/auto/qml/qqmllanguage/data/invalidID.2.qml
new file mode 100644
index 0000000000..4fb3b298dd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: ""
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.3.errors.txt
new file mode 100644
index 0000000000..bb811cfe9d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.3.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid use of id property
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.3.qml b/tests/auto/qml/qqmllanguage/data/invalidID.3.qml
new file mode 100644
index 0000000000..668417286b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id.other: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.4.errors.txt
new file mode 100644
index 0000000000..c721fe91bf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.4.errors.txt
@@ -0,0 +1 @@
+4:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.4.qml b/tests/auto/qml/qqmllanguage/data/invalidID.4.qml
new file mode 100644
index 0000000000..86010bf792
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.4.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyQmlObject {
+ id: hello
+ id: world
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.5.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.5.errors.txt
new file mode 100644
index 0000000000..c167de382e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.5.errors.txt
@@ -0,0 +1 @@
+2:20:Invalid import qualifier ID
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.5.qml b/tests/auto/qml/qqmllanguage/data/invalidID.5.qml
new file mode 100644
index 0000000000..5b92a1a0eb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/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/qml/qqmllanguage/data/invalidID.6.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.6.errors.txt
new file mode 100644
index 0000000000..7251de118f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.6.errors.txt
@@ -0,0 +1 @@
+3:9:IDs cannot start with an uppercase letter
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.6.qml b/tests/auto/qml/qqmllanguage/data/invalidID.6.qml
new file mode 100644
index 0000000000..62187d9473
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.6.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: StartsWithUpperCase
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.7.errors.txt
new file mode 100644
index 0000000000..e4fd1db3f0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.7.errors.txt
@@ -0,0 +1 @@
+3:9:ID illegally masks global JavaScript property
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.7.qml b/tests/auto/qml/qqmllanguage/data/invalidID.7.qml
new file mode 100644
index 0000000000..d4bc539650
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.7.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: gc
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.8.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.8.errors.txt
new file mode 100644
index 0000000000..b03ec6ccea
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.8.errors.txt
@@ -0,0 +1 @@
+3:9:IDs must contain only letters, numbers, and underscores
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.8.qml b/tests/auto/qml/qqmllanguage/data/invalidID.8.qml
new file mode 100644
index 0000000000..1ea615c32e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.8.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: hello.world
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.9.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.9.errors.txt
new file mode 100644
index 0000000000..c010e79492
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.9.errors.txt
@@ -0,0 +1 @@
+3:9:IDs must start with a letter or underscore
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.9.qml b/tests/auto/qml/qqmllanguage/data/invalidID.9.qml
new file mode 100644
index 0000000000..57474b7212
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.9.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: "3hello"
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.errors.txt
new file mode 100644
index 0000000000..c010e79492
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.errors.txt
@@ -0,0 +1 @@
+3:9:IDs must start with a letter or underscore
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.qml b/tests/auto/qml/qqmllanguage/data/invalidID.qml
new file mode 100644
index 0000000000..04db3eb67c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ id: 1
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidImportID.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidImportID.errors.txt
new file mode 100644
index 0000000000..034e937366
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidImportID.errors.txt
@@ -0,0 +1 @@
+2:23:Invalid import qualifier ID
diff --git a/tests/auto/qml/qqmllanguage/data/invalidImportID.qml b/tests/auto/qml/qqmllanguage/data/invalidImportID.qml
new file mode 100644
index 0000000000..37e7c5d4d0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidImportID.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+import QtQuick 2.0 as qt
+
+QtObject {}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidOn.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidOn.errors.txt
new file mode 100644
index 0000000000..b4210a11fc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidOn.errors.txt
@@ -0,0 +1 @@
+3:5:"MyQmlObject" cannot operate on "value"
diff --git a/tests/auto/qml/qqmllanguage/data/invalidOn.qml b/tests/auto/qml/qqmllanguage/data/invalidOn.qml
new file mode 100644
index 0000000000..d748bf4755
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidOn.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ MyQmlObject on value {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidProperty.errors.txt
new file mode 100644
index 0000000000..e9e27c479b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidProperty.errors.txt
@@ -0,0 +1 @@
+4:18:Illegal property name
diff --git a/tests/auto/qml/qqmllanguage/data/invalidProperty.qml b/tests/auto/qml/qqmllanguage/data/invalidProperty.qml
new file mode 100644
index 0000000000..f9b322e35c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidProperty.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int parseInt
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.errors.txt
new file mode 100644
index 0000000000..eff7c0e6c4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.errors.txt
@@ -0,0 +1 @@
+1:1:Expected a qualified name id
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml
new file mode 100644
index 0000000000..2c63c08510
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.errors.txt
new file mode 100644
index 0000000000..4bcc948e92
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.errors.txt
@@ -0,0 +1 @@
+1:1:Expected type name
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.2.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.qml
new file mode 100644
index 0000000000..427827ca89
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.2.qml
@@ -0,0 +1,2 @@
+foo {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.errors.txt
new file mode 100644
index 0000000000..fdce1abf06
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.errors.txt
@@ -0,0 +1 @@
+3:5:Expected type name
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.3.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.qml
new file mode 100644
index 0000000000..65e93ed55d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.3.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0 as Foo
+
+Foo.foo {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.errors.txt
new file mode 100644
index 0000000000..3b90f573a2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.errors.txt
@@ -0,0 +1 @@
+3:1:Bar.Item - Bar is not a namespace
diff --git a/tests/auto/qml/qqmllanguage/data/invalidRoot.4.qml b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.qml
new file mode 100644
index 0000000000..ba4c8ae1f7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidRoot.4.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0 as Foo
+
+Bar.Item {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.errors.txt
new file mode 100644
index 0000000000..4bcc948e92
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.errors.txt
@@ -0,0 +1 @@
+1:1:Expected type name
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.qml
new file mode 100644
index 0000000000..658b72d9f2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.1.qml
@@ -0,0 +1,2 @@
+item {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.errors.txt
new file mode 100644
index 0000000000..fdce1abf06
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.errors.txt
@@ -0,0 +1 @@
+3:5:Expected type name
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.qml
new file mode 100644
index 0000000000..9c83238282
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0 as Foo
+
+Foo.item {
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.errors.txt
new file mode 100644
index 0000000000..208df2b84a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.errors.txt
@@ -0,0 +1 @@
+5:9:Expected type name
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.qml
new file mode 100644
index 0000000000..2f7027081e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.3.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0 as Foo
+
+Foo.Item {
+
+ Foo.item {
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.errors.txt
new file mode 100644
index 0000000000..3b90f573a2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.errors.txt
@@ -0,0 +1 @@
+3:1:Bar.Item - Bar is not a namespace
diff --git a/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.qml b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.qml
new file mode 100644
index 0000000000..ba4c8ae1f7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidTypeName.4.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0 as Foo
+
+Bar.Item {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.1.6.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.1.6.js
new file mode 100644
index 0000000000..c7b3c8b6ca
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.1.6.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 6
+
+function greeting() { return "Good news, everybody!" }
+
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.js
new file mode 100644
index 0000000000..b90033eeb4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/FirstAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 0
+
+function greeting() { return "Hello" }
+
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/SecondAPI.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/SecondAPI.js
new file mode 100644
index 0000000000..b802477cb6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/SecondAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 5
+
+function greeting() { return "Howdy" }
+
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/qmldir
new file mode 100644
index 0000000000..083afb051c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule.1.6/qmldir
@@ -0,0 +1,3 @@
+FirstAPI 1.0 FirstAPI.js
+FirstAPI 1.6 FirstAPI.1.6.js
+SecondAPI 1.5 SecondAPI.js
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/FirstAPI.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/FirstAPI.js
new file mode 100644
index 0000000000..b90033eeb4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/FirstAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 0
+
+function greeting() { return "Hello" }
+
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/SecondAPI.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/SecondAPI.js
new file mode 100644
index 0000000000..b802477cb6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/SecondAPI.js
@@ -0,0 +1,5 @@
+var major = 1
+var minor = 5
+
+function greeting() { return "Howdy" }
+
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/qmldir
new file mode 100644
index 0000000000..5c3acebd39
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/PureJsModule/qmldir
@@ -0,0 +1,2 @@
+FirstAPI 1.0 FirstAPI.js
+SecondAPI 1.5 SecondAPI.js
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/SomeAPI.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/SomeAPI.js
new file mode 100644
index 0000000000..efac613fc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/SomeAPI.js
@@ -0,0 +1,5 @@
+var major = 9
+var minor = 0
+
+function greeting() { return "Hey hey hey" }
+
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/qmldir
new file mode 100644
index 0000000000..5c1b182028
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/VersionedOnlyJsModule.9.0/qmldir
@@ -0,0 +1 @@
+SomeAPI 9.0 SomeAPI.js
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest.qml
new file mode 100644
index 0000000000..56daa9c09a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0 as Qt47
+Qt47.Rectangle {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest2.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest2.qml
new file mode 100644
index 0000000000..59df88216e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/InstalledTest2.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Text {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/LocalLast.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/LocalLast.qml
new file mode 100644
index 0000000000..26a5d6bba9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/LocalLast.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Rectangle {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/PrivateType.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/PrivateType.qml
new file mode 100644
index 0000000000..ed1b09e419
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/PrivateType.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Image {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/qmldir
new file mode 100644
index 0000000000..d15720a154
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest/qmldir
@@ -0,0 +1,4 @@
+Rectangle 1.5 InstalledTest2.qml
+LocalLast 1.0 LocalLast.qml
+InstalledTest 1.4 InstalledTest2.qml
+InstalledTest 1.0 InstalledTest.qml
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest.qml
new file mode 100644
index 0000000000..56daa9c09a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0 as Qt47
+Qt47.Rectangle {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest2.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest2.qml
new file mode 100644
index 0000000000..59df88216e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/InstalledTest2.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Text {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/qmldir
new file mode 100644
index 0000000000..b301226099
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest0/qmldir
@@ -0,0 +1,2 @@
+InstalledTest 1.4 InstalledTest2.qml
+InstalledTestTP 0.0 InstalledTest.qml
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test1.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test1.qml
new file mode 100644
index 0000000000..617bdaaf67
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test1.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Item {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test2.qml b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test2.qml
new file mode 100644
index 0000000000..617bdaaf67
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/Test2.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Item {}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/qmldir
new file mode 100644
index 0000000000..90ad9fdb19
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest1/qmldir
@@ -0,0 +1,2 @@
+Test 1.0 Test1.qml
+Test 1.0 Test2.qml
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/qmldir b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/qmldir
new file mode 100644
index 0000000000..c492dec4d7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/qmldir
@@ -0,0 +1,2 @@
+Test 1.0 test1.js
+Test 1.0 test2.js
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test1.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test1.js
new file mode 100644
index 0000000000..6a53b53b02
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test1.js
@@ -0,0 +1 @@
+var foo = 1
diff --git a/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test2.js b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test2.js
new file mode 100644
index 0000000000..34d5cdda65
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/org/qtproject/installedtest2/test2.js
@@ -0,0 +1 @@
+var bar = 2
diff --git a/tests/auto/qml/qqmllanguage/data/lib/testModule/Test.qml b/tests/auto/qml/qqmllanguage/data/lib/testModule/Test.qml
new file mode 100644
index 0000000000..f53382871f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/testModule/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string test: 'foo'
+}
diff --git a/tests/auto/qml/qqmllanguage/data/lib/testModule/qmldir b/tests/auto/qml/qqmllanguage/data/lib/testModule/qmldir
new file mode 100644
index 0000000000..d6a9461666
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib/testModule/qmldir
@@ -0,0 +1 @@
+Test 1.0 Test.qml
diff --git a/tests/auto/qml/qqmllanguage/data/lib2/testModule/Test.qml b/tests/auto/qml/qqmllanguage/data/lib2/testModule/Test.qml
new file mode 100644
index 0000000000..cb44ffd44e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib2/testModule/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string test: 'bar'
+}
diff --git a/tests/auto/qml/qqmllanguage/data/lib2/testModule/qmldir b/tests/auto/qml/qqmllanguage/data/lib2/testModule/qmldir
new file mode 100644
index 0000000000..d6a9461666
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib2/testModule/qmldir
@@ -0,0 +1 @@
+Test 1.0 Test.qml
diff --git a/tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/Test.qml b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/Test.qml
new file mode 100644
index 0000000000..2c597ba3e2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string test: 'baz'
+}
diff --git a/tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/qmldir b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/qmldir
new file mode 100644
index 0000000000..d6a9461666
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1.0/qmldir
@@ -0,0 +1 @@
+Test 1.0 Test.qml
diff --git a/tests/auto/qml/qqmllanguage/data/lib3/testModule.1/Test.qml b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1/Test.qml
new file mode 100644
index 0000000000..6feec2ea6b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string test: 'unused'
+}
diff --git a/tests/auto/qml/qqmllanguage/data/lib3/testModule.1/qmldir b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1/qmldir
new file mode 100644
index 0000000000..d6a9461666
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib3/testModule.1/qmldir
@@ -0,0 +1 @@
+Test 1.0 Test.qml
diff --git a/tests/auto/qml/qqmllanguage/data/lib4/testModule.1/Test.qml b/tests/auto/qml/qqmllanguage/data/lib4/testModule.1/Test.qml
new file mode 100644
index 0000000000..b6b45ae283
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib4/testModule.1/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string test: 'qux'
+}
diff --git a/tests/auto/qml/qqmllanguage/data/lib4/testModule.1/qmldir b/tests/auto/qml/qqmllanguage/data/lib4/testModule.1/qmldir
new file mode 100644
index 0000000000..d6a9461666
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/lib4/testModule.1/qmldir
@@ -0,0 +1 @@
+Test 1.0 Test.qml
diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.1.errors.txt b/tests/auto/qml/qqmllanguage/data/listAssignment.1.errors.txt
new file mode 100644
index 0000000000..35d2d3510e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listAssignment.1.errors.txt
@@ -0,0 +1 @@
+4:24:Cannot assign object to list
diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.1.qml b/tests/auto/qml/qqmllanguage/data/listAssignment.1.qml
new file mode 100644
index 0000000000..1af190633d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listAssignment.1.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import QtQuick 2.0
+MyContainer {
+ containerChildren: QtObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.2.errors.txt b/tests/auto/qml/qqmllanguage/data/listAssignment.2.errors.txt
new file mode 100644
index 0000000000..8b40aa3ebb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listAssignment.2.errors.txt
@@ -0,0 +1,2 @@
+3:15:Cannot assign primitives to lists
+
diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.2.qml b/tests/auto/qml/qqmllanguage/data/listAssignment.2.qml
new file mode 100644
index 0000000000..e3baadb46c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listAssignment.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ children: 2
+}
diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.3.errors.txt b/tests/auto/qml/qqmllanguage/data/listAssignment.3.errors.txt
new file mode 100644
index 0000000000..c721fe91bf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listAssignment.3.errors.txt
@@ -0,0 +1 @@
+4:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/listAssignment.3.qml b/tests/auto/qml/qqmllanguage/data/listAssignment.3.qml
new file mode 100644
index 0000000000..00c4c6b543
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listAssignment.3.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainer {
+ children: childBinding.expression
+ children: childBinding2.expression
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/listItemDeleteSelf.qml b/tests/auto/qml/qqmllanguage/data/listItemDeleteSelf.qml
new file mode 100644
index 0000000000..74439c66d4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listItemDeleteSelf.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+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 }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: fruitModel.remove(index)
+ }
+ }
+ }
+
+ ListView {
+ model: fruitModel
+ delegate: fruitDelegate
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/listProperties.qml b/tests/auto/qml/qqmllanguage/data/listProperties.qml
new file mode 100644
index 0000000000..dcfe37d6fc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listProperties.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property list<QtObject> listProperty
+ property int test: listProperty.length
+
+ listProperty: [ QtObject{}, QtObject {} ]
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/literals.qml b/tests/auto/qml/qqmllanguage/data/literals.qml
new file mode 100644
index 0000000000..564b389760
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/literals.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant n1: 0xFe32 // hex
+ property variant n2: 015
+ property variant n3: -4.2E11 // floating-point literals
+ property variant n4: .1e9
+ property variant n5: 3e-12
+ property variant n6: 3e+12
+ property variant n7: 0.1e9
+ property variant n8: 1152921504606846976
+ property variant n9: 100000000000000000000
+
+ property variant c1: "\b" // special characters
+ property variant c2: "\f"
+ property variant c3: "\n"
+ property variant c4: "\r"
+ property variant c5: "\t"
+ property variant c6: "\v"
+ property variant c7: "\'"
+ property variant c8: "\""
+ property variant c9: "\\"
+ property variant c10: "\xA9"
+ property variant c11: "\u00A9" // unicode
+}
diff --git a/tests/auto/qml/qqmllanguage/data/localOrderTest.qml b/tests/auto/qml/qqmllanguage/data/localOrderTest.qml
new file mode 100644
index 0000000000..a6a9a4d627
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/localOrderTest.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+import org.qtproject.installedtest 1.0
+
+LocalLast2 {
+ property QtObject item: LocalLast {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.errors.txt b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.errors.txt
new file mode 100644
index 0000000000..07d05d3d21
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.errors.txt
@@ -0,0 +1 @@
+3:1:MyQmlObject is not a type
diff --git a/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.qml b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.qml
new file mode 100644
index 0000000000..717ca76f05
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/majorVersionIsolation.qml
@@ -0,0 +1,4 @@
+import Test.Version 2.0
+
+MyQmlObject {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.errors.txt b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.errors.txt
new file mode 100644
index 0000000000..29342dc46e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.errors.txt
@@ -0,0 +1 @@
+8:5:"MyRevisionedClass.prop2" is not available in Test 1.0.
diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.qml b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.qml
new file mode 100644
index 0000000000..fbb37705a1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.1.qml
@@ -0,0 +1,9 @@
+// Check that a property in a later revision (prop2) cannot be assigned
+import QtQuick 2.0
+import Test 1.0
+
+MyRevisionedClass
+{
+ prop1: 1
+ prop2: 2
+}
diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.errors.txt b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.errors.txt
new file mode 100644
index 0000000000..57b5764b08
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.errors.txt
@@ -0,0 +1 @@
+6:5:"MyRevisionedClass.onSignal2" is not available in Test 1.0.
diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.qml b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.qml
new file mode 100644
index 0000000000..8da7a2558f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.2.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyRevisionedClass
+{
+ onSignal1: prop1 = 2
+ onSignal2: prop1 = 3
+}
diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.errors.txt b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.errors.txt
new file mode 100644
index 0000000000..45364a044f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.errors.txt
@@ -0,0 +1 @@
+9:5:"MyRevisionedClass.propD" is not available in Test 1.1.
diff --git a/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.qml b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.qml
new file mode 100644
index 0000000000..195be2116a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/metaobjectRevision.3.qml
@@ -0,0 +1,10 @@
+import Test 1.1
+
+MyRevisionedClass
+{
+ propA: 10
+ propB: 10
+ propC: 10
+ // propD is in rev 1 of MyRevisionedClassUnregistered, but not registered in 1.1
+ propD: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/method.1.errors.txt b/tests/auto/qml/qqmllanguage/data/method.1.errors.txt
new file mode 100644
index 0000000000..98d0b9cefb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/method.1.errors.txt
@@ -0,0 +1 @@
+4:14:Method names cannot begin with an upper case letter
diff --git a/tests/auto/qml/qqmllanguage/data/method.1.qml b/tests/auto/qml/qqmllanguage/data/method.1.qml
new file mode 100644
index 0000000000..a888b1aaf4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/method.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ function MyMethod() {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/missingObject.errors.txt b/tests/auto/qml/qqmllanguage/data/missingObject.errors.txt
new file mode 100644
index 0000000000..b31b562de1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingObject.errors.txt
@@ -0,0 +1 @@
+1:10:Expected token `{'
diff --git a/tests/auto/qml/qqmllanguage/data/missingObject.qml b/tests/auto/qml/qqmllanguage/data/missingObject.qml
new file mode 100644
index 0000000000..2f17045869
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingObject.qml
@@ -0,0 +1 @@
+something: 24
diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt b/tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt
new file mode 100644
index 0000000000..33bf3070d7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt
@@ -0,0 +1 @@
+8:5:Cannot assign to non-existent property "onDynamicMethod"
diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.2.qml b/tests/auto/qml/qqmllanguage/data/missingSignal.2.qml
new file mode 100644
index 0000000000..b4297ce67d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingSignal.2.qml
@@ -0,0 +1,11 @@
+import Test 1.0
+MyQmlObject {
+ function dynamicMethod() {
+ basicSlot();
+ }
+
+ // invalid: signal handler definition given for non-signal method.
+ onDynamicMethod: {
+ basicSlot();
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.errors.txt b/tests/auto/qml/qqmllanguage/data/missingSignal.errors.txt
new file mode 100644
index 0000000000..f562246288
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingSignal.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign to non-existent property "onClicked"
diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.qml b/tests/auto/qml/qqmllanguage/data/missingSignal.qml
new file mode 100644
index 0000000000..92aefef8c4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingSignal.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import QtQuick 2.0
+QtObject {
+ onClicked: console.log("Hello world!")
+}
diff --git a/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.errors.txt
new file mode 100644
index 0000000000..caf7e55ba2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.errors.txt
@@ -0,0 +1 @@
+4:18:Cannot assign to non-existent property "foo"
diff --git a/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.qml b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.qml
new file mode 100644
index 0000000000..9a0fa6a26b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/missingValueTypeProperty.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.foo: 9
+}
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.1.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.1.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.1.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.1.qml b/tests/auto/qml/qqmllanguage/data/multiSet.1.qml
new file mode 100644
index 0000000000..649c49ee3a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.1.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: 10
+ intProperty: 11
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.10.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.10.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.10.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.10.qml b/tests/auto/qml/qqmllanguage/data/multiSet.10.qml
new file mode 100644
index 0000000000..bc21db98f8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.10.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ property int a: 10
+ a: 11
+}
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.11.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.11.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.11.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.11.qml b/tests/auto/qml/qqmllanguage/data/multiSet.11.qml
new file mode 100644
index 0000000000..7d03139056
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.11.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.x: 10
+ rectProperty.x: 11
+}
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.2.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.2.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.2.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.2.qml b/tests/auto/qml/qqmllanguage/data/multiSet.2.qml
new file mode 100644
index 0000000000..abcd216744
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.2.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: 10
+ intProperty: a + 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.3.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.3.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.3.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.3.qml b/tests/auto/qml/qqmllanguage/data/multiSet.3.qml
new file mode 100644
index 0000000000..77eaba0b32
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.3.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: a + 10
+ intProperty: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.4.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.4.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.4.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.4.qml b/tests/auto/qml/qqmllanguage/data/multiSet.4.qml
new file mode 100644
index 0000000000..c16d04fea6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.4.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ intProperty: 10
+ intProperty: MyTypeObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.5.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.5.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.5.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.5.qml b/tests/auto/qml/qqmllanguage/data/multiSet.5.qml
new file mode 100644
index 0000000000..2980c5b28c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.5.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyContainer {
+ children: MyContainer {}
+ children: MyContainer {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.6.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.6.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.6.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.6.qml b/tests/auto/qml/qqmllanguage/data/multiSet.6.qml
new file mode 100644
index 0000000000..492c720edc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.6.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyContainer {
+ children: MyContainer {}
+ children: [ MyContainer {}, MyContainer {} ]
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.7.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.7.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.7.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.7.qml b/tests/auto/qml/qqmllanguage/data/multiSet.7.qml
new file mode 100644
index 0000000000..2a9c1d0de8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.7.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyContainer {
+ children: [ MyContainer {}, MyContainer {} ]
+ children: MyContainer {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.8.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.8.errors.txt
new file mode 100644
index 0000000000..450fc163bd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.8.errors.txt
@@ -0,0 +1 @@
+6:9:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.8.qml b/tests/auto/qml/qqmllanguage/data/multiSet.8.qml
new file mode 100644
index 0000000000..052437ea18
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.8.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped {
+ value: 10
+ value: 11
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.9.errors.txt b/tests/auto/qml/qqmllanguage/data/multiSet.9.errors.txt
new file mode 100644
index 0000000000..e1f7ec5bc2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.9.errors.txt
@@ -0,0 +1 @@
+5:5:Property value set multiple times
diff --git a/tests/auto/qml/qqmllanguage/data/multiSet.9.qml b/tests/auto/qml/qqmllanguage/data/multiSet.9.qml
new file mode 100644
index 0000000000..e2e954f778
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/multiSet.9.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ grouped.value: 10
+ grouped.value: 11
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nestedComponentRoots.qml b/tests/auto/qml/qqmllanguage/data/nestedComponentRoots.qml
new file mode 100644
index 0000000000..5e6c2a91c9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nestedComponentRoots.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+NestedComponentRoot {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nestedErrors.errors.txt b/tests/auto/qml/qqmllanguage/data/nestedErrors.errors.txt
new file mode 100644
index 0000000000..53e752b641
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nestedErrors.errors.txt
@@ -0,0 +1,2 @@
+4:5:Type NestedErrorsType unavailable
+4:8:Invalid property assignment: number expected
diff --git a/tests/auto/qml/qqmllanguage/data/nestedErrors.qml b/tests/auto/qml/qqmllanguage/data/nestedErrors.qml
new file mode 100644
index 0000000000..cc1df4d181
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nestedErrors.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ NestedErrorsType {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/noCreation.errors.txt b/tests/auto/qml/qqmllanguage/data/noCreation.errors.txt
new file mode 100644
index 0000000000..23cd3f3504
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/noCreation.errors.txt
@@ -0,0 +1 @@
+3:1:Keys is only available via attached properties
diff --git a/tests/auto/qml/qqmllanguage/data/noCreation.qml b/tests/auto/qml/qqmllanguage/data/noCreation.qml
new file mode 100644
index 0000000000..28852f1a0c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/noCreation.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Keys {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.errors.txt
new file mode 100644
index 0000000000..cdfa4b2ef2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign to non-existent property "nonScriptable"
diff --git a/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.qml b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.qml
new file mode 100644
index 0000000000..bd59bc80f9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonScriptableProperty.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyQmlObject {
+ nonScriptable: 11
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.errors.txt
new file mode 100644
index 0000000000..6bfce9a2c9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.errors.txt
@@ -0,0 +1 @@
+2:15:Cannot assign to non-existent property "something"
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.qml
new file mode 100644
index 0000000000..df7406ce98
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.1.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+MyQmlObject { something: 24 }
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.errors.txt
new file mode 100644
index 0000000000..4b30056d59
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existent property "something"
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.qml
new file mode 100644
index 0000000000..06ccd37905
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: 24
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.errors.txt
new file mode 100644
index 0000000000..4b30056d59
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existent property "something"
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml
new file mode 100644
index 0000000000..5b08608862
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.3.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: 1 + 1
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.errors.txt
new file mode 100644
index 0000000000..4b30056d59
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existent property "something"
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.qml
new file mode 100644
index 0000000000..65791919ba
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.4.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: ;
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.errors.txt
new file mode 100644
index 0000000000..c07f2b99a2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.errors.txt
@@ -0,0 +1 @@
+3:5:Expected a qualified name id
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml
new file mode 100644
index 0000000000..37af05731e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ 24
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.errors.txt
new file mode 100644
index 0000000000..89925b74c2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existent default property
diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.qml
new file mode 100644
index 0000000000..5cd55d0856
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.6.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/notAvailable.errors.txt b/tests/auto/qml/qqmllanguage/data/notAvailable.errors.txt
new file mode 100644
index 0000000000..af95a53cc7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/notAvailable.errors.txt
@@ -0,0 +1 @@
+3:1:UnavailableType is unavailable for testing
diff --git a/tests/auto/qml/qqmllanguage/data/notAvailable.qml b/tests/auto/qml/qqmllanguage/data/notAvailable.qml
new file mode 100644
index 0000000000..7c3c7ee08d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/notAvailable.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+
+UnavailableType {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt
new file mode 100644
index 0000000000..07a40949cd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt
@@ -0,0 +1 @@
+3:-1:Cannot set properties on obj as it is null
diff --git a/tests/auto/qml/qqmllanguage/data/nullDotProperty.qml b/tests/auto/qml/qqmllanguage/data/nullDotProperty.qml
new file mode 100644
index 0000000000..4e36779b5c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullDotProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyDotPropertyObject {
+ obj.value: 1
+}
diff --git a/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml
new file mode 100644
index 0000000000..acd5463a3c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.1.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ Component {
+ id: internal
+
+ Item {
+ }
+ }
+
+ property bool expectNull: null
+
+ function setExpectNull(b) {
+ success = false;
+ expectNull = b;
+ }
+
+ property QtObject obj: null
+ onObjChanged: success = (expectNull ? obj == null : obj != null)
+
+ Component.onCompleted: {
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ if (!success) return
+
+ // Replace with a different object
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ }
+
+ function destroyObject() {
+ setExpectNull(true)
+ obj.destroy();
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.2.qml b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.2.qml
new file mode 100644
index 0000000000..ed0e0d10f0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.2.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ Component {
+ id: internal
+
+ Item {
+ }
+ }
+
+ property bool expectNull: null
+
+ function setExpectNull(b) {
+ success = false;
+ expectNull = b;
+ }
+
+ property variant obj: null
+ onObjChanged: success = (expectNull ? obj == null : obj != null)
+
+ Component.onCompleted: {
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ if (!success) return
+
+ // Replace with a different object
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ }
+
+ function destroyObject() {
+ setExpectNull(true)
+ obj.destroy();
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.3.qml b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.3.qml
new file mode 100644
index 0000000000..f5e94ba715
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.3.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ Component {
+ id: internal
+
+ Item {
+ }
+ }
+
+ property bool expectNull: null
+
+ function setExpectNull(b) {
+ success = false;
+ expectNull = b;
+ }
+
+ property var obj: null
+ onObjChanged: success = (expectNull ? obj == null : obj != null)
+
+ Component.onCompleted: {
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ if (!success) return
+
+ // Replace with a different object
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ }
+
+ function destroyObject() {
+ setExpectNull(true)
+ obj.destroy();
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.4.qml b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.4.qml
new file mode 100644
index 0000000000..ccfda01644
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/objectDeletionNotify.4.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ Component {
+ id: internal
+
+ Item {
+ }
+ }
+
+ property var expectNull: null
+
+ function setExpectNull(b) {
+ success = false;
+ expectNull = b;
+ }
+
+ function setExpectNoChange() {
+ success = true;
+ expectNull = null;
+ }
+
+ property var obj: null
+ onObjChanged: success = (expectNull == null) ? false : (expectNull ? obj == null : obj != null)
+
+ property var temp: null
+
+ Component.onCompleted: {
+ // Set obj to contain an object
+ setExpectNull(false)
+ obj = internal.createObject(null, {})
+ if (!success) return
+
+ // Use temp variable to keep object reference alive
+ temp = obj
+
+ // Change obj to contain a string
+ setExpectNull(false)
+ obj = 'hello'
+ }
+
+ function destroyObject() {
+ setExpectNoChange()
+ temp.destroy();
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.errors.txt
new file mode 100644
index 0000000000..db7d9c0f60
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.errors.txt
@@ -0,0 +1 @@
+4:18:Unexpected object assignment
diff --git a/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.qml b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.qml
new file mode 100644
index 0000000000..99247735dd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/objectValueTypeProperty.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty.x: MyTypeObject {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/onCompleted.qml b/tests/auto/qml/qqmllanguage/data/onCompleted.qml
new file mode 100644
index 0000000000..89e6777f8a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/onCompleted.qml
@@ -0,0 +1,17 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ // We set a and b to ensure that onCompleted is executed after bindings and
+ // constants have been assigned
+ property int a: Math.min(6, 7)
+ Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b)
+
+ objectProperty: OnCompletedType {
+ qmlobjectProperty: MyQmlObject {
+ id: nestedObject
+ property int b: 10
+ Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b)
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/onDestruction.qml b/tests/auto/qml/qqmllanguage/data/onDestruction.qml
new file mode 100644
index 0000000000..7d6da260b4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/onDestruction.qml
@@ -0,0 +1,17 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ // We set a and b to ensure that onCompleted is executed after bindings and
+ // constants have been assigned
+ property int a: Math.min(6, 7)
+ Component.onDestruction: console.log("Destruction " + a + " " + nestedObject.b)
+
+ objectProperty: OnDestructionType {
+ qmlobjectProperty: MyQmlObject {
+ id: nestedObject
+ property int b: 10
+ Component.onDestruction: console.log("Destruction " + a + " " + nestedObject.b)
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.1.errors.txt b/tests/auto/qml/qqmllanguage/data/overrideSignal.1.errors.txt
new file mode 100644
index 0000000000..ba8945b87c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.1.errors.txt
@@ -0,0 +1 @@
+5:12:Duplicate signal name: invalid override of property change signal or superclass signal
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.1.qml b/tests/auto/qml/qqmllanguage/data/overrideSignal.1.qml
new file mode 100644
index 0000000000..d6328fa57d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.1.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ property int test: 10
+ signal testChanged // manual signal override, should not be valid.
+
+ Component.onCompleted: test = 20
+
+ // due to an unrelated bug (QTBUG-26818), a certain
+ // number of properties are needed to exist before the
+ // crash condition is hit, currently.
+ property int a
+ property int b
+ property int c
+ property int d
+ property int e
+ property int f
+ property int g
+ property int h
+ property int i
+ property int j
+ property int k
+ property int l
+ property int m
+ property int n
+}
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.2.errors.txt b/tests/auto/qml/qqmllanguage/data/overrideSignal.2.errors.txt
new file mode 100644
index 0000000000..bc1490759f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.2.errors.txt
@@ -0,0 +1 @@
+5:14:Duplicate method name: invalid override of property change signal or superclass signal
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.2.qml b/tests/auto/qml/qqmllanguage/data/overrideSignal.2.qml
new file mode 100644
index 0000000000..3b38d0074b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.2.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ property int test: 10
+ function testChanged() { console.log("function override"); } // manual function override, should not be valid.
+
+ Component.onCompleted: test = 20
+
+ // due to an unrelated bug (QTBUG-26818), a certain
+ // number of properties are needed to exist before the
+ // crash condition is hit, currently.
+ property int a
+ property int b
+ property int c
+ property int d
+ property int e
+ property int f
+ property int g
+ property int h
+ property int i
+ property int j
+ property int k
+ property int l
+ property int m
+ property int n
+}
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.3.qml b/tests/auto/qml/qqmllanguage/data/overrideSignal.3.qml
new file mode 100644
index 0000000000..779724a3cc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.3.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+ property int test: 10
+ property int testChanged: 15 // property override is fine.
+
+ onTestChanged: if (test == 20) success = true;
+
+ Component.onCompleted: {
+ test = 20;
+ testChanged = 25;
+ }
+
+ // due to an unrelated bug (QTBUG-26818), a certain
+ // number of properties are needed to exist before the
+ // crash condition is hit, currently.
+ property int a
+ property int b
+ property int c
+ property int d
+ property int e
+ property int f
+ property int g
+ property int h
+ property int i
+ property int j
+ property int k
+ property int l
+ property int m
+ property int n
+}
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.4.errors.txt b/tests/auto/qml/qqmllanguage/data/overrideSignal.4.errors.txt
new file mode 100644
index 0000000000..e2e235cc11
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.4.errors.txt
@@ -0,0 +1 @@
+6:12:Duplicate signal name: invalid override of property change signal or superclass signal
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.4.qml b/tests/auto/qml/qqmllanguage/data/overrideSignal.4.qml
new file mode 100644
index 0000000000..2f5abf3c0e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.4.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+ property alias test: child.test
+ signal testChanged // manual signal override, should not be valid.
+
+ Component.onCompleted: test = 20;
+
+ Item {
+ id: child
+ property int test: 10
+ }
+
+ // due to an unrelated bug (QTBUG-26818), a certain
+ // number of properties are needed to exist before the
+ // crash condition is hit, currently.
+ property int a
+ property int b
+ property int c
+ property int d
+ property int e
+ property int f
+ property int g
+ property int h
+ property int i
+ property int j
+ property int k
+ property int l
+ property int m
+ property int n
+}
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.5.errors.txt b/tests/auto/qml/qqmllanguage/data/overrideSignal.5.errors.txt
new file mode 100644
index 0000000000..e2e235cc11
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.5.errors.txt
@@ -0,0 +1 @@
+6:12:Duplicate signal name: invalid override of property change signal or superclass signal
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.5.qml b/tests/auto/qml/qqmllanguage/data/overrideSignal.5.qml
new file mode 100644
index 0000000000..fd393f6211
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.5.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+OverrideSignalComponent {
+ property bool success: (testChangedCount == 1)
+ property int testChangedCount: 0
+ signal testChanged // override change signal from super
+
+ Component.onCompleted: {
+ test = 20;
+ testChanged();
+ }
+
+ onTestChanged: testChangedCount = 1; // override the signal, change handler won't be called.
+
+ // due to an unrelated bug (QTBUG-26818), a certain
+ // number of properties are needed to exist before the
+ // crash condition is hit, currently.
+ property int a
+ property int b
+ property int c
+ property int d
+ property int e
+ property int f
+ property int g
+ property int h
+ property int i
+ property int j
+ property int k
+ property int l
+ property int m
+ property int n
+}
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.6.errors.txt b/tests/auto/qml/qqmllanguage/data/overrideSignal.6.errors.txt
new file mode 100644
index 0000000000..da451917f5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.6.errors.txt
@@ -0,0 +1 @@
+4:12:Duplicate signal name: invalid override of property change signal or superclass signal
diff --git a/tests/auto/qml/qqmllanguage/data/overrideSignal.6.qml b/tests/auto/qml/qqmllanguage/data/overrideSignal.6.qml
new file mode 100644
index 0000000000..69e56bf7fe
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/overrideSignal.6.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+OverrideSignalComponent {
+ signal objectNameChanged // manual signal override of builtin signal, invalid.
+
+ // due to an unrelated bug (QTBUG-26818), a certain
+ // number of properties are needed to exist before the
+ // crash condition is hit, currently.
+ property int a
+ property int b
+ property int c
+ property int d
+ property int e
+ property int f
+ property int g
+ property int h
+ property int i
+ property int j
+ property int k
+ property int l
+ property int m
+ property int n
+}
diff --git a/tests/auto/qml/qqmllanguage/data/property.1.errors.txt b/tests/auto/qml/qqmllanguage/data/property.1.errors.txt
new file mode 100644
index 0000000000..3ae6c4601b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.1.errors.txt
@@ -0,0 +1 @@
+4:14:Expected property type
diff --git a/tests/auto/qml/qqmllanguage/data/property.1.qml b/tests/auto/qml/qqmllanguage/data/property.1.qml
new file mode 100644
index 0000000000..6b43e6cc89
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property blah a;
+}
diff --git a/tests/auto/qml/qqmllanguage/data/property.2.errors.txt b/tests/auto/qml/qqmllanguage/data/property.2.errors.txt
new file mode 100644
index 0000000000..a18e21a01c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.2.errors.txt
@@ -0,0 +1 @@
+4:14:Unexpected property type modifier
diff --git a/tests/auto/qml/qqmllanguage/data/property.2.qml b/tests/auto/qml/qqmllanguage/data/property.2.qml
new file mode 100644
index 0000000000..e6aa00e730
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property invalidmodifier<int> a;
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/property.3.errors.txt b/tests/auto/qml/qqmllanguage/data/property.3.errors.txt
new file mode 100644
index 0000000000..5e09a25b57
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.3.errors.txt
@@ -0,0 +1 @@
+4:14:Invalid property type modifier
diff --git a/tests/auto/qml/qqmllanguage/data/property.3.qml b/tests/auto/qml/qqmllanguage/data/property.3.qml
new file mode 100644
index 0000000000..978c1aa80b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.3.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property invalidmodifier<QtObject> a;
+}
+
+
diff --git a/tests/auto/qml/qqmllanguage/data/property.4.errors.txt b/tests/auto/qml/qqmllanguage/data/property.4.errors.txt
new file mode 100644
index 0000000000..b447186849
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.4.errors.txt
@@ -0,0 +1 @@
+5:1:Syntax error
diff --git a/tests/auto/qml/qqmllanguage/data/property.4.qml b/tests/auto/qml/qqmllanguage/data/property.4.qml
new file mode 100644
index 0000000000..bb94e84244
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.4.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ readonly property int a
+}
diff --git a/tests/auto/qml/qqmllanguage/data/property.6.errors.txt b/tests/auto/qml/qqmllanguage/data/property.6.errors.txt
new file mode 100644
index 0000000000..985c083cc3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.6.errors.txt
@@ -0,0 +1 @@
+4:18:Property names cannot begin with an upper case letter
diff --git a/tests/auto/qml/qqmllanguage/data/property.6.qml b/tests/auto/qml/qqmllanguage/data/property.6.qml
new file mode 100644
index 0000000000..88f493f9a9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.6.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int Hello
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/property.7.errors.txt b/tests/auto/qml/qqmllanguage/data/property.7.errors.txt
new file mode 100644
index 0000000000..985c083cc3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.7.errors.txt
@@ -0,0 +1 @@
+4:18:Property names cannot begin with an upper case letter
diff --git a/tests/auto/qml/qqmllanguage/data/property.7.qml b/tests/auto/qml/qqmllanguage/data/property.7.qml
new file mode 100644
index 0000000000..05eb319947
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/property.7.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int Hello: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/propertyInit.1.qml b/tests/auto/qml/qqmllanguage/data/propertyInit.1.qml
new file mode 100644
index 0000000000..7d6fea24db
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/propertyInit.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test: { var _ = 1; _ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/propertyInit.2.qml b/tests/auto/qml/qqmllanguage/data/propertyInit.2.qml
new file mode 100644
index 0000000000..fa690ba6bc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/propertyInit.2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test: if (b == 1) 123; else 321;
+ property int b: 1
+}
diff --git a/tests/auto/qml/qqmllanguage/data/propertyValueSource.2.qml b/tests/auto/qml/qqmllanguage/data/propertyValueSource.2.qml
new file mode 100644
index 0000000000..e48526abec
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/propertyValueSource.2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ MyCompositeValueSource on intProperty {}
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/propertyValueSource.qml b/tests/auto/qml/qqmllanguage/data/propertyValueSource.qml
new file mode 100644
index 0000000000..22aa68250e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/propertyValueSource.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ MyPropertyValueSource on intProperty {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml
new file mode 100644
index 0000000000..55c507f67e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import QtQuick 2.0
+QtObject {
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml
new file mode 100644
index 0000000000..db8a3da2b2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import QtQuick 2.0
+QtObject {
+ MyQmlObject.value: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/LocalInternal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/LocalInternal.qml
new file mode 100644
index 0000000000..4ce04c46d2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/LocalInternal.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Image { source: "pics/blue.png" }
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/Test.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/Test.qml
new file mode 100644
index 0000000000..f789a905f2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/Test.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Rectangle { }
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestLocal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestLocal.qml
new file mode 100644
index 0000000000..11443ca6d5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestLocal.qml
@@ -0,0 +1 @@
+LocalInternal {}
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestNamed.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestNamed.qml
new file mode 100644
index 0000000000..672cb8f201
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestNamed.qml
@@ -0,0 +1 @@
+NamedLocal { }
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestSubDir.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestSubDir.qml
new file mode 100644
index 0000000000..0dfede4093
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/TestSubDir.qml
@@ -0,0 +1,2 @@
+import "subdir"
+SubTest { }
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/UndeclaredLocal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/UndeclaredLocal.qml
new file mode 100644
index 0000000000..4ce04c46d2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/UndeclaredLocal.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Image { source: "pics/blue.png" }
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/WrongTestLocal.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/WrongTestLocal.qml
new file mode 100644
index 0000000000..8dcb7be231
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/WrongTestLocal.qml
@@ -0,0 +1 @@
+UndeclaredInternal {}
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/noqmldir/Test.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/noqmldir/Test.qml
new file mode 100644
index 0000000000..f789a905f2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/noqmldir/Test.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Rectangle { }
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/pics/blue.png b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/pics/blue.png
new file mode 100644
index 0000000000..46f815f1ed
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/pics/blue.png
Binary files differ
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/qmldir b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/qmldir
new file mode 100644
index 0000000000..60150f837c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/qmldir
@@ -0,0 +1,5 @@
+Test Test.qml
+TestSubDir TestSubDir.qml
+TestLocal TestLocal.qml
+NamedLocal LocalInternal.qml
+internal LocalInternal LocalInternal.qml
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/SubTest.qml b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/SubTest.qml
new file mode 100644
index 0000000000..1480ae8683
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/SubTest.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Text {}
diff --git a/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/qmldir b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/qmldir
new file mode 100644
index 0000000000..a54f7dfa61
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/qtest/qml/qqmllanguage/subdir/qmldir
@@ -0,0 +1 @@
+SubTest SubTest.qml
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.1.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.1.errors.txt
new file mode 100644
index 0000000000..b8c34042be
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.1.errors.txt
@@ -0,0 +1 @@
+3:21:Invalid property assignment: "readOnlyString" is a read-only property
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.1.qml b/tests/auto/qml/qqmllanguage/data/readOnly.1.qml
new file mode 100644
index 0000000000..60757bd005
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ readOnlyString: "Hello World"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt
new file mode 100644
index 0000000000..d857a0440e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.2.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid property assignment: "readOnlyString" is a read-only property
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.2.qml b/tests/auto/qml/qqmllanguage/data/readOnly.2.qml
new file mode 100644
index 0000000000..8f1633cc11
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ readOnlyString: "Hello" + "World"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.3.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.3.errors.txt
new file mode 100644
index 0000000000..c7e9e1bb2f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.3.errors.txt
@@ -0,0 +1 @@
+6:36:Invalid property assignment: "objAlias" is a read-only property
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.3.qml b/tests/auto/qml/qqmllanguage/data/readOnly.3.qml
new file mode 100644
index 0000000000..e3c56b701a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.3.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property variant child
+ child: HelperAlias { objAlias: QtObject {} }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.4.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.4.errors.txt
new file mode 100644
index 0000000000..d857a0440e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.4.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid property assignment: "readOnlyString" is a read-only property
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.4.qml b/tests/auto/qml/qqmllanguage/data/readOnly.4.qml
new file mode 100644
index 0000000000..5338ac77bc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.4.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ MyPropertyValueSource on readOnlyString {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.5.errors.txt b/tests/auto/qml/qqmllanguage/data/readOnly.5.errors.txt
new file mode 100644
index 0000000000..e71ae4447c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.5.errors.txt
@@ -0,0 +1 @@
+2:23:Invalid property assignment: "readOnlyProperty" is a read-only property
diff --git a/tests/auto/qml/qqmllanguage/data/readOnly.5.qml b/tests/auto/qml/qqmllanguage/data/readOnly.5.qml
new file mode 100644
index 0000000000..d80b27a1e3
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readOnly.5.qml
@@ -0,0 +1,3 @@
+ReadOnlyType {
+ readOnlyProperty: 13
+}
diff --git a/tests/auto/qml/qqmllanguage/data/readonly.qml b/tests/auto/qml/qqmllanguage/data/readonly.qml
new file mode 100644
index 0000000000..493a9ad502
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/readonly.qml
@@ -0,0 +1,17 @@
+import Test 1.0
+
+MyQmlObject {
+ property int testData: 9
+ property alias testData2: myObject.test1
+
+ readonly property int test1: 10
+ readonly property int test2: testData + 9
+ readonly property alias test3: myObject.test1
+
+
+ property variant dummy: MyQmlObject {
+ id: myObject
+ property int test1: 13
+ }
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/receivers.qml b/tests/auto/qml/qqmllanguage/data/receivers.qml
new file mode 100644
index 0000000000..8828745854
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/receivers.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyReceiversTestObject {
+ property int dummy: prop
+ onPropChanged: { var a = 0; } //do nothing
+ onMySignal: { var a = 0; } //do nothing
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/registeredCompositeType.qml b/tests/auto/qml/qqmllanguage/data/registeredCompositeType.qml
new file mode 100644
index 0000000000..f633a14fa7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/registeredCompositeType.qml
@@ -0,0 +1,3 @@
+import Test 1.0
+
+RegisteredCompositeType {}
diff --git a/tests/auto/qml/qqmllanguage/data/registrationOrder.qml b/tests/auto/qml/qqmllanguage/data/registrationOrder.qml
new file mode 100644
index 0000000000..14217ad521
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/registrationOrder.qml
@@ -0,0 +1,4 @@
+import Test.VersionOrder 2.0
+
+MyQmlObject {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/remoteLoadCrash.qml b/tests/auto/qml/qqmllanguage/data/remoteLoadCrash.qml
new file mode 100644
index 0000000000..5f237d39a2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/remoteLoadCrash.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+Text {
+}
diff --git a/tests/auto/qml/qqmllanguage/data/revisions11.qml b/tests/auto/qml/qqmllanguage/data/revisions11.qml
new file mode 100644
index 0000000000..823439acdd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/revisions11.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+import Test 1.1
+
+MyRevisionedClass
+{
+ prop1: 1
+ prop2: 10
+
+ onSignal2: prop2 = 3
+}
diff --git a/tests/auto/qml/qqmllanguage/data/revisionsbasesub11.qml b/tests/auto/qml/qqmllanguage/data/revisionsbasesub11.qml
new file mode 100644
index 0000000000..78ab51a4b7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/revisionsbasesub11.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import Test 1.1
+
+MyRevisionedSubclass
+{
+ propA: 10
+ propB: 10
+ propC: 10
+ // propD is not registered in 1.1
+ prop1: 10
+ prop2: 10
+ prop3: 10
+ prop4: 10
+
+ onSignal4: prop4 = 2
+}
diff --git a/tests/auto/qml/qqmllanguage/data/revisionssub11.qml b/tests/auto/qml/qqmllanguage/data/revisionssub11.qml
new file mode 100644
index 0000000000..d00758387e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/revisionssub11.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Test 1.1
+
+MyRevisionedSubclass
+{
+ prop1: 10
+ prop2: 10
+ prop3: 10
+ prop4: 10
+
+ onSignal4: prop4 = 2
+}
diff --git a/tests/auto/qml/qqmllanguage/data/rootAsQmlComponent.qml b/tests/auto/qml/qqmllanguage/data/rootAsQmlComponent.qml
new file mode 100644
index 0000000000..8d72cd3844
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/rootAsQmlComponent.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainerComponent {
+ x: 11
+ MyQmlObject {}
+ MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scopedProperties.qml b/tests/auto/qml/qqmllanguage/data/scopedProperties.qml
new file mode 100644
index 0000000000..6e3a46d754
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scopedProperties.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+MyBaseComponent {
+ id: extended
+
+ property bool success: false
+
+ property int baseProperty: 666
+ property int boundProperty: baseProperty
+ property alias aliasProperty: extended.baseProperty
+
+ function extendedPropertiesTest(expected) {
+ return (baseProperty == expected &&
+ boundProperty == expected &&
+ aliasProperty == expected);
+ }
+
+ Component.onCompleted: {
+ if (basePropertiesTest('bar') && extendedPropertiesTest(666)) {
+ baseProperty = 999;
+ success = extendedPropertiesTest(999) && baseSuccess;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.1.errors.txt b/tests/auto/qml/qqmllanguage/data/scriptString.1.errors.txt
new file mode 100644
index 0000000000..14463e0941
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString.1.errors.txt
@@ -0,0 +1 @@
+4:21:Invalid property assignment: script expected
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.1.qml b/tests/auto/qml/qqmllanguage/data/scriptString.1.qml
new file mode 100644
index 0000000000..f07d2231fe
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString.1.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: MyTypeObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt b/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt
new file mode 100644
index 0000000000..f8a776f9a0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString.2.errors.txt
@@ -0,0 +1 @@
+4:40:Cannot assign multiple values to a script property
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.2.qml b/tests/auto/qml/qqmllanguage/data/scriptString.2.qml
new file mode 100644
index 0000000000..dc825c7511
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: [ MyTypeObject {}, MyTypeObject {} ]
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString.qml b/tests/auto/qml/qqmllanguage/data/scriptString.qml
new file mode 100644
index 0000000000..40a3bbeede
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: foo + bar
+ grouped.script: console.log(1921)
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString2.qml b/tests/auto/qml/qqmllanguage/data/scriptString2.qml
new file mode 100644
index 0000000000..c42da2b9e1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: "hello\n\"world\""
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString3.qml b/tests/auto/qml/qqmllanguage/data/scriptString3.qml
new file mode 100644
index 0000000000..0cd82ff58f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: 12.345
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString4.qml b/tests/auto/qml/qqmllanguage/data/scriptString4.qml
new file mode 100644
index 0000000000..3e2f9a49f1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString4.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: true
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString5.qml b/tests/auto/qml/qqmllanguage/data/scriptString5.qml
new file mode 100644
index 0000000000..12485bb19e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString5.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: null
+}
diff --git a/tests/auto/qml/qqmllanguage/data/scriptString6.qml b/tests/auto/qml/qqmllanguage/data/scriptString6.qml
new file mode 100644
index 0000000000..c30f2245c8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/scriptString6.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: undefined
+}
diff --git a/tests/auto/qml/qqmllanguage/data/signal.1.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.1.errors.txt
new file mode 100644
index 0000000000..f5c789123d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.1.errors.txt
@@ -0,0 +1 @@
+4:12:Invalid signal parameter type: nontype
diff --git a/tests/auto/qml/qqmllanguage/data/signal.1.qml b/tests/auto/qml/qqmllanguage/data/signal.1.qml
new file mode 100644
index 0000000000..1c27baa4e8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal mySignal(nontype a)
+}
diff --git a/tests/auto/qml/qqmllanguage/data/signal.2.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.2.errors.txt
new file mode 100644
index 0000000000..0d4c33d750
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.2.errors.txt
@@ -0,0 +1 @@
+4:21:Unexpected token `,'
diff --git a/tests/auto/qml/qqmllanguage/data/signal.2.qml b/tests/auto/qml/qqmllanguage/data/signal.2.qml
new file mode 100644
index 0000000000..2b00ab80bb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ signal mySignal(,)
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/signal.3.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.3.errors.txt
new file mode 100644
index 0000000000..bf043ac85a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.3.errors.txt
@@ -0,0 +1 @@
+4:22:Expected token `identifier'
diff --git a/tests/auto/qml/qqmllanguage/data/signal.3.qml b/tests/auto/qml/qqmllanguage/data/signal.3.qml
new file mode 100644
index 0000000000..1bfcfff7b5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.3.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ signal mySignal(a)
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/signal.4.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.4.errors.txt
new file mode 100644
index 0000000000..513ff60ae6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.4.errors.txt
@@ -0,0 +1 @@
+4:12:Signal names cannot begin with an upper case letter
diff --git a/tests/auto/qml/qqmllanguage/data/signal.4.qml b/tests/auto/qml/qqmllanguage/data/signal.4.qml
new file mode 100644
index 0000000000..653c14e6aa
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.4.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ signal MySignal
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/signal.5.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.5.errors.txt
new file mode 100644
index 0000000000..cf772e881e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.5.errors.txt
@@ -0,0 +1 @@
+4:27:Expected token `identifier'
diff --git a/tests/auto/qml/qqmllanguage/data/signal.5.qml b/tests/auto/qml/qqmllanguage/data/signal.5.qml
new file mode 100644
index 0000000000..63921cb2ca
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.5.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ signal mySignal(string)
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/signal.6.errors.txt b/tests/auto/qml/qqmllanguage/data/signal.6.errors.txt
new file mode 100644
index 0000000000..183b05f659
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.6.errors.txt
@@ -0,0 +1 @@
+4:12:Invalid signal parameter type: Nontype
diff --git a/tests/auto/qml/qqmllanguage/data/signal.6.qml b/tests/auto/qml/qqmllanguage/data/signal.6.qml
new file mode 100644
index 0000000000..8b6e4011dc
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signal.6.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal mySignal(Nontype a)
+}
diff --git a/tests/auto/qml/qqmllanguage/data/signalParameterTypes.1.qml b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.1.qml
new file mode 100644
index 0000000000..e3d4008962
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.1.qml
@@ -0,0 +1,44 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+
+ property bool success: false
+ property bool gotInvalid: false
+ property bool expectNull: false
+ property SignalEmitter e: SignalEmitter { testObject: root; handleSignal: true }
+
+ function determineSuccess(param) {
+ if (root.expectNull == true) {
+ if (param != null) {
+ // the parameter shouldn't have been passed through, but was.
+ root.success = false;
+ root.gotInvalid = true;
+ } else {
+ root.success = true;
+ root.gotInvalid = false;
+ }
+ return;
+ } else if (param == null) {
+ // the parameter should have been passed through, but wasn't.
+ root.success = false;
+ return;
+ }
+
+ if (param.testProperty == 42) {
+ // got the expected value. if we didn't previously
+ // get an unexpected value, set success to true.
+ root.success = (!root.gotInvalid);
+ } else {
+ // the value passed through was not what we expected.
+ root.gotInvalid = true;
+ root.success = false;
+ }
+ }
+
+ Component.onCompleted: {
+ success = false;
+ e.emitTestSignal();
+ // the handler in the SignalEmitter should call determineSuccess.
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml
new file mode 100644
index 0000000000..5ae1bcecf5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml
@@ -0,0 +1,48 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+
+ property bool success: false
+ property bool gotInvalid: false
+ property bool expectNull: false
+ property SignalEmitter e: SignalEmitter { testObject: root; handleSignal: false } // false so it doesn't use bound handler.
+
+ function determineSuccess(param) {
+ if (root.expectNull == true) {
+ if (param != null) {
+ // the parameter shouldn't have been passed through, but was.
+ root.success = false;
+ root.gotInvalid = true;
+ } else {
+ root.success = true;
+ root.gotInvalid = false;
+ }
+ return;
+ } else if (param == null) {
+ // the parameter should have been passed through, but wasn't.
+ root.success = false;
+ return;
+ }
+
+ if (param.testProperty == 42) {
+ // got the expected value. if we didn't previously
+ // get an unexpected value, set success to true.
+ root.success = (!root.gotInvalid);
+ } else {
+ // the value passed through was not what we expected.
+ root.gotInvalid = true;
+ root.success = false;
+ }
+ }
+
+ function handleTestSignal(spp) {
+ root.determineSuccess(spp);
+ }
+
+ Component.onCompleted: {
+ success = false;
+ e.testSignal.connect(handleTestSignal)
+ e.emitTestSignal();
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/signalWithDefaultArg.qml b/tests/auto/qml/qqmllanguage/data/signalWithDefaultArg.qml
new file mode 100644
index 0000000000..e9f86fe6ca
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signalWithDefaultArg.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyQmlObject {
+ property real signalCount: 0
+ property real signalArg: 0
+
+ signal noArgSignal
+ signal argSignal(real arg)
+
+ function emitNoArgSignal() { noArgSignal(); }
+ function emitArgSignal() { argSignal(22); }
+
+ onSignalWithDefaultArg: {
+ signalArg = parameter
+ signalCount++
+ }
+
+ Component.onCompleted: {
+ noArgSignal.connect(signalWithDefaultArg)
+ argSignal.connect(signalWithDefaultArg)
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/simpleBindings.qml b/tests/auto/qml/qqmllanguage/data/simpleBindings.qml
new file mode 100644
index 0000000000..2fcd1a5a4f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/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/qml/qqmllanguage/data/simpleContainer.qml b/tests/auto/qml/qqmllanguage/data/simpleContainer.qml
new file mode 100644
index 0000000000..c3a795f536
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/simpleContainer.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyContainer {
+ MyQmlObject {}
+ MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/simpleObject.qml b/tests/auto/qml/qqmllanguage/data/simpleObject.qml
new file mode 100644
index 0000000000..30c78237de
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/simpleObject.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+MyQmlObject {}
diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.2.errors.txt b/tests/auto/qml/qqmllanguage/data/singularProperty.2.errors.txt
new file mode 100644
index 0000000000..beae562ff0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/singularProperty.2.errors.txt
@@ -0,0 +1 @@
+5:10:Cannot assign multiple values to a singular property
diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.2.qml b/tests/auto/qml/qqmllanguage/data/singularProperty.2.qml
new file mode 100644
index 0000000000..e2760cb418
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/singularProperty.2.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject a
+ a: [ QtObject {}, QtObject {} ]
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/singularProperty.errors.txt
new file mode 100644
index 0000000000..beae562ff0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/singularProperty.errors.txt
@@ -0,0 +1 @@
+5:10:Cannot assign multiple values to a singular property
diff --git a/tests/auto/qml/qqmllanguage/data/singularProperty.qml b/tests/auto/qml/qqmllanguage/data/singularProperty.qml
new file mode 100644
index 0000000000..ccbc6f0849
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/singularProperty.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant a
+ a: [ QtObject {}, QtObject {} ]
+}
diff --git a/tests/auto/qml/qqmllanguage/data/subdir/Test.qml b/tests/auto/qml/qqmllanguage/data/subdir/Test.qml
new file mode 100644
index 0000000000..f789a905f2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/subdir/Test.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Rectangle { }
diff --git a/tests/auto/qml/qqmllanguage/data/subdir/subsubdir/SubTest.qml b/tests/auto/qml/qqmllanguage/data/subdir/subsubdir/SubTest.qml
new file mode 100644
index 0000000000..f789a905f2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/subdir/subsubdir/SubTest.qml
@@ -0,0 +1,2 @@
+import QtQuick 2.0
+Rectangle { }
diff --git a/tests/auto/qml/qqmllanguage/data/test.js b/tests/auto/qml/qqmllanguage/data/test.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/test.js
diff --git a/tests/auto/qml/qqmllanguage/data/test2.js b/tests/auto/qml/qqmllanguage/data/test2.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/test2.js
diff --git a/tests/auto/qml/qqmllanguage/data/unregisteredObject.errors.txt b/tests/auto/qml/qqmllanguage/data/unregisteredObject.errors.txt
new file mode 100644
index 0000000000..10e5fb2d96
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/unregisteredObject.errors.txt
@@ -0,0 +1 @@
+2:1:UnregisteredObjectType is not a type
diff --git a/tests/auto/qml/qqmllanguage/data/unregisteredObject.qml b/tests/auto/qml/qqmllanguage/data/unregisteredObject.qml
new file mode 100644
index 0000000000..4969f62ad5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/unregisteredObject.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+UnregisteredObjectType {}
diff --git a/tests/auto/qml/qqmllanguage/data/unsupportedProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/unsupportedProperty.errors.txt
new file mode 100644
index 0000000000..3cd626de86
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/unsupportedProperty.errors.txt
@@ -0,0 +1 @@
+3:13:Invalid property assignment: unsupported type "QMatrix"
diff --git a/tests/auto/qml/qqmllanguage/data/unsupportedProperty.qml b/tests/auto/qml/qqmllanguage/data/unsupportedProperty.qml
new file mode 100644
index 0000000000..9f19680368
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/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/qml/qqmllanguage/data/valueTypes.qml b/tests/auto/qml/qqmllanguage/data/valueTypes.qml
new file mode 100644
index 0000000000..bf325a74ee
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/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/qml/qqmllanguage/data/variantNotify.qml b/tests/auto/qml/qqmllanguage/data/variantNotify.qml
new file mode 100644
index 0000000000..169b245450
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/variantNotify.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+QtObject {
+ property int notifyCount: 0
+
+ property variant foo
+ onFooChanged: notifyCount++
+
+ Component.onCompleted: {
+ foo = 1;
+ foo = 1;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/versionedbase.qml b/tests/auto/qml/qqmllanguage/data/versionedbase.qml
new file mode 100644
index 0000000000..3e8bca0368
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/versionedbase.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import Test 1.1
+
+MySubclass
+{
+ prop1: 10
+ prop2: 10
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.1.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.1.errors.txt
new file mode 100644
index 0000000000..ba7a0766b2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.1.errors.txt
@@ -0,0 +1 @@
+3:12:Invalid property assignment: int expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.1.qml b/tests/auto/qml/qqmllanguage/data/wrongType.1.qml
new file mode 100644
index 0000000000..289d37f050
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value: "hello"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.10.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.10.errors.txt
new file mode 100644
index 0000000000..ae75b5289d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.10.errors.txt
@@ -0,0 +1 @@
+3:23:Invalid property assignment: datetime expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.10.qml b/tests/auto/qml/qqmllanguage/data/wrongType.10.qml
new file mode 100644
index 0000000000..2cf0e50277
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.10.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ dateTimeProperty: 12
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.11.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.11.errors.txt
new file mode 100644
index 0000000000..23a4cda4c2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.11.errors.txt
@@ -0,0 +1 @@
+3:20:Invalid property assignment: point expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.11.qml b/tests/auto/qml/qqmllanguage/data/wrongType.11.qml
new file mode 100644
index 0000000000..ae77ba1fe8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.11.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ pointProperty: "apples"
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.12.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.12.errors.txt
new file mode 100644
index 0000000000..3092100280
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.12.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: size expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.12.qml b/tests/auto/qml/qqmllanguage/data/wrongType.12.qml
new file mode 100644
index 0000000000..b7a366f567
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.12.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ sizeProperty: "red"
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.13.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.13.errors.txt
new file mode 100644
index 0000000000..ba7a0766b2
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.13.errors.txt
@@ -0,0 +1 @@
+3:12:Invalid property assignment: int expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.13.qml b/tests/auto/qml/qqmllanguage/data/wrongType.13.qml
new file mode 100644
index 0000000000..477aff1dbe
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.13.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value: "12"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.14.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.14.errors.txt
new file mode 100644
index 0000000000..d621fdd6cd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.14.errors.txt
@@ -0,0 +1 @@
+3:21:Invalid property assignment: string expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.14.qml b/tests/auto/qml/qqmllanguage/data/wrongType.14.qml
new file mode 100644
index 0000000000..672d693c72
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.14.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ stringProperty: 10
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.15.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.15.errors.txt
new file mode 100644
index 0000000000..44768e30cb
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.15.errors.txt
@@ -0,0 +1 @@
+3:18:Invalid property assignment: url expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.15.qml b/tests/auto/qml/qqmllanguage/data/wrongType.15.qml
new file mode 100644
index 0000000000..633a5ba2ba
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.15.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ urlProperty: 12
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt
new file mode 100644
index 0000000000..77cf210918
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt
@@ -0,0 +1 @@
+4:24:Cannot assign object to property
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.16.qml b/tests/auto/qml/qqmllanguage/data/wrongType.16.qml
new file mode 100644
index 0000000000..973fdada24
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.16.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import QtQuick 2.0
+MyQmlObject {
+ qmlobjectProperty: QtObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.17.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.17.errors.txt
new file mode 100644
index 0000000000..ef34d0ea95
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.17.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: unknown enumeration
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.17.qml b/tests/auto/qml/qqmllanguage/data/wrongType.17.qml
new file mode 100644
index 0000000000..f678fb3136
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.17.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ enumProperty: 6
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.2.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.2.errors.txt
new file mode 100644
index 0000000000..9ff9f250c0
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.2.errors.txt
@@ -0,0 +1 @@
+3:14:Invalid property assignment: boolean expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.2.qml b/tests/auto/qml/qqmllanguage/data/wrongType.2.qml
new file mode 100644
index 0000000000..34b74f7e01
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ enabled: 5
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.3.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.3.errors.txt
new file mode 100644
index 0000000000..6d971c6499
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.3.errors.txt
@@ -0,0 +1 @@
+3:11:Invalid property assignment: rect expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.3.qml b/tests/auto/qml/qqmllanguage/data/wrongType.3.qml
new file mode 100644
index 0000000000..384181a17f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.3.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ rect: "5,5x10"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.4.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.4.errors.txt
new file mode 100644
index 0000000000..ef34d0ea95
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.4.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: unknown enumeration
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.4.qml b/tests/auto/qml/qqmllanguage/data/wrongType.4.qml
new file mode 100644
index 0000000000..0787bf5fda
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.4.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ enumProperty: "InvalidEnumName"
+}
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.5.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.5.errors.txt
new file mode 100644
index 0000000000..cab10bddb8
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.5.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: unsigned int expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.5.qml b/tests/auto/qml/qqmllanguage/data/wrongType.5.qml
new file mode 100644
index 0000000000..c50ae9a26d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.5.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ uintProperty: -13
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.6.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.6.errors.txt
new file mode 100644
index 0000000000..d2b8c54c5b
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.6.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: number expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.6.qml b/tests/auto/qml/qqmllanguage/data/wrongType.6.qml
new file mode 100644
index 0000000000..da10b7895f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.6.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ realProperty: "Hello"
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.7.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.7.errors.txt
new file mode 100644
index 0000000000..8a168d2941
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.7.errors.txt
@@ -0,0 +1 @@
+4:20:Invalid property assignment: color expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.7.qml b/tests/auto/qml/qqmllanguage/data/wrongType.7.qml
new file mode 100644
index 0000000000..e9dd71079a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.7.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import QtQuick 2.0
+MyTypeObject {
+ colorProperty: 12
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.8.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.8.errors.txt
new file mode 100644
index 0000000000..1773c00825
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.8.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: date expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.8.qml b/tests/auto/qml/qqmllanguage/data/wrongType.8.qml
new file mode 100644
index 0000000000..a5f6756399
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.8.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ dateProperty: 12
+}
+
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.9.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.9.errors.txt
new file mode 100644
index 0000000000..8630975c57
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.9.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: time expected
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.9.qml b/tests/auto/qml/qqmllanguage/data/wrongType.9.qml
new file mode 100644
index 0000000000..a3db732692
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.9.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ timeProperty: 12
+}
+
diff --git a/tests/auto/qml/qqmllanguage/qqmllanguage.pro b/tests/auto/qml/qqmllanguage/qqmllanguage.pro
new file mode 100644
index 0000000000..942a511b7f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/qqmllanguage.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_qqmllanguage
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmllanguage.cpp \
+ testtypes.cpp
+HEADERS += testtypes.h
+
+INCLUDEPATH += ../../shared/
+HEADERS += ../../shared/testhttpserver.h
+SOURCES += ../../shared/testhttpserver.cpp
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private network testlib
+
+include (../../shared/util.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp
new file mode 100644
index 0000000000..3957f9d872
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/testtypes.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+
+void registerTypes()
+{
+ qmlRegisterInterface<MyInterface>("MyInterface");
+ qmlRegisterType<MyQmlObject>("Test",1,0,"MyQmlObject");
+ qmlRegisterType<MyTypeObject>("Test",1,0,"MyTypeObject");
+ qmlRegisterType<MyContainer>("Test",1,0,"MyContainer");
+ qmlRegisterType<MyPropertyValueSource>("Test",1,0,"MyPropertyValueSource");
+ qmlRegisterType<MyDotPropertyObject>("Test",1,0,"MyDotPropertyObject");
+ qmlRegisterType<MyNamespace::MyNamespacedType>("Test",1,0,"MyNamespacedType");
+ qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType");
+ qmlRegisterType<MyParserStatus>("Test",1,0,"MyParserStatus");
+ qmlRegisterType<MyGroupedObject>();
+ qmlRegisterType<MyRevisionedClass>("Test",1,0,"MyRevisionedClass");
+ qmlRegisterType<MyRevisionedClass,1>("Test",1,1,"MyRevisionedClass");
+ qmlRegisterType<MyRevisionedIllegalOverload>("Test",1,0,"MyRevisionedIllegalOverload");
+ qmlRegisterType<MyRevisionedLegalOverload>("Test",1,0,"MyRevisionedLegalOverload");
+
+ // Register the uncreatable base class
+ qmlRegisterRevision<MyRevisionedBaseClassRegistered,1>("Test",1,1);
+ // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0
+ qmlRegisterType<MyRevisionedSubclass>("Test",1,0,"MyRevisionedSubclass");
+ // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
+ qmlRegisterType<MyRevisionedSubclass,1>("Test",1,1,"MyRevisionedSubclass");
+
+ // Only version 1.0, but its super class is registered in version 1.1 also
+ qmlRegisterType<MySubclass>("Test",1,0,"MySubclass");
+
+ qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser);
+
+ qmlRegisterTypeNotAvailable("Test",1,0,"UnavailableType", "UnavailableType is unavailable for testing");
+
+ qmlRegisterType<MyQmlObject>("Test.Version",1,0,"MyQmlObject");
+ qmlRegisterType<MyTypeObject>("Test.Version",1,0,"MyTypeObject");
+ qmlRegisterType<MyTypeObject>("Test.Version",2,0,"MyTypeObject");
+
+ qmlRegisterType<MyVersion2Class>("Test.VersionOrder", 2,0, "MyQmlObject");
+ qmlRegisterType<MyQmlObject>("Test.VersionOrder", 1,0, "MyQmlObject");
+
+ qmlRegisterType<MyEnum1Class>("Test",1,0,"MyEnum1Class");
+ qmlRegisterType<MyEnum2Class>("Test",1,0,"MyEnum2Class");
+ qmlRegisterType<MyEnumDerivedClass>("Test",1,0,"MyEnumDerivedClass");
+
+ qmlRegisterType<MyReceiversTestObject>("Test",1,0,"MyReceiversTestObject");
+
+ qmlRegisterUncreatableType<MyUncreateableBaseClass>("Test", 1, 0, "MyUncreateableBaseClass", "Cannot create MyUncreateableBaseClass");
+ qmlRegisterType<MyCreateableDerivedClass>("Test", 1, 0, "MyCreateableDerivedClass");
+
+ qmlRegisterUncreatableType<MyUncreateableBaseClass,1>("Test", 1, 1, "MyUncreateableBaseClass", "Cannot create MyUncreateableBaseClass");
+ qmlRegisterType<MyCreateableDerivedClass,1>("Test", 1, 1, "MyCreateableDerivedClass");
+}
+
+QVariant myCustomVariantTypeConverter(const QString &data)
+{
+ MyCustomVariantType rv;
+ rv.a = data.toInt();
+ return QVariant::fromValue(rv);
+}
diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h
new file mode 100644
index 0000000000..703b26a73c
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/testtypes.h
@@ -0,0 +1,1075 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qdatetime.h>
+#include <QtGui/qmatrix.h>
+#include <QtGui/qcolor.h>
+#include <QtGui/qvector3d.h>
+#include <QtGui/qvector4d.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qqmlpropertyvaluesource.h>
+#include <QtQml/qqmlscriptstring.h>
+#include <QtQml/qqmlproperty.h>
+
+#include <private/qqmlcustomparser_p.h>
+
+QVariant myCustomVariantTypeConverter(const QString &data);
+
+class MyInterface
+{
+public:
+ MyInterface() : id(913) {}
+ int id;
+};
+
+QT_BEGIN_NAMESPACE
+#define MyInterface_iid "org.qt-project.Qt.Test.MyInterface"
+Q_DECLARE_INTERFACE(MyInterface, MyInterface_iid);
+QT_END_NAMESPACE
+QML_DECLARE_INTERFACE(MyInterface);
+
+struct MyCustomVariantType
+{
+ MyCustomVariantType() : a(0) {}
+ int a;
+};
+Q_DECLARE_METATYPE(MyCustomVariantType);
+
+class MyAttachedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2)
+public:
+ MyAttachedObject(QObject *parent) : QObject(parent), m_value(0), m_value2(0) {}
+
+ int value() const { return m_value; }
+ void setValue(int v) { if (m_value != v) { m_value = v; emit valueChanged(); } }
+
+ int value2() const { return m_value2; }
+ void setValue2(int v) { m_value2 = v; }
+
+signals:
+ void valueChanged();
+
+private:
+ int m_value;
+ int m_value2;
+};
+
+class MyQmlObject : public QObject, public MyInterface
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue FINAL)
+ Q_PROPERTY(QString readOnlyString READ readOnlyString)
+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
+ Q_PROPERTY(QRect rect READ rect WRITE setRect)
+ Q_PROPERTY(QMatrix matrix READ matrix WRITE setMatrix) //assumed to be unsupported by QML
+ Q_PROPERTY(MyInterface *interfaceProperty READ interface WRITE setInterface)
+ Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal)
+ Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType)
+ Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject)
+ Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal)
+ Q_PROPERTY(int nonScriptable READ nonScriptable WRITE setNonScriptable SCRIPTABLE false)
+ Q_PROPERTY(QJSValue qjsvalue READ qjsvalue WRITE setQJSValue NOTIFY qjsvalueChanged)
+
+ Q_INTERFACES(MyInterface)
+public:
+ MyQmlObject() : m_value(-1), m_interface(0), m_qmlobject(0) { qRegisterMetaType<MyCustomVariantType>("MyCustomVariantType"); }
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; }
+
+ QString readOnlyString() const { return QLatin1String(""); }
+
+ bool enabled() const { return false; }
+ void setEnabled(bool) {}
+
+ QRect rect() const { return QRect(); }
+ void setRect(const QRect&) {}
+
+ QMatrix matrix() const { return QMatrix(); }
+ void setMatrix(const QMatrix&) {}
+
+ MyInterface *interface() const { return m_interface; }
+ void setInterface(MyInterface *iface) { m_interface = iface; }
+
+ static MyAttachedObject *qmlAttachedProperties(QObject *other) {
+ return new MyAttachedObject(other);
+ }
+ Q_CLASSINFO("DefaultMethod", "basicSlot()")
+
+ int onLiteralSignal() const { return m_value; }
+ void setOnLiteralSignal(int v) { m_value = v; }
+
+ MyQmlObject *qmlobject() const { return m_qmlobject; }
+ void setQmlobject(MyQmlObject *o) { m_qmlobject = o; }
+
+ MyCustomVariantType customType() const { return m_custom; }
+ void setCustomType(const MyCustomVariantType &v) { m_custom = v; }
+
+ int propertyWithNotify() const { return m_propertyWithNotify; }
+ void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); }
+
+ int nonScriptable() const { return 0; }
+ void setNonScriptable(int) {}
+
+ QJSValue qjsvalue() const { return m_qjsvalue; }
+ void setQJSValue(const QJSValue &value) { m_qjsvalue = value; emit qjsvalueChanged(); }
+
+public slots:
+ void basicSlot() { qWarning("MyQmlObject::basicSlot"); }
+ void basicSlotWithArgs(int v) { qWarning("MyQmlObject::basicSlotWithArgs(%d)", v); }
+ void qjsvalueMethod(const QJSValue &v) { m_qjsvalue = v; }
+
+signals:
+ void basicSignal();
+ void basicParameterizedSignal(int parameter);
+ void oddlyNamedNotifySignal();
+ void signalWithDefaultArg(int parameter = 5);
+ void qjsvalueChanged();
+
+private:
+ friend class tst_qqmllanguage;
+ int m_value;
+ MyInterface *m_interface;
+ MyQmlObject *m_qmlobject;
+ MyCustomVariantType m_custom;
+ int m_propertyWithNotify;
+ QJSValue m_qjsvalue;
+};
+QML_DECLARE_TYPE(MyQmlObject)
+QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
+
+class MyGroupedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlScriptString script READ script WRITE setScript)
+ Q_PROPERTY(int value READ value WRITE setValue)
+public:
+ QQmlScriptString script() const { return m_script; }
+ void setScript(const QQmlScriptString &s) { m_script = s; }
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; }
+
+private:
+ int m_value;
+ QQmlScriptString m_script;
+};
+
+
+class MyEnumContainer : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(RelatedEnum)
+
+public:
+ enum RelatedEnum { RelatedInvalid = -1, RelatedValue = 42 };
+};
+
+class MyTypeObject : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(MyEnum)
+ Q_ENUMS(MyMirroredEnum)
+ Q_ENUMS(MyEnumContainer::RelatedEnum)
+ Q_FLAGS(MyFlags)
+
+ Q_PROPERTY(QString id READ id WRITE setId)
+ Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectPropertyChanged)
+ Q_PROPERTY(QQmlComponent *componentProperty READ componentProperty WRITE setComponentProperty)
+ Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty NOTIFY flagPropertyChanged)
+ Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty NOTIFY enumPropertyChanged)
+ Q_PROPERTY(MyEnum readOnlyEnumProperty READ readOnlyEnumProperty)
+ Q_PROPERTY(Qt::TextFormat qtEnumProperty READ qtEnumProperty WRITE setQtEnumProperty NOTIFY qtEnumPropertyChanged)
+ Q_PROPERTY(MyMirroredEnum mirroredEnumProperty READ mirroredEnumProperty WRITE setMirroredEnumProperty NOTIFY mirroredEnumPropertyChanged)
+ Q_PROPERTY(MyEnumContainer::RelatedEnum relatedEnumProperty READ relatedEnumProperty WRITE setRelatedEnumProperty)
+ Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringPropertyChanged)
+ Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty NOTIFY uintPropertyChanged)
+ Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty NOTIFY intPropertyChanged)
+ Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty NOTIFY realPropertyChanged)
+ Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty NOTIFY doublePropertyChanged)
+ Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty NOTIFY floatPropertyChanged)
+ Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty NOTIFY colorPropertyChanged)
+ Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty NOTIFY datePropertyChanged)
+ Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty NOTIFY timePropertyChanged)
+ Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty NOTIFY dateTimePropertyChanged)
+ Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty NOTIFY pointPropertyChanged)
+ Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty NOTIFY pointFPropertyChanged)
+ Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty NOTIFY sizePropertyChanged)
+ Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty NOTIFY sizeFPropertyChanged)
+ 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 NOTIFY rectFPropertyChanged)
+ Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty NOTIFY boolPropertyChanged)
+ Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty NOTIFY variantPropertyChanged)
+ Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty NOTIFY vectorPropertyChanged)
+ Q_PROPERTY(QVector4D vector4Property READ vector4Property WRITE setVector4Property NOTIFY vector4PropertyChanged)
+ Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty NOTIFY urlPropertyChanged)
+
+ Q_PROPERTY(QQmlScriptString scriptProperty READ scriptProperty WRITE setScriptProperty)
+ Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT)
+ Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT)
+
+public:
+ MyTypeObject()
+ : objectPropertyValue(0), componentPropertyValue(0) {}
+
+ QString idValue;
+ QString id() const {
+ return idValue;
+ }
+ void setId(const QString &v) {
+ idValue = v;
+ }
+
+ QObject *objectPropertyValue;
+ QObject *objectProperty() const {
+ return objectPropertyValue;
+ }
+ void setObjectProperty(QObject *v) {
+ objectPropertyValue = v;
+ emit objectPropertyChanged();
+ }
+
+ QQmlComponent *componentPropertyValue;
+ QQmlComponent *componentProperty() const {
+ return componentPropertyValue;
+ }
+ void setComponentProperty(QQmlComponent *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;
+ emit flagPropertyChanged();
+ }
+
+ enum MyEnum { EnumVal1, EnumVal2 };
+ MyEnum enumPropertyValue;
+ MyEnum enumProperty() const {
+ return enumPropertyValue;
+ }
+ void setEnumProperty(MyEnum v) {
+ enumPropertyValue = v;
+ emit enumPropertyChanged();
+ }
+
+ MyEnum readOnlyEnumProperty() const {
+ return EnumVal1;
+ }
+
+ Qt::TextFormat qtEnumPropertyValue;
+ Qt::TextFormat qtEnumProperty() const {
+ return qtEnumPropertyValue;
+ }
+ void setQtEnumProperty(Qt::TextFormat v) {
+ qtEnumPropertyValue = v;
+ emit qtEnumPropertyChanged();
+ }
+
+ enum MyMirroredEnum {
+ MirroredEnumVal1 = Qt::AlignLeft,
+ MirroredEnumVal2 = Qt::AlignRight,
+ MirroredEnumVal3 = Qt::AlignHCenter };
+ MyMirroredEnum mirroredEnumPropertyValue;
+ MyMirroredEnum mirroredEnumProperty() const {
+ return mirroredEnumPropertyValue;
+ }
+ void setMirroredEnumProperty(MyMirroredEnum v) {
+ mirroredEnumPropertyValue = v;
+ emit mirroredEnumPropertyChanged();
+ }
+
+ MyEnumContainer::RelatedEnum relatedEnumPropertyValue;
+ MyEnumContainer::RelatedEnum relatedEnumProperty() const {
+ return relatedEnumPropertyValue;
+ }
+ void setRelatedEnumProperty(MyEnumContainer::RelatedEnum v) {
+ relatedEnumPropertyValue = v;
+ }
+
+ QString stringPropertyValue;
+ QString stringProperty() const {
+ return stringPropertyValue;
+ }
+ void setStringProperty(const QString &v) {
+ stringPropertyValue = v;
+ emit stringPropertyChanged();
+ }
+
+ uint uintPropertyValue;
+ uint uintProperty() const {
+ return uintPropertyValue;
+ }
+ void setUintProperty(const uint &v) {
+ uintPropertyValue = v;
+ emit uintPropertyChanged();
+ }
+
+ int intPropertyValue;
+ int intProperty() const {
+ return intPropertyValue;
+ }
+ void setIntProperty(const int &v) {
+ intPropertyValue = v;
+ emit intPropertyChanged();
+ }
+
+ qreal realPropertyValue;
+ qreal realProperty() const {
+ return realPropertyValue;
+ }
+ void setRealProperty(const qreal &v) {
+ realPropertyValue = v;
+ emit realPropertyChanged();
+ }
+
+ double doublePropertyValue;
+ double doubleProperty() const {
+ return doublePropertyValue;
+ }
+ void setDoubleProperty(const double &v) {
+ doublePropertyValue = v;
+ emit doublePropertyChanged();
+ }
+
+ float floatPropertyValue;
+ float floatProperty() const {
+ return floatPropertyValue;
+ }
+ void setFloatProperty(const float &v) {
+ floatPropertyValue = v;
+ emit floatPropertyChanged();
+ }
+
+ QColor colorPropertyValue;
+ QColor colorProperty() const {
+ return colorPropertyValue;
+ }
+ void setColorProperty(const QColor &v) {
+ colorPropertyValue = v;
+ emit colorPropertyChanged();
+ }
+
+ QDate datePropertyValue;
+ QDate dateProperty() const {
+ return datePropertyValue;
+ }
+ void setDateProperty(const QDate &v) {
+ datePropertyValue = v;
+ emit datePropertyChanged();
+ }
+
+ QTime timePropertyValue;
+ QTime timeProperty() const {
+ return timePropertyValue;
+ }
+ void setTimeProperty(const QTime &v) {
+ timePropertyValue = v;
+ emit timePropertyChanged();
+ }
+
+ QDateTime dateTimePropertyValue;
+ QDateTime dateTimeProperty() const {
+ return dateTimePropertyValue;
+ }
+ void setDateTimeProperty(const QDateTime &v) {
+ dateTimePropertyValue = v;
+ emit dateTimePropertyChanged();
+ }
+
+ QPoint pointPropertyValue;
+ QPoint pointProperty() const {
+ return pointPropertyValue;
+ }
+ void setPointProperty(const QPoint &v) {
+ pointPropertyValue = v;
+ emit pointPropertyChanged();
+ }
+
+ QPointF pointFPropertyValue;
+ QPointF pointFProperty() const {
+ return pointFPropertyValue;
+ }
+ void setPointFProperty(const QPointF &v) {
+ pointFPropertyValue = v;
+ emit pointFPropertyChanged();
+ }
+
+ QSize sizePropertyValue;
+ QSize sizeProperty() const {
+ return sizePropertyValue;
+ }
+ void setSizeProperty(const QSize &v) {
+ sizePropertyValue = v;
+ emit sizePropertyChanged();
+ }
+
+ QSizeF sizeFPropertyValue;
+ QSizeF sizeFProperty() const {
+ return sizeFPropertyValue;
+ }
+ void setSizeFProperty(const QSizeF &v) {
+ sizeFPropertyValue = v;
+ emit sizeFPropertyChanged();
+ }
+
+ 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;
+ emit rectFPropertyChanged();
+ }
+
+ bool boolPropertyValue;
+ bool boolProperty() const {
+ return boolPropertyValue;
+ }
+ void setBoolProperty(const bool &v) {
+ boolPropertyValue = v;
+ emit boolPropertyChanged();
+ }
+
+ QVariant variantPropertyValue;
+ QVariant variantProperty() const {
+ return variantPropertyValue;
+ }
+ void setVariantProperty(const QVariant &v) {
+ variantPropertyValue = v;
+ emit variantPropertyChanged();
+ }
+
+ QVector3D vectorPropertyValue;
+ QVector3D vectorProperty() const {
+ return vectorPropertyValue;
+ }
+ void setVectorProperty(const QVector3D &v) {
+ vectorPropertyValue = v;
+ emit vectorPropertyChanged();
+ }
+
+ QVector4D vector4PropertyValue;
+ QVector4D vector4Property() const {
+ return vector4PropertyValue;
+ }
+ void setVector4Property(const QVector4D &v) {
+ vector4PropertyValue = v;
+ emit vector4PropertyChanged();
+ }
+
+ QUrl urlPropertyValue;
+ QUrl urlProperty() const {
+ return urlPropertyValue;
+ }
+ void setUrlProperty(const QUrl &v) {
+ urlPropertyValue = v;
+ emit urlPropertyChanged();
+ }
+
+ QQmlScriptString scriptPropertyValue;
+ QQmlScriptString scriptProperty() const {
+ return scriptPropertyValue;
+ }
+ void setScriptProperty(const QQmlScriptString &v) {
+ scriptPropertyValue = v;
+ }
+
+ MyGroupedObject groupedValue;
+ MyGroupedObject *grouped() { return &groupedValue; }
+
+ MyGroupedObject *nullGrouped() { return 0; }
+
+ void doAction() { emit action(); }
+signals:
+ void action();
+
+ void objectPropertyChanged();
+ void flagPropertyChanged();
+ void enumPropertyChanged();
+ void qtEnumPropertyChanged();
+ void mirroredEnumPropertyChanged();
+ void stringPropertyChanged();
+ void uintPropertyChanged();
+ void intPropertyChanged();
+ void realPropertyChanged();
+ void doublePropertyChanged();
+ void floatPropertyChanged();
+ void colorPropertyChanged();
+ void datePropertyChanged();
+ void timePropertyChanged();
+ void dateTimePropertyChanged();
+ void pointPropertyChanged();
+ void pointFPropertyChanged();
+ void sizePropertyChanged();
+ void sizeFPropertyChanged();
+ void rectPropertyChanged();
+ void rectFPropertyChanged();
+ void boolPropertyChanged();
+ void variantPropertyChanged();
+ void vectorPropertyChanged();
+ void vector4PropertyChanged();
+ void urlPropertyChanged();
+
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
+
+
+class MyContainer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<QObject> children READ children)
+ Q_PROPERTY(QQmlListProperty<MyContainer> containerChildren READ containerChildren)
+ Q_PROPERTY(QQmlListProperty<MyInterface> qlistInterfaces READ qlistInterfaces)
+ Q_CLASSINFO("DefaultProperty", "children")
+public:
+ MyContainer() {}
+
+ QQmlListProperty<QObject> children() { return QQmlListProperty<QObject>(this, m_children); }
+ QQmlListProperty<MyContainer> containerChildren() { return QQmlListProperty<MyContainer>(this, m_containerChildren); }
+ QList<QObject *> *getChildren() { return &m_children; }
+ QQmlListProperty<MyInterface> qlistInterfaces() { return QQmlListProperty<MyInterface>(this, m_interfaces); }
+ QList<MyInterface *> *getQListInterfaces() { return &m_interfaces; }
+
+ QList<MyContainer*> m_containerChildren;
+ QList<QObject*> m_children;
+ QList<MyInterface *> m_interfaces;
+};
+
+
+class MyPropertyValueSource : public QObject, public QQmlPropertyValueSource
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueSource)
+public:
+ MyPropertyValueSource()
+ : QQmlPropertyValueSource() {}
+
+ QQmlProperty prop;
+ virtual void setTarget(const QQmlProperty &p)
+ {
+ prop = p;
+ }
+};
+
+class UnavailableType : public QObject
+{
+ Q_OBJECT
+public:
+ UnavailableType() {}
+};
+
+class MyReceiversTestObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int prop READ prop NOTIFY propChanged)
+public:
+ MyReceiversTestObject() {}
+
+ int prop() const { return 5; }
+
+ int mySignalCount() { return receivers(SIGNAL(mySignal())); }
+ int propChangedCount() { return receivers(SIGNAL(propChanged())); }
+ int myUnconnectedSignalCount() { return receivers(SIGNAL(myUnconnectedSignal())); }
+
+signals:
+ void mySignal();
+ void propChanged();
+ void myUnconnectedSignal();
+
+private:
+ friend class tst_qqmllanguage;
+};
+
+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;
+};
+
+
+namespace MyNamespace {
+ class MyNamespacedType : public QObject
+ {
+ Q_OBJECT
+ };
+
+ class MySecondNamespacedType : public QObject
+ {
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<MyNamespace::MyNamespacedType> list READ list)
+ public:
+ QQmlListProperty<MyNamespacedType> list() { return QQmlListProperty<MyNamespacedType>(this, m_list); }
+
+ private:
+ QList<MyNamespacedType *> m_list;
+ };
+}
+
+class MyCustomParserType : public QObject
+{
+ Q_OBJECT
+};
+
+class MyCustomParserTypeParser : public QQmlCustomParser
+{
+public:
+ QByteArray compile(const QList<QQmlCustomParserProperty> &) { return QByteArray(); }
+ void setCustomData(QObject *, const QByteArray &) {}
+};
+
+class MyParserStatus : public QObject, public QQmlParserStatus
+{
+ Q_INTERFACES(QQmlParserStatus)
+ Q_OBJECT
+public:
+ MyParserStatus() : m_cbc(0), m_ccc(0) {}
+
+ int classBeginCount() const { return m_cbc; }
+ int componentCompleteCount() const { return m_ccc; }
+
+ virtual void classBegin() { m_cbc++; }
+ virtual void componentComplete() { m_ccc++; }
+private:
+ int m_cbc;
+ int m_ccc;
+};
+
+class MyRevisionedBaseClassRegistered : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal propA READ propA WRITE setPropA NOTIFY propAChanged)
+ Q_PROPERTY(qreal propB READ propB WRITE setPropB NOTIFY propBChanged REVISION 1)
+
+public:
+ MyRevisionedBaseClassRegistered() : m_pa(1), m_pb(2) {}
+
+ qreal propA() const { return m_pa; }
+ void setPropA(qreal p) {
+ if (p != m_pa) {
+ m_pa = p;
+ emit propAChanged();
+ }
+ }
+ qreal propB() const { return m_pb; }
+ void setPropB(qreal p) {
+ if (p != m_pb) {
+ m_pb = p;
+ emit propBChanged();
+ }
+ }
+
+ Q_INVOKABLE void methodA() { }
+ Q_INVOKABLE Q_REVISION(1) void methodB() { }
+
+signals:
+ void propAChanged();
+ void propBChanged();
+
+ void signalA();
+ Q_REVISION(1) void signalB();
+
+protected:
+ qreal m_pa;
+ qreal m_pb;
+};
+
+class MyRevisionedIllegalOverload : public MyRevisionedBaseClassRegistered
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal propA READ propA WRITE setPropA REVISION 1);
+};
+
+class MyRevisionedLegalOverload : public MyRevisionedBaseClassRegistered
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal propB READ propB WRITE setPropB REVISION 1);
+};
+
+class MyRevisionedBaseClassUnregistered : public MyRevisionedBaseClassRegistered
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal propC READ propC WRITE setPropC NOTIFY propCChanged)
+ Q_PROPERTY(qreal propD READ propD WRITE setPropD NOTIFY propDChanged REVISION 1)
+
+public:
+ MyRevisionedBaseClassUnregistered() : m_pc(1), m_pd(2) {}
+
+ qreal propC() const { return m_pc; }
+ void setPropC(qreal p) {
+ if (p != m_pc) {
+ m_pc = p;
+ emit propCChanged();
+ }
+ }
+ qreal propD() const { return m_pd; }
+ void setPropD(qreal p) {
+ if (p != m_pd) {
+ m_pd = p;
+ emit propDChanged();
+ }
+ }
+
+ Q_INVOKABLE void methodC() { }
+ Q_INVOKABLE Q_REVISION(1) void methodD() { }
+
+signals:
+ void propCChanged();
+ void propDChanged();
+
+ void signalC();
+ Q_REVISION(1) void signalD();
+
+protected:
+ qreal m_pc;
+ qreal m_pd;
+};
+
+class MyRevisionedClass : public MyRevisionedBaseClassUnregistered
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal prop1 READ prop1 WRITE setProp1 NOTIFY prop1Changed)
+ Q_PROPERTY(qreal prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed REVISION 1)
+
+public:
+ MyRevisionedClass() : m_p1(1), m_p2(2) {}
+
+ qreal prop1() const { return m_p1; }
+ void setProp1(qreal p) {
+ if (p != m_p1) {
+ m_p1 = p;
+ emit prop1Changed();
+ }
+ }
+ qreal prop2() const { return m_p2; }
+ void setProp2(qreal p) {
+ if (p != m_p2) {
+ m_p2 = p;
+ emit prop2Changed();
+ }
+ }
+
+ Q_INVOKABLE void method1() { }
+ Q_INVOKABLE Q_REVISION(1) void method2() { }
+
+signals:
+ void prop1Changed();
+ void prop2Changed();
+
+ void signal1();
+ Q_REVISION(1) void signal2();
+
+protected:
+ qreal m_p1;
+ qreal m_p2;
+};
+
+class MyRevisionedSubclass : public MyRevisionedClass
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal prop3 READ prop3 WRITE setProp3 NOTIFY prop3Changed)
+ Q_PROPERTY(qreal prop4 READ prop4 WRITE setProp4 NOTIFY prop4Changed REVISION 1)
+
+public:
+ MyRevisionedSubclass() : m_p3(3), m_p4(4) {}
+
+ qreal prop3() const { return m_p3; }
+ void setProp3(qreal p) {
+ if (p != m_p3) {
+ m_p3 = p;
+ emit prop3Changed();
+ }
+ }
+ qreal prop4() const { return m_p4; }
+ void setProp4(qreal p) {
+ if (p != m_p4) {
+ m_p4 = p;
+ emit prop4Changed();
+ }
+ }
+
+ Q_INVOKABLE void method3() { }
+ Q_INVOKABLE Q_REVISION(1) void method4() { }
+
+signals:
+ void prop3Changed();
+ void prop4Changed();
+
+ void signal3();
+ Q_REVISION(1) void signal4();
+
+protected:
+ qreal m_p3;
+ qreal m_p4;
+};
+
+class MySubclass : public MyRevisionedClass
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal prop5 READ prop5 WRITE setProp5 NOTIFY prop5Changed)
+
+public:
+ MySubclass() : m_p5(5) {}
+
+ qreal prop5() const { return m_p5; }
+ void setProp5(qreal p) {
+ if (p != m_p5) {
+ m_p5 = p;
+ emit prop5Changed();
+ }
+ }
+
+ Q_INVOKABLE void method5() { }
+
+signals:
+ void prop5Changed();
+
+protected:
+ qreal m_p5;
+};
+
+class MyUncreateableBaseClass : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool prop1 READ prop1 WRITE setprop1)
+ Q_PROPERTY(bool prop2 READ prop2 WRITE setprop2 REVISION 1)
+ Q_PROPERTY(bool prop3 READ prop3 WRITE setprop3 REVISION 1)
+public:
+ explicit MyUncreateableBaseClass(bool /* arg */, QObject *parent = 0)
+ : QObject(parent), _prop1(false), _prop2(false), _prop3(false)
+ {
+ }
+
+ bool _prop1;
+ bool prop1() const { return _prop1; }
+ void setprop1(bool p) { _prop1 = p; }
+ bool _prop2;
+ bool prop2() const { return _prop2; }
+ void setprop2(bool p) { _prop2 = p; }
+ bool _prop3;
+ bool prop3() const { return _prop3; }
+ void setprop3(bool p) { _prop3 = p; }
+};
+
+class MyCreateableDerivedClass : public MyUncreateableBaseClass
+{
+ Q_OBJECT
+ Q_PROPERTY(bool prop2 READ prop2 WRITE setprop2 REVISION 1)
+
+public:
+ MyCreateableDerivedClass(QObject *parent = 0)
+ : MyUncreateableBaseClass(true, parent)
+ {
+ }
+};
+
+class MyVersion2Class : public QObject
+{
+ Q_OBJECT
+};
+
+class MyEnum1Class : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(EnumA)
+
+public:
+ MyEnum1Class() : value(A_Invalid) {}
+
+ enum EnumA
+ {
+ A_Invalid = -1,
+
+ A_11 = 11,
+ A_13 = 13
+ };
+
+ Q_INVOKABLE void setValue(EnumA v) { value = v; }
+
+ EnumA getValue() { return value; }
+
+private:
+ EnumA value;
+};
+
+class MyEnum2Class : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(EnumB)
+ Q_ENUMS(EnumE)
+
+public:
+ MyEnum2Class() : valueA(MyEnum1Class::A_Invalid), valueB(B_Invalid), valueC(Qt::PlainText),
+ valueD(Qt::ElideLeft), valueE(E_Invalid), valueE2(E_Invalid) {}
+
+ enum EnumB
+ {
+ B_Invalid = -1,
+
+ B_29 = 29,
+ B_31 = 31,
+ B_37 = 37
+ };
+
+ enum EnumE
+ {
+ E_Invalid = -1,
+
+ E_14 = 14,
+ E_76 = 76
+ };
+
+ MyEnum1Class::EnumA getValueA() { return valueA; }
+ EnumB getValueB() { return valueB; }
+ Qt::TextFormat getValueC() { return valueC; }
+ Qt::TextElideMode getValueD() { return valueD; }
+ EnumE getValueE() { return valueE; }
+ EnumE getValueE2() { return valueE2; }
+
+ Q_INVOKABLE void setValueA(MyEnum1Class::EnumA v) { valueA = v; emit valueAChanged(v); }
+ Q_INVOKABLE void setValueB(EnumB v) { valueB = v; emit valueBChanged(v); }
+ Q_INVOKABLE void setValueC(Qt::TextFormat v) { valueC = v; emit valueCChanged(v); } //registered
+ Q_INVOKABLE void setValueD(Qt::TextElideMode v) { valueD = v; emit valueDChanged(v); } //unregistered
+ Q_INVOKABLE void setValueE(EnumE v) { valueE = v; emit valueEChanged(v); }
+ Q_INVOKABLE void setValueE2(MyEnum2Class::EnumE v) { valueE2 = v; emit valueE2Changed(v); }
+
+signals:
+ void valueAChanged(MyEnum1Class::EnumA newValue);
+ void valueBChanged(MyEnum2Class::EnumB newValue);
+ void valueCChanged(Qt::TextFormat newValue);
+ void valueDChanged(Qt::TextElideMode newValue);
+ void valueEChanged(EnumE newValue);
+ void valueE2Changed(MyEnum2Class::EnumE newValue);
+
+private:
+ MyEnum1Class::EnumA valueA;
+ EnumB valueB;
+ Qt::TextFormat valueC;
+ Qt::TextElideMode valueD;
+ EnumE valueE;
+ EnumE valueE2;
+};
+
+class MyEnumDerivedClass : public MyEnum2Class
+{
+ Q_OBJECT
+};
+
+Q_DECLARE_METATYPE(MyEnum2Class::EnumB)
+Q_DECLARE_METATYPE(MyEnum1Class::EnumA)
+Q_DECLARE_METATYPE(Qt::TextFormat)
+
+QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered)
+QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered)
+QML_DECLARE_TYPE(MyRevisionedClass)
+QML_DECLARE_TYPE(MyRevisionedSubclass)
+QML_DECLARE_TYPE(MySubclass)
+QML_DECLARE_TYPE(MyReceiversTestObject)
+
+void registerTypes();
+
+#endif // TESTTYPES_H
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
new file mode 100644
index 0000000000..5a924a901a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -0,0 +1,3178 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlincubator.h>
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+#include <QSignalSpy>
+
+#include <private/qqmlproperty_p.h>
+#include <private/qqmlmetatype_p.h>
+#include <private/qqmlglobal_p.h>
+#include <private/qqmlscriptstring_p.h>
+
+#include "testtypes.h"
+#include "testhttpserver.h"
+
+#include "../../shared/util.h"
+
+DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES)
+
+/*
+This test case covers QML language issues. This covers everything that does not
+involve evaluating ECMAScript expressions and bindings.
+
+Evaluation of expressions and bindings is covered in qmlecmascript
+*/
+class tst_qqmllanguage : public QQmlDataTest
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void errors_data();
+ void errors();
+
+ void insertedSemicolon_data();
+ void insertedSemicolon();
+
+ void simpleObject();
+ void simpleContainer();
+ void interfaceProperty();
+ void interfaceQList();
+ void assignObjectToSignal();
+ void assignObjectToVariant();
+ void assignLiteralSignalProperty();
+ void assignQmlComponent();
+ void assignBasicTypes();
+ void assignTypeExtremes();
+ void assignCompositeToType();
+ void assignLiteralToVariant();
+ void assignLiteralToVar();
+ void assignLiteralToJSValue();
+ void bindJSValueToVar();
+ void bindJSValueToVariant();
+ void bindJSValueToType();
+ void bindTypeToJSValue();
+ void customParserTypes();
+ void rootAsQmlComponent();
+ void inlineQmlComponents();
+ void idProperty();
+ void autoNotifyConnection();
+ void assignSignal();
+ void overrideSignal_data();
+ void overrideSignal();
+ void dynamicProperties();
+ void dynamicPropertiesNested();
+ void listProperties();
+ void dynamicObjectProperties();
+ void dynamicSignalsAndSlots();
+ void simpleBindings();
+ void autoComponentCreation();
+ void propertyValueSource();
+ void attachedProperties();
+ void dynamicObjects();
+ void customVariantTypes();
+ void valueTypes();
+ void cppnamespace();
+ void aliasProperties();
+ void aliasPropertiesAndSignals();
+ void aliasPropertyChangeSignals();
+ void componentCompositeType();
+ void i18n();
+ void i18n_data();
+ void onCompleted();
+ void onDestruction();
+ void scriptString();
+ void defaultPropertyListOrder();
+ void declaredPropertyValues();
+ void dontDoubleCallClassBegin();
+ void reservedWords_data();
+ void reservedWords();
+ void inlineAssignmentsOverrideBindings();
+ void nestedComponentRoots();
+ void registrationOrder();
+ void readonly();
+ void receivers();
+ void registeredCompositeType();
+ void implicitImportsLast();
+
+ void basicRemote_data();
+ void basicRemote();
+ void importsBuiltin_data();
+ void importsBuiltin();
+ void importsLocal_data();
+ void importsLocal();
+ void importsRemote_data();
+ void importsRemote();
+ void importsInstalled_data();
+ void importsInstalled();
+ void importsInstalledRemote_data();
+ void importsInstalledRemote();
+ void importsPath_data();
+ void importsPath();
+ void importsOrder_data();
+ void importsOrder();
+ void importIncorrectCase();
+ void importJs_data();
+ void importJs();
+
+ void qmlAttachedPropertiesObjectMethod();
+ void customOnProperty();
+ void variantNotify();
+
+ void revisions();
+ void revisionOverloads();
+
+ void subclassedUncreateableRevision_data();
+ void subclassedUncreateableRevision();
+
+ void propertyInit();
+ void remoteLoadCrash();
+ void signalWithDefaultArg();
+ void signalParameterTypes();
+
+ // regression tests for crashes
+ void crash1();
+ void crash2();
+
+ void globalEnums();
+ void literals_data();
+ void literals();
+
+ void objectDeletionNotify_data();
+ void objectDeletionNotify();
+
+ void scopedProperties();
+
+private:
+ QQmlEngine engine;
+ QStringList defaultImportPathList;
+
+ void testType(const QString& qml, const QString& type, const QString& error, bool partialMatch = false);
+};
+
+#define DETERMINE_ERRORS(errorfile,expected,actual)\
+ QList<QByteArray> expected; \
+ QList<QByteArray> actual; \
+ do { \
+ QFile file(testFile(errorfile)); \
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
+ QByteArray data = file.readAll(); \
+ file.close(); \
+ expected = data.split('\n'); \
+ expected.removeAll(QByteArray("")); \
+ QList<QQmlError> errors = component.errors(); \
+ for (int ii = 0; ii < errors.count(); ++ii) { \
+ const QQmlError &error = errors.at(ii); \
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" + \
+ QByteArray::number(error.column()) + ":" + \
+ error.description().toUtf8(); \
+ actual << errorStr; \
+ } \
+ } while (false);
+
+#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 { \
+ DETERMINE_ERRORS(errorfile,actual,expected);\
+ if (qgetenv("DEBUG") != "" && expected != actual) \
+ qWarning() << "Expected:" << expected << "Actual:" << actual; \
+ if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\
+ QFile file(testFile(errorfile)); \
+ QVERIFY(file.open(QIODevice::WriteOnly)); \
+ for (int ii = 0; ii < actual.count(); ++ii) { \
+ file.write(actual.at(ii)); file.write("\n"); \
+ } \
+ file.close(); \
+ } else { \
+ QCOMPARE(expected, actual); \
+ } \
+ }
+
+void tst_qqmllanguage::cleanupTestCase()
+{
+ QVERIFY(QFile::remove(testFile(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml"))));
+}
+
+void tst_qqmllanguage::insertedSemicolon_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+ QTest::addColumn<bool>("create");
+
+ QTest::newRow("insertedSemicolon.1") << "insertedSemicolon.1.qml" << "insertedSemicolon.1.errors.txt" << false;
+}
+
+void tst_qqmllanguage::insertedSemicolon()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+ QFETCH(bool, create);
+
+ QQmlComponent component(&engine, testFileUrl(file));
+
+ if(create) {
+ QObject *object = component.create();
+ QVERIFY(object == 0);
+ }
+
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+}
+
+void tst_qqmllanguage::errors_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+ QTest::addColumn<bool>("create");
+
+ QTest::newRow("nonexistantProperty.1") << "nonexistantProperty.1.qml" << "nonexistantProperty.1.errors.txt" << false;
+ QTest::newRow("nonexistantProperty.2") << "nonexistantProperty.2.qml" << "nonexistantProperty.2.errors.txt" << false;
+ QTest::newRow("nonexistantProperty.3") << "nonexistantProperty.3.qml" << "nonexistantProperty.3.errors.txt" << false;
+ QTest::newRow("nonexistantProperty.4") << "nonexistantProperty.4.qml" << "nonexistantProperty.4.errors.txt" << false;
+ QTest::newRow("nonexistantProperty.5") << "nonexistantProperty.5.qml" << "nonexistantProperty.5.errors.txt" << false;
+ QTest::newRow("nonexistantProperty.6") << "nonexistantProperty.6.qml" << "nonexistantProperty.6.errors.txt" << false;
+
+ QTest::newRow("wrongType (string for int)") << "wrongType.1.qml" << "wrongType.1.errors.txt" << false;
+ QTest::newRow("wrongType (int for bool)") << "wrongType.2.qml" << "wrongType.2.errors.txt" << false;
+ QTest::newRow("wrongType (bad rect)") << "wrongType.3.qml" << "wrongType.3.errors.txt" << false;
+
+ QTest::newRow("wrongType (invalid enum)") << "wrongType.4.qml" << "wrongType.4.errors.txt" << false;
+ QTest::newRow("wrongType (int for uint)") << "wrongType.5.qml" << "wrongType.5.errors.txt" << false;
+ QTest::newRow("wrongType (string for real)") << "wrongType.6.qml" << "wrongType.6.errors.txt" << false;
+ QTest::newRow("wrongType (int for color)") << "wrongType.7.qml" << "wrongType.7.errors.txt" << false;
+ QTest::newRow("wrongType (int for date)") << "wrongType.8.qml" << "wrongType.8.errors.txt" << false;
+ QTest::newRow("wrongType (int for time)") << "wrongType.9.qml" << "wrongType.9.errors.txt" << false;
+ QTest::newRow("wrongType (int for datetime)") << "wrongType.10.qml" << "wrongType.10.errors.txt" << false;
+ QTest::newRow("wrongType (string for point)") << "wrongType.11.qml" << "wrongType.11.errors.txt" << false;
+ QTest::newRow("wrongType (color for size)") << "wrongType.12.qml" << "wrongType.12.errors.txt" << false;
+ QTest::newRow("wrongType (number string for int)") << "wrongType.13.qml" << "wrongType.13.errors.txt" << false;
+ QTest::newRow("wrongType (int for string)") << "wrongType.14.qml" << "wrongType.14.errors.txt" << false;
+ QTest::newRow("wrongType (int for url)") << "wrongType.15.qml" << "wrongType.15.errors.txt" << false;
+ QTest::newRow("wrongType (invalid object)") << "wrongType.16.qml" << "wrongType.16.errors.txt" << false;
+ QTest::newRow("wrongType (int for enum)") << "wrongType.17.qml" << "wrongType.17.errors.txt" << false;
+
+ QTest::newRow("readOnly.1") << "readOnly.1.qml" << "readOnly.1.errors.txt" << false;
+ QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.errors.txt" << false;
+ QTest::newRow("readOnly.3") << "readOnly.3.qml" << "readOnly.3.errors.txt" << false;
+ QTest::newRow("readOnly.4") << "readOnly.4.qml" << "readOnly.4.errors.txt" << false;
+ QTest::newRow("readOnly.5") << "readOnly.5.qml" << "readOnly.5.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("invalidID.7") << "invalidID.7.qml" << "invalidID.7.errors.txt" << false;
+ QTest::newRow("invalidID.8") << "invalidID.8.qml" << "invalidID.8.errors.txt" << false;
+ QTest::newRow("invalidID.9") << "invalidID.9.qml" << "invalidID.9.errors.txt" << false;
+
+ QTest::newRow("scriptString.1") << "scriptString.1.qml" << "scriptString.1.errors.txt" << false;
+ QTest::newRow("scriptString.2") << "scriptString.2.qml" << "scriptString.2.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("missingSignal2") << "missingSignal.2.qml" << "missingSignal.2.errors.txt" << false;
+ QTest::newRow("finalOverride") << "finalOverride.qml" << "finalOverride.errors.txt" << false;
+ QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false;
+
+ QTest::newRow("invalidGroupedProperty.1") << "invalidGroupedProperty.1.qml" << "invalidGroupedProperty.1.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.2") << "invalidGroupedProperty.2.qml" << "invalidGroupedProperty.2.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.3") << "invalidGroupedProperty.3.qml" << "invalidGroupedProperty.3.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.4") << "invalidGroupedProperty.4.qml" << "invalidGroupedProperty.4.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.5") << "invalidGroupedProperty.5.qml" << "invalidGroupedProperty.5.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.6") << "invalidGroupedProperty.6.qml" << "invalidGroupedProperty.6.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.7") << "invalidGroupedProperty.7.qml" << "invalidGroupedProperty.7.errors.txt" << true;
+ QTest::newRow("invalidGroupedProperty.8") << "invalidGroupedProperty.8.qml" << "invalidGroupedProperty.8.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.9") << "invalidGroupedProperty.9.qml" << "invalidGroupedProperty.9.errors.txt" << false;
+ QTest::newRow("invalidGroupedProperty.10") << "invalidGroupedProperty.10.qml" << "invalidGroupedProperty.10.errors.txt" << false;
+
+ QTest::newRow("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false;
+ QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false;
+ QTest::newRow("importVersionMissing (installed)") << "importVersionMissingInstalled.qml" << "importVersionMissingInstalled.errors.txt" << false;
+ QTest::newRow("importNonExist (installed)") << "importNonExist.qml" << "importNonExist.errors.txt" << false;
+ QTest::newRow("importNonExistOlder (installed)") << "importNonExistOlder.qml" << "importNonExistOlder.errors.txt" << false;
+ QTest::newRow("importNewerVersion (installed)") << "importNewerVersion.qml" << "importNewerVersion.errors.txt" << false;
+ QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false;
+ QTest::newRow("importFile") << "importFile.qml" << "importFile.errors.txt" << false;
+
+ QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false;
+ QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false;
+ QTest::newRow("signal.3") << "signal.3.qml" << "signal.3.errors.txt" << false;
+ QTest::newRow("signal.4") << "signal.4.qml" << "signal.4.errors.txt" << false;
+ QTest::newRow("signal.5") << "signal.5.qml" << "signal.5.errors.txt" << false;
+ QTest::newRow("signal.6") << "signal.6.qml" << "signal.6.errors.txt" << false;
+
+ QTest::newRow("method.1") << "method.1.qml" << "method.1.errors.txt" << false;
+
+ QTest::newRow("property.1") << "property.1.qml" << "property.1.errors.txt" << false;
+ QTest::newRow("property.2") << "property.2.qml" << "property.2.errors.txt" << false;
+ QTest::newRow("property.3") << "property.3.qml" << "property.3.errors.txt" << false;
+ QTest::newRow("property.4") << "property.4.qml" << "property.4.errors.txt" << false;
+ QTest::newRow("property.6") << "property.6.qml" << "property.6.errors.txt" << false;
+ QTest::newRow("property.7") << "property.7.qml" << "property.7.errors.txt" << false;
+
+ QTest::newRow("importScript.1") << "importscript.1.qml" << "importscript.1.errors.txt" << false;
+
+ QTest::newRow("Component.1") << "component.1.qml" << "component.1.errors.txt" << false;
+ QTest::newRow("Component.2") << "component.2.qml" << "component.2.errors.txt" << false;
+ QTest::newRow("Component.3") << "component.3.qml" << "component.3.errors.txt" << false;
+ QTest::newRow("Component.4") << "component.4.qml" << "component.4.errors.txt" << false;
+ QTest::newRow("Component.5") << "component.5.qml" << "component.5.errors.txt" << false;
+ QTest::newRow("Component.6") << "component.6.qml" << "component.6.errors.txt" << false;
+ QTest::newRow("Component.7") << "component.7.qml" << "component.7.errors.txt" << false;
+ QTest::newRow("Component.8") << "component.8.qml" << "component.8.errors.txt" << false;
+ QTest::newRow("Component.9") << "component.9.qml" << "component.9.errors.txt" << false;
+
+ QTest::newRow("MultiSet.1") << "multiSet.1.qml" << "multiSet.1.errors.txt" << false;
+ QTest::newRow("MultiSet.2") << "multiSet.2.qml" << "multiSet.2.errors.txt" << false;
+ QTest::newRow("MultiSet.3") << "multiSet.3.qml" << "multiSet.3.errors.txt" << false;
+ QTest::newRow("MultiSet.4") << "multiSet.4.qml" << "multiSet.4.errors.txt" << false;
+ QTest::newRow("MultiSet.5") << "multiSet.5.qml" << "multiSet.5.errors.txt" << false;
+ QTest::newRow("MultiSet.6") << "multiSet.6.qml" << "multiSet.6.errors.txt" << false;
+ QTest::newRow("MultiSet.7") << "multiSet.7.qml" << "multiSet.7.errors.txt" << false;
+ QTest::newRow("MultiSet.8") << "multiSet.8.qml" << "multiSet.8.errors.txt" << false;
+ QTest::newRow("MultiSet.9") << "multiSet.9.qml" << "multiSet.9.errors.txt" << false;
+ QTest::newRow("MultiSet.10") << "multiSet.10.qml" << "multiSet.10.errors.txt" << false;
+ QTest::newRow("MultiSet.11") << "multiSet.11.qml" << "multiSet.11.errors.txt" << false;
+
+ QTest::newRow("dynamicMeta.1") << "dynamicMeta.1.qml" << "dynamicMeta.1.errors.txt" << false;
+ QTest::newRow("dynamicMeta.2") << "dynamicMeta.2.qml" << "dynamicMeta.2.errors.txt" << false;
+ QTest::newRow("dynamicMeta.3") << "dynamicMeta.3.qml" << "dynamicMeta.3.errors.txt" << false;
+ QTest::newRow("dynamicMeta.4") << "dynamicMeta.4.qml" << "dynamicMeta.4.errors.txt" << false;
+ QTest::newRow("dynamicMeta.5") << "dynamicMeta.5.qml" << "dynamicMeta.5.errors.txt" << false;
+
+ QTest::newRow("invalidAlias.1") << "invalidAlias.1.qml" << "invalidAlias.1.errors.txt" << false;
+ QTest::newRow("invalidAlias.2") << "invalidAlias.2.qml" << "invalidAlias.2.errors.txt" << false;
+ QTest::newRow("invalidAlias.3") << "invalidAlias.3.qml" << "invalidAlias.3.errors.txt" << false;
+ QTest::newRow("invalidAlias.4") << "invalidAlias.4.qml" << "invalidAlias.4.errors.txt" << false;
+ QTest::newRow("invalidAlias.5") << "invalidAlias.5.qml" << "invalidAlias.5.errors.txt" << false;
+ QTest::newRow("invalidAlias.6") << "invalidAlias.6.qml" << "invalidAlias.6.errors.txt" << false;
+ QTest::newRow("invalidAlias.7") << "invalidAlias.7.qml" << "invalidAlias.7.errors.txt" << false;
+ QTest::newRow("invalidAlias.8") << "invalidAlias.8.qml" << "invalidAlias.8.errors.txt" << false;
+ QTest::newRow("invalidAlias.9") << "invalidAlias.9.qml" << "invalidAlias.9.errors.txt" << false;
+ QTest::newRow("invalidAlias.10") << "invalidAlias.10.qml" << "invalidAlias.10.errors.txt" << false;
+
+ QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.3") << "invalidAttachedProperty.3.qml" << "invalidAttachedProperty.3.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.4") << "invalidAttachedProperty.4.qml" << "invalidAttachedProperty.4.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.5") << "invalidAttachedProperty.5.qml" << "invalidAttachedProperty.5.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.6") << "invalidAttachedProperty.6.qml" << "invalidAttachedProperty.6.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.7") << "invalidAttachedProperty.7.qml" << "invalidAttachedProperty.7.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.8") << "invalidAttachedProperty.8.qml" << "invalidAttachedProperty.8.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.9") << "invalidAttachedProperty.9.qml" << "invalidAttachedProperty.9.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.10") << "invalidAttachedProperty.10.qml" << "invalidAttachedProperty.10.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.11") << "invalidAttachedProperty.11.qml" << "invalidAttachedProperty.11.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.12") << "invalidAttachedProperty.12.qml" << "invalidAttachedProperty.12.errors.txt" << false;
+ QTest::newRow("invalidAttachedProperty.13") << "invalidAttachedProperty.13.qml" << "invalidAttachedProperty.13.errors.txt" << false;
+
+ QTest::newRow("assignValueToSignal") << "assignValueToSignal.qml" << "assignValueToSignal.errors.txt" << false;
+ QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false;
+
+ QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false;
+ QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false;
+ QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false;
+ QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false;
+ QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false;
+ QTest::newRow("enumTypes") << "enumTypes.qml" << "enumTypes.errors.txt" << false;
+ QTest::newRow("noCreation") << "noCreation.qml" << "noCreation.errors.txt" << false;
+ QTest::newRow("destroyedSignal") << "destroyedSignal.qml" << "destroyedSignal.errors.txt" << false;
+ QTest::newRow("assignToNamespace") << "assignToNamespace.qml" << "assignToNamespace.errors.txt" << false;
+ QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false;
+ QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false;
+ QTest::newRow("nonScriptableProperty") << "nonScriptableProperty.qml" << "nonScriptableProperty.errors.txt" << false;
+ QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false;
+ QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false;
+ QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false;
+ QTest::newRow("incorrectCase") << "incorrectCase.qml"
+#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
+ << "incorrectCase.errors.insensitive.txt"
+#else
+ << "incorrectCase.errors.sensitive.txt"
+#endif
+ << false;
+
+ QTest::newRow("metaobjectRevision.1") << "metaobjectRevision.1.qml" << "metaobjectRevision.1.errors.txt" << false;
+ QTest::newRow("metaobjectRevision.2") << "metaobjectRevision.2.qml" << "metaobjectRevision.2.errors.txt" << false;
+ QTest::newRow("metaobjectRevision.3") << "metaobjectRevision.3.qml" << "metaobjectRevision.3.errors.txt" << false;
+
+ QTest::newRow("invalidRoot.1") << "invalidRoot.1.qml" << "invalidRoot.1.errors.txt" << false;
+ QTest::newRow("invalidRoot.2") << "invalidRoot.2.qml" << "invalidRoot.2.errors.txt" << false;
+ QTest::newRow("invalidRoot.3") << "invalidRoot.3.qml" << "invalidRoot.3.errors.txt" << false;
+ QTest::newRow("invalidRoot.4") << "invalidRoot.4.qml" << "invalidRoot.4.errors.txt" << false;
+
+ QTest::newRow("invalidTypeName.1") << "invalidTypeName.1.qml" << "invalidTypeName.1.errors.txt" << false;
+ QTest::newRow("invalidTypeName.2") << "invalidTypeName.2.qml" << "invalidTypeName.2.errors.txt" << false;
+ QTest::newRow("invalidTypeName.3") << "invalidTypeName.3.qml" << "invalidTypeName.3.errors.txt" << false;
+ QTest::newRow("invalidTypeName.4") << "invalidTypeName.4.qml" << "invalidTypeName.4.errors.txt" << false;
+
+ QTest::newRow("Major version isolation") << "majorVersionIsolation.qml" << "majorVersionIsolation.errors.txt" << false;
+
+ QTest::newRow("badCompositeRegistration.1") << "badCompositeRegistration.1.qml" << "badCompositeRegistration.1.errors.txt" << false;
+ QTest::newRow("badCompositeRegistration.2") << "badCompositeRegistration.2.qml" << "badCompositeRegistration.2.errors.txt" << false;
+}
+
+
+void tst_qqmllanguage::errors()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+ QFETCH(bool, create);
+
+ QQmlComponent component(&engine, testFileUrl(file));
+
+ if(create) {
+ QObject *object = component.create();
+ QVERIFY(object == 0);
+ }
+
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+}
+
+void tst_qqmllanguage::simpleObject()
+{
+ QQmlComponent component(&engine, testFileUrl("simpleObject.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qqmllanguage::simpleContainer()
+{
+ QQmlComponent component(&engine, testFileUrl("simpleContainer.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QCOMPARE(container->getChildren()->count(),2);
+}
+
+void tst_qqmllanguage::interfaceProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("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_qqmllanguage::interfaceQList()
+{
+ QQmlComponent component(&engine, testFileUrl("interfaceQList.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->getQListInterfaces()->count() == 2);
+ for(int ii = 0; ii < 2; ++ii)
+ QVERIFY(container->getQListInterfaces()->at(ii)->id == 913);
+}
+
+void tst_qqmllanguage::assignObjectToSignal()
+{
+ QQmlComponent component(&engine, testFileUrl("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_qqmllanguage::assignObjectToVariant()
+{
+ QQmlComponent component(&engine, testFileUrl("assignObjectToVariant.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVariant v = object->property("a");
+ QVERIFY(v.userType() == qMetaTypeId<QObject *>());
+}
+
+void tst_qqmllanguage::assignLiteralSignalProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("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_qqmllanguage::assignQmlComponent()
+{
+ QQmlComponent component(&engine, testFileUrl("assignQmlComponent.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->getChildren()->count() == 1);
+ QObject *child = object->getChildren()->at(0);
+ QCOMPARE(child->property("x"), QVariant(10));
+ QCOMPARE(child->property("y"), QVariant(11));
+}
+
+// Test literal assignment to all the basic types
+void tst_qqmllanguage::assignBasicTypes()
+{
+ QQmlComponent component(&engine, testFileUrl("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->qtEnumProperty(), Qt::RichText);
+ QCOMPARE(object->mirroredEnumProperty(), MyTypeObject::MirroredEnumVal3);
+ QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue);
+ QCOMPARE(object->stringProperty(), QString("Hello World!"));
+ QCOMPARE(object->uintProperty(), uint(10));
+ QCOMPARE(object->intProperty(), -19);
+ QCOMPARE((float)object->realProperty(), float(23.2));
+ QCOMPARE((float)object->doubleProperty(), float(-19.7));
+ QCOMPARE((float)object->floatProperty(), float(8.5));
+ QCOMPARE(object->colorProperty(), QColor("red"));
+ QCOMPARE(object->dateProperty(), QDate(1982, 11, 25));
+ QCOMPARE(object->timeProperty(), QTime(11, 11, 32));
+ QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1)));
+ QCOMPARE(object->pointProperty(), QPoint(99,13));
+ QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3));
+ QCOMPARE(object->sizeProperty(), QSize(99, 13));
+ QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2));
+ QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200));
+ QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99));
+ QCOMPARE(object->boolProperty(), true);
+ QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
+ QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f));
+ QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2f, 2.3f));
+ QUrl encoded;
+ encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode);
+ QCOMPARE(object->urlProperty(), component.url().resolved(encoded));
+ QVERIFY(object->objectProperty() != 0);
+ MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty());
+ QVERIFY(child != 0);
+ QCOMPARE(child->intProperty(), 8);
+
+ //these used to go via script. Ensure they no longer do
+ QCOMPARE(object->property("qtEnumTriggeredChange").toBool(), false);
+ QCOMPARE(object->property("mirroredEnumTriggeredChange").toBool(), false);
+}
+
+// Test edge case type assignments
+void tst_qqmllanguage::assignTypeExtremes()
+{
+ QQmlComponent component(&engine, testFileUrl("assignTypeExtremes.qml"));
+ VERIFY_ERRORS(0);
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->uintProperty(), 0xEE6B2800);
+ QCOMPARE(object->intProperty(), -0x77359400);
+}
+
+// Test that a composite type can assign to a property of its base type
+void tst_qqmllanguage::assignCompositeToType()
+{
+ QQmlComponent component(&engine, testFileUrl("assignCompositeToType.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+// Test that literals are stored correctly in variant properties
+void tst_qqmllanguage::assignLiteralToVariant()
+{
+ QQmlComponent component(&engine, testFileUrl("assignLiteralToVariant.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").userType(), (int)QVariant::Int);
+ QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double);
+ QCOMPARE(object->property("test3").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test4").userType(), (int)QVariant::Color);
+ QCOMPARE(object->property("test5").userType(), (int)QVariant::RectF);
+ QCOMPARE(object->property("test6").userType(), (int)QVariant::PointF);
+ QCOMPARE(object->property("test7").userType(), (int)QVariant::SizeF);
+ QCOMPARE(object->property("test8").userType(), (int)QVariant::Vector3D);
+ QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test12").userType(), (int)QVariant::Vector4D);
+
+ QVERIFY(object->property("test1") == QVariant(1));
+ QVERIFY(object->property("test2") == QVariant((double)1.7));
+ QVERIFY(object->property("test3") == QVariant(QString(QLatin1String("Hello world!"))));
+ QVERIFY(object->property("test4") == QVariant(QColor::fromRgb(0xFF008800)));
+ QVERIFY(object->property("test5") == QVariant(QRectF(10, 10, 10, 10)));
+ QVERIFY(object->property("test6") == QVariant(QPointF(10, 10)));
+ QVERIFY(object->property("test7") == QVariant(QSizeF(10, 10)));
+ QVERIFY(object->property("test8") == QVariant(QVector3D(100, 100, 100)));
+ QVERIFY(object->property("test9") == QVariant(QString(QLatin1String("#FF008800"))));
+ QVERIFY(object->property("test10") == QVariant(bool(true)));
+ QVERIFY(object->property("test11") == QVariant(bool(false)));
+ QVERIFY(object->property("test12") == QVariant(QVector4D(100, 100, 100, 100)));
+
+ delete object;
+}
+
+// Test that literals are stored correctly in "var" properties
+// Note that behaviour differs from "variant" properties in that
+// no conversion from "special strings" to QVariants is performed.
+void tst_qqmllanguage::assignLiteralToVar()
+{
+ QQmlComponent component(&engine, testFileUrl("assignLiteralToVar.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").userType(), (int)QMetaType::Int);
+ QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double);
+ QCOMPARE(object->property("test3").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test4").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test5").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test6").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test7").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test8").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test12").userType(), (int)QVariant::Color);
+ QCOMPARE(object->property("test13").userType(), (int)QVariant::RectF);
+ QCOMPARE(object->property("test14").userType(), (int)QVariant::PointF);
+ QCOMPARE(object->property("test15").userType(), (int)QVariant::SizeF);
+ QCOMPARE(object->property("test16").userType(), (int)QVariant::Vector3D);
+ QCOMPARE(object->property("variantTest1Bound").userType(), (int)QMetaType::Int);
+ QCOMPARE(object->property("test1Bound").userType(), (int)QMetaType::Int);
+
+ QCOMPARE(object->property("test1"), QVariant(5));
+ QCOMPARE(object->property("test2"), QVariant((double)1.7));
+ QCOMPARE(object->property("test3"), QVariant(QString(QLatin1String("Hello world!"))));
+ QCOMPARE(object->property("test4"), QVariant(QString(QLatin1String("#FF008800"))));
+ QCOMPARE(object->property("test5"), QVariant(QString(QLatin1String("10,10,10x10"))));
+ QCOMPARE(object->property("test6"), QVariant(QString(QLatin1String("10,10"))));
+ QCOMPARE(object->property("test7"), QVariant(QString(QLatin1String("10x10"))));
+ QCOMPARE(object->property("test8"), QVariant(QString(QLatin1String("100,100,100"))));
+ QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800"))));
+ QCOMPARE(object->property("test10"), QVariant(bool(true)));
+ QCOMPARE(object->property("test11"), QVariant(bool(false)));
+ QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2, 0.3, 0.4, 0.5)));
+ QCOMPARE(object->property("test13"), QVariant(QRectF(10, 10, 10, 10)));
+ QCOMPARE(object->property("test14"), QVariant(QPointF(10, 10)));
+ QCOMPARE(object->property("test15"), QVariant(QSizeF(10, 10)));
+ QCOMPARE(object->property("test16"), QVariant(QVector3D(100, 100, 100)));
+ QCOMPARE(object->property("variantTest1Bound"), QVariant(9));
+ QCOMPARE(object->property("test1Bound"), QVariant(11));
+
+ delete object;
+}
+
+void tst_qqmllanguage::assignLiteralToJSValue()
+{
+ QQmlComponent component(&engine, testFileUrl("assignLiteralToJSValue.qml"));
+ VERIFY_ERRORS(0);
+ QObject *root = component.create();
+ QVERIFY(root != 0);
+
+ {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test1");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(5));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test2");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(1.7));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test3");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("Hello world!")));
+ }{
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test4");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("#FF008800")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test5");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("10,10,10x10")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test6");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("10,10")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test7");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("10x10")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test8");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("100,100,100")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test9");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("#FF008800")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test10");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isBool());
+ QCOMPARE(value.toBool(), true);
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test11");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isBool());
+ QCOMPARE(value.toBool(), false);
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test20");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isCallable());
+ QCOMPARE(value.call(QList<QJSValue> () << QJSValue(4)).toInt(), 12);
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test21");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isUndefined());
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test22");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNull());
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test1Bound");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(9));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("test20Bound");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(27));
+ }
+}
+
+void tst_qqmllanguage::bindJSValueToVar()
+{
+ QQmlComponent component(&engine, testFileUrl("assignLiteralToJSValue.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *root = component.create();
+ QVERIFY(root != 0);
+
+ QObject *object = root->findChild<QObject *>("varProperties");
+
+ QCOMPARE(object->property("test1").userType(), (int)QMetaType::Int);
+ QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double);
+ QCOMPARE(object->property("test3").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test4").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test5").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test6").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test7").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test8").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test12").userType(), (int)QVariant::Color);
+ QCOMPARE(object->property("test13").userType(), (int)QVariant::RectF);
+ QCOMPARE(object->property("test14").userType(), (int)QVariant::PointF);
+ QCOMPARE(object->property("test15").userType(), (int)QVariant::SizeF);
+ QCOMPARE(object->property("test16").userType(), (int)QVariant::Vector3D);
+ QCOMPARE(object->property("test1Bound").userType(), (int)QVariant::Int);
+ QCOMPARE(object->property("test20Bound").userType(), (int)QVariant::Int);
+
+ QCOMPARE(object->property("test1"), QVariant(5));
+ QCOMPARE(object->property("test2"), QVariant((double)1.7));
+ QCOMPARE(object->property("test3"), QVariant(QString(QLatin1String("Hello world!"))));
+ QCOMPARE(object->property("test4"), QVariant(QString(QLatin1String("#FF008800"))));
+ QCOMPARE(object->property("test5"), QVariant(QString(QLatin1String("10,10,10x10"))));
+ QCOMPARE(object->property("test6"), QVariant(QString(QLatin1String("10,10"))));
+ QCOMPARE(object->property("test7"), QVariant(QString(QLatin1String("10x10"))));
+ QCOMPARE(object->property("test8"), QVariant(QString(QLatin1String("100,100,100"))));
+ QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800"))));
+ QCOMPARE(object->property("test10"), QVariant(bool(true)));
+ QCOMPARE(object->property("test11"), QVariant(bool(false)));
+ QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2, 0.3, 0.4, 0.5)));
+ QCOMPARE(object->property("test13"), QVariant(QRectF(10, 10, 10, 10)));
+ QCOMPARE(object->property("test14"), QVariant(QPointF(10, 10)));
+ QCOMPARE(object->property("test15"), QVariant(QSizeF(10, 10)));
+ QCOMPARE(object->property("test16"), QVariant(QVector3D(100, 100, 100)));
+ QCOMPARE(object->property("test1Bound"), QVariant(9));
+ QCOMPARE(object->property("test20Bound"), QVariant(27));
+}
+
+void tst_qqmllanguage::bindJSValueToVariant()
+{
+ QQmlComponent component(&engine, testFileUrl("assignLiteralToJSValue.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *root = component.create();
+ QVERIFY(root != 0);
+
+ QObject *object = root->findChild<QObject *>("variantProperties");
+
+ QCOMPARE(object->property("test1").userType(), (int)QMetaType::Int);
+ QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double);
+ QCOMPARE(object->property("test3").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test4").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test5").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test6").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test7").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test8").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("test12").userType(), (int)QVariant::Color);
+ QCOMPARE(object->property("test13").userType(), (int)QVariant::RectF);
+ QCOMPARE(object->property("test14").userType(), (int)QVariant::PointF);
+ QCOMPARE(object->property("test15").userType(), (int)QVariant::SizeF);
+ QCOMPARE(object->property("test16").userType(), (int)QVariant::Vector3D);
+ QCOMPARE(object->property("test1Bound").userType(), (int)QVariant::Int);
+ QCOMPARE(object->property("test20Bound").userType(), (int)QVariant::Int);
+
+ QCOMPARE(object->property("test1"), QVariant(5));
+ QCOMPARE(object->property("test2"), QVariant((double)1.7));
+ QCOMPARE(object->property("test3"), QVariant(QString(QLatin1String("Hello world!"))));
+ QCOMPARE(object->property("test4"), QVariant(QString(QLatin1String("#FF008800"))));
+ QCOMPARE(object->property("test5"), QVariant(QString(QLatin1String("10,10,10x10"))));
+ QCOMPARE(object->property("test6"), QVariant(QString(QLatin1String("10,10"))));
+ QCOMPARE(object->property("test7"), QVariant(QString(QLatin1String("10x10"))));
+ QCOMPARE(object->property("test8"), QVariant(QString(QLatin1String("100,100,100"))));
+ QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800"))));
+ QCOMPARE(object->property("test10"), QVariant(bool(true)));
+ QCOMPARE(object->property("test11"), QVariant(bool(false)));
+ QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2, 0.3, 0.4, 0.5)));
+ QCOMPARE(object->property("test13"), QVariant(QRectF(10, 10, 10, 10)));
+ QCOMPARE(object->property("test14"), QVariant(QPointF(10, 10)));
+ QCOMPARE(object->property("test15"), QVariant(QSizeF(10, 10)));
+ QCOMPARE(object->property("test16"), QVariant(QVector3D(100, 100, 100)));
+ QCOMPARE(object->property("test1Bound"), QVariant(9));
+ QCOMPARE(object->property("test20Bound"), QVariant(27));
+}
+
+void tst_qqmllanguage::bindJSValueToType()
+{
+ QQmlComponent component(&engine, testFileUrl("assignLiteralToJSValue.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *root = component.create();
+ QVERIFY(root != 0);
+
+ {
+ MyTypeObject *object = root->findChild<MyTypeObject *>("typedProperties");
+
+ QCOMPARE(object->intProperty(), 5);
+ QCOMPARE(object->doubleProperty(), double(1.7));
+ QCOMPARE(object->stringProperty(), QString(QLatin1String("Hello world!")));
+ QCOMPARE(object->boolProperty(), true);
+ QCOMPARE(object->colorProperty(), QColor::fromRgbF(0.2, 0.3, 0.4, 0.5));
+ QCOMPARE(object->rectFProperty(), QRectF(10, 10, 10, 10));
+ QCOMPARE(object->pointFProperty(), QPointF(10, 10));
+ QCOMPARE(object->sizeFProperty(), QSizeF(10, 10));
+ QCOMPARE(object->vectorProperty(), QVector3D(100, 100, 100));
+ } {
+ MyTypeObject *object = root->findChild<MyTypeObject *>("stringProperties");
+
+ QCOMPARE(object->intProperty(), 1);
+ QCOMPARE(object->doubleProperty(), double(1.7));
+ QCOMPARE(object->stringProperty(), QString(QLatin1String("Hello world!")));
+ QCOMPARE(object->boolProperty(), true);
+ QCOMPARE(object->colorProperty(), QColor::fromRgb(0x00, 0x88, 0x00, 0xFF));
+ QCOMPARE(object->rectFProperty(), QRectF(10, 10, 10, 10));
+ QCOMPARE(object->pointFProperty(), QPointF(10, 10));
+ QCOMPARE(object->sizeFProperty(), QSizeF(10, 10));
+ QCOMPARE(object->vectorProperty(), QVector3D(100, 100, 100));
+ }
+}
+
+void tst_qqmllanguage::bindTypeToJSValue()
+{
+ QQmlComponent component(&engine, testFileUrl("bindTypeToJSValue.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *root = component.create();
+ QVERIFY(root != 0);
+
+ {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("flagProperty");
+ QVERIFY(object);
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("enumProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(MyTypeObject::EnumVal2));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("stringProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("Hello World!")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("uintProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(10));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("intProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(-19));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("realProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(23.2));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("doubleProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(-19.7));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("floatProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toNumber(), qreal(8.5));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("colorProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isObject());
+ QCOMPARE(value.property(QLatin1String("r")).toNumber(), qreal(1.0));
+ QCOMPARE(value.property(QLatin1String("g")).toNumber(), qreal(0.0));
+ QCOMPARE(value.property(QLatin1String("b")).toNumber(), qreal(0.0));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("dateProperty");
+ QJSValue value = object->qjsvalue();
+ QCOMPARE(value.toDateTime().isValid(), true);
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("timeProperty");
+ QJSValue value = object->qjsvalue();
+ QCOMPARE(value.toDateTime().isValid(), true);
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("dateTimeProperty");
+ QJSValue value = object->qjsvalue();
+ QCOMPARE(value.toDateTime().isValid(), true);
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("pointProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isObject());
+ QCOMPARE(value.property(QLatin1String("x")).toNumber(), qreal(99));
+ QCOMPARE(value.property(QLatin1String("y")).toNumber(), qreal(13));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("pointFProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isObject());
+ QCOMPARE(value.property(QLatin1String("x")).toNumber(), qreal(-10.1));
+ QCOMPARE(value.property(QLatin1String("y")).toNumber(), qreal(12.3));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("rectProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isObject());
+ QCOMPARE(value.property(QLatin1String("x")).toNumber(), qreal(9));
+ QCOMPARE(value.property(QLatin1String("y")).toNumber(), qreal(7));
+ QCOMPARE(value.property(QLatin1String("width")).toNumber(), qreal(100));
+ QCOMPARE(value.property(QLatin1String("height")).toNumber(), qreal(200));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("rectFProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isObject());
+ QCOMPARE(value.property(QLatin1String("x")).toNumber(), qreal(1000.1));
+ QCOMPARE(value.property(QLatin1String("y")).toNumber(), qreal(-10.9));
+ QCOMPARE(value.property(QLatin1String("width")).toNumber(), qreal(400));
+ QCOMPARE(value.property(QLatin1String("height")).toNumber(), qreal(90.99));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("boolProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isBool());
+ QCOMPARE(value.toBool(), true);
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("variantProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("Hello World!")));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("vectorProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isObject());
+ QCOMPARE(value.property(QLatin1String("x")).toNumber(), qreal(10.0f));
+ QCOMPARE(value.property(QLatin1String("y")).toNumber(), qreal(1.0f));
+ QCOMPARE(value.property(QLatin1String("z")).toNumber(), qreal(2.2f));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("vector4Property");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isObject());
+ QCOMPARE(value.property(QLatin1String("x")).toNumber(), qreal(10.0f));
+ QCOMPARE(value.property(QLatin1String("y")).toNumber(), qreal(1.0f));
+ QCOMPARE(value.property(QLatin1String("z")).toNumber(), qreal(2.2f));
+ QCOMPARE(value.property(QLatin1String("w")).toNumber(), qreal(2.3f));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("urlProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QUrl encoded;
+ encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode);
+ QCOMPARE(value.toString(), component.url().resolved(encoded).toString());
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("objectProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isQObject());
+ QVERIFY(qobject_cast<MyTypeObject *>(value.toQObject()));
+ } {
+ MyQmlObject *object = root->findChild<MyQmlObject *>("varProperty");
+ QJSValue value = object->qjsvalue();
+ QVERIFY(value.isString());
+ QCOMPARE(value.toString(), QString(QLatin1String("Hello World!")));
+ }
+}
+
+// Tests that custom parser types can be instantiated
+void tst_qqmllanguage::customParserTypes()
+{
+ QQmlComponent component(&engine, testFileUrl("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_qqmllanguage::rootAsQmlComponent()
+{
+ QQmlComponent component(&engine, testFileUrl("rootAsQmlComponent.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("x"), QVariant(11));
+ QCOMPARE(object->getChildren()->count(), 2);
+}
+
+// Tests that components can be specified inline
+void tst_qqmllanguage::inlineQmlComponents()
+{
+ QQmlComponent component(&engine, testFileUrl("inlineQmlComponents.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->getChildren()->count(), 1);
+ QQmlComponent *comp = qobject_cast<QQmlComponent *>(object->getChildren()->at(0));
+ QVERIFY(comp != 0);
+ MyQmlObject *compObject = qobject_cast<MyQmlObject *>(comp->create());
+ QVERIFY(compObject != 0);
+ QCOMPARE(compObject->value(), 11);
+}
+
+// Tests that types that have an id property have it set
+void tst_qqmllanguage::idProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("idProperty.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->getChildren()->count(), 1);
+ MyTypeObject *child =
+ qobject_cast<MyTypeObject *>(object->getChildren()->at(0));
+ QVERIFY(child != 0);
+ QCOMPARE(child->id(), QString("myObjectId"));
+ QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child));
+}
+
+// Tests automatic connection to notify signals if "onBlahChanged" syntax is used
+// even if the notify signal for "blah" is not called "blahChanged"
+void tst_qqmllanguage::autoNotifyConnection()
+{
+ QQmlComponent component(&engine, testFileUrl("autoNotifyConnection.qml"));
+ VERIFY_ERRORS(0);
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QMetaProperty prop = object->metaObject()->property(object->metaObject()->indexOfProperty("receivedNotify"));
+ QVERIFY(prop.isValid());
+
+ QCOMPARE(prop.read(object), QVariant::fromValue(false));
+ object->setPropertyWithNotify(1);
+ QCOMPARE(prop.read(object), QVariant::fromValue(true));
+}
+
+// Tests that signals can be assigned to
+void tst_qqmllanguage::assignSignal()
+{
+ QQmlComponent component(&engine, testFileUrl("assignSignal.qml"));
+ VERIFY_ERRORS(0);
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot");
+ emit object->basicSignal();
+ QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)");
+ emit object->basicParameterizedSignal(9);
+}
+
+
+void tst_qqmllanguage::overrideSignal_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+
+ QTest::newRow("override signal with signal") << "overrideSignal.1.qml" << "overrideSignal.1.errors.txt";
+ QTest::newRow("override signal with method") << "overrideSignal.2.qml" << "overrideSignal.2.errors.txt";
+ QTest::newRow("override signal with property") << "overrideSignal.3.qml" << "";
+ QTest::newRow("override signal of alias property with signal") << "overrideSignal.4.qml" << "overrideSignal.4.errors.txt";
+ QTest::newRow("override signal of superclass with signal") << "overrideSignal.5.qml" << "overrideSignal.5.errors.txt";
+ QTest::newRow("override builtin signal with signal") << "overrideSignal.6.qml" << "overrideSignal.6.errors.txt";
+}
+
+void tst_qqmllanguage::overrideSignal()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+
+ QQmlComponent component(&engine, testFileUrl(file));
+ if (errorFile.isEmpty()) {
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ } else {
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+ }
+}
+
+// Tests the creation and assignment of dynamic properties
+void tst_qqmllanguage::dynamicProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("dynamicProperties.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("intProperty"), QVariant(10));
+ QCOMPARE(object->property("boolProperty"), QVariant(false));
+ QCOMPARE(object->property("doubleProperty"), QVariant(-10.1));
+ QCOMPARE(object->property("realProperty"), QVariant((qreal)-19.9));
+ QCOMPARE(object->property("stringProperty"), QVariant("Hello World!"));
+ QCOMPARE(object->property("urlProperty"), QVariant(testFileUrl("main.qml")));
+ QCOMPARE(object->property("colorProperty"), QVariant(QColor("red")));
+ QCOMPARE(object->property("dateProperty"), QVariant(QDate(1945, 9, 2)));
+ QCOMPARE(object->property("varProperty"), QVariant("Hello World!"));
+}
+
+// Test that nested types can use dynamic properties
+void tst_qqmllanguage::dynamicPropertiesNested()
+{
+ QQmlComponent component(&engine, testFileUrl("dynamicPropertiesNested.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("super_a").toInt(), 11); // Overridden
+ QCOMPARE(object->property("super_c").toInt(), 14); // Inherited
+ QCOMPARE(object->property("a").toInt(), 13); // New
+ QCOMPARE(object->property("b").toInt(), 12); // New
+
+ delete object;
+}
+
+// Tests the creation and assignment to dynamic list properties
+void tst_qqmllanguage::listProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("listProperties.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 2);
+}
+
+// Tests the creation and assignment of dynamic object properties
+// ### Not complete
+void tst_qqmllanguage::dynamicObjectProperties()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("dynamicObjectProperties.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(object->property("objectProperty") == qVariantFromValue((QObject*)0));
+ QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0));
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("dynamicObjectProperties.2.qml"));
+ QEXPECT_FAIL("", "QTBUG-10822", Abort);
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)0));
+ }
+}
+
+// Tests the declaration of dynamic signals and slots
+void tst_qqmllanguage::dynamicSignalsAndSlots()
+{
+ QTest::ignoreMessage(QtDebugMsg, "1921");
+
+ QQmlComponent component(&engine, testFileUrl("dynamicSignalsAndSlots.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->metaObject()->indexOfMethod("signal1()") != -1);
+ QVERIFY(object->metaObject()->indexOfMethod("signal2()") != -1);
+ QVERIFY(object->metaObject()->indexOfMethod("slot1()") != -1);
+ QVERIFY(object->metaObject()->indexOfMethod("slot2()") != -1);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ QMetaObject::invokeMethod(object, "slot3", Qt::DirectConnection, Q_ARG(QVariant, QVariant(10)));
+ QCOMPARE(object->property("test").toInt(), 10);
+}
+
+void tst_qqmllanguage::simpleBindings()
+{
+ QQmlComponent component(&engine, testFileUrl("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_qqmllanguage::autoComponentCreation()
+{
+ QQmlComponent component(&engine, testFileUrl("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_qqmllanguage::propertyValueSource()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyValueSource.qml"));
+ VERIFY_ERRORS(0);
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QList<QObject *> valueSources;
+ QObjectList allChildren = object->findChildren<QObject*>();
+ foreach (QObject *child, allChildren) {
+ if (qobject_cast<QQmlPropertyValueSource *>(child))
+ valueSources.append(child);
+ }
+
+ QCOMPARE(valueSources.count(), 1);
+ MyPropertyValueSource *valueSource =
+ qobject_cast<MyPropertyValueSource *>(valueSources.at(0));
+ QVERIFY(valueSource != 0);
+ QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object));
+ QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty")));
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyValueSource.2.qml"));
+ VERIFY_ERRORS(0);
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QList<QObject *> valueSources;
+ QObjectList allChildren = object->findChildren<QObject*>();
+ foreach (QObject *child, allChildren) {
+ if (qobject_cast<QQmlPropertyValueSource *>(child))
+ valueSources.append(child);
+ }
+
+ QCOMPARE(valueSources.count(), 1);
+ MyPropertyValueSource *valueSource =
+ qobject_cast<MyPropertyValueSource *>(valueSources.at(0));
+ QVERIFY(valueSource != 0);
+ QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object));
+ QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty")));
+ }
+}
+
+void tst_qqmllanguage::attachedProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("attachedProperties.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QObject *attached = qmlAttachedPropertiesObject<MyQmlObject>(object);
+ QVERIFY(attached != 0);
+ QCOMPARE(attached->property("value"), QVariant(10));
+ QCOMPARE(attached->property("value2"), QVariant(13));
+}
+
+// Tests non-static object properties
+void tst_qqmllanguage::dynamicObjects()
+{
+ QQmlComponent component(&engine, testFileUrl("dynamicObject.1.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+// Tests the registration of custom variant string converters
+void tst_qqmllanguage::customVariantTypes()
+{
+ QQmlComponent component(&engine, testFileUrl("customVariantTypes.qml"));
+ VERIFY_ERRORS(0);
+ MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->customType().a, 10);
+}
+
+void tst_qqmllanguage::valueTypes()
+{
+ QQmlComponent component(&engine, testFileUrl("valueTypes.qml"));
+ VERIFY_ERRORS(0);
+
+ QString message = component.url().toString() + ":2:1: QML MyTypeObject: Binding loop detected for property \"rectProperty.width\"";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+
+
+ QCOMPARE(object->rectProperty(), QRect(10, 11, 12, 13));
+ QCOMPARE(object->rectProperty2(), QRect(10, 11, 12, 13));
+ QCOMPARE(object->intProperty(), 10);
+ object->doAction();
+ QCOMPARE(object->rectProperty(), QRect(12, 11, 14, 13));
+ QCOMPARE(object->rectProperty2(), QRect(12, 11, 14, 13));
+ QCOMPARE(object->intProperty(), 12);
+
+ // ###
+#if 0
+ QQmlProperty p(object, "rectProperty.x");
+ QCOMPARE(p.read(), QVariant(12));
+ p.write(13);
+ QCOMPARE(p.read(), QVariant(13));
+
+ quint32 r = QQmlPropertyPrivate::saveValueType(p.coreIndex(), p.valueTypeCoreIndex());
+ QQmlProperty p2;
+ QQmlPropertyPrivate::restore(p2, r, object);
+ QCOMPARE(p2.read(), QVariant(13));
+#endif
+}
+
+void tst_qqmllanguage::cppnamespace()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("cppnamespace.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("cppnamespace.2.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+ }
+}
+
+void tst_qqmllanguage::aliasProperties()
+{
+ // Simple "int" alias
+ {
+ QQmlComponent component(&engine, testFileUrl("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 through alias
+ object->setProperty("valueAlias", QVariant(19));
+ QCOMPARE(object->property("valueAlias").toInt(), 19);
+ QCOMPARE(object->property("value").toInt(), 19);
+
+ delete object;
+ }
+
+ // Complex object alias
+ {
+ QQmlComponent component(&engine, testFileUrl("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
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.3.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("value").toInt(), 1892);
+ QCOMPARE(object->property("value2").toInt(), 1892);
+
+ object->setProperty("value", QVariant(1313));
+ QCOMPARE(object->property("value").toInt(), 1313);
+ QCOMPARE(object->property("value2").toInt(), 1313);
+
+ object->setProperty("value2", QVariant(8080));
+ QCOMPARE(object->property("value").toInt(), 8080);
+ QCOMPARE(object->property("value2").toInt(), 8080);
+
+ delete object;
+ }
+
+ // Enum aliases
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.4.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("enumAlias").toInt(), 1);
+
+ delete object;
+ }
+
+ // Id aliases
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.5.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVariant v = object->property("otherAlias");
+ QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>());
+ MyQmlObject *o = qvariant_cast<MyQmlObject*>(v);
+ QCOMPARE(o->value(), 10);
+
+ delete o;
+
+ v = object->property("otherAlias");
+ QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>());
+ o = qvariant_cast<MyQmlObject*>(v);
+ QVERIFY(o == 0);
+
+ delete object;
+ }
+
+ // Nested aliases - this used to cause a crash
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.6.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("a").toInt(), 1923);
+ }
+
+ // Ptr Alias Cleanup - check that aliases to ptr types return 0
+ // if the object aliased to is removed
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.7.qml"));
+ VERIFY_ERRORS(0);
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *object1 = qvariant_cast<QObject *>(object->property("object"));
+ QVERIFY(object1 != 0);
+ QObject *object2 = qvariant_cast<QObject *>(object1->property("object"));
+ QVERIFY(object2 != 0);
+
+ QObject *alias = qvariant_cast<QObject *>(object->property("aliasedObject"));
+ QVERIFY(alias == object2);
+
+ delete object1;
+
+ QObject *alias2 = object; // "Random" start value
+ int status = -1;
+ void *a[] = { &alias2, 0, &status };
+ QMetaObject::metacall(object, QMetaObject::ReadProperty,
+ object->metaObject()->indexOfProperty("aliasedObject"), a);
+ QVERIFY(alias2 == 0);
+ }
+
+ // Simple composite type
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.8.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("value").toInt(), 10);
+
+ delete object;
+ }
+
+ // Complex composite type
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.9.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("value").toInt(), 10);
+
+ delete object;
+ }
+
+ // Valuetype alias
+ // Simple "int" alias
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.10.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ // Read through alias
+ QCOMPARE(object->property("valueAlias").toRect(), QRect(10, 11, 9, 8));
+ object->setProperty("rectProperty", QVariant(QRect(33, 12, 99, 100)));
+ QCOMPARE(object->property("valueAlias").toRect(), QRect(33, 12, 99, 100));
+
+ // Write through alias
+ object->setProperty("valueAlias", QVariant(QRect(3, 3, 4, 9)));
+ QCOMPARE(object->property("valueAlias").toRect(), QRect(3, 3, 4, 9));
+ QCOMPARE(object->property("rectProperty").toRect(), QRect(3, 3, 4, 9));
+
+ delete object;
+ }
+
+ // Valuetype sub-alias
+ {
+ QQmlComponent component(&engine, testFileUrl("alias.11.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ // Read through alias
+ QCOMPARE(object->property("aliasProperty").toInt(), 19);
+ object->setProperty("rectProperty", QVariant(QRect(33, 8, 102, 111)));
+ QCOMPARE(object->property("aliasProperty").toInt(), 33);
+
+ // Write through alias
+ object->setProperty("aliasProperty", QVariant(4));
+ QCOMPARE(object->property("aliasProperty").toInt(), 4);
+ QCOMPARE(object->property("rectProperty").toRect(), QRect(4, 8, 102, 111));
+
+ delete object;
+ }
+}
+
+// QTBUG-13374 Test that alias properties and signals can coexist
+void tst_qqmllanguage::aliasPropertiesAndSignals()
+{
+ QQmlComponent component(&engine, testFileUrl("aliasPropertiesAndSignals.qml"));
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
+// Test that the root element in a composite type can be a Component
+void tst_qqmllanguage::componentCompositeType()
+{
+ QQmlComponent component(&engine, testFileUrl("componentCompositeType.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+class TestType : public QObject {
+ Q_OBJECT
+public:
+ TestType(QObject *p=0) : QObject(p) {}
+};
+
+class TestType2 : public QObject {
+ Q_OBJECT
+public:
+ TestType2(QObject *p=0) : QObject(p) {}
+};
+
+void tst_qqmllanguage::i18n_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("stringProperty");
+ QTest::newRow("i18nStrings") << "i18nStrings.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245 (5 accented 'a' letters)");
+ QTest::newRow("i18nDeclaredPropertyNames") << "i18nDeclaredPropertyNames.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 10");
+ QTest::newRow("i18nDeclaredPropertyUse") << "i18nDeclaredPropertyUse.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 15");
+ QTest::newRow("i18nScript") << "i18nScript.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 20");
+ QTest::newRow("i18nType") << "i18nType.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 30");
+ QTest::newRow("i18nNameSpace") << "i18nNameSpace.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 40");
+}
+
+void tst_qqmllanguage::i18n()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, stringProperty);
+ QQmlComponent component(&engine, testFileUrl(file));
+ VERIFY_ERRORS(0);
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->stringProperty(), stringProperty);
+
+ delete object;
+}
+
+// Check that the Component::onCompleted attached property works
+void tst_qqmllanguage::onCompleted()
+{
+ QQmlComponent component(&engine, testFileUrl("onCompleted.qml"));
+ VERIFY_ERRORS(0);
+ QTest::ignoreMessage(QtDebugMsg, "Completed 6 10");
+ QTest::ignoreMessage(QtDebugMsg, "Completed 6 10");
+ QTest::ignoreMessage(QtDebugMsg, "Completed 10 11");
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+// Check that the Component::onDestruction attached property works
+void tst_qqmllanguage::onDestruction()
+{
+ QQmlComponent component(&engine, testFileUrl("onDestruction.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10");
+ QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10");
+ QTest::ignoreMessage(QtDebugMsg, "Destruction 10 11");
+ delete object;
+}
+
+// Check that assignments to QQmlScriptString properties work
+void tst_qqmllanguage::scriptString()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptString.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(!object->scriptProperty().isEmpty());
+ QCOMPARE(object->scriptProperty().stringLiteral(), QString());
+ bool ok;
+ QCOMPARE(object->scriptProperty().numberLiteral(&ok), qreal(0.));
+ QCOMPARE(ok, false);
+
+ const QQmlScriptStringPrivate *scriptPrivate = QQmlScriptStringPrivate::get(object->scriptProperty());
+ QVERIFY(scriptPrivate != 0);
+ QCOMPARE(scriptPrivate->script, QString("foo + bar"));
+ QCOMPARE(scriptPrivate->scope, qobject_cast<QObject*>(object));
+ QCOMPARE(scriptPrivate->context, qmlContext(object));
+
+ QVERIFY(object->grouped() != 0);
+ const QQmlScriptStringPrivate *groupedPrivate = QQmlScriptStringPrivate::get(object->grouped()->script());
+ QCOMPARE(groupedPrivate->script, QString("console.log(1921)"));
+ QCOMPARE(groupedPrivate->scope, qobject_cast<QObject*>(object));
+ QCOMPARE(groupedPrivate->context, qmlContext(object));
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptString2.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().stringLiteral(), QString("hello\\n\\\"world\\\""));
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptString3.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ bool ok;
+ QCOMPARE(object->scriptProperty().numberLiteral(&ok), qreal(12.345));
+ QCOMPARE(ok, true);
+
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptString4.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ bool ok;
+ QCOMPARE(object->scriptProperty().booleanLiteral(&ok), true);
+ QCOMPARE(ok, true);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptString5.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().isNullLiteral(), true);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("scriptString6.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().isUndefinedLiteral(), true);
+ }
+}
+
+// Check that default property assignments are correctly spliced into explicit
+// property assignments
+void tst_qqmllanguage::defaultPropertyListOrder()
+{
+ QQmlComponent component(&engine, testFileUrl("defaultPropertyListOrder.qml"));
+ VERIFY_ERRORS(0);
+
+ MyContainer *container = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(container != 0);
+
+ QCOMPARE(container->getChildren()->count(), 6);
+ QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0));
+ QCOMPARE(container->getChildren()->at(1)->property("index"), QVariant(1));
+ QCOMPARE(container->getChildren()->at(2)->property("index"), QVariant(2));
+ QCOMPARE(container->getChildren()->at(3)->property("index"), QVariant(3));
+ QCOMPARE(container->getChildren()->at(4)->property("index"), QVariant(4));
+ QCOMPARE(container->getChildren()->at(5)->property("index"), QVariant(5));
+}
+
+void tst_qqmllanguage::declaredPropertyValues()
+{
+ QQmlComponent component(&engine, testFileUrl("declaredPropertyValues.qml"));
+ VERIFY_ERRORS(0);
+}
+
+void tst_qqmllanguage::dontDoubleCallClassBegin()
+{
+ QQmlComponent component(&engine, testFileUrl("dontDoubleCallClassBegin.qml"));
+ QObject *o = component.create();
+ QVERIFY(o);
+
+ MyParserStatus *o2 = qobject_cast<MyParserStatus *>(qvariant_cast<QObject *>(o->property("object")));
+ QVERIFY(o2);
+ QCOMPARE(o2->classBeginCount(), 1);
+ QCOMPARE(o2->componentCompleteCount(), 1);
+
+ delete o;
+}
+
+void tst_qqmllanguage::reservedWords_data()
+{
+ QTest::addColumn<QByteArray>("word");
+
+ QTest::newRow("abstract") << QByteArray("abstract");
+ QTest::newRow("as") << QByteArray("as");
+ QTest::newRow("boolean") << QByteArray("boolean");
+ QTest::newRow("break") << QByteArray("break");
+ QTest::newRow("byte") << QByteArray("byte");
+ QTest::newRow("case") << QByteArray("case");
+ QTest::newRow("catch") << QByteArray("catch");
+ QTest::newRow("char") << QByteArray("char");
+ QTest::newRow("class") << QByteArray("class");
+ QTest::newRow("continue") << QByteArray("continue");
+ QTest::newRow("const") << QByteArray("const");
+ QTest::newRow("debugger") << QByteArray("debugger");
+ QTest::newRow("default") << QByteArray("default");
+ QTest::newRow("delete") << QByteArray("delete");
+ QTest::newRow("do") << QByteArray("do");
+ QTest::newRow("double") << QByteArray("double");
+ QTest::newRow("else") << QByteArray("else");
+ QTest::newRow("enum") << QByteArray("enum");
+ QTest::newRow("export") << QByteArray("export");
+ QTest::newRow("extends") << QByteArray("extends");
+ QTest::newRow("false") << QByteArray("false");
+ QTest::newRow("final") << QByteArray("final");
+ QTest::newRow("finally") << QByteArray("finally");
+ QTest::newRow("float") << QByteArray("float");
+ QTest::newRow("for") << QByteArray("for");
+ QTest::newRow("function") << QByteArray("function");
+ QTest::newRow("goto") << QByteArray("goto");
+ QTest::newRow("if") << QByteArray("if");
+ QTest::newRow("implements") << QByteArray("implements");
+ QTest::newRow("import") << QByteArray("import");
+ QTest::newRow("in") << QByteArray("in");
+ QTest::newRow("instanceof") << QByteArray("instanceof");
+ QTest::newRow("int") << QByteArray("int");
+ QTest::newRow("interface") << QByteArray("interface");
+ QTest::newRow("long") << QByteArray("long");
+ QTest::newRow("native") << QByteArray("native");
+ QTest::newRow("new") << QByteArray("new");
+ QTest::newRow("null") << QByteArray("null");
+ QTest::newRow("package") << QByteArray("package");
+ QTest::newRow("private") << QByteArray("private");
+ QTest::newRow("protected") << QByteArray("protected");
+ QTest::newRow("public") << QByteArray("public");
+ QTest::newRow("return") << QByteArray("return");
+ QTest::newRow("short") << QByteArray("short");
+ QTest::newRow("static") << QByteArray("static");
+ QTest::newRow("super") << QByteArray("super");
+ QTest::newRow("switch") << QByteArray("switch");
+ QTest::newRow("synchronized") << QByteArray("synchronized");
+ QTest::newRow("this") << QByteArray("this");
+ QTest::newRow("throw") << QByteArray("throw");
+ QTest::newRow("throws") << QByteArray("throws");
+ QTest::newRow("transient") << QByteArray("transient");
+ QTest::newRow("true") << QByteArray("true");
+ QTest::newRow("try") << QByteArray("try");
+ QTest::newRow("typeof") << QByteArray("typeof");
+ QTest::newRow("var") << QByteArray("var");
+ QTest::newRow("void") << QByteArray("void");
+ QTest::newRow("volatile") << QByteArray("volatile");
+ QTest::newRow("while") << QByteArray("while");
+ QTest::newRow("with") << QByteArray("with");
+}
+
+void tst_qqmllanguage::reservedWords()
+{
+ QFETCH(QByteArray, word);
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nQtObject { property string " + word + " }", QUrl());
+ QCOMPARE(component.errorString(), QLatin1String(":2 Expected token `identifier'\n"));
+}
+
+// Check that first child of qml is of given type. Empty type insists on error.
+void tst_qqmllanguage::testType(const QString& qml, const QString& type, const QString& expectederror, bool partialMatch)
+{
+ if (engine.importPathList() == defaultImportPathList)
+ engine.addImportPath(testFile("lib"));
+
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(), testFileUrl("empty.qml")); // just a file for relative local imports
+
+ QTRY_VERIFY(!component.isLoading());
+
+ if (type.isEmpty()) {
+ QVERIFY(component.isError());
+ QString actualerror;
+ foreach (const QQmlError e, component.errors()) {
+ if (!actualerror.isEmpty())
+ actualerror.append("; ");
+ actualerror.append(e.description());
+ }
+ QCOMPARE(actualerror.left(partialMatch ? expectederror.length(): -1),expectederror);
+ } else {
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(QString(object->metaObject()->className()), type);
+ delete object;
+ }
+
+ engine.setImportPathList(defaultImportPathList);
+}
+
+// QTBUG-17276
+void tst_qqmllanguage::inlineAssignmentsOverrideBindings()
+{
+ QQmlComponent component(&engine, testFileUrl("inlineAssignmentsOverrideBindings.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toInt(), 11);
+ delete o;
+}
+
+// QTBUG-19354
+void tst_qqmllanguage::nestedComponentRoots()
+{
+ QQmlComponent component(&engine, testFileUrl("nestedComponentRoots.qml"));
+}
+
+// Import tests (QT-558)
+void tst_qqmllanguage::importsBuiltin_data()
+{
+ // QT-610
+
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
+
+ // import built-ins
+ QTest::newRow("missing import")
+ << "Test {}"
+ << ""
+ << "Test is not a type";
+ QTest::newRow("not in version 0.0")
+ << "import org.qtproject.Test 0.0\n"
+ "Test {}"
+ << ""
+ << "Test is not a type";
+ QTest::newRow("version not installed")
+ << "import org.qtproject.Test 99.0\n"
+ "Test {}"
+ << ""
+ << "module \"org.qtproject.Test\" version 99.0 is not installed";
+ QTest::newRow("in version 0.0")
+ << "import org.qtproject.Test 0.0\n"
+ "TestTP {}"
+ << "TestType"
+ << "";
+ QTest::newRow("qualified in version 0.0")
+ << "import org.qtproject.Test 0.0 as T\n"
+ "T.TestTP {}"
+ << "TestType"
+ << "";
+ QTest::newRow("in version 1.0")
+ << "import org.qtproject.Test 1.0\n"
+ "Test {}"
+ << "TestType"
+ << "";
+ QTest::newRow("qualified wrong")
+ << "import org.qtproject.Test 1.0 as T\n" // QT-610
+ "Test {}"
+ << ""
+ << "Test is not a type";
+ QTest::newRow("qualified right")
+ << "import org.qtproject.Test 1.0 as T\n"
+ "T.Test {}"
+ << "TestType"
+ << "";
+ QTest::newRow("qualified right but not in version 0.0")
+ << "import org.qtproject.Test 0.0 as T\n"
+ "T.Test {}"
+ << ""
+ << "T.Test is not a type";
+ QTest::newRow("in version 1.1")
+ << "import org.qtproject.Test 1.1\n"
+ "Test {}"
+ << "TestType"
+ << "";
+ QTest::newRow("in version 1.3")
+ << "import org.qtproject.Test 1.3\n"
+ "Test {}"
+ << "TestType"
+ << "";
+ QTest::newRow("in version 1.5")
+ << "import org.qtproject.Test 1.5\n"
+ "Test {}"
+ << "TestType"
+ << "";
+ QTest::newRow("changed in version 1.8")
+ << "import org.qtproject.Test 1.8\n"
+ "Test {}"
+ << "TestType2"
+ << "";
+ QTest::newRow("in version 1.12")
+ << "import org.qtproject.Test 1.12\n"
+ "Test {}"
+ << "TestType2"
+ << "";
+ QTest::newRow("old in version 1.9")
+ << "import org.qtproject.Test 1.9\n"
+ "OldTest {}"
+ << "TestType"
+ << "";
+ QTest::newRow("old in version 1.11")
+ << "import org.qtproject.Test 1.11\n"
+ "OldTest {}"
+ << "TestType"
+ << "";
+ QTest::newRow("multiversion 1")
+ << "import org.qtproject.Test 1.11\n"
+ "import org.qtproject.Test 1.12\n"
+ "Test {}"
+ << (!qmlCheckTypes()?"TestType2":"")
+ << (!qmlCheckTypes()?"":"Test is ambiguous. Found in org/qtproject/Test/ in version 1.12 and 1.11");
+ QTest::newRow("multiversion 2")
+ << "import org.qtproject.Test 1.11\n"
+ "import org.qtproject.Test 1.12\n"
+ "OldTest {}"
+ << (!qmlCheckTypes()?"TestType":"")
+ << (!qmlCheckTypes()?"":"OldTest is ambiguous. Found in org/qtproject/Test/ in version 1.12 and 1.11");
+ QTest::newRow("qualified multiversion 3")
+ << "import org.qtproject.Test 1.0 as T0\n"
+ "import org.qtproject.Test 1.8 as T8\n"
+ "T0.Test {}"
+ << "TestType"
+ << "";
+ QTest::newRow("qualified multiversion 4")
+ << "import org.qtproject.Test 1.0 as T0\n"
+ "import org.qtproject.Test 1.8 as T8\n"
+ "T8.Test {}"
+ << "TestType2"
+ << "";
+}
+
+void tst_qqmllanguage::importsBuiltin()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ QFETCH(QString, error);
+ testType(qml,type,error);
+}
+
+void tst_qqmllanguage::importsLocal_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
+
+ // import locals
+ QTest::newRow("local import")
+ << "import \"subdir\"\n" // QT-613
+ "Test {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("local import second")
+ << "import QtQuick 2.0\nimport \"subdir\"\n"
+ "Test {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("local import subsubdir")
+ << "import QtQuick 2.0\nimport \"subdir/subsubdir\"\n"
+ "SubTest {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("local import QTBUG-7721 A")
+ << "subdir.Test {}" // no longer allowed (QTBUG-7721)
+ << ""
+ << "subdir.Test - subdir is not a namespace";
+ QTest::newRow("local import QTBUG-7721 B")
+ << "import \"subdir\" as X\n"
+ "X.subsubdir.SubTest {}" // no longer allowed (QTBUG-7721)
+ << ""
+ << "X.subsubdir.SubTest - nested namespaces not allowed";
+ QTest::newRow("local import as")
+ << "import \"subdir\" as T\n"
+ "T.Test {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("wrong local import as")
+ << "import \"subdir\" as T\n"
+ "Test {}"
+ << ""
+ << "Test is not a type";
+ QTest::newRow("library precedence over local import")
+ << "import \"subdir\"\n"
+ "import org.qtproject.Test 1.0\n"
+ "Test {}"
+ << (!qmlCheckTypes()?"TestType":"")
+ << (!qmlCheckTypes()?"":"Test is ambiguous. Found in org/qtproject/Test/ and in subdir/");
+}
+
+void tst_qqmllanguage::importsLocal()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ QFETCH(QString, error);
+ testType(qml,type,error);
+}
+
+void tst_qqmllanguage::basicRemote_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
+
+ QString serverdir = "http://127.0.0.1:14447/qtest/qml/qqmllanguage/";
+
+ QTest::newRow("no need for qmldir") << QUrl(serverdir+"Test.qml") << "" << "";
+ QTest::newRow("absent qmldir") << QUrl(serverdir+"/noqmldir/Test.qml") << "" << "";
+ QTest::newRow("need qmldir") << QUrl(serverdir+"TestLocal.qml") << "" << "";
+}
+
+void tst_qqmllanguage::basicRemote()
+{
+ QFETCH(QUrl, url);
+ QFETCH(QString, type);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(14447);
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine, url);
+
+ QTRY_VERIFY(!component.isLoading());
+
+ if (error.isEmpty()) {
+ if (component.isError())
+ qDebug() << component.errors();
+ QVERIFY(!component.isError());
+ } else {
+ QVERIFY(component.isError());
+ }
+}
+
+void tst_qqmllanguage::importsRemote_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
+
+ QString serverdir = "http://127.0.0.1:14447/qtest/qml/qqmllanguage";
+
+ QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QQuickRectangle"
+ << "";
+ QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QQuickText"
+ << "";
+ QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QQuickImage"
+ << "";
+ QTest::newRow("wrong remote import with undeclared local") << "import \""+serverdir+"\"\nWrongTestLocal {}" << ""
+ << "WrongTestLocal is not a type";
+ QTest::newRow("wrong remote import of internal local") << "import \""+serverdir+"\"\nLocalInternal {}" << ""
+ << "LocalInternal is not a type";
+ QTest::newRow("wrong remote import of undeclared local") << "import \""+serverdir+"\"\nUndeclaredLocal {}" << ""
+ << "UndeclaredLocal is not a type";
+}
+
+void tst_qqmllanguage::importsRemote()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(14447);
+ server.serveDirectory(dataDirectory());
+
+ testType(qml,type,error);
+}
+
+void tst_qqmllanguage::importsInstalled_data()
+{
+ // QT-610
+
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
+
+ // import installed
+ QTest::newRow("installed import 0")
+ << "import org.qtproject.installedtest0 0.0\n"
+ "InstalledTestTP {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("installed import 0 as TP")
+ << "import org.qtproject.installedtest0 0.0 as TP\n"
+ "TP.InstalledTestTP {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("installed import 1")
+ << "import org.qtproject.installedtest 1.0\n"
+ "InstalledTest {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("installed import 2")
+ << "import org.qtproject.installedtest 1.3\n"
+ "InstalledTest {}"
+ << "QQuickRectangle"
+ << "";
+ QTest::newRow("installed import 3")
+ << "import org.qtproject.installedtest 1.4\n"
+ "InstalledTest {}"
+ << "QQuickText"
+ << "";
+ QTest::newRow("installed import minor version not available") // QTBUG-11936
+ << "import org.qtproject.installedtest 0.1\n"
+ "InstalledTest {}"
+ << ""
+ << "module \"org.qtproject.installedtest\" version 0.1 is not installed";
+ QTest::newRow("installed import minor version not available") // QTBUG-9627
+ << "import org.qtproject.installedtest 1.10\n"
+ "InstalledTest {}"
+ << ""
+ << "module \"org.qtproject.installedtest\" version 1.10 is not installed";
+ QTest::newRow("installed import major version not available") // QTBUG-9627
+ << "import org.qtproject.installedtest 9.0\n"
+ "InstalledTest {}"
+ << ""
+ << "module \"org.qtproject.installedtest\" version 9.0 is not installed";
+ QTest::newRow("installed import visibility") // QT-614
+ << "import org.qtproject.installedtest 1.4\n"
+ "PrivateType {}"
+ << ""
+ << "PrivateType is not a type";
+ QTest::newRow("installed import version QML clash")
+ << "import org.qtproject.installedtest1 1.0\n"
+ "Test {}"
+ << ""
+ << "\"Test\" version 1.0 is defined more than once in module \"org.qtproject.installedtest1\"";
+ QTest::newRow("installed import version JS clash")
+ << "import org.qtproject.installedtest2 1.0\n"
+ "Test {}"
+ << ""
+ << "\"Test\" version 1.0 is defined more than once in module \"org.qtproject.installedtest2\"";
+}
+
+void tst_qqmllanguage::importsInstalled()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ QFETCH(QString, error);
+ testType(qml,type,error);
+}
+
+void tst_qqmllanguage::importsInstalledRemote_data()
+{
+ // Repeat the tests for local installed data
+ importsInstalled_data();
+}
+
+void tst_qqmllanguage::importsInstalledRemote()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(14447);
+ server.serveDirectory(dataDirectory());
+
+ QString serverdir = "http://127.0.0.1:14447/lib/";
+ engine.setImportPathList(QStringList(defaultImportPathList) << serverdir);
+
+ testType(qml,type,error);
+
+ engine.setImportPathList(defaultImportPathList);
+}
+
+void tst_qqmllanguage::importsPath_data()
+{
+ QTest::addColumn<QStringList>("importPath");
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("value");
+
+ QTest::newRow("local takes priority normal")
+ << (QStringList() << testFile("lib") << "http://127.0.0.1:14447/lib2/")
+ << "import testModule 1.0\n"
+ "Test {}"
+ << "foo";
+
+ QTest::newRow("local takes priority reversed")
+ << (QStringList() << "http://127.0.0.1:14447/lib/" << testFile("lib2"))
+ << "import testModule 1.0\n"
+ "Test {}"
+ << "bar";
+
+ QTest::newRow("earlier takes priority 1")
+ << (QStringList() << "http://127.0.0.1:14447/lib/" << "http://127.0.0.1:14447/lib2/")
+ << "import testModule 1.0\n"
+ "Test {}"
+ << "foo";
+
+ QTest::newRow("earlier takes priority 2")
+ << (QStringList() << "http://127.0.0.1:14447/lib2/" << "http://127.0.0.1:14447/lib/")
+ << "import testModule 1.0\n"
+ "Test {}"
+ << "bar";
+
+ QTest::newRow("major version takes priority over unversioned")
+ << (QStringList() << "http://127.0.0.1:14447/lib/" << "http://127.0.0.1:14447/lib3/")
+ << "import testModule 1.0\n"
+ "Test {}"
+ << "baz";
+
+ QTest::newRow("major version takes priority over minor")
+ << (QStringList() << "http://127.0.0.1:14447/lib4/" << "http://127.0.0.1:14447/lib3/")
+ << "import testModule 1.0\n"
+ "Test {}"
+ << "baz";
+
+ QTest::newRow("minor version takes priority over unversioned")
+ << (QStringList() << "http://127.0.0.1:14447/lib/" << "http://127.0.0.1:14447/lib4/")
+ << "import testModule 1.0\n"
+ "Test {}"
+ << "qux";
+}
+
+void tst_qqmllanguage::importsPath()
+{
+ QFETCH(QStringList, importPath);
+ QFETCH(QString, qml);
+ QFETCH(QString, value);
+
+ TestHTTPServer server(14447);
+ server.serveDirectory(dataDirectory());
+
+ engine.setImportPathList(QStringList(defaultImportPathList) << importPath);
+
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(), testFileUrl("empty.qml"));
+
+ QTRY_VERIFY(component.isReady());
+ VERIFY_ERRORS(0);
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toString(), value);
+ delete object;
+
+ engine.setImportPathList(defaultImportPathList);
+}
+
+void tst_qqmllanguage::importsOrder_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+ QTest::addColumn<QString>("error");
+ QTest::addColumn<bool>("partialMatch");
+
+ QTest::newRow("double import") <<
+ "import org.qtproject.installedtest 1.4\n"
+ "import org.qtproject.installedtest 1.4\n"
+ "InstalledTest {}"
+ << (!qmlCheckTypes()?"QQuickText":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/org/qtproject/installedtest/ in version 1.4 and 1.4")
+ << false;
+ QTest::newRow("installed import overrides 1") <<
+ "import org.qtproject.installedtest 1.0\n"
+ "import org.qtproject.installedtest 1.4\n"
+ "InstalledTest {}"
+ << (!qmlCheckTypes()?"QQuickText":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/org/qtproject/installedtest/ in version 1.4 and 1.0")
+ << false;
+ QTest::newRow("installed import overrides 2") <<
+ "import org.qtproject.installedtest 1.4\n"
+ "import org.qtproject.installedtest 1.0\n"
+ "InstalledTest {}"
+ << (!qmlCheckTypes()?"QQuickRectangle":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/org/qtproject/installedtest/ in version 1.0 and 1.4")
+ << false;
+ QTest::newRow("installed import re-overrides 1") <<
+ "import org.qtproject.installedtest 1.4\n"
+ "import org.qtproject.installedtest 1.0\n"
+ "import org.qtproject.installedtest 1.4\n"
+ "InstalledTest {}"
+ << (!qmlCheckTypes()?"QQuickText":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/org/qtproject/installedtest/ in version 1.4 and 1.0")
+ << false;
+ QTest::newRow("installed import re-overrides 2") <<
+ "import org.qtproject.installedtest 1.4\n"
+ "import org.qtproject.installedtest 1.0\n"
+ "import org.qtproject.installedtest 1.4\n"
+ "import org.qtproject.installedtest 1.0\n"
+ "InstalledTest {}"
+ << (!qmlCheckTypes()?"QQuickRectangle":"")
+ << (!qmlCheckTypes()?"":"InstalledTest is ambiguous. Found in lib/org/qtproject/installedtest/ in version 1.0 and 1.4")
+ << false;
+ QTest::newRow("installed import versus builtin 1") <<
+ "import org.qtproject.installedtest 1.5\n"
+ "import QtQuick 2.0\n"
+ "Rectangle {}"
+ << (!qmlCheckTypes()?"QQuickRectangle":"")
+ << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in file://")
+ << true;
+ QTest::newRow("installed import versus builtin 2") <<
+ "import QtQuick 2.0\n"
+ "import org.qtproject.installedtest 1.5\n"
+ "Rectangle {}"
+ << (!qmlCheckTypes()?"QQuickText":"")
+ << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in lib/org/qtproject/installedtest/ and in file://")
+ << true;
+ QTest::newRow("namespaces cannot be overridden by types 1") <<
+ "import QtQuick 2.0 as Rectangle\n"
+ "import org.qtproject.installedtest 1.5\n"
+ "Rectangle {}"
+ << ""
+ << "Namespace Rectangle cannot be used as a type"
+ << false;
+ QTest::newRow("namespaces cannot be overridden by types 2") <<
+ "import QtQuick 2.0 as Rectangle\n"
+ "import org.qtproject.installedtest 1.5\n"
+ "Rectangle.Image {}"
+ << "QQuickImage"
+ << ""
+ << false;
+ QTest::newRow("local last 1") <<
+ "LocalLast {}"
+ << "QQuickText"
+ << ""
+ << false;
+ QTest::newRow("local last 2") <<
+ "import org.qtproject.installedtest 1.0\n"
+ "LocalLast {}"
+ << (!qmlCheckTypes()?"QQuickRectangle":"")// i.e. from org.qtproject.installedtest, not data/LocalLast.qml
+ << (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/org/qtproject/installedtest/ and in ")
+ << false;
+ QTest::newRow("local last 3") << //Forces it to load the local qmldir to resolve types, but they shouldn't override anything
+ "import org.qtproject.installedtest 1.0\n"
+ "LocalLast {LocalLast2{}}"
+ << (!qmlCheckTypes()?"QQuickRectangle":"")// i.e. from org.qtproject.installedtest, not data/LocalLast.qml
+ << (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/org/qtproject/installedtest/ and in ")
+ << false;
+}
+
+void tst_qqmllanguage::importsOrder()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ QFETCH(QString, error);
+ QFETCH(bool, partialMatch);
+ testType(qml,type,error,partialMatch);
+}
+
+void tst_qqmllanguage::importIncorrectCase()
+{
+ if (engine.importPathList() == defaultImportPathList)
+ engine.addImportPath(testFile("lib"));
+
+ // Load "importIncorrectCase.qml" using wrong case
+ QQmlComponent component(&engine, testFileUrl("ImportIncorrectCase.qml"));
+
+ QList<QQmlError> errors = component.errors();
+ QCOMPARE(errors.count(), 1);
+
+#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
+ QString expectedError = QLatin1String("File name case mismatch");
+#else
+ QString expectedError = QLatin1String("File not found");
+#endif
+
+ QCOMPARE(errors.at(0).description(), expectedError);
+
+ engine.setImportPathList(defaultImportPathList);
+}
+
+void tst_qqmllanguage::importJs_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+ QTest::addColumn<bool>("performTest");
+
+ QTest::newRow("defaultVersion")
+ << "importJs.1.qml"
+ << "importJs.1.errors.txt"
+ << true;
+
+ QTest::newRow("specifiedVersion")
+ << "importJs.2.qml"
+ << "importJs.2.errors.txt"
+ << true;
+
+ QTest::newRow("excludeExcessiveVersion")
+ << "importJs.3.qml"
+ << "importJs.3.errors.txt"
+ << false;
+
+ QTest::newRow("includeAppropriateVersion")
+ << "importJs.4.qml"
+ << "importJs.4.errors.txt"
+ << true;
+
+ QTest::newRow("noDefaultVersion")
+ << "importJs.5.qml"
+ << "importJs.5.errors.txt"
+ << false;
+
+ QTest::newRow("repeatImportFails")
+ << "importJs.6.qml"
+ << "importJs.6.errors.txt"
+ << false;
+
+ QTest::newRow("multipleVersionImportFails")
+ << "importJs.7.qml"
+ << "importJs.7.errors.txt"
+ << false;
+
+ QTest::newRow("namespacedImport")
+ << "importJs.8.qml"
+ << "importJs.8.errors.txt"
+ << true;
+
+ QTest::newRow("namespacedVersionedImport")
+ << "importJs.9.qml"
+ << "importJs.9.errors.txt"
+ << true;
+
+ QTest::newRow("namespacedRepeatImport")
+ << "importJs.10.qml"
+ << "importJs.10.errors.txt"
+ << true;
+}
+
+void tst_qqmllanguage::importJs()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+ QFETCH(bool, performTest);
+
+ engine.setImportPathList(QStringList(defaultImportPathList) << testFile("lib"));
+
+ QQmlComponent component(&engine, testFileUrl(file));
+
+ {
+ DETERMINE_ERRORS(errorFile,expected,actual);
+ QCOMPARE(expected.size(), actual.size());
+ for (int i = 0; i < expected.size(); ++i)
+ {
+ const int compareLen = qMin(expected.at(i).length(), actual.at(i).length());
+ QCOMPARE(expected.at(i).left(compareLen), actual.at(i).left(compareLen));
+ }
+ }
+
+ if (performTest) {
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toBool(),true);
+ delete object;
+ }
+
+ engine.setImportPathList(defaultImportPathList);
+}
+
+void tst_qqmllanguage::qmlAttachedPropertiesObjectMethod()
+{
+ QObject object;
+
+ QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)0);
+ QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, true), (QObject *)0);
+
+ {
+ QQmlComponent component(&engine, testFileUrl("qmlAttachedPropertiesObjectMethod.1.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)0);
+ QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0);
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("qmlAttachedPropertiesObjectMethod.2.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != 0);
+ QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0);
+ }
+}
+
+void tst_qqmllanguage::crash1()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nComponent {}", QUrl());
+}
+
+void tst_qqmllanguage::crash2()
+{
+ QQmlComponent component(&engine, testFileUrl("crash2.qml"));
+}
+
+// QTBUG-8676
+void tst_qqmllanguage::customOnProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("customOnProperty.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("on").toInt(), 10);
+
+ delete object;
+}
+
+// QTBUG-12601
+void tst_qqmllanguage::variantNotify()
+{
+ QQmlComponent component(&engine, testFileUrl("variantNotify.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("notifyCount").toInt(), 1);
+
+ delete object;
+}
+
+void tst_qqmllanguage::revisions()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("revisions11.qml"));
+
+ VERIFY_ERRORS(0);
+ MyRevisionedClass *object = qobject_cast<MyRevisionedClass*>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->prop2(), 10.0);
+
+ delete object;
+ }
+ {
+ QQmlEngine myEngine;
+ QQmlComponent component(&myEngine, testFileUrl("revisionssub11.qml"));
+
+ VERIFY_ERRORS(0);
+ MyRevisionedSubclass *object = qobject_cast<MyRevisionedSubclass*>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->prop1(), 10.0);
+ QCOMPARE(object->prop2(), 10.0);
+ QCOMPARE(object->prop3(), 10.0);
+ QCOMPARE(object->prop4(), 10.0);
+
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("versionedbase.qml"));
+ VERIFY_ERRORS(0);
+ MySubclass *object = qobject_cast<MySubclass*>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->prop1(), 10.0);
+ QCOMPARE(object->prop2(), 10.0);
+
+ delete object;
+ }
+}
+
+void tst_qqmllanguage::revisionOverloads()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("allowedRevisionOverloads.qml"));
+ VERIFY_ERRORS(0);
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("disallowedRevisionOverloads.qml"));
+ QEXPECT_FAIL("", "QTBUG-13849", Abort);
+ QVERIFY(0);
+ VERIFY_ERRORS("disallowedRevisionOverloads.errors.txt");
+ }
+}
+
+void tst_qqmllanguage::subclassedUncreateableRevision_data()
+{
+ QTest::addColumn<QString>("version");
+ QTest::addColumn<QString>("prop");
+ QTest::addColumn<bool>("shouldWork");
+
+ QTest::newRow("prop1 exists in 1.0") << "1.0" << "prop1" << true;
+ QTest::newRow("prop2 does not exist in 1.0") << "1.0" << "prop2" << false;
+ QTest::newRow("prop3 does not exist in 1.0") << "1.0" << "prop3" << false;
+
+ QTest::newRow("prop1 exists in 1.1") << "1.1" << "prop1" << true;
+ QTest::newRow("prop2 works because it's re-declared in Derived") << "1.1" << "prop2" << true;
+ QTest::newRow("prop3 only works if the Base REVISION 1 is picked up") << "1.1" << "prop3" << true;
+
+}
+
+void tst_qqmllanguage::subclassedUncreateableRevision()
+{
+ QFETCH(QString, version);
+ QFETCH(QString, prop);
+ QFETCH(bool, shouldWork);
+
+ {
+ QQmlEngine engine;
+ QString qml = QString("import QtQuick 2.0\nimport Test %1\nMyUncreateableBaseClass {}").arg(version);
+ QQmlComponent c(&engine);
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath()));
+ QObject *obj = c.create();
+ QCOMPARE(obj, static_cast<QObject*>(0));
+ QCOMPARE(c.errors().count(), 1);
+ QCOMPARE(c.errors().first().description(), QString("Cannot create MyUncreateableBaseClass"));
+ }
+
+ QQmlEngine engine;
+ QString qml = QString("import QtQuick 2.0\nimport Test %1\nMyCreateableDerivedClass {\n%3: true\n}").arg(version).arg(prop);
+ QQmlComponent c(&engine);
+ if (!shouldWork)
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath()));
+ QObject *obj = c.create();
+ if (!shouldWork) {
+ QCOMPARE(obj, static_cast<QObject*>(0));
+ return;
+ }
+
+ QVERIFY(obj);
+ MyUncreateableBaseClass *base = qobject_cast<MyUncreateableBaseClass*>(obj);
+ QVERIFY(base);
+ QCOMPARE(base->property(prop.toLatin1()).toBool(), true);
+ delete obj;
+}
+
+void tst_qqmllanguage::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QVERIFY2(QDir::setCurrent(dataDirectory()), qPrintable("Could not chdir to " + dataDirectory()));
+
+ defaultImportPathList = engine.importPathList();
+
+ QQmlMetaType::registerCustomStringConverter(qMetaTypeId<MyCustomVariantType>(), myCustomVariantTypeConverter);
+
+ registerTypes();
+ // Registered here because it uses testFileUrl
+ qmlRegisterType(testFileUrl("CompositeType.qml"), "Test", 1, 0, "RegisteredCompositeType");
+ qmlRegisterType(testFileUrl("CompositeType.DoesNotExist.qml"), "Test", 1, 0, "RegisteredCompositeType2");
+ qmlRegisterType(testFileUrl("invalidRoot.1.qml"), "Test", 1, 0, "RegisteredCompositeType3");
+
+ // Registering the TestType class in other modules should have no adverse effects
+ qmlRegisterType<TestType>("org.qtproject.TestPre", 1, 0, "Test");
+
+ qmlRegisterType<TestType>("org.qtproject.Test", 0, 0, "TestTP");
+ qmlRegisterType<TestType>("org.qtproject.Test", 1, 0, "Test");
+ qmlRegisterType<TestType>("org.qtproject.Test", 1, 5, "Test");
+ qmlRegisterType<TestType2>("org.qtproject.Test", 1, 8, "Test");
+ qmlRegisterType<TestType>("org.qtproject.Test", 1, 9, "OldTest");
+ qmlRegisterType<TestType2>("org.qtproject.Test", 1, 12, "Test");
+
+ // Registering the TestType class in other modules should have no adverse effects
+ qmlRegisterType<TestType>("org.qtproject.TestPost", 1, 0, "Test");
+
+ // Create locale-specific file
+ // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit
+ // For iso8859-1 locale, this will just be data/I18nType?????.qml where ????? is 5 8-bit characters
+ // For utf-8 locale, this will be data/I18nType??????????.qml where ?????????? is 5 8-bit characters, UTF-8 encoded
+ QFile in(testFileUrl(QLatin1String("I18nType30.qml")).toLocalFile());
+ QVERIFY2(in.open(QIODevice::ReadOnly), qPrintable(QString::fromLatin1("Cannot open '%1': %2").arg(in.fileName(), in.errorString())));
+ QFile out(testFileUrl(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile());
+ QVERIFY2(out.open(QIODevice::WriteOnly), qPrintable(QString::fromLatin1("Cannot open '%1': %2").arg(out.fileName(), out.errorString())));
+ out.write(in.readAll());
+}
+
+void tst_qqmllanguage::aliasPropertyChangeSignals()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasPropertyChangeSignals.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+
+ // QTCREATORBUG-2769
+ {
+ QQmlComponent component(&engine, testFileUrl("aliasPropertyChangeSignals.2.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+ }
+}
+
+// Tests property initializers
+void tst_qqmllanguage::propertyInit()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyInit.1.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toInt(), 1);
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("propertyInit.2.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toInt(), 123);
+
+ delete o;
+ }
+}
+
+// Test that registration order doesn't break type availability
+// QTBUG-16878
+void tst_qqmllanguage::registrationOrder()
+{
+ QQmlComponent component(&engine, testFileUrl("registrationOrder.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QVERIFY(o->metaObject() == &MyVersion2Class::staticMetaObject);
+ delete o;
+}
+
+void tst_qqmllanguage::readonly()
+{
+ QQmlComponent component(&engine, testFileUrl("readonly.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 18);
+ QCOMPARE(o->property("test3").toInt(), 13);
+
+ o->setProperty("testData", 13);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 22);
+ QCOMPARE(o->property("test3").toInt(), 13);
+
+ o->setProperty("testData2", 2);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 22);
+ QCOMPARE(o->property("test3").toInt(), 2);
+
+ o->setProperty("test1", 11);
+ o->setProperty("test2", 11);
+ o->setProperty("test3", 11);
+
+ QCOMPARE(o->property("test1").toInt(), 10);
+ QCOMPARE(o->property("test2").toInt(), 22);
+ QCOMPARE(o->property("test3").toInt(), 2);
+
+ delete o;
+}
+
+void tst_qqmllanguage::receivers()
+{
+ QQmlComponent component(&engine, testFileUrl("receivers.qml"));
+
+ MyReceiversTestObject *o = qobject_cast<MyReceiversTestObject*>(component.create());
+ QVERIFY(o != 0);
+ QCOMPARE(o->mySignalCount(), 1);
+ QCOMPARE(o->propChangedCount(), 2);
+ QCOMPARE(o->myUnconnectedSignalCount(), 0);
+
+ QVERIFY(o->isSignalConnected(QMetaMethod::fromSignal(&MyReceiversTestObject::mySignal)));
+ QVERIFY(o->isSignalConnected(QMetaMethod::fromSignal(&MyReceiversTestObject::propChanged)));
+ QVERIFY(!o->isSignalConnected(QMetaMethod::fromSignal(&MyReceiversTestObject::myUnconnectedSignal)));
+
+ delete o;
+}
+
+void tst_qqmllanguage::registeredCompositeType()
+{
+ QQmlComponent component(&engine, testFileUrl("registeredCompositeType.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ delete o;
+}
+
+// QTBUG-18268
+void tst_qqmllanguage::remoteLoadCrash()
+{
+ TestHTTPServer server(14448);
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Text {}", QUrl("http://127.0.0.1:14448/remoteLoadCrash.qml"));
+ while (component.isLoading())
+ QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents, 50);
+
+ QObject *o = component.create();
+ delete o;
+}
+
+void tst_qqmllanguage::signalWithDefaultArg()
+{
+ QQmlComponent component(&engine, testFileUrl("signalWithDefaultArg.qml"));
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("signalCount").toInt(), 0);
+ QCOMPARE(object->property("signalArg").toInt(), 0);
+
+ emit object->signalWithDefaultArg();
+ QCOMPARE(object-> property("signalCount").toInt(), 1);
+ QCOMPARE(object->property("signalArg").toInt(), 5);
+
+ emit object->signalWithDefaultArg(15);
+ QCOMPARE(object->property("signalCount").toInt(), 2);
+ QCOMPARE(object->property("signalArg").toInt(), 15);
+
+
+ QMetaObject::invokeMethod(object, "emitNoArgSignal");
+ QCOMPARE(object->property("signalCount").toInt(), 3);
+ QCOMPARE(object->property("signalArg").toInt(), 5);
+
+ QMetaObject::invokeMethod(object, "emitArgSignal");
+ QCOMPARE(object->property("signalCount").toInt(), 4);
+ QCOMPARE(object->property("signalArg").toInt(), 22);
+
+ delete object;
+}
+
+void tst_qqmllanguage::signalParameterTypes()
+{
+ // bound signal handlers
+ {
+ QQmlComponent component(&engine, testFileUrl("signalParameterTypes.1.qml"));
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+ QVERIFY(obj->property("success").toBool());
+ delete obj;
+ }
+
+ // dynamic signal connections
+ {
+ QQmlComponent component(&engine, testFileUrl("signalParameterTypes.2.qml"));
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+ QEXPECT_FAIL("", "Dynamic connections don't enforce type safety - QTBUG-26662", Abort);
+ QVERIFY(obj->property("success").toBool());
+ delete obj;
+ }
+}
+
+// QTBUG-20639
+void tst_qqmllanguage::globalEnums()
+{
+ qRegisterMetaType<MyEnum1Class::EnumA>();
+ qRegisterMetaType<MyEnum2Class::EnumB>();
+ qRegisterMetaType<Qt::TextFormat>();
+
+ QQmlComponent component(&engine, testFileUrl("globalEnums.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ MyEnum1Class *enum1Class = o->findChild<MyEnum1Class *>(QString::fromLatin1("enum1Class"));
+ QVERIFY(enum1Class != 0);
+ QVERIFY(enum1Class->getValue() == -1);
+
+ MyEnumDerivedClass *enum2Class = o->findChild<MyEnumDerivedClass *>(QString::fromLatin1("enumDerivedClass"));
+ QVERIFY(enum2Class != 0);
+ QVERIFY(enum2Class->getValueA() == -1);
+ QVERIFY(enum2Class->getValueB() == -1);
+ QVERIFY(enum2Class->getValueC() == 0);
+ QVERIFY(enum2Class->getValueD() == 0);
+ QVERIFY(enum2Class->getValueE() == -1);
+ QVERIFY(enum2Class->getValueE2() == -1);
+
+ QVERIFY(enum2Class->property("aValue") == 0);
+ QVERIFY(enum2Class->property("bValue") == 0);
+ QVERIFY(enum2Class->property("cValue") == 0);
+ QVERIFY(enum2Class->property("dValue") == 0);
+ QVERIFY(enum2Class->property("eValue") == 0);
+ QVERIFY(enum2Class->property("e2Value") == 0);
+
+ QSignalSpy signalA(enum2Class, SIGNAL(valueAChanged(MyEnum1Class::EnumA)));
+ QSignalSpy signalB(enum2Class, SIGNAL(valueBChanged(MyEnum2Class::EnumB)));
+
+ QMetaObject::invokeMethod(o, "setEnumValues");
+
+ QVERIFY(enum1Class->getValue() == MyEnum1Class::A_13);
+ QVERIFY(enum2Class->getValueA() == MyEnum1Class::A_11);
+ QVERIFY(enum2Class->getValueB() == MyEnum2Class::B_37);
+ QVERIFY(enum2Class->getValueC() == Qt::RichText);
+ QVERIFY(enum2Class->getValueD() == Qt::ElideMiddle);
+ QVERIFY(enum2Class->getValueE() == MyEnum2Class::E_14);
+ QVERIFY(enum2Class->getValueE2() == MyEnum2Class::E_76);
+
+ QVERIFY(signalA.count() == 1);
+ QVERIFY(signalB.count() == 1);
+
+ QVERIFY(enum2Class->property("aValue") == MyEnum1Class::A_11);
+ QVERIFY(enum2Class->property("bValue") == 37);
+ QVERIFY(enum2Class->property("cValue") == 1);
+ QVERIFY(enum2Class->property("dValue") == 2);
+ QVERIFY(enum2Class->property("eValue") == 14);
+ QVERIFY(enum2Class->property("e2Value") == 76);
+
+ delete o;
+}
+
+void tst_qqmllanguage::literals_data()
+{
+ QTest::addColumn<QString>("property");
+ QTest::addColumn<QVariant>("value");
+
+ QTest::newRow("hex") << "n1" << QVariant(0xfe32);
+ // Octal integer literals are deprecated
+// QTest::newRow("octal") << "n2" << QVariant(015);
+ QTest::newRow("fp1") << "n3" << QVariant(-4.2E11);
+ QTest::newRow("fp2") << "n4" << QVariant(.1e9);
+ QTest::newRow("fp3") << "n5" << QVariant(3e-12);
+ QTest::newRow("fp4") << "n6" << QVariant(3e+12);
+ QTest::newRow("fp5") << "n7" << QVariant(0.1e9);
+ QTest::newRow("large-int1") << "n8" << QVariant((double) 1152921504606846976);
+ QTest::newRow("large-int2") << "n9" << QVariant(100000000000000000000.);
+
+ QTest::newRow("special1") << "c1" << QVariant(QString("\b"));
+ QTest::newRow("special2") << "c2" << QVariant(QString("\f"));
+ QTest::newRow("special3") << "c3" << QVariant(QString("\n"));
+ QTest::newRow("special4") << "c4" << QVariant(QString("\r"));
+ QTest::newRow("special5") << "c5" << QVariant(QString("\t"));
+ QTest::newRow("special6") << "c6" << QVariant(QString("\v"));
+ QTest::newRow("special7") << "c7" << QVariant(QString("\'"));
+ QTest::newRow("special8") << "c8" << QVariant(QString("\""));
+ QTest::newRow("special9") << "c9" << QVariant(QString("\\"));
+ // We don't handle octal escape sequences
+ QTest::newRow("special10") << "c10" << QVariant(QString(1, QChar(0xa9)));
+ QTest::newRow("special11") << "c11" << QVariant(QString(1, QChar(0x00A9)));
+}
+
+void tst_qqmllanguage::literals()
+{
+ QFETCH(QString, property);
+ QFETCH(QVariant, value);
+
+ QQmlComponent component(&engine, testFile("literals.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property(property.toLatin1()), value);
+ delete object;
+}
+
+void tst_qqmllanguage::objectDeletionNotify_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QTest::newRow("property QtObject") << "objectDeletionNotify.1.qml";
+ QTest::newRow("property variant") << "objectDeletionNotify.2.qml";
+ QTest::newRow("property var") << "objectDeletionNotify.3.qml";
+ QTest::newRow("property var guard removed") << "objectDeletionNotify.4.qml";
+}
+
+void tst_qqmllanguage::objectDeletionNotify()
+{
+ QFETCH(QString, file);
+
+ QQmlComponent component(&engine, testFile(file));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+
+ QMetaObject::invokeMethod(object, "destroyObject");
+
+ // Process the deletion event
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QCOMPARE(object->property("success").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmllanguage::scopedProperties()
+{
+ QQmlComponent component(&engine, testFile("scopedProperties.qml"));
+
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o != 0);
+ QVERIFY(o->property("success").toBool());
+}
+
+// Tests that the implicit import has lowest precedence, in the case where
+// there are conflicting types and types only found in the local import.
+// Tests that just check one (or the root) type are in ::importsOrder
+void tst_qqmllanguage::implicitImportsLast()
+{
+ if (qmlCheckTypes())
+ QSKIP("This test is about maintaining the same choice when type is ambiguous.");
+
+ if (engine.importPathList() == defaultImportPathList)
+ engine.addImportPath(testFile("lib"));
+
+ QQmlComponent component(&engine, testFile("localOrderTest.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = qobject_cast<QObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(QString(object->metaObject()->className()).startsWith(QLatin1String("QQuickMouseArea")));
+ QObject* object2 = object->property("item").value<QObject*>();
+ QVERIFY(object2 != 0);
+ QCOMPARE(QString(object2->metaObject()->className()), QLatin1String("QQuickRectangle"));
+
+ engine.setImportPathList(defaultImportPathList);
+}
+
+
+QTEST_MAIN(tst_qqmllanguage)
+
+#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro b/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro
new file mode 100644
index 0000000000..e6c9dc3a29
--- /dev/null
+++ b/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qqmllistcompositor
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmllistcompositor.cpp
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
new file mode 100644
index 0000000000..d5e85f478d
--- /dev/null
+++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
@@ -0,0 +1,1740 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <private/qqmllistcompositor_p.h>
+
+template<typename T, int N> int lengthOf(const T (&)[N]) { return N; }
+
+typedef QQmlListCompositor C;
+
+struct Range
+{
+ Range() {}
+ Range(void *list, int index, int count, int flags)
+ : list(list), index(index), count(count), flags(flags) {}
+ void *list;
+ int index;
+ int count;
+ int flags;
+};
+
+template <typename T> struct Array
+{
+ Array() : array(0), count(0) {}
+ template<int N> Array(const T (&array)[N]) : array(array), count(N) {}
+
+ T operator [](int index) const { return array[index]; }
+
+ const T *array;
+ int count;
+};
+
+typedef Array<int> IndexArray;
+typedef Array<const void *> ListArray;
+
+typedef QVector<QQmlListCompositor::Remove> RemoveList;
+typedef QVector<QQmlListCompositor::Insert> InsertList;
+typedef QVector<QQmlListCompositor::Change> ChangeList;
+
+typedef QVector<Range> RangeList;
+
+Q_DECLARE_METATYPE(RangeList)
+Q_DECLARE_METATYPE(RemoveList)
+Q_DECLARE_METATYPE(InsertList)
+Q_DECLARE_METATYPE(ChangeList)
+Q_DECLARE_METATYPE(void *)
+Q_DECLARE_METATYPE(IndexArray)
+Q_DECLARE_METATYPE(ListArray)
+Q_DECLARE_METATYPE(C::Group)
+
+QT_BEGIN_NAMESPACE
+bool operator ==(const C::Change &left, const C::Change &right)
+{
+ return left.index[3] == right.index[3]
+ && left.index[2] == right.index[2]
+ && left.index[1] == right.index[1]
+ && left.index[0] == right.index[0]
+ && left.count == right.count
+ && left.groups() == right.groups()
+ && left.inCache() == right.inCache()
+ && (left.moveId == -1) == (right.moveId == -1);
+}
+QT_END_NAMESPACE
+
+static const C::Group Visible = C::Group(2);
+static const C::Group Selection = C::Group(3);
+
+class tst_qqmllistcompositor : public QObject
+{
+ Q_OBJECT
+
+ enum {
+ VisibleFlag = 0x04,
+ SelectionFlag = 0x08
+ };
+
+ void populateChange(
+ C::Change &change, int sIndex, int vIndex, int dIndex, int cIndex, int count, int flags, int moveId)
+ {
+ change.index[Selection] = sIndex;
+ change.index[Visible] = vIndex;
+ change.index[C::Default] = dIndex;
+ change.index[C::Cache] = cIndex;
+ change.count = count;
+ change.flags = flags;
+ change.moveId = moveId;
+ }
+
+ C::Remove Remove(
+ int sIndex, int vIndex, int dIndex, int cIndex, int count, int flags, int moveId = -1)
+ {
+ C::Remove remove;
+ populateChange(remove, sIndex, vIndex, dIndex, cIndex, count, flags, moveId);
+ return remove;
+ }
+
+ C::Insert Insert(
+ int sIndex, int vIndex, int dIndex, int cIndex, int count, int flags, int moveId = -1)
+ {
+ C::Insert insert;
+ populateChange(insert, sIndex, vIndex, dIndex, cIndex, count, flags, moveId);
+ return insert;
+ }
+
+ C::Change Change(
+ int sIndex, int vIndex, int dIndex, int cIndex, int count, int flags, int moveId = -1)
+ {
+ C::Change change;
+ populateChange(change, sIndex, vIndex, dIndex, cIndex, count, flags, moveId);
+ return change;
+ }
+
+private slots:
+ void find_data();
+ void find();
+ void findInsertPosition_data();
+ void findInsertPosition();
+ void insert();
+ void clearFlags_data();
+ void clearFlags();
+ void setFlags_data();
+ void setFlags();
+ void move_data();
+ void move();
+ void moveFromEnd();
+ void clear();
+ void listItemsInserted_data();
+ void listItemsInserted();
+ void listItemsRemoved_data();
+ void listItemsRemoved();
+ void listItemsMoved_data();
+ void listItemsMoved();
+ void listItemsChanged_data();
+ void listItemsChanged();
+ void compositorDebug();
+ void changeDebug();
+ void groupDebug();
+};
+
+void tst_qqmllistcompositor::find_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<C::Group>("startGroup");
+ QTest::addColumn<int>("startIndex");
+ QTest::addColumn<C::Group>("group");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<int>("selectionIndex");
+ QTest::addColumn<int>("visibleIndex");
+ QTest::addColumn<int>("defaultIndex");
+ QTest::addColumn<int>("cacheIndex");
+ QTest::addColumn<uint>("rangeFlags");
+ QTest::addColumn<int>("rangeIndex");
+
+ int listA; void *a = &listA;
+
+ QTest::newRow("Start")
+ << (RangeList()
+ << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 1, 1, int(C::AppendFlag | C::PrependFlag | C::CacheFlag))
+ << Range(0, 0, 1, int(VisibleFlag| C::CacheFlag)))
+ << C::Cache << 2
+ << Selection << 0
+ << 0 << 0 << 0 << 0
+ << uint(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag) << 0;
+}
+
+void tst_qqmllistcompositor::find()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(C::Group, startGroup);
+ QFETCH(int, startIndex);
+ QFETCH(C::Group, group);
+ QFETCH(int, index);
+ QFETCH(int, cacheIndex);
+ QFETCH(int, defaultIndex);
+ QFETCH(int, visibleIndex);
+ QFETCH(int, selectionIndex);
+ QFETCH(uint, rangeFlags);
+ QFETCH(int, rangeIndex);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ compositor.find(startGroup, startIndex);
+
+ QQmlListCompositor::iterator it = compositor.find(group, index);
+ QCOMPARE(it.index[C::Cache], cacheIndex);
+ QCOMPARE(it.index[C::Default], defaultIndex);
+ QCOMPARE(it.index[Visible], visibleIndex);
+ QCOMPARE(it.index[Selection], selectionIndex);
+ QCOMPARE(it->flags, rangeFlags);
+ QCOMPARE(it->index, rangeIndex);
+}
+
+void tst_qqmllistcompositor::findInsertPosition_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<C::Group>("group");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<int>("selectionIndex");
+ QTest::addColumn<int>("visibleIndex");
+ QTest::addColumn<int>("defaultIndex");
+ QTest::addColumn<int>("cacheIndex");
+ QTest::addColumn<uint>("rangeFlags");
+ QTest::addColumn<int>("rangeIndex");
+
+ int listA; void *a = &listA;
+
+ QTest::newRow("Start")
+ << (RangeList()
+ << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 1, 1, int(C::AppendFlag | C::PrependFlag | C::CacheFlag))
+ << Range(0, 0, 1, int(VisibleFlag| C::CacheFlag)))
+ << Selection << 0
+ << 0 << 0 << 0 << 0
+ << uint(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag) << 0;
+ QTest::newRow("1")
+ << (RangeList()
+ << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 1, 1, int(C::AppendFlag | C::PrependFlag | C::CacheFlag))
+ << Range(0, 0, 1, int(VisibleFlag| C::CacheFlag)))
+ << Selection << 1
+ << 1 << 1 << 1 << 3
+ << uint(0) << 0;
+}
+
+void tst_qqmllistcompositor::findInsertPosition()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(C::Group, group);
+ QFETCH(int, index);
+ QFETCH(int, cacheIndex);
+ QFETCH(int, defaultIndex);
+ QFETCH(int, visibleIndex);
+ QFETCH(int, selectionIndex);
+ QFETCH(uint, rangeFlags);
+ QFETCH(int, rangeIndex);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QQmlListCompositor::insert_iterator it = compositor.findInsertPosition(group, index);
+
+ QCOMPARE(it.index[C::Cache], cacheIndex);
+ QCOMPARE(it.index[C::Default], defaultIndex);
+ QCOMPARE(it.index[Visible], visibleIndex);
+ QCOMPARE(it.index[Selection], selectionIndex);
+ QCOMPARE(it->flags, rangeFlags);
+ QCOMPARE(it->index, rangeIndex);
+}
+
+void tst_qqmllistcompositor::insert()
+{
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ C::iterator it;
+
+ int listA; int *a = &listA;
+ int listB; int *b = &listB;
+ int listC; int *c = &listC;
+
+ {
+ compositor.append(a, 0, 12, C::AppendFlag | C::PrependFlag | C::DefaultFlag);
+ const int indexes[] = {0,1,2,3,4,5,6,7,8,9,10,11};
+ const int *lists[] = {a,a,a,a,a,a,a,a,a,a, a, a};
+ QCOMPARE(compositor.count(C::Default), lengthOf(indexes));
+ for (int i = 0; i < lengthOf(indexes); ++i) {
+ it = compositor.find(C::Default, i);
+ QCOMPARE(it.list<int>(), lists[i]);
+ if (lists[i]) QCOMPARE(it.modelIndex(), indexes[i]);
+ }
+ } {
+ compositor.append(b, 4, 4, C::DefaultFlag);
+ const int indexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,4,5,6,7};
+ const int *lists[] = {a,a,a,a,a,a,a,a,a,a, a, a,b,b,b,b};
+ QCOMPARE(compositor.count(C::Default), lengthOf(indexes));
+ for (int i = 0; i < lengthOf(indexes); ++i) {
+ it = compositor.find(C::Default, i);
+ QCOMPARE(it.list<int>(), lists[i]);
+ if (lists[i]) QCOMPARE(it.modelIndex(), indexes[i]);
+ }
+ } { // Insert at end.
+ compositor.insert(
+ C::Default, 16, c, 2, 2, C::DefaultFlag);
+ const int indexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,4,5,6,7,2,3};
+ const int *lists[] = {a,a,a,a,a,a,a,a,a,a, a, a,b,b,b,b,c,c};
+ QCOMPARE(compositor.count(C::Default), lengthOf(indexes));
+ for (int i = 0; i < lengthOf(indexes); ++i) {
+ it = compositor.find(C::Default, i);
+ QCOMPARE(it.list<int>(), lists[i]);
+ if (lists[i]) QCOMPARE(it.modelIndex(), indexes[i]);
+ }
+ } { // Insert at start
+ compositor.insert(
+ C::Default, 0, c, 6, 4, C::DefaultFlag);
+ const int indexes[] = {6,7,8,9,0,1,2,3,4,5,6,7,8,9,10,11,4,5,6,7,2,3};
+ const int *lists[] = {c,c,c,c,a,a,a,a,a,a,a,a,a,a, a, a,b,b,b,b,c,c};
+ for (int i = 0; i < lengthOf(indexes); ++i) {
+ it = compositor.find(C::Default, i);
+ QCOMPARE(it.list<int>(), lists[i]);
+ if (lists[i]) QCOMPARE(it.modelIndex(), indexes[i]);
+ }
+ } { // Insert after static range.
+ compositor.insert(
+ C::Default, 4, b, 0, 8, C::AppendFlag | C::PrependFlag | C::DefaultFlag);
+ const int indexes[] = {6,7,8,9,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,8,9,10,11,4,5,6,7,2,3};
+ const int *lists[] = {c,c,c,c,b,b,b,b,b,b,b,b,a,a,a,a,a,a,a,a,a,a, a, a,b,b,b,b,c,c};
+ QCOMPARE(compositor.count(C::Default), lengthOf(indexes));
+ for (int i = 0; i < lengthOf(indexes); ++i) {
+ it = compositor.find(C::Default, i);
+ QCOMPARE(it.list<int>(), lists[i]);
+ if (lists[i]) QCOMPARE(it.modelIndex(), indexes[i]);
+ }
+ } { // Insert at end of dynamic range.
+ compositor.insert(
+ C::Default, 12, c, 0, 4, C::AppendFlag | C::PrependFlag | C::DefaultFlag);
+ const int indexes[] = {6,7,8,9,0,1,2,3,4,5,6,7,0,1,2,3,0,1,2,3,4,5,6,7,8,9,10,11,4,5,6,7,2,3};
+ const int *lists[] = {c,c,c,c,b,b,b,b,b,b,b,b,c,c,c,c,a,a,a,a,a,a,a,a,a,a, a, a,b,b,b,b,c,c};
+ QCOMPARE(compositor.count(C::Default), lengthOf(indexes));
+ for (int i = 0; i < lengthOf(indexes); ++i) {
+ it = compositor.find(C::Default, i);
+ QCOMPARE(it.list<int>(), lists[i]);
+ if (lists[i]) QCOMPARE(it.modelIndex(), indexes[i]);
+ }
+ } { // Insert into range.
+ compositor.insert(
+ C::Default, 8, c, 0, 4, C::AppendFlag | C::PrependFlag | C::DefaultFlag);
+ const int indexes[] = {6,7,8,9,0,1,2,3,0,1,2,3,4,5,6,7,0,1,2,3,0,1,2,3,4,5,6,7,8,9,10,11,4,5,6,7,2,3};
+ const int *lists[] = {c,c,c,c,b,b,b,b,c,c,c,c,b,b,b,b,c,c,c,c,a,a,a,a,a,a,a,a,a,a, a, a,b,b,b,b,c,c};
+ QCOMPARE(compositor.count(C::Default), lengthOf(indexes));
+ for (int i = 0; i < lengthOf(indexes); ++i) {
+ it = compositor.find(C::Default, i);
+ QCOMPARE(it.list<int>(), lists[i]);
+ if (lists[i]) QCOMPARE(it.modelIndex(), indexes[i]);
+ }
+ }
+}
+
+void tst_qqmllistcompositor::clearFlags_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<C::Group>("group");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<int>("flags");
+ QTest::addColumn<RemoveList>("expectedRemoves");
+ QTest::addColumn<IndexArray>("cacheIndexes");
+ QTest::addColumn<ListArray>("cacheLists");
+ QTest::addColumn<IndexArray>("defaultIndexes");
+ QTest::addColumn<ListArray>("defaultLists");
+ QTest::addColumn<IndexArray>("visibleIndexes");
+ QTest::addColumn<ListArray>("visibleLists");
+ QTest::addColumn<IndexArray>("selectionIndexes");
+ QTest::addColumn<ListArray>("selectionLists");
+
+ int listA; void *a = &listA;
+
+ { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ static const int visibleIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *visibleLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ QTest::newRow("Default, 2, 2, Selection")
+ << (RangeList()
+ << Range(a, 0, 12, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(0, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)))
+ << C::Default << 2 << 2 << int(SelectionFlag)
+ << (RemoveList()
+ << Remove(2, 2, 2, 2, 2, SelectionFlag | C::CacheFlag))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ QTest::newRow("Selection, 1, 2, Visible")
+ << (RangeList()
+ << Range(a, 0, 2, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 2, 2, int(C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 4, 8, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(0, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)))
+ << Selection << 1 << 2 << int(VisibleFlag)
+ << (RemoveList()
+ << Remove(1, 1, 1, 1, 1, VisibleFlag | C::CacheFlag)
+ << Remove(2, 3, 4, 4, 1, VisibleFlag | C::CacheFlag))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0};
+ static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0};
+ static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,11,0,0,0};
+ static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0};
+ static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0};
+ static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0};
+ QTest::newRow("Default, 13, 1, Prepend | Selection | Visible | Default")
+ << (RangeList()
+ << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 1, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 2, 2, int(C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 4, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 5, 7, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(0, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)))
+ << C::Default << 13 << 1 << int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag)
+ << (RemoveList()
+ << Remove(11, 11, 13, 13, 1, SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,0};
+ static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0};
+ static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,11,0,0,0};
+ static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0};
+ static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0};
+ static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0};
+ QTest::newRow("Cache, 11, 4, Cache")
+ << (RangeList()
+ << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 1, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 2, 2, int(C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 4, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 5, 7, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(0, 0, 1, int(C::CacheFlag))
+ << Range(0, 0, 3, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)))
+ << C::Cache << 11 << 4 << int(C::CacheFlag)
+ << (RemoveList())
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,0};
+ static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,0};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a,0};
+ static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,0};
+ static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a,0};
+ static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,0};
+ static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a,0};
+ QTest::newRow("Default, 11, 3, Default | Visible | Selection")
+ << (RangeList()
+ << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 1, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 2, 2, int(C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 4, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 5, 6, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << Range(a, 11, 1, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag))
+ << Range(0, 0, 2, int(SelectionFlag | VisibleFlag | C::DefaultFlag))
+ << Range(0, 0, 1, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)))
+ << C::Default << 11 << 3 << int(C::DefaultFlag | VisibleFlag| SelectionFlag)
+ << (RemoveList()
+ << Remove(9, 9, 11, 11, 1, SelectionFlag | VisibleFlag | C::DefaultFlag)
+ << Remove(9, 9, 11, 11, 2, SelectionFlag | VisibleFlag | C::DefaultFlag))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ }
+}
+
+void tst_qqmllistcompositor::clearFlags()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(C::Group, group);
+ QFETCH(int, index);
+ QFETCH(int, count);
+ QFETCH(int, flags);
+ QFETCH(RemoveList, expectedRemoves);
+ QFETCH(IndexArray, cacheIndexes);
+ QFETCH(ListArray, cacheLists);
+ QFETCH(IndexArray, defaultIndexes);
+ QFETCH(ListArray, defaultLists);
+ QFETCH(IndexArray, visibleIndexes);
+ QFETCH(ListArray, visibleLists);
+ QFETCH(IndexArray, selectionIndexes);
+ QFETCH(ListArray, selectionLists);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QVector<C::Remove> removes;
+ compositor.clearFlags(group, index, count, flags, &removes);
+
+ QCOMPARE(removes, expectedRemoves);
+
+ QCOMPARE(compositor.count(C::Cache), cacheIndexes.count);
+ for (int i = 0; i < cacheIndexes.count; ++i) {
+ C::iterator it = compositor.find(C::Cache, i);
+ QCOMPARE(it->list, cacheLists[i]);
+ if (cacheLists[i])
+ QCOMPARE(it.modelIndex(), cacheIndexes[i]);
+ }
+ QCOMPARE(compositor.count(C::Default), defaultIndexes.count);
+ for (int i = 0; i < defaultIndexes.count; ++i) {
+ C::iterator it = compositor.find(C::Default, i);
+ QCOMPARE(it->list, defaultLists[i]);
+ if (defaultLists[i])
+ QCOMPARE(it.modelIndex(), defaultIndexes[i]);
+ }
+ QCOMPARE(compositor.count(Visible), visibleIndexes.count);
+ for (int i = 0; i < visibleIndexes.count; ++i) {
+ C::iterator it = compositor.find(Visible, i);
+ QCOMPARE(it->list, visibleLists[i]);
+ if (visibleLists[i])
+ QCOMPARE(it.modelIndex(), visibleIndexes[i]);
+ }
+ QCOMPARE(compositor.count(Selection), selectionIndexes.count);
+ for (int i = 0; i < selectionIndexes.count; ++i) {
+ C::iterator it = compositor.find(Selection, i);
+ QCOMPARE(it->list, selectionLists[i]);
+ if (selectionLists[i])
+ QCOMPARE(it.modelIndex(), selectionIndexes[i]);
+ }
+}
+
+void tst_qqmllistcompositor::setFlags_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<C::Group>("group");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<int>("flags");
+ QTest::addColumn<InsertList>("expectedInserts");
+ QTest::addColumn<IndexArray>("cacheIndexes");
+ QTest::addColumn<ListArray>("cacheLists");
+ QTest::addColumn<IndexArray>("defaultIndexes");
+ QTest::addColumn<ListArray>("defaultLists");
+ QTest::addColumn<IndexArray>("visibleIndexes");
+ QTest::addColumn<ListArray>("visibleLists");
+ QTest::addColumn<IndexArray>("selectionIndexes");
+ QTest::addColumn<ListArray>("selectionLists");
+
+ int listA; void *a = &listA;
+
+ { static const int cacheIndexes[] = {0,0,0,0};
+ static const void *cacheLists[] = {0,0,0,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a};
+ QTest::newRow("Default, 2, 2, Default")
+ << (RangeList()
+ << Range(a, 0, 12, C::DefaultFlag)
+ << Range(0, 0, 4, C::CacheFlag))
+ << C::Default << 2 << 2 << int(C::DefaultFlag)
+ << (InsertList())
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray() << ListArray()
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {0,0,0,0};
+ static const void *cacheLists[] = {0,0,0,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a};
+ static const int visibleIndexes[] = {2,3};
+ static const void *visibleLists[] = {a,a};
+ QTest::newRow("Default, 2, 2, Visible")
+ << (RangeList()
+ << Range(a, 0, 12, C::DefaultFlag)
+ << Range(0, 0, 4, C::CacheFlag))
+ << C::Default << 2 << 2 << int(VisibleFlag)
+ << (InsertList()
+ << Insert(0, 0, 2, 0, 2, VisibleFlag))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {3,6,0,0,0,0};
+ static const void *cacheLists[] = {a,a,0,0,0,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a};
+ static const int visibleIndexes[] = {2,3,6,7};
+ static const void *visibleLists[] = {a,a,a,a};
+ static const int selectionIndexes[] = {3,6};
+ static const void *selectionLists[] = {a,a};
+ QTest::newRow("Visible, 1, 2, Selection | Cache")
+ << (RangeList()
+ << Range(a, 0, 2, C::DefaultFlag)
+ << Range(a, 2, 2, VisibleFlag | C::DefaultFlag)
+ << Range(a, 4, 2, C::DefaultFlag)
+ << Range(a, 6, 2, VisibleFlag | C::DefaultFlag)
+ << Range(a, 8, 4, C::DefaultFlag)
+ << Range(0, 0, 4, C::CacheFlag))
+ << Visible << 1 << 2 << int(SelectionFlag | C::CacheFlag)
+ << (InsertList()
+ << Insert(0, 1, 3, 0, 1, SelectionFlag | C::CacheFlag)
+ << Insert(1, 2, 6, 1, 1, SelectionFlag | C::CacheFlag))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ } { static const int cacheIndexes[] = {3,6,0,0,0,0};
+ static const void *cacheLists[] = {a,a,0,0,0,0};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a};
+ static const int visibleIndexes[] = {2,3,6,7,0};
+ static const void *visibleLists[] = {a,a,a,a,0};
+ static const int selectionIndexes[] = {3,6};
+ static const void *selectionLists[] = {a,a};
+ QTest::newRow("Cache, 3, 1, Visible")
+ << (RangeList()
+ << Range(a, 0, 2, C::DefaultFlag)
+ << Range(a, 2, 1, VisibleFlag | C::DefaultFlag)
+ << Range(a, 3, 1, SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 4, 2, C::DefaultFlag)
+ << Range(a, 6, 1, SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 7, 1, VisibleFlag | C::DefaultFlag)
+ << Range(a, 8, 4, C::DefaultFlag)
+ << Range(0, 0, 4, C::CacheFlag))
+ << C::Cache << 3 << 1 << int(VisibleFlag)
+ << (InsertList()
+ << Insert(2, 4, 12, 3, 1, VisibleFlag | C::CacheFlag))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11};
+ static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a};
+ static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a};
+ static const int visibleIndexes[] = {0,1,3,4,5,6,7,8,9,10,11};
+ static const void *visibleLists[] = {a,a,a,a,a,a,a,a,a, a, a};
+ static const int selectionIndexes[] = {2,6,7,8,9};
+ static const void *selectionLists[] = {a,a,a,a,a};
+ QTest::newRow("Existing flag, sparse selection")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 1, C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 3, 3, C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 6, 4, C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a,10, 2, C::AppendFlag | C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))
+ << C::Cache << 3 << 1 << int(VisibleFlag)
+ << InsertList()
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray(selectionIndexes) << ListArray(selectionLists);
+ }
+}
+
+void tst_qqmllistcompositor::setFlags()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(C::Group, group);
+ QFETCH(int, index);
+ QFETCH(int, count);
+ QFETCH(int, flags);
+ QFETCH(InsertList, expectedInserts);
+ QFETCH(IndexArray, cacheIndexes);
+ QFETCH(ListArray, cacheLists);
+ QFETCH(IndexArray, defaultIndexes);
+ QFETCH(ListArray, defaultLists);
+ QFETCH(IndexArray, visibleIndexes);
+ QFETCH(ListArray, visibleLists);
+ QFETCH(IndexArray, selectionIndexes);
+ QFETCH(ListArray, selectionLists);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QVector<C::Insert> inserts;
+ compositor.setFlags(group, index, count, flags, &inserts);
+
+ QCOMPARE(inserts, expectedInserts);
+
+ QCOMPARE(compositor.count(C::Cache), cacheIndexes.count);
+ for (int i = 0; i < cacheIndexes.count; ++i) {
+ C::iterator it = compositor.find(C::Cache, i);
+ QCOMPARE(it->list, cacheLists[i]);
+ if (cacheLists[i])
+ QCOMPARE(it.modelIndex(), cacheIndexes[i]);
+ }
+ QCOMPARE(compositor.count(C::Default), defaultIndexes.count);
+ for (int i = 0; i < defaultIndexes.count; ++i) {
+ C::iterator it = compositor.find(C::Default, i);
+ QCOMPARE(it->list, defaultLists[i]);
+ if (defaultLists[i])
+ QCOMPARE(it.modelIndex(), defaultIndexes[i]);
+ }
+ QCOMPARE(compositor.count(Visible), visibleIndexes.count);
+ for (int i = 0; i < visibleIndexes.count; ++i) {
+ C::iterator it = compositor.find(Visible, i);
+ QCOMPARE(it->list, visibleLists[i]);
+ if (visibleLists[i])
+ QCOMPARE(it.modelIndex(), visibleIndexes[i]);
+ }
+ QCOMPARE(compositor.count(Selection), selectionIndexes.count);
+ for (int i = 0; i < selectionIndexes.count; ++i) {
+ C::iterator it = compositor.find(Selection, i);
+ QCOMPARE(it->list, selectionLists[i]);
+ if (selectionLists[i])
+ QCOMPARE(it.modelIndex(), selectionIndexes[i]);
+ }
+}
+
+void tst_qqmllistcompositor::move_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<C::Group>("fromGroup");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<C::Group>("toGroup");
+ QTest::addColumn<int>("to");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<RemoveList>("expectedRemoves");
+ QTest::addColumn<InsertList>("expectedInserts");
+ QTest::addColumn<IndexArray>("cacheIndexes");
+ QTest::addColumn<ListArray>("cacheLists");
+ QTest::addColumn<IndexArray>("defaultIndexes");
+ QTest::addColumn<ListArray>("defaultLists");
+ QTest::addColumn<IndexArray>("visibleIndexes");
+ QTest::addColumn<ListArray>("visibleLists");
+ QTest::addColumn<IndexArray>("selectionIndexes");
+ QTest::addColumn<ListArray>("selectionLists");
+
+ int listA; void *a = &listA;
+ int listB; void *b = &listB;
+ int listC; void *c = &listC;
+
+ { static const int cacheIndexes[] = {0,0,0,0,2,3};
+ static const void *cacheLists[] = {0,0,0,0,c,c};
+ static const int defaultIndexes[] = {0,0,1,2,3,4,5,0,1,2,3,4,5,1,2,3,0,1,2,3,4,5};
+ static const void *defaultLists[] = {0,a,a,a,a,a,a,b,b,b,b,b,b,0,0,0,c,c,c,c,c,c};
+ QTest::newRow("15, 0, 1")
+ << (RangeList()
+ << Range(a, 0, 6, C::DefaultFlag)
+ << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(0, 0, 4, C::DefaultFlag | C::CacheFlag)
+ << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag))
+ << C::Default << 15 << C::Default << 0 << 1
+ << (RemoveList()
+ << Remove(0, 0, 15, 3, 1, C::DefaultFlag | C::CacheFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 0, 0, 1, C::DefaultFlag | C::CacheFlag, 0))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray() << ListArray()
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {0,0,0,0,2,3};
+ static const void *cacheLists[] = {0,0,0,0,c,c};
+ static const int defaultIndexes[] = {0,1,0,1,2,3,4,5,0,1,2,3,4,5,2,3,0,1,2,3,4,5};
+ static const void *defaultLists[] = {0,0,a,a,a,a,a,a,b,b,b,b,b,b,0,0,c,c,c,c,c,c};
+ QTest::newRow("15, 1, 1")
+ << (RangeList()
+ << Range(0, 0, 1, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 6, C::DefaultFlag)
+ << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(0, 0, 3, C::DefaultFlag | C::CacheFlag)
+ << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag))
+ << C::Default << 15 << C::Default << 1 << 1
+ << (RemoveList()
+ << Remove(0, 0, 15, 3, 1, C::DefaultFlag | C::CacheFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 1, 1, 1, C::DefaultFlag | C::CacheFlag, 0))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray() << ListArray()
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {0,0,0,0,2,3};
+ static const void *cacheLists[] = {0,0,0,0,c,c};
+ static const int defaultIndexes[] = {0,1,2,0,1,3,4,5,0,1,2,3,4,5,2,3,0,1,2,3,4,5};
+ static const void *defaultLists[] = {a,a,a,0,0,a,a,a,b,b,b,b,b,b,0,0,c,c,c,c,c,c};
+ QTest::newRow("0, 3, 2")
+ << (RangeList()
+ << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 6, C::DefaultFlag)
+ << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag)
+ << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag))
+ << C::Default << 0 << C::Default << 3 << 2
+ << (RemoveList()
+ << Remove(0, 0, 0, 0, 2, C::DefaultFlag | C::CacheFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 3, 0, 2, C::DefaultFlag | C::CacheFlag, 0))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray() << ListArray()
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {0,0,0,0,2,3};
+ static const void *cacheLists[] = {0,0,0,0,c,c};
+ static const int defaultIndexes[] = {0,5,0,1,2,3,4,5,0,1,0,1,2,2,3,3,4,1,2,3,4,5};
+ static const void *defaultLists[] = {a,a,b,b,b,b,b,b,0,0,c,a,a,0,0,a,a,c,c,c,c,c};
+ QTest::newRow("7, 1, 10")
+ << (RangeList()
+ << Range(a, 0, 3, C::DefaultFlag)
+ << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 3, 3, C::DefaultFlag)
+ << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag)
+ << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag))
+ << C::Default << 7 << C::Default << 1 << 10
+ << (RemoveList()
+ << Remove(0, 0, 7, 2, 1, C::DefaultFlag, 0)
+ << Remove(0, 0, 7, 2, 6, C::DefaultFlag, 1)
+ << Remove(0, 0, 7, 2, 2, C::DefaultFlag | C::CacheFlag, 2)
+ << Remove(0, 0, 7, 2, 1, C::DefaultFlag, 3))
+ << (InsertList()
+ << Insert(0, 0, 1, 0, 1, C::DefaultFlag, 0)
+ << Insert(0, 0, 2, 0, 6, C::DefaultFlag, 1)
+ << Insert(0, 0, 8, 0, 2, C::DefaultFlag | C::CacheFlag, 2)
+ << Insert(0, 0, 10, 2, 1, C::DefaultFlag, 3))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray() << ListArray()
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {0,0,0,0,3,2};
+ static const void *cacheLists[] = {0,0,0,0,c,c};
+ static const int defaultIndexes[] = {0,5,0,1,2,3,4,5,0,1,0,1,2,2,3,3,4,3,4,5,1,2};
+ static const void *defaultLists[] = {a,a,b,b,b,b,b,b,0,0,c,a,a,0,0,a,a,c,c,c,c,c};
+ QTest::newRow("17, 20, 2")
+ << (RangeList()
+ << Range(a, 0, 1, C::DefaultFlag)
+ << Range(a, 5, 1, C::DefaultFlag)
+ << Range(b, 0, 6, C::DefaultFlag)
+ << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag)
+ << Range(c, 0, 1, C::DefaultFlag)
+ << Range(a, 1, 2, C::DefaultFlag)
+ << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 3, 2, C::DefaultFlag)
+ << Range(b, 0, 6, C::AppendFlag | C::PrependFlag)
+ << Range(c, 0, 1, C::PrependFlag)
+ << Range(c, 1, 1, C::PrependFlag | C::DefaultFlag)
+ << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag))
+ << C::Default << 17 << C::Default << 20 << 2
+ << (RemoveList()
+ << Remove(0, 0, 17, 4, 1, C::DefaultFlag, 0)
+ << Remove(0, 0, 17, 4, 1, C::DefaultFlag | C::CacheFlag, 1))
+ << (InsertList()
+ << Insert(0, 0, 20, 5, 1, C::DefaultFlag, 0)
+ << Insert(0, 0, 21, 5, 1, C::DefaultFlag | C::CacheFlag, 1))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray() << ListArray()
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {8,9,10,4,11,0,1,2,3,5,6,7};
+ static const void *cacheLists[] = {a,a, a,a, a,a,a,a,a,a,a,a};
+ static const int defaultIndexes[] = {8,9,10,4,11,0,1,2,3,5,6,7};
+ static const void *defaultLists[] = {a,a, a,a, a,a,a,a,a,a,a,a};
+ static const int visibleIndexes[] = {8,9,10,4,11,0,1,2,3,5,6,7};
+ static const void *visibleLists[] = {a,a, a,a, a,a,a,a,a,a,a,a};
+ QTest::newRow("3, 4, 5")
+ << (RangeList()
+ << Range(a, 8, 4, VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 2, C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 1, C::PrependFlag)
+ << Range(a, 2, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 3, 5, C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 8, 4, C::AppendFlag | C::PrependFlag))
+ << C::Default << 3 << C::Default << 4 << 5
+ << (RemoveList()
+ << Remove(0, 3, 3, 3, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 0)
+ << Remove(0, 3, 3, 3, 2, VisibleFlag | C::DefaultFlag | C::CacheFlag, 1)
+ << Remove(0, 3, 3, 3, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 2)
+ << Remove(0, 3, 3, 3, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 3))
+ << (InsertList()
+ << Insert(0, 4, 4, 4, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 0)
+ << Insert(0, 5, 5, 5, 2, VisibleFlag | C::DefaultFlag | C::CacheFlag, 1)
+ << Insert(0, 7, 7, 7, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 2)
+ << Insert(0, 8, 8, 8, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 3))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {0,1};
+ static const void *cacheLists[] = {a,a};
+ static const int defaultIndexes[] = {0,1};
+ static const void *defaultLists[] = {a,a};
+ QTest::newRow("0, 1, 1")
+ << (RangeList()
+ << Range(a, 0, 1, C::PrependFlag)
+ << Range(a, 1, 1, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 0, C::AppendFlag | C::PrependFlag)
+ << Range(a, 0, 1, C::DefaultFlag | C::CacheFlag))
+ << C::Default << 0 << C::Default << 1 << 1
+ << (RemoveList()
+ << Remove(0, 0, 0, 0, 1, C::DefaultFlag | C::CacheFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 1, 1, 1, C::DefaultFlag | C::CacheFlag, 0))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray() << ListArray()
+ << IndexArray() << ListArray();
+ } { static const int cacheIndexes[] = {1,2,3,4,5,6,0,8,9};
+ static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a};
+ static const int defaultIndexes[] = {1,2,3,4,5,6,0,8,9};
+ static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a};
+ static const int visibleIndexes[] = {0,7,10};
+ static const void *visibleLists[] = {a,a, a};
+ QTest::newRow("0, 6, 3")
+ << (RangeList()
+ << Range(a, 0, 1, C::PrependFlag)
+ << Range(a, 1, 6, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 7, 1, VisibleFlag)
+ << Range(a,10, 1, VisibleFlag)
+ << Range(a, 7, 1, C::PrependFlag)
+ << Range(a, 8, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << Visible << 0 << C::Default << 6 << 3
+ << (RemoveList()
+ << Remove(0, 0, 6, 6, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 0)
+ << Remove(0, 0, 6, 6, 1, VisibleFlag, 1)
+ << Remove(0, 0, 6, 6, 1, VisibleFlag, 2))
+ << (InsertList()
+ << Insert(0, 0, 6, 6, 1, VisibleFlag | C::DefaultFlag | C::CacheFlag, 0)
+ << Insert(0, 1, 7, 7, 1, VisibleFlag, 1)
+ << Insert(0, 2, 7, 7, 1, VisibleFlag, 2))
+ << IndexArray(cacheIndexes) << ListArray(cacheLists)
+ << IndexArray(defaultIndexes) << ListArray(defaultLists)
+ << IndexArray(visibleIndexes) << ListArray(visibleLists)
+ << IndexArray() << ListArray();
+ }
+}
+
+void tst_qqmllistcompositor::move()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(C::Group, fromGroup);
+ QFETCH(int, from);
+ QFETCH(C::Group, toGroup);
+ QFETCH(int, to);
+ QFETCH(int, count);
+ QFETCH(RemoveList, expectedRemoves);
+ QFETCH(InsertList, expectedInserts);
+ QFETCH(IndexArray, cacheIndexes);
+ QFETCH(ListArray, cacheLists);
+ QFETCH(IndexArray, defaultIndexes);
+ QFETCH(ListArray, defaultLists);
+ QFETCH(IndexArray, visibleIndexes);
+ QFETCH(ListArray, visibleLists);
+ QFETCH(IndexArray, selectionIndexes);
+ QFETCH(ListArray, selectionLists);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QVector<C::Remove> removes;
+ QVector<C::Insert> inserts;
+ compositor.move(fromGroup, from, toGroup, to, count, fromGroup, &removes, &inserts);
+
+ QCOMPARE(removes, expectedRemoves);
+ QCOMPARE(inserts, expectedInserts);
+
+ QCOMPARE(compositor.count(C::Cache), cacheIndexes.count);
+ for (int i = 0; i < cacheIndexes.count; ++i) {
+ C::iterator it = compositor.find(C::Cache, i);
+ QCOMPARE(it->list, cacheLists[i]);
+ if (cacheLists[i])
+ QCOMPARE(it.modelIndex(), cacheIndexes[i]);
+ }
+ QCOMPARE(compositor.count(C::Default), defaultIndexes.count);
+ for (int i = 0; i < defaultIndexes.count; ++i) {
+ C::iterator it = compositor.find(C::Default, i);
+ QCOMPARE(it->list, defaultLists[i]);
+ if (defaultLists[i])
+ QCOMPARE(it.modelIndex(), defaultIndexes[i]);
+ }
+ QCOMPARE(compositor.count(Visible), visibleIndexes.count);
+ for (int i = 0; i < visibleIndexes.count; ++i) {
+ C::iterator it = compositor.find(Visible, i);
+ QCOMPARE(it->list, visibleLists[i]);
+ if (visibleLists[i])
+ QCOMPARE(it.modelIndex(), visibleIndexes[i]);
+ }
+ QCOMPARE(compositor.count(Selection), selectionIndexes.count);
+ for (int i = 0; i < selectionIndexes.count; ++i) {
+ C::iterator it = compositor.find(Selection, i);
+ QCOMPARE(it->list, selectionLists[i]);
+ if (selectionLists[i])
+ QCOMPARE(it.modelIndex(), selectionIndexes[i]);
+ }
+}
+
+void tst_qqmllistcompositor::moveFromEnd()
+{
+ int listA; void *a = &listA;
+
+ QQmlListCompositor compositor;
+ compositor.append(a, 0, 1, C::AppendFlag | C::PrependFlag | C::DefaultFlag);
+
+ // Moving an item anchors it to that position.
+ compositor.move(C::Default, 0, C::Default, 0, 1, C::Default);
+
+ // The existing item is anchored at 0 so prepending an item to the source will append it here
+ QVector<C::Insert> inserts;
+ compositor.listItemsInserted(a, 0, 1, &inserts);
+
+ QCOMPARE(inserts.count(), 1);
+ QCOMPARE(inserts.at(0).index[1], 1);
+ QCOMPARE(inserts.at(0).count, 1);
+
+ C::iterator it;
+ it = compositor.find(C::Default, 0);
+ QCOMPARE(it.modelIndex(), 1);
+
+ it = compositor.find(C::Default, 1);
+ QCOMPARE(it.modelIndex(), 0);
+}
+
+void tst_qqmllistcompositor::clear()
+{
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ int listA; void *a = &listA;
+ int listB; void *b = &listB;
+
+ compositor.append(a, 0, 8, C::AppendFlag | C::PrependFlag | VisibleFlag | C::DefaultFlag);
+ compositor.append(b, 4, 5, VisibleFlag | C::DefaultFlag);
+ compositor.append(0, 0, 3, VisibleFlag | C::DefaultFlag | C::CacheFlag);
+
+ QCOMPARE(compositor.count(C::Default), 16);
+ QCOMPARE(compositor.count(Visible), 16);
+ QCOMPARE(compositor.count(C::Cache), 3);
+
+ compositor.clear();
+ QCOMPARE(compositor.count(C::Default), 0);
+ QCOMPARE(compositor.count(Visible), 0);
+ QCOMPARE(compositor.count(C::Cache), 0);
+}
+
+void tst_qqmllistcompositor::listItemsInserted_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<void *>("list");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<InsertList>("expectedInserts");
+ QTest::addColumn<IndexArray>("cacheIndexes");
+ QTest::addColumn<IndexArray>("defaultIndexes");
+ QTest::addColumn<IndexArray>("visibleIndexes");
+ QTest::addColumn<IndexArray>("selectionIndexes");
+
+ int listA; void *a = &listA;
+ int listB; void *b = &listB;
+
+ { static const int defaultIndexes[] = {/*A*/0,1,5,6,/*B*/0,1,2,3,/*A*/2,3,4};
+ QTest::newRow("A 10, 2")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 2, 3, C::PrependFlag)
+ << Range(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 2, 3, C::DefaultFlag))
+ << a << 10 << 2
+ << InsertList()
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int defaultIndexes[] = {/*A*/0,1,5,6,/*B*/0,1,2,3,/*A*/2,3,4};
+ QTest::newRow("B 10, 2")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 2, 3, C::PrependFlag)
+ << Range(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 2, 3, C::DefaultFlag))
+ << b << 10 << 2
+ << InsertList()
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int defaultIndexes[] = {/*A*/0,1,2,3,7,8,/*B*/0,1,2,3,/*A*/4,5,6};
+ static const int visibleIndexes[] = {/*A*/0,1};
+ QTest::newRow("A 0, 2")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 2, 3, C::PrependFlag)
+ << Range(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 2, 3, C::DefaultFlag))
+ << a << 0 << 2
+ << (InsertList()
+ << Insert(0, 0, 0, 0, 2, VisibleFlag | C::DefaultFlag))
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray(visibleIndexes)
+ << IndexArray();
+ } { static const int defaultIndexes[] = {/*A*/0,1,2,3,5,8,9,/*B*/0,1,2,3,/*A*/4,6,7};
+ static const int visibleIndexes[] = {/*A*/0,1,5};
+ QTest::newRow("A 5, 1")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | VisibleFlag | C::DefaultFlag)
+ << Range(a, 2, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 4, 3, C::PrependFlag)
+ << Range(a, 7, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 4, 3, C::DefaultFlag))
+ << a << 5 << 1
+ << (InsertList()
+ << Insert(0, 2, 4, 0, 1, VisibleFlag | C::DefaultFlag))
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray(visibleIndexes)
+ << IndexArray();
+ } { static const int defaultIndexes[] = {/*A*/0,1,2,3,5,8,9,10,11,/*B*/0,1,2,3,/*A*/4,6,7};
+ static const int visibleIndexes[] = {/*A*/0,1,5,10,11};
+ QTest::newRow("A 10, 2")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | VisibleFlag | C::DefaultFlag)
+ << Range(a, 2, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 4, 1, C::PrependFlag)
+ << Range(a, 5, 1, C::PrependFlag | VisibleFlag | C::DefaultFlag)
+ << Range(a, 6, 2, C::PrependFlag)
+ << Range(a, 8, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 4, 1, C::DefaultFlag)
+ << Range(a, 6, 2, C::DefaultFlag))
+ << a << 10 << 2
+ << (InsertList()
+ << Insert(0, 3, 7, 0, 2, VisibleFlag | C::DefaultFlag))
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray(visibleIndexes)
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/0,1,-1,-1,-1,2,5,6,7,8,9};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5,6,7,8,9};
+ static const int visibleIndexes[] = {/*A*/3,4};
+ QTest::newRow("Insert after remove")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 3, C::CacheFlag)
+ << Range(a, 2, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << a << 3 << 2
+ << (InsertList()
+ << Insert(0, 0, 3, 6, 2, VisibleFlag | C::DefaultFlag))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray(visibleIndexes)
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/0,1,2,3,4};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5,6};
+ static const int visibleIndexes[] = {/*A*/0,1,2,3,4,5,6};
+ QTest::newRow("Consecutive appends")
+ << (RangeList()
+ << Range(a, 0, 5, C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 5, 1, C::PrependFlag | VisibleFlag | C::DefaultFlag)
+ << Range(a, 6, 0, C::AppendFlag | VisibleFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << a << 6 << 1
+ << (InsertList()
+ << Insert(0, 6, 6, 5, 1, VisibleFlag | C::DefaultFlag))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray(visibleIndexes)
+ << IndexArray();
+ }
+}
+
+void tst_qqmllistcompositor::listItemsInserted()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(void *, list);
+ QFETCH(int, index);
+ QFETCH(int, count);
+ QFETCH(InsertList, expectedInserts);
+ QFETCH(IndexArray, cacheIndexes);
+ QFETCH(IndexArray, defaultIndexes);
+ QFETCH(IndexArray, visibleIndexes);
+ QFETCH(IndexArray, selectionIndexes);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QVector<C::Insert> inserts;
+ compositor.listItemsInserted(list, index, count, &inserts);
+
+ QCOMPARE(inserts, expectedInserts);
+
+ QCOMPARE(compositor.count(C::Cache), cacheIndexes.count);
+ for (int i = 0; i < cacheIndexes.count; ++i) {
+ if (cacheIndexes[i] != -1) {
+ QCOMPARE(compositor.find(C::Cache, i).modelIndex(), cacheIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(C::Default), defaultIndexes.count);
+ for (int i = 0; i < defaultIndexes.count; ++i) {
+ if (defaultIndexes[i] != -1) {
+ QCOMPARE(compositor.find(C::Default, i).modelIndex(), defaultIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(Visible), visibleIndexes.count);
+ for (int i = 0; i < visibleIndexes.count; ++i) {
+ if (visibleIndexes[i] != -1) {
+ QCOMPARE(compositor.find(Visible, i).modelIndex(), visibleIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(Selection), selectionIndexes.count);
+ for (int i = 0; i < selectionIndexes.count; ++i) {
+ if (selectionIndexes[i] != -1) {
+ QCOMPARE(compositor.find(Selection, i).modelIndex(), selectionIndexes[i]);
+ }
+ }
+}
+
+void tst_qqmllistcompositor::listItemsRemoved_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<void *>("list");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<RemoveList>("expectedRemoves");
+ QTest::addColumn<IndexArray>("cacheIndexes");
+ QTest::addColumn<IndexArray>("defaultIndexes");
+ QTest::addColumn<IndexArray>("visibleIndexes");
+ QTest::addColumn<IndexArray>("selectionIndexes");
+
+ int listA; void *a = &listA;
+ int listB; void *b = &listB;
+
+ { static const int defaultIndexes[] = {/*A*/0,1,5,6,/*B*/0,1,2,3,/*A*/2,3,4};
+ QTest::newRow("12, 2")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 2, 3, C::PrependFlag)
+ << Range(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 2, 3, C::DefaultFlag))
+ << a << 12 << 2
+ << RemoveList()
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int defaultIndexes[] = {/*A*/0,1,/*B*/0,1,2,3,/*A*/2,3};
+ QTest::newRow("4, 3")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 2, 3, C::PrependFlag)
+ << Range(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 2, 3, C::DefaultFlag))
+ << a << 4 << 3
+ << (RemoveList()
+ << Remove(0, 0, 2, 0, 2, C::DefaultFlag)
+ << Remove(0, 0, 8, 0, 1, C::DefaultFlag))
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/0,1,-1,-1,-1,2,-1,-1,3,4,5};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5};
+ QTest::newRow("Remove after remove")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 3, C::CacheFlag)
+ << Range(a, 2, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << a << 3 << 2
+ << (RemoveList()
+ << Remove(0, 0, 3, 6, 2, C::DefaultFlag | C::CacheFlag))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/-1,-1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5,6};
+ QTest::newRow("Sparse remove")
+ << (RangeList()
+ << Range(a, 0, 2, C::CacheFlag)
+ << Range(a, 0, 1, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 1, C::CacheFlag)
+ << Range(a, 1, 5, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 1, C::CacheFlag)
+ << Range(a, 6, 2, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 1, C::CacheFlag)
+ << Range(a, 8, 3, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 0, 1, C::CacheFlag)
+ << Range(a, 11, 1, C::DefaultFlag | C::CacheFlag)
+ << Range(a, 12, 5, C::DefaultFlag))
+ << a << 1 << 10
+ << (RemoveList()
+ << Remove(0, 0, 1, 4, 5, C::DefaultFlag | C::CacheFlag)
+ << Remove(0, 0, 1,10, 2, C::DefaultFlag | C::CacheFlag)
+ << Remove(0, 0, 1,13, 3, C::DefaultFlag | C::CacheFlag))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ }
+}
+
+void tst_qqmllistcompositor::listItemsRemoved()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(void *, list);
+ QFETCH(int, index);
+ QFETCH(int, count);
+ QFETCH(RemoveList, expectedRemoves);
+ QFETCH(IndexArray, cacheIndexes);
+ QFETCH(IndexArray, defaultIndexes);
+ QFETCH(IndexArray, visibleIndexes);
+ QFETCH(IndexArray, selectionIndexes);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QVector<C::Remove> removes;
+ compositor.listItemsRemoved(list, index, count, &removes);
+
+ QCOMPARE(removes, expectedRemoves);
+
+ QCOMPARE(compositor.count(C::Cache), cacheIndexes.count);
+ for (int i = 0; i < cacheIndexes.count; ++i) {
+ if (cacheIndexes[i] != -1) {
+ QCOMPARE(compositor.find(C::Cache, i).modelIndex(), cacheIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(C::Default), defaultIndexes.count);
+ for (int i = 0; i < defaultIndexes.count; ++i) {
+ if (defaultIndexes[i] != -1) {
+ QCOMPARE(compositor.find(C::Default, i).modelIndex(), defaultIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(Visible), visibleIndexes.count);
+ for (int i = 0; i < visibleIndexes.count; ++i) {
+ if (visibleIndexes[i] != -1) {
+ QCOMPARE(compositor.find(Visible, i).modelIndex(), visibleIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(Selection), selectionIndexes.count);
+ for (int i = 0; i < selectionIndexes.count; ++i) {
+ if (selectionIndexes[i] != -1) {
+ QCOMPARE(compositor.find(Selection, i).modelIndex(), selectionIndexes[i]);
+ }
+ }
+}
+
+void tst_qqmllistcompositor::listItemsMoved_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<void *>("list");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<int>("to");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<RemoveList>("expectedRemoves");
+ QTest::addColumn<InsertList>("expectedInserts");
+ QTest::addColumn<IndexArray>("cacheIndexes");
+ QTest::addColumn<IndexArray>("defaultIndexes");
+ QTest::addColumn<IndexArray>("visibleIndexes");
+ QTest::addColumn<IndexArray>("selectionIndexes");
+
+ int listA; void *a = &listA;
+ int listB; void *b = &listB;
+
+ { static const int defaultIndexes[] = {/*A*/0,2,3,4,/*B*/0,1,2,3,/*A*/5,6,1};
+ QTest::newRow("4, 1, 3")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 2, 3, C::PrependFlag)
+ << Range(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 2, 3, C::DefaultFlag))
+ << a << 4 << 1 << 3
+ << (RemoveList()
+ << Remove(0, 0, 2, 0, 2, C::DefaultFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 1, 0, 2, C::DefaultFlag, 0))
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int defaultIndexes[] = {/*A*/1,2,3,6,/*B*/0,1,2,3,/*A*/4,5,0};
+ QTest::newRow("0, 6, 1")
+ << (RangeList()
+ << Range(a, 0, 1, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 1, 1, C::PrependFlag)
+ << Range(a, 2, 3, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 5, 2, C::PrependFlag)
+ << Range(a, 7, 0, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 5, 2, C::DefaultFlag)
+ << Range(a, 1, 1, C::DefaultFlag))
+ << a << 0 << 6 << 1
+ << (RemoveList()
+ << Remove(0, 0, 0, 0, 1, C::DefaultFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 3, 0, 1, C::DefaultFlag, 0))
+ << IndexArray()
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/0,1,3,4};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5,6,7};
+ QTest::newRow("6, 2, 1")
+ << (RangeList()
+ << Range(a, 0, 4, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 4, 4, C::AppendFlag | C::PrependFlag | C::DefaultFlag))
+ << a << 6 << 2 << 1
+ << (RemoveList()
+ << Remove(0, 0, 6, 4, 1, C::DefaultFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 2, 2, 1, C::DefaultFlag, 0))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/0,1,-1,-1,-1,2,3,4,5,6,7};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5,6,7};
+ QTest::newRow("Move after remove")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 3, C::CacheFlag)
+ << Range(a, 2, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << a << 4 << 2 << 2
+ << (RemoveList()
+ << Remove(0, 0, 4, 7, 2, C::DefaultFlag | C::CacheFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 2, 5, 2, C::DefaultFlag | C::CacheFlag, 0))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/0,1,5,6,7,8,9,10,11,12};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5,6,7,8,9,10,11,12};
+ QTest::newRow("Move merge tail")
+ << (RangeList()
+ << Range(a, 0, 10, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 10, 3, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 13, 0, C::AppendFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << a << 8 << 0 << 5
+ << (RemoveList()
+ << Remove(0, 0, 8, 8, 2, C::DefaultFlag | C::CacheFlag, 0)
+ << Remove(0, 0, 8, 8, 3, C::DefaultFlag, 1))
+ << (InsertList()
+ << Insert(0, 0, 0, 0, 2, C::DefaultFlag | C::CacheFlag, 0)
+ << Insert(0, 0, 2, 2, 3, C::DefaultFlag, 1))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ } { static const int cacheIndexes[] = {/*A*/0,1,2,3};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3};
+ static const int selectionIndexes[] = {/*A*/3};
+ QTest::newRow("Move selection")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 1, C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 3, 1, C::AppendFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << a << 2 << 3 << 1
+ << (RemoveList()
+ << Remove(0, 0, 2, 2, 1, C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag, 0))
+ << (InsertList()
+ << Insert(0, 0, 3, 3, 1, C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag, 0))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray(selectionIndexes);
+ } { static const int cacheIndexes[] = {/*A*/0,1,2,3,4,5,8,9};
+ static const int defaultIndexes[] = {/*A*/0,1,2,3,4,5,6,7,8,9,10,11};
+ QTest::newRow("move mixed cached items")
+ << (RangeList()
+ << Range(a, 0, 1, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 1, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 3, 7, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 10, 2, C::PrependFlag | C::DefaultFlag))
+ << a << 1 << 6 << 3
+ << (RemoveList()
+ << Remove(0, 0, 1, 1, 2, C::PrependFlag | C::DefaultFlag, 0)
+ << Remove(0, 0, 1, 1, 1, C::PrependFlag | C::DefaultFlag | C::CacheFlag, 1))
+ << (InsertList()
+ << Insert(0, 0, 6, 6, 2, C::PrependFlag | C::DefaultFlag, 0)
+ << Insert(0, 0, 8, 6, 1, C::PrependFlag | C::DefaultFlag | C::CacheFlag, 1))
+ << IndexArray(cacheIndexes)
+ << IndexArray(defaultIndexes)
+ << IndexArray()
+ << IndexArray();
+ }
+}
+
+void tst_qqmllistcompositor::listItemsMoved()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(void *, list);
+ QFETCH(int, from);
+ QFETCH(int, to);
+ QFETCH(int, count);
+ QFETCH(RemoveList, expectedRemoves);
+ QFETCH(InsertList, expectedInserts);
+ QFETCH(IndexArray, cacheIndexes);
+ QFETCH(IndexArray, defaultIndexes);
+ QFETCH(IndexArray, visibleIndexes);
+ QFETCH(IndexArray, selectionIndexes);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QVector<C::Remove> removes;
+ QVector<C::Insert> inserts;
+ compositor.listItemsMoved(list, from, to, count, &removes, &inserts);
+
+ QCOMPARE(removes, expectedRemoves);
+ QCOMPARE(inserts, expectedInserts);
+
+ QCOMPARE(compositor.count(C::Cache), cacheIndexes.count);
+ for (int i = 0; i < cacheIndexes.count; ++i) {
+ if (cacheIndexes[i] != -1) {
+ QCOMPARE(compositor.find(C::Cache, i).modelIndex(), cacheIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(C::Default), defaultIndexes.count);
+ for (int i = 0; i < defaultIndexes.count; ++i) {
+ if (defaultIndexes[i] != -1) {
+ QCOMPARE(compositor.find(C::Default, i).modelIndex(), defaultIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(Visible), visibleIndexes.count);
+ for (int i = 0; i < visibleIndexes.count; ++i) {
+ if (visibleIndexes[i] != -1) {
+ QCOMPARE(compositor.find(Visible, i).modelIndex(), visibleIndexes[i]);
+ }
+ }
+ QCOMPARE(compositor.count(Selection), selectionIndexes.count);
+ for (int i = 0; i < selectionIndexes.count; ++i) {
+ if (selectionIndexes[i] != -1) {
+ QCOMPARE(compositor.find(Selection, i).modelIndex(), selectionIndexes[i]);
+ }
+ }
+}
+
+void tst_qqmllistcompositor::listItemsChanged_data()
+{
+ QTest::addColumn<RangeList>("ranges");
+ QTest::addColumn<void *>("list");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<ChangeList>("expectedChanges");
+
+ int listA; void *a = &listA;
+ int listB; void *b = &listB;
+
+ QTest::newRow("overlapping")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag)
+ << Range(a, 2, 3, C::PrependFlag)
+ << Range(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)
+ << Range(b, 0, 4, C::DefaultFlag)
+ << Range(a, 2, 3, C::DefaultFlag))
+ << a << 3 << 4
+ << (ChangeList()
+ << Change(0, 0, 2, 0, 2, C::DefaultFlag)
+ << Change(0, 0, 9, 0, 2, C::DefaultFlag));
+ QTest::newRow("Change after remove")
+ << (RangeList()
+ << Range(a, 0, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag)
+ << Range(a, 2, 3, C::CacheFlag)
+ << Range(a, 2, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag | C::CacheFlag))
+ << a << 3 << 2
+ << (ChangeList()
+ << Change(0, 0, 3, 6, 2, C::DefaultFlag | C::CacheFlag));
+}
+
+void tst_qqmllistcompositor::listItemsChanged()
+{
+ QFETCH(RangeList, ranges);
+ QFETCH(void *, list);
+ QFETCH(int, index);
+ QFETCH(int, count);
+ QFETCH(ChangeList, expectedChanges);
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+
+ foreach (const Range &range, ranges)
+ compositor.append(range.list, range.index, range.count, range.flags);
+
+ QVector<C::Change> changes;
+ compositor.listItemsChanged(list, index, count, &changes);
+
+ QCOMPARE(changes, expectedChanges);
+}
+
+void tst_qqmllistcompositor::compositorDebug()
+{
+ void *a = (void *)0xa0;
+ void *b = (void *)0xb0;
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+ compositor.append(a, 0, 2, C::PrependFlag | C::DefaultFlag);
+ compositor.append(a, 2, 3, C::PrependFlag);
+ compositor.append(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag);
+ compositor.append(b, 0, 4, C::DefaultFlag);
+ compositor.append(a, 2, 3, C::DefaultFlag);
+
+ QTest::ignoreMessage(QtDebugMsg,
+ "QQmlListCompositor(00110\n"
+ " 0 0 0 0 Range(0xa0 0 2 00P000000000D0\n"
+ " 0 0 2 0 Range(0xa0 2 3 00P00000000000\n"
+ " 0 0 2 0 Range(0xa0 5 2 0AP000000000D0\n"
+ " 0 0 4 0 Range(0xb0 0 4 000000000000D0\n"
+ " 0 0 8 0 Range(0xa0 2 3 000000000000D0)");
+ qDebug() << compositor;
+
+ compositor.setFlags(C::Default, 5, 2, SelectionFlag);
+
+ QTest::ignoreMessage(QtDebugMsg,
+ "QQmlListCompositor(20110\n"
+ " 0 0 0 0 Range(0xa0 0 2 00P000000000D0\n"
+ " 0 0 2 0 Range(0xa0 2 3 00P00000000000\n"
+ " 0 0 2 0 Range(0xa0 5 2 0AP000000000D0\n"
+ " 0 0 4 0 Range(0xb0 0 1 000000000000D0\n"
+ " 0 0 5 0 Range(0xb0 1 2 000000000010D0\n"
+ " 2 0 7 0 Range(0xb0 3 1 000000000000D0\n"
+ " 2 0 8 0 Range(0xa0 2 3 000000000000D0)");
+ qDebug() << compositor;
+}
+
+void tst_qqmllistcompositor::changeDebug()
+{
+ void *a = (void *)0xa0;
+ void *b = (void *)0xb0;
+
+ QQmlListCompositor compositor;
+ compositor.setGroupCount(4);
+ compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag);
+ compositor.append(a, 0, 2, C::PrependFlag | C::DefaultFlag);
+ compositor.append(a, 2, 3, C::PrependFlag);
+ compositor.append(a, 5, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag);
+ compositor.append(b, 0, 1, C::DefaultFlag);
+ compositor.append(b, 1, 2, SelectionFlag | C::DefaultFlag);
+ compositor.append(b, 3, 1, C::DefaultFlag);
+ compositor.append(a, 2, 3, C::DefaultFlag);
+
+
+ QTest::ignoreMessage(QtDebugMsg, "Change(-1 2 000000010D0 2 0 7 0)");
+ qDebug() << QQmlListCompositor::Change(compositor.find(C::Default, 7), 2, SelectionFlag | C::DefaultFlag);
+ QTest::ignoreMessage(QtDebugMsg, "Remove(9 4 000000000D0 10 0)");
+ qDebug() << QQmlListCompositor::Remove(compositor.find(C::Default, 10), 4, C::DefaultFlag, 9);
+ QTest::ignoreMessage(QtDebugMsg, "Insert(9 4 000000000D0 3 0)");
+ qDebug() << QQmlListCompositor::Insert(compositor.find(C::Default, 3), 4, C::DefaultFlag, 9);
+}
+
+void tst_qqmllistcompositor::groupDebug()
+{
+ QTest::ignoreMessage(QtDebugMsg, "Default ");
+ qDebug() << C::Default;
+ QTest::ignoreMessage(QtDebugMsg, "Cache ");
+ qDebug() << C::Cache;
+ QTest::ignoreMessage(QtDebugMsg, "Group3 ");
+ qDebug() << Selection;
+}
+
+QTEST_MAIN(tst_qqmllistcompositor)
+
+#include "tst_qqmllistcompositor.moc"
+
+
diff --git a/tests/auto/qml/qqmllistmodel/data/enumerate.qml b/tests/auto/qml/qqmllistmodel/data/enumerate.qml
new file mode 100644
index 0000000000..f73d66b318
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodel/data/enumerate.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ property string result
+
+ ListModel {
+ id: model
+
+ ListElement {
+ val1: 1
+ val2: 2
+ val3: "str"
+ val4: false
+ val5: true
+ }
+ }
+
+ Component.onCompleted: {
+ var element = model.get(0);
+
+ for (var i in element)
+ result += i+"="+element[i]+(element[i] ? "Y" : "N")+":";
+ }
+}
diff --git a/tests/auto/qml/qqmllistmodel/data/multipleroles.qml b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml
new file mode 100644
index 0000000000..4a331e2b3e
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+ListView {
+ width: 100
+ height: 250
+ delegate: Rectangle {
+ width: 100
+ height: 50
+ color: black ? "black": "white"
+ }
+ model: ListModel {
+ objectName: "listModel"
+ ListElement {
+ black: false
+ rounded: false
+ }
+ ListElement {
+ black: true
+ rounded: false
+ }
+ ListElement {
+ black: true
+ rounded: false
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml b/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml
new file mode 100644
index 0000000000..58bf1ccd04
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+ListModel {
+ id: model
+ property bool ok : false
+
+ Component.onCompleted: {
+ model.append({"attrs": []})
+ model.get(0)
+ model.set(0, {"attrs": [{'abc': 123, 'def': 456}] } )
+ ok = ( model.get(0).attrs.get(0).abc == 123
+ && model.get(0).attrs.get(0).def == 456 )
+
+ model.set(0, {"attrs": [{'abc': 789, 'def': 101}] } )
+ ok = ( model.get(0).attrs.get(0).abc == 789
+ && model.get(0).attrs.get(0).def == 101 )
+
+ }
+}
+
diff --git a/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml b/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml
new file mode 100644
index 0000000000..750d99c5a3
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+ListModel{
+ property bool ok: false
+ property int foo: 5
+ onFooChanged: ok = true
+ Component.onCompleted: foo = 6
+}
diff --git a/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro
new file mode 100644
index 0000000000..ef044f1663
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmllistmodel
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmllistmodel.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
new file mode 100644
index 0000000000..eec312ec4f
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
@@ -0,0 +1,1258 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickanimation_p.h>
+#include <QtQml/private/qqmlengine_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
+#include <QtQml/private/qqmlexpression_p.h>
+#include <QQmlComponent>
+
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qtranslator.h>
+#include <QSignalSpy>
+
+#include "../../shared/util.h"
+
+Q_DECLARE_METATYPE(QList<int>)
+Q_DECLARE_METATYPE(QList<QVariantHash>)
+
+#define RUNEVAL(object, string) \
+ QVERIFY(QMetaObject::invokeMethod(object, "runEval", Q_ARG(QVariant, QString(string))));
+
+inline QVariant runexpr(QQmlEngine *engine, const QString &str)
+{
+ QQmlExpression expr(engine->rootContext(), 0, str);
+ return expr.evaluate();
+}
+
+#define RUNEXPR(string) runexpr(&engine, QString(string))
+
+static bool isValidErrorMessage(const QString &msg, bool dynamicRoleTest)
+{
+ bool valid = true;
+
+ if (msg.isEmpty()) {
+ valid = false;
+ } else if (dynamicRoleTest) {
+ if (msg.contains("Can't assign to existing role") || msg.contains("Can't create role for unsupported data type"))
+ valid = false;
+ }
+
+ return valid;
+}
+
+class tst_qqmllistmodel : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmllistmodel()
+ {
+ qRegisterMetaType<QVector<int> >();
+ }
+
+private:
+ int roleFromName(const QQmlListModel *model, const QString &roleName);
+
+ static bool compareVariantList(const QVariantList &testList, QVariant object);
+
+private slots:
+ void static_types();
+ void static_types_data();
+ void static_i18n();
+ void static_i18n_data();
+ void static_nestedElements();
+ void static_nestedElements_data();
+ void dynamic_data();
+ void dynamic();
+ void enumerate();
+ void error_data();
+ void error();
+ void syncError();
+ void get();
+ void set_data();
+ void set();
+ void get_data();
+ void get_nested();
+ void get_nested_data();
+ void crash_model_with_multiple_roles();
+ void set_model_cache();
+ void property_changes();
+ void property_changes_data();
+ void clear_data();
+ void clear();
+ void signal_handlers_data();
+ void signal_handlers();
+ void role_mode_data();
+ void role_mode();
+ void string_to_list_crash();
+ void empty_element_warning();
+ void empty_element_warning_data();
+ void datetime();
+ void datetime_data();
+};
+
+bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVariant object)
+{
+ bool allOk = true;
+
+ QQmlListModel *model = qobject_cast<QQmlListModel *>(object.value<QObject *>());
+ if (model == 0)
+ return false;
+
+ if (model->count() != testList.count())
+ return false;
+
+ for (int i=0 ; i < testList.count() ; ++i) {
+ const QVariant &testVariant = testList.at(i);
+ if (testVariant.type() != QVariant::Map)
+ return false;
+ const QVariantMap &map = testVariant.toMap();
+
+ const QHash<int, QByteArray> roleNames = model->roleNames();
+
+ QVariantMap::const_iterator it = map.begin();
+ QVariantMap::const_iterator end = map.end();
+
+ while (it != end) {
+ const QString &testKey = it.key();
+ const QVariant &testData = it.value();
+
+ int roleIndex = roleNames.key(testKey.toUtf8(), -1);
+ if (roleIndex == -1)
+ return false;
+
+ const QVariant &modelData = model->data(i, roleIndex);
+
+ if (testData.type() == QVariant::List) {
+ const QVariantList &subList = testData.toList();
+ allOk = allOk && compareVariantList(subList, modelData);
+ } else {
+ allOk = allOk && (testData == modelData);
+ }
+
+ ++it;
+ }
+ }
+
+ return allOk;
+}
+
+int tst_qqmllistmodel::roleFromName(const QQmlListModel *model, const QString &roleName)
+{
+ return model->roleNames().key(roleName.toUtf8(), -1);
+}
+
+void tst_qqmllistmodel::static_types_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QVariant>("value");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("string")
+ << "ListElement { foo: \"bar\" }"
+ << QVariant(QString("bar"))
+ << QString();
+
+ QTest::newRow("real")
+ << "ListElement { foo: 10.5 }"
+ << QVariant(10.5)
+ << QString();
+
+ QTest::newRow("real0")
+ << "ListElement { foo: 0 }"
+ << QVariant(double(0))
+ << QString();
+
+ QTest::newRow("bool")
+ << "ListElement { foo: false }"
+ << QVariant(false)
+ << QString();
+
+ QTest::newRow("bool")
+ << "ListElement { foo: true }"
+ << QVariant(true)
+ << QString();
+
+ QTest::newRow("enum")
+ << "ListElement { foo: Text.AlignHCenter }"
+ << QVariant(double(QQuickText::AlignHCenter))
+ << QString();
+
+ QTest::newRow("Qt enum")
+ << "ListElement { foo: Qt.AlignBottom }"
+ << QVariant(double(Qt::AlignBottom))
+ << QString();
+
+ QTest::newRow("negative enum")
+ << "ListElement { foo: Animation.Infinite }"
+ << QVariant(double(QQuickAbstractAnimation::Infinite))
+ << QString();
+
+ QTest::newRow("role error")
+ << "ListElement { foo: 1 } ListElement { foo: 'string' }"
+ << QVariant()
+ << QString("<Unknown File>: Can't assign to existing role 'foo' of different type [String -> Number]");
+
+ QTest::newRow("list type error")
+ << "ListElement { foo: 1 } ListElement { foo: ListElement { bar: 1 } }"
+ << QVariant()
+ << QString("<Unknown File>: Can't assign to existing role 'foo' of different type [List -> Number]");
+}
+
+void tst_qqmllistmodel::static_types()
+{
+ QFETCH(QString, qml);
+ QFETCH(QVariant, value);
+ QFETCH(QString, error);
+
+ qml = "import QtQuick 2.0\nItem { property variant test: model.get(0).foo; ListModel { id: model; " + qml + " } }";
+
+ if (!error.isEmpty()) {
+ QTest::ignoreMessage(QtWarningMsg, error.toLatin1());
+ }
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(),
+ QUrl::fromLocalFile(QString("dummy.qml")));
+
+ QVERIFY(!component.isError());
+
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+
+ if (error.isEmpty()) {
+ QVariant actual = obj->property("test");
+
+ QCOMPARE(actual, value);
+ QCOMPARE(actual.toString(), value.toString());
+ }
+
+ delete obj;
+}
+
+void tst_qqmllistmodel::static_i18n_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QVariant>("value");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("QT_TR_NOOP")
+ << QString::fromUtf8("ListElement { foo: QT_TR_NOOP(\"na\303\257ve\") }")
+ << QVariant(QString::fromUtf8("na\303\257ve"))
+ << QString();
+
+ QTest::newRow("QT_TRANSLATE_NOOP")
+ << "ListElement { foo: QT_TRANSLATE_NOOP(\"MyListModel\", \"hello\") }"
+ << QVariant(QString("hello"))
+ << QString();
+
+ QTest::newRow("QT_TRID_NOOP")
+ << QString::fromUtf8("ListElement { foo: QT_TRID_NOOP(\"qtn_1st_text\") }")
+ << QVariant(QString("qtn_1st_text"))
+ << QString();
+
+ QTest::newRow("QT_TR_NOOP extra param")
+ << QString::fromUtf8("ListElement { foo: QT_TR_NOOP(\"hello\",\"world\") }")
+ << QVariant(QString())
+ << QString("ListElement: improperly specified QT_TR_NOOP");
+
+ QTest::newRow("QT_TRANSLATE_NOOP missing params")
+ << "ListElement { foo: QT_TRANSLATE_NOOP() }"
+ << QVariant(QString())
+ << QString("ListElement: improperly specified QT_TRANSLATE_NOOP");
+
+ QTest::newRow("QT_TRID_NOOP missing param")
+ << QString::fromUtf8("ListElement { foo: QT_TRID_NOOP() }")
+ << QVariant(QString())
+ << QString("ListElement: improperly specified QT_TRID_NOOP");
+}
+
+void tst_qqmllistmodel::static_i18n()
+{
+ QFETCH(QString, qml);
+ QFETCH(QVariant, value);
+ QFETCH(QString, error);
+
+ qml = "import QtQuick 2.0\nItem { property variant test: model.get(0).foo; ListModel { id: model; " + qml + " } }";
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(),
+ QUrl::fromLocalFile(QString("dummy.qml")));
+
+ if (!error.isEmpty()) {
+ QVERIFY(component.isError());
+ QCOMPARE(component.errors().at(0).description(), error);
+ return;
+ }
+
+ QVERIFY(!component.isError());
+
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+
+ QVariant actual = obj->property("test");
+
+ QCOMPARE(actual, value);
+ QCOMPARE(actual.toString(), value.toString());
+
+ delete obj;
+}
+
+void tst_qqmllistmodel::static_nestedElements()
+{
+ QFETCH(int, elementCount);
+
+ QStringList elements;
+ for (int i=0; i<elementCount; i++)
+ elements.append("ListElement { a: 1; b: 2 }");
+ QString elementsStr = elements.join(",\n") + "\n";
+
+ QString componentStr =
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ " property variant count: model.get(0).attributes.count\n"
+ " ListModel {\n"
+ " id: model\n"
+ " ListElement {\n"
+ " attributes: [\n";
+ componentStr += elementsStr.toUtf8().constData();
+ componentStr +=
+ " ]\n"
+ " }\n"
+ " }\n"
+ "}";
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toUtf8(), QUrl::fromLocalFile(""));
+
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+
+ QVariant count = obj->property("count");
+ QCOMPARE(count.type(), QVariant::Int);
+ QCOMPARE(count.toInt(), elementCount);
+
+ delete obj;
+}
+
+void tst_qqmllistmodel::static_nestedElements_data()
+{
+ QTest::addColumn<int>("elementCount");
+
+ QTest::newRow("0 items") << 0;
+ QTest::newRow("1 item") << 1;
+ QTest::newRow("2 items") << 2;
+ QTest::newRow("many items") << 5;
+}
+
+void tst_qqmllistmodel::dynamic_data()
+{
+ QTest::addColumn<QString>("script");
+ QTest::addColumn<int>("result");
+ QTest::addColumn<QString>("warning");
+ QTest::addColumn<bool>("dynamicRoles");
+
+ for (int i=0 ; i < 2 ; ++i) {
+ bool dr = (i != 0);
+
+ // Simple flat model
+ QTest::newRow("count") << "count" << 0 << "" << dr;
+
+ QTest::newRow("get1") << "{get(0) === undefined}" << 1 << "" << dr;
+ QTest::newRow("get2") << "{get(-1) === undefined}" << 1 << "" << dr;
+ QTest::newRow("get3") << "{append({'foo':123});get(0) != undefined}" << 1 << "" << dr;
+ QTest::newRow("get4") << "{append({'foo':123});get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("get-modify1") << "{append({'foo':123,'bar':456});get(0).foo = 333;get(0).foo}" << 333 << "" << dr;
+ QTest::newRow("get-modify2") << "{append({'z':1});append({'foo':123,'bar':456});get(1).bar = 999;get(1).bar}" << 999 << "" << dr;
+
+ QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << "" << dr;
+ QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << "" << dr;
+ QTest::newRow("append3a") << "{append({'foo':123});append({'foo':456});get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("append3b") << "{append({'foo':123});append({'foo':456});get(1).foo}" << 456 << "" << dr;
+ QTest::newRow("append4a") << "{append(123)}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object" << dr;
+ QTest::newRow("append4b") << "{append([{'foo':123},{'foo':456},{'foo':789}]);count}" << 3 << "" << dr;
+ QTest::newRow("append4c") << "{append([{'foo':123},{'foo':456},{'foo':789}]);get(1).foo}" << 456 << "" << dr;
+
+ QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << "" << dr;
+ QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << "" << dr;
+ QTest::newRow("clear3") << "{append({'foo':123});clear()}" << 0 << "" << dr;
+
+ QTest::newRow("remove1") << "{append({'foo':123});remove(0);count}" << 0 << "" << dr;
+ QTest::newRow("remove2a") << "{append({'foo':123});append({'foo':456});remove(0);count}" << 1 << "" << dr;
+ QTest::newRow("remove2b") << "{append({'foo':123});append({'foo':456});remove(0);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("remove2c") << "{append({'foo':123});append({'foo':456});remove(1);get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("remove3") << "{append({'foo':123});remove(0)}" << 0 << "" << dr;
+ QTest::newRow("remove3a") << "{append({'foo':123});remove(-1);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [-1 - 0] out of range [0 - 1]" << dr;
+ QTest::newRow("remove4a") << "{remove(0)}" << 0 << "<Unknown File>: QML ListModel: remove: indices [0 - 1] out of range [0 - 0]" << dr;
+ QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0);count}" << 0 << "<Unknown File>: QML ListModel: remove: indices [0 - 1] out of range [0 - 0]" << dr;
+ QTest::newRow("remove4c") << "{append({'foo':123});remove(1);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [1 - 2] out of range [0 - 1]" << dr;
+ QTest::newRow("remove5a") << "{append({'foo':123});append({'foo':456});remove(0,2);count}" << 0 << "" << dr;
+ QTest::newRow("remove5b") << "{append({'foo':123});append({'foo':456});remove(0,1);count}" << 1 << "" << dr;
+ QTest::newRow("remove5c") << "{append({'foo':123});append({'foo':456});remove(1,1);count}" << 1 << "" << dr;
+ QTest::newRow("remove5d") << "{append({'foo':123});append({'foo':456});remove(0,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("remove5e") << "{append({'foo':123});append({'foo':456});remove(1,1);get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("remove5f") << "{append({'foo':123});append({'foo':456});append({'foo':789});remove(0,1);remove(1,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("remove6a") << "{remove();count}" << 0 << "<Unknown File>: QML ListModel: remove: incorrect number of arguments" << dr;
+ QTest::newRow("remove6b") << "{remove(1,2,3);count}" << 0 << "<Unknown File>: QML ListModel: remove: incorrect number of arguments" << dr;
+ QTest::newRow("remove7a") << "{append({'foo':123});remove(0,0);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [0 - 0] out of range [0 - 1]" << dr;
+ QTest::newRow("remove7b") << "{append({'foo':123});remove(0,-1);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [0 - -1] out of range [0 - 1]" << dr;
+
+ QTest::newRow("insert1") << "{insert(0,{'foo':123});count}" << 1 << "" << dr;
+ QTest::newRow("insert2") << "{insert(1,{'foo':123});count}" << 0 << "<Unknown File>: QML ListModel: insert: index 1 out of range" << dr;
+ QTest::newRow("insert3a") << "{append({'foo':123});insert(1,{'foo':456});count}" << 2 << "" << dr;
+ QTest::newRow("insert3b") << "{append({'foo':123});insert(1,{'foo':456});get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("insert3c") << "{append({'foo':123});insert(1,{'foo':456});get(1).foo}" << 456 << "" << dr;
+ QTest::newRow("insert3d") << "{append({'foo':123});insert(0,{'foo':456});get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("insert3e") << "{append({'foo':123});insert(0,{'foo':456});get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("insert4") << "{append({'foo':123});insert(-1,{'foo':456});count}" << 1 << "<Unknown File>: QML ListModel: insert: index -1 out of range" << dr;
+ QTest::newRow("insert5a") << "{insert(0,123)}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object" << dr;
+ QTest::newRow("insert5b") << "{insert(0,[{'foo':11},{'foo':22},{'foo':33}]);count}" << 3 << "" << dr;
+ QTest::newRow("insert5c") << "{insert(0,[{'foo':11},{'foo':22},{'foo':33}]);get(2).foo}" << 33 << "" << dr;
+
+ QTest::newRow("set1") << "{append({'foo':123});set(0,{'foo':456});count}" << 1 << "" << dr;
+ QTest::newRow("set2") << "{append({'foo':123});set(0,{'foo':456});get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("set3a") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).foo}" << 999 << "" << dr;
+ QTest::newRow("set3b") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).bar}" << 456 << "" << dr;
+ QTest::newRow("set4a") << "{set(0,{'foo':456});count}" << 1 << "" << dr;
+ QTest::newRow("set4c") << "{set(-1,{'foo':456})}" << 0 << "<Unknown File>: QML ListModel: set: index -1 out of range" << dr;
+ QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123);count}" << 1 << "<Unknown File>: QML ListModel: set: value is not an object" << dr;
+ QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3]);count}" << 1 << "<Unknown File>: QML ListModel: set: value is not an object" << dr;
+ QTest::newRow("set6") << "{append({'foo':123});set(1,{'foo':456});count}" << 2 << "" << dr;
+
+ QTest::newRow("setprop1") << "{append({'foo':123});setProperty(0,'foo',456);count}" << 1 << "" << dr;
+ QTest::newRow("setprop2") << "{append({'foo':123});setProperty(0,'foo',456);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("setprop3a") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).foo}" << 999 << "" << dr;
+ QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).bar}" << 456 << "" << dr;
+ QTest::newRow("setprop4a") << "{setProperty(0,'foo',456)}" << 0 << "<Unknown File>: QML ListModel: set: index 0 out of range" << dr;
+ QTest::newRow("setprop4b") << "{setProperty(-1,'foo',456)}" << 0 << "<Unknown File>: QML ListModel: set: index -1 out of range" << dr;
+ QTest::newRow("setprop4c") << "{append({'foo':123,'bar':456});setProperty(1,'foo',456);count}" << 1 << "<Unknown File>: QML ListModel: set: index 1 out of range" << dr;
+ QTest::newRow("setprop5") << "{append({'foo':123,'bar':456});append({'foo':111});setProperty(1,'bar',222);get(1).bar}" << 222 << "" << dr;
+
+ QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << "" << dr;
+ QTest::newRow("move1b") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("move1c") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("move1d") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("move1e") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("move2a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);count}" << 3 << "" << dr;
+ QTest::newRow("move2b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(0).foo}" << 789 << "" << dr;
+ QTest::newRow("move2c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("move2d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(2).foo}" << 456 << "" << dr;
+ QTest::newRow("move3a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,3);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+ QTest::newRow("move3b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,-1,1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+ QTest::newRow("move3c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,-1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+ QTest::newRow("move3d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,3,1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+
+ QTest::newRow("large1") << "{append({'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8});get(0).h}" << 8 << "" << dr;
+
+ QTest::newRow("datatypes1") << "{append({'a':1});append({'a':'string'});}" << 0 << "<Unknown File>: Can't assign to existing role 'a' of different type [String -> Number]" << dr;
+
+ QTest::newRow("null") << "{append({'a':null});}" << 0 << "" << dr;
+ QTest::newRow("setNull") << "{append({'a':1});set(0, {'a':null});}" << 0 << "" << dr;
+ QTest::newRow("setString") << "{append({'a':'hello'});set(0, {'a':'world'});get(0).a == 'world'}" << 1 << "" << dr;
+ QTest::newRow("setInt") << "{append({'a':5});set(0, {'a':10});get(0).a}" << 10 << "" << dr;
+ QTest::newRow("setNumber") << "{append({'a':6});set(0, {'a':5.5});get(0).a < 5.6}" << 1 << "" << dr;
+ QTest::newRow("badType0") << "{append({'a':'hello'});set(0, {'a':1});}" << 0 << "<Unknown File>: Can't assign to existing role 'a' of different type [Number -> String]" << dr;
+ QTest::newRow("invalidInsert0") << "{insert(0);}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object" << dr;
+ QTest::newRow("invalidAppend0") << "{append();}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object" << dr;
+ QTest::newRow("invalidInsert1") << "{insert(0, 34);}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object" << dr;
+ QTest::newRow("invalidAppend1") << "{append(37);}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object" << dr;
+
+ // QObjects
+ QTest::newRow("qobject0") << "{append({'a':dummyItem0});}" << 0 << "" << dr;
+ QTest::newRow("qobject1") << "{append({'a':dummyItem0});set(0,{'a':dummyItem1});get(0).a == dummyItem1;}" << 1 << "" << dr;
+ QTest::newRow("qobject2") << "{append({'a':dummyItem0});get(0).a == dummyItem0;}" << 1 << "" << dr;
+ QTest::newRow("qobject3") << "{append({'a':dummyItem0});append({'b':1});}" << 0 << "" << dr;
+
+ // JS objects
+ QTest::newRow("js1") << "{append({'foo':{'prop':1}});count}" << 1 << "" << dr;
+ QTest::newRow("js2") << "{append({'foo':{'prop':27}});get(0).foo.prop}" << 27 << "" << dr;
+ QTest::newRow("js3") << "{append({'foo':{'prop':27}});append({'bar':1});count}" << 2 << "" << dr;
+ QTest::newRow("js4") << "{append({'foo':{'prop':27}});append({'bar':1});set(0, {'foo':{'prop':28}});get(0).foo.prop}" << 28 << "" << dr;
+ QTest::newRow("js5") << "{append({'foo':{'prop':27}});append({'bar':1});set(1, {'foo':{'prop':33}});get(1).foo.prop}" << 33 << "" << dr;
+ QTest::newRow("js6") << "{append({'foo':{'prop':27}});clear();count}" << 0 << "" << dr;
+ QTest::newRow("js7") << "{append({'foo':{'prop':27}});set(0, {'foo':null});count}" << 1 << "" << dr;
+ QTest::newRow("js8") << "{append({'foo':{'prop':27}});set(0, {'foo':{'prop2':31}});get(0).foo.prop2}" << 31 << "" << dr;
+
+ // Nested models
+ QTest::newRow("nested-append1") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});count}" << 1 << "" << dr;
+ QTest::newRow("nested-append2") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.get(1).a}" << 2 << "" << dr;
+ QTest::newRow("nested-append3") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.append({'a':4});get(0).bars.get(3).a}" << 4 << "" << dr;
+
+ QTest::newRow("nested-insert") << "{append({'foo':123});insert(0,{'bars':[{'a':1},{'b':2},{'c':3}]});get(0).bars.get(0).a}" << 1 << "" << dr;
+ QTest::newRow("nested-set") << "{append({'foo':[{'x':1}]});set(0,{'foo':[{'x':123}]});get(0).foo.get(0).x}" << 123 << "" << dr;
+
+ QTest::newRow("nested-count") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.count}" << 3 << "" << dr;
+ QTest::newRow("nested-clear") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.clear(); get(0).bars.count}" << 0 << "" << dr;
+ }
+}
+
+void tst_qqmllistmodel::dynamic()
+{
+ QFETCH(QString, script);
+ QFETCH(int, result);
+ QFETCH(QString, warning);
+ QFETCH(bool, dynamicRoles);
+
+ QQuickItem dummyItem0, dummyItem1;
+ QQmlEngine engine;
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine::setContextForObject(&model,engine.rootContext());
+ engine.rootContext()->setContextObject(&model);
+ engine.rootContext()->setContextProperty("dummyItem0", QVariant::fromValue(&dummyItem0));
+ engine.rootContext()->setContextProperty("dummyItem1", QVariant::fromValue(&dummyItem1));
+ QQmlExpression e(engine.rootContext(), &model, script);
+ if (isValidErrorMessage(warning, dynamicRoles))
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+
+ QSignalSpy spyCount(&model, SIGNAL(countChanged()));
+
+ int actual = e.evaluate().toInt();
+ if (e.hasError())
+ qDebug() << e.error(); // errors not expected
+
+ QCOMPARE(actual,result);
+
+ if (model.count() > 0)
+ QVERIFY(spyCount.count() > 0);
+}
+
+void tst_qqmllistmodel::enumerate()
+{
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("enumerate.qml"));
+ QVERIFY(!component.isError());
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item != 0);
+
+ QLatin1String expectedStrings[] = {
+ QLatin1String("val1=1Y"),
+ QLatin1String("val2=2Y"),
+ QLatin1String("val3=strY"),
+ QLatin1String("val4=falseN"),
+ QLatin1String("val5=trueY")
+ };
+
+ int expectedStringCount = sizeof(expectedStrings) / sizeof(expectedStrings[0]);
+
+ QStringList r = item->property("result").toString().split(":");
+
+ int matchCount = 0;
+ for (int i=0 ; i < expectedStringCount ; ++i) {
+ const QLatin1String &expectedString = expectedStrings[i];
+
+ QStringList::const_iterator it = r.begin();
+ QStringList::const_iterator end = r.end();
+
+ while (it != end) {
+ if (it->compare(expectedString) == 0) {
+ ++matchCount;
+ break;
+ }
+ ++it;
+ }
+ }
+
+ QVERIFY(matchCount == expectedStringCount);
+
+ delete item;
+}
+
+void tst_qqmllistmodel::error_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("id not allowed in ListElement")
+ << "import QtQuick 2.0\nListModel { ListElement { id: fred } }"
+ << "ListElement: cannot use reserved \"id\" property";
+
+ QTest::newRow("id allowed in ListModel")
+ << "import QtQuick 2.0\nListModel { id:model }"
+ << "";
+
+ QTest::newRow("random properties not allowed in ListModel")
+ << "import QtQuick 2.0\nListModel { foo:123 }"
+ << "ListModel: undefined property 'foo'";
+
+ QTest::newRow("random properties allowed in ListElement")
+ << "import QtQuick 2.0\nListModel { ListElement { foo:123 } }"
+ << "";
+
+ QTest::newRow("bindings not allowed in ListElement")
+ << "import QtQuick 2.0\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }"
+ << "ListElement: cannot use script for property value";
+
+ QTest::newRow("random object list properties allowed in ListElement")
+ << "import QtQuick 2.0\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }"
+ << "";
+
+ QTest::newRow("default properties not allowed in ListElement")
+ << "import QtQuick 2.0\nListModel { ListElement { Item { } } }"
+ << "ListElement: cannot contain nested elements";
+
+ QTest::newRow("QML elements not allowed in ListElement")
+ << "import QtQuick 2.0\nListModel { ListElement { a: Item { } } }"
+ << "ListElement: cannot contain nested elements";
+
+ QTest::newRow("qualified ListElement supported")
+ << "import QtQuick 2.0 as Foo\nFoo.ListModel { Foo.ListElement { a: 123 } }"
+ << "";
+
+ QTest::newRow("qualified ListElement required")
+ << "import QtQuick 2.0 as Foo\nFoo.ListModel { ListElement { a: 123 } }"
+ << "ListElement is not a type";
+
+ QTest::newRow("unknown qualified ListElement not allowed")
+ << "import QtQuick 2.0\nListModel { Foo.ListElement { a: 123 } }"
+ << "Foo.ListElement - Foo is not a namespace";
+}
+
+void tst_qqmllistmodel::error()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, error);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(),
+ QUrl::fromLocalFile(QString("dummy.qml")));
+ if (error.isEmpty()) {
+ QVERIFY(!component.isError());
+ } else {
+ QVERIFY(component.isError());
+ QList<QQmlError> errors = component.errors();
+ QCOMPARE(errors.count(),1);
+ QCOMPARE(errors.at(0).description(),error);
+ }
+}
+
+void tst_qqmllistmodel::syncError()
+{
+ QString qml = "import QtQuick 2.0\nListModel { id: lm; Component.onCompleted: lm.sync() }";
+ QString error = "file:dummy.qml:2:1: QML ListModel: List sync() can only be called from a WorkerScript";
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(),
+ QUrl::fromLocalFile(QString("dummy.qml")));
+ QTest::ignoreMessage(QtWarningMsg,error.toUtf8());
+ QObject *obj = component.create();
+ QVERIFY(obj);
+ delete obj;
+}
+
+/*
+ Test model changes from set() are available to the view
+*/
+void tst_qqmllistmodel::set_data()
+{
+ QTest::addColumn<bool>("dynamicRoles");
+
+ QTest::newRow("staticRoles") << false;
+ QTest::newRow("dynamicRoles") << true;
+}
+
+void tst_qqmllistmodel::set()
+{
+ QFETCH(bool, dynamicRoles);
+
+ QQmlEngine engine;
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine::setContextForObject(&model,engine.rootContext());
+ engine.rootContext()->setContextProperty("model", &model);
+
+ RUNEXPR("model.append({test:false})");
+ RUNEXPR("model.set(0, {test:true})");
+
+ QCOMPARE(RUNEXPR("model.get(0).test").toBool(), true); // triggers creation of model cache
+ QCOMPARE(model.data(0, 0), qVariantFromValue(true));
+
+ RUNEXPR("model.set(0, {test:false})");
+ QCOMPARE(RUNEXPR("model.get(0).test").toBool(), false); // tests model cache is updated
+ QCOMPARE(model.data(0, 0), qVariantFromValue(false));
+
+ QString warning = QString::fromLatin1("<Unknown File>: Can't create role for unsupported data type");
+ if (isValidErrorMessage(warning, dynamicRoles))
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+ QVariant invalidData = QColor();
+ model.setProperty(0, "test", invalidData);
+}
+
+/*
+ Test model changes on values returned by get() are available to the view
+*/
+void tst_qqmllistmodel::get()
+{
+ QFETCH(QString, expression);
+ QFETCH(int, index);
+ QFETCH(QString, roleName);
+ QFETCH(QVariant, roleValue);
+ QFETCH(bool, dynamicRoles);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "ListModel {}\n", QUrl());
+ QQmlListModel *model = qobject_cast<QQmlListModel*>(component.create());
+ model->setDynamicRoles(dynamicRoles);
+ engine.rootContext()->setContextProperty("model", model);
+
+ RUNEXPR("model.append({roleA: 100})");
+ RUNEXPR("model.append({roleA: 200, roleB: 400})");
+ RUNEXPR("model.append({roleA: 200, roleB: 400})");
+ RUNEXPR("model.append({roleC: {} })");
+ RUNEXPR("model.append({roleD: [ { a:1, b:2 }, { c: 3 } ] })");
+
+ QSignalSpy spy(model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+ QQmlExpression expr(engine.rootContext(), model, expression);
+ expr.evaluate();
+ QVERIFY(!expr.hasError());
+
+ int role = roleFromName(model, roleName);
+ QVERIFY(role >= 0);
+
+ if (roleValue.type() == QVariant::List) {
+ const QVariantList &list = roleValue.toList();
+ QVERIFY(compareVariantList(list, model->data(index, role)));
+ } else {
+ QCOMPARE(model->data(index, role), roleValue);
+ }
+
+ QCOMPARE(spy.count(), 1);
+
+ QList<QVariant> spyResult = spy.takeFirst();
+ QCOMPARE(spyResult.at(0).value<QModelIndex>(), model->index(index, 0, QModelIndex()));
+ QCOMPARE(spyResult.at(1).value<QModelIndex>(), model->index(index, 0, QModelIndex())); // only 1 item is modified at a time
+ QCOMPARE(spyResult.at(2).value<QVector<int> >(), (QVector<int>() << role));
+
+ delete model;
+}
+
+void tst_qqmllistmodel::get_data()
+{
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<QString>("roleName");
+ QTest::addColumn<QVariant>("roleValue");
+ QTest::addColumn<bool>("dynamicRoles");
+
+ for (int i=0 ; i < 2 ; ++i) {
+ bool dr = (i != 0);
+
+ QTest::newRow("simple value") << "get(0).roleA = 500" << 0 << "roleA" << QVariant(500) << dr;
+ QTest::newRow("simple value 2") << "get(1).roleB = 500" << 1 << "roleB" << QVariant(500) << dr;
+
+ QVariantMap map;
+ QVariantList list;
+ map.clear(); map["a"] = 50; map["b"] = 500;
+ list << map;
+ map.clear(); map["c"] = 1000;
+ list << map;
+ QTest::newRow("list of objects") << "get(2).roleD = [{'a': 50, 'b': 500}, {'c': 1000}]" << 2 << "roleD" << QVariant::fromValue(list) << dr;
+ }
+}
+
+/*
+ Test that the tests run in get() also work for nested list data
+*/
+void tst_qqmllistmodel::get_nested()
+{
+ QFETCH(QString, expression);
+ QFETCH(int, index);
+ QFETCH(QString, roleName);
+ QFETCH(QVariant, roleValue);
+ QFETCH(bool, dynamicRoles);
+
+ if (roleValue.type() == QVariant::Map)
+ return;
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "ListModel {}", QUrl());
+ QQmlListModel *model = qobject_cast<QQmlListModel*>(component.create());
+ model->setDynamicRoles(dynamicRoles);
+ QVERIFY(component.errorString().isEmpty());
+ QQmlListModel *childModel;
+ engine.rootContext()->setContextProperty("model", model);
+
+ RUNEXPR("model.append({ listRoleA: [\n"
+ "{ roleA: 100 },\n"
+ "{ roleA: 200, roleB: 400 },\n"
+ "{ roleA: 200, roleB: 400 }, \n"
+ "{ roleC: {} }, \n"
+ "{ roleD: [ { a: 1, b:2 }, { c: 3 } ] } \n"
+ "] })\n");
+
+ RUNEXPR("model.append({ listRoleA: [\n"
+ "{ roleA: 100 },\n"
+ "{ roleA: 200, roleB: 400 },\n"
+ "{ roleA: 200, roleB: 400 }, \n"
+ "{ roleC: {} }, \n"
+ "{ roleD: [ { a: 1, b:2 }, { c: 3 } ] } \n"
+ "],\n"
+ "listRoleB: [\n"
+ "{ roleA: 100 },\n"
+ "{ roleA: 200, roleB: 400 },\n"
+ "{ roleA: 200, roleB: 400 }, \n"
+ "{ roleC: {} }, \n"
+ "{ roleD: [ { a: 1, b:2 }, { c: 3 } ] } \n"
+ "],\n"
+ "listRoleC: [\n"
+ "{ roleA: 100 },\n"
+ "{ roleA: 200, roleB: 400 },\n"
+ "{ roleA: 200, roleB: 400 }, \n"
+ "{ roleC: {} }, \n"
+ "{ roleD: [ { a: 1, b:2 }, { c: 3 } ] } \n"
+ "] })\n");
+
+ // Test setting the inner list data for:
+ // get(0).listRoleA
+ // get(1).listRoleA
+ // get(1).listRoleB
+ // get(1).listRoleC
+
+ QList<QPair<int, QString> > testData;
+ testData << qMakePair(0, QString("listRoleA"));
+ testData << qMakePair(1, QString("listRoleA"));
+ testData << qMakePair(1, QString("listRoleB"));
+ testData << qMakePair(1, QString("listRoleC"));
+
+ for (int i=0; i<testData.count(); i++) {
+ int outerListIndex = testData[i].first;
+ QString outerListRoleName = testData[i].second;
+ int outerListRole = roleFromName(model, outerListRoleName);
+ QVERIFY(outerListRole >= 0);
+
+ childModel = qobject_cast<QQmlListModel*>(model->data(outerListIndex, outerListRole).value<QObject*>());
+ QVERIFY(childModel);
+
+ QString extendedExpression = QString("get(%1).%2.%3").arg(outerListIndex).arg(outerListRoleName).arg(expression);
+ QQmlExpression expr(engine.rootContext(), model, extendedExpression);
+
+ QSignalSpy spy(childModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+ expr.evaluate();
+ QVERIFY(!expr.hasError());
+
+ int role = roleFromName(childModel, roleName);
+ QVERIFY(role >= 0);
+ if (roleValue.type() == QVariant::List) {
+ QVERIFY(compareVariantList(roleValue.toList(), childModel->data(index, role)));
+ } else {
+ QCOMPARE(childModel->data(index, role), roleValue);
+ }
+ QCOMPARE(spy.count(), 1);
+
+ QList<QVariant> spyResult = spy.takeFirst();
+ QCOMPARE(spyResult.at(0).value<QModelIndex>(), childModel->index(index, 0, QModelIndex()));
+ QCOMPARE(spyResult.at(1).value<QModelIndex>(), childModel->index(index, 0, QModelIndex())); // only 1 item is modified at a time
+ QCOMPARE(spyResult.at(2).value<QVector<int> >(), (QVector<int>() << role));
+ }
+
+ delete model;
+}
+
+void tst_qqmllistmodel::get_nested_data()
+{
+ get_data();
+}
+
+//QTBUG-13754
+void tst_qqmllistmodel::crash_model_with_multiple_roles()
+{
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("multipleroles.qml"));
+ QObject *rootItem = component.create();
+ QVERIFY(component.errorString().isEmpty());
+ QVERIFY(rootItem != 0);
+ QQmlListModel *model = rootItem->findChild<QQmlListModel*>("listModel");
+ QVERIFY(model != 0);
+
+ // used to cause a crash
+ model->setProperty(0, "black", true);
+
+ delete rootItem;
+}
+
+//QTBUG-15190
+void tst_qqmllistmodel::set_model_cache()
+{
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("setmodelcachelist.qml"));
+ QObject *model = component.create();
+ QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
+ QVERIFY(model != 0);
+ QVERIFY(model->property("ok").toBool());
+
+ delete model;
+}
+
+void tst_qqmllistmodel::property_changes()
+{
+ QFETCH(QString, script_setup);
+ QFETCH(QString, script_change);
+ QFETCH(QString, roleName);
+ QFETCH(int, listIndex);
+ QFETCH(bool, itemsChanged);
+ QFETCH(QString, testExpression);
+ QFETCH(bool, dynamicRoles);
+
+ QQmlEngine engine;
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine::setContextForObject(&model, engine.rootContext());
+ engine.rootContext()->setContextObject(&model);
+
+ QQmlExpression expr(engine.rootContext(), &model, script_setup);
+ expr.evaluate();
+ QVERIFY2(!expr.hasError(), QTest::toString(expr.error().toString()));
+
+ QString signalHandler = "on" + QString(roleName[0].toUpper()) + roleName.mid(1, roleName.length()) + "Changed:";
+ QString qml = "import QtQuick 2.0\n"
+ "Connections {\n"
+ "property bool gotSignal: false\n"
+ "target: model.get(" + QString::number(listIndex) + ")\n"
+ + signalHandler + " gotSignal = true\n"
+ "}\n";
+
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(), QUrl::fromLocalFile(""));
+ engine.rootContext()->setContextProperty("model", &model);
+ QObject *connectionsObject = component.create();
+ QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
+
+ QSignalSpy spyItemsChanged(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+
+ expr.setExpression(script_change);
+ expr.evaluate();
+ QVERIFY2(!expr.hasError(), QTest::toString(expr.error().toString()));
+
+ // test the object returned by get() emits the correct signals
+ QCOMPARE(connectionsObject->property("gotSignal").toBool(), itemsChanged);
+
+ // test itemsChanged() is emitted correctly
+ if (itemsChanged) {
+ QCOMPARE(spyItemsChanged.count(), 1);
+ QCOMPARE(spyItemsChanged.at(0).at(0).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex()));
+ QCOMPARE(spyItemsChanged.at(0).at(1).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex()));
+ } else {
+ QCOMPARE(spyItemsChanged.count(), 0);
+ }
+
+ expr.setExpression(testExpression);
+ QCOMPARE(expr.evaluate().toBool(), true);
+
+ delete connectionsObject;
+}
+
+void tst_qqmllistmodel::property_changes_data()
+{
+ QTest::addColumn<QString>("script_setup");
+ QTest::addColumn<QString>("script_change");
+ QTest::addColumn<QString>("roleName");
+ QTest::addColumn<int>("listIndex");
+ QTest::addColumn<bool>("itemsChanged");
+ QTest::addColumn<QString>("testExpression");
+ QTest::addColumn<bool>("dynamicRoles");
+
+ for (int i=0 ; i < 2 ; ++i) {
+ bool dr = (i != 0);
+
+ QTest::newRow("set: plain") << "append({'a':123, 'b':456, 'c':789});" << "set(0,{'b':123});"
+ << "b" << 0 << true << "get(0).b == 123" << dr;
+ QTest::newRow("setProperty: plain") << "append({'a':123, 'b':456, 'c':789});" << "setProperty(0, 'b', 123);"
+ << "b" << 0 << true << "get(0).b == 123" << dr;
+
+ QTest::newRow("set: plain, no changes") << "append({'a':123, 'b':456, 'c':789});" << "set(0,{'b':456});"
+ << "b" << 0 << false << "get(0).b == 456" << dr;
+ QTest::newRow("setProperty: plain, no changes") << "append({'a':123, 'b':456, 'c':789});" << "setProperty(0, 'b', 456);"
+ << "b" << 0 << false << "get(0).b == 456" << dr;
+
+ QTest::newRow("set: inserted item")
+ << "{append({'a':123, 'b':456, 'c':789}); get(0); insert(0, {'a':0, 'b':0, 'c':0});}"
+ << "set(1, {'a':456});"
+ << "a" << 1 << true << "get(1).a == 456" << dr;
+ QTest::newRow("setProperty: inserted item")
+ << "{append({'a':123, 'b':456, 'c':789}); get(0); insert(0, {'a':0, 'b':0, 'c':0});}"
+ << "setProperty(1, 'a', 456);"
+ << "a" << 1 << true << "get(1).a == 456" << dr;
+ QTest::newRow("get: inserted item")
+ << "{append({'a':123, 'b':456, 'c':789}); get(0); insert(0, {'a':0, 'b':0, 'c':0});}"
+ << "get(1).a = 456;"
+ << "a" << 1 << true << "get(1).a == 456" << dr;
+ QTest::newRow("set: removed item")
+ << "{append({'a':0, 'b':0, 'c':0}); append({'a':123, 'b':456, 'c':789}); get(1); remove(0);}"
+ << "set(0, {'a':456});"
+ << "a" << 0 << true << "get(0).a == 456" << dr;
+ QTest::newRow("setProperty: removed item")
+ << "{append({'a':0, 'b':0, 'c':0}); append({'a':123, 'b':456, 'c':789}); get(1); remove(0);}"
+ << "setProperty(0, 'a', 456);"
+ << "a" << 0 << true << "get(0).a == 456" << dr;
+ QTest::newRow("get: removed item")
+ << "{append({'a':0, 'b':0, 'c':0}); append({'a':123, 'b':456, 'c':789}); get(1); remove(0);}"
+ << "get(0).a = 456;"
+ << "a" << 0 << true << "get(0).a == 456" << dr;
+
+ // Following tests only call set() since setProperty() only allows plain
+ // values, not lists, as the argument.
+ // Note that when a list is changed, itemsChanged() is currently always
+ // emitted regardless of whether it actually changed or not.
+
+ QTest::newRow("nested-set: list, new size") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2" << dr;
+
+ QTest::newRow("nested-set: list, empty -> non-empty") << "append({'a':123, 'b':[], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2},{'a':3}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2 && get(0).b.get(2).a == 3" << dr;
+
+ QTest::newRow("nested-set: list, non-empty -> empty") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[]});"
+ << "b" << 0 << true << "get(0).b.count == 0" << dr;
+
+ QTest::newRow("nested-set: list, same size, different values") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':222},{'a':3}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 222 && get(0).b.get(2).a == 3" << dr;
+
+ QTest::newRow("nested-set: list, no changes") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2},{'a':3}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2 && get(0).b.get(2).a == 3" << dr;
+
+ QTest::newRow("nested-set: list, no changes, empty") << "append({'a':123, 'b':[], 'c':789});" << "set(0,{'b':[]});"
+ << "b" << 0 << true << "get(0).b.count == 0" << dr;
+ }
+}
+
+void tst_qqmllistmodel::clear_data()
+{
+ QTest::addColumn<bool>("dynamicRoles");
+
+ QTest::newRow("staticRoles") << false;
+ QTest::newRow("dynamicRoles") << true;
+}
+
+void tst_qqmllistmodel::clear()
+{
+ QFETCH(bool, dynamicRoles);
+
+ QQmlEngine engine;
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine::setContextForObject(&model, engine.rootContext());
+ engine.rootContext()->setContextProperty("model", &model);
+
+ model.clear();
+ QCOMPARE(model.count(), 0);
+
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\"})");
+ QCOMPARE(model.count(), 1);
+
+ model.clear();
+ QCOMPARE(model.count(), 0);
+
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\"})");
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\"})");
+ QCOMPARE(model.count(), 2);
+
+ model.clear();
+ QCOMPARE(model.count(), 0);
+
+ // clearing does not remove the roles
+ RUNEXPR("model.append({propertyA: \"value a\", propertyB: \"value b\", propertyC: \"value c\"})");
+ QHash<int, QByteArray> roleNames = model.roleNames();
+ model.clear();
+ QCOMPARE(model.count(), 0);
+ QCOMPARE(model.roleNames(), roleNames);
+ QCOMPARE(roleNames[0], QByteArray("propertyA"));
+ QCOMPARE(roleNames[1], QByteArray("propertyB"));
+ QCOMPARE(roleNames[2], QByteArray("propertyC"));
+}
+
+void tst_qqmllistmodel::signal_handlers_data()
+{
+ QTest::addColumn<bool>("dynamicRoles");
+
+ QTest::newRow("staticRoles") << false;
+ QTest::newRow("dynamicRoles") << true;
+}
+
+void tst_qqmllistmodel::signal_handlers()
+{
+ QFETCH(bool, dynamicRoles);
+
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("signalhandlers.qml"));
+ QObject *model = component.create();
+ QQmlListModel *lm = qobject_cast<QQmlListModel *>(model);
+ QVERIFY(lm != 0);
+ lm->setDynamicRoles(dynamicRoles);
+ QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
+ QVERIFY(model != 0);
+ QVERIFY(model->property("ok").toBool());
+
+ delete model;
+}
+
+void tst_qqmllistmodel::role_mode_data()
+{
+ QTest::addColumn<QString>("script");
+ QTest::addColumn<int>("result");
+ QTest::addColumn<QString>("warning");
+
+ QTest::newRow("default0") << "{dynamicRoles}" << 0 << "";
+ QTest::newRow("default1") << "{append({'a':1});dynamicRoles}" << 0 << "";
+
+ QTest::newRow("enableDynamic0") << "{dynamicRoles=true;dynamicRoles}" << 1 << "";
+ QTest::newRow("enableDynamic1") << "{append({'a':1});dynamicRoles=true;dynamicRoles}" << 0 << "<Unknown File>: QML ListModel: unable to enable dynamic roles as this model is not empty!";
+ QTest::newRow("enableDynamic2") << "{dynamicRoles=true;append({'a':1});dynamicRoles=false;dynamicRoles}" << 1 << "<Unknown File>: QML ListModel: unable to enable static roles as this model is not empty!";
+}
+
+void tst_qqmllistmodel::role_mode()
+{
+ QFETCH(QString, script);
+ QFETCH(int, result);
+ QFETCH(QString, warning);
+
+ QQmlEngine engine;
+ QQmlListModel model;
+ QQmlEngine::setContextForObject(&model,engine.rootContext());
+ engine.rootContext()->setContextObject(&model);
+ QQmlExpression e(engine.rootContext(), &model, script);
+ if (!warning.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+
+ int actual = e.evaluate().toInt();
+ if (e.hasError())
+ qDebug() << e.error(); // errors not expected
+
+ QCOMPARE(actual,result);
+}
+
+void tst_qqmllistmodel::string_to_list_crash()
+{
+ QQmlEngine engine;
+ QQmlListModel model;
+ QQmlEngine::setContextForObject(&model,engine.rootContext());
+ engine.rootContext()->setContextObject(&model);
+ QString script = QLatin1String("{append({'a':'data'});get(0).a = [{'x':123}]}");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Can't assign to existing role 'a' of different type [String -> List]");
+ QQmlExpression e(engine.rootContext(), &model, script);
+ // Don't crash!
+ e.evaluate();
+}
+
+void tst_qqmllistmodel::empty_element_warning_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<bool>("warning");
+
+ QTest::newRow("empty") << "import QtQuick 2.0\nListModel {}" << false;
+ QTest::newRow("withid") << "import QtQuick 2.0\nListModel { id: model }" << false;
+ QTest::newRow("emptyElement") << "import QtQuick 2.0\nListModel { ListElement {} }" << true;
+ QTest::newRow("emptyElements") << "import QtQuick 2.0\nListModel { ListElement {} ListElement {} }" << true;
+ QTest::newRow("role1") << "import QtQuick 2.0\nListModel { ListElement {a:1} }" << false;
+ QTest::newRow("role2") << "import QtQuick 2.0\nListModel { ListElement {} ListElement {a:1} ListElement {} }" << false;
+ QTest::newRow("role3") << "import QtQuick 2.0\nListModel { ListElement {} ListElement {a:1} ListElement {b:2} }" << false;
+}
+
+void tst_qqmllistmodel::empty_element_warning()
+{
+ QFETCH(QString, qml);
+ QFETCH(bool, warning);
+
+ if (warning) {
+ QString warningString = QLatin1String("file:dummy.qml:2:1: QML ListModel: All ListElement declarations are empty, no roles can be created unless dynamicRoles is set.");
+ QTest::ignoreMessage(QtWarningMsg, warningString.toLatin1());
+ }
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(), QUrl::fromLocalFile(QString("dummy.qml")));
+ QVERIFY(!component.isError());
+
+ QObject *obj = component.create();
+ QVERIFY(obj != 0);
+
+ delete obj;
+}
+
+void tst_qqmllistmodel::datetime_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QDateTime>("expected");
+
+ QDateTime dt;
+ QDateTime dt0(QDate(1900, 1, 2), QTime( 8, 14));
+ QDateTime dt1(QDate(2000, 11, 22), QTime(10, 45));
+
+ QTest::newRow("dt0") << "{append({'date':dt0});get(0).date}" << dt0;
+ QTest::newRow("dt1") << "{append({'date':dt0});get(0).date=dt1;get(0).date}" << dt1;
+ QTest::newRow("dt2") << "{append({'date':dt0});set(0,{'date':dt1});get(0).date}" << dt1;
+ QTest::newRow("dt3") << "{append({'date':dt0});get(0).date=undefined;get(0).date}" << dt;
+}
+
+void tst_qqmllistmodel::datetime()
+{
+ QFETCH(QString, qml);
+ QFETCH(QDateTime, expected);
+
+ QQmlEngine engine;
+ QQmlListModel model;
+ QQmlEngine::setContextForObject(&model,engine.rootContext());
+ QDateTime dt0(QDate(1900, 1, 2), QTime( 8, 14));
+ QDateTime dt1(QDate(2000, 11, 22), QTime(10, 45));
+ engine.rootContext()->setContextProperty("dt0", dt0);
+ engine.rootContext()->setContextProperty("dt1", dt1);
+ engine.rootContext()->setContextObject(&model);
+ QQmlExpression e(engine.rootContext(), &model, qml);
+ QVariant result = e.evaluate();
+ QDateTime dtResult = result.toDateTime();
+ QVERIFY(expected == dtResult);
+}
+
+QTEST_MAIN(tst_qqmllistmodel)
+
+#include "tst_qqmllistmodel.moc"
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/model.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/model.qml
new file mode 100644
index 0000000000..5973ea8adf
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/model.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ id: item
+ property variant model
+ property bool done: false
+ property variant result
+
+ function evalExpressionViaWorker(commands) {
+ done = false
+ worker.sendMessage({'commands': commands, 'model': model})
+ }
+
+ WorkerScript {
+ id: worker
+ source: "script.js"
+ onMessage: {
+ item.result = messageObject.result
+ item.done = true
+ }
+ }
+
+ function runEval(js) {
+ eval(js);
+ }
+}
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/script.js b/tests/auto/qml/qqmllistmodelworkerscript/data/script.js
new file mode 100644
index 0000000000..66a4acb8a8
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/script.js
@@ -0,0 +1,13 @@
+WorkerScript.onMessage = function(msg) {
+ var result = null
+ try {
+ for (var i=0; i<msg.commands.length; i++) {
+ var c = 'msg.model.' + msg.commands[i]
+ result = eval(c)
+ }
+ msg.model.sync()
+ } catch(e) { }
+ WorkerScript.sendMessage({'done': true, 'result': result})
+}
+
+
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js
new file mode 100644
index 0000000000..cb9dfa66aa
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js
@@ -0,0 +1,8 @@
+WorkerScript.onMessage = function(msg) {
+ if (msg.action == 'removeItem') {
+ msg.model.remove(0);
+ } else if (msg.action == 'dosync') {
+ msg.model.sync();
+ }
+ WorkerScript.sendMessage({'done': true})
+}
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml
new file mode 100644
index 0000000000..e2361acf6b
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Item {
+ id: item
+ property variant model
+ property bool done: false
+
+ WorkerScript {
+ id: worker
+ source: "workerremoveelement.js"
+ onMessage: {
+ item.done = true
+ }
+ }
+
+ function addItem() {
+ model.append({ 'data': 1 });
+
+ var element = model.get(0);
+ }
+
+ function removeItemViaWorker() {
+ done = false
+ var msg = { 'action': 'removeItem', 'model': model }
+ worker.sendMessage(msg);
+ }
+
+ function doSync() {
+ done = false
+ var msg = { 'action': 'dosync', 'model': model }
+ worker.sendMessage(msg);
+ }
+}
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js
new file mode 100644
index 0000000000..f63dd68839
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js
@@ -0,0 +1,9 @@
+WorkerScript.onMessage = function(msg) {
+ if (msg.action == 'removeList') {
+ msg.model.remove(0);
+ } else if (msg.action == 'dosync') {
+ msg.model.sync();
+ }
+ WorkerScript.sendMessage({'done': true})
+}
+
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml
new file mode 100644
index 0000000000..bdb5e024d8
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Item {
+ id: item
+ property variant model
+ property bool done: false
+
+ WorkerScript {
+ id: worker
+ source: "workerremovelist.js"
+ onMessage: {
+ item.done = true
+ }
+ }
+
+ function addList() {
+ model.append({ 'data': [ { 'subData': 1 } ] });
+
+ var element = model.get(0);
+ }
+
+ function removeListViaWorker() {
+ done = false
+ var msg = { 'action': 'removeList', 'model': model }
+ worker.sendMessage(msg);
+ }
+
+ function doSync() {
+ done = false
+ var msg = { 'action': 'dosync', 'model': model }
+ worker.sendMessage(msg);
+ }
+}
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js
new file mode 100644
index 0000000000..9b8d8fa7f3
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js
@@ -0,0 +1,8 @@
+WorkerScript.onMessage = function(msg) {
+ if (msg.action == 'addItem') {
+ msg.model.get(0).level0.append({ 'level1': 33 });
+ } else if (msg.action == 'dosync') {
+ msg.model.sync();
+ }
+ WorkerScript.sendMessage({'done': true})
+}
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml
new file mode 100644
index 0000000000..c21cd43e7e
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ id: item
+ property variant model
+ property bool done: false
+
+ WorkerScript {
+ id: worker
+ source: "workersync.js"
+ onMessage: {
+ item.done = true
+ }
+ }
+
+ function addItem0() {
+ model.append({ 'level0': [ { 'level1': 29 } ] });
+ model.append({ 'level0': [ { 'level1': 37 } ] });
+ }
+
+ function addItemViaWorker() {
+ done = false
+ var msg = { 'action': 'addItem', 'model': model }
+ worker.sendMessage(msg);
+ }
+
+ function doSync() {
+ done = false
+ var msg = { 'action': 'dosync', 'model': model }
+ worker.sendMessage(msg);
+ }
+}
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro
new file mode 100644
index 0000000000..14f0604a9b
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qqmllistmodelworkerscript
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmllistmodelworkerscript.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp
new file mode 100644
index 0000000000..a0edfb6891
--- /dev/null
+++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp
@@ -0,0 +1,859 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQml/private/qqmlengine_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
+#include <QtQml/private/qqmlexpression_p.h>
+#include <QQmlComponent>
+
+#include <QtCore/qtimer.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qtranslator.h>
+#include <QSignalSpy>
+
+#include "../../shared/util.h"
+
+Q_DECLARE_METATYPE(QList<int>)
+Q_DECLARE_METATYPE(QList<QVariantHash>)
+
+#define RUNEVAL(object, string) \
+ QVERIFY(QMetaObject::invokeMethod(object, "runEval", Q_ARG(QVariant, QString(string))));
+
+inline QVariant runexpr(QQmlEngine *engine, const QString &str)
+{
+ QQmlExpression expr(engine->rootContext(), 0, str);
+ return expr.evaluate();
+}
+
+#define RUNEXPR(string) runexpr(&engine, QString(string))
+
+static bool isValidErrorMessage(const QString &msg, bool dynamicRoleTest)
+{
+ bool valid = true;
+
+ if (msg.isEmpty()) {
+ valid = false;
+ } else if (dynamicRoleTest) {
+ if (msg.contains("Can't assign to existing role") || msg.contains("Can't create role for unsupported data type"))
+ valid = false;
+ }
+
+ return valid;
+}
+
+class tst_qqmllistmodelworkerscript : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmllistmodelworkerscript()
+ {
+ qRegisterMetaType<QVector<int> >();
+ }
+
+private:
+ int roleFromName(const QQmlListModel *model, const QString &roleName);
+ QQuickItem *createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQmlListModel *model);
+ void waitForWorker(QQuickItem *item);
+
+ static bool compareVariantList(const QVariantList &testList, QVariant object);
+
+private slots:
+ void dynamic_data();
+ void dynamic_worker_data();
+ void dynamic_worker();
+ void dynamic_worker_sync_data();
+ void dynamic_worker_sync();
+ void get_data();
+ void get_worker();
+ void get_worker_data();
+ void property_changes_data();
+ void property_changes_worker();
+ void property_changes_worker_data();
+ void worker_sync_data();
+ void worker_sync();
+ void worker_remove_element_data();
+ void worker_remove_element();
+ void worker_remove_list_data();
+ void worker_remove_list();
+ void dynamic_role_data();
+ void dynamic_role();
+};
+
+bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testList, QVariant object)
+{
+ bool allOk = true;
+
+ QQmlListModel *model = qobject_cast<QQmlListModel *>(object.value<QObject *>());
+ if (model == 0)
+ return false;
+
+ if (model->count() != testList.count())
+ return false;
+
+ for (int i=0 ; i < testList.count() ; ++i) {
+ const QVariant &testVariant = testList.at(i);
+ if (testVariant.type() != QVariant::Map)
+ return false;
+ const QVariantMap &map = testVariant.toMap();
+
+ const QHash<int, QByteArray> roleNames = model->roleNames();
+
+ QVariantMap::const_iterator it = map.begin();
+ QVariantMap::const_iterator end = map.end();
+
+ while (it != end) {
+ const QString &testKey = it.key();
+ const QVariant &testData = it.value();
+
+ int roleIndex = roleNames.key(testKey.toUtf8(), -1);
+ if (roleIndex == -1)
+ return false;
+
+ const QVariant &modelData = model->data(model->index(i, 0, QModelIndex()), roleIndex);
+
+ if (testData.type() == QVariant::List) {
+ const QVariantList &subList = testData.toList();
+ allOk = allOk && compareVariantList(subList, modelData);
+ } else {
+ allOk = allOk && (testData == modelData);
+ }
+
+ ++it;
+ }
+ }
+
+ return allOk;
+}
+
+int tst_qqmllistmodelworkerscript::roleFromName(const QQmlListModel *model, const QString &roleName)
+{
+ return model->roleNames().key(roleName.toUtf8(), -1);
+}
+
+QQuickItem *tst_qqmllistmodelworkerscript::createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQmlListModel *model)
+{
+ QQuickItem *item = qobject_cast<QQuickItem*>(component->create());
+ QQmlEngine::setContextForObject(model, eng->rootContext());
+ if (item)
+ item->setProperty("model", qVariantFromValue(model));
+ return item;
+}
+
+void tst_qqmllistmodelworkerscript::waitForWorker(QQuickItem *item)
+{
+ QQmlProperty prop(item, "done");
+ QVERIFY(prop.isValid());
+ if (prop.read().toBool())
+ return; // already finished
+
+ QEventLoop loop;
+ QTimer timer;
+ timer.setSingleShot(true);
+ connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+
+ QVERIFY(prop.connectNotifySignal(&loop, SLOT(quit())));
+ timer.start(10000);
+ loop.exec();
+ QVERIFY(timer.isActive());
+ QVERIFY(prop.read().toBool());
+}
+
+void tst_qqmllistmodelworkerscript::dynamic_data()
+{
+ QTest::addColumn<QString>("script");
+ QTest::addColumn<int>("result");
+ QTest::addColumn<QString>("warning");
+ QTest::addColumn<bool>("dynamicRoles");
+
+ for (int i=0 ; i < 2 ; ++i) {
+ bool dr = (i != 0);
+
+ // Simple flat model
+ QTest::newRow("count") << "count" << 0 << "" << dr;
+
+ QTest::newRow("get1") << "{get(0) === undefined}" << 1 << "" << dr;
+ QTest::newRow("get2") << "{get(-1) === undefined}" << 1 << "" << dr;
+ QTest::newRow("get3") << "{append({'foo':123});get(0) != undefined}" << 1 << "" << dr;
+ QTest::newRow("get4") << "{append({'foo':123});get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("get-modify1") << "{append({'foo':123,'bar':456});get(0).foo = 333;get(0).foo}" << 333 << "" << dr;
+ QTest::newRow("get-modify2") << "{append({'z':1});append({'foo':123,'bar':456});get(1).bar = 999;get(1).bar}" << 999 << "" << dr;
+
+ QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << "" << dr;
+ QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << "" << dr;
+ QTest::newRow("append3a") << "{append({'foo':123});append({'foo':456});get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("append3b") << "{append({'foo':123});append({'foo':456});get(1).foo}" << 456 << "" << dr;
+ QTest::newRow("append4a") << "{append(123)}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object" << dr;
+ QTest::newRow("append4b") << "{append([{'foo':123},{'foo':456},{'foo':789}]);count}" << 3 << "" << dr;
+ QTest::newRow("append4c") << "{append([{'foo':123},{'foo':456},{'foo':789}]);get(1).foo}" << 456 << "" << dr;
+
+ QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << "" << dr;
+ QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << "" << dr;
+ QTest::newRow("clear3") << "{append({'foo':123});clear()}" << 0 << "" << dr;
+
+ QTest::newRow("remove1") << "{append({'foo':123});remove(0);count}" << 0 << "" << dr;
+ QTest::newRow("remove2a") << "{append({'foo':123});append({'foo':456});remove(0);count}" << 1 << "" << dr;
+ QTest::newRow("remove2b") << "{append({'foo':123});append({'foo':456});remove(0);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("remove2c") << "{append({'foo':123});append({'foo':456});remove(1);get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("remove3") << "{append({'foo':123});remove(0)}" << 0 << "" << dr;
+ QTest::newRow("remove3a") << "{append({'foo':123});remove(-1);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [-1 - 0] out of range [0 - 1]" << dr;
+ QTest::newRow("remove4a") << "{remove(0)}" << 0 << "<Unknown File>: QML ListModel: remove: indices [0 - 1] out of range [0 - 0]" << dr;
+ QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0);count}" << 0 << "<Unknown File>: QML ListModel: remove: indices [0 - 1] out of range [0 - 0]" << dr;
+ QTest::newRow("remove4c") << "{append({'foo':123});remove(1);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [1 - 2] out of range [0 - 1]" << dr;
+ QTest::newRow("remove5a") << "{append({'foo':123});append({'foo':456});remove(0,2);count}" << 0 << "" << dr;
+ QTest::newRow("remove5b") << "{append({'foo':123});append({'foo':456});remove(0,1);count}" << 1 << "" << dr;
+ QTest::newRow("remove5c") << "{append({'foo':123});append({'foo':456});remove(1,1);count}" << 1 << "" << dr;
+ QTest::newRow("remove5d") << "{append({'foo':123});append({'foo':456});remove(0,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("remove5e") << "{append({'foo':123});append({'foo':456});remove(1,1);get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("remove5f") << "{append({'foo':123});append({'foo':456});append({'foo':789});remove(0,1);remove(1,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("remove6a") << "{remove();count}" << 0 << "<Unknown File>: QML ListModel: remove: incorrect number of arguments" << dr;
+ QTest::newRow("remove6b") << "{remove(1,2,3);count}" << 0 << "<Unknown File>: QML ListModel: remove: incorrect number of arguments" << dr;
+ QTest::newRow("remove7a") << "{append({'foo':123});remove(0,0);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [0 - 0] out of range [0 - 1]" << dr;
+ QTest::newRow("remove7b") << "{append({'foo':123});remove(0,-1);count}" << 1 << "<Unknown File>: QML ListModel: remove: indices [0 - -1] out of range [0 - 1]" << dr;
+
+ QTest::newRow("insert1") << "{insert(0,{'foo':123});count}" << 1 << "" << dr;
+ QTest::newRow("insert2") << "{insert(1,{'foo':123});count}" << 0 << "<Unknown File>: QML ListModel: insert: index 1 out of range" << dr;
+ QTest::newRow("insert3a") << "{append({'foo':123});insert(1,{'foo':456});count}" << 2 << "" << dr;
+ QTest::newRow("insert3b") << "{append({'foo':123});insert(1,{'foo':456});get(0).foo}" << 123 << "" << dr;
+ QTest::newRow("insert3c") << "{append({'foo':123});insert(1,{'foo':456});get(1).foo}" << 456 << "" << dr;
+ QTest::newRow("insert3d") << "{append({'foo':123});insert(0,{'foo':456});get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("insert3e") << "{append({'foo':123});insert(0,{'foo':456});get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("insert4") << "{append({'foo':123});insert(-1,{'foo':456});count}" << 1 << "<Unknown File>: QML ListModel: insert: index -1 out of range" << dr;
+ QTest::newRow("insert5a") << "{insert(0,123)}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object" << dr;
+ QTest::newRow("insert5b") << "{insert(0,[{'foo':11},{'foo':22},{'foo':33}]);count}" << 3 << "" << dr;
+ QTest::newRow("insert5c") << "{insert(0,[{'foo':11},{'foo':22},{'foo':33}]);get(2).foo}" << 33 << "" << dr;
+
+ QTest::newRow("set1") << "{append({'foo':123});set(0,{'foo':456});count}" << 1 << "" << dr;
+ QTest::newRow("set2") << "{append({'foo':123});set(0,{'foo':456});get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("set3a") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).foo}" << 999 << "" << dr;
+ QTest::newRow("set3b") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).bar}" << 456 << "" << dr;
+ QTest::newRow("set4a") << "{set(0,{'foo':456});count}" << 1 << "" << dr;
+ QTest::newRow("set4c") << "{set(-1,{'foo':456})}" << 0 << "<Unknown File>: QML ListModel: set: index -1 out of range" << dr;
+ QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123);count}" << 1 << "<Unknown File>: QML ListModel: set: value is not an object" << dr;
+ QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3]);count}" << 1 << "<Unknown File>: QML ListModel: set: value is not an object" << dr;
+ QTest::newRow("set6") << "{append({'foo':123});set(1,{'foo':456});count}" << 2 << "" << dr;
+
+ QTest::newRow("setprop1") << "{append({'foo':123});setProperty(0,'foo',456);count}" << 1 << "" << dr;
+ QTest::newRow("setprop2") << "{append({'foo':123});setProperty(0,'foo',456);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("setprop3a") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).foo}" << 999 << "" << dr;
+ QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).bar}" << 456 << "" << dr;
+ QTest::newRow("setprop4a") << "{setProperty(0,'foo',456)}" << 0 << "<Unknown File>: QML ListModel: set: index 0 out of range" << dr;
+ QTest::newRow("setprop4b") << "{setProperty(-1,'foo',456)}" << 0 << "<Unknown File>: QML ListModel: set: index -1 out of range" << dr;
+ QTest::newRow("setprop4c") << "{append({'foo':123,'bar':456});setProperty(1,'foo',456);count}" << 1 << "<Unknown File>: QML ListModel: set: index 1 out of range" << dr;
+ QTest::newRow("setprop5") << "{append({'foo':123,'bar':456});append({'foo':111});setProperty(1,'bar',222);get(1).bar}" << 222 << "" << dr;
+
+ QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << "" << dr;
+ QTest::newRow("move1b") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("move1c") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("move1d") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(0).foo}" << 456 << "" << dr;
+ QTest::newRow("move1e") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("move2a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);count}" << 3 << "" << dr;
+ QTest::newRow("move2b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(0).foo}" << 789 << "" << dr;
+ QTest::newRow("move2c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(1).foo}" << 123 << "" << dr;
+ QTest::newRow("move2d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(2).foo}" << 456 << "" << dr;
+ QTest::newRow("move3a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,3);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+ QTest::newRow("move3b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,-1,1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+ QTest::newRow("move3c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,-1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+ QTest::newRow("move3d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,3,1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range" << dr;
+
+ QTest::newRow("large1") << "{append({'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8});get(0).h}" << 8 << "" << dr;
+
+ QTest::newRow("datatypes1") << "{append({'a':1});append({'a':'string'});}" << 0 << "<Unknown File>: Can't assign to existing role 'a' of different type [String -> Number]" << dr;
+
+ QTest::newRow("null") << "{append({'a':null});}" << 0 << "" << dr;
+ QTest::newRow("setNull") << "{append({'a':1});set(0, {'a':null});}" << 0 << "" << dr;
+ QTest::newRow("setString") << "{append({'a':'hello'});set(0, {'a':'world'});get(0).a == 'world'}" << 1 << "" << dr;
+ QTest::newRow("setInt") << "{append({'a':5});set(0, {'a':10});get(0).a}" << 10 << "" << dr;
+ QTest::newRow("setNumber") << "{append({'a':6});set(0, {'a':5.5});get(0).a < 5.6}" << 1 << "" << dr;
+ QTest::newRow("badType0") << "{append({'a':'hello'});set(0, {'a':1});}" << 0 << "<Unknown File>: Can't assign to existing role 'a' of different type [Number -> String]" << dr;
+ QTest::newRow("invalidInsert0") << "{insert(0);}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object" << dr;
+ QTest::newRow("invalidAppend0") << "{append();}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object" << dr;
+ QTest::newRow("invalidInsert1") << "{insert(0, 34);}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object" << dr;
+ QTest::newRow("invalidAppend1") << "{append(37);}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object" << dr;
+
+ // QObjects
+ QTest::newRow("qobject0") << "{append({'a':dummyItem0});}" << 0 << "" << dr;
+ QTest::newRow("qobject1") << "{append({'a':dummyItem0});set(0,{'a':dummyItem1});get(0).a == dummyItem1;}" << 1 << "" << dr;
+ QTest::newRow("qobject2") << "{append({'a':dummyItem0});get(0).a == dummyItem0;}" << 1 << "" << dr;
+ QTest::newRow("qobject3") << "{append({'a':dummyItem0});append({'b':1});}" << 0 << "" << dr;
+
+ // JS objects
+ QTest::newRow("js1") << "{append({'foo':{'prop':1}});count}" << 1 << "" << dr;
+ QTest::newRow("js2") << "{append({'foo':{'prop':27}});get(0).foo.prop}" << 27 << "" << dr;
+ QTest::newRow("js3") << "{append({'foo':{'prop':27}});append({'bar':1});count}" << 2 << "" << dr;
+ QTest::newRow("js4") << "{append({'foo':{'prop':27}});append({'bar':1});set(0, {'foo':{'prop':28}});get(0).foo.prop}" << 28 << "" << dr;
+ QTest::newRow("js5") << "{append({'foo':{'prop':27}});append({'bar':1});set(1, {'foo':{'prop':33}});get(1).foo.prop}" << 33 << "" << dr;
+ QTest::newRow("js6") << "{append({'foo':{'prop':27}});clear();count}" << 0 << "" << dr;
+ QTest::newRow("js7") << "{append({'foo':{'prop':27}});set(0, {'foo':null});count}" << 1 << "" << dr;
+ QTest::newRow("js8") << "{append({'foo':{'prop':27}});set(0, {'foo':{'prop2':31}});get(0).foo.prop2}" << 31 << "" << dr;
+
+ // Nested models
+ QTest::newRow("nested-append1") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});count}" << 1 << "" << dr;
+ QTest::newRow("nested-append2") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.get(1).a}" << 2 << "" << dr;
+ QTest::newRow("nested-append3") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.append({'a':4});get(0).bars.get(3).a}" << 4 << "" << dr;
+
+ QTest::newRow("nested-insert") << "{append({'foo':123});insert(0,{'bars':[{'a':1},{'b':2},{'c':3}]});get(0).bars.get(0).a}" << 1 << "" << dr;
+ QTest::newRow("nested-set") << "{append({'foo':[{'x':1}]});set(0,{'foo':[{'x':123}]});get(0).foo.get(0).x}" << 123 << "" << dr;
+
+ QTest::newRow("nested-count") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.count}" << 3 << "" << dr;
+ QTest::newRow("nested-clear") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.clear(); get(0).bars.count}" << 0 << "" << dr;
+ }
+}
+
+void tst_qqmllistmodelworkerscript::dynamic_worker_data()
+{
+ dynamic_data();
+}
+
+void tst_qqmllistmodelworkerscript::dynamic_worker()
+{
+ QFETCH(QString, script);
+ QFETCH(int, result);
+ QFETCH(QString, warning);
+ QFETCH(bool, dynamicRoles);
+
+ if (QByteArray(QTest::currentDataTag()).startsWith("qobject"))
+ return;
+
+ // This is same as dynamic() except it applies the test to a ListModel called
+ // from a WorkerScript.
+
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("model.qml"));
+ QQuickItem *item = createWorkerTest(&eng, &component, &model);
+ QVERIFY(item != 0);
+
+ QSignalSpy spyCount(&model, SIGNAL(countChanged()));
+
+ if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}'))
+ script = script.mid(1, script.length() - 2);
+ QVariantList operations;
+ foreach (const QString &s, script.split(';')) {
+ if (!s.isEmpty())
+ operations << s;
+ }
+
+ if (isValidErrorMessage(warning, dynamicRoles))
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+
+ QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker",
+ Q_ARG(QVariant, operations)));
+ waitForWorker(item);
+ QCOMPARE(QQmlProperty(item, "result").read().toInt(), result);
+
+ if (model.count() > 0)
+ QVERIFY(spyCount.count() > 0);
+
+ delete item;
+ qApp->processEvents();
+}
+
+void tst_qqmllistmodelworkerscript::dynamic_worker_sync_data()
+{
+ dynamic_data();
+}
+
+void tst_qqmllistmodelworkerscript::dynamic_worker_sync()
+{
+ QFETCH(QString, script);
+ QFETCH(int, result);
+ QFETCH(QString, warning);
+ QFETCH(bool, dynamicRoles);
+
+ if (QByteArray(QTest::currentDataTag()).startsWith("qobject"))
+ return;
+
+ // This is the same as dynamic_worker() except that it executes a set of list operations
+ // from the worker script, calls sync(), and tests the changes are reflected in the
+ // list in the main thread
+
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("model.qml"));
+ QQuickItem *item = createWorkerTest(&eng, &component, &model);
+ QVERIFY(item != 0);
+
+ if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}'))
+ script = script.mid(1, script.length() - 2);
+ QVariantList operations;
+ foreach (const QString &s, script.split(';')) {
+ if (!s.isEmpty())
+ operations << s;
+ }
+
+ if (isValidErrorMessage(warning, dynamicRoles))
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+
+ // execute a set of commands on the worker list model, then check the
+ // changes are reflected in the list model in the main thread
+ QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker",
+ Q_ARG(QVariant, operations.mid(0, operations.length()-1))));
+ waitForWorker(item);
+
+ QQmlExpression e(eng.rootContext(), &model, operations.last().toString());
+ QCOMPARE(e.evaluate().toInt(), result);
+
+ delete item;
+ qApp->processEvents();
+}
+
+void tst_qqmllistmodelworkerscript::get_data()
+{
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<QString>("roleName");
+ QTest::addColumn<QVariant>("roleValue");
+ QTest::addColumn<bool>("dynamicRoles");
+
+ for (int i=0 ; i < 2 ; ++i) {
+ bool dr = (i != 0);
+
+ QTest::newRow("simple value") << "get(0).roleA = 500" << 0 << "roleA" << QVariant(500) << dr;
+ QTest::newRow("simple value 2") << "get(1).roleB = 500" << 1 << "roleB" << QVariant(500) << dr;
+
+ QVariantMap map;
+ QVariantList list;
+ map.clear(); map["a"] = 50; map["b"] = 500;
+ list << map;
+ map.clear(); map["c"] = 1000;
+ list << map;
+ QTest::newRow("list of objects") << "get(2).roleD = [{'a': 50, 'b': 500}, {'c': 1000}]" << 2 << "roleD" << QVariant::fromValue(list) << dr;
+ }
+}
+
+void tst_qqmllistmodelworkerscript::get_worker()
+{
+ QFETCH(QString, expression);
+ QFETCH(int, index);
+ QFETCH(QString, roleName);
+ QFETCH(QVariant, roleValue);
+ QFETCH(bool, dynamicRoles);
+
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("model.qml"));
+ QQuickItem *item = createWorkerTest(&eng, &component, &model);
+ QVERIFY(item != 0);
+
+ // Add some values like get() test
+ RUNEVAL(item, "model.append({roleA: 100})");
+ RUNEVAL(item, "model.append({roleA: 200, roleB: 400})");
+ RUNEVAL(item, "model.append({roleA: 200, roleB: 400})");
+ RUNEVAL(item, "model.append({roleC: {} })");
+ RUNEVAL(item, "model.append({roleD: [ { a:1, b:2 }, { c: 3 } ] })");
+
+ int role = roleFromName(&model, roleName);
+ QVERIFY(role >= 0);
+
+ QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+
+ // in the worker thread, change the model data and call sync()
+ QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker",
+ Q_ARG(QVariant, QStringList(expression))));
+ waitForWorker(item);
+
+ // see if we receive the model changes in the main thread's model
+ if (roleValue.type() == QVariant::List) {
+ const QVariantList &list = roleValue.toList();
+ QVERIFY(compareVariantList(list, model.data(index, role)));
+ } else {
+ QCOMPARE(model.data(index, role), roleValue);
+ }
+
+ QCOMPARE(spy.count(), 1);
+
+ QList<QVariant> spyResult = spy.takeFirst();
+ QCOMPARE(spyResult.at(0).value<QModelIndex>(), model.index(index, 0, QModelIndex()));
+ QCOMPARE(spyResult.at(1).value<QModelIndex>(), model.index(index, 0, QModelIndex())); // only 1 item is modified at a time
+ QVERIFY(spyResult.at(2).value<QVector<int> >().contains(role));
+
+ delete item;
+}
+
+void tst_qqmllistmodelworkerscript::get_worker_data()
+{
+ get_data();
+}
+
+void tst_qqmllistmodelworkerscript::property_changes_data()
+{
+ QTest::addColumn<QString>("script_setup");
+ QTest::addColumn<QString>("script_change");
+ QTest::addColumn<QString>("roleName");
+ QTest::addColumn<int>("listIndex");
+ QTest::addColumn<bool>("itemsChanged");
+ QTest::addColumn<QString>("testExpression");
+ QTest::addColumn<bool>("dynamicRoles");
+
+ for (int i=0 ; i < 2 ; ++i) {
+ bool dr = (i != 0);
+
+ QTest::newRow("set: plain") << "append({'a':123, 'b':456, 'c':789});" << "set(0,{'b':123});"
+ << "b" << 0 << true << "get(0).b == 123" << dr;
+ QTest::newRow("setProperty: plain") << "append({'a':123, 'b':456, 'c':789});" << "setProperty(0, 'b', 123);"
+ << "b" << 0 << true << "get(0).b == 123" << dr;
+
+ QTest::newRow("set: plain, no changes") << "append({'a':123, 'b':456, 'c':789});" << "set(0,{'b':456});"
+ << "b" << 0 << false << "get(0).b == 456" << dr;
+ QTest::newRow("setProperty: plain, no changes") << "append({'a':123, 'b':456, 'c':789});" << "setProperty(0, 'b', 456);"
+ << "b" << 0 << false << "get(0).b == 456" << dr;
+
+ QTest::newRow("set: inserted item")
+ << "{append({'a':123, 'b':456, 'c':789}); get(0); insert(0, {'a':0, 'b':0, 'c':0});}"
+ << "set(1, {'a':456});"
+ << "a" << 1 << true << "get(1).a == 456" << dr;
+ QTest::newRow("setProperty: inserted item")
+ << "{append({'a':123, 'b':456, 'c':789}); get(0); insert(0, {'a':0, 'b':0, 'c':0});}"
+ << "setProperty(1, 'a', 456);"
+ << "a" << 1 << true << "get(1).a == 456" << dr;
+ QTest::newRow("get: inserted item")
+ << "{append({'a':123, 'b':456, 'c':789}); get(0); insert(0, {'a':0, 'b':0, 'c':0});}"
+ << "get(1).a = 456;"
+ << "a" << 1 << true << "get(1).a == 456" << dr;
+ QTest::newRow("set: removed item")
+ << "{append({'a':0, 'b':0, 'c':0}); append({'a':123, 'b':456, 'c':789}); get(1); remove(0);}"
+ << "set(0, {'a':456});"
+ << "a" << 0 << true << "get(0).a == 456" << dr;
+ QTest::newRow("setProperty: removed item")
+ << "{append({'a':0, 'b':0, 'c':0}); append({'a':123, 'b':456, 'c':789}); get(1); remove(0);}"
+ << "setProperty(0, 'a', 456);"
+ << "a" << 0 << true << "get(0).a == 456" << dr;
+ QTest::newRow("get: removed item")
+ << "{append({'a':0, 'b':0, 'c':0}); append({'a':123, 'b':456, 'c':789}); get(1); remove(0);}"
+ << "get(0).a = 456;"
+ << "a" << 0 << true << "get(0).a == 456" << dr;
+
+ // Following tests only call set() since setProperty() only allows plain
+ // values, not lists, as the argument.
+ // Note that when a list is changed, itemsChanged() is currently always
+ // emitted regardless of whether it actually changed or not.
+
+ QTest::newRow("nested-set: list, new size") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2" << dr;
+
+ QTest::newRow("nested-set: list, empty -> non-empty") << "append({'a':123, 'b':[], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2},{'a':3}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2 && get(0).b.get(2).a == 3" << dr;
+
+ QTest::newRow("nested-set: list, non-empty -> empty") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[]});"
+ << "b" << 0 << true << "get(0).b.count == 0" << dr;
+
+ QTest::newRow("nested-set: list, same size, different values") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':222},{'a':3}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 222 && get(0).b.get(2).a == 3" << dr;
+
+ QTest::newRow("nested-set: list, no changes") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2},{'a':3}]});"
+ << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2 && get(0).b.get(2).a == 3" << dr;
+
+ QTest::newRow("nested-set: list, no changes, empty") << "append({'a':123, 'b':[], 'c':789});" << "set(0,{'b':[]});"
+ << "b" << 0 << true << "get(0).b.count == 0" << dr;
+ }
+}
+
+void tst_qqmllistmodelworkerscript::property_changes_worker()
+{
+ QFETCH(QString, script_setup);
+ QFETCH(QString, script_change);
+ QFETCH(QString, roleName);
+ QFETCH(int, listIndex);
+ QFETCH(bool, itemsChanged);
+ QFETCH(bool, dynamicRoles);
+
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
+ QQuickItem *item = createWorkerTest(&engine, &component, &model);
+ QVERIFY(item != 0);
+
+ QQmlExpression expr(engine.rootContext(), &model, script_setup);
+ expr.evaluate();
+ QVERIFY2(!expr.hasError(), QTest::toString(expr.error().toString()));
+
+ QSignalSpy spyItemsChanged(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+
+ QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker",
+ Q_ARG(QVariant, QStringList(script_change))));
+ waitForWorker(item);
+
+ // test itemsChanged() is emitted correctly
+ if (itemsChanged) {
+ QCOMPARE(spyItemsChanged.count(), 1);
+ QCOMPARE(spyItemsChanged.at(0).at(0).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex()));
+ QCOMPARE(spyItemsChanged.at(0).at(1).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex()));
+ } else {
+ QCOMPARE(spyItemsChanged.count(), 0);
+ }
+
+ delete item;
+ qApp->processEvents();
+}
+
+void tst_qqmllistmodelworkerscript::property_changes_worker_data()
+{
+ property_changes_data();
+}
+
+void tst_qqmllistmodelworkerscript::worker_sync_data()
+{
+ QTest::addColumn<bool>("dynamicRoles");
+
+ QTest::newRow("staticRoles") << false;
+ QTest::newRow("dynamicRoles") << true;
+}
+
+void tst_qqmllistmodelworkerscript::worker_sync()
+{
+ QFETCH(bool, dynamicRoles);
+
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("workersync.qml"));
+ QQuickItem *item = createWorkerTest(&eng, &component, &model);
+ QVERIFY(item != 0);
+
+ QVERIFY(model.count() == 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "addItem0"));
+
+ QVERIFY(model.count() == 2);
+ QVariant childData = model.data(0, 0);
+ QQmlListModel *childModel = qobject_cast<QQmlListModel *>(childData.value<QObject *>());
+ QVERIFY(childModel);
+ QVERIFY(childModel->count() == 1);
+
+ QSignalSpy spyModelInserted(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy spyChildInserted(childModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
+
+ QVERIFY(QMetaObject::invokeMethod(item, "addItemViaWorker"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 2);
+ QVERIFY(childModel->count() == 1);
+ QVERIFY(spyModelInserted.count() == 0);
+ QVERIFY(spyChildInserted.count() == 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "doSync"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 2);
+ QVERIFY(childModel->count() == 2);
+ QVERIFY(spyModelInserted.count() == 0);
+ QVERIFY(spyChildInserted.count() == 1);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "addItemViaWorker"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 2);
+ QVERIFY(childModel->count() == 2);
+ QVERIFY(spyModelInserted.count() == 0);
+ QVERIFY(spyChildInserted.count() == 1);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "doSync"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 2);
+ QVERIFY(childModel->count() == 3);
+ QVERIFY(spyModelInserted.count() == 0);
+ QVERIFY(spyChildInserted.count() == 2);
+
+ delete item;
+ qApp->processEvents();
+}
+
+void tst_qqmllistmodelworkerscript::worker_remove_element_data()
+{
+ worker_sync_data();
+}
+
+void tst_qqmllistmodelworkerscript::worker_remove_element()
+{
+ QFETCH(bool, dynamicRoles);
+
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml"));
+ QQuickItem *item = createWorkerTest(&eng, &component, &model);
+ QVERIFY(item != 0);
+
+ QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+
+ QVERIFY(model.count() == 0);
+ QVERIFY(spyModelRemoved.count() == 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "addItem"));
+
+ QVERIFY(model.count() == 1);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "removeItemViaWorker"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 1);
+ QVERIFY(spyModelRemoved.count() == 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "doSync"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 0);
+ QVERIFY(spyModelRemoved.count() == 1);
+
+ delete item;
+ qApp->processEvents();
+
+ {
+ //don't crash if model was deleted earlier
+ QQmlListModel* model = new QQmlListModel;
+ model->setDynamicRoles(dynamicRoles);
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml"));
+ QQuickItem *item = createWorkerTest(&eng, &component, model);
+ QVERIFY(item != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "addItem"));
+
+ QVERIFY(model->count() == 1);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "removeItemViaWorker"));
+ QVERIFY(QMetaObject::invokeMethod(item, "doSync"));
+ delete model;
+ qApp->processEvents(); //must not crash here
+ waitForWorker(item);
+
+ delete item;
+ }
+}
+
+void tst_qqmllistmodelworkerscript::worker_remove_list_data()
+{
+ worker_sync_data();
+}
+
+void tst_qqmllistmodelworkerscript::worker_remove_list()
+{
+ QFETCH(bool, dynamicRoles);
+
+ QQmlListModel model;
+ model.setDynamicRoles(dynamicRoles);
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("workerremovelist.qml"));
+ QQuickItem *item = createWorkerTest(&eng, &component, &model);
+ QVERIFY(item != 0);
+
+ QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+
+ QVERIFY(model.count() == 0);
+ QVERIFY(spyModelRemoved.count() == 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "addList"));
+
+ QVERIFY(model.count() == 1);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "removeListViaWorker"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 1);
+ QVERIFY(spyModelRemoved.count() == 0);
+
+ QVERIFY(QMetaObject::invokeMethod(item, "doSync"));
+ waitForWorker(item);
+
+ QVERIFY(model.count() == 0);
+ QVERIFY(spyModelRemoved.count() == 1);
+
+ delete item;
+ qApp->processEvents();
+}
+
+void tst_qqmllistmodelworkerscript::dynamic_role_data()
+{
+ QTest::addColumn<QString>("preamble");
+ QTest::addColumn<QString>("script");
+ QTest::addColumn<int>("result");
+
+ QTest::newRow("sync1") << "{append({'a':[{'b':1},{'b':2}]})}" << "{get(0).a = 'string';count}" << 1;
+}
+
+void tst_qqmllistmodelworkerscript::dynamic_role()
+{
+ QFETCH(QString, preamble);
+ QFETCH(QString, script);
+ QFETCH(int, result);
+
+ QQmlListModel model;
+ model.setDynamicRoles(true);
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QQuickItem *item = createWorkerTest(&engine, &component, &model);
+ QVERIFY(item != 0);
+
+ QQmlExpression preExp(engine.rootContext(), &model, preamble);
+ QCOMPARE(preExp.evaluate().toInt(), 0);
+
+ if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}'))
+ script = script.mid(1, script.length() - 2);
+ QVariantList operations;
+ foreach (const QString &s, script.split(';')) {
+ if (!s.isEmpty())
+ operations << s;
+ }
+
+ // execute a set of commands on the worker list model, then check the
+ // changes are reflected in the list model in the main thread
+ QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker",
+ Q_ARG(QVariant, operations.mid(0, operations.length()-1))));
+ waitForWorker(item);
+
+ QQmlExpression e(engine.rootContext(), &model, operations.last().toString());
+ QCOMPARE(e.evaluate().toInt(), result);
+
+ delete item;
+ qApp->processEvents();
+}
+
+QTEST_MAIN(tst_qqmllistmodelworkerscript)
+
+#include "tst_qqmllistmodelworkerscript.moc"
diff --git a/tests/auto/qml/qqmllistreference/data/MyType.qml b/tests/auto/qml/qqmllistreference/data/MyType.qml
new file mode 100644
index 0000000000..f48a77598c
--- /dev/null
+++ b/tests/auto/qml/qqmllistreference/data/MyType.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a
+}
diff --git a/tests/auto/qml/qqmllistreference/data/engineTypes.qml b/tests/auto/qml/qqmllistreference/data/engineTypes.qml
new file mode 100644
index 0000000000..99a61a7680
--- /dev/null
+++ b/tests/auto/qml/qqmllistreference/data/engineTypes.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property list<MyType> myList
+
+ myList: [ MyType { a: 1 },
+ MyType { a: 9 } ]
+
+}
diff --git a/tests/auto/qml/qqmllistreference/data/variantToList.qml b/tests/auto/qml/qqmllistreference/data/variantToList.qml
new file mode 100644
index 0000000000..3728cd0311
--- /dev/null
+++ b/tests/auto/qml/qqmllistreference/data/variantToList.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ property list<QtObject> myList;
+ myList: QtObject {}
+
+ property variant value: myList
+ property int test: value.length
+}
+
diff --git a/tests/auto/qml/qqmllistreference/qqmllistreference.pro b/tests/auto/qml/qqmllistreference/qqmllistreference.pro
new file mode 100644
index 0000000000..f30b245975
--- /dev/null
+++ b/tests/auto/qml/qqmllistreference/qqmllistreference.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmllistreference
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmllistreference.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp
new file mode 100644
index 0000000000..a37355b566
--- /dev/null
+++ b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp
@@ -0,0 +1,636 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QUrl>
+#include <QFileInfo>
+#include <QDir>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlprivate.h>
+#include <QtQml/qqmlproperty.h>
+#include <QDebug>
+#include "../../shared/util.h"
+
+class tst_qqmllistreference : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmllistreference() {}
+
+private slots:
+ void initTestCase();
+ void qmllistreference();
+ void qmllistreference_invalid();
+ void isValid();
+ void object();
+ void listElementType();
+ void canAppend();
+ void canAt();
+ void canClear();
+ void canCount();
+ void isReadable();
+ void isManipulable();
+ void append();
+ void at();
+ void clear();
+ void count();
+ void copy();
+ void qmlmetaproperty();
+ void engineTypes();
+ void variantToList();
+};
+
+class TestType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<TestType> data READ dataProperty)
+ Q_PROPERTY(int intProperty READ intProperty)
+
+public:
+ TestType() : property(this, data) {}
+ QQmlListProperty<TestType> dataProperty() { return property; }
+ int intProperty() const { return 10; }
+
+ QList<TestType *> data;
+ QQmlListProperty<TestType> property;
+};
+
+void tst_qqmllistreference::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<TestType>();
+}
+
+void tst_qqmllistreference::qmllistreference()
+{
+ TestType tt;
+
+ QQmlListReference r(&tt, "data");
+ QVERIFY(r.isValid() == true);
+ QCOMPARE(r.count(), 0);
+
+ tt.data.append(&tt);
+ QCOMPARE(r.count(), 1);
+}
+
+void tst_qqmllistreference::qmllistreference_invalid()
+{
+ TestType tt;
+
+ // Invalid
+ {
+ QQmlListReference r;
+ QVERIFY(r.isValid() == false);
+ QVERIFY(r.object() == 0);
+ QVERIFY(r.listElementType() == 0);
+ QVERIFY(r.canAt() == false);
+ QVERIFY(r.canClear() == false);
+ QVERIFY(r.canCount() == false);
+ QVERIFY(r.append(0) == false);
+ QVERIFY(r.at(10) == 0);
+ QVERIFY(r.clear() == false);
+ QVERIFY(r.count() == 0);
+ QVERIFY(r.isReadable() == false);
+ QVERIFY(r.isManipulable() == false);
+ }
+
+ // Non-property
+ {
+ QQmlListReference r(&tt, "blah");
+ QVERIFY(r.isValid() == false);
+ QVERIFY(r.object() == 0);
+ QVERIFY(r.listElementType() == 0);
+ QVERIFY(r.canAt() == false);
+ QVERIFY(r.canClear() == false);
+ QVERIFY(r.canCount() == false);
+ QVERIFY(r.append(0) == false);
+ QVERIFY(r.at(10) == 0);
+ QVERIFY(r.clear() == false);
+ QVERIFY(r.count() == 0);
+ QVERIFY(r.isReadable() == false);
+ QVERIFY(r.isManipulable() == false);
+ }
+
+ // Non-list property
+ {
+ QQmlListReference r(&tt, "intProperty");
+ QVERIFY(r.isValid() == false);
+ QVERIFY(r.object() == 0);
+ QVERIFY(r.listElementType() == 0);
+ QVERIFY(r.canAt() == false);
+ QVERIFY(r.canClear() == false);
+ QVERIFY(r.canCount() == false);
+ QVERIFY(r.append(0) == false);
+ QVERIFY(r.at(10) == 0);
+ QVERIFY(r.clear() == false);
+ QVERIFY(r.count() == 0);
+ QVERIFY(r.isReadable() == false);
+ QVERIFY(r.isManipulable() == false);
+ }
+}
+
+void tst_qqmllistreference::isValid()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.isValid() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.isValid() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.isValid() == true);
+ delete tt;
+ QVERIFY(ref.isValid() == false);
+ }
+}
+
+void tst_qqmllistreference::object()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.object() == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.object() == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.object() == tt);
+ delete tt;
+ QVERIFY(ref.object() == 0);
+ }
+}
+
+void tst_qqmllistreference::listElementType()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.listElementType() == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.listElementType() == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.listElementType() == &TestType::staticMetaObject);
+ delete tt;
+ QVERIFY(ref.listElementType() == 0);
+ }
+}
+
+void tst_qqmllistreference::canAppend()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.canAppend() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.canAppend() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.canAppend() == true);
+ delete tt;
+ QVERIFY(ref.canAppend() == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.append = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.canAppend() == false);
+ }
+}
+
+void tst_qqmllistreference::canAt()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.canAt() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.canAt() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.canAt() == true);
+ delete tt;
+ QVERIFY(ref.canAt() == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.at = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.canAt() == false);
+ }
+}
+
+void tst_qqmllistreference::canClear()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.canClear() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.canClear() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.canClear() == true);
+ delete tt;
+ QVERIFY(ref.canClear() == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.clear = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.canClear() == false);
+ }
+}
+
+void tst_qqmllistreference::canCount()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.canCount() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.canCount() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.canCount() == true);
+ delete tt;
+ QVERIFY(ref.canCount() == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.count = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.canCount() == false);
+ }
+}
+
+void tst_qqmllistreference::isReadable()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.isReadable() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.isReadable() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.isReadable() == true);
+ delete tt;
+ QVERIFY(ref.isReadable() == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.count = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.isReadable() == false);
+ }
+}
+
+void tst_qqmllistreference::isManipulable()
+{
+ TestType *tt = new TestType;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.isManipulable() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.isManipulable() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.isManipulable() == true);
+ delete tt;
+ QVERIFY(ref.isManipulable() == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.count = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.isManipulable() == false);
+ }
+}
+
+void tst_qqmllistreference::append()
+{
+ TestType *tt = new TestType;
+ QObject object;
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.append(tt) == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.append(tt) == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.append(tt) == true);
+ QVERIFY(tt->data.count() == 1);
+ QVERIFY(tt->data.at(0) == tt);
+ QVERIFY(ref.append(&object) == false);
+ QVERIFY(tt->data.count() == 1);
+ QVERIFY(tt->data.at(0) == tt);
+ QVERIFY(ref.append(0) == true);
+ QVERIFY(tt->data.count() == 2);
+ QVERIFY(tt->data.at(0) == tt);
+ QVERIFY(tt->data.at(1) == 0);
+ delete tt;
+ QVERIFY(ref.append(0) == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.append = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.append(&tt) == false);
+ }
+}
+
+void tst_qqmllistreference::at()
+{
+ TestType *tt = new TestType;
+ tt->data.append(tt);
+ tt->data.append(0);
+ tt->data.append(tt);
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.at(0) == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.at(0) == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.at(0) == tt);
+ QVERIFY(ref.at(1) == 0);
+ QVERIFY(ref.at(2) == tt);
+ delete tt;
+ QVERIFY(ref.at(0) == 0);
+ }
+
+ {
+ TestType tt;
+ tt.data.append(&tt);
+ tt.property.at = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.at(0) == 0);
+ }
+}
+
+void tst_qqmllistreference::clear()
+{
+ TestType *tt = new TestType;
+ tt->data.append(tt);
+ tt->data.append(0);
+ tt->data.append(tt);
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.clear() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.clear() == false);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.clear() == true);
+ QVERIFY(tt->data.count() == 0);
+ delete tt;
+ QVERIFY(ref.clear() == false);
+ }
+
+ {
+ TestType tt;
+ tt.property.clear = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.clear() == false);
+ }
+}
+
+void tst_qqmllistreference::count()
+{
+ TestType *tt = new TestType;
+ tt->data.append(tt);
+ tt->data.append(0);
+ tt->data.append(tt);
+
+ {
+ QQmlListReference ref;
+ QVERIFY(ref.count() == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "blah");
+ QVERIFY(ref.count() == 0);
+ }
+
+ {
+ QQmlListReference ref(tt, "data");
+ QVERIFY(ref.count() == 3);
+ tt->data.removeAt(1);
+ QVERIFY(ref.count() == 2);
+ delete tt;
+ QVERIFY(ref.count() == 0);
+ }
+
+ {
+ TestType tt;
+ tt.data.append(&tt);
+ tt.property.count = 0;
+ QQmlListReference ref(&tt, "data");
+ QVERIFY(ref.count() == 0);
+ }
+}
+
+void tst_qqmllistreference::copy()
+{
+ TestType tt;
+ tt.data.append(&tt);
+ tt.data.append(0);
+ tt.data.append(&tt);
+
+ QQmlListReference *r1 = new QQmlListReference(&tt, "data");
+ QVERIFY(r1->count() == 3);
+
+ QQmlListReference r2(*r1);
+ QQmlListReference r3;
+ r3 = *r1;
+
+ QVERIFY(r2.count() == 3);
+ QVERIFY(r3.count() == 3);
+
+ delete r1;
+
+ QVERIFY(r2.count() == 3);
+ QVERIFY(r3.count() == 3);
+
+ tt.data.removeAt(2);
+
+ QVERIFY(r2.count() == 2);
+ QVERIFY(r3.count() == 2);
+}
+
+void tst_qqmllistreference::qmlmetaproperty()
+{
+ TestType tt;
+ tt.data.append(&tt);
+ tt.data.append(0);
+ tt.data.append(&tt);
+
+ QQmlProperty prop(&tt, QLatin1String("data"));
+ QVariant v = prop.read();
+ QVERIFY(v.userType() == qMetaTypeId<QQmlListReference>());
+ QQmlListReference ref = qvariant_cast<QQmlListReference>(v);
+ QVERIFY(ref.count() == 3);
+ QVERIFY(ref.listElementType() == &TestType::staticMetaObject);
+}
+
+void tst_qqmllistreference::engineTypes()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("engineTypes.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o);
+
+ QQmlProperty p1(o, QLatin1String("myList"));
+ QVERIFY(p1.propertyTypeCategory() == QQmlProperty::List);
+
+ QQmlProperty p2(o, QLatin1String("myList"), engine.rootContext());
+ QVERIFY(p2.propertyTypeCategory() == QQmlProperty::List);
+ QVariant v = p2.read();
+ QVERIFY(v.userType() == qMetaTypeId<QQmlListReference>());
+ QQmlListReference ref = qvariant_cast<QQmlListReference>(v);
+ QVERIFY(ref.count() == 2);
+ QVERIFY(ref.listElementType());
+ QVERIFY(ref.listElementType() != &QObject::staticMetaObject);
+
+ delete o;
+}
+
+void tst_qqmllistreference::variantToList()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("variantToList.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o);
+
+ QVERIFY(o->property("value").userType() == qMetaTypeId<QQmlListReference>());
+ QCOMPARE(o->property("test").toInt(), 1);
+
+ delete o;
+}
+
+QTEST_MAIN(tst_qqmllistreference)
+
+#include "tst_qqmllistreference.moc"
diff --git a/tests/auto/qml/qqmllocale/data/date.qml b/tests/auto/qml/qqmllocale/data/date.qml
new file mode 100644
index 0000000000..3f58497d22
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/data/date.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+QtObject {
+ property var locale: Qt.locale()
+
+ function setLocale(l) {
+ locale = Qt.locale(l)
+ }
+
+ function toLocaleString(fmt) {
+ var d = new Date(2011, 9, 7, 18, 53, 48, 345);
+ if (fmt < 0)
+ return d.toLocaleString(locale);
+ else
+ return d.toLocaleString(locale, fmt);
+ }
+
+ function toLocaleDateString(fmt) {
+ var d = new Date(2011, 9, 7, 18, 53, 48, 345);
+ if (fmt < 0)
+ return d.toLocaleDateString(locale);
+ else
+ return d.toLocaleDateString(locale, fmt);
+ }
+
+ function toLocaleTimeString(fmt) {
+ var d = new Date(2011, 9, 7, 18, 53, 48, 345);
+ if (fmt < 0)
+ return d.toLocaleTimeString(locale);
+ else
+ return d.toLocaleTimeString(locale, fmt);
+ }
+
+ function fromLocaleString(d,fmt) {
+ return Date.fromLocaleString(locale, d, fmt)
+ }
+
+ function fromLocaleDateString(d,fmt) {
+ return Date.fromLocaleDateString(locale, d, fmt)
+ }
+
+ function fromLocaleTimeString(d,fmt) {
+ return Date.fromLocaleTimeString(locale, d, fmt)
+ }
+}
diff --git a/tests/auto/qml/qqmllocale/data/functions.qml b/tests/auto/qml/qqmllocale/data/functions.qml
new file mode 100644
index 0000000000..5fef6a26fb
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/data/functions.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+
+QtObject {
+ property var locale: Qt.locale()
+
+ function setLocale(l) {
+ locale = Qt.locale(l)
+ }
+
+ function currencySymbol(type) {
+ if (type < 0)
+ return locale.currencySymbol()
+ else
+ return locale.currencySymbol(type)
+ }
+
+ function monthName(month,type) {
+ if (type < 0)
+ return locale.monthName(month)
+ else
+ return locale.monthName(month, type)
+ }
+
+ function standaloneMonthName(month,type) {
+ if (type < 0)
+ return locale.standaloneMonthName(month)
+ else
+ return locale.standaloneMonthName(month, type)
+ }
+
+ function dayName(month,type) {
+ if (type < 0)
+ return locale.dayName(month)
+ else
+ return locale.dayName(month, type)
+ }
+
+ function standaloneDayName(month,type) {
+ if (type < 0)
+ return locale.standaloneDayName(month)
+ else
+ return locale.standaloneDayName(month, type)
+ }
+
+ function dateTimeFormat(fmt) {
+ if (fmt < 0)
+ return locale.dateTimeFormat()
+ else
+ return locale.dateTimeFormat(fmt)
+ }
+
+ function dateFormat(fmt) {
+ if (fmt < 0)
+ return locale.dateFormat()
+ else
+ return locale.dateFormat(fmt)
+ }
+
+ function timeFormat(fmt) {
+ if (fmt < 0)
+ return locale.timeFormat()
+ else
+ return locale.timeFormat(fmt)
+ }
+}
diff --git a/tests/auto/qml/qqmllocale/data/localeCompare.qml b/tests/auto/qml/qqmllocale/data/localeCompare.qml
new file mode 100644
index 0000000000..6851af6ef9
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/data/localeCompare.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property var string1: "a"
+ property var string2: "a"
+ property var comparison: string1.localeCompare(string2)
+}
diff --git a/tests/auto/qml/qqmllocale/data/number.qml b/tests/auto/qml/qqmllocale/data/number.qml
new file mode 100644
index 0000000000..51a6c15dce
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/data/number.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+QtObject {
+ property var locale: Qt.locale()
+
+ function setLocale(l) {
+ locale = Qt.locale(l)
+ }
+
+ function toLocaleString(n,fmt,prec) {
+ if (prec < 0)
+ return n.toLocaleString(locale, fmt);
+ else
+ return n.toLocaleString(locale, fmt, prec);
+ }
+
+ function toLocaleCurrencyString(n,symbol) {
+ if (symbol.length == 0)
+ return n.toLocaleCurrencyString(locale);
+ else
+ return n.toLocaleCurrencyString(locale, symbol);
+ }
+
+ function fromLocaleString(n) {
+ return Number.fromLocaleString(locale, n)
+ }
+
+ property var const1: 1234.56.toLocaleString(locale);
+ property var const2: 1234..toLocaleString(locale);
+}
diff --git a/tests/auto/qml/qqmllocale/data/properties.qml b/tests/auto/qml/qqmllocale/data/properties.qml
new file mode 100644
index 0000000000..16d1f4092a
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/data/properties.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+QtObject {
+ property var locale: Qt.locale()
+
+ function setLocale(l) {
+ locale = Qt.locale(l);
+ }
+
+ property var name: locale.name
+ property var amText: locale.amText
+ property var pmText: locale.pmText
+ property var nativeLanguageName: locale.nativeLanguageName
+ property var nativeCountryName: locale.nativeCountryName
+ property var decimalPoint: locale.decimalPoint
+ property var groupSeparator: locale.groupSeparator
+ property var percent: locale.percent
+ property var zeroDigit: locale.zeroDigit
+ property var negativeSign: locale.negativeSign
+ property var positiveSign: locale.positiveSign
+ property var exponential: locale.exponential
+ property var firstDayOfWeek: locale.firstDayOfWeek
+ property var measurementSystem: locale.measurementSystem
+ property var textDirection: locale.textDirection
+ property var weekDays: locale.weekDays
+ property var uiLanguages: locale.uiLanguages
+}
diff --git a/tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml b/tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml
new file mode 100644
index 0000000000..cc6e1437ab
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/data/timeZoneUpdated.qml
@@ -0,0 +1,55 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ property date localDate
+ property date utcDate
+
+ Component.onCompleted: {
+ // Test date: 2012-06-01T02:15:30+10:00 (AEST timezone)
+ localDate = new Date(2012, 6-1, 1, 2, 15, 30)
+ utcDate = new Date(Date.UTC(2012, 6-1, 1, 2, 15, 30))
+
+ if (localDate.getTimezoneOffset() != -600) return
+
+ if (localDate.toLocaleString() != getLocalizedForm('2012-06-01T02:15:30+10:00')) return
+ if (localDate.toISOString() != "2012-05-31T16:15:30.000Z") return
+
+ if (utcDate.toISOString() != "2012-06-01T02:15:30.000Z") return
+ if (utcDate.toLocaleString() != getLocalizedForm('2012-06-01T12:15:30+10:00')) return
+
+ success = true
+ }
+
+ function check() {
+ success = false
+
+ // We have changed to IST time zone - inform JS:
+ Date.timeZoneUpdated()
+
+ if (localDate.getTimezoneOffset() != -330) return
+
+ if (localDate.toLocaleString() != getLocalizedForm('2012-06-01T02:15:30+05:30')) return
+ if (localDate.toISOString() != "2012-05-31T20:45:30.000Z") return
+
+ if (utcDate.toISOString() != "2012-06-01T06:45:30.000Z") return
+ if (utcDate.toLocaleString() != getLocalizedForm("2012-06-01T12:15:30+05:30")) return
+
+ // Create new dates in this timezone
+ localDate = new Date(2012, 6-1, 1, 2, 15, 30)
+ utcDate = new Date(Date.UTC(2012, 6-1, 1, 2, 15, 30))
+
+ if (localDate.toLocaleString() != getLocalizedForm("2012-06-01T02:15:30+05:30")) return
+ if (localDate.toISOString() != "2012-05-31T20:45:30.000Z") return
+
+ if (utcDate.toISOString() != "2012-06-01T02:15:30.000Z") return
+ if (utcDate.toLocaleString() != getLocalizedForm("2012-06-01T07:45:30+05:30")) return
+
+ success = true
+ }
+
+ function resetTimeZone() {
+ Date.timeZoneUpdated()
+ }
+}
diff --git a/tests/auto/qml/qqmllocale/qqmllocale.pro b/tests/auto/qml/qqmllocale/qqmllocale.pro
new file mode 100644
index 0000000000..6d8eccd61c
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/qqmllocale.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmllocale
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmllocale.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += qml testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
new file mode 100644
index 0000000000..53e49a4b9e
--- /dev/null
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -0,0 +1,1288 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QDebug>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtCore/QDateTime>
+#include <qcolor.h>
+#include "../../shared/util.h"
+
+#include <time.h>
+
+class tst_qqmllocale : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmllocale() { }
+
+private slots:
+ void defaultLocale();
+
+ void properties_data();
+ void properties();
+ void currencySymbol_data();
+ void currencySymbol();
+ void monthName_data();
+ void monthName();
+ void standaloneMonthName_data();
+ void standaloneMonthName();
+ void dayName_data();
+ void dayName();
+ void standaloneDayName_data();
+ void standaloneDayName();
+ void firstDayOfWeek_data();
+ void firstDayOfWeek();
+ void weekDays_data();
+ void weekDays();
+ void uiLanguages_data();
+ void uiLanguages();
+ void dateFormat_data();
+ void dateFormat();
+ void dateTimeFormat_data();
+ void dateTimeFormat();
+ void timeFormat_data();
+ void timeFormat();
+#if defined(Q_OS_UNIX)
+ void timeZoneUpdated();
+#endif
+
+ void dateToLocaleString_data();
+ void dateToLocaleString();
+ void dateToLocaleStringFormatted_data();
+ void dateToLocaleStringFormatted();
+ void dateToLocaleDateString_data();
+ void dateToLocaleDateString();
+ void dateToLocaleDateStringFormatted_data();
+ void dateToLocaleDateStringFormatted();
+ void dateToLocaleTimeString_data();
+ void dateToLocaleTimeString();
+ void dateToLocaleTimeStringFormatted_data();
+ void dateToLocaleTimeStringFormatted();
+ void dateFromLocaleString_data();
+ void dateFromLocaleString();
+ void dateFromLocaleDateString_data();
+ void dateFromLocaleDateString();
+ void dateFromLocaleTimeString_data();
+ void dateFromLocaleTimeString();
+
+ void numberToLocaleString_data();
+ void numberToLocaleString();
+ void numberToLocaleCurrencyString_data();
+ void numberToLocaleCurrencyString();
+ void numberFromLocaleString_data();
+ void numberFromLocaleString();
+ void numberConstToLocaleString();
+
+ void stringLocaleCompare_data();
+ void stringLocaleCompare();
+
+private:
+ void addPropertyData(const QString &l);
+ QVariant getProperty(QObject *obj, const QString &locale, const QString &property);
+ void addCurrencySymbolData(const QString &locale);
+ void addStandardFormatData();
+ void addFormatNameData(const QString &locale);
+ void addDateTimeFormatData(const QString &l);
+ void addDateFormatData(const QString &l);
+ void addTimeFormatData(const QString &l);
+ QQmlEngine engine;
+};
+
+void tst_qqmllocale::defaultLocale()
+{
+ QQmlComponent c(&engine, testFileUrl("properties.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QCOMPARE(obj->property("name").toString(), QLocale().name());
+}
+
+#define LOCALE_PROP(type,prop) { #prop, QVariant(type(qlocale.prop())) }
+
+void tst_qqmllocale::addPropertyData(const QString &l)
+{
+ QLocale qlocale(l);
+
+ struct {
+ const char *name;
+ QVariant value;
+ }
+ values[] = {
+ LOCALE_PROP(QString,name),
+ LOCALE_PROP(QString,amText),
+ LOCALE_PROP(QString,pmText),
+ LOCALE_PROP(QString,nativeLanguageName),
+ LOCALE_PROP(QString,nativeCountryName),
+ LOCALE_PROP(QString,decimalPoint),
+ LOCALE_PROP(QString,groupSeparator),
+ LOCALE_PROP(QString,percent),
+ LOCALE_PROP(QString,zeroDigit),
+ LOCALE_PROP(QString,negativeSign),
+ LOCALE_PROP(QString,positiveSign),
+ LOCALE_PROP(QString,exponential),
+ LOCALE_PROP(int,measurementSystem),
+ LOCALE_PROP(int,textDirection),
+ { 0, QVariant() }
+ };
+
+ int i = 0;
+ while (values[i].name) {
+ QByteArray n = l.toLatin1() + ':' + values[i].name;
+ QTest::newRow(n.constData()) << l << QByteArray(values[i].name) << values[i].value;
+ ++i;
+ }
+}
+
+void tst_qqmllocale::properties_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QByteArray>("property");
+ QTest::addColumn<QVariant>("value");
+
+ addPropertyData("en_US");
+ addPropertyData("de_DE");
+ addPropertyData("ar_SA");
+ addPropertyData("hi_IN");
+ addPropertyData("zh_CN");
+ addPropertyData("th_TH");
+}
+
+void tst_qqmllocale::properties()
+{
+ QFETCH(QString, locale);
+ QFETCH(QByteArray, property);
+ QFETCH(QVariant, value);
+
+ QQmlComponent c(&engine, testFileUrl("properties.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QCOMPARE(obj->property(property), value);
+
+ delete obj;
+}
+
+void tst_qqmllocale::addCurrencySymbolData(const QString &l)
+{
+ QByteArray locale = l.toLatin1();
+ QTest::newRow(locale.constData()) << l << -1;
+ QByteArray t(locale);
+ t += " CurrencyIsoCode";
+ QTest::newRow(t.constData()) << l << (int)QLocale::CurrencyIsoCode;
+ t = locale + " CurrencySymbol";
+ QTest::newRow(t.constData()) << l << (int)QLocale::CurrencySymbol;
+ t = locale + " CurrencyDisplayName";
+ QTest::newRow(t.constData()) << l << (int)QLocale::CurrencyDisplayName;
+}
+
+void tst_qqmllocale::currencySymbol_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<int>("param");
+
+ addCurrencySymbolData("en_US");
+ addCurrencySymbolData("de_DE");
+ addCurrencySymbolData("ar_SA");
+ addCurrencySymbolData("hi_IN");
+ addCurrencySymbolData("zh_CN");
+ addCurrencySymbolData("th_TH");
+}
+
+void tst_qqmllocale::currencySymbol()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+ QLocale::CurrencySymbolFormat format = QLocale::CurrencySymbol;
+
+ if (param >= 0)
+ format = QLocale::CurrencySymbolFormat(param);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QMetaObject::invokeMethod(obj, "currencySymbol", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(int(format))));
+
+ QCOMPARE(val.toString(), l.currencySymbol(format));
+
+ delete obj;
+}
+
+void tst_qqmllocale::addFormatNameData(const QString &l)
+{
+ QByteArray locale = l.toLatin1();
+ QTest::newRow(locale.constData()) << l << -1;
+ QByteArray t(locale);
+ t += " LongFormat";
+ QTest::newRow(t.constData()) << l << (int)QLocale::LongFormat;
+ t = locale + " ShortFormat";
+ QTest::newRow(t.constData()) << l << (int)QLocale::ShortFormat;
+ t = locale + " NarrowFormat";
+ QTest::newRow(t.constData()) << l << (int)QLocale::NarrowFormat;
+}
+
+void tst_qqmllocale::addStandardFormatData()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<int>("param");
+
+ addFormatNameData("en_US");
+ addFormatNameData("de_DE");
+ addFormatNameData("ar_SA");
+ addFormatNameData("hi_IN");
+ addFormatNameData("zh_CN");
+ addFormatNameData("th_TH");
+}
+
+void tst_qqmllocale::monthName_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::monthName()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+ QLocale::FormatType format = QLocale::LongFormat;
+ if (param >= 0)
+ format = QLocale::FormatType(param);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ for (int i = 0; i <= 11; ++i) {
+ QMetaObject::invokeMethod(obj, "monthName", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(i)),
+ Q_ARG(QVariant, QVariant(int(format))));
+
+ // QLocale January == 1, JS Date January == 0
+ QCOMPARE(val.toString(), l.monthName(i+1, format));
+ }
+
+ delete obj;
+}
+
+void tst_qqmllocale::standaloneMonthName_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::standaloneMonthName()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+ QLocale::FormatType format = QLocale::LongFormat;
+ if (param >= 0)
+ format = QLocale::FormatType(param);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ for (int i = 0; i <= 11; ++i) {
+ QMetaObject::invokeMethod(obj, "standaloneMonthName", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(i)),
+ Q_ARG(QVariant, QVariant(int(format))));
+
+ // QLocale January == 1, JS Date January == 0
+ QCOMPARE(val.toString(), l.standaloneMonthName(i+1, format));
+ }
+
+ delete obj;
+}
+
+void tst_qqmllocale::dayName_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::dayName()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+ QLocale::FormatType format = QLocale::LongFormat;
+ if (param >= 0)
+ format = QLocale::FormatType(param);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ for (int i = 1; i <= 7; ++i) {
+ QMetaObject::invokeMethod(obj, "dayName", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(i)),
+ Q_ARG(QVariant, QVariant(int(format))));
+
+ QCOMPARE(val.toString(), l.dayName(i, format));
+ }
+
+ delete obj;
+}
+
+void tst_qqmllocale::standaloneDayName_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::standaloneDayName()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+ QLocale::FormatType format = param < 0 ? QLocale::LongFormat : QLocale::FormatType(param);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ for (int i = 1; i <= 7; ++i) {
+ QMetaObject::invokeMethod(obj, "standaloneDayName", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(i)),
+ Q_ARG(QVariant, QVariant(int(format))));
+
+ QCOMPARE(val.toString(), l.standaloneDayName(i, format));
+ }
+
+ delete obj;
+}
+
+void tst_qqmllocale::firstDayOfWeek_data()
+{
+ QTest::addColumn<QString>("locale");
+
+ QTest::newRow("en_US") << "en_US";
+ QTest::newRow("de_DE") << "de_DE";
+ QTest::newRow("ar_SA") << "ar_SA";
+ QTest::newRow("hi_IN") << "hi_IN";
+ QTest::newRow("zh_CN") << "zh_CN";
+ QTest::newRow("th_TH") << "th_TH";
+}
+
+void tst_qqmllocale::firstDayOfWeek()
+{
+ QFETCH(QString, locale);
+
+ QQmlComponent c(&engine, testFileUrl("properties.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QVariant val = obj->property("firstDayOfWeek");
+ QVERIFY(val.type() == QVariant::Int);
+
+ int day = int(QLocale(locale).firstDayOfWeek());
+ if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday)
+ day = 0;
+ QCOMPARE(day, val.toInt());
+
+ delete obj;
+}
+
+void tst_qqmllocale::weekDays_data()
+{
+ QTest::addColumn<QString>("locale");
+
+ QTest::newRow("en_US") << "en_US";
+ QTest::newRow("de_DE") << "de_DE";
+ QTest::newRow("ar_SA") << "ar_SA";
+ QTest::newRow("hi_IN") << "hi_IN";
+ QTest::newRow("zh_CN") << "zh_CN";
+ QTest::newRow("th_TH") << "th_TH";
+}
+
+void tst_qqmllocale::weekDays()
+{
+ QFETCH(QString, locale);
+
+ QQmlComponent c(&engine, testFileUrl("properties.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QVariant val = obj->property("weekDays");
+ QVERIFY(val.type() == QVariant::List);
+
+ QList<QVariant> qmlDays = val.toList();
+ QList<Qt::DayOfWeek> days = QLocale(locale).weekdays();
+
+ QVERIFY(days.count() == qmlDays.count());
+
+ for (int i = 0; i < days.count(); ++i) {
+ int day = int(days.at(i));
+ if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday)
+ day = 0;
+ QCOMPARE(day, qmlDays.at(i).toInt());
+ }
+
+ delete obj;
+}
+
+void tst_qqmllocale::uiLanguages_data()
+{
+ QTest::addColumn<QString>("locale");
+
+ QTest::newRow("en_US") << "en_US";
+ QTest::newRow("de_DE") << "de_DE";
+ QTest::newRow("ar_SA") << "ar_SA";
+ QTest::newRow("hi_IN") << "hi_IN";
+ QTest::newRow("zh_CN") << "zh_CN";
+ QTest::newRow("th_TH") << "th_TH";
+}
+
+void tst_qqmllocale::uiLanguages()
+{
+ QFETCH(QString, locale);
+
+ QQmlComponent c(&engine, testFileUrl("properties.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QVariant val = obj->property("uiLanguages");
+ QVERIFY(val.type() == QVariant::List);
+
+ QList<QVariant> qmlLangs = val.toList();
+ QStringList langs = QLocale(locale).uiLanguages();
+
+ QVERIFY(langs.count() == qmlLangs.count());
+
+ for (int i = 0; i < langs.count(); ++i) {
+ QCOMPARE(langs.at(i), qmlLangs.at(i).toString());
+ }
+
+ delete obj;
+}
+
+
+void tst_qqmllocale::dateTimeFormat_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::dateTimeFormat()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale::FormatType format = param < 0 ? QLocale::LongFormat : QLocale::FormatType(param);
+ QMetaObject::invokeMethod(obj, "dateTimeFormat", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(param)));
+
+ QCOMPARE(val.toString(), l.dateTimeFormat(format));
+}
+
+void tst_qqmllocale::dateFormat_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::dateFormat()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale::FormatType format = param < 0 ? QLocale::LongFormat : QLocale::FormatType(param);
+ QMetaObject::invokeMethod(obj, "dateFormat", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(param)));
+
+ QCOMPARE(val.toString(), l.dateFormat(format));
+}
+
+void tst_qqmllocale::timeFormat_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::timeFormat()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("functions.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QVariant val;
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale::FormatType format = param < 0 ? QLocale::LongFormat : QLocale::FormatType(param);
+ QMetaObject::invokeMethod(obj, "timeFormat", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(param)));
+
+ QCOMPARE(val.toString(), l.timeFormat(format));
+}
+
+void tst_qqmllocale::dateToLocaleString_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::dateToLocaleString()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale::FormatType format = param < 0 ? QLocale::LongFormat : QLocale::FormatType(param);
+
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(param)));
+
+ QLocale l(locale);
+ QCOMPARE(val.toString(), l.toString(dt, format));
+}
+
+void tst_qqmllocale::addDateTimeFormatData(const QString &l)
+{
+ const char *formats[] = {
+ "hh:mm dd.MM.yyyy",
+ "h:m:sap ddd MMMM d yy",
+ "'The date and time is: 'H:mm:ss:zzz dd/MM/yy",
+ "MMM d yyyy HH:mm t",
+ 0
+ };
+ QByteArray locale = l.toLatin1();
+ int i = 0;
+ while (formats[i]) {
+ QByteArray t(locale);
+ t += " ";
+ t += formats[i];
+ QTest::newRow(t.constData()) << l << QString(formats[i]);
+ ++i;
+ }
+}
+
+void tst_qqmllocale::dateToLocaleStringFormatted_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QString>("format");
+
+ addDateTimeFormatData("en_US");
+ addDateTimeFormatData("de_DE");
+ addDateTimeFormatData("ar_SA");
+ addDateTimeFormatData("hi_IN");
+ addDateTimeFormatData("zh_CN");
+ addDateTimeFormatData("th_TH");
+}
+
+void tst_qqmllocale::dateToLocaleStringFormatted()
+{
+ QFETCH(QString, locale);
+ QFETCH(QString, format);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(format)));
+
+ QLocale l(locale);
+ QCOMPARE(val.toString(), l.toString(dt, format));
+}
+
+void tst_qqmllocale::dateToLocaleDateString_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::dateToLocaleDateString()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale::FormatType format = param < 0 ? QLocale::LongFormat : QLocale::FormatType(param);
+
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleDateString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(param)));
+
+ QLocale l(locale);
+ QCOMPARE(val.toString(), l.toString(dt.date(), format));
+}
+
+void tst_qqmllocale::addDateFormatData(const QString &l)
+{
+ const char *formats[] = {
+ "dd.MM.yyyy",
+ "ddd MMMM d yy",
+ "'The date is: 'dd/MM/yy",
+ "MMM d yyyy",
+ 0
+ };
+ QByteArray locale = l.toLatin1();
+ int i = 0;
+ while (formats[i]) {
+ QByteArray t(locale);
+ t += " ";
+ t += formats[i];
+ QTest::newRow(t.constData()) << l << QString(formats[i]);
+ ++i;
+ }
+}
+
+void tst_qqmllocale::dateToLocaleDateStringFormatted_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QString>("format");
+
+ addDateFormatData("en_US");
+ addDateFormatData("de_DE");
+ addDateFormatData("ar_SA");
+ addDateFormatData("hi_IN");
+ addDateFormatData("zh_CN");
+ addDateFormatData("th_TH");
+}
+
+void tst_qqmllocale::dateToLocaleDateStringFormatted()
+{
+ QFETCH(QString, locale);
+ QFETCH(QString, format);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(format)));
+
+ QLocale l(locale);
+ QCOMPARE(val.toString(), l.toString(dt.date(), format));
+}
+
+void tst_qqmllocale::dateToLocaleTimeString_data()
+{
+ addStandardFormatData();
+}
+
+void tst_qqmllocale::dateToLocaleTimeString()
+{
+ QFETCH(QString, locale);
+ QFETCH(int, param);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale::FormatType format = param < 0 ? QLocale::LongFormat : QLocale::FormatType(param);
+
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleTimeString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(param)));
+
+ QLocale l(locale);
+ QCOMPARE(val.toString(), l.toString(dt.time(), format));
+}
+
+void tst_qqmllocale::addTimeFormatData(const QString &l)
+{
+ const char *formats[] = {
+ "hh:mm",
+ "h:m:sap",
+ "'The time is: 'H:mm:ss:zzz",
+ "HH:mm t",
+ 0
+ };
+ QByteArray locale = l.toLatin1();
+ int i = 0;
+ while (formats[i]) {
+ QByteArray t(locale);
+ t += " ";
+ t += formats[i];
+ QTest::newRow(t.constData()) << l << QString(formats[i]);
+ ++i;
+ }
+}
+
+void tst_qqmllocale::dateToLocaleTimeStringFormatted_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QString>("format");
+
+ addTimeFormatData("en_US");
+ addTimeFormatData("de_DE");
+ addTimeFormatData("ar_SA");
+ addTimeFormatData("hi_IN");
+ addTimeFormatData("zh_CN");
+ addTimeFormatData("th_TH");
+}
+
+void tst_qqmllocale::dateToLocaleTimeStringFormatted()
+{
+ QFETCH(QString, locale);
+ QFETCH(QString, format);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7)); // weirdly, JS Date month range is 0-11
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(format)));
+
+ QLocale l(locale);
+ QCOMPARE(val.toString(), l.toString(dt.time(), format));
+}
+
+void tst_qqmllocale::dateFromLocaleString_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QString>("format");
+
+ QTest::newRow("en_US 1") << "en_US" << "dddd, MMMM d, yyyy h:mm:ss AP";
+ QTest::newRow("en_US long") << "en_US" << QLocale("en_US").dateTimeFormat();
+ QTest::newRow("en_US short") << "en_US" << QLocale("en_US").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("de_DE long") << "de_DE" << QLocale("de_DE").dateTimeFormat();
+ QTest::newRow("de_DE short") << "de_DE" << QLocale("de_DE").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("ar_SA long") << "ar_SA" << QLocale("ar_SA").dateTimeFormat();
+ QTest::newRow("ar_SA short") << "ar_SA" << QLocale("ar_SA").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("zh_CN long") << "zh_CN" << QLocale("zh_CN").dateTimeFormat();
+ QTest::newRow("zh_CN short") << "zh_CN" << QLocale("zh_CN").dateTimeFormat(QLocale::ShortFormat);
+}
+
+void tst_qqmllocale::dateFromLocaleString()
+{
+ QFETCH(QString, locale);
+ QFETCH(QString, format);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7));
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale l(locale);
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "fromLocaleString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(format)));
+
+ QDateTime pd = l.toDateTime(l.toString(dt, format), format);
+ QCOMPARE(val.toDateTime(), pd);
+}
+
+void tst_qqmllocale::dateFromLocaleDateString_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QString>("format");
+
+ QTest::newRow("en_US 1") << "en_US" << "dddd, MMMM d, yyyy h:mm:ss AP";
+ QTest::newRow("en_US long") << "en_US" << QLocale("en_US").dateTimeFormat();
+ QTest::newRow("en_US short") << "en_US" << QLocale("en_US").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("de_DE long") << "de_DE" << QLocale("de_DE").dateTimeFormat();
+ QTest::newRow("de_DE short") << "de_DE" << QLocale("de_DE").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("ar_SA long") << "ar_SA" << QLocale("ar_SA").dateTimeFormat();
+ QTest::newRow("ar_SA short") << "ar_SA" << QLocale("ar_SA").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("zh_CN long") << "zh_CN" << QLocale("zh_CN").dateTimeFormat();
+ QTest::newRow("zh_CN short") << "zh_CN" << QLocale("zh_CN").dateTimeFormat(QLocale::ShortFormat);
+}
+
+void tst_qqmllocale::dateFromLocaleDateString()
+{
+ QFETCH(QString, locale);
+ QFETCH(QString, format);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7));
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale l(locale);
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "fromLocaleDateString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(format)));
+
+ QDate pd = l.toDate(l.toString(dt, format), format);
+ QCOMPARE(val.toDate(), pd);
+}
+
+void tst_qqmllocale::dateFromLocaleTimeString_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QString>("format");
+
+ QTest::newRow("en_US 1") << "en_US" << "dddd, MMMM d, yyyy h:mm:ss AP";
+ QTest::newRow("en_US long") << "en_US" << QLocale("en_US").dateTimeFormat();
+ QTest::newRow("en_US short") << "en_US" << QLocale("en_US").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("de_DE long") << "de_DE" << QLocale("de_DE").dateTimeFormat();
+ QTest::newRow("de_DE short") << "de_DE" << QLocale("de_DE").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("ar_SA long") << "ar_SA" << QLocale("ar_SA").dateTimeFormat();
+ QTest::newRow("ar_SA short") << "ar_SA" << QLocale("ar_SA").dateTimeFormat(QLocale::ShortFormat);
+ QTest::newRow("zh_CN long") << "zh_CN" << QLocale("zh_CN").dateTimeFormat();
+ QTest::newRow("zh_CN short") << "zh_CN" << QLocale("zh_CN").dateTimeFormat(QLocale::ShortFormat);
+}
+
+void tst_qqmllocale::dateFromLocaleTimeString()
+{
+ QFETCH(QString, locale);
+ QFETCH(QString, format);
+
+ QQmlComponent c(&engine, testFileUrl("date.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QDateTime dt;
+ dt.setDate(QDate(2011, 10, 7));
+ dt.setTime(QTime(18, 53, 48, 345));
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale l(locale);
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "fromLocaleTimeString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(l.toString(dt, format))),
+ Q_ARG(QVariant, QVariant(format)));
+
+ QTime pd = l.toTime(l.toString(dt, format), format);
+ QCOMPARE(val.toTime(), pd);
+}
+
+void tst_qqmllocale::numberToLocaleString_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<char>("format");
+ QTest::addColumn<int>("prec");
+
+ QTest::newRow("en_US 1") << "en_US" << 'f' << 2;
+ QTest::newRow("en_US 2") << "en_US" << 'g' << 3;
+ QTest::newRow("en_US 3") << "en_US" << 'f' << 0;
+ QTest::newRow("en_US 4") << "en_US" << 'f' << -1;
+ QTest::newRow("de_DE 1") << "de_DE" << 'f' << 2;
+ QTest::newRow("de_DE 2") << "de_DE" << 'g' << 3;
+ QTest::newRow("ar_SA 1") << "ar_SA" << 'f' << 2;
+ QTest::newRow("ar_SA 2") << "ar_SA" << 'g' << 3;
+}
+
+void tst_qqmllocale::numberToLocaleString()
+{
+ QFETCH(QString, locale);
+ QFETCH(char, format);
+ QFETCH(int, prec);
+
+ QQmlComponent c(&engine, testFileUrl("number.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ double number = 2344423.3289;
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale l(locale);
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(number)),
+ Q_ARG(QVariant, QVariant(QString(format))),
+ Q_ARG(QVariant, QVariant(prec)));
+
+ if (prec < 0) prec = 2;
+ QCOMPARE(val.toString(), l.toString(number, format, prec));
+}
+
+void tst_qqmllocale::numberToLocaleCurrencyString_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<QString>("symbol");
+
+ QTest::newRow("en_US 1") << "en_US" << QString();
+ QTest::newRow("en_US 2") << "en_US" << "USD";
+ QTest::newRow("de_DE") << "de_DE" << QString();
+ QTest::newRow("ar_SA") << "ar_SA" << QString();
+ QTest::newRow("hi_IN") << "hi_IN" << QString();
+ QTest::newRow("zh_CN") << "zh_CN" << QString();
+ QTest::newRow("th_TH") << "th_TH" << QString();
+}
+
+void tst_qqmllocale::numberToLocaleCurrencyString()
+{
+ QFETCH(QString, locale);
+ QFETCH(QString, symbol);
+
+ QQmlComponent c(&engine, testFileUrl("number.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ double number = 2344423.3289;
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QLocale l(locale);
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "toLocaleCurrencyString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(number)),
+ Q_ARG(QVariant, QVariant(symbol)));
+
+ QCOMPARE(val.toString(), l.toCurrencyString(number, symbol));
+}
+
+void tst_qqmllocale::numberFromLocaleString_data()
+{
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<double>("number");
+
+ QTest::newRow("en_US 1") << "en_US" << 1234567.2345;
+ QTest::newRow("en_US 2") << "en_US" << 0.234;
+ QTest::newRow("en_US 3") << "en_US" << 234.0;
+ QTest::newRow("de_DE") << "de_DE" << 1234567.2345;
+ QTest::newRow("ar_SA") << "ar_SA" << 1234567.2345;
+ QTest::newRow("hi_IN") << "hi_IN" << 1234567.2345;
+ QTest::newRow("zh_CN") << "zh_CN" << 1234567.2345;
+ QTest::newRow("th_TH") << "th_TH" << 1234567.2345;
+}
+
+void tst_qqmllocale::numberFromLocaleString()
+{
+ QFETCH(QString, locale);
+ QFETCH(double, number);
+
+ QQmlComponent c(&engine, testFileUrl("number.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QLocale l(locale);
+ QString strNumber = l.toString(number, 'f');
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant(locale)));
+
+ QVariant val;
+ QMetaObject::invokeMethod(obj, "fromLocaleString", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, val),
+ Q_ARG(QVariant, QVariant(strNumber)));
+
+ QCOMPARE(val.toDouble(), l.toDouble(strNumber));
+}
+
+void tst_qqmllocale::numberConstToLocaleString()
+{
+ QQmlComponent c(&engine, testFileUrl("number.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QMetaObject::invokeMethod(obj, "setLocale", Qt::DirectConnection,
+ Q_ARG(QVariant, QVariant("en_US")));
+
+ QLocale l("en_US");
+ QCOMPARE(obj->property("const1").toString(), l.toString(1234.56, 'f', 2));
+ QCOMPARE(obj->property("const2").toString(), l.toString(1234., 'f', 2));
+}
+
+void tst_qqmllocale::stringLocaleCompare_data()
+{
+ QTest::addColumn<QString>("string1");
+ QTest::addColumn<QString>("string2");
+
+ QTest::newRow("before") << "a" << "b";
+ QTest::newRow("equal") << "a" << "a";
+ QTest::newRow("after") << "b" << "a";
+
+ // Copied from QString::localeAwareCompare tests
+ // We don't actually change locale - we just care that String.localeCompare()
+ // matches QString::localeAwareCompare();
+ QTest::newRow("swedish1") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4");
+ QTest::newRow("swedish2") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6");
+ QTest::newRow("swedish3") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6");
+ QTest::newRow("swedish4") << QString::fromLatin1("z") << QString::fromLatin1("\xe5");
+
+ QTest::newRow("german1") << QString::fromLatin1("z") << QString::fromLatin1("\xe4");
+ QTest::newRow("german2") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6");
+ QTest::newRow("german3") << QString::fromLatin1("z") << QString::fromLatin1("\xf6");
+}
+
+void tst_qqmllocale::stringLocaleCompare()
+{
+ QFETCH(QString, string1);
+ QFETCH(QString, string2);
+
+ QQmlComponent c(&engine, testFileUrl("localeCompare.qml"));
+
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ obj->setProperty("string1", string1);
+ obj->setProperty("string2", string2);
+
+ QCOMPARE(obj->property("comparison").toInt(), QString::localeAwareCompare(string1, string2));
+}
+
+class DateFormatter : public QObject
+{
+ Q_OBJECT
+public:
+ DateFormatter() : QObject() {}
+
+ Q_INVOKABLE QString getLocalizedForm(const QString &isoTimestamp);
+};
+
+QString DateFormatter::getLocalizedForm(const QString &isoTimestamp)
+{
+ QDateTime input = QDateTime::fromString(isoTimestamp, Qt::ISODate);
+ QLocale locale;
+ return locale.toString(input);
+}
+
+#if defined(Q_OS_UNIX)
+// Currently disabled on Windows as adjusting the timezone
+// requires additional privileges that aren't normally
+// enabled for a process. This can be achieved by calling
+// AdjustTokenPrivileges() and then SetTimeZoneInformation(),
+// which will require linking to a different library to access that API.
+static void setTimeZone(const QByteArray &tz)
+{
+ qputenv("TZ", tz);
+ ::tzset();
+
+// following left for future reference, see comment above
+// #if defined(Q_OS_WIN32)
+// ::_tzset();
+// #endif
+}
+
+void tst_qqmllocale::timeZoneUpdated()
+{
+ QByteArray original(qgetenv("TZ"));
+
+ // Set the timezone to Brisbane time
+ setTimeZone(QByteArray("AEST-10:00"));
+
+ DateFormatter formatter;
+
+ QQmlEngine e;
+ e.rootContext()->setContextObject(&formatter);
+
+ QQmlComponent c(&e, testFileUrl("timeZoneUpdated.qml"));
+ QScopedPointer<QObject> obj(c.create());
+ QVERIFY(obj);
+ QCOMPARE(obj->property("success").toBool(), true);
+
+ // Change to Indian time
+ setTimeZone(QByteArray("IST-05:30"));
+
+ QMetaObject::invokeMethod(obj.data(), "check");
+
+ // Reset to original time
+ setTimeZone(original);
+ QMetaObject::invokeMethod(obj.data(), "resetTimeZone");
+
+ QCOMPARE(obj->property("success").toBool(), true);
+}
+#endif
+
+QTEST_MAIN(tst_qqmllocale)
+
+#include "tst_qqmllocale.moc"
diff --git a/tests/auto/qml/qqmlmetaobject/data/method.1.qml b/tests/auto/qml/qqmlmetaobject/data/method.1.qml
new file mode 100644
index 0000000000..a021881743
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/method.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ function testFunction() { return 19; }
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/method.2.qml b/tests/auto/qml/qqmlmetaobject/data/method.2.qml
new file mode 100644
index 0000000000..d514955f47
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/method.2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ function testFunction(foo) { return 19; }
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/method.3.qml b/tests/auto/qml/qqmlmetaobject/data/method.3.qml
new file mode 100644
index 0000000000..d6d19758c9
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/method.3.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ function testFunction(foo, bar, baz) { return 19; }
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.MyQmlObject.qml b/tests/auto/qml/qqmlmetaobject/data/property.MyQmlObject.qml
new file mode 100644
index 0000000000..8903bbb3e9
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.MyQmlObject.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property MyQmlObject test: MyQmlObject {}
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.QtObject.qml b/tests/auto/qml/qqmlmetaobject/data/property.QtObject.qml
new file mode 100644
index 0000000000..20c42b5851
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.QtObject.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject test: QtObject {}
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.alias.2.qml b/tests/auto/qml/qqmlmetaobject/data/property.alias.2.qml
new file mode 100644
index 0000000000..cae1ae6696
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.alias.2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ id: me
+ property alias test: me
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.alias.3.qml b/tests/auto/qml/qqmlmetaobject/data/property.alias.3.qml
new file mode 100644
index 0000000000..86422ae367
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.alias.3.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Text {
+ id: me
+ font.family: "Arial"
+ property alias test: me.font.family
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.alias.qml b/tests/auto/qml/qqmlmetaobject/data/property.alias.qml
new file mode 100644
index 0000000000..33a4a1c5b0
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.alias.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ objectName: "Joe"
+ id: me
+ property alias test: me.objectName
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.bool.qml b/tests/auto/qml/qqmlmetaobject/data/property.bool.qml
new file mode 100644
index 0000000000..9459cb6394
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.bool.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ default property bool test: true
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.color.qml b/tests/auto/qml/qqmlmetaobject/data/property.color.qml
new file mode 100644
index 0000000000..7451a27101
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.color.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ default property color test: "#ff0000"
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.date.qml b/tests/auto/qml/qqmlmetaobject/data/property.date.qml
new file mode 100644
index 0000000000..05fcb2516c
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.date.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property date test: "2012-02-07"
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.double.qml b/tests/auto/qml/qqmlmetaobject/data/property.double.qml
new file mode 100644
index 0000000000..65da1889e4
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.double.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property double test: 1234567890
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.int.qml b/tests/auto/qml/qqmlmetaobject/data/property.int.qml
new file mode 100644
index 0000000000..ae419d08cb
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.int.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test: 19
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.list.MyQmlObject.qml b/tests/auto/qml/qqmlmetaobject/data/property.list.MyQmlObject.qml
new file mode 100644
index 0000000000..602762cba2
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.list.MyQmlObject.qml
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+QtObject {
+ property list<MyQmlObject> test: [ MyQmlObject {} ]
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.list.QtObject.qml b/tests/auto/qml/qqmlmetaobject/data/property.list.QtObject.qml
new file mode 100644
index 0000000000..e774d70b42
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.list.QtObject.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property list<QtObject> test: [ QtObject {} ]
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.real.qml b/tests/auto/qml/qqmlmetaobject/data/property.real.qml
new file mode 100644
index 0000000000..2268aac8c2
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.real.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property real test: 1234567890
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.string.qml b/tests/auto/qml/qqmlmetaobject/data/property.string.qml
new file mode 100644
index 0000000000..2a625c4fe4
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.string.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ default property string test: "dog"
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.url.qml b/tests/auto/qml/qqmlmetaobject/data/property.url.qml
new file mode 100644
index 0000000000..c820c82515
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.url.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property url test: "http://foo.bar"
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.var.qml b/tests/auto/qml/qqmlmetaobject/data/property.var.qml
new file mode 100644
index 0000000000..9ea9245317
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.var.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property var test: [5, true, "ciao"]
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/property.variant.qml b/tests/auto/qml/qqmlmetaobject/data/property.variant.qml
new file mode 100644
index 0000000000..edffa173c4
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/property.variant.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ default property variant test: "12,34"
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/signal.1.qml b/tests/auto/qml/qqmlmetaobject/data/signal.1.qml
new file mode 100644
index 0000000000..113130f3cc
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/signal.1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal testSignal
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/signal.2.qml b/tests/auto/qml/qqmlmetaobject/data/signal.2.qml
new file mode 100644
index 0000000000..db860cc7cd
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/signal.2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal testSignal(string foo)
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/signal.3.qml b/tests/auto/qml/qqmlmetaobject/data/signal.3.qml
new file mode 100644
index 0000000000..4d04041f8f
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/signal.3.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal testSignal(int foo, bool bar, real baz)
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/signal.4.qml b/tests/auto/qml/qqmlmetaobject/data/signal.4.qml
new file mode 100644
index 0000000000..ad9b002176
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/signal.4.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal testSignal(variant foo, var bar)
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/signal.5.qml b/tests/auto/qml/qqmlmetaobject/data/signal.5.qml
new file mode 100644
index 0000000000..b848bb5cb5
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/signal.5.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal testSignal(color foo, date bar, url baz)
+}
diff --git a/tests/auto/qml/qqmlmetaobject/data/signal.6.qml b/tests/auto/qml/qqmlmetaobject/data/signal.6.qml
new file mode 100644
index 0000000000..a4ec6c0eaa
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/data/signal.6.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ signal testSignal(double foo)
+}
diff --git a/tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro b/tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro
new file mode 100644
index 0000000000..87f70852fa
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/qqmlmetaobject.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+TARGET = tst_qqmlmetaobject
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlmetaobject.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+QT += qml testlib gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
new file mode 100644
index 0000000000..5d6d0d66de
--- /dev/null
+++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
@@ -0,0 +1,401 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlengine.h>
+#include "../../shared/util.h"
+
+Q_DECLARE_METATYPE(QMetaMethod::MethodType)
+
+class MyQmlObject : public QObject
+{
+ Q_OBJECT
+};
+QML_DECLARE_TYPE(MyQmlObject)
+
+class tst_QQmlMetaObject : public QQmlDataTest
+{
+ Q_OBJECT
+private slots:
+ void initTestCase();
+
+ void property_data();
+ void property();
+ void method_data();
+ void method();
+
+private:
+ MyQmlObject myQmlObject;
+};
+
+void tst_QQmlMetaObject::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+
+ qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObject");
+}
+
+void tst_QQmlMetaObject::property_data()
+{
+ QTest::addColumn<QString>("testFile");
+ QTest::addColumn<QByteArray>("cppTypeName");
+ QTest::addColumn<int>("cppType");
+ QTest::addColumn<bool>("isDefault");
+ QTest::addColumn<QVariant>("expectedValue");
+ QTest::addColumn<bool>("isWritable");
+ QTest::addColumn<QVariant>("newValue");
+
+ QTest::newRow("int") << "property.int.qml"
+ << QByteArray("int") << int(QMetaType::Int)
+ << false // default
+ << QVariant(19) << true << QVariant(42);
+ QTest::newRow("bool") << "property.bool.qml"
+ << QByteArray("bool") << int(QMetaType::Bool)
+ << true // default
+ << QVariant(true) << true << QVariant(false);
+ QTest::newRow("double") << "property.double.qml"
+ << QByteArray("double") << int(QMetaType::Double)
+ << false // default
+ << QVariant(double(1234567890.))
+ << true // writable
+ << QVariant(double(1.23456789));
+ QTest::newRow("real") << "property.real.qml"
+ << QByteArray("double") << int(QMetaType::Double)
+ << false // default
+ << QVariant(double(1234567890.))
+ << true // writable
+ << QVariant(double(1.23456789));
+ QTest::newRow("string") << "property.string.qml"
+ << QByteArray("QString") << int(QMetaType::QString)
+ << true // default
+ << QVariant(QString::fromLatin1("dog"))
+ << true // writable
+ << QVariant(QString::fromLatin1("food"));
+ QTest::newRow("url") << "property.url.qml"
+ << QByteArray("QUrl") << int(QMetaType::QUrl)
+ << false // default
+ << QVariant(QUrl("http://foo.bar"))
+ << true //writable
+ << QVariant(QUrl("http://bar.baz"));
+ QTest::newRow("color") << "property.color.qml"
+ << QByteArray("QColor") << int(QMetaType::QColor)
+ << true // default
+ << QVariant(QColor("#ff0000"))
+ << true // writable
+ << QVariant(QColor("#00ff00"));
+ QTest::newRow("date") << "property.date.qml"
+ << QByteArray("QDateTime") << int(QMetaType::QDateTime)
+ << false // default
+ << QVariant(QDateTime(QDate(2012, 2, 7)))
+ << true // writable
+ << QVariant(QDateTime(QDate(2010, 7, 2)));
+ QTest::newRow("variant") << "property.variant.qml"
+ << QByteArray("QVariant") << int(QMetaType::QVariant)
+ << true // default
+ << QVariant(QPointF(12, 34))
+ << true // writable
+ << QVariant(QSizeF(45, 67));
+ QTest::newRow("var") << "property.var.qml"
+ << QByteArray("QVariant") << int(QMetaType::QVariant)
+ << false // default
+ << QVariant(QVariantList() << 5 << true << "ciao")
+ << true // writable
+ << QVariant(QVariantList() << 17.0);
+ QTest::newRow("QtObject") << "property.QtObject.qml"
+ << QByteArray("QObject*") << int(QMetaType::QObjectStar)
+ << false // default
+ << QVariant()
+ << true // writable
+ << QVariant::fromValue(static_cast<QObject*>(this));
+ QTest::newRow("list<QtObject>") << "property.list.QtObject.qml"
+ << QByteArray("QQmlListProperty<QObject>")
+ << qMetaTypeId<QQmlListProperty<QObject> >()
+ << false // default
+ << QVariant()
+ << false // writable
+ << QVariant();
+ QTest::newRow("MyQmlObject") << "property.MyQmlObject.qml"
+ << QByteArray("MyQmlObject*") << qMetaTypeId<MyQmlObject*>()
+ << false // default
+ << QVariant()
+ << true // writable
+ << QVariant::fromValue(&myQmlObject);
+ QTest::newRow("list<MyQmlObject>") << "property.list.MyQmlObject.qml"
+ << QByteArray("QQmlListProperty<MyQmlObject>")
+ << qMetaTypeId<QQmlListProperty<MyQmlObject> >()
+ << false // default
+ << QVariant()
+ << false // writable
+ << QVariant();
+ QTest::newRow("alias") << "property.alias.qml"
+ << QByteArray("QString") << int(QMetaType::QString)
+ << false // default
+ << QVariant(QString::fromLatin1("Joe"))
+ << true // writable
+ << QVariant(QString::fromLatin1("Bob"));
+ QTest::newRow("alias-2") << "property.alias.2.qml"
+ << QByteArray("QObject*") << int(QMetaType::QObjectStar)
+ << false // default
+ << QVariant()
+ << false // writable
+ << QVariant();
+ QTest::newRow("alias-3") << "property.alias.3.qml"
+ << QByteArray("QString") << int(QMetaType::QString)
+ << false // default
+ << QVariant(QString::fromLatin1("Arial"))
+ << true // writable
+ << QVariant(QString::fromLatin1("Helvetica"));
+}
+
+void tst_QQmlMetaObject::property()
+{
+ QFETCH(QString, testFile);
+ QFETCH(QByteArray, cppTypeName);
+ QFETCH(int, cppType);
+ QFETCH(bool, isDefault);
+ QFETCH(QVariant, expectedValue);
+ QFETCH(bool, isWritable);
+ QFETCH(QVariant, newValue);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl(testFile));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ const QMetaObject *mo = object->metaObject();
+ QVERIFY(mo->superClass() != 0);
+ QVERIFY(QByteArray(mo->className()).contains("_QML_"));
+ QCOMPARE(mo->propertyOffset(), mo->superClass()->propertyCount());
+ QCOMPARE(mo->propertyCount(), mo->superClass()->propertyCount() + 1);
+
+ QMetaProperty prop = mo->property(mo->propertyOffset());
+ QCOMPARE(prop.name(), "test");
+
+ QCOMPARE(QByteArray(prop.typeName()), cppTypeName);
+ if (prop.userType() < QMetaType::User)
+ QCOMPARE(prop.type(), QVariant::Type(cppType));
+ else
+ QCOMPARE(prop.type(), QVariant::UserType);
+ QCOMPARE(prop.userType(), cppType);
+
+ QVERIFY(!prop.isConstant());
+ QVERIFY(!prop.isDesignable());
+ QVERIFY(!prop.isEnumType());
+ QVERIFY(!prop.isFinal());
+ QVERIFY(!prop.isFlagType());
+ QVERIFY(prop.isReadable());
+ QVERIFY(!prop.isResettable());
+ QVERIFY(prop.isScriptable());
+ QVERIFY(!prop.isStored());
+ QVERIFY(!prop.isUser());
+ QVERIFY(prop.isValid());
+ QCOMPARE(prop.isWritable(), isWritable);
+
+ QCOMPARE(mo->classInfoOffset(), mo->superClass()->classInfoCount());
+ QCOMPARE(mo->classInfoCount(), mo->superClass()->classInfoCount() + (isDefault ? 1 : 0));
+ if (isDefault) {
+ QMetaClassInfo info = mo->classInfo(mo->classInfoOffset());
+ QCOMPARE(info.name(), "DefaultProperty");
+ QCOMPARE(info.value(), "test");
+ }
+
+ QCOMPARE(mo->methodOffset(), mo->superClass()->methodCount());
+ QCOMPARE(mo->methodCount(), mo->superClass()->methodCount() + 1); // the signal
+
+ QVERIFY(prop.notifySignalIndex() != -1);
+ QMetaMethod signal = prop.notifySignal();
+ QCOMPARE(signal.methodType(), QMetaMethod::Signal);
+ QCOMPARE(signal.name(), QByteArray("testChanged"));
+ QCOMPARE(signal.methodSignature(), QByteArray("testChanged()"));
+ QCOMPARE(signal.access(), QMetaMethod::Protected);
+ QCOMPARE(signal.parameterCount(), 0);
+ QCOMPARE(signal.parameterTypes(), QList<QByteArray>());
+ QCOMPARE(signal.parameterNames(), QList<QByteArray>());
+ QCOMPARE(signal.tag(), "");
+ QCOMPARE(signal.typeName(), "void");
+ QCOMPARE(signal.returnType(), int(QMetaType::Void));
+
+ QSignalSpy changedSpy(object, SIGNAL(testChanged()));
+ QObject::connect(object, SIGNAL(testChanged()), object, SLOT(deleteLater()));
+
+ if (expectedValue.isValid())
+ QCOMPARE(prop.read(object), expectedValue);
+ else
+ QVERIFY(prop.read(object).isValid());
+ QCOMPARE(changedSpy.count(), 0);
+
+ if (isWritable) {
+ QVERIFY(prop.write(object, newValue));
+ QCOMPARE(changedSpy.count(), 1);
+ QCOMPARE(prop.read(object), newValue);
+ } else {
+ QVERIFY(!prop.write(object, prop.read(object)));
+ QCOMPARE(changedSpy.count(), 0);
+ }
+
+ delete object;
+}
+
+void tst_QQmlMetaObject::method_data()
+{
+ QTest::addColumn<QString>("testFile");
+ QTest::addColumn<QString>("signature");
+ QTest::addColumn<QMetaMethod::MethodType>("methodType");
+ QTest::addColumn<int>("returnType");
+ QTest::addColumn<QString>("returnTypeName");
+ QTest::addColumn<QList<int> >("parameterTypes");
+ QTest::addColumn<QList<QByteArray> >("parameterTypeNames");
+ QTest::addColumn<QList<QByteArray> >("parameterNames");
+
+ QTest::newRow("testFunction()") << "method.1.qml"
+ << "testFunction()"
+ << QMetaMethod::Slot
+ << int(QMetaType::QVariant) << "QVariant"
+ << QList<int>()
+ << QList<QByteArray>()
+ << QList<QByteArray>();
+ QTest::newRow("testFunction(foo)") << "method.2.qml"
+ << "testFunction(QVariant)"
+ << QMetaMethod::Slot
+ << int(QMetaType::QVariant) << "QVariant"
+ << (QList<int>() << QMetaType::QVariant)
+ << (QList<QByteArray>() << "QVariant")
+ << (QList<QByteArray>() << "foo");
+ QTest::newRow("testFunction(foo, bar, baz)") << "method.3.qml"
+ << "testFunction(QVariant,QVariant,QVariant)"
+ << QMetaMethod::Slot
+ << int(QMetaType::QVariant) << "QVariant"
+ << (QList<int>() << QMetaType::QVariant << QMetaType::QVariant << QMetaType::QVariant)
+ << (QList<QByteArray>() << "QVariant" << "QVariant" << "QVariant")
+ << (QList<QByteArray>() << "foo" << "bar" << "baz");
+ QTest::newRow("testSignal") << "signal.1.qml"
+ << "testSignal()"
+ << QMetaMethod::Signal
+ << int(QMetaType::Void) << "void"
+ << QList<int>()
+ << QList<QByteArray>()
+ << QList<QByteArray>();
+ QTest::newRow("testSignal(string foo)") << "signal.2.qml"
+ << "testSignal(QString)"
+ << QMetaMethod::Signal
+ << int(QMetaType::Void) << "void"
+ << (QList<int>() << QMetaType::QString)
+ << (QList<QByteArray>() << "QString")
+ << (QList<QByteArray>() << "foo");
+ QTest::newRow("testSignal(int foo, bool bar, real baz)") << "signal.3.qml"
+ << "testSignal(int,bool,double)"
+ << QMetaMethod::Signal
+ << int(QMetaType::Void) << "void"
+ << (QList<int>() << QMetaType::Int << QMetaType::Bool << QMetaType::Double)
+ << (QList<QByteArray>() << "int" << "bool" << "double")
+ << (QList<QByteArray>() << "foo" << "bar" << "baz");
+ QTest::newRow("testSignal(variant foo, var bar)") << "signal.4.qml"
+ << "testSignal(QVariant,QVariant)"
+ << QMetaMethod::Signal
+ << int(QMetaType::Void) << "void"
+ << (QList<int>() << QMetaType::QVariant << QMetaType::QVariant)
+ << (QList<QByteArray>() << "QVariant" << "QVariant")
+ << (QList<QByteArray>() << "foo" << "bar");
+ QTest::newRow("testSignal(color foo, date bar, url baz)") << "signal.5.qml"
+ << "testSignal(QColor,QDateTime,QUrl)"
+ << QMetaMethod::Signal
+ << int(QMetaType::Void) << "void"
+ << (QList<int>() << QMetaType::QColor << QMetaType::QDateTime << QMetaType::QUrl)
+ << (QList<QByteArray>() << "QColor" << "QDateTime" << "QUrl")
+ << (QList<QByteArray>() << "foo" << "bar" << "baz");
+ QTest::newRow("testSignal(double foo)") << "signal.6.qml"
+ << "testSignal(double)"
+ << QMetaMethod::Signal
+ << int(QMetaType::Void) << "void"
+ << (QList<int>() << QMetaType::Double)
+ << (QList<QByteArray>() << "double")
+ << (QList<QByteArray>() << "foo");
+}
+
+void tst_QQmlMetaObject::method()
+{
+ QFETCH(QString, testFile);
+ QFETCH(QString, signature);
+ QFETCH(QMetaMethod::MethodType, methodType);
+ QFETCH(int, returnType);
+ QFETCH(QString, returnTypeName);
+ QFETCH(QList<int>, parameterTypes);
+ QFETCH(QList<QByteArray>, parameterTypeNames);
+ QFETCH(QList<QByteArray>, parameterNames);
+
+ QCOMPARE(parameterTypes.size(), parameterTypeNames.size());
+ QCOMPARE(parameterTypeNames.size(), parameterNames.size());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl(testFile));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ const QMetaObject *mo = object->metaObject();
+ QVERIFY(mo->superClass() != 0);
+ QVERIFY(QByteArray(mo->className()).contains("_QML_"));
+ QCOMPARE(mo->methodOffset(), mo->superClass()->methodCount());
+ QCOMPARE(mo->methodCount(), mo->superClass()->methodCount() + 1);
+
+ QMetaMethod method = mo->method(mo->methodOffset());
+ QCOMPARE(method.methodType(), methodType);
+ QCOMPARE(QString::fromUtf8(method.methodSignature().constData()), signature);
+ QCOMPARE(method.access(), QMetaMethod::Protected);
+
+ QString computedName = signature.left(signature.indexOf('('));
+ QCOMPARE(QString::fromUtf8(method.name()), computedName);
+
+ QCOMPARE(method.parameterCount(), parameterTypes.size());
+ for (int i = 0; i < parameterTypes.size(); ++i)
+ QCOMPARE(method.parameterType(i), parameterTypes.at(i));
+ QCOMPARE(method.parameterTypes(), parameterTypeNames);
+ QCOMPARE(method.tag(), "");
+
+ QCOMPARE(QString::fromUtf8(method.typeName()), returnTypeName);
+ QCOMPARE(method.returnType(), returnType);
+
+ delete object;
+}
+
+QTEST_MAIN(tst_QQmlMetaObject)
+
+#include "tst_qqmlmetaobject.moc"
diff --git a/tests/auto/qml/qqmlmetatype/data/CompositeType.qml b/tests/auto/qml/qqmlmetatype/data/CompositeType.qml
new file mode 100644
index 0000000000..bc2abca42b
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/data/CompositeType.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property int foo
+}
diff --git a/tests/auto/qml/qqmlmetatype/data/ImplicitType.qml b/tests/auto/qml/qqmlmetatype/data/ImplicitType.qml
new file mode 100644
index 0000000000..ca2bcef5bf
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/data/ImplicitType.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property int bar
+}
diff --git a/tests/auto/qml/qqmlmetatype/data/testImplicitComposite.qml b/tests/auto/qml/qqmlmetatype/data/testImplicitComposite.qml
new file mode 100644
index 0000000000..f838c6995f
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/data/testImplicitComposite.qml
@@ -0,0 +1,3 @@
+import "."
+
+ImplicitType{}
diff --git a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro
new file mode 100644
index 0000000000..a9a6a32a2b
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qqmlmetatype
+SOURCES += tst_qqmlmetatype.cpp
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+include (../../shared/util.pri)
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private testlib v8-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
new file mode 100644
index 0000000000..90023222d3
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <qqml.h>
+#include <qqmlprivate.h>
+#include <qqmlengine.h>
+#include <qqmlcomponent.h>
+
+#include <private/qqmlmetatype_p.h>
+#include <private/qqmlpropertyvalueinterceptor_p.h>
+#include <private/qhashedstring_p.h>
+#include "../../shared/util.h"
+
+class tst_qqmlmetatype : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlmetatype() {}
+
+private slots:
+ void initTestCase();
+
+ void qmlParserStatusCast();
+ void qmlPropertyValueSourceCast();
+ void qmlPropertyValueInterceptorCast();
+ void qmlType();
+ void invalidQmlTypeName();
+ void registrationType();
+ void compositeType();
+
+ void isList();
+
+ void defaultObject();
+};
+
+class TestType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int foo READ foo)
+
+ Q_CLASSINFO("DefaultProperty", "foo")
+public:
+ int foo() { return 0; }
+};
+QML_DECLARE_TYPE(TestType);
+
+QObject *testTypeProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(scriptEngine);
+ return new TestType();
+}
+
+class ParserStatusTestType : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ void classBegin(){}
+ void componentComplete(){}
+ Q_CLASSINFO("DefaultProperty", "foo") // Missing default property
+ Q_INTERFACES(QQmlParserStatus)
+};
+QML_DECLARE_TYPE(ParserStatusTestType);
+
+class ValueSourceTestType : public QObject, public QQmlPropertyValueSource
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueSource)
+public:
+ virtual void setTarget(const QQmlProperty &) {}
+};
+QML_DECLARE_TYPE(ValueSourceTestType);
+
+class ValueInterceptorTestType : public QObject, public QQmlPropertyValueInterceptor
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueInterceptor)
+public:
+ virtual void setTarget(const QQmlProperty &) {}
+ virtual void write(const QVariant &) {}
+};
+QML_DECLARE_TYPE(ValueInterceptorTestType);
+
+void tst_qqmlmetatype::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<TestType>("Test", 1, 0, "TestType");
+ qmlRegisterSingletonType<TestType>("Test", 1, 0, "TestTypeSingleton", testTypeProvider);
+ qmlRegisterType<ParserStatusTestType>("Test", 1, 0, "ParserStatusTestType");
+ qmlRegisterType<ValueSourceTestType>("Test", 1, 0, "ValueSourceTestType");
+ qmlRegisterType<ValueInterceptorTestType>("Test", 1, 0, "ValueInterceptorTestType");
+
+ QUrl testTypeUrl(testFileUrl("CompositeType.qml"));
+ qmlRegisterType(testTypeUrl, "Test", 1, 0, "TestTypeComposite");
+}
+
+void tst_qqmlmetatype::qmlParserStatusCast()
+{
+ QVERIFY(QQmlMetaType::qmlType(QVariant::Int) == 0);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0);
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->parserStatusCast(), -1);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0);
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->parserStatusCast(), -1);
+
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0);
+ int cast = QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->parserStatusCast();
+ QVERIFY(cast != -1);
+ QVERIFY(cast != 0);
+
+ ParserStatusTestType t;
+ QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QQmlParserStatus *)&t));
+
+ QQmlParserStatus *status = reinterpret_cast<QQmlParserStatus *>(reinterpret_cast<char *>((QObject *)&t) + cast);
+ QCOMPARE(status, (QQmlParserStatus*)&t);
+}
+
+void tst_qqmlmetatype::qmlPropertyValueSourceCast()
+{
+ QVERIFY(QQmlMetaType::qmlType(QVariant::Int) == 0);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0);
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueSourceCast(), -1);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0);
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueSourceCast(), -1);
+
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0);
+ int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->propertyValueSourceCast();
+ QVERIFY(cast != -1);
+ QVERIFY(cast != 0);
+
+ ValueSourceTestType t;
+ QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QQmlPropertyValueSource *)&t));
+
+ QQmlPropertyValueSource *source = reinterpret_cast<QQmlPropertyValueSource *>(reinterpret_cast<char *>((QObject *)&t) + cast);
+ QCOMPARE(source, (QQmlPropertyValueSource*)&t);
+}
+
+void tst_qqmlmetatype::qmlPropertyValueInterceptorCast()
+{
+ QVERIFY(QQmlMetaType::qmlType(QVariant::Int) == 0);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0);
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueInterceptorCast(), -1);
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0);
+ QCOMPARE(QQmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueInterceptorCast(), -1);
+
+ QVERIFY(QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()) != 0);
+ int cast = QQmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>())->propertyValueInterceptorCast();
+ QVERIFY(cast != -1);
+ QVERIFY(cast != 0);
+
+ ValueInterceptorTestType t;
+ QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QQmlPropertyValueInterceptor *)&t));
+
+ QQmlPropertyValueInterceptor *interceptor = reinterpret_cast<QQmlPropertyValueInterceptor *>(reinterpret_cast<char *>((QObject *)&t) + cast);
+ QCOMPARE(interceptor, (QQmlPropertyValueInterceptor*)&t);
+}
+
+void tst_qqmlmetatype::qmlType()
+{
+ QQmlType *type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"), 1, 0);
+ QVERIFY(type);
+ QVERIFY(type->module() == QLatin1String("Test"));
+ QVERIFY(type->elementName() == QLatin1String("ParserStatusTestType"));
+ QCOMPARE(type->qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
+
+ type = QQmlMetaType::qmlType("Test/ParserStatusTestType", 1, 0);
+ QVERIFY(type);
+ QVERIFY(type->module() == QLatin1String("Test"));
+ QVERIFY(type->elementName() == QLatin1String("ParserStatusTestType"));
+ QCOMPARE(type->qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
+}
+
+void tst_qqmlmetatype::invalidQmlTypeName()
+{
+ QStringList currFailures = QQmlMetaType::typeRegistrationFailures();
+ QCOMPARE(qmlRegisterType<TestType>("TestNamespace", 1, 0, "Test$Type"), -1); // should fail due to invalid QML type name.
+ QStringList nowFailures = QQmlMetaType::typeRegistrationFailures();
+
+ foreach (const QString &f, currFailures)
+ nowFailures.removeOne(f);
+
+ QCOMPARE(nowFailures.size(), 1);
+ QCOMPARE(nowFailures.at(0), QStringLiteral("Invalid QML element name \"Test$Type\""));
+}
+
+void tst_qqmlmetatype::isList()
+{
+ QCOMPARE(QQmlMetaType::isList(QVariant::Invalid), false);
+ QCOMPARE(QQmlMetaType::isList(QVariant::Int), false);
+
+ QQmlListProperty<TestType> list;
+
+ QCOMPARE(QQmlMetaType::isList(qMetaTypeId<QQmlListProperty<TestType> >()), true);
+}
+
+void tst_qqmlmetatype::defaultObject()
+{
+ QVERIFY(QQmlMetaType::defaultProperty(&QObject::staticMetaObject).name() == 0);
+ QVERIFY(QQmlMetaType::defaultProperty(&ParserStatusTestType::staticMetaObject).name() == 0);
+ QCOMPARE(QString(QQmlMetaType::defaultProperty(&TestType::staticMetaObject).name()), QString("foo"));
+
+ QObject o;
+ TestType t;
+ ParserStatusTestType p;
+
+ QVERIFY(QQmlMetaType::defaultProperty((QObject *)0).name() == 0);
+ QVERIFY(QQmlMetaType::defaultProperty(&o).name() == 0);
+ QVERIFY(QQmlMetaType::defaultProperty(&p).name() == 0);
+ QCOMPARE(QString(QQmlMetaType::defaultProperty(&t).name()), QString("foo"));
+}
+
+void tst_qqmlmetatype::registrationType()
+{
+ QQmlType *type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0);
+ QVERIFY(type);
+ QVERIFY(!type->isInterface());
+ QVERIFY(!type->isSingleton());
+ QVERIFY(!type->isComposite());
+
+ type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"), 1, 0);
+ QVERIFY(type);
+ QVERIFY(!type->isInterface());
+ QVERIFY(type->isSingleton());
+ QVERIFY(!type->isComposite());
+
+ type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"), 1, 0);
+ QVERIFY(type);
+ QVERIFY(!type->isInterface());
+ QVERIFY(!type->isSingleton());
+ QVERIFY(type->isComposite());
+}
+
+void tst_qqmlmetatype::compositeType()
+{
+ QQmlEngine engine;
+
+ //Loading the test file also loads all composite types it imports
+ QQmlComponent c(&engine, testFileUrl("testImplicitComposite.qml"));
+ QObject* obj = c.create();
+ QVERIFY(obj);
+
+ QQmlType *type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0);
+ QVERIFY(type);
+ QVERIFY(type->module() == QLatin1String(""));
+ QVERIFY(type->elementName() == QLatin1String("ImplicitType"));
+ QCOMPARE(type->qmlTypeName(), QLatin1String("ImplicitType"));
+ QCOMPARE(type->sourceUrl(), testFileUrl("ImplicitType.qml"));
+}
+
+QTEST_MAIN(tst_qqmlmetatype)
+
+#include "tst_qqmlmetatype.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/.gitignore b/tests/auto/qml/qqmlmoduleplugin/.gitignore
new file mode 100644
index 0000000000..b458285566
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/.gitignore
@@ -0,0 +1,2 @@
+imports/*/*/*
+!imports/com/nokia/PureQmlModule/*
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/implicit1/implicitQmldir.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/implicit1/implicitQmldir.errors.txt
new file mode 100644
index 0000000000..ce3b796e16
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/implicit1/implicitQmldir.errors.txt
@@ -0,0 +1 @@
+-1:-1:module "" plugin "AType" not found
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/implicit1/qmldir b/tests/auto/qml/qqmlmoduleplugin/data/implicit1/qmldir
new file mode 100644
index 0000000000..7f5b3a362d
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/implicit1/qmldir
@@ -0,0 +1,2 @@
+plugin AType
+
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/implicit1/temptest.qml b/tests/auto/qml/qqmlmoduleplugin/data/implicit1/temptest.qml
new file mode 100644
index 0000000000..67fb18feb0
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/implicit1/temptest.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+// this qml file uses a type which is meant to be defined
+// in a plugin which is specified in the qmldir file.
+// however, that plugin doesn't exist, so it cannot be
+// loaded, and hence the AItem type will be an unknown type.
+
+Item {
+ id: root
+
+ AItem {
+ id: unknown
+ }
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/implicit2/Test.qml b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/Test.qml
new file mode 100644
index 0000000000..ea9611691e
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ id: moduleRoot
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/implicit2/implicitQmldir.2.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/implicitQmldir.2.errors.txt
new file mode 100644
index 0000000000..08492af787
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/implicitQmldir.2.errors.txt
@@ -0,0 +1,4 @@
+1:12:unexpected token
+1:-1:invalid qmldir directive contains too many tokens
+2:17:unexpected token
+2:-1:invalid qmldir directive contains too many tokens
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/implicit2/qmldir b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/qmldir
new file mode 100644
index 0000000000..7c4def92fc
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/qmldir
@@ -0,0 +1,3 @@
+foo bar foo bar
+internal foo bar foo
+Test 1.0 Test.qml
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/implicit2/temptest2.qml b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/temptest2.qml
new file mode 100644
index 0000000000..051c6f8904
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/implicit2/temptest2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+// the type loader will implicitly search "." for a qmldir
+// to try and find the missing type of AItem
+// and the qmldir has various syntax errors in it.
+
+Item {
+ id: root
+ AItem{}
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
new file mode 100644
index 0000000000..a0ac0c72c7
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
@@ -0,0 +1,21 @@
+import com.nokia.AutoTestQmlMixedPluginType 1.5
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ property bool test2: false
+
+ Bar {
+ id: bar
+ }
+
+ Foo {
+ id: foo
+ }
+
+ Component.onCompleted: {
+ test = (bar.value == 16);
+ test2 = (foo.value == 89);
+ }
+}
+
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
new file mode 100644
index 0000000000..1346cbdb7b
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
@@ -0,0 +1,13 @@
+import com.nokia.AutoTestQmlMixedPluginType 1.0
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+ Bar {
+ id: bar
+ }
+
+ Component.onCompleted: {
+ test = (bar.value == 16);
+ }
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt
new file mode 100644
index 0000000000..262193788b
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.AutoTestQmlNestedPluginType.Nested" is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml
new file mode 100644
index 0000000000..b3f9ac6c3f
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.1.qml
@@ -0,0 +1,5 @@
+import com.nokia.AutoTestQmlNestedPluginType.Nested 1.0
+import com.nokia.AutoTestQmlNestedPluginType 1.0
+
+MyNestedPluginType {
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml
new file mode 100644
index 0000000000..cb8e0e33d1
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.2.qml
@@ -0,0 +1,5 @@
+import com.nokia.AutoTestQmlNestedPluginType 1.0
+import com.nokia.AutoTestQmlNestedPluginType.Nested 1.0
+
+MyNestedPluginType {
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.errors.txt
new file mode 100644
index 0000000000..f0c73e336f
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.errors.txt
@@ -0,0 +1 @@
+3:1:MyNestedPluginType is not a type
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml
new file mode 100644
index 0000000000..69c6a34f46
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.3.qml
@@ -0,0 +1,4 @@
+import com.nokia.AutoTestQmlNestedPluginType 1.0
+
+MyNestedPluginType {
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt
new file mode 100644
index 0000000000..9743ae4f68
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.errors.txt
@@ -0,0 +1 @@
+2:1:module "com.nokia.AutoTestQmlNestedPluginType.Nested" version 6.66 is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml
new file mode 100644
index 0000000000..dce8b7564a
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsNested.4.qml
@@ -0,0 +1,5 @@
+import com.nokia.AutoTestQmlNestedPluginType 1.0
+import com.nokia.AutoTestQmlNestedPluginType.Nested 6.66
+
+MyNestedPluginType {
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml b/tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml
new file mode 100644
index 0000000000..a21ece7058
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/incorrectCase.qml
@@ -0,0 +1,4 @@
+import com.nokia.WrongCase 1.0
+
+MyPluginType { value: 123 }
+
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.0.qml b/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.0.qml
new file mode 100644
index 0000000000..ad757fdc47
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.0.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property int majorVersion: 1
+ property int minorVersion: 0
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.1.qml b/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.1.qml
new file mode 100644
index 0000000000..531912b465
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.1.1.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property int majorVersion: 1
+ property int minorVersion: 1
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.2.0.qml b/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.2.0.qml
new file mode 100644
index 0000000000..74c9948b69
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/localModule/TestComponent.2.0.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property int majorVersion: 2
+ property int minorVersion: 0
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/localModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/data/localModule/qmldir
new file mode 100644
index 0000000000..052e2d9182
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/localModule/qmldir
@@ -0,0 +1,3 @@
+TestComponent 1.0 TestComponent.1.0.qml
+TestComponent 1.1 TestComponent.1.1.qml
+TestComponent 2.0 TestComponent.2.0.qml
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml b/tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml
new file mode 100644
index 0000000000..a9e28e5d8b
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/pluginWithQmlFile.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestPluginWithQmlFile 1.0
+
+MyQmlFile {}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt
new file mode 100644
index 0000000000..a40c1c8211
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.9 is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml
new file mode 100644
index 0000000000..bda59f0a32
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.2.qml
@@ -0,0 +1,5 @@
+import com.nokia.AutoTestQmlVersionPluginType 1.9
+import QtQuick 2.0
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt
new file mode 100644
index 0000000000..2634223de7
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.1 is not installed
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml
new file mode 100644
index 0000000000..2e556e76d6
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/versionNotInstalled.qml
@@ -0,0 +1,6 @@
+import com.nokia.AutoTestQmlVersionPluginType 1.1
+import QtQuick 2.0
+
+QtObject {
+}
+
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/works.qml b/tests/auto/qml/qqmlmoduleplugin/data/works.qml
new file mode 100644
index 0000000000..f29ae24ea2
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/works.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestQmlPluginType 1.0
+
+MyPluginType { value: 123 }
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/works2.qml b/tests/auto/qml/qqmlmoduleplugin/data/works2.qml
new file mode 100644
index 0000000000..cc322bf26b
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/works2.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestQmlPluginType 2.0
+
+MyPluginType { valueOnlyIn2: 123 }
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/works21.qml b/tests/auto/qml/qqmlmoduleplugin/data/works21.qml
new file mode 100644
index 0000000000..c08160ac5a
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/data/works21.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestQmlPluginType 2.1
+
+MyPluginType { valueOnlyIn2: 123 }
diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml
new file mode 100644
index 0000000000..617bdaaf67
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Item {}
diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml
new file mode 100644
index 0000000000..fac5d8f4b9
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Item {}
+
diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/qmldir
new file mode 100644
index 0000000000..167bb10c21
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/PureQmlModule/qmldir
@@ -0,0 +1,3 @@
+ComponentA 1.0 ComponentA.qml
+ComponentB 1.0 ComponentB.qml
+
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro
new file mode 100644
index 0000000000..8e37a2d16b
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/invalidFirstCommandModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/InvalidFirstCommandModule
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
new file mode 100644
index 0000000000..925f3cdf86
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.InvalidFirstCommandModule");
+ qmlRegisterType<MyPluginType>("com.nokia.InvalidFirstCommandModule", 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir
new file mode 100644
index 0000000000..90b607e793
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/qmldir
@@ -0,0 +1,3 @@
+plugin invalidNamespaceModule
+module com.nokia.InvalidFirstCommandModule
+# comment.
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro
new file mode 100644
index 0000000000..b53ae1f9c3
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/invalidNamespaceModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/InvalidNamespaceModule
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
new file mode 100644
index 0000000000..0ed1b20446
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.InvalidStrictModule");
+ qmlRegisterType<MyPluginType>("com.nokia.SomeOtherModule", 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir
new file mode 100644
index 0000000000..5f349709f2
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/qmldir
@@ -0,0 +1,2 @@
+module com.nokia.AwesomeModule
+plugin invalidNamespaceModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro
new file mode 100644
index 0000000000..a348d5d6a6
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/InvalidStrictModule
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp
new file mode 100644
index 0000000000..0ed1b20446
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.InvalidStrictModule");
+ qmlRegisterType<MyPluginType>("com.nokia.SomeOtherModule", 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir
new file mode 100644
index 0000000000..45752a9bca
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir
@@ -0,0 +1,2 @@
+module com.nokia.InvalidStrictModule
+plugin invalidStrictModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
new file mode 100644
index 0000000000..8b434dfb12
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString value READ value)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+
+ QString value() const { return "Hello"; }
+};
+
+class MyNestedPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString value READ value)
+
+public:
+ MyNestedPluginType(QObject *parent=0) : QObject(parent) {}
+
+ QString value() const { return "Goodbye"; }
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlNestedPluginType");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+
+ QString nestedUri(uri);
+ nestedUri += QLatin1String(".Nested");
+
+ qmlRegisterType<MyNestedPluginType>(nestedUri.toLatin1().constData(), 1, 0, "MyNestedPluginType");
+ }
+};
+
+#include "nestedPlugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro
new file mode 100644
index 0000000000..a2e582a604
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += nestedPlugin
+SOURCES = nestedPlugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/AutoTestQmlNestedPluginType
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/qmldir b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/qmldir
new file mode 100644
index 0000000000..f6ed20dda4
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/qmldir
@@ -0,0 +1 @@
+plugin nestedPlugin
diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro
new file mode 100644
index 0000000000..5ad1bd5eca
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/nonstrictModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/NonstrictModule
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
new file mode 100644
index 0000000000..1cdd0f7754
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.NonstrictModule");
+
+ // Install into a namespace that should be protected
+ qmlRegisterType<MyPluginType>("com.nokia.StrictModule", 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/qmldir
new file mode 100644
index 0000000000..7371ee759f
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/qmldir
@@ -0,0 +1 @@
+plugin nonstrictModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro
new file mode 100644
index 0000000000..560450832c
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.2.1.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2.1
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
new file mode 100644
index 0000000000..6b5c38f29a
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import2.1 worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin()
+ {
+ qWarning("plugin2.1 created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ qmlRegisterType<MyPluginType>(uri, 2, 1, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/qmldir b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/qmldir
new file mode 100644
index 0000000000..0a8b5d46eb
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/qmldir
@@ -0,0 +1 @@
+plugin plugin
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro
new file mode 100644
index 0000000000..ed70708e1d
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.2.pro
@@ -0,0 +1,14 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2
+
+QT += core-private gui-private qml-private
+
+IMPORT_DIR = DESTDIR
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
new file mode 100644
index 0000000000..12e31a4cb8
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import2 worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin()
+ {
+ qWarning("plugin2 created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/qmldir b/tests/auto/qml/qqmlmoduleplugin/plugin.2/qmldir
new file mode 100644
index 0000000000..0a8b5d46eb
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/qmldir
@@ -0,0 +1 @@
+plugin plugin
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
new file mode 100644
index 0000000000..ee07c77e2f
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin()
+ {
+ qWarning("plugin created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro
new file mode 100644
index 0000000000..b78e85c86b
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/qmldir b/tests/auto/qml/qqmlmoduleplugin/plugin/qmldir
new file mode 100644
index 0000000000..0a8b5d46eb
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/plugin/qmldir
@@ -0,0 +1 @@
+plugin plugin
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/Foo.qml b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/Foo.qml
new file mode 100644
index 0000000000..36d69e901f
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/Foo.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property int value: 89
+}
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
new file mode 100644
index 0000000000..4512f9a642
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class BarPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value)
+
+public:
+ int value() const { return 16; }
+};
+
+
+class MyMixedPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyMixedPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlMixedPluginType");
+ qmlRegisterType<BarPluginType>(uri, 1, 0, "Bar");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro
new file mode 100644
index 0000000000..9076c3ebab
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/pluginMixed.pro
@@ -0,0 +1,14 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/AutoTestQmlMixedPluginType
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ Foo.qml \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/qmldir b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/qmldir
new file mode 100644
index 0000000000..065dc3b21f
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/qmldir
@@ -0,0 +1,2 @@
+plugin pluginMixed
+Foo 1.5 Foo.qml
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
new file mode 100644
index 0000000000..dfe2262e36
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class FloorPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value);
+
+public:
+ int value() const { return 16; }
+};
+
+
+class MyMixedPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyMixedPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlVersionPluginType");
+ qmlRegisterType<FloorPluginType>(uri, 1, 4, "Floor");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro
new file mode 100644
index 0000000000..ba07180953
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/pluginVersion.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/AutoTestQmlVersionPluginType
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/qmldir b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/qmldir
new file mode 100644
index 0000000000..640967fe40
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/qmldir
@@ -0,0 +1 @@
+plugin pluginVersion
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/MyQmlFile.qml b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/MyQmlFile.qml
new file mode 100644
index 0000000000..617bdaaf67
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/MyQmlFile.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Item {}
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
new file mode 100644
index 0000000000..34cf311b6b
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestPluginWithQmlFile");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro
new file mode 100644
index 0000000000..8cb40456cf
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro
@@ -0,0 +1,14 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/AutoTestPluginWithQmlFile
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir \
+ MyQmlFile.qml
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/qmldir b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/qmldir
new file mode 100644
index 0000000000..858ba1450e
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/qmldir
@@ -0,0 +1,3 @@
+MyQmlFile 1.0 MyQmlFile.qml
+plugin pluginWithQmlFile
+
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp
new file mode 100644
index 0000000000..3daba28b3d
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin()
+ {
+ qWarning("plugin created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.WrongCase");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro
new file mode 100644
index 0000000000..0e3757b6ca
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/pluginWrongCase.pro
@@ -0,0 +1,14 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+TARGET = Plugin
+DESTDIR = ../imports/com/nokia/WrongCase
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/qmldir b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/qmldir
new file mode 100644
index 0000000000..6c8787498f
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/qmldir
@@ -0,0 +1 @@
+plugin PluGin
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
new file mode 100644
index 0000000000..1b73f02934
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.PreemptedStrictModule");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro
new file mode 100644
index 0000000000..0aab522d04
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/preemptedStrictModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/PreemptedStrictModule
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir
new file mode 100644
index 0000000000..c82acd2fd3
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/qmldir
@@ -0,0 +1,2 @@
+module com.nokia.PreemptedStrictModule
+plugin preemptedStrictModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
new file mode 100644
index 0000000000..3a62650b13
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.PreemptiveModule");
+ qmlRegisterType<MyPluginType>("com.nokia.PreemptiveModule", 1, 0, "MyPluginType");
+
+ // Install into another namespace that should be protected
+ qmlRegisterType<MyPluginType>("com.nokia.PreemptedStrictModule", 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro
new file mode 100644
index 0000000000..5bb6520b80
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/preemptiveModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/PreemptiveModule
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/qmldir
new file mode 100644
index 0000000000..d240cafac9
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/qmldir
@@ -0,0 +1 @@
+plugin preemptiveModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro
new file mode 100644
index 0000000000..4806d34699
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro
@@ -0,0 +1,25 @@
+QT = core
+TEMPLATE = subdirs
+SUBDIRS =\
+ plugin\
+ plugin.2\
+ plugin.2.1\
+ pluginWrongCase\
+ pluginWithQmlFile\
+ pluginMixed\
+ pluginVersion\
+ nestedPlugin\
+ strictModule\
+ invalidStrictModule\
+ nonstrictModule\
+ preemptiveModule\
+ preemptedStrictModule\
+ invalidNamespaceModule\
+ invalidFirstCommandModule
+
+tst_qqmlmoduleplugin_pro.depends += plugin
+SUBDIRS += tst_qqmlmoduleplugin.pro
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
new file mode 100644
index 0000000000..8353c6b012
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.StrictModule");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir
new file mode 100644
index 0000000000..ff06446fbd
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/qmldir
@@ -0,0 +1,2 @@
+module com.nokia.StrictModule
+plugin strictModule
diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro b/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro
new file mode 100644
index 0000000000..7b818c0481
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/strictModule.pro
@@ -0,0 +1,13 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core qml
+DESTDIR = ../imports/com/nokia/StrictModule
+
+QT += core-private gui-private qml-private
+
+IMPORT_FILES = \
+ qmldir
+
+include (../../../shared/imports.pri)
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
new file mode 100644
index 0000000000..b2f860455e
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -0,0 +1,543 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <qdir.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QDebug>
+
+#include "../../shared/testhttpserver.h"
+#include "../../shared/util.h"
+
+#define SERVER_ADDR "http://127.0.0.1:14456"
+#define SERVER_PORT 14456
+
+// Note: this test does not use module identifier directives in the qmldir files, because
+// it would result in repeated attempts to insert types into the same namespace.
+// This occurs because type registration is process-global, while the test
+// cases should really be run in proper per-process isolation.
+
+class tst_qqmlmoduleplugin : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+
+private slots:
+ virtual void initTestCase();
+ void importsPlugin();
+ void importsPlugin2();
+ void importsPlugin21();
+ void importsMixedQmlCppPlugin();
+ void incorrectPluginCase();
+ void importPluginWithQmlFile();
+ void remoteImportWithQuotedUrl();
+ void remoteImportWithUnquotedUri();
+ void versionNotInstalled();
+ void versionNotInstalled_data();
+ void implicitQmldir();
+ void implicitQmldir_data();
+ void importsNested();
+ void importsNested_data();
+ void importLocalModule();
+ void importLocalModule_data();
+ void importStrictModule();
+ void importStrictModule_data();
+
+private:
+ QString m_importsDirectory;
+ QString m_dataImportsDirectory;
+};
+
+void tst_qqmlmoduleplugin::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ m_importsDirectory = QFINDTESTDATA(QStringLiteral("imports"));
+ QVERIFY2(QFileInfo(m_importsDirectory).isDir(),
+ qPrintable(QString::fromLatin1("Imports directory '%1' does not exist.").arg(m_importsDirectory)));
+ m_dataImportsDirectory = directory() + QStringLiteral("/imports");
+ QVERIFY2(QFileInfo(m_dataImportsDirectory).isDir(),
+ qPrintable(QString::fromLatin1("Imports directory '%1' does not exist.").arg(m_dataImportsDirectory)));
+}
+
+#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 { \
+ QString verify_errors_file_name = testFile(errorfile); \
+ QFile file(verify_errors_file_name); \
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
+ QByteArray data = file.readAll(); \
+ file.close(); \
+ QList<QByteArray> expected = data.split('\n'); \
+ expected.removeAll(QByteArray("")); \
+ QList<QQmlError> errors = component.errors(); \
+ QList<QByteArray> actual; \
+ for (int ii = 0; ii < errors.count(); ++ii) { \
+ const QQmlError &error = errors.at(ii); \
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" + \
+ QByteArray::number(error.column()) + ":" + \
+ error.description().toUtf8(); \
+ actual << errorStr; \
+ } \
+ if (qgetenv("DEBUG") != "" && expected != actual) { \
+ qWarning() << "Expected:" << expected << "Actual:" << actual; \
+ } \
+ if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\
+ QFile file(testFile(errorfile)); \
+ QVERIFY(file.open(QIODevice::WriteOnly)); \
+ for (int ii = 0; ii < actual.count(); ++ii) { \
+ file.write(actual.at(ii)); file.write("\n"); \
+ } \
+ file.close(); \
+ } else { \
+ QCOMPARE(expected, actual); \
+ } \
+ }
+
+void tst_qqmlmoduleplugin::importsPlugin()
+{
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+ QTest::ignoreMessage(QtWarningMsg, "plugin created");
+ QTest::ignoreMessage(QtWarningMsg, "import worked");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QQmlComponent component(&engine, testFileUrl(QStringLiteral("works.qml")));
+ foreach (QQmlError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").toInt(),123);
+ delete object;
+}
+
+void tst_qqmlmoduleplugin::importsPlugin2()
+{
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+ QTest::ignoreMessage(QtWarningMsg, "plugin2 created");
+ QTest::ignoreMessage(QtWarningMsg, "import2 worked");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QQmlComponent component(&engine, testFileUrl(QStringLiteral("works2.qml")));
+ foreach (QQmlError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").toInt(),123);
+ delete object;
+}
+
+void tst_qqmlmoduleplugin::importsPlugin21()
+{
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+ QTest::ignoreMessage(QtWarningMsg, "plugin2.1 created");
+ QTest::ignoreMessage(QtWarningMsg, "import2.1 worked");
+ QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+ QQmlComponent component(&engine, testFileUrl(QStringLiteral("works21.qml")));
+ foreach (QQmlError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").toInt(),123);
+ delete object;
+}
+
+void tst_qqmlmoduleplugin::incorrectPluginCase()
+{
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+
+ QQmlComponent component(&engine, testFileUrl(QStringLiteral("incorrectCase.qml")));
+
+ QList<QQmlError> errors = component.errors();
+ QCOMPARE(errors.count(), 1);
+
+#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
+#if defined(Q_OS_MAC)
+ QString libname = "libPluGin.dylib";
+#elif defined(Q_OS_WIN32)
+ QString libname = "PluGin.dll";
+#endif
+ QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QDir(m_importsDirectory).filePath("com/nokia/WrongCase/" + libname) + QLatin1String("\"");
+#else
+ QString expectedError = QLatin1String("module \"com.nokia.WrongCase\" plugin \"PluGin\" not found");
+#endif
+
+ QCOMPARE(errors.at(0).description(), expectedError);
+}
+
+void tst_qqmlmoduleplugin::importPluginWithQmlFile()
+{
+ QString path = m_importsDirectory;
+
+ // QTBUG-16885: adding an import path with a lower-case "c:" causes assert failure
+ // (this only happens if the plugin includes pure QML files)
+ #ifdef Q_OS_WIN
+ QVERIFY(path.at(0).isUpper() && path.at(1) == QLatin1Char(':'));
+ path = path.at(0).toLower() + path.mid(1);
+ #endif
+
+ QQmlEngine engine;
+ engine.addImportPath(path);
+
+ QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestPluginWithQmlFile' does not contain a module identifier directive - it cannot be protected from external registrations.");
+
+ QQmlComponent component(&engine, testFileUrl(QStringLiteral("pluginWithQmlFile.qml")));
+ foreach (QQmlError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qqmlmoduleplugin::remoteImportWithQuotedUrl()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(m_dataImportsDirectory);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import \"" SERVER_ADDR "/com/nokia/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl());
+
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
+ QObject *object = component.create();
+ QCOMPARE(object->property("width").toInt(), 300);
+ QVERIFY(object != 0);
+ delete object;
+
+ foreach (QQmlError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+}
+
+void tst_qqmlmoduleplugin::remoteImportWithUnquotedUri()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(m_dataImportsDirectory);
+
+ QQmlEngine engine;
+ engine.addImportPath(m_dataImportsDirectory);
+ QQmlComponent component(&engine);
+ component.setData("import com.nokia.PureQmlModule 1.0 \nComponentA { width: 300; ComponentB{} }", QUrl());
+
+
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("width").toInt(), 300);
+ delete object;
+
+ foreach (QQmlError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+}
+
+// QTBUG-17324
+
+void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin()
+{
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+
+ QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlMixedPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+
+ {
+ QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.qml")));
+
+ QObject *o = component.create();
+ QVERIFY2(o != 0, QQmlDataTest::msgComponentError(component, &engine));
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.2.qml")));
+
+ QObject *o = component.create();
+ QVERIFY2(o != 0, QQmlDataTest::msgComponentError(component, &engine));
+ QCOMPARE(o->property("test").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ delete o;
+ }
+
+
+}
+
+void tst_qqmlmoduleplugin::versionNotInstalled_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+
+ QTest::newRow("versionNotInstalled") << "versionNotInstalled.qml" << "versionNotInstalled.errors.txt";
+ QTest::newRow("versionNotInstalled") << "versionNotInstalled.2.qml" << "versionNotInstalled.2.errors.txt";
+}
+
+void tst_qqmlmoduleplugin::versionNotInstalled()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+
+ static int count = 0;
+ if (++count == 1)
+ QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlVersionPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+
+ QQmlComponent component(&engine, testFileUrl(file));
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+}
+
+
+// test that errors are reporting correctly for plugin loading and qmldir parsing
+void tst_qqmlmoduleplugin::implicitQmldir_data()
+{
+ QTest::addColumn<QString>("directory");
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+
+ // parsing qmldir succeeds, but plugin specified in the qmldir file doesn't exist
+ QTest::newRow("implicitQmldir") << "implicit1" << "temptest.qml" << "implicitQmldir.errors.txt";
+
+ // parsing qmldir fails due to syntax errors, etc.
+ QTest::newRow("implicitQmldir2") << "implicit2" << "temptest2.qml" << "implicitQmldir.2.errors.txt";
+}
+void tst_qqmlmoduleplugin::implicitQmldir()
+{
+ QFETCH(QString, directory);
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+
+ QString importPath = testFile(directory);
+ QString fileName = directory + QDir::separator() + file;
+ QString errorFileName = directory + QDir::separator() + errorFile;
+ QUrl testUrl = testFileUrl(fileName);
+
+ QQmlEngine engine;
+ engine.addImportPath(importPath);
+
+ QQmlComponent component(&engine, testUrl);
+ QList<QQmlError> errors = component.errors();
+ VERIFY_ERRORS(errorFileName.toLatin1().constData());
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ QObject *obj = component.create();
+ QVERIFY(!obj);
+ delete obj;
+}
+
+void tst_qqmlmoduleplugin::importsNested_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+
+ // Note: no other test case should import the plugin used for this test, or the
+ // wrong order test will pass spuriously
+ QTest::newRow("wrongOrder") << "importsNested.1.qml" << "importsNested.1.errors.txt";
+ QTest::newRow("missingImport") << "importsNested.3.qml" << "importsNested.3.errors.txt";
+ QTest::newRow("invalidVersion") << "importsNested.4.qml" << "importsNested.4.errors.txt";
+ QTest::newRow("correctOrder") << "importsNested.2.qml" << QString();
+}
+void tst_qqmlmoduleplugin::importsNested()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+
+ // Note: because imports are cached between test case data rows (and the plugins remain loaded),
+ // these tests should really be run in new instances of the app...
+
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+
+ if (!errorFile.isEmpty()) {
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ }
+
+ static int count = 0;
+ if (++count == 1)
+ QTest::ignoreMessage(QtWarningMsg, "Module 'com.nokia.AutoTestQmlNestedPluginType' does not contain a module identifier directive - it cannot be protected from external registrations.");
+
+ QQmlComponent component(&engine, testFile(file));
+ QObject *obj = component.create();
+
+ if (errorFile.isEmpty()) {
+ if (qgetenv("DEBUG") != "" && !component.errors().isEmpty())
+ qWarning() << "Unexpected Errors:" << component.errors();
+ QVERIFY(obj);
+ delete obj;
+ } else {
+ QList<QQmlError> errors = component.errors();
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+ QVERIFY(!obj);
+ }
+}
+
+void tst_qqmlmoduleplugin::importLocalModule()
+{
+ QFETCH(QString, qml);
+ QFETCH(int, majorVersion);
+ QFETCH(int, minorVersion);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(), testFileUrl("empty.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("majorVersion").value<int>(), majorVersion);
+ QCOMPARE(object->property("minorVersion").value<int>(), minorVersion);
+}
+
+void tst_qqmlmoduleplugin::importLocalModule_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<int>("majorVersion");
+ QTest::addColumn<int>("minorVersion");
+
+ QTest::newRow("default version")
+ << "import \"localModule\"\n"
+ "TestComponent {}"
+ << 2 << 0;
+
+ QTest::newRow("specific version")
+ << "import \"localModule\" 1.1\n"
+ "TestComponent {}"
+ << 1 << 1;
+
+ QTest::newRow("lesser version")
+ << "import \"localModule\" 1.0\n"
+ "TestComponent {}"
+ << 1 << 0;
+
+ // Note: this does not match the behaviour of installed modules, which fail for this case:
+ QTest::newRow("nonexistent version")
+ << "import \"localModule\" 1.3\n"
+ "TestComponent {}"
+ << 1 << 1;
+
+ QTest::newRow("high version")
+ << "import \"localModule\" 2.0\n"
+ "TestComponent {}"
+ << 2 << 0;
+}
+
+void tst_qqmlmoduleplugin::importStrictModule()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, warning);
+ QFETCH(QString, error);
+
+ if (!warning.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QQmlEngine engine;
+ engine.addImportPath(m_importsDirectory);
+
+ QUrl url(testFileUrl("empty.qml"));
+
+ QQmlComponent component(&engine);
+ component.setData(qml.toUtf8(), url);
+
+ if (error.isEmpty()) {
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != 0);
+ } else {
+ QVERIFY(!component.isReady());
+ QCOMPARE(component.errors().count(), 1);
+ QCOMPARE(component.errors().first().toString(), url.toString() + error);
+ }
+}
+
+void tst_qqmlmoduleplugin::importStrictModule_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("warning");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("success")
+ << "import com.nokia.StrictModule 1.0\n"
+ "MyPluginType {}"
+ << QString()
+ << QString();
+
+ QTest::newRow("wrong target")
+ << "import com.nokia.InvalidStrictModule 1.0\n"
+ "MyPluginType {}"
+ << QString()
+ << ":1:1: plugin cannot be loaded for module \"com.nokia.InvalidStrictModule\": Cannot install element 'MyPluginType' into unregistered namespace 'com.nokia.SomeOtherModule'";
+
+ QTest::newRow("non-strict clash")
+ << "import com.nokia.NonstrictModule 1.0\n"
+ "MyPluginType {}"
+ << "Module 'com.nokia.NonstrictModule' does not contain a module identifier directive - it cannot be protected from external registrations."
+ << ":1:1: plugin cannot be loaded for module \"com.nokia.NonstrictModule\": Cannot install element 'MyPluginType' into protected namespace 'com.nokia.StrictModule'";
+
+ QTest::newRow("non-strict preemption")
+ << "import com.nokia.PreemptiveModule 1.0\n"
+ "import com.nokia.PreemptedStrictModule 1.0\n"
+ "MyPluginType {}"
+ << "Module 'com.nokia.PreemptiveModule' does not contain a module identifier directive - it cannot be protected from external registrations."
+ << ":2:1: plugin cannot be loaded for module \"com.nokia.PreemptedStrictModule\": Namespace 'com.nokia.PreemptedStrictModule' has already been used for type registration";
+
+ QTest::newRow("invalid namespace")
+ << "import com.nokia.InvalidNamespaceModule 1.0\n"
+ "MyPluginType {}"
+ << QString()
+ << ":1:1: plugin cannot be loaded for module \"com.nokia.InvalidNamespaceModule\": Module namespace 'com.nokia.AwesomeModule' does not match import URI 'com.nokia.InvalidNamespaceModule'";
+
+ QTest::newRow("module directive must be first")
+ << "import com.nokia.InvalidFirstCommandModule 1.0\n"
+ "MyPluginType {}"
+ << QString()
+ << ":1:1: module identifier directive must be the first command in a qmldir file";
+}
+
+QTEST_MAIN(tst_qqmlmoduleplugin)
+
+#include "tst_qqmlmoduleplugin.moc"
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro
new file mode 100644
index 0000000000..c483ef8ccd
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlmoduleplugin
+
+HEADERS = ../../shared/testhttpserver.h
+SOURCES = tst_qqmlmoduleplugin.cpp \
+ ../../shared/testhttpserver.cpp
+CONFIG -= app_bundle
+
+include (../../shared/util.pri)
+
+TESTDATA = data/* imports/* $$OUT_PWD/imports/*
+
+QT += core-private gui-private qml-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlnotifier/data/connectnotify.qml b/tests/auto/qml/qqmlnotifier/data/connectnotify.qml
new file mode 100644
index 0000000000..35226ee5ab
--- /dev/null
+++ b/tests/auto/qml/qqmlnotifier/data/connectnotify.qml
@@ -0,0 +1,73 @@
+import QtQuick 2.0
+import Test 1.0
+
+Item {
+ id: root
+ ExportedClass {
+ id: exportedClass
+ objectName: "exportedClass"
+ onBoundSignal: {}
+ }
+
+ property int v4Binding: exportedClass.v4BindingProp
+
+ property int v8Binding: {
+ Math.abs(12); // Prevent optimization to v4
+ return exportedClass.v8BindingProp
+ }
+
+ property int scriptBinding: {
+ function innerFunction() {} // Prevent usage of v4 or v8 bindings
+ return exportedClass.scriptBindingProp
+ }
+
+ property int foo: exportedClass.qmlObjectProp
+ property int baz: _exportedObject.cppObjectProp
+
+ // v4 bindings that could share a subscription. They don't, though, and the code
+ // relies on that
+ property int v4Binding2: exportedClass.v4BindingProp2
+ property int bla: exportedClass.v4BindingProp2
+
+ function removeV4Binding() {
+ //console.log("Going to remove v4 binding...")
+ root.v4Binding = 1;
+ //console.log("Binding removed!")
+ }
+
+ function removeV8Binding() {
+ //console.log("Going to remove v8 binding...")
+ root.v8Binding = 1;
+ //console.log("Binding removed!")
+ }
+
+ function removeScriptBinding() {
+ //console.log("Going to remove script binding...")
+ root.scriptBinding = 1;
+ //console.log("Binding removed!")
+ }
+
+ function removeV4Binding2() {
+ //console.log("Going to remove v4 binding 2...")
+ root.v4Binding2 = 1;
+ //console.log("Binding removed!")
+ }
+
+ function readProperty() {
+ var test = exportedClass.unboundProp
+ }
+
+ function changeState() {
+ //console.log("Changing state...")
+ if (root.state == "") root.state = "state1"
+ else root.state = ""
+ //console.log("State changed.")
+ }
+
+ property int someValue: 42
+
+ states: State {
+ name: "state1"
+ PropertyChanges { target: root; someValue: exportedClass.unboundProp }
+ }
+}
diff --git a/tests/auto/qml/qqmlnotifier/qqmlnotifier.pro b/tests/auto/qml/qqmlnotifier/qqmlnotifier.pro
new file mode 100644
index 0000000000..5fc40a3c2c
--- /dev/null
+++ b/tests/auto/qml/qqmlnotifier/qqmlnotifier.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qqmlnotifier
+SOURCES += tst_qqmlnotifier.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+QT += qml testlib
diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
new file mode 100644
index 0000000000..fa3b190826
--- /dev/null
+++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp
@@ -0,0 +1,324 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QDebug>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QQmlContext>
+#include <qqml.h>
+#include <QMetaMethod>
+
+#include "../../shared/util.h"
+
+class ExportedClass : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int qmlObjectProp READ qmlObjectProp NOTIFY qmlObjectPropChanged)
+ Q_PROPERTY(int cppObjectProp READ cppObjectProp NOTIFY cppObjectPropChanged)
+ Q_PROPERTY(int unboundProp READ unboundProp NOTIFY unboundPropChanged)
+ Q_PROPERTY(int v8BindingProp READ v8BindingProp NOTIFY v8BindingPropChanged)
+ Q_PROPERTY(int v4BindingProp READ v4BindingProp NOTIFY v4BindingPropChanged)
+ Q_PROPERTY(int v4BindingProp2 READ v4BindingProp2 NOTIFY v4BindingProp2Changed)
+ Q_PROPERTY(int scriptBindingProp READ scriptBindingProp NOTIFY scriptBindingPropChanged)
+public:
+ int qmlObjectPropConnections;
+ int cppObjectPropConnections;
+ int unboundPropConnections;
+ int v8BindingPropConnections;
+ int v4BindingPropConnections;
+ int v4BindingProp2Connections;
+ int scriptBindingPropConnections;
+ int boundSignalConnections;
+ int unusedSignalConnections;
+
+ ExportedClass()
+ : qmlObjectPropConnections(0), cppObjectPropConnections(0), unboundPropConnections(0),
+ v8BindingPropConnections(0), v4BindingPropConnections(0), v4BindingProp2Connections(0),
+ scriptBindingPropConnections(0), boundSignalConnections(0), unusedSignalConnections(0)
+ {}
+
+ ~ExportedClass()
+ {
+ QCOMPARE(qmlObjectPropConnections, 0);
+ QCOMPARE(cppObjectPropConnections, 0);
+ QCOMPARE(unboundPropConnections, 0);
+ QCOMPARE(v8BindingPropConnections, 0);
+ QCOMPARE(v4BindingPropConnections, 0);
+ QCOMPARE(v4BindingProp2Connections, 0);
+ QCOMPARE(scriptBindingPropConnections, 0);
+ QCOMPARE(boundSignalConnections, 0);
+ QCOMPARE(unusedSignalConnections, 0);
+ }
+
+ int qmlObjectProp() const { return 42; }
+ int unboundProp() const { return 42; }
+ int v8BindingProp() const { return 42; }
+ int v4BindingProp() const { return 42; }
+ int v4BindingProp2() const { return 42; }
+ int cppObjectProp() const { return 42; }
+ int scriptBindingProp() const { return 42; }
+
+ void verifyReceiverCount()
+ {
+ QCOMPARE(receivers(SIGNAL(qmlObjectPropChanged())), qmlObjectPropConnections);
+ QCOMPARE(receivers(SIGNAL(cppObjectPropChanged())), cppObjectPropConnections);
+ QCOMPARE(receivers(SIGNAL(unboundPropChanged())), unboundPropConnections);
+ QCOMPARE(receivers(SIGNAL(v8BindingPropChanged())), v8BindingPropConnections);
+ QCOMPARE(receivers(SIGNAL(v4BindingPropChanged())), v4BindingPropConnections);
+ QCOMPARE(receivers(SIGNAL(v4BindingProp2Changed())), v4BindingProp2Connections);
+ QCOMPARE(receivers(SIGNAL(scriptBindingPropChanged())), scriptBindingPropConnections);
+ QCOMPARE(receivers(SIGNAL(boundSignal())), boundSignalConnections);
+ QCOMPARE(receivers(SIGNAL(unusedSignal())), unusedSignalConnections);
+ }
+
+protected:
+ void connectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE {
+ if (signal.name() == "qmlObjectPropChanged") qmlObjectPropConnections++;
+ if (signal.name() == "cppObjectPropChanged") cppObjectPropConnections++;
+ if (signal.name() == "unboundPropChanged") unboundPropConnections++;
+ if (signal.name() == "v8BindingPropChanged") v8BindingPropConnections++;
+ if (signal.name() == "v4BindingPropChanged") v4BindingPropConnections++;
+ if (signal.name() == "v4BindingProp2Changed") v4BindingProp2Connections++;
+ if (signal.name() == "scriptBindingPropChanged") scriptBindingPropConnections++;
+ if (signal.name() == "boundSignal") boundSignalConnections++;
+ if (signal.name() == "unusedSignal") unusedSignalConnections++;
+ verifyReceiverCount();
+ //qDebug() << Q_FUNC_INFO << this << signal.name();
+ }
+
+ void disconnectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE {
+ if (signal.name() == "qmlObjectPropChanged") qmlObjectPropConnections--;
+ if (signal.name() == "cppObjectPropChanged") cppObjectPropConnections--;
+ if (signal.name() == "unboundPropChanged") unboundPropConnections--;
+ if (signal.name() == "v8BindingPropChanged") v8BindingPropConnections--;
+ if (signal.name() == "v4BindingPropChanged") v4BindingPropConnections--;
+ if (signal.name() == "v4BindingProp2Changed") v4BindingProp2Connections--;
+ if (signal.name() == "scriptBindingPropChanged") scriptBindingPropConnections--;
+ if (signal.name() == "boundSignal") boundSignalConnections--;
+ if (signal.name() == "unusedSignal") unusedSignalConnections--;
+ verifyReceiverCount();
+ //qDebug() << Q_FUNC_INFO << this << signal.methodSignature();
+ }
+
+signals:
+ void qmlObjectPropChanged();
+ void cppObjectPropChanged();
+ void unboundPropChanged();
+ void v8BindingPropChanged();
+ void v4BindingPropChanged();
+ void v4BindingProp2Changed();
+ void scriptBindingPropChanged();
+ void boundSignal();
+ void unusedSignal();
+};
+
+class tst_qqmlnotifier : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlnotifier()
+ : root(0), exportedClass(0), exportedObject(0)
+ {}
+
+private slots:
+ void initTestCase() Q_DECL_OVERRIDE;
+ void cleanupTestCase();
+ void testConnectNotify();
+
+ void removeV4Binding();
+ void removeV4Binding2();
+ void removeV8Binding();
+ void removeScriptBinding();
+ // No need to test value type proxy bindings - the user can't override disconnectNotify() anyway,
+ // as the classes are private to the QML engine
+
+ void readProperty();
+ void propertyChange();
+ void disconnectOnDestroy();
+
+private:
+ void createObjects();
+
+ QQmlEngine engine;
+ QObject *root;
+ ExportedClass *exportedClass;
+ ExportedClass *exportedObject;
+};
+
+void tst_qqmlnotifier::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<ExportedClass>("Test", 1, 0, "ExportedClass");
+}
+
+void tst_qqmlnotifier::createObjects()
+{
+ delete root;
+ root = 0;
+ exportedClass = exportedObject = 0;
+
+ QQmlComponent component(&engine, testFileUrl("connectnotify.qml"));
+ exportedObject = new ExportedClass();
+ exportedObject->setObjectName("exportedObject");
+ engine.rootContext()->setContextProperty("_exportedObject", exportedObject);
+ root = component.create();
+ QVERIFY(root != 0);
+
+ exportedClass = qobject_cast<ExportedClass *>(
+ root->findChild<ExportedClass*>("exportedClass"));
+ QVERIFY(exportedClass != 0);
+}
+
+void tst_qqmlnotifier::cleanupTestCase()
+{
+ delete root;
+ root = 0;
+ delete exportedObject;
+ exportedObject = 0;
+}
+
+void tst_qqmlnotifier::testConnectNotify()
+{
+ createObjects();
+
+ QCOMPARE(exportedClass->qmlObjectPropConnections, 1);
+ QCOMPARE(exportedClass->cppObjectPropConnections, 0);
+ QCOMPARE(exportedClass->unboundPropConnections, 0);
+ QCOMPARE(exportedClass->v8BindingPropConnections, 1);
+ QCOMPARE(exportedClass->v4BindingPropConnections, 1);
+ QCOMPARE(exportedClass->v4BindingProp2Connections, 2);
+ QCOMPARE(exportedClass->scriptBindingPropConnections, 1);
+ QCOMPARE(exportedClass->boundSignalConnections, 1);
+ QCOMPARE(exportedClass->unusedSignalConnections, 0);
+ exportedClass->verifyReceiverCount();
+
+ QCOMPARE(exportedObject->qmlObjectPropConnections, 0);
+ QCOMPARE(exportedObject->cppObjectPropConnections, 1);
+ QCOMPARE(exportedObject->unboundPropConnections, 0);
+ QCOMPARE(exportedObject->v8BindingPropConnections, 0);
+ QCOMPARE(exportedObject->v4BindingPropConnections, 0);
+ QCOMPARE(exportedObject->v4BindingProp2Connections, 0);
+ QCOMPARE(exportedObject->scriptBindingPropConnections, 0);
+ QCOMPARE(exportedObject->boundSignalConnections, 0);
+ QCOMPARE(exportedObject->unusedSignalConnections, 0);
+ exportedObject->verifyReceiverCount();
+}
+
+void tst_qqmlnotifier::removeV4Binding()
+{
+ createObjects();
+
+ // Removing a binding should disconnect all of its guarded properties
+ QVERIFY(QMetaObject::invokeMethod(root, "removeV4Binding"));
+ QCOMPARE(exportedClass->v4BindingPropConnections, 0);
+ exportedClass->verifyReceiverCount();
+}
+
+void tst_qqmlnotifier::removeV4Binding2()
+{
+ createObjects();
+
+ // In this case, the v4BindingProp2 property is used by two v4 bindings.
+ // Make sure that removing one binding doesn't by accident disconnect all.
+ QVERIFY(QMetaObject::invokeMethod(root, "removeV4Binding2"));
+ QCOMPARE(exportedClass->v4BindingProp2Connections, 1);
+ exportedClass->verifyReceiverCount();
+}
+
+void tst_qqmlnotifier::removeV8Binding()
+{
+ createObjects();
+
+ // Removing a binding should disconnect all of its guarded properties
+ QVERIFY(QMetaObject::invokeMethod(root, "removeV8Binding"));
+ QCOMPARE(exportedClass->v8BindingPropConnections, 0);
+ exportedClass->verifyReceiverCount();
+}
+
+void tst_qqmlnotifier::removeScriptBinding()
+{
+ createObjects();
+
+ // Removing a binding should disconnect all of its guarded properties
+ QVERIFY(QMetaObject::invokeMethod(root, "removeScriptBinding"));
+ QCOMPARE(exportedClass->scriptBindingPropConnections, 0);
+ exportedClass->verifyReceiverCount();
+}
+
+void tst_qqmlnotifier::readProperty()
+{
+ createObjects();
+
+ // Reading a property should not connect to it
+ QVERIFY(QMetaObject::invokeMethod(root, "readProperty"));
+ QCOMPARE(exportedClass->unboundPropConnections, 0);
+ exportedClass->verifyReceiverCount();
+}
+
+void tst_qqmlnotifier::propertyChange()
+{
+ createObjects();
+
+ // Changing the state will trigger the PropertyChange to overwrite a value with a binding.
+ // For this, the new binding needs to be connected, and afterwards disconnected.
+ QVERIFY(QMetaObject::invokeMethod(root, "changeState"));
+ QCOMPARE(exportedClass->unboundPropConnections, 1);
+ exportedClass->verifyReceiverCount();
+ QVERIFY(QMetaObject::invokeMethod(root, "changeState"));
+ QCOMPARE(exportedClass->unboundPropConnections, 0);
+ exportedClass->verifyReceiverCount();
+}
+
+void tst_qqmlnotifier::disconnectOnDestroy()
+{
+ createObjects();
+
+ // Deleting a QML object should remove all connections. For exportedClass, this is tested in
+ // the destructor, and for exportedObject, it is tested below.
+ delete root;
+ root = 0;
+ QCOMPARE(exportedObject->cppObjectPropConnections, 0);
+ exportedObject->verifyReceiverCount();
+}
+
+QTEST_MAIN(tst_qqmlnotifier)
+
+#include "tst_qqmlnotifier.moc"
diff --git a/tests/auto/qml/qqmlparser/qqmlparser.pro b/tests/auto/qml/qqmlparser/qqmlparser.pro
new file mode 100644
index 0000000000..c666b71d6c
--- /dev/null
+++ b/tests/auto/qml/qqmlparser/qqmlparser.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qqmlparser
+QT += qml-private testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlparser.cpp
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+
+cross_compile: DEFINES += QTEST_CROSS_COMPILED
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
new file mode 100644
index 0000000000..3d08ec3e16
--- /dev/null
+++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
@@ -0,0 +1,210 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qqmljsengine_p.h>
+#include <private/qqmljsparser_p.h>
+#include <private/qqmljslexer_p.h>
+#include <private/qqmljsastvisitor_p.h>
+#include <private/qqmljsast_p.h>
+
+#include <qtest.h>
+#include <QDir>
+#include <QDebug>
+#include <cstdlib>
+
+class tst_qqmlparser : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qqmlparser();
+
+private slots:
+ void initTestCase();
+#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
+ void qmlParser_data();
+ void qmlParser();
+#endif
+
+private:
+ QStringList excludedDirs;
+
+ QStringList findFiles(const QDir &);
+};
+
+namespace check {
+
+using namespace QQmlJS;
+
+class Check: public AST::Visitor
+{
+ QList<AST::Node *> nodeStack;
+
+public:
+ void operator()(AST::Node *node)
+ {
+ AST::Node::accept(node, this);
+ }
+
+ void checkNode(AST::Node *node)
+ {
+ if (! nodeStack.isEmpty()) {
+ AST::Node *parent = nodeStack.last();
+ const quint32 parentBegin = parent->firstSourceLocation().begin();
+ const quint32 parentEnd = parent->lastSourceLocation().end();
+
+ QVERIFY(node->firstSourceLocation().begin() >= parentBegin);
+ QVERIFY(node->lastSourceLocation().end() <= parentEnd);
+ }
+ }
+
+ virtual bool preVisit(AST::Node *node)
+ {
+ checkNode(node);
+ nodeStack.append(node);
+ return true;
+ }
+
+ virtual void postVisit(AST::Node *)
+ {
+ nodeStack.removeLast();
+ }
+};
+
+}
+
+tst_qqmlparser::tst_qqmlparser()
+{
+}
+
+void tst_qqmlparser::initTestCase()
+{
+ // Add directories you want excluded here
+
+ // These snippets are not expected to run on their own.
+ excludedDirs << "doc/src/snippets/qml/visualdatamodel_rootindex";
+ excludedDirs << "doc/src/snippets/qml/qtbinding";
+ excludedDirs << "doc/src/snippets/qml/imports";
+ excludedDirs << "doc/src/snippets/qtquick1/visualdatamodel_rootindex";
+ excludedDirs << "doc/src/snippets/qtquick1/qtbinding";
+ excludedDirs << "doc/src/snippets/qtquick1/imports";
+}
+
+QStringList tst_qqmlparser::findFiles(const QDir &d)
+{
+ for (int ii = 0; ii < excludedDirs.count(); ++ii) {
+ QString s = excludedDirs.at(ii);
+ if (d.absolutePath().endsWith(s))
+ return QStringList();
+ }
+
+ QStringList rv;
+
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"),
+ QDir::Files);
+ foreach (const QString &file, files) {
+ rv << d.absoluteFilePath(file);
+ }
+
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QDir::NoSymLinks);
+ foreach (const QString &dir, dirs) {
+ QDir sub = d;
+ sub.cd(dir);
+ rv << findFiles(sub);
+ }
+
+ return rv;
+}
+
+/*
+This test checks all the qml and js files in the QtQml UI source tree
+and ensures that the subnode's source locations are inside parent node's source locations
+*/
+
+#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
+void tst_qqmlparser::qmlParser_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QString examples = QLatin1String(SRCDIR) + "/../../../../examples/";
+ QString tests = QLatin1String(SRCDIR) + "/../../../../tests/";
+
+ QStringList files;
+ files << findFiles(QDir(examples));
+ files << findFiles(QDir(tests));
+
+ foreach (const QString &file, files)
+ QTest::newRow(qPrintable(file)) << file;
+}
+#endif
+
+#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
+void tst_qqmlparser::qmlParser()
+{
+ QFETCH(QString, file);
+
+ using namespace QQmlJS;
+
+ QString code;
+
+ QFile f(file);
+ if (f.open(QFile::ReadOnly))
+ code = QString::fromUtf8(f.readAll());
+
+ const bool qmlMode = file.endsWith(QLatin1String(".qml"));
+
+ Engine engine;
+ Lexer lexer(&engine);
+ lexer.setCode(code, 1, qmlMode);
+ Parser parser(&engine);
+ if (qmlMode)
+ parser.parse();
+ else
+ parser.parseProgram();
+
+ check::Check chk;
+ chk(parser.rootNode());
+}
+#endif
+
+QTEST_MAIN(tst_qqmlparser)
+
+#include "tst_qqmlparser.moc"
diff --git a/tests/auto/qml/qqmlproperty/data/NoContextTypeA.qml b/tests/auto/qml/qqmlproperty/data/NoContextTypeA.qml
new file mode 100644
index 0000000000..f58967cbb2
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/NoContextTypeA.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property string someString
+}
diff --git a/tests/auto/qml/qqmlproperty/data/NoContextTypeB.qml b/tests/auto/qml/qqmlproperty/data/NoContextTypeB.qml
new file mode 100644
index 0000000000..4b3672873d
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/NoContextTypeB.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property NoContextTypeA myTypeA
+}
diff --git a/tests/auto/qml/qqmlproperty/data/SecondComponent.qml b/tests/auto/qml/qqmlproperty/data/SecondComponent.qml
new file mode 100644
index 0000000000..45d81c9010
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/SecondComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property string a: "Hello, World"
+ property bool b: false
+}
diff --git a/tests/auto/qml/qqmlproperty/data/TestType.qml b/tests/auto/qml/qqmlproperty/data/TestType.qml
new file mode 100644
index 0000000000..1fe150548a
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/TestType.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property int a: 10
+}
+
diff --git a/tests/auto/qml/qqmlproperty/data/aliasPropertyBindings.qml b/tests/auto/qml/qqmlproperty/data/aliasPropertyBindings.qml
new file mode 100644
index 0000000000..f101f38a2d
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/aliasPropertyBindings.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property real test: 9
+ property real test2: 3
+
+ property real realProperty: test * test + test
+ property alias aliasProperty: root.realProperty
+
+ states: State {
+ name: "switch"
+ PropertyChanges {
+ target: root
+ aliasProperty: 32 * test2
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml b/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml
new file mode 100644
index 0000000000..a9e51c1255
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/assignEmptyVariantMap.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ Component.onCompleted: { o.variantMap = {}; }
+}
diff --git a/tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml b/tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml
new file mode 100644
index 0000000000..1b7614dc07
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/componentDir/FirstComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property int a: 10
+}
diff --git a/tests/auto/qml/qqmlproperty/data/invalidBinding.qml b/tests/auto/qml/qqmlproperty/data/invalidBinding.qml
new file mode 100644
index 0000000000..e2bb1d172d
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/invalidBinding.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ property Text text: myText
+
+ property Rectangle rectangle1: myText
+ property Rectangle rectangle2: eval('getMyText()') // eval to force non-shared (v8) binding
+
+ function getMyText() { return myText; }
+
+ Text {
+ id: myText
+
+ anchors.verticalCenter: parent // invalid binding
+ }
+}
diff --git a/tests/auto/qml/qqmlproperty/data/readSynthesizedObject.qml b/tests/auto/qml/qqmlproperty/data/readSynthesizedObject.qml
new file mode 100644
index 0000000000..55010b69a9
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/readSynthesizedObject.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property TestType test
+
+ test: TestType {
+ property int b: 19
+ }
+}
diff --git a/tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml b/tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml
new file mode 100644
index 0000000000..92e1675d11
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/registeredCompositeTypeProperty.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+import "componentDir"
+
+Item {
+ id: root
+
+ property FirstComponent first: FirstComponent { }
+ property FirstComponent second
+ property SecondComponent third: SecondComponent { }
+
+ property list<FirstComponent> fclist: [
+ FirstComponent {
+ a: 15
+ }
+ ]
+ property list<SecondComponent> sclistOne: [
+ SecondComponent {
+ a: "G'day, World"
+ },
+ SecondComponent { },
+ SecondComponent {
+ b: true
+ }
+ ]
+ property list<SecondComponent> sclistTwo
+
+ Component.onCompleted: {
+ var c1 = Qt.createComponent("./componentDir/FirstComponent.qml");
+ var o1 = c1.createObject(root);
+ second = o1;
+ }
+}
diff --git a/tests/auto/qml/qqmlproperty/qqmlproperty.pro b/tests/auto/qml/qqmlproperty/qqmlproperty.pro
new file mode 100644
index 0000000000..1ec02177ea
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/qqmlproperty.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qqmlproperty
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlproperty.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
new file mode 100644
index 0000000000..9b83698591
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -0,0 +1,1878 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlproperty.h>
+#include <QtQml/private/qqmlproperty_p.h>
+#include <private/qqmlbinding_p.h>
+#include <private/qqmlboundsignal_p.h>
+#include <QtWidgets/QLineEdit>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+#include <QtCore/private/qobject_p.h>
+#include "../../shared/util.h"
+
+#include <QDebug>
+class MyQmlObject : public QObject
+{
+ Q_OBJECT
+public:
+ MyQmlObject() {}
+};
+
+QML_DECLARE_TYPE(MyQmlObject);
+
+class MyAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int foo READ foo WRITE setFoo)
+public:
+ MyAttached(QObject *parent) : QObject(parent), m_foo(13) {}
+
+ int foo() const { return m_foo; }
+ void setFoo(int f) { m_foo = f; }
+
+private:
+ int m_foo;
+};
+
+class MyContainer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<MyQmlObject> children READ children)
+public:
+ MyContainer() {}
+
+ QQmlListProperty<MyQmlObject> children() { return QQmlListProperty<MyQmlObject>(this, m_children); }
+
+ static MyAttached *qmlAttachedProperties(QObject *o) {
+ return new MyAttached(o);
+ }
+
+private:
+ QList<MyQmlObject*> m_children;
+};
+
+QML_DECLARE_TYPE(MyContainer);
+QML_DECLARE_TYPEINFO(MyContainer, QML_HAS_ATTACHED_PROPERTIES)
+
+class tst_qqmlproperty : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlproperty() {}
+
+private slots:
+ void initTestCase();
+
+ // Constructors
+ void qmlmetaproperty();
+ void qmlmetaproperty_object();
+ void qmlmetaproperty_object_string();
+ void qmlmetaproperty_object_context();
+ void qmlmetaproperty_object_string_context();
+
+ // Methods
+ void name();
+ void read();
+ void write();
+ void reset();
+
+ // Functionality
+ void writeObjectToList();
+ void writeListToList();
+
+ //writeToReadOnly();
+
+ void urlHandling_data();
+ void urlHandling();
+
+ void variantMapHandling_data();
+ void variantMapHandling();
+
+ // Bugs
+ void crashOnValueProperty();
+ void aliasPropertyBindings();
+ void noContext();
+ void assignEmptyVariantMap();
+ void warnOnInvalidBinding();
+ void registeredCompositeTypeProperty();
+
+ void copy();
+private:
+ QQmlEngine engine;
+};
+
+void tst_qqmlproperty::qmlmetaproperty()
+{
+ QQmlProperty prop;
+
+ QObject *obj = new QObject;
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(obj, QObjectPrivate::get(obj)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QCOMPARE(prop.name(), QString());
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Invalid);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), false);
+ QCOMPARE(prop.object(), (QObject *)0);
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QVERIFY(prop.property().name() == 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), -1);
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+}
+
+// 1 = equal, 0 = unknown, -1 = not equal.
+static int compareVariantAndListReference(const QVariant &v, QQmlListReference &r)
+{
+ if (QLatin1String(v.typeName()) != QLatin1String("QQmlListReference"))
+ return -1;
+
+ QQmlListReference lhs = v.value<QQmlListReference>();
+ if (lhs.isValid() != r.isValid())
+ return -1;
+
+ if (lhs.canCount() != r.canCount())
+ return -1;
+
+ if (!lhs.canCount()) {
+ if (lhs.canAt() != r.canAt())
+ return -1; // not equal.
+ return 0; // not sure if they're equal or not, and no way to tell.
+ }
+
+ // if we get here, we must be able to count.
+ if (lhs.count() != r.count())
+ return -1;
+
+ if (lhs.canAt() != r.canAt())
+ return -1;
+
+ if (!lhs.canAt())
+ return 0; // can count, but can't check element equality.
+
+ for (int i = 0; i < lhs.count(); ++i) {
+ if (lhs.at(i) != r.at(i)) {
+ return -1; // different elements :. not equal.
+ }
+ }
+
+ return 1; // equal.
+}
+
+void tst_qqmlproperty::registeredCompositeTypeProperty()
+{
+ // Composite type properties
+ {
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("registeredCompositeTypeProperty.qml"));
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ // create property accessors and check types.
+ QQmlProperty p1(obj, "first");
+ QQmlProperty p2(obj, "second");
+ QQmlProperty p3(obj, "third");
+ QQmlProperty p1e(obj, "first", &engine);
+ QQmlProperty p2e(obj, "second", &engine);
+ QQmlProperty p3e(obj, "third", &engine);
+ QVERIFY(p1.propertyType() == p2.propertyType());
+ QVERIFY(p1.propertyType() != p3.propertyType());
+
+ // check that the values are retrievable from CPP
+ QVariant first = obj->property("first");
+ QVariant second = obj->property("second");
+ QVariant third = obj->property("third");
+ QVERIFY(first.isValid());
+ QVERIFY(second.isValid());
+ QVERIFY(third.isValid());
+ // ensure that conversion from qobject-derived-ptr to qobject-ptr works.
+ QVERIFY(first.value<QObject*>());
+ QVERIFY(second.value<QObject*>());
+ QVERIFY(third.value<QObject*>());
+
+ // check that the values retrieved via QQmlProperty match those retrieved via QMetaProperty::read().
+ QCOMPARE(p1.read().value<QObject*>(), first.value<QObject*>());
+ QCOMPARE(p2.read().value<QObject*>(), second.value<QObject*>());
+ QCOMPARE(p3.read().value<QObject*>(), third.value<QObject*>());
+ QCOMPARE(p1e.read().value<QObject*>(), first.value<QObject*>());
+ QCOMPARE(p2e.read().value<QObject*>(), second.value<QObject*>());
+ QCOMPARE(p3e.read().value<QObject*>(), third.value<QObject*>());
+
+ delete obj;
+ }
+
+ // List-of-composite-type type properties
+ {
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("registeredCompositeTypeProperty.qml"));
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ // create list property accessors and check types
+ QQmlProperty lp1e(obj, "fclist", &engine);
+ QQmlProperty lp2e(obj, "sclistOne", &engine);
+ QQmlProperty lp3e(obj, "sclistTwo", &engine);
+ QVERIFY(lp1e.propertyType() != lp2e.propertyType());
+ QVERIFY(lp2e.propertyType() == lp3e.propertyType());
+
+ // check that the list values are retrievable from CPP
+ QVariant firstList = obj->property("fclist");
+ QVariant secondList = obj->property("sclistOne");
+ QVariant thirdList = obj->property("sclistTwo");
+ QVERIFY(firstList.isValid());
+ QVERIFY(secondList.isValid());
+ QVERIFY(thirdList.isValid());
+
+ // check that the value returned by QQmlProperty::read() is equivalent to the list reference.
+ QQmlListReference r1(obj, "fclist", &engine);
+ QQmlListReference r2(obj, "sclistOne", &engine);
+ QQmlListReference r3(obj, "sclistTwo", &engine);
+ QCOMPARE(compareVariantAndListReference(lp1e.read(), r1), 1);
+ QCOMPARE(compareVariantAndListReference(lp2e.read(), r2), 1);
+ QCOMPARE(compareVariantAndListReference(lp3e.read(), r3), 1);
+
+ delete obj;
+ }
+}
+
+class PropertyObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int defaultProperty READ defaultProperty)
+ Q_PROPERTY(QRect rectProperty READ rectProperty)
+ Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty)
+ Q_PROPERTY(QUrl url READ url WRITE setUrl)
+ Q_PROPERTY(QVariantMap variantMap READ variantMap WRITE setVariantMap)
+ Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty)
+ Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal)
+ Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject)
+
+ Q_CLASSINFO("DefaultProperty", "defaultProperty")
+public:
+ PropertyObject() : m_resetProperty(9) {}
+
+ int defaultProperty() { return 10; }
+ QRect rectProperty() { return QRect(10, 10, 1, 209); }
+
+ QRect wrectProperty() { return m_rect; }
+ void setWRectProperty(const QRect &r) { m_rect = r; }
+
+ QUrl url() { return m_url; }
+ void setUrl(const QUrl &u) { m_url = u; }
+
+ QVariantMap variantMap() const { return m_variantMap; }
+ void setVariantMap(const QVariantMap &variantMap) { m_variantMap = variantMap; }
+
+ int resettableProperty() const { return m_resetProperty; }
+ void setResettableProperty(int r) { m_resetProperty = r; }
+ void resetProperty() { m_resetProperty = 9; }
+
+ int propertyWithNotify() const { return m_propertyWithNotify; }
+ void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); }
+
+ MyQmlObject *qmlObject() { return &m_qmlObject; }
+
+signals:
+ void clicked();
+ void oddlyNamedNotifySignal();
+
+private:
+ int m_resetProperty;
+ QRect m_rect;
+ QUrl m_url;
+ QVariantMap m_variantMap;
+ int m_propertyWithNotify;
+ MyQmlObject m_qmlObject;
+};
+
+QML_DECLARE_TYPE(PropertyObject);
+
+void tst_qqmlproperty::qmlmetaproperty_object()
+{
+ QObject object; // Has no default property
+ PropertyObject dobject; // Has default property
+
+ {
+ QQmlProperty prop(&object);
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString());
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Invalid);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), false);
+ QCOMPARE(prop.object(), (QObject *)0);
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QVERIFY(prop.property().name() == 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), -1);
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject);
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("defaultProperty"));
+ QCOMPARE(prop.read(), QVariant(10));
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), true);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Property);
+ QCOMPARE(prop.isProperty(), true);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), true);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyTypeName(), "int");
+ QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding != 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+}
+
+void tst_qqmlproperty::qmlmetaproperty_object_string()
+{
+ QObject object;
+ PropertyObject dobject;
+
+ {
+ QQmlProperty prop(&object, QString("defaultProperty"));
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString());
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Invalid);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), false);
+ QCOMPARE(prop.object(), (QObject *)0);
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QVERIFY(prop.property().name() == 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), -1);
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject, QString("defaultProperty"));
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("defaultProperty"));
+ QCOMPARE(prop.read(), QVariant(10));
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), true);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Property);
+ QCOMPARE(prop.isProperty(), true);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), true);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyTypeName(), "int");
+ QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding != 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject, QString("onClicked"));
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("onClicked"));
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant("Hello")), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QCOMPARE(QString(prop.method().methodSignature()), QString("clicked()"));
+ QCOMPARE(prop.type(), QQmlProperty::SignalProperty);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), true);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QCOMPARE(prop.property().name(), (const char *)0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(!sigExprWatcher.wasDeleted());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == sigExpr);
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged"));
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("onOddlyNamedNotifySignal"));
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant("Hello")), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QCOMPARE(QString(prop.method().methodSignature()), QString("oddlyNamedNotifySignal()"));
+ QCOMPARE(prop.type(), QQmlProperty::SignalProperty);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), true);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QCOMPARE(prop.property().name(), (const char *)0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(!sigExprWatcher.wasDeleted());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == sigExpr);
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+}
+
+void tst_qqmlproperty::qmlmetaproperty_object_context()
+{
+ QObject object; // Has no default property
+ PropertyObject dobject; // Has default property
+
+ {
+ QQmlProperty prop(&object, engine.rootContext());
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString());
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Invalid);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), false);
+ QCOMPARE(prop.object(), (QObject *)0);
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QVERIFY(prop.property().name() == 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), -1);
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject, engine.rootContext());
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("defaultProperty"));
+ QCOMPARE(prop.read(), QVariant(10));
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), true);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Property);
+ QCOMPARE(prop.isProperty(), true);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), true);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyTypeName(), "int");
+ QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding != 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+}
+
+void tst_qqmlproperty::qmlmetaproperty_object_string_context()
+{
+ QObject object;
+ PropertyObject dobject;
+
+ {
+ QQmlProperty prop(&object, QString("defaultProperty"), engine.rootContext());
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString());
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Invalid);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), false);
+ QCOMPARE(prop.object(), (QObject *)0);
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QVERIFY(prop.property().name() == 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), -1);
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject, QString("defaultProperty"), engine.rootContext());
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("defaultProperty"));
+ QCOMPARE(prop.read(), QVariant(10));
+ QCOMPARE(prop.write(QVariant()), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), true);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QVERIFY(!prop.method().isValid());
+ QCOMPARE(prop.type(), QQmlProperty::Property);
+ QCOMPARE(prop.isProperty(), true);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), true);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), false);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyTypeName(), "int");
+ QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding != 0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == binding.data());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(sigExprWatcher.wasDeleted());
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject, QString("onClicked"), engine.rootContext());
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("onClicked"));
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant("Hello")), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QCOMPARE(QString(prop.method().methodSignature()), QString("clicked()"));
+ QCOMPARE(prop.type(), QQmlProperty::SignalProperty);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), true);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QCOMPARE(prop.property().name(), (const char *)0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(!sigExprWatcher.wasDeleted());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == sigExpr);
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+
+ {
+ QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext());
+
+ QWeakPointer<QQmlAbstractBinding> binding(QQmlAbstractBinding::getPointer(new QQmlBinding(QLatin1String("null"), 0, engine.rootContext())));
+ static_cast<QQmlBinding *>(binding.data())->setTarget(prop);
+ QVERIFY(binding != 0);
+ QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1);
+ QQmlAbstractExpression::DeleteWatcher sigExprWatcher(sigExpr);
+ QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted());
+
+ QObject *obj = new QObject;
+
+ QCOMPARE(prop.name(), QString("onOddlyNamedNotifySignal"));
+ QCOMPARE(prop.read(), QVariant());
+ QCOMPARE(prop.write(QVariant("Hello")), false);
+ QCOMPARE(prop.hasNotifySignal(), false);
+ QCOMPARE(prop.needsNotifySignal(), false);
+ QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false);
+ QCOMPARE(prop.connectNotifySignal(obj, 0), false);
+ QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false);
+ QCOMPARE(prop.connectNotifySignal(obj, -1), false);
+ QCOMPARE(QString(prop.method().methodSignature()), QString("oddlyNamedNotifySignal()"));
+ QCOMPARE(prop.type(), QQmlProperty::SignalProperty);
+ QCOMPARE(prop.isProperty(), false);
+ QCOMPARE(prop.isWritable(), false);
+ QCOMPARE(prop.isDesignable(), false);
+ QCOMPARE(prop.isResettable(), false);
+ QCOMPARE(prop.isSignalProperty(), true);
+ QCOMPARE(prop.isValid(), true);
+ QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
+ QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory);
+ QCOMPARE(prop.propertyType(), 0);
+ QCOMPARE(prop.propertyTypeName(), (const char *)0);
+ QCOMPARE(prop.property().name(), (const char *)0);
+ QVERIFY(QQmlPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::setBinding(prop, binding.data()) == 0);
+ QVERIFY(binding == 0);
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QQmlPropertyPrivate::takeSignalExpression(prop, sigExpr) == 0);
+ QVERIFY(!sigExprWatcher.wasDeleted());
+ QVERIFY(QQmlPropertyPrivate::signalExpression(prop) == sigExpr);
+ QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()"));
+ QCOMPARE(QQmlPropertyPrivate::valueTypeCoreIndex(prop), -1);
+
+ delete obj;
+ }
+}
+
+void tst_qqmlproperty::name()
+{
+ {
+ QQmlProperty p;
+ QCOMPARE(p.name(), QString());
+ }
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o);
+ QCOMPARE(p.name(), QString("defaultProperty"));
+ }
+
+ {
+ QObject o;
+ QQmlProperty p(&o, QString("objectName"));
+ QCOMPARE(p.name(), QString("objectName"));
+ }
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onClicked");
+ QCOMPARE(p.name(), QString("onClicked"));
+ }
+
+ {
+ QObject o;
+ QQmlProperty p(&o, "onClicked");
+ QCOMPARE(p.name(), QString());
+ }
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onPropertyWithNotifyChanged");
+ QCOMPARE(p.name(), QString("onOddlyNamedNotifySignal"));
+ }
+
+ {
+ QObject o;
+ QQmlProperty p(&o, "onPropertyWithNotifyChanged");
+ QCOMPARE(p.name(), QString());
+ }
+
+ {
+ QObject o;
+ QQmlProperty p(&o, "foo");
+ QCOMPARE(p.name(), QString());
+ }
+
+ {
+ QQmlProperty p(0, "foo");
+ QCOMPARE(p.name(), QString());
+ }
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "rectProperty");
+ QCOMPARE(p.name(), QString("rectProperty"));
+ }
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "rectProperty.x");
+ QCOMPARE(p.name(), QString("rectProperty.x"));
+ }
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "rectProperty.foo");
+ QCOMPARE(p.name(), QString());
+ }
+}
+
+void tst_qqmlproperty::read()
+{
+ // Invalid
+ {
+ QQmlProperty p;
+ QCOMPARE(p.read(), QVariant());
+ }
+
+ // Default prop
+ {
+ PropertyObject o;
+ QQmlProperty p(&o);
+ QCOMPARE(p.read(), QVariant(10));
+ }
+
+ // Invalid default prop
+ {
+ QObject o;
+ QQmlProperty p(&o);
+ QCOMPARE(p.read(), QVariant());
+ }
+
+ // Value prop by name
+ {
+ QObject o;
+
+ QQmlProperty p(&o, "objectName");
+ QCOMPARE(p.read(), QVariant(QString()));
+
+ o.setObjectName("myName");
+
+ QCOMPARE(p.read(), QVariant("myName"));
+ }
+
+ // Value prop by name (static)
+ {
+ QObject o;
+
+ QCOMPARE(QQmlProperty::read(&o, "objectName"), QVariant(QString()));
+
+ o.setObjectName("myName");
+
+ QCOMPARE(QQmlProperty::read(&o, "objectName"), QVariant("myName"));
+ }
+
+ // Value-type prop
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "rectProperty.x");
+ QCOMPARE(p.read(), QVariant(10));
+ }
+
+ // Invalid value-type prop
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "rectProperty.foo");
+ QCOMPARE(p.read(), QVariant());
+ }
+
+ // Signal property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onClicked");
+ QCOMPARE(p.read(), QVariant());
+
+ QVERIFY(0 == QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1)));
+ QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p));
+
+ QCOMPARE(p.read(), QVariant());
+ }
+
+ // Automatic signal property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onPropertyWithNotifyChanged");
+ QCOMPARE(p.read(), QVariant());
+
+ QVERIFY(0 == QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1)));
+ QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p));
+
+ QCOMPARE(p.read(), QVariant());
+ }
+
+ // Deleted object
+ {
+ PropertyObject *o = new PropertyObject;
+ QQmlProperty p(o, "rectProperty.x");
+ QCOMPARE(p.read(), QVariant(10));
+ delete o;
+ QCOMPARE(p.read(), QVariant());
+ }
+
+ // Object property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "qmlObject");
+ QCOMPARE(p.propertyTypeCategory(), QQmlProperty::Object);
+ QCOMPARE(p.propertyType(), qMetaTypeId<MyQmlObject*>());
+ QVariant v = p.read();
+ QVERIFY(v.userType() == QMetaType::QObjectStar);
+ QVERIFY(qvariant_cast<QObject *>(v) == o.qmlObject());
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("readSynthesizedObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QQmlProperty p(object, "test", &engine);
+
+ QCOMPARE(p.propertyTypeCategory(), QQmlProperty::Object);
+ QVERIFY(p.propertyType() != QMetaType::QObjectStar);
+
+ QVariant v = p.read();
+ QVERIFY(v.userType() == QMetaType::QObjectStar);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("a").toInt(), 10);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("b").toInt(), 19);
+ }
+ { // static
+ QQmlComponent component(&engine, testFileUrl("readSynthesizedObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVariant v = QQmlProperty::read(object, "test", &engine);
+ QVERIFY(v.userType() == QMetaType::QObjectStar);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("a").toInt(), 10);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("b").toInt(), 19);
+ }
+
+ // Attached property
+ {
+ QQmlComponent component(&engine);
+ component.setData("import Test 1.0\nMyContainer { }", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QQmlProperty p(object, "MyContainer.foo", qmlContext(object));
+ QCOMPARE(p.read(), QVariant(13));
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import Test 1.0\nMyContainer { MyContainer.foo: 10 }", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QQmlProperty p(object, "MyContainer.foo", qmlContext(object));
+ QCOMPARE(p.read(), QVariant(10));
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QQmlProperty p(object, "Foo.MyContainer.foo", qmlContext(object));
+ QCOMPARE(p.read(), QVariant(10));
+ delete object;
+ }
+ { // static
+ QQmlComponent component(&engine);
+ component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(QQmlProperty::read(object, "Foo.MyContainer.foo", qmlContext(object)), QVariant(10));
+ delete object;
+ }
+}
+
+void tst_qqmlproperty::write()
+{
+ // Invalid
+ {
+ QQmlProperty p;
+ QCOMPARE(p.write(QVariant(10)), false);
+ }
+
+ // Read-only default prop
+ {
+ PropertyObject o;
+ QQmlProperty p(&o);
+ QCOMPARE(p.write(QVariant(10)), false);
+ }
+
+ // Invalid default prop
+ {
+ QObject o;
+ QQmlProperty p(&o);
+ QCOMPARE(p.write(QVariant(10)), false);
+ }
+
+ // Read-only prop by name
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, QString("defaultProperty"));
+ QCOMPARE(p.write(QVariant(10)), false);
+ }
+
+ // Writable prop by name
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, QString("objectName"));
+ QCOMPARE(o.objectName(), QString());
+ QCOMPARE(p.write(QVariant(QString("myName"))), true);
+ QCOMPARE(o.objectName(), QString("myName"));
+ }
+
+ // Writable prop by name (static)
+ {
+ PropertyObject o;
+ QCOMPARE(QQmlProperty::write(&o, QString("objectName"), QVariant(QString("myName"))), true);
+ QCOMPARE(o.objectName(), QString("myName"));
+ }
+
+ // Deleted object
+ {
+ PropertyObject *o = new PropertyObject;
+ QQmlProperty p(o, QString("objectName"));
+ QCOMPARE(p.write(QVariant(QString("myName"))), true);
+ QCOMPARE(o->objectName(), QString("myName"));
+
+ delete o;
+
+ QCOMPARE(p.write(QVariant(QString("myName"))), false);
+ }
+
+ // Signal property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onClicked");
+ QCOMPARE(p.write(QVariant("console.log(1921)")), false);
+
+ QVERIFY(0 == QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1)));
+ QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p));
+
+ QCOMPARE(p.write(QVariant("console.log(1921)")), false);
+
+ QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p));
+ }
+
+ // Automatic signal property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onPropertyWithNotifyChanged");
+ QCOMPARE(p.write(QVariant("console.log(1921)")), false);
+
+ QVERIFY(0 == QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), false, QString(), -1, -1)));
+ QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p));
+
+ QCOMPARE(p.write(QVariant("console.log(1921)")), false);
+
+ QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p));
+ }
+
+ // Value-type property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "wrectProperty");
+
+ QCOMPARE(o.wrectProperty(), QRect());
+ QCOMPARE(p.write(QRect(1, 13, 99, 8)), true);
+ QCOMPARE(o.wrectProperty(), QRect(1, 13, 99, 8));
+
+ QQmlProperty p2(&o, "wrectProperty.x");
+ QCOMPARE(p2.read(), QVariant(1));
+ QCOMPARE(p2.write(QVariant(6)), true);
+ QCOMPARE(p2.read(), QVariant(6));
+ QCOMPARE(o.wrectProperty(), QRect(6, 13, 99, 8));
+ }
+
+ // URL-property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "url");
+
+ QCOMPARE(p.write(QUrl("main.qml")), true);
+ QCOMPARE(o.url(), QUrl("main.qml"));
+
+ QQmlProperty p2(&o, "url", engine.rootContext());
+
+ QUrl result = engine.baseUrl().resolved(QUrl("main.qml"));
+ QVERIFY(result != QUrl("main.qml"));
+
+ QCOMPARE(p2.write(QUrl("main.qml")), true);
+ QCOMPARE(o.url(), result);
+ }
+ { // static
+ PropertyObject o;
+
+ QCOMPARE(QQmlProperty::write(&o, "url", QUrl("main.qml")), true);
+ QCOMPARE(o.url(), QUrl("main.qml"));
+
+ QUrl result = engine.baseUrl().resolved(QUrl("main.qml"));
+ QVERIFY(result != QUrl("main.qml"));
+
+ QCOMPARE(QQmlProperty::write(&o, "url", QUrl("main.qml"), engine.rootContext()), true);
+ QCOMPARE(o.url(), result);
+ }
+
+ // VariantMap-property
+ QVariantMap vm;
+ vm.insert("key", "value");
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "variantMap");
+
+ QCOMPARE(p.write(vm), true);
+ QCOMPARE(o.variantMap(), vm);
+
+ QQmlProperty p2(&o, "variantMap", engine.rootContext());
+
+ QCOMPARE(p2.write(vm), true);
+ QCOMPARE(o.variantMap(), vm);
+ }
+ { // static
+ PropertyObject o;
+
+ QCOMPARE(QQmlProperty::write(&o, "variantMap", vm), true);
+ QCOMPARE(o.variantMap(), vm);
+
+ QCOMPARE(QQmlProperty::write(&o, "variantMap", vm, engine.rootContext()), true);
+ QCOMPARE(o.variantMap(), vm);
+ }
+
+ // Attached property
+ {
+ QQmlComponent component(&engine);
+ component.setData("import Test 1.0\nMyContainer { }", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QQmlProperty p(object, "MyContainer.foo", qmlContext(object));
+ p.write(QVariant(99));
+ QCOMPARE(p.read(), QVariant(99));
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QQmlProperty p(object, "Foo.MyContainer.foo", qmlContext(object));
+ p.write(QVariant(99));
+ QCOMPARE(p.read(), QVariant(99));
+ delete object;
+ }
+}
+
+void tst_qqmlproperty::reset()
+{
+ // Invalid
+ {
+ QQmlProperty p;
+ QCOMPARE(p.isResettable(), false);
+ QCOMPARE(p.reset(), false);
+ }
+
+ // Read-only default prop
+ {
+ PropertyObject o;
+ QQmlProperty p(&o);
+ QCOMPARE(p.isResettable(), false);
+ QCOMPARE(p.reset(), false);
+ }
+
+ // Invalid default prop
+ {
+ QObject o;
+ QQmlProperty p(&o);
+ QCOMPARE(p.isResettable(), false);
+ QCOMPARE(p.reset(), false);
+ }
+
+ // Non-resettable-only prop by name
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, QString("defaultProperty"));
+ QCOMPARE(p.isResettable(), false);
+ QCOMPARE(p.reset(), false);
+ }
+
+ // Resettable prop by name
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, QString("resettableProperty"));
+
+ QCOMPARE(p.read(), QVariant(9));
+ QCOMPARE(p.write(QVariant(11)), true);
+ QCOMPARE(p.read(), QVariant(11));
+
+ QCOMPARE(p.isResettable(), true);
+ QCOMPARE(p.reset(), true);
+
+ QCOMPARE(p.read(), QVariant(9));
+ }
+
+ // Deleted object
+ {
+ PropertyObject *o = new PropertyObject;
+
+ QQmlProperty p(o, QString("resettableProperty"));
+
+ QCOMPARE(p.isResettable(), true);
+ QCOMPARE(p.reset(), true);
+
+ delete o;
+
+ QCOMPARE(p.isResettable(), false);
+ QCOMPARE(p.reset(), false);
+ }
+
+ // Signal property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onClicked");
+
+ QCOMPARE(p.isResettable(), false);
+ QCOMPARE(p.reset(), false);
+ }
+
+ // Automatic signal property
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "onPropertyWithNotifyChanged");
+
+ QCOMPARE(p.isResettable(), false);
+ QCOMPARE(p.reset(), false);
+ }
+}
+
+void tst_qqmlproperty::writeObjectToList()
+{
+ QQmlComponent containerComponent(&engine);
+ containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl());
+ MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create());
+ QVERIFY(container != 0);
+ QQmlListReference list(container, "children");
+ QVERIFY(list.count() == 1);
+
+ MyQmlObject *object = new MyQmlObject;
+ QQmlProperty prop(container, "children");
+ prop.write(qVariantFromValue(object));
+ QCOMPARE(list.count(), 1);
+ QCOMPARE(list.at(0), qobject_cast<QObject*>(object));
+}
+
+void tst_qqmlproperty::writeListToList()
+{
+ QQmlComponent containerComponent(&engine);
+ containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl());
+ MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create());
+ QVERIFY(container != 0);
+ QQmlListReference list(container, "children");
+ QVERIFY(list.count() == 1);
+
+ QList<QObject*> objList;
+ objList << new MyQmlObject() << new MyQmlObject() << new MyQmlObject() << new MyQmlObject();
+ QQmlProperty prop(container, "children");
+ prop.write(qVariantFromValue(objList));
+ QCOMPARE(list.count(), 4);
+
+ //XXX need to try this with read/write prop (for read-only it correctly doesn't write)
+ /*QList<MyQmlObject*> typedObjList;
+ typedObjList << new MyQmlObject();
+ prop.write(qVariantFromValue(&typedObjList));
+ QCOMPARE(container->children()->size(), 1);*/
+}
+
+void tst_qqmlproperty::urlHandling_data()
+{
+ QTest::addColumn<QByteArray>("input");
+ QTest::addColumn<QString>("scheme");
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<QByteArray>("encoded");
+
+ QTest::newRow("unspecifiedFile")
+ << QByteArray("main.qml")
+ << QString("")
+ << QString("main.qml")
+ << QByteArray("main.qml");
+
+ QTest::newRow("specifiedFile")
+ << QByteArray("file:///main.qml")
+ << QString("file")
+ << QString("/main.qml")
+ << QByteArray("file:///main.qml");
+
+ QTest::newRow("httpFile")
+ << QByteArray("http://www.example.com/main.qml")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml");
+
+ QTest::newRow("pathFile")
+ << QByteArray("http://www.example.com/resources/main.qml")
+ << QString("http")
+ << QString("/resources/main.qml")
+ << QByteArray("http://www.example.com/resources/main.qml");
+
+ QTest::newRow("encodableName")
+ << QByteArray("http://www.example.com/main file.qml")
+ << QString("http")
+ << QString("/main file.qml")
+ << QByteArray("http://www.example.com/main%20file.qml");
+
+ QTest::newRow("preencodedName")
+ << QByteArray("http://www.example.com/resources%7Cmain%20file.qml")
+ << QString("http")
+ << QString("/resources|main file.qml")
+ << QByteArray("http://www.example.com/resources%7Cmain%20file.qml");
+
+ QTest::newRow("encodableQuery")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now working?")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now%20working?");
+
+ // Although 'text%2Fqml' is pre-encoded, it will be decoded to allow correct QUrl classification
+ QTest::newRow("preencodedQuery")
+ << QByteArray("http://www.example.com/main.qml?type=text%2Fqml&comment=now working%3F")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now%20working%3F");
+
+ QTest::newRow("encodableFragment")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000|volume+50%")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7Cvolume+50%25");
+
+ QTest::newRow("improperlyEncodedFragment")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7Cvolume%2B50%")
+ << QString("http")
+ << QString("/main.qml")
+ << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%257Cvolume%252B50%25");
+}
+
+void tst_qqmlproperty::urlHandling()
+{
+ QFETCH(QByteArray, input);
+ QFETCH(QString, scheme);
+ QFETCH(QString, path);
+ QFETCH(QByteArray, encoded);
+
+ QString inputString(QString::fromUtf8(input));
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "url");
+
+ // Test url written as QByteArray
+ QCOMPARE(p.write(input), true);
+ QUrl byteArrayResult(o.url());
+
+ QCOMPARE(byteArrayResult.scheme(), scheme);
+ QCOMPARE(byteArrayResult.path(), path);
+ QCOMPARE(byteArrayResult.toString(QUrl::FullyEncoded), QString::fromUtf8(encoded));
+ QCOMPARE(byteArrayResult.toEncoded(), encoded);
+ }
+
+ {
+ PropertyObject o;
+ QQmlProperty p(&o, "url");
+
+ // Test url written as QString
+ QCOMPARE(p.write(inputString), true);
+ QUrl stringResult(o.url());
+
+ QCOMPARE(stringResult.scheme(), scheme);
+ QCOMPARE(stringResult.path(), path);
+ QCOMPARE(stringResult.toString(QUrl::FullyEncoded), QString::fromUtf8(encoded));
+ QCOMPARE(stringResult.toEncoded(), encoded);
+ }
+}
+
+void tst_qqmlproperty::variantMapHandling_data()
+{
+ QTest::addColumn<QVariantMap>("vm");
+
+ // Object literals
+ {
+ QVariantMap m;
+ QTest::newRow("{}") << m;
+ }
+ {
+ QVariantMap m;
+ m["a"] = QVariantMap();
+ QTest::newRow("{ a:{} }") << m;
+ }
+ {
+ QVariantMap m, m2;
+ m2["b"] = 10;
+ m2["c"] = 20;
+ m["a"] = m2;
+ QTest::newRow("{ a:{b:10, c:20} }") << m;
+ }
+ {
+ QVariantMap m;
+ m["a"] = 10;
+ m["b"] = QVariantList() << 20 << 30;
+ QTest::newRow("{ a:10, b:[20, 30]}") << m;
+ }
+
+ // Cyclic objects
+ {
+ QVariantMap m;
+ m["p"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=o") << m;
+ }
+ {
+ QVariantMap m;
+ m["p"] = 123;
+ m["q"] = QVariantMap();
+ QTest::newRow("var o={}; o.p=123; o.q=o") << m;
+ }
+}
+
+void tst_qqmlproperty::variantMapHandling()
+{
+ QFETCH(QVariantMap, vm);
+
+ PropertyObject o;
+ QQmlProperty p(&o, "variantMap");
+
+ QCOMPARE(p.write(vm), true);
+ QCOMPARE(o.variantMap(), vm);
+}
+
+void tst_qqmlproperty::crashOnValueProperty()
+{
+ QQmlEngine *engine = new QQmlEngine;
+ QQmlComponent component(engine);
+
+ component.setData("import Test 1.0\nPropertyObject { wrectProperty.x: 10 }", QUrl());
+ PropertyObject *obj = qobject_cast<PropertyObject*>(component.create());
+ QVERIFY(obj != 0);
+
+ QQmlProperty p(obj, "wrectProperty.x", qmlContext(obj));
+ QCOMPARE(p.name(), QString("wrectProperty.x"));
+
+ QCOMPARE(p.read(), QVariant(10));
+
+ //don't crash once the engine is deleted
+ delete engine;
+ engine = 0;
+
+ QCOMPARE(p.propertyTypeName(), "int");
+ QCOMPARE(p.read(), QVariant(10));
+ p.write(QVariant(20));
+ QCOMPARE(p.read(), QVariant(20));
+}
+
+// QTBUG-13719
+void tst_qqmlproperty::aliasPropertyBindings()
+{
+ QQmlComponent component(&engine, testFileUrl("aliasPropertyBindings.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("realProperty").toReal(), 90.);
+ QCOMPARE(object->property("aliasProperty").toReal(), 90.);
+
+ object->setProperty("test", 10);
+
+ QCOMPARE(object->property("realProperty").toReal(), 110.);
+ QCOMPARE(object->property("aliasProperty").toReal(), 110.);
+
+ QQmlProperty realProperty(object, QLatin1String("realProperty"));
+ QQmlProperty aliasProperty(object, QLatin1String("aliasProperty"));
+
+ // Check there is a binding on these two properties
+ QVERIFY(QQmlPropertyPrivate::binding(realProperty) != 0);
+ QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != 0);
+
+ // Check that its the same binding on these two properties
+ QCOMPARE(QQmlPropertyPrivate::binding(realProperty),
+ QQmlPropertyPrivate::binding(aliasProperty));
+
+ // Change the binding
+ object->setProperty("state", QString("switch"));
+
+ QVERIFY(QQmlPropertyPrivate::binding(realProperty) != 0);
+ QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != 0);
+ QCOMPARE(QQmlPropertyPrivate::binding(realProperty),
+ QQmlPropertyPrivate::binding(aliasProperty));
+
+ QCOMPARE(object->property("realProperty").toReal(), 96.);
+ QCOMPARE(object->property("aliasProperty").toReal(), 96.);
+
+ // Check the old binding really has not effect any more
+ object->setProperty("test", 4);
+
+ QCOMPARE(object->property("realProperty").toReal(), 96.);
+ QCOMPARE(object->property("aliasProperty").toReal(), 96.);
+
+ object->setProperty("test2", 9);
+
+ QCOMPARE(object->property("realProperty").toReal(), 288.);
+ QCOMPARE(object->property("aliasProperty").toReal(), 288.);
+
+ // Revert
+ object->setProperty("state", QString(""));
+
+ QVERIFY(QQmlPropertyPrivate::binding(realProperty) != 0);
+ QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != 0);
+ QCOMPARE(QQmlPropertyPrivate::binding(realProperty),
+ QQmlPropertyPrivate::binding(aliasProperty));
+
+ QCOMPARE(object->property("realProperty").toReal(), 20.);
+ QCOMPARE(object->property("aliasProperty").toReal(), 20.);
+
+ object->setProperty("test2", 3);
+
+ QCOMPARE(object->property("realProperty").toReal(), 20.);
+ QCOMPARE(object->property("aliasProperty").toReal(), 20.);
+
+ delete object;
+}
+
+void tst_qqmlproperty::copy()
+{
+ PropertyObject object;
+
+ QQmlProperty *property = new QQmlProperty(&object, QLatin1String("defaultProperty"));
+ QCOMPARE(property->name(), QString("defaultProperty"));
+ QCOMPARE(property->read(), QVariant(10));
+ QCOMPARE(property->type(), QQmlProperty::Property);
+ QCOMPARE(property->propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(property->propertyType(), (int)QVariant::Int);
+
+ QQmlProperty p1(*property);
+ QCOMPARE(p1.name(), QString("defaultProperty"));
+ QCOMPARE(p1.read(), QVariant(10));
+ QCOMPARE(p1.type(), QQmlProperty::Property);
+ QCOMPARE(p1.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(p1.propertyType(), (int)QVariant::Int);
+
+ QQmlProperty p2(&object, QLatin1String("url"));
+ QCOMPARE(p2.name(), QString("url"));
+ p2 = *property;
+ QCOMPARE(p2.name(), QString("defaultProperty"));
+ QCOMPARE(p2.read(), QVariant(10));
+ QCOMPARE(p2.type(), QQmlProperty::Property);
+ QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+
+ delete property; property = 0;
+
+ QCOMPARE(p1.name(), QString("defaultProperty"));
+ QCOMPARE(p1.read(), QVariant(10));
+ QCOMPARE(p1.type(), QQmlProperty::Property);
+ QCOMPARE(p1.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(p1.propertyType(), (int)QVariant::Int);
+
+ QCOMPARE(p2.name(), QString("defaultProperty"));
+ QCOMPARE(p2.read(), QVariant(10));
+ QCOMPARE(p2.type(), QQmlProperty::Property);
+ QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
+ QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+}
+
+void tst_qqmlproperty::noContext()
+{
+ QQmlComponent compA(&engine, testFileUrl("NoContextTypeA.qml"));
+ QQmlComponent compB(&engine, testFileUrl("NoContextTypeB.qml"));
+
+ QObject *a = compA.create();
+ QVERIFY(a != 0);
+ QObject *b = compB.create();
+ QVERIFY(b != 0);
+
+ QVERIFY(QQmlProperty::write(b, "myTypeA", QVariant::fromValue(a), &engine));
+
+ delete a;
+ delete b;
+}
+
+void tst_qqmlproperty::assignEmptyVariantMap()
+{
+ PropertyObject o;
+
+ QVariantMap map;
+ map.insert("key", "value");
+ o.setVariantMap(map);
+ QCOMPARE(o.variantMap().count(), 1);
+ QCOMPARE(o.variantMap().isEmpty(), false);
+
+ QQmlContext context(&engine);
+ context.setContextProperty("o", &o);
+
+ QQmlComponent component(&engine, testFileUrl("assignEmptyVariantMap.qml"));
+ QObject *obj = component.create(&context);
+ QVERIFY(obj);
+
+ QCOMPARE(o.variantMap().count(), 0);
+ QCOMPARE(o.variantMap().isEmpty(), true);
+
+ delete obj;
+}
+
+void tst_qqmlproperty::warnOnInvalidBinding()
+{
+ QUrl testUrl(testFileUrl("invalidBinding.qml"));
+ QString expectedWarning;
+
+ // V4 error message for property-to-property binding
+ expectedWarning = testUrl.toString() + QString::fromLatin1(":6:36: Unable to assign QQuickText to QQuickRectangle");
+ QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData());
+
+ // V8 error message for function-to-property binding
+ expectedWarning = testUrl.toString() + QString::fromLatin1(":7:36: Unable to assign QQuickText to QQuickRectangle");
+ QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData());
+
+ // V8 error message for invalid binding to anchor
+ expectedWarning = testUrl.toString() + QString::fromLatin1(":14: Unable to assign QQuickItem_QML_6 to QQuickAnchorLine");
+ QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData());
+
+ QQmlComponent component(&engine, testUrl);
+ QObject *obj = component.create();
+ QVERIFY(obj);
+ delete obj;
+}
+
+void tst_qqmlproperty::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<MyQmlObject>("Test",1,0,"MyQmlObject");
+ qmlRegisterType<PropertyObject>("Test",1,0,"PropertyObject");
+ qmlRegisterType<MyContainer>("Test",1,0,"MyContainer");
+}
+
+QTEST_MAIN(tst_qqmlproperty)
+
+#include "tst_qqmlproperty.moc"
diff --git a/tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro b/tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro
new file mode 100644
index 0000000000..5f75015d0d
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertycache/qqmlpropertycache.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+TARGET = tst_qqmlpropertycache
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlpropertycache.cpp
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private testlib v8-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
new file mode 100644
index 0000000000..1ac53b2ee2
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -0,0 +1,283 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <private/qqmlpropertycache_p.h>
+#include <QtQml/qqmlengine.h>
+#include "../../shared/util.h"
+
+class tst_qqmlpropertycache : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qqmlpropertycache() {}
+
+private slots:
+ void properties();
+ void propertiesDerived();
+ void methods();
+ void methodsDerived();
+ void signalHandlers();
+ void signalHandlersDerived();
+
+private:
+ QQmlEngine engine;
+};
+
+class BaseObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int propertyA READ propertyA NOTIFY propertyAChanged)
+ Q_PROPERTY(QString propertyB READ propertyB NOTIFY propertyBChanged)
+public:
+ BaseObject(QObject *parent = 0) : QObject(parent) {}
+
+ int propertyA() const { return 0; }
+ QString propertyB() const { return QString(); }
+
+public Q_SLOTS:
+ void slotA() {}
+
+Q_SIGNALS:
+ void propertyAChanged();
+ void propertyBChanged();
+ void signalA();
+};
+
+class DerivedObject : public BaseObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int propertyC READ propertyC NOTIFY propertyCChanged)
+ Q_PROPERTY(QString propertyD READ propertyD NOTIFY propertyDChanged)
+public:
+ DerivedObject(QObject *parent = 0) : BaseObject(parent) {}
+
+ int propertyC() const { return 0; }
+ QString propertyD() const { return QString(); }
+
+public Q_SLOTS:
+ void slotB() {}
+
+Q_SIGNALS:
+ void propertyCChanged();
+ void propertyDChanged();
+ void signalB();
+};
+
+QQmlPropertyData *cacheProperty(QQmlPropertyCache *cache, const char *name)
+{
+ return cache->property(QLatin1String(name), 0, 0);
+}
+
+void tst_qqmlpropertycache::properties()
+{
+ QQmlEngine engine;
+ DerivedObject object;
+ const QMetaObject *metaObject = object.metaObject();
+
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(&engine, metaObject));
+ QQmlPropertyData *data;
+
+ QVERIFY(data = cacheProperty(cache, "propertyA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyA"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyB"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyC"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyC"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyD"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyD"));
+}
+
+void tst_qqmlpropertycache::propertiesDerived()
+{
+ QQmlEngine engine;
+ DerivedObject object;
+ const QMetaObject *metaObject = object.metaObject();
+
+ QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&engine, &BaseObject::staticMetaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(&engine, object.metaObject()));
+ QQmlPropertyData *data;
+
+ QVERIFY(data = cacheProperty(cache, "propertyA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyA"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyB"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyC"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyC"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyD"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfProperty("propertyD"));
+}
+
+void tst_qqmlpropertycache::methods()
+{
+ QQmlEngine engine;
+ DerivedObject object;
+ const QMetaObject *metaObject = object.metaObject();
+
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(&engine, metaObject));
+ QQmlPropertyData *data;
+
+ QVERIFY(data = cacheProperty(cache, "slotA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotA()"));
+
+ QVERIFY(data = cacheProperty(cache, "slotB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotB()"));
+
+ QVERIFY(data = cacheProperty(cache, "signalA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
+
+ QVERIFY(data = cacheProperty(cache, "signalB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyAChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyBChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyCChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyDChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
+}
+
+void tst_qqmlpropertycache::methodsDerived()
+{
+ QQmlEngine engine;
+ DerivedObject object;
+ const QMetaObject *metaObject = object.metaObject();
+
+ QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&engine, &BaseObject::staticMetaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(&engine, object.metaObject()));
+ QQmlPropertyData *data;
+
+ QVERIFY(data = cacheProperty(cache, "slotA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotA()"));
+
+ QVERIFY(data = cacheProperty(cache, "slotB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("slotB()"));
+
+ QVERIFY(data = cacheProperty(cache, "signalA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
+
+ QVERIFY(data = cacheProperty(cache, "signalB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyAChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyBChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyCChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "propertyDChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
+}
+
+void tst_qqmlpropertycache::signalHandlers()
+{
+ QQmlEngine engine;
+ DerivedObject object;
+ const QMetaObject *metaObject = object.metaObject();
+
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(&engine, metaObject));
+ QQmlPropertyData *data;
+
+ QVERIFY(data = cacheProperty(cache, "onSignalA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
+
+ QVERIFY(data = cacheProperty(cache, "onSignalB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyAChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyBChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyCChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyDChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
+}
+
+void tst_qqmlpropertycache::signalHandlersDerived()
+{
+ QQmlEngine engine;
+ DerivedObject object;
+ const QMetaObject *metaObject = object.metaObject();
+
+ QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&engine, &BaseObject::staticMetaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(&engine, object.metaObject()));
+ QQmlPropertyData *data;
+
+ QVERIFY(data = cacheProperty(cache, "onSignalA"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalA()"));
+
+ QVERIFY(data = cacheProperty(cache, "onSignalB"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("signalB()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyAChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyAChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyBChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyBChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyCChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyCChanged()"));
+
+ QVERIFY(data = cacheProperty(cache, "onPropertyDChanged"));
+ QCOMPARE(data->coreIndex, metaObject->indexOfMethod("propertyDChanged()"));
+}
+
+QTEST_MAIN(tst_qqmlpropertycache)
+
+#include "tst_qqmlpropertycache.moc"
diff --git a/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro b/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro
new file mode 100644
index 0000000000..81212bb064
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qqmlpropertymap
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlpropertymap.cpp
+
+include (../../shared/util.pri)
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
new file mode 100644
index 0000000000..327716f1b5
--- /dev/null
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -0,0 +1,317 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include "../../shared/util.h"
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlpropertymap.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QSignalSpy>
+#include <QDebug>
+
+class tst_QQmlPropertyMap : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QQmlPropertyMap() {}
+
+private slots:
+ void insert();
+ void operatorInsert();
+ void operatorValue();
+ void clear();
+ void changed();
+ void count();
+ void controlledWrite();
+
+ void crashBug();
+ void QTBUG_17868();
+ void metaObjectAccessibility();
+};
+
+void tst_QQmlPropertyMap::insert()
+{
+ QQmlPropertyMap map;
+ map.insert(QLatin1String("key1"),100);
+ map.insert(QLatin1String("key2"),200);
+ QVERIFY(map.keys().count() == 2);
+ QVERIFY(map.contains(QLatin1String("key1")));
+
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant(100));
+ QCOMPARE(map.value(QLatin1String("key2")), QVariant(200));
+
+ map.insert(QLatin1String("key1"),"Hello World");
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World"));
+
+ //inserting property names same with existing method(signal, slot, method) names is not allowed
+ //QQmlPropertyMap has an invokable keys() method
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols. ");
+ map.insert(QLatin1String("keys"), 1);
+ QVERIFY(map.keys().count() == 2);
+ QVERIFY(!map.contains(QLatin1String("keys")));
+ QVERIFY(map.value(QLatin1String("keys")).isNull());
+
+ //QQmlPropertyMap has a deleteLater() slot
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols. ");
+ map.insert(QLatin1String("deleteLater"), 1);
+ QVERIFY(map.keys().count() == 2);
+ QVERIFY(!map.contains(QLatin1String("deleteLater")));
+ QVERIFY(map.value(QLatin1String("deleteLater")).isNull());
+
+ //QQmlPropertyMap has an valueChanged() signal
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols. ");
+ map.insert(QLatin1String("valueChanged"), 1);
+ QVERIFY(map.keys().count() == 2);
+ QVERIFY(!map.contains(QLatin1String("valueChanged")));
+ QVERIFY(map.value(QLatin1String("valueChanged")).isNull());
+
+ //but 'valueChange' should be ok
+ map.insert(QLatin1String("valueChange"), 1);
+ QVERIFY(map.keys().count() == 3);
+ QVERIFY(map.contains(QLatin1String("valueChange")));
+ QCOMPARE(map.value(QLatin1String("valueChange")), QVariant(1));
+
+ //'valueCHANGED' should be ok, too
+ map.insert(QLatin1String("valueCHANGED"), 1);
+ QVERIFY(map.keys().count() == 4);
+ QVERIFY(map.contains(QLatin1String("valueCHANGED")));
+ QCOMPARE(map.value(QLatin1String("valueCHANGED")), QVariant(1));
+}
+
+void tst_QQmlPropertyMap::operatorInsert()
+{
+ QQmlPropertyMap map;
+ map[QLatin1String("key1")] = 100;
+ map[QLatin1String("key2")] = 200;
+ QVERIFY(map.keys().count() == 2);
+
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant(100));
+ QCOMPARE(map.value(QLatin1String("key2")), QVariant(200));
+
+ map[QLatin1String("key1")] = "Hello World";
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World"));
+}
+
+void tst_QQmlPropertyMap::operatorValue()
+{
+ QQmlPropertyMap map;
+ map.insert(QLatin1String("key1"),100);
+ map.insert(QLatin1String("key2"),200);
+ QVERIFY(map.count() == 2);
+ QVERIFY(map.contains(QLatin1String("key1")));
+
+ const QQmlPropertyMap &constMap = map;
+
+ QCOMPARE(constMap.value(QLatin1String("key1")), QVariant(100));
+ QCOMPARE(constMap.value(QLatin1String("key2")), QVariant(200));
+ QCOMPARE(constMap[QLatin1String("key1")], constMap.value(QLatin1String("key1")));
+ QCOMPARE(constMap[QLatin1String("key2")], constMap.value(QLatin1String("key2")));
+}
+
+void tst_QQmlPropertyMap::clear()
+{
+ QQmlPropertyMap map;
+ map.insert(QLatin1String("key1"),100);
+ QVERIFY(map.keys().count() == 1);
+
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant(100));
+
+ map.clear(QLatin1String("key1"));
+ QVERIFY(map.keys().count() == 1);
+ QVERIFY(map.contains(QLatin1String("key1")));
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant());
+}
+
+void tst_QQmlPropertyMap::changed()
+{
+ QQmlPropertyMap map;
+ QSignalSpy spy(&map, SIGNAL(valueChanged(const QString&, const QVariant&)));
+ map.insert(QLatin1String("key1"),100);
+ map.insert(QLatin1String("key2"),200);
+ QCOMPARE(spy.count(), 0);
+
+ map.clear(QLatin1String("key1"));
+ QCOMPARE(spy.count(), 0);
+
+ //make changes in QML
+ QQmlEngine engine;
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty(QLatin1String("testdata"), &map);
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nText { text: { testdata.key1 = 'Hello World'; 'X' } }",
+ QUrl::fromLocalFile(""));
+ QVERIFY(component.isReady());
+ QQuickText *txt = qobject_cast<QQuickText*>(component.create());
+ QVERIFY(txt);
+ QCOMPARE(txt->text(), QString('X'));
+ QCOMPARE(spy.count(), 1);
+ QList<QVariant> arguments = spy.takeFirst();
+ QCOMPARE(arguments.count(), 2);
+ QCOMPARE(arguments.at(0).toString(),QLatin1String("key1"));
+ QCOMPARE(arguments.at(1).value<QVariant>(),QVariant("Hello World"));
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World"));
+}
+
+void tst_QQmlPropertyMap::count()
+{
+ QQmlPropertyMap map;
+ QCOMPARE(map.isEmpty(), true);
+ map.insert(QLatin1String("key1"),100);
+ map.insert(QLatin1String("key2"),200);
+ QCOMPARE(map.count(), 2);
+ QCOMPARE(map.isEmpty(), false);
+
+ map.insert(QLatin1String("key3"),"Hello World");
+ QCOMPARE(map.count(), 3);
+
+ //clearing doesn't remove the key
+ map.clear(QLatin1String("key3"));
+ QCOMPARE(map.count(), 3);
+ QCOMPARE(map.size(), map.count());
+}
+
+class MyPropertyMap : public QQmlPropertyMap
+{
+ Q_OBJECT
+protected:
+ virtual QVariant updateValue(const QString &key, const QVariant &src)
+ {
+ if (key == QLatin1String("key1")) {
+ // 'key1' must be all uppercase
+ const QString original(src.toString());
+ return QVariant(original.toUpper());
+ }
+
+ return src;
+ }
+};
+
+void tst_QQmlPropertyMap::controlledWrite()
+{
+ MyPropertyMap map;
+ QCOMPARE(map.isEmpty(), true);
+
+ //make changes in QML
+ QQmlEngine engine;
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty(QLatin1String("testdata"), &map);
+
+ const char *qmlSource =
+ "import QtQuick 2.0\n"
+ "Item { Component.onCompleted: { testdata.key1 = 'Hello World'; testdata.key2 = 'Goodbye' } }";
+
+ QQmlComponent component(&engine);
+ component.setData(qmlSource, QUrl::fromLocalFile(""));
+ QVERIFY(component.isReady());
+
+ QObject *obj = component.create();
+ QVERIFY(obj);
+ delete obj;
+
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant("HELLO WORLD"));
+ QCOMPARE(map.value(QLatin1String("key2")), QVariant("Goodbye"));
+}
+
+void tst_QQmlPropertyMap::crashBug()
+{
+ QQmlPropertyMap map;
+
+ QQmlEngine engine;
+ QQmlContext context(&engine);
+ context.setContextProperty("map", &map);
+
+ QQmlComponent c(&engine);
+ c.setData("import QtQuick 2.0\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl());
+ QObject *obj = c.create(&context);
+ delete obj;
+}
+
+void tst_QQmlPropertyMap::QTBUG_17868()
+{
+ QQmlPropertyMap map;
+
+ QQmlEngine engine;
+ QQmlContext context(&engine);
+ context.setContextProperty("map", &map);
+ map.insert("key", 1);
+ QQmlComponent c(&engine);
+ c.setData("import QtQuick 2.0\nItem {property bool error:false; Component.onCompleted: {try{ map.keys(); }catch(e) {error=true;}}}",QUrl());
+ QObject *obj = c.create(&context);
+ QVERIFY(obj);
+ QVERIFY(!obj->property("error").toBool());
+ delete obj;
+
+}
+
+class MyEnhancedPropertyMap : public QQmlPropertyMap
+{
+ Q_OBJECT
+public:
+ MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0) {}
+
+signals:
+ void testSignal();
+
+public slots:
+ void testSlot() {}
+};
+
+void tst_QQmlPropertyMap::metaObjectAccessibility()
+{
+ QQmlTestMessageHandler messageHandler;
+
+ QQmlEngine engine;
+
+ MyEnhancedPropertyMap map;
+
+ // Verify that signals and slots of QQmlPropertyMap-derived classes are accessible
+ QObject::connect(&map, SIGNAL(testSignal()), &engine, SIGNAL(quit()));
+ QObject::connect(&engine, SIGNAL(quit()), &map, SLOT(testSlot()));
+
+ QCOMPARE(map.metaObject()->className(), "MyEnhancedPropertyMap");
+
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+}
+
+QTEST_MAIN(tst_QQmlPropertyMap)
+
+#include "tst_qqmlpropertymap.moc"
diff --git a/tests/auto/qml/qqmlqt/data/TestComponent.2.qml b/tests/auto/qml/qqmlqt/data/TestComponent.2.qml
new file mode 100644
index 0000000000..d6e99028b5
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/TestComponent.2.qml
@@ -0,0 +1,592 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + 1
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ Item {
+ id: c3
+ objectName: "c3"
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+ if (c3.children.length != 500) success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/TestComponent.3.qml b/tests/auto/qml/qqmlqt/data/TestComponent.3.qml
new file mode 100644
index 0000000000..81ea07cb88
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/TestComponent.3.qml
@@ -0,0 +1,89 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+ property int one: 1
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + parent.one
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ root.one = 50;
+ if (c1.one != 55) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/TestComponent.qml b/tests/auto/qml/qqmlqt/data/TestComponent.qml
new file mode 100644
index 0000000000..64cec1cd06
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/TestComponent.qml
@@ -0,0 +1,534 @@
+import QtQuick 2.0
+
+Item {
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+}
diff --git a/tests/auto/qml/qqmlqt/data/atob.qml b/tests/auto/qml/qqmlqt/data/atob.qml
new file mode 100644
index 0000000000..0d684003a1
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/atob.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+QtObject {
+ property string test1: Qt.atob()
+ property string test2: Qt.atob("SGVsbG8gd29ybGQh")
+}
+
diff --git a/tests/auto/qml/qqmlqt/data/btoa.qml b/tests/auto/qml/qqmlqt/data/btoa.qml
new file mode 100644
index 0000000000..0ecd01d284
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/btoa.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property string test1: Qt.btoa()
+ property string test2: Qt.btoa("Hello world!")
+}
diff --git a/tests/auto/qml/qqmlqt/data/colorEqual.qml b/tests/auto/qml/qqmlqt/data/colorEqual.qml
new file mode 100644
index 0000000000..c84a5b94c4
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/colorEqual.qml
@@ -0,0 +1,81 @@
+import QtQuick 2.0
+
+QtObject {
+ property color color1
+
+ property bool test1a: Qt.colorEqual(color1)
+ property bool test1b: Qt.colorEqual('red')
+
+ property bool test1c: Qt.colorEqual(color1, '')
+ property bool test1d: Qt.colorEqual('', color1)
+
+ property bool test1e: Qt.colorEqual(color1, 7)
+ property bool test1f: Qt.colorEqual(7, color1)
+
+ property var other: ({ name: 'value' })
+
+ property bool test1g: Qt.colorEqual(color1, other)
+ property bool test1h: Qt.colorEqual(other, color1)
+
+ property color color2: 'red'
+
+ property bool test2a: Qt.colorEqual(color2, 'red')
+ property bool test2b: Qt.colorEqual('red', color2)
+ property bool test2c: Qt.colorEqual(color2, '#f00')
+ property bool test2d: Qt.colorEqual('#f00', color2)
+ property bool test2e: Qt.colorEqual(color2, '#ff0000')
+ property bool test2f: Qt.colorEqual('#ff0000', color2)
+ property bool test2g: Qt.colorEqual(color2, '#ffff0000')
+ property bool test2h: Qt.colorEqual('#ffff0000', color2)
+ property bool test2i: Qt.colorEqual(color2, '#80ff0000')
+ property bool test2j: Qt.colorEqual('#80ff0000', color2)
+ property bool test2k: Qt.colorEqual(color2, 'blue')
+ property bool test2l: Qt.colorEqual('blue', color2)
+ property bool test2m: Qt.colorEqual(color2, 'darklightmediumgreen')
+ property bool test2n: Qt.colorEqual('darklightmediumgreen', color2)
+
+ property color color3: '#f00'
+
+ property bool test3a: Qt.colorEqual(color3, '#f00')
+ property bool test3b: Qt.colorEqual('#f00', color3)
+ property bool test3c: Qt.colorEqual(color3, '#ff0000')
+ property bool test3d: Qt.colorEqual('#ff0000', color3)
+ property bool test3e: Qt.colorEqual(color3, '#ffff0000')
+ property bool test3f: Qt.colorEqual('#ffff0000', color3)
+ property bool test3g: Qt.colorEqual(color3, '#80ff0000')
+ property bool test3h: Qt.colorEqual('#80ff0000', color3)
+ property bool test3i: Qt.colorEqual(color3, 'red')
+ property bool test3j: Qt.colorEqual('red', color3)
+ property bool test3k: Qt.colorEqual(color3, 'red')
+ property bool test3l: Qt.colorEqual('red', color3)
+ property bool test3m: Qt.colorEqual(color3, color2)
+ property bool test3n: Qt.colorEqual(color2, color3)
+
+ property color color4: '#80ff0000'
+
+ property bool test4a: Qt.colorEqual(color4, '#80ff0000')
+ property bool test4b: Qt.colorEqual('#80ff0000', color4)
+ property bool test4c: Qt.colorEqual(color4, '#00ff0000')
+ property bool test4d: Qt.colorEqual('#00ff0000', color4)
+ property bool test4e: Qt.colorEqual(color4, '#ffff0000')
+ property bool test4f: Qt.colorEqual('#ffff0000', color4)
+ property bool test4g: Qt.colorEqual(color4, 'red')
+ property bool test4h: Qt.colorEqual('red', color4)
+ // Note: these fail due to the mismatching precision of their alpha values:
+ property bool test4i: Qt.colorEqual(color4, Qt.rgba(1, 0, 0, 0.5))
+ property bool test4j: Qt.colorEqual(Qt.rgba(1, 0, 0, 0.5), color4)
+
+ property color color5: 'mediumturquoise'
+
+ property bool test5a: Qt.colorEqual(color5, 'medium' + 'turquoise')
+ property bool test5b: Qt.colorEqual('medium' + 'turquoise', color5)
+ property bool test5c: Qt.colorEqual(color5, color5)
+ property bool test5d: Qt.colorEqual(color5, color3)
+ property bool test5e: Qt.colorEqual(color3, color5)
+
+ property bool test6a: Qt.colorEqual('red', 'red')
+ property bool test6b: Qt.colorEqual('red', '#f00')
+ property bool test6c: Qt.colorEqual('#f00', 'red')
+ property bool test6d: Qt.colorEqual('red', 'blue')
+ property bool test6e: Qt.colorEqual('blue', 'red')
+}
diff --git a/tests/auto/qml/qqmlqt/data/createComponent.2.qml b/tests/auto/qml/qqmlqt/data/createComponent.2.qml
new file mode 100644
index 0000000000..36e2b23c9f
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/createComponent.2.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+ property var syncComponent
+ property var asyncComponent
+
+ function asyncStatusChanged() {
+ if (asyncComponent.status == Component.Ready && syncComponent.status == Component.Ready) {
+ success = true;
+ var ao = asyncComponent.createObject();
+ var so = syncComponent.createObject();
+ if (ao.c1one != 6) success = false;
+ if (so.c1one != 55) success = false;
+ ao.destroy();
+ so.destroy();
+ }
+ }
+
+ Component.onCompleted: {
+ asyncComponent = Qt.createComponent("TestComponent.2.qml", Component.Asynchronous);
+ if (asyncComponent.status != Component.Loading)
+ return;
+ asyncComponent.statusChanged.connect(asyncStatusChanged);
+ syncComponent = Qt.createComponent("TestComponent.3.qml", Component.PreferSynchronous);
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/createComponent.qml b/tests/auto/qml/qqmlqt/data/createComponent.qml
new file mode 100644
index 0000000000..01b6490419
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/createComponent.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool emptyArg: false
+
+ property string relativeUrl
+ property string absoluteUrl
+
+ property QtObject incorectArgCount1: Qt.createComponent()
+ property QtObject incorectArgCount2: Qt.createComponent("main.qml", 10)
+
+ property bool asyncResult: false
+ property var asyncComponent
+
+ function asyncStatusChanged() {
+ if (asyncComponent.status == Component.Ready)
+ asyncResult = true;
+ }
+
+ Component.onCompleted: {
+ emptyArg = (Qt.createComponent("") == null);
+ var r = Qt.createComponent("createComponentData.qml");
+ relativeUrl = r.url;
+
+ var a = Qt.createComponent("http://www.example.com/test.qml");
+ absoluteUrl = a.url;
+
+ asyncComponent = Qt.createComponent("TestComponent.qml", Component.Asynchronous);
+ if (asyncComponent.status != Component.Loading)
+ return;
+ asyncComponent.statusChanged.connect(asyncStatusChanged);
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/createComponentData.qml b/tests/auto/qml/qqmlqt/data/createComponentData.qml
new file mode 100644
index 0000000000..2a824e5362
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/createComponentData.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test: 1913
+}
diff --git a/tests/auto/qml/qqmlqt/data/createComponent_lib.js b/tests/auto/qml/qqmlqt/data/createComponent_lib.js
new file mode 100644
index 0000000000..30499e943e
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/createComponent_lib.js
@@ -0,0 +1,11 @@
+.pragma library
+
+function loadComponent() {
+ var component = Qt.createComponent("createComponentData.qml");
+ return component.status;
+}
+
+function createComponent() {
+ var component = Qt.createComponent("createComponentData.qml");
+ return component.createObject(null);
+}
diff --git a/tests/auto/qml/qqmlqt/data/createComponent_lib.qml b/tests/auto/qml/qqmlqt/data/createComponent_lib.qml
new file mode 100644
index 0000000000..a52453e8fa
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/createComponent_lib.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import "createComponent_lib.js" as Test
+
+Item {
+ property int status: Component.Null
+ property int readValue: 0
+
+ Component.onCompleted: {
+ status = Test.loadComponent()
+ readValue = Test.createComponent().test;
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/createQmlObject.qml b/tests/auto/qml/qqmlqt/data/createQmlObject.qml
new file mode 100644
index 0000000000..87601b1cc8
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/createQmlObject.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ // errors resulting in exceptions
+ property QtObject incorrectArgCount1: Qt.createQmlObject()
+ property QtObject incorrectArgCount2: Qt.createQmlObject("import QtQuick 2.0\nQtObject{}", root, "main.qml", 10)
+ property QtObject noParent: Qt.createQmlObject("import QtQuick 2.0\nQtObject{\nproperty int test: 13}", 0)
+ property QtObject notAvailable: Qt.createQmlObject("import QtQuick 2.0\nQtObject{Blah{}}", root)
+ property QtObject errors: Qt.createQmlObject("import QtQuick 2.0\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml")
+
+ property bool emptyArg: false
+
+ property bool success: false
+
+ Component.onCompleted: {
+ // errors resulting in nulls
+ emptyArg = (Qt.createQmlObject("", root) == null);
+ try {
+ Qt.createQmlObject("import QtQuick 2.0\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root)
+ } catch (error) {
+ console.log("RunTimeError: ",error.message);
+ }
+
+ var o = Qt.createQmlObject("import QtQuick 2.0\nQtObject{\nproperty int test: 13\n}", root);
+ success = (o.test == 13);
+
+ Qt.createQmlObject("import QtQuick 2.0\nItem {}\n", root);
+ }
+}
diff --git a/tests/auto/qml/qqmlqt/data/darker.qml b/tests/auto/qml/qqmlqt/data/darker.qml
new file mode 100644
index 0000000000..ce6dea0dfe
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/darker.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.darker(Qt.rgba(1, 0.8, 0.3))
+ property variant test2: Qt.darker()
+ property variant test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8)
+ property variant test4: Qt.darker("red");
+ property variant test5: Qt.darker("perfectred"); // Non-existent color
+ property variant test6: Qt.darker(10);
+ property variant test7: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8, 10)
+}
+
diff --git a/tests/auto/qml/qqmlqt/data/dateTimeConversion.qml b/tests/auto/qml/qqmlqt/data/dateTimeConversion.qml
new file mode 100644
index 0000000000..300074dec1
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/dateTimeConversion.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+QtObject {
+ // months are 0-based - so January = 0, December = 11.
+ property variant qtime: new Date(2000,0,0,14,15,38,200) // yyyy/MM/dd 14:15:38.200
+ property variant qdate: new Date(2008,11,24) // 2008/12/24 hh:mm:ss.zzz
+ property variant qdatetime: new Date(2008,11,24,14,15,38,200) // 2008/12/24 14:15:38.200
+
+ property variant qdatetime2: new Date(2852,11,31,23,59,59,500) // 2852/12/31 23:59:59.500
+ property variant qdatetime3: new Date(2000,0,1,0,0,0,0) // 2000/01/01 00:00:00.000
+ property variant qdatetime4: new Date(2001,1,2) // 2001/02/02 hh:mm:ss.zzz
+ property variant qdatetime5: new Date(1999,0,1,2,3,4) // 1999/01/01 02:03:04.zzz
+ property variant qdatetime6: new Date(2008,1,24,14,15,38,200) // 2008/02/24 14:15:38.200
+
+ // Use UTC for historical dates to avoid DST issues
+ property variant qdatetime7: new Date(Date.UTC(1970,0,1,0,0,0,0)) // 1970/01/01 00:00:00.000
+ property variant qdatetime8: new Date(Date.UTC(1586,1,2)) // 1586/02/02 hh:mm:ss.zzz
+ property variant qdatetime9: new Date(Date.UTC(955,0,1,0,0,0,0)) // 955/01/01 00:00:00.000
+ property variant qdatetime10: new Date(Date.UTC(113,1,24,14,15,38,200)) // 113/02/24 14:15:38.200
+}
diff --git a/tests/auto/qml/qqmlqt/data/enums.qml b/tests/auto/qml/qqmlqt/data/enums.qml
new file mode 100644
index 0000000000..5a2ff534af
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/enums.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property int test1: Qt.Key_Escape
+ property int test2: Qt.DescendingOrder
+ property int test3: Qt.ElideMiddle
+ property int test4: Qt.AlignRight
+}
+
diff --git a/tests/auto/qml/qqmlqt/data/font.qml b/tests/auto/qml/qqmlqt/data/font.qml
new file mode 100644
index 0000000000..9ebf460caf
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/font.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.font({ family: "Arial", pointSize: 22 });
+ property variant test2: Qt.font({ family: "Arial", pointSize: 20, weight: Font.DemiBold, italic: true });
+ property variant test3: Qt.font("Arial", 22);
+ property variant test4: Qt.font({ something: "Arial", other: 22 });
+}
diff --git a/tests/auto/qml/qqmlqt/data/fontFamilies.qml b/tests/auto/qml/qqmlqt/data/fontFamilies.qml
new file mode 100644
index 0000000000..70245ab159
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/fontFamilies.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.fontFamilies(10)
+ property variant test2: Qt.fontFamilies();
+}
diff --git a/tests/auto/qml/qqmlqt/data/formatting.qml b/tests/auto/qml/qqmlqt/data/formatting.qml
new file mode 100644
index 0000000000..7a462c8eeb
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/formatting.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+QtObject {
+ property date dateFromString: "2008-12-24"
+ property variant jsdate: new Date(2008,11,24,14,15,38,200) // months are 0-based
+
+ function formatDate(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatDate(v),
+ Qt.formatDate(v, Qt.DefaultLocaleLongDate),
+ Qt.formatDate(v, "ddd MMMM d yy")
+ ]
+ }
+
+ function formatTime(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatTime(v),
+ Qt.formatTime(v, Qt.DefaultLocaleLongDate),
+ Qt.formatTime(v, "H:m:s a"),
+ Qt.formatTime(v, "hh:mm:ss.zzz")
+ ]
+ }
+
+ function formatDateTime(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatDateTime(v),
+ Qt.formatDateTime(v, Qt.DefaultLocaleLongDate),
+ Qt.formatDateTime(v, "M/d/yy H:m:s a")
+ ]
+ }
+
+ // Error cases
+ property string err_date1: Qt.formatDate()
+ property string err_date2: Qt.formatDate(new Date, new Object)
+
+ property string err_time1: Qt.formatTime()
+ property string err_time2: Qt.formatTime(new Date, new Object)
+
+ property string err_dateTime1: Qt.formatDateTime()
+ property string err_dateTime2: Qt.formatDateTime(new Date, new Object)
+}
diff --git a/tests/auto/qml/qqmlqt/data/hsla.qml b/tests/auto/qml/qqmlqt/data/hsla.qml
new file mode 100644
index 0000000000..ff9622b339
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/hsla.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+QtObject {
+ property color test1: Qt.hsla(1, 0, 0, 0.8);
+ property color test2: Qt.hsla(1, 0.5, 0.3);
+ property color test3: Qt.hsla(1, 1);
+ property color test4: Qt.hsla(1, 1, 1, 1, 1);
+ property color test5: Qt.hsla(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.hsla(-0.1, -0.2, -0.3, -0.4);
+}
+
diff --git a/tests/auto/qml/qqmlqt/data/isQtObject.qml b/tests/auto/qml/qqmlqt/data/isQtObject.qml
new file mode 100644
index 0000000000..6829209518
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/isQtObject.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property QtObject nullObject
+
+ property bool test1: Qt.isQtObject(root)
+ property bool test2: Qt.isQtObject(nullObject)
+ property bool test3: Qt.isQtObject(10)
+ property bool test4: Qt.isQtObject(null)
+ property bool test5: Qt.isQtObject({ a: 10, b: 11 })
+}
+
diff --git a/tests/auto/qml/qqmlqt/data/lighter.qml b/tests/auto/qml/qqmlqt/data/lighter.qml
new file mode 100644
index 0000000000..bf57e08004
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/lighter.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3))
+ property variant test2: Qt.lighter()
+ property variant test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8)
+ property variant test4: Qt.lighter("red");
+ property variant test5: Qt.lighter("perfectred"); // Non-existent color
+ property variant test6: Qt.lighter(10);
+ property variant test7: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8, 5)
+}
diff --git a/tests/auto/qml/qqmlqt/data/matrix4x4.qml b/tests/auto/qml/qqmlqt/data/matrix4x4.qml
new file mode 100644
index 0000000000..0185fcb635
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/matrix4x4.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.matrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+ property variant test2: Qt.matrix4x4([1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4]);
+ property variant test3: Qt.matrix4x4(1,2,3,4,5,6);
+ property variant test4: Qt.matrix4x4([1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5]);
+ property variant test5: Qt.matrix4x4({ test: 5, subprop: "hello" });
+}
diff --git a/tests/auto/qml/qqmlqt/data/md5.qml b/tests/auto/qml/qqmlqt/data/md5.qml
new file mode 100644
index 0000000000..bec1ed1fe7
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/md5.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+QtObject {
+ property string test1: Qt.md5()
+ property string test2: Qt.md5("Hello World")
+}
diff --git a/tests/auto/qml/qqmlqt/data/openUrlExternally.qml b/tests/auto/qml/qqmlqt/data/openUrlExternally.qml
new file mode 100644
index 0000000000..37b9f513d9
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/openUrlExternally.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: Qt.openUrlExternally("test:url")
+
+ property bool testFile
+ onTestFileChanged: Qt.openUrlExternally("test.html")
+}
diff --git a/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.js b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.js
new file mode 100644
index 0000000000..702357afbf
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.js
@@ -0,0 +1,9 @@
+.pragma library
+
+function loadTest() {
+ Qt.openUrlExternally("test:url")
+}
+
+function loadFile() {
+ Qt.openUrlExternally("test.html")
+}
diff --git a/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.qml b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.qml
new file mode 100644
index 0000000000..4bf584d134
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/openUrlExternally_lib.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import "openUrlExternally_lib.js" as Test
+
+Item {
+ Component.onCompleted: Test.loadTest();
+
+ property bool testFile
+ onTestFileChanged: Test.loadFile();
+}
diff --git a/tests/auto/qml/qqmlqt/data/point.qml b/tests/auto/qml/qqmlqt/data/point.qml
new file mode 100644
index 0000000000..fe12ee6232
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/point.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.point(19, 34);
+ property variant test2: Qt.point(-3, 109.2);
+ property variant test3: Qt.point(-3);
+ property variant test4: Qt.point(-3, 109.2, 1);
+}
+
diff --git a/tests/auto/qml/qqmlqt/data/quaternion.qml b/tests/auto/qml/qqmlqt/data/quaternion.qml
new file mode 100644
index 0000000000..6203bd1e32
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/quaternion.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.quaternion(2, 17, 0.9, 0.6);
+ property variant test2: Qt.quaternion(102, -10, -982.1, 10);
+ property variant test3: Qt.quaternion(102, -10, -982.1);
+ property variant test4: Qt.quaternion(102, -10, -982.1, 10, 15);
+}
diff --git a/tests/auto/qml/qqmlqt/data/quit.qml b/tests/auto/qml/qqmlqt/data/quit.qml
new file mode 100644
index 0000000000..e3b91660e7
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/quit.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: Qt.quit()
+}
diff --git a/tests/auto/qml/qqmlqt/data/rect.qml b/tests/auto/qml/qqmlqt/data/rect.qml
new file mode 100644
index 0000000000..b294b22c5b
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/rect.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.rect(10, 13, 100, 109)
+ property variant test2: Qt.rect(-10, 13, 100, 109.6)
+ property variant test3: Qt.rect(10, 13);
+ property variant test4: Qt.rect(10, 13, 100, 109, 10)
+ property variant test5: Qt.rect(10, 13, 100, -109)
+}
diff --git a/tests/auto/qml/qqmlqt/data/resolvedUrl.qml b/tests/auto/qml/qqmlqt/data/resolvedUrl.qml
new file mode 100644
index 0000000000..06ef48b82b
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/resolvedUrl.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+QtObject {
+ property string result
+ property bool isString: false
+
+ Component.onCompleted: {
+ var a = Qt.resolvedUrl("resolvedUrl.qml");
+ result = a;
+ isString = (typeof a) == "string"
+ }
+}
+
diff --git a/tests/auto/qml/qqmlqt/data/rgba.qml b/tests/auto/qml/qqmlqt/data/rgba.qml
new file mode 100644
index 0000000000..3b010f68cb
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/rgba.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ property color test1: Qt.rgba(1, 0, 0, 0.8);
+ property color test2: Qt.rgba(1, 0.5, 0.3);
+ property color test3: Qt.rgba(1, 1);
+ property color test4: Qt.rgba(1, 1, 1, 1, 1);
+ property color test5: Qt.rgba(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.rgba(-0.1, -0.2, -0.3, -0.4);
+}
diff --git a/tests/auto/qml/qqmlqt/data/size.qml b/tests/auto/qml/qqmlqt/data/size.qml
new file mode 100644
index 0000000000..41051f4216
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/size.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.size(19, 34);
+ property variant test2: Qt.size(3, 109.2);
+ property variant test3: Qt.size(-3, 10);
+ property variant test4: Qt.size(3);
+ property variant test5: Qt.size(3, 109.2, 1);
+}
+
+
diff --git a/tests/auto/qml/qqmlqt/data/tint.qml b/tests/auto/qml/qqmlqt/data/tint.qml
new file mode 100644
index 0000000000..816e6e9b08
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/tint.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ property color test1: Qt.tint("red", "blue");
+ property color test2: Qt.tint(Qt.rgba(1, 0, 0), Qt.rgba(0, 0, 0, 0));
+ property color test3: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5));
+ property color test4: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5), 10);
+ property color test5: Qt.tint("red")
+}
diff --git a/tests/auto/qml/qqmlqt/data/vector.qml b/tests/auto/qml/qqmlqt/data/vector.qml
new file mode 100644
index 0000000000..5a949515ed
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/vector.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.vector3d(1, 0, 0.9);
+ property variant test2: Qt.vector3d(102, -10, -982.1);
+ property variant test3: Qt.vector3d(102, -10);
+ property variant test4: Qt.vector3d(102, -10, -982.1, 10);
+}
diff --git a/tests/auto/qml/qqmlqt/data/vector2.qml b/tests/auto/qml/qqmlqt/data/vector2.qml
new file mode 100644
index 0000000000..1ca513eaba
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/vector2.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.vector2d(1, 0.9);
+ property variant test2: Qt.vector2d(102, -982.1);
+ property variant test3: Qt.vector2d(102);
+ property variant test4: Qt.vector2d(102, -982.1, 10);
+}
diff --git a/tests/auto/qml/qqmlqt/data/vector4.qml b/tests/auto/qml/qqmlqt/data/vector4.qml
new file mode 100644
index 0000000000..554dd1e9d4
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/data/vector4.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property variant test1: Qt.vector4d(1, 0, 0.9, 0.6);
+ property variant test2: Qt.vector4d(102, -10, -982.1, 10);
+ property variant test3: Qt.vector4d(102, -10, -982.1);
+ property variant test4: Qt.vector4d(102, -10, -982.1, 10, 15);
+}
diff --git a/tests/auto/qml/qqmlqt/qqmlqt.pro b/tests/auto/qml/qqmlqt/qqmlqt.pro
new file mode 100644
index 0000000000..0be49304fb
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/qqmlqt.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qqmlqt
+SOURCES += tst_qqmlqt.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+QT += core-private v8-private qml-private quick-private testlib gui gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
new file mode 100644
index 0000000000..c72299660f
--- /dev/null
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -0,0 +1,929 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <private/qqmlengine_p.h>
+
+#include <qtest.h>
+#include <QDebug>
+#include <QQmlEngine>
+#include <QFontDatabase>
+#include <QFileInfo>
+#include <QQmlComponent>
+#include <QDesktopServices>
+#include <QDir>
+#include <QCryptographicHash>
+#include <QtQuick/QQuickItem>
+#include <QSignalSpy>
+#include <QVector2D>
+#include <QVector3D>
+#include <QVector4D>
+#include <QQuaternion>
+#include <QMatrix4x4>
+#include <QFont>
+#include "../../shared/util.h"
+
+class tst_qqmlqt : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlqt() {}
+
+private slots:
+ void enums();
+ void rgba();
+ void hsla();
+ void colorEqual();
+ void rect();
+ void point();
+ void size();
+ void vector2d();
+ void vector3d();
+ void vector4d();
+ void quaternion();
+ void matrix4x4();
+ void font();
+ void lighter();
+ void darker();
+ void tint();
+ void openUrlExternally();
+ void openUrlExternally_pragmaLibrary();
+ void md5();
+ void createComponent();
+ void createComponent_pragmaLibrary();
+ void createQmlObject();
+ void dateTimeConversion();
+ void dateTimeFormatting();
+ void dateTimeFormatting_data();
+ void dateTimeFormattingVariants();
+ void dateTimeFormattingVariants_data();
+ void isQtObject();
+ void btoa();
+ void atob();
+ void fontFamilies();
+ void quit();
+ void resolvedUrl();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qqmlqt::enums()
+{
+ QQmlComponent component(&engine, testFileUrl("enums.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape);
+ QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder);
+ QCOMPARE(object->property("test3").toInt(), (int)Qt::ElideMiddle);
+ QCOMPARE(object->property("test4").toInt(), (int)Qt::AlignRight);
+
+ delete object;
+}
+
+void tst_qqmlqt::rgba()
+{
+ QQmlComponent component(&engine, testFileUrl("rgba.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.rgba(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.rgba(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0, 0, 0.8));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromRgbF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromRgbF(0, 0, 0, 0));
+
+ delete object;
+}
+
+void tst_qqmlqt::hsla()
+{
+ QQmlComponent component(&engine, testFileUrl("hsla.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.hsla(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.hsla(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromHslF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromHslF(0, 0, 0, 0));
+
+ delete object;
+}
+
+void tst_qqmlqt::colorEqual()
+{
+ QQmlComponent component(&engine, testFileUrl("colorEqual.qml"));
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":6: Error: Qt.colorEqual(): Invalid arguments"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":7: Error: Qt.colorEqual(): Invalid arguments"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":9: Error: Qt.colorEqual(): Invalid color name"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":10: Error: Qt.colorEqual(): Invalid color name"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":12: Error: Qt.colorEqual(): Invalid arguments"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":13: Error: Qt.colorEqual(): Invalid arguments"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":17: Error: Qt.colorEqual(): Invalid arguments"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":18: Error: Qt.colorEqual(): Invalid arguments"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":34: Error: Qt.colorEqual(): Invalid color name"));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":35: Error: Qt.colorEqual(): Invalid color name"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1a").toBool(), false);
+ QCOMPARE(object->property("test1b").toBool(), false);
+ QCOMPARE(object->property("test1c").toBool(), false);
+ QCOMPARE(object->property("test1d").toBool(), false);
+ QCOMPARE(object->property("test1e").toBool(), false);
+ QCOMPARE(object->property("test1f").toBool(), false);
+ QCOMPARE(object->property("test1g").toBool(), false);
+ QCOMPARE(object->property("test1h").toBool(), false);
+
+ QCOMPARE(object->property("test2a").toBool(), true);
+ QCOMPARE(object->property("test2b").toBool(), true);
+ QCOMPARE(object->property("test2c").toBool(), true);
+ QCOMPARE(object->property("test2d").toBool(), true);
+ QCOMPARE(object->property("test2e").toBool(), true);
+ QCOMPARE(object->property("test2f").toBool(), true);
+ QCOMPARE(object->property("test2g").toBool(), true);
+ QCOMPARE(object->property("test2h").toBool(), true);
+ QCOMPARE(object->property("test2i").toBool(), false);
+ QCOMPARE(object->property("test2j").toBool(), false);
+ QCOMPARE(object->property("test2k").toBool(), false);
+ QCOMPARE(object->property("test2l").toBool(), false);
+ QCOMPARE(object->property("test2m").toBool(), false);
+ QCOMPARE(object->property("test2n").toBool(), false);
+
+ QCOMPARE(object->property("test3a").toBool(), true);
+ QCOMPARE(object->property("test3b").toBool(), true);
+ QCOMPARE(object->property("test3c").toBool(), true);
+ QCOMPARE(object->property("test3d").toBool(), true);
+ QCOMPARE(object->property("test3e").toBool(), true);
+ QCOMPARE(object->property("test3f").toBool(), true);
+ QCOMPARE(object->property("test3g").toBool(), false);
+ QCOMPARE(object->property("test3h").toBool(), false);
+ QCOMPARE(object->property("test3i").toBool(), true);
+ QCOMPARE(object->property("test3j").toBool(), true);
+ QCOMPARE(object->property("test3k").toBool(), true);
+ QCOMPARE(object->property("test3l").toBool(), true);
+ QCOMPARE(object->property("test3m").toBool(), true);
+ QCOMPARE(object->property("test3n").toBool(), true);
+
+ QCOMPARE(object->property("test4a").toBool(), true);
+ QCOMPARE(object->property("test4b").toBool(), true);
+ QCOMPARE(object->property("test4c").toBool(), false);
+ QCOMPARE(object->property("test4d").toBool(), false);
+ QCOMPARE(object->property("test4e").toBool(), false);
+ QCOMPARE(object->property("test4f").toBool(), false);
+ QCOMPARE(object->property("test4g").toBool(), false);
+ QCOMPARE(object->property("test4h").toBool(), false);
+ QCOMPARE(object->property("test4i").toBool(), false);
+ QCOMPARE(object->property("test4j").toBool(), false);
+
+ QCOMPARE(object->property("test5a").toBool(), true);
+ QCOMPARE(object->property("test5b").toBool(), true);
+ QCOMPARE(object->property("test5c").toBool(), true);
+ QCOMPARE(object->property("test5d").toBool(), false);
+ QCOMPARE(object->property("test5e").toBool(), false);
+
+ QCOMPARE(object->property("test6a").toBool(), true);
+ QCOMPARE(object->property("test6b").toBool(), true);
+ QCOMPARE(object->property("test6c").toBool(), true);
+ QCOMPARE(object->property("test6d").toBool(), false);
+ QCOMPARE(object->property("test6e").toBool(), false);
+
+ delete object;
+}
+
+void tst_qqmlqt::rect()
+{
+ QQmlComponent component(&engine, testFileUrl("rect.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.rect(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.rect(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109));
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6));
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF());
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF());
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF(10, 13, 100, -109));
+
+ delete object;
+}
+
+void tst_qqmlqt::point()
+{
+ QQmlComponent component(&engine, testFileUrl("point.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.point(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.point(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34));
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2));
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test3")), QPointF());
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test4")), QPointF());
+
+ delete object;
+}
+
+void tst_qqmlqt::size()
+{
+ QQmlComponent component(&engine, testFileUrl("size.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: Qt.size(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":8: Error: Qt.size(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test2")), QSizeF(3, 109.2));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test3")), QSizeF(-3, 10));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test4")), QSizeF());
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test5")), QSizeF());
+
+ delete object;
+}
+
+void tst_qqmlqt::vector2d()
+{
+ QQmlComponent component(&engine, testFileUrl("vector2.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.vector2d(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.vector2d(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test1")), QVector2D(1, 0.9f));
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test2")), QVector2D(102, -982.1f));
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test3")), QVector2D());
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test4")), QVector2D());
+
+ delete object;
+}
+
+void tst_qqmlqt::vector3d()
+{
+ QQmlComponent component(&engine, testFileUrl("vector.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.vector3d(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.vector3d(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9f));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1f));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D());
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D());
+
+ delete object;
+}
+
+void tst_qqmlqt::vector4d()
+{
+ QQmlComponent component(&engine, testFileUrl("vector4.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.vector4d(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.vector4d(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9f, 0.6f));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1f, 10));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test3")), QVector4D());
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test4")), QVector4D());
+
+ delete object;
+}
+
+void tst_qqmlqt::quaternion()
+{
+ QQmlComponent component(&engine, testFileUrl("quaternion.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.quaternion(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.quaternion(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test1")), QQuaternion(2, 17, 0.9f, 0.6f));
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test2")), QQuaternion(102, -10, -982.1f, 10));
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test3")), QQuaternion());
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test4")), QQuaternion());
+
+ delete object;
+}
+
+void tst_qqmlqt::matrix4x4()
+{
+ QQmlComponent component(&engine, testFileUrl("matrix4x4.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.matrix4x4(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.matrix4x4(): Invalid argument: not a valid matrix4x4 values array";
+ QString warning3 = component.url().toString() + ":8: Error: Qt.matrix4x4(): Invalid argument: not a valid matrix4x4 values array";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test1")), QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16));
+ QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test2")), QMatrix4x4(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4));
+ QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test3")), QMatrix4x4());
+ QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test4")), QMatrix4x4());
+ QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test5")), QMatrix4x4());
+
+ delete object;
+}
+
+void tst_qqmlqt::font()
+{
+ QQmlComponent component(&engine, testFileUrl("font.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.font(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.font(): Invalid argument: no valid font subproperties specified";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("test1")), QFont("Arial", 22));
+ QCOMPARE(qvariant_cast<QFont>(object->property("test2")), QFont("Arial", 20, QFont::DemiBold, true));
+ QCOMPARE(qvariant_cast<QFont>(object->property("test3")), QFont());
+ QCOMPARE(qvariant_cast<QFont>(object->property("test4")), QFont());
+
+ delete object;
+}
+
+void tst_qqmlqt::lighter()
+{
+ QQmlComponent component(&engine, testFileUrl("lighter.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: Qt.lighter(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.lighter(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0.8, 0.3).lighter(180));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").lighter());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+
+ delete object;
+}
+
+void tst_qqmlqt::darker()
+{
+ QQmlComponent component(&engine, testFileUrl("darker.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: Qt.darker(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.darker(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0.8, 0.3).darker(280));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").darker());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+
+ delete object;
+}
+
+void tst_qqmlqt::tint()
+{
+ QQmlComponent component(&engine, testFileUrl("tint.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: Qt.tint(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":8: Error: Qt.tint(): Invalid arguments";
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0, 0));
+ QColor test3 = qvariant_cast<QColor>(object->property("test3"));
+ QCOMPARE(test3.rgba(), 0xFF7F0080);
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+
+ delete object;
+}
+
+class MyUrlHandler : public QObject
+{
+ Q_OBJECT
+public:
+ MyUrlHandler() : called(0) { }
+ int called;
+ QUrl last;
+
+public slots:
+ void noteCall(const QUrl &url) { called++; last = url; }
+};
+
+void tst_qqmlqt::openUrlExternally()
+{
+ MyUrlHandler handler;
+
+ QDesktopServices::setUrlHandler("test", &handler, "noteCall");
+ QDesktopServices::setUrlHandler("file", &handler, "noteCall");
+
+ QQmlComponent component(&engine, testFileUrl("openUrlExternally.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(handler.called,1);
+ QCOMPARE(handler.last, QUrl("test:url"));
+
+ object->setProperty("testFile", true);
+
+ QCOMPARE(handler.called,2);
+ QCOMPARE(handler.last, testFileUrl("test.html"));
+
+ QDesktopServices::unsetUrlHandler("test");
+ QDesktopServices::unsetUrlHandler("file");
+}
+
+void tst_qqmlqt::openUrlExternally_pragmaLibrary()
+{
+ MyUrlHandler handler;
+
+ QDesktopServices::setUrlHandler("test", &handler, "noteCall");
+ QDesktopServices::setUrlHandler("file", &handler, "noteCall");
+
+ QQmlComponent component(&engine, testFileUrl("openUrlExternally_lib.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(handler.called,1);
+ QCOMPARE(handler.last, QUrl("test:url"));
+
+ object->setProperty("testFile", true);
+
+ QCOMPARE(handler.called,2);
+ QCOMPARE(handler.last, testFileUrl("test.html"));
+
+ QDesktopServices::unsetUrlHandler("test");
+ QDesktopServices::unsetUrlHandler("file");
+}
+
+void tst_qqmlqt::md5()
+{
+ QQmlComponent component(&engine, testFileUrl("md5.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.md5(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex()));
+
+ delete object;
+}
+
+void tst_qqmlqt::createComponent()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("createComponent.qml"));
+
+ QString warning1 = component.url().toString() + ":9: Error: Qt.createComponent(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.createComponent(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
+ QCOMPARE(object->property("relativeUrl").toString(), testFileUrl("createComponentData.qml").toString());
+
+ QTRY_VERIFY(object->property("asyncResult").toBool());
+
+ delete object;
+ }
+
+ // simultaneous sync and async compilation
+ {
+ QQmlComponent component(&engine, testFileUrl("createComponent.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QTRY_VERIFY(object->property("success").toBool());
+ delete object;
+ }
+}
+
+void tst_qqmlqt::createComponent_pragmaLibrary()
+{
+ // Currently, just loading createComponent_lib.qml causes crash on some platforms
+ QQmlComponent component(&engine, testFileUrl("createComponent_lib.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("status").toInt(), int(QQmlComponent::Ready));
+ QCOMPARE(object->property("readValue").toInt(), int(1913));
+ delete object;
+}
+
+void tst_qqmlqt::createQmlObject()
+{
+ QQmlComponent component(&engine, testFileUrl("createQmlObject.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: Qt.createQmlObject(): Invalid arguments";
+ QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":2:10: Blah is not a type";
+ QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("main.qml").toString() + ":4:14: Duplicate property name";
+ QString warning4 = component.url().toString()+ ":9: Error: Qt.createQmlObject(): Missing parent object";
+ QString warning5 = component.url().toString()+ ":8: Error: Qt.createQmlObject(): Invalid arguments";
+ QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":3: Cannot assign object type QObject with no default method";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(warning6));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("emptyArg").toBool(), true);
+ QCOMPARE(object->property("success").toBool(), true);
+
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ QVERIFY(item != 0);
+ QVERIFY(item->childItems().count() == 1);
+
+ delete object;
+}
+
+
+void tst_qqmlqt::dateTimeConversion()
+{
+ QDate date(2008,12,24);
+ QTime time(14,15,38,200);
+ QDateTime dateTime(date, time);
+ //Note that when converting Date to QDateTime they can argue over historical DST data when converting to local time.
+ //Tests should use UTC or recent dates.
+ QDateTime dateTime2(QDate(2852,12,31), QTime(23,59,59,500));
+ QDateTime dateTime3(QDate(2000,1,1), QTime(0,0,0,0));
+ QDateTime dateTime4(QDate(2001,2,2), QTime(0,0,0,0));
+ QDateTime dateTime5(QDate(1999,1,1), QTime(2,3,4,0));
+ QDateTime dateTime6(QDate(2008,2,24), QTime(14,15,38,200));
+ QDateTime dateTime7(QDate(1970,1,1), QTime(0,0,0,0), Qt::UTC);
+ QDateTime dateTime8(QDate(1586,2,2), QTime(0,0,0,0), Qt::UTC);
+ QDateTime dateTime9(QDate(955,1,1), QTime(0,0,0,0), Qt::UTC);
+ QDateTime dateTime10(QDate(113,2,24), QTime(14,15,38,200), Qt::UTC);
+
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("dateTimeConversion.qml"));
+ QObject *obj = component.create();
+
+ QCOMPARE(obj->property("qdate").toDate(), date);
+ QCOMPARE(obj->property("qtime").toTime(), time);
+ QCOMPARE(obj->property("qdatetime").toDateTime(), dateTime);
+ QCOMPARE(obj->property("qdatetime2").toDateTime(), dateTime2);
+ QCOMPARE(obj->property("qdatetime3").toDateTime(), dateTime3);
+ QCOMPARE(obj->property("qdatetime4").toDateTime(), dateTime4);
+ QCOMPARE(obj->property("qdatetime5").toDateTime(), dateTime5);
+ QCOMPARE(obj->property("qdatetime6").toDateTime(), dateTime6);
+ QCOMPARE(obj->property("qdatetime7").toDateTime(), dateTime7);
+ QCOMPARE(obj->property("qdatetime8").toDateTime(), dateTime8);
+ QCOMPARE(obj->property("qdatetime9").toDateTime(), dateTime9);
+ QCOMPARE(obj->property("qdatetime10").toDateTime(), dateTime10);
+}
+
+void tst_qqmlqt::dateTimeFormatting()
+{
+ QFETCH(QString, method);
+ QFETCH(QStringList, inputProperties);
+ QFETCH(QStringList, expectedResults);
+
+ QDate date(2008,12,24);
+ QTime time(14,15,38,200);
+ QDateTime dateTime(date, time);
+
+ QQmlEngine eng;
+
+ eng.rootContext()->setContextProperty("qdate", date);
+ eng.rootContext()->setContextProperty("qtime", time);
+ eng.rootContext()->setContextProperty("qdatetime", dateTime);
+
+ QQmlComponent component(&eng, testFileUrl("formatting.qml"));
+
+ QStringList warnings;
+ warnings << component.url().toString() + ":37: Error: Qt.formatDate(): Invalid date format"
+ << component.url().toString() + ":36: Error: Qt.formatDate(): Invalid arguments"
+ << component.url().toString() + ":40: Error: Qt.formatTime(): Invalid time format"
+ << component.url().toString() + ":39: Error: Qt.formatTime(): Invalid arguments"
+ << component.url().toString() + ":43: Error: Qt.formatDateTime(): Invalid datetime format"
+ << component.url().toString() + ":42: Error: Qt.formatDateTime(): Invalid arguments";
+
+ foreach (const QString &warning, warnings)
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QObject *object = component.create();
+ QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
+ QVERIFY(object != 0);
+
+ QVERIFY(inputProperties.count() > 0);
+ QVariant result;
+ foreach(const QString &prop, inputProperties) {
+ QVERIFY(QMetaObject::invokeMethod(object, method.toUtf8().constData(),
+ Q_RETURN_ARG(QVariant, result),
+ Q_ARG(QVariant, prop)));
+ QStringList output = result.toStringList();
+ QCOMPARE(output.size(), expectedResults.size());
+ for (int i=0; i<output.count(); i++)
+ QCOMPARE(output[i], expectedResults[i]);
+ }
+
+ delete object;
+}
+
+void tst_qqmlqt::dateTimeFormatting_data()
+{
+ QTest::addColumn<QString>("method");
+ QTest::addColumn<QStringList>("inputProperties");
+ QTest::addColumn<QStringList>("expectedResults");
+
+ QDate date(2008,12,24);
+ QTime time(14,15,38,200);
+ QDateTime dateTime(date, time);
+
+ QTest::newRow("formatDate")
+ << "formatDate"
+ << (QStringList() << "dateFromString" << "jsdate" << "qdate" << "qdatetime")
+ << (QStringList() << date.toString(Qt::DefaultLocaleShortDate)
+ << date.toString(Qt::DefaultLocaleLongDate)
+ << date.toString("ddd MMMM d yy"));
+
+ QTest::newRow("formatTime")
+ << "formatTime"
+ << (QStringList() << "jsdate" << "qtime" << "qdatetime")
+ << (QStringList() << time.toString(Qt::DefaultLocaleShortDate)
+ << time.toString(Qt::DefaultLocaleLongDate)
+ << time.toString("H:m:s a")
+ << time.toString("hh:mm:ss.zzz"));
+
+ QTest::newRow("formatDateTime")
+ << "formatDateTime"
+ << (QStringList() << "jsdate" << "qdatetime")
+ << (QStringList() << dateTime.toString(Qt::DefaultLocaleShortDate)
+ << dateTime.toString(Qt::DefaultLocaleLongDate)
+ << dateTime.toString("M/d/yy H:m:s a"));
+}
+
+void tst_qqmlqt::dateTimeFormattingVariants()
+{
+ QFETCH(QString, method);
+ QFETCH(QVariant, variant);
+ QFETCH(QStringList, expectedResults);
+
+ QQmlEngine eng;
+ eng.rootContext()->setContextProperty("qvariant", variant);
+ QQmlComponent component(&eng, testFileUrl("formatting.qml"));
+
+ QStringList warnings;
+ warnings << component.url().toString() + ":37: Error: Qt.formatDate(): Invalid date format"
+ << component.url().toString() + ":36: Error: Qt.formatDate(): Invalid arguments"
+ << component.url().toString() + ":40: Error: Qt.formatTime(): Invalid time format"
+ << component.url().toString() + ":39: Error: Qt.formatTime(): Invalid arguments"
+ << component.url().toString() + ":43: Error: Qt.formatDateTime(): Invalid datetime format"
+ << component.url().toString() + ":42: Error: Qt.formatDateTime(): Invalid arguments";
+
+ foreach (const QString &warning, warnings)
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QObject *object = component.create();
+ QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
+ QVERIFY(object != 0);
+
+ QVariant result;
+ QVERIFY(QMetaObject::invokeMethod(object, method.toUtf8().constData(),
+ Q_RETURN_ARG(QVariant, result),
+ Q_ARG(QVariant, QString(QLatin1String("qvariant")))));
+ QStringList output = result.toStringList();
+ QCOMPARE(output, expectedResults);
+
+ delete object;
+}
+
+void tst_qqmlqt::dateTimeFormattingVariants_data()
+{
+ QTest::addColumn<QString>("method");
+ QTest::addColumn<QVariant>("variant");
+ QTest::addColumn<QStringList>("expectedResults");
+
+ QDateTime temporary;
+
+ QTime time(11, 16, 39, 755);
+ temporary = QDateTime(QDate(1970,1,1), time);
+ QTest::newRow("formatDate, qtime") << "formatDate" << QVariant::fromValue(time) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qtime") << "formatDateTime" << QVariant::fromValue(time) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qtime") << "formatTime" << QVariant::fromValue(time) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QDate date(2011,5,31);
+ temporary = QDateTime(date);
+ QTest::newRow("formatDate, qdate") << "formatDate" << QVariant::fromValue(date) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qdate") << "formatDateTime" << QVariant::fromValue(date) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qdate") << "formatTime" << QVariant::fromValue(date) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QDateTime dateTime(date, time);
+ temporary = dateTime;
+ QTest::newRow("formatDate, qdatetime") << "formatDate" << QVariant::fromValue(dateTime) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qdatetime") << "formatDateTime" << QVariant::fromValue(dateTime) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qdatetime") << "formatTime" << QVariant::fromValue(dateTime) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QString string(QLatin1String("2011/05/31 11:16:39.755"));
+ temporary = QDateTime::fromString(string, "yyyy/MM/dd HH:mm:ss.zzz");
+ QTest::newRow("formatDate, qstring") << "formatDate" << QVariant::fromValue(string) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qstring") << "formatDateTime" << QVariant::fromValue(string) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qstring") << "formatTime" << QVariant::fromValue(string) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ QColor color(Qt::red);
+ temporary = QVariant::fromValue(color).toDateTime();
+ QTest::newRow("formatDate, qcolor") << "formatDate" << QVariant::fromValue(color) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, qcolor") << "formatDateTime" << QVariant::fromValue(color) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, qcolor") << "formatTime" << QVariant::fromValue(color) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+
+ int integer(4);
+ temporary = QVariant::fromValue(integer).toDateTime();
+ QTest::newRow("formatDate, int") << "formatDate" << QVariant::fromValue(integer) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy"));
+ QTest::newRow("formatDateTime, int") << "formatDateTime" << QVariant::fromValue(integer) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a"));
+ QTest::newRow("formatTime, int") << "formatTime" << QVariant::fromValue(integer) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz"));
+}
+
+void tst_qqmlqt::isQtObject()
+{
+ QQmlComponent component(&engine, testFileUrl("isQtObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), false);
+ QCOMPARE(object->property("test3").toBool(), false);
+ QCOMPARE(object->property("test4").toBool(), false);
+ QCOMPARE(object->property("test5").toBool(), false);
+
+ delete object;
+}
+
+void tst_qqmlqt::btoa()
+{
+ QQmlComponent component(&engine, testFileUrl("btoa.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.btoa(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QString("SGVsbG8gd29ybGQh"));
+
+ delete object;
+}
+
+void tst_qqmlqt::atob()
+{
+ QQmlComponent component(&engine, testFileUrl("atob.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.atob(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QString("Hello world!"));
+
+ delete object;
+}
+
+void tst_qqmlqt::fontFamilies()
+{
+ QQmlComponent component(&engine, testFileUrl("fontFamilies.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.fontFamilies(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QFontDatabase database;
+ QCOMPARE(object->property("test2"), QVariant::fromValue(database.families()));
+
+ delete object;
+}
+
+void tst_qqmlqt::quit()
+{
+ QQmlComponent component(&engine, testFileUrl("quit.qml"));
+
+ QSignalSpy spy(&engine, SIGNAL(quit()));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(spy.count(), 1);
+
+ delete object;
+}
+
+void tst_qqmlqt::resolvedUrl()
+{
+ QQmlComponent component(&engine, testFileUrl("resolvedUrl.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("result").toString(), component.url().toString());
+ QCOMPARE(object->property("isString").toBool(), true);
+
+ delete object;
+}
+
+QTEST_MAIN(tst_qqmlqt)
+
+#include "tst_qqmlqt.moc"
diff --git a/tests/auto/qml/qqmlsqldatabase/data/README b/tests/auto/qml/qqmlsqldatabase/data/README
new file mode 100644
index 0000000000..7efca3a972
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/README
@@ -0,0 +1,3 @@
+These tests are executed in sequence - the database persist until the end of the
+testing. This is done to better exercise the persistence of the database, since
+that is how it is used.
diff --git a/tests/auto/qml/qqmlsqldatabase/data/changeversion.js b/tests/auto/qml/qqmlsqldatabase/data/changeversion.js
new file mode 100644
index 0000000000..f466501ae3
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/changeversion.js
@@ -0,0 +1,55 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-changeversion", "", "Test database from Qt autotests", 1000000,
+ function(db) {
+ db.changeVersion("","1.0")
+ db.transaction(function(tx){
+ tx.executeSql('CREATE TABLE Greeting(salutation TEXT, salutee TEXT)');
+ })
+ });
+
+ db.transaction(function(tx){
+ tx.executeSql('INSERT INTO Greeting VALUES ("Hello", "world")');
+ tx.executeSql('INSERT INTO Greeting VALUES ("Goodbye", "cruel world")');
+ });
+
+
+ db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-changeversion", "", "Test database from Qt autotests", 1000000);
+
+ if (db.version == "1.0")
+ db.changeVersion("1.0","2.0",function(tx)
+ {
+ tx.executeSql('CREATE TABLE Utterance(type TEXT, phrase TEXT)')
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+ for (var i=0; i<rs.rows.length; ++i) {
+ var type = "Greeting";
+ var phrase = rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee;
+ if (rs.rows.item(i).salutation == "Goodbye"
+ || rs.rows.item(i).salutation == "Farewell"
+ || rs.rows.item(i).salutation == "Good-bye") type = "Valediction";
+ var ins = tx.executeSql('INSERT INTO Utterance VALUES(?,?)',[type,phrase]);
+ }
+ tx.executeSql('DROP TABLE Greeting');
+ });
+ else
+ return "db.version should be 1.0, but is " + db.version;
+
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-changeversion", "2.0", "Test database from Qt autotests", 1000000);
+
+ db.transaction(function(tx){
+ var rs = tx.executeSql('SELECT * FROM Utterance');
+ r = ""
+ for (var i=0; i<rs.rows.length; ++i) {
+ r += "(" + rs.rows.item(i).type + ": " + rs.rows.item(i).phrase + ")";
+ }
+ if (r == "(Greeting: Hello, world)(Valediction: Goodbye, cruel world)")
+ r = "passed"
+ else
+ r = "WRONG DATA: " + r;
+ })
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/creation-a.js b/tests/auto/qml/qqmlsqldatabase/data/creation-a.js
new file mode 100644
index 0000000000..65818e4981
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/creation-a.js
@@ -0,0 +1,20 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-creation-a", "1.0", "Test database from Qt autotests", 1000000,
+ function(db) {
+ db.transaction(function(tx){
+ tx.executeSql('CREATE TABLE Greeting(salutation TEXT, salutee TEXT)');
+ r = "passed";
+ })
+ });
+
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-creation-a", "1.0", "Test database from Qt autotests", 1000000,
+ function(db) {
+ r = "FAILED: should have already been created";
+ });
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/creation.js b/tests/auto/qml/qqmlsqldatabase/data/creation.js
new file mode 100644
index 0000000000..3eeef21429
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/creation.js
@@ -0,0 +1,15 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-creation", "1.0", "Test database from Qt autotests", 1000000);
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ r = "passed";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/error-a.js b/tests/auto/qml/qqmlsqldatabase/data/error-a.js
new file mode 100644
index 0000000000..6517c7a84d
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/error-a.js
@@ -0,0 +1,22 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-error-a", "1.0", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ try {
+ db.transaction(
+ function(tx) {
+ var rs = tx.executeSql('SELECT * FROM NotExists');
+ r = "SHOULD NOT SUCCEED";
+ }
+ );
+ } catch (err) {
+ if (err.message == "no such table: NotExists Unable to execute statement")
+ r = "passed";
+ else
+ r = "WRONG ERROR="+err.message;
+ }
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/error-b.js b/tests/auto/qml/qqmlsqldatabase/data/error-b.js
new file mode 100644
index 0000000000..b7369fa668
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/error-b.js
@@ -0,0 +1,15 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-error-b", "1.0", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('INSERT INTO Greeting VALUES("junk","junk")');
+ notexist[123] = "oops"
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/error-creation.js b/tests/auto/qml/qqmlsqldatabase/data/error-creation.js
new file mode 100644
index 0000000000..2d9ebb5b34
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/error-creation.js
@@ -0,0 +1,16 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+ try {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-creation", "2.0", "Test database from Qt autotests", 1000000);
+ } catch (err) {
+ if (err.code != SQLException.VERSION_ERR)
+ r = "WRONG ERROR CODE="+err.code;
+ else if (err.message != "SQL: database version mismatch")
+ r = "WRONG ERROR="+err.message;
+ else
+ r = "passed";
+ }
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/error-notransaction.js b/tests/auto/qml/qqmlsqldatabase/data/error-notransaction.js
new file mode 100644
index 0000000000..1db6d60cae
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/error-notransaction.js
@@ -0,0 +1,17 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-data/error-notransaction", "1.0", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ try {
+ db.transaction();
+ } catch (err) {
+ if (err.message == "transaction: missing callback")
+ r = "passed";
+ else
+ r = "WRONG ERROR="+err.message;
+ }
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/error-outsidetransaction.js b/tests/auto/qml/qqmlsqldatabase/data/error-outsidetransaction.js
new file mode 100644
index 0000000000..666f130d18
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/error-outsidetransaction.js
@@ -0,0 +1,19 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-data/error-notransaction", "1.0", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+ var v;
+
+ try {
+ db.transaction(function(tx) { v = tx });
+ v.executeSql("SELECT 'bad'")
+ } catch (err) {
+ if (err.message == "executeSql called outside transaction()")
+ r = "passed";
+ else
+ r = "WRONG ERROR="+err.message;
+ }
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/iteration-forwardonly.js b/tests/auto/qml/qqmlsqldatabase/data/iteration-forwardonly.js
new file mode 100644
index 0000000000..e2f2704927
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/iteration-forwardonly.js
@@ -0,0 +1,31 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-iteration-forwardonly", "", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES ("Hello", "world")');
+ tx.executeSql('INSERT INTO Greeting VALUES ("Goodbye", "cruel world")');
+ }
+ )
+
+ db.transaction(
+ function(tx) {
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+ rs.forwardOnly = !rs.forwardOnly
+ var r1=""
+ for(var i = 0; i < rs.rows.length; i++)
+ r1 += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + ";"
+ if (r1 != "hello, world;hello, world;hello, world;hello, world;")
+ if (r1 != "Hello, world;Goodbye, cruel world;")
+ r = "SELECTED DATA WRONG: "+r1;
+ else
+ r = "passed";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/iteration.js b/tests/auto/qml/qqmlsqldatabase/data/iteration.js
new file mode 100644
index 0000000000..f83b767a7d
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/iteration.js
@@ -0,0 +1,30 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-iteration", "", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES ("Hello", "world")');
+ tx.executeSql('INSERT INTO Greeting VALUES ("Goodbye", "cruel world")');
+ }
+ )
+
+ db.transaction(
+ function(tx) {
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+ var r1=""
+ for(var i = 0; i < rs.rows.length; i++)
+ r1 += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + ";"
+ if (r1 != "hello, world;hello, world;hello, world;hello, world;")
+ if (r1 != "Hello, world;Goodbye, cruel world;")
+ r = "SELECTED DATA WRONG: "+r1;
+ else
+ r = "passed";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/readonly-error.js b/tests/auto/qml/qqmlsqldatabase/data/readonly-error.js
new file mode 100644
index 0000000000..e14d7002c1
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/readonly-error.js
@@ -0,0 +1,29 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-readonly-error", "1.0", "Test database from Qt autotests", 1000000);
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ }
+ );
+
+ try {
+ db.readTransaction(
+ function(tx) {
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ r = "FAILED";
+ }
+ );
+ } catch (err) {
+ if (err.message == "Read-only Transaction")
+ r = "passed";
+ else
+ r = "WRONG ERROR="+err.message;
+ }
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/readonly.js b/tests/auto/qml/qqmlsqldatabase/data/readonly.js
new file mode 100644
index 0000000000..8dd7e78071
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/readonly.js
@@ -0,0 +1,26 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-readonly", "1.0", "Test database from Qt autotests", 1000000);
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ r = "passed";
+ }
+ );
+
+ db.readTransaction(
+ function(tx) {
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+ if (rs.rows.item(0).salutation == 'hello')
+ r = "passed";
+ else
+ r = "FAILED";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/reopen1.js b/tests/auto/qml/qqmlsqldatabase/data/reopen1.js
new file mode 100644
index 0000000000..5589f12def
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/reopen1.js
@@ -0,0 +1,16 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-reopen", "1.0", "Test database from Qt autotests", 1000000);
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ r = "passed";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/reopen2.js b/tests/auto/qml/qqmlsqldatabase/data/reopen2.js
new file mode 100644
index 0000000000..2f7f5a6097
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/reopen2.js
@@ -0,0 +1,18 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var r="transaction_not_finished";
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-reopen", "1.0", "Test database from Qt autotests", 1000000);
+
+ db.transaction(
+ function(tx) {
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+ if (rs.rows.item(0).salutation == 'hello')
+ r = "passed";
+ else
+ r = "FAILED";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/selection-bindnames.js b/tests/auto/qml/qqmlsqldatabase/data/selection-bindnames.js
new file mode 100644
index 0000000000..fdb495632b
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/selection-bindnames.js
@@ -0,0 +1,28 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-bindnames", "", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'goodbye', 'world' ]);
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'there' ]);
+ }
+ );
+
+ db.transaction(
+ function(tx) {
+ var rs = tx.executeSql('SELECT * FROM Greeting WHERE salutation=:p2 AND salutee=:p1', {':p1':'world', ':p2':'hello'});
+ if ( rs.rows.length != 2 )
+ r = "SELECT RETURNED WRONG VALUE "+rs.rows.length+rs.rows.item(0)+rs.rows.item(1)
+ else
+ r = "passed";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/data/selection.js b/tests/auto/qml/qqmlsqldatabase/data/selection.js
new file mode 100644
index 0000000000..b7b1fe47e9
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/selection.js
@@ -0,0 +1,46 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-selection", "", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ tx.executeSql('CREATE TABLE IF NOT EXISTS TypeTest(num INTEGER, txt1 TEXT, txt2 TEXT)');
+ tx.executeSql("INSERT INTO TypeTest VALUES(1, null, 'hello')");
+ }
+ );
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+ if ( rs.rows.length != 4 )
+ r = "SELECT RETURNED WRONG VALUE "+rs.rows.length+rs.rows[0]+rs.rows[1]
+ else
+ r = "passed";
+ }
+ );
+ if (r == "passed") {
+ db.transaction(function (tx) {
+ r = "";
+ var firstRow = tx.executeSql("SELECT * FROM TypeTest").rows.item(0);
+ if (typeof(firstRow.num) != "number")
+ r += " num:" + firstRow.num+ "type:" + typeof(firstRow.num);
+ if (typeof(firstRow.txt1) != "object" || firstRow.txt1 != null)
+ r += " txt1:" + firstRow.txt1 + " type:" + typeof(firstRow.txt1);
+ if (typeof(firstRow.txt2) != "string" || firstRow.txt2 != "hello")
+ r += " txt2:" + firstRow.txt2 + " type:" + typeof(firstRow.txt2);
+ if (r == "")
+ r = "passed";
+ else
+ r = "SELECT RETURNED VALUES WITH WRONG TYPES " + r;
+ });
+ }
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro b/tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro
new file mode 100644
index 0000000000..bd58608925
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/qqmlsqldatabase.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qqmlsqldatabase
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlsqldatabase.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private sql testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
new file mode 100644
index 0000000000..e52e4792a9
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
@@ -0,0 +1,259 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <private/qqmlengine_p.h>
+#include <QtCore/qcryptographichash.h>
+/*
+#include <QtWebKit/qwebpage.h>
+#include <QtWebKit/qwebframe.h>
+#include <QtWebKit/qwebdatabase.h>
+#include <QtWebKit/qwebsecurityorigin.h>
+*/
+#include <QtSql/qsqldatabase.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include "../../shared/util.h"
+
+class tst_qqmlsqldatabase : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlsqldatabase()
+ {
+ qApp->setApplicationName("tst_qqmlsqldatabase");
+ qApp->setOrganizationName("Nokia");
+ qApp->setOrganizationDomain("nokia.com");
+ engine = new QQmlEngine;
+ }
+
+ ~tst_qqmlsqldatabase()
+ {
+ delete engine;
+ }
+
+private slots:
+ void initTestCase();
+
+ void checkDatabasePath();
+
+ void testQml_data();
+ void testQml();
+ void testQml_cleanopen_data();
+ void testQml_cleanopen();
+ void totalDatabases();
+
+ void cleanupTestCase();
+
+private:
+ QString dbDir() const;
+ QQmlEngine *engine;
+};
+
+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_qqmlsqldatabase::initTestCase()
+{
+ if (engine->offlineStoragePath().isEmpty())
+ QSKIP("offlineStoragePath is empty, skip this test.");
+ QQmlDataTest::initTestCase();
+ removeRecursive(dbDir());
+ QDir().mkpath(dbDir());
+}
+
+void tst_qqmlsqldatabase::cleanupTestCase()
+{
+ if (engine->offlineStoragePath().isEmpty())
+ QSKIP("offlineStoragePath is empty, skip this test.");
+ removeRecursive(dbDir());
+}
+
+QString tst_qqmlsqldatabase::dbDir() const
+{
+ static QString tmpd = QDir::tempPath()+"/tst_qqmlsqldatabase_output-"
+ + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss"));
+ return tmpd;
+}
+
+void tst_qqmlsqldatabase::checkDatabasePath()
+{
+ if (engine->offlineStoragePath().isEmpty())
+ QSKIP("offlineStoragePath is empty, skip this 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("tst_qqmlsqldatabase"));
+ QVERIFY(engine->offlineStoragePath().contains("OfflineStorage"));
+}
+
+static const int total_databases_created_by_tests = 12;
+void tst_qqmlsqldatabase::testQml_data()
+{
+ QTest::addColumn<QString>("jsfile"); // The input file
+
+ // Each test should use a newly named DB to avoid inter-test dependencies
+ QTest::newRow("creation") << "creation.js";
+ QTest::newRow("creation-a") << "creation-a.js";
+ QTest::newRow("creation") << "creation.js";
+ QTest::newRow("error-creation") << "error-creation.js"; // re-uses above DB
+ QTest::newRow("changeversion") << "changeversion.js";
+ QTest::newRow("readonly") << "readonly.js";
+ QTest::newRow("readonly-error") << "readonly-error.js";
+ QTest::newRow("selection") << "selection.js";
+ QTest::newRow("selection-bindnames") << "selection-bindnames.js";
+ QTest::newRow("iteration") << "iteration.js";
+ QTest::newRow("iteration-forwardonly") << "iteration-forwardonly.js";
+ QTest::newRow("error-a") << "error-a.js";
+ QTest::newRow("error-notransaction") << "error-notransaction.js";
+ QTest::newRow("error-outsidetransaction") << "error-outsidetransaction.js"; // reuse above
+ QTest::newRow("reopen1") << "reopen1.js";
+ QTest::newRow("reopen2") << "reopen2.js"; // re-uses above DB
+
+ // If you add a test, you should usually use a new database in the
+ // test - in which case increment total_databases_created_by_tests above.
+}
+
+/*
+class QWebPageWithJavaScriptConsoleMessages : public QWebPage {
+public:
+ void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
+ {
+ qWarning() << sourceID << ":" << lineNumber << ":" << message;
+ }
+};
+
+void tst_qqmlsqldatabase::validateAgainstWebkit()
+{
+ // Validates tests against WebKit (HTML5) support.
+ //
+ QFETCH(QString, jsfile);
+ QFETCH(QString, result);
+ QFETCH(int, databases);
+
+ QFile f(jsfile);
+ QVERIFY(f.open(QIODevice::ReadOnly));
+ QString js=f.readAll();
+
+ QWebPageWithJavaScriptConsoleMessages webpage;
+ webpage.settings()->setOfflineStoragePath(dbDir());
+ webpage.settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
+
+ QEXPECT_FAIL("","WebKit doesn't support openDatabaseSync yet", Continue);
+ QCOMPARE(webpage.mainFrame()->evaluateJavaScript(js).toString(),result);
+
+ QTest::qWait(100); // WebKit crashes if you quit it too fast
+
+ QWebSecurityOrigin origin = webpage.mainFrame()->securityOrigin();
+ QList<QWebDatabase> dbs = origin.databases();
+ QCOMPARE(dbs.count(), databases);
+}
+*/
+
+void tst_qqmlsqldatabase::testQml()
+{
+ if (engine->offlineStoragePath().isEmpty())
+ QSKIP("offlineStoragePath is empty, skip this test.");
+
+ // Tests QML SQL Database support with tests
+ // that have been validated against Webkit.
+ //
+ QFETCH(QString, jsfile);
+
+ QString qml=
+ "import QtQuick 2.0\n"
+ "import \""+jsfile+"\" as JS\n"
+ "Text { text: JS.test() }";
+
+ engine->setOfflineStoragePath(dbDir());
+ QQmlComponent component(engine);
+ component.setData(qml.toUtf8(), testFileUrl("empty.qml")); // just a file for relative local imports
+ QVERIFY(!component.isError());
+ QQuickText *text = qobject_cast<QQuickText*>(component.create());
+ QVERIFY(text != 0);
+ QCOMPARE(text->text(),QString("passed"));
+}
+
+void tst_qqmlsqldatabase::testQml_cleanopen_data()
+{
+ QTest::addColumn<QString>("jsfile"); // The input file
+ QTest::newRow("reopen1") << "reopen1.js";
+ QTest::newRow("reopen2") << "reopen2.js";
+ QTest::newRow("error-creation") << "error-creation.js"; // re-uses creation DB
+}
+
+void tst_qqmlsqldatabase::testQml_cleanopen()
+{
+ if (engine->offlineStoragePath().isEmpty())
+ QSKIP("offlineStoragePath is empty, skip this test.");
+
+ // Same as testQml, but clean connections between tests,
+ // making it more like the tests are running in new processes.
+ testQml();
+
+ engine->collectGarbage();
+
+ foreach (QString dbname, QSqlDatabase::connectionNames()) {
+ QSqlDatabase::removeDatabase(dbname);
+ }
+}
+
+void tst_qqmlsqldatabase::totalDatabases()
+{
+ if (engine->offlineStoragePath().isEmpty())
+ QSKIP("offlineStoragePath is empty, skip this test.");
+
+ QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).count(), total_databases_created_by_tests*2);
+}
+
+QTEST_MAIN(tst_qqmlsqldatabase)
+
+#include "tst_qqmlsqldatabase.moc"
diff --git a/tests/auto/qml/qqmltimer/qqmltimer.pro b/tests/auto/qml/qqmltimer/qqmltimer.pro
new file mode 100644
index 0000000000..28f8e6959f
--- /dev/null
+++ b/tests/auto/qml/qqmltimer/qqmltimer.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+TARGET = tst_qqmltimer
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmltimer.cpp
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private quick-private gui testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
new file mode 100644
index 0000000000..28a0f4f8c7
--- /dev/null
+++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
@@ -0,0 +1,409 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QSignalSpy>
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/private/qqmltimer_p.h>
+#include <QtQuick/qquickitem.h>
+#include <QDebug>
+#include <QtCore/QPauseAnimation>
+#include <private/qabstractanimation_p.h>
+
+void consistentWait(int ms)
+{
+ //Use animations for timing, because we enabled consistentTiming
+ //This function will qWait for >= ms worth of consistent timing to elapse
+ QPauseAnimation waitTimer(ms);
+ waitTimer.start();
+ while (waitTimer.state() == QAbstractAnimation::Running)
+ QTest::qWait(20);
+}
+
+class tst_qqmltimer : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qqmltimer();
+
+private slots:
+ void initTestCase();
+ void notRepeating();
+ void notRepeatingStart();
+ void repeat();
+ void noTriggerIfNotRunning();
+ void triggeredOnStart();
+ void triggeredOnStartRepeat();
+ void changeDuration();
+ void restart();
+ void restartFromTriggered();
+ void runningFromTriggered();
+ void parentProperty();
+};
+
+class TimerHelper : public QObject
+{
+ Q_OBJECT
+public:
+ TimerHelper() : QObject(), count(0)
+ {
+ }
+
+ int count;
+
+public slots:
+ void timeout() {
+ ++count;
+ }
+};
+
+tst_qqmltimer::tst_qqmltimer()
+{
+}
+
+void tst_qqmltimer::initTestCase()
+{
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qqmltimer::notRepeating()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile(""));
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ QVERIFY(timer != 0);
+ QVERIFY(timer->isRunning());
+ QVERIFY(!timer->isRepeating());
+ QCOMPARE(timer->interval(), 100);
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+
+
+ consistentWait(200);
+ QCOMPARE(helper.count, 1);
+ consistentWait(200);
+ QCOMPARE(helper.count, 1);
+ QVERIFY(timer->isRunning() == false);
+}
+
+void tst_qqmltimer::notRepeatingStart()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100 }"), QUrl::fromLocalFile(""));
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ QVERIFY(timer != 0);
+ QVERIFY(!timer->isRunning());
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+
+ consistentWait(200);
+ QCOMPARE(helper.count, 0);
+
+ timer->start();
+ consistentWait(200);
+ QCOMPARE(helper.count, 1);
+ consistentWait(200);
+ QCOMPARE(helper.count, 1);
+ QVERIFY(timer->isRunning() == false);
+
+ delete timer;
+}
+
+void tst_qqmltimer::repeat()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile(""));
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ QVERIFY(timer != 0);
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+ QCOMPARE(helper.count, 0);
+
+ consistentWait(200);
+ QVERIFY(helper.count > 0);
+ int oldCount = helper.count;
+
+ consistentWait(200);
+ QVERIFY(helper.count > oldCount);
+ QVERIFY(timer->isRunning());
+
+ oldCount = helper.count;
+ timer->stop();
+
+ consistentWait(200);
+ QVERIFY(helper.count == oldCount);
+ QVERIFY(timer->isRunning() == false);
+
+ QSignalSpy spy(timer, SIGNAL(repeatChanged()));
+
+ timer->setRepeating(false);
+ QVERIFY(!timer->isRepeating());
+ QCOMPARE(spy.count(),1);
+
+ timer->setRepeating(false);
+ QCOMPARE(spy.count(),1);
+
+ timer->setRepeating(true);
+ QCOMPARE(spy.count(),2);
+
+ delete timer;
+}
+
+void tst_qqmltimer::triggeredOnStart()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile(""));
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ QVERIFY(timer != 0);
+ QVERIFY(timer->triggeredOnStart());
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+ consistentWait(1);
+ QCOMPARE(helper.count, 1);
+ consistentWait(200);
+ QCOMPARE(helper.count, 2);
+ consistentWait(200);
+ QCOMPARE(helper.count, 2);
+ QVERIFY(timer->isRunning() == false);
+
+ QSignalSpy spy(timer, SIGNAL(triggeredOnStartChanged()));
+
+ timer->setTriggeredOnStart(false);
+ QVERIFY(!timer->triggeredOnStart());
+ QCOMPARE(spy.count(),1);
+
+ timer->setTriggeredOnStart(false);
+ QCOMPARE(spy.count(),1);
+
+ timer->setTriggeredOnStart(true);
+ QCOMPARE(spy.count(),2);
+
+ delete timer;
+}
+
+void tst_qqmltimer::triggeredOnStartRepeat()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile(""));
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ QVERIFY(timer != 0);
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+ consistentWait(1);
+ QCOMPARE(helper.count, 1);
+
+ consistentWait(200);
+ QVERIFY(helper.count > 1);
+ int oldCount = helper.count;
+ consistentWait(200);
+ QVERIFY(helper.count > oldCount);
+ QVERIFY(timer->isRunning());
+
+ delete timer;
+}
+
+void tst_qqmltimer::noTriggerIfNotRunning()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray(
+ "import QtQml 2.0\n"
+ "QtObject { property bool ok: true\n"
+ "property Timer timer1: Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }"
+ "property Timer timer2: Timer { interval: 10; running: true; onTriggered: t1.running=false }"
+ "}"
+ ), QUrl::fromLocalFile(""));
+ QObject *item = component.create();
+ QVERIFY(item != 0);
+ consistentWait(200);
+ QCOMPARE(item->property("ok").toBool(), true);
+
+ delete item;
+}
+
+void tst_qqmltimer::changeDuration()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile(""));
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ QVERIFY(timer != 0);
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+ QCOMPARE(helper.count, 0);
+
+ consistentWait(500);
+ QCOMPARE(helper.count, 2);
+
+ timer->setInterval(500);
+
+ consistentWait(600);
+ QCOMPARE(helper.count, 3);
+ QVERIFY(timer->isRunning());
+
+ QSignalSpy spy(timer, SIGNAL(intervalChanged()));
+
+ timer->setInterval(200);
+ QCOMPARE(timer->interval(), 200);
+ QCOMPARE(spy.count(),1);
+
+ timer->setInterval(200);
+ QCOMPARE(spy.count(),1);
+
+ timer->setInterval(300);
+ QCOMPARE(spy.count(),2);
+
+ delete timer;
+}
+
+void tst_qqmltimer::restart()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile(""));
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
+ QVERIFY(timer != 0);
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+ QCOMPARE(helper.count, 0);
+
+ consistentWait(600);
+ QCOMPARE(helper.count, 1);
+
+ consistentWait(300);
+
+ timer->restart();
+
+ consistentWait(700);
+
+ QCOMPARE(helper.count, 2);
+ QVERIFY(timer->isRunning());
+
+ delete timer;
+}
+
+void tst_qqmltimer::restartFromTriggered()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { "
+ "interval: 500; "
+ "repeat: false; "
+ "running: true; "
+ "onTriggered: restart()"
+ " }"), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(component.create());
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(object.data());
+ QVERIFY(timer != 0);
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+ QCOMPARE(helper.count, 0);
+
+ consistentWait(600);
+ QCOMPARE(helper.count, 1);
+ QVERIFY(timer->isRunning());
+
+ consistentWait(600);
+ QCOMPARE(helper.count, 2);
+ QVERIFY(timer->isRunning());
+}
+
+void tst_qqmltimer::runningFromTriggered()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQml 2.0\nTimer { "
+ "property bool ok: false; "
+ "interval: 500; "
+ "repeat: false; "
+ "running: true; "
+ "onTriggered: { ok = !running; running = true }"
+ " }"), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(component.create());
+ QQmlTimer *timer = qobject_cast<QQmlTimer*>(object.data());
+ QVERIFY(timer != 0);
+
+ TimerHelper helper;
+ connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
+ QCOMPARE(helper.count, 0);
+
+ consistentWait(600);
+ QCOMPARE(helper.count, 1);
+ QVERIFY(timer->property("ok").toBool());
+ QVERIFY(timer->isRunning());
+
+ consistentWait(600);
+ QCOMPARE(helper.count, 2);
+ QVERIFY(timer->property("ok").toBool());
+ QVERIFY(timer->isRunning());
+}
+
+void tst_qqmltimer::parentProperty()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQuick 2.0\nItem { Timer { objectName: \"timer\"; running: parent.visible } }"), QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item != 0);
+ QQmlTimer *timer = item->findChild<QQmlTimer*>("timer");
+ QVERIFY(timer != 0);
+
+ QVERIFY(timer->isRunning());
+
+ delete timer;
+}
+
+QTEST_MAIN(tst_qqmltimer)
+
+#include "tst_qqmltimer.moc"
diff --git a/tests/auto/qml/qqmltranslation/data/idtranslation.qml b/tests/auto/qml/qqmltranslation/data/idtranslation.qml
new file mode 100644
index 0000000000..b128a1e578
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/idtranslation.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+QtObject {
+ property string _idTranslation2: QT_TRID_NOOP("qtn_hello_world")
+ property string idTranslation: qsTrId("qtn_hello_world")
+ property string idTranslation2: qsTrId(_idTranslation2)
+ property string idTranslation3: if (1) qsTrId("qtn_hello_world")
+}
diff --git a/tests/auto/qml/qqmltranslation/data/qml_fr.qm b/tests/auto/qml/qqmltranslation/data/qml_fr.qm
new file mode 100644
index 0000000000..252022515a
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/qml_fr.qm
Binary files differ
diff --git a/tests/auto/qml/qqmltranslation/data/qml_fr.ts b/tests/auto/qml/qqmltranslation/data/qml_fr.ts
new file mode 100644
index 0000000000..b003e239bc
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/qml_fr.ts
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr" sourcelanguage="en">
+<context>
+ <name>CustomContext</name>
+ <message>
+ <location filename="translation.qml" line="5"/>
+ <location filename="translation.qml" line="11"/>
+ <source>goodbye</source>
+ <translation>au revoir</translation>
+ </message>
+ <message>
+ <location filename="translation.qml" line="8"/>
+ <source>see ya</source>
+ <comment>informal &apos;goodbye&apos;</comment>
+ <translation>à plus tard</translation>
+ </message>
+</context>
+<context>
+ <name>translation</name>
+ <message>
+ <location filename="translation.qml" line="4"/>
+ <location filename="translation.qml" line="10"/>
+ <source>hello</source>
+ <translation>bonjour</translation>
+ </message>
+ <message>
+ <location filename="translation.qml" line="7"/>
+ <source>hi</source>
+ <comment>informal &apos;hello&apos;</comment>
+ <translation>salut</translation>
+ </message>
+ <message numerus="yes">
+ <location filename="translation.qml" line="15"/>
+ <location filename="translation.qml" line="16"/>
+ <source>%n duck(s)</source>
+ <translation>
+ <numerusform>%n canard</numerusform>
+ <numerusform>%n canards</numerusform>
+ </translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/qml/qqmltranslation/data/qmlid_fr.qm b/tests/auto/qml/qqmltranslation/data/qmlid_fr.qm
new file mode 100644
index 0000000000..265164916f
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/qmlid_fr.qm
Binary files differ
diff --git a/tests/auto/qml/qqmltranslation/data/qmlid_fr.ts b/tests/auto/qml/qqmltranslation/data/qmlid_fr.ts
new file mode 100644
index 0000000000..bff39b80b6
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/qmlid_fr.ts
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr">
+<context>
+ <name></name>
+ <message id="qtn_hello_world">
+ <location filename="idtranslation.qml" line="4"/>
+ <location filename="idtranslation.qml" line="5"/>
+ <source></source>
+ <translation>bonjour tout le monde</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/qml/qqmltranslation/data/translation.qml b/tests/auto/qml/qqmltranslation/data/translation.qml
new file mode 100644
index 0000000000..8435bedb28
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/translation.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+QtObject {
+ property string basic: qsTr("hello")
+ property string basic2: qsTranslate("CustomContext", "goodbye")
+ property string basic3: if (1) qsTr("hello")
+
+ property string disambiguation: qsTr("hi", "informal 'hello'")
+ property string disambiguation2: qsTranslate("CustomContext", "see ya", "informal 'goodbye'")
+ property string disambiguation3: if (1) qsTr("hi", "informal 'hello'")
+
+ property string _noop: QT_TR_NOOP("hello")
+ property string _noop2: QT_TRANSLATE_NOOP("CustomContext", "goodbye")
+ property string noop: qsTr(_noop)
+ property string noop2: qsTranslate("CustomContext", _noop2)
+
+ property string singular: qsTr("%n duck(s)", "", 1)
+ property string singular2: if (1) qsTr("%n duck(s)", "", 1)
+ property string plural: qsTr("%n duck(s)", "", 2)
+ property string plural2: if (1) qsTr("%n duck(s)", "", 2)
+}
diff --git a/tests/auto/qml/qqmltranslation/data/translation.qrc b/tests/auto/qml/qqmltranslation/data/translation.qrc
new file mode 100644
index 0000000000..2e2d0a0497
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/data/translation.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>translation.qml</file>
+ <file>qml_fr.qm</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qml/qqmltranslation/qqmltranslation.pro b/tests/auto/qml/qqmltranslation/qqmltranslation.pro
new file mode 100644
index 0000000000..6ccec6fc7d
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/qqmltranslation.pro
@@ -0,0 +1,15 @@
+CONFIG += testcase
+TARGET = tst_qqmltranslation
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmltranslation.cpp
+RESOURCES += data/translation.qrc
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
new file mode 100644
index 0000000000..0e22d3cfca
--- /dev/null
+++ b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QTranslator>
+#include "../../shared/util.h"
+
+class tst_qqmltranslation : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmltranslation() {}
+
+private slots:
+ void translation();
+ void idTranslation();
+ void translationInQrc();
+};
+
+void tst_qqmltranslation::translation()
+{
+ QTranslator translator;
+ translator.load(QLatin1String("qml_fr"), dataDirectory());
+ QCoreApplication::installTranslator(&translator);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("translation.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("basic").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("basic2").toString(), QLatin1String("au revoir"));
+ QCOMPARE(object->property("basic3").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("disambiguation").toString(), QLatin1String("salut"));
+ QCOMPARE(object->property("disambiguation2").toString(), QString::fromUtf8("\xc3\xa0 plus tard"));
+ QCOMPARE(object->property("disambiguation3").toString(), QLatin1String("salut"));
+ QCOMPARE(object->property("noop").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("noop2").toString(), QLatin1String("au revoir"));
+ QCOMPARE(object->property("singular").toString(), QLatin1String("1 canard"));
+ QCOMPARE(object->property("singular2").toString(), QLatin1String("1 canard"));
+ QCOMPARE(object->property("plural").toString(), QLatin1String("2 canards"));
+ QCOMPARE(object->property("plural2").toString(), QLatin1String("2 canards"));
+
+ QCoreApplication::removeTranslator(&translator);
+ delete object;
+}
+
+void tst_qqmltranslation::idTranslation()
+{
+ QTranslator translator;
+ translator.load(QLatin1String("qmlid_fr"), dataDirectory());
+ QCoreApplication::installTranslator(&translator);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("idtranslation.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("idTranslation").toString(), QLatin1String("bonjour tout le monde"));
+ QCOMPARE(object->property("idTranslation2").toString(), QLatin1String("bonjour tout le monde"));
+ QCOMPARE(object->property("idTranslation3").toString(), QLatin1String("bonjour tout le monde"));
+
+ QCoreApplication::removeTranslator(&translator);
+ delete object;
+}
+
+void tst_qqmltranslation::translationInQrc()
+{
+ QTranslator translator;
+ translator.load(":/qml_fr.qm");
+ QCoreApplication::installTranslator(&translator);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, QUrl("qrc:/translation.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("basic").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("basic2").toString(), QLatin1String("au revoir"));
+ QCOMPARE(object->property("basic3").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("disambiguation").toString(), QLatin1String("salut"));
+ QCOMPARE(object->property("disambiguation2").toString(), QString::fromUtf8("\xc3\xa0 plus tard"));
+ QCOMPARE(object->property("disambiguation3").toString(), QLatin1String("salut"));
+ QCOMPARE(object->property("noop").toString(), QLatin1String("bonjour"));
+ QCOMPARE(object->property("noop2").toString(), QLatin1String("au revoir"));
+ QCOMPARE(object->property("singular").toString(), QLatin1String("1 canard"));
+ QCOMPARE(object->property("singular2").toString(), QLatin1String("1 canard"));
+ QCOMPARE(object->property("plural").toString(), QLatin1String("2 canards"));
+ QCOMPARE(object->property("plural2").toString(), QLatin1String("2 canards"));
+
+ QCoreApplication::removeTranslator(&translator);
+ delete object;
+}
+
+QTEST_MAIN(tst_qqmltranslation)
+
+#include "tst_qqmltranslation.moc"
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/comparisonSemantics.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/comparisonSemantics.qml
new file mode 100644
index 0000000000..e37cf9bc8d
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/comparisonSemantics.qml
@@ -0,0 +1,95 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool comparisonSuccess: false
+
+ property date d: new Date(1999, 8, 8)
+ property date d2: new Date(1998, 8, 8)
+
+ property rect g: Qt.rect(1, 2, 3, 4)
+ property rect g2: Qt.rect(5, 6, 7, 8)
+ property point p: Qt.point(1, 2)
+ property point p2: Qt.point(3, 4)
+ property size z: Qt.size(1, 2)
+ property size z2: Qt.size(3, 4)
+
+ property vector2d v2: Qt.vector2d(1,2)
+ property vector2d v22: Qt.vector2d(3,4)
+ property vector3d v3: Qt.vector3d(1,2,3)
+ property vector3d v32: Qt.vector3d(4,5,6)
+ property vector4d v4: Qt.vector4d(1,2,3,4)
+ property vector4d v42: Qt.vector4d(5,6,7,8)
+ property quaternion q: Qt.quaternion(1,2,3,4)
+ property quaternion q2: Qt.quaternion(5,6,7,8)
+ property matrix4x4 m: Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ property matrix4x4 m2: Qt.matrix4x4(21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36)
+ property color c: "red"
+ property color c2: "blue"
+ property font f: Qt.font({family: "Arial", pointSize: 20})
+ property font f2: Qt.font({family: "Arial", pointSize: 22})
+
+ Component.onCompleted: {
+ comparisonSuccess = true;
+
+ // same type comparison.
+ if (d == d2) comparisonSuccess = false;
+ d = d2;
+ if (d == d2) comparisonSuccess = false; // QML date uses same comparison semantics as JS date!
+ if (d.toString() != d2.toString()) comparisonSuccess = false;
+
+ if (g == g2) comparisonSuccess = false;
+ g = g2;
+ if (g != g2) comparisonSuccess = false;
+
+ if (p == p2) comparisonSuccess = false;
+ p = p2;
+ if (p != p2) comparisonSuccess = false;
+
+ if (z == z2) comparisonSuccess = false;
+ z = z2;
+ if (z != z2) comparisonSuccess = false;
+
+ if (v2 == v22) comparisonSuccess = false;
+ v2 = v22;
+ if (v2 != v22) comparisonSuccess = false;
+
+ if (v3 == v32) comparisonSuccess = false;
+ v3 = v32;
+ if (v3 != v32) comparisonSuccess = false;
+
+ if (v4 == v42) comparisonSuccess = false;
+ v4 = v42;
+ if (v4 != v42) comparisonSuccess = false;
+
+ if (q == q2) comparisonSuccess = false;
+ q = q2;
+ if (q != q2) comparisonSuccess = false;
+
+ if (m == m2) comparisonSuccess = false;
+ m = m2;
+ if (m != m2) comparisonSuccess = false;
+
+ if (c == c2) comparisonSuccess = false;
+ c = c2;
+ if (c != c2) comparisonSuccess = false;
+
+ if (f == f2) comparisonSuccess = false;
+ f = f2;
+ if (f != f2) comparisonSuccess = false;
+
+ // cross-type comparison.
+ p = Qt.point(1,2);
+ z = Qt.size(1,2);
+ v2 = Qt.vector2d(1,2);
+ if (p == z || p == v2 || z == v2) comparisonSuccess = false;
+ if (z == p || v2 == p || v2 == z) comparisonSuccess = false;
+
+ g = Qt.rect(1,2,3,4);
+ q = Qt.quaternion(1,2,3,4);
+ v4 = Qt.vector4d(1,2,3,4);
+ if (g == q || g == v4 || q == v4) comparisonSuccess = false;
+ if (q == g || v4 == g || v4 == q) comparisonSuccess = false;
+
+ if (c == f) comparisonSuccess = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/cppIntegration.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/cppIntegration.qml
new file mode 100644
index 0000000000..06756f7a18
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/cppIntegration.qml
@@ -0,0 +1,98 @@
+import QtQuick 2.0
+import Test 1.0
+
+MyTypeObject {
+ property bool success: false
+
+ // the values come from the MyTypeObject property definitions,
+ // which were defined in C++.
+
+ property rect g: rectf
+ property point p: pointf
+ property size z: sizef
+
+ property vector2d v2: vector2
+ property vector3d v3: vector
+ property vector4d v4: vector4
+ property quaternion q: quaternion
+ property matrix4x4 m: matrix
+ property color c: color
+ property font f: font
+
+ Component.onCompleted: {
+ success = true;
+
+ // ensure that the semantics of the properties
+ // defined in C++ match those of the properties
+ // defined in QML, and that we can compare/assign etc.
+
+ if (g != rectf) success = false;
+ g = Qt.rect(1,2,3,4);
+ if (g == rectf) success = false;
+ g = rectf;
+ if (g != rectf) success = false;
+ g = rect;
+ if (g != rect) success = false;
+ g = rectf; // for the cpp-size value comparison.
+
+ if (p != pointf) success = false;
+ p = Qt.point(1,2);
+ if (p == pointf) success = false;
+ p = pointf;
+ if (p != pointf) success = false;
+ p = point;
+ if (p != point) success = false;
+ p = pointf; // for the cpp-size value comparison.
+
+ if (z != sizef) success = false;
+ z = Qt.size(1,2);
+ if (z == sizef) success = false;
+ z = sizef;
+ if (z != sizef) success = false;
+ z = size;
+ if (z != size) success = false;
+ z = sizef; // for the cpp-size value comparison.
+
+ if (v2 != vector2) success = false;
+ v2 = Qt.vector2d(1,2);
+ if (v2 == vector2) success = false;
+ v2 = vector2;
+ if (v2 != vector2) success = false;
+
+ if (v3 != vector) success = false;
+ v3 = Qt.vector3d(1,2,3);
+ if (v3 == vector) success = false;
+ v3 = vector;
+ if (v3 != vector) success = false;
+
+ if (v4 != vector4) success = false;
+ v4 = Qt.vector4d(1,2,3,4);
+ if (v4 == vector4) success = false;
+ v4 = vector4;
+ if (v4 != vector4) success = false;
+
+ if (q != quaternion) success = false;
+ q = Qt.quaternion(1,2,3,4);
+ if (q == quaternion) success = false;
+ q = quaternion;
+ if (q != quaternion) success = false;
+
+ if (m != matrix) success = false;
+ m = Qt.matrix4x4(120, 230, 340, 450, 560, 670, 780, 890, 900, 1010, 1120, 1230, 1340, 1450, 1560, 1670);
+ if (m == matrix) success = false;
+ m = matrix;
+ if (m != matrix) success = false;
+
+ if (c != color) success = false;
+ c = Qt.rgba(1,0,0,.5);
+ if (c == color) success = false;
+ c = color;
+ if (c != color) success = false;
+
+ if (f != font) success = false;
+ f = Qt.font({family: "Arial", pointSize: 15, weight: Font.DemiBold, italic: false});
+ if (f == font) success = false;
+ f = font;
+ if (f != font) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/invokableFunctions.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/invokableFunctions.qml
new file mode 100644
index 0000000000..85e87e91cf
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/invokableFunctions.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+ property bool complete: false
+
+ property matrix4x4 m1: Qt.matrix4x4(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)
+ property matrix4x4 m2: Qt.matrix4x4(5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8)
+ property vector4d v1: Qt.vector4d(1,2,3,4)
+ property vector4d v2: Qt.vector4d(5,6,7,8)
+ property real scalar: 5
+
+ Component.onCompleted: {
+ // test that invokable functions of non-qml module value types work
+ complete = false;
+ success = true;
+ var result;
+
+ result = v1.plus(v2);
+ if (result != Qt.vector4d(6, 8, 10, 12)) success = false;
+
+ result = v1.times(scalar);
+ if (result != Qt.vector4d(5, 10, 15, 20)) success = false;
+
+ result = v1.times(v2);
+ if (result != Qt.vector4d(5, 12, 21, 32)) success = false;
+
+ // ensure that side-effects don't cause overwrite of valuetype-copy values.
+ result = Qt.vector4d(1,2,3,4).times(Qt.vector4d(5,6,7,8), Qt.vector4d(9,9,9,9).toString());
+ if (result != Qt.vector4d(5, 12, 21, 32)) success = false;
+
+ result = v1.times(m2);
+ if (result != Qt.vector4d(70,70,70,70)) success = false;
+
+ result = m1.times(v2);
+ if (result != Qt.vector4d(26, 52, 78, 104)) success = false;
+
+ result = m1.times(m2);
+ if (result != Qt.matrix4x4(26,26,26,26,52,52,52,52,78,78,78,78,104,104,104,104)) success = false;
+
+ result = m1.plus(m2);
+ if (result != Qt.matrix4x4(6,6,6,6,8,8,8,8,10,10,10,10,12,12,12,12)) success = false;
+
+ result = m1.row(2); // zero-based
+ if (result != Qt.vector4d(3, 3, 3, 3)) success = false;
+
+ result = m1.column(2); // zero-based
+ if (result != Qt.vector4d(1, 2, 3, 4)) success = false;
+
+ complete = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/jsObjectConversion.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/jsObjectConversion.qml
new file mode 100644
index 0000000000..cd51b6c8cb
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/jsObjectConversion.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool qtquickTypeSuccess: false
+
+ // currently, only conversion from js object to font and matrix is supported.
+ property matrix4x4 m: Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ property matrix4x4 m2: Qt.matrix4x4([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
+ property font f: Qt.font({ family: "Arial", pointSize: 10, weight: Font.Bold, italic: true })
+ property font f2: Qt.font({ family: "Arial", pointSize: 10, weight: Font.Bold, italic: true })
+
+ Component.onCompleted: {
+ qtquickTypeSuccess = true;
+
+ // check that the initialisation worked
+ if (m != m2) qtquickTypeSuccess = false;
+ if (f != f2) qtquickTypeSuccess = false;
+
+ // check that assignment works
+ m = Qt.matrix4x4(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)
+ m2 = Qt.matrix4x4([1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4])
+ if (m != m2) qtquickTypeSuccess = false;
+ f = Qt.font({ family: "Arial", pointSize: 16, weight: Font.Black, italic: false });
+ f2 = Qt.font({ family: "Arial", pointSize: 16, weight: Font.Black, italic: false });
+ if (f != f2) qtquickTypeSuccess = false;
+
+ // ensure that equality works as required.
+ if (m2 != Qt.matrix4x4([1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4])) qtquickTypeSucces = false;
+ if (f2 != Qt.font({ family: "Arial", pointSize: 16, weight: Font.Black, italic: false })) qtquickTypeSuccess = false;
+
+ // just to ensure comparison of values from js object assigned values is consistent.
+ m = Qt.matrix4x4(5,5,5,5,2,2,2,2,3,3,3,3,4,4,4,4);
+ m2 = Qt.matrix4x4([6,6,6,6,2,2,2,2,3,3,3,3,4,4,4,4]);
+ if (m == m2) qtquickTypeSuccess = false;
+ m = Qt.matrix4x4(6,6,6,6,2,2,2,2,3,3,3,3,4,4,4,4);
+ if (m != m2) qtquickTypeSuccess = false;
+ m = Qt.matrix4x4([7,7,7,7,2,2,2,2,3,3,3,3,4,4,4,4]);
+ if (m == m2) qtquickTypeSuccess = false;
+ m = Qt.matrix4x4([6,6,6,6,2,2,2,2,3,3,3,3,4,4,4,4]);
+ if (m != m2) qtquickTypeSuccess = false;
+
+ f = Qt.font({ family: "Arial", pointSize: 10, weight: Font.Bold, italic: true });
+ f2 = Qt.font({ family: "Arial", pointSize: 16, weight: Font.Black, italic: false });
+ if (f == f2) qtquickTypeSuccess = false;
+ f = Qt.font({ family: "Arial", pointSize: 16, weight: Font.Black, italic: false });
+ if (f != f2) qtquickTypeSuccess = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/qtqmlValueTypes.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/qtqmlValueTypes.qml
new file mode 100644
index 0000000000..30bc92d8af
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/qtqmlValueTypes.qml
@@ -0,0 +1,48 @@
+import QtQml 2.0
+
+QtObject {
+ property bool qtqmlTypeSuccess: false
+ property bool qtquickTypeSuccess: false
+
+ property int i: 10
+ property bool b: true
+ property real r: 5.5
+ property string s: "Hello"
+
+ property date d: new Date(1999, 8, 8)
+
+ property rect g: Qt.rect(1, 2, 3, 4)
+ property point p: Qt.point(1, 2)
+ property size z: Qt.size(1, 2)
+
+ // the following property types are valid syntax in QML
+ // but their valuetype implementation is provided by QtQuick.
+ // Thus, we can define properties of the type, but not use them.
+ property vector2d v2
+ property vector3d v3
+ property vector4d v4
+ property quaternion q
+ property matrix4x4 m
+ property color c
+ property font f
+
+ Component.onCompleted: {
+ qtqmlTypeSuccess = true;
+ qtquickTypeSuccess = true;
+
+ // test that the base qtqml provided types work
+ if (i != 10) qtqmlTypeSuccess = false;
+ if (b != true) qtqmlTypeSuccess = false;
+ if (r != 5.5) qtqmlTypeSuccess = false;
+ if (s != "Hello") qtqmlTypeSuccess = false;
+ if (d.toDateString() != (new Date(1999,8,8)).toDateString()) qtqmlTypeSuccess = false;
+ if (g != Qt.rect(1, 2, 3, 4)) qtqmlTypeSuccess = false;
+ if (p != Qt.point(1, 2)) qtqmlTypeSuccess = false;
+ if (z != Qt.size(1, 2)) qtqmlTypeSuccess = false;
+
+ // This should also work, as the base value types are provided by QtQml.
+ if (g.x != 1 || g.y != 2 || g.width != 3 || g.height != 4) qtqmlTypeSuccess = false;
+ if (p.x != 1 || p.y != 2) qtqmlTypeSuccess = false;
+ if (z.width != 1 || z.height != 2) qtqmlTypeSuccess = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml
new file mode 100644
index 0000000000..f723dc3e2e
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/qtquickValueTypes.qml
@@ -0,0 +1,119 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool qtqmlTypeSuccess: false
+ property bool qtquickTypeSuccess: false
+
+ property int i: 10
+ property bool b: true
+ property real r: 5.5
+ property string s: "Hello"
+
+ property date d: new Date(1999, 8, 8)
+
+ property rect g: Qt.rect(1, 2, 3, 4)
+ property point p: Qt.point(1, 2)
+ property size z: Qt.size(1, 2)
+
+ property vector2d v2: Qt.vector2d(1,2)
+ property vector3d v3: Qt.vector3d(1,2,3)
+ property vector4d v4: Qt.vector4d(1,2,3,4)
+ property quaternion q: Qt.quaternion(1,2,3,4)
+ property matrix4x4 m: Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ property color c: "red"
+ property color c2: "red"
+ property font f: Qt.font({ family: "Arial", pointSize: 20 })
+
+ // ensure that group property specification works as expected.
+ property font f2
+ f2.family: "Arial"
+ f2.pointSize: 45
+ f2.italic: true
+ v22.x: 5
+ v22.y: 10
+ property vector2d v22
+ property font f3 // note: cannot specify grouped subproperties inline with property declaration :-/
+ f3 {
+ family: "Arial"
+ pointSize: 45
+ italic: true
+ }
+
+ Component.onCompleted: {
+ qtqmlTypeSuccess = true;
+ qtquickTypeSuccess = true;
+
+ // check base types still work even though we imported QtQuick
+ if (i != 10) qtqmlTypeSuccess = false;
+ if (b != true) qtqmlTypeSuccess = false;
+ if (r != 5.5) qtqmlTypeSuccess = false;
+ if (s != "Hello") qtqmlTypeSuccess = false;
+ if (d.toDateString() != (new Date(1999,8,8)).toDateString()) qtqmlTypeSuccess = false;
+
+ // check language-provided value types still work.
+ if (g != Qt.rect(1, 2, 3, 4)) qtqmlTypeSuccess = false;
+ if (g.x != 1 || g.y != 2 || g.width != 3 || g.height != 4) qtqmlTypeSuccess = false;
+ if (p != Qt.point(1, 2)) qtqmlTypeSuccess = false;
+ if (p.x != 1 || p.y != 2) qtqmlTypeSuccess = false;
+ if (z != Qt.size(1, 2)) qtqmlTypeSuccess = false;
+ if (z.width != 1 || z.height != 2) qtqmlTypeSuccess = false;
+
+ // Check that the value type provider for vector3d and other non-QtQml value-types is provided by QtQuick.
+ if (v2.x != 1 || v2.y != 2) qtquickTypeSuccess = false;
+ if (v2 != Qt.vector2d(1,2)) qtquickTypeSuccess = false;
+ if (v3.x != 1 || v3.y != 2 || v3.z != 3) qtquickTypeSuccess = false;
+ if (v3 != Qt.vector3d(1,2,3)) qtquickTypeSuccess = false;
+ if (v4.x != 1 || v4.y != 2 || v4.z != 3 || v4.w != 4) qtquickTypeSuccess = false;
+ if (v4 != Qt.vector4d(1,2,3,4)) qtquickTypeSuccess = false;
+ if (q.scalar != 1 || q.x != 2 || q.y != 3 || q.z != 4) qtquickTypeSuccess = false;
+ if (q != Qt.quaternion(1,2,3,4)) qtquickTypeSuccess = false;
+ if (m != Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)) qtquickTypeSuccess = false;
+ if (c != Qt.rgba(1,0,0,1)) qtquickTypeSuccess = false;
+ if (c != c2) qtquickTypeSuccess = false; // can compare two colors directly.
+ if (f.family != "Arial" || f.pointSize != 20) qtquickTypeSuccess = false;
+ if (f != Qt.font({ family: "Arial", pointSize: 20 })) qtquickTypeSuccess = false;
+ if (f2.family != "Arial" || f2.pointSize != 45 || f2.italic != true) qtquickTypeSuccess = false;
+ if (f2 != f3) qtquickTypeSuccess = false;
+ if (v22.x != 5 || v22.y != 10) qtquickTypeSuccess = false;
+
+ // font has some optional parameters.
+ var defaultFont = Qt.font({ family: "Arial", pointSize: 22 }); // normal should be default weight.
+ var lightFont = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Light });
+ var normalFont = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Normal });
+ var demiboldFont = Qt.font({ family: "Arial", pointSize: 22, weight: Font.DemiBold });
+ var boldFont = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Bold });
+ var blackFont = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Black });
+
+ f = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Light });
+ if (f.family != "Arial" || f.pointSize != 22 || f.weight != lightFont.weight || f.weight == normalFont.weight) qtquickTypeSuccess = false;
+ f = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Normal, italic: true });
+ if (f.family != "Arial" || f.pointSize != 22 || f.weight != normalFont.weight || f.italic != true) qtquickTypeSuccess = false;
+ f = Qt.font({ family: "Arial", pointSize: 22, weight: Font.DemiBold, italic: false });
+ if (f.family != "Arial" || f.pointSize != 22 || f.weight != demiboldFont.weight || f.italic != false) qtquickTypeSuccess = false;
+ f = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Bold }); // italic should be false by default
+ if (f.family != "Arial" || f.pointSize != 22 || f.weight != boldFont.weight || f.italic != false) qtquickTypeSuccess = false;
+ f = Qt.font({ family: "Arial", pointSize: 22, weight: Font.Black }); // italic should be false by default
+ if (f.family != "Arial" || f.pointSize != 22 || f.weight != blackFont.weight || f.italic != false) qtquickTypeSuccess = false;
+
+ // Check the string conversion codepaths.
+ v2 = "5,6";
+ if (v2 != Qt.vector2d(5,6)) qtquickTypeSuccess = false;
+ if (v2.toString() != "QVector2D(5, 6)") qtquickTypeSuccess = false;
+ v3 = "5,6,7";
+ if (v3 != Qt.vector3d(5,6,7)) qtquickTypeSuccess = false;
+ if (v3.toString() != "QVector3D(5, 6, 7)") qtquickTypeSuccess = false;
+ v4 = "5,6,7,8";
+ if (v4 != Qt.vector4d(5,6,7,8)) qtquickTypeSuccess = false;
+ if (v4.toString() != "QVector4D(5, 6, 7, 8)") qtquickTypeSuccess = false;
+ q = "5,6,7,8";
+ if (q != Qt.quaternion(5,6,7,8)) qtquickTypeSuccess = false;
+ if (q.toString() != "QQuaternion(5, 6, 7, 8)") qtquickTypeSuccess = false;
+ m = "4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7";
+ if (m != Qt.matrix4x4(4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7)) qtquickTypeSuccess = false;
+ if (m.toString() != "QMatrix4x4(4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7)") qtquickTypeSuccess = false;
+ c = "blue";
+ if (c.toString() != Qt.rgba(0,0,1,0).toString()) qtquickTypeSuccess = false;
+ if (c.toString() != "#0000FF" && c.toString() != "#0000ff") qtquickTypeSuccess = false; // color string converter is special
+ // no string converter for fonts.
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml
new file mode 100644
index 0000000000..d2f748c4c4
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/data/userType.qml
@@ -0,0 +1,88 @@
+import QtQuick 2.0
+import Test 1.0
+
+Item {
+ property bool success: false
+
+ // Test user value type stored as both var and variant
+ property var testValue1
+ property variant testValue2
+ property variant testValue3
+ property var testValue4
+
+ TestValueExporter {
+ id: assignmentValueType
+ testValue.property1: 1
+ testValue.property2: 3.1415927
+ }
+
+ TestValueExporter {
+ id: v4BindingValueType
+ testValue.property1: 1 + 2
+ testValue.property2: 3.1415927 / 2.0
+ }
+
+ TestValueExporter {
+ id: v8BindingValueType
+ testValue.property1: if (true) 1 + 2
+ testValue.property2: if (true) 3.1415927 / 2.0
+ }
+
+ function numberEqual(lhs, rhs) {
+ var d = (lhs - rhs)
+ return (Math.abs(d) < 0.0001)
+ }
+
+ Component.onCompleted: {
+ // Poperties assigned the result of Q_INVOKABLE:
+ testValue1 = testValueExporter.getTestValue()
+ testValue2 = testValueExporter.getTestValue()
+
+ if (testValue1.property1 != 333) return
+ if (!numberEqual(testValue1.property2, 666.999)) return
+
+ if (testValue2.property1 != 333) return
+ if (!numberEqual(testValue2.property2, 666.999)) return
+
+ if (testValue1 != testValue2) return
+
+ // Write to the properties of the value type
+ testValue1.property1 = 1
+ testValue1.property2 = 3.1415927
+
+ testValue2.property1 = 1
+ testValue2.property2 = 3.1415927
+
+ if (testValue1.property1 != 1) return
+ if (!numberEqual(testValue1.property2, 3.1415927)) return
+
+ if (testValue2.property1 != 1) return
+ if (!numberEqual(testValue2.property2, 3.1415927)) return
+
+ if (testValue1 != testValue2) return
+
+ // Assignment of value type properties
+ testValue3 = testValue1
+ testValue4 = testValue2
+
+ if (testValue3.property1 != 1) return
+ if (!numberEqual(testValue3.property2, 3.1415927)) return
+
+ if (testValue4.property1 != 1) return
+ if (!numberEqual(testValue4.property2, 3.1415927)) return
+
+ if (testValue3 != testValue4) return
+
+ // Access a value-type property of a QObject
+ var vt = testValueExporter.testValue
+ if (vt.property1 != 0) return
+ if (!numberEqual(vt.property2, 0.0)) return
+
+ testValueExporter.testValue = testValue4
+
+ if (vt.property1 != 1) return
+ if (!numberEqual(vt.property2, 3.1415927)) return
+
+ success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro b/tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro
new file mode 100644
index 0000000000..a482db40b4
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/qqmlvaluetypeproviders.pro
@@ -0,0 +1,17 @@
+CONFIG += testcase
+TARGET = tst_qqmlvaluetypeproviders
+macx:CONFIG -= app_bundle
+
+HEADERS += testtypes.h
+
+SOURCES += tst_qqmlvaluetypeproviders.cpp \
+ testtypes.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private gui testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.cpp b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.cpp
new file mode 100644
index 0000000000..43b2bbf5db
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+
+void registerTypes()
+{
+ qmlRegisterType<MyTypeObject>("Test", 1, 0, "MyTypeObject");
+}
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
new file mode 100644
index 0000000000..86ac04317f
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QObject>
+#include <QPoint>
+#include <QPointF>
+#include <QSize>
+#include <QSizeF>
+#include <QRect>
+#include <QRectF>
+#include <QVector2D>
+#include <QVector3D>
+#include <QVector4D>
+#include <QQuaternion>
+#include <QMatrix4x4>
+#include <QFont>
+#include <QColor>
+#include <qqml.h>
+
+class MyTypeObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed)
+ Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed)
+ Q_PROPERTY(QPointF pointfpoint READ pointfpoint WRITE setPointfpoint NOTIFY changed)
+ Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed)
+ Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed)
+ Q_PROPERTY(QSizeF sizefsize READ sizefsize WRITE setSizefsize NOTIFY changed)
+ Q_PROPERTY(QSize sizereadonly READ size NOTIFY changed)
+ Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed)
+ Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed)
+ Q_PROPERTY(QRectF rectfrect READ rectfrect WRITE setRectfrect NOTIFY changed)
+ Q_PROPERTY(QVector2D vector2 READ vector2 WRITE setVector2 NOTIFY changed)
+ Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed)
+ Q_PROPERTY(QVector4D vector4 READ vector4 WRITE setVector4 NOTIFY changed)
+ Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion NOTIFY changed)
+ Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY changed)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed)
+ Q_PROPERTY(QVariant variant READ variant NOTIFY changed)
+
+public:
+ MyTypeObject() :
+ m_point(10, 4),
+ m_pointf(11.3, -10.9),
+ m_pointfpoint(10.0, 4.0),
+ m_size(1912, 1913),
+ m_sizef(0.1, 100923.2),
+ m_sizefsize(1912.0, 1913.0),
+ m_rect(2, 3, 109, 102),
+ m_rectf(103.8, 99.2, 88.1, 77.6),
+ m_rectfrect(2.0, 3.0, 109.0, 102.0),
+ m_vector2(32.88, 1.3),
+ m_vector(23.88, 3.1, 4.3),
+ m_vector4(54.2, 23.88, 3.1, 4.3),
+ m_quaternion(4.3, 54.2, 23.88, 3.1),
+ m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
+ {
+ m_font.setFamily("Arial");
+ m_font.setBold(true);
+ m_font.setWeight(QFont::DemiBold);
+ m_font.setItalic(true);
+ m_font.setUnderline(true);
+ m_font.setOverline(true);
+ m_font.setStrikeOut(true);
+ m_font.setPointSize(29);
+ m_font.setCapitalization(QFont::AllLowercase);
+ m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2);
+ m_font.setWordSpacing(19.7);
+ m_color.setRedF(0.2);
+ m_color.setGreenF(0.88);
+ m_color.setBlueF(0.6);
+ m_color.setAlphaF(0.34);
+ }
+
+ QPoint m_point;
+ QPoint point() const { return m_point; }
+ void setPoint(const QPoint &v) { m_point = v; emit changed(); }
+
+ QPointF m_pointf;
+ QPointF pointf() const { return m_pointf; }
+ void setPointf(const QPointF &v) { m_pointf = v; emit changed(); }
+
+ QPointF m_pointfpoint;
+ QPointF pointfpoint() const { return m_pointfpoint; }
+ void setPointfpoint(const QPointF &v) { m_pointfpoint = v; emit changed(); }
+
+ QSize m_size;
+ QSize size() const { return m_size; }
+ void setSize(const QSize &v) { m_size = v; emit changed(); }
+
+ QSizeF m_sizef;
+ QSizeF sizef() const { return m_sizef; }
+ void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); }
+
+ QSizeF m_sizefsize;
+ QSizeF sizefsize() const { return m_sizefsize; }
+ void setSizefsize(const QSizeF &v) { m_sizefsize = v; emit changed(); }
+
+ QRect m_rect;
+ QRect rect() const { return m_rect; }
+ void setRect(const QRect &v) { m_rect = v; emit changed(); }
+
+ QRectF m_rectf;
+ QRectF rectf() const { return m_rectf; }
+ void setRectf(const QRectF &v) { m_rectf = v; emit changed(); }
+
+ QRectF m_rectfrect;
+ QRectF rectfrect() const { return m_rectfrect; }
+ void setRectfrect(const QRectF &v) { m_rectfrect = v; emit changed(); }
+
+ QVector2D m_vector2;
+ QVector2D vector2() const { return m_vector2; }
+ void setVector2(const QVector2D &v) { m_vector2 = v; emit changed(); }
+
+ QVector3D m_vector;
+ QVector3D vector() const { return m_vector; }
+ void setVector(const QVector3D &v) { m_vector = v; emit changed(); }
+
+ QVector4D m_vector4;
+ QVector4D vector4() const { return m_vector4; }
+ void setVector4(const QVector4D &v) { m_vector4 = v; emit changed(); }
+
+ QQuaternion m_quaternion;
+ QQuaternion quaternion() const { return m_quaternion; }
+ void setQuaternion(const QQuaternion &v) { m_quaternion = v; emit changed(); }
+
+ QMatrix4x4 m_matrix;
+ QMatrix4x4 matrix() const { return m_matrix; }
+ void setMatrix(const QMatrix4x4 &v) { m_matrix = v; emit changed(); }
+
+ QFont m_font;
+ QFont font() const { return m_font; }
+ void setFont(const QFont &v) { m_font = v; emit changed(); }
+
+ QColor m_color;
+ QColor color() const { return m_color; }
+ void setColor(const QColor &v) { m_color = v; emit changed(); }
+
+ QVariant variant() const { return sizef(); }
+
+ void emitRunScript() { emit runScript(); }
+
+signals:
+ void changed();
+ void runScript();
+
+public slots:
+ QSize method() { return QSize(13, 14); }
+};
+
+void registerTypes();
+
+#endif // TESTTYPES_H
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp
new file mode 100644
index 0000000000..bba4edd651
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp
@@ -0,0 +1,305 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QQmlContext>
+#include <QDebug>
+#include <private/qqmlglobal_p.h>
+#include <private/qquickvaluetypes_p.h>
+#include "../../shared/util.h"
+#include "testtypes.h"
+
+QT_BEGIN_NAMESPACE
+extern int qt_defaultDpi(void);
+QT_END_NAMESPACE
+
+// There is some overlap between the qqmllanguage and qqmlvaluetypes
+// test here, but it needs to be separate to ensure that no QML plugins
+// are loaded prior to these tests, which could contaminate the type
+// system with more providers.
+
+class tst_qqmlvaluetypeproviders : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlvaluetypeproviders() {}
+
+private slots:
+ void initTestCase();
+
+ void qtqmlValueTypes(); // This test function _must_ be the first test function run.
+ void qtquickValueTypes();
+ void comparisonSemantics();
+ void cppIntegration();
+ void jsObjectConversion();
+ void invokableFunctions();
+ void userType();
+};
+
+void tst_qqmlvaluetypeproviders::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ registerTypes();
+}
+
+void tst_qqmlvaluetypeproviders::qtqmlValueTypes()
+{
+ QQmlEngine e;
+ QQmlComponent component(&e, testFileUrl("qtqmlValueTypes.qml"));
+ QVERIFY(!component.isError());
+ QVERIFY(component.errors().isEmpty());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("qtqmlTypeSuccess").toBool());
+ QVERIFY(object->property("qtquickTypeSuccess").toBool());
+ delete object;
+}
+
+void tst_qqmlvaluetypeproviders::qtquickValueTypes()
+{
+ QQmlEngine e;
+ QQmlComponent component(&e, testFileUrl("qtquickValueTypes.qml"));
+ QVERIFY(!component.isError());
+ QVERIFY(component.errors().isEmpty());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("qtqmlTypeSuccess").toBool());
+ QVERIFY(object->property("qtquickTypeSuccess").toBool());
+ delete object;
+}
+
+void tst_qqmlvaluetypeproviders::comparisonSemantics()
+{
+ QQmlEngine e;
+ QQmlComponent component(&e, testFileUrl("comparisonSemantics.qml"));
+ QVERIFY(!component.isError());
+ QVERIFY(component.errors().isEmpty());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("comparisonSuccess").toBool());
+ delete object;
+}
+
+void tst_qqmlvaluetypeproviders::cppIntegration()
+{
+ QQmlEngine e;
+ QQmlComponent component(&e, testFileUrl("cppIntegration.qml"));
+ QVERIFY(!component.isError());
+ QVERIFY(component.errors().isEmpty());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ // ensure accessing / comparing / assigning cpp-defined props
+ // and qml-defined props works in QML.
+ QVERIFY(object->property("success").toBool());
+
+ // ensure types match
+ QCOMPARE(object->property("g").userType(), object->property("rectf").userType());
+ QCOMPARE(object->property("p").userType(), object->property("pointf").userType());
+ QCOMPARE(object->property("z").userType(), object->property("sizef").userType());
+ QCOMPARE(object->property("v2").userType(), object->property("vector2").userType());
+ QCOMPARE(object->property("v3").userType(), object->property("vector").userType());
+ QCOMPARE(object->property("v4").userType(), object->property("vector4").userType());
+ QCOMPARE(object->property("q").userType(), object->property("quaternion").userType());
+ QCOMPARE(object->property("m").userType(), object->property("matrix").userType());
+ QCOMPARE(object->property("c").userType(), object->property("color").userType());
+ QCOMPARE(object->property("f").userType(), object->property("font").userType());
+
+ // ensure values match
+ QCOMPARE(object->property("g").value<QRectF>(), object->property("rectf").value<QRectF>());
+ QCOMPARE(object->property("p").value<QPointF>(), object->property("pointf").value<QPointF>());
+ QCOMPARE(object->property("z").value<QSizeF>(), object->property("sizef").value<QSizeF>());
+ QCOMPARE(object->property("v2").value<QVector2D>(), object->property("vector2").value<QVector2D>());
+ QCOMPARE(object->property("v3").value<QVector3D>(), object->property("vector").value<QVector3D>());
+ QCOMPARE(object->property("v4").value<QVector4D>(), object->property("vector4").value<QVector4D>());
+ QCOMPARE(object->property("q").value<QQuaternion>(), object->property("quaternion").value<QQuaternion>());
+ QCOMPARE(object->property("m").value<QMatrix4x4>(), object->property("matrix").value<QMatrix4x4>());
+ QCOMPARE(object->property("c").value<QColor>(), object->property("color").value<QColor>());
+ QCOMPARE(object->property("f").value<QFont>(), object->property("font").value<QFont>());
+
+ delete object;
+}
+
+void tst_qqmlvaluetypeproviders::jsObjectConversion()
+{
+ QQmlEngine e;
+ QQmlComponent component(&e, testFileUrl("jsObjectConversion.qml"));
+ QVERIFY(!component.isError());
+ QVERIFY(component.errors().isEmpty());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("qtquickTypeSuccess").toBool());
+ delete object;
+}
+
+void tst_qqmlvaluetypeproviders::invokableFunctions()
+{
+ QQmlEngine e;
+ QQmlComponent component(&e, testFileUrl("invokableFunctions.qml"));
+ QVERIFY(!component.isError());
+ QVERIFY(component.errors().isEmpty());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("complete").toBool());
+ QVERIFY(object->property("success").toBool());
+ delete object;
+}
+
+namespace {
+
+// A value-type class to export to QML
+class TestValue
+{
+public:
+ TestValue() : m_p1(0), m_p2(0.0) {}
+ TestValue(int p1, double p2) : m_p1(p1), m_p2(p2) {}
+ TestValue(const TestValue &other) : m_p1(other.m_p1), m_p2(other.m_p2) {}
+ ~TestValue() {}
+
+ TestValue &operator=(const TestValue &other) { m_p1 = other.m_p1; m_p2 = other.m_p2; return *this; }
+
+ int property1() const { return m_p1; }
+ void setProperty1(int p1) { m_p1 = p1; }
+
+ double property2() const { return m_p2; }
+ void setProperty2(double p2) { m_p2 = p2; }
+
+ bool operator==(const TestValue &other) const { return (m_p1 == other.m_p1) && (m_p2 == other.m_p2); }
+ bool operator!=(const TestValue &other) const { return !operator==(other); }
+
+private:
+ int m_p1;
+ double m_p2;
+};
+
+}
+
+Q_DECLARE_METATYPE(TestValue);
+
+namespace {
+
+class TestValueType : public QQmlValueTypeBase<TestValue>
+{
+ Q_OBJECT
+ Q_PROPERTY(int property1 READ property1 WRITE setProperty1)
+ Q_PROPERTY(double property2 READ property2 WRITE setProperty2)
+public:
+ TestValueType(QObject *parent = 0) : QQmlValueTypeBase<TestValue>(qMetaTypeId<TestValue>(), parent) {}
+
+ virtual QString toString() const { return QString::number(property1()) + QLatin1Char(',') + QString::number(property2()); }
+ virtual bool isEqual(const QVariant &other) const { return (other.userType() == qMetaTypeId<TestValue>()) && (v == other.value<TestValue>()); }
+
+ int property1() const { return v.property1(); }
+ void setProperty1(int p1) { v.setProperty1(p1); }
+
+ double property2() const { return v.property2(); }
+ void setProperty2(double p2) { v.setProperty2(p2); }
+};
+
+class TestValueTypeProvider : public QQmlValueTypeProvider
+{
+public:
+ bool create(int type, QQmlValueType *&v)
+ {
+ if (type == qMetaTypeId<TestValue>()) {
+ v = new TestValueType;
+ return true;
+ }
+
+ return false;
+ }
+
+};
+
+TestValueTypeProvider *getValueTypeProvider()
+{
+ static TestValueTypeProvider valueTypeProvider;
+ return &valueTypeProvider;
+}
+
+bool initializeProviders()
+{
+ QQml_addValueTypeProvider(getValueTypeProvider());
+ return true;
+}
+
+const bool initialized = initializeProviders();
+
+class TestValueExporter : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(TestValue testValue READ testValue WRITE setTestValue)
+public:
+ TestValue testValue() const { return m_testValue; }
+ void setTestValue(const TestValue &v) { m_testValue = v; }
+
+ Q_INVOKABLE TestValue getTestValue() const { return TestValue(333, 666.999); }
+
+private:
+ TestValue m_testValue;
+};
+
+}
+
+void tst_qqmlvaluetypeproviders::userType()
+{
+ Q_ASSERT(initialized);
+ Q_ASSERT(qMetaTypeId<TestValue>() >= QMetaType::User);
+
+ qRegisterMetaType<TestValue>();
+ qmlRegisterType<TestValueExporter>("Test", 1, 0, "TestValueExporter");
+
+ TestValueExporter exporter;
+
+ QQmlEngine e;
+ e.rootContext()->setContextProperty("testValueExporter", &exporter);
+
+ QQmlComponent component(&e, testFileUrl("userType.qml"));
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("success").toBool(), true);
+}
+
+QTEST_MAIN(tst_qqmlvaluetypeproviders)
+
+#include "tst_qqmlvaluetypeproviders.moc"
diff --git a/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType.qml b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType.qml
new file mode 100644
index 0000000000..f625d081e5
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ property bool boldProperty: false
+
+ font.bold: boldProperty
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType4.qml b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType4.qml
new file mode 100644
index 0000000000..0bdccce5be
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType4.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ property int dataProperty: 7
+
+ point: Qt.point(dataProperty, dataProperty)
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType5.qml b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType5.qml
new file mode 100644
index 0000000000..151c49971e
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType5.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ property int dataProperty: 7
+
+ point.x: dataProperty
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.2.qml b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.2.qml
new file mode 100644
index 0000000000..ce2e82d0f8
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.2.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ property int value: 10
+ rect.x: value
+
+ onRunScript: { rect = Qt.rect(10, 10, 10, 10) }
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.3.qml b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.3.qml
new file mode 100644
index 0000000000..d431b4ae08
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.3.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+
+MyTypeObject {
+ property variant value
+
+ rect: value
+
+ onRunScript: { rect.x = 44 }
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.qml b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.qml
new file mode 100644
index 0000000000..a8a72f515b
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ property int value: 10
+ rect.x: value
+
+ onRunScript: { rect.x = 42; }
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.2.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.2.qml
new file mode 100644
index 0000000000..0da717ba5c
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.2.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Test 1.0
+
+MyTypeObject {
+ property int value: 10
+ rect.y: Qt.binding(function() { return value; }); // error.
+
+ Component.onCompleted: {
+ rect.x = 5;
+ rect.x = (function() { return value; }); // error.
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml
new file mode 100644
index 0000000000..9b10803649
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import Test 1.0
+
+MyTypeObject {
+ property int value: 10
+
+ rect.x: value
+
+ Component.onCompleted: {
+ rect.y = Qt.binding(function() { return value + 5; });
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingConflict.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingConflict.qml
new file mode 100644
index 0000000000..fd25c9f0a7
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingConflict.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ property int value: 13
+
+ rect.x: value
+ rect: "10,10,10x10"
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingRead.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingRead.qml
new file mode 100644
index 0000000000..538d776fba
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingRead.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ property int value: rect.x
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingVariantCopy.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingVariantCopy.qml
new file mode 100644
index 0000000000..3a48c8bdb1
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingVariantCopy.qml
@@ -0,0 +1,13 @@
+import Test 1.0
+
+MyTypeObject {
+ property variant object
+ object: MyTypeObject {
+ rect.x: 19
+ rect.y: 33
+ rect.width: 5
+ rect.height: 99
+ }
+
+ rect: object.rect
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.1.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.1.qml
new file mode 100644
index 0000000000..2a1b936da6
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.1.qml
@@ -0,0 +1,29 @@
+import Test 1.0
+import QtQuick 2.0
+
+BindingsSpliceCorrectlyType {
+ property bool test: false
+
+ property bool italicProperty: false
+
+ font.italic: italicProperty
+
+ Component.onCompleted: {
+ // Test initial state
+ if (font.italic != false) return;
+ if (font.bold != false) return;
+
+ // Test italic binding worked
+ italicProperty = true;
+
+ if (font.italic != true) return;
+ if (font.bold != false) return;
+
+ // Test bold binding worked
+ boldProperty = true;
+ if (font.italic != true) return;
+ if (font.bold != true) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.2.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.2.qml
new file mode 100644
index 0000000000..84b465c565
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.2.qml
@@ -0,0 +1,31 @@
+import Test 1.0
+import QtQuick 2.0
+
+BindingsSpliceCorrectlyType {
+ property bool test: false
+
+ property bool italicProperty: false
+
+ font.italic: italicProperty
+ font.bold: false
+
+ Component.onCompleted: {
+ // Test initial state
+ if (font.italic != false) return;
+ if (font.bold != false) return;
+
+ // Test italic binding worked
+ italicProperty = true;
+
+ if (font.italic != true) return;
+ if (font.bold != false) return;
+
+ // Test bold binding was removed by constant write
+ boldProperty = true;
+ if (font.italic != true) return;
+ if (font.bold != false) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.3.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.3.qml
new file mode 100644
index 0000000000..f1212f8039
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.3.qml
@@ -0,0 +1,36 @@
+import Test 1.0
+import QtQuick 2.0
+
+BindingsSpliceCorrectlyType {
+ property bool test: false
+
+ property bool italicProperty: false
+ property bool boldProperty2: false
+
+ font.italic: italicProperty
+ font.bold: boldProperty2
+
+ Component.onCompleted: {
+ // Test initial state
+ if (font.italic != false) return;
+ if (font.bold != false) return;
+
+ // Test italic binding worked
+ italicProperty = true;
+
+ if (font.italic != true) return;
+ if (font.bold != false) return;
+
+ // Test bold binding was overridden
+ boldProperty = true;
+ if (font.italic != true) return;
+ if (font.bold != false) return;
+
+ boldProperty2 = true;
+ if (font.italic != true) return;
+ if (font.bold != true) return;
+
+ test = true;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.4.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.4.qml
new file mode 100644
index 0000000000..9c5e950660
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.4.qml
@@ -0,0 +1,27 @@
+import Test 1.0
+import QtQuick 2.0
+
+BindingsSpliceCorrectlyType4 {
+ property bool test: false
+
+ property int dataProperty2: 8
+
+ point.x: dataProperty2
+
+ Component.onCompleted: {
+ if (point.x != 8) return;
+ if (point.y != 4) return;
+
+ dataProperty = 9;
+
+ if (point.x != 8) return;
+ if (point.y != 4) return;
+
+ dataProperty2 = 13;
+
+ if (point.x != 13) return;
+ if (point.y != 4) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.5.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.5.qml
new file mode 100644
index 0000000000..7d87ba1782
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.5.qml
@@ -0,0 +1,27 @@
+import Test 1.0
+import QtQuick 2.0
+
+BindingsSpliceCorrectlyType5 {
+ property bool test: false
+
+ property int dataProperty2: 8
+
+ point: Qt.point(dataProperty2, dataProperty2);
+
+ Component.onCompleted: {
+ if (point.x != 8) return;
+ if (point.y != 8) return;
+
+ dataProperty = 9;
+
+ if (point.x != 8) return;
+ if (point.y != 8) return;
+
+ dataProperty2 = 13;
+
+ if (point.x != 13) return;
+ if (point.y != 13) return;
+
+ test = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml
new file mode 100644
index 0000000000..8701dae612
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml
@@ -0,0 +1,37 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_r: color.r
+ property real v_g: color.g
+ property real v_b: color.b
+ property real v_a: color.a
+ property variant copy: color
+ property string colorToString: color.toString()
+
+ // compare different colors
+ property bool colorEqualsIdenticalRgba: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // true
+ property bool colorEqualsDifferentAlpha: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44)) // false
+ property bool colorEqualsDifferentRgba: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44)) // false
+
+ // compare different color.toString()s
+ property bool colorToStringEqualsColorString: (color.toString() == colorToString) // true
+ property bool colorToStringEqualsDifferentAlphaString: (color.toString() == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // true
+ property bool colorToStringEqualsDifferentRgbaString: (color.toString() == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false
+
+ // compare colors to strings
+ property bool colorEqualsColorString: (color == colorToString) // false
+ property bool colorEqualsDifferentAlphaString: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // false
+ property bool colorEqualsDifferentRgbaString: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false
+
+ // compare colors to various value types
+ property bool equalsColor: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // true
+ property bool equalsVector3d: (color == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (color == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (color == Qt.point(10, 4)) // false
+ property bool equalsRect: (color == Qt.rect(2, 3, 109, 102)) // false
+
+ // ensure comparison directionality doesn't matter
+ property bool equalsColorRHS: (Qt.rgba(0.2, 0.88, 0.6, 0.34) == color) // true
+ property bool colorEqualsCopy: (color == copy) // true
+ property bool copyEqualsColor: (copy == color) // true
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/color_read.qml b/tests/auto/qml/qqmlvaluetypes/data/color_read.qml
new file mode 100644
index 0000000000..bc92b1e5f9
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/color_read.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_r: color.r
+ property real v_g: color.g
+ property real v_b: color.b
+ property real v_a: color.a
+ property variant copy: color
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/color_write.qml b/tests/auto/qml/qqmlvaluetypes/data/color_write.qml
new file mode 100644
index 0000000000..3f1bad4aa6
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/color_write.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ color.r: if (true) 0.5
+ color.g: if (true) 0.38
+ color.b: if (true) 0.3
+ color.a: if (true) 0.7
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml
new file mode 100644
index 0000000000..923922c55a
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 800
+ height: 600
+
+ property alias font: myText.font
+
+ property int myPixelSize: 12
+ property int myPixelSize2: 24
+
+ Text {
+ id: other
+ font.pixelSize: 6
+ }
+
+ Text {
+ id: myText
+
+ text: "Hello world!"
+ font.pixelSize: myPixelSize
+ }
+
+ states: State {
+ name: "Swapped"
+ PropertyChanges {
+ target: myText
+ font: other.font
+ }
+ }
+
+ function toggle() {
+ if (root.state == "") root.state = "Swapped"; else root.state = "";
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";}
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml
new file mode 100644
index 0000000000..9804af4df6
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 800
+ height: 600
+
+ property alias font: myText.font
+
+ property int myPixelSize: 12
+ property int myPixelSize2: 24
+
+ Text {
+ id: other
+ font.pixelSize: 6
+ }
+
+ Text {
+ id: myText
+
+ text: "Hello world!"
+ font: other.font
+ }
+
+ states: State {
+ name: "Swapped"
+ PropertyChanges {
+ target: myText
+ font.pixelSize: myPixelSize
+ }
+ }
+
+ function toggle() {
+ if (root.state == "") root.state = "Swapped"; else root.state = "";
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";}
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml
new file mode 100644
index 0000000000..b5bb7f8ccc
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 800
+ height: 600
+
+ property alias font: myText.font
+
+ property int myPixelSize: 12
+ property int myPixelSize2: 24
+
+ Text {
+ id: other
+ font.pixelSize: 6
+ }
+
+ Text {
+ id: myText
+
+ text: "Hello world!"
+ font.pixelSize: myPixelSize
+ }
+
+ states: State {
+ name: "Swapped"
+ PropertyChanges {
+ target: myText
+ font.pixelSize: myPixelSize2
+ }
+ }
+
+ function toggle() {
+ if (root.state == "") root.state = "Swapped"; else root.state = "";
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";}
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/deletedObject.js b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.js
new file mode 100644
index 0000000000..af298ffbd0
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.js
@@ -0,0 +1,13 @@
+var savedReference;
+
+function startup()
+{
+ savedReference = object.rect;
+ console.log("Test: " + savedReference.x);
+}
+
+function afterDelete()
+{
+ console.log("Test: " + savedReference.x);
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/deletedObject.qml b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.qml
new file mode 100644
index 0000000000..4f7ad39db0
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.qml
@@ -0,0 +1,11 @@
+import Test 1.0
+import QtQuick 2.0
+import "deletedObject.js" as JS
+
+MyTypeObject {
+ property variant object
+
+ object: MyTypeObject {}
+ Component.onCompleted: JS.startup()
+ onRunScript: JS.afterDelete()
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.1.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.1.qml
new file mode 100644
index 0000000000..cb01a80669
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/enums.1.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ font.capitalization: "AllUppercase"
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.2.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.2.qml
new file mode 100644
index 0000000000..93f1ed59bc
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/enums.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ font.capitalization: if (1) "AllUppercase"
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.3.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.3.qml
new file mode 100644
index 0000000000..cc7861a122
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/enums.3.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ font.capitalization: Font.AllUppercase
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.4.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.4.qml
new file mode 100644
index 0000000000..cf41c90b90
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/enums.4.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+import QtQuick 2.0 as MyQt
+
+MyTypeObject {
+ font.capitalization: MyQt.Font.AllUppercase
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.5.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.5.qml
new file mode 100644
index 0000000000..de279dba6c
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/enums.5.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+import QtQuick 2.0 as MyQt
+
+MyTypeObject {
+ MyQt.Component.onCompleted: {
+ font.capitalization = MyQt.Font.AllUppercase
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/font_compare.qml
new file mode 100644
index 0000000000..efbb0e3d0b
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_compare.qml
@@ -0,0 +1,31 @@
+import Test 1.0
+
+MyTypeObject {
+ property string f_family: font.family
+ property bool f_bold: font.bold
+ property int f_weight: font.weight
+ property bool f_italic: font.italic
+ property bool f_underline: font.underline
+ property bool f_overline: font.overline
+ property bool f_strikeout: font.strikeout
+ property real f_pointSize: font.pointSize
+ property int f_pixelSize: font.pixelSize
+ property int f_capitalization: font.capitalization
+ property real f_letterSpacing: font.letterSpacing
+ property real f_wordSpacing: font.wordSpacing;
+ property variant copy: font
+ property string tostring: font.toString()
+
+ // compare to string
+ property bool equalsString: (font == tostring)
+
+ // compare fonts to various value types
+ property bool equalsColor: (font == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (font == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (font == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (font == Qt.point(10, 4)) // false
+ property bool equalsRect: (font == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (font == font) // true
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_read.qml b/tests/auto/qml/qqmlvaluetypes/data/font_read.qml
new file mode 100644
index 0000000000..d73bb132d3
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_read.qml
@@ -0,0 +1,18 @@
+import Test 1.0
+
+MyTypeObject {
+ property string f_family: font.family
+ property bool f_bold: font.bold
+ property int f_weight: font.weight
+ property bool f_italic: font.italic
+ property bool f_underline: font.underline
+ property bool f_overline: font.overline
+ property bool f_strikeout: font.strikeout
+ property real f_pointSize: font.pointSize
+ property int f_pixelSize: font.pixelSize
+ property int f_capitalization: font.capitalization
+ property real f_letterSpacing: font.letterSpacing
+ property real f_wordSpacing: font.wordSpacing;
+ property variant copy: font
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.2.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.2.qml
new file mode 100644
index 0000000000..b559389efb
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ font.pixelSize: 10
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.3.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.3.qml
new file mode 100644
index 0000000000..913ac50738
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.3.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ font.pixelSize: 10
+ font.pointSize: 19
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.4.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.4.qml
new file mode 100644
index 0000000000..2ec69d7281
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.4.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ font.pointSize: 19
+ font.pixelSize: 10
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.5.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.5.qml
new file mode 100644
index 0000000000..5297a8260d
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.5.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Test 1.0
+
+Item {
+ MyTypeObject {
+ objectName: "object1"
+ font.pixelSize: 19
+ }
+ MyTypeObject {
+ objectName: "object2"
+ font.pointSize: 14
+ }
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml
new file mode 100644
index 0000000000..ff4d0a1004
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml
@@ -0,0 +1,16 @@
+import Test 1.0
+
+MyTypeObject {
+ font.family: if(1) "Helvetica"
+ font.bold: if(1) false
+ font.weight: "Normal"
+ font.italic: if(1) false
+ font.underline: if(1) false
+ font.overline: if(1) false
+ font.strikeout: if(1) false
+ font.pointSize: if(1) 15
+ font.capitalization: "AllLowercase"
+ font.letterSpacing: if(1) 9.7
+ font.wordSpacing: if(1) 11.2
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_component.qml b/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_component.qml
new file mode 100644
index 0000000000..7b8b587542
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_component.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyColorObject {
+ color: "#8000FF"
+ MyFloatSetInterceptor on color.r {}
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_ignore.qml b/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_ignore.qml
new file mode 100644
index 0000000000..f1a498cb67
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_ignore.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyColorObject {
+ color: "#8000FF"
+ MyFloatIgnoreInterceptor on color.r {}
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_value.qml b/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_value.qml
new file mode 100644
index 0000000000..1d6194c041
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/grouped_interceptors_value.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+
+MyColorObject {
+ color.r: 0.1
+ color.g: 0.2
+ color.b: 0.3
+ color.a: 0.4
+
+ MyColorInterceptor on color {}
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/initializeByWrite.qml b/tests/auto/qml/qqmlvaluetypes/data/initializeByWrite.qml
new file mode 100644
index 0000000000..8493dd4d7e
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/initializeByWrite.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+ListView {
+ property bool test: false
+
+ width: 200
+ height: 200
+ model: 20
+
+ delegate: Text {
+ text: qsTr(props.titleText).arg(index)
+ color: props.titleColor
+ font.pointSize: props.titlePointSize
+ }
+
+ property QtObject props: QtObject {
+ property string titleText: "List Item %1 Title"
+ property color titleColor: Qt.rgba(1, 0, 0, 0)
+ property int titlePointSize: 18
+ }
+
+ Component.onCompleted: {
+ test = (props.titleText == "List Item %1 Title") &&
+ (props.titleColor == Qt.rgba(1, 0, 0, 0)) &&
+ (props.titlePointSize == 18)
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_compare.qml
new file mode 100644
index 0000000000..94292302cc
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_compare.qml
@@ -0,0 +1,35 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_m11: matrix.m11
+ property real v_m12: matrix.m12
+ property real v_m13: matrix.m13
+ property real v_m14: matrix.m14
+ property real v_m21: matrix.m21
+ property real v_m22: matrix.m22
+ property real v_m23: matrix.m23
+ property real v_m24: matrix.m24
+ property real v_m31: matrix.m31
+ property real v_m32: matrix.m32
+ property real v_m33: matrix.m33
+ property real v_m34: matrix.m34
+ property real v_m41: matrix.m41
+ property real v_m42: matrix.m42
+ property real v_m43: matrix.m43
+ property real v_m44: matrix.m44
+ property variant copy: matrix
+ property string tostring: matrix.toString()
+
+ // compare to string
+ property bool equalsString: (matrix == tostring)
+
+ // compare matrix4x4s to various value types
+ property bool equalsColor: (matrix == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (matrix == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (matrix == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (matrix == Qt.point(10, 4)) // false
+ property bool equalsRect: (matrix == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (matrix == matrix) // true
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_invokables.qml b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_invokables.qml
new file mode 100644
index 0000000000..aa26956922
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_invokables.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ property variant m1: Qt.matrix4x4(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)
+ property variant m2: Qt.matrix4x4(5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8)
+ property variant m3: Qt.matrix4x4(123,22,6,42,55,54,67,77,777,1,112,22,55,6696,77,777)
+ property variant v1: Qt.vector4d(1,2,3,4)
+ property variant v2: Qt.vector3d(1,2,3)
+ property real factor: 2.23
+
+ Component.onCompleted: {
+ success = true;
+ if (m1.times(m2) != Qt.matrix4x4(26, 26, 26, 26, 52, 52, 52, 52, 78, 78, 78, 78, 104, 104, 104, 104)) success = false;
+ if (m1.times(v1) != Qt.vector4d(10, 20, 30, 40)) success = false;
+ if (m1.times(v2) != Qt.vector3d(0.25, 0.5, 0.75)) success = false;
+ if (!m1.times(factor).fuzzyEquals(Qt.matrix4x4(2.23, 2.23, 2.23, 2.23, 4.46, 4.46, 4.46, 4.46, 6.69, 6.69, 6.69, 6.69, 8.92, 8.92, 8.92, 8.92))) success = false;
+ if (m1.plus(m2) != Qt.matrix4x4(6, 6, 6, 6, 8, 8, 8, 8, 10, 10, 10, 10, 12, 12, 12, 12)) success = false;
+ if (m2.minus(m1) != Qt.matrix4x4(4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4)) success = false;
+ if (m1.row(2) != Qt.vector4d(3,3,3,3)) success = false;
+ if (m1.column(2) != Qt.vector4d(1,2,3,4)) success = false;
+ if (m1.determinant() != 0) success = false;
+ if (m3.determinant() != -15260238498) success = false;
+ if (m1.inverted() != Qt.matrix4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)) success = false; // non-invertible
+ if (!m3.inverted().fuzzyEquals(Qt.matrix4x4(0.0028384, -0.00188321, 0.000970577, 0.00000571656, -0.00206701, -0.000598587, 0.000358192, 0.000160908, -0.0235917, 0.0122695, 0.00286765, -0.0000218643, 0.01995, 0.00407588, -0.00343969, -0.000097903), 0.00001)) success = false;
+ if (m1.transposed() != Qt.matrix4x4(1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4)) success = false;
+ if (m1.fuzzyEquals(m2)) success = false;
+ if (!m1.fuzzyEquals(m2, 10)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_read.qml b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_read.qml
new file mode 100644
index 0000000000..6c4a68258c
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_read.qml
@@ -0,0 +1,22 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_m11: matrix.m11
+ property real v_m12: matrix.m12
+ property real v_m13: matrix.m13
+ property real v_m14: matrix.m14
+ property real v_m21: matrix.m21
+ property real v_m22: matrix.m22
+ property real v_m23: matrix.m23
+ property real v_m24: matrix.m24
+ property real v_m31: matrix.m31
+ property real v_m32: matrix.m32
+ property real v_m33: matrix.m33
+ property real v_m34: matrix.m34
+ property real v_m41: matrix.m41
+ property real v_m42: matrix.m42
+ property real v_m43: matrix.m43
+ property real v_m44: matrix.m44
+ property variant copy: matrix
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_write.qml b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_write.qml
new file mode 100644
index 0000000000..2a9f154d6f
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_write.qml
@@ -0,0 +1,21 @@
+import Test 1.0
+
+MyTypeObject {
+ matrix.m11: if (true) 11
+ matrix.m12: if (true) 12
+ matrix.m13: if (true) 13
+ matrix.m14: if (true) 14
+ matrix.m21: if (true) 21
+ matrix.m22: if (true) 22
+ matrix.m23: if (true) 23
+ matrix.m24: if (true) 24
+ matrix.m31: if (true) 31
+ matrix.m32: if (true) 32
+ matrix.m33: if (true) 33
+ matrix.m34: if (true) 34
+ matrix.m41: if (true) 41
+ matrix.m42: if (true) 42
+ matrix.m43: if (true) 43
+ matrix.m44: if (true) 44
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/nonValueTypeComparison.qml b/tests/auto/qml/qqmlvaluetypes/data/nonValueTypeComparison.qml
new file mode 100644
index 0000000000..0ffa5eb666
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/nonValueTypeComparison.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ property variant somepoint: Qt.point(1,2)
+ property variant randomjsobj: {"some": 1, "thing": 2}
+ property bool test1: somepoint != randomjsobj
+
+ property variant similar: {"x":1, "y":2}
+ property bool test2: somepoint != similar
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/point_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/point_compare.qml
new file mode 100644
index 0000000000..c0041b4bb1
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/point_compare.qml
@@ -0,0 +1,22 @@
+import Test 1.0
+
+MyTypeObject {
+ property int p_x: point.x
+ property int p_y: point.y
+ property variant copy: point
+ property string tostring: point.toString()
+
+ // compare to string
+ property bool equalsString: (point == tostring)
+
+ // compare points to various value types
+ property bool equalsColor: (point == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (point == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (point == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (point == Qt.point(10, 4)) // true
+ property bool equalsRect: (point == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (point == point) // true
+ property bool equalsOther: (point == Qt.point(15, 4)) // false
+ property bool pointEqualsPointf: (point == pointfpoint) // true
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/point_read.qml b/tests/auto/qml/qqmlvaluetypes/data/point_read.qml
new file mode 100644
index 0000000000..4bb6c5384c
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/point_read.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ property int p_x: point.x
+ property int p_y: point.y
+ property variant copy: point
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/point_write.qml b/tests/auto/qml/qqmlvaluetypes/data/point_write.qml
new file mode 100644
index 0000000000..063525a6f0
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/point_write.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ point.x: if (true) 11
+ point.y: if (true) 12
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/pointf_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/pointf_compare.qml
new file mode 100644
index 0000000000..0d70137934
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/pointf_compare.qml
@@ -0,0 +1,22 @@
+import Test 1.0
+
+MyTypeObject {
+ property int p_x: point.x
+ property int p_y: point.y
+ property variant copy: point
+ property string tostring: pointf.toString()
+
+ // compare to string
+ property bool equalsString: (pointf == tostring)
+
+ // compare pointfs to various value types
+ property bool equalsColor: (pointf == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (pointf == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (pointf == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (pointf == Qt.point(11.3, -10.9)) // true
+ property bool equalsRect: (pointf == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (pointf == pointf) // true
+ property bool equalsOther: (pointf == Qt.point(6.3, -4.9)) // false
+ property bool pointfEqualsPoint: (pointfpoint == point) // true
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/pointf_read.qml b/tests/auto/qml/qqmlvaluetypes/data/pointf_read.qml
new file mode 100644
index 0000000000..0eab6daabe
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/pointf_read.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ property real p_x: pointf.x
+ property real p_y: pointf.y
+ property variant copy: pointf
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/pointf_write.qml b/tests/auto/qml/qqmlvaluetypes/data/pointf_write.qml
new file mode 100644
index 0000000000..9ee3fc1bda
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/pointf_write.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ pointf.x: if (true) 6.8
+ pointf.y: if (true) 9.3
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/quaternion_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/quaternion_compare.qml
new file mode 100644
index 0000000000..0e82f596af
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/quaternion_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_scalar: quaternion.scalar
+ property real v_x: quaternion.x
+ property real v_y: quaternion.y
+ property real v_z: quaternion.z
+ property variant copy: quaternion
+ property string tostring: quaternion.toString()
+
+ // compare to string
+ property bool equalsString: (quaternion == tostring)
+
+ // compare quaternions to various value types
+ property bool equalsColor: (quaternion == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (quaternion == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (quaternion == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (quaternion == Qt.point(10, 4)) // false
+ property bool equalsRect: (quaternion == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (quaternion == quaternion) // true
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/quaternion_read.qml b/tests/auto/qml/qqmlvaluetypes/data/quaternion_read.qml
new file mode 100644
index 0000000000..d1a21dc926
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/quaternion_read.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_scalar: quaternion.scalar
+ property real v_x: quaternion.x
+ property real v_y: quaternion.y
+ property real v_z: quaternion.z
+ property variant copy: quaternion
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/quaternion_write.qml b/tests/auto/qml/qqmlvaluetypes/data/quaternion_write.qml
new file mode 100644
index 0000000000..0c3e5afd98
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/quaternion_write.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ quaternion.scalar: if (true) 88.5
+ quaternion.x: if (true) -0.3
+ quaternion.y: if (true) -12.9
+ quaternion.z: if (true) 907.4
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/rect_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/rect_compare.qml
new file mode 100644
index 0000000000..c511c2dfc4
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/rect_compare.qml
@@ -0,0 +1,25 @@
+import Test 1.0
+
+MyTypeObject {
+ property int r_x: rect.x
+ property int r_y: rect.y
+ property int r_width: rect.width
+ property int r_height: rect.height
+ property variant copy: rect
+ property string tostring: rect.toString()
+
+ // compare to string
+ property bool equalsString: (rect == tostring)
+
+ // compare rects to various value types
+ property bool equalsColor: (rect == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (rect == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (rect == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (rect == Qt.point(10, 4)) // false
+ property bool equalsRect: (rect == Qt.rect(2, 3, 109, 102)) // true
+
+ property bool equalsSelf: (rect == rect) // true
+ property bool equalsOther: (rect == Qt.rect(6, 9, 99, 92)) // false
+ property bool rectEqualsRectf: (rect == rectfrect) // true
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/rect_read.qml b/tests/auto/qml/qqmlvaluetypes/data/rect_read.qml
new file mode 100644
index 0000000000..c3b37a7099
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/rect_read.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+
+MyTypeObject {
+ property int r_x: rect.x
+ property int r_y: rect.y
+ property int r_width: rect.width
+ property int r_height: rect.height
+ property variant copy: rect
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/rect_write.qml b/tests/auto/qml/qqmlvaluetypes/data/rect_write.qml
new file mode 100644
index 0000000000..8add45305c
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/rect_write.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ rect.x: if (true) 1234
+ rect.y: if (true) 7
+ rect.width: if (true) 56
+ rect.height: if (true) 63
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/rectf_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/rectf_compare.qml
new file mode 100644
index 0000000000..6ac4049558
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/rectf_compare.qml
@@ -0,0 +1,25 @@
+import Test 1.0
+
+MyTypeObject {
+ property real r_x: rectf.x
+ property real r_y: rectf.y
+ property real r_width: rectf.width
+ property real r_height: rectf.height
+ property variant copy: rectf
+ property string tostring: rectf.toString()
+
+ // compare to string
+ property bool equalsString: (rectf == tostring)
+
+ // compare rectfs to various value types
+ property bool equalsColor: (rectf == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (rectf == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (rectf == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (rectf == Qt.point(10, 4)) // false
+ property bool equalsRect: (rectf == Qt.rect(103.8, 99.2, 88.1, 77.6)) // true
+
+ property bool equalsSelf: (rectf == rectf) // true
+ property bool equalsOther: (rectf == Qt.rect(13.8, 9.2, 78.7, 96.2)) // false
+ property bool rectfEqualsRect: (rectfrect == rect) // true
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/rectf_read.qml b/tests/auto/qml/qqmlvaluetypes/data/rectf_read.qml
new file mode 100644
index 0000000000..6ff3ce30bf
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/rectf_read.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+
+MyTypeObject {
+ property real r_x: rectf.x
+ property real r_y: rectf.y
+ property real r_width: rectf.width
+ property real r_height: rectf.height
+ property variant copy: rectf
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/rectf_write.qml b/tests/auto/qml/qqmlvaluetypes/data/rectf_write.qml
new file mode 100644
index 0000000000..1e6ff4ff90
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/rectf_write.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ rectf.x: if (true) 70.1
+ rectf.y: if (true) -113.2
+ rectf.width: if (true) 80924.8
+ rectf.height: if (true) 99.2
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/returnValues.qml b/tests/auto/qml/qqmlvaluetypes/data/returnValues.qml
new file mode 100644
index 0000000000..1f9816f666
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/returnValues.qml
@@ -0,0 +1,17 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ property bool test1: false;
+ property bool test2: false;
+
+ Component.onCompleted: {
+ var a = method();
+
+ test1 = (a.width == 13)
+ test2 = (a.height == 14)
+
+ size = a;
+ }
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/scriptAccess.qml b/tests/auto/qml/qqmlvaluetypes/data/scriptAccess.qml
new file mode 100644
index 0000000000..cbecb4379a
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/scriptAccess.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Test 1.0
+
+MyTypeObject {
+ property int valuePre;
+ property int valuePost;
+
+ Component.onCompleted: { valuePre = rect.x; rect.x = 19; valuePost = rect.x; }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/scriptVariantCopy.qml b/tests/auto/qml/qqmlvaluetypes/data/scriptVariantCopy.qml
new file mode 100644
index 0000000000..42fccfac5a
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/scriptVariantCopy.qml
@@ -0,0 +1,14 @@
+import Test 1.0
+
+MyTypeObject {
+ property variant object
+ object: MyTypeObject {
+ rect.x: 19
+ rect.y: 33
+ rect.width: 5
+ rect.height: 99
+ }
+
+ onRunScript: rect = object.rect
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/size_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/size_compare.qml
new file mode 100644
index 0000000000..1fd4711c15
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/size_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property int s_width: size.width
+ property int s_height: size.height
+ property variant copy: size
+ property string tostring: size.toString()
+
+ // compare to string
+ property bool equalsString: (size == tostring)
+
+ // compare sizes to various value types
+ property bool equalsColor: (size == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (size == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (size == Qt.size(1912, 1913)) // true
+ property bool equalsPoint: (size == Qt.point(10, 4)) // false
+ property bool equalsRect: (size == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (size == size) // true
+ property bool equalsOther: (size == Qt.size(1212, 1313)) // false
+ property bool sizeEqualsSizef: (size == sizefsize) // true
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/size_read.qml b/tests/auto/qml/qqmlvaluetypes/data/size_read.qml
new file mode 100644
index 0000000000..a49fd9f760
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/size_read.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ property int s_width: size.width
+ property int s_height: size.height
+ property variant copy: size
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/size_write.qml b/tests/auto/qml/qqmlvaluetypes/data/size_write.qml
new file mode 100644
index 0000000000..2f9d10e45f
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/size_write.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ size.width: if (true) 13
+ size.height: if (true) 88
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizef_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/sizef_compare.qml
new file mode 100644
index 0000000000..c74a049454
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizef_compare.qml
@@ -0,0 +1,24 @@
+import Test 1.0
+
+MyTypeObject {
+ property real s_width: sizef.width
+ property real s_height: sizef.height
+ property variant copy: sizef
+ property string tostring: sizef.toString()
+
+ // compare to string
+ property bool equalsString: (sizef == tostring)
+
+ // compare sizefs to various value types
+ property bool equalsColor: (sizef == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (sizef == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (sizef == Qt.size(0.1, 100923.2)) // true
+ property bool equalsPoint: (sizef == Qt.point(10, 4)) // false
+ property bool equalsRect: (sizef == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (sizef == sizef) // true
+ property bool equalsOther: (size == Qt.size(3.1, 923.2)) // false
+ property bool sizefEqualsSize: (sizefsize == size) // true
+}
+
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizef_read.qml b/tests/auto/qml/qqmlvaluetypes/data/sizef_read.qml
new file mode 100644
index 0000000000..96cd425f17
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizef_read.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ property real s_width: sizef.width
+ property real s_height: sizef.height
+ property variant copy: sizef
+}
+
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizef_write.qml b/tests/auto/qml/qqmlvaluetypes/data/sizef_write.qml
new file mode 100644
index 0000000000..f16f0bdf93
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizef_write.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ sizef.width: if (true) 44.3
+ sizef.height: if (true) 92.8
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_read.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_read.qml
new file mode 100644
index 0000000000..7f708a0899
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_read.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ property int s_width: sizereadonly.width
+ property int s_height: sizereadonly.height
+ property variant copy: sizereadonly
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror.qml
new file mode 100644
index 0000000000..3254557014
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ sizereadonly: "13x88"
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror2.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror2.qml
new file mode 100644
index 0000000000..656d718b05
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror2.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ sizereadonly.width: if (true) 13
+ sizereadonly.height: if (true) 88
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror3.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror3.qml
new file mode 100644
index 0000000000..b8e3f0d41b
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror3.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ sizereadonly.width: 13
+ sizereadonly.height: 88
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror4.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror4.qml
new file mode 100644
index 0000000000..68b54b571e
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror4.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+import QtQuick 2.0
+
+MyTypeObject {
+ Component.onCompleted: {
+ sizereadonly.width = 13;
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/staticAssignment.qml b/tests/auto/qml/qqmlvaluetypes/data/staticAssignment.qml
new file mode 100644
index 0000000000..b687f89eef
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/staticAssignment.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ rect.x: 9
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/valueInterceptors.qml b/tests/auto/qml/qqmlvaluetypes/data/valueInterceptors.qml
new file mode 100644
index 0000000000..0897847d2d
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/valueInterceptors.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ property int value: 13;
+
+ MyOffsetValueInterceptor on rect.x {}
+ rect.x: value
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/valueSources.qml b/tests/auto/qml/qqmlvaluetypes/data/valueSources.qml
new file mode 100644
index 0000000000..717f3502c0
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/valueSources.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ MyConstantValueSource on rect.x {}
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/varAssignment.qml b/tests/auto/qml/qqmlvaluetypes/data/varAssignment.qml
new file mode 100644
index 0000000000..9b56abbbed
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/varAssignment.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ property int x;
+ property int y;
+ property int z;
+
+ Component.onCompleted: {
+ var vec3 = Qt.vector3d(1, 2, 3);
+ x = vec3.x;
+ y = vec3.y;
+ z = vec3.z;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/variant_read.qml b/tests/auto/qml/qqmlvaluetypes/data/variant_read.qml
new file mode 100644
index 0000000000..a08f3db94f
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/variant_read.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ property real s_width: variant.width
+ property real s_height: variant.height
+ property variant copy: variant
+}
+
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml b/tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml
new file mode 100644
index 0000000000..6063917dd4
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/variant_write.1.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ property bool complete: false
+ property bool success: false
+
+ property variant v1: Qt.vector3d(1,2,3)
+ property variant v2: Qt.vector3d(4,5,6)
+ property variant v3: v1.plus(v2) // set up doomed binding
+
+ Component.onCompleted: {
+ complete = false;
+ success = true;
+
+ v1 = Qt.vector2d(1,2) // changing the type of the property shouldn't cause crash
+
+ v1.x = 8;
+ v2.x = 9;
+
+ if (v1 != Qt.vector2d(8,2)) success = false;
+ if (v2 != Qt.vector3d(9,5,6)) success = false;
+
+ complete = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/variant_write.2.qml b/tests/auto/qml/qqmlvaluetypes/data/variant_write.2.qml
new file mode 100644
index 0000000000..0dbfd2a012
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/variant_write.2.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ property bool complete: false
+ property bool success: false
+
+ property variant v1
+
+ Component.onCompleted: {
+ complete = false;
+ success = true;
+
+ // store a js reference to the VariantReference vt in a temp var.
+ v1 = Qt.vector3d(1,2,3)
+ var ref = v1;
+ ref.z = 5
+ if (v1 != Qt.vector3d(1,2,5)) success = false;
+
+ // now change the type of a reference, and attempt a valid write.
+ v1 = Qt.vector2d(1,2);
+ ref.x = 5;
+ if (v1 != Qt.vector2d(5,2)) success = false;
+
+ // now change the type of a reference, and attempt an invalid write.
+ v1 = Qt.rgba(1,0,0,1);
+ ref.x = 5;
+ if (v1.toString() != Qt.rgba(1,0,0,1).toString()) success = false;
+ v1 = 6;
+ ref.x = 5;
+ if (v1 != 6) success = false;
+
+ // now change the type of a reference, and attempt an invalid read.
+ v1 = Qt.vector3d(1,2,3);
+ ref = v1;
+ v1 = Qt.vector2d(1,2);
+ if (ref.z == 3) success = false;
+
+ complete = true;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector2d_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/vector2d_compare.qml
new file mode 100644
index 0000000000..eb8fb5bb76
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector2d_compare.qml
@@ -0,0 +1,21 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector2.x
+ property real v_y: vector2.y
+ property variant copy: vector2
+ property string tostring: vector2.toString()
+
+ // compare to string
+ property bool equalsString: (vector2 == tostring)
+
+ // compare vector2ds to various value types
+ property bool equalsColor: (vector2 == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (vector2 == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (vector2 == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (vector2 == Qt.point(10, 4)) // false
+ property bool equalsRect: (vector2 == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (vector2 == vector2)
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector2d_invokables.qml b/tests/auto/qml/qqmlvaluetypes/data/vector2d_invokables.qml
new file mode 100644
index 0000000000..9f84a50950
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector2d_invokables.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ property variant v1: Qt.vector2d(1,2)
+ property variant v2: Qt.vector2d(5,6)
+ property real factor: 2.23
+
+ Component.onCompleted: {
+ success = true;
+ if (v1.times(v2) != Qt.vector2d(5, 12)) success = false;
+ if (v1.times(factor) != Qt.vector2d(2.23, 4.46)) success = false;
+ if (v1.plus(v2) != Qt.vector2d(6, 8)) success = false;
+ if (v2.minus(v1) != Qt.vector2d(4, 4)) success = false;
+ if (!v1.normalized().fuzzyEquals(Qt.vector2d(0.447214, 0.894427), 0.000001)) success = false;
+ if ((v1.length() == v2.length()) || (v1.length() != Qt.vector2d(2,1).length())) success = false;
+ if (v1.toVector3d() != Qt.vector3d(1,2,0)) success = false;
+ if (v1.toVector4d() != Qt.vector4d(1,2,0,0)) success = false;
+ if (v1.fuzzyEquals(v2)) success = false;
+ if (!v1.fuzzyEquals(v2, 4)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector2d_read.qml b/tests/auto/qml/qqmlvaluetypes/data/vector2d_read.qml
new file mode 100644
index 0000000000..fc315f7abf
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector2d_read.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector2.x
+ property real v_y: vector2.y
+ property variant copy: vector2
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector2d_write.qml b/tests/auto/qml/qqmlvaluetypes/data/vector2d_write.qml
new file mode 100644
index 0000000000..f0e35ff200
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector2d_write.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+
+MyTypeObject {
+ vector2.x: if (true) -0.3
+ vector2.y: if (true) -12.9
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector3d_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/vector3d_compare.qml
new file mode 100644
index 0000000000..7bda1d17f4
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector3d_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector.x
+ property real v_y: vector.y
+ property real v_z: vector.z
+ property variant copy: vector
+ property string tostring: vector.toString()
+
+ // compare to string
+ property bool equalsString: (vector == tostring)
+
+ // compare vector3ds to various value types
+ property bool equalsColor: (vector == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (vector == Qt.vector3d(23.88, 3.1, 4.3)) // true
+ property bool equalsSize: (vector == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (vector == Qt.point(10, 4)) // false
+ property bool equalsRect: (vector == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (vector == vector) // true
+ property bool equalsOther: (vector == Qt.vector3d(3.1, 2.2, 923.2)) // false
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector3d_invokables.qml b/tests/auto/qml/qqmlvaluetypes/data/vector3d_invokables.qml
new file mode 100644
index 0000000000..48185f9089
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector3d_invokables.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ property variant v1: Qt.vector3d(1,2,3)
+ property variant v2: Qt.vector3d(5,6,7)
+ property variant m1: Qt.matrix4x4(5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8)
+ property real factor: 2.23
+
+ Component.onCompleted: {
+ success = true;
+ if (v1.times(v2) != Qt.vector3d(5, 12, 21)) success = false;
+ if (v1.times(m1) != Qt.vector3d(1, 1, 1)) success = false;
+ if (v1.times(factor) != Qt.vector3d(2.23, 4.46, 6.69)) success = false;
+ if (v1.plus(v2) != Qt.vector3d(6, 8, 10)) success = false;
+ if (v2.minus(v1) != Qt.vector3d(4, 4, 4)) success = false;
+ if (!v1.normalized().fuzzyEquals(Qt.vector3d(0.267261, 0.534522, 0.801784), 0.00001)) success = false;
+ if ((v1.length() == v2.length()) || (v1.length() != Qt.vector3d(3,2,1).length())) success = false;
+ if (v1.toVector2d() != Qt.vector2d(1,2)) success = false;
+ if (v1.toVector4d() != Qt.vector4d(1,2,3,0)) success = false;
+ if (v1.fuzzyEquals(v2)) success = false;
+ if (!v1.fuzzyEquals(v2, 4)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector3d_read.qml b/tests/auto/qml/qqmlvaluetypes/data/vector3d_read.qml
new file mode 100644
index 0000000000..f1e876dbb9
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector3d_read.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector.x
+ property real v_y: vector.y
+ property real v_z: vector.z
+ property variant copy: vector
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector3d_write.qml b/tests/auto/qml/qqmlvaluetypes/data/vector3d_write.qml
new file mode 100644
index 0000000000..9c1bf7620a
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector3d_write.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyTypeObject {
+ vector.x: if (true) -0.3
+ vector.y: if (true) -12.9
+ vector.z: if (true) 907.4
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector4d_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/vector4d_compare.qml
new file mode 100644
index 0000000000..3ea42a59ce
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector4d_compare.qml
@@ -0,0 +1,23 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector4.x
+ property real v_y: vector4.y
+ property real v_z: vector4.z
+ property real v_w: vector4.w
+ property variant copy: vector4
+ property string tostring: vector4.toString()
+
+ // compare to string
+ property bool equalsString: (vector4 == tostring)
+
+ // compare vector4ds to various value types
+ property bool equalsColor: (vector4 == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false
+ property bool equalsVector3d: (vector4 == Qt.vector3d(1, 2, 3)) // false
+ property bool equalsSize: (vector4 == Qt.size(1912, 1913)) // false
+ property bool equalsPoint: (vector4 == Qt.point(10, 4)) // false
+ property bool equalsRect: (vector4 == Qt.rect(2, 3, 109, 102)) // false
+
+ property bool equalsSelf: (vector4 == vector4) // true
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector4d_invokables.qml b/tests/auto/qml/qqmlvaluetypes/data/vector4d_invokables.qml
new file mode 100644
index 0000000000..c80ee0dc54
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector4d_invokables.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ property bool success: false
+
+ property variant v1: Qt.vector4d(1,2,3,4)
+ property variant v2: Qt.vector4d(5,6,7,8)
+ property variant m1: Qt.matrix4x4(5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8)
+ property real factor: 2.23
+
+ Component.onCompleted: {
+ success = true;
+ if (v1.times(v2) != Qt.vector4d(5, 12, 21, 32)) success = false;
+ if (v1.times(m1) != Qt.vector4d(70, 70, 70, 70)) success = false;
+ if (v1.times(factor) != Qt.vector4d(2.23, 4.46, 6.69, 8.92)) success = false;
+ if (v1.plus(v2) != Qt.vector4d(6, 8, 10, 12)) success = false;
+ if (v2.minus(v1) != Qt.vector4d(4, 4, 4, 4)) success = false;
+ if (!v1.normalized().fuzzyEquals(Qt.vector4d(0.182574, 0.365148, 0.547723, 0.730297), 0.00001)) success = false;
+ if ((v1.length() == v2.length()) || (v1.length() != Qt.vector4d(4,3,2,1).length())) success = false;
+ if (v1.toVector2d() != Qt.vector2d(1,2)) success = false;
+ if (v1.toVector3d() != Qt.vector3d(1,2,3)) success = false;
+ if (v1.fuzzyEquals(v2)) success = false;
+ if (!v1.fuzzyEquals(v2, 4)) success = false;
+ }
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector4d_read.qml b/tests/auto/qml/qqmlvaluetypes/data/vector4d_read.qml
new file mode 100644
index 0000000000..f9d5d6053e
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector4d_read.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+
+MyTypeObject {
+ property real v_x: vector4.x
+ property real v_y: vector4.y
+ property real v_z: vector4.z
+ property real v_w: vector4.w
+ property variant copy: vector4
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector4d_write.qml b/tests/auto/qml/qqmlvaluetypes/data/vector4d_write.qml
new file mode 100644
index 0000000000..548698126d
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/data/vector4d_write.qml
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyTypeObject {
+ vector4.x: if (true) -0.3
+ vector4.y: if (true) -12.9
+ vector4.z: if (true) 907.4
+ vector4.w: if (true) 88.5
+}
+
diff --git a/tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro b/tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro
new file mode 100644
index 0000000000..1d02773146
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/qqmlvaluetypes.pro
@@ -0,0 +1,17 @@
+CONFIG += testcase
+TARGET = tst_qqmlvaluetypes
+macx:CONFIG -= app_bundle
+
+HEADERS += testtypes.h
+
+SOURCES += tst_qqmlvaluetypes.cpp \
+ testtypes.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private gui testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlvaluetypes/testtypes.cpp b/tests/auto/qml/qqmlvaluetypes/testtypes.cpp
new file mode 100644
index 0000000000..8cec232746
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/testtypes.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+
+void registerTypes()
+{
+ qmlRegisterType<MyTypeObject>("Test", 1, 0, "MyTypeObject");
+ qmlRegisterType<MyConstantValueSource>("Test", 1, 0, "MyConstantValueSource");
+ qmlRegisterType<MyOffsetValueInterceptor>("Test", 1, 0, "MyOffsetValueInterceptor");
+ qmlRegisterType<MyColorObject>("Test", 1, 0, "MyColorObject");
+ qmlRegisterType<MyColorInterceptor>("Test", 1, 0, "MyColorInterceptor");
+ qmlRegisterType<MyFloatSetInterceptor>("Test", 1, 0, "MyFloatSetInterceptor");
+ qmlRegisterType<MyFloatIgnoreInterceptor>("Test", 1, 0, "MyFloatIgnoreInterceptor");
+}
diff --git a/tests/auto/qml/qqmlvaluetypes/testtypes.h b/tests/auto/qml/qqmlvaluetypes/testtypes.h
new file mode 100644
index 0000000000..3e5952f64d
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/testtypes.h
@@ -0,0 +1,279 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QObject>
+#include <QPoint>
+#include <QPointF>
+#include <QSize>
+#include <QSizeF>
+#include <QRect>
+#include <QRectF>
+#include <QVector2D>
+#include <QVector3D>
+#include <QVector4D>
+#include <QQuaternion>
+#include <QMatrix4x4>
+#include <QFont>
+#include <QColor>
+#include <qqml.h>
+#include <QQmlPropertyValueSource>
+#include <QQmlProperty>
+#include <private/qqmlproperty_p.h>
+#include <private/qqmlpropertyvalueinterceptor_p.h>
+
+class MyTypeObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed)
+ Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed)
+ Q_PROPERTY(QPointF pointfpoint READ pointfpoint WRITE setPointfpoint NOTIFY changed)
+ Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed)
+ Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed)
+ Q_PROPERTY(QSizeF sizefsize READ sizefsize WRITE setSizefsize NOTIFY changed)
+ Q_PROPERTY(QSize sizereadonly READ size NOTIFY changed)
+ Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed)
+ Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed)
+ Q_PROPERTY(QRectF rectfrect READ rectfrect WRITE setRectfrect NOTIFY changed)
+ Q_PROPERTY(QVector2D vector2 READ vector2 WRITE setVector2 NOTIFY changed)
+ Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed)
+ Q_PROPERTY(QVector4D vector4 READ vector4 WRITE setVector4 NOTIFY changed)
+ Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion NOTIFY changed)
+ Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY changed)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed)
+ Q_PROPERTY(QVariant variant READ variant NOTIFY changed)
+
+public:
+ MyTypeObject() :
+ m_point(10, 4),
+ m_pointf(11.3, -10.9),
+ m_pointfpoint(10.0, 4.0),
+ m_size(1912, 1913),
+ m_sizef(0.1, 100923.2),
+ m_sizefsize(1912.0, 1913.0),
+ m_rect(2, 3, 109, 102),
+ m_rectf(103.8, 99.2, 88.1, 77.6),
+ m_rectfrect(2.0, 3.0, 109.0, 102.0),
+ m_vector2(32.88, 1.3),
+ m_vector(23.88, 3.1, 4.3),
+ m_vector4(54.2, 23.88, 3.1, 4.3),
+ m_quaternion(4.3, 54.2, 23.88, 3.1),
+ m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
+ {
+ m_font.setFamily("Arial");
+ m_font.setBold(true);
+ m_font.setWeight(QFont::DemiBold);
+ m_font.setItalic(true);
+ m_font.setUnderline(true);
+ m_font.setOverline(true);
+ m_font.setStrikeOut(true);
+ m_font.setPointSize(29);
+ m_font.setCapitalization(QFont::AllLowercase);
+ m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2);
+ m_font.setWordSpacing(19.7);
+ m_color.setRedF(0.2);
+ m_color.setGreenF(0.88);
+ m_color.setBlueF(0.6);
+ m_color.setAlphaF(0.34);
+ }
+
+ QPoint m_point;
+ QPoint point() const { return m_point; }
+ void setPoint(const QPoint &v) { m_point = v; emit changed(); }
+
+ QPointF m_pointf;
+ QPointF pointf() const { return m_pointf; }
+ void setPointf(const QPointF &v) { m_pointf = v; emit changed(); }
+
+ QPointF m_pointfpoint;
+ QPointF pointfpoint() const { return m_pointfpoint; }
+ void setPointfpoint(const QPointF &v) { m_pointfpoint = v; emit changed(); }
+
+ QSize m_size;
+ QSize size() const { return m_size; }
+ void setSize(const QSize &v) { m_size = v; emit changed(); }
+
+ QSizeF m_sizef;
+ QSizeF sizef() const { return m_sizef; }
+ void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); }
+
+ QSizeF m_sizefsize;
+ QSizeF sizefsize() const { return m_sizefsize; }
+ void setSizefsize(const QSizeF &v) { m_sizefsize = v; emit changed(); }
+
+ QRect m_rect;
+ QRect rect() const { return m_rect; }
+ void setRect(const QRect &v) { m_rect = v; emit changed(); }
+
+ QRectF m_rectf;
+ QRectF rectf() const { return m_rectf; }
+ void setRectf(const QRectF &v) { m_rectf = v; emit changed(); }
+
+ QRectF m_rectfrect;
+ QRectF rectfrect() const { return m_rectfrect; }
+ void setRectfrect(const QRectF &v) { m_rectfrect = v; emit changed(); }
+
+ QVector2D m_vector2;
+ QVector2D vector2() const { return m_vector2; }
+ void setVector2(const QVector2D &v) { m_vector2 = v; emit changed(); }
+
+ QVector3D m_vector;
+ QVector3D vector() const { return m_vector; }
+ void setVector(const QVector3D &v) { m_vector = v; emit changed(); }
+
+ QVector4D m_vector4;
+ QVector4D vector4() const { return m_vector4; }
+ void setVector4(const QVector4D &v) { m_vector4 = v; emit changed(); }
+
+ QQuaternion m_quaternion;
+ QQuaternion quaternion() const { return m_quaternion; }
+ void setQuaternion(const QQuaternion &v) { m_quaternion = v; emit changed(); }
+
+ QMatrix4x4 m_matrix;
+ QMatrix4x4 matrix() const { return m_matrix; }
+ void setMatrix(const QMatrix4x4 &v) { m_matrix = v; emit changed(); }
+
+ QFont m_font;
+ QFont font() const { return m_font; }
+ void setFont(const QFont &v) { m_font = v; emit changed(); }
+
+ QColor m_color;
+ QColor color() const { return m_color; }
+ void setColor(const QColor &v) { m_color = v; emit changed(); }
+
+ QVariant variant() const { return sizef(); }
+
+ void emitRunScript() { emit runScript(); }
+
+signals:
+ void changed();
+ void runScript();
+
+public slots:
+ QSize method() { return QSize(13, 14); }
+};
+
+class MyConstantValueSource : public QObject, public QQmlPropertyValueSource
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueSource)
+public:
+ virtual void setTarget(const QQmlProperty &p) { p.write(3345); }
+};
+
+class MyOffsetValueInterceptor : public QObject, public QQmlPropertyValueInterceptor
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueInterceptor)
+public:
+ virtual void setTarget(const QQmlProperty &p) { prop = p; }
+ virtual void write(const QVariant &value) { QQmlPropertyPrivate::write(prop, value.toInt() + 13, QQmlPropertyPrivate::BypassInterceptor); }
+
+private:
+ QQmlProperty prop;
+};
+
+// This test interceptor deliberately swizzles RGBA -> ABGR
+class MyColorInterceptor : public QObject, public QQmlPropertyValueInterceptor
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueInterceptor)
+public:
+ virtual void setTarget(const QQmlProperty &p) { prop = p; }
+ virtual void write(const QVariant &v)
+ {
+ QColor c = v.value<QColor>();
+
+ int r, g, b, a;
+ c.getRgb(&r, &g, &b, &a);
+ c.setRgb(a, b, g, r);
+
+ QQmlPropertyPrivate::write(prop, c, QQmlPropertyPrivate::BypassInterceptor);
+ }
+
+private:
+ QQmlProperty prop;
+};
+
+class MyFloatSetInterceptor : public QObject, public QQmlPropertyValueInterceptor
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueInterceptor)
+public:
+ virtual void setTarget(const QQmlProperty &p) { prop = p; }
+ virtual void write(const QVariant &)
+ {
+ QQmlPropertyPrivate::write(prop, 0.0f, QQmlPropertyPrivate::BypassInterceptor);
+ }
+
+private:
+ QQmlProperty prop;
+};
+
+class MyFloatIgnoreInterceptor : public QObject, public QQmlPropertyValueInterceptor
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlPropertyValueInterceptor)
+public:
+ virtual void setTarget(const QQmlProperty &) {}
+ virtual void write(const QVariant &) {}
+};
+
+class MyColorObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+
+public:
+ MyColorObject() {}
+
+ QColor m_color;
+ QColor color() const { return m_color; }
+ void setColor(const QColor &v) { m_color = v; }
+};
+
+void registerTypes();
+
+#endif // TESTTYPES_H
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
new file mode 100644
index 0000000000..a8e598b11c
--- /dev/null
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -0,0 +1,1456 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QDebug>
+#include <private/qquickvaluetypes_p.h>
+#include "../../shared/util.h"
+#include "testtypes.h"
+
+QT_BEGIN_NAMESPACE
+extern int qt_defaultDpi(void);
+QT_END_NAMESPACE
+
+class tst_qqmlvaluetypes : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlvaluetypes() {}
+
+private slots:
+ void initTestCase();
+
+ void point();
+ void pointf();
+ void size();
+ void sizef();
+ void sizereadonly();
+ void rect();
+ void rectf();
+ void vector2d();
+ void vector3d();
+ void vector4d();
+ void quaternion();
+ void matrix4x4();
+ void font();
+ void color();
+ void variant();
+
+ void bindingAssignment();
+ void bindingRead();
+ void staticAssignment();
+ void scriptAccess();
+ void autoBindingRemoval();
+ void valueSources();
+ void valueInterceptors();
+ void bindingConflict();
+ void deletedObject();
+ void bindingVariantCopy();
+ void scriptVariantCopy();
+ void cppClasses();
+ void enums();
+ void conflictingBindings();
+ void returnValues();
+ void varAssignment();
+ void bindingsSpliceCorrectly();
+ void nonValueTypeComparison();
+ void initializeByWrite();
+ void groupedInterceptors();
+ void groupedInterceptors_data();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qqmlvaluetypes::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ registerTypes();
+}
+
+void tst_qqmlvaluetypes::point()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("point_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("p_x").toInt(), 10);
+ QCOMPARE(object->property("p_y").toInt(), 4);
+ QCOMPARE(object->property("copy"), QVariant(QPoint(10, 4)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("point_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->point(), QPoint(11, 12));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("point_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QPoint(10, 4)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), true);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("pointEqualsPointf").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::pointf()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("pointf_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(float(object->property("p_x").toDouble()), float(11.3));
+ QCOMPARE(float(object->property("p_y").toDouble()), float(-10.9));
+ QCOMPARE(object->property("copy"), QVariant(QPointF(11.3, -10.9)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("pointf_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->pointf(), QPointF(6.8, 9.3));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("pointf_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QPointF(11.3, -10.9)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), true);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("pointfEqualsPoint").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::size()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("size_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("s_width").toInt(), 1912);
+ QCOMPARE(object->property("s_height").toInt(), 1913);
+ QCOMPARE(object->property("copy"), QVariant(QSize(1912, 1913)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("size_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->size(), QSize(13, 88));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("size_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QSize(1912, 1913)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), true);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("sizeEqualsSizef").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::sizef()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("sizef_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(float(object->property("s_width").toDouble()), float(0.1));
+ QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2));
+ QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("sizef_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->sizef(), QSizeF(44.3, 92.8));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("sizef_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QSizeF(0.1, 100923)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), true);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("sizefEqualsSize").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::variant()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("variant_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(float(object->property("s_width").toDouble()), float(0.1));
+ QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2));
+ QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("variant_write.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("complete").toBool());
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("variant_write.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("complete").toBool());
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::sizereadonly()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("sizereadonly_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("s_width").toInt(), 1912);
+ QCOMPARE(object->property("s_height").toInt(), 1913);
+ QCOMPARE(object->property("copy"), QVariant(QSize(1912, 1913)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("sizereadonly_writeerror.qml"));
+ QVERIFY(component.isError());
+ QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("sizereadonly_writeerror2.qml"));
+ QVERIFY(component.isError());
+ QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("sizereadonly_writeerror3.qml"));
+ QVERIFY(component.isError());
+ QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("sizereadonly_writeerror4.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object);
+
+ QCOMPARE(object->property("sizereadonly").toSize(), QSize(1912, 1913));
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::rect()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("rect_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("r_x").toInt(), 2);
+ QCOMPARE(object->property("r_y").toInt(), 3);
+ QCOMPARE(object->property("r_width").toInt(), 109);
+ QCOMPARE(object->property("r_height").toInt(), 102);
+ QCOMPARE(object->property("copy"), QVariant(QRect(2, 3, 109, 102)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("rect_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect(), QRect(1234, 7, 56, 63));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("rect_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QRect(2, 3, 109, 102)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), true);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("rectEqualsRectf").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::rectf()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("rectf_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(float(object->property("r_x").toDouble()), float(103.8));
+ QCOMPARE(float(object->property("r_y").toDouble()), float(99.2));
+ QCOMPARE(float(object->property("r_width").toDouble()), float(88.1));
+ QCOMPARE(float(object->property("r_height").toDouble()), float(77.6));
+ QCOMPARE(object->property("copy"), QVariant(QRectF(103.8, 99.2, 88.1, 77.6)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("rectf_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rectf(), QRectF(70.1, -113.2, 80924.8, 99.2));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("rectf_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QRectF(103.8, 99.2, 88.1, 77.6)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), true);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+ QCOMPARE(object->property("rectfEqualsRect").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::vector2d()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("vector2d_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE((float)object->property("v_x").toDouble(), (float)32.88);
+ QCOMPARE((float)object->property("v_y").toDouble(), (float)1.3);
+ QCOMPARE(object->property("copy"), QVariant(QVector2D(32.88, 1.3)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector2d_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->vector2(), QVector2D(-0.3, -12.9));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector2d_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QVector2D(32.88, 1.3)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector2d_invokables.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::vector3d()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("vector3d_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE((float)object->property("v_x").toDouble(), (float)23.88);
+ QCOMPARE((float)object->property("v_y").toDouble(), (float)3.1);
+ QCOMPARE((float)object->property("v_z").toDouble(), (float)4.3);
+ QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88, 3.1, 4.3)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector3d_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->vector(), QVector3D(-0.3, -12.9, 907.4));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector3d_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QVector3D(23.88, 3.1, 4.3)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), true);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+ QCOMPARE(object->property("equalsOther").toBool(), false);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector3d_invokables.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::vector4d()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("vector4d_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2);
+ QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88);
+ QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1);
+ QCOMPARE((float)object->property("v_w").toDouble(), (float)4.3);
+ QCOMPARE(object->property("copy"), QVariant(QVector4D(54.2, 23.88, 3.1, 4.3)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector4d_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->vector4(), QVector4D(-0.3, -12.9, 907.4, 88.5));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector4d_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QVector4D(54.2, 23.88, 3.1, 4.3)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("vector4d_invokables.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::quaternion()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("quaternion_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE((float)object->property("v_scalar").toDouble(), (float)4.3);
+ QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2);
+ QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88);
+ QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1);
+ QCOMPARE(object->property("copy"), QVariant(QQuaternion(4.3, 54.2, 23.88, 3.1)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("quaternion_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->quaternion(), QQuaternion(88.5, -0.3, -12.9, 907.4));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("quaternion_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QQuaternion(4.3, 54.2, 23.88, 3.1)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::matrix4x4()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("matrix4x4_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE((float)object->property("v_m11").toDouble(), (float)1);
+ QCOMPARE((float)object->property("v_m12").toDouble(), (float)2);
+ QCOMPARE((float)object->property("v_m13").toDouble(), (float)3);
+ QCOMPARE((float)object->property("v_m14").toDouble(), (float)4);
+ QCOMPARE((float)object->property("v_m21").toDouble(), (float)5);
+ QCOMPARE((float)object->property("v_m22").toDouble(), (float)6);
+ QCOMPARE((float)object->property("v_m23").toDouble(), (float)7);
+ QCOMPARE((float)object->property("v_m24").toDouble(), (float)8);
+ QCOMPARE((float)object->property("v_m31").toDouble(), (float)9);
+ QCOMPARE((float)object->property("v_m32").toDouble(), (float)10);
+ QCOMPARE((float)object->property("v_m33").toDouble(), (float)11);
+ QCOMPARE((float)object->property("v_m34").toDouble(), (float)12);
+ QCOMPARE((float)object->property("v_m41").toDouble(), (float)13);
+ QCOMPARE((float)object->property("v_m42").toDouble(), (float)14);
+ QCOMPARE((float)object->property("v_m43").toDouble(), (float)15);
+ QCOMPARE((float)object->property("v_m44").toDouble(), (float)16);
+ QCOMPARE(object->property("copy"),
+ QVariant(QMatrix4x4(1, 2, 3, 4,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16)));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("matrix4x4_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->matrix(), QMatrix4x4(11, 12, 13, 14,
+ 21, 22, 23, 24,
+ 31, 32, 33, 34,
+ 41, 42, 43, 44));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("matrix4x4_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)");
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("matrix4x4_invokables.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::font()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("font_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("f_family").toString(), object->font().family());
+ QCOMPARE(object->property("f_bold").toBool(), object->font().bold());
+ QCOMPARE(object->property("f_weight").toInt(), object->font().weight());
+ QCOMPARE(object->property("f_italic").toBool(), object->font().italic());
+ QCOMPARE(object->property("f_underline").toBool(), object->font().underline());
+ QCOMPARE(object->property("f_overline").toBool(), object->font().overline());
+ QCOMPARE(object->property("f_strikeout").toBool(), object->font().strikeOut());
+ QCOMPARE(object->property("f_pointSize").toDouble(), object->font().pointSizeF());
+ QCOMPARE(object->property("f_pixelSize").toInt(), int((object->font().pointSizeF() * qt_defaultDpi()) / qreal(72.)));
+ QCOMPARE(object->property("f_capitalization").toInt(), (int)object->font().capitalization());
+ QCOMPARE(object->property("f_letterSpacing").toDouble(), object->font().letterSpacing());
+ QCOMPARE(object->property("f_wordSpacing").toDouble(), object->font().wordSpacing());
+
+ QCOMPARE(object->property("copy"), QVariant(object->font()));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("font_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QFont font;
+ font.setFamily("Helvetica");
+ font.setBold(false);
+ font.setWeight(QFont::Normal);
+ font.setItalic(false);
+ font.setUnderline(false);
+ font.setStrikeOut(false);
+ font.setPointSize(15);
+ font.setCapitalization(QFont::AllLowercase);
+ font.setLetterSpacing(QFont::AbsoluteSpacing, 9.7);
+ font.setWordSpacing(11.2);
+
+ QFont f = object->font();
+ QCOMPARE(f.family(), font.family());
+ QCOMPARE(f.bold(), font.bold());
+ QCOMPARE(f.weight(), font.weight());
+ QCOMPARE(f.italic(), font.italic());
+ QCOMPARE(f.underline(), font.underline());
+ QCOMPARE(f.strikeOut(), font.strikeOut());
+ QCOMPARE(f.pointSize(), font.pointSize());
+ QCOMPARE(f.capitalization(), font.capitalization());
+ QCOMPARE(f.letterSpacing(), font.letterSpacing());
+ QCOMPARE(f.wordSpacing(), font.wordSpacing());
+
+ delete object;
+ }
+
+ // Test pixelSize
+ {
+ QQmlComponent component(&engine, testFileUrl("font_write.2.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->font().pixelSize(), 10);
+
+ delete object;
+ }
+
+ // Test pixelSize and pointSize
+ {
+ QQmlComponent component(&engine, testFileUrl("font_write.3.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->font().pixelSize(), 10);
+
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("font_write.4.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->font().pixelSize(), 10);
+
+ delete object;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("font_write.5.qml"));
+ QObject *object = qobject_cast<QObject *>(component.create());
+ QVERIFY(object != 0);
+ MyTypeObject *object1 = object->findChild<MyTypeObject *>("object1");
+ QVERIFY(object1 != 0);
+ MyTypeObject *object2 = object->findChild<MyTypeObject *>("object2");
+ QVERIFY(object2 != 0);
+
+ QCOMPARE(object1->font().pixelSize(), 19);
+ QCOMPARE(object2->font().pointSize(), 14);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("font_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QString tostring = QLatin1String("QFont(") + object->font().toString() + QLatin1Char(')');
+ QCOMPARE(object->property("tostring").toString(), tostring);
+ QCOMPARE(object->property("equalsString").toBool(), true);
+ QCOMPARE(object->property("equalsColor").toBool(), false);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+ QCOMPARE(object->property("equalsSelf").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::color()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("color_read.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE((float)object->property("v_r").toDouble(), (float)0.2);
+ QCOMPARE((float)object->property("v_g").toDouble(), (float)0.88);
+ QCOMPARE((float)object->property("v_b").toDouble(), (float)0.6);
+ QCOMPARE((float)object->property("v_a").toDouble(), (float)0.34);
+ QColor comparison;
+ comparison.setRedF(0.2);
+ comparison.setGreenF(0.88);
+ comparison.setBlueF(0.6);
+ comparison.setAlphaF(0.34);
+ QCOMPARE(object->property("copy"), QVariant(comparison));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("color_write.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QColor newColor;
+ newColor.setRedF(0.5);
+ newColor.setGreenF(0.38);
+ newColor.setBlueF(0.3);
+ newColor.setAlphaF(0.7);
+ QCOMPARE(object->color(), newColor);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("color_compare.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QString colorString("#33e199");
+ QCOMPARE(object->property("colorToString").toString(), colorString);
+ QCOMPARE(object->property("colorEqualsIdenticalRgba").toBool(), true);
+ QCOMPARE(object->property("colorEqualsDifferentAlpha").toBool(), false);
+ QCOMPARE(object->property("colorEqualsDifferentRgba").toBool(), false);
+ QCOMPARE(object->property("colorToStringEqualsColorString").toBool(), true);
+ QCOMPARE(object->property("colorToStringEqualsDifferentAlphaString").toBool(), true);
+ QCOMPARE(object->property("colorToStringEqualsDifferentRgbaString").toBool(), false);
+ QCOMPARE(object->property("colorEqualsColorString").toBool(), true); // maintaining behaviour with QtQuick 1.0
+ QCOMPARE(object->property("colorEqualsDifferentAlphaString").toBool(), true); // maintaining behaviour with QtQuick 1.0
+ QCOMPARE(object->property("colorEqualsDifferentRgbaString").toBool(), false);
+
+ QCOMPARE(object->property("equalsColor").toBool(), true);
+ QCOMPARE(object->property("equalsVector3d").toBool(), false);
+ QCOMPARE(object->property("equalsSize").toBool(), false);
+ QCOMPARE(object->property("equalsPoint").toBool(), false);
+ QCOMPARE(object->property("equalsRect").toBool(), false);
+
+ // Color == Property and Property == Color should return the same result.
+ QCOMPARE(object->property("equalsColorRHS").toBool(), object->property("equalsColor").toBool());
+ QCOMPARE(object->property("colorEqualsCopy").toBool(), true);
+ QCOMPARE(object->property("copyEqualsColor").toBool(), object->property("colorEqualsCopy").toBool());
+
+ delete object;
+ }
+}
+
+// Test bindings can write to value types
+void tst_qqmlvaluetypes::bindingAssignment()
+{
+ // binding declaration
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingAssignment.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect().x(), 10);
+ QCOMPARE(object->rect().y(), 15);
+
+ object->setProperty("value", QVariant(92));
+
+ QCOMPARE(object->rect().x(), 92);
+ QCOMPARE(object->rect().y(), 97);
+
+ delete object;
+ }
+
+ // function assignment should fail without crashing
+ {
+ QString warning1 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":6:13: Invalid use of Qt.binding() in a binding declaration.");
+ QString warning2 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":10: Error: Cannot assign JavaScript function to value-type property");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QQmlComponent component(&engine, testFileUrl("bindingAssignment.2.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->rect().x(), 5);
+ object->setProperty("value", QVariant(92));
+ QCOMPARE(object->rect().x(), 5);
+ delete object;
+ }
+}
+
+// Test bindings can read from value types
+void tst_qqmlvaluetypes::bindingRead()
+{
+ QQmlComponent component(&engine, testFileUrl("bindingRead.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("value").toInt(), 2);
+
+ object->setRect(QRect(19, 3, 88, 2));
+
+ QCOMPARE(object->property("value").toInt(), 19);
+
+ delete object;
+}
+
+// Test static values can assign to value types
+void tst_qqmlvaluetypes::staticAssignment()
+{
+ QQmlComponent component(&engine, testFileUrl("staticAssignment.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect().x(), 9);
+
+ delete object;
+}
+
+// Test scripts can read/write value types
+void tst_qqmlvaluetypes::scriptAccess()
+{
+ QQmlComponent component(&engine, testFileUrl("scriptAccess.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("valuePre").toInt(), 2);
+ QCOMPARE(object->rect().x(), 19);
+ QCOMPARE(object->property("valuePost").toInt(), 19);
+
+ delete object;
+}
+
+// Test that assigning a constant from script removes any binding
+void tst_qqmlvaluetypes::autoBindingRemoval()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("autoBindingRemoval.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect().x(), 10);
+
+ object->setProperty("value", QVariant(13));
+
+ QCOMPARE(object->rect().x(), 13);
+
+ object->emitRunScript();
+
+ QCOMPARE(object->rect().x(), 42);
+
+ object->setProperty("value", QVariant(92));
+
+ QCOMPARE(object->rect().x(), 42);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("autoBindingRemoval.2.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect().x(), 10);
+
+ object->setProperty("value", QVariant(13));
+
+ QCOMPARE(object->rect().x(), 13);
+
+ object->emitRunScript();
+
+ QCOMPARE(object->rect(), QRect(10, 10, 10, 10));
+
+ object->setProperty("value", QVariant(92));
+
+ QCOMPARE(object->rect(), QRect(10, 10, 10, 10));
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("autoBindingRemoval.3.qml"));
+ QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QRect";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ object->setProperty("value", QVariant(QRect(9, 22, 33, 44)));
+
+ QCOMPARE(object->rect(), QRect(9, 22, 33, 44));
+
+ object->emitRunScript();
+
+ QCOMPARE(object->rect(), QRect(44, 22, 33, 44));
+
+ object->setProperty("value", QVariant(QRect(19, 3, 4, 8)));
+
+ QCOMPARE(object->rect(), QRect(44, 22, 33, 44));
+
+ delete object;
+ }
+}
+
+// Test that property value sources assign to value types
+void tst_qqmlvaluetypes::valueSources()
+{
+ QQmlComponent component(&engine, testFileUrl("valueSources.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect().x(), 3345);
+
+ delete object;
+}
+
+static void checkNoErrors(QQmlComponent& component)
+{
+ QList<QQmlError> errors = component.errors();
+ if (errors.isEmpty())
+ return;
+ for (int ii = 0; ii < errors.count(); ++ii) {
+ const QQmlError &error = errors.at(ii);
+ qWarning("%d:%d:%s",error.line(),error.column(),error.description().toUtf8().constData());
+ }
+}
+
+// Test that property value interceptors can be applied to value types
+void tst_qqmlvaluetypes::valueInterceptors()
+{
+ QQmlComponent component(&engine, testFileUrl("valueInterceptors.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ checkNoErrors(component);
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect().x(), 13);
+
+ object->setProperty("value", 99);
+
+ QCOMPARE(object->rect().x(), 112);
+
+ delete object;
+}
+
+// Test that you can't assign a binding to the "root" value type, and a sub-property
+void tst_qqmlvaluetypes::bindingConflict()
+{
+ QQmlComponent component(&engine, testFileUrl("bindingConflict.qml"));
+ QCOMPARE(component.isError(), true);
+}
+
+#define CPP_TEST(type, v) \
+{ \
+ type *t = new type; \
+ QVariant value(v); \
+ t->setValue(value); \
+ QCOMPARE(t->value(), value); \
+ delete t; \
+}
+
+// Test that accessing a reference to a valuetype after the owning object is deleted
+// doesn't crash
+void tst_qqmlvaluetypes::deletedObject()
+{
+ QQmlComponent component(&engine, testFileUrl("deletedObject.qml"));
+ QTest::ignoreMessage(QtDebugMsg, "Test: 2");
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QObject *dObject = qvariant_cast<QObject *>(object->property("object"));
+ QVERIFY(dObject != 0);
+ delete dObject;
+
+ QTest::ignoreMessage(QtDebugMsg, "Test: undefined");
+ object->emitRunScript();
+
+ delete object;
+}
+
+// Test that value types can be assigned to another value type property in a binding
+void tst_qqmlvaluetypes::bindingVariantCopy()
+{
+ QQmlComponent component(&engine, testFileUrl("bindingVariantCopy.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect(), QRect(19, 33, 5, 99));
+
+ delete object;
+}
+
+// Test that value types can be assigned to another value type property in script
+void tst_qqmlvaluetypes::scriptVariantCopy()
+{
+ QQmlComponent component(&engine, testFileUrl("scriptVariantCopy.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->rect(), QRect(2, 3, 109, 102));
+
+ object->emitRunScript();
+
+ QCOMPARE(object->rect(), QRect(19, 33, 5, 99));
+
+ delete object;
+}
+
+
+// Test that the value type classes can be used manually
+void tst_qqmlvaluetypes::cppClasses()
+{
+ CPP_TEST(QQmlPointValueType, QPoint(19, 33));
+ CPP_TEST(QQmlPointFValueType, QPointF(33.6, -23));
+ CPP_TEST(QQmlSizeValueType, QSize(-100, 18));
+ CPP_TEST(QQmlSizeFValueType, QSizeF(-100.7, 18.2));
+ CPP_TEST(QQmlRectValueType, QRect(13, 39, 10928, 88));
+ CPP_TEST(QQmlRectFValueType, QRectF(88.2, -90.1, 103.2, 118));
+ CPP_TEST(QQuickVector2DValueType, QVector2D(19.7, 1002));
+ CPP_TEST(QQuickVector3DValueType, QVector3D(18.2, 19.7, 1002));
+ CPP_TEST(QQuickVector4DValueType, QVector4D(18.2, 19.7, 1002, 54));
+ CPP_TEST(QQuickQuaternionValueType, QQuaternion(18.2, 19.7, 1002, 54));
+ CPP_TEST(QQuickMatrix4x4ValueType,
+ QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16));
+ CPP_TEST(QQuickFontValueType, QFont("Helvetica"));
+
+}
+
+void tst_qqmlvaluetypes::enums()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("enums.1.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::AllUppercase);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("enums.2.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::AllUppercase);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("enums.3.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::AllUppercase);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("enums.4.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::AllUppercase);
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("enums.5.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::AllUppercase);
+ delete object;
+ }
+}
+
+// Tests switching between "conflicting" bindings (eg. a binding on the core
+// property, to a binding on the value-type sub-property)
+void tst_qqmlvaluetypes::conflictingBindings()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("conflicting.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12);
+
+ QMetaObject::invokeMethod(object, "toggle");
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6);
+
+ QMetaObject::invokeMethod(object, "toggle");
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("conflicting.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6);
+
+ QMetaObject::invokeMethod(object, "toggle");
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12);
+
+ QMetaObject::invokeMethod(object, "toggle");
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("conflicting.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12);
+
+ QMetaObject::invokeMethod(object, "toggle");
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 24);
+
+ QMetaObject::invokeMethod(object, "toggle");
+
+ QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::returnValues()
+{
+ QQmlComponent component(&engine, testFileUrl("returnValues.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("size").toSize(), QSize(13, 14));
+
+ delete object;
+}
+
+void tst_qqmlvaluetypes::varAssignment()
+{
+ QQmlComponent component(&engine, testFileUrl("varAssignment.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("x").toInt(), 1);
+ QCOMPARE(object->property("y").toInt(), 2);
+ QCOMPARE(object->property("z").toInt(), 3);
+
+ delete object;
+}
+
+// Test bindings splice together correctly
+void tst_qqmlvaluetypes::bindingsSpliceCorrectly()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+
+
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.4.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.5.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlvaluetypes::nonValueTypeComparison()
+{
+ QQmlComponent component(&engine, testFileUrl("nonValueTypeComparison.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlvaluetypes::initializeByWrite()
+{
+ QQmlComponent component(&engine, testFileUrl("initializeByWrite.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlvaluetypes::groupedInterceptors_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<QColor>("expectedInitialColor");
+ QTest::addColumn<QColor>("setColor");
+ QTest::addColumn<QColor>("expectedFinalColor");
+
+ QColor c0, c1, c2;
+ c0.setRgbF(0.1f, 0.2f, 0.3f, 0.4f);
+ c1.setRgbF(0.2f, 0.4f, 0.6f, 0.8f);
+ c2.setRgbF(0.8f, 0.6f, 0.4f, 0.2f);
+
+ QTest::newRow("value-interceptor") << QString::fromLatin1("grouped_interceptors_value.qml") << c0 << c1 << c2;
+ QTest::newRow("component-interceptor") << QString::fromLatin1("grouped_interceptors_component.qml") << QColor(128, 0, 255) << QColor(50, 100, 200) << QColor(0, 100, 200);
+ QTest::newRow("ignore-interceptor") << QString::fromLatin1("grouped_interceptors_ignore.qml") << QColor(128, 0, 255) << QColor(50, 100, 200) << QColor(128, 100, 200);
+}
+
+static bool fuzzyCompare(qreal a, qreal b)
+{
+ const qreal EPSILON = 0.0001;
+ return (a + EPSILON > b) && (a - EPSILON < b);
+}
+
+void tst_qqmlvaluetypes::groupedInterceptors()
+{
+ QFETCH(QString, qmlfile);
+ QFETCH(QColor, expectedInitialColor);
+ QFETCH(QColor, setColor);
+ QFETCH(QColor, expectedFinalColor);
+
+ QQmlComponent component(&engine, testFileUrl(qmlfile));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QColor initialColor = object->property("color").value<QColor>();
+ QVERIFY(fuzzyCompare(initialColor.redF(), expectedInitialColor.redF()));
+ QVERIFY(fuzzyCompare(initialColor.greenF(), expectedInitialColor.greenF()));
+ QVERIFY(fuzzyCompare(initialColor.blueF(), expectedInitialColor.blueF()));
+ QVERIFY(fuzzyCompare(initialColor.alphaF(), expectedInitialColor.alphaF()));
+
+ object->setProperty("color", setColor);
+
+ QColor finalColor = object->property("color").value<QColor>();
+ QVERIFY(fuzzyCompare(finalColor.redF(), expectedFinalColor.redF()));
+ QVERIFY(fuzzyCompare(finalColor.greenF(), expectedFinalColor.greenF()));
+ QVERIFY(fuzzyCompare(finalColor.blueF(), expectedFinalColor.blueF()));
+ QVERIFY(fuzzyCompare(finalColor.alphaF(), expectedFinalColor.alphaF()));
+
+ delete object;
+}
+
+QTEST_MAIN(tst_qqmlvaluetypes)
+
+#include "tst_qqmlvaluetypes.moc"
diff --git a/tests/auto/qml/qqmlxmlhttprequest/.gitattributes b/tests/auto/qml/qqmlxmlhttprequest/.gitattributes
new file mode 100644
index 0000000000..7805eb6951
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/.gitattributes
@@ -0,0 +1,3 @@
+data/testdocument.html eol=lf
+data/redirecttarget.html eol=lf
+data/utf16.html eol=lf
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent.qml
new file mode 100644
index 0000000000..c4ecbd8912
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int a: 4
+
+ Component.onCompleted: {
+ root.parent.finished();
+ triggerXmlHttpRequest();
+ }
+
+ function triggerXmlHttpRequest() {
+ var doc = new XMLHttpRequest();
+ doc.onreadystatechange = function() {
+ if (doc.readyState == XMLHttpRequest.DONE) {
+ var seqComponent = doc.responseText;
+ var o = Qt.createQmlObject(seqComponent,root);
+ }
+ }
+ doc.open("GET", "http://127.0.0.1:14445/TestComponent3.qml");
+ doc.send();
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent2.qml b/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent2.qml
new file mode 100644
index 0000000000..f27a980f42
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent2.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int a: 5
+ Component.onCompleted: root.parent.finished()
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent3.qml b/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent3.qml
new file mode 100644
index 0000000000..763ec6de20
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/TestComponent3.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int a: 3
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/abort.expect b/tests/auto/qml/qqmlxmlhttprequest/data/abort.expect
new file mode 100644
index 0000000000..d6951a8255
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/abort.expect
@@ -0,0 +1,10 @@
+PUT /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Content-Type: text/plain;charset=UTF-8
+Content-Length: 9
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
+Test Data \ No newline at end of file
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/abort.qml b/tests/auto/qml/qqmlxmlhttprequest/data/abort.qml
new file mode 100644
index 0000000000..9ba97fac4b
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/abort.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+QtObject {
+ property string urlDummy
+ property string url
+
+ property bool seenDone: false
+ property bool didNotSeeUnsent: true
+ property bool endStateUnsent: false
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("GET", urlDummy);
+ x.setRequestHeader("Test-header", "TestValue");
+ x.setRequestHeader("Accept-Language", "en-US");
+ x.send();
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ seenDone = true;
+ } else if (x.readyState == XMLHttpRequest.UNSENT) {
+ didNotSeeUnsent = false;
+ }
+ }
+
+ x.abort();
+
+ if (x.readyState == XMLHttpRequest.UNSENT) {
+ endStateUnsent = true;
+ }
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+ x.open("PUT", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+ x.send("Test Data");
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/abort.reply b/tests/auto/qml/qqmlxmlhttprequest/data/abort.reply
new file mode 100644
index 0000000000..7ae6951f9b
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/abort.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 200 OK
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml b/tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml
new file mode 100644
index 0000000000..d5bb84ddc0
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/abort_opened.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url: "testdocument.html"
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool status: false
+ property bool statusText: false
+ property bool responseText: false
+ property bool responseXML: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.abort();
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("PUT", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ x.abort();
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ var a = x.status;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ status = true;
+ }
+ try {
+ var a = x.statusText;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusText = true;
+ }
+ responseText = (x.responseText == "");
+ responseXML = (x.responseXML == null);
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+
+ x.send()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml
new file mode 100644
index 0000000000..4f58062a26
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/abort_unsent.qml
@@ -0,0 +1,55 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url: "testdocument.html"
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool status: false
+ property bool statusText: false
+ property bool responseText: false
+ property bool responseXML: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.abort();
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ var a = x.status;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ status = true;
+ }
+ try {
+ var a = x.statusText;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusText = true;
+ }
+ responseText = (x.responseText == "");
+ responseXML = (x.responseXML == null);
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+
+ x.send()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/attr.qml b/tests/auto/qml/qqmlxmlhttprequest/data/attr.qml
new file mode 100644
index 0000000000..b1c081c5fd
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/attr.qml
@@ -0,0 +1,78 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool xmlTest: false
+ property bool dataOK: false
+
+ function checkAttr(documentElement, attr)
+ {
+ if (attr == null)
+ return;
+
+ if (attr.name != "attr")
+ return;
+
+ if (attr.value != "myvalue")
+ return;
+
+ if (attr.ownerElement.tagName != documentElement.tagName)
+ return;
+
+ if (attr.nodeName != "attr")
+ return;
+
+ if (attr.nodeValue != "myvalue")
+ return;
+
+ if (attr.nodeType != 2)
+ return;
+
+ if (attr.childNodes.length != 0)
+ return;
+
+ if (attr.firstChild != null)
+ return;
+
+ if (attr.lastChild != null)
+ return;
+
+ if (attr.previousSibling != null)
+ return;
+
+ if (attr.nextSibling != null)
+ return;
+
+ if (attr.attributes != null)
+ return;
+
+ xmlTest = true;
+ }
+
+ function checkXML(document)
+ {
+ checkAttr(document.documentElement, document.documentElement.attributes[0]);
+ }
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "attr.xml");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+
+ dataOK = true;
+
+ if (x.responseXML != null)
+ checkXML(x.responseXML);
+
+ }
+ }
+
+ x.send()
+ }
+}
+
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/attr.xml b/tests/auto/qml/qqmlxmlhttprequest/data/attr.xml
new file mode 100644
index 0000000000..2aa64a3d00
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/attr.xml
@@ -0,0 +1 @@
+<root attr="myvalue" />
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/callbackException.qml b/tests/auto/qml/qqmlxmlhttprequest/data/callbackException.qml
new file mode 100644
index 0000000000..ee1043f97f
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/callbackException.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+QtObject {
+ id: obj
+ property string url
+ property string which
+ property bool threw: false
+
+ onWhichChanged: {
+ var x = new XMLHttpRequest;
+
+ x.onreadystatechange = function() {
+ if (x.readyState == which) {
+ obj.threw = true
+ throw(new Error("Exception from Callback"))
+ }
+ }
+
+ x.open("GET", url);
+ x.setRequestHeader("Test-header", "TestValue");
+ x.send();
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/cdata.qml b/tests/auto/qml/qqmlxmlhttprequest/data/cdata.qml
new file mode 100644
index 0000000000..f558fdadc6
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/cdata.qml
@@ -0,0 +1,133 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool xmlTest: false
+ property bool dataOK: false
+
+ function checkCData(text, whitespacetext)
+ {
+ // This is essentially a copy of text.qml/checkText()
+
+ if (text == null)
+ return;
+
+ if (text.nodeName != "#cdata-section")
+ return;
+
+ if (text.nodeValue != "Hello world!")
+ return;
+
+ if (text.nodeType != 4)
+ return;
+
+ if (text.parentNode.nodeName != "item")
+ return;
+
+ if (text.childNodes.length != 0)
+ return;
+
+ if (text.firstChild != null)
+ return;
+
+ if (text.lastChild != null)
+ return;
+
+ if (text.previousSibling != null)
+ return;
+
+ if (text.nextSibling != null)
+ return;
+
+ if (text.attributes != null)
+ return;
+
+ if (text.wholeText != "Hello world!")
+ return;
+
+ if (text.data != "Hello world!")
+ return;
+
+ if (text.length != 12)
+ return;
+
+ if (text.isElementContentWhitespace != false)
+ return;
+
+ if (whitespacetext.nodeName != "#cdata-section")
+ return;
+
+ if (whitespacetext.nodeValue != " ")
+ return;
+
+ if (whitespacetext.nodeType != 4)
+ return;
+
+ if (whitespacetext.parentNode.nodeName != "item")
+ return;
+
+ if (whitespacetext.childNodes.length != 0)
+ return;
+
+ if (whitespacetext.firstChild != null)
+ return;
+
+ if (whitespacetext.lastChild != null)
+ return;
+
+ if (whitespacetext.previousSibling != null)
+ return;
+
+ if (whitespacetext.nextSibling != null)
+ return;
+
+ if (whitespacetext.attributes != null)
+ return;
+
+ if (whitespacetext.wholeText != " ")
+ return;
+
+ if (whitespacetext.data != " ")
+ return;
+
+ if (whitespacetext.length != 3)
+ return;
+
+ if (whitespacetext.isElementContentWhitespace != true)
+ return;
+
+
+ xmlTest = true;
+ }
+
+ function checkXML(document)
+ {
+ checkCData(document.documentElement.childNodes[0].childNodes[0],
+ document.documentElement.childNodes[1].childNodes[0]);
+
+ }
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "cdata.xml");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+
+ dataOK = true;
+
+ if (x.responseXML != null)
+ checkXML(x.responseXML);
+
+ }
+ }
+
+ x.send()
+ }
+}
+
+
+
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/cdata.xml b/tests/auto/qml/qqmlxmlhttprequest/data/cdata.xml
new file mode 100644
index 0000000000..061d37c0b6
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/cdata.xml
@@ -0,0 +1,2 @@
+<root><item><![CDATA[Hello world!]]></item><item><![CDATA[ ]]></item></root>
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/constructor.qml b/tests/auto/qml/qqmlxmlhttprequest/data/constructor.qml
new file mode 100644
index 0000000000..458066736e
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/constructor.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool calledAsConstructor
+ property bool calledAsFunction
+
+ Component.onCompleted: {
+ var x1 = new XMLHttpRequest;
+ var x2 = XMLHttpRequest();
+
+ calledAsConstructor = (x1 != null && x1 instanceof XMLHttpRequest);
+ calledAsFunction = (x2 == undefined);
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/defaultState.qml b/tests/auto/qml/qqmlxmlhttprequest/data/defaultState.qml
new file mode 100644
index 0000000000..913fe59f99
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/defaultState.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+QtObject {
+ property int readyState
+ property bool statusIsException: false
+ property bool statusTextIsException: false
+ property string responseText
+ property bool responseXMLIsNull
+
+ Component.onCompleted: {
+ var xhr = new XMLHttpRequest();
+
+ readyState = xhr.readyState;
+ try {
+ status = xhr.status;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusIsException = true;
+ }
+ try {
+ statusText = xhr.statusText;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusTextIsException = true;
+ }
+ responseText = xhr.responseText;
+ responseXMLIsNull = (xhr.responseXML == null);
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/document.qml b/tests/auto/qml/qqmlxmlhttprequest/data/document.qml
new file mode 100644
index 0000000000..7695cd76a1
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/document.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool xmlTest: false
+ property bool dataOK: false
+
+ function checkXML(document)
+ {
+ if (document.xmlVersion != "1.0")
+ return;
+
+ if (document.xmlEncoding != "UTF-8")
+ return;
+
+ if (document.xmlStandalone != true)
+ return;
+
+ if (document.documentElement == null)
+ return;
+
+ if (document.nodeName != "#document")
+ return;
+
+ if (document.nodeValue != null)
+ return;
+
+ if (document.parentNode != null)
+ return;
+
+ // ### Test other node properties
+ // ### test encoding (what is a valid qt encoding?)
+ xmlTest = true;
+ }
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "document.xml");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+
+ dataOK = true;
+
+ if (x.responseXML != null)
+ checkXML(x.responseXML);
+
+ }
+ }
+
+ x.send()
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/document.xml b/tests/auto/qml/qqmlxmlhttprequest/data/document.xml
new file mode 100644
index 0000000000..fb693ea193
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/document.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8" standalone='yes'?>
+<root>
+</root>
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/domExceptionCodes.qml b/tests/auto/qml/qqmlxmlhttprequest/data/domExceptionCodes.qml
new file mode 100644
index 0000000000..092db3443d
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/domExceptionCodes.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+QtObject {
+ property int index_size_err: DOMException.INDEX_SIZE_ERR
+ property int domstring_size_err: DOMException.DOMSTRING_SIZE_ERR
+ property int hierarchy_request_err: DOMException.HIERARCHY_REQUEST_ERR
+ property int wrong_document_err: DOMException.WRONG_DOCUMENT_ERR
+ property int invalid_character_err: DOMException.INVALID_CHARACTER_ERR
+ property int no_data_allowed_err: DOMException.NO_DATA_ALLOWED_ERR
+ property int no_modification_allowed_err: DOMException.NO_MODIFICATION_ALLOWED_ERR
+ property int not_found_err: DOMException.NOT_FOUND_ERR
+ property int not_supported_err: DOMException.NOT_SUPPORTED_ERR
+ property int inuse_attribute_err: DOMException.INUSE_ATTRIBUTE_ERR
+ property int invalid_state_err: DOMException.INVALID_STATE_ERR
+ property int syntax_err: DOMException.SYNTAX_ERR
+ property int invalid_modification_err: DOMException.INVALID_MODIFICATION_ERR
+ property int namespace_err: DOMException.NAMESPACE_ERR
+ property int invalid_access_err: DOMException.INVALID_ACCESS_ERR
+ property int validation_err: DOMException.VALIDATION_ERR
+ property int type_mismatch_err: DOMException.TYPE_MISMATCH_ERR
+
+ Component.onCompleted: {
+ // Attempt to overwrite and delete values
+ DOMException.INDEX_SIZE_ERR = 44;
+ DOMException.DOMSTRING_SIZE_ERR = 44;
+ DOMException.HIERARCHY_REQUEST_ERR = 44;
+ DOMException.WRONG_DOCUMENT_ERR = 44;
+ DOMException.INVALID_CHARACTER_ERR = 44;
+ DOMException.NO_DATA_ALLOWED_ERR = 44;
+ DOMException.NO_MODIFICATION_ALLOWED_ERR = 44;
+ DOMException.NOT_FOUND_ERR = 44;
+ DOMException.NOT_SUPPORTED_ERR = 44;
+ DOMException.INUSE_ATTRIBUTE_ERR = 44;
+ DOMException.INVALID_STATE_ERR = 44;
+ DOMException.SYNTAX_ERR = 44;
+ DOMException.INVALID_MODIFICATION_ERR = 44;
+ DOMException.NAMESPACE_ERR = 44;
+ DOMException.INVALID_ACCESS_ERR = 44;
+ DOMException.VALIDATION_ERR = 44;
+ DOMException.TYPE_MISMATCH_ERR = 44;
+
+ delete DOMException.INDEX_SIZE_ERR;
+ delete DOMException.DOMSTRING_SIZE_ERR;
+ delete DOMException.HIERARCHY_REQUEST_ERR;
+ delete DOMException.WRONG_DOCUMENT_ERR;
+ delete DOMException.INVALID_CHARACTER_ERR;
+ delete DOMException.NO_DATA_ALLOWED_ERR;
+ delete DOMException.NO_MODIFICATION_ALLOWED_ERR;
+ delete DOMException.NOT_FOUND_ERR;
+ delete DOMException.NOT_SUPPORTED_ERR;
+ delete DOMException.INUSE_ATTRIBUTE_ERR;
+ delete DOMException.INVALID_STATE_ERR;
+ delete DOMException.SYNTAX_ERR;
+ delete DOMException.INVALID_MODIFICATION_ERR;
+ delete DOMException.NAMESPACE_ERR;
+ delete DOMException.INVALID_ACCESS_ERR;
+ delete DOMException.VALIDATION_ERR;
+ delete DOMException.TYPE_MISMATCH_ERR;
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/element.qml b/tests/auto/qml/qqmlxmlhttprequest/data/element.qml
new file mode 100644
index 0000000000..9b190f3a43
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/element.qml
@@ -0,0 +1,145 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool xmlTest: false
+ property bool dataOK: false
+
+ function checkElement(e, person, fruit)
+ {
+ if (e.tagName != "root")
+ return;
+
+ if (e.nodeName != "root")
+ return;
+
+ if (e.nodeValue != null)
+ return;
+
+ if (e.nodeType != 1)
+ return;
+
+ var childTagNames = [ "person", "fruit" ];
+
+ if (e.childNodes.length != childTagNames.length)
+ return;
+
+ for (var ii = 0; ii < childTagNames.length; ++ii) {
+ if (e.childNodes[ii].tagName != childTagNames[ii])
+ return;
+ }
+
+ if (e.childNodes[childTagNames.length + 1] != null)
+ return;
+
+ // Check writing fails
+ e.childNodes[0] = null;
+ if (e.childNodes[0] == null)
+ return;
+
+ e.childNodes[10] = 10;
+ if (e.childNodes[10] != null)
+ return;
+
+ if (e.firstChild.tagName != e.childNodes[0].tagName)
+ return;
+
+ if (e.lastChild.tagName != e.childNodes[1].tagName)
+ return;
+
+ if (e.previousSibling != null)
+ return;
+
+ if (e.nextSibling != null)
+ return;
+
+ if (e.attributes == null)
+ return;
+
+ if (e.attributes.length != 2)
+ return;
+
+ var attr1 = e.attributes["attr"];
+ if (attr1.nodeValue != "value")
+ return;
+
+ var attrIdx = e.attributes[0];
+ if (attrIdx.nodeValue != "value")
+ return;
+
+ var attr2 = e.attributes["attr2"];
+ if (attr2.nodeValue != "value2")
+ return;
+
+ var attr3 = e.attributes["attr3"];
+ if (attr3 != null)
+ return;
+
+ var attrIdx2 = e.attributes[11];
+ if (attrIdx2 != null)
+ return;
+
+ // Check writing fails
+ e.attributes[0] = null;
+ if (e.attributes[0] == null)
+ return;
+
+ e.attributes["attr"] = null;
+ if (e.attributes["attr"] == null)
+ return;
+
+ e.attributes["attr3"] = 10;
+ if (e.attributes["attr3"] != null)
+ return;
+
+ // Check person and fruit sub elements
+ if (person.parentNode.nodeName != "root")
+ return;
+
+ if (person.previousSibling != null)
+ return;
+
+ if (person.nextSibling.nodeName != "fruit")
+ return;
+
+ if (fruit.parentNode.nodeName != "root")
+ return;
+
+ if (fruit.previousSibling.nodeName != "person")
+ return;
+
+ if (fruit.nextSibling != null)
+ return;
+
+ xmlTest = true;
+ }
+
+ function checkXML(document)
+ {
+ checkElement(document.documentElement,
+ document.documentElement.childNodes[0],
+ document.documentElement.childNodes[1]);
+ }
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "element.xml");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+
+ dataOK = true;
+
+ if (x.responseXML != null)
+ checkXML(x.responseXML);
+
+ }
+ }
+
+ x.send()
+ }
+}
+
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/element.xml b/tests/auto/qml/qqmlxmlhttprequest/data/element.xml
new file mode 100644
index 0000000000..071ffae057
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/element.xml
@@ -0,0 +1 @@
+<root attr="value" attr2="value2"><person /><fruit /></root>
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml
new file mode 100644
index 0000000000..580688b835
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders.qml
@@ -0,0 +1,66 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool unsentException: false
+ property bool openedException: false
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool headersReceivedState: false
+ property bool headersReceivedHeader: false
+
+ property bool doneState: false
+ property bool doneHeader: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.getResponseHeader("Test-Header");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ unsentException = true;
+ }
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ x.getResponseHeader("Test-Header");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ openedException = true;
+ }
+
+ var headers = "connection: close\r\ncontent-type: text/html; charset=UTF-8\r\ntest-header: TestValue\r\nmultitest-header: TestValue, SecondTestValue\r\ncontent-length: 11";
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ headersReceivedState = true;
+
+ headersReceivedHeader = (x.getAllResponseHeaders() == headers);
+ } else if (x.readyState == XMLHttpRequest.DONE) {
+ doneState = headersReceivedState && true;
+
+ doneHeader = (x.getAllResponseHeaders() == headers);
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send()
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_args.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_args.qml
new file mode 100644
index 0000000000..84a0bf3015
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_args.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool exceptionThrown: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "testdocument.html");
+ x.send();
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ try {
+ x.getAllResponseHeaders("Test-header");
+ } catch (e) {
+ if (e.code == DOMException.SYNTAX_ERR)
+ exceptionThrown = true;
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_sent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_sent.qml
new file mode 100644
index 0000000000..27edb4c4b7
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_sent.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "testdocument.html");
+ x.send();
+
+ try {
+ x.getAllResponseHeaders();
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_unsent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_unsent.qml
new file mode 100644
index 0000000000..3d57348cc5
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getAllResponseHeaders_unsent.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.getAllResponseHeaders();
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.expect b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.expect
new file mode 100644
index 0000000000..cf5830ed0c
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.expect
@@ -0,0 +1,7 @@
+GET /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml
new file mode 100644
index 0000000000..203967e539
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.qml
@@ -0,0 +1,76 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool unsentException: false
+ property bool openedException: false
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool headersReceivedState: false
+ property bool headersReceivedNullHeader: false
+ property bool headersReceivedValidHeader: false
+ property bool headersReceivedMultiValidHeader: false
+ property bool headersReceivedCookieHeader: false
+
+ property bool doneState: false
+ property bool doneNullHeader: false
+ property bool doneValidHeader: false
+ property bool doneMultiValidHeader: false
+ property bool doneCookieHeader: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.getResponseHeader("Test-Header");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ unsentException = true;
+ }
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ x.getResponseHeader("Test-Header");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ openedException = true;
+ }
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ headersReceivedState = true;
+
+ headersReceivedNullHeader = (x.getResponseHeader("Nonexistant-header") == "");
+ headersReceivedValidHeader = (x.getResponseHeader("Test-HEAder") == "TestValue");
+ headersReceivedMultiValidHeader = (x.getResponseHeader("MultiTest-HEAder") == "TestValue, SecondTestValue");
+ headersReceivedCookieHeader = (x.getResponseHeader("Set-Cookie") == "" && x.getResponseHeader("Set-Cookie2") == "");
+ } else if (x.readyState == XMLHttpRequest.DONE) {
+ doneState = headersReceivedState && true;
+
+ doneNullHeader = (x.getResponseHeader("Nonexistant-header") == "");
+ doneValidHeader = (x.getResponseHeader("Test-HEAder") == "TestValue");
+ doneMultiValidHeader = (x.getResponseHeader("MultiTest-HEAder") == "TestValue, SecondTestValue");
+ doneCookieHeader = (x.getResponseHeader("Set-Cookie") == "" && x.getResponseHeader("Set-Cookie2") == "");
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send()
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.reply b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.reply
new file mode 100644
index 0000000000..c4b4bb2763
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader.reply
@@ -0,0 +1,8 @@
+HTTP/1.0 200 OK
+Connection: close
+Content-type: text/html; charset=UTF-8
+Test-Header: TestValue
+MultiTest-Header: TestValue
+MultiTest-Header: SecondTestValue
+Set-Cookie: mycook=Value
+Set-Cookie2: mycook=Value
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_args.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_args.qml
new file mode 100644
index 0000000000..dccc71dfc3
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_args.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool exceptionThrown: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "testdocument.html");
+ x.send();
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ try {
+ x.getResponseHeader();
+ } catch (e) {
+ if (e.code == DOMException.SYNTAX_ERR)
+ exceptionThrown = true;
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_sent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_sent.qml
new file mode 100644
index 0000000000..cff7af79e2
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_sent.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "testdocument.html");
+ x.send();
+
+ try {
+ x.getResponseHeader("Test-header");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_unsent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_unsent.qml
new file mode 100644
index 0000000000..ad2ea0bd33
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/getResponseHeader_unsent.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.getResponseHeader("Test-header");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/instanceStateValues.qml b/tests/auto/qml/qqmlxmlhttprequest/data/instanceStateValues.qml
new file mode 100644
index 0000000000..b3a54e9b53
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/instanceStateValues.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+QtObject {
+ property int unsent
+ property int opened
+ property int headers_received
+ property int loading
+ property int done
+
+ Component.onCompleted: {
+ // Attempt to overwrite and delete values
+ var x = new XMLHttpRequest();
+
+ x.UNSENT = 9;
+ x.OPENED = 9;
+ x.HEADERS_RECEIVED = 9;
+ x.LOADING = 9;
+ x.DONE = 9;
+
+ delete x.UNSENT;
+ delete x.OPENED;
+ delete x.HEADERS_RECEIVED;
+ delete x.LOADING;
+ delete x.DONE;
+
+ unsent = x.UNSENT
+ opened = x.OPENED
+ headers_received = x.HEADERS_RECEIVED
+ loading = x.LOADING
+ done = x.DONE
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml b/tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml
new file mode 100644
index 0000000000..5a4093b9f1
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/invalidMethodUsage.qml
@@ -0,0 +1,148 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool readyState: false
+ property bool status: false
+ property bool statusText: false
+ property bool responseText: false
+ property bool responseXML: false
+
+ property bool open: false
+ property bool setRequestHeader: false
+ property bool send: false
+ property bool abort: false
+ property bool getResponseHeader: false
+ property bool getAllResponseHeaders: false
+
+ Component.onCompleted: {
+ var o = 10;
+
+ try {
+ XMLHttpRequest.prototype.readyState
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ readyState = true;
+ }
+ try {
+ XMLHttpRequest.prototype.status
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ status = true;
+ }
+ try {
+ XMLHttpRequest.prototype.statusText
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ statusText = true;
+ }
+ try {
+ XMLHttpRequest.prototype.responseText
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ responseText = true;
+ }
+ try {
+ XMLHttpRequest.prototype.responseXML
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ responseXML = true;
+ }
+
+ try {
+ XMLHttpRequest.prototype.open.call(o);
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ open = true;
+ }
+
+ try {
+ XMLHttpRequest.prototype.setRequestHeader.call(o);
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ setRequestHeader = true;
+ }
+
+ try {
+ XMLHttpRequest.prototype.send.call(o);
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ send = true;
+ }
+
+ try {
+ XMLHttpRequest.prototype.abort.call(o);
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ abort = true;
+ }
+
+ try {
+ XMLHttpRequest.prototype.getResponseHeader.call(o);
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ getResponseHeader = true;
+ }
+
+ try {
+ XMLHttpRequest.prototype.getAllResponseHeaders.call(o);
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ return;
+
+ if (e.message != "Not an XMLHttpRequest object")
+ return;
+
+ getAllResponseHeaders = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open.qml b/tests/auto/qml/qqmlxmlhttprequest/data/open.qml
new file mode 100644
index 0000000000..6e7681dfb4
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool status: false
+ property bool statusText: false
+ property bool responseText: false
+ property bool responseXML: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ var a = x.status;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ status = true;
+ }
+ try {
+ var a = x.statusText;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusText = true;
+ }
+ responseText = (x.responseText == "");
+ responseXML = (x.responseXML == null);
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+
+ x.send()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.1.qml b/tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.1.qml
new file mode 100644
index 0000000000..61ef76d488
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.1.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool exceptionThrown: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.open("GET");
+ } catch (e) {
+ if (e.code == DOMException.SYNTAX_ERR)
+ exceptionThrown = true;
+ }
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.2.qml b/tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.2.qml
new file mode 100644
index 0000000000..677759ccf3
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_arg_count.2.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool exceptionThrown: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.open("GET", "http://www.nokia.com", true, "user", "password", "extra");
+ } catch (e) {
+ if (e.code == DOMException.SYNTAX_ERR)
+ exceptionThrown = true;
+ }
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_invalid_method.qml b/tests/auto/qml/qqmlxmlhttprequest/data/open_invalid_method.qml
new file mode 100644
index 0000000000..0f29031e42
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_invalid_method.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool exceptionThrown: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.open("BLAH", "http://www.nokia.com");
+ } catch (e) {
+ if (e.code == DOMException.SYNTAX_ERR)
+ exceptionThrown = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_network.expect b/tests/auto/qml/qqmlxmlhttprequest/data/open_network.expect
new file mode 100644
index 0000000000..cf5830ed0c
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_network.expect
@@ -0,0 +1,7 @@
+GET /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_network.reply b/tests/auto/qml/qqmlxmlhttprequest/data/open_network.reply
new file mode 100644
index 0000000000..7ae6951f9b
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_network.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 200 OK
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_network.wait b/tests/auto/qml/qqmlxmlhttprequest/data/open_network.wait
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_network.wait
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_sync.qml b/tests/auto/qml/qqmlxmlhttprequest/data/open_sync.qml
new file mode 100644
index 0000000000..eafdda761f
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_sync.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool exceptionThrown: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.open("GET", "http://www.nokia.com", false);
+ } catch (e) {
+ if (e.code == DOMException.NOT_SUPPORTED_ERR)
+ exceptionThrown = true;
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_user.qml b/tests/auto/qml/qqmlxmlhttprequest/data/open_user.qml
new file mode 100644
index 0000000000..4eaef536b3
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_user.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool status: false
+ property bool statusText: false
+ property bool responseText: false
+ property bool responseXML: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("GET", url, true, "username", "password");
+ x.setRequestHeader("Accept-Language","en-US");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ var a = x.status;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ status = true;
+ }
+ try {
+ var a = x.statusText;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusText = true;
+ }
+ responseText = (x.responseText == "");
+ responseXML = (x.responseXML == null);
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+
+ x.send()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/open_username.qml b/tests/auto/qml/qqmlxmlhttprequest/data/open_username.qml
new file mode 100644
index 0000000000..b8ce5361f3
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/open_username.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool status: false
+ property bool statusText: false
+ property bool responseText: false
+ property bool responseXML: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("GET", url, true, "sampleusername", "password");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ var a = x.status;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ status = true;
+ }
+ try {
+ var a = x.statusText;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusText = true;
+ }
+ responseText = (x.responseText == "");
+ responseXML = (x.responseXML == null);
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+
+ x.send()
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml b/tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml
new file mode 100644
index 0000000000..e5c7b74553
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/redirectError.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+ property bool done: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("GET", url);
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ done = true;
+ dataOK = x.status == 404;
+ }
+ }
+
+ x.send();
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml b/tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml
new file mode 100644
index 0000000000..0894573ecc
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/redirectRecur.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+ property bool done: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("GET", url);
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ done = true;
+ dataOK = x.status == 302;
+ }
+ }
+
+ x.send();
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml b/tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml
new file mode 100644
index 0000000000..003d1954e9
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/redirects.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+ property bool done: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("GET", url);
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ done = true;
+ dataOK = x.responseText == "Redirected\n";
+ }
+ }
+
+ x.send();
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/redirecttarget.html b/tests/auto/qml/qqmlxmlhttprequest/data/redirecttarget.html
new file mode 100644
index 0000000000..95f35e01c7
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/redirecttarget.html
@@ -0,0 +1 @@
+Redirected
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/responseText.qml b/tests/auto/qml/qqmlxmlhttprequest/data/responseText.qml
new file mode 100644
index 0000000000..4b216d9c85
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/responseText.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+ property string expectedText
+
+ property bool unsent: false
+ property bool opened: false
+ property bool sent: false
+ property bool headersReceived: false
+
+ property bool loading: false
+ property bool done: false
+
+ property bool reset: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ unsent = (x.responseText == "");
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ opened = (x.responseText == "");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ headersReceived = (x.responseText == "");
+ } else if (x.readyState == XMLHttpRequest.LOADING) {
+ if (x.responseText == expectedText)
+ loading = true;
+ } else if (x.readyState == XMLHttpRequest.DONE) {
+ if (x.responseText == expectedText)
+ done = true;
+
+ dataOK = (x.responseText == expectedText);
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ reset = (x.responseText == "");
+ }
+ }
+
+ x.send()
+
+ sent = (x.responseText == "");
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/responseXML_invalid.qml b/tests/auto/qml/qqmlxmlhttprequest/data/responseXML_invalid.qml
new file mode 100644
index 0000000000..e9265e09ef
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/responseXML_invalid.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool xmlNull: false
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "testdocument.html");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ xmlNull = (x.responseXML == null);
+ }
+ }
+
+
+ x.send()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/seconddocument.html b/tests/auto/qml/qqmlxmlhttprequest/data/seconddocument.html
new file mode 100644
index 0000000000..a33f44bcb5
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/seconddocument.html
@@ -0,0 +1 @@
+This should not be read!
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml
new file mode 100644
index 0000000000..4e0caa7171
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_alreadySent.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool dataOK: false
+ property bool test: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("GET", "testdocument.html");
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send();
+
+ try {
+ x.send()
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.expect
new file mode 100644
index 0000000000..9c07d4b633
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.expect
@@ -0,0 +1,10 @@
+POST /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Content-Type: text/plain;charset=UTF-8
+Content-Length: 12
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
+My Sent Data \ No newline at end of file
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.qml
new file mode 100644
index 0000000000..6faac0242f
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.1.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("POST", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("My Sent Data");
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.2.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.2.qml
new file mode 100644
index 0000000000..383a76e75e
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("POST", url);
+ x.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("My Sent Data");
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.3.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.3.qml
new file mode 100644
index 0000000000..5cb8c926c2
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.3.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("POST", url);
+ x.setRequestHeader("Content-Type", "text/plain;charset=latin1");
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("My Sent Data");
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.expect
new file mode 100644
index 0000000000..c2aba77881
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.expect
@@ -0,0 +1,10 @@
+POST /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Content-Type: charset=UTF-8;text/plain
+Content-Length: 12
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
+My Sent Data \ No newline at end of file
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.qml
new file mode 100644
index 0000000000..884661c8ce
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.4.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("POST", url);
+ x.setRequestHeader("Content-Type", "charset=UTF-8;text/plain");
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("My Sent Data");
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.5.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.5.qml
new file mode 100644
index 0000000000..c031b84418
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.5.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("POST", url);
+ x.setRequestHeader("Content-Type", "charset=latin1;text/plain");
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("My Sent Data");
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.expect
new file mode 100644
index 0000000000..b09b1bcec5
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.expect
@@ -0,0 +1,10 @@
+PUT /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Content-Type: text/plain;charset=UTF-8
+Content-Length: 12
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
+My Sent Data \ No newline at end of file
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.qml
new file mode 100644
index 0000000000..42eb360d14
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.6.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("PUT", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("My Sent Data");
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.7.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.7.qml
new file mode 100644
index 0000000000..5dc252f970
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.7.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open("POST", url);
+ x.setRequestHeader("Content-Type", "text/plain");
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("My Sent Data");
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_data.reply b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.reply
new file mode 100644
index 0000000000..7ae6951f9b
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_data.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 200 OK
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.qml
new file mode 100644
index 0000000000..336971c919
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+QtObject {
+ property string reqType
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+ x.open(reqType, url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ if (reqType == "HEAD" || reqType == "DELETE")
+ dataOK = (x.responseText == "");
+ else
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send("Data To Ignore");
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.reply b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.reply
new file mode 100644
index 0000000000..7ae6951f9b
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 200 OK
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_DELETE.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_DELETE.expect
new file mode 100644
index 0000000000..dd86b837f4
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_DELETE.expect
@@ -0,0 +1,7 @@
+DELETE /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_GET.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_GET.expect
new file mode 100644
index 0000000000..cf5830ed0c
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_GET.expect
@@ -0,0 +1,7 @@
+GET /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_HEAD.expect b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_HEAD.expect
new file mode 100644
index 0000000000..7b7b282660
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_ignoreData_HEAD.expect
@@ -0,0 +1,7 @@
+HEAD /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_unsent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_unsent.qml
new file mode 100644
index 0000000000..ef56517bf5
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_unsent.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.send();
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.expect b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.expect
new file mode 100644
index 0000000000..e7f8e10780
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.expect
@@ -0,0 +1,9 @@
+GET /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Test-header: value
+Test-header2: value,value2
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.qml b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.qml
new file mode 100644
index 0000000000..4229584af2
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ x.setRequestHeader("Test-header", "value");
+ x.setRequestHeader("Test-header2", "value");
+ x.setRequestHeader("Test-header2", "value2");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send();
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.reply b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.reply
new file mode 100644
index 0000000000..7ae6951f9b
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 200 OK
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_args.qml b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_args.qml
new file mode 100644
index 0000000000..1cef3e43da
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_args.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool exceptionThrown: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "testdocument.html");
+
+ try {
+ x.setRequestHeader("Test-header");
+ } catch (e) {
+ if (e.code == DOMException.SYNTAX_ERR)
+ exceptionThrown = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_caseInsensitive.qml b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_caseInsensitive.qml
new file mode 100644
index 0000000000..e03f73431a
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_caseInsensitive.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ x.setRequestHeader("Test-header", "value");
+ //Setting headers with just different cases
+ //will be treated as the same header, and accepted
+ //as the last setting.
+ x.setRequestHeader("Test-hEADEr2", "value");
+ x.setRequestHeader("Test-header2", "value2");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send();
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_illegalName.qml b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_illegalName.qml
new file mode 100644
index 0000000000..cd047cf8dd
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_illegalName.qml
@@ -0,0 +1,58 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+ property string header
+
+ property bool readyState: false
+ property bool openedState: false
+
+ property bool status: false
+ property bool statusText: false
+ property bool responseText: false
+ property bool responseXML: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ if (x.readyState == XMLHttpRequest.UNSENT)
+ readyState = true;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ x.setRequestHeader(header, "Value");
+
+ if (x.readyState == XMLHttpRequest.OPENED)
+ openedState = true;
+
+ try {
+ var a = x.status;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ status = true;
+ }
+ try {
+ var a = x.statusText;
+ } catch (error) {
+ if (error.code == DOMException.INVALID_STATE_ERR)
+ statusText = true;
+ }
+ responseText = (x.responseText == "");
+ responseXML = (x.responseXML == null);
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+
+ x.send()
+ }
+}
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_sent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_sent.qml
new file mode 100644
index 0000000000..49888fdac8
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_sent.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+ property bool test: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language","en-US");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ dataOK = (x.responseText == "QML Rocks!\n");
+ }
+ }
+
+ x.send();
+
+ try {
+ x.setRequestHeader("Test-header", "value");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_unsent.qml b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_unsent.qml
new file mode 100644
index 0000000000..f528aa912c
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/setRequestHeader_unsent.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool test: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ x.setRequestHeader("Test-header", "value");
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ test = true;
+ }
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/stateChangeCallingContext.qml b/tests/auto/qml/qqmlxmlhttprequest/data/stateChangeCallingContext.qml
new file mode 100644
index 0000000000..f44f4f926c
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/stateChangeCallingContext.qml
@@ -0,0 +1,63 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property int whichCount: 0
+ property bool success: false
+
+ SequentialAnimation {
+ id: anim
+ PauseAnimation { duration: 525 } // delay mode is 500 msec.
+ ScriptAction { script: loadcomponent(0) }
+ PauseAnimation { duration: 525 } // delay mode is 500 msec.
+ ScriptAction { script: loadcomponent(1) }
+ PauseAnimation { duration: 525 } // delay mode is 500 msec.
+ ScriptAction { script: if (whichCount == 2) root.success = true; else console.log("failed to load testlist"); }
+ }
+
+ Component.onCompleted: {
+ updateList();
+ anim.start();
+ }
+
+ function updateList() {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET","http://127.0.0.1:14445/testlist"); // list of components
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ var components = xhr.responseText.split('\n');
+ var i;
+ for (i=0; i<components.length; i++) {
+ var pair = components[i].split(";")
+ if (pair.length == 2) {
+ // Trim any unwanted whitespace
+ var name = pair[0].replace(/^\s+|\s+$/g, "")
+ var url = pair[1].replace(/^\s+|\s+$/g, "")
+ componentlist.append({"Name" : name, "url" : url})
+ }
+ }
+ }
+ }
+ xhr.send()
+ }
+
+ function loadcomponent(which) {
+ if (componentlist.count > which) {
+ loader.source = componentlist.get(which).url;
+ whichCount += 1;
+ }
+ }
+
+ Loader {
+ id: loader
+ signal finished
+
+ anchors.fill: parent
+ onStatusChanged: {
+ if (status == Loader.Error) { finished(); next(); }
+ }
+ }
+
+ ListModel { id: componentlist }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/staticStateValues.qml b/tests/auto/qml/qqmlxmlhttprequest/data/staticStateValues.qml
new file mode 100644
index 0000000000..1b701e90ff
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/staticStateValues.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+QtObject {
+ property int unsent: XMLHttpRequest.UNSENT
+ property int opened: XMLHttpRequest.OPENED
+ property int headers_received: XMLHttpRequest.HEADERS_RECEIVED
+ property int loading: XMLHttpRequest.LOADING
+ property int done: XMLHttpRequest.DONE
+
+ Component.onCompleted: {
+ // Attempt to overwrite and delete values
+ XMLHttpRequest.UNSENT = 9;
+ XMLHttpRequest.OPENED = 9;
+ XMLHttpRequest.HEADERS_RECEIVED = 9;
+ XMLHttpRequest.LOADING = 9;
+ XMLHttpRequest.DONE = 9;
+
+ delete XMLHttpRequest.UNSENT;
+ delete XMLHttpRequest.OPENED;
+ delete XMLHttpRequest.HEADERS_RECEIVED;
+ delete XMLHttpRequest.LOADING;
+ delete XMLHttpRequest.DONE;
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/status.200.reply b/tests/auto/qml/qqmlxmlhttprequest/data/status.200.reply
new file mode 100644
index 0000000000..7ae6951f9b
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/status.200.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 200 OK
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/status.400.reply b/tests/auto/qml/qqmlxmlhttprequest/data/status.400.reply
new file mode 100644
index 0000000000..c158fbb33d
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/status.400.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 400 Bad request
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/status.404.reply b/tests/auto/qml/qqmlxmlhttprequest/data/status.404.reply
new file mode 100644
index 0000000000..2e29f56d41
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/status.404.reply
@@ -0,0 +1,3 @@
+HTTP/1.0 404 Document not found
+Connection: close
+Content-type: text/html; charset=UTF-8
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/status.expect b/tests/auto/qml/qqmlxmlhttprequest/data/status.expect
new file mode 100644
index 0000000000..cf5830ed0c
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/status.expect
@@ -0,0 +1,7 @@
+GET /testdocument.html HTTP/1.1
+Accept-Language: en-US
+Connection: Keep-Alive
+Accept-Encoding: gzip, deflate
+User-Agent: Mozilla/5.0
+Host: 127.0.0.1:14445
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/status.qml b/tests/auto/qml/qqmlxmlhttprequest/data/status.qml
new file mode 100644
index 0000000000..5feac17711
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/status.qml
@@ -0,0 +1,75 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+ property int expectedStatus
+
+ property bool unsentException: false;
+ property bool openedException: false;
+ property bool sentException: false;
+
+ property bool headersReceived: false
+ property bool loading: false
+ property bool done: false
+
+ property bool resetException: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ var a = x.status;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ unsentException = true;
+ }
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ try {
+ var a = x.status;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ openedException = true;
+ }
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ if (x.status == expectedStatus)
+ headersReceived = true;
+ } else if (x.readyState == XMLHttpRequest.LOADING) {
+ if (x.status == expectedStatus)
+ loading = true;
+ } else if (x.readyState == XMLHttpRequest.DONE) {
+ if (x.status == expectedStatus)
+ done = true;
+
+ dataOK = (x.responseText == "QML Rocks!\n");
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ try {
+ var a = x.status;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ resetException = true;
+ }
+
+ }
+ }
+
+ x.send()
+
+ try {
+ var a = x.status;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ sentException = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml b/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml
new file mode 100644
index 0000000000..3c74efc091
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/statusText.qml
@@ -0,0 +1,75 @@
+import QtQuick 2.0
+
+QtObject {
+ property string url
+ property string expectedStatus
+
+ property bool unsentException: false;
+ property bool openedException: false;
+ property bool sentException: false;
+
+ property bool headersReceived: false
+ property bool loading: false
+ property bool done: false
+
+ property bool resetException: false
+
+ property bool dataOK: false
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ try {
+ var a = x.statusText;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ unsentException = true;
+ }
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ try {
+ var a = x.statusText;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ openedException = true;
+ }
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ if (x.statusText == expectedStatus)
+ headersReceived = true;
+ } else if (x.readyState == XMLHttpRequest.LOADING) {
+ if (x.statusText == expectedStatus)
+ loading = true;
+ } else if (x.readyState == XMLHttpRequest.DONE) {
+ if (x.statusText == expectedStatus)
+ done = true;
+
+ dataOK = (x.responseText == "QML Rocks!\n");
+
+ x.open("GET", url);
+ x.setRequestHeader("Accept-Language", "en-US");
+
+ try {
+ var a = x.statusText;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ resetException = true;
+ }
+
+ }
+ }
+
+ x.send()
+
+ try {
+ var a = x.statusText;
+ } catch (e) {
+ if (e.code == DOMException.INVALID_STATE_ERR)
+ sentException = true;
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/testdocument.html b/tests/auto/qml/qqmlxmlhttprequest/data/testdocument.html
new file mode 100644
index 0000000000..8fe0f4b0e2
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/testdocument.html
@@ -0,0 +1 @@
+QML Rocks!
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/testlist b/tests/auto/qml/qqmlxmlhttprequest/data/testlist
new file mode 100644
index 0000000000..cd9dd14511
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/testlist
@@ -0,0 +1,3 @@
+One;TestComponent.qml
+Two;TestComponent2.qml
+Three;TestComponent3.qml
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/text.qml b/tests/auto/qml/qqmlxmlhttprequest/data/text.qml
new file mode 100644
index 0000000000..b79e0bc7b1
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/text.qml
@@ -0,0 +1,129 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool xmlTest: false
+ property bool dataOK: false
+
+ function checkText(text, whitespacetext)
+ {
+ if (text == null)
+ return;
+
+ if (text.nodeName != "#text")
+ return;
+
+ if (text.nodeValue != "Hello world!")
+ return;
+
+ if (text.nodeType != 3)
+ return;
+
+ if (text.parentNode.nodeName != "item")
+ return;
+
+ if (text.childNodes.length != 0)
+ return;
+
+ if (text.firstChild != null)
+ return;
+
+ if (text.lastChild != null)
+ return;
+
+ if (text.previousSibling != null)
+ return;
+
+ if (text.nextSibling != null)
+ return;
+
+ if (text.attributes != null)
+ return;
+
+ if (text.wholeText != "Hello world!")
+ return;
+
+ if (text.data != "Hello world!")
+ return;
+
+ if (text.length != 12)
+ return;
+
+ if (text.isElementContentWhitespace != false)
+ return;
+
+ if (whitespacetext.nodeName != "#text")
+ return;
+
+ if (whitespacetext.nodeValue != " ")
+ return;
+
+ if (whitespacetext.nodeType != 3)
+ return;
+
+ if (whitespacetext.parentNode.nodeName != "item")
+ return;
+
+ if (whitespacetext.childNodes.length != 0)
+ return;
+
+ if (whitespacetext.firstChild != null)
+ return;
+
+ if (whitespacetext.lastChild != null)
+ return;
+
+ if (whitespacetext.previousSibling != null)
+ return;
+
+ if (whitespacetext.nextSibling != null)
+ return;
+
+ if (whitespacetext.attributes != null)
+ return;
+
+ if (whitespacetext.wholeText != " ")
+ return;
+
+ if (whitespacetext.data != " ")
+ return;
+
+ if (whitespacetext.length != 3)
+ return;
+
+ if (whitespacetext.isElementContentWhitespace != true)
+ return;
+
+ xmlTest = true;
+ }
+
+ function checkXML(document)
+ {
+ checkText(document.documentElement.childNodes[0].childNodes[0],
+ document.documentElement.childNodes[1].childNodes[0]);
+
+ }
+
+ Component.onCompleted: {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", "text.xml");
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+
+ dataOK = true;
+
+ if (x.responseXML != null)
+ checkXML(x.responseXML);
+
+ }
+ }
+
+ x.send()
+ }
+}
+
+
+
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/text.xml b/tests/auto/qml/qqmlxmlhttprequest/data/text.xml
new file mode 100644
index 0000000000..e7416888fd
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/text.xml
@@ -0,0 +1 @@
+<root><item>Hello world!</item><item> </item></root>
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/utf16.html b/tests/auto/qml/qqmlxmlhttprequest/data/utf16.html
new file mode 100644
index 0000000000..b640733f1e
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/utf16.html
@@ -0,0 +1 @@
+უ Σ
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/utf16.qml b/tests/auto/qml/qqmlxmlhttprequest/data/utf16.qml
new file mode 100644
index 0000000000..7c024bfda6
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/utf16.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool dataOK: false
+
+ property string fileName
+ property string responseText
+ property string responseXmlRootNodeValue
+
+ function startRequest() {
+ var x = new XMLHttpRequest;
+
+ x.open("GET", fileName);
+
+ // Test to the end
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+
+ responseText = x.responseText
+ if (x.responseXML)
+ responseXmlRootNodeValue = x.responseXML.documentElement.childNodes[0].nodeValue
+
+ dataOK = true;
+ }
+ }
+ x.send()
+ }
+}
+
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/utf16.xml b/tests/auto/qml/qqmlxmlhttprequest/data/utf16.xml
new file mode 100644
index 0000000000..0fbb126ed8
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/data/utf16.xml
Binary files differ
diff --git a/tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro b/tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro
new file mode 100644
index 0000000000..f1fbfde0ec
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/qqmlxmlhttprequest.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_qqmlxmlhttprequest
+macx:CONFIG -= app_bundle
+
+CONFIG+=insignificant_test # QTQAINFRA-573
+
+INCLUDEPATH += ../../shared/
+HEADERS += ../../shared/testhttpserver.h
+
+SOURCES += tst_qqmlxmlhttprequest.cpp \
+ ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
new file mode 100644
index 0000000000..3ae27fe9c3
--- /dev/null
+++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
@@ -0,0 +1,1183 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QDebug>
+#include <QScopedPointer>
+#include <QNetworkCookieJar>
+#include "testhttpserver.h"
+#include "../../shared/util.h"
+
+#define SERVER_PORT 14445
+
+class tst_qqmlxmlhttprequest : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qqmlxmlhttprequest() {}
+
+private slots:
+ void domExceptionCodes();
+ void callbackException();
+ void callbackException_data();
+ void staticStateValues();
+ void instanceStateValues();
+ void constructor();
+ void defaultState();
+ void open();
+ void open_data();
+ void open_invalid_method();
+ void open_sync();
+ void open_arg_count();
+ void setRequestHeader();
+ void setRequestHeader_caseInsensitive();
+ void setRequestHeader_unsent();
+ void setRequestHeader_illegalName_data();
+ void setRequestHeader_illegalName();
+ void setRequestHeader_sent();
+ void setRequestHeader_args();
+ void send_unsent();
+ void send_alreadySent();
+ void send_ignoreData();
+ void send_withdata();
+ void send_withdata_data();
+ void abort();
+ void abort_unsent();
+ void abort_opened();
+ void getResponseHeader();
+ void getResponseHeader_unsent();
+ void getResponseHeader_sent();
+ void getResponseHeader_args();
+ void getAllResponseHeaders();
+ void getAllResponseHeaders_unsent();
+ void getAllResponseHeaders_sent();
+ void getAllResponseHeaders_args();
+ void status();
+ void status_data();
+ void statusText();
+ void statusText_data();
+ void responseText();
+ void responseText_data();
+ void responseXML_invalid();
+ void invalidMethodUsage();
+ void redirects();
+ void nonUtf8();
+ void nonUtf8_data();
+
+ // Attributes
+ void document();
+ void element();
+ void attr();
+ void text();
+ void cdata();
+
+ // Crashes
+ // void outstanding_request_at_shutdown();
+
+ // void network_errors()
+ // void readyState()
+
+ void stateChangeCallingContext();
+
+private:
+ QQmlEngine engine;
+};
+
+// Test that the dom exception codes are correct
+void tst_qqmlxmlhttprequest::domExceptionCodes()
+{
+ QQmlComponent component(&engine, testFileUrl("domExceptionCodes.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("index_size_err").toInt(), 1);
+ QCOMPARE(object->property("domstring_size_err").toInt(), 2);
+ QCOMPARE(object->property("hierarchy_request_err").toInt(), 3);
+ QCOMPARE(object->property("wrong_document_err").toInt(), 4);
+ QCOMPARE(object->property("invalid_character_err").toInt(), 5);
+ QCOMPARE(object->property("no_data_allowed_err").toInt(), 6);
+ QCOMPARE(object->property("no_modification_allowed_err").toInt(), 7);
+ QCOMPARE(object->property("not_found_err").toInt(), 8);
+ QCOMPARE(object->property("not_supported_err").toInt(), 9);
+ QCOMPARE(object->property("inuse_attribute_err").toInt(), 10);
+ QCOMPARE(object->property("invalid_state_err").toInt(), 11);
+ QCOMPARE(object->property("syntax_err").toInt(), 12);
+ QCOMPARE(object->property("invalid_modification_err").toInt(), 13);
+ QCOMPARE(object->property("namespace_err").toInt(), 14);
+ QCOMPARE(object->property("invalid_access_err").toInt(), 15);
+ QCOMPARE(object->property("validation_err").toInt(), 16);
+ QCOMPARE(object->property("type_mismatch_err").toInt(), 17);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::callbackException_data()
+{
+ QTest::addColumn<QString>("which");
+ QTest::addColumn<int>("line");
+
+ QTest::newRow("on-opened") << "1" << 15;
+ QTest::newRow("on-loading") << "3" << 15;
+ QTest::newRow("on-done") << "4" << 15;
+}
+
+void tst_qqmlxmlhttprequest::callbackException()
+{
+ // Test exception reporting for exceptions thrown at various points.
+
+ QFETCH(QString, which);
+ QFETCH(int, line);
+
+ QString expect = testFileUrl("callbackException.qml").toString() + ":"+QString::number(line)+": Error: Exception from Callback";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
+
+ QQmlComponent component(&engine, testFileUrl("callbackException.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "testdocument.html");
+ object->setProperty("which", which);
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("threw").toBool() == true);
+
+ delete object;
+}
+
+// Test that the state value properties on the XMLHttpRequest constructor have the correct values.
+// ### WebKit does not do this, but it seems to fit the standard and QML better
+void tst_qqmlxmlhttprequest::staticStateValues()
+{
+ QQmlComponent component(&engine, testFileUrl("staticStateValues.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("unsent").toInt(), 0);
+ QCOMPARE(object->property("opened").toInt(), 1);
+ QCOMPARE(object->property("headers_received").toInt(), 2);
+ QCOMPARE(object->property("loading").toInt(), 3);
+ QCOMPARE(object->property("done").toInt(), 4);
+
+ delete object;
+}
+
+// Test that the state value properties on instances have the correct values.
+void tst_qqmlxmlhttprequest::instanceStateValues()
+{
+ QQmlComponent component(&engine, testFileUrl("instanceStateValues.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("unsent").toInt(), 0);
+ QCOMPARE(object->property("opened").toInt(), 1);
+ QCOMPARE(object->property("headers_received").toInt(), 2);
+ QCOMPARE(object->property("loading").toInt(), 3);
+ QCOMPARE(object->property("done").toInt(), 4);
+
+ delete object;
+}
+
+// Test calling constructor
+void tst_qqmlxmlhttprequest::constructor()
+{
+ QQmlComponent component(&engine, testFileUrl("constructor.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("calledAsConstructor").toBool(), true);
+ QCOMPARE(object->property("calledAsFunction").toBool(), true);
+
+ delete object;
+}
+
+// Test that all the properties are set correctly before any request is sent
+void tst_qqmlxmlhttprequest::defaultState()
+{
+ QQmlComponent component(&engine, testFileUrl("defaultState.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("readState").toInt(), 0);
+ QCOMPARE(object->property("statusIsException").toBool(), true);
+ QCOMPARE(object->property("statusTextIsException").toBool(), true);
+ QCOMPARE(object->property("responseText").toString(), QString());
+ QCOMPARE(object->property("responseXMLIsNull").toBool(), true);
+
+ delete object;
+}
+
+// Test valid XMLHttpRequest.open() calls
+void tst_qqmlxmlhttprequest::open()
+{
+ QFETCH(QUrl, qmlFile);
+ QFETCH(QString, url);
+ QFETCH(bool, remote);
+
+ QScopedPointer<TestHTTPServer> server; // ensure deletion in case test fails
+ if (remote) {
+ server.reset(new TestHTTPServer(SERVER_PORT));
+ QVERIFY(server->isValid());
+ QVERIFY(server->wait(testFileUrl("open_network.expect"),
+ testFileUrl("open_network.reply"),
+ testFileUrl("testdocument.html")));
+ }
+
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", url);
+ component.completeCreate();
+
+ QCOMPARE(object->property("readyState").toBool(), true);
+ QCOMPARE(object->property("openedState").toBool(), true);
+ QCOMPARE(object->property("status").toBool(), true);
+ QCOMPARE(object->property("statusText").toBool(), true);
+ QCOMPARE(object->property("responseText").toBool(), true);
+ QCOMPARE(object->property("responseXML").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::open_data()
+{
+ QTest::addColumn<QUrl>("qmlFile");
+ QTest::addColumn<QString>("url");
+ QTest::addColumn<bool>("remote");
+
+ QTest::newRow("Relative url)") << testFileUrl("open.qml") << "testdocument.html" << false;
+ QTest::newRow("Absolute url)") << testFileUrl("open.qml") << testFileUrl("testdocument.html").toString() << false;
+ QTest::newRow("Absolute network url)") << testFileUrl("open.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
+
+ // ### Check that the username/password were sent to the server
+ QTest::newRow("User/pass") << testFileUrl("open_user.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
+}
+
+// Test that calling XMLHttpRequest.open() with an invalid method raises an exception
+void tst_qqmlxmlhttprequest::open_invalid_method()
+{
+ QQmlComponent component(&engine, testFileUrl("open_invalid_method.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("exceptionThrown").toBool(), true);
+
+ delete object;
+}
+
+// Test that calling XMLHttpRequest.open() with sync raises an exception
+void tst_qqmlxmlhttprequest::open_sync()
+{
+ QQmlComponent component(&engine, testFileUrl("open_sync.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("exceptionThrown").toBool(), true);
+
+ delete object;
+}
+
+// Calling with incorrect arg count raises an exception
+void tst_qqmlxmlhttprequest::open_arg_count()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("open_arg_count.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("exceptionThrown").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("open_arg_count.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("exceptionThrown").toBool(), true);
+
+ delete object;
+ }
+}
+
+// Test valid setRequestHeader() calls
+void tst_qqmlxmlhttprequest::setRequestHeader()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("setRequestHeader.expect"),
+ testFileUrl("setRequestHeader.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("setRequestHeader.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+// Test valid setRequestHeader() calls with different header cases
+void tst_qqmlxmlhttprequest::setRequestHeader_caseInsensitive()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("setRequestHeader.expect"),
+ testFileUrl("setRequestHeader.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("setRequestHeader_caseInsensitive.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+// Test setting headers before open() throws exception
+void tst_qqmlxmlhttprequest::setRequestHeader_unsent()
+{
+ QQmlComponent component(&engine, testFileUrl("setRequestHeader_unsent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::setRequestHeader_illegalName_data()
+{
+ QTest::addColumn<QString>("name");
+
+ QTest::newRow("Accept-Charset") << "AccePT-CHArset";
+ QTest::newRow("Accept-Encoding") << "AccEpt-EnCOding";
+ QTest::newRow("Connection") << "ConnECtion";
+ QTest::newRow("Content-Length") << "ContEnt-LenGth";
+ QTest::newRow("Cookie") << "CookIe";
+ QTest::newRow("Cookie2") << "CoOkie2";
+ QTest::newRow("Content-Transfer-Encoding") << "ConteNT-tRANSFER-eNCOding";
+ QTest::newRow("Date") << "DaTE";
+ QTest::newRow("Expect") << "ExPect";
+ QTest::newRow("Host") << "HoST";
+ QTest::newRow("Keep-Alive") << "KEEP-aLive";
+ QTest::newRow("Referer") << "ReferEr";
+ QTest::newRow("TE") << "Te";
+ QTest::newRow("Trailer") << "TraILEr";
+ QTest::newRow("Transfer-Encoding") << "tRANsfer-Encoding";
+ QTest::newRow("Upgrade") << "UpgrADe";
+ QTest::newRow("User-Agent") << "uSEr-Agent";
+ QTest::newRow("Via") << "vIa";
+ QTest::newRow("Proxy-") << "ProXy-";
+ QTest::newRow("Sec-") << "SeC-";
+ QTest::newRow("Proxy-*") << "Proxy-BLAH";
+ QTest::newRow("Sec-*") << "Sec-F";
+}
+
+// Tests that using illegal header names has no effect
+void tst_qqmlxmlhttprequest::setRequestHeader_illegalName()
+{
+ QFETCH(QString, name);
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("open_network.expect"),
+ testFileUrl("open_network.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("setRequestHeader_illegalName.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("header", name);
+ component.completeCreate();
+
+ QCOMPARE(object->property("readyState").toBool(), true);
+ QCOMPARE(object->property("openedState").toBool(), true);
+ QCOMPARE(object->property("status").toBool(), true);
+ QCOMPARE(object->property("statusText").toBool(), true);
+ QCOMPARE(object->property("responseText").toBool(), true);
+ QCOMPARE(object->property("responseXML").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+// Test that attempting to set a header after a request is sent throws an exception
+void tst_qqmlxmlhttprequest::setRequestHeader_sent()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("open_network.expect"),
+ testFileUrl("open_network.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("setRequestHeader_sent.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+// Invalid arg count throws exception
+void tst_qqmlxmlhttprequest::setRequestHeader_args()
+{
+ QQmlComponent component(&engine, testFileUrl("setRequestHeader_args.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("exceptionThrown").toBool(), true);
+
+ delete object;
+}
+
+// Test that calling send() in UNSENT state throws an exception
+void tst_qqmlxmlhttprequest::send_unsent()
+{
+ QQmlComponent component(&engine, testFileUrl("send_unsent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// Test attempting to resend a sent request throws an exception
+void tst_qqmlxmlhttprequest::send_alreadySent()
+{
+ QQmlComponent component(&engine, testFileUrl("send_alreadySent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+// Test that sends for GET, HEAD and DELETE ignore data
+void tst_qqmlxmlhttprequest::send_ignoreData()
+{
+ {
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("send_ignoreData_GET.expect"),
+ testFileUrl("send_ignoreData.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("send_ignoreData.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("reqType", "GET");
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+ }
+
+ {
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("send_ignoreData_HEAD.expect"),
+ testFileUrl("send_ignoreData.reply"),
+ QUrl()));
+
+ QQmlComponent component(&engine, testFileUrl("send_ignoreData.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("reqType", "HEAD");
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+ }
+
+ {
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("send_ignoreData_DELETE.expect"),
+ testFileUrl("send_ignoreData.reply"),
+ QUrl()));
+
+ QQmlComponent component(&engine, testFileUrl("send_ignoreData.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("reqType", "DELETE");
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+ }
+}
+
+// Test that send()'ing data works
+void tst_qqmlxmlhttprequest::send_withdata()
+{
+ QFETCH(QString, file_expected);
+ QFETCH(QString, file_qml);
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl(file_expected),
+ testFileUrl("send_data.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl(file_qml));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::send_withdata_data()
+{
+ QTest::addColumn<QString>("file_expected");
+ QTest::addColumn<QString>("file_qml");
+
+ QTest::newRow("No content-type") << "send_data.1.expect" << "send_data.1.qml";
+ QTest::newRow("Correct content-type") << "send_data.1.expect" << "send_data.2.qml";
+ QTest::newRow("Incorrect content-type") << "send_data.1.expect" << "send_data.3.qml";
+ QTest::newRow("Correct content-type - out of order") << "send_data.4.expect" << "send_data.4.qml";
+ QTest::newRow("Incorrect content-type - out of order") << "send_data.4.expect" << "send_data.5.qml";
+ QTest::newRow("PUT") << "send_data.6.expect" << "send_data.6.qml";
+ QTest::newRow("Correct content-type - no charset") << "send_data.1.expect" << "send_data.7.qml";
+}
+
+// Test abort() has no effect in unsent state
+void tst_qqmlxmlhttprequest::abort_unsent()
+{
+ QQmlComponent component(&engine, testFileUrl("abort_unsent.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "testdocument.html");
+ component.completeCreate();
+
+ QCOMPARE(object->property("readyState").toBool(), true);
+ QCOMPARE(object->property("openedState").toBool(), true);
+ QCOMPARE(object->property("status").toBool(), true);
+ QCOMPARE(object->property("statusText").toBool(), true);
+ QCOMPARE(object->property("responseText").toBool(), true);
+ QCOMPARE(object->property("responseXML").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+// Test abort() cancels an open (but unsent) request
+void tst_qqmlxmlhttprequest::abort_opened()
+{
+ QQmlComponent component(&engine, testFileUrl("abort_opened.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "testdocument.html");
+ component.completeCreate();
+
+ QCOMPARE(object->property("readyState").toBool(), true);
+ QCOMPARE(object->property("openedState").toBool(), true);
+ QCOMPARE(object->property("status").toBool(), true);
+ QCOMPARE(object->property("statusText").toBool(), true);
+ QCOMPARE(object->property("responseText").toBool(), true);
+ QCOMPARE(object->property("responseXML").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+// Test abort() aborts in progress send
+void tst_qqmlxmlhttprequest::abort()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("abort.expect"),
+ testFileUrl("abort.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("abort.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("urlDummy", "http://127.0.0.1:14449/testdocument.html");
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QCOMPARE(object->property("seenDone").toBool(), true);
+ QCOMPARE(object->property("didNotSeeUnsent").toBool(), true);
+ QCOMPARE(object->property("endStateUnsent").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::getResponseHeader()
+{
+ QQmlEngine engine; // Avoid cookie contamination
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("getResponseHeader.expect"),
+ testFileUrl("getResponseHeader.reply"),
+ testFileUrl("testdocument.html")));
+
+
+ QQmlComponent component(&engine, testFileUrl("getResponseHeader.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QCOMPARE(object->property("unsentException").toBool(), true);
+ QCOMPARE(object->property("openedException").toBool(), true);
+ QCOMPARE(object->property("readyState").toBool(), true);
+ QCOMPARE(object->property("openedState").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("headersReceivedState").toBool(), true);
+ QCOMPARE(object->property("headersReceivedNullHeader").toBool(), true);
+ QCOMPARE(object->property("headersReceivedValidHeader").toBool(), true);
+ QCOMPARE(object->property("headersReceivedMultiValidHeader").toBool(), true);
+ QCOMPARE(object->property("headersReceivedCookieHeader").toBool(), true);
+
+ QCOMPARE(object->property("doneState").toBool(), true);
+ QCOMPARE(object->property("doneNullHeader").toBool(), true);
+ QCOMPARE(object->property("doneValidHeader").toBool(), true);
+ QCOMPARE(object->property("doneMultiValidHeader").toBool(), true);
+ QCOMPARE(object->property("doneCookieHeader").toBool(), true);
+
+ delete object;
+}
+
+// Test getResponseHeader throws an exception in an invalid state
+void tst_qqmlxmlhttprequest::getResponseHeader_unsent()
+{
+ QQmlComponent component(&engine, testFileUrl("getResponseHeader_unsent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// Test getResponseHeader throws an exception in an invalid state
+void tst_qqmlxmlhttprequest::getResponseHeader_sent()
+{
+ QQmlComponent component(&engine, testFileUrl("getResponseHeader_sent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// Invalid arg count throws exception
+void tst_qqmlxmlhttprequest::getResponseHeader_args()
+{
+ QQmlComponent component(&engine, testFileUrl("getResponseHeader_args.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("exceptionThrown").toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::getAllResponseHeaders()
+{
+ QQmlEngine engine; // Avoid cookie contamination
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("getResponseHeader.expect"),
+ testFileUrl("getResponseHeader.reply"),
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ component.completeCreate();
+
+ QCOMPARE(object->property("unsentException").toBool(), true);
+ QCOMPARE(object->property("openedException").toBool(), true);
+ QCOMPARE(object->property("readyState").toBool(), true);
+ QCOMPARE(object->property("openedState").toBool(), true);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("headersReceivedState").toBool(), true);
+ QCOMPARE(object->property("headersReceivedHeader").toBool(), true);
+
+ QCOMPARE(object->property("doneState").toBool(), true);
+ QCOMPARE(object->property("doneHeader").toBool(), true);
+
+ delete object;
+}
+
+// Test getAllResponseHeaders throws an exception in an invalid state
+void tst_qqmlxmlhttprequest::getAllResponseHeaders_unsent()
+{
+ QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders_unsent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// Test getAllResponseHeaders throws an exception in an invalid state
+void tst_qqmlxmlhttprequest::getAllResponseHeaders_sent()
+{
+ QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders_sent.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toBool(), true);
+
+ delete object;
+}
+
+// Invalid arg count throws exception
+void tst_qqmlxmlhttprequest::getAllResponseHeaders_args()
+{
+ QQmlComponent component(&engine, testFileUrl("getAllResponseHeaders_args.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("exceptionThrown").toBool() == true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::status()
+{
+ QFETCH(QUrl, replyUrl);
+ QFETCH(int, status);
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("status.expect"),
+ replyUrl,
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("status.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("expectedStatus", status);
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("unsentException").toBool(), true);
+ QCOMPARE(object->property("openedException").toBool(), true);
+ QCOMPARE(object->property("sentException").toBool(), true);
+ QCOMPARE(object->property("headersReceived").toBool(), true);
+ QCOMPARE(object->property("loading").toBool(), true);
+ QCOMPARE(object->property("done").toBool(), true);
+ QCOMPARE(object->property("resetException").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::status_data()
+{
+ QTest::addColumn<QUrl>("replyUrl");
+ QTest::addColumn<int>("status");
+
+ QTest::newRow("OK") << testFileUrl("status.200.reply") << 200;
+ QTest::newRow("Not Found") << testFileUrl("status.404.reply") << 404;
+ QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << 400;
+}
+
+void tst_qqmlxmlhttprequest::statusText()
+{
+ QFETCH(QUrl, replyUrl);
+ QFETCH(QString, statusText);
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("status.expect"),
+ replyUrl,
+ testFileUrl("testdocument.html")));
+
+ QQmlComponent component(&engine, testFileUrl("statusText.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("expectedStatus", statusText);
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("unsentException").toBool(), true);
+ QCOMPARE(object->property("openedException").toBool(), true);
+ QCOMPARE(object->property("sentException").toBool(), true);
+ QCOMPARE(object->property("headersReceived").toBool(), true);
+ QCOMPARE(object->property("loading").toBool(), true);
+ QCOMPARE(object->property("done").toBool(), true);
+ QCOMPARE(object->property("resetException").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::statusText_data()
+{
+ QTest::addColumn<QUrl>("replyUrl");
+ QTest::addColumn<QString>("statusText");
+
+ QTest::newRow("OK") << testFileUrl("status.200.reply") << "OK";
+ QTest::newRow("Not Found") << testFileUrl("status.404.reply") << "Document not found";
+ QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << "Bad request";
+}
+
+void tst_qqmlxmlhttprequest::responseText()
+{
+ QFETCH(QUrl, replyUrl);
+ QFETCH(QUrl, bodyUrl);
+ QFETCH(QString, responseText);
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ QVERIFY(server.wait(testFileUrl("status.expect"),
+ replyUrl,
+ bodyUrl));
+
+ QQmlComponent component(&engine, testFileUrl("responseText.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
+ object->setProperty("expectedText", responseText);
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("unsent").toBool(), true);
+ QCOMPARE(object->property("opened").toBool(), true);
+ QCOMPARE(object->property("sent").toBool(), true);
+ QCOMPARE(object->property("headersReceived").toBool(), true);
+ QCOMPARE(object->property("loading").toBool(), true);
+ QCOMPARE(object->property("done").toBool(), true);
+ QCOMPARE(object->property("reset").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::responseText_data()
+{
+ QTest::addColumn<QUrl>("replyUrl");
+ QTest::addColumn<QUrl>("bodyUrl");
+ QTest::addColumn<QString>("responseText");
+
+ QTest::newRow("OK") << testFileUrl("status.200.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
+ QTest::newRow("empty body") << testFileUrl("status.200.reply") << QUrl() << "";
+ QTest::newRow("Not Found") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
+ QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
+}
+
+void tst_qqmlxmlhttprequest::nonUtf8()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QString, responseText);
+ QFETCH(QString, xmlRootNodeValue);
+
+ QQmlComponent component(&engine, testFileUrl("utf16.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ object->setProperty("fileName", fileName);
+ QMetaObject::invokeMethod(object, "startRequest");
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("responseText").toString(), responseText);
+
+ if (!xmlRootNodeValue.isEmpty()) {
+ QString rootNodeValue = object->property("responseXmlRootNodeValue").toString();
+ QCOMPARE(rootNodeValue, xmlRootNodeValue);
+ }
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::nonUtf8_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QString>("responseText");
+ QTest::addColumn<QString>("xmlRootNodeValue");
+
+ QString uc;
+ uc.resize(3);
+ uc[0] = QChar(0x10e3);
+ uc[1] = QChar(' ');
+ uc[2] = QChar(0x03a3);
+
+ QTest::newRow("responseText") << "utf16.html" << uc + '\n' << "";
+ QTest::newRow("responseXML") << "utf16.xml" << "<?xml version=\"1.0\" encoding=\"UTF-16\" standalone='yes'?>\n<root>\n" + uc + "\n</root>\n" << QString('\n' + uc + '\n');
+}
+
+// Test that calling hte XMLHttpRequest methods on a non-XMLHttpRequest object
+// throws an exception
+void tst_qqmlxmlhttprequest::invalidMethodUsage()
+{
+ QQmlComponent component(&engine, testFileUrl("invalidMethodUsage.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("readyState").toBool(), true);
+ QCOMPARE(object->property("status").toBool(), true);
+ QCOMPARE(object->property("statusText").toBool(), true);
+ QCOMPARE(object->property("responseText").toBool(), true);
+ QCOMPARE(object->property("responseXML").toBool(), true);
+
+ QCOMPARE(object->property("open").toBool(), true);
+ QCOMPARE(object->property("setRequestHeader").toBool(), true);
+ QCOMPARE(object->property("send").toBool(), true);
+ QCOMPARE(object->property("abort").toBool(), true);
+ QCOMPARE(object->property("getResponseHeader").toBool(), true);
+ QCOMPARE(object->property("getAllResponseHeaders").toBool(), true);
+
+ delete object;
+}
+
+// Test that XMLHttpRequest transparently redirects
+void tst_qqmlxmlhttprequest::redirects()
+{
+ {
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html");
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine, testFileUrl("redirects.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
+ object->setProperty("expectedText", "");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("done").toBool() == true);
+ QCOMPARE(object->property("dataOK").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html");
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine, testFileUrl("redirectError.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
+ object->setProperty("expectedText", "");
+ component.completeCreate();
+
+ QTRY_VERIFY(object->property("done").toBool() == true);
+ QCOMPARE(object->property("dataOK").toBool(), true);
+
+ delete object;
+ }
+
+ {
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html");
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine, testFileUrl("redirectRecur.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
+ object->setProperty("expectedText", "");
+ component.completeCreate();
+
+ for (int ii = 0; ii < 60; ++ii) {
+ if (object->property("done").toBool()) break;
+ QTest::qWait(50);
+ }
+ QVERIFY(object->property("done").toBool() == true);
+
+ QCOMPARE(object->property("dataOK").toBool(), true);
+
+ delete object;
+ }
+}
+
+void tst_qqmlxmlhttprequest::responseXML_invalid()
+{
+ QQmlComponent component(&engine, testFileUrl("responseXML_invalid.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("xmlNull").toBool(), true);
+
+ delete object;
+}
+
+// Test the Document DOM element
+void tst_qqmlxmlhttprequest::document()
+{
+ QQmlComponent component(&engine, testFileUrl("document.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("xmlTest").toBool(), true);
+
+ delete object;
+}
+
+// Test the Element DOM element
+void tst_qqmlxmlhttprequest::element()
+{
+ QQmlComponent component(&engine, testFileUrl("element.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("xmlTest").toBool(), true);
+
+ delete object;
+}
+
+// Test the Attr DOM element
+void tst_qqmlxmlhttprequest::attr()
+{
+ QQmlComponent component(&engine, testFileUrl("attr.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("xmlTest").toBool(), true);
+
+ delete object;
+}
+
+// Test the Text DOM element
+void tst_qqmlxmlhttprequest::text()
+{
+ QQmlComponent component(&engine, testFileUrl("text.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("xmlTest").toBool(), true);
+
+ delete object;
+}
+
+// Test the CDataSection DOM element
+void tst_qqmlxmlhttprequest::cdata()
+{
+ QQmlComponent component(&engine, testFileUrl("cdata.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QTRY_VERIFY(object->property("dataOK").toBool() == true);
+
+ QCOMPARE(object->property("xmlTest").toBool(), true);
+
+ delete object;
+}
+
+void tst_qqmlxmlhttprequest::stateChangeCallingContext()
+{
+#ifdef Q_OS_WIN
+ QSKIP("QTBUG-26738");
+#endif
+
+ // ensure that we don't crash by attempting to evaluate
+ // without a valid calling context.
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
+
+ QQmlComponent component(&engine, testFileUrl("stateChangeCallingContext.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ server.sendDelayedItem();
+ QTRY_VERIFY(object->property("success").toBool() == true);
+ delete object;
+}
+
+QTEST_MAIN(tst_qqmlxmlhttprequest)
+
+#include "tst_qqmlxmlhttprequest.moc"
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/basic.qml b/tests/auto/qml/qquickfolderlistmodel/data/basic.qml
new file mode 100644
index 0000000000..2c4977d08b
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/basic.qml
@@ -0,0 +1,5 @@
+import Qt.labs.folderlistmodel 1.0
+
+FolderListModel {
+ nameFilters: [ "*.qml" ]
+}
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/dummy.qml b/tests/auto/qml/qquickfolderlistmodel/data/dummy.qml
new file mode 100644
index 0000000000..609638bec6
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/dummy.qml
@@ -0,0 +1 @@
+// This file is not used, it is just content for QDirModel
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/resetFiltering.qml b/tests/auto/qml/qquickfolderlistmodel/data/resetFiltering.qml
new file mode 100644
index 0000000000..d9a8ec4535
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/resetFiltering.qml
@@ -0,0 +1,5 @@
+import Qt.labs.folderlistmodel 1.0
+
+FolderListModel {
+ showDirs: false
+}
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/innerdir/test2.txt b/tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/innerdir/test2.txt
new file mode 100644
index 0000000000..97e64bb130
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/innerdir/test2.txt
@@ -0,0 +1 @@
+This file contains some text.
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/test.txt b/tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/test.txt
new file mode 100644
index 0000000000..97e64bb130
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/resetfiltering/test.txt
@@ -0,0 +1 @@
+This file contains some text.
diff --git a/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro b/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro
new file mode 100644
index 0000000000..d14f4fb278
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/qquickfolderlistmodel.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+TARGET = tst_qquickfolderlistmodel
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickfolderlistmodel.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
new file mode 100644
index 0000000000..a8bb887158
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qabstractitemmodel.h>
+#include <QDebug>
+#include "../../shared/util.h"
+
+#if defined (Q_OS_WIN)
+#include <qt_windows.h>
+#endif
+
+// From qquickfolderlistmodel.h
+const int FileNameRole = Qt::UserRole+1;
+const int FilePathRole = Qt::UserRole+2;
+enum SortField { Unsorted, Name, Time, Size, Type };
+
+class tst_qquickfolderlistmodel : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickfolderlistmodel() : removeStart(0), removeEnd(0) {}
+
+public slots:
+ void removed(const QModelIndex &, int start, int end) {
+ removeStart = start;
+ removeEnd = end;
+ }
+
+private slots:
+ void basicProperties();
+ void resetFiltering();
+ void refresh();
+#if defined (Q_OS_WIN)
+ void changeDrive();
+#endif
+
+private:
+ void checkNoErrors(const QQmlComponent& component);
+ QQmlEngine engine;
+
+ int removeStart;
+ int removeEnd;
+};
+
+void tst_qquickfolderlistmodel::checkNoErrors(const QQmlComponent& component)
+{
+ // Wait until the component is ready
+ QTRY_VERIFY(component.isReady() || component.isError());
+
+ if (component.isError()) {
+ QList<QQmlError> errors = component.errors();
+ for (int ii = 0; ii < errors.count(); ++ii) {
+ const QQmlError &error = errors.at(ii);
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" +
+ QByteArray::number(error.column()) + ":" +
+ error.description().toUtf8();
+ qWarning() << errorStr;
+ }
+ }
+ QVERIFY(!component.isError());
+}
+
+void tst_qquickfolderlistmodel::basicProperties()
+{
+ QQmlComponent component(&engine, testFileUrl("basic.qml"));
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+ flm->setProperty("folder", dataDirectoryUrl());
+ QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
+ QCOMPARE(flm->property("folder").toUrl(), dataDirectoryUrl());
+ QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(QDir(directory()).canonicalPath()));
+ QCOMPARE(flm->property("sortField").toInt(), int(Name));
+ QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml");
+ QCOMPARE(flm->property("sortReversed").toBool(), false);
+ QCOMPARE(flm->property("showDirs").toBool(), true);
+ QCOMPARE(flm->property("showDotAndDotDot").toBool(), false);
+ QCOMPARE(flm->property("showOnlyReadable").toBool(), false);
+ QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("basic.qml"));
+ QCOMPARE(flm->data(flm->index(1),FileNameRole).toString(), QLatin1String("dummy.qml"));
+
+ flm->setProperty("folder",QUrl::fromLocalFile(""));
+ QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(""));
+}
+
+void tst_qquickfolderlistmodel::resetFiltering()
+{
+ // see QTBUG-17837
+ QQmlComponent component(&engine, testFileUrl("resetFiltering.qml"));
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+ connect(flm, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
+ this, SLOT(removed(const QModelIndex&,int,int)));
+
+ flm->setProperty("folder", testFileUrl("resetfiltering"));
+ QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible
+ int count = flm->rowCount();
+ QCOMPARE(removeStart, 0);
+ QCOMPARE(removeEnd, count-1);
+
+ flm->setProperty("folder", testFileUrl("resetfiltering/innerdir"));
+ QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test2.txt" visible
+ count = flm->rowCount();
+ QCOMPARE(removeStart, 0);
+ QCOMPARE(removeEnd, count-1);
+
+ flm->setProperty("folder", testFileUrl("resetfiltering"));
+ QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible
+ count = flm->rowCount();
+ QCOMPARE(removeStart, 0);
+ QCOMPARE(removeEnd, count-1);
+}
+
+void tst_qquickfolderlistmodel::refresh()
+{
+ QQmlComponent component(&engine, testFileUrl("basic.qml"));
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+ flm->setProperty("folder", dataDirectoryUrl());
+ QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
+
+ int count = flm->rowCount();
+
+ connect(flm, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
+ this, SLOT(removed(const QModelIndex&,int,int)));
+
+ flm->setProperty("sortReversed", true);
+
+ QTRY_COMPARE(removeStart, 0);
+ QTRY_COMPARE(removeEnd, count-1); // wait for refresh
+}
+
+#if defined (Q_OS_WIN)
+void tst_qquickfolderlistmodel::changeDrive()
+{
+ QSKIP("QTBUG-26728");
+ class DriveMapper
+ {
+ public:
+ DriveMapper(const QString &dataDir)
+ {
+ size_t stringLen = dataDir.length();
+ targetPath = new wchar_t[stringLen+1];
+ dataDir.toWCharArray(targetPath);
+ targetPath[stringLen] = 0;
+
+ DefineDosDevice(DDD_NO_BROADCAST_SYSTEM, L"X:", targetPath);
+ }
+
+ ~DriveMapper()
+ {
+ DefineDosDevice(DDD_EXACT_MATCH_ON_REMOVE | DDD_NO_BROADCAST_SYSTEM | DDD_REMOVE_DEFINITION, L"X:", targetPath);
+ delete [] targetPath;
+ }
+
+ private:
+ wchar_t *targetPath;
+ };
+
+ QString dataDir = testFile(0);
+ DriveMapper dm(dataDir);
+ QQmlComponent component(&engine, testFileUrl("basic.qml"));
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+ QSignalSpy folderChangeSpy(flm, SIGNAL(folderChanged()));
+
+ flm->setProperty("folder",QUrl::fromLocalFile(dataDir));
+ QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(dataDir));
+ QTRY_VERIFY(folderChangeSpy.count() == 1);
+
+ flm->setProperty("folder",QUrl::fromLocalFile("X:/resetfiltering/"));
+ QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile("X:/resetfiltering/"));
+ QTRY_VERIFY(folderChangeSpy.count() == 2);
+}
+#endif
+
+QTEST_MAIN(tst_qquickfolderlistmodel)
+
+#include "tst_qquickfolderlistmodel.moc"
diff --git a/tests/auto/qml/qquickworkerscript/data/BaseWorker.qml b/tests/auto/qml/qquickworkerscript/data/BaseWorker.qml
new file mode 100644
index 0000000000..0ac56d9b66
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/BaseWorker.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+WorkerScript {
+ id: worker
+
+ property variant response
+
+ signal done()
+
+ function testSend(value) {
+ worker.sendMessage(value)
+ }
+
+ function compareLiteralResponse(expected) {
+ var e = eval('(' + expected + ')')
+ return JSON.stringify(worker.response) == JSON.stringify(e)
+ }
+
+ onMessage: {
+ worker.response = messageObject
+ worker.done()
+ }
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/Global.js b/tests/auto/qml/qquickworkerscript/data/Global.js
new file mode 100644
index 0000000000..6bdb4a56b9
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/Global.js
@@ -0,0 +1 @@
+var data = "World"
diff --git a/tests/auto/qml/qquickworkerscript/data/externalObjectWorker.qml b/tests/auto/qml/qquickworkerscript/data/externalObjectWorker.qml
new file mode 100644
index 0000000000..1dae608b50
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/externalObjectWorker.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ function testExternalObject() {
+ worker.sendMessage(Qt.vector3d(1,2,3));
+ }
+
+ WorkerScript {
+ id: worker
+ source: "script.js"
+ }
+}
diff --git a/tests/auto/qml/qquickworkerscript/data/script.js b/tests/auto/qml/qquickworkerscript/data/script.js
new file mode 100644
index 0000000000..90aae263a1
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/script.js
@@ -0,0 +1,4 @@
+WorkerScript.onMessage = function(msg) {
+ WorkerScript.sendMessage(msg)
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/script_error_onCall.js b/tests/auto/qml/qquickworkerscript/data/script_error_onCall.js
new file mode 100644
index 0000000000..f589b0ef40
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/script_error_onCall.js
@@ -0,0 +1,6 @@
+WorkerScript.onMessage = function(msg) {
+ var a = 123
+ var b = 345
+ var f = getData()
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js b/tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js
new file mode 100644
index 0000000000..1d6eab2285
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js
@@ -0,0 +1,5 @@
+WorkerScript.onMessage = function(msg) {
+ var a = 123
+ aoij awef aljfaow eij
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/script_fixed_return.js b/tests/auto/qml/qquickworkerscript/data/script_fixed_return.js
new file mode 100644
index 0000000000..14f6f178ae
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/script_fixed_return.js
@@ -0,0 +1,4 @@
+WorkerScript.onMessage = function(msg) {
+ WorkerScript.sendMessage('Hello_World')
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/script_include.js b/tests/auto/qml/qquickworkerscript/data/script_include.js
new file mode 100644
index 0000000000..0385d91170
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/script_include.js
@@ -0,0 +1,5 @@
+WorkerScript.onMessage = function(msg) {
+ var res = Qt.include("Global.js");
+ WorkerScript.sendMessage(msg + " " + data)
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/script_pragma.js b/tests/auto/qml/qquickworkerscript/data/script_pragma.js
new file mode 100644
index 0000000000..cb3b6d3398
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/script_pragma.js
@@ -0,0 +1,6 @@
+.pragma library
+
+WorkerScript.onMessage = function(msg) {
+ WorkerScript.sendMessage(msg)
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/stressDispose.js b/tests/auto/qml/qquickworkerscript/data/stressDispose.js
new file mode 100644
index 0000000000..5c4c5ec906
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/stressDispose.js
@@ -0,0 +1,6 @@
+WorkerScript.onMessage = function() {
+}
+for (var ii = 0; ii < 100; ++ii) {
+ var a = "HELLO WORLD";
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/stressDispose.qml b/tests/auto/qml/qquickworkerscript/data/stressDispose.qml
new file mode 100644
index 0000000000..3e8465d6fe
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/stressDispose.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ WorkerScript {
+ id: worker
+ source: "stressDispose.js"
+ }
+
+ Component.onCompleted: {
+ worker.sendMessage(10);
+ }
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/worker.qml b/tests/auto/qml/qquickworkerscript/data/worker.qml
new file mode 100644
index 0000000000..b5a92bf1f5
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/worker.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+BaseWorker {
+ source: "script.js"
+}
diff --git a/tests/auto/qml/qquickworkerscript/data/worker_error_onCall.qml b/tests/auto/qml/qquickworkerscript/data/worker_error_onCall.qml
new file mode 100644
index 0000000000..aa20783e76
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/worker_error_onCall.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+BaseWorker {
+ source: "script_error_onCall.js"
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/data/worker_error_onLoad.qml b/tests/auto/qml/qquickworkerscript/data/worker_error_onLoad.qml
new file mode 100644
index 0000000000..8a33aeb44c
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/worker_error_onLoad.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+BaseWorker {
+ source: "script_error_onLoad.js"
+}
+
+
diff --git a/tests/auto/qml/qquickworkerscript/data/worker_include.qml b/tests/auto/qml/qquickworkerscript/data/worker_include.qml
new file mode 100644
index 0000000000..100b8d4551
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/worker_include.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+BaseWorker {
+ source: "script_include.js"
+}
diff --git a/tests/auto/qml/qquickworkerscript/data/worker_pragma.qml b/tests/auto/qml/qquickworkerscript/data/worker_pragma.qml
new file mode 100644
index 0000000000..7e313b3c42
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/data/worker_pragma.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+BaseWorker {
+ source: "script_pragma.js"
+}
+
diff --git a/tests/auto/qml/qquickworkerscript/qquickworkerscript.pro b/tests/auto/qml/qquickworkerscript/qquickworkerscript.pro
new file mode 100644
index 0000000000..56c89fab49
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/qquickworkerscript.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickworkerscript
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickworkerscript.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
new file mode 100644
index 0000000000..a2bf06c2ba
--- /dev/null
+++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
@@ -0,0 +1,300 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>
+#include <QtQml/qjsengine.h>
+
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlengine.h>
+
+#include <private/qquickworkerscript_p.h>
+#include <private/qqmlengine_p.h>
+#include "../../shared/util.h"
+
+class tst_QQuickWorkerScript : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickWorkerScript() {}
+private slots:
+ void source();
+ void messaging();
+ void messaging_data();
+ void messaging_sendQObjectList();
+ void messaging_sendJsObject();
+ void messaging_sendExternalObject();
+ void script_with_pragma();
+ void script_included();
+ void scriptError_onLoad();
+ void scriptError_onCall();
+ void stressDispose();
+
+private:
+ void waitForEchoMessage(QQuickWorkerScript *worker) {
+ QEventLoop loop;
+ QVERIFY(connect(worker, SIGNAL(done()), &loop, SLOT(quit())));
+ QTimer timer;
+ timer.setSingleShot(true);
+ connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.start(10000);
+ loop.exec();
+ QVERIFY(timer.isActive());
+ }
+
+ QQmlEngine m_engine;
+};
+
+void tst_QQuickWorkerScript::source()
+{
+ QQmlComponent component(&m_engine, testFileUrl("worker.qml"));
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+ const QMetaObject *mo = worker->metaObject();
+
+ QVariant value(100);
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+ waitForEchoMessage(worker);
+ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value);
+
+ QUrl source = testFileUrl("script_fixed_return.js");
+ worker->setSource(source);
+ QCOMPARE(worker->source(), source);
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+ waitForEchoMessage(worker);
+ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), qVariantFromValue(QString("Hello_World")));
+
+ qApp->processEvents();
+ delete worker;
+}
+
+void tst_QQuickWorkerScript::messaging()
+{
+ QFETCH(QVariant, value);
+
+ QQmlComponent component(&m_engine, testFileUrl("worker.qml"));
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+ waitForEchoMessage(worker);
+
+ const QMetaObject *mo = worker->metaObject();
+ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value);
+
+ qApp->processEvents();
+ delete worker;
+}
+
+void tst_QQuickWorkerScript::messaging_data()
+{
+ QTest::addColumn<QVariant>("value");
+
+ QTest::newRow("invalid") << QVariant();
+ QTest::newRow("bool") << qVariantFromValue(true);
+ QTest::newRow("int") << qVariantFromValue(1001);
+ QTest::newRow("real") << qVariantFromValue(10334.375);
+ QTest::newRow("string") << qVariantFromValue(QString("More cheeeese, Gromit!"));
+ QTest::newRow("variant list") << qVariantFromValue((QVariantList() << "a" << "b" << "c"));
+ QTest::newRow("date time") << qVariantFromValue(QDateTime::currentDateTime());
+#ifndef QT_NO_REGEXP
+ // QtScript's QScriptValue -> QRegExp uses RegExp2 pattern syntax
+ QTest::newRow("regexp") << qVariantFromValue(QRegExp("^\\d\\d?$", Qt::CaseInsensitive, QRegExp::RegExp2));
+#endif
+}
+
+void tst_QQuickWorkerScript::messaging_sendQObjectList()
+{
+ // Not allowed to send QObjects other than QQmlListModelWorkerAgent
+ // instances. If objects are sent in a list, they will be sent as 'undefined'
+ // js values.
+
+ QQmlComponent component(&m_engine, testFileUrl("worker.qml"));
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QVariantList objects;
+ for (int i=0; i<3; i++)
+ objects << qVariantFromValue(new QObject(this));
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(objects))));
+ waitForEchoMessage(worker);
+
+ const QMetaObject *mo = worker->metaObject();
+ QVariantList result = mo->property(mo->indexOfProperty("response")).read(worker).value<QVariantList>();
+ QCOMPARE(result, (QVariantList() << QVariant() << QVariant() << QVariant()));
+
+ qApp->processEvents();
+ delete worker;
+}
+
+void tst_QQuickWorkerScript::messaging_sendJsObject()
+{
+ QQmlComponent component(&m_engine, testFileUrl("worker.qml"));
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ // Properties are in alphabetical order to enable string-based comparison after
+ // QVariant roundtrip, since the properties will be stored in a QVariantMap.
+ QString jsObject = "{'haste': 1125, 'name': 'zyz', 'spell power': 3101}";
+
+ QVariantMap map;
+ map.insert("haste", 1125);
+ map.insert("name", "zyz");
+ map.insert("spell power", 3101);
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, qVariantFromValue(map))));
+ waitForEchoMessage(worker);
+
+ QVariant result = qVariantFromValue(false);
+ QVERIFY(QMetaObject::invokeMethod(worker, "compareLiteralResponse", Qt::DirectConnection,
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, jsObject)));
+ QVERIFY(result.toBool());
+
+ qApp->processEvents();
+ delete worker;
+}
+
+void tst_QQuickWorkerScript::messaging_sendExternalObject()
+{
+ QQmlComponent component(&m_engine, testFileUrl("externalObjectWorker.qml"));
+ QObject *obj = component.create();
+ QVERIFY(obj);
+ QMetaObject::invokeMethod(obj, "testExternalObject");
+ QTest::qWait(100); // shouldn't crash.
+ delete obj;
+}
+
+void tst_QQuickWorkerScript::script_with_pragma()
+{
+ QVariant value(100);
+
+ QQmlComponent component(&m_engine, testFileUrl("worker_pragma.qml"));
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+ waitForEchoMessage(worker);
+
+ const QMetaObject *mo = worker->metaObject();
+ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value);
+
+ qApp->processEvents();
+ delete worker;
+}
+
+void tst_QQuickWorkerScript::script_included()
+{
+ QQmlComponent component(&m_engine, testFileUrl("worker_include.qml"));
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QString value("Hello");
+
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+ waitForEchoMessage(worker);
+
+ const QMetaObject *mo = worker->metaObject();
+ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).toString(), value + " World");
+
+ qApp->processEvents();
+ delete worker;
+}
+
+static QString qquickworkerscript_lastWarning;
+static void qquickworkerscript_warningsHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
+{
+ if (type == QtWarningMsg)
+ qquickworkerscript_lastWarning = msg;
+}
+
+void tst_QQuickWorkerScript::scriptError_onLoad()
+{
+ QQmlComponent component(&m_engine, testFileUrl("worker_error_onLoad.qml"));
+
+ QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QTRY_COMPARE(qquickworkerscript_lastWarning,
+ testFileUrl("script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier"));
+
+ qInstallMessageHandler(previousMsgHandler);
+ qApp->processEvents();
+ delete worker;
+}
+
+void tst_QQuickWorkerScript::scriptError_onCall()
+{
+ QQmlComponent component(&m_engine, testFileUrl("worker_error_onCall.qml"));
+ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
+ QVariant value;
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+
+ QTRY_COMPARE(qquickworkerscript_lastWarning,
+ testFileUrl("script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: getData is not defined"));
+
+ qInstallMessageHandler(previousMsgHandler);
+ qApp->processEvents();
+ delete worker;
+}
+
+// Rapidly create and destroy worker scripts to test resources are being disposed
+// in the correct isolate
+void tst_QQuickWorkerScript::stressDispose()
+{
+ for (int ii = 0; ii < 100; ++ii) {
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stressDispose.qml"));
+ QObject *o = component.create();
+ QVERIFY(o);
+ delete o;
+ }
+}
+
+QTEST_MAIN(tst_QQuickWorkerScript)
+
+#include "tst_qquickworkerscript.moc"
diff --git a/tests/auto/qml/qrcqml/data/SameDir.qml b/tests/auto/qml/qrcqml/data/SameDir.qml
new file mode 100644
index 0000000000..1ee9b7630f
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/SameDir.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property string tokenProperty: "foo"
+}
diff --git a/tests/auto/qml/qrcqml/data/SameDir2.qml b/tests/auto/qml/qrcqml/data/SameDir2.qml
new file mode 100644
index 0000000000..83d0673d64
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/SameDir2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property string tokenProperty: "bar"
+}
diff --git a/tests/auto/qml/qrcqml/data/SameDir3.qml b/tests/auto/qml/qrcqml/data/SameDir3.qml
new file mode 100644
index 0000000000..b1d08f4225
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/SameDir3.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property string tokenProperty: "baz"
+}
diff --git a/tests/auto/qml/qrcqml/data/SubDir.qml b/tests/auto/qml/qrcqml/data/SubDir.qml
new file mode 100644
index 0000000000..d1c40af3cb
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/SubDir.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+QtObject {}
diff --git a/tests/auto/qml/qrcqml/data/imports/QrcImport/Imported.qml b/tests/auto/qml/qrcqml/data/imports/QrcImport/Imported.qml
new file mode 100644
index 0000000000..c2ef0a6906
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/imports/QrcImport/Imported.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ property string tokenProperty: "bar"
+}
diff --git a/tests/auto/qml/qrcqml/data/imports/QrcImport/qmldir b/tests/auto/qml/qrcqml/data/imports/QrcImport/qmldir
new file mode 100644
index 0000000000..8eb1fa5c18
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/imports/QrcImport/qmldir
@@ -0,0 +1 @@
+Imported 1.0 Imported.qml
diff --git a/tests/auto/qml/qrcqml/data/importtest.qml b/tests/auto/qml/qrcqml/data/importtest.qml
new file mode 100644
index 0000000000..dd45bd8b98
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/importtest.qml
@@ -0,0 +1,5 @@
+import QrcImport 1.0
+
+Imported {
+ tokenProperty: "foo"
+}
diff --git a/tests/auto/qml/qrcqml/data/main.qml b/tests/auto/qml/qrcqml/data/main.qml
new file mode 100644
index 0000000000..339c6dedf7
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/main.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import "../data" as Subdirectory
+
+SameDir {
+ property QtObject other: Subdirectory.SubDir {}
+}
diff --git a/tests/auto/qml/qrcqml/data/main2.qml b/tests/auto/qml/qrcqml/data/main2.qml
new file mode 100644
index 0000000000..b1eb73c31f
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/main2.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import "data" as Subdirectory
+
+SameDir {
+ property QtObject other: Subdirectory.SubDir {}
+}
diff --git a/tests/auto/qml/qrcqml/data/main3.qml b/tests/auto/qml/qrcqml/data/main3.qml
new file mode 100644
index 0000000000..b1eb73c31f
--- /dev/null
+++ b/tests/auto/qml/qrcqml/data/main3.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import "data" as Subdirectory
+
+SameDir {
+ property QtObject other: Subdirectory.SubDir {}
+}
diff --git a/tests/auto/qml/qrcqml/qrcqml.pro b/tests/auto/qml/qrcqml/qrcqml.pro
new file mode 100644
index 0000000000..3bbc6d6085
--- /dev/null
+++ b/tests/auto/qml/qrcqml/qrcqml.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qrcqml
+QT += qml testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qrcqml.cpp
+RESOURCES = qrcqml.qrc
+
+CONFIG += parallel_test
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qrcqml/qrcqml.qrc b/tests/auto/qml/qrcqml/qrcqml.qrc
new file mode 100644
index 0000000000..9ab0565366
--- /dev/null
+++ b/tests/auto/qml/qrcqml/qrcqml.qrc
@@ -0,0 +1,21 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/main.qml</file>
+ <file>data/SameDir.qml</file>
+ <file>data/SubDir.qml</file>
+ <file alias="main.qml">data/main2.qml</file>
+ <file alias="SameDir.qml">data/SameDir2.qml</file>
+ <file alias="importtest.qml">data/importtest.qml</file>
+ </qresource>
+ <qresource prefix="/search">
+ <file alias="main.qml">data/main3.qml</file>
+ <file alias="SameDir.qml">data/SameDir3.qml</file>
+ </qresource>
+ <qresource prefix="/search/data">
+ <file alias="SubDir.qml">data/SubDir.qml</file>
+ </qresource>
+ <qresource prefix="/imports">
+ <file alias="QrcImport/Imported.qml">data/imports/QrcImport/Imported.qml</file>
+ <file alias="QrcImport/qmldir">data/imports/QrcImport/qmldir</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qml/qrcqml/tst_qrcqml.cpp b/tests/auto/qml/qrcqml/tst_qrcqml.cpp
new file mode 100644
index 0000000000..5abdcade0e
--- /dev/null
+++ b/tests/auto/qml/qrcqml/tst_qrcqml.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QObject>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QDebug>
+
+// Loading QML files from embedded resources is a common QML usecase.
+// This test just verifies that it works at a basic level, and with the qrc:/ syntax
+
+class tst_qrcqml : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qrcqml();
+
+private slots:
+ void basicLoad_data();
+ void basicLoad();
+ void qrcImport_data();
+ void qrcImport();
+};
+
+tst_qrcqml::tst_qrcqml()
+{
+}
+
+void tst_qrcqml::basicLoad_data()
+{
+ QTest::addColumn<QString>("url");
+ QTest::addColumn<QString>("token");
+
+ QTest::newRow("simple")
+ << "qrc:/data/main.qml"
+ << "foo";
+
+ QTest::newRow("aliased")
+ << "qrc:/main.qml"
+ << "bar";
+
+ QTest::newRow("prefixed")
+ << "qrc:/search/main.qml"
+ << "baz";
+
+ /* This is not supported:
+ QTest::newRow("without qrc scheme")
+ << ":/data/main.qml"
+ << "hello";
+ */
+}
+
+void tst_qrcqml::basicLoad()
+{
+ QFETCH(QString, url);
+ QFETCH(QString, token);
+
+ QQmlEngine e;
+ QQmlComponent c(&e, QUrl(url));
+ QVERIFY(c.isReady());
+ QObject* o = c.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("tokenProperty").toString(), token);
+ delete o;
+}
+
+void tst_qrcqml::qrcImport_data()
+{
+ QTest::addColumn<QString>("importPath");
+ QTest::addColumn<QString>("token");
+
+ QTest::newRow("qrc path")
+ << ":/imports"
+ << "foo";
+
+ QTest::newRow("qrc url")
+ << "qrc:/imports"
+ << "foo";
+}
+
+void tst_qrcqml::qrcImport()
+{
+ QFETCH(QString, importPath);
+ QFETCH(QString, token);
+
+ QQmlEngine e;
+ e.addImportPath(importPath);
+ QQmlComponent c(&e, QUrl("qrc:///importtest.qml"));
+ QVERIFY(c.isReady());
+ QObject *o = c.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("tokenProperty").toString(), token);
+ delete o;
+}
+
+QTEST_MAIN(tst_qrcqml)
+
+#include "tst_qrcqml.moc"
diff --git a/tests/auto/qml/qtqmlmodules/data/base.qml b/tests/auto/qml/qtqmlmodules/data/base.qml
new file mode 100644
index 0000000000..942b270572
--- /dev/null
+++ b/tests/auto/qml/qtqmlmodules/data/base.qml
@@ -0,0 +1,14 @@
+import QtQml 2.0
+
+QtObject {
+ property bool success: {
+ prop1 != undefined &&
+ prop2 != undefined &&
+ prop3 != undefined &&
+ prop4 != undefined
+ }
+ property Component prop1: Component { QtObject {}}
+ property Timer prop2: Timer {}
+ property Connections prop3: Connections{}
+ property Binding prop4: Binding{}
+}
diff --git a/tests/auto/qml/qtqmlmodules/data/models.qml b/tests/auto/qml/qtqmlmodules/data/models.qml
new file mode 100644
index 0000000000..d253565932
--- /dev/null
+++ b/tests/auto/qml/qtqmlmodules/data/models.qml
@@ -0,0 +1,15 @@
+import QtQml 2.0
+import QtQml.Models 2.1
+
+QtObject {
+ property bool success: {
+ prop1 != undefined &&
+ prop2 != undefined &&
+ prop3 != undefined &&
+ prop4 != undefined
+ }
+ property DelegateModelGroup prop1: DelegateModelGroup{}
+ property DelegateModel prop2: DelegateModel{}
+ property ObjectModel prop3: ObjectModel{}
+ property ListModel prop4: ListModel{ListElement{dummy: true}}
+}
diff --git a/tests/auto/qml/qtqmlmodules/data/unavailable.qml b/tests/auto/qml/qtqmlmodules/data/unavailable.qml
new file mode 100644
index 0000000000..5841e3f677
--- /dev/null
+++ b/tests/auto/qml/qtqmlmodules/data/unavailable.qml
@@ -0,0 +1,35 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+ property bool success: false;
+ Component.onCompleted: {
+ var strings = [
+ "QtObject{}",
+ "Binding{}",
+ "Connections{}",
+ "Timer{}",
+ "Component{QtObject{}}",
+ "ListModel{ListElement{}}",
+ "ObjectModel{QtObject{}}",
+ "import QtQml 2.0 Item{}",
+ "import QtQml 2.0 ListModel{}",
+ "import QtQml 2.0 ObjectModel{}"
+ ];
+ var idx;
+ for (idx in strings) {
+ var errored = false;
+ var item;
+ try {
+ item = Qt.createQmlObject(strings[idx], root);
+ } catch (err) {
+ errored = true;
+ }
+ if (!errored) {
+ console.log("It worked? ", item);
+ return;
+ }
+ }
+ root.success = true;
+ }
+}
diff --git a/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro b/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro
new file mode 100644
index 0000000000..36ece8d7e0
--- /dev/null
+++ b/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qtqmlmodules
+SOURCES += tst_qtqmlmodules.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+QT += core-private v8-private qml-private testlib gui gui-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp b/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp
new file mode 100644
index 0000000000..1e98c53694
--- /dev/null
+++ b/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research in Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QDebug>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include "../../shared/util.h"
+
+class tst_qtqmlmodules : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qtqmlmodules() {}
+
+private slots:
+ void baseTypes();
+ void modelsTypes();
+ void unavailableTypes();
+};
+
+void tst_qtqmlmodules::baseTypes()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("base.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+
+ delete object;
+}
+
+void tst_qtqmlmodules::modelsTypes()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("models.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+
+ delete object;
+}
+
+void tst_qtqmlmodules::unavailableTypes()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("unavailable.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QVERIFY(object->property("success").toBool());
+
+ delete object;
+}
+
+QTEST_MAIN(tst_qtqmlmodules)
+
+#include "tst_qtqmlmodules.moc"
diff --git a/tests/auto/qml/runall.sh b/tests/auto/qml/runall.sh
new file mode 100644
index 0000000000..07318aa131
--- /dev/null
+++ b/tests/auto/qml/runall.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+#
+#############################################################################
+##
+## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of the test suite of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## 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, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, 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.
+##
+##
+## $QT_END_LICENSE$
+##
+############################################################################/
+
+if [ "$(uname)" = Linux ]
+then
+ Xnest :7 2>/dev/null &
+ sleep 1
+ trap "kill $!" EXIT
+ export DISPLAY=:7
+ export LANG=en_US
+ kwin 2>/dev/null &
+ sleep 1
+fi
+
+function filter
+{
+ exe=$1
+ skip=0
+ while read line
+ do
+ if [ $skip != 0 ]
+ then
+ let skip=skip-1
+ else
+ case "$line" in
+ make*Error) echo "$line";;
+ make*Stop) echo "$line";;
+ /*/bin/make*) ;;
+ make*) ;;
+ install*) ;;
+ QQmlDebugServer:*Waiting*) ;;
+ QQmlDebugServer:*Connection*) ;;
+ */qmake*) ;;
+ */bin/moc*) ;;
+ *targ.debug*) ;;
+ g++*) ;;
+ cd*) ;;
+ XFAIL*) skip=1;;
+ SKIP*) skip=1;;
+ PASS*) ;;
+ QDEBUG*) ;;
+ Makefile*) ;;
+ Config*) ;;
+ Totals*) ;;
+ \**) ;;
+ ./*) ;;
+ *tst_*) echo "$line" ;;
+ *) echo "$exe: $line"
+ esac
+ fi
+ done
+}
+
+make -k -j1 install 2>&1 | filter build
+for exe in $(make install | sed -n 's/^install .* "\([^"]*qt4\/tst_[^"]*\)".*/\1/p')
+do
+ echo $exe
+ $exe 2>&1 | filter $exe
+done
+
diff --git a/tests/auto/qml/v4/data/colorType.qml b/tests/auto/qml/v4/data/colorType.qml
new file mode 100644
index 0000000000..f6a98a4a3e
--- /dev/null
+++ b/tests/auto/qml/v4/data/colorType.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool useMyColor: true
+ property color myColor: "red"
+ property color myOtherColor: "green"
+
+ property color test1: useMyColor ? myColor : myOtherColor
+ property color test2: useMyColor ? "red" : "green"
+ property color test3: useMyColor ? myColor : "green"
+
+ property bool test4: !myColor ? false : true
+
+ property bool test5: myColor != "red"
+ property bool test6: myColor == "#ff0000"
+ property bool test7: myColor != "#00ff00"
+}
+
diff --git a/tests/auto/qml/v4/data/conditionalExpr.qml b/tests/auto/qml/v4/data/conditionalExpr.qml
new file mode 100644
index 0000000000..704f7c6c5a
--- /dev/null
+++ b/tests/auto/qml/v4/data/conditionalExpr.qml
@@ -0,0 +1,8 @@
+import Qt.v4 1.0
+
+Result {
+ property int n: 2
+ property int a: n ? 1 : 0
+ property int b: if (n) { 1 } else { 0 }
+ result: (a && b) ? 0 : 1
+}
diff --git a/tests/auto/qml/v4/data/conversions.1.qml b/tests/auto/qml/v4/data/conversions.1.qml
new file mode 100644
index 0000000000..b3abde770a
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.1.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning bool prop to other proptypes.
+ boolProp: true
+ intProp: boolProp
+ floatProp: boolProp
+ doubleProp: boolProp
+ qrealProp: boolProp
+ qstringProp: boolProp
+ qurlProp: boolProp
+ vec3Prop: Qt.vector3d(boolProp, boolProp, boolProp)
+}
diff --git a/tests/auto/qml/v4/data/conversions.2.qml b/tests/auto/qml/v4/data/conversions.2.qml
new file mode 100644
index 0000000000..2fd0453ac2
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.2.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning int prop to other proptypes.
+ boolProp: intProp
+ intProp: 4
+ floatProp: intProp
+ doubleProp: intProp
+ qrealProp: intProp
+ qstringProp: intProp
+ qurlProp: intProp
+ vec3Prop: Qt.vector3d(intProp, intProp, intProp)
+}
diff --git a/tests/auto/qml/v4/data/conversions.3.qml b/tests/auto/qml/v4/data/conversions.3.qml
new file mode 100644
index 0000000000..66f0761a25
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.3.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning float prop to other proptypes.
+ boolProp: floatProp
+ intProp: floatProp
+ floatProp: 4.4
+ doubleProp: floatProp
+ qrealProp: floatProp
+ qstringProp: floatProp
+ qurlProp: floatProp
+ vec3Prop: Qt.vector3d(floatProp, floatProp, floatProp)
+}
diff --git a/tests/auto/qml/v4/data/conversions.4.qml b/tests/auto/qml/v4/data/conversions.4.qml
new file mode 100644
index 0000000000..ccf0035313
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.4.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning double prop to other prop types
+ boolProp: doubleProp
+ intProp: doubleProp
+ floatProp: doubleProp
+ doubleProp: 4.444444444
+ qrealProp: doubleProp
+ qstringProp: doubleProp
+ qurlProp: doubleProp
+ vec3Prop: Qt.vector3d(doubleProp, doubleProp, doubleProp)
+}
diff --git a/tests/auto/qml/v4/data/conversions.5.qml b/tests/auto/qml/v4/data/conversions.5.qml
new file mode 100644
index 0000000000..26dc3b7195
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.5.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning qreal prop to other prop types
+ boolProp: qrealProp
+ intProp: qrealProp
+ floatProp: qrealProp
+ doubleProp: qrealProp
+ qrealProp: 4.44
+ qstringProp: qrealProp
+ qurlProp: qrealProp
+ vec3Prop: Qt.vector3d(qrealProp, qrealProp, qrealProp)
+}
diff --git a/tests/auto/qml/v4/data/conversions.6.qml b/tests/auto/qml/v4/data/conversions.6.qml
new file mode 100644
index 0000000000..573b227ada
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.6.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning string prop to other proptypes.
+ boolProp: qstringProp
+ intProp: qstringProp
+ floatProp: qstringProp
+ doubleProp: qstringProp
+ qrealProp: qstringProp
+ qstringProp: "4"
+ qurlProp: qstringProp
+ vec3Prop: Qt.vector3d(qstringProp, qstringProp, qstringProp)
+}
diff --git a/tests/auto/qml/v4/data/conversions.7.qml b/tests/auto/qml/v4/data/conversions.7.qml
new file mode 100644
index 0000000000..5112b06b1e
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.7.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning url prop to other proptypes.
+ boolProp: qurlProp
+ intProp: qurlProp
+ floatProp: qurlProp
+ doubleProp: qurlProp
+ qrealProp: qurlProp
+ qstringProp: qurlProp
+ qurlProp: "4"
+ vec3Prop: Qt.vector3d(qurlProp, qurlProp, qurlProp)
+}
diff --git a/tests/auto/qml/v4/data/conversions.8.qml b/tests/auto/qml/v4/data/conversions.8.qml
new file mode 100644
index 0000000000..18bf160e7e
--- /dev/null
+++ b/tests/auto/qml/v4/data/conversions.8.qml
@@ -0,0 +1,13 @@
+import Qt.v4 1.0
+
+Conversion {
+ // test assigning vector prop to other proptypes.
+ boolProp: vec3Prop
+ intProp: vec3Prop
+ floatProp: vec3Prop
+ doubleProp: vec3Prop
+ qrealProp: vec3Prop
+ qstringProp: vec3Prop
+ qurlProp: vec3Prop
+ vec3Prop: Qt.vector3d(4, 4, 4)
+}
diff --git a/tests/auto/qml/v4/data/doubleBoolJump.qml b/tests/auto/qml/v4/data/doubleBoolJump.qml
new file mode 100644
index 0000000000..2eea73b573
--- /dev/null
+++ b/tests/auto/qml/v4/data/doubleBoolJump.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ QtObject {
+ property real output: i1.p1 || i2.p2 == "text" ? 0.7 : 0
+ }
+
+ QtObject {
+ id: i2
+ property string p2
+ }
+
+ QtObject {
+ id: i1
+ property bool p1: false
+ }
+}
+
diff --git a/tests/auto/qml/v4/data/equals.qml b/tests/auto/qml/v4/data/equals.qml
new file mode 100644
index 0000000000..2862bb7ac9
--- /dev/null
+++ b/tests/auto/qml/v4/data/equals.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject myprop1: null
+ property QtObject myprop2: QtObject {}
+ property real zero: 0
+ property bool falseProp: false
+
+ property bool test1: myprop1 == false
+ property bool test2: myprop1 == null
+ property bool test3: 5 == myprop1
+ property bool test4: null == myprop1
+ property bool test5: myprop1 != false
+ property bool test6: myprop1 != null
+ property bool test7: 5 != myprop1
+ property bool test8: null != myprop1
+
+ property bool test9: myprop2 == false
+ property bool test10: myprop2 == null
+ property bool test11: 5 == myprop2
+ property bool test12: null == myprop2
+ property bool test13: myprop2 != false
+ property bool test14: myprop2 != null
+ property bool test15: 5 != myprop2
+ property bool test16: null != myprop2
+
+ property bool test17: myprop1 == myprop1
+ property bool test18: myprop1 != myprop1
+ property bool test19: myprop1 == myprop2
+ property bool test20: myprop1 != myprop2
+ property bool test21: myprop2 == myprop2
+ property bool test22: myprop2 != myprop2
+
+ property bool test23: myprop1 == "hello"
+ property bool test24: myprop1 != "hello"
+ property bool test25: myprop2 == "hello"
+ property bool test26: myprop2 != "hello"
+
+ property bool test27: falseProp == zero
+ property bool test28: falseProp != zero
+ property bool test29: falseProp == 1
+ property bool test30: falseProp != 1
+ property bool test31: true == zero
+ property bool test32: true != zero
+ property bool test33: true == 1
+ property bool test34: true != 1
+
+ property bool test35: "a\
+b" === "ab"
+}
+
diff --git a/tests/auto/qml/v4/data/fetchException.qml b/tests/auto/qml/v4/data/fetchException.qml
new file mode 100644
index 0000000000..6431fcfae8
--- /dev/null
+++ b/tests/auto/qml/v4/data/fetchException.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ property Item data
+ property int a: data.x, 1
+}
diff --git a/tests/auto/qml/v4/data/integerOperations.qml b/tests/auto/qml/v4/data/integerOperations.qml
new file mode 100644
index 0000000000..805f4566fb
--- /dev/null
+++ b/tests/auto/qml/v4/data/integerOperations.qml
@@ -0,0 +1,59 @@
+import QtQuick 2.0
+
+Item {
+ property int testa1: i1.p1
+ property int testa2: -testa1 - i1.p1
+
+ property int testb1: i1.p1 & 2
+ property int testb2: i1.p2 & 2
+ property int testb3: 2 & i1.p1
+ property int testb4: 2 & i1.p2
+ property int testb5: i1.p1 & i1.p3
+ property int testb6: i1.p2 & i1.p3
+ property int testb7: i1.p3 & i1.p1
+ property int testb8: i1.p3 & i1.p2
+
+ property int testc1: i1.p1 | 2
+ property int testc2: i1.p2 | 2
+ property int testc3: 2 | i1.p1
+ property int testc4: 2 | i1.p2
+ property int testc5: i1.p1 | i1.p3
+ property int testc6: i1.p2 | i1.p3
+ property int testc7: i1.p3 | i1.p1
+ property int testc8: i1.p3 | i1.p2
+
+ property int testd1: i1.p1 ^ 7
+ property int testd2: 7 ^ i1.p1
+ property int testd3: i1.p1 ^ i1.p4
+ property int testd4: i1.p4 ^ i1.p1
+
+ property int teste1: i1.p4 << 2
+ property int teste2: i1.p5 << 2
+ property int teste3: 2 << i1.p4
+ property int teste4: i1.p4 << i1.p3
+ property int teste5: i1.p5 << i1.p3
+ property int teste6: i1.p3 << i1.p4
+
+ property int testf1: i1.p4 >> 2
+ property int testf2: i1.p5 >> 2
+ property int testf3: 2 >> i1.p4
+ property int testf4: i1.p4 >> i1.p3
+ property int testf5: i1.p5 >> i1.p3
+ property int testf6: i1.p3 >> i1.p4
+
+ property int testg1: i1.p4 >>> 2
+ property int testg2: i1.p5 >>> 2
+ property int testg3: 2 >>> i1.p4
+ property int testg4: i1.p4 >>> i1.p3
+ property int testg5: i1.p5 >>> i1.p3
+ property int testg6: i1.p3 >>> i1.p4
+
+ QtObject {
+ id: i1
+ property int p1: 333
+ property int p2: -666
+ property int p3: 2
+ property int p4: 7
+ property int p5: -7
+ }
+ }
diff --git a/tests/auto/qml/v4/data/jsvalueHandling.qml b/tests/auto/qml/v4/data/jsvalueHandling.qml
new file mode 100644
index 0000000000..d15e878a52
--- /dev/null
+++ b/tests/auto/qml/v4/data/jsvalueHandling.qml
@@ -0,0 +1,69 @@
+import QtQuick 2.0
+import Qt.v4 1.0
+
+JSValueTest {
+ property bool pBool: true
+ property int pInt: 666
+ property real pReal: 3.1415927
+ property string pString: 'foo'
+ property url pUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
+ property color pColor: Qt.rgba(1, 0, 0, 0.5)
+ property QtObject pObject: QtObject { property string foo: 'bar' }
+ property var pVar: pUrl
+
+ // Test assignment to QJSValue
+ boolVar: pBool
+ intVar: pInt
+ realVar: pReal
+ stringVar: pString
+ urlVar: pUrl
+ colorVar: pColor
+ objectVar: pObject
+ nullVar: null
+ varVar: pVar
+
+ // Test equivalence
+ property bool boolConversionSuccess: (boolVar == true)
+ property bool intConversionSuccess: (intVar == 666)
+ property bool realConversionSuccess: (realVar == 3.1415927)
+ property bool stringConversionSuccess: (stringVar == 'foo')
+
+ property url comparisonUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
+ property bool urlConversionSuccess: (urlVar == comparisonUrl)
+
+ property color comparisonColor: Qt.rgba(1, 0, 0, 0.5)
+ property bool colorConversionSuccess: (colorVar == comparisonColor)
+
+ property bool objectConversionSuccess: (objectVar == pObject)
+ property bool nullConversionSuccess: (nullVar == null)
+
+ property bool varConversionSuccess: (varVar == comparisonUrl)
+
+ // Operations are not handled by V4 - they should pass through correctly
+ property var pVarNot: !boolVar
+ property var pVarComplement: ~intVar
+ property var pVarEqual: (boolVar == pBool)
+ property var pVarLiteralEqual: (boolVar == true)
+ property var pVarUnequal: (urlVar == colorVar)
+ property var pVarComparison: (intVar <= intVar)
+ property var pVarShift: (intVar >> 1)
+
+ Component.onCompleted: {
+ if (!boolConversionSuccess) console.warn('QV4: bool conversion failed');
+ if (!intConversionSuccess) console.warn('QV4: int conversion failed');
+ if (!realConversionSuccess) console.warn('QV4: real conversion failed');
+ if (!stringConversionSuccess) console.warn('QV4: string conversion failed');
+ if (!urlConversionSuccess) console.warn('QV4: url conversion failed');
+ if (!colorConversionSuccess) console.warn('QV4: color conversion failed');
+ if (!objectConversionSuccess) console.warn('QV4: object conversion failed');
+ if (!nullConversionSuccess) console.warn('QV4: null conversion failed');
+ if (!varConversionSuccess) console.warn('QV4: var conversion failed');
+ if (pVarNot != false) console.warn('QV4: var negation impeded');
+ if (pVarComplement != ~666) console.warn('QV4: var complement impeded');
+ if (pVarEqual != true) console.warn('QV4: var equality impeded');
+ if (pVarLiteralEqual != true) console.warn('QV4: var/literal equality impeded');
+ if (pVarUnequal != false) console.warn('QV4: var unequality impeded');
+ if (pVarComparison != true) console.warn('QV4: var comparison impeded');
+ if (pVarShift != 333) console.warn('QV4: var shift impeded');
+ }
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.2.qml b/tests/auto/qml/v4/data/logicalAnd.2.qml
new file mode 100644
index 0000000000..cc3d75bd90
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.2.qml
@@ -0,0 +1,6 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: "foo" && "bar"
+ result: s == "bar"
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.3.qml b/tests/auto/qml/v4/data/logicalAnd.3.qml
new file mode 100644
index 0000000000..6527f05d07
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.3.qml
@@ -0,0 +1,8 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: ""
+ property bool flag: true
+
+ result: (s && flag) == ""
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.4.qml b/tests/auto/qml/v4/data/logicalAnd.4.qml
new file mode 100644
index 0000000000..fbcee91699
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.4.qml
@@ -0,0 +1,8 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: "foo"
+ property bool flag: true
+
+ result: (!flag && s) == false
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.5.qml b/tests/auto/qml/v4/data/logicalAnd.5.qml
new file mode 100644
index 0000000000..f0698463fe
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.5.qml
@@ -0,0 +1,7 @@
+import Qt.v4 1.0
+
+Result {
+ property bool flag: true
+
+ result: (null && flag) == null
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.6.qml b/tests/auto/qml/v4/data/logicalAnd.6.qml
new file mode 100644
index 0000000000..e98b5c99cd
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.6.qml
@@ -0,0 +1,9 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: ""
+ property bool flag: true
+ property string subresult: s && flag
+
+ result: subresult === ""
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.7.qml b/tests/auto/qml/v4/data/logicalAnd.7.qml
new file mode 100644
index 0000000000..0f19d3fb40
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.7.qml
@@ -0,0 +1,9 @@
+import Qt.v4 1.0
+
+Result {
+ property real nan: Number.NaN
+ property bool flag: true
+ property real subresult: nan && flag
+
+ result: isNaN(subresult)
+}
diff --git a/tests/auto/qml/v4/data/logicalAnd.qml b/tests/auto/qml/v4/data/logicalAnd.qml
new file mode 100644
index 0000000000..40fc3616c2
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalAnd.qml
@@ -0,0 +1,6 @@
+import Qt.v4 1.0
+
+Result {
+ property int a: 10
+ result: a == 10 && a == 2
+}
diff --git a/tests/auto/qml/v4/data/logicalOr.2.qml b/tests/auto/qml/v4/data/logicalOr.2.qml
new file mode 100644
index 0000000000..54fb78b127
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalOr.2.qml
@@ -0,0 +1,6 @@
+import Qt.v4 1.0
+
+Result {
+ property string s: "foo" || "bar"
+ result: s == "foo"
+}
diff --git a/tests/auto/qml/v4/data/logicalOr.qml b/tests/auto/qml/v4/data/logicalOr.qml
new file mode 100644
index 0000000000..406a7d83eb
--- /dev/null
+++ b/tests/auto/qml/v4/data/logicalOr.qml
@@ -0,0 +1,6 @@
+import Qt.v4 1.0
+
+Result {
+ property int a: 10
+ result: a == 1 || a == 2
+}
diff --git a/tests/auto/qml/v4/data/mathAbs.qml b/tests/auto/qml/v4/data/mathAbs.qml
new file mode 100644
index 0000000000..eb504ae4d8
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathAbs.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.abs(i1.p1)
+ property real test2: Math.abs(i1.p2)
+
+ property int test3: Math.abs(i1.p3)
+ property int test4: Math.abs(i1.p4)
+
+ property real subtest5: Math.abs()
+ property real subtest6: Math.abs(i1.p6)
+ property bool test5: isNaN(subtest5)
+ property bool test6: isNaN(subtest6)
+
+ property real subtest7: Math.abs(i1.p7)
+ property bool test7: isNaN(subtest7)
+ property int test8: Math.abs(i1.p8)
+
+ property real subtest9: Math.abs(i1.p9)
+ property real subtest10: Math.abs(i1.p10)
+ property bool test9: subtest9 === Number.POSITIVE_INFINITY
+ property bool test10: subtest10 === Number.POSITIVE_INFINITY
+
+ property int test11: Math.abs(i1.p11)
+ property real subtest12: Math.abs(i1.p12)
+ property bool test12: subtest12 === 0 && (1/subtest12) === Infinity
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.5
+ property int p3: 18
+ property int p4: -72
+ property real p6: Number.NaN
+ property string p7: "hello world"
+ property string p8: "82"
+ property real p9: Number.NEGATIVE_INFINITY
+ property real p10: Number.POSITIVE_INFINITY
+ property real p11: 0
+ property real p12: -0
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathCeil.qml b/tests/auto/qml/v4/data/mathCeil.qml
new file mode 100644
index 0000000000..1f65066233
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathCeil.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.ceil(i1.p1)
+ property real test2: Math.ceil(i1.p2)
+
+ property real subtest3: Math.ceil()
+ property real subtest4: Math.ceil(i1.p4)
+ property bool test3: isNaN(subtest3)
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.ceil(i1.p5)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.ceil(i1.p6)
+
+ property real subtest7: Math.ceil(i1.p7)
+ property real subtest8: Math.ceil(i1.p8)
+ property bool test7: subtest7 === Number.NEGATIVE_INFINITY
+ property bool test8: subtest8 === Number.POSITIVE_INFINITY
+
+ property real test9: Math.ceil(i1.p9)
+ property real subtest10: Math.ceil(i1.p10)
+ property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
+
+ property real subtest11: Math.ceil(i1.p11)
+ property bool test11: subtest11 === 0 && (1/subtest11) === -Infinity
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ property real p11: -0.5
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathCos.qml b/tests/auto/qml/v4/data/mathCos.qml
new file mode 100644
index 0000000000..44c47e9f15
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathCos.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.cos(i1.p1)
+ property real test2: Math.cos(i1.p2)
+
+ property real subtest3: Math.cos()
+ property real subtest4: Math.cos(i1.p4)
+ property bool test3: isNaN(subtest3)
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.cos(i1.p5)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.cos(i1.p6)
+
+ property real subtest7: Math.cos(i1.p7)
+ property real subtest8: Math.cos(i1.p8)
+ property bool test7: isNaN(subtest7)
+ property bool test8: isNaN(subtest8)
+
+ property real subtest9: Math.cos(i1.p9)
+ property bool test9: subtest9 === 1
+ property real subtest10: Math.cos(i1.p10)
+ property bool test10: subtest10 === 1
+
+ property real subtest11: Math.PI / 6.66
+ property real test11: Math.cos(subtest11)
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathFloor.qml b/tests/auto/qml/v4/data/mathFloor.qml
new file mode 100644
index 0000000000..3473dccd10
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathFloor.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.floor(i1.p1)
+ property real test2: Math.floor(i1.p2)
+
+ property real subtest3: Math.floor()
+ property real subtest4: Math.floor(i1.p4)
+ property bool test3: isNaN(subtest3)
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.floor(i1.p5)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.floor(i1.p6)
+
+ property real subtest7: Math.floor(i1.p7)
+ property real subtest8: Math.floor(i1.p8)
+ property bool test7: subtest7 === Number.NEGATIVE_INFINITY
+ property bool test8: subtest8 === Number.POSITIVE_INFINITY
+
+ property real test9: Math.floor(i1.p9)
+ property real subtest10: Math.floor(i1.p10)
+ property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathMax.qml b/tests/auto/qml/v4/data/mathMax.qml
new file mode 100644
index 0000000000..cd8a88a3e7
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathMax.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.max(i1.p1, i1.p2)
+ property real test2: Math.max(i1.p2, i1.p3)
+
+ property real subtest3: Math.max()
+ property real subtest4: Math.max(i1.p4)
+ property bool test3: subtest3 === -Infinity
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.max(i1.p5, i1.p1)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.max(i1.p6, i1.p3)
+
+ property real test7: Math.max(i1.p7, i1.p2)
+ property real subtest8: Math.max(i1.p8, i1.p2)
+ property bool test8: subtest8 === Number.POSITIVE_INFINITY
+
+ property real subtest9: Math.max(i1.p10, i1.p9)
+ property bool test9: subtest9 === 0 && (1/subtest9) === Infinity
+
+ // Reverse the inputs to Math.max
+ property real subtest10: Math.max(i1.p9, i1.p10)
+ property bool test10: subtest10 === 0 && (1/subtest10) === Infinity
+
+ property real test11: Math.max(i1.p11, i1.p1)
+ property real test12: Math.max(i1.p11, i1.p2)
+ property real test13: Math.max(i1.p1, i1.p2, i1.p3)
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property int p3: 7
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ property var p11: null
+ }
+}
diff --git a/tests/auto/qml/v4/data/mathMin.qml b/tests/auto/qml/v4/data/mathMin.qml
new file mode 100644
index 0000000000..4ae5408b58
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathMin.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.min(i1.p1, i1.p2)
+ property real test2: Math.min(i1.p2, i1.p3)
+
+ property real subtest3: Math.min()
+ property real subtest4: Math.min(i1.p4)
+ property bool test3: subtest3 === Infinity
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.min(i1.p5, i1.p1)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.min(i1.p6, i1.p3)
+
+ property real subtest7: Math.min(i1.p7, i1.p2)
+ property bool test7: subtest7 === Number.NEGATIVE_INFINITY
+ property real test8: Math.min(i1.p8, i1.p2)
+
+ property real subtest9: Math.min(i1.p10, i1.p9)
+ property bool test9: subtest9 === 0 && (1/subtest9) === -Infinity
+
+ // Reverse the inputs to Math.min
+ property real subtest10: Math.min(i1.p9, i1.p10)
+ property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
+
+ property real test11: Math.min(i1.p11, i1.p1)
+ property real test12: Math.min(i1.p11, i1.p2)
+ property real test13: Math.min(i1.p1, i1.p2, i1.p3)
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property int p3: 95
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ property var p11: null
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathSin.qml b/tests/auto/qml/v4/data/mathSin.qml
new file mode 100644
index 0000000000..c48ec03fee
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathSin.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.sin(i1.p1)
+ property real test2: Math.sin(i1.p2)
+
+ property real subtest3: Math.sin()
+ property real subtest4: Math.sin(i1.p4)
+ property bool test3: isNaN(subtest3)
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.sin(i1.p5)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.sin(i1.p6)
+
+ property real subtest7: Math.sin(i1.p7)
+ property real subtest8: Math.sin(i1.p8)
+ property bool test7: isNaN(subtest7)
+ property bool test8: isNaN(subtest8)
+
+ property real subtest9: Math.sin(i1.p9)
+ property bool test9: subtest9 === 0 && (1/subtest9) === Infinity
+ property real subtest10: Math.sin(i1.p10)
+ property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
+
+ property real subtest11: Math.PI / 6.66
+ property real test11: Math.sin(subtest11)
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ }
+ }
diff --git a/tests/auto/qml/v4/data/nestedLogicalAnd.qml b/tests/auto/qml/v4/data/nestedLogicalAnd.qml
new file mode 100644
index 0000000000..1358fcea64
--- /dev/null
+++ b/tests/auto/qml/v4/data/nestedLogicalAnd.qml
@@ -0,0 +1,14 @@
+import Qt.v4 1.0
+
+Result {
+ property bool val1: false
+ property bool val2: true
+ property bool val3: false
+
+ property bool b1: (true && true && false)
+ property bool b2: (true && (false && true))
+ property bool b3: ((true && true) && true)
+ property bool b4: (val1 && (val2 && val3)) ? true : false
+
+ result: !b1 && !b2 && b3 && !b4
+}
diff --git a/tests/auto/qml/v4/data/nestedLogicalOr.qml b/tests/auto/qml/v4/data/nestedLogicalOr.qml
new file mode 100644
index 0000000000..c4478a3e7b
--- /dev/null
+++ b/tests/auto/qml/v4/data/nestedLogicalOr.qml
@@ -0,0 +1,14 @@
+import Qt.v4 1.0
+
+Result {
+ property bool val1: false
+ property bool val2: true
+ property bool val3: false
+
+ property bool b1: (false || false || true)
+ property bool b2: (false || (false || true))
+ property bool b3: ((false || false) || true)
+ property bool b4: (val1 || (val2 || val3)) ? true : false
+
+ result: b1 && b2 && b3 && b4
+}
diff --git a/tests/auto/qml/v4/data/nestedObjectAccess.qml b/tests/auto/qml/v4/data/nestedObjectAccess.qml
new file mode 100644
index 0000000000..56cd17e41e
--- /dev/null
+++ b/tests/auto/qml/v4/data/nestedObjectAccess.qml
@@ -0,0 +1,5 @@
+import Qt.v4 1.0
+
+Result {
+ result: nested.result
+}
diff --git a/tests/auto/qml/v4/data/nestedObjectAccess2.qml b/tests/auto/qml/v4/data/nestedObjectAccess2.qml
new file mode 100644
index 0000000000..2f0e0db01c
--- /dev/null
+++ b/tests/auto/qml/v4/data/nestedObjectAccess2.qml
@@ -0,0 +1,5 @@
+import Qt.v4 1.0
+
+Result {
+ result: nested2.result
+}
diff --git a/tests/auto/qml/v4/data/nullQObject.qml b/tests/auto/qml/v4/data/nullQObject.qml
new file mode 100644
index 0000000000..00185b3988
--- /dev/null
+++ b/tests/auto/qml/v4/data/nullQObject.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ property QtObject obj
+ property QtObject test
+ test: obj
+}
diff --git a/tests/auto/qml/v4/data/objectToBool.qml b/tests/auto/qml/v4/data/objectToBool.qml
new file mode 100644
index 0000000000..8c8a67bee0
--- /dev/null
+++ b/tests/auto/qml/v4/data/objectToBool.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject prop1: null
+ property QtObject prop2: QtObject {}
+
+ property bool test1: prop1 ? true : false
+ property bool test2: prop2 ? true : false
+
+ property bool test3: prop1 == false
+ property bool test4: prop1 === false
+
+ property bool test5: prop2 == false
+ property bool test6: prop2 === false
+}
+
diff --git a/tests/auto/qml/v4/data/qrealToIntRounding.qml b/tests/auto/qml/v4/data/qrealToIntRounding.qml
new file mode 100644
index 0000000000..ee3d405073
--- /dev/null
+++ b/tests/auto/qml/v4/data/qrealToIntRounding.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+QtObject {
+ property int data: 1
+
+ property int test1: 6.6 + data
+ property int test2: 6.2 + data
+ property int test3: 6 + data
+}
+
diff --git a/tests/auto/qml/v4/data/qtbug_21883.qml b/tests/auto/qml/v4/data/qtbug_21883.qml
new file mode 100644
index 0000000000..a51f97c944
--- /dev/null
+++ b/tests/auto/qml/v4/data/qtbug_21883.qml
@@ -0,0 +1,5 @@
+import Qt.v4 1.0
+
+Result {
+ property Result dummy: Result
+}
diff --git a/tests/auto/qml/v4/data/qtbug_22816.qml b/tests/auto/qml/v4/data/qtbug_22816.qml
new file mode 100644
index 0000000000..bfa8d4948c
--- /dev/null
+++ b/tests/auto/qml/v4/data/qtbug_22816.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ QtObject {
+ id: object
+ property bool prop1: true
+ function myfunction() { return true; }
+ property bool prop2: object.prop1 && myfunction();
+ }
+
+ property bool test1: object.prop1 && object.prop2
+ property bool test2: object.prop1
+
+ Component.onCompleted: {
+ object.prop1 = false;
+ }
+}
+
diff --git a/tests/auto/qml/v4/data/singletonType.qml b/tests/auto/qml/v4/data/singletonType.qml
new file mode 100644
index 0000000000..3fcbcae64d
--- /dev/null
+++ b/tests/auto/qml/v4/data/singletonType.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0 as ModApi
+import QtQuick 2.0
+
+Item {
+ property int testProp: ModApi.V4.ip
+ property int testProp2: 2
+
+ function getRandom() {
+ testProp2 = ModApi.V4.random();
+ // testProp should also have changed.
+ }
+}
diff --git a/tests/auto/qml/v4/data/strictEquals.qml b/tests/auto/qml/v4/data/strictEquals.qml
new file mode 100644
index 0000000000..503ca50454
--- /dev/null
+++ b/tests/auto/qml/v4/data/strictEquals.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+
+QtObject {
+ property QtObject myprop1: null
+ property QtObject myprop2: QtObject {}
+ property real zero: 0
+ property bool falseProp: false
+
+ property bool test1: myprop1 === false
+ property bool test2: myprop1 === null
+ property bool test3: 5 === myprop1
+ property bool test4: null === myprop1
+ property bool test5: myprop1 !== false
+ property bool test6: myprop1 !== null
+ property bool test7: 5 !== myprop1
+ property bool test8: null !== myprop1
+
+ property bool test9: myprop2 === false
+ property bool test10: myprop2 === null
+ property bool test11: 5 === myprop2
+ property bool test12: null === myprop2
+ property bool test13: myprop2 !== false
+ property bool test14: myprop2 !== null
+ property bool test15: 5 !== myprop2
+ property bool test16: null !== myprop2
+
+ property bool test17: myprop1 === myprop1
+ property bool test18: myprop1 !== myprop1
+ property bool test19: myprop1 === myprop2
+ property bool test20: myprop1 !== myprop2
+ property bool test21: myprop2 === myprop2
+ property bool test22: myprop2 !== myprop2
+
+ property bool test23: myprop1 === "hello"
+ property bool test24: myprop1 !== "hello"
+ property bool test25: myprop2 === "hello"
+ property bool test26: myprop2 !== "hello"
+
+ property bool test27: falseProp === zero
+ property bool test28: falseProp !== zero
+ property bool test29: falseProp === 1
+ property bool test30: falseProp !== 1
+ property bool test31: true === zero
+ property bool test32: true !== zero
+ property bool test33: true === 1
+ property bool test34: true !== 1
+
+ property bool test35: zero === 5.0
+ property bool test36: zero !== 5.0
+ property bool test37: zero === 1
+ property bool test38: zero !== 1
+}
+
diff --git a/tests/auto/qml/v4/data/stringComparison.qml b/tests/auto/qml/v4/data/stringComparison.qml
new file mode 100644
index 0000000000..d9eab5389e
--- /dev/null
+++ b/tests/auto/qml/v4/data/stringComparison.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+QtObject {
+ property string string1: "aaba"
+ property string string2: "aa"
+ property string string3: "aaab"
+ property string string4: "c"
+ property string string5: string2 + string4
+
+ property bool test1: string1 > string2
+ property bool test2: string2 < string1
+ property bool test3: string1 > string3
+ property bool test4: string3 < string1
+ property bool test5: string1 < string4
+ property bool test6: string4 > string1
+ property bool test7: string1 < string5
+ property bool test8: string5 > string1
+
+ property bool test9: string1 == "aaba"
+ property bool test10: string1 != "baa"
+ property bool test11: string1 === "aaba"
+ property bool test12: string1 !== "baa"
+ property bool test13: string4 == "c"
+ property bool test14: string4 != "d"
+ property bool test15: string4 === "c"
+ property bool test16: string4 !== "d"
+ property bool test17: string5 === "aac"
+ property bool test18: string5 !== "aad"
+
+ property bool test19: string1 >= string2
+ property bool test20: string2 <= string1
+ property bool test21: string1 >= string3
+ property bool test22: string3 <= string1
+ property bool test23: string1 <= string4
+ property bool test24: string4 >= string1
+ property bool test25: string4 <= "c"
+ property bool test26: string4 >= "c"
+ property bool test27: string5 <= "aac"
+ property bool test28: string5 >= "aac"
+}
+
diff --git a/tests/auto/qml/v4/data/subscriptions.1.qml b/tests/auto/qml/v4/data/subscriptions.1.qml
new file mode 100644
index 0000000000..607233819e
--- /dev/null
+++ b/tests/auto/qml/v4/data/subscriptions.1.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 400
+ height: 400
+
+ property real targetHeight: menuItems.height + 1
+ property real heightValue: if (1) menuItems.height //this must be v8?
+ property bool boolProp: menuItems.height > heightValue //this must be v4?
+
+ Column {
+ id: menuItems
+ Item { height: 200; width: 10 }
+ }
+}
diff --git a/tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml b/tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml
new file mode 100644
index 0000000000..a8e05eeda1
--- /dev/null
+++ b/tests/auto/qml/v4/data/subscriptionsInConditionalExpressions.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ id: thisTest
+
+ property bool cond: true
+ property real a: 1
+ property real result: cond ? a : a
+
+ PropertyAction { running: true; target: thisTest; property: "a"; value: 2; }
+}
diff --git a/tests/auto/qml/v4/data/unaryMinus.qml b/tests/auto/qml/v4/data/unaryMinus.qml
new file mode 100644
index 0000000000..410654fc3c
--- /dev/null
+++ b/tests/auto/qml/v4/data/unaryMinus.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: -i1.p2
+ property int test2: -i1.p2
+ property real test3: -i1.p1
+ property int test4: -i1.p1
+ property real test5: -i1.p3
+ property int test6: -i1.p3
+ property real test7: -i1.p4
+ property int test8: -i1.p4
+ property real test9: -i1.p5
+ property int test10: -i1.p5
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property int p2: 18
+ property real p3: -3.3
+ property int p4: -7
+ property real p5: 4.4
+ }
+ }
+
diff --git a/tests/auto/qml/v4/data/unaryPlus.qml b/tests/auto/qml/v4/data/unaryPlus.qml
new file mode 100644
index 0000000000..cd5315a7cc
--- /dev/null
+++ b/tests/auto/qml/v4/data/unaryPlus.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: +i1.p2
+ property int test2: +i1.p2
+ property real test3: +i1.p1
+ property int test4: +i1.p1
+ property real test5: +i1.p3
+ property int test6: +i1.p3
+ property real test7: +i1.p4
+ property int test8: +i1.p4
+ property real test9: +i1.p5
+ property int test10: +i1.p5
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property int p2: 18
+ property real p3: -3.3
+ property int p4: -7
+ property real p5: 4.4
+ }
+}
+
diff --git a/tests/auto/qml/v4/data/unnecessaryReeval.qml b/tests/auto/qml/v4/data/unnecessaryReeval.qml
new file mode 100644
index 0000000000..48662d7a2d
--- /dev/null
+++ b/tests/auto/qml/v4/data/unnecessaryReeval.qml
@@ -0,0 +1,7 @@
+import Qt.v4 1.0
+
+Result {
+ property int a: 8
+ property int b: 19
+ result: (a == 8)?b:7
+}
diff --git a/tests/auto/qml/v4/data/varHandling.qml b/tests/auto/qml/v4/data/varHandling.qml
new file mode 100644
index 0000000000..c19e6a256f
--- /dev/null
+++ b/tests/auto/qml/v4/data/varHandling.qml
@@ -0,0 +1,67 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool pBool: true
+ property int pInt: 666
+ property real pReal: 3.1415927
+ property string pString: 'foo'
+ property url pUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
+ property color pColor: Qt.rgba(1, 0, 0, 0.5)
+ property QtObject pObject: QtObject { property string foo: 'bar' }
+
+ // Test assignment to var
+ property var pBoolVar: pBool
+ property var pIntVar: pInt
+ property var pRealVar: pReal
+ property var pStringVar: pString
+ property var pUrlVar: pUrl
+ property var pColorVar: pColor
+ property var pObjectVar: pObject
+ property var pNullVar: null
+ property var pVarVar: pUrlVar
+
+ // Test equivalence
+ property bool boolConversionSuccess: (pBoolVar == true)
+ property bool intConversionSuccess: (pIntVar == 666)
+ property bool realConversionSuccess: (pRealVar == 3.1415927)
+ property bool stringConversionSuccess: (pStringVar == 'foo')
+
+ property url comparisonUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
+ property bool urlConversionSuccess: (pUrlVar == comparisonUrl)
+
+ property color comparisonColor: Qt.rgba(1, 0, 0, 0.5)
+ property bool colorConversionSuccess: (pColorVar == comparisonColor)
+
+ property bool objectConversionSuccess: (pObjectVar == pObject)
+ property bool nullConversionSuccess: (pNullVar == null)
+
+ property bool varConversionSuccess: (pVarVar == comparisonUrl)
+
+ // Operations are not handled by V4 - they should pass through correctly
+ property var pVarNot: !pBoolVar
+ property var pVarComplement: ~pIntVar
+ property var pVarEqual: (pBoolVar == pBoolVar)
+ property var pVarLiteralEqual: (pBoolVar == true)
+ property var pVarUnequal: (pUrlVar == pColorVar)
+ property var pVarComparison: (pIntVar <= pIntVar)
+ property var pVarShift: (pIntVar >> 1)
+
+ Component.onCompleted: {
+ if (!boolConversionSuccess) console.warn('QV4: bool conversion failed');
+ if (!intConversionSuccess) console.warn('QV4: int conversion failed');
+ if (!realConversionSuccess) console.warn('QV4: real conversion failed');
+ if (!stringConversionSuccess) console.warn('QV4: string conversion failed');
+ if (!urlConversionSuccess) console.warn('QV4: url conversion failed');
+ if (!colorConversionSuccess) console.warn('QV4: color conversion failed');
+ if (!objectConversionSuccess) console.warn('QV4: object conversion failed');
+ if (!nullConversionSuccess) console.warn('QV4: null conversion failed');
+ if (!varConversionSuccess) console.warn('QV4: var conversion failed');
+ if (pVarNot != false) console.warn('QV4: var negation impeded');
+ if (pVarComplement != ~666) console.warn('QV4: var complement impeded');
+ if (pVarEqual != true) console.warn('QV4: var equality impeded');
+ if (pVarLiteralEqual != true) console.warn('QV4: var/literal equality impeded');
+ if (pVarUnequal != false) console.warn('QV4: var unequality impeded');
+ if (pVarComparison != true) console.warn('QV4: var comparison impeded');
+ if (pVarShift != 333) console.warn('QV4: var shift impeded');
+ }
+}
diff --git a/tests/auto/qml/v4/data/variantHandling.qml b/tests/auto/qml/v4/data/variantHandling.qml
new file mode 100644
index 0000000000..3d48eef57e
--- /dev/null
+++ b/tests/auto/qml/v4/data/variantHandling.qml
@@ -0,0 +1,67 @@
+import QtQuick 2.0
+
+QtObject {
+ property bool pBool: true
+ property int pInt: 666
+ property real pReal: 3.1415927
+ property string pString: 'foo'
+ property url pUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
+ property color pColor: Qt.rgba(1, 0, 0, 0.5)
+ property QtObject pObject: QtObject { property string foo: 'bar' }
+
+ // Test assignment to variant
+ property variant pBoolVar: pBool
+ property variant pIntVar: pInt
+ property variant pRealVar: pReal
+ property variant pStringVar: pString
+ property variant pUrlVar: pUrl
+ property variant pColorVar: pColor
+ property variant pObjectVar: pObject
+ property variant pNullVar: null
+ property variant pVarVar: pUrlVar
+
+ // Test equivalence
+ property bool boolConversionSuccess: (pBoolVar == true)
+ property bool intConversionSuccess: (pIntVar == 666)
+ property bool realConversionSuccess: (pRealVar == 3.1415927)
+ property bool stringConversionSuccess: (pStringVar == 'foo')
+
+ property url comparisonUrl: 'http://tools.ietf.org/html/rfc3986#section-1.1.2'
+ property bool urlConversionSuccess: (pUrlVar == comparisonUrl)
+
+ property color comparisonColor: Qt.rgba(1, 0, 0, 0.5)
+ property bool colorConversionSuccess: (pColorVar == comparisonColor)
+
+ property bool objectConversionSuccess: (pObjectVar == pObject)
+ property bool nullConversionSuccess: (pNullVar == null)
+
+ property bool variantConversionSuccess: (pVarVar == comparisonUrl)
+
+ // Operations are not handled by V4 - they should pass through correctly
+ property variant pVarNot: !pBoolVar
+ property variant pVarComplement: ~pIntVar
+ property variant pVarEqual: (pBoolVar == pBoolVar)
+ property variant pVarLiteralEqual: (pBoolVar == true)
+ property variant pVarUnequal: (pUrlVar == pColorVar)
+ property variant pVarComparison: (pIntVar <= pIntVar)
+ property variant pVarShift: (pIntVar >> 1)
+
+ Component.onCompleted: {
+ if (!boolConversionSuccess) console.warn('QV4: bool conversion failed');
+ if (!intConversionSuccess) console.warn('QV4: int conversion failed');
+ if (!realConversionSuccess) console.warn('QV4: real conversion failed');
+ if (!stringConversionSuccess) console.warn('QV4: string conversion failed');
+ if (!urlConversionSuccess) console.warn('QV4: url conversion failed');
+ if (!colorConversionSuccess) console.warn('QV4: color conversion failed');
+ if (!objectConversionSuccess) console.warn('QV4: object conversion failed');
+ if (!nullConversionSuccess) console.warn('QV4: null conversion failed');
+ if (!variantConversionSuccess) console.warn('QV4: variant conversion failed');
+ if (pVarNot != false) console.warn('QV4: variant negation impeded');
+ if (pVarComplement != ~666) console.warn('QV4: variant complement impeded');
+ if (pVarEqual != true) console.warn('QV4: variant equality impeded');
+ if (pVarLiteralEqual != true) console.warn('QV4: variant/literal equality impeded');
+ if (pVarUnequal != false) console.warn('QV4: variant unequality impeded');
+ if (pVarComparison != true) console.warn('QV4: variant comparison impeded');
+ if (pVarShift != 333) console.warn('QV4: variant shift impeded');
+ }
+}
diff --git a/tests/auto/qml/v4/testtypes.cpp b/tests/auto/qml/v4/testtypes.cpp
new file mode 100644
index 0000000000..ba81e591fc
--- /dev/null
+++ b/tests/auto/qml/v4/testtypes.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+
+#include <QtQml/qqml.h>
+
+void registerTypes()
+{
+ qmlRegisterType<ResultObject>("Qt.v4", 1,0, "Result");
+ qmlRegisterType<NestedObject>();
+ qmlRegisterType<ConversionObject>("Qt.v4", 1, 0, "Conversion");
+ qmlRegisterType<JSValueTest>("Qt.v4", 1, 0, "JSValueTest");
+}
diff --git a/tests/auto/qml/v4/testtypes.h b/tests/auto/qml/v4/testtypes.h
new file mode 100644
index 0000000000..ee516f2927
--- /dev/null
+++ b/tests/auto/qml/v4/testtypes.h
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
+#include <QVector3D>
+#include <QJSValue>
+
+class NestedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int dummy READ dummy);
+ Q_PROPERTY(int result READ result FINAL CONSTANT);
+
+public:
+ int dummy() const { return 7; }
+ int result() const { return 37; }
+};
+
+class ResultObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int result READ result WRITE setResult FINAL)
+ Q_PROPERTY(NestedObject *nested READ nested CONSTANT)
+ Q_PROPERTY(NestedObject *nested2 READ nested2 FINAL CONSTANT)
+public:
+ ResultObject() : m_result(0), m_resultCounter(0) {}
+
+ int resultCounter() const { return m_resultCounter; }
+ void resetResultCounter() { m_resultCounter = 0; }
+
+ int result() const { return m_result; }
+ void setResult(int result) { m_result = result; m_resultCounter++; }
+
+ NestedObject *nested() { return &m_nested; }
+ NestedObject *nested2() { return &m_nested2; }
+
+private:
+ int m_result;
+ int m_resultCounter;
+
+ NestedObject m_nested;
+ NestedObject m_nested2;
+};
+
+class ConversionObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(bool boolProp READ boolProp WRITE setBoolProp NOTIFY boolPropChanged)
+ Q_PROPERTY(int intProp READ intProp WRITE setIntProp NOTIFY intPropChanged)
+ Q_PROPERTY(float floatProp READ floatProp WRITE setFloatProp NOTIFY floatPropChanged)
+ Q_PROPERTY(double doubleProp READ doubleProp WRITE setDoubleProp NOTIFY doublePropChanged)
+ Q_PROPERTY(qreal qrealProp READ qrealProp WRITE setQrealProp NOTIFY qrealPropChanged)
+ Q_PROPERTY(QString qstringProp READ qstringProp WRITE setQstringProp NOTIFY qstringPropChanged)
+ Q_PROPERTY(QUrl qurlProp READ qurlProp WRITE setQurlProp NOTIFY qurlPropChanged)
+ Q_PROPERTY(QVector3D vec3Prop READ vec3Prop WRITE setVec3Prop NOTIFY vec3PropChanged)
+ Q_PROPERTY(QJSValue jsvalueProp READ jsvalueProp WRITE setJsvalueProp NOTIFY jsvaluePropChanged)
+
+public:
+ ConversionObject() : m_boolProp(false), m_intProp(0), m_floatProp(0.0), m_doubleProp(0.0), m_qrealProp(0.0) {}
+ ~ConversionObject() {}
+
+ bool boolProp() const { return m_boolProp; }
+ void setBoolProp(bool v) { m_boolProp = v; emit boolPropChanged(); }
+ int intProp() const { return m_intProp; }
+ void setIntProp(int v) { m_intProp = v; emit intPropChanged(); }
+ float floatProp() const { return m_floatProp; }
+ void setFloatProp(float v) { m_floatProp = v; emit floatPropChanged(); }
+ double doubleProp() const { return m_doubleProp; }
+ void setDoubleProp(double v) { m_doubleProp = v; emit doublePropChanged(); }
+ qreal qrealProp() const { return m_qrealProp; }
+ void setQrealProp(qreal v) { m_qrealProp = v; emit qrealPropChanged(); }
+ QString qstringProp() const { return m_qstringProp; }
+ void setQstringProp(const QString& v) { m_qstringProp = v; emit qstringPropChanged(); }
+ QUrl qurlProp() const { return m_qurlProp; }
+ void setQurlProp(const QUrl& v) { m_qurlProp = v; emit qurlPropChanged(); }
+ QVector3D vec3Prop() const { return m_vec3Prop; }
+ void setVec3Prop(const QVector3D& v) { m_vec3Prop = v; emit vec3PropChanged(); }
+ QJSValue jsvalueProp() const { return m_jsvalueProp; }
+ void setJsvalueProp(const QJSValue &v) { m_jsvalueProp = v; emit jsvaluePropChanged(); }
+
+signals:
+ void boolPropChanged();
+ void intPropChanged();
+ void floatPropChanged();
+ void doublePropChanged();
+ void qrealPropChanged();
+ void qstringPropChanged();
+ void qurlPropChanged();
+ void vec3PropChanged();
+ void jsvaluePropChanged();
+
+private:
+ bool m_boolProp;
+ int m_intProp;
+ float m_floatProp;
+ double m_doubleProp;
+ qreal m_qrealProp;
+ QString m_qstringProp;
+ QUrl m_qurlProp;
+ QVector3D m_vec3Prop;
+ QJSValue m_jsvalueProp;
+};
+
+class JSValueTest : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QJSValue boolVar READ boolVar WRITE setBoolVar NOTIFY boolVarChanged)
+ Q_PROPERTY(QJSValue intVar READ intVar WRITE setIntVar NOTIFY intVarChanged)
+ Q_PROPERTY(QJSValue realVar READ realVar WRITE setRealVar NOTIFY realVarChanged)
+ Q_PROPERTY(QJSValue stringVar READ stringVar WRITE setStringVar NOTIFY stringVarChanged)
+ Q_PROPERTY(QJSValue urlVar READ urlVar WRITE setUrlVar NOTIFY urlVarChanged)
+ Q_PROPERTY(QJSValue colorVar READ colorVar WRITE setColorVar NOTIFY colorVarChanged)
+ Q_PROPERTY(QJSValue objectVar READ objectVar WRITE setObjectVar NOTIFY objectVarChanged)
+ Q_PROPERTY(QJSValue nullVar READ nullVar WRITE setNullVar NOTIFY nullVarChanged)
+ Q_PROPERTY(QJSValue varVar READ varVar WRITE setVarVar NOTIFY varVarChanged)
+
+public:
+ JSValueTest() {}
+ ~JSValueTest() {}
+
+ QJSValue boolVar() const { return m_boolVar; }
+ void setBoolVar(const QJSValue &v) { m_boolVar = v; emit boolVarChanged(); }
+
+ QJSValue intVar() const { return m_intVar; }
+ void setIntVar(const QJSValue &v) { m_intVar = v; emit intVarChanged(); }
+
+ QJSValue realVar() const { return m_realVar; }
+ void setRealVar(const QJSValue &v) { m_realVar = v; emit realVarChanged(); }
+
+ QJSValue stringVar() const { return m_stringVar; }
+ void setStringVar(const QJSValue &v) { m_stringVar = v; emit stringVarChanged(); }
+
+ QJSValue urlVar() const { return m_urlVar; }
+ void setUrlVar(const QJSValue &v) { m_urlVar = v; emit urlVarChanged(); }
+
+ QJSValue colorVar() const { return m_colorVar; }
+ void setColorVar(const QJSValue &v) { m_colorVar = v; emit colorVarChanged(); }
+
+ QJSValue objectVar() const { return m_objectVar; }
+ void setObjectVar(const QJSValue &v) { m_objectVar = v; emit objectVarChanged(); }
+
+ QJSValue nullVar() const { return m_nullVar; }
+ void setNullVar(const QJSValue &v) { m_nullVar = v; emit nullVarChanged(); }
+
+ QJSValue varVar() const { return m_varVar; }
+ void setVarVar(const QJSValue &v) { m_varVar = v; emit varVarChanged(); }
+
+signals:
+ void boolVarChanged();
+ void intVarChanged();
+ void realVarChanged();
+ void stringVarChanged();
+ void urlVarChanged();
+ void colorVarChanged();
+ void objectVarChanged();
+ void nullVarChanged();
+ void varVarChanged();
+
+private:
+ QJSValue m_boolVar;
+ QJSValue m_intVar;
+ QJSValue m_realVar;
+ QJSValue m_stringVar;
+ QJSValue m_urlVar;
+ QJSValue m_colorVar;
+ QJSValue m_objectVar;
+ QJSValue m_nullVar;
+ QJSValue m_varVar;
+};
+
+void registerTypes();
+
+#endif // TESTTYPES_H
+
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
new file mode 100644
index 0000000000..e08bccd016
--- /dev/null
+++ b/tests/auto/qml/v4/tst_v4.cpp
@@ -0,0 +1,1125 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtCore/qdebug.h>
+#include <QtGui/qcolor.h>
+#include <QtCore/qnumeric.h>
+
+#include <private/qv4compiler_p.h>
+
+#include "../../shared/util.h"
+#include "testtypes.h"
+
+class tst_v4 : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_v4() {}
+
+private slots:
+ void initTestCase();
+
+ void unnecessaryReeval();
+ void logicalOr();
+ void nestedLogicalOr();
+ void logicalAnd();
+ void nestedLogicalAnd();
+ void conditionalExpr();
+ void qtscript();
+ void qtscript_data();
+ void nestedObjectAccess();
+ void subscriptionsInConditionalExpressions();
+ void qtbug_21883();
+ void qtbug_22816();
+ void stringComparison();
+ void unaryMinus();
+ void unaryPlus();
+ void colorType();
+ void mathAbs();
+ void mathCeil();
+ void mathFloor();
+ void mathMax();
+ void mathMin();
+ void mathCos();
+ void mathSin();
+ void singletonType();
+ void integerOperations();
+
+ void conversions_data();
+ void conversions();
+ void subscriptions();
+
+ void debuggingDumpInstructions(); // this test should be last.
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_v4::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ registerTypes();
+}
+
+void tst_v4::qtscript()
+{
+ QFETCH(QString, file);
+ QV4Compiler::enableBindingsTest(true);
+
+ QQmlComponent component(&engine, testFileUrl(file));
+
+ QQmlTestMessageHandler messageHandler;
+
+ QObject *o = component.create();
+ delete o;
+
+ QEXPECT_FAIL("jsvalueHandling", "QTBUG-26951 - QJSValue has a different representation of NULL to QV8Engine", Continue);
+ const int v4ErrorCount = messageHandler.messages().filter(QLatin1String("QV4")).size();
+ QVERIFY2(v4ErrorCount == 0, qPrintable(messageHandler.messageString()));
+
+ QV4Compiler::enableBindingsTest(false);
+}
+
+void tst_v4::qtscript_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QTest::newRow("equals") << "equals.qml";
+ QTest::newRow("strict equals") << "strictEquals.qml";
+ QTest::newRow("qreal -> int rounding") << "qrealToIntRounding.qml";
+ QTest::newRow("exception on fetch") << "fetchException.qml";
+ QTest::newRow("logical or") << "logicalOr.qml";
+ QTest::newRow("conditional expressions") << "conditionalExpr.qml";
+ QTest::newRow("double bool jump") << "doubleBoolJump.qml";
+ QTest::newRow("unary minus") << "unaryMinus.qml";
+ QTest::newRow("null qobject") << "nullQObject.qml";
+ QTest::newRow("qobject -> bool") << "objectToBool.qml";
+ QTest::newRow("conversion from bool") << "conversions.1.qml";
+ QTest::newRow("conversion from int") << "conversions.2.qml";
+ QTest::newRow("conversion from float") << "conversions.3.qml";
+ QTest::newRow("conversion from double") << "conversions.4.qml";
+ QTest::newRow("conversion from real") << "conversions.5.qml";
+ QTest::newRow("conversion from string") << "conversions.6.qml";
+ QTest::newRow("conversion from url") << "conversions.7.qml";
+ QTest::newRow("conversion from vec3") << "conversions.8.qml";
+ QTest::newRow("variantHandling") << "variantHandling.qml";
+ QTest::newRow("varHandling") << "varHandling.qml";
+ QTest::newRow("jsvalueHandling") << "jsvalueHandling.qml";
+ QTest::newRow("integerOperations") << "integerOperations.qml";
+}
+
+void tst_v4::unnecessaryReeval()
+{
+ QQmlComponent component(&engine, testFileUrl("unnecessaryReeval.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->resultCounter(), 1);
+ QCOMPARE(ro->result(), 19);
+ ro->resetResultCounter();
+
+ ro->setProperty("b", 6);
+
+ QCOMPARE(ro->resultCounter(), 1);
+ QCOMPARE(ro->result(), 6);
+ ro->resetResultCounter();
+
+ ro->setProperty("a", 14);
+
+ QCOMPARE(ro->resultCounter(), 1);
+ QCOMPARE(ro->result(), 7);
+ ro->resetResultCounter();
+
+ ro->setProperty("b", 14);
+ QCOMPARE(ro->resultCounter(), 0);
+ QCOMPARE(ro->result(), 7);
+
+ delete o;
+}
+
+void tst_v4::logicalOr()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalOr.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 0);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalOr.2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+}
+
+void tst_v4::nestedLogicalOr()
+{
+ //we are primarily testing that v4 does not get caught in a loop (QTBUG-24038)
+ QQmlComponent component(&engine, testFileUrl("nestedLogicalOr.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+}
+
+void tst_v4::logicalAnd()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 0);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.3.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ // QTBUG-24660
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.4.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.5.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.6.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("logicalAnd.7.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+ }
+}
+
+void tst_v4::nestedLogicalAnd()
+{
+ QQmlComponent component(&engine, testFileUrl("nestedLogicalAnd.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 1);
+ delete o;
+}
+
+void tst_v4::conditionalExpr()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("conditionalExpr.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 0);
+ delete o;
+ }
+}
+
+// This would previously use the metaObject of the root element to result the nested access.
+// That is, the index for accessing "result" would have been RootObject::result, instead of
+// NestedObject::result.
+void tst_v4::nestedObjectAccess()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 37);
+
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("nestedObjectAccess2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->result(), 37);
+
+ delete o;
+ }
+}
+
+void tst_v4::subscriptionsInConditionalExpressions()
+{
+ QQmlComponent component(&engine, testFileUrl("subscriptionsInConditionalExpressions.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QObject *ro = qobject_cast<QObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->property("result").toReal(), qreal(2));
+
+ delete o;
+}
+
+// Crash test
+void tst_v4::qtbug_21883()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_21883.qml"));
+
+ QString warning = component.url().toString() + ":4: Unable to assign null to ResultObject*";
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ delete o;
+}
+
+void tst_v4::qtbug_22816()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_22816.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toBool(), false);
+ QCOMPARE(o->property("test2").toBool(), false);
+ delete o;
+}
+
+void tst_v4::stringComparison()
+{
+ QQmlComponent component(&engine, testFileUrl("stringComparison.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toBool(), true);
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toBool(), true);
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QCOMPARE(o->property("test11").toBool(), true);
+ QCOMPARE(o->property("test12").toBool(), true);
+ QCOMPARE(o->property("test13").toBool(), true);
+ QCOMPARE(o->property("test14").toBool(), true);
+ QCOMPARE(o->property("test15").toBool(), true);
+ QCOMPARE(o->property("test16").toBool(), true);
+ QCOMPARE(o->property("test17").toBool(), true);
+ QCOMPARE(o->property("test18").toBool(), true);
+ QCOMPARE(o->property("test19").toBool(), true);
+ QCOMPARE(o->property("test20").toBool(), true);
+ QCOMPARE(o->property("test21").toBool(), true);
+ QCOMPARE(o->property("test22").toBool(), true);
+ delete o;
+}
+
+void tst_v4::unaryMinus()
+{
+ QQmlComponent component(&engine, testFileUrl("unaryMinus.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(-18));
+ QCOMPARE(o->property("test2").toInt(), -18);
+ QCOMPARE(o->property("test3").toReal(), qreal(3.7));
+ QCOMPARE(o->property("test4").toInt(), 4);
+ QCOMPARE(o->property("test5").toReal(), qreal(3.3));
+ QCOMPARE(o->property("test6").toInt(), 3);
+ QCOMPARE(o->property("test7").toReal(), qreal(7));
+ QCOMPARE(o->property("test8").toInt(), 7);
+ QCOMPARE(o->property("test9").toReal(), qreal(-4.4));
+ QCOMPARE(o->property("test10").toInt(), -4);
+
+ delete o;
+}
+
+void tst_v4::unaryPlus()
+{
+ QQmlComponent component(&engine, testFileUrl("unaryPlus.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(18));
+ QCOMPARE(o->property("test2").toInt(), 18);
+ QCOMPARE(o->property("test3").toReal(), qreal(-3.7));
+ QCOMPARE(o->property("test4").toInt(), -4);
+ QCOMPARE(o->property("test5").toReal(), qreal(-3.3));
+ QCOMPARE(o->property("test6").toInt(), -3);
+ QCOMPARE(o->property("test7").toReal(), qreal(-7));
+ QCOMPARE(o->property("test8").toInt(), -7);
+ QCOMPARE(o->property("test9").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test10").toInt(), 4);
+
+ delete o;
+}
+
+void tst_v4::colorType()
+{
+ QQmlComponent component(&engine, testFileUrl("colorType.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").value<QColor>(), QColor("red"));
+ QCOMPARE(o->property("test2").value<QColor>(), QColor("red"));
+ QCOMPARE(o->property("test3").value<QColor>(), QColor("red"));
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toBool(), true);
+ QCOMPARE(o->property("test7").toBool(), true);
+ delete o;
+}
+
+void tst_v4::mathAbs()
+{
+ QQmlComponent component(&engine, testFileUrl("mathAbs.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(3.7));
+ QCOMPARE(o->property("test2").toReal(), qreal(4.5));
+ QCOMPARE(o->property("test3").toInt(), 18);
+ QCOMPARE(o->property("test4").toInt(), 72);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toBool(), true);
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toInt(), 82);
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QCOMPARE(o->property("test11").toInt(), 0);
+ QCOMPARE(o->property("test12").toBool(), true);
+
+ delete o;
+}
+
+void tst_v4::mathCeil()
+{
+ QQmlComponent component(&engine, testFileUrl("mathCeil.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(-3));
+ QCOMPARE(o->property("test2").toReal(), qreal(5));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toReal(), qreal(83));
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toBool(), true);
+ QCOMPARE(o->property("test9").toInt(), 0);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QCOMPARE(o->property("test11").toBool(), true);
+
+ delete o;
+}
+
+void tst_v4::mathFloor()
+{
+ QQmlComponent component(&engine, testFileUrl("mathFloor.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(-4));
+ QCOMPARE(o->property("test2").toReal(), qreal(4));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toReal(), qreal(82));
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toBool(), true);
+ QCOMPARE(o->property("test9").toInt(), 0);
+ QCOMPARE(o->property("test10").toBool(), true);
+
+ delete o;
+}
+
+void tst_v4::mathMax()
+{
+ QQmlComponent component(&engine, testFileUrl("mathMax.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test2").toReal(), qreal(7));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toReal(), qreal(82.6));
+ QCOMPARE(o->property("test7").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test8").toBool(), true);
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QCOMPARE(o->property("test11").toReal(), qreal(0));
+ QCOMPARE(o->property("test12").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test13").toReal(), qreal(7));
+
+ delete o;
+}
+
+void tst_v4::mathMin()
+{
+ QQmlComponent component(&engine, testFileUrl("mathMin.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(-3.7));
+ QCOMPARE(o->property("test2").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toReal(), qreal(82.6));
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QCOMPARE(o->property("test11").toReal(), qreal(-3.7));
+ QCOMPARE(o->property("test12").toReal(), qreal(0));
+ QCOMPARE(o->property("test13").toReal(), qreal(-3.7));
+ delete o;
+}
+
+static bool fuzzyCompare(qreal a, qreal b)
+{
+ const qreal EPSILON = 0.0001;
+ return (a + EPSILON > b) && (a - EPSILON < b);
+}
+
+void tst_v4::mathCos()
+{
+ QQmlComponent component(&engine, testFileUrl("mathCos.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QVERIFY(fuzzyCompare(o->property("test1").toReal(), qreal(-0.848100)));
+ QVERIFY(fuzzyCompare(o->property("test2").toReal(), qreal(-0.307333)));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QVERIFY(fuzzyCompare(o->property("test6").toReal(), qreal(0.606941)));
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toBool(), true);
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QVERIFY(fuzzyCompare(o->property("test11").toReal(), qreal(0.890792)));
+
+ delete o;
+}
+
+void tst_v4::mathSin()
+{
+ QQmlComponent component(&engine, testFileUrl("mathSin.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QVERIFY(fuzzyCompare(o->property("test1").toReal(), qreal(0.529836)));
+ QVERIFY(fuzzyCompare(o->property("test2").toReal(), qreal(-0.951602)));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QVERIFY(fuzzyCompare(o->property("test6").toReal(), qreal(0.794747)));
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toBool(), true);
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QVERIFY(fuzzyCompare(o->property("test11").toReal(), qreal(0.454411)));
+
+ delete o;
+}
+
+void tst_v4::integerOperations()
+{
+ QQmlComponent component(&engine, testFileUrl("integerOperations.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("testa1").toInt(), 333);
+ QCOMPARE(o->property("testa2").toInt(), -666);
+
+ QCOMPARE(o->property("testb1").toInt(), 0);
+ QCOMPARE(o->property("testb2").toInt(), 2);
+ QCOMPARE(o->property("testb3").toInt(), 0);
+ QCOMPARE(o->property("testb4").toInt(), 2);
+ QCOMPARE(o->property("testb5").toInt(), 0);
+ QCOMPARE(o->property("testb6").toInt(), 2);
+ QCOMPARE(o->property("testb7").toInt(), 0);
+ QCOMPARE(o->property("testb8").toInt(), 2);
+
+ QCOMPARE(o->property("testc1").toInt(), 335);
+ QCOMPARE(o->property("testc2").toInt(), -666);
+ QCOMPARE(o->property("testc3").toInt(), 335);
+ QCOMPARE(o->property("testc4").toInt(), -666);
+ QCOMPARE(o->property("testc5").toInt(), 335);
+ QCOMPARE(o->property("testc6").toInt(), -666);
+ QCOMPARE(o->property("testc7").toInt(), 335);
+ QCOMPARE(o->property("testc8").toInt(), -666);
+
+ QCOMPARE(o->property("testd1").toInt(), 330);
+ QCOMPARE(o->property("testd2").toInt(), 330);
+ QCOMPARE(o->property("testd3").toInt(), 330);
+ QCOMPARE(o->property("testd4").toInt(), 330);
+
+ QCOMPARE(o->property("teste1").toInt(), 28);
+ QCOMPARE(o->property("teste2").toInt(), -28);
+ QCOMPARE(o->property("teste3").toInt(), 256);
+ QCOMPARE(o->property("teste4").toInt(), 28);
+ QCOMPARE(o->property("teste5").toInt(), -28);
+ QCOMPARE(o->property("teste6").toInt(), 256);
+
+ QCOMPARE(o->property("testf1").toInt(), 1);
+ QCOMPARE(o->property("testf2").toInt(), -2);
+ QCOMPARE(o->property("testf3").toInt(), 0);
+ QCOMPARE(o->property("testf4").toInt(), 1);
+ QCOMPARE(o->property("testf5").toInt(), -2);
+ QCOMPARE(o->property("testf6").toInt(), 0);
+
+ QCOMPARE(o->property("testg1").toInt(), 1);
+ QCOMPARE(o->property("testg2").toInt(), 0x3FFFFFFE);
+ QCOMPARE(o->property("testg3").toInt(), 0);
+ QCOMPARE(o->property("testg4").toInt(), 1);
+ QCOMPARE(o->property("testg5").toInt(), 0x3FFFFFFE);
+ QCOMPARE(o->property("testg6").toInt(), 0);
+
+ delete o;
+}
+
+class V4SingletonType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int ip READ ip WRITE setIp NOTIFY ipChanged FINAL)
+public:
+ V4SingletonType() : m_ip(12) {}
+ ~V4SingletonType() {}
+
+ Q_INVOKABLE int random() { static int prng = 3; prng++; m_ip++; emit ipChanged(); return prng; }
+
+ int ip() const { return m_ip; }
+ void setIp(int v) { m_ip = v; emit ipChanged(); }
+
+signals:
+ void ipChanged();
+
+private:
+ int m_ip;
+};
+
+static QObject *v4_module_api_factory(QQmlEngine*, QJSEngine*)
+{
+ return new V4SingletonType;
+}
+
+void tst_v4::singletonType()
+{
+ // register singleton type, providing typeinfo via template
+ qmlRegisterSingletonType<V4SingletonType>("Qt.test", 1, 0, "V4", v4_module_api_factory);
+ QQmlComponent component(&engine, testFileUrl("singletonType.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("testProp").toInt(), 12);
+ QCOMPARE(o->property("testProp2").toInt(), 2);
+ QMetaObject::invokeMethod(o, "getRandom");
+ QCOMPARE(o->property("testProp").toInt(), 13);
+ QCOMPARE(o->property("testProp2").toInt(), 4);
+ delete o;
+}
+
+void tst_v4::conversions_data()
+{
+ QTest::addColumn<QUrl>("file");
+ QTest::addColumn<QStringList>("warnings");
+ QTest::addColumn<bool>("boolProp");
+ QTest::addColumn<int>("intProp");
+ QTest::addColumn<float>("floatProp");
+ QTest::addColumn<double>("doubleProp");
+ QTest::addColumn<qreal>("qrealProp");
+ QTest::addColumn<QString>("qstringProp");
+ QTest::addColumn<QUrl>("qurlProp");
+ QTest::addColumn<QVector3D>("vec3Prop");
+
+ QTest::newRow("from bool") << testFileUrl("conversions.1.qml")
+ << (QStringList() << (testFileUrl("conversions.1.qml").toString() + QLatin1String(":11:15: Unable to assign bool to QUrl")))
+ << true
+ << (int)true
+ << (float)1.0
+ << (double)1.0
+ << (qreal)1.0
+ << QString(QLatin1String("true"))
+ << QUrl() // cannot assign bool to url.
+ << QVector3D(1, 1, 1);
+
+ QTest::newRow("from integer") << testFileUrl("conversions.2.qml")
+ << (QStringList() << (testFileUrl("conversions.2.qml").toString() + QLatin1String(":11:15: Unable to assign int to QUrl")))
+ << (bool)4
+ << 4
+ << (float)4.0
+ << (double)4.0
+ << (qreal)4.0
+ << QString(QLatin1String("4"))
+ << QUrl() // cannot assign int to url.
+ << QVector3D(4, 4, 4);
+
+ QTest::newRow("from float") << testFileUrl("conversions.3.qml")
+ << (QStringList() << (testFileUrl("conversions.3.qml").toString() + QLatin1String(":11:15: Unable to assign number to QUrl")))
+ << (bool)4.4
+ << (int)4.4
+ << (float)4.4
+ << (double)((float)4.4)
+ << (qreal)((float)4.4)
+ << QString::number((double)((float)4.4), 'g', 16)
+ << QUrl() // cannot assign number to url.
+ << QVector3D(4.4, 4.4, 4.4);
+
+ QTest::newRow("from double") << testFileUrl("conversions.4.qml")
+ << (QStringList() << (testFileUrl("conversions.4.qml").toString() + QLatin1String(":11:15: Unable to assign number to QUrl")))
+ << (bool)4.444444444
+ << (int)4.444444444
+ << (float)4.444444444
+ << (double)4.444444444
+ << (qreal)4.444444444
+ << QString::number((double)4.444444444, 'g', 16)
+ << QUrl() // cannot assign number to url.
+ << QVector3D(4.444444444, 4.444444444, 4.444444444);
+
+ QTest::newRow("from qreal") << testFileUrl("conversions.5.qml")
+ << (QStringList() << (testFileUrl("conversions.5.qml").toString() + QLatin1String(":11:15: Unable to assign number to QUrl")))
+ << (bool)4.44
+ << (int)4.44
+ << (float)4.44
+ << (double)4.44
+ << (qreal)4.44
+ << QString(QLatin1String("4.44"))
+ << QUrl() // cannot assign number to url.
+ << QVector3D(4.44, 4.44, 4.44);
+
+ QTest::newRow("from string") << testFileUrl("conversions.6.qml")
+ << (QStringList())
+ << true
+ << 4
+ << (float)4.0
+ << (double)4.0
+ << (qreal)4.0
+ << QString(QLatin1String("4"))
+ << QUrl(testFileUrl("").toString() + QString(QLatin1String("4")))
+ << QVector3D(4, 4, 4);
+
+ QTest::newRow("from url") << testFileUrl("conversions.7.qml")
+ << (QStringList() << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":6:14: Unable to assign QUrl to int"))
+ << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":7:16: Unable to assign QUrl to number"))
+ << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":8:17: Unable to assign QUrl to number"))
+ << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":9:16: Unable to assign QUrl to number")))
+ << true
+ << 0
+ << (float) 0
+ << (double) 0
+ << (qreal) 0
+ << QString(testFileUrl("").toString() + QString(QLatin1String("4")))
+ << QUrl(testFileUrl("").toString() + QString(QLatin1String("4")))
+ << QVector3D(qQNaN(), qQNaN(), qQNaN());
+
+ QTest::newRow("from vector") << testFileUrl("conversions.8.qml")
+ << (QStringList() << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":11: Unable to assign QVector3D to QUrl"))
+ << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":10: Unable to assign QVector3D to QString"))
+ << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":9: Unable to assign QVector3D to double"))
+ << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":8: Unable to assign QVector3D to double"))
+ << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":7: Unable to assign QVector3D to float"))
+ << (testFileUrl("conversions.8.qml").toString() + QLatin1String(":6: Unable to assign QVector3D to int")))
+ << true // non-null therefore true
+ << (int)0 // the other values should be the default-ctor values.
+ << (float)0
+ << (double)0
+ << (qreal)0
+ << QString()
+ << QUrl()
+ << QVector3D(4, 4, 4); // except this one.
+}
+
+#define COMPARE_NUMBER(type, prop, expected) \
+ if (qIsNaN(expected)) \
+ QVERIFY(qIsNaN(qvariant_cast<type>(prop))); \
+ else \
+ QCOMPARE((prop), QVariant::fromValue<type>(expected));
+
+void tst_v4::conversions()
+{
+ QFETCH(QUrl, file);
+ QFETCH(QStringList, warnings);
+ QFETCH(bool, boolProp);
+ QFETCH(int, intProp);
+ QFETCH(float, floatProp);
+ QFETCH(double, doubleProp);
+ QFETCH(qreal, qrealProp);
+ QFETCH(QString, qstringProp);
+ QFETCH(QUrl, qurlProp);
+ QFETCH(QVector3D, vec3Prop);
+
+ foreach (const QString &w, warnings)
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(w));
+
+ QQmlComponent component(&engine, file);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("boolProp"), QVariant::fromValue<bool>(boolProp));
+ QCOMPARE(o->property("intProp"), QVariant::fromValue<int>(intProp));
+ COMPARE_NUMBER(float, o->property("floatProp"), floatProp);
+ COMPARE_NUMBER(double, o->property("doubleProp"), doubleProp);
+ COMPARE_NUMBER(qreal, o->property("qrealProp"), qrealProp);
+ QCOMPARE(o->property("qstringProp"), QVariant::fromValue<QString>(qstringProp));
+ QCOMPARE(o->property("qurlProp"), QVariant::fromValue<QUrl>(qurlProp));
+
+ QVector3D vec3 = qvariant_cast<QVector3D>(o->property("vec3Prop"));
+ COMPARE_NUMBER(qreal, QVariant::fromValue<qreal>(vec3.x()), vec3Prop.x());
+ COMPARE_NUMBER(qreal, QVariant::fromValue<qreal>(vec3.y()), vec3Prop.y());
+ COMPARE_NUMBER(qreal, QVariant::fromValue<qreal>(vec3.z()), vec3Prop.z());
+ delete o;
+}
+
+void tst_v4::subscriptions()
+{
+ {
+ QQmlComponent component(&engine, testFileUrl("subscriptions.1.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QObject *ro = qobject_cast<QObject *>(o);
+ QVERIFY(ro != 0);
+
+ QCOMPARE(ro->property("targetHeight"), QVariant::fromValue<qreal>(201));
+
+ delete o;
+ }
+}
+
+static QByteArray getAddress(int address)
+{
+ return QByteArray::number(address);
+}
+
+static QByteArray getLeading(int address)
+{
+ QByteArray leading;
+ if (address != -1) {
+ leading = getAddress(address);
+ leading.prepend(QByteArray(8 - leading.count(), ' '));
+ }
+ return leading;
+}
+
+#include <private/qv4instruction_p.h>
+void tst_v4::debuggingDumpInstructions()
+{
+ QStringList expectedPreAddress;
+ expectedPreAddress << "\t\tNoop";
+ expectedPreAddress << "\t0:0:";
+ expectedPreAddress << "\t\tSubscribeId\t\tId_Offset(0) -> Subscribe_Slot(0)";
+ expectedPreAddress << "\t\tFetchAndSubscribe\tObject_Reg(0) Fast_Accessor(0x0) -> Output_Reg(0) Subscription_Slot(0)";
+ expectedPreAddress << "\t\tLoadId\t\t\tId_Offset(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadScope\t\t-> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadRoot\t\t-> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadSingletonObject\t\t) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadAttached\t\tObject_Reg(0) Attached_Index(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tUnaryNot\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tUnaryMinusNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tUnaryMinusInt\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tUnaryPlusNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tUnaryPlusInt\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertBoolToInt\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertBoolToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertBoolToNumber\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertBoolToString\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertBoolToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertBoolToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertIntToBool\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertIntToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertIntToNumber\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertIntToString\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertIntToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertIntToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertJSValueToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNumberToBool\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNumberToInt\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNumberToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNumberToString\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNumberToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNumberToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToBool\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToInt\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToNumber\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToUrl\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToColor\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertStringToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertUrlToBool\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertUrlToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertUrlToString\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertUrlToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertUrlToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertColorToBool\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertColorToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertColorToString\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertColorToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertColorToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertObjectToBool\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertObjectToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertObjectToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertObjectToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertVarToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNullToJSValue\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNullToObject\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNullToVariant\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tConvertNullToVar\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tResolveUrl\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathSinNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathCosNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathAbsNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathRoundNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathFloorNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathCeilNumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathPINumber\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadNull\t\tConstant(null) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadNumber\t\tConstant(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadInt\t\t\tConstant(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadBool\t\tConstant(false) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLoadString\t\tString_DataIndex(0) String_Length(0) -> Output_Register(0)";
+ expectedPreAddress << "\t\tEnableV4Test\t\tString_DataIndex(0) String_Length(0)";
+ expectedPreAddress << "\t\tTestV4Store\t\tInput_Reg(0) Reg_Type(0)";
+ expectedPreAddress << "\t\tBitAndInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tBitOrInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tBitXorInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tAddNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tAddString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tSubNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMulNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tDivNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tModNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLShiftInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tRShiftInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tURShiftInt\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tGtNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLtNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tGeNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLeNumber\t\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tEqualNumber\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tNotEqualNumber\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tStrictEqualNumber\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tStrictNotEqualNumber\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tGtString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLtString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tGeString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tLeString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tEqualString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tNotEqualString\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tStrictEqualString\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tStrictNotEqualString\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tEqualObject\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tNotEqualObject\t\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tStrictEqualObject\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tStrictNotEqualObject\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathMaxNumber\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tMathMinNumber\tInput_Reg(0) Input_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tNewString\t\tRegister(0)";
+ expectedPreAddress << "\t\tNewUrl\t\t\tRegister(0)";
+ expectedPreAddress << "\t\tCleanupRegister\t\tRegister(0)";
+ expectedPreAddress << "\t\tCopy\t\t\tInput_Reg(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tFetch\t\t\tObject_Reg(0) Property_Index(0) -> Output_Reg(0)";
+ expectedPreAddress << "\t\tStore\t\t\tInput_Reg(0) -> Object_Reg(0) Property_Index(0)";
+ expectedPreAddress << "\t\tJump\t\t\tAddress(UNIT_TEST_JUMP_ADDRESS) [if false == Input_Reg(0)]"; //(address + size() + i->jump.count)
+ expectedPreAddress << "\t\tBranchTrue\t\tAddress(UNIT_TEST_BRANCH_ADDRESS) [if true == Input_Reg(0)]"; //(address + size() + i->branchop.offset)
+ expectedPreAddress << "\t\tBranchFalse\t\tAddress(UNIT_TEST_BRANCH_ADDRESS) [if false == Input_Reg(0)]"; //(address + size() + i->branchop.offset)
+ expectedPreAddress << "\t\tBranch\t\t\tAddress(UNIT_TEST_BRANCH_ADDRESS)"; //(address + size() + i->branchop.offset)
+ expectedPreAddress << "\t\tBlock\t\t\tMask(0)";
+ expectedPreAddress << "\t\tThrow\t\t\tInputReg(0)";
+ expectedPreAddress << "\t\tInitString\t\tString_DataIndex(0) -> String_Slot(0)";
+ QStringList expected;
+
+ QQmlTestMessageHandler messageHandler;
+
+ QQmlJS::Bytecode bc;
+#define DUMP_INSTR_IN_UNIT_TEST(I, FMT) { QQmlJS::V4InstrData<QQmlJS::V4Instr::I> i; memset(&i, 0, sizeof(i)); bc.append(i); }
+ FOR_EACH_V4_INSTR(DUMP_INSTR_IN_UNIT_TEST);
+#undef DUMP_INSTR_IN_UNIT_TEST // NOTE: we memset in order to ensure stable output.
+ const char *start = bc.constData();
+ const char *end = start + bc.size();
+ const char *codeAddr = start;
+ int whichExpected = 0;
+#define DUMP_INSTR_SIZE_IN_UNIT_TEST(I, FMT) { \
+ QString currExpected = whichExpected < expectedPreAddress.size() ? expectedPreAddress.at(whichExpected++) : QString(); \
+ currExpected.prepend(getLeading(codeAddr - start)); \
+ expected.append(currExpected); \
+ codeAddr += QQmlJS::V4Instr::size(static_cast<QQmlJS::V4Instr::Type>(QQmlJS::V4Instr::I)); \
+ }
+ FOR_EACH_V4_INSTR(DUMP_INSTR_SIZE_IN_UNIT_TEST);
+#undef DUMP_INSTR_SIZE_IN_UNIT_TEST // so that we generate the correct address for each instruction comparison
+ bc.dump(start, end);
+
+ // ensure that the output was expected.
+ const int messageCount = messageHandler.messages().count();
+ QCOMPARE(messageCount, expected.count());
+ for (int ii = 0; ii < messageCount; ++ii) {
+ // Calculating the destination address of a null jump/branch instruction is tricky
+ // so instead we simply don't compare that part of those instructions.
+ QRegExp ignoreAddress("\\bAddress\\((\\w*)\\)");
+ ignoreAddress.setMinimal(true);
+ QString expectOut = expected.at(ii); expectOut.replace(ignoreAddress, "");
+ QString actualOut = messageHandler.messages().at(ii); actualOut.replace(ignoreAddress, "");
+ QCOMPARE(actualOut, expectOut);
+ }
+}
+
+
+QTEST_MAIN(tst_v4)
+
+#include "tst_v4.moc"
diff --git a/tests/auto/qml/v4/v4.pro b/tests/auto/qml/v4/v4.pro
new file mode 100644
index 0000000000..8c7c30e399
--- /dev/null
+++ b/tests/auto/qml/v4/v4.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qqmlv4
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_v4.cpp \
+ testtypes.cpp
+HEADERS += testtypes.h
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qmldevtools/compile/compile.pro b/tests/auto/qmldevtools/compile/compile.pro
new file mode 100644
index 0000000000..1c65daf909
--- /dev/null
+++ b/tests/auto/qmldevtools/compile/compile.pro
@@ -0,0 +1,12 @@
+option(host_build)
+TARGET = tst_compile
+force_bootstrap: \
+ QT = bootstrap-private
+else: \
+ QT = core
+QT += qmldevtools-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_compile.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qmldevtools/compile/tst_compile.cpp b/tests/auto/qmldevtools/compile/tst_compile.cpp
new file mode 100644
index 0000000000..6b13d1b4bb
--- /dev/null
+++ b/tests/auto/qmldevtools/compile/tst_compile.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qqmljsengine_p.h>
+#include <private/qqmljslexer_p.h>
+#include <private/qqmljsparser_p.h>
+#include <private/qqmljsastvisitor_p.h>
+#include <private/qqmljsast_p.h>
+
+int main()
+{
+ // Nothing - this test just makes sure that the QmlDevTools headers
+ // are present, and that we can link against the library.
+ return 0;
+}
diff --git a/tests/auto/qmldevtools/qmldevtools.pro b/tests/auto/qmldevtools/qmldevtools.pro
new file mode 100644
index 0000000000..a0ca1bff87
--- /dev/null
+++ b/tests/auto/qmldevtools/qmldevtools.pro
@@ -0,0 +1,6 @@
+TEMPLATE = subdirs
+
+contains(QT_CONFIG, private_tests) {
+ SUBDIRS += \
+ compile
+}
diff --git a/tests/auto/qmltest/animatedimage/stickman.gif b/tests/auto/qmltest/animatedimage/stickman.gif
new file mode 100644
index 0000000000..7c4cd18687
--- /dev/null
+++ b/tests/auto/qmltest/animatedimage/stickman.gif
Binary files differ
diff --git a/tests/auto/qmltest/animatedimage/tst_animatedimage.qml b/tests/auto/qmltest/animatedimage/tst_animatedimage.qml
new file mode 100644
index 0000000000..d0574da4f5
--- /dev/null
+++ b/tests/auto/qmltest/animatedimage/tst_animatedimage.qml
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+ property string srcImage: "stickman.gif"
+ property bool canconnect
+ property bool checkfinished: false
+
+ Component.onCompleted: {
+ var check = new XMLHttpRequest;
+ check.open("GET", "http://127.0.0.1:14445/stickman.gif");
+ check.onreadystatechange = function() {
+
+ console.log("Status: ", check.status)
+ console.log("Readystate", check.readyState)
+ if (check.readyState == XMLHttpRequest.DONE) {
+ if (check.status == 404) {
+ top.canconnect = false;
+ }else{
+ top.canconnect = true;
+ }
+ top.checkfinished = true;
+ }
+ }
+ check.send();
+ }
+
+ AnimatedImage {
+ id: noSource
+ source: ""
+ }
+
+ AnimatedImage {
+ id: clearSource
+ source: srcImage
+ }
+
+ AnimatedImage {
+ id: resized
+ source: srcImage
+ width: 300
+ height: 300
+ }
+
+ AnimatedImage {
+ id: smooth
+ source: srcImage
+ smooth: true
+ width: 300
+ height: 300
+ }
+
+ AnimatedImage {
+ id: tileModes1
+ source: srcImage
+ width: 100
+ height: 300
+ fillMode: AnimatedImage.Tile
+ }
+
+ AnimatedImage {
+ id: tileModes2
+ source: srcImage
+ width: 300
+ height: 150
+ fillMode: AnimatedImage.TileVertically
+ }
+ AnimatedImage {
+ id: tileModes3
+ source: srcImage
+ width: 300
+ height: 150
+ fillMode: AnimatedImage.TileHorizontally
+ }
+
+ TestCase {
+ name: "AnimatedImage"
+
+ function test_noSource() {
+ compare(noSource.source, "")
+ compare(noSource.width, 0)
+ compare(noSource.height, 0)
+ compare(noSource.fillMode, AnimatedImage.Stretch)
+ }
+
+ function test_imageSource_data() {
+ return [
+ {
+ tag: "local",
+ source: "stickman.gif",
+ remote: false,
+ error: ""
+ },
+ {
+ tag: "local not found",
+ source: "no-such-file.png",
+ remote: false,
+ error: "SUBinline:1:21: QML AnimatedImage: Error Reading Animated Image File SUBno-such-file.png"
+ },
+ {
+ tag: "remote",
+ source: "http://127.0.0.1:14445/stickman.gif",
+ remote: true,
+ error: ""
+ }
+ ]
+ }
+
+ function test_imageSource(row) {
+ var expectError = (row.error.length != 0)
+ var canconnect = false;
+
+ if (expectError) {
+ var parentUrl = Qt.resolvedUrl(".")
+ ignoreWarning(row.error.replace(/SUB/g, parentUrl))
+ }
+
+ var img = Qt.createQmlObject('import QtQuick 2.0; AnimatedImage { source: "'+row.source+'" }', top)
+
+ if (row.remote) {
+ skip("Remote solution not yet complete")
+ tryCompare(img, "status", AnimatedImage.Loading)
+ tryCompare(top, "checkfinished", true, 10000)
+ if (top.canconnect == false)
+ skip("Cannot access remote")
+ }
+
+ if (!expectError) {
+ tryCompare(img, "status", AnimatedImage.Ready, 10000)
+ compare(img.width, 160)
+ compare(img.height, 120)
+ compare(img.fillMode, AnimatedImage.Stretch)
+ } else {
+ tryCompare(img, "status", AnimatedImage.Error)
+ }
+
+ img.destroy()
+ }
+
+ function test_clearSource() {
+ compare(clearSource.source, Qt.resolvedUrl(srcImage))
+ compare(clearSource.width, 160)
+ compare(clearSource.height, 120)
+
+ srcImage = ""
+ compare(clearSource.source, "")
+ compare(clearSource.width, 0)
+ compare(clearSource.height, 0)
+ }
+
+ function test_resized() {
+ compare(resized.width, 300)
+ compare(resized.height, 300)
+ compare(resized.fillMode, AnimatedImage.Stretch)
+ }
+
+ function test_smooth() {
+ compare(smooth.smooth, true)
+ compare(smooth.width, 300)
+ compare(smooth.height, 300)
+ compare(smooth.fillMode, AnimatedImage.Stretch)
+ }
+
+ function test_tileModes() {
+ compare(tileModes1.width, 100)
+ compare(tileModes1.height, 300)
+ compare(tileModes1.fillMode, AnimatedImage.Tile)
+
+ compare(tileModes2.width, 300)
+ compare(tileModes2.height, 150)
+ compare(tileModes2.fillMode, AnimatedImage.TileVertically)
+
+ compare(tileModes3.width, 300)
+ compare(tileModes3.height, 150)
+ compare(tileModes3.fillMode, AnimatedImage.TileHorizontally)
+ }
+
+ }
+}
diff --git a/tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml b/tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml
new file mode 100644
index 0000000000..6d4b17f83e
--- /dev/null
+++ b/tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ Rectangle {
+ id: rect
+
+ property bool finished: false
+
+ Behavior on opacity {
+ NumberAnimation {
+ onRunningChanged: {
+ if (!running) {
+ if (rect.opacity <= 0.1)
+ rect.opacity = 1
+ else
+ rect.finished = true
+ }
+ }
+ }
+ }
+ }
+
+ TestCase {
+ name: "AbstractAnitaionJobCrash"
+
+ function test_noCrash() {
+ rect.opacity = 0
+ while (!rect.finished)
+ wait(100)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/borderimage/InvalidSciFile.qml b/tests/auto/qmltest/borderimage/InvalidSciFile.qml
new file mode 100644
index 0000000000..29db34af8b
--- /dev/null
+++ b/tests/auto/qmltest/borderimage/InvalidSciFile.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+BorderImage {
+ source: "invalid.sci"
+ width: 300
+ height: 300
+}
diff --git a/tests/auto/qmltest/borderimage/colors-round.sci b/tests/auto/qmltest/borderimage/colors-round.sci
new file mode 100644
index 0000000000..5d2f49f0e1
--- /dev/null
+++ b/tests/auto/qmltest/borderimage/colors-round.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:colors.png
diff --git a/tests/auto/qmltest/borderimage/colors.png b/tests/auto/qmltest/borderimage/colors.png
new file mode 100644
index 0000000000..dfb62f3d64
--- /dev/null
+++ b/tests/auto/qmltest/borderimage/colors.png
Binary files differ
diff --git a/tests/auto/qmltest/borderimage/invalid.sci b/tests/auto/qmltest/borderimage/invalid.sci
new file mode 100644
index 0000000000..98c72c9bf1
--- /dev/null
+++ b/tests/auto/qmltest/borderimage/invalid.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.down:30
+border.up:40
+horizontalTileRule:Roun
+verticalTileRule:Repea
+source:colors.png
diff --git a/tests/auto/qmltest/borderimage/remote.sci b/tests/auto/qmltest/borderimage/remote.sci
new file mode 100644
index 0000000000..70d5213453
--- /dev/null
+++ b/tests/auto/qmltest/borderimage/remote.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:http://127.0.0.1:14445/colors.png
diff --git a/tests/auto/qmltest/borderimage/tst_borderimage.qml b/tests/auto/qmltest/borderimage/tst_borderimage.qml
new file mode 100644
index 0000000000..880832e8d4
--- /dev/null
+++ b/tests/auto/qmltest/borderimage/tst_borderimage.qml
@@ -0,0 +1,285 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+ property bool canconnect
+ property bool checkfinished: false
+
+ Component.onCompleted: {
+ var check = new XMLHttpRequest;
+ check.open("GET", "http://127.0.0.1:14445/colors.png");
+ check.onreadystatechange = function() {
+ if (check.readyState == XMLHttpRequest.DONE) {
+ if (check.status == 404) {
+ top.canconnect = false;
+ }else{
+ top.canconnect = true;
+ }
+ top.checkfinished = true;
+ }
+ }
+ check.send();
+ }
+
+ BorderImage {
+ id: noSource
+ source: ""
+ }
+
+ property string srcImage: "colors.png"
+
+ BorderImage {
+ id: clearSource
+ source: srcImage
+ }
+
+ BorderImage {
+ id: resized
+ source: srcImage
+ width: 300
+ height: 300
+ }
+
+ BorderImage {
+ id: smooth
+ source: srcImage
+ smooth: true
+ width: 300
+ height: 300
+ }
+
+ BorderImage {
+ id: tileModes1
+ source: srcImage
+ width: 100
+ height: 300
+ horizontalTileMode: BorderImage.Repeat
+ verticalTileMode: BorderImage.Repeat
+ }
+
+ BorderImage {
+ id: tileModes2
+ source: srcImage
+ width: 300
+ height: 150
+ horizontalTileMode: BorderImage.Round
+ verticalTileMode: BorderImage.Round
+ }
+
+ TestCase {
+ name: "BorderImage"
+
+ function test_noSource() {
+ compare(noSource.source, "")
+ compare(noSource.width, 0)
+ compare(noSource.height, 0)
+ compare(noSource.horizontalTileMode, BorderImage.Stretch)
+ compare(noSource.verticalTileMode, BorderImage.Stretch)
+ }
+
+ function test_imageSource_data() {
+ return [
+ {
+ tag: "local",
+ source: "colors.png",
+ remote: false,
+ error: ""
+ },
+ {
+ tag: "local not found",
+ source: "no-such-file.png",
+ remote: false,
+ error: "SUBinline:1:21: QML BorderImage: Cannot open: SUBno-such-file.png"
+ },
+ {
+ tag: "remote",
+ source: "http://127.0.0.1:14445/colors.png",
+ remote: true,
+ error: ""
+ }
+ ]
+ }
+
+ function test_imageSource(row) {
+ var expectError = (row.error.length != 0)
+ if (expectError) {
+ var parentUrl = Qt.resolvedUrl(".")
+ ignoreWarning(row.error.replace(/SUB/g, parentUrl))
+ }
+
+ var img = Qt.createQmlObject
+ ('import QtQuick 2.0; BorderImage { source: "' +
+ row.source + '" }', top)
+
+ if (row.remote) {
+ skip("Remote solution not yet complete")
+ tryCompare(img, "status", BorderImage.Loading)
+ tryCompare(top, "checkfinished", true, 10000)
+ if (top.canconnect == false)
+ skip("Cannot access remote")
+ }
+
+ if (!expectError) {
+ tryCompare(img, "status", BorderImage.Ready, 10000)
+ compare(img.width, 120)
+ compare(img.height, 120)
+ compare(img.horizontalTileMode, BorderImage.Stretch)
+ compare(img.verticalTileMode, BorderImage.Stretch)
+ } else {
+ tryCompare(img, "status", BorderImage.Error)
+ }
+
+ img.destroy()
+ }
+
+ function test_clearSource() {
+ compare(clearSource.source, Qt.resolvedUrl("colors.png"))
+ compare(clearSource.width, 120)
+ compare(clearSource.height, 120)
+
+ srcImage = ""
+ compare(clearSource.source, "")
+ compare(clearSource.width, 0)
+ compare(clearSource.height, 0)
+ }
+
+ function test_resized() {
+ compare(resized.width, 300)
+ compare(resized.height, 300)
+ compare(resized.horizontalTileMode, BorderImage.Stretch)
+ compare(resized.verticalTileMode, BorderImage.Stretch)
+ }
+
+ function test_smooth() {
+ compare(smooth.smooth, true)
+ compare(smooth.width, 300)
+ compare(smooth.height, 300)
+ compare(smooth.horizontalTileMode, BorderImage.Stretch)
+ compare(smooth.verticalTileMode, BorderImage.Stretch)
+ }
+
+ function test_tileModes() {
+ compare(tileModes1.width, 100)
+ compare(tileModes1.height, 300)
+ compare(tileModes1.horizontalTileMode, BorderImage.Repeat)
+ compare(tileModes1.verticalTileMode, BorderImage.Repeat)
+
+ compare(tileModes2.width, 300)
+ compare(tileModes2.height, 150)
+ compare(tileModes2.horizontalTileMode, BorderImage.Round)
+ compare(tileModes2.verticalTileMode, BorderImage.Round)
+ }
+
+ function test_sciSource_data() {
+ return [
+ {
+ tag: "local",
+ source: "colors-round.sci",
+ remote: false,
+ valid: true
+ },
+ {
+ tag: "local not found",
+ source: "no-such-file.sci",
+ remote: false,
+ valid: false
+ },
+ {
+ tag: "remote",
+ source: "remote.sci",
+ remote: true,
+ valid: true
+ }
+ ]
+ }
+
+ function test_sciSource(row) {
+ var img = Qt.createQmlObject('import QtQuick 2.0; BorderImage { height: 300; width: 300 }', top)
+
+ if (row.remote) {
+ skip("Remote solution not yet complete")
+ img.source = row.source;
+ tryCompare(top, "checkfinished", true, 10000)
+ if (top.canconnect == false)
+ skip("Cannot access remote")
+ }else{
+ img.source = row.source;
+ }
+
+ compare(img.source, Qt.resolvedUrl(row.source))
+ compare(img.width, 300)
+ compare(img.height, 300)
+
+ if (row.valid) {
+ tryCompare(img, "status", BorderImage.Ready, 10000)
+ compare(img.border.left, 10)
+ compare(img.border.top, 20)
+ compare(img.border.right, 30)
+ compare(img.border.bottom, 40)
+ compare(img.horizontalTileMode, BorderImage.Round)
+ compare(img.verticalTileMode, BorderImage.Repeat)
+ } else {
+ tryCompare(img, "status", BorderImage.Error)
+ }
+
+ img.destroy()
+ }
+
+
+ function test_invalidSciFile() {
+ ignoreWarning("QQuickGridScaledImage: Invalid tile rule specified. Using Stretch.") // for "Roun"
+ ignoreWarning("QQuickGridScaledImage: Invalid tile rule specified. Using Stretch.") // for "Repea"
+
+ var component = Qt.createComponent("InvalidSciFile.qml")
+ var invalidSciFile = component.createObject(top)
+
+ compare(invalidSciFile.status, Image.Error)
+ compare(invalidSciFile.width, 300)
+ compare(invalidSciFile.height, 300)
+ compare(invalidSciFile.horizontalTileMode, BorderImage.Stretch)
+ compare(invalidSciFile.verticalTileMode, BorderImage.Stretch)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/buttonclick/Button.qml b/tests/auto/qmltest/buttonclick/Button.qml
new file mode 100644
index 0000000000..78954f2fef
--- /dev/null
+++ b/tests/auto/qmltest/buttonclick/Button.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+
+ signal clicked(int x, int y)
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 5
+ border { width: 1; color: "black" }
+ smooth: true
+ radius: 8
+
+ // color the button with a gradient
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "blue" }
+ GradientStop { position: 1.0; color: "lightblue" }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: container.clicked(mouse.x, mouse.y);
+ }
+
+ Text {
+ id: buttonLabel
+ anchors.centerIn: container
+ color: "white"
+ text: container.text
+ }
+}
diff --git a/tests/auto/qmltest/buttonclick/tst_buttonclick.qml b/tests/auto/qmltest/buttonclick/tst_buttonclick.qml
new file mode 100644
index 0000000000..506d22602f
--- /dev/null
+++ b/tests/auto/qmltest/buttonclick/tst_buttonclick.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Button {
+ id: button
+ onClicked: text = "Clicked"
+
+ SignalSpy {
+ id: spy
+ target: button
+ signalName: "clicked"
+ }
+
+ TestCase {
+ name: "ButtonClick"
+ when: windowShown
+
+ function test_click() {
+
+ compare(spy.count, 0)
+ button.clicked(1, 2);
+ compare(button.text, "Clicked");
+
+ compare(spy.count, 1)
+ compare(spy.signalArguments.length, 1)
+ compare(spy.signalArguments[0][0], 1)
+ compare(spy.signalArguments[0][1], 2)
+ verify(spy.valid)
+ spy.clear()
+ compare(spy.count, 0)
+ verify(spy.valid)
+ compare(spy.signalArguments.length, 0)
+ spy.signalName = ""
+ verify(!spy.valid)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/createbenchmark/item.qml b/tests/auto/qmltest/createbenchmark/item.qml
new file mode 100644
index 0000000000..3bb77f2dce
--- /dev/null
+++ b/tests/auto/qmltest/createbenchmark/item.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+}
diff --git a/tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml b/tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml
new file mode 100644
index 0000000000..fe7a70687a
--- /dev/null
+++ b/tests/auto/qmltest/createbenchmark/tst_createbenchmark.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+TestCase {
+ id: top
+ name: "CreateBenchmark"
+
+ function benchmark_create_component() {
+ var component = Qt.createComponent("item.qml")
+ var obj = component.createObject(top)
+ //obj.destroy(100)
+ component.destroy()
+ }
+}
diff --git a/tests/auto/qmltest/events/tst_drag.qml b/tests/auto/qmltest/events/tst_drag.qml
new file mode 100644
index 0000000000..7db1e1e1b2
--- /dev/null
+++ b/tests/auto/qmltest/events/tst_drag.qml
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle{
+ id: root
+ width:200
+ height:200
+
+ TestUtil {
+ id: util
+ }
+
+ SignalSpy {
+ id: spyX
+ target: container2
+ signalName: "posXChanged"
+ }
+ SignalSpy {
+ id: spyY
+ target: container2
+ signalName: "posYChanged"
+ }
+
+ Rectangle {
+ id:container
+ width:20
+ height:20
+ color: "blue"
+ MouseArea {
+ id:mouseArea; anchors.fill : parent
+ drag.maximumX: 180
+ drag.maximumY: 180
+ drag.minimumX: 0
+ drag.minimumY: 0
+ drag.target: parent
+ }
+ }
+
+ Rectangle {
+ id: container2
+ x: 25
+ y: 25
+ width:100
+ height:100
+ color: "red"
+ property bool updatePositionWhileDragging: false
+ property var posX: 0
+ property var posY: 0
+
+ function reset() {
+ fakeHandle.x = 0
+ fakeHandle.y = 0
+ spyX.clear()
+ spyY.clear()
+ }
+
+ Binding {
+ when: container2.updatePositionWhileDragging
+ target: container2
+ property: "posX"
+ value: fakeHandle.x
+ }
+
+ Binding {
+ when: container2.updatePositionWhileDragging
+ target: container2
+ property: "posY"
+ value: fakeHandle.y
+ }
+
+ Item { id: fakeHandle }
+
+ MouseArea {
+ anchors.fill : container2
+ drag.maximumX: 180
+ drag.maximumY: 180
+ drag.minimumX: 0
+ drag.minimumY: 0
+ drag.target: fakeHandle
+
+ onReleased: if (!container2.updatePositionWhileDragging) {
+ container2.posX = mouse.x;
+ container2.posY = mouse.y
+ }
+ }
+ }
+
+ TestCase {
+ name:"mouserelease"
+ when:windowShown
+ function test_mouseDrag() {
+ mouseDrag(container, 10, 10, 20, 30);
+ compare(container.x, 20 - util.dragThreshold - 1);
+ compare(container.y, 30 - util.dragThreshold - 1);
+ }
+
+ function test_doSomethingWhileDragging() {
+ container2.updatePositionWhileDragging = false
+ // dx and dy are superior to 3 times util.dragThreshold.
+ // but here the dragging does not update posX and posY
+ // posX and posY are only updated on mouseRelease
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 10*util.dragThreshold, 10*util.dragThreshold);
+ compare(spyX.count, 1)
+ compare(spyY.count, 1)
+
+ container2.updatePositionWhileDragging = true
+ // dx and dy are superior to 3 times util.dragThreshold.
+ // 3 intermediate mouseMove when dragging
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 10*util.dragThreshold, 10*util.dragThreshold);
+ compare(spyX.count, 3)
+ compare(spyY.count, 3)
+
+ // dx and dy are inferior to 3 times util.dragThreshold.
+ // No intermediate mouseMove when dragging, only one mouseMove
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 2*util.dragThreshold, 2*util.dragThreshold);
+ compare(spyX.count, 1)
+ compare(spyY.count, 1)
+
+ // dx is superior to 3 times util.dragThreshold.
+ // 3 intermediate mouseMove when dragging on x axis
+ // no move on the y axis
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 10*util.dragThreshold, 0);
+ compare(spyX.count, 3)
+ compare(spyY.count, 0)
+
+ // dy is inferior to 3 times util.dragThreshold.
+ // No intermediate mouseMove when dragging, only one mouseMove on y axis
+ // no move on the x axis
+ container2.reset()
+ mouseDrag(container2, container2.x + 10, container2.y + 10, 0, 2*util.dragThreshold);
+ compare(spyX.count, 0)
+ compare(spyY.count, 1)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/events/tst_events.qml b/tests/auto/qmltest/events/tst_events.qml
new file mode 100644
index 0000000000..d96431f389
--- /dev/null
+++ b/tests/auto/qmltest/events/tst_events.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ width: 50; height: 50
+ id: top
+ focus: true
+
+ property bool leftKeyPressed: false
+ property bool leftKeyReleased: false
+
+ Keys.onLeftPressed: {
+ leftKeyPressed = true
+ }
+
+ Keys.onReleased: {
+ if (event.key == Qt.Key_Left)
+ leftKeyReleased = true
+ }
+
+ property bool mouseHasBeenClicked: false
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ mouseHasBeenClicked = true
+ }
+ }
+
+ TestCase {
+ name: "Events"
+ when: windowShown // Must have this line for events to work.
+
+ function test_key_click() {
+ skip("test_key_click() is unstable, QTBUG-27671")
+ keyClick(Qt.Key_Left)
+ tryCompare(top, "leftKeyPressed", true, 10000)
+ tryCompare(top, "leftKeyReleased", true, 10000)
+ }
+
+ function test_mouse_click() {
+ mouseClick(top, 25, 30)
+ tryCompare(top, "mouseHasBeenClicked", true, 10000)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/events/tst_wheel.qml b/tests/auto/qmltest/events/tst_wheel.qml
new file mode 100644
index 0000000000..28767750c3
--- /dev/null
+++ b/tests/auto/qmltest/events/tst_wheel.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:top
+ width: 400
+ height: 400
+ color: "gray"
+
+ Flickable {
+ id: flick
+ objectName: "flick"
+ anchors.fill: parent
+ contentWidth: 800
+ contentHeight: 800
+
+ Rectangle {
+ width: flick.contentWidth
+ height: flick.contentHeight
+ color: "red"
+ Rectangle {
+ width: 50; height: 50; color: "blue"
+ anchors.centerIn: parent
+ }
+ }
+ }
+ TestCase {
+ name: "WheelEvents"
+ when: windowShown // Must have this line for events to work.
+
+ function test_wheel() {
+ //mouseWheel(item, x, y, xDelta, yDelta, buttons = Qt.NoButton, modifiers = Qt.NoModifier, delay = -1)
+ mouseWheel(flick, 200, 200, 0, -120, Qt.NoButton, Qt.NoModifier, -1);
+ wait(1000);
+ verify(flick.contentY > 0);
+ verify(flick.contentX == 0);
+ flick.contentY = 0;
+ verify(flick.contentY == 0);
+ mouseWheel(flick, 200, 200, -120, 0, Qt.NoButton, Qt.NoModifier, -1);
+ wait(1000);
+ verify(flick.contentX > 0);
+ verify(flick.contentY == 0);
+ }
+
+ }
+
+}
diff --git a/tests/auto/qmltest/fontloader/dummy.ttf b/tests/auto/qmltest/fontloader/dummy.ttf
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qmltest/fontloader/dummy.ttf
diff --git a/tests/auto/qmltest/fontloader/tarzeau_ocr_a.ttf b/tests/auto/qmltest/fontloader/tarzeau_ocr_a.ttf
new file mode 100644
index 0000000000..cf93f9651f
--- /dev/null
+++ b/tests/auto/qmltest/fontloader/tarzeau_ocr_a.ttf
Binary files differ
diff --git a/tests/auto/qmltest/fontloader/tst_fontloader.qml b/tests/auto/qmltest/fontloader/tst_fontloader.qml
new file mode 100644
index 0000000000..4d79a170f3
--- /dev/null
+++ b/tests/auto/qmltest/fontloader/tst_fontloader.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ FontLoader {
+ id: fontloader
+ }
+
+ FontLoader {
+ id: fontswitch
+ }
+
+ TextInput {
+ id: testinput
+ font.family: fontloader.name
+ }
+
+
+
+ TestCase {
+ name: "FontLoader"
+
+ function test_fontloading() {
+ compare(fontloader.status, FontLoader.Null)
+ compare(testinput.font.family, "")
+ fontloader.source = "tarzeau_ocr_a.ttf";
+ tryCompare(fontloader.status, FontLoader.Loading)
+ tryCompare(fontloader.status, FontLoader.Ready)
+ compare(testinput.font.family, "OCRA")
+ fontloader.source = "dummy.ttf";
+ tryCompare(fontloader.status, FontLoader.Error)
+ compare(testinput.font.family, "")
+ fontloader.source = "";
+ fontloader.name = "Courier";
+ tryCompare(fontloader.status, FontLoader.Ready)
+ compare(testinput.font.family, "Courier")
+ }
+
+ function test_fontswitching() {
+ compare(fontswitch.status, FontLoader.Null)
+ fontswitch.source = "tarzeau_ocr_a.ttf";
+ tryCompare(fontswitch.status, FontLoader.Loading)
+ tryCompare(fontswitch.status, FontLoader.Ready)
+ tryCompare(fontswitch.name, "OCRA")
+ fontswitch.source = "";
+ fontswitch.name = "Courier";
+ tryCompare(fontswitch.status, FontLoader.Ready)
+ tryCompare(fontswitch.name, "Courier")
+ fontswitch.source = "tarzeau_ocr_a.ttf";
+ tryCompare(fontswitch.status, FontLoader.Loading)
+ tryCompare(fontswitch.status, FontLoader.Ready)
+ compare(fontswitch.name, "OCRA")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/gradient/tst_gradient.qml b/tests/auto/qmltest/gradient/tst_gradient.qml
new file mode 100644
index 0000000000..c25ac19e84
--- /dev/null
+++ b/tests/auto/qmltest/gradient/tst_gradient.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ Gradient {
+ id: emptygradient
+ }
+
+ Gradient {
+ id: twogradients
+ GradientStop { position: 0.0; color: "red" }
+ GradientStop { position: 1.0; color: "green" }
+ }
+
+ Gradient {
+ id: elevengradients
+ GradientStop { position: 0.0; color: "red" }
+ GradientStop { position: 0.1; color: "orange" }
+ GradientStop { position: 0.2; color: "yellow" }
+ GradientStop { position: 0.3; color: "green" }
+ GradientStop { position: 0.4; color: "blue" }
+ GradientStop { position: 0.5; color: "violet" }
+ GradientStop { position: 0.6; color: "indigo" }
+ GradientStop { position: 0.7; color: "brown" }
+ GradientStop { position: 0.8; color: "lightgray" }
+ GradientStop { position: 0.9; color: "gray" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ Gradient {
+ id: movedgradients
+ property real stopposition: 0.5
+ GradientStop { position: 0.0; color: "red" }
+ GradientStop { position: movedgradients.stopposition; color: "blue" }
+ GradientStop { position: 1.0; color: "green" }
+ }
+
+ Gradient {
+ id: defaultgradient
+ GradientStop { }
+ GradientStop { position: 1.0; color: "red" }
+ }
+
+ TestCase {
+ name: "Gradient"
+
+ function test_empty() {
+ compare(emptygradient.stops.length, 0)
+ }
+
+ function test_lengthtwo() {
+ compare(twogradients.stops.length, 2)
+ compare(twogradients.stops[0].color.toString(), "#ff0000")
+ compare(twogradients.stops[1].color.toString(), "#008000")
+ }
+
+ function test_multiplestops() {
+ compare(elevengradients.stops.length, 11)
+ compare(elevengradients.stops[0].color.toString(), "#ff0000")
+ compare(elevengradients.stops[4].color.toString(), "#0000ff")
+ compare(elevengradients.stops[4].position, 0.4)
+ compare(elevengradients.stops[9].position, 0.9)
+ }
+
+ function test_moved() {
+ compare(movedgradients.stops.length, 3)
+ compare(movedgradients.stops[1].position, 0.5)
+ movedgradients.stopposition = 0.3;
+ compare(movedgradients.stops[1].position, 0.3)
+ }
+
+ function test_default() {
+ compare(defaultgradient.stops.length, 2)
+ compare(defaultgradient.stops[0].color.toString(), "#000000")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/image/logo.png b/tests/auto/qmltest/image/logo.png
new file mode 100644
index 0000000000..d75936b007
--- /dev/null
+++ b/tests/auto/qmltest/image/logo.png
Binary files differ
diff --git a/tests/auto/qmltest/image/tst_image.qml b/tests/auto/qmltest/image/tst_image.qml
new file mode 100644
index 0000000000..1afa5f8274
--- /dev/null
+++ b/tests/auto/qmltest/image/tst_image.qml
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ property string srcImage: "logo.png"
+ property bool canconnect
+ property bool checkfinished: false
+
+ Component.onCompleted: {
+ var check = new XMLHttpRequest;
+ check.open("GET", "http://127.0.0.1:14445/logo.png");
+ check.onreadystatechange = function() {
+ if (check.readyState == XMLHttpRequest.DONE) {
+ if (check.status == 404) {
+ top.canconnect = false;
+ } else {
+ top.canconnect = true;
+ }
+ top.checkfinished = true;
+ }
+ }
+ check.send();
+ }
+
+ Image {
+ id: noSource
+ source: ""
+ }
+
+ Image {
+ id: clearSource
+ source: srcImage
+ }
+
+ Image {
+ id: resized
+ source: srcImage
+ width: 300
+ height: 300
+ }
+
+ Image {
+ id: smooth
+ source: srcImage
+ smooth: true
+ width: 300
+ height: 300
+ }
+
+ Image {
+ id: tileModes1
+ source: srcImage
+ width: 100
+ height: 300
+ fillMode: Image.Tile
+ }
+
+ Image {
+ id: tileModes2
+ source: srcImage
+ width: 300
+ height: 150
+ fillMode: Image.TileVertically
+ }
+ Image {
+ id: tileModes3
+ source: srcImage
+ width: 300
+ height: 150
+ fillMode: Image.TileHorizontally
+ }
+
+ TestCase {
+ name: "Image"
+
+ function test_noSource() {
+ compare(noSource.source, "")
+ compare(noSource.width, 0)
+ compare(noSource.height, 0)
+ compare(noSource.fillMode, Image.Stretch)
+ }
+
+ function test_imageSource_data() {
+ return [
+ {
+ tag: "local",
+ source: "logo.png",
+ remote: false,
+ error: ""
+ },
+ {
+ tag: "local not found",
+ source: "no-such-file.png",
+ remote: false,
+ error: "SUBinline:1:21: QML Image: Cannot open: SUBno-such-file.png"
+ },
+ {
+ tag: "remote",
+ source: "http://127.0.0.1:14445/logo.png",
+ remote: true,
+ error: ""
+ }
+ ]
+ }
+
+ function test_imageSource(row) {
+ var expectError = (row.error.length != 0)
+ if (expectError) {
+ var parentUrl = Qt.resolvedUrl(".")
+ ignoreWarning(row.error.replace(/SUB/g, parentUrl))
+ }
+
+ var img = Qt.createQmlObject('import QtQuick 2.0; Image { source: "'+row.source+'" }', top)
+
+ if (row.remote) {
+ skip("Remote solution not yet complete")
+ tryCompare(img, "status", Image.Loading)
+ tryCompare(top, "checkfinished", true, 10000)
+ if (top.canconnect == false)
+ skip("Cannot access remote")
+ }
+
+ if (!expectError) {
+ tryCompare(img, "status", Image.Ready, 10000)
+ compare(img.width, 59)
+ compare(img.height, 71)
+ compare(img.fillMode, Image.Stretch)
+ } else {
+ tryCompare(img, "status", Image.Error)
+ }
+
+ img.destroy()
+ }
+
+ function test_clearSource() {
+ compare(clearSource.source, Qt.resolvedUrl(srcImage))
+ compare(clearSource.width, 59)
+ compare(clearSource.height, 71)
+
+ srcImage = ""
+ compare(clearSource.source, "")
+ compare(clearSource.width, 0)
+ compare(clearSource.height, 0)
+ }
+
+ function test_resized() {
+ compare(resized.width, 300)
+ compare(resized.height, 300)
+ compare(resized.fillMode, Image.Stretch)
+ }
+
+ function test_smooth() {
+ compare(smooth.smooth, true)
+ compare(smooth.width, 300)
+ compare(smooth.height, 300)
+ compare(smooth.fillMode, Image.Stretch)
+ }
+
+ function test_tileModes() {
+ compare(tileModes1.width, 100)
+ compare(tileModes1.height, 300)
+ compare(tileModes1.fillMode, Image.Tile)
+
+ compare(tileModes2.width, 300)
+ compare(tileModes2.height, 150)
+ compare(tileModes2.fillMode, Image.TileVertically)
+
+ compare(tileModes3.width, 300)
+ compare(tileModes3.height, 150)
+ compare(tileModes3.fillMode, Image.TileHorizontally)
+ }
+
+ }
+}
diff --git a/tests/auto/qmltest/listmodel/tst_listmodel.qml b/tests/auto/qmltest/listmodel/tst_listmodel.qml
new file mode 100644
index 0000000000..a975691462
--- /dev/null
+++ b/tests/auto/qmltest/listmodel/tst_listmodel.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+ ListModel { id: emptymodel }
+ ListModel { id: manyitems }
+ ListModel { id: insertmodel }
+ ListModel { id: move; ListElement { name: "Element0" } ListElement { name: "Element1" } }
+ ListModel { id: firstmodel; ListElement { name: "FirstModelElement0" } }
+ ListModel { id: secondmodel; ListElement { name: "SecondModelElement0" } ListElement { name: "SecondModelElement1" } }
+ ListModel { id: altermodel; ListElement { name: "AlterModelElement0" } ListElement { name: "AlterModelElement1" } }
+
+ TestCase {
+ name: "ListModel"
+
+ function test_empty() {
+ compare(emptymodel.count, 0)
+ emptymodel.clear();
+ compare(emptymodel.count, 0)
+ }
+
+ function test_multipleitems_data() {
+ return [
+ {
+ tag: "10items",
+ numitems: 10
+ },
+ {
+ tag: "100items",
+ numitems: 100
+ },
+ {
+ tag: "10000items",
+ numitems: 10000
+ }
+ ]
+ }
+
+ function test_multipleitems(row) {
+ var i;
+ manyitems.clear();
+ compare(manyitems.count, 0)
+ for (i = 0; i < row.numitems; ++i) {
+ manyitems.append({"name":"Item"+i})
+ }
+ compare(manyitems.count, row.numitems)
+ }
+
+ function test_insert() {
+ insertmodel.insert(0, {"name": "Element0"})
+ compare(insertmodel.get(0).name, "Element0")
+ insertmodel.insert(1, {"name": "Element1"})
+ compare(insertmodel.get(1).name, "Element1")
+ }
+
+ function test_altermodeled() {
+ tryCompare(altermodel.count, 2)
+ compare(altermodel.get(0).name, "AlterModelElement0")
+ compare(altermodel.get(1).name, "AlterModelElement1")
+ altermodel.append({"name":"AlterModelElement2"})
+ tryCompare(altermodel.count, 3)
+ compare(altermodel.get(0).name, "AlterModelElement0")
+ compare(altermodel.get(1).name, "AlterModelElement1")
+ compare(altermodel.get(2).name, "AlterModelElement2")
+ altermodel.insert(2,{"name":"AlterModelElement1.5"})
+ tryCompare(altermodel.count, 4)
+ compare(altermodel.get(0).name, "AlterModelElement0")
+ compare(altermodel.get(1).name, "AlterModelElement1")
+ compare(altermodel.get(2).name, "AlterModelElement1.5")
+ compare(altermodel.get(3).name, "AlterModelElement2")
+ tryCompare(altermodel.count, 4)
+ altermodel.move(2,1,1);
+ compare(altermodel.get(0).name, "AlterModelElement0")
+ compare(altermodel.get(1).name, "AlterModelElement1.5")
+ compare(altermodel.get(2).name, "AlterModelElement1")
+ compare(altermodel.get(3).name, "AlterModelElement2")
+ altermodel.remove(1,2)
+ tryCompare(altermodel.count, 2)
+ compare(altermodel.get(0).name, "AlterModelElement0")
+ compare(altermodel.get(1).name, "AlterModelElement2")
+ altermodel.set(1,{"name":"AlterModelElement1"})
+ compare(altermodel.get(0).name, "AlterModelElement0")
+ compare(altermodel.get(1).name, "AlterModelElement1")
+ altermodel.setProperty(0, "name", "AlteredProperty")
+ compare(altermodel.get(0).name, "AlteredProperty")
+ altermodel.clear()
+ tryCompare(altermodel.count, 0)
+ compare(altermodel.get(0), undefined)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/listview/tst_listview.qml b/tests/auto/qmltest/listview/tst_listview.qml
new file mode 100644
index 0000000000..cbace624c3
--- /dev/null
+++ b/tests/auto/qmltest/listview/tst_listview.qml
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ ListView {
+ id: emptylist
+ height: 20
+ width: 50
+ }
+
+ ListView {
+ id: viewmanyitems
+ model: manyitems
+ }
+
+ ListView {
+ id: modelchange
+ model: firstmodel
+ delegate: Text { text: model.name }
+ }
+
+ ListView {
+ id: modelalter
+ model: altermodel
+ delegate: Text { text: model.name }
+ }
+
+ ListModel { id: emptymodel }
+ ListModel { id: manyitems }
+ ListModel { id: firstmodel; ListElement { name: "FirstModelElement0" } }
+ ListModel { id: secondmodel; ListElement { name: "SecondModelElement0" } ListElement { name: "SecondModelElement1" } }
+ ListModel { id: altermodel; ListElement { name: "AlterModelElement0" } ListElement { name: "AlterModelElement1" } }
+
+ TestCase {
+ name: "ListView"
+
+ function test_empty() {
+ compare(emptylist.count, 0)
+ emptylist.model = emptymodel;
+ compare(emptylist.count, 0)
+ }
+
+ function test_multipleitems_data() {
+ return [
+ {
+ tag: "10items",
+ numitems: 10
+ },
+ {
+ tag: "100items",
+ numitems: 100
+ },
+ {
+ tag: "10000items",
+ numitems: 10000
+ }
+ ]
+ }
+
+ function test_multipleitems(row) {
+ var i;
+ manyitems.clear();
+ compare(manyitems.count, 0)
+ for (i = 0; i < row.numitems; ++i) {
+ manyitems.append({"name":"Item"+i})
+ }
+ compare(manyitems.count, row.numitems)
+ tryCompare(viewmanyitems.count, row.numitems)
+ }
+
+ function test_modelchange() {
+ tryCompare(modelchange.count, 1)
+ modelchange.currentIndex = 0;
+ compare(modelchange.currentItem.text, "FirstModelElement0")
+ modelchange.model = secondmodel;
+ tryCompare(modelchange.count, 2)
+ modelchange.currentIndex = 0;
+ compare(modelchange.currentItem.text, "SecondModelElement0")
+ modelchange.currentIndex = 1;
+ compare(modelchange.currentItem.text, "SecondModelElement1")
+ }
+
+ function test_modelaltered() {
+ tryCompare(modelalter.count, 2)
+ modelalter.currentIndex = 0;
+ compare(modelalter.currentItem.text, "AlterModelElement0")
+ modelalter.currentIndex = 1;
+ compare(modelalter.currentItem.text, "AlterModelElement1")
+ altermodel.append({"name":"AlterModelElement2"})
+ tryCompare(modelalter.count, 3)
+ modelalter.currentIndex = 0;
+ compare(modelalter.currentItem.text, "AlterModelElement0")
+ modelalter.currentIndex = 1;
+ compare(modelalter.currentItem.text, "AlterModelElement1")
+ modelalter.currentIndex = 2;
+ compare(modelalter.currentItem.text, "AlterModelElement2")
+ altermodel.insert(2,{"name":"AlterModelElement1.5"})
+ tryCompare(modelalter.count, 4)
+ modelalter.currentIndex = 0;
+ compare(modelalter.currentItem.text, "AlterModelElement0")
+ modelalter.currentIndex = 1;
+ compare(modelalter.currentItem.text, "AlterModelElement1")
+ modelalter.currentIndex = 2;
+ compare(modelalter.currentItem.text, "AlterModelElement1.5")
+ modelalter.currentIndex = 3;
+ compare(modelalter.currentItem.text, "AlterModelElement2")
+ altermodel.move(2,1,1);
+ tryCompare(modelalter.count, 4)
+ modelalter.currentIndex = 0;
+ compare(modelalter.currentItem.text, "AlterModelElement0")
+ modelalter.currentIndex = 1;
+ compare(modelalter.currentItem.text, "AlterModelElement1.5")
+ modelalter.currentIndex = 2;
+ compare(modelalter.currentItem.text, "AlterModelElement1")
+ modelalter.currentIndex = 3;
+ compare(modelalter.currentItem.text, "AlterModelElement2")
+ altermodel.remove(1,2)
+ tryCompare(modelalter.count, 2)
+ modelalter.currentIndex = 0;
+ compare(modelalter.currentItem.text, "AlterModelElement0")
+ modelalter.currentIndex = 1;
+ compare(modelalter.currentItem.text, "AlterModelElement2")
+ altermodel.set(1,{"name":"AlterModelElement1"})
+ modelalter.currentIndex = 0;
+ compare(modelalter.currentItem.text, "AlterModelElement0")
+ modelalter.currentIndex = 1;
+ compare(modelalter.currentItem.text, "AlterModelElement1")
+ altermodel.clear()
+ tryCompare(modelalter.count, 0)
+ compare(modelalter.currentItem, null)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/pixel/tst_pixel.qml b/tests/auto/qmltest/pixel/tst_pixel.qml
new file mode 100644
index 0000000000..9185ac1441
--- /dev/null
+++ b/tests/auto/qmltest/pixel/tst_pixel.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:rect
+ width: 40
+ height: 40
+ color:"red"
+ TestCase {
+ name: "Pixels"
+ when: windowShown
+
+ function test_pixel() {
+ skip("test_pixel() is unstable, QTBUG-27671")
+ var img = grabImage(rect);
+ compare(img.pixel(20, 20), Qt.rgba(255, 0, 0, 255));
+ compare(img.red(1,1), 255);
+ compare(img.green(1,1), 0);
+ compare(img.blue(1,1), 0);
+ compare(img.alpha(1,1), 255);
+
+ fuzzyCompare(img.red(1,1), 254, 2);
+ fuzzyCompare(img.pixel(1,1), Qt.rgba(254, 0, 0, 254), 2);
+ fuzzyCompare(img.pixel(1,1), "#FF0201", 2);
+
+ rect.color = "blue";
+ waitForRendering(rect);
+ img = grabImage(rect);
+ compare(img.pixel(20, 20), Qt.rgba(0, 0, 255, 255));
+ compare(img.red(1,1), 0);
+ compare(img.green(1,1), 0);
+ compare(img.blue(1,1), 255);
+ compare(img.alpha(1,1), 255);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qmltest/qmltest.pro b/tests/auto/qmltest/qmltest.pro
new file mode 100644
index 0000000000..0a7967654c
--- /dev/null
+++ b/tests/auto/qmltest/qmltest.pro
@@ -0,0 +1,13 @@
+TEMPLATE=app
+TARGET=tst_qmltest
+CONFIG += qmltestcase
+SOURCES += tst_qmltest.cpp
+
+
+importFiles.files = borderimage buttonclick createbenchmark events qqmlbinding selftests
+
+importFiles.path = .
+DEPLOYMENT += importFiles
+
+mac:CONFIG+=insignificant_test # QTBUG-25306
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qmltest/qqmlbinding/tst_binding.qml b/tests/auto/qmltest/qqmlbinding/tst_binding.qml
new file mode 100644
index 0000000000..9a71e6ce35
--- /dev/null
+++ b/tests/auto/qmltest/qqmlbinding/tst_binding.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id: screen
+ width: 320; height: 240
+ property string text
+ property bool changeColor: false
+
+ Text { id: s1; text: "Hello" }
+ Rectangle { id: r1; width: 1; height: 1; color: "yellow" }
+ Rectangle { id: r2; width: 1; height: 1; color: "red" }
+
+ Binding { target: screen; property: "text"; value: s1.text; id: binding1 }
+ Binding { target: screen; property: "color"; value: r1.color }
+ Binding { target: screen; property: "color"; when: screen.changeColor == true; value: r2.color; id: binding3 }
+
+ TestCase {
+ name: "Binding"
+
+ function test_binding() {
+ compare(screen.color, "#ffff00") // Yellow
+ compare(screen.text, "Hello")
+ verify(!binding3.when)
+
+ screen.changeColor = true
+ compare(screen.color, "#ff0000") // Red
+
+ verify(binding1.target == screen)
+ compare(binding1.property, "text")
+ compare(binding1.value, "Hello")
+ }
+ }
+}
diff --git a/tests/auto/qmltest/qqmlbinding/tst_binding2.qml b/tests/auto/qmltest/qqmlbinding/tst_binding2.qml
new file mode 100644
index 0000000000..cd79b1f80d
--- /dev/null
+++ b/tests/auto/qmltest/qqmlbinding/tst_binding2.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id: screen
+ width: 320; height: 240
+ property string text
+ property bool changeColor: false
+
+ Text { id: s1; text: "Hello" }
+ Rectangle { id: r1; width: 1; height: 1; color: "yellow" }
+ Rectangle { id: r2; width: 1; height: 1; color: "red" }
+
+ Binding { target: screen; property: "text"; value: s1.text }
+ Binding { target: screen; property: "color"; value: r1.color }
+ Binding { target: screen; property: "color"; value: r2.color; when: screen.changeColor == true }
+
+ TestCase {
+ name: "Binding2"
+
+ function test_binding2() {
+ compare(screen.color, "#ffff00") // Yellow
+ compare(screen.text, "Hello")
+
+ screen.changeColor = true
+ compare(screen.color, "#ff0000") // Red
+ }
+ }
+}
diff --git a/tests/auto/qmltest/rectangle/tst_rectangle.qml b/tests/auto/qmltest/rectangle/tst_rectangle.qml
new file mode 100644
index 0000000000..caf40cdb26
--- /dev/null
+++ b/tests/auto/qmltest/rectangle/tst_rectangle.qml
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ Rectangle { id: empty }
+
+ Rectangle { id: radius }
+
+ Rectangle {
+ id: resized
+ width: 300
+ height: 300
+ }
+
+ Rectangle {
+ id: smooth
+ smooth: true
+ width: 300
+ height: 300
+ }
+
+ Rectangle {
+ id: gradient
+ width: 100
+ height: 300
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "red" }
+ GradientStop { position: 0.5; color: "yellow" }
+ GradientStop { position: 1.0; color: "green" }
+ }
+ }
+
+ Rectangle {
+ id: rectangleborder
+ width: 300
+ height: 150
+ border.width: 1
+ border.color: "gray"
+ }
+
+ TestCase {
+ name: "Rectangle"
+
+ function test_empty() {
+ compare(empty.width, 0)
+ compare(empty.height, 0)
+ }
+
+ function test_radius() {
+ compare(radius.width, 0)
+ compare(radius.height, 0)
+ compare(radius.radius, 0)
+ radius.height = 100;
+ radius.width = 100;
+ radius.radius = 10;
+ compare(radius.width, 100)
+ compare(radius.height, 100)
+ compare(radius.radius, 10)
+ }
+
+ function test_resized() {
+ compare(resized.width, 300)
+ compare(resized.height, 300)
+ resized.height = 500;
+ resized.width = 500;
+ compare(resized.width, 500)
+ compare(resized.height, 500)
+ }
+
+ function test_smooth() {
+ compare(smooth.smooth, true)
+ compare(smooth.width, 300)
+ compare(smooth.height, 300)
+
+ }
+
+ function test_gradient() {
+ var grad = gradient.gradient;
+ var gstops = grad.stops;
+ compare(gstops[0].color.toString(), "#ff0000")
+ compare(gstops[1].color.toString(), "#ffff00")
+ compare(gstops[2].color.toString(), "#008000")
+ }
+
+ function test_borders() {
+ compare(rectangleborder.border.width, 1)
+ compare(rectangleborder.border.color.toString(), "#808080")
+ rectangleborder.border.width = 10;
+ rectangleborder.border.color = "brown";
+ compare(rectangleborder.border.width, 10)
+ compare(rectangleborder.border.color.toString(), "#a52a2a")
+ }
+
+ }
+}
diff --git a/tests/auto/qmltest/selftests/tst_compare.qml b/tests/auto/qmltest/selftests/tst_compare.qml
new file mode 100644
index 0000000000..788f9b8635
--- /dev/null
+++ b/tests/auto/qmltest/selftests/tst_compare.qml
@@ -0,0 +1,1391 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+TestCase {
+ name: "SelfTests_compare"
+
+ function test_primitives_and_constants() {
+ compare(qtest_compareInternal(null, null), true, "null");
+ compare(qtest_compareInternal(null, {}), false, "null");
+ compare(qtest_compareInternal(null, undefined), false, "null");
+ compare(qtest_compareInternal(null, 0), false, "null");
+ compare(qtest_compareInternal(null, false), false, "null");
+ compare(qtest_compareInternal(null, ''), false, "null");
+ compare(qtest_compareInternal(null, []), false, "null");
+
+ compare(qtest_compareInternal(undefined, undefined), true, "undefined");
+ compare(qtest_compareInternal(undefined, null), false, "undefined");
+ compare(qtest_compareInternal(undefined, 0), false, "undefined");
+ compare(qtest_compareInternal(undefined, false), false, "undefined");
+ compare(qtest_compareInternal(undefined, {}), false, "undefined");
+ compare(qtest_compareInternal(undefined, []), false, "undefined");
+ compare(qtest_compareInternal(undefined, ""), false, "undefined");
+
+ // Nan usually doest not equal to Nan using the '==' operator.
+ // Only isNaN() is able to do it.
+ compare(qtest_compareInternal(0/0, 0/0), true, "NaN"); // NaN VS NaN
+ compare(qtest_compareInternal(1/0, 2/0), true, "Infinity"); // Infinity VS Infinity
+ compare(qtest_compareInternal(-1/0, 2/0), false, "-Infinity, Infinity"); // -Infinity VS Infinity
+ compare(qtest_compareInternal(-1/0, -2/0), true, "-Infinity, -Infinity"); // -Infinity VS -Infinity
+ compare(qtest_compareInternal(0/0, 1/0), false, "NaN, Infinity"); // Nan VS Infinity
+ compare(qtest_compareInternal(1/0, 0/0), false, "NaN, Infinity"); // Nan VS Infinity
+ compare(qtest_compareInternal(0/0, null), false, "NaN");
+ compare(qtest_compareInternal(0/0, undefined), false, "NaN");
+ compare(qtest_compareInternal(0/0, 0), false, "NaN");
+ compare(qtest_compareInternal(0/0, false), false, "NaN");
+ //compare(qtest_compareInternal(0/0, function () {}), false, "NaN"); // Do we really need that?
+ compare(qtest_compareInternal(1/0, null), false, "NaN, Infinity");
+ compare(qtest_compareInternal(1/0, undefined), false, "NaN, Infinity");
+ compare(qtest_compareInternal(1/0, 0), false, "NaN, Infinity");
+ compare(qtest_compareInternal(1/0, 1), false, "NaN, Infinity");
+ compare(qtest_compareInternal(1/0, false), false, "NaN, Infinity");
+ compare(qtest_compareInternal(1/0, true), false, "NaN, Infinity");
+ //compare(qtest_compareInternal(1/0, function () {}), false, "NaN"); // Do we really need that?
+
+ compare(qtest_compareInternal(0, 0), true, "number");
+ compare(qtest_compareInternal(0, 1), false, "number");
+ compare(qtest_compareInternal(1, 0), false, "number");
+ compare(qtest_compareInternal(1, 1), true, "number");
+ compare(qtest_compareInternal(1.1, 1.1), true, "number");
+ compare(qtest_compareInternal(0.0000005, 0.0000005), true, "number");
+ compare(qtest_compareInternal(0, ''), false, "number");
+ compare(qtest_compareInternal(0, '0'), false, "number");
+ compare(qtest_compareInternal(1, '1'), false, "number");
+ compare(qtest_compareInternal(0, false), false, "number");
+ compare(qtest_compareInternal(1, true), false, "number");
+
+ compare(qtest_compareInternal(true, true), true, "boolean");
+ compare(qtest_compareInternal(true, false), false, "boolean");
+ compare(qtest_compareInternal(false, true), false, "boolean");
+ compare(qtest_compareInternal(false, 0), false, "boolean");
+ compare(qtest_compareInternal(false, null), false, "boolean");
+ compare(qtest_compareInternal(false, undefined), false, "boolean");
+ compare(qtest_compareInternal(true, 1), false, "boolean");
+ compare(qtest_compareInternal(true, null), false, "boolean");
+ compare(qtest_compareInternal(true, undefined), false, "boolean");
+
+ compare(qtest_compareInternal('', ''), true, "string");
+ compare(qtest_compareInternal('a', 'a'), true, "string");
+ compare(qtest_compareInternal("foobar", "foobar"), true, "string");
+ compare(qtest_compareInternal("foobar", "foo"), false, "string");
+ compare(qtest_compareInternal('', 0), false, "string");
+ compare(qtest_compareInternal('', false), false, "string");
+ compare(qtest_compareInternal('', null), false, "string");
+ compare(qtest_compareInternal('', undefined), false, "string");
+
+ // Short annotation VS new annotation
+ compare(qtest_compareInternal(0, new Number()), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Number(), 0), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(1, new Number(1)), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Number(1), 1), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Number(0), 1), false, "short annotation VS new annotation");
+ compare(qtest_compareInternal(0, new Number(1)), false, "short annotation VS new annotation");
+
+ compare(qtest_compareInternal(new String(), ""), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal("", new String()), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new String("My String"), "My String"), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal("My String", new String("My String")), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal("Bad String", new String("My String")), false, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new String("Bad String"), "My String"), false, "short annotation VS new annotation");
+
+ compare(qtest_compareInternal(false, new Boolean()), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Boolean(), false), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(true, new Boolean(true)), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Boolean(true), true), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(true, new Boolean(1)), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(false, new Boolean(false)), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Boolean(false), false), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(false, new Boolean(0)), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(true, new Boolean(false)), false, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Boolean(false), true), false, "short annotation VS new annotation");
+
+ compare(qtest_compareInternal(new Object(), {}), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal({}, new Object()), true, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Object(), {a:1}), false, "short annotation VS new annotation");
+ compare(qtest_compareInternal({a:1}, new Object()), false, "short annotation VS new annotation");
+ compare(qtest_compareInternal({a:undefined}, new Object()), false, "short annotation VS new annotation");
+ compare(qtest_compareInternal(new Object(), {a:undefined}), false, "short annotation VS new annotation");
+ }
+
+ function test_objects_basics() {
+ compare(qtest_compareInternal({}, {}), true);
+ compare(qtest_compareInternal({}, null), false);
+ compare(qtest_compareInternal({}, undefined), false);
+ compare(qtest_compareInternal({}, 0), false);
+ compare(qtest_compareInternal({}, false), false);
+
+ // This test is a hard one, it is very important
+ // REASONS:
+ // 1) They are of the same type "object"
+ // 2) [] instanceof Object is true
+ // 3) Their properties are the same (doesn't exists)
+ compare(qtest_compareInternal({}, []), false);
+
+ compare(qtest_compareInternal({a:1}, {a:1}), true);
+ compare(qtest_compareInternal({a:1}, {a:"1"}), false);
+ compare(qtest_compareInternal({a:[]}, {a:[]}), true);
+ compare(qtest_compareInternal({a:{}}, {a:null}), false);
+ compare(qtest_compareInternal({a:1}, {}), false);
+ compare(qtest_compareInternal({}, {a:1}), false);
+
+ // Hard ones
+ compare(qtest_compareInternal({a:undefined}, {}), false);
+ compare(qtest_compareInternal({}, {a:undefined}), false);
+ compare(qtest_compareInternal(
+ {
+ a: [{ bar: undefined }]
+ },
+ {
+ a: [{ bat: undefined }]
+ }
+ ), false);
+ }
+
+ function test_arrays_basics() {
+ compare(qtest_compareInternal([], []), true);
+
+ // May be a hard one, can invoke a crash at execution.
+ // because their types are both "object" but null isn't
+ // like a true object, it doesn't have any property at all.
+ compare(qtest_compareInternal([], null), false);
+
+ compare(qtest_compareInternal([], undefined), false);
+ compare(qtest_compareInternal([], false), false);
+ compare(qtest_compareInternal([], 0), false);
+ compare(qtest_compareInternal([], ""), false);
+
+ // May be a hard one, but less hard
+ // than {} with [] (note the order)
+ compare(qtest_compareInternal([], {}), false);
+
+ compare(qtest_compareInternal([null],[]), false);
+ compare(qtest_compareInternal([undefined],[]), false);
+ compare(qtest_compareInternal([],[null]), false);
+ compare(qtest_compareInternal([],[undefined]), false);
+ compare(qtest_compareInternal([null],[undefined]), false);
+ compare(qtest_compareInternal([[]],[[]]), true);
+ compare(qtest_compareInternal([[],[],[]],[[],[],[]]), true);
+ compare(qtest_compareInternal(
+ [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
+ [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]),
+ true);
+ compare(qtest_compareInternal(
+ [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
+ [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // shorter
+ false);
+ compare(qtest_compareInternal(
+ [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[{}]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
+ [[],[],[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]), // deepest element not an array
+ false);
+
+ // same multidimensional
+ compare(qtest_compareInternal(
+ [1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,[
+ [6,7,8,9, [
+ [
+ 1,2,3,4,[
+ 2,3,4,[
+ 1,2,[
+ 1,2,3,4,[
+ 1,2,3,4,5,6,7,8,9,[
+ 0
+ ],1,2,3,4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],5,6,7
+ ]
+ ]
+ ]
+ ]
+ ]]],
+ [1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,[
+ [6,7,8,9, [
+ [
+ 1,2,3,4,[
+ 2,3,4,[
+ 1,2,[
+ 1,2,3,4,[
+ 1,2,3,4,5,6,7,8,9,[
+ 0
+ ],1,2,3,4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],5,6,7
+ ]
+ ]
+ ]
+ ]
+ ]]]),
+ true, "Multidimensional");
+
+ // different multidimensional
+ compare(qtest_compareInternal(
+ [1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,[
+ [6,7,8,9, [
+ [
+ 1,2,3,4,[
+ 2,3,4,[
+ 1,2,[
+ 1,2,3,4,[
+ 1,2,3,4,5,6,7,8,9,[
+ 0
+ ],1,2,3,4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],5,6,7
+ ]
+ ]
+ ]
+ ]
+ ]]],
+ [1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,[
+ [6,7,8,9, [
+ [
+ 1,2,3,4,[
+ 2,3,4,[
+ 1,2,[
+ '1',2,3,4,[ // string instead of number
+ 1,2,3,4,5,6,7,8,9,[
+ 0
+ ],1,2,3,4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],5,6,7
+ ]
+ ]
+ ]
+ ]
+ ]]]),
+ false, "Multidimensional");
+
+ // different multidimensional
+ compare(qtest_compareInternal(
+ [1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,[
+ [6,7,8,9, [
+ [
+ 1,2,3,4,[
+ 2,3,4,[
+ 1,2,[
+ 1,2,3,4,[
+ 1,2,3,4,5,6,7,8,9,[
+ 0
+ ],1,2,3,4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],5,6,7
+ ]
+ ]
+ ]
+ ]
+ ]]],
+ [1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,6,7,8,9, [
+ 1,2,3,4,5,[
+ [6,7,8,9, [
+ [
+ 1,2,3,4,[
+ 2,3,[ // missing an element (4)
+ 1,2,[
+ 1,2,3,4,[
+ 1,2,3,4,5,6,7,8,9,[
+ 0
+ ],1,2,3,4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],4,5,6,7,8,9
+ ],5,6,7,8,9
+ ],5,6,7
+ ]
+ ]
+ ]
+ ]
+ ]]]),
+ false, "Multidimensional");
+ }
+
+ function test_date_instances() {
+ // Date, we don't need to test Date.parse() because it returns a number.
+ // Only test the Date instances by setting them a fix date.
+ // The date use is midnight January 1, 1970
+
+ var d1 = new Date();
+ d1.setTime(0); // fix the date
+
+ var d2 = new Date();
+ d2.setTime(0); // fix the date
+
+ var d3 = new Date(); // The very now
+
+ // Anyway their types differs, just in case the code fails in the order in which it deals with date
+ compare(qtest_compareInternal(d1, 0), false); // d1.valueOf() returns 0, but d1 and 0 are different
+ // test same values date and different instances equality
+ compare(qtest_compareInternal(d1, d2), true);
+ // test different date and different instances difference
+ compare(qtest_compareInternal(d1, d3), false);
+
+ // try to fool equiv by adding a valueOf function to an object
+ // that would return the same value of a real date instance.
+ var d4 = new Date();
+ d4.setFullYear(2010);
+ d4.setMonth(1);
+ d4.setDate(1);
+ d4.setHours(1);
+ d4.setMinutes(1);
+ d4.setSeconds(1);
+ d4.setMilliseconds(1);
+ var o4 = {
+ valueOf: function () {
+ return d4.valueOf();
+ }
+ }
+ compare(qtest_compareInternal(d4, o4), false); // o4 isn't an instance of Date
+ }
+
+
+ function test_regexp() {
+ // Must test cases that imply those traps:
+ // var a = /./;
+ // a instanceof Object; // Oops
+ // a instanceof RegExp; // Oops
+ // typeof a === "function"; // Oops, false in IE and Opera, true in FF and Safari ("object")
+
+ // Tests same regex with same modifiers in different order
+ var r = /foo/;
+ var r5 = /foo/gim;
+ var r6 = /foo/gmi;
+ var r7 = /foo/igm;
+ var r8 = /foo/img;
+ var r9 = /foo/mig;
+ var r10 = /foo/mgi;
+ var ri1 = /foo/i;
+ var ri2 = /foo/i;
+ var rm1 = /foo/m;
+ var rm2 = /foo/m;
+ var rg1 = /foo/g;
+ var rg2 = /foo/g;
+
+ compare(qtest_compareInternal(r5, r6), true, "Modifier order");
+ compare(qtest_compareInternal(r5, r7), true, "Modifier order");
+ compare(qtest_compareInternal(r5, r8), true, "Modifier order");
+ compare(qtest_compareInternal(r5, r9), true, "Modifier order");
+ compare(qtest_compareInternal(r5, r10), true, "Modifier order");
+ compare(qtest_compareInternal(r, r5), false, "Modifier");
+
+ compare(qtest_compareInternal(ri1, ri2), true, "Modifier");
+ compare(qtest_compareInternal(r, ri1), false, "Modifier");
+ compare(qtest_compareInternal(ri1, rm1), false, "Modifier");
+ compare(qtest_compareInternal(r, rm1), false, "Modifier");
+ compare(qtest_compareInternal(rm1, ri1), false, "Modifier");
+ compare(qtest_compareInternal(rm1, rm2), true, "Modifier");
+ compare(qtest_compareInternal(rg1, rm1), false, "Modifier");
+ compare(qtest_compareInternal(rm1, rg1), false, "Modifier");
+ compare(qtest_compareInternal(rg1, rg2), true, "Modifier");
+
+ // Different regex, same modifiers
+ var r11 = /[a-z]/gi;
+ var r13 = /[0-9]/gi; // oops! different
+ compare(qtest_compareInternal(r11, r13), false, "Regex pattern");
+
+ var r14 = /0/ig;
+ var r15 = /"0"/ig; // oops! different
+ compare(qtest_compareInternal(r14, r15), false, "Regex pattern");
+
+ var r1 = /[\n\r\u2028\u2029]/g;
+ var r2 = /[\n\r\u2028\u2029]/g;
+ var r3 = /[\n\r\u2028\u2028]/g; // differs from r1
+ var r4 = /[\n\r\u2028\u2029]/; // differs from r1
+
+ compare(qtest_compareInternal(r1, r2), true, "Regex pattern");
+ compare(qtest_compareInternal(r1, r3), false, "Regex pattern");
+ compare(qtest_compareInternal(r1, r4), false, "Regex pattern");
+
+ // More complex regex
+ var regex1 = "^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$";
+ var regex2 = "^[-_.a-z0-9]+@([-_a-z0-9]+\\.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$";
+ // regex 3 is different: '.' not escaped
+ var regex3 = "^[-_.a-z0-9]+@([-_a-z0-9]+.)+([A-Za-z][A-Za-z]|[A-Za-z][A-Za-z][A-Za-z])|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$";
+
+ var r21 = new RegExp(regex1);
+ var r22 = new RegExp(regex2);
+ var r23 = new RegExp(regex3); // diff from r21, not same pattern
+ var r23a = new RegExp(regex3, "gi"); // diff from r23, not same modifier
+ var r24a = new RegExp(regex3, "ig"); // same as r23a
+
+ compare(qtest_compareInternal(r21, r22), true, "Complex Regex");
+ compare(qtest_compareInternal(r21, r23), false, "Complex Regex");
+ compare(qtest_compareInternal(r23, r23a), false, "Complex Regex");
+ compare(qtest_compareInternal(r23a, r24a), true, "Complex Regex");
+
+ // typeof r1 is "function" in some browsers and "object" in others so we must cover this test
+ var re = / /;
+ compare(qtest_compareInternal(re, function () {}), false, "Regex internal");
+ compare(qtest_compareInternal(re, {}), false, "Regex internal");
+ }
+
+
+ function test_complex_objects() {
+
+ function fn1() {
+ return "fn1";
+ }
+ function fn2() {
+ return "fn2";
+ }
+
+ // Try to invert the order of some properties to make sure it is covered.
+ // It can failed when properties are compared between unsorted arrays.
+ compare(qtest_compareInternal(
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ a: 3.14159,
+ b: false,
+ c: {
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ r: "r",
+ s: [1,2,3],
+ t: undefined,
+ u: 0,
+ v: {
+ w: {
+ x: {
+ y: "Yahoo!",
+ z: null
+ }
+ }
+ }
+ },
+ q: [],
+ p: 1/0,
+ o: 99
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ d: 0,
+ i: true,
+ h: "false"
+ }
+ },
+ e: undefined,
+ g: "",
+ h: "h",
+ f: {},
+ i: []
+ },
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ b: false,
+ a: 3.14159,
+ c: {
+ d: 0,
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ r: "r",
+ t: undefined,
+ u: 0,
+ s: [1,2,3],
+ v: {
+ w: {
+ x: {
+ z: null,
+ y: "Yahoo!"
+ }
+ }
+ }
+ },
+ o: 99,
+ p: 1/0,
+ q: []
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ i: true,
+ h: "false"
+ }
+ },
+ e: undefined,
+ g: "",
+ f: {},
+ h: "h",
+ i: []
+ }
+ ), true);
+
+ compare(qtest_compareInternal(
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ a: 3.14159,
+ b: false,
+ c: {
+ d: 0,
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ //r: "r", // different: missing a property
+ s: [1,2,3],
+ t: undefined,
+ u: 0,
+ v: {
+ w: {
+ x: {
+ y: "Yahoo!",
+ z: null
+ }
+ }
+ }
+ },
+ o: 99,
+ p: 1/0,
+ q: []
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ h: "false",
+ i: true
+ }
+ },
+ e: undefined,
+ f: {},
+ g: "",
+ h: "h",
+ i: []
+ },
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ a: 3.14159,
+ b: false,
+ c: {
+ d: 0,
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ r: "r",
+ s: [1,2,3],
+ t: undefined,
+ u: 0,
+ v: {
+ w: {
+ x: {
+ y: "Yahoo!",
+ z: null
+ }
+ }
+ }
+ },
+ o: 99,
+ p: 1/0,
+ q: []
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ h: "false",
+ i: true
+ }
+ },
+ e: undefined,
+ f: {},
+ g: "",
+ h: "h",
+ i: []
+ }
+ ), false);
+
+ compare(qtest_compareInternal(
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ a: 3.14159,
+ b: false,
+ c: {
+ d: 0,
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ r: "r",
+ s: [1,2,3],
+ t: undefined,
+ u: 0,
+ v: {
+ w: {
+ x: {
+ y: "Yahoo!",
+ z: null
+ }
+ }
+ }
+ },
+ o: 99,
+ p: 1/0,
+ q: []
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ h: "false",
+ i: true
+ }
+ },
+ e: undefined,
+ f: {},
+ g: "",
+ h: "h",
+ i: []
+ },
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ a: 3.14159,
+ b: false,
+ c: {
+ d: 0,
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ r: "r",
+ s: [1,2,3],
+ //t: undefined, // different: missing a property with an undefined value
+ u: 0,
+ v: {
+ w: {
+ x: {
+ y: "Yahoo!",
+ z: null
+ }
+ }
+ }
+ },
+ o: 99,
+ p: 1/0,
+ q: []
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ h: "false",
+ i: true
+ }
+ },
+ e: undefined,
+ f: {},
+ g: "",
+ h: "h",
+ i: []
+ }
+ ), false);
+
+ compare(qtest_compareInternal(
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ a: 3.14159,
+ b: false,
+ c: {
+ d: 0,
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ r: "r",
+ s: [1,2,3],
+ t: undefined,
+ u: 0,
+ v: {
+ w: {
+ x: {
+ y: "Yahoo!",
+ z: null
+ }
+ }
+ }
+ },
+ o: 99,
+ p: 1/0,
+ q: []
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ h: "false",
+ i: true
+ }
+ },
+ e: undefined,
+ f: {},
+ g: "",
+ h: "h",
+ i: []
+ },
+ {
+ a: 1,
+ b: null,
+ c: [{}],
+ d: {
+ a: 3.14159,
+ b: false,
+ c: {
+ d: 0,
+ e: fn1,
+ f: [[[]]],
+ g: {
+ j: {
+ k: {
+ n: {
+ r: "r",
+ s: [1,2,3],
+ t: undefined,
+ u: 0,
+ v: {
+ w: {
+ x: {
+ y: "Yahoo!",
+ z: null
+ }
+ }
+ }
+ },
+ o: 99,
+ p: 1/0,
+ q: {} // different was []
+ },
+ l: undefined,
+ m: null
+ }
+ },
+ h: "false",
+ i: true
+ }
+ },
+ e: undefined,
+ f: {},
+ g: "",
+ h: "h",
+ i: []
+ }
+ ), false);
+
+ var same1 = {
+ a: [
+ "string", null, 0, "1", 1, {
+ prop: null,
+ foo: [1,2,null,{}, [], [1,2,3]],
+ bar: undefined
+ }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας"
+ ],
+ unicode: "è€ æ±‰è¯­ä¸­å­˜åœ¨ 港澳和海外的åŽäººåœˆä¸­ 贵州 我去了书店 现在尚有争",
+ b: "b",
+ c: fn1
+ };
+
+ var same2 = {
+ a: [
+ "string", null, 0, "1", 1, {
+ prop: null,
+ foo: [1,2,null,{}, [], [1,2,3]],
+ bar: undefined
+ }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας"
+ ],
+ unicode: "è€ æ±‰è¯­ä¸­å­˜åœ¨ 港澳和海外的åŽäººåœˆä¸­ 贵州 我去了书店 现在尚有争",
+ b: "b",
+ c: fn1
+ };
+
+ var diff1 = {
+ a: [
+ "string", null, 0, "1", 1, {
+ prop: null,
+ foo: [1,2,null,{}, [], [1,2,3,4]], // different: 4 was add to the array
+ bar: undefined
+ }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας"
+ ],
+ unicode: "è€ æ±‰è¯­ä¸­å­˜åœ¨ 港澳和海外的åŽäººåœˆä¸­ 贵州 我去了书店 现在尚有争",
+ b: "b",
+ c: fn1
+ };
+
+ var diff2 = {
+ a: [
+ "string", null, 0, "1", 1, {
+ prop: null,
+ foo: [1,2,null,{}, [], [1,2,3]],
+ newprop: undefined, // different: newprop was added
+ bar: undefined
+ }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας"
+ ],
+ unicode: "è€ æ±‰è¯­ä¸­å­˜åœ¨ 港澳和海外的åŽäººåœˆä¸­ 贵州 我去了书店 现在尚有争",
+ b: "b",
+ c: fn1
+ };
+
+ var diff3 = {
+ a: [
+ "string", null, 0, "1", 1, {
+ prop: null,
+ foo: [1,2,null,{}, [], [1,2,3]],
+ bar: undefined
+ }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ α" // different: missing last char
+ ],
+ unicode: "è€ æ±‰è¯­ä¸­å­˜åœ¨ 港澳和海外的åŽäººåœˆä¸­ 贵州 我去了书店 现在尚有争",
+ b: "b",
+ c: fn1
+ };
+
+ var diff4 = {
+ a: [
+ "string", null, 0, "1", 1, {
+ prop: null,
+ foo: [1,2,undefined,{}, [], [1,2,3]], // different: undefined instead of null
+ bar: undefined
+ }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας"
+ ],
+ unicode: "è€ æ±‰è¯­ä¸­å­˜åœ¨ 港澳和海外的åŽäººåœˆä¸­ 贵州 我去了书店 现在尚有争",
+ b: "b",
+ c: fn1
+ };
+
+ var diff5 = {
+ a: [
+ "string", null, 0, "1", 1, {
+ prop: null,
+ foo: [1,2,null,{}, [], [1,2,3]],
+ bat: undefined // different: property name not "bar"
+ }, 3, "Hey!", "Κάνε πάντα γνωÏίζουμε ας των, μηχανής επιδιόÏθωσης επιδιοÏθώσεις ÏŽÏ‚ μια. Κλπ ας"
+ ],
+ unicode: "è€ æ±‰è¯­ä¸­å­˜åœ¨ 港澳和海外的åŽäººåœˆä¸­ 贵州 我去了书店 现在尚有争",
+ b: "b",
+ c: fn1
+ };
+
+ compare(qtest_compareInternal(same1, same2), true);
+ compare(qtest_compareInternal(same2, same1), true);
+ compare(qtest_compareInternal(same2, diff1), false);
+ compare(qtest_compareInternal(diff1, same2), false);
+
+ compare(qtest_compareInternal(same1, diff1), false);
+ compare(qtest_compareInternal(same1, diff2), false);
+ compare(qtest_compareInternal(same1, diff3), false);
+ compare(qtest_compareInternal(same1, diff3), false);
+ compare(qtest_compareInternal(same1, diff4), false);
+ compare(qtest_compareInternal(same1, diff5), false);
+ compare(qtest_compareInternal(diff5, diff1), false);
+ }
+
+
+ function test_complex_arrays() {
+
+ function fn() {
+ }
+
+ compare(qtest_compareInternal(
+ [1, 2, 3, true, {}, null, [
+ {
+ a: ["", '1', 0]
+ },
+ 5, 6, 7
+ ], "foo"],
+ [1, 2, 3, true, {}, null, [
+ {
+ a: ["", '1', 0]
+ },
+ 5, 6, 7
+ ], "foo"]),
+ true);
+
+ compare(qtest_compareInternal(
+ [1, 2, 3, true, {}, null, [
+ {
+ a: ["", '1', 0]
+ },
+ 5, 6, 7
+ ], "foo"],
+ [1, 2, 3, true, {}, null, [
+ {
+ b: ["", '1', 0] // not same property name
+ },
+ 5, 6, 7
+ ], "foo"]),
+ false);
+
+ var a = [{
+ b: fn,
+ c: false,
+ "do": "reserved word",
+ "for": {
+ ar: [3,5,9,"hey!", [], {
+ ar: [1,[
+ 3,4,6,9, null, [], []
+ ]],
+ e: fn,
+ f: undefined
+ }]
+ },
+ e: 0.43445
+ }, 5, "string", 0, fn, false, null, undefined, 0, [
+ 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
+ ], [], [[[], "foo", null, {
+ n: 1/0,
+ z: {
+ a: [3,4,5,6,"yep!", undefined, undefined],
+ b: {}
+ }
+ }, {}]]];
+
+ compare(qtest_compareInternal(a,
+ [{
+ b: fn,
+ c: false,
+ "do": "reserved word",
+ "for": {
+ ar: [3,5,9,"hey!", [], {
+ ar: [1,[
+ 3,4,6,9, null, [], []
+ ]],
+ e: fn,
+ f: undefined
+ }]
+ },
+ e: 0.43445
+ }, 5, "string", 0, fn, false, null, undefined, 0, [
+ 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
+ ], [], [[[], "foo", null, {
+ n: 1/0,
+ z: {
+ a: [3,4,5,6,"yep!", undefined, undefined],
+ b: {}
+ }
+ }, {}]]]), true);
+
+ compare(qtest_compareInternal(a,
+ [{
+ b: fn,
+ c: false,
+ "do": "reserved word",
+ "for": {
+ ar: [3,5,9,"hey!", [], {
+ ar: [1,[
+ 3,4,6,9, null, [], []
+ ]],
+ e: fn,
+ f: undefined
+ }]
+ },
+ e: 0.43445
+ }, 5, "string", 0, fn, false, null, undefined, 0, [
+ 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[2]]]], "3"], {}, 1/0 // different: [[[[[2]]]]] instead of [[[[[3]]]]]
+ ], [], [[[], "foo", null, {
+ n: 1/0,
+ z: {
+ a: [3,4,5,6,"yep!", undefined, undefined],
+ b: {}
+ }
+ }, {}]]]), false);
+
+ compare(qtest_compareInternal(a,
+ [{
+ b: fn,
+ c: false,
+ "do": "reserved word",
+ "for": {
+ ar: [3,5,9,"hey!", [], {
+ ar: [1,[
+ 3,4,6,9, null, [], []
+ ]],
+ e: fn,
+ f: undefined
+ }]
+ },
+ e: 0.43445
+ }, 5, "string", 0, fn, false, null, undefined, 0, [
+ 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
+ ], [], [[[], "foo", null, {
+ n: -1/0, // different, -Infinity instead of Infinity
+ z: {
+ a: [3,4,5,6,"yep!", undefined, undefined],
+ b: {}
+ }
+ }, {}]]]), false);
+
+ compare(qtest_compareInternal(a,
+ [{
+ b: fn,
+ c: false,
+ "do": "reserved word",
+ "for": {
+ ar: [3,5,9,"hey!", [], {
+ ar: [1,[
+ 3,4,6,9, null, [], []
+ ]],
+ e: fn,
+ f: undefined
+ }]
+ },
+ e: 0.43445
+ }, 5, "string", 0, fn, false, null, undefined, 0, [
+ 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
+ ], [], [[[], "foo", { // different: null is missing
+ n: 1/0,
+ z: {
+ a: [3,4,5,6,"yep!", undefined, undefined],
+ b: {}
+ }
+ }, {}]]]), false);
+
+ compare(qtest_compareInternal(a,
+ [{
+ b: fn,
+ c: false,
+ "do": "reserved word",
+ "for": {
+ ar: [3,5,9,"hey!", [], {
+ ar: [1,[
+ 3,4,6,9, null, [], []
+ ]],
+ e: fn
+ // different: missing property f: undefined
+ }]
+ },
+ e: 0.43445
+ }, 5, "string", 0, fn, false, null, undefined, 0, [
+ 4,5,6,7,8,9,11,22,33,44,55,"66", null, [], [[[[[3]]]], "3"], {}, 1/0
+ ], [], [[[], "foo", null, {
+ n: 1/0,
+ z: {
+ a: [3,4,5,6,"yep!", undefined, undefined],
+ b: {}
+ }
+ }, {}]]]), false);
+ }
+
+
+ function test_prototypal_inheritance() {
+ function Gizmo(id) {
+ this.id = id;
+ }
+
+ function Hoozit(id) {
+ this.id = id;
+ }
+ Hoozit.prototype = new Gizmo();
+
+ var gizmo = new Gizmo("ok");
+ var hoozit = new Hoozit("ok");
+
+ // Try this test many times after test on instances that hold function
+ // to make sure that our code does not mess with last object constructor memoization.
+ compare(qtest_compareInternal(function () {}, function () {}), false);
+
+ // Hoozit inherit from Gizmo
+ // hoozit instanceof Hoozit; // true
+ // hoozit instanceof Gizmo; // true
+ compare(qtest_compareInternal(hoozit, gizmo), true);
+
+ Gizmo.prototype.bar = true; // not a function just in case we skip them
+
+ // Hoozit inherit from Gizmo
+ // They are equivalent
+ compare(qtest_compareInternal(hoozit, gizmo), true);
+
+ // Make sure this is still true !important
+ // The reason for this is that I forgot to reset the last
+ // caller to where it were called from.
+ compare(qtest_compareInternal(function () {}, function () {}), false);
+
+ // Make sure this is still true !important
+ compare(qtest_compareInternal(hoozit, gizmo), true);
+
+ Hoozit.prototype.foo = true; // not a function just in case we skip them
+
+ // Gizmo does not inherit from Hoozit
+ // gizmo instanceof Gizmo; // true
+ // gizmo instanceof Hoozit; // false
+ // They are not equivalent
+ compare(qtest_compareInternal(hoozit, gizmo), false);
+
+ // Make sure this is still true !important
+ compare(qtest_compareInternal(function () {}, function () {}), false);
+ }
+
+
+ function test_instances() {
+ function A() {}
+ var a1 = new A();
+ var a2 = new A();
+
+ function B() {
+ this.fn = function () {};
+ }
+ var b1 = new B();
+ var b2 = new B();
+
+ compare(qtest_compareInternal(a1, a2), true, "Same property, same constructor");
+
+ // b1.fn and b2.fn are functions but they are different references
+ // But we decided to skip function for instances.
+ expectFail("", "Don't know if we want to take over function checking like in QUnit")
+ compare(qtest_compareInternal(b1, b2), true, "Same property, same constructor");
+ compare(qtest_compareInternal(a1, b1), false, "Same properties but different constructor"); // failed
+
+ function Car(year) {
+ var privateVar = 0;
+ this.year = year;
+ this.isOld = function() {
+ return year > 10;
+ };
+ }
+
+ function Human(year) {
+ var privateVar = 1;
+ this.year = year;
+ this.isOld = function() {
+ return year > 80;
+ };
+ }
+
+ var car = new Car(30);
+ var carSame = new Car(30);
+ var carDiff = new Car(10);
+ var human = new Human(30);
+
+ var diff = {
+ year: 30
+ };
+
+ var same = {
+ year: 30,
+ isOld: function () {}
+ };
+
+ compare(qtest_compareInternal(car, car), true);
+ compare(qtest_compareInternal(car, carDiff), false);
+ compare(qtest_compareInternal(car, carSame), true);
+ compare(qtest_compareInternal(car, human), false);
+ }
+
+
+ function test_complex_instances_nesting() {
+ //"Complex Instances Nesting (with function value in literals and/or in nested instances)"
+ function A(fn) {
+ this.a = {};
+ this.fn = fn;
+ this.b = {a: []};
+ this.o = {};
+ this.fn1 = fn;
+ }
+ function B(fn) {
+ this.fn = fn;
+ this.fn1 = function () {};
+ this.a = new A(function () {});
+ }
+
+ function fnOutside() {
+ }
+
+ function C(fn) {
+ function fnInside() {
+ }
+ this.x = 10;
+ this.fn = fn;
+ this.fn1 = function () {};
+ this.fn2 = fnInside;
+ this.fn3 = {
+ a: true,
+ b: fnOutside // ok make reference to a function in all instances scope
+ };
+ this.o1 = {};
+
+ // This function will be ignored.
+ // Even if it is not visible for all instances (e.g. locked in a closures),
+ // it is from a property that makes part of an instance (e.g. from the C constructor)
+ this.b1 = new B(function () {});
+ this.b2 = new B({
+ x: {
+ b2: new B(function() {})
+ }
+ });
+ }
+
+ function D(fn) {
+ function fnInside() {
+ }
+ this.x = 10;
+ this.fn = fn;
+ this.fn1 = function () {};
+ this.fn2 = fnInside;
+ this.fn3 = {
+ a: true,
+ b: fnOutside, // ok make reference to a function in all instances scope
+
+ // This function won't be ingored.
+ // It isn't visible for all C insances
+ // and it is not in a property of an instance. (in an Object instances e.g. the object literal)
+ c: fnInside
+ };
+ this.o1 = {};
+
+ // This function will be ignored.
+ // Even if it is not visible for all instances (e.g. locked in a closures),
+ // it is from a property that makes part of an instance (e.g. from the C constructor)
+ this.b1 = new B(function () {});
+ this.b2 = new B({
+ x: {
+ b2: new B(function() {})
+ }
+ });
+ }
+
+ function E(fn) {
+ function fnInside() {
+ }
+ this.x = 10;
+ this.fn = fn;
+ this.fn1 = function () {};
+ this.fn2 = fnInside;
+ this.fn3 = {
+ a: true,
+ b: fnOutside // ok make reference to a function in all instances scope
+ };
+ this.o1 = {};
+
+ // This function will be ignored.
+ // Even if it is not visible for all instances (e.g. locked in a closures),
+ // it is from a property that makes part of an instance (e.g. from the C constructor)
+ this.b1 = new B(function () {});
+ this.b2 = new B({
+ x: {
+ b1: new B({a: function() {}}),
+ b2: new B(function() {})
+ }
+ });
+ }
+
+
+ var a1 = new A(function () {});
+ var a2 = new A(function () {});
+ expectFail("", "Don't know if we want to take over function checking like in QUnit")
+ compare(qtest_compareInternal(a1, a2), true);
+
+ compare(qtest_compareInternal(a1, a2), true); // different instances
+
+ var b1 = new B(function () {});
+ var b2 = new B(function () {});
+ compare(qtest_compareInternal(a1, a2), true);
+
+ var c1 = new C(function () {});
+ var c2 = new C(function () {});
+ compare(qtest_compareInternal(c1, c2), true);
+
+ var d1 = new D(function () {});
+ var d2 = new D(function () {});
+ compare(qtest_compareInternal(d1, d2), false);
+
+ var e1 = new E(function () {});
+ var e2 = new E(function () {});
+ compare(qtest_compareInternal(e1, e2), false);
+
+ }
+}
diff --git a/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml b/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml
new file mode 100644
index 0000000000..b86d735cd2
--- /dev/null
+++ b/tests/auto/qmltest/selftests/tst_compare_quickobjects.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+TestCase {
+ name: "SelfTests_compare_QuickObjects"
+ id: testParent
+
+ Rectangle {
+ id: item1
+ color: "#000000"
+ }
+ Rectangle {
+ id: item2
+ color: "#000000"
+ }
+ Rectangle {
+ id: item3
+ color: "#ffffff"
+ }
+
+ Component {
+ id: item4
+
+ Rectangle {
+ color: "#ffffff"
+ }
+ }
+
+ function test_quickobjects() {
+ compare(qtest_compareInternal(item1, item1), true, "Identical QtQuick instances");
+ compare(qtest_compareInternal(item1, item3), false, "QtQuick instances with different properties");
+
+ expectFail("", "Unsure if we want this.");
+ compare(qtest_compareInternal(item1, item2), true, "QtQuick instances with same properties");
+
+ expectFail("", "Unsure if we want this.");
+ compare(qtest_compareInternal(item4.createObject(testParent),
+ item4.createObject(testParent)), true, "QtQuick dynamic instances");
+ }
+}
diff --git a/tests/auto/qmltest/selftests/tst_datadriven.qml b/tests/auto/qmltest/selftests/tst_datadriven.qml
new file mode 100644
index 0000000000..4a85e70488
--- /dev/null
+++ b/tests/auto/qmltest/selftests/tst_datadriven.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ TestCase {
+ name:"data-driven-empty-init-data"
+ property int tests:0;
+ property int init_data_called_times:0;
+ function init_data() {init_data_called_times++;}
+ function initTestCase() {tests = 0; init_data_called_times = 0;}
+ function cleanupTestCase() {compare(tests, 2); compare(init_data_called_times, 2);}
+
+ function test_test1() {tests++;}
+ function test_test2() {tests++;}
+ }
+ TestCase {
+ name:"data-driven-no-init-data"
+ property int tests:0;
+ function initTestCase() {tests = 0;}
+ function cleanupTestCase() {compare(tests, 2);}
+
+ function test_test1() {tests++;}
+ function test_test2() {tests++;}
+ }
+ TestCase {
+ name:"data-driven-init-data"
+ property int tests:0;
+ property int init_data_called_times:0;
+ function initTestCase() {tests = 0; init_data_called_times = 0;}
+ function cleanupTestCase() {compare(tests, 2); compare(init_data_called_times, 1);}
+ function init_data() {init_data_called_times++; return [{tag:"data1", data:"test data 1"}];}
+
+ function test_test1(row) {tests++; compare(row.data, "test data 1");}
+ function test_test2_data() {return [{tag:"data2", data:"test data 2"}]; }
+ function test_test2(row) {tests++; compare(row.data, "test data 2");}
+ }
+}
diff --git a/tests/auto/qmltest/selftests/tst_selftests.qml b/tests/auto/qmltest/selftests/tst_selftests.qml
new file mode 100644
index 0000000000..cc13b475aa
--- /dev/null
+++ b/tests/auto/qmltest/selftests/tst_selftests.qml
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+TestCase {
+ name: "SelfTests"
+
+ // Replace the TestResult functions in "testCase" with hooks
+ // that record the events but don't send them to QTestLib.
+ QtObject {
+ id: functions
+ property string failmsg: "cleaned"
+ property string actual: ""
+ property string expected: ""
+ property variant functionsToRun: []
+
+ function fail(msg, file, line) {
+ failmsg = msg
+ }
+
+ function verify(cond, msg, file, line) {
+ if (cond) {
+ failmsg = "verify-ok"
+ return true
+ } else {
+ failmsg = msg
+ return false
+ }
+ }
+
+ function compare(success, msg, act, exp, file, line) {
+ if (success) {
+ failmsg = "compare-ok"
+ actual = ""
+ expected = ""
+ return true
+ } else {
+ failmsg = msg
+ actual = act
+ expected = exp
+ return false
+ }
+ }
+
+ function skip(msg, file, line) {
+ failmsg = "skip:" + msg
+ }
+
+ function stringify(str) {
+ return str;
+ }
+ }
+
+ TestCase {
+ id: testCase
+ when: false
+ optional: true
+ qtest_results: functions
+ }
+
+ function init() {
+ compare(functions.failmsg, "cleaned") // Checks for previous cleanup()
+ functions.failmsg = "invalid"
+ }
+
+ function cleanup() {
+ functions.failmsg = "cleaned"
+ }
+
+ function test_fail() {
+ compare(functions.failmsg, "invalid") // Checks that init() was run
+
+ var caught = false
+ try {
+ testCase.fail("foo")
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "foo")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false
+ try {
+ testCase.fail()
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false
+ try {
+ testCase.fail(false)
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "false")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false
+ try {
+ testCase.fail(3)
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "3")
+ caught = true
+ }
+ verify(caught)
+ }
+
+ function test_verify() {
+ compare(functions.failmsg, "invalid") // Checks that init() was run
+
+ try {
+ testCase.verify(true)
+ } catch (e) {
+ fail("verify(true) did not succeed")
+ }
+ compare(functions.failmsg, "verify-ok")
+
+ var caught = false;
+ try {
+ testCase.verify(false, "foo")
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "foo")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false;
+ try {
+ testCase.verify(false)
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "")
+ caught = true
+ }
+ verify(caught)
+ }
+
+ function test_compare() {
+ compare(functions.failmsg, "invalid") // Checks that init() was run
+
+ try {
+ testCase.compare(23, 23)
+ } catch (e) {
+ fail("compare(23, 23) did not succeed")
+ }
+ compare(functions.failmsg, "compare-ok")
+
+ var caught = false;
+ try {
+ testCase.compare(23, 42, "foo")
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "foo")
+ compare(functions.actual, "23")
+ compare(functions.expected, "42")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false;
+ try {
+ testCase.compare("abcdef", 42)
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "Compared values are not the same")
+ compare(functions.actual, "abcdef")
+ compare(functions.expected, "42")
+ caught = true
+ }
+ verify(caught)
+
+/*
+ caught = false;
+ try {
+ testCase.compare(Qt.vector3d(1, 2, 3), Qt.vector3d(-1, 2, 3), "x")
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "x")
+ compare(functions.actual, "Qt.vector3d(1, 2, 3)")
+ compare(functions.expected, "Qt.vector3d(-1, 2, 3)")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false;
+ try {
+ testCase.compare(Qt.vector3d(1, 2, 3), Qt.vector3d(1, -2, 3), "y")
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "y")
+ compare(functions.actual, "Qt.vector3d(1, 2, 3)")
+ compare(functions.expected, "Qt.vector3d(1, -2, 3)")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false;
+ try {
+ testCase.compare(Qt.vector3d(1, 2, 3), Qt.vector3d(1, 2, -3), "z")
+ } catch (e) {
+ compare(e.message, "QtQuickTest::fail")
+ compare(functions.failmsg, "z")
+ compare(functions.actual, "Qt.vector3d(1, 2, 3)")
+ compare(functions.expected, "Qt.vector3d(1, 2, -3)")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false;
+ try {
+ testCase.compare(Qt.vector3d(1, 2, 3), Qt.vector3d(1, 2, 3))
+ } catch (e) {
+ fail("vector compare did not succeed")
+ }
+ compare(functions.failmsg, "compare-ok")
+*/
+ }
+
+ function test_skip() {
+ compare(functions.failmsg, "invalid") // Checks that init() was run
+
+ var caught = false
+ try {
+ testCase.skip("foo")
+ } catch (e) {
+ compare(e.message, "QtQuickTest::skip")
+ compare(functions.failmsg, "skip:foo")
+ caught = true
+ }
+ verify(caught)
+
+ caught = false
+ try {
+ testCase.skip()
+ } catch (e) {
+ compare(e.message, "QtQuickTest::skip")
+ compare(functions.failmsg, "skip:")
+ caught = true
+ }
+ verify(caught)
+ }
+}
diff --git a/tests/auto/qmltest/text/tst_text.qml b/tests/auto/qmltest/text/tst_text.qml
new file mode 100644
index 0000000000..87e9501ccd
--- /dev/null
+++ b/tests/auto/qmltest/text/tst_text.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ Text {
+ id: emptyText
+ }
+
+ Text {
+ id: txtfamily
+ text: "Hello world!"
+ font.family: "Courier"
+ }
+
+ Text {
+ id: txtcolor
+ text: "Hello world!"
+ color: "red"
+ }
+
+ Text {
+ id: txtelide
+ text: "Hello world!"
+ elide: Text.ElideRight
+ }
+
+ Text {
+ property string first: "Hello world!"
+ property string second: "Hello\nworld!"
+ property string third: "Hello\nworld\n!"
+
+ id: txtlinecount
+ text: first
+ width: 120
+ wrapMode: Text.WrapAnywhere
+ font.pixelSize: 18
+ }
+
+ TestCase {
+ name: "Text"
+
+ function test_empty() {
+ compare(emptyText.text, "")
+ }
+
+ function test_family() {
+ compare(txtfamily.font.family, "Courier")
+ txtfamily.font.family = "Helvetica";
+ compare(txtfamily.font.family, "Helvetica")
+ }
+
+ function test_color() {
+ compare(txtcolor.color, "#ff0000")
+ txtcolor.color = "blue";
+ compare(txtcolor.color, "#0000ff")
+ }
+
+ function test_elide() {
+ compare(txtelide.elide, Text.ElideRight)
+ txtelide.elide = Text.ElideLeft;
+ compare(txtelide.elide, Text.ElideLeft)
+ txtelide.elide = Text.ElideMiddle;
+ compare(txtelide.elide, Text.ElideMiddle)
+ }
+
+ function test_linecount() {
+ compare(txtlinecount.lineCount, 1)
+ txtlinecount.text = txtlinecount.second;
+ compare(txtlinecount.lineCount, 2)
+ txtlinecount.text = txtlinecount.third;
+ compare(txtlinecount.lineCount, 3)
+ txtlinecount.text = txtlinecount.first;
+ compare(txtlinecount.lineCount, 1)
+ txtlinecount.width = 50;
+ compare(txtlinecount.lineCount, 3)
+ }
+
+ }
+}
diff --git a/tests/auto/qmltest/textedit/tst_textedit.qml b/tests/auto/qmltest/textedit/tst_textedit.qml
new file mode 100644
index 0000000000..edfa127c59
--- /dev/null
+++ b/tests/auto/qmltest/textedit/tst_textedit.qml
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ TextEdit {
+ id: emptyText
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
+ id: txtfamily
+ text: "Hello world!"
+ font.family: "Courier"
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
+ id: txtcolor
+ text: "Hello world!"
+ color: "red"
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
+ id: txtentry
+ text: ""
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
+ id: txtentry2
+ text: ""
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
+ id: txtfunctions
+ text: "The quick brown fox jumped over the lazy dog"
+ height: 20
+ width: 50
+ }
+
+ TextEdit {
+ id: txtlines
+ property string styledtextvalue: "Line 1<br>Line 2<br>Line 3"
+ text: "Line 1\nLine 2\nLine 3"
+ textFormat: Text.PlainText
+ }
+
+ TestCase {
+ name: "TextEdit"
+ when: windowShown
+
+ function test_empty() {
+ compare(emptyText.text, "")
+ }
+
+ function test_family() {
+ compare(txtfamily.font.family, "Courier")
+ txtfamily.font.family = "Helvetica";
+ compare(txtfamily.font.family, "Helvetica")
+ }
+
+ function test_color() {
+ compare(txtcolor.color, "#ff0000")
+ txtcolor.color = "blue";
+ compare(txtcolor.color, "#0000ff")
+ }
+
+ function test_textentry() {
+ txtentry.focus = true;
+ compare(txtentry.text, "")
+ keyClick(Qt.Key_H)
+ keyClick(Qt.Key_E)
+ keyClick(Qt.Key_L)
+ keyClick(Qt.Key_L)
+ keyClick(Qt.Key_O)
+ keyClick(Qt.Key_Space)
+ keyClick(Qt.Key_W)
+ keyClick(Qt.Key_O)
+ keyClick(Qt.Key_R)
+ keyClick(Qt.Key_L)
+ keyClick(Qt.Key_D)
+ compare(txtentry.text, "hello world")
+ }
+
+ function test_textentry_char() {
+ txtentry2.focus = true;
+ compare(txtentry2.text, "")
+ keyClick("h")
+ keyClick("e")
+ keyClick("l")
+ keyClick("l")
+ keyClick("o")
+ keyClick(" ")
+ keyClick("W")
+ keyClick("o")
+ keyClick("r")
+ keyClick("l")
+ keyClick("d")
+ compare(txtentry2.text, "hello World")
+ }
+
+ function test_functions() {
+ compare(txtfunctions.getText(4,9), "quick")
+ txtfunctions.select(4,9);
+ compare(txtfunctions.selectedText, "quick")
+ txtfunctions.deselect();
+ compare(txtfunctions.selectedText, "")
+ txtfunctions.select(4,9);
+ txtfunctions.cut();
+ compare(txtfunctions.text, "The brown fox jumped over the lazy dog")
+ txtfunctions.text = "Qt";
+ txtfunctions.insert(txtfunctions.text.length, " ")
+ compare(txtfunctions.text, "Qt ");
+ txtfunctions.cursorPosition = txtfunctions.text.length;
+ txtfunctions.paste();
+ compare(txtfunctions.text, "Qt quick");
+ txtfunctions.cursorPosition = txtfunctions.text.length;
+ txtfunctions.selectWord();
+ compare(txtfunctions.selectedText, "quick")
+ txtfunctions.copy();
+ txtfunctions.selectAll();
+ compare(txtfunctions.selectedText, "Qt quick")
+ txtfunctions.deselect();
+ compare(txtfunctions.selectedText, "")
+ txtfunctions.paste();
+ compare(txtfunctions.text, "Qt quickquick");
+ }
+
+ function test_linecounts() {
+ compare(txtlines.lineCount, 3)
+ txtlines.text = txtlines.styledtextvalue;
+ compare(txtlines.text, "Line 1<br>Line 2<br>Line 3")
+ tryCompare(txtlines.lineCount, 1)
+ txtlines.textFormat = Text.StyledText;
+ tryCompare(txtlines.lineCount, 3)
+ txtlines.textFormat = Text.RichText;
+ tryCompare(txtlines.lineCount, 3)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/textinput/tst_textinput.qml b/tests/auto/qmltest/textinput/tst_textinput.qml
new file mode 100644
index 0000000000..c359d53200
--- /dev/null
+++ b/tests/auto/qmltest/textinput/tst_textinput.qml
@@ -0,0 +1,286 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Item {
+ id: top
+
+ TextInput {
+ id: emptyText
+ height: 20
+ width: 50
+ }
+
+ TextInput {
+ id: txtfamily
+ text: "Hello world!"
+ font.family: "Courier"
+ height: 20
+ width: 50
+ }
+
+ TextInput {
+ id: txtcolor
+ text: "Hello world!"
+ color: "red"
+ height: 20
+ width: 50
+ }
+
+ TextInput {
+ id: txtentry
+ text: ""
+ height: 20
+ width: 50
+ }
+
+ TextInput {
+ id: txtfunctions
+ text: "The quick brown fox jumped over the lazy dog"
+ height: 20
+ width: 50
+ }
+
+ TextInput {
+ id: txtintvalidator
+ text: ""
+ height: 20
+ width: 50
+ validator: IntValidator { id: iv; top: 20; bottom: 10; }
+ }
+
+ TextInput {
+ id: txtdoublevalidator
+ text: ""
+ height: 20
+ width: 50
+ validator: DoubleValidator { id: dv; top: 2.0; bottom: 1.0; }
+ }
+
+ TextInput {
+ id: txtregexpvalidator
+ text: ""
+ height: 20
+ width: 50
+ validator: RegExpValidator { id: rv; regExp: /[a-z]{3}/ }
+ }
+
+
+
+ TestCase {
+ name: "TextInput"
+ when: windowShown
+
+ function test_empty() {
+ compare(emptyText.text, "")
+ }
+
+ function test_family() {
+ compare(txtfamily.font.family, "Courier")
+ txtfamily.font.family = "Helvetica";
+ compare(txtfamily.font.family, "Helvetica")
+ }
+
+ function test_color() {
+ compare(txtcolor.color, "#ff0000")
+ txtcolor.color = "blue";
+ compare(txtcolor.color, "#0000ff")
+ }
+
+ function test_textentry() {
+ txtentry.focus = true;
+ compare(txtentry.text, "")
+ keyClick(Qt.Key_H)
+ keyClick(Qt.Key_E)
+ keyClick(Qt.Key_L)
+ keyClick(Qt.Key_L)
+ keyClick(Qt.Key_O)
+ keyClick(Qt.Key_Space)
+ keyClick(Qt.Key_W)
+ keyClick(Qt.Key_O)
+ keyClick(Qt.Key_R)
+ keyClick(Qt.Key_L)
+ keyClick(Qt.Key_D)
+ compare(txtentry.text, "hello world")
+ }
+
+ function test_functions() {
+ compare(txtfunctions.getText(4,9), "quick")
+ txtfunctions.select(4,9);
+ compare(txtfunctions.selectedText, "quick")
+ txtfunctions.deselect();
+ compare(txtfunctions.selectedText, "")
+ txtfunctions.select(4,9);
+ txtfunctions.cut();
+ compare(txtfunctions.text, "The brown fox jumped over the lazy dog")
+ txtfunctions.text = "Qt";
+ txtfunctions.insert(txtfunctions.text.length, " ")
+ compare(txtfunctions.text, "Qt ");
+ txtfunctions.cursorPosition = txtfunctions.text.length;
+ txtfunctions.paste();
+ compare(txtfunctions.text, "Qt quick");
+ txtfunctions.cursorPosition = txtfunctions.text.length;
+ txtfunctions.selectWord();
+ compare(txtfunctions.selectedText, "quick")
+ txtfunctions.copy();
+ txtfunctions.selectAll();
+ compare(txtfunctions.selectedText, "Qt quick")
+ txtfunctions.deselect();
+ compare(txtfunctions.selectedText, "")
+ txtfunctions.paste();
+ compare(txtfunctions.text, "Qt quickquick");
+ }
+
+ function test_intvalidators_data() {
+ return [
+ {
+ tag: "toolow",
+ testnumber: "5",
+ acceptable: false
+ },
+ {
+ tag: "toohigh",
+ testnumber: "50",
+ acceptable: false
+ },
+ {
+ tag: "onlowerbounds",
+ testnumber: "10",
+ acceptable: true
+ },
+ {
+ tag: "onupperbounds",
+ testnumber: "20",
+ acceptable: true
+ },
+ {
+ tag: "middle",
+ testnumber: "15",
+ acceptable: true
+ },
+ {
+ tag: "negativemiddle",
+ testnumber: "-15",
+ acceptable: false
+ }
+ ]
+
+ }
+
+ function test_intvalidators(row) {
+ compare(txtintvalidator.validator.top, 20)
+ compare(txtintvalidator.validator.bottom, 10)
+ txtintvalidator.text = row.testnumber;
+ compare(txtintvalidator.acceptableInput, row.acceptable)
+ }
+
+ function test_doublevalidators_data() {
+ return [
+ {
+ tag: "toolow",
+ testnumber: "0.5",
+ acceptable: false
+ },
+ {
+ tag: "toohigh",
+ testnumber: "2.5",
+ acceptable: false
+ },
+ {
+ tag: "onlowerbounds",
+ testnumber: "1.0",
+ acceptable: true
+ },
+ {
+ tag: "onupperbounds",
+ testnumber: "2.0",
+ acceptable: true
+ },
+ {
+ tag: "middle",
+ testnumber: "1.5",
+ acceptable: true
+ },
+ {
+ tag: "negativemiddle",
+ testnumber: "-1.5",
+ acceptable: false
+ }
+ ]
+
+ }
+
+ function test_doublevalidators(row) {
+ compare(txtdoublevalidator.validator.top, 2.0)
+ compare(txtdoublevalidator.validator.bottom, 1.0)
+ txtdoublevalidator.text = row.testnumber;
+ compare(txtdoublevalidator.acceptableInput, row.acceptable)
+ }
+
+ function test_regexpvalidators_data() {
+ return [
+ {
+ tag: "toolow",
+ testtext: "ab",
+ acceptable: false
+ },
+ {
+ tag: "toohigh",
+ testtext: "abcd",
+ acceptable: false
+ },
+ {
+ tag: "acceptable",
+ testtext: "abc",
+ acceptable: true
+ }
+ ]
+
+ }
+
+ function test_regexpvalidators(row) {
+ compare(txtregexpvalidator.validator.regExp, /[a-z]{3}/)
+ txtregexpvalidator.text = row.testtext;
+ compare(txtregexpvalidator.acceptableInput, row.acceptable)
+ }
+ }
+}
diff --git a/tests/auto/qmltest/tst_qmltest.cpp b/tests/auto/qmltest/tst_qmltest.cpp
new file mode 100644
index 0000000000..d982ed5274
--- /dev/null
+++ b/tests/auto/qmltest/tst_qmltest.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(qmltest) \ No newline at end of file
diff --git a/tests/auto/quick/dialogs/data/RectWithFileDialog.qml b/tests/auto/quick/dialogs/data/RectWithFileDialog.qml
new file mode 100644
index 0000000000..ca7ecc948a
--- /dev/null
+++ b/tests/auto/quick/dialogs/data/RectWithFileDialog.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+import QtQuick.Dialogs 1.0
+
+Rectangle {
+ width: 1024
+ height: 320
+ property alias fileDialog: fileDialog
+ property alias label: label
+ property alias mouseArea: mouseArea
+
+ FileDialog {
+ id: fileDialog
+ title: "Choose some files"
+ selectMultiple: true
+ nameFilters: [ "QML files (*.qml)", "All files (*)" ]
+ selectedNameFilter: "QML files (*.qml)"
+ onAccepted: label.text = fileDialog.filePaths
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: fileDialog.visible = !fileDialog.visible
+ }
+
+ Text {
+ id: label
+ text: "Click to open a file dialog"
+ wrapMode: Text.Wrap
+ anchors.fill: parent
+ anchors.margins: 10
+ }
+}
diff --git a/tests/auto/quick/dialogs/dialogs.pro b/tests/auto/quick/dialogs/dialogs.pro
new file mode 100644
index 0000000000..024b15a758
--- /dev/null
+++ b/tests/auto/quick/dialogs/dialogs.pro
@@ -0,0 +1,19 @@
+CONFIG += testcase
+TARGET = tst_dialogs
+SOURCES += tst_dialogs.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+macx:CONFIG+=insignificant_test # QTBUG-30513 - test is unstable
+linux-*:CONFIG+=insignificant_test # QTBUG-30513 - test is unstable
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private quick-private v8-private testlib
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/FileDialog.qml \
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp
new file mode 100644
index 0000000000..1ab10cc80f
--- /dev/null
+++ b/tests/auto/quick/dialogs/tst_dialogs.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include "../../shared/util.h"
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickView>
+#include <QSignalSpy>
+
+class tst_dialogs : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void initTestCase()
+ {
+ QQmlDataTest::initTestCase();
+ }
+
+ // FileDialog
+ void fileDialogDefaultModality();
+ void fileDialogNonModal();
+ void fileDialogNameFilters();
+
+private:
+};
+
+void tst_dialogs::fileDialogDefaultModality()
+{
+ QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->setSource(testFileUrl("RectWithFileDialog.qml"));
+ window->setGeometry(240,240,1024,320);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ // Click to show
+ QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
+ QSignalSpy spyVisibilityChanged(dlg, SIGNAL(visibilityChanged()));
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // show
+ QTRY_VERIFY(spyVisibilityChanged.count() > 0);
+ int visibilityChangedCount = spyVisibilityChanged.count();
+ // Can't hide by clicking the main window, because dialog is modal.
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100));
+ /*
+ On the Mac, if you send an event directly to a window, the modal dialog
+ doesn't block the event, so the window will process it normally. This
+ is a different code path compared to having a user click the mouse and
+ generate a native event; in that case the OS does the filtering itself,
+ and Qt will not even see the event. But simulating real events in the
+ test framework is generally unstable. So there isn't a good way to test
+ modality on the mac.
+ This test sometimes fails on other platforms too. Maybe it's not reliable
+ to try to click the main window in a location which is outside the
+ dialog, without checking or guaranteeing it somehow.
+ */
+ QSKIP("Modality test is flaky in general and doesn't work at all on MacOS");
+ // So we expect no change in visibility.
+ QCOMPARE(spyVisibilityChanged.count(), visibilityChangedCount);
+
+ QCOMPARE(dlg->property("visible").toBool(), true);
+ QMetaObject::invokeMethod(dlg, "close");
+ QTRY_VERIFY(spyVisibilityChanged.count() > visibilityChangedCount);
+ visibilityChangedCount = spyVisibilityChanged.count();
+ QCOMPARE(dlg->property("visible").toBool(), false);
+ QMetaObject::invokeMethod(dlg, "open");
+ QTRY_VERIFY(spyVisibilityChanged.count() > visibilityChangedCount);
+ QCOMPARE(dlg->property("visible").toBool(), true);
+ QCOMPARE(dlg->property("modality").toInt(), (int)Qt::WindowModal);
+}
+
+void tst_dialogs::fileDialogNonModal()
+{
+ QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->setSource(testFileUrl("RectWithFileDialog.qml"));
+ window->setGeometry(240,240,1024,320);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ // Click to toggle visibility
+ QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
+ dlg->setProperty("modality", QVariant((int)Qt::NonModal));
+ QSignalSpy spyVisibilityChanged(dlg, SIGNAL(visibilityChanged()));
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // show
+ int visibilityChangedCount = spyVisibilityChanged.count();
+ QTRY_VERIFY(visibilityChangedCount > 0);
+ QCOMPARE(dlg->property("visible").toBool(), true);
+ QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // hide
+ QTRY_VERIFY(spyVisibilityChanged.count() > visibilityChangedCount);
+ QCOMPARE(dlg->property("visible").toBool(), false);
+ QCOMPARE(dlg->property("modality").toInt(), (int)Qt::NonModal);
+}
+
+void tst_dialogs::fileDialogNameFilters()
+{
+ QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->setSource(testFileUrl("RectWithFileDialog.qml"));
+ window->setGeometry(240,240,1024,320);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
+ QStringList filters;
+ filters << "QML files (*.qml)";
+ filters << "Image files (*.jpg, *.png, *.gif)";
+ filters << "All files (*)";
+ dlg->setProperty("nameFilters", QVariant(filters));
+ QCOMPARE(dlg->property("selectedNameFilter").toString(), filters.first());
+}
+
+QTEST_MAIN(tst_dialogs)
+
+#include "tst_dialogs.moc"
diff --git a/tests/auto/quick/examples/data/dummytest.qml b/tests/auto/quick/examples/data/dummytest.qml
new file mode 100644
index 0000000000..b20e907f27
--- /dev/null
+++ b/tests/auto/quick/examples/data/dummytest.qml
@@ -0,0 +1,6 @@
+import Qt.VisualTest 4.6
+
+VisualTest {
+ Frame { msec: 0 }
+ Frame { msec: 10 }
+}
diff --git a/tests/auto/quick/examples/data/webbrowser/webbrowser.qml b/tests/auto/quick/examples/data/webbrowser/webbrowser.qml
new file mode 100644
index 0000000000..d31787b939
--- /dev/null
+++ b/tests/auto/quick/examples/data/webbrowser/webbrowser.qml
@@ -0,0 +1,6 @@
+import Qt.VisualTest 4.6
+
+VisualTest {
+ Frame { msec: 0 }
+ Frame { msec: 2000 }
+}
diff --git a/tests/auto/quick/examples/examples.pro b/tests/auto/quick/examples/examples.pro
new file mode 100644
index 0000000000..7f95771766
--- /dev/null
+++ b/tests/auto/quick/examples/examples.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+testcase.timeout = 400 # this test is slow
+TARGET = tst_examples
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_examples.cpp
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+CONFIG += parallel_test
+#temporary
+QT += core-private gui-private qml-private quick-private v8-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
new file mode 100644
index 0000000000..9c5fb88af2
--- /dev/null
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -0,0 +1,331 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QLibraryInfo>
+#include <QDir>
+#include <QProcess>
+#include <QDebug>
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickView>
+#include <QQmlComponent>
+#include <QQmlEngine>
+#include <QQmlError>
+
+static QtMessageHandler testlibMsgHandler = 0;
+void msgHandlerFilter(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg)
+{
+ if (type == QtCriticalMsg || type == QtFatalMsg)
+ (*testlibMsgHandler)(type, ctxt, msg);
+}
+
+class tst_examples : public QObject
+{
+ Q_OBJECT
+public:
+ tst_examples();
+ ~tst_examples();
+
+private slots:
+ void init();
+ void cleanup();
+
+ void sgexamples_data();
+ void sgexamples();
+ void sgsnippets_data();
+ void sgsnippets();
+
+ void namingConvention();
+private:
+ QStringList excludedDirs;
+ QStringList excludedFiles;
+
+ void namingConvention(const QDir &);
+ QStringList findQmlFiles(const QDir &);
+
+ QQmlEngine engine;
+};
+
+tst_examples::tst_examples()
+{
+ // Add files to exclude here
+ excludedFiles << "examples/quick/canvas/tiger/tiger.qml"; // QTBUG-26528
+ excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem
+
+ // Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/)
+ excludedDirs << "shared"; //Not an example
+ excludedDirs << "quick/text/fonts"; // QTBUG-29004
+ excludedDirs << "snippets/qml/path"; //No root QQuickItem
+ excludedDirs << "tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir
+
+ // These snippets are not expected to run on their own.
+ excludedDirs << "snippets/qml/visualdatamodel_rootindex";
+ excludedDirs << "snippets/qml/qtbinding";
+ excludedDirs << "snippets/qml/imports";
+
+#ifdef QT_NO_WEBKIT
+ excludedDirs << "qtquick/modelviews/webview";
+ excludedDirs << "demos/webbrowser";
+ excludedDirs << "doc/src/snippets/qml/webview";
+#endif
+
+#ifdef QT_NO_XMLPATTERNS
+ excludedDirs << "demos/twitter";
+ excludedDirs << "demos/flickr";
+ excludedDirs << "demos/photoviewer";
+ excludedDirs << "snippets/qml/xmlrole.qml";
+#endif
+
+}
+
+tst_examples::~tst_examples()
+{
+}
+
+void tst_examples::init()
+{
+ if (!qstrcmp(QTest::currentTestFunction(), "sgsnippets"))
+ testlibMsgHandler = qInstallMessageHandler(msgHandlerFilter);
+}
+
+void tst_examples::cleanup()
+{
+ if (!qstrcmp(QTest::currentTestFunction(), "sgsnippets"))
+ qInstallMessageHandler(testlibMsgHandler);
+}
+
+/*
+This tests that the examples follow the naming convention required
+to have them tested by the examples() test.
+*/
+void tst_examples::namingConvention(const QDir &d)
+{
+ for (int ii = 0; ii < excludedDirs.count(); ++ii) {
+ QString s = excludedDirs.at(ii);
+ if (d.absolutePath().endsWith(s))
+ return;
+ }
+
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"),
+ QDir::Files);
+
+ bool seenQml = !files.isEmpty();
+ bool seenLowercase = false;
+
+ foreach (const QString &file, files) {
+ if (file.at(0).isLower())
+ seenLowercase = true;
+ }
+
+ if (!seenQml) {
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QDir::NoSymLinks);
+ foreach (const QString &dir, dirs) {
+ QDir sub = d;
+ sub.cd(dir);
+ namingConvention(sub);
+ }
+ } else if(!seenLowercase) {
+ // QTBUG-28271 don't fail, but rather warn only
+ qWarning() << QString(
+ "Directory %1 violates naming convention; expected at least one qml file "
+ "starting with lower case, got: %2"
+ ).arg(d.absolutePath()).arg(files.join(","));
+
+// QFAIL(qPrintable(QString(
+// "Directory %1 violates naming convention; expected at least one qml file "
+// "starting with lower case, got: %2"
+// ).arg(d.absolutePath()).arg(files.join(","))));
+ }
+}
+
+void tst_examples::namingConvention()
+{
+ QStringList examplesLocations;
+ examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtdeclarative");
+ examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtquick");
+ examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtqml");
+
+ foreach(const QString &examples, examplesLocations) {
+ QDir d(examples);
+ if (d.exists())
+ namingConvention(d);
+ }
+}
+
+QStringList tst_examples::findQmlFiles(const QDir &d)
+{
+ for (int ii = 0; ii < excludedDirs.count(); ++ii) {
+ QString s = excludedDirs.at(ii);
+ if (d.absolutePath().endsWith(s))
+ return QStringList();
+ }
+
+ QStringList rv;
+
+ QStringList cppfiles = d.entryList(QStringList() << QLatin1String("*.cpp"), QDir::Files);
+ if (cppfiles.isEmpty()) {
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"),
+ QDir::Files);
+ foreach (const QString &file, files) {
+ if (file.at(0).isLower()) {
+ bool superContinue = false;
+ for (int ii = 0; ii < excludedFiles.count(); ++ii) {
+ QString e = excludedFiles.at(ii);
+ if (d.absoluteFilePath(file).endsWith(e)) {
+ superContinue = true;
+ break;
+ }
+ }
+ if (superContinue)
+ continue;
+ rv << d.absoluteFilePath(file);
+ }
+ }
+ }
+
+
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QDir::NoSymLinks);
+ foreach (const QString &dir, dirs) {
+ QDir sub = d;
+ sub.cd(dir);
+ rv << findQmlFiles(sub);
+ }
+
+ return rv;
+}
+
+/*
+This test runs all the examples in the QtQml UI source tree and ensures
+that they start and exit cleanly.
+
+Examples are any .qml files under the examples/ directory that start
+with a lower case letter.
+*/
+void tst_examples::sgexamples_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QString examples = QLatin1String(SRCDIR) + "/../../../../examples/";
+
+ QStringList files;
+ files << findQmlFiles(QDir(examples));
+
+ foreach (const QString &file, files)
+ QTest::newRow(qPrintable(file)) << file;
+}
+
+void tst_examples::sgexamples()
+{
+ QFETCH(QString, file);
+ QQuickWindow window;
+ window.setPersistentOpenGLContext(true);
+ window.setPersistentSceneGraph(true);
+
+ QQmlComponent component(&engine, QUrl::fromLocalFile(file));
+ if (component.status() == QQmlComponent::Error)
+ qWarning() << component.errors();
+ QCOMPARE(component.status(), QQmlComponent::Ready);
+
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QQuickItem *root = qobject_cast<QQuickItem *>(object.data());
+ if (!root)
+ component.completeCreate();
+ QVERIFY(root);
+
+ window.resize(240, 320);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ root->setParentItem(window.contentItem());
+ component.completeCreate();
+
+ qApp->processEvents();
+}
+
+void tst_examples::sgsnippets_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QString snippets = QLatin1String(SRCDIR) + "/../../../../src/qml/doc/snippets/qml";
+ QStringList files;
+ files << findQmlFiles(QDir(snippets));
+ foreach (const QString &file, files)
+ QTest::newRow(qPrintable(file)) << file;
+
+ snippets = QLatin1String(SRCDIR) + "/../../../../src/quick/doc/snippets/qml";
+ files.clear();
+ files << findQmlFiles(QDir(snippets));
+ foreach (const QString &file, files)
+ QTest::newRow(qPrintable(file)) << file;
+}
+
+void tst_examples::sgsnippets()
+{
+ QQuickWindow window;
+
+ QFETCH(QString, file);
+
+ QQmlComponent component(&engine, QUrl::fromLocalFile(file));
+ if (component.status() == QQmlComponent::Error)
+ qWarning() << component.errors();
+ QCOMPARE(component.status(), QQmlComponent::Ready);
+
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+ QQuickItem *root = qobject_cast<QQuickItem *>(object.data());
+ if (!root)
+ component.completeCreate();
+ QVERIFY(root);
+
+ window.resize(240, 320);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ root->setParentItem(window.contentItem());
+ component.completeCreate();
+
+ qApp->processEvents();
+}
+
+QTEST_MAIN(tst_examples)
+
+#include "tst_examples.moc"
diff --git a/tests/auto/quick/geometry/geometry.pro b/tests/auto/quick/geometry/geometry.pro
new file mode 100644
index 0000000000..4a225c2546
--- /dev/null
+++ b/tests/auto/quick/geometry/geometry.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_geometry
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_geometry.cpp
+
+CONFIG+=parallel_test
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/geometry/tst_geometry.cpp b/tests/auto/quick/geometry/tst_geometry.cpp
new file mode 100644
index 0000000000..a46c31d0f3
--- /dev/null
+++ b/tests/auto/quick/geometry/tst_geometry.cpp
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt scene graph research project.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+#include <QtQuick/qsggeometry.h>
+
+class GeometryTest : public QObject
+{
+ Q_OBJECT
+
+public:
+
+private Q_SLOTS:
+ void testPoint2D();
+ void testTexturedPoint2D();
+ void testCustomGeometry();
+
+private:
+};
+
+void GeometryTest::testPoint2D()
+{
+ QSGGeometry geometry(QSGGeometry::defaultAttributes_Point2D(), 4, 0);
+
+ QCOMPARE(geometry.attributeCount(), 1);
+ QCOMPARE(geometry.sizeOfVertex(), (int) sizeof(float) * 2);
+ QCOMPARE(geometry.vertexCount(), 4);
+ QCOMPARE(geometry.indexCount(), 0);
+ QVERIFY(geometry.indexData() == 0);
+
+ QSGGeometry::updateRectGeometry(&geometry, QRectF(1, 2, 3, 4));
+
+ QSGGeometry::Point2D *pts = geometry.vertexDataAsPoint2D();
+ QVERIFY(pts != 0);
+
+ QCOMPARE(pts[0].x, (float) 1);
+ QCOMPARE(pts[0].y, (float) 2);
+ QCOMPARE(pts[3].x, (float) 4);
+ QCOMPARE(pts[3].y, (float) 6);
+
+ // Verify that resize gives me enough allocated data without crashing...
+ geometry.allocate(100, 100);
+ pts = geometry.vertexDataAsPoint2D();
+ quint16 *is = geometry.indexDataAsUShort();
+ for (int i=0; i<100; ++i) {
+ pts[i].x = i;
+ pts[i].y = i + 100;
+ is[i] = i;
+ }
+ QVERIFY(true);
+}
+
+
+void GeometryTest::testTexturedPoint2D()
+{
+ QSGGeometry geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4, 0);
+
+ QCOMPARE(geometry.attributeCount(), 2);
+ QCOMPARE(geometry.sizeOfVertex(), (int) sizeof(float) * 4);
+ QCOMPARE(geometry.vertexCount(), 4);
+ QCOMPARE(geometry.indexCount(), 0);
+ QVERIFY(geometry.indexData() == 0);
+
+ QSGGeometry::updateTexturedRectGeometry(&geometry, QRectF(1, 2, 3, 4), QRectF(5, 6, 7, 8));
+
+ QSGGeometry::TexturedPoint2D *pts = geometry.vertexDataAsTexturedPoint2D();
+ QVERIFY(pts != 0);
+
+ QCOMPARE(pts[0].x, (float) 1);
+ QCOMPARE(pts[0].y, (float) 2);
+ QCOMPARE(pts[0].tx, (float) 5);
+ QCOMPARE(pts[0].ty, (float) 6);
+
+ QCOMPARE(pts[3].x, (float) 4);
+ QCOMPARE(pts[3].y, (float) 6);
+ QCOMPARE(pts[3].tx, (float) 12);
+ QCOMPARE(pts[3].ty, (float) 14);
+
+ // Verify that resize gives me enough allocated data without crashing...
+ geometry.allocate(100, 100);
+ pts = geometry.vertexDataAsTexturedPoint2D();
+ quint16 *is = geometry.indexDataAsUShort();
+ for (int i=0; i<100; ++i) {
+ pts[i].x = i;
+ pts[i].y = i + 100;
+ pts[i].tx = i + 200;
+ pts[i].ty = i + 300;
+ is[i] = i;
+ }
+ QVERIFY(true);
+}
+
+void GeometryTest::testCustomGeometry()
+{
+ struct V {
+ float x, y;
+ unsigned char r, g, b, a;
+ float v1, v2, v3, v4;
+ };
+
+ static QSGGeometry::Attribute attributes[] = {
+ { 0, 2, GL_FLOAT, 0, 0},
+ { 1, 4, GL_UNSIGNED_BYTE, 0, 0},
+ { 2, 4, GL_FLOAT, 0, 0},
+ };
+ static QSGGeometry::AttributeSet set = { 4, 6 * sizeof(float) + 4 * sizeof(unsigned char), attributes };
+
+ QSGGeometry geometry(set, 1000, 4000);
+
+ // Verify that space has been allocated.
+ quint16 *ii = geometry.indexDataAsUShort();
+ for (int i=0; i<geometry.indexCount(); ++i) {
+ ii[i] = i;
+ }
+
+ V *v = (V *) geometry.vertexData();
+ for (int i=0; i<geometry.vertexCount(); ++i) {
+ v[i].x = 0;
+ v[i].y = 1;
+ v[i].r = 2;
+ v[i].g = 3;
+ v[i].b = 4;
+ v[i].a = 5;
+ v[i].v1 = 6;
+ v[i].v2 = 7;
+ v[i].v3 = 8;
+ v[i].v4 = 9;
+ }
+
+ // Verify the data's integrity
+ for (int i=0; i<4000; ++i)
+ QCOMPARE(ii[i], (quint16) i);
+ for (int i=0; i<1000; ++i)
+ QVERIFY(v[i].v1 == 6);
+
+}
+
+
+QTEST_MAIN(GeometryTest);
+
+#include "tst_geometry.moc"
diff --git a/tests/auto/quick/nodes/nodes.pro b/tests/auto/quick/nodes/nodes.pro
new file mode 100644
index 0000000000..2e3a4455ea
--- /dev/null
+++ b/tests/auto/quick/nodes/nodes.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_nodestest
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_nodestest.cpp
+
+CONFIG+=parallel_test
+
+QT += core-private gui-private qml-private quick-private opengl widgets testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp
new file mode 100644
index 0000000000..a8094002dd
--- /dev/null
+++ b/tests/auto/quick/nodes/tst_nodestest.cpp
@@ -0,0 +1,354 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt scene graph research project.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+#include <QtQuick/qsgnode.h>
+#include <QtQuick/private/qsgrenderer_p.h>
+#include <QtQuick/private/qsgnodeupdater_p.h>
+
+#include <QtQuick/qsgsimplerectnode.h>
+#include <QtOpenGL/QGLWidget>
+class NodesTest : public QObject
+{
+ Q_OBJECT
+
+public:
+ NodesTest();
+
+private Q_SLOTS:
+ void initTestCase();
+ void cleanupTestCase() {
+ delete widget;
+ }
+
+ // Root nodes
+ void propegate();
+ void propegateWithMultipleRoots();
+ void simulatedEffect_data();
+ void simulatedEffect();
+
+ // Opacity nodes
+ void basicOpacityNode();
+ void opacityPropegation();
+
+ // QSGNodeUpdater
+ void isBlockedCheck();
+
+private:
+ QGLWidget *widget;
+
+ QSGNodeUpdater updater;
+};
+
+void NodesTest::initTestCase()
+{
+ widget = new QGLWidget();
+ widget->resize(100, 30);
+ widget->show();
+}
+
+class DummyRenderer : public QSGRenderer
+{
+public:
+ DummyRenderer(QSGRootNode *root)
+ : QSGRenderer(QSGContext::createDefaultContext())
+ , changedNode(0)
+ , changedState(0)
+ , renderCount(0)
+ {
+ setRootNode(root);
+ }
+
+ void render() {
+ ++renderCount;
+ renderingOrder = ++globalRendereringOrder;
+ }
+
+ void nodeChanged(QSGNode *node, QSGNode::DirtyState state) {
+ changedNode = node;
+ changedState = state;
+ QSGRenderer::nodeChanged(node, state);
+ }
+
+ QSGNode *changedNode;
+ QSGNode::DirtyState changedState;
+
+ int renderCount;
+ int renderingOrder;
+ static int globalRendereringOrder;
+};
+
+int DummyRenderer::globalRendereringOrder;
+
+NodesTest::NodesTest()
+{
+}
+
+
+void NodesTest::propegate()
+{
+ QSGRootNode root;
+ QSGNode child; child.setFlag(QSGNode::OwnedByParent, false);
+ root.appendChildNode(&child);
+
+ DummyRenderer renderer(&root);
+
+ child.markDirty(QSGNode::DirtyGeometry);
+
+ QCOMPARE(&child, renderer.changedNode);
+ QCOMPARE((int) renderer.changedState, (int) QSGNode::DirtyGeometry);
+}
+
+
+void NodesTest::propegateWithMultipleRoots()
+{
+ QSGRootNode root1;
+ QSGNode child2; child2.setFlag(QSGNode::OwnedByParent, false);
+ QSGRootNode root3; root3.setFlag(QSGNode::OwnedByParent, false);
+ QSGNode child4; child4.setFlag(QSGNode::OwnedByParent, false);
+
+ root1.appendChildNode(&child2);
+ child2.appendChildNode(&root3);
+ root3.appendChildNode(&child4);
+
+ DummyRenderer ren1(&root1);
+ DummyRenderer ren2(&root3);
+
+ child4.markDirty(QSGNode::DirtyGeometry);
+
+ QCOMPARE(ren1.changedNode, &child4);
+ QCOMPARE(ren2.changedNode, &child4);
+
+ QCOMPARE((int) ren1.changedState, (int) QSGNode::DirtyGeometry);
+ QCOMPARE((int) ren2.changedState, (int) QSGNode::DirtyGeometry);
+}
+
+
+
+class SimulatedEffectRenderer : public DummyRenderer
+{
+public:
+ SimulatedEffectRenderer(QSGRootNode *root, QSGBasicGeometryNode *c)
+ : DummyRenderer(root)
+ {
+ child = c;
+ }
+
+ void render() {
+ matrix = child->matrix() ? *child->matrix() : QMatrix4x4();
+ DummyRenderer::render();
+ }
+
+ QSGBasicGeometryNode *child;
+ QMatrix4x4 matrix;
+};
+
+
+class PseudoEffectNode : public QSGNode {
+public:
+ PseudoEffectNode(QSGRenderer *r)
+ : renderer(r)
+ {
+ setFlag(UsePreprocess);
+ }
+
+ void preprocess() {
+
+ if (renderer->rootNode()->parent()) {
+ // Mark the root dirty to build a clean state from the root and down
+ renderer->rootNode()->markDirty(QSGNode::DirtyForceUpdate);
+ }
+
+ renderer->renderScene();
+
+ if (renderer->rootNode()->parent()) {
+ // Mark the parent of the root dirty to force the root and down to be updated.
+ renderer->rootNode()->parent()->markDirty(QSGNode::DirtyForceUpdate);
+ }
+ }
+
+ QSGRenderer *renderer;
+};
+
+void NodesTest::simulatedEffect_data()
+{
+ QTest::addColumn<bool>("connected");
+
+ QTest::newRow("connected") << true;
+ QTest::newRow("disconnected") << false;
+}
+
+void NodesTest::simulatedEffect()
+{
+ QFETCH(bool, connected);
+
+ QSGRootNode root;
+ QSGRootNode source;
+ QSGTransformNode xform;
+ QSGSimpleRectNode geometry;
+ geometry.setRect(QRectF(0, 0, 1, 1));
+ geometry.setColor(Qt::red);
+
+ root.setFlag(QSGNode::OwnedByParent, false);
+ source.setFlag(QSGNode::OwnedByParent, false);
+ xform.setFlag(QSGNode::OwnedByParent, false);
+ geometry.setFlag(QSGNode::OwnedByParent, false);
+
+ SimulatedEffectRenderer rootRenderer(&root, &geometry);
+ SimulatedEffectRenderer sourceRenderer(&source, &geometry);
+
+ PseudoEffectNode effect(&sourceRenderer);
+
+ /*
+ root Source is redirected into effect using the SimulatedEffectRenderer
+ / \
+ xform effect
+ |
+ source
+ |
+ geometry
+ */
+
+ root.appendChildNode(&xform);
+ root.appendChildNode(&effect);
+ if (connected)
+ xform.appendChildNode(&source);
+ source.appendChildNode(&geometry);
+ QMatrix4x4 m; m.translate(1, 2, 3);
+ xform.setMatrix(m);
+
+ // Clear all dirty states...
+ updater.updateStates(&root);
+
+ rootRenderer.renderScene();
+
+ // compare that we got one render call to each
+ QCOMPARE(rootRenderer.renderCount, 1);
+ QCOMPARE(sourceRenderer.renderCount, 1);
+ QVERIFY(sourceRenderer.renderingOrder < rootRenderer.renderingOrder);
+ if (connected) // geometry is not rendered in this case, so skip it...
+ QCOMPARE(rootRenderer.matrix, xform.matrix());
+ QCOMPARE(sourceRenderer.matrix, QMatrix4x4());
+}
+
+void NodesTest::basicOpacityNode()
+{
+ QSGOpacityNode n;
+ QCOMPARE(n.opacity(), 1.);
+
+ n.setOpacity(0.5);
+ QCOMPARE(n.opacity(), 0.5);
+
+ n.setOpacity(-1);
+ QCOMPARE(n.opacity(), 0.);
+
+ n.setOpacity(2);
+ QCOMPARE(n.opacity(), 1.);
+}
+
+void NodesTest::opacityPropegation()
+{
+ QSGRootNode root;
+ QSGOpacityNode *a = new QSGOpacityNode;
+ QSGOpacityNode *b = new QSGOpacityNode;
+ QSGOpacityNode *c = new QSGOpacityNode;
+
+ QSGSimpleRectNode *geometry = new QSGSimpleRectNode;
+ geometry->setRect(0, 0, 100, 100);
+
+ root.appendChildNode(a);
+ a->appendChildNode(b);
+ b->appendChildNode(c);
+ c->appendChildNode(geometry);
+
+ a->setOpacity(0.9);
+ b->setOpacity(0.8);
+ c->setOpacity(0.7);
+
+ updater.updateStates(&root);
+
+ QCOMPARE(a->combinedOpacity(), 0.9);
+ QCOMPARE(b->combinedOpacity(), 0.9 * 0.8);
+ QCOMPARE(c->combinedOpacity(), 0.9 * 0.8 * 0.7);
+ QCOMPARE(geometry->inheritedOpacity(), 0.9 * 0.8 * 0.7);
+
+ b->setOpacity(0.1);
+ updater.updateStates(&root);
+
+ QCOMPARE(a->combinedOpacity(), 0.9);
+ QCOMPARE(b->combinedOpacity(), 0.9 * 0.1);
+ QCOMPARE(c->combinedOpacity(), 0.9 * 0.1 * 0.7);
+ QCOMPARE(geometry->inheritedOpacity(), 0.9 * 0.1 * 0.7);
+
+ b->setOpacity(0);
+ updater.updateStates(&root);
+
+ QVERIFY(b->isSubtreeBlocked());
+
+ // Verify that geometry did not get updated as it is in a blocked
+ // subtree
+ QCOMPARE(c->combinedOpacity(), 0.9 * 0.1 * 0.7);
+ QCOMPARE(geometry->inheritedOpacity(), 0.9 * 0.1 * 0.7);
+}
+
+void NodesTest::isBlockedCheck()
+{
+ QSGRootNode root;
+ QSGOpacityNode *opacity = new QSGOpacityNode();
+ QSGNode *node = new QSGNode();
+
+ root.appendChildNode(opacity);
+ opacity->appendChildNode(node);
+
+ QSGNodeUpdater updater;
+
+ opacity->setOpacity(0);
+ QVERIFY(updater.isNodeBlocked(node, &root));
+
+ opacity->setOpacity(1);
+ QVERIFY(!updater.isNodeBlocked(node, &root));
+}
+
+QTEST_MAIN(NodesTest);
+
+#include "tst_nodestest.moc"
diff --git a/tests/auto/quick/qquickaccessible/data/checkbuttons.qml b/tests/auto/quick/qquickaccessible/data/checkbuttons.qml
new file mode 100644
index 0000000000..22cdad1377
--- /dev/null
+++ b/tests/auto/quick/qquickaccessible/data/checkbuttons.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Item {
+ width: 400
+ height: 400
+
+ // button, not checkable
+ Rectangle {
+ y: 20
+ width: 100; height: 20
+ Accessible.role : Accessible.Button
+ }
+
+ // button, checkable, not checked
+ Rectangle {
+ y: 40
+ width: 100; height: 20
+ Accessible.role : Accessible.Button
+ property bool checkable: true
+ property bool checked: false
+ }
+
+ // button, checkable, checked
+ Rectangle {
+ y: 60
+ width: 100; height: 20
+ Accessible.role : Accessible.Button
+ property bool checkable: true
+ property bool checked: true
+ }
+
+ // check box, checked
+ Rectangle {
+ y: 80
+ width: 100; height: 20
+ Accessible.role : Accessible.CheckBox
+ property bool checked: true
+ }
+ // check box, not checked
+ Rectangle {
+ y: 100
+ width: 100; height: 20
+ Accessible.role : Accessible.CheckBox
+ property bool checked: false
+ }
+}
+
diff --git a/tests/auto/quick/qquickaccessible/data/hittest.qml b/tests/auto/quick/qquickaccessible/data/hittest.qml
new file mode 100644
index 0000000000..446b12240d
--- /dev/null
+++ b/tests/auto/quick/qquickaccessible/data/hittest.qml
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.0
+import "widgets"
+
+Rectangle {
+ id: page
+ width: 640
+ height: 480
+ color: "white"
+ Rectangle {
+ id: header
+ color: "#c0c0c0"
+ height: usage.height + chkClip.height
+ anchors.left: parent.left
+ anchors.right: parent.right
+ Text {
+ id: usage
+ text: "Use an a11y inspect tool to see if all visible rectangles can be found with hit testing."
+ }
+ Rectangle {
+ id: chkClip
+ property bool checked: true
+
+ color: (checked ? "#f0f0f0" : "#c0c0c0")
+ height: label.height
+ width: label.width
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: chkClip.checked = !chkClip.checked
+ }
+ Text {
+ id: label
+ text: "Click here to toggle clipping"
+ }
+ }
+ }
+ TextRect {
+ clip: chkClip.checked
+ z: 2
+ id: rect1
+ text: "rect1"
+ width: 100
+ height: 100
+ color: "#ffc0c0"
+ anchors.top: header.bottom
+ TextRect {
+ id: rect10
+ text: "rect10"
+ width: 100
+ height: 100
+ x: 50
+ y: 50
+ color: "#ffa0a0"
+ TextRect {
+ id: rect100
+ text: "rect100"
+ width: 100
+ height: 100
+ x: 80
+ y: 80
+ color: "#ff8080"
+ }
+ TextRect {
+ id: rect101
+ text: "rect101"
+ x: 100
+ y: 70
+ z: 3
+ width: 100
+ height: 100
+ color: "#e06060"
+ }
+ TextRect {
+ id: rect102
+ text: "rect102"
+ width: 100
+ height: 100
+ x: 150
+ y: 60
+ color: "#c04040"
+ }
+ }
+ }
+
+ TextRect {
+ x: 0
+ y: 50
+ id: rect2
+ text: "rect2"
+ width: 100
+ height: 100
+ color: "#c0c0ff"
+ TextRect {
+ id: rect20
+ text: "rect20"
+ width: 100
+ height: 100
+ x: 50
+ y: 50
+ color: "#a0a0ff"
+ TextRect {
+ id: rect200
+ text: "rect200"
+ width: 100
+ height: 100
+ x: 80
+ y: 80
+ color: "#8080ff"
+ }
+ TextRect {
+ id: rect201
+ text: "rect201"
+ x: 100
+ y: 70
+ z: 100
+ width: 100
+ height: 100
+ color: "#6060e0"
+ }
+ TextRect {
+ id: rect202
+ text: "rect202"
+ width: 100
+ height: 100
+ x: 150
+ y: 60
+ color: "#4040c0"
+ }
+ }
+ }
+
+}
diff --git a/tests/auto/quick/qquickaccessible/data/pushbutton.qml b/tests/auto/quick/qquickaccessible/data/pushbutton.qml
new file mode 100644
index 0000000000..df19231703
--- /dev/null
+++ b/tests/auto/quick/qquickaccessible/data/pushbutton.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ Accessible.role : Accessible.Button
+ property string text : "test"
+
+ Text {
+ anchors.fill : parent
+ text : parent.text
+ }
+
+ MouseArea {
+ anchors.fill : parent
+ }
+}
diff --git a/tests/auto/quick/qquickaccessible/data/statictext.qml b/tests/auto/quick/qquickaccessible/data/statictext.qml
new file mode 100644
index 0000000000..7cf1b707a0
--- /dev/null
+++ b/tests/auto/quick/qquickaccessible/data/statictext.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ width: 400
+ height: 400
+
+ Text {
+ x: 100
+ y: 20
+ width: 200
+ height: 50
+ text : "Hello Accessibility"
+
+ // Setting any value of the attached property
+ // makes an item accessible.
+ Accessible.name: text
+ }
+
+ Text {
+ x: 100
+ y: 40
+ width: 100
+ height: 40
+ text : "Hello 2"
+ Accessible.role: Accessible.StaticText
+ Accessible.name: "The Hello 2 accessible text"
+ Accessible.description: "A text description"
+ }
+}
diff --git a/tests/auto/quick/qquickaccessible/data/widgets/TextRect.qml b/tests/auto/quick/qquickaccessible/data/widgets/TextRect.qml
new file mode 100644
index 0000000000..937686974b
--- /dev/null
+++ b/tests/auto/quick/qquickaccessible/data/widgets/TextRect.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: button
+
+ property alias text : buttonText.text
+ Accessible.name: text
+ Accessible.description: "This button does " + text
+ Accessible.role: Accessible.Client
+
+ signal clicked
+
+ width: 40
+ height: 40
+ border.width: 2
+ border.color: "black";
+
+ Text {
+ id: buttonText
+ text: "TextRect"
+ anchors.centerIn: parent
+ font.pixelSize: parent.height * .1
+ style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
+ }
+
+}
diff --git a/tests/auto/quick/qquickaccessible/qquickaccessible.pro b/tests/auto/quick/qquickaccessible/qquickaccessible.pro
new file mode 100644
index 0000000000..6fc6011229
--- /dev/null
+++ b/tests/auto/quick/qquickaccessible/qquickaccessible.pro
@@ -0,0 +1,26 @@
+CONFIG += testcase
+
+TARGET = tst_qquickaccessible
+QT += qml-private network quick-private testlib gui-private
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickaccessible.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+OTHER_FILES += data/checkbuttons.qml
+OTHER_FILES += data/hittest.qml
+OTHER_FILES += data/pushbutton.qml
+OTHER_FILES += data/statictext.qml
+
+CONFIG += parallel_test
+
+wince*: {
+ accessneeded.files = $$QT.widgets.plugins/accessible/*.dll
+ accessneeded.path = accessible
+ DEPLOYMENT += accessneeded
+}
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
new file mode 100644
index 0000000000..d0bb075f4e
--- /dev/null
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -0,0 +1,418 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include "QtTest/qtestaccessible.h"
+
+#include <QtGui/qaccessible.h>
+
+#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickitem.h>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlproperty.h>
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+
+#include "../../shared/util.h"
+
+
+#define EXPECT(cond) \
+ do { \
+ if (!errorAt && !(cond)) { \
+ errorAt = __LINE__; \
+ qWarning("level: %d, middle: %d, role: %d (%s)", treelevel, middle, iface->role(), #cond); \
+ } \
+ } while (0)
+
+static int verifyHierarchy(QAccessibleInterface *iface)
+{
+ int errorAt = 0;
+ static int treelevel = 0; // for error diagnostics
+ QAccessibleInterface *middleChild, *if2;
+ middleChild = 0;
+ ++treelevel;
+ int middle = iface->childCount()/2 + 1;
+ if (iface->childCount() >= 2) {
+ middleChild = iface->child(middle - 1);
+ }
+ for (int i = 0; i < iface->childCount() && !errorAt; ++i) {
+ if2 = iface->child(i);
+ EXPECT(if2 != 0);
+ // navigate Ancestor...
+ QAccessibleInterface *parent = if2->parent();
+ EXPECT(iface->object() == parent->object());
+
+ // verify children...
+ if (!errorAt)
+ errorAt = verifyHierarchy(if2);
+ }
+
+ --treelevel;
+ return errorAt;
+}
+
+
+//TESTED_FILES=
+
+class tst_QQuickAccessible : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickAccessible();
+ virtual ~tst_QQuickAccessible();
+
+private slots:
+ void commonTests_data();
+ void commonTests();
+
+ void quickAttachedProperties();
+ void basicPropertiesTest();
+ void hitTest();
+ void checkableTest();
+};
+
+tst_QQuickAccessible::tst_QQuickAccessible()
+{
+
+}
+
+tst_QQuickAccessible::~tst_QQuickAccessible()
+{
+
+}
+
+void tst_QQuickAccessible::commonTests_data()
+{
+ QTest::addColumn<QString>("accessibleRoleFileName");
+
+ QTest::newRow("StaticText") << "statictext.qml";
+ QTest::newRow("PushButton") << "pushbutton.qml";
+}
+
+void tst_QQuickAccessible::commonTests()
+{
+ QFETCH(QString, accessibleRoleFileName);
+
+ qDebug() << "testing" << accessibleRoleFileName;
+
+ QQuickView *view = new QQuickView();
+// view->setFixedSize(240,320);
+ view->setSource(testFileUrl(accessibleRoleFileName));
+ view->show();
+// view->setFocus();
+ QVERIFY(view->rootObject() != 0);
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(view);
+ QVERIFY(iface);
+
+ delete view;
+}
+
+
+
+QString eventName(const int ev)
+{
+ switch (ev) {
+ case 0x0001: return "SoundPlayed";
+ case 0x0002: return "Alert";
+ case 0x0003: return "ForegroundChanged";
+ case 0x0004: return "MenuStart";
+ case 0x0005: return "MenuEnd";
+ case 0x0006: return "PopupMenuStart";
+ case 0x0007: return "PopupMenuEnd";
+ case 0x000C: return "ContextHelpStart";
+ case 0x000D: return "ContextHelpEnd";
+ case 0x000E: return "DragDropStart";
+ case 0x000F: return "DragDropEnd";
+ case 0x0010: return "DialogStart";
+ case 0x0011: return "DialogEnd";
+ case 0x0012: return "ScrollingStart";
+ case 0x0013: return "ScrollingEnd";
+ case 0x0018: return "MenuCommand";
+ case 0x8000: return "ObjectCreated";
+ case 0x8001: return "ObjectDestroyed";
+ case 0x8002: return "ObjectShow";
+ case 0x8003: return "ObjectHide";
+ case 0x8004: return "ObjectReorder";
+ case 0x8005: return "Focus";
+ case 0x8006: return "Selection";
+ case 0x8007: return "SelectionAdd";
+ case 0x8008: return "SelectionRemove";
+ case 0x8009: return "SelectionWithin";
+ case 0x800A: return "StateChanged";
+ case 0x800B: return "LocationChanged";
+ case 0x800C: return "NameChanged";
+ case 0x800D: return "DescriptionChanged";
+ case 0x800E: return "ValueChanged";
+ case 0x800F: return "ParentChanged";
+ case 0x80A0: return "HelpChanged";
+ case 0x80B0: return "DefaultActionChanged";
+ case 0x80C0: return "AcceleratorChanged";
+ default: return "Unknown Event";
+ }
+}
+
+void tst_QQuickAccessible::quickAttachedProperties()
+{
+ {
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem {\n"
+ "}", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object);
+ QCOMPARE(attachedObject, static_cast<QObject*>(0));
+ delete object;
+ }
+
+ // Attached property
+ {
+ QObject parent;
+ QQuickAccessibleAttached *attachedObj = new QQuickAccessibleAttached(&parent);
+
+ attachedObj->name();
+
+ QVariant pp = attachedObj->property("name");
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem {\n"
+ "Accessible.role: Accessible.Button\n"
+ "}", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object);
+ QVERIFY(attachedObject);
+ if (attachedObject) {
+ QVariant p = attachedObject->property("role");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toInt(), int(QAccessible::PushButton));
+ p = attachedObject->property("name");
+ QCOMPARE(p.isNull(), true);
+ p = attachedObject->property("description");
+ QCOMPARE(p.isNull(), true);
+ }
+ delete object;
+ }
+
+ // Attached property
+ {
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem {\n"
+ "Accessible.role: Accessible.Button\n"
+ "Accessible.name: \"Donald\"\n"
+ "Accessible.description: \"Duck\"\n"
+ "}", QUrl());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object);
+ QVERIFY(attachedObject);
+ if (attachedObject) {
+ QVariant p = attachedObject->property("role");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toInt(), int(QAccessible::PushButton));
+ p = attachedObject->property("name");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toString(), QLatin1String("Donald"));
+ p = attachedObject->property("description");
+ QCOMPARE(p.isNull(), false);
+ QCOMPARE(p.toString(), QLatin1String("Duck"));
+ }
+ delete object;
+ }
+}
+
+
+void tst_QQuickAccessible::basicPropertiesTest()
+{
+ QAccessibleInterface *app = QAccessible::queryAccessibleInterface(qApp);
+ QCOMPARE(app->childCount(), 0);
+
+ QQuickView *window = new QQuickView();
+ window->setSource(testFileUrl("statictext.qml"));
+ window->show();
+ QCOMPARE(app->childCount(), 1);
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window);
+ QVERIFY(iface);
+ QCOMPARE(iface->childCount(), 1);
+
+ QAccessibleInterface *item = iface->child(0);
+ QVERIFY(item);
+ QCOMPARE(item->childCount(), 2);
+ QCOMPARE(item->rect().size(), QSize(400, 400));
+ QCOMPARE(item->role(), QAccessible::Pane);
+ QCOMPARE(iface->indexOfChild(item), 0);
+
+ QAccessibleInterface *text = item->child(0);
+ QVERIFY(text);
+ QCOMPARE(text->childCount(), 0);
+
+ QCOMPARE(text->text(QAccessible::Name), QLatin1String("Hello Accessibility"));
+ QCOMPARE(text->rect().size(), QSize(200, 50));
+ QCOMPARE(text->rect().x(), item->rect().x() + 100);
+ QCOMPARE(text->rect().y(), item->rect().y() + 20);
+ QCOMPARE(text->role(), QAccessible::StaticText);
+ QCOMPARE(item->indexOfChild(text), 0);
+
+ QAccessibleInterface *text2 = item->child(1);
+ QVERIFY(text2);
+ QCOMPARE(text2->childCount(), 0);
+
+ QCOMPARE(text2->text(QAccessible::Name), QLatin1String("The Hello 2 accessible text"));
+ QCOMPARE(text2->rect().size(), QSize(100, 40));
+ QCOMPARE(text2->rect().x(), item->rect().x() + 100);
+ QCOMPARE(text2->rect().y(), item->rect().y() + 40);
+ QCOMPARE(text2->role(), QAccessible::StaticText);
+ QCOMPARE(item->indexOfChild(text2), 1);
+
+ QCOMPARE(iface->indexOfChild(text2), -1);
+ QCOMPARE(text2->indexOfChild(item), -1);
+
+ delete window;
+}
+
+QAccessibleInterface *topLevelChildAt(QAccessibleInterface *iface, int x, int y)
+{
+ QAccessibleInterface *child = iface->childAt(x, y);
+ if (!child)
+ return 0;
+
+ QAccessibleInterface *childOfChild;
+ while (childOfChild = child->childAt(x, y)) {
+ child = childOfChild;
+ }
+ return child;
+}
+
+void tst_QQuickAccessible::hitTest()
+{
+ QQuickView *window = new QQuickView;
+ window->setSource(testFileUrl("hittest.qml"));
+ window->show();
+
+ QAccessibleInterface *windowIface = QAccessible::queryAccessibleInterface(window);
+ QVERIFY(windowIface);
+ QAccessibleInterface *rootItem = windowIface->child(0);
+ QRect rootRect = rootItem->rect();
+
+ // check the root item from app
+ QAccessibleInterface *appIface = QAccessible::queryAccessibleInterface(qApp);
+ QVERIFY(appIface);
+ QAccessibleInterface *itemHit(appIface->childAt(rootRect.x() + 200, rootRect.y() + 50));
+ QVERIFY(itemHit);
+ QCOMPARE(rootRect, itemHit->rect());
+
+ // hit rect1
+ QAccessibleInterface *rect1(rootItem->child(0));
+ QRect rect1Rect = rect1->rect();
+ QAccessibleInterface *rootItemIface = rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10);
+ QVERIFY(rootItemIface);
+ QCOMPARE(rect1Rect, rootItemIface->rect());
+ QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect1"));
+
+ // should also work from top level (app)
+ QAccessibleInterface *app(QAccessible::queryAccessibleInterface(qApp));
+ QAccessibleInterface *itemHit2(topLevelChildAt(app, rect1Rect.x() + 10, rect1Rect.y() + 10));
+ QVERIFY(itemHit2);
+ QCOMPARE(itemHit2->rect(), rect1Rect);
+ QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1"));
+
+ // hit rect201
+ QAccessibleInterface *rect2(rootItem->child(1));
+ QVERIFY(rect2);
+ // FIXME: This is seems broken on mac
+ // QCOMPARE(rect2->rect().translated(rootItem->rect().x(), rootItem->rect().y()), QRect(0, 50, 100, 100));
+ QAccessibleInterface *rect20(rect2->child(0));
+ QVERIFY(rect20);
+ QAccessibleInterface *rect201(rect20->child(1));
+ QVERIFY(rect201);
+
+ QRect rect201Rect = rect201->rect();
+ rootItemIface = windowIface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20);
+ QVERIFY(rootItemIface);
+ QCOMPARE(rootItemIface->rect(), rect201Rect);
+ QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect201"));
+
+ delete window;
+}
+
+void tst_QQuickAccessible::checkableTest()
+{
+ QQuickView *window = new QQuickView();
+ window->setSource(testFileUrl("checkbuttons.qml"));
+ window->show();
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window);
+ QVERIFY(iface);
+ QAccessibleInterface *root = iface->child(0);
+
+ QAccessibleInterface *button1 = root->child(0);
+ QCOMPARE(button1->role(), QAccessible::Button);
+ QVERIFY(!(button1->state().checked));
+ QVERIFY(!(button1->state().checkable));
+
+ QAccessibleInterface *button2 = root->child(1);
+ QVERIFY(!(button2->state().checked));
+ QVERIFY(button2->state().checkable);
+
+ QAccessibleInterface *button3 = root->child(2);
+ QVERIFY(button3->state().checked);
+ QVERIFY(button3->state().checkable);
+
+ QAccessibleInterface *checkBox1 = root->child(3);
+ QCOMPARE(checkBox1->role(), QAccessible::CheckBox);
+ QVERIFY((checkBox1->state().checked));
+ QVERIFY(checkBox1->state().checkable);
+
+ QAccessibleInterface *checkBox2 = root->child(4);
+ QVERIFY(!(checkBox2->state().checked));
+ QVERIFY(checkBox2->state().checkable);
+}
+
+QTEST_MAIN(tst_QQuickAccessible)
+
+#include "tst_qquickaccessible.moc"
diff --git a/tests/auto/quick/qquickanchors/data/anchors.qml b/tests/auto/quick/qquickanchors/data/anchors.qml
new file mode 100644
index 0000000000..4be49a3468
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/anchors.qml
@@ -0,0 +1,162 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 240
+ height: 320
+ Rectangle { id: masterRect; objectName: "masterRect"; x: 26; width: 96; height: 20; color: "red" }
+ Rectangle {
+ id: rect1; objectName: "rect1"
+ y: 20; width: 10; height: 10
+ anchors.left: masterRect.left
+ }
+ Rectangle {
+ id: rect2; objectName: "rect2"
+ y: 20; width: 10; height: 10
+ anchors.left: masterRect.right
+ }
+ Rectangle {
+ id: rect3; objectName: "rect3"
+ y: 20; width: 10; height: 10
+ anchors.left: masterRect.horizontalCenter
+ }
+ Rectangle {
+ id: rect4; objectName: "rect4"
+ y: 30; width: 10; height: 10
+ anchors.right: masterRect.left
+ }
+ Rectangle {
+ id: rect5; objectName: "rect5"
+ y: 30; width: 10; height: 10
+ anchors.right: masterRect.right
+ }
+ Rectangle {
+ id: rect6; objectName: "rect6"
+ y: 30; width: 10; height: 10
+ anchors.right: masterRect.horizontalCenter
+ }
+ Rectangle {
+ id: rect7; objectName: "rect7"
+ y: 50; width: 10; height: 10
+ anchors.left: parent.left
+ }
+ Rectangle {
+ id: rect8; objectName: "rect8"
+ y: 50; width: 10; height: 10
+ anchors.left: parent.right
+ }
+ Rectangle {
+ id: rect9; objectName: "rect9"
+ y: 50; width: 10; height: 10
+ anchors.left: parent.horizontalCenter
+ }
+ Rectangle {
+ id: rect10; objectName: "rect10"
+ y: 60; width: 10; height: 10
+ anchors.right: parent.left
+ }
+ Rectangle {
+ id: rect11; objectName: "rect11"
+ y: 60; width: 10; height: 10
+ anchors.right: parent.right
+ }
+ Rectangle {
+ id: rect12; objectName: "rect12"
+ y: 60; width: 10; height: 10
+ anchors.right: parent.horizontalCenter
+ }
+ Rectangle {
+ id: rect13; objectName: "rect13"
+ x: 200; width: 10; height: 10
+ anchors.top: masterRect.bottom
+ }
+ Rectangle {
+ id: rect14; objectName: "rect14"
+ width: 10; height: 10; color: "steelblue"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Rectangle {
+ id: rect15; objectName: "rect15"
+ y: 200; height: 10
+ anchors.left: masterRect.left
+ anchors.right: masterRect.right
+ }
+ Rectangle {
+ id: rect16; objectName: "rect16"
+ y: 220; height: 10
+ anchors.left: masterRect.left
+ anchors.horizontalCenter: masterRect.right
+ }
+ Rectangle {
+ id: rect17; objectName: "rect17"
+ y: 240; height: 10
+ anchors.right: masterRect.right
+ anchors.horizontalCenter: masterRect.left
+ }
+ Rectangle {
+ id: rect18; objectName: "rect18"
+ x: 180; width: 10
+ anchors.top: masterRect.bottom
+ anchors.bottom: rect12.top
+ }
+ Rectangle {
+ id: rect19; objectName: "rect19"
+ y: 70; width: 10; height: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Rectangle {
+ id: rect20; objectName: "rect20"
+ y: 70; width: 10; height: 10
+ anchors.horizontalCenter: parent.right
+ }
+ Rectangle {
+ id: rect21; objectName: "rect21"
+ y: 70; width: 10; height: 10
+ anchors.horizontalCenter: parent.left
+ }
+ Rectangle {
+ id: rect22; objectName: "rect22"
+ width: 10; height: 10
+ anchors.centerIn: masterRect
+ }
+ Rectangle {
+ id: rect23; objectName: "rect23"
+ anchors.left: masterRect.left
+ anchors.leftMargin: 5
+ anchors.right: masterRect.right
+ anchors.rightMargin: 5
+ anchors.top: masterRect.top
+ anchors.topMargin: 5
+ anchors.bottom: masterRect.bottom
+ anchors.bottomMargin: 5
+ }
+ Rectangle {
+ id: rect24; objectName: "rect24"
+ width: 10; height: 10
+ anchors.horizontalCenter: masterRect.left
+ anchors.horizontalCenterOffset: width/2
+ }
+ Rectangle {
+ id: rect25; objectName: "rect25"
+ width: 10; height: 10
+ anchors.verticalCenter: rect12.top
+ anchors.verticalCenterOffset: height/2
+ }
+ Rectangle {
+ id: rect26; objectName: "rect26"
+ width: 10; height: 10
+ anchors.baseline: masterRect.top
+ anchors.baselineOffset: height/2
+ }
+ Text {
+ id: text1; objectName: "text1"
+ y: 200;
+ text: "Hello"
+ }
+ Text {
+ id: text2; objectName: "text2"
+ anchors.baseline: text1.baseline
+ anchors.left: text1.right
+ text: "World"
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/baselineOffset.qml b/tests/auto/quick/qquickanchors/data/baselineOffset.qml
new file mode 100644
index 0000000000..8bae61d16d
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/baselineOffset.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+
+ Item {
+ objectName: "baselineAnchored"
+
+ width: 200
+ height: 10
+
+ anchors.baseline: parent.verticalCenter
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/centerin.qml b/tests/auto/quick/qquickanchors/data/centerin.qml
new file mode 100644
index 0000000000..b880219f0f
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/centerin.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ objectName: "centered"
+ width: 50; height: 50; color: "blue"
+ anchors.centerIn: parent;
+ anchors.verticalCenterOffset: 30
+ anchors.horizontalCenterOffset: 10
+ }
+
+ Rectangle {
+ objectName: "centered2"
+ width: 11; height: 11; color: "green"
+ anchors.centerIn: parent;
+ }
+
+ Rectangle {
+ objectName: "centered3"
+ width: 11; height: 11; color: "green"
+ anchors.centerIn: parent;
+ anchors.alignWhenCentered: false
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/centerinRotation.qml b/tests/auto/quick/qquickanchors/data/centerinRotation.qml
new file mode 100644
index 0000000000..86d696bca2
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/centerinRotation.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ objectName: "outer"
+ rotation: 90
+ width: 101; height: 101; color: "blue"
+ anchors.centerIn: parent;
+ anchors.alignWhenCentered: false
+
+ Rectangle {
+ objectName: "inner"
+ width: 50; height: 50; color: "blue"
+ anchors.centerIn: parent;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/crash1.qml b/tests/auto/quick/qquickanchors/data/crash1.qml
new file mode 100644
index 0000000000..98dd6cfa41
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/crash1.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Column {
+ Text {
+ text: "foo"
+ anchors.fill: parent
+ }
+ Text {
+ text: "bar"
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/fill.qml b/tests/auto/quick/qquickanchors/data/fill.qml
new file mode 100644
index 0000000000..08db199d7b
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/fill.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ objectName: "filler"
+ width: 50; height: 50; color: "blue"
+ anchors.fill: parent;
+ anchors.leftMargin: 10;
+ anchors.rightMargin: 20;
+ anchors.topMargin: 30;
+ anchors.bottomMargin: 40;
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/hvCenter.qml b/tests/auto/quick/qquickanchors/data/hvCenter.qml
new file mode 100644
index 0000000000..6763f8eb75
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/hvCenter.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 77; height: 95
+ Rectangle {
+ objectName: "centered"
+ width: 57; height: 57; color: "blue"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/individualMargins.qml b/tests/auto/quick/qquickanchors/data/individualMargins.qml
new file mode 100644
index 0000000000..ce2899afe4
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/individualMargins.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ objectName: "filler"
+ width: 50; height: 50; color: "blue"
+ anchors.left: parent.left;
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.margins: 10
+ anchors.leftMargin: 5
+ anchors.topMargin: 6
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/loop1.qml b/tests/auto/quick/qquickanchors/data/loop1.qml
new file mode 100644
index 0000000000..342b2af052
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/loop1.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Rectangle {
+ 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/quick/qquickanchors/data/loop2.qml b/tests/auto/quick/qquickanchors/data/loop2.qml
new file mode 100644
index 0000000000..044152989e
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/loop2.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container;
+ width: 600;
+ height: 600;
+
+ Image {
+ id: image1
+ source: "http://labs.qt.nokia.com/blogs/wp-content/uploads/2009/03/3311388091_ac2a257feb.jpg"
+ anchors.right: image2.left
+ }
+
+ Image {
+ id: image2
+ source: "http://labs.qt.nokia.com/blogs/wp-content/uploads/2009/03/oslo_groupphoto.jpg"
+ anchors.left: image1.right
+ anchors.leftMargin: 20
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/margins.qml b/tests/auto/quick/qquickanchors/data/margins.qml
new file mode 100644
index 0000000000..9403f65a61
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/margins.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ objectName: "filler"
+ width: 50; height: 50; color: "blue"
+ anchors.fill: parent;
+ anchors.margins: 10
+ anchors.leftMargin: 5
+ anchors.topMargin: 6
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/data/stretch.qml b/tests/auto/quick/qquickanchors/data/stretch.qml
new file mode 100644
index 0000000000..64e23e30b5
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/data/stretch.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ Rectangle {
+ id: rect1
+ x: 20; y: 20;
+ height: 360; width: 360;
+
+ Rectangle {
+ id: rect2; objectName: "stretcher"
+ anchors.verticalCenter: rect1.verticalCenter
+ anchors.bottom: rect3.top
+ anchors.horizontalCenter: rect1.horizontalCenter
+ anchors.left: rect3.left
+ }
+
+ Rectangle {
+ id: rect3
+ x: 160; y: 230
+ width: 10
+ height: 10
+ }
+
+ Rectangle {
+ id: rect4; objectName: "stretcher2"
+ anchors.verticalCenter: rect1.verticalCenter
+ anchors.top: rect5.top
+ }
+
+ Rectangle {
+ id: rect5
+ x: 160; y: 130
+ width: 10
+ height: 10
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanchors/qquickanchors.pro b/tests/auto/quick/qquickanchors/qquickanchors.pro
new file mode 100644
index 0000000000..b2e1c9df36
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/qquickanchors.pro
@@ -0,0 +1,15 @@
+TARGET = tst_qquickanchors
+CONFIG += testcase
+SOURCES += tst_qquickanchors.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private v8-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
new file mode 100644
index 0000000000..ee277ecd9b
--- /dev/null
+++ b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
@@ -0,0 +1,820 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <private/qquickitem_p.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickanchors_p_p.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include "../../shared/util.h"
+#include "../shared/visualtestutil.h"
+
+Q_DECLARE_METATYPE(QQuickAnchors::Anchor)
+Q_DECLARE_METATYPE(QQuickAnchorLine::AnchorLine)
+
+using namespace QQuickVisualTestUtil;
+
+class tst_qquickanchors : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickanchors() {}
+
+private slots:
+ void basicAnchors();
+ void basicAnchorsRTL();
+ void loops();
+ void illegalSets();
+ void illegalSets_data();
+ void reset();
+ void reset_data();
+ void resetConvenience();
+ void nullItem();
+ void nullItem_data();
+ void crash1();
+ void centerIn();
+ void centerInRTL();
+ void centerInRotation();
+ void hvCenter();
+ void hvCenterRTL();
+ void fill();
+ void fillRTL();
+ void margins_data();
+ void margins();
+ void marginsRTL_data() { margins_data(); }
+ void marginsRTL();
+ void stretch();
+ void baselineOffset();
+};
+
+void tst_qquickanchors::basicAnchors()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("anchors.qml"));
+
+ qApp->processEvents();
+
+ //sibling horizontal
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect1"))->x(), 26.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect2"))->x(), 122.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect3"))->x(), 74.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect4"))->x(), 16.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect5"))->x(), 112.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect6"))->x(), 64.0);
+
+ //parent horizontal
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect7"))->x(), 0.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect8"))->x(), 240.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect9"))->x(), 120.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect10"))->x(), -10.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect11"))->x(), 230.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect12"))->x(), 110.0);
+
+ //vertical
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect13"))->y(), 20.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect14"))->y(), 155.0);
+
+ //stretch
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect15"))->x(), 26.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect15"))->width(), 96.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect16"))->x(), 26.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect16"))->width(), 192.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect17"))->x(), -70.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect17"))->width(), 192.0);
+
+ //vertical stretch
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect18"))->y(), 20.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect18"))->height(), 40.0);
+
+ //more parent horizontal
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect19"))->x(), 115.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect20"))->x(), 235.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect21"))->x(), -5.0);
+
+ //centerIn
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect22"))->x(), 69.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect22"))->y(), 5.0);
+
+ //margins
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect23"))->x(), 31.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect23"))->y(), 5.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect23"))->width(), 86.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect23"))->height(), 10.0);
+
+ // offsets
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect24"))->x(), 26.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect25"))->y(), 60.0);
+ QCOMPARE(findItem<QQuickRectangle>(view->rootObject(), QLatin1String("rect26"))->y(), 5.0);
+
+ //baseline
+ QQuickText *text1 = findItem<QQuickText>(view->rootObject(), QLatin1String("text1"));
+ QQuickText *text2 = findItem<QQuickText>(view->rootObject(), QLatin1String("text2"));
+ QCOMPARE(text1->y(), text2->y());
+
+ delete view;
+}
+
+QQuickItem* childItem(QQuickItem *parentItem, const char * itemString) {
+ return findItem<QQuickItem>(parentItem, QLatin1String(itemString));
+}
+
+qreal offsetMasterRTL(QQuickItem *rootItem, const char * itemString) {
+ QQuickItem* masterItem = findItem<QQuickItem>(rootItem, QLatin1String("masterRect"));
+ return masterItem->width()+2*masterItem->x()-findItem<QQuickItem>(rootItem, QLatin1String(itemString))->width();
+}
+
+qreal offsetParentRTL(QQuickItem *rootItem, const char * itemString) {
+ return rootItem->width()+2*rootItem->x()-findItem<QQuickItem>(rootItem, QLatin1String(itemString))->width();
+}
+
+void mirrorAnchors(QQuickItem *item) {
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ itemPrivate->setLayoutMirror(true);
+}
+
+void tst_qquickanchors::basicAnchorsRTL()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("anchors.qml"));
+
+ qApp->processEvents();
+
+ QQuickItem* rootItem = qobject_cast<QQuickItem*>(view->rootObject());
+ foreach (QObject *child, rootItem->children()) {
+ bool mirrored = QQuickItemPrivate::get(qobject_cast<QQuickItem*>(child))->anchors()->mirrored();
+ QCOMPARE(mirrored, false);
+ }
+
+ foreach (QObject *child, rootItem->children())
+ mirrorAnchors(qobject_cast<QQuickItem*>(child));
+
+ foreach (QObject *child, rootItem->children()) {
+ bool mirrored = QQuickItemPrivate::get(qobject_cast<QQuickItem*>(child))->anchors()->mirrored();
+ QCOMPARE(mirrored, true);
+ }
+
+ //sibling horizontal
+ QCOMPARE(childItem(rootItem, "rect1")->x(), offsetMasterRTL(rootItem, "rect1")-26.0);
+ QCOMPARE(childItem(rootItem, "rect2")->x(), offsetMasterRTL(rootItem, "rect2")-122.0);
+ QCOMPARE(childItem(rootItem, "rect3")->x(), offsetMasterRTL(rootItem, "rect3")-74.0);
+ QCOMPARE(childItem(rootItem, "rect4")->x(), offsetMasterRTL(rootItem, "rect4")-16.0);
+ QCOMPARE(childItem(rootItem, "rect5")->x(), offsetMasterRTL(rootItem, "rect5")-112.0);
+ QCOMPARE(childItem(rootItem, "rect6")->x(), offsetMasterRTL(rootItem, "rect6")-64.0);
+
+ //parent horizontal
+ QCOMPARE(childItem(rootItem, "rect7")->x(), offsetParentRTL(rootItem, "rect7")-0.0);
+ QCOMPARE(childItem(rootItem, "rect8")->x(), offsetParentRTL(rootItem, "rect8")-240.0);
+ QCOMPARE(childItem(rootItem, "rect9")->x(), offsetParentRTL(rootItem, "rect9")-120.0);
+ QCOMPARE(childItem(rootItem, "rect10")->x(), offsetParentRTL(rootItem, "rect10")+10.0);
+ QCOMPARE(childItem(rootItem, "rect11")->x(), offsetParentRTL(rootItem, "rect11")-230.0);
+ QCOMPARE(childItem(rootItem, "rect12")->x(), offsetParentRTL(rootItem, "rect12")-110.0);
+
+ //vertical
+ QCOMPARE(childItem(rootItem, "rect13")->y(), 20.0);
+ QCOMPARE(childItem(rootItem, "rect14")->y(), 155.0);
+
+ //stretch
+ QCOMPARE(childItem(rootItem, "rect15")->x(), offsetMasterRTL(rootItem, "rect15")-26.0);
+ QCOMPARE(childItem(rootItem, "rect15")->width(), 96.0);
+ QCOMPARE(childItem(rootItem, "rect16")->x(), offsetMasterRTL(rootItem, "rect16")-26.0);
+ QCOMPARE(childItem(rootItem, "rect16")->width(), 192.0);
+ QCOMPARE(childItem(rootItem, "rect17")->x(), offsetMasterRTL(rootItem, "rect17")+70.0);
+ QCOMPARE(childItem(rootItem, "rect17")->width(), 192.0);
+
+ //vertical stretch
+ QCOMPARE(childItem(rootItem, "rect18")->y(), 20.0);
+ QCOMPARE(childItem(rootItem, "rect18")->height(), 40.0);
+
+ //more parent horizontal
+ QCOMPARE(childItem(rootItem, "rect19")->x(), offsetParentRTL(rootItem, "rect19")-115.0);
+ QCOMPARE(childItem(rootItem, "rect20")->x(), offsetParentRTL(rootItem, "rect20")-235.0);
+ QCOMPARE(childItem(rootItem, "rect21")->x(), offsetParentRTL(rootItem, "rect21")+5.0);
+
+ //centerIn
+ QCOMPARE(childItem(rootItem, "rect22")->x(), offsetMasterRTL(rootItem, "rect22")-69.0);
+ QCOMPARE(childItem(rootItem, "rect22")->y(), 5.0);
+
+ //margins
+ QCOMPARE(childItem(rootItem, "rect23")->x(), offsetMasterRTL(rootItem, "rect23")-31.0);
+ QCOMPARE(childItem(rootItem, "rect23")->y(), 5.0);
+ QCOMPARE(childItem(rootItem, "rect23")->width(), 86.0);
+ QCOMPARE(childItem(rootItem, "rect23")->height(), 10.0);
+
+ // offsets
+ QCOMPARE(childItem(rootItem, "rect24")->x(), offsetMasterRTL(rootItem, "rect24")-26.0);
+ QCOMPARE(childItem(rootItem, "rect25")->y(), 60.0);
+ QCOMPARE(childItem(rootItem, "rect26")->y(), 5.0);
+
+ //baseline
+ QQuickText *text1 = findItem<QQuickText>(rootItem, QLatin1String("text1"));
+ QQuickText *text2 = findItem<QQuickText>(rootItem, QLatin1String("text2"));
+ QCOMPARE(text1->y(), text2->y());
+
+ delete view;
+}
+
+// mostly testing that we don't crash
+void tst_qquickanchors::loops()
+{
+ {
+ QUrl source(testFileUrl("loop1.qml"));
+
+ QString expect = source.toString() + ":6:5: QML Text: Possible anchor loop detected on horizontal anchor.";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
+
+ QQuickView *view = new QQuickView;
+ view->setSource(source);
+ qApp->processEvents();
+
+ delete view;
+ }
+
+ {
+ QUrl source(testFileUrl("loop2.qml"));
+
+ QString expect = source.toString() + ":8:3: QML Image: Possible anchor loop detected on horizontal anchor.";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
+
+ QQuickView *view = new QQuickView;
+ view->setSource(source);
+ qApp->processEvents();
+
+ delete view;
+ }
+}
+
+void tst_qquickanchors::illegalSets()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, warning);
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQuick 2.0\n" + qml.toUtf8()), QUrl::fromLocalFile(""));
+ if (!component.isReady())
+ qWarning() << "Test errors:" << component.errors();
+ QVERIFY(component.isReady());
+ QObject *o = component.create();
+ delete o;
+}
+
+void tst_qquickanchors::illegalSets_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("warning");
+
+ QTest::newRow("H - too many anchors")
+ << "Rectangle { id: rect; Rectangle { anchors.left: rect.left; anchors.right: rect.right; anchors.horizontalCenter: rect.horizontalCenter } }"
+ << "file::2:23: QML Rectangle: Cannot specify left, right, and horizontalCenter anchors at the same time.";
+
+ foreach (const QString &side, QStringList() << "left" << "right") {
+ QTest::newRow("H - anchor to V")
+ << QString("Rectangle { Rectangle { anchors.%1: parent.top } }").arg(side)
+ << "file::2:13: QML Rectangle: Cannot anchor a horizontal edge to a vertical edge.";
+
+ QTest::newRow("H - anchor to non parent/sibling")
+ << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side)
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
+
+ QTest::newRow("H - anchor to self")
+ << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side)
+ << "file::2:1: QML Rectangle: Cannot anchor item to self.";
+ }
+
+
+ QTest::newRow("V - too many anchors")
+ << "Rectangle { id: rect; Rectangle { anchors.top: rect.top; anchors.bottom: rect.bottom; anchors.verticalCenter: rect.verticalCenter } }"
+ << "file::2:23: QML Rectangle: Cannot specify top, bottom, and verticalCenter anchors at the same time.";
+
+ QTest::newRow("V - too many anchors with baseline")
+ << "Rectangle { Text { id: text1; text: \"Hello\" } Text { anchors.baseline: text1.baseline; anchors.top: text1.top; } }"
+ << "file::2:47: QML Text: Baseline anchor cannot be used in conjunction with top, bottom, or verticalCenter anchors.";
+
+ foreach (const QString &side, QStringList() << "top" << "bottom" << "baseline") {
+
+ QTest::newRow("V - anchor to H")
+ << QString("Rectangle { Rectangle { anchors.%1: parent.left } }").arg(side)
+ << "file::2:13: QML Rectangle: Cannot anchor a vertical edge to a horizontal edge.";
+
+ QTest::newRow("V - anchor to non parent/sibling")
+ << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side)
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
+
+ QTest::newRow("V - anchor to self")
+ << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side)
+ << "file::2:1: QML Rectangle: Cannot anchor item to self.";
+ }
+
+
+ QTest::newRow("centerIn - anchor to non parent/sibling")
+ << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.centerIn: rect} }"
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
+
+
+ QTest::newRow("fill - anchor to non parent/sibling")
+ << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.fill: rect} }"
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
+}
+
+void tst_qquickanchors::reset()
+{
+ QFETCH(QString, side);
+ QFETCH(QQuickAnchorLine::AnchorLine, anchorLine);
+ QFETCH(QQuickAnchors::Anchor, usedAnchor);
+
+ QQuickItem *baseItem = new QQuickItem;
+
+ QQuickAnchorLine anchor;
+ anchor.item = baseItem;
+ anchor.anchorLine = anchorLine;
+
+ QQuickItem *item = new QQuickItem;
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+
+ const QMetaObject *meta = itemPrivate->anchors()->metaObject();
+ QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData()));
+
+ QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchor)));
+ QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(usedAnchor), true);
+
+ QVERIFY(p.reset(itemPrivate->anchors()));
+ QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(usedAnchor), false);
+
+ delete item;
+ delete baseItem;
+}
+
+void tst_qquickanchors::reset_data()
+{
+ QTest::addColumn<QString>("side");
+ QTest::addColumn<QQuickAnchorLine::AnchorLine>("anchorLine");
+ QTest::addColumn<QQuickAnchors::Anchor>("usedAnchor");
+
+ QTest::newRow("left") << "left" << QQuickAnchorLine::Left << QQuickAnchors::LeftAnchor;
+ QTest::newRow("top") << "top" << QQuickAnchorLine::Top << QQuickAnchors::TopAnchor;
+ QTest::newRow("right") << "right" << QQuickAnchorLine::Right << QQuickAnchors::RightAnchor;
+ QTest::newRow("bottom") << "bottom" << QQuickAnchorLine::Bottom << QQuickAnchors::BottomAnchor;
+
+ QTest::newRow("hcenter") << "horizontalCenter" << QQuickAnchorLine::HCenter << QQuickAnchors::HCenterAnchor;
+ QTest::newRow("vcenter") << "verticalCenter" << QQuickAnchorLine::VCenter << QQuickAnchors::VCenterAnchor;
+ QTest::newRow("baseline") << "baseline" << QQuickAnchorLine::Baseline << QQuickAnchors::BaselineAnchor;
+}
+
+void tst_qquickanchors::resetConvenience()
+{
+ QQuickItem *baseItem = new QQuickItem;
+ QQuickItem *item = new QQuickItem;
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+
+ //fill
+ itemPrivate->anchors()->setFill(baseItem);
+ QVERIFY(itemPrivate->anchors()->fill() == baseItem);
+ itemPrivate->anchors()->resetFill();
+ QVERIFY(itemPrivate->anchors()->fill() == 0);
+
+ //centerIn
+ itemPrivate->anchors()->setCenterIn(baseItem);
+ QVERIFY(itemPrivate->anchors()->centerIn() == baseItem);
+ itemPrivate->anchors()->resetCenterIn();
+ QVERIFY(itemPrivate->anchors()->centerIn() == 0);
+
+ delete item;
+ delete baseItem;
+}
+
+void tst_qquickanchors::nullItem()
+{
+ QFETCH(QString, side);
+
+ QQuickAnchorLine anchor;
+ QQuickItem *item = new QQuickItem;
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+
+ const QMetaObject *meta = itemPrivate->anchors()->metaObject();
+ QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData()));
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML Item: Cannot anchor to a null item.");
+ QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchor)));
+
+ delete item;
+}
+
+void tst_qquickanchors::nullItem_data()
+{
+ QTest::addColumn<QString>("side");
+
+ QTest::newRow("left") << "left";
+ QTest::newRow("top") << "top";
+ QTest::newRow("right") << "right";
+ QTest::newRow("bottom") << "bottom";
+
+ QTest::newRow("hcenter") << "horizontalCenter";
+ QTest::newRow("vcenter") << "verticalCenter";
+ QTest::newRow("baseline") << "baseline";
+}
+
+//QTBUG-5428
+void tst_qquickanchors::crash1()
+{
+ QUrl source(testFileUrl("crash1.qml"));
+
+ QQuickView *view = new QQuickView(source);
+ qApp->processEvents();
+
+ delete view;
+}
+
+void tst_qquickanchors::fill()
+{
+ QQuickView *view = new QQuickView(testFileUrl("fill.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("filler"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 10.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 30.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 20.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 40.0);
+ QCOMPARE(rect->x(), 0.0 + 10.0);
+ QCOMPARE(rect->y(), 0.0 + 30.0);
+ QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0);
+ QCOMPARE(rect->height(), 200.0 - 30.0 - 40.0);
+ //Alter Offsets (tests QTBUG-6631)
+ rectPrivate->anchors()->setLeftMargin(20.0);
+ rectPrivate->anchors()->setRightMargin(0.0);
+ rectPrivate->anchors()->setBottomMargin(0.0);
+ rectPrivate->anchors()->setTopMargin(10.0);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 20.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 10.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 0.0);
+ QCOMPARE(rect->x(), 0.0 + 20.0);
+ QCOMPARE(rect->y(), 0.0 + 10.0);
+ QCOMPARE(rect->width(), 200.0 - 20.0);
+ QCOMPARE(rect->height(), 200.0 - 10.0);
+
+ delete view;
+}
+
+void tst_qquickanchors::fillRTL()
+{
+ QQuickView *view = new QQuickView(testFileUrl("fill.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("filler"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ mirrorAnchors(rect);
+
+ QCOMPARE(rect->x(), 0.0 + 20.0);
+ QCOMPARE(rect->y(), 0.0 + 30.0);
+ QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0);
+ QCOMPARE(rect->height(), 200.0 - 30.0 - 40.0);
+ //Alter Offsets (tests QTBUG-6631)
+ rectPrivate->anchors()->setLeftMargin(20.0);
+ rectPrivate->anchors()->setRightMargin(0.0);
+ rectPrivate->anchors()->setBottomMargin(0.0);
+ rectPrivate->anchors()->setTopMargin(10.0);
+ QCOMPARE(rect->x(), 0.0 + 0.0);
+ QCOMPARE(rect->y(), 0.0 + 10.0);
+ QCOMPARE(rect->width(), 200.0 - 20.0);
+ QCOMPARE(rect->height(), 200.0 - 10.0);
+
+ delete view;
+}
+
+void tst_qquickanchors::centerIn()
+{
+ QQuickView *view = new QQuickView(testFileUrl("centerin.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QCOMPARE(rectPrivate->anchors()->horizontalCenterOffset(), 10.0);
+ QCOMPARE(rectPrivate->anchors()->verticalCenterOffset(), 30.0);
+ QCOMPARE(rect->x(), 75.0 + 10);
+ QCOMPARE(rect->y(), 75.0 + 30);
+ //Alter Offsets (tests QTBUG-6631)
+ rectPrivate->anchors()->setHorizontalCenterOffset(-20.0);
+ rectPrivate->anchors()->setVerticalCenterOffset(-10.0);
+ QCOMPARE(rectPrivate->anchors()->horizontalCenterOffset(), -20.0);
+ QCOMPARE(rectPrivate->anchors()->verticalCenterOffset(), -10.0);
+ QCOMPARE(rect->x(), 75.0 - 20.0);
+ QCOMPARE(rect->y(), 75.0 - 10.0);
+
+ // By default center aligned to pixel
+ QQuickRectangle* rect2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered2"));
+ QCOMPARE(rect2->x(), 94.0);
+ QCOMPARE(rect2->y(), 94.0);
+
+ //QTBUG-21730 (use actual center to prevent animation jitter)
+ QQuickRectangle* rect3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered3"));
+ QCOMPARE(rect3->x(), 94.5);
+ QCOMPARE(rect3->y(), 94.5);
+
+ delete view;
+}
+
+void tst_qquickanchors::centerInRTL()
+{
+ QQuickView *view = new QQuickView(testFileUrl("centerin.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ mirrorAnchors(rect);
+
+ QCOMPARE(rect->x(), 75.0 - 10);
+ QCOMPARE(rect->y(), 75.0 + 30);
+ //Alter Offsets (tests QTBUG-6631)
+ rectPrivate->anchors()->setHorizontalCenterOffset(-20.0);
+ rectPrivate->anchors()->setVerticalCenterOffset(-10.0);
+ QCOMPARE(rect->x(), 75.0 + 20.0);
+ QCOMPARE(rect->y(), 75.0 - 10.0);
+
+ delete view;
+}
+
+//QTBUG-12441
+void tst_qquickanchors::centerInRotation()
+{
+ QQuickView *view = new QQuickView(testFileUrl("centerinRotation.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* outer = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("outer"));
+ QQuickRectangle* inner = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("inner"));
+
+ QCOMPARE(outer->x(), qreal(49.5));
+ QCOMPARE(outer->y(), qreal(49.5));
+ QCOMPARE(inner->x(), qreal(25.5));
+ QCOMPARE(inner->y(), qreal(25.5));
+
+ delete view;
+}
+
+void tst_qquickanchors::hvCenter()
+{
+ QQuickView *view = new QQuickView(testFileUrl("hvCenter.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ // test QTBUG-10999
+ QCOMPARE(rect->x(), 10.0);
+ QCOMPARE(rect->y(), 19.0);
+
+ rectPrivate->anchors()->setHorizontalCenterOffset(-5.0);
+ rectPrivate->anchors()->setVerticalCenterOffset(5.0);
+ QCOMPARE(rect->x(), 10.0 - 5.0);
+ QCOMPARE(rect->y(), 19.0 + 5.0);
+
+ delete view;
+}
+
+void tst_qquickanchors::hvCenterRTL()
+{
+ QQuickView *view = new QQuickView(testFileUrl("hvCenter.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("centered"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ mirrorAnchors(rect);
+
+ // test QTBUG-10999
+ QCOMPARE(rect->x(), 10.0);
+ QCOMPARE(rect->y(), 19.0);
+
+ rectPrivate->anchors()->setHorizontalCenterOffset(-5.0);
+ rectPrivate->anchors()->setVerticalCenterOffset(5.0);
+ QCOMPARE(rect->x(), 10.0 + 5.0);
+ QCOMPARE(rect->y(), 19.0 + 5.0);
+
+ delete view;
+}
+
+void tst_qquickanchors::margins_data()
+{
+ QTest::addColumn<QUrl>("source");
+
+ QTest::newRow("fill") << testFileUrl("margins.qml");
+ QTest::newRow("individual") << testFileUrl("individualMargins.qml");
+}
+
+void tst_qquickanchors::margins()
+{
+ QFETCH(QUrl, source);
+ QQuickView *view = new QQuickView(source);
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("filler"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QCOMPARE(rectPrivate->anchors()->margins(), 10.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 6.0);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 5.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 10.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 10.0);
+ QCOMPARE(rect->x(), 5.0);
+ QCOMPARE(rect->y(), 6.0);
+ QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0);
+ QCOMPARE(rect->height(), 200.0 - 6.0 - 10.0);
+
+ rectPrivate->anchors()->setTopMargin(0.0);
+ rectPrivate->anchors()->setMargins(20.0);
+
+ QCOMPARE(rectPrivate->anchors()->margins(), 20.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 5.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 20.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 20.0);
+ QCOMPARE(rect->x(), 5.0);
+ QCOMPARE(rect->y(), 0.0);
+ QCOMPARE(rect->width(), 200.0 - 5.0 - 20.0);
+ QCOMPARE(rect->height(), 200.0 - 0.0 - 20.0);
+
+ rectPrivate->anchors()->setRightMargin(0.0);
+ rectPrivate->anchors()->setBottomMargin(0.0);
+ QCOMPARE(rectPrivate->anchors()->margins(), 20.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 5.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 0.0);
+ QCOMPARE(rect->x(), 5.0);
+ QCOMPARE(rect->y(), 0.0);
+ QCOMPARE(rect->width(), 200.0 - 5.0 - 0.0);
+ QCOMPARE(rect->height(), 200.0 - 0.0 - 0.0);
+
+ // Test setting margins doesn't have any effect on individual margins with explicit values.
+ rectPrivate->anchors()->setMargins(50.0);
+ QCOMPARE(rectPrivate->anchors()->margins(), 50.0);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 5.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 0.0);
+ QCOMPARE(rect->x(), 0.0 + 5.0);
+ QCOMPARE(rect->y(), 0.0 + 0.0);
+ QCOMPARE(rect->width(), 200.0 - 5.0 - 0.0);
+ QCOMPARE(rect->height(), 200.0 - 0.0 - 0.0);
+
+ // Test that individual margins that are reset have the same value as margins.
+ rectPrivate->anchors()->resetLeftMargin();
+ rectPrivate->anchors()->resetBottomMargin();
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 50.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 50.0);
+ QCOMPARE(rect->x(), 0.0 + 50.0);
+ QCOMPARE(rect->y(), 0.0 + 0.0);
+ QCOMPARE(rect->width(), 200.0 - 50.0 - 0.0);
+ QCOMPARE(rect->height(), 200.0 - 0.0 - 50.0);
+
+ rectPrivate->anchors()->setMargins(30.0);
+ QCOMPARE(rectPrivate->anchors()->margins(), 30.0);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 30.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 0.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 30.0);
+ QCOMPARE(rect->x(), 0.0 + 30.0);
+ QCOMPARE(rect->y(), 0.0 + 0.0);
+ QCOMPARE(rect->width(), 200.0 - 30.0 - 0.0);
+ QCOMPARE(rect->height(), 200.0 - 0.0 - 30.0);
+
+ rectPrivate->anchors()->resetTopMargin();
+ rectPrivate->anchors()->resetRightMargin();
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 30.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 30.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 30.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 30.0);
+ QCOMPARE(rect->x(), 0.0 + 30.0);
+ QCOMPARE(rect->y(), 0.0 + 30.0);
+ QCOMPARE(rect->width(), 200.0 - 30.0 - 30.0);
+ QCOMPARE(rect->height(), 200.0 - 30.0 - 30.0);
+
+ rectPrivate->anchors()->setMargins(25.0);
+ QCOMPARE(rectPrivate->anchors()->margins(), 25.0);
+ QCOMPARE(rectPrivate->anchors()->leftMargin(), 25.0);
+ QCOMPARE(rectPrivate->anchors()->topMargin(), 25.0);
+ QCOMPARE(rectPrivate->anchors()->rightMargin(), 25.0);
+ QCOMPARE(rectPrivate->anchors()->bottomMargin(), 25.0);
+ QCOMPARE(rect->x(), 0.0 + 25.0);
+ QCOMPARE(rect->y(), 0.0 + 25.0);
+ QCOMPARE(rect->width(), 200.0 - 25.0 - 25.0);
+ QCOMPARE(rect->height(), 200.0 - 25.0 - 25.0);
+
+ delete view;
+}
+
+void tst_qquickanchors::marginsRTL()
+{
+ QFETCH(QUrl, source);
+ QQuickView *view = new QQuickView(source);
+
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("filler"));
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ mirrorAnchors(rect);
+
+ QCOMPARE(rect->x(), 10.0);
+ QCOMPARE(rect->y(), 6.0);
+ QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0);
+ QCOMPARE(rect->height(), 200.0 - 6.0 - 10.0);
+
+ rectPrivate->anchors()->setTopMargin(0.0);
+ rectPrivate->anchors()->setMargins(20.0);
+
+ QCOMPARE(rect->x(), 20.0);
+ QCOMPARE(rect->y(), 0.0);
+ QCOMPARE(rect->width(), 200.0 - 5.0 - 20.0);
+ QCOMPARE(rect->height(), 200.0 - 0.0 - 20.0);
+
+ delete view;
+}
+
+void tst_qquickanchors::stretch()
+{
+ QQuickView *view = new QQuickView(testFileUrl("stretch.qml"));
+
+ qApp->processEvents();
+ QQuickRectangle* rect = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("stretcher"));
+ QCOMPARE(rect->x(), 160.0);
+ QCOMPARE(rect->y(), 130.0);
+ QCOMPARE(rect->width(), 40.0);
+ QCOMPARE(rect->height(), 100.0);
+
+ QQuickRectangle* rect2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("stretcher2"));
+ QCOMPARE(rect2->y(), 130.0);
+ QCOMPARE(rect2->height(), 100.0);
+
+ delete view;
+}
+
+void tst_qquickanchors::baselineOffset()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("baselineOffset.qml"));
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+
+ QQuickItem *anchoredItem = findItem<QQuickItem>(item, QLatin1String("baselineAnchored"));
+
+ QCOMPARE(anchoredItem->baselineOffset(), 0.0);
+ QCOMPARE(anchoredItem->y(), 100.0);
+
+ anchoredItem->setBaselineOffset(5);
+ QCOMPARE(anchoredItem->baselineOffset(), 5.0);
+ QCOMPARE(anchoredItem->y(), 95.0);
+
+ anchoredItem->setBaselineOffset(10);
+ QCOMPARE(anchoredItem->baselineOffset(), 10.0);
+ QCOMPARE(anchoredItem->y(), 90.0);
+}
+
+QTEST_MAIN(tst_qquickanchors)
+
+#include "tst_qquickanchors.moc"
diff --git a/tests/auto/quick/qquickanimatedimage/data/colors.gif b/tests/auto/quick/qquickanimatedimage/data/colors.gif
new file mode 100644
index 0000000000..1270bfaa79
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/colors.gif
Binary files differ
diff --git a/tests/auto/quick/qquickanimatedimage/data/colors.qml b/tests/auto/quick/qquickanimatedimage/data/colors.qml
new file mode 100644
index 0000000000..5ccc0148dd
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/colors.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ source: "colors.gif"
+}
diff --git a/tests/auto/quick/qquickanimatedimage/data/green.png b/tests/auto/quick/qquickanimatedimage/data/green.png
new file mode 100644
index 0000000000..0a2e153ba1
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/green.png
Binary files differ
diff --git a/tests/auto/quick/qquickanimatedimage/data/hearts.gif b/tests/auto/quick/qquickanimatedimage/data/hearts.gif
new file mode 100644
index 0000000000..cfb55f27f5
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/hearts.gif
Binary files differ
diff --git a/tests/auto/quick/qquickanimatedimage/data/hearts.qml b/tests/auto/quick/qquickanimatedimage/data/hearts.qml
new file mode 100644
index 0000000000..717bab430b
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/hearts.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ source: "hearts.gif"
+ playing: false
+}
diff --git a/tests/auto/quick/qquickanimatedimage/data/hearts_copy.gif b/tests/auto/quick/qquickanimatedimage/data/hearts_copy.gif
new file mode 100644
index 0000000000..cfb55f27f5
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/hearts_copy.gif
Binary files differ
diff --git a/tests/auto/quick/qquickanimatedimage/data/qmldir b/tests/auto/quick/qquickanimatedimage/data/qmldir
new file mode 100644
index 0000000000..ef7c1f44f3
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/qmldir
@@ -0,0 +1 @@
+# No local types
diff --git a/tests/auto/quick/qquickanimatedimage/data/qtbug-16520.qml b/tests/auto/quick/qquickanimatedimage/data/qtbug-16520.qml
new file mode 100644
index 0000000000..da77a4063b
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/qtbug-16520.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 500
+ height: 500
+
+ AnimatedImage {
+ objectName: "anim"
+ anchors.centerIn: parent
+ asynchronous: true
+ opacity: status == AnimatedImage.Ready ? 1 : 0
+
+ Behavior on opacity {
+ NumberAnimation { duration: 1000 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimatedimage/data/stickman.gif b/tests/auto/quick/qquickanimatedimage/data/stickman.gif
new file mode 100644
index 0000000000..7c4cd18687
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/stickman.gif
Binary files differ
diff --git a/tests/auto/quick/qquickanimatedimage/data/stickman.qml b/tests/auto/quick/qquickanimatedimage/data/stickman.qml
new file mode 100644
index 0000000000..a47924de21
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/stickman.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ source: "stickman.gif"
+}
diff --git a/tests/auto/quick/qquickanimatedimage/data/stickmanerror1.qml b/tests/auto/quick/qquickanimatedimage/data/stickmanerror1.qml
new file mode 100644
index 0000000000..4f823b3d70
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/stickmanerror1.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ sourceSize: "240x180"
+ source: "stickman.gif"
+}
diff --git a/tests/auto/quick/qquickanimatedimage/data/stickmanpause.qml b/tests/auto/quick/qquickanimatedimage/data/stickmanpause.qml
new file mode 100644
index 0000000000..ef771ed56f
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/stickmanpause.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ source: "stickman.gif"
+ paused: true
+ currentFrame: 2
+}
diff --git a/tests/auto/quick/qquickanimatedimage/data/stickmanscaled.qml b/tests/auto/quick/qquickanimatedimage/data/stickmanscaled.qml
new file mode 100644
index 0000000000..1ef1f95165
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/stickmanscaled.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ width: 240
+ height: 180
+ source: "stickman.gif"
+}
diff --git a/tests/auto/quick/qquickanimatedimage/data/stickmanstopped.qml b/tests/auto/quick/qquickanimatedimage/data/stickmanstopped.qml
new file mode 100644
index 0000000000..0bf80b8972
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/data/stickmanstopped.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+AnimatedImage {
+ source: "stickman.gif"
+ playing: false
+}
diff --git a/tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro b/tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro
new file mode 100644
index 0000000000..83607137e1
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/qquickanimatedimage.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickanimatedimage
+HEADERS += ../../shared/testhttpserver.h
+SOURCES += tst_qquickanimatedimage.cpp \
+ ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
new file mode 100644
index 0000000000..201287b2a8
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
@@ -0,0 +1,535 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <private/qquickimage_p.h>
+#include <private/qquickanimatedimage_p.h>
+#include <QSignalSpy>
+#include <QtQml/qqmlcontext.h>
+
+#include "../../shared/testhttpserver.h"
+#include "../../shared/util.h"
+
+Q_DECLARE_METATYPE(QQuickImageBase::Status)
+
+class tst_qquickanimatedimage : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickanimatedimage() {}
+
+private slots:
+ void cleanup();
+ void play();
+ void pause();
+ void stopped();
+ void setFrame();
+ void frameCount();
+ void mirror_running();
+ void mirror_notRunning();
+ void mirror_notRunning_data();
+ void remote();
+ void remote_data();
+ void sourceSize();
+ void sourceSizeChanges();
+ void sourceSizeReadOnly();
+ void invalidSource();
+ void qtbug_16520();
+ void progressAndStatusChanges();
+ void playingAndPausedChanges();
+};
+
+void tst_qquickanimatedimage::cleanup()
+{
+ QQuickWindow window;
+ window.releaseResources();
+}
+
+void tst_qquickanimatedimage::play()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stickman.qml"));
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+ QVERIFY(anim->isPlaying());
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::pause()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stickmanpause.qml"));
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+
+ QTRY_VERIFY(anim->isPaused());
+ QTRY_VERIFY(anim->isPlaying());
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::stopped()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stickmanstopped.qml"));
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+ QTRY_VERIFY(!anim->isPlaying());
+ QCOMPARE(anim->currentFrame(), 0);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::setFrame()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stickmanpause.qml"));
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+ QVERIFY(anim->isPlaying());
+ QCOMPARE(anim->currentFrame(), 2);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::frameCount()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("colors.qml"));
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+ QVERIFY(anim->isPlaying());
+ QCOMPARE(anim->frameCount(), 3);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::mirror_running()
+{
+ // test where mirror is set to true after animation has started
+
+ QQuickView window;
+ window.setSource(testFileUrl("hearts.qml"));
+ window.show();
+ QTest::qWaitForWindowExposed(&window);
+
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject());
+ QVERIFY(anim);
+
+ int width = anim->property("width").toInt();
+
+ QCOMPARE(anim->frameCount(), 2);
+
+ QCOMPARE(anim->currentFrame(), 0);
+ QImage frame0 = window.grabWindow();
+
+ anim->setCurrentFrame(1);
+ QCOMPARE(anim->currentFrame(), 1);
+ QImage frame1 = window.grabWindow();
+
+ anim->setCurrentFrame(0);
+
+ QSignalSpy spy(anim, SIGNAL(frameChanged()));
+ QVERIFY(spy.isValid());
+ anim->setPlaying(true);
+
+ QTRY_VERIFY(spy.count() == 1); spy.clear();
+ anim->setMirror(true);
+
+ QCOMPARE(anim->currentFrame(), 1);
+ QImage frame1_flipped = window.grabWindow();
+
+ QTRY_VERIFY(spy.count() == 1); spy.clear();
+ QCOMPARE(anim->currentFrame(), 0); // animation only has 2 frames, should cycle back to first
+ QImage frame0_flipped = window.grabWindow();
+
+ QTransform transform;
+ transform.translate(width, 0).scale(-1, 1.0);
+ QImage frame0_expected = frame0.transformed(transform);
+ QImage frame1_expected = frame1.transformed(transform);
+
+ QCOMPARE(frame0_flipped, frame0_expected);
+ QCOMPARE(frame1_flipped, frame1_expected);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::mirror_notRunning()
+{
+ QFETCH(QUrl, fileUrl);
+
+ QQuickView window;
+ window.show();
+
+ window.setSource(fileUrl);
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject());
+ QVERIFY(anim);
+
+ int width = anim->property("width").toInt();
+ QPixmap screenshot = QPixmap::fromImage(window.grabWindow());
+
+ QTransform transform;
+ transform.translate(width, 0).scale(-1, 1.0);
+ QPixmap expected = screenshot.transformed(transform);
+
+ int frame = anim->currentFrame();
+ bool playing = anim->isPlaying();
+ bool paused = anim->isPlaying();
+
+ anim->setProperty("mirror", true);
+ screenshot = QPixmap::fromImage(window.grabWindow());
+
+ QCOMPARE(screenshot, expected);
+
+ // mirroring should not change the current frame or playing status
+ QCOMPARE(anim->currentFrame(), frame);
+ QCOMPARE(anim->isPlaying(), playing);
+ QCOMPARE(anim->isPaused(), paused);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::mirror_notRunning_data()
+{
+ QTest::addColumn<QUrl>("fileUrl");
+
+ QTest::newRow("paused") << testFileUrl("stickmanpause.qml");
+ QTest::newRow("stopped") << testFileUrl("stickmanstopped.qml");
+}
+
+void tst_qquickanimatedimage::remote_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<bool>("paused");
+
+ QTest::newRow("playing") << "stickman.qml" << false;
+ QTest::newRow("paused") << "stickmanpause.qml" << true;
+}
+
+void tst_qquickanimatedimage::remote()
+{
+ QFETCH(QString, fileName);
+ QFETCH(bool, paused);
+
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, QUrl("http://127.0.0.1:14449/" + fileName));
+ QTRY_VERIFY(component.isReady());
+
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+
+ QTRY_VERIFY(anim->isPlaying());
+ if (paused) {
+ QTRY_VERIFY(anim->isPaused());
+ QCOMPARE(anim->currentFrame(), 2);
+ }
+ QVERIFY(anim->status() != QQuickAnimatedImage::Error);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::sourceSize()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stickmanscaled.qml"));
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+ QCOMPARE(anim->width(),240.0);
+ QCOMPARE(anim->height(),180.0);
+ QCOMPARE(anim->sourceSize(),QSize(160,120));
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::sourceSizeReadOnly()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("stickmanerror1.qml"));
+ QVERIFY(component.isError());
+ QCOMPARE(component.errors().at(0).description(), QString("Invalid property assignment: \"sourceSize\" is a read-only property"));
+}
+
+void tst_qquickanimatedimage::invalidSource()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile(""));
+ QVERIFY(component.isReady());
+
+ QTest::ignoreMessage(QtWarningMsg, "file::2:2: QML AnimatedImage: Error Reading Animated Image File file:no-such-file.gif");
+
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(component.create());
+ QVERIFY(anim);
+
+ QVERIFY(anim->isPlaying());
+ QVERIFY(!anim->isPaused());
+ QCOMPARE(anim->currentFrame(), 0);
+ QCOMPARE(anim->frameCount(), 0);
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Error);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::sourceSizeChanges()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nAnimatedImage { source: srcImage }", QUrl::fromLocalFile(""));
+ QTRY_VERIFY(component.isReady());
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", "");
+ QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage*>(component.create());
+ QVERIFY(anim != 0);
+
+ QSignalSpy sourceSizeSpy(anim, SIGNAL(sourceSizeChanged()));
+
+ // Local
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null);
+ QTRY_VERIFY(sourceSizeSpy.count() == 0);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("hearts_copy.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 2);
+
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null);
+ QTRY_VERIFY(sourceSizeSpy.count() == 3);
+
+ // Remote
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/hearts.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/hearts.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/hearts_copy.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/colors.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_VERIFY(sourceSizeSpy.count() == 5);
+
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null);
+ QTRY_VERIFY(sourceSizeSpy.count() == 6);
+
+ delete anim;
+}
+
+void tst_qquickanimatedimage::qtbug_16520()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("qtbug-16520.qml"));
+ QTRY_VERIFY(component.isReady());
+
+ QQuickRectangle *root = qobject_cast<QQuickRectangle *>(component.create());
+ QVERIFY(root);
+ QQuickAnimatedImage *anim = root->findChild<QQuickAnimatedImage*>("anim");
+ QVERIFY(anim != 0);
+
+ anim->setProperty("source", "http://127.0.0.1:14449/stickman.gif");
+ QTRY_VERIFY(anim->opacity() == 0);
+ QTRY_VERIFY(anim->opacity() == 1);
+
+ delete anim;
+ delete root;
+}
+
+void tst_qquickanimatedimage::progressAndStatusChanges()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nAnimatedImage { source: srcImage }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", testFileUrl("stickman.gif"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+
+ qRegisterMetaType<QQuickImageBase::Status>();
+ QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &)));
+ QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal)));
+ QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QQuickImageBase::Status)));
+
+ // Same image
+ ctxt->setContextProperty("srcImage", testFileUrl("stickman.gif"));
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 0);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 0);
+
+ // Loading local file
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.gif"));
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 1);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 1);
+
+ // Loading remote file
+ ctxt->setContextProperty("srcImage", "http://127.0.0.1:14449/stickman.gif");
+ QTRY_VERIFY(obj->status() == QQuickImage::Loading);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 2);
+ QTRY_VERIFY(progressSpy.count() > 1);
+ QTRY_COMPARE(statusSpy.count(), 3);
+
+ ctxt->setContextProperty("srcImage", "");
+ QTRY_VERIFY(obj->status() == QQuickImage::Null);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_COMPARE(sourceSpy.count(), 3);
+ QTRY_VERIFY(progressSpy.count() > 2);
+ QTRY_COMPARE(statusSpy.count(), 4);
+
+ delete obj;
+}
+
+void tst_qquickanimatedimage::playingAndPausedChanges()
+{
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nAnimatedImage { source: srcImage }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickAnimatedImage *obj = qobject_cast<QQuickAnimatedImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QQuickAnimatedImage::Null);
+ QTRY_VERIFY(obj->isPlaying());
+ QTRY_VERIFY(!obj->isPaused());
+ QSignalSpy playingSpy(obj, SIGNAL(playingChanged()));
+ QSignalSpy pausedSpy(obj, SIGNAL(pausedChanged()));
+
+ // initial state
+ obj->setProperty("playing", true);
+ obj->setProperty("paused", false);
+ QTRY_VERIFY(obj->isPlaying());
+ QTRY_VERIFY(!obj->isPaused());
+ QTRY_COMPARE(playingSpy.count(), 0);
+ QTRY_COMPARE(pausedSpy.count(), 0);
+
+ obj->setProperty("playing", false);
+ obj->setProperty("paused", true);
+ QTRY_VERIFY(!obj->isPlaying());
+ QTRY_VERIFY(obj->isPaused());
+ QTRY_COMPARE(playingSpy.count(), 1);
+ QTRY_COMPARE(pausedSpy.count(), 1);
+
+ obj->setProperty("playing", true);
+ obj->setProperty("paused", false);
+ QTRY_VERIFY(obj->isPlaying());
+ QTRY_VERIFY(!obj->isPaused());
+ QTRY_COMPARE(playingSpy.count(), 2);
+ QTRY_COMPARE(pausedSpy.count(), 2);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("stickman.gif"));
+ QTRY_VERIFY(obj->isPlaying());
+ QTRY_VERIFY(!obj->isPaused());
+ QTRY_COMPARE(playingSpy.count(), 2);
+ QTRY_COMPARE(pausedSpy.count(), 2);
+
+ obj->setProperty("paused", true);
+ QTRY_VERIFY(obj->isPlaying());
+ QTRY_VERIFY(obj->isPaused());
+ QTRY_COMPARE(playingSpy.count(), 2);
+ QTRY_COMPARE(pausedSpy.count(), 3);
+
+ obj->setProperty("playing", false);
+ QTRY_VERIFY(!obj->isPlaying());
+ QTRY_VERIFY(!obj->isPaused());
+ QTRY_COMPARE(playingSpy.count(), 3);
+ QTRY_COMPARE(pausedSpy.count(), 4);
+
+ obj->setProperty("playing", true);
+
+ // Cannot animate this image, playing will be false
+ ctxt->setContextProperty("srcImage", testFileUrl("green.png"));
+ QTRY_VERIFY(!obj->isPlaying());
+ QTRY_VERIFY(!obj->isPaused());
+ QTRY_COMPARE(playingSpy.count(), 5);
+ QTRY_COMPARE(pausedSpy.count(), 4);
+
+ delete obj;
+}
+QTEST_MAIN(tst_qquickanimatedimage)
+
+#include "tst_qquickanimatedimage.moc"
diff --git a/tests/auto/quick/qquickanimatedsprite/data/basic.qml b/tests/auto/quick/qquickanimatedsprite/data/basic.qml
new file mode 100644
index 0000000000..d903230aef
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedsprite/data/basic.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ AnimatedSprite {
+ objectName: "sprite"
+ loops: 30
+ source: "squarefacesprite.png"
+ frameCount: 6
+ frameDuration: 240
+ width: 160
+ height: 160
+ }
+}
diff --git a/tests/auto/quick/qquickanimatedsprite/data/frameChange.qml b/tests/auto/quick/qquickanimatedsprite/data/frameChange.qml
new file mode 100644
index 0000000000..e19d7c268e
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedsprite/data/frameChange.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ AnimatedSprite {
+ objectName: "sprite"
+ source: "squarefacesprite.png"
+ frameCount: 6
+ loops: 3
+ frameSync: true
+ running: false
+ width: 160
+ height: 160
+ }
+}
diff --git a/tests/auto/quick/qquickanimatedsprite/data/squarefacesprite.png b/tests/auto/quick/qquickanimatedsprite/data/squarefacesprite.png
new file mode 100644
index 0000000000..f9a5d5fcce
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedsprite/data/squarefacesprite.png
Binary files differ
diff --git a/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro b/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro
new file mode 100644
index 0000000000..dd56991812
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedsprite/qquickanimatedsprite.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickanimatedsprite
+SOURCES += tst_qquickanimatedsprite.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
new file mode 100644
index 0000000000..bf46b6eca8
--- /dev/null
+++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include "../../shared/util.h"
+#include <QtQuick/qquickview.h>
+#include <private/qabstractanimation_p.h>
+#include <private/qquickanimatedsprite_p.h>
+
+class tst_qquickanimatedsprite : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickanimatedsprite(){}
+
+private slots:
+ void initTestCase();
+ void test_properties();
+ void test_frameChangedSignal();
+};
+
+void tst_qquickanimatedsprite::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ QUnifiedTimer::instance()->setConsistentTiming(true);
+}
+
+void tst_qquickanimatedsprite::test_properties()
+{
+ QQuickView *window = new QQuickView(0);
+
+ window->setSource(testFileUrl("basic.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->rootObject());
+ QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite");
+ QVERIFY(sprite);
+
+ QTRY_VERIFY(sprite->running());
+ QVERIFY(!sprite->paused());
+ QVERIFY(sprite->interpolate());
+ QCOMPARE(sprite->loops(), 30);
+
+ sprite->setRunning(false);
+ QVERIFY(!sprite->running());
+ sprite->setInterpolate(false);
+ QVERIFY(!sprite->interpolate());
+
+ delete window;
+}
+
+void tst_qquickanimatedsprite::test_frameChangedSignal()
+{
+ QQuickView *window = new QQuickView(0);
+
+ window->setSource(testFileUrl("frameChange.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->rootObject());
+ QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite");
+ QVERIFY(sprite);
+
+ QVERIFY(!sprite->running());
+ QVERIFY(!sprite->paused());
+ QCOMPARE(sprite->loops(), 3);
+ QCOMPARE(sprite->frameCount(), 6);
+
+ QSignalSpy frameChangedSpy(sprite, SIGNAL(currentFrameChanged(int)));
+ sprite->setRunning(true);
+ QTRY_COMPARE(frameChangedSpy.count(), 3*6);
+ QTRY_VERIFY(!sprite->running());
+
+ delete window;
+}
+
+QTEST_MAIN(tst_qquickanimatedsprite)
+
+#include "tst_qquickanimatedsprite.moc"
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml
new file mode 100755
index 0000000000..92e27b9945
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_coloranimation.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:50
+ height:50
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:colorAnimationcontroller
+ progress:1
+ animation: ColorAnimation {id:anim; target: rect; property:"color"; to:"#FFFFFF"; from:"#000000"; duration: 1000}
+ }
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_colorAnimation() {
+ colorAnimationcontroller.progress = 0;
+ compare(rect.color.toString(), "#000000");
+ colorAnimationcontroller.progress = 0.5;
+ compare(rect.color.toString(), "#7f7f7f");
+
+ // <=0 -> 0
+ colorAnimationcontroller.progress = -1;
+ compare(rect.color, "#000000");
+
+ //>=1 -> 1
+ colorAnimationcontroller.progress = 1.1;
+ compare(rect.color.toString(), "#ffffff");
+
+ //make sure the progress can be set backward
+ colorAnimationcontroller.progress = 0.5;
+ compare(rect.color, "#7f7f7f");
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_completion.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_completion.qml
new file mode 100755
index 0000000000..48c4fb734c
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_completion.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:110
+ height:40
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:ctrl
+ progress:0
+ animation: NumberAnimation {id:anim; target: rect; property:"x"; to:100; from:0; duration: 500}
+ }
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_complete() {
+ skip("QTBUG-25967")
+
+ ctrl.progress = 0;
+ compare(rect.x, 0);
+ ctrl.progress = 0.5;
+ compare(rect.x, 50);
+
+ ctrl.completeToBeginning();
+ wait(200);
+ verify(ctrl.progress < 0.5 && ctrl.progress > 0);
+ wait(600);
+ compare(ctrl.progress, 0);
+ compare(rect.x, 0);
+
+ ctrl.progress = 0.5;
+ compare(rect.x, 50);
+
+ ctrl.completeToEnd();
+ wait(200);
+ verify(ctrl.progress > 0.5 && ctrl.progress < 1);
+ wait(600);
+ compare(ctrl.progress, 1);
+ compare(rect.x, 100);
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_numberanimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_numberanimation.qml
new file mode 100644
index 0000000000..7c4496b206
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_numberanimation.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:50
+ height:50
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:numberAnimationcontroller
+ progress:1
+ animation: NumberAnimation {target: rect; property: "x"; from:0; to:40; duration: 1000}
+ }
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_numberAnimation() {
+ numberAnimationcontroller.progress = 0;
+ compare(rect.x, 0);
+ numberAnimationcontroller.progress = 0.5;
+ compare(rect.x, 20);
+
+ // <=0 -> 0
+ numberAnimationcontroller.progress = -1;
+ compare(rect.x, 0);
+
+ //>=1 -> 1
+ numberAnimationcontroller.progress = 1.1;
+ compare(rect.x, 40);
+
+ //make sure the progress can be set backward
+ numberAnimationcontroller.progress = 0.5;
+ compare(rect.x, 20);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml
new file mode 100644
index 0000000000..1a17a1a908
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml
@@ -0,0 +1,63 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:100
+ height:100
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:controller
+ progress:0
+ animation: ParallelAnimation {
+ id:anim
+ NumberAnimation { target: rect; property: "x"; from:0; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; from:0; to: 100; duration: 1000 }
+ NumberAnimation { target: rect; property: "height"; from:10; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "width"; from:10; to: 50; duration: 1000 }
+ ColorAnimation {target:rect; property:"color"; from:"red"; to:"blue"; duration:1000 }
+ }
+ }
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_parallelAnimation_data() {
+ //FIXME:the commented lines fail on MAC OS X
+ return [
+ {tag:"0.1",progress:0.1, x:5, y:10, color:"#e50019", width:14, height:14},
+ //{tag:"0.2",progress:0.2, x:10, y:20, color:"#cb0033", width:18, height:18},
+ {tag:"0.30000000000000004",progress:0.30000000000000004, x:15, y:30, color:"#b2004c", width:22, height:22},
+ //{tag:"0.4",progress:0.4, x:20, y:40, color:"#980066", width:26, height:26},
+ {tag:"0.5",progress:0.5, x:25, y:50, color:"#7f007f", width:30, height:30},
+ {tag:"0.6",progress:0.59999999, x:29.95, y:59.9, color:"#660098", width:33.96, height:33.96},
+ {tag:"0.7",progress:0.69999999, x:34.949999999999996, y:69.89999999999999, color:"#4c00b2", width:37.96, height:37.96},
+ {tag:"0.7999999999999999",progress:0.7999999999999999, x:39.95, y:79.9, color:"#3300cb", width:41.96, height:41.96},
+ {tag:"0.8999999999999999",progress:0.8999999999999999, x:44.95, y:89.9, color:"#1900e5", width:45.96, height:45.96},
+ {tag:"0.9999999999999999",progress:0.9999999999999999, x:49.95, y:99.9, color:"#0000fe", width:49.96, height:49.96},
+ {tag:"1",progress:1, x:50, y:100, color:"#0000ff", width:50, height:50},
+ {tag:"0.9",progress:0.9, x:45, y:90, color:"#1900e5", width:46, height:46},
+ //{tag:"0.8",progress:0.8, x:40, y:80, color:"#3200cc", width:42, height:42},
+ {tag:"0.7000000000000001",progress:0.7000000000000001, x:35, y:70, color:"#4c00b2", width:38, height:38},
+ //{tag:"0.6000000000000001",progress:0.6000000000000001, x:30, y:60, color:"#660098", width:34, height:34},
+ {tag:"0.5000000000000001",progress:0.5000000000000001, x:25, y:50, color:"#7f007f", width:30, height:30},
+ //{tag:"0.40000000000000013",progress:0.40000000000000013, x:20, y:40, color:"#980066", width:26, height:26},
+ {tag:"0.30000000000000016",progress:0.30000000000000016, x:15, y:30, color:"#b2004c", width:22, height:22},
+ //{tag:"0.20000000000000015",progress:0.19999999999999999, x:10, y:20, color:"#cb0033", width:18, height:18},
+ {tag:"0.10000000000000014",progress:0.10000000000000014, x:5, y:10, color:"#e50019", width:14, height:14},
+ {tag:"1.3877787807814457e-16",progress:1.3877787807814457e-16, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0",progress:0, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.1",progress:0.1, x:5, y:10, color:"#e50019", width:14, height:14}
+ ];
+ }
+ function test_parallelAnimation(row) {
+ controller.progress = row.progress;
+ compare(rect.x, row.x);
+ compare(rect.y, row.y);
+ compare(rect.width, row.width);
+ compare(rect.height, row.height);
+ compare(rect.color.toString(), row.color);
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml
new file mode 100644
index 0000000000..59671f5145
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_sequentialanimation.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:100
+ height:100
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:controller
+ progress:0
+ animation: SequentialAnimation {
+ id:anim
+ NumberAnimation { target: rect; property: "x"; from:0; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "y"; from:0; to: 100; duration: 1000 }
+ NumberAnimation { target: rect; property: "height"; from:10; to: 50; duration: 1000 }
+ NumberAnimation { target: rect; property: "width"; from:10; to: 50; duration: 1000 }
+ ColorAnimation {target:rect; property:"color"; from:"red"; to:"blue"; duration:1000 }
+ }
+ }
+
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_sequentialAnimation_data() {
+ return [
+ {tag:"0.1",progress:0.1, x:25, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.2",progress:0.2, x:50, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.30000000000000004",progress:0.30000000000000004, x:50, y:50, color:"#ff0000", width:10, height:10},
+ {tag:"0.4",progress:0.4, x:50, y:100, color:"#ff0000", width:10, height:10},
+ {tag:"0.5",progress:0.5, x:50, y:100, color:"#ff0000", width:10, height:30},
+ {tag:"0.6",progress:0.5999999999999, x:50, y:100, color:"#ff0000", width:10, height:49.96},
+ {tag:"0.7",progress:0.6999999999999, x:50, y:100, color:"#ff0000", width:29.96, height:50},
+ {tag:"0.7999999999999999",progress:0.7999999999999999, x:50, y:100, color:"#ff0000", width:49.96, height:50},
+ {tag:"0.8999999999999999",progress:0.8999999999999999, x:50, y:100, color:"#7f007f", width:50, height:50},
+ {tag:"0.9999999999999999",progress:0.9999999999999999, x:50, y:100, color:"#0000fe", width:50, height:50},
+ {tag:"1",progress:1, x:50, y:100, color:"#0000ff", width:50, height:50},
+ {tag:"0.9",progress:0.9, x:50, y:100, color:"#7f007f", width:50, height:50},
+ {tag:"0.8",progress:0.8, x:50, y:100, color:"#ff0000", width:50, height:50},
+ {tag:"0.7000000000000001",progress:0.7000000000000001, x:50, y:100, color:"#ff0000", width:30, height:50},
+ {tag:"0.6000000000000001",progress:0.6000000000000001, x:50, y:100, color:"#ff0000", width:10, height:50},
+ {tag:"0.5000000000000001",progress:0.5000000000000001, x:50, y:100, color:"#ff0000", width:10, height:30},
+ {tag:"0.40000000000000013",progress:0.40000000000000013, x:50, y:100, color:"#ff0000", width:10, height:10},
+ {tag:"0.30000000000000016",progress:0.30000000000000016, x:50, y:50, color:"#ff0000", width:10, height:10},
+ {tag:"0.20000000000000015",progress:0.20000000000000015, x:50, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.10000000000000014",progress:0.10000000000000014, x:25, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"1.3877787807814457e-16",progress:1.3877787807814457e-16, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0",progress:0, x:0, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.1",progress:0.1, x:25, y:0, color:"#ff0000", width:10, height:10},
+ {tag:"0.2",progress:0.2, x:50, y:0, color:"#ff0000", width:10, height:10}
+
+ ];
+ }
+ function test_sequentialAnimation(row) {
+ controller.progress = row.progress;
+ compare(rect.x, row.x);
+ compare(rect.y, row.y);
+ compare(rect.width, row.width);
+ compare(rect.height, row.height);
+ compare(rect.color.toString(), row.color);
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro b/tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro
new file mode 100644
index 0000000000..b5e03ee620
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/qquickanimationcontroller.pro
@@ -0,0 +1,10 @@
+QT += core-private gui-private qml-private
+TEMPLATE=app
+TARGET=tst_qquickanimationcontroller
+
+CONFIG += qmltestcase
+CONFIG += parallel_test
+SOURCES += tst_qquickanimationcontroller.cpp
+
+TESTDATA = data/*
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickanimationcontroller/tst_qquickanimationcontroller.cpp b/tests/auto/quick/qquickanimationcontroller/tst_qquickanimationcontroller.cpp
new file mode 100644
index 0000000000..e3be838c10
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/tst_qquickanimationcontroller.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(qquickanimationcontroller)
diff --git a/tests/auto/quick/qquickanimations/data/Double.qml b/tests/auto/quick/qquickanimations/data/Double.qml
new file mode 100644
index 0000000000..99ffca1d62
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/Double.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ property bool on: false
+ border.color: "#ffffff"
+ color: "green"
+ width: 50
+ height: 50
+ NumberAnimation on x {
+ objectName: "animation"
+ running: container.on; from: 0; to: 600; loops: Animation.Infinite; duration: 2000
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/attached.qml b/tests/auto/quick/qquickanimations/data/attached.qml
new file mode 100644
index 0000000000..9dcfcd8752
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/attached.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 180; height: 200;
+
+ Component {
+ id: delegate
+ Rectangle {
+ id: wrapper
+ width: 180; height: 200
+ color: "blue"
+
+ states: State {
+ name: "otherState"
+ PropertyChanges { target: wrapper; color: "green" }
+ }
+
+ transitions: Transition {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ ScriptAction { script: console.log(wrapper.ListView.delayRemove ? "on" : "off") }
+ }
+
+ Component.onCompleted: {
+ console.log(ListView.delayRemove ? "on" : "off");
+ wrapper.state = "otherState"
+ }
+ }
+ }
+
+ ListView {
+ model: 1
+ delegate: delegate
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/badproperty1.qml b/tests/auto/quick/qquickanimations/data/badproperty1.qml
new file mode 100644
index 0000000000..9634c2c169
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/badproperty1.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: myRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: myRect; border.color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { target: myRect; to: "red"; property: "border.colr"; duration: 1000 }
+ }
+ Component.onCompleted: if (wrapper.state == "state1") wrapper.state = ""; else wrapper.state = "state1";
+}
diff --git a/tests/auto/quick/qquickanimations/data/badproperty2.qml b/tests/auto/quick/qquickanimations/data/badproperty2.qml
new file mode 100644
index 0000000000..c121172a99
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/badproperty2.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: myRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: myRect; border.color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { target: myRect; to: "red"; property: "border"; duration: 1000 }
+ }
+ Component.onCompleted: if (wrapper.state == "state1") wrapper.state = ""; else wrapper.state = "state1";
+}
diff --git a/tests/auto/quick/qquickanimations/data/badtype1.qml b/tests/auto/quick/qquickanimations/data/badtype1.qml
new file mode 100644
index 0000000000..43e1ec8572
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/badtype1.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ Rectangle {
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ PropertyAnimation on x { from: "blue"; to: "green"; }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/badtype2.qml b/tests/auto/quick/qquickanimations/data/badtype2.qml
new file mode 100644
index 0000000000..5341cb3d1c
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/badtype2.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ Rectangle {
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { from: "blue"; to: "green"; }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/badtype3.qml b/tests/auto/quick/qquickanimations/data/badtype3.qml
new file mode 100644
index 0000000000..182efa0840
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/badtype3.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ Rectangle {
+ color: "red"
+ ColorAnimation on color { from: 10; to: 15; }
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/badtype4.qml b/tests/auto/quick/qquickanimations/data/badtype4.qml
new file mode 100644
index 0000000000..f091e2430f
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/badtype4.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseArea {
+ 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/quick/qquickanimations/data/disabledTransition.qml b/tests/auto/quick/qquickanimations/data/disabledTransition.qml
new file mode 100644
index 0000000000..0fbafead8b
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/disabledTransition.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ enabled: false
+ NumberAnimation { targets: theRect; properties: "x" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/dontAutoStart.qml b/tests/auto/quick/qquickanimations/data/dontAutoStart.qml
new file mode 100644
index 0000000000..c0c0c65e3f
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/dontAutoStart.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 600
+ height: 400
+
+ Rectangle {
+ id: redRect
+ width: 100; height: 100
+ color: Qt.rgba(1,0,0)
+ Behavior on x {
+ NumberAnimation { id: myAnim; objectName: "MyAnim"; target: redRect; property: "y"; to: 300; loops: Animation.Infinite}
+ }
+
+ }
+
+}
diff --git a/tests/auto/quick/qquickanimations/data/dontStart.qml b/tests/auto/quick/qquickanimations/data/dontStart.qml
new file mode 100644
index 0000000000..3eee0cfd35
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/dontStart.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 600
+ height: 400
+
+ Rectangle {
+ id: redRect
+ width: 100; height: 100
+ color: Qt.rgba(1,0,0)
+ SequentialAnimation on x {
+ running: false
+ NumberAnimation { objectName: "MyAnim"; running: true }
+ }
+
+ }
+
+}
diff --git a/tests/auto/quick/qquickanimations/data/dontStart2.qml b/tests/auto/quick/qquickanimations/data/dontStart2.qml
new file mode 100644
index 0000000000..e7b4164e4e
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/dontStart2.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 600
+ height: 400
+
+ Rectangle {
+ id: redRect
+ width: 100; height: 100
+ color: Qt.rgba(1,0,0)
+
+ transitions: Transition {
+ SequentialAnimation {
+ NumberAnimation { id: myAnim; objectName: "MyAnim"; running: true }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/dotproperty.qml b/tests/auto/quick/qquickanimations/data/dotproperty.qml
new file mode 100644
index 0000000000..e0e46dcef5
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/dotproperty.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: myRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseArea {
+ anchors.fill: parent
+ onClicked: if (wrapper.state == "state1") wrapper.state = ""; else wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: myRect; border.color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { properties: "border.color"; duration: 1000 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/doubleRegistrationBug.qml b/tests/auto/quick/qquickanimations/data/doubleRegistrationBug.qml
new file mode 100644
index 0000000000..9ef3da20c0
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/doubleRegistrationBug.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ Double { id: dub; on: parent.width < 800 }
+ Component.onCompleted: dub.on = false
+}
diff --git a/tests/auto/quick/qquickanimations/data/looping.qml b/tests/auto/quick/qquickanimations/data/looping.qml
new file mode 100644
index 0000000000..a3d40ae837
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/looping.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 200; height: 200
+
+ Rectangle {
+ x: 50; y: 50; width: 50; height: 50; color: "red"
+
+ SequentialAnimation on rotation {
+ NumberAnimation {
+ from: 0; to: 90; duration: 100
+ loops: 3
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/mixedtype1.qml b/tests/auto/quick/qquickanimations/data/mixedtype1.qml
new file mode 100644
index 0000000000..76129dd15e
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/mixedtype1.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseArea {
+ 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/quick/qquickanimations/data/mixedtype2.qml b/tests/auto/quick/qquickanimations/data/mixedtype2.qml
new file mode 100644
index 0000000000..1a7166e3f3
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/mixedtype2.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseArea {
+ 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/quick/qquickanimations/data/nonTransitionBug.qml b/tests/auto/quick/qquickanimations/data/nonTransitionBug.qml
new file mode 100644
index 0000000000..909c533e7b
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/nonTransitionBug.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 200
+ height: 200
+
+ Rectangle {
+ id: mover
+ objectName: "mover"
+ }
+
+ states: [
+ State {
+ name: "free"
+ },
+ State {
+ name: "left"
+ PropertyChanges {
+ restoreEntryValues: false
+ target: mover
+ x: 0
+ }
+ }
+ ]
+
+ transitions: Transition {
+ PropertyAnimation { properties: "x"; duration: 50 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathAnimation.qml b/tests/auto/quick/qquickanimations/data/pathAnimation.qml
new file mode 100644
index 0000000000..d2006a1c6a
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathAnimation.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: redRect
+ color: "red"
+ width: 100; height: 100
+ x: 50; y: 50
+ }
+
+ PathAnimation {
+ target: redRect
+ duration: 100;
+ path: Path {
+ startX: 50; startY: 50
+ PathCubic {
+ x: 300; y: 300
+
+ control1X: 300; control1Y: 50
+ control2X: 50; control2Y: 300
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathAnimation2.qml b/tests/auto/quick/qquickanimations/data/pathAnimation2.qml
new file mode 100644
index 0000000000..2f64dac2cc
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathAnimation2.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: redRect
+ color: "red"
+ width: 100; height: 100
+ x: 50; y: 50
+ }
+
+ PathAnimation {
+ target: redRect
+ duration: 100;
+ endRotation: 0
+ orientationEntryDuration: 10
+ orientationExitDuration: 10
+ orientation: PathAnimation.RightFirst
+ path: Path {
+ startX: 50; startY: 50
+ PathLine { x: 300; y: 300 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathAnimationInOutBackCrash.qml b/tests/auto/quick/qquickanimations/data/pathAnimationInOutBackCrash.qml
new file mode 100644
index 0000000000..1ee76f6906
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathAnimationInOutBackCrash.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+Item {
+ id: root
+ width: 450; height: 600
+
+ Rectangle {
+ objectName:"rect"
+ id: rect
+ x:200
+ y:500
+ width: 225; height: 40
+ color: "lightsteelblue"
+ }
+ PathAnimation {
+ id:anim
+ running:true
+ duration: 200
+
+ easing.type: Easing.InOutBack
+
+ target:rect
+ path: Path {
+ PathLine { x: 0; y: 0 }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/quick/qquickanimations/data/pathAnimationNoStart.qml b/tests/auto/quick/qquickanimations/data/pathAnimationNoStart.qml
new file mode 100644
index 0000000000..be3501fabb
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathAnimationNoStart.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: redRect
+ color: "red"
+ width: 100; height: 100
+ x: 50; y: 50
+ }
+
+ PathAnimation {
+ target: redRect
+ duration: 100;
+ path: Path {
+ //no startX/Y defined (should automatically start from redRects pos)
+ PathCubic {
+ x: 300; y: 300
+
+ control1X: 300; control1Y: 50
+ control2X: 50; control2Y: 300
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathInterpolator.qml b/tests/auto/quick/qquickanimations/data/pathInterpolator.qml
new file mode 100644
index 0000000000..0104412d7c
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathInterpolator.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+PathInterpolator {
+ path: Path {
+ startX: 50; startY: 50
+ PathCubic {
+ x: 300; y: 300
+
+ control1X: 300; control1Y: 50
+ control2X: 50; control2Y: 300
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathInterpolatorBack.qml b/tests/auto/quick/qquickanimations/data/pathInterpolatorBack.qml
new file mode 100644
index 0000000000..41366ef798
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathInterpolatorBack.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+PathInterpolator {
+ path: Path {
+ startX: 50; startY: 50
+ PathLine { x: 50; y: 100 }
+ PathLine { x: 100; y: 100 }
+ PathLine { x: 100; y: 50 }
+ PathLine { x: 200; y: 50 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathInterpolatorBack2.qml b/tests/auto/quick/qquickanimations/data/pathInterpolatorBack2.qml
new file mode 100644
index 0000000000..eb3d4c3f86
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathInterpolatorBack2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+PathInterpolator {
+ path: Path {
+ startX: 200; startY: 280
+ PathCurve { x: 150; y: 280 }
+ PathCurve { x: 150; y: 80 }
+ PathCurve { x: 0; y: 80 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pathTransition.qml b/tests/auto/quick/qquickanimations/data/pathTransition.qml
new file mode 100644
index 0000000000..55ffc33f95
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pathTransition.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 800
+ height: 800
+
+ Rectangle {
+ id: redRect; objectName: "redRect"
+ color: "red"
+ width: 50; height: 50
+ x: 500; y: 50
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: redRect
+ x: 100; y: 700
+ }
+ }
+
+ transitions: Transition {
+ to: "moved"; reversible: true
+ PathAnimation {
+ id: pathAnim
+ target: redRect
+ duration: 300
+ path: Path {
+ PathCurve { x: 100; y: 100 }
+ PathCurve { x: 200; y: 350 }
+ PathCurve { x: 600; y: 500 }
+ PathCurve {}
+ }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = parent.state == "moved" ? "" : "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pauseBindingBug.qml b/tests/auto/quick/qquickanimations/data/pauseBindingBug.qml
new file mode 100644
index 0000000000..359cda166f
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pauseBindingBug.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: rect
+ width: 200
+ height: 200
+
+ property bool animating: false
+ property int value: 0
+
+ NumberAnimation on value {
+ objectName: "animation"
+ paused: !rect.animating
+ to: 100
+ duration: 50
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/pauseBug.qml b/tests/auto/quick/qquickanimations/data/pauseBug.qml
new file mode 100644
index 0000000000..fa2c4be4ba
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/pauseBug.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+SequentialAnimation {
+ id: animation
+ running: true
+ ScriptAction { script: animation.paused = true }
+}
diff --git a/tests/auto/quick/qquickanimations/data/properties.qml b/tests/auto/quick/qquickanimations/data/properties.qml
new file mode 100644
index 0000000000..f0f730967c
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/properties.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { to: 200 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/properties2.qml b/tests/auto/quick/qquickanimations/data/properties2.qml
new file mode 100644
index 0000000000..6b7f026e0b
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/properties2.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { targets: theRect; properties: "x"; to: 200; }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/properties3.qml b/tests/auto/quick/qquickanimations/data/properties3.qml
new file mode 100644
index 0000000000..5eb65496d4
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/properties3.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { target: theRect; property: "x"; to: 300; }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/properties4.qml b/tests/auto/quick/qquickanimations/data/properties4.qml
new file mode 100644
index 0000000000..dfe8ad17e7
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/properties4.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { target: theRect; property: "y"; to: 200; }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/properties5.qml b/tests/auto/quick/qquickanimations/data/properties5.qml
new file mode 100644
index 0000000000..075fc9bc5a
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/properties5.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { targets: theRect; properties: "y"; to: 200; }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/propertiesTransition.qml b/tests/auto/quick/qquickanimations/data/propertiesTransition.qml
new file mode 100644
index 0000000000..968c5f6285
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/propertiesTransition.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { targets: theRect; properties: "x" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/propertiesTransition2.qml b/tests/auto/quick/qquickanimations/data/propertiesTransition2.qml
new file mode 100644
index 0000000000..f06165604a
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/propertiesTransition2.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { target: theRect; property: "y"; to: 200 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/propertiesTransition3.qml b/tests/auto/quick/qquickanimations/data/propertiesTransition3.qml
new file mode 100644
index 0000000000..7d3b3b9c6d
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/propertiesTransition3.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { targets: theRect; properties: "y" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/propertiesTransition4.qml b/tests/auto/quick/qquickanimations/data/propertiesTransition4.qml
new file mode 100644
index 0000000000..1c31a79634
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/propertiesTransition4.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { target: theRect; properties: "x" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/propertiesTransition5.qml b/tests/auto/quick/qquickanimations/data/propertiesTransition5.qml
new file mode 100644
index 0000000000..a2ff746900
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/propertiesTransition5.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { targets: theRect; property: "x" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/propertiesTransition6.qml b/tests/auto/quick/qquickanimations/data/propertiesTransition6.qml
new file mode 100644
index 0000000000..d3db01efb0
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/propertiesTransition6.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { targets: theItem; properties: "x" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/propertiesTransition7.qml b/tests/auto/quick/qquickanimations/data/propertiesTransition7.qml
new file mode 100644
index 0000000000..98898de8ef
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/propertiesTransition7.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ SpringAnimation { targets: theRect; properties: "x"; velocity: 10000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/reanchor.qml b/tests/auto/quick/qquickanimations/data/reanchor.qml
new file mode 100644
index 0000000000..241cc81a96
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/reanchor.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ color: "green";
+ anchors.left: parent.left
+ anchors.right: rightGuideline.left
+ anchors.top: topGuideline.top
+ anchors.bottom: container.bottom
+ }
+ Item { id: leftGuideline; x: 10 }
+ Item { id: rightGuideline; x: 150 }
+ Item { id: topGuideline; y: 10 }
+ Item { id: bottomGuideline; y: 150 }
+ Item { id: topGuideline2; y: 50 }
+ Item { id: bottomGuideline2; y: 175 }
+
+ states: [ State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ anchors.left: leftGuideline.left
+ anchors.right: container.right
+ anchors.top: container.top
+ anchors.bottom: bottomGuideline.bottom
+ }
+ }, State {
+ name: "reanchored2"
+ AnchorChanges {
+ target: myRect;
+ anchors.left: undefined
+ anchors.right: undefined
+ anchors.top: topGuideline2.top
+ anchors.bottom: bottomGuideline2.bottom
+ }
+ }]
+
+ transitions: Transition {
+ AnchorAnimation { }
+ }
+
+ state: "reanchored"
+}
diff --git a/tests/auto/quick/qquickanimations/data/registrationBug.qml b/tests/auto/quick/qquickanimations/data/registrationBug.qml
new file mode 100644
index 0000000000..633da4e17f
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/registrationBug.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: rect
+ width: 200
+ height: 200
+
+ property bool animating: true
+ property int value: 0
+
+ NumberAnimation {
+ target: rect
+ property: "value"
+ running: rect.animating
+ to: 100
+ duration: 50
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/reparent.qml b/tests/auto/quick/qquickanimations/data/reparent.qml
new file mode 100644
index 0000000000..39f1e7a6d2
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/reparent.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400;
+ height: 240;
+ color: "black";
+
+ Rectangle {
+ id: gr
+ objectName: "target"
+ color: "green"
+ width: 50; height: 50
+ }
+
+ Rectangle {
+ id: np
+ objectName: "newParent"
+ x: 150
+ width: 150; height: 150
+ color: "yellow"
+ clip: true
+ Rectangle {
+ color: "red"
+ x: 50; y: 50; height: 50; width: 50
+ }
+
+ }
+
+ Rectangle {
+ id: vp
+ objectName: "viaParent"
+ x: 100; y: 100
+ width: 50; height: 50
+ color: "blue"
+ rotation: 45
+ scale: 2
+ }
+
+ states: State {
+ name: "state1"
+ ParentChange {
+ target: gr
+ parent: np
+ x: 50; y: 50; width: 100;
+ }
+ }
+
+ transitions: Transition {
+ reversible: true
+ to: "state1"
+ ParentAnimation {
+ target: gr; via: vp;
+ NumberAnimation { properties: "x,y,rotation,scale,width" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/rotation.qml b/tests/auto/quick/qquickanimations/data/rotation.qml
new file mode 100644
index 0000000000..4dc42a1bd2
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/rotation.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 600; height: 200
+
+ Row {
+ spacing: 5
+ Rectangle {
+ id: rr
+ objectName: "rr"
+ color: "red"
+ width: 100; height: 100
+ }
+ Rectangle {
+ id: rr2
+ objectName: "rr2"
+ color: "red"
+ width: 100; height: 100
+ }
+ Rectangle {
+ id: rr3
+ objectName: "rr3"
+ color: "red"
+ width: 100; height: 100
+ }
+ Rectangle {
+ id: rr4
+ objectName: "rr4"
+ color: "red"
+ width: 100; height: 100
+ }
+ }
+
+ states: State {
+ name: "state1"
+ PropertyChanges { target: rr; rotation: 370 }
+ PropertyChanges { target: rr2; rotation: 370 }
+ PropertyChanges { target: rr3; rotation: 370 }
+ PropertyChanges { target: rr4; rotation: 370 }
+ }
+
+ transitions: Transition {
+ RotationAnimation { target: rr; direction: RotationAnimation.Numerical; duration: 1000 }
+ RotationAnimation { target: rr2; direction: RotationAnimation.Clockwise; duration: 1000 }
+ RotationAnimation { target: rr3; direction: RotationAnimation.Counterclockwise; duration: 1000 }
+ RotationAnimation { target: rr4; direction: RotationAnimation.Shortest; duration: 1000 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/runningTrueBug.qml b/tests/auto/quick/qquickanimations/data/runningTrueBug.qml
new file mode 100644
index 0000000000..bec6fab368
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/runningTrueBug.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+Rectangle {
+ color: "skyblue"
+ width: 500
+ height: 200
+ Rectangle {
+ objectName: "cloud"
+ color: "white"
+ y: 50
+ width: 100
+ height: 100
+
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ id: firstAnimation
+ from: 0
+ to: 500
+ duration: 5000
+ }
+ NumberAnimation {
+ id: secondAnimation
+ from: -100
+ to: 0
+ duration: 1000
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/scriptActionBug.qml b/tests/auto/quick/qquickanimations/data/scriptActionBug.qml
new file mode 100644
index 0000000000..48566db01d
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/scriptActionBug.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ property bool actionTriggered: false
+ property bool stateChangeScriptTriggered: false
+
+ states: State {
+ name: "state1"
+ StateChangeScript { script: stateChangeScriptTriggered = true }
+ }
+
+ transitions: Transition {
+ ScriptAction { script: actionTriggered = true }
+ }
+
+ Component.onCompleted: state = "state1"
+}
diff --git a/tests/auto/quick/qquickanimations/data/signals.qml b/tests/auto/quick/qquickanimations/data/signals.qml
new file mode 100644
index 0000000000..c91ad93626
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/signals.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+
+Item {
+ id: wrapper
+ width: 400; height: 400
+
+ function start() { animation.start() }
+ function stop() { animation.stop() }
+ property alias alwaysRunToEnd: animation.alwaysRunToEnd
+
+ property int startedCount: 0
+ property int stoppedCount: 0
+
+ Rectangle {
+ id: greenRect
+ width: 50; height: 50
+ color: "green"
+
+ NumberAnimation on x {
+ id: animation
+ from: 0
+ to: 100
+ duration: 200
+
+ onStarted: ++startedCount
+ onStopped: ++stoppedCount
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/transitionAssignmentBug.qml b/tests/auto/quick/qquickanimations/data/transitionAssignmentBug.qml
new file mode 100644
index 0000000000..508693e0fc
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/transitionAssignmentBug.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ property bool nullObject
+ Component.onCompleted: nullObject = transitions.length > 0 && transitions[0] === null
+
+ property list<Transition> myTransitions: [Transition {}, Transition {}]
+ transitions: myTransitions
+}
diff --git a/tests/auto/quick/qquickanimations/data/valuesource.qml b/tests/auto/quick/qquickanimations/data/valuesource.qml
new file mode 100644
index 0000000000..7a636b4003
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/valuesource.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { id: anim; objectName: "MyAnim"; to: 200 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/data/valuesource2.qml b/tests/auto/quick/qquickanimations/data/valuesource2.qml
new file mode 100644
index 0000000000..9788761ee8
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/data/valuesource2.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ NumberAnimation on x { id: anim; objectName: "MyAnim"; running: false; to: 200 }
+ }
+}
diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro
new file mode 100644
index 0000000000..747a2afdff
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/qquickanimations.pro
@@ -0,0 +1,15 @@
+CONFIG += testcase
+mac:CONFIG+=insignificant_test # QTBUG-29062
+TARGET = tst_qquickanimations
+SOURCES += tst_qquickanimations.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
new file mode 100644
index 0000000000..94726aa5fe
--- /dev/null
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -0,0 +1,1455 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/private/qanimationgroupjob_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquickitemanimation_p.h>
+#include <QtQuick/private/qquickitemanimation_p_p.h>
+#include <QtQuick/private/qquicktransition_p.h>
+#include <QtQuick/private/qquickanimation_p.h>
+#include <QtQuick/private/qquickpathinterpolator_p.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QEasingCurve>
+
+#include <limits.h>
+#include <math.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickanimations : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickanimations() {}
+
+private slots:
+ void initTestCase()
+ {
+ QQmlEngine engine; // ensure types are registered
+ QQmlDataTest::initTestCase();
+ }
+
+ void simpleProperty();
+ void simpleNumber();
+ void simpleColor();
+ void simpleRotation();
+ void simplePath();
+ void simpleAnchor();
+ void reparent();
+ void pathInterpolator();
+ void pathInterpolatorBackwardJump();
+ void pathWithNoStart();
+ void alwaysRunToEnd();
+ void complete();
+ void resume();
+ void dotProperty();
+ void badTypes();
+ void badProperties();
+ void mixedTypes();
+ void properties();
+ void propertiesTransition();
+ void pathTransition();
+ void disabledTransition();
+ void invalidDuration();
+ void attached();
+ void propertyValueSourceDefaultStart();
+ void dontStart();
+ void easingProperties();
+ void rotation();
+ void startStopSignals();
+ void runningTrueBug();
+ void nonTransitionBug();
+ void registrationBug();
+ void doubleRegistrationBug();
+ void alwaysRunToEndRestartBug();
+ void transitionAssignmentBug();
+ void pauseBindingBug();
+ void pauseBug();
+ void loopingBug();
+ void anchorBug();
+ void pathAnimationInOutBackBug();
+ void scriptActionBug();
+};
+
+#define QTIMED_COMPARE(lhs, rhs) do { \
+ for (int ii = 0; ii < 5; ++ii) { \
+ if (lhs == rhs) \
+ break; \
+ QTest::qWait(50); \
+ } \
+ QCOMPARE(lhs, rhs); \
+} while (false)
+
+void tst_qquickanimations::simpleProperty()
+{
+ QQuickRectangle rect;
+ QQuickPropertyAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ QVERIFY(animation.target() == &rect);
+ QVERIFY(animation.property() == "x");
+ QVERIFY(animation.to().toReal() == 200.0);
+ animation.start();
+ QVERIFY(animation.isRunning());
+ QTest::qWait(animation.duration());
+ QTIMED_COMPARE(rect.x(), 200.0);
+
+ rect.setPosition(QPointF(0,0));
+ animation.start();
+ QVERIFY(animation.isRunning());
+ animation.pause();
+ QVERIFY(animation.isPaused());
+ animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
+ QCOMPARE(rect.x(),100.0);
+}
+
+void tst_qquickanimations::simpleNumber()
+{
+ QQuickRectangle rect;
+ QQuickNumberAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ QVERIFY(animation.target() == &rect);
+ QVERIFY(animation.property() == "x");
+ QVERIFY(animation.to() == 200);
+ animation.start();
+ QVERIFY(animation.isRunning());
+ QTest::qWait(animation.duration());
+ QTIMED_COMPARE(rect.x(), qreal(200));
+
+ rect.setX(0);
+ animation.start();
+ animation.pause();
+ QVERIFY(animation.isRunning());
+ QVERIFY(animation.isPaused());
+ animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
+ QCOMPARE(rect.x(), qreal(100));
+}
+
+void tst_qquickanimations::simpleColor()
+{
+ QQuickRectangle rect;
+ QQuickColorAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("color");
+ animation.setTo(QColor("red"));
+ QVERIFY(animation.target() == &rect);
+ QVERIFY(animation.property() == "color");
+ QVERIFY(animation.to() == QColor("red"));
+ animation.start();
+ QVERIFY(animation.isRunning());
+ QTest::qWait(animation.duration());
+ QTIMED_COMPARE(rect.color(), QColor("red"));
+
+ rect.setColor(QColor("blue"));
+ animation.start();
+ animation.pause();
+ QVERIFY(animation.isRunning());
+ QVERIFY(animation.isPaused());
+ animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
+ QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1));
+
+ rect.setColor(QColor("green"));
+ animation.setFrom(QColor("blue"));
+ QVERIFY(animation.from() == QColor("blue"));
+ animation.restart();
+ QCOMPARE(rect.color(), QColor("blue"));
+ QVERIFY(animation.isRunning());
+ animation.setCurrentTime(125);
+ QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1));
+}
+
+void tst_qquickanimations::simpleRotation()
+{
+ QQuickRectangle rect;
+ QQuickRotationAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("rotation");
+ animation.setTo(270);
+ QVERIFY(animation.target() == &rect);
+ QVERIFY(animation.property() == "rotation");
+ QVERIFY(animation.to() == 270);
+ QVERIFY(animation.direction() == QQuickRotationAnimation::Numerical);
+ animation.start();
+ QVERIFY(animation.isRunning());
+ QTest::qWait(animation.duration());
+ QTIMED_COMPARE(rect.rotation(), qreal(270));
+
+ rect.setRotation(0);
+ animation.start();
+ animation.pause();
+ QVERIFY(animation.isRunning());
+ QVERIFY(animation.isPaused());
+ animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
+ QCOMPARE(rect.rotation(), qreal(135));
+}
+
+void tst_qquickanimations::simplePath()
+{
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathAnimation.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(redRect);
+ QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
+ QVERIFY(pathAnim);
+
+ QCOMPARE(pathAnim->duration(), 100);
+ QCOMPARE(pathAnim->target(), redRect);
+
+ pathAnim->start();
+ pathAnim->pause();
+
+ pathAnim->setCurrentTime(30);
+ QCOMPARE(redRect->x(), qreal(167));
+ QCOMPARE(redRect->y(), qreal(104));
+
+ pathAnim->setCurrentTime(100);
+ QCOMPARE(redRect->x(), qreal(300));
+ QCOMPARE(redRect->y(), qreal(300));
+
+ //verify animation runs to end
+ pathAnim->start();
+ QCOMPARE(redRect->x(), qreal(50));
+ QCOMPARE(redRect->y(), qreal(50));
+ QTRY_COMPARE(redRect->x(), qreal(300));
+ QCOMPARE(redRect->y(), qreal(300));
+
+ pathAnim->setOrientation(QQuickPathAnimation::RightFirst);
+ QCOMPARE(pathAnim->orientation(), QQuickPathAnimation::RightFirst);
+ pathAnim->start();
+ QTRY_VERIFY(redRect->rotation() != 0);
+ pathAnim->stop();
+
+ delete rect;
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathAnimation2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(redRect);
+ QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
+ QVERIFY(pathAnim);
+
+ QCOMPARE(pathAnim->orientation(), QQuickPathAnimation::RightFirst);
+ QCOMPARE(pathAnim->endRotation(), qreal(0));
+ QCOMPARE(pathAnim->orientationEntryDuration(), 10);
+ QCOMPARE(pathAnim->orientationExitDuration(), 10);
+
+ pathAnim->start();
+ pathAnim->pause();
+ QCOMPARE(redRect->x(), qreal(50));
+ QCOMPARE(redRect->y(), qreal(50));
+ QCOMPARE(redRect->rotation(), qreal(-360));
+
+ pathAnim->setCurrentTime(50);
+ QCOMPARE(redRect->x(), qreal(175));
+ QCOMPARE(redRect->y(), qreal(175));
+ QCOMPARE(redRect->rotation(), qreal(-315));
+
+ pathAnim->setCurrentTime(100);
+ QCOMPARE(redRect->x(), qreal(300));
+ QCOMPARE(redRect->y(), qreal(300));
+ QCOMPARE(redRect->rotation(), qreal(0));
+
+ delete rect;
+ }
+}
+
+void tst_qquickanimations::simpleAnchor()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("reanchor.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *greenRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(greenRect);
+
+ QCOMPARE(rect->state(), QLatin1String("reanchored"));
+ QCOMPARE(greenRect->x(), qreal(10));
+ QCOMPARE(greenRect->y(), qreal(0));
+ QCOMPARE(greenRect->width(), qreal(190));
+ QCOMPARE(greenRect->height(), qreal(150));
+
+ rect->setState("");
+
+ //verify animation in progress
+ QTRY_VERIFY(greenRect->x() < 10 && greenRect->x() > 0);
+ QVERIFY(greenRect->y() > 0 && greenRect->y() < 10);
+ QVERIFY(greenRect->width() < 190 && greenRect->width() > 150);
+ QVERIFY(greenRect->height() > 150 && greenRect->height() < 190);
+
+ //verify end state ("")
+ QTRY_COMPARE(greenRect->x(), qreal(0));
+ QCOMPARE(greenRect->y(), qreal(10));
+ QCOMPARE(greenRect->width(), qreal(150));
+ QCOMPARE(greenRect->height(), qreal(190));
+
+ rect->setState("reanchored2");
+
+ //verify animation in progress
+ QTRY_VERIFY(greenRect->y() > 10 && greenRect->y() < 50);
+ QVERIFY(greenRect->height() > 125 && greenRect->height() < 190);
+ //NOTE: setting left/right anchors to undefined removes the anchors, but does not resize.
+ QCOMPARE(greenRect->x(), qreal(0));
+ QCOMPARE(greenRect->width(), qreal(150));
+
+ //verify end state ("reanchored2")
+ QTRY_COMPARE(greenRect->y(), qreal(50));
+ QCOMPARE(greenRect->height(), qreal(125));
+ QCOMPARE(greenRect->x(), qreal(0));
+ QCOMPARE(greenRect->width(), qreal(150));
+
+ rect->setState("reanchored");
+
+ //verify animation in progress
+ QTRY_VERIFY(greenRect->x() < 10 && greenRect->x() > 0);
+ QVERIFY(greenRect->y() > 0 && greenRect->y() < 50);
+ QVERIFY(greenRect->width() < 190 && greenRect->width() > 150);
+ QVERIFY(greenRect->height() > 125 && greenRect->height() < 150);
+
+ //verify end state ("reanchored")
+ QTRY_COMPARE(greenRect->x(), qreal(10));
+ QCOMPARE(greenRect->y(), qreal(0));
+ QCOMPARE(greenRect->width(), qreal(190));
+ QCOMPARE(greenRect->height(), qreal(150));
+
+ rect->setState("reanchored2");
+
+ //verify animation in progress
+ QTRY_VERIFY(greenRect->x() < 10 && greenRect->x() > 0);
+ QVERIFY(greenRect->y() > 0 && greenRect->y() < 50);
+ QVERIFY(greenRect->width() < 190 && greenRect->width() > 150);
+ QVERIFY(greenRect->height() > 125 && greenRect->height() < 150);
+
+ //verify end state ("reanchored2")
+ QTRY_COMPARE(greenRect->x(), qreal(0));
+ QCOMPARE(greenRect->y(), qreal(50));
+ QCOMPARE(greenRect->width(), qreal(150));
+ QCOMPARE(greenRect->height(), qreal(125));
+
+ delete rect;
+}
+
+void tst_qquickanimations::reparent()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("reparent.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *target = rect->findChild<QQuickRectangle*>("target");
+ QVERIFY(target);
+
+ QCOMPARE(target->parentItem(), rect);
+ QCOMPARE(target->x(), qreal(0));
+ QCOMPARE(target->y(), qreal(0));
+ QCOMPARE(target->width(), qreal(50));
+ QCOMPARE(target->height(), qreal(50));
+ QCOMPARE(target->rotation(), qreal(0));
+ QCOMPARE(target->scale(), qreal(1));
+
+ rect->setState("state1");
+
+ QQuickRectangle *viaParent = rect->findChild<QQuickRectangle*>("viaParent");
+ QVERIFY(viaParent);
+
+ QQuickRectangle *newParent = rect->findChild<QQuickRectangle*>("newParent");
+ QVERIFY(newParent);
+
+ QTest::qWait(100);
+
+ //animation in progress
+ QTRY_COMPARE(target->parentItem(), viaParent);
+ QVERIFY(target->x() > -100 && target->x() < 50);
+ QVERIFY(target->y() > -100 && target->y() < 50);
+ QVERIFY(target->width() > 50 && target->width() < 100);
+ QCOMPARE(target->height(), qreal(50));
+ QCOMPARE(target->rotation(), qreal(-45));
+ QCOMPARE(target->scale(), qreal(.5));
+
+ //end state
+ QTRY_COMPARE(target->parentItem(), newParent);
+ QCOMPARE(target->x(), qreal(50));
+ QCOMPARE(target->y(), qreal(50));
+ QCOMPARE(target->width(), qreal(100));
+ QCOMPARE(target->height(), qreal(50));
+ QCOMPARE(target->rotation(), qreal(0));
+ QCOMPARE(target->scale(), qreal(1));
+
+ delete rect;
+}
+
+void tst_qquickanimations::pathInterpolator()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathInterpolator.qml"));
+ QQuickPathInterpolator *interpolator = qobject_cast<QQuickPathInterpolator*>(c.create());
+ QVERIFY(interpolator);
+
+ QCOMPARE(interpolator->progress(), qreal(0));
+ QCOMPARE(interpolator->x(), qreal(50));
+ QCOMPARE(interpolator->y(), qreal(50));
+ QCOMPARE(interpolator->angle(), qreal(0));
+
+ interpolator->setProgress(.5);
+ QCOMPARE(interpolator->progress(), qreal(.5));
+ QCOMPARE(interpolator->x(), qreal(175));
+ QCOMPARE(interpolator->y(), qreal(175));
+ QCOMPARE(interpolator->angle(), qreal(90));
+
+ interpolator->setProgress(1);
+ QCOMPARE(interpolator->progress(), qreal(1));
+ QCOMPARE(interpolator->x(), qreal(300));
+ QCOMPARE(interpolator->y(), qreal(300));
+ QCOMPARE(interpolator->angle(), qreal(0));
+
+ //for path interpulator the progress value must be [0,1] range.
+ interpolator->setProgress(1.1);
+ QCOMPARE(interpolator->progress(), qreal(1));
+
+ interpolator->setProgress(-0.000123);
+ QCOMPARE(interpolator->progress(), qreal(0));
+}
+
+void tst_qquickanimations::pathInterpolatorBackwardJump()
+{
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathInterpolatorBack.qml"));
+ QQuickPathInterpolator *interpolator = qobject_cast<QQuickPathInterpolator*>(c.create());
+ QVERIFY(interpolator);
+
+ QCOMPARE(interpolator->progress(), qreal(0));
+ QCOMPARE(interpolator->x(), qreal(50));
+ QCOMPARE(interpolator->y(), qreal(50));
+ QCOMPARE(interpolator->angle(), qreal(90));
+
+ interpolator->setProgress(.5);
+ QCOMPARE(interpolator->progress(), qreal(.5));
+ QCOMPARE(interpolator->x(), qreal(100));
+ QCOMPARE(interpolator->y(), qreal(75));
+ QCOMPARE(interpolator->angle(), qreal(270));
+
+ interpolator->setProgress(1);
+ QCOMPARE(interpolator->progress(), qreal(1));
+ QCOMPARE(interpolator->x(), qreal(200));
+ QCOMPARE(interpolator->y(), qreal(50));
+ QCOMPARE(interpolator->angle(), qreal(0));
+
+ //make sure we don't get caught in infinite loop here
+ interpolator->setProgress(0);
+ QCOMPARE(interpolator->progress(), qreal(0));
+ QCOMPARE(interpolator->x(), qreal(50));
+ QCOMPARE(interpolator->y(), qreal(50));
+ QCOMPARE(interpolator->angle(), qreal(90));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathInterpolatorBack2.qml"));
+ QQuickPathInterpolator *interpolator = qobject_cast<QQuickPathInterpolator*>(c.create());
+ QVERIFY(interpolator);
+
+ QCOMPARE(interpolator->progress(), qreal(0));
+ QCOMPARE(interpolator->x(), qreal(200));
+ QCOMPARE(interpolator->y(), qreal(280));
+ QCOMPARE(interpolator->angle(), qreal(180));
+
+ interpolator->setProgress(1);
+ QCOMPARE(interpolator->progress(), qreal(1));
+ QCOMPARE(interpolator->x(), qreal(0));
+ QCOMPARE(interpolator->y(), qreal(80));
+ QCOMPARE(interpolator->angle(), qreal(180));
+
+ //make sure we don't get caught in infinite loop here
+ interpolator->setProgress(0);
+ QCOMPARE(interpolator->progress(), qreal(0));
+ QCOMPARE(interpolator->x(), qreal(200));
+ QCOMPARE(interpolator->y(), qreal(280));
+ QCOMPARE(interpolator->angle(), qreal(180));
+ }
+}
+
+void tst_qquickanimations::pathWithNoStart()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathAnimationNoStart.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(redRect);
+ QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
+ QVERIFY(pathAnim);
+
+ pathAnim->start();
+ pathAnim->pause();
+ QCOMPARE(redRect->x(), qreal(50));
+ QCOMPARE(redRect->y(), qreal(50));
+
+ pathAnim->setCurrentTime(50);
+ QCOMPARE(redRect->x(), qreal(175));
+ QCOMPARE(redRect->y(), qreal(175));
+
+ pathAnim->setCurrentTime(100);
+ QCOMPARE(redRect->x(), qreal(300));
+ QCOMPARE(redRect->y(), qreal(300));
+
+ redRect->setX(100);
+ redRect->setY(100);
+ pathAnim->start();
+ QCOMPARE(redRect->x(), qreal(100));
+ QCOMPARE(redRect->y(), qreal(100));
+ QTRY_COMPARE(redRect->x(), qreal(300));
+ QCOMPARE(redRect->y(), qreal(300));
+}
+
+void tst_qquickanimations::alwaysRunToEnd()
+{
+ QQuickRectangle rect;
+ QQuickPropertyAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ animation.setDuration(1000);
+ animation.setLoops(-1);
+ animation.setAlwaysRunToEnd(true);
+ QVERIFY(animation.loops() == -1);
+ QVERIFY(animation.alwaysRunToEnd() == true);
+ animation.start();
+ QTest::qWait(1500);
+ animation.stop();
+ QVERIFY(rect.x() != qreal(200));
+ QTest::qWait(500);
+ QTIMED_COMPARE(rect.x(), qreal(200));
+}
+
+void tst_qquickanimations::complete()
+{
+ QQuickRectangle rect;
+ QQuickPropertyAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("x");
+ animation.setFrom(1);
+ animation.setTo(200);
+ animation.setDuration(500);
+ QVERIFY(animation.from() == 1);
+ animation.start();
+ QTest::qWait(50);
+ animation.stop();
+ QVERIFY(rect.x() != qreal(200));
+ animation.start();
+ QTest::qWait(50);
+ QVERIFY(animation.isRunning());
+ animation.complete();
+ QCOMPARE(rect.x(), qreal(200));
+}
+
+void tst_qquickanimations::resume()
+{
+ QQuickRectangle rect;
+ QQuickPropertyAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("x");
+ animation.setFrom(10);
+ animation.setTo(200);
+ animation.setDuration(1000);
+ QVERIFY(animation.from() == 10);
+
+ animation.start();
+ QTest::qWait(400);
+ animation.pause();
+ qreal x = rect.x();
+ QVERIFY(x != qreal(200) && x != qreal(10));
+ QVERIFY(animation.isRunning());
+ QVERIFY(animation.isPaused());
+
+ animation.resume();
+ QVERIFY(animation.isRunning());
+ QVERIFY(!animation.isPaused());
+ QTest::qWait(400);
+ animation.stop();
+ QVERIFY(rect.x() > x);
+
+ animation.start();
+ QVERIFY(animation.isRunning());
+ animation.pause();
+ QVERIFY(animation.isPaused());
+ animation.resume();
+ QVERIFY(!animation.isPaused());
+
+ QSignalSpy spy(&animation, SIGNAL(pausedChanged(bool)));
+ animation.pause();
+ QCOMPARE(spy.count(), 1);
+ QVERIFY(animation.isPaused());
+ animation.stop();
+ QVERIFY(!animation.isPaused());
+ QCOMPARE(spy.count(), 2);
+
+ // Load QtQuick to ensure that QQuickPropertyAnimation is registered as PropertyAnimation
+ {
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nQtObject {}\n", QUrl());
+ }
+
+ QByteArray message = "<Unknown File>: QML PropertyAnimation: setPaused() cannot be used when animation isn't running.";
+ QTest::ignoreMessage(QtWarningMsg, message);
+ animation.pause();
+ QCOMPARE(spy.count(), 2);
+ QVERIFY(!animation.isPaused());
+ animation.resume();
+ QVERIFY(!animation.isPaused());
+ QVERIFY(!animation.isRunning());
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquickanimations::dotProperty()
+{
+ QQuickRectangle rect;
+ QQuickNumberAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("border.width");
+ animation.setTo(10);
+ animation.start();
+ QTest::qWait(animation.duration()+50);
+ QTIMED_COMPARE(rect.border()->width(), 10.0);
+
+ rect.border()->setWidth(0);
+ animation.start();
+ animation.pause();
+ animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
+ QCOMPARE(rect.border()->width(), 5.0);
+}
+
+void tst_qquickanimations::badTypes()
+{
+ //don't crash
+ {
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("badtype1.qml"));
+
+ qApp->processEvents();
+
+ delete view;
+ }
+
+ //make sure we get a compiler error
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("badtype2.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready");
+ c.create();
+
+ QVERIFY(c.errors().count() == 1);
+ QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: number expected"));
+ }
+
+ //make sure we get a compiler error
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("badtype3.qml"));
+ QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: 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
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("badtype4.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("state1");
+ QTest::qWait(1000 + 50);
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("MyRect");
+ QVERIFY(myRect);
+ QCOMPARE(myRect->x(),qreal(200));
+ }
+}
+
+void tst_qquickanimations::badProperties()
+{
+ //make sure we get a runtime error
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c1(&engine, testFileUrl("badproperty1.qml"));
+ QByteArray message = testFileUrl("badproperty1.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\"";
+ QTest::ignoreMessage(QtWarningMsg, message);
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c1.create());
+ QVERIFY(rect);
+
+ QQmlComponent c2(&engine, testFileUrl("badproperty2.qml"));
+ message = testFileUrl("badproperty2.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\"";
+ QTest::ignoreMessage(QtWarningMsg, message);
+ rect = qobject_cast<QQuickRectangle*>(c2.create());
+ QVERIFY(rect);
+
+ //### should we warn here are well?
+ //rect->setState("state1");
+ }
+}
+
+//test animating mixed types with property animation in a transition
+//for example, int + real; color + real; etc
+void tst_qquickanimations::mixedTypes()
+{
+ //assumes border.width stays a real -- not real robust
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("mixedtype1.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("state1");
+ QTest::qWait(500);
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("MyRect");
+ QVERIFY(myRect);
+
+ //rather inexact -- is there a better way?
+ QVERIFY(myRect->x() > 100 && myRect->x() < 200);
+ QVERIFY(myRect->border()->width() > 1 && myRect->border()->width() < 10);
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("mixedtype2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("state1");
+ QTest::qWait(500);
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("MyRect");
+ QVERIFY(myRect);
+
+ //rather inexact -- is there a better way?
+ QVERIFY(myRect->x() > 100 && myRect->x() < 200);
+ QVERIFY(myRect->color() != QColor("red") && myRect->color() != QColor("blue"));
+ }
+}
+
+void tst_qquickanimations::properties()
+{
+ const int waitDuration = 300;
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("properties.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("properties2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("properties3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(300));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("properties4.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->y(),qreal(200));
+ QTIMED_COMPARE(myRect->x(),qreal(100));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("properties5.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(100));
+ QTIMED_COMPARE(myRect->y(),qreal(200));
+ }
+}
+
+void tst_qquickanimations::propertiesTransition()
+{
+ const int waitDuration = 300;
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("propertiesTransition.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("propertiesTransition2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+ QCOMPARE(myRect->y(),qreal(100));
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->y(),qreal(200));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("propertiesTransition3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+ QCOMPARE(myRect->y(),qreal(100));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("propertiesTransition4.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QCOMPARE(myRect->x(),qreal(100));
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("propertiesTransition5.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QCOMPARE(myRect->x(),qreal(100));
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+ /*{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("propertiesTransition6.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QCOMPARE(myRect->x(),qreal(100));
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(100));
+ }*/
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("propertiesTransition7.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
+}
+
+void tst_qquickanimations::pathTransition()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathTransition.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("redRect");
+ QVERIFY(myRect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QTRY_VERIFY(myRect->x() < 500 && myRect->x() > 100 && myRect->y() > 50 && myRect->y() < 700 ); //animation started
+ QTRY_VERIFY(qFuzzyCompare(myRect->x(), qreal(100)) && qFuzzyCompare(myRect->y(), qreal(700)));
+ QTest::qWait(100);
+
+ QQuickItemPrivate::get(rect)->setState("");
+ QTRY_VERIFY(myRect->x() < 500 && myRect->x() > 100 && myRect->y() > 50 && myRect->y() < 700 ); //animation started
+ QTRY_VERIFY(qFuzzyCompare(myRect->x(), qreal(500)) && qFuzzyCompare(myRect->y(), qreal(50)));
+}
+
+void tst_qquickanimations::disabledTransition()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("disabledTransition.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
+ QVERIFY(myRect);
+
+ QQuickTransition *trans = rect->findChild<QQuickTransition*>();
+ QVERIFY(trans);
+
+ QCOMPARE(trans->enabled(), false);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QCOMPARE(myRect->x(),qreal(200));
+
+ trans->setEnabled(true);
+ QSignalSpy runningSpy(trans, SIGNAL(runningChanged()));
+ QQuickItemPrivate::get(rect)->setState("");
+ QCOMPARE(myRect->x(),qreal(200));
+ QCOMPARE(runningSpy.count(), 1); //stopped -> running
+ QVERIFY(trans->running());
+ QTest::qWait(300);
+ QTIMED_COMPARE(myRect->x(),qreal(100));
+ QVERIFY(!trans->running());
+ QCOMPARE(runningSpy.count(), 2); //running -> stopped
+}
+
+void tst_qquickanimations::invalidDuration()
+{
+ QQuickPropertyAnimation *animation = new QQuickPropertyAnimation;
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML PropertyAnimation: Cannot set a duration of < 0");
+ animation->setDuration(-1);
+ QCOMPARE(animation->duration(), 250);
+
+ QQuickPauseAnimation *pauseAnimation = new QQuickPauseAnimation;
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML PauseAnimation: Cannot set a duration of < 0");
+ pauseAnimation->setDuration(-1);
+ QCOMPARE(pauseAnimation->duration(), 250);
+}
+
+void tst_qquickanimations::attached()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("attached.qml"));
+ QTest::ignoreMessage(QtDebugMsg, "off");
+ QTest::ignoreMessage(QtDebugMsg, "on");
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+}
+
+void tst_qquickanimations::propertyValueSourceDefaultStart()
+{
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("valuesource.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickAbstractAnimation *myAnim = rect->findChild<QQuickAbstractAnimation*>("MyAnim");
+ QVERIFY(myAnim);
+ QVERIFY(myAnim->isRunning());
+ }
+
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("valuesource2.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickAbstractAnimation *myAnim = rect->findChild<QQuickAbstractAnimation*>("MyAnim");
+ QVERIFY(myAnim);
+ QVERIFY(myAnim->isRunning() == false);
+ }
+
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("dontAutoStart.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickAbstractAnimation *myAnim = rect->findChild<QQuickAbstractAnimation*>("MyAnim");
+ QVERIFY(myAnim && !myAnim->qtAnimation());
+ //QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimationJob::Stopped);
+ }
+}
+
+
+void tst_qquickanimations::dontStart()
+{
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("dontStart.qml"));
+
+ QString warning = c.url().toString() + ":14:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickAbstractAnimation *myAnim = rect->findChild<QQuickAbstractAnimation*>("MyAnim");
+ QVERIFY(myAnim && !myAnim->qtAnimation());
+ //QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimationJob::Stopped);
+ }
+
+ {
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("dontStart2.qml"));
+
+ QString warning = c.url().toString() + ":15:17: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickAbstractAnimation *myAnim = rect->findChild<QQuickAbstractAnimation*>("MyAnim");
+ QVERIFY(myAnim && !myAnim->qtAnimation());
+ //QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimationJob::Stopped);
+ }
+}
+
+void tst_qquickanimations::easingProperties()
+{
+ {
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nNumberAnimation { easing.type: \"InOutQuad\" }";
+ QQmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad);
+ }
+
+ {
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }";
+ QQmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce);
+ QCOMPARE(animObject->easing().amplitude(), 5.0);
+ }
+
+ {
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}";
+ QQmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic);
+ QCOMPARE(animObject->easing().amplitude(), 5.0);
+ QCOMPARE(animObject->easing().period(), 3.0);
+ }
+
+ {
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }";
+ QQmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack);
+ QCOMPARE(animObject->easing().overshoot(), 2.0);
+ }
+
+ {
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"Bezier\"; easing.bezierCurve: [0.5, 0.2, 0.13, 0.65, 1.0, 1.0] }";
+ QQmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::BezierSpline);
+ QList<QPointF> points = animObject->easing().cubicBezierSpline();
+ QCOMPARE(points.count(), 3);
+ QCOMPARE(points.at(0), QPointF(0.5, 0.2));
+ QCOMPARE(points.at(1), QPointF(0.13, 0.65));
+ QCOMPARE(points.at(2), QPointF(1.0, 1.0));
+ }
+}
+
+void tst_qquickanimations::rotation()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("rotation.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *rr = rect->findChild<QQuickRectangle*>("rr");
+ QQuickRectangle *rr2 = rect->findChild<QQuickRectangle*>("rr2");
+ QQuickRectangle *rr3 = rect->findChild<QQuickRectangle*>("rr3");
+ QQuickRectangle *rr4 = rect->findChild<QQuickRectangle*>("rr4");
+
+ QQuickItemPrivate::get(rect)->setState("state1");
+ QTest::qWait(800);
+ qreal r1 = rr->rotation();
+ qreal r2 = rr2->rotation();
+ qreal r3 = rr3->rotation();
+ qreal r4 = rr4->rotation();
+
+ QVERIFY(r1 > qreal(0) && r1 < qreal(370));
+ QVERIFY(r2 > qreal(0) && r2 < qreal(370));
+ QVERIFY(r3 < qreal(0) && r3 > qreal(-350));
+ QVERIFY(r4 > qreal(0) && r4 < qreal(10));
+ QCOMPARE(r1,r2);
+ QVERIFY(r4 < r2);
+
+ QTest::qWait(800);
+ QTIMED_COMPARE(rr->rotation() + rr2->rotation() + rr3->rotation() + rr4->rotation(), qreal(370*4));
+}
+
+void tst_qquickanimations::startStopSignals()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("signals.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(root);
+
+ QCOMPARE(root->property("startedCount").toInt(), 1); //autostart
+ QCOMPARE(root->property("stoppedCount").toInt(), 0);
+
+ QMetaObject::invokeMethod(root, "stop");
+
+ QCOMPARE(root->property("startedCount").toInt(), 1);
+ QCOMPARE(root->property("stoppedCount").toInt(), 1);
+
+ QMetaObject::invokeMethod(root, "start");
+
+ QCOMPARE(root->property("startedCount").toInt(), 2);
+ QCOMPARE(root->property("stoppedCount").toInt(), 1);
+
+ QTest::qWait(100);
+
+ QCOMPARE(root->property("startedCount").toInt(), 2);
+ QCOMPARE(root->property("stoppedCount").toInt(), 1);
+
+ QTest::qWait(100);
+
+ QTRY_COMPARE(root->property("stoppedCount").toInt(), 2);
+ QCOMPARE(root->property("startedCount").toInt(), 2);
+
+ root->setProperty("alwaysRunToEnd", true);
+
+ QMetaObject::invokeMethod(root, "start");
+
+ QCOMPARE(root->property("startedCount").toInt(), 3);
+ QCOMPARE(root->property("stoppedCount").toInt(), 2);
+
+ QTest::qWait(100);
+
+ QCOMPARE(root->property("startedCount").toInt(), 3);
+ QCOMPARE(root->property("stoppedCount").toInt(), 2);
+
+ QMetaObject::invokeMethod(root, "stop");
+
+ QCOMPARE(root->property("startedCount").toInt(), 3);
+ QCOMPARE(root->property("stoppedCount").toInt(), 2);
+
+ QTest::qWait(100);
+
+ QTRY_COMPARE(root->property("stoppedCount").toInt(), 3);
+ QCOMPARE(root->property("startedCount").toInt(), 3);
+}
+
+void tst_qquickanimations::runningTrueBug()
+{
+ //ensure we start correctly when "running: true" is explicitly set
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("runningTrueBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *cloud = rect->findChild<QQuickRectangle*>("cloud");
+ QVERIFY(cloud);
+ QTest::qWait(1000);
+ QVERIFY(cloud->x() > qreal(0));
+}
+
+//QTBUG-24308
+void tst_qquickanimations::pathAnimationInOutBackBug()
+{
+ //ensure we don't pass bad progress value (out of [0,1]) to QQuickPath::backwardsPointAt()
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathAnimationInOutBackCrash.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(item);
+
+ QQuickRectangle *rect = item->findChild<QQuickRectangle *>("rect");
+ QVERIFY(rect);
+ QTest::qWait(1000);
+ QCOMPARE(rect->x(), qreal(0));
+ QCOMPARE(rect->y(), qreal(0));
+}
+
+//QTBUG-12805
+void tst_qquickanimations::nonTransitionBug()
+{
+ //tests that the animation values from the previous transition are properly cleared
+ //in the case where an animation in the transition doesn't match anything (but previously did)
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("nonTransitionBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QQuickRectangle *mover = rect->findChild<QQuickRectangle*>("mover");
+
+ mover->setX(100);
+ QCOMPARE(mover->x(), qreal(100));
+
+ rectPrivate->setState("left");
+ QTRY_COMPARE(mover->x(), qreal(0));
+
+ mover->setX(100);
+ QCOMPARE(mover->x(), qreal(100));
+
+ //make sure we don't try to animate back to 0
+ rectPrivate->setState("free");
+ QTest::qWait(300);
+ QCOMPARE(mover->x(), qreal(100));
+}
+
+//QTBUG-14042
+void tst_qquickanimations::registrationBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("registrationBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QTRY_COMPARE(rect->property("value"), QVariant(int(100)));
+}
+
+void tst_qquickanimations::doubleRegistrationBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("doubleRegistrationBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickAbstractAnimation *anim = rect->findChild<QQuickAbstractAnimation*>("animation");
+ QVERIFY(anim != 0);
+ QTRY_COMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Stopped);
+}
+
+//QTBUG-16736
+void tst_qquickanimations::alwaysRunToEndRestartBug()
+{
+ QQuickRectangle rect;
+ QQuickPropertyAnimation animation;
+ animation.setTargetObject(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ animation.setDuration(1000);
+ animation.setLoops(-1);
+ animation.setAlwaysRunToEnd(true);
+ QVERIFY(animation.loops() == -1);
+ QVERIFY(animation.alwaysRunToEnd() == true);
+ animation.start();
+ animation.stop();
+ animation.start();
+ animation.stop();
+ QTest::qWait(500);
+ QVERIFY(rect.x() != qreal(200));
+ QTest::qWait(800);
+ QTIMED_COMPARE(rect.x(), qreal(200));
+ QCOMPARE(static_cast<QQuickAbstractAnimation*>(&animation)->qtAnimation()->state(), QAbstractAnimationJob::Stopped);
+}
+
+//QTBUG-20227
+void tst_qquickanimations::transitionAssignmentBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("transitionAssignmentBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->property("nullObject").toBool(), false);
+}
+
+//QTBUG-19080
+void tst_qquickanimations::pauseBindingBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("pauseBindingBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QQuickAbstractAnimation *anim = rect->findChild<QQuickAbstractAnimation*>("animation");
+ QVERIFY(anim->qtAnimation()->state() == QAbstractAnimationJob::Paused);
+
+ delete rect;
+}
+
+//QTBUG-13598
+void tst_qquickanimations::pauseBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("pauseBug.qml"));
+ QQuickAbstractAnimation *anim = qobject_cast<QQuickAbstractAnimation*>(c.create());
+ QVERIFY(anim != 0);
+ QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Paused);
+ QCOMPARE(anim->isPaused(), true);
+ QCOMPARE(anim->isRunning(), true);
+
+ delete anim;
+}
+
+//QTBUG-23092
+void tst_qquickanimations::loopingBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("looping.qml"));
+ QObject *obj = c.create();
+
+ QQuickAbstractAnimation *anim = obj->findChild<QQuickAbstractAnimation*>();
+ QVERIFY(anim != 0);
+ QCOMPARE(anim->qtAnimation()->totalDuration(), 300);
+ QCOMPARE(anim->isRunning(), true);
+ QTRY_COMPARE(static_cast<QAnimationGroupJob*>(anim->qtAnimation())->firstChild()->currentLoop(), 2);
+ QTRY_COMPARE(anim->isRunning(), false);
+
+ QQuickRectangle *rect = obj->findChild<QQuickRectangle*>();
+ QVERIFY(rect != 0);
+ QCOMPARE(rect->rotation(), qreal(90));
+
+ delete obj;
+}
+
+//QTBUG-24532
+void tst_qquickanimations::anchorBug()
+{
+ QQuickAnchorAnimation animation;
+ animation.setDuration(5000);
+ animation.setEasing(QEasingCurve(QEasingCurve::InOutBack));
+ animation.start();
+ animation.pause();
+
+ QCOMPARE(animation.qtAnimation()->duration(), 5000);
+ QCOMPARE(static_cast<QQuickBulkValueAnimator*>(animation.qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutBack));
+}
+
+//ScriptAction should not match a StateChangeScript if no scriptName has been specified
+void tst_qquickanimations::scriptActionBug()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("scriptActionBug.qml"));
+ QObject *obj = c.create();
+
+ //Both the ScriptAction and StateChangeScript should be triggered
+ QCOMPARE(obj->property("actionTriggered").toBool(), true);
+ QCOMPARE(obj->property("actionTriggered").toBool(), true);
+}
+
+QTEST_MAIN(tst_qquickanimations)
+
+#include "tst_qquickanimations.moc"
diff --git a/tests/auto/quick/qquickapplication/qquickapplication.pro b/tests/auto/quick/qquickapplication/qquickapplication.pro
new file mode 100644
index 0000000000..7079478628
--- /dev/null
+++ b/tests/auto/quick/qquickapplication/qquickapplication.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qquickapplication
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickapplication.cpp
+QT += core-private gui-private qml quick qml-private quick-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
new file mode 100644
index 0000000000..b8986fbf85
--- /dev/null
+++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+#include <QtGui/qinputmethod.h>
+#include <qpa/qwindowsysteminterface.h>
+
+class tst_qquickapplication : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qquickapplication();
+
+private slots:
+ void active();
+ void layoutDirection();
+ void inputMethod();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qquickapplication::tst_qquickapplication()
+{
+}
+
+void tst_qquickapplication::active()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; "
+ "Item { "
+ " property bool active: Qt.application.active; "
+ " property bool active2: false; "
+ " Connections { "
+ " target: Qt.application; "
+ " onActiveChanged: active2 = Qt.application.active; "
+ " } "
+ "}", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
+ QVERIFY(item);
+ QQuickWindow window;
+ item->setParentItem(window.contentItem());
+
+ // not active
+ QVERIFY(!item->property("active").toBool());
+ QVERIFY(!item->property("active2").toBool());
+
+ // active
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(QGuiApplication::focusWindow() == &window);
+ QVERIFY(item->property("active").toBool());
+ QVERIFY(item->property("active2").toBool());
+
+ // not active again
+ QWindowSystemInterface::handleWindowActivated(0);
+
+ QTRY_VERIFY(QGuiApplication::focusWindow() != &window);
+ QVERIFY(!item->property("active").toBool());
+ QVERIFY(!item->property("active2").toBool());
+}
+
+void tst_qquickapplication::layoutDirection()
+{
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Item { property bool layoutDirection: Qt.application.layoutDirection }", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
+ QVERIFY(item);
+ QQuickView view;
+ item->setParentItem(view.rootObject());
+
+ // not mirrored
+ QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::LeftToRight);
+
+ // mirrored
+ QGuiApplication::setLayoutDirection(Qt::RightToLeft);
+ QEXPECT_FAIL("", "QTBUG-21573", Abort);
+ QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::RightToLeft);
+
+ // not mirrored again
+ QGuiApplication::setLayoutDirection(Qt::LeftToRight);
+ QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::LeftToRight);
+}
+
+void tst_qquickapplication::inputMethod()
+{
+ // technically not in QQuickApplication, but testing anyway here
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Item { property variant inputMethod: Qt.inputMethod }", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
+ QVERIFY(item);
+ QQuickView view;
+ item->setParentItem(view.rootObject());
+
+ // check that the inputMethod property maches with application's input method
+ QCOMPARE(qvariant_cast<QObject*>(item->property("inputMethod")), qApp->inputMethod());
+}
+
+
+QTEST_MAIN(tst_qquickapplication)
+
+#include "tst_qquickapplication.moc"
diff --git a/tests/auto/quick/qquickbehaviors/data/binding.qml b/tests/auto/quick/qquickbehaviors/data/binding.qml
new file mode 100644
index 0000000000..5aceefa743
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/binding.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ property real basex : 0
+ property real movedx: 200
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ x: basex
+ Behavior on x { NumberAnimation { duration: 800; } }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: movedx
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/color.qml b/tests/auto/quick/qquickbehaviors/data/color.qml
new file mode 100644
index 0000000000..a318578a9b
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/color.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100;
+ color: "green"
+ Behavior on color { ColorAnimation { duration: 500; } }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "red"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ color: "red"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/cpptrigger.qml b/tests/auto/quick/qquickbehaviors/data/cpptrigger.qml
new file mode 100644
index 0000000000..f033ec5aeb
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/cpptrigger.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x { NumberAnimation { duration: 500; } }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/delayedRegistration.qml b/tests/auto/quick/qquickbehaviors/data/delayedRegistration.qml
new file mode 100644
index 0000000000..ed35a308f7
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/delayedRegistration.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ width: 400; height: 400;
+ property Item myItem
+
+ function doCreate() {
+ myItem = myComponent.createObject(container)
+ myItem.x = 100
+ }
+
+ Component {
+ id: myComponent
+ Rectangle {
+ width: 100
+ height: 100
+ color: "green"
+ Behavior on x { NumberAnimation { duration: 500 } }
+ }
+ }
+
+ Component.onCompleted: doCreate()
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/disabled.qml b/tests/auto/quick/qquickbehaviors/data/disabled.qml
new file mode 100644
index 0000000000..20860d8dde
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/disabled.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x {
+ objectName: "MyBehavior";
+ enabled: false
+ NumberAnimation { duration: 200; }
+ }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/dontStart.qml b/tests/auto/quick/qquickbehaviors/data/dontStart.qml
new file mode 100644
index 0000000000..38e1ea9d9e
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/dontStart.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: wrapper
+ width: 600
+ height: 400
+
+ Rectangle {
+ id: redRect
+ width: 100; height: 100
+ color: Qt.rgba(1,0,0)
+ Behavior on x {
+ NumberAnimation {id: myAnim; objectName: "MyAnim"; running: true }
+ }
+
+ }
+
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/empty.qml b/tests/auto/quick/qquickbehaviors/data/empty.qml
new file mode 100644
index 0000000000..d8f115390a
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/empty.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x {}
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/explicit.qml b/tests/auto/quick/qquickbehaviors/data/explicit.qml
new file mode 100644
index 0000000000..20875c30e3
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/explicit.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x {
+ objectName: "MyBehavior";
+ NumberAnimation { target: rect; property: "x"; duration: 500; }
+ }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/groupProperty.qml b/tests/auto/quick/qquickbehaviors/data/groupProperty.qml
new file mode 100644
index 0000000000..a05ab7d54b
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/groupProperty.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on pos { PropertyAnimation { duration: 500; } }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ pos: Qt.point(200,0);
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/groupProperty2.qml b/tests/auto/quick/qquickbehaviors/data/groupProperty2.qml
new file mode 100644
index 0000000000..2f3de5131c
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/groupProperty2.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on border.width { NumberAnimation { duration: 500; } }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ border.width: 4;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/groupedPropertyCrash.qml b/tests/auto/quick/qquickbehaviors/data/groupedPropertyCrash.qml
new file mode 100644
index 0000000000..6835902bc5
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/groupedPropertyCrash.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+ Text {
+ Behavior on anchors.verticalCenterOffset { NumberAnimation { duration: 300; } }
+ text: "Hello World"
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/loop.qml b/tests/auto/quick/qquickbehaviors/data/loop.qml
new file mode 100644
index 0000000000..3e8d88734d
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/loop.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x { NumberAnimation { duration: 200; } }
+ onXChanged: x = 100;
+ }
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml b/tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml
new file mode 100644
index 0000000000..029a439607
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pointSize: 24
+ Behavior on font.pointSize { NumberAnimation {} }
+ }
+
+ function updateFontProperties() {
+ text.font.italic = true
+ text.font.pointSize = 48
+ text.font.weight = Font.Bold
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/nonSelecting2.qml b/tests/auto/quick/qquickbehaviors/data/nonSelecting2.qml
new file mode 100644
index 0000000000..6357094cfe
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/nonSelecting2.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x {
+ objectName: "MyBehavior";
+ NumberAnimation { targets: rect; properties: "y"; duration: 200; }
+ }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/parent.qml b/tests/auto/quick/qquickbehaviors/data/parent.qml
new file mode 100644
index 0000000000..f8c2731d86
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/parent.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on parent {
+ SequentialAnimation {
+ PauseAnimation { duration: 500 }
+ PropertyAction {}
+ }
+ }
+ }
+ Item {
+ id: newParent
+ objectName: "NewParent"
+ x: 100
+ }
+ states: State {
+ name: "reparented"
+ PropertyChanges {
+ target: rect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/qtbug12295.qml b/tests/auto/quick/qquickbehaviors/data/qtbug12295.qml
new file mode 100644
index 0000000000..c6bef581a4
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/qtbug12295.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "blue"
+
+ Rectangle {
+ id: myRect
+ objectName: "myRect"
+ width: 100
+ height: 100
+ Behavior on x {
+ NumberAnimation { duration: 500 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/reassignedAnimation.qml b/tests/auto/quick/qquickbehaviors/data/reassignedAnimation.qml
new file mode 100644
index 0000000000..5731cb3efd
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/reassignedAnimation.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x {
+ id: myBehavior
+ objectName: "MyBehavior"
+ NumberAnimation {id: na1; duration: 200 }
+ }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+
+ NumberAnimation {id: na2; duration: 1000 }
+ Component.onCompleted: {
+ myBehavior.animation = na2;
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/runningTrue.qml b/tests/auto/quick/qquickbehaviors/data/runningTrue.qml
new file mode 100644
index 0000000000..4fd1136f3a
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/runningTrue.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width:200; height:200
+
+ property real myValue: 0
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 100
+ height: 100
+ color: "green"
+ smooth: true
+ rotation: myValue
+ Behavior on rotation {
+ RotationAnimation { id: rotAnim; objectName: "rotAnim"; direction: RotationAnimation.Shortest }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/scripttrigger.qml b/tests/auto/quick/qquickbehaviors/data/scripttrigger.qml
new file mode 100644
index 0000000000..ff71f2b1b0
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/scripttrigger.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+
+ onColorChanged: {
+ rect.x = 200
+ }
+
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x { NumberAnimation { duration: 800; } }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/simple.qml b/tests/auto/quick/qquickbehaviors/data/simple.qml
new file mode 100644
index 0000000000..c64a6e1928
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/simple.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: rect
+ objectName: "MyRect"
+ width: 100; height: 100; color: "green"
+ Behavior on x {
+ objectName: "MyBehavior";
+ NumberAnimation {id: na; duration: 500; }
+ }
+ }
+ MouseArea {
+ id: clicker
+ anchors.fill: parent
+ }
+ states: State {
+ name: "moved"
+ when: clicker.pressed
+ PropertyChanges {
+ target: rect
+ x: 200
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/startOnCompleted.qml b/tests/auto/quick/qquickbehaviors/data/startOnCompleted.qml
new file mode 100644
index 0000000000..fdc3779a5c
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/startOnCompleted.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ id: innerRect
+ width: 100; height: 100
+ color: "green"
+ Behavior on x { NumberAnimation {} }
+ }
+
+ Component.onCompleted: innerRect.x = 100
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/startup.qml b/tests/auto/quick/qquickbehaviors/data/startup.qml
new file mode 100644
index 0000000000..9fa74ca39e
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/startup.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ objectName: "innerRect"
+ height: 100; width: 100; color: "green"
+ property real targetX: 100
+
+ x: targetX
+ Behavior on x {
+ NumberAnimation {}
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/startup2.qml b/tests/auto/quick/qquickbehaviors/data/startup2.qml
new file mode 100644
index 0000000000..0654ef3644
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/startup2.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 800;
+ height: 480;
+
+ Text { id:theText; text: "hello world" }
+
+ Rectangle {
+ objectName: "innerRect"
+ color: "red"
+ x: theText.width
+ Behavior on x { NumberAnimation {} }
+ width: 100; height: 100
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/valueType.qml b/tests/auto/quick/qquickbehaviors/data/valueType.qml
new file mode 100644
index 0000000000..7bc8297dc7
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/valueType.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+
+ color.r: 1
+ color.g: 0
+ color.b: 1
+
+ Behavior on color.r { NumberAnimation { duration: 500; } }
+
+ function changeR() { color.r = 0 }
+}
diff --git a/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro
new file mode 100644
index 0000000000..cbe9cf76fe
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/qquickbehaviors.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickbehaviors
+SOURCES += tst_qquickbehaviors.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
new file mode 100644
index 0000000000..c40abbd55f
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
@@ -0,0 +1,500 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <qsignalspy.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickbehavior_p.h>
+#include <QtQuick/private/qquickanimation_p.h>
+#include <private/qquickitem_p.h>
+#include "../../shared/util.h"
+
+class tst_qquickbehaviors : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickbehaviors() {}
+
+private slots:
+ void init() { qApp->processEvents(); } //work around animation timer bug (QTBUG-22865)
+ void simpleBehavior();
+ void scriptTriggered();
+ void cppTriggered();
+ void loop();
+ void colorBehavior();
+ void parentBehavior();
+ void replaceBinding();
+ //void transitionOverrides();
+ void group();
+ void valueType();
+ void emptyBehavior();
+ void explicitSelection();
+ void nonSelectingBehavior();
+ void reassignedAnimation();
+ void disabled();
+ void dontStart();
+ void startup();
+ void groupedPropertyCrash();
+ void runningTrue();
+ void sameValue();
+ void delayedRegistration();
+ void startOnCompleted();
+ void multipleChangesToValueType();
+};
+
+void tst_qquickbehaviors::simpleBehavior()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("simple.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+ QTRY_VERIFY(qobject_cast<QQuickBehavior*>(rect->findChild<QQuickBehavior*>("MyBehavior"))->animation());
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() > 0);
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() < 200);
+ //i.e. the behavior has been triggered
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::scriptTriggered()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("scripttrigger.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+
+ rect->setColor(QColor("red"));
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() > 0);
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() < 200);
+ //i.e. the behavior has been triggered
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::cppTriggered()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("cpptrigger.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QTRY_VERIFY(innerRect);
+
+ innerRect->setProperty("x", 200);
+ QTRY_VERIFY(innerRect->x() > 0);
+ QTRY_VERIFY(innerRect->x() < 200); //i.e. the behavior has been triggered
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::loop()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("loop.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+
+ //don't crash
+ QQuickItemPrivate::get(rect)->setState("moved");
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::colorBehavior()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("color.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("red");
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->color() != QColor("red"));
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->color() != QColor("green"));
+ //i.e. the behavior has been triggered
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::parentBehavior()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("parent.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("reparented");
+ QTRY_VERIFY(rect->findChild<QQuickRectangle*>("MyRect")->parentItem() != rect->findChild<QQuickItem*>("NewParent"));
+ QTRY_VERIFY(rect->findChild<QQuickRectangle*>("MyRect")->parentItem() == rect->findChild<QQuickItem*>("NewParent"));
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::replaceBinding()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("binding.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QTRY_VERIFY(innerRect);
+ QTRY_VERIFY(innerRect->x() > 0);
+ QTRY_VERIFY(innerRect->x() < 200);
+ //i.e. the behavior has been triggered
+ QTRY_COMPARE(innerRect->x(), (qreal)200);
+ rect->setProperty("basex", 10);
+ QTRY_COMPARE(innerRect->x(), (qreal)200);
+ rect->setProperty("movedx", 210);
+ QTRY_COMPARE(innerRect->x(), (qreal)210);
+
+ QQuickItemPrivate::get(rect)->setState("");
+ QTRY_VERIFY(innerRect->x() > 10);
+ QTRY_VERIFY(innerRect->x() < 210); //i.e. the behavior has been triggered
+ QTRY_COMPARE(innerRect->x(), (qreal)10);
+ rect->setProperty("movedx", 200);
+ QTRY_COMPARE(innerRect->x(), (qreal)10);
+ rect->setProperty("basex", 20);
+ QTRY_COMPARE(innerRect->x(), (qreal)20);
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::group()
+{
+ /* XXX TODO Create a test element for this case.
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("groupProperty.qml")));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ qDebug() << c.errorString();
+ QTRY_VERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ //QTest::qWait(200);
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() > 0);
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() < 200);
+ //i.e. the behavior has been triggered
+
+ delete rect;
+ }
+ */
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("groupProperty2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QTRY_VERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->border()->width() > 0);
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->border()->width() < 4);
+ //i.e. the behavior has been triggered
+
+ delete rect;
+ }
+}
+
+void tst_qquickbehaviors::valueType()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("valueType.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ //QTBUG-20827
+ QCOMPARE(rect->color(), QColor::fromRgb(255,0,255));
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::emptyBehavior()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("empty.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ qreal x = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x();
+ QCOMPARE(x, qreal(200)); //should change immediately
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::explicitSelection()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("explicit.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() > 0);
+ QTRY_VERIFY(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x() < 200);
+ //i.e. the behavior has been triggered
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::nonSelectingBehavior()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("nonSelecting2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ qreal x = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x();
+ QCOMPARE(x, qreal(200)); //should change immediately
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::reassignedAnimation()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("reassignedAnimation.qml"));
+ QString warning = testFileUrl("reassignedAnimation.qml").toString() + ":9:9: QML Behavior: Cannot change the animation assigned to a Behavior.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+ QCOMPARE(qobject_cast<QQuickNumberAnimation*>(
+ rect->findChild<QQuickBehavior*>("MyBehavior")->animation())->duration(), 200);
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::disabled()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("disabled.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+ QCOMPARE(rect->findChild<QQuickBehavior*>("MyBehavior")->enabled(), false);
+
+ QQuickItemPrivate::get(rect)->setState("moved");
+ qreal x = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"))->x();
+ QCOMPARE(x, qreal(200)); //should change immediately
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::dontStart()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("dontStart.qml"));
+
+ QString warning = c.url().toString() + ":13:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickAbstractAnimation *myAnim = rect->findChild<QQuickAbstractAnimation*>("MyAnim");
+ QVERIFY(myAnim && !myAnim->qtAnimation());
+
+ delete rect;
+}
+
+void tst_qquickbehaviors::startup()
+{
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("startup.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *innerRect = rect->findChild<QQuickRectangle*>("innerRect");
+ QVERIFY(innerRect);
+
+ QCOMPARE(innerRect->x(), qreal(100)); //should be set immediately
+
+ delete rect;
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("startup2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *innerRect = rect->findChild<QQuickRectangle*>("innerRect");
+ QVERIFY(innerRect);
+
+ QQuickText *text = rect->findChild<QQuickText*>();
+ QVERIFY(text);
+
+ QCOMPARE(innerRect->x(), text->width()); //should be set immediately
+
+ delete rect;
+ }
+}
+
+//QTBUG-10799
+void tst_qquickbehaviors::groupedPropertyCrash()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("groupedPropertyCrash.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect); //don't crash
+
+ delete rect;
+}
+
+//QTBUG-5491
+void tst_qquickbehaviors::runningTrue()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("runningTrue.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickAbstractAnimation *animation = rect->findChild<QQuickAbstractAnimation*>("rotAnim");
+ QVERIFY(animation);
+
+ QSignalSpy runningSpy(animation, SIGNAL(runningChanged(bool)));
+ rect->setProperty("myValue", 180);
+ QTRY_VERIFY(runningSpy.count() > 0);
+
+ delete rect;
+}
+
+//QTBUG-12295
+void tst_qquickbehaviors::sameValue()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("qtbug12295.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *target = rect->findChild<QQuickRectangle*>("myRect");
+ QVERIFY(target);
+
+ target->setX(100);
+ QCOMPARE(target->x(), qreal(100));
+
+ target->setProperty("x", 0);
+ QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
+ QTRY_VERIFY(target->x() == qreal(0)); //make sure Behavior has finished.
+
+ target->setX(100);
+ QCOMPARE(target->x(), qreal(100));
+
+ //this is the main point of the test -- the behavior needs to be triggered again
+ //even though we set 0 twice in a row.
+ target->setProperty("x", 0);
+ QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100));
+
+ delete rect;
+}
+
+//QTBUG-18362
+void tst_qquickbehaviors::delayedRegistration()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("delayedRegistration.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickItem *innerRect = rect->property("myItem").value<QQuickItem*>();
+ QVERIFY(innerRect != 0);
+
+ QCOMPARE(innerRect->property("x").toInt(), int(0));
+
+ QTRY_COMPARE(innerRect->property("x").toInt(), int(100));
+}
+
+//QTBUG-22555
+void tst_qquickbehaviors::startOnCompleted()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("startOnCompleted.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickItem *innerRect = rect->findChild<QQuickRectangle*>();
+ QVERIFY(innerRect != 0);
+
+ QCOMPARE(innerRect->property("x").toInt(), int(0));
+
+ QTRY_COMPARE(innerRect->property("x").toInt(), int(100));
+
+ delete rect;
+}
+
+//QTBUG-25139
+void tst_qquickbehaviors::multipleChangesToValueType()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("multipleChangesToValueType.qml"));
+ QScopedPointer<QQuickRectangle> rect(qobject_cast<QQuickRectangle *>(c.create()));
+ QVERIFY(rect != 0);
+
+ QQuickText *text = rect->findChild<QQuickText *>();
+ QVERIFY(text != 0);
+
+ QFont value;
+ value.setPointSize(24);
+ QCOMPARE(text->property("font").value<QFont>(), value);
+
+ QVERIFY(QMetaObject::invokeMethod(rect.data(), "updateFontProperties"));
+
+ value.setItalic(true);
+ value.setWeight(QFont::Bold);
+ QCOMPARE(text->property("font").value<QFont>(), value);
+
+ value.setPointSize(48);
+ QTRY_COMPARE(text->property("font").value<QFont>(), value);
+}
+
+QTEST_MAIN(tst_qquickbehaviors)
+
+#include "tst_qquickbehaviors.moc"
diff --git a/tests/auto/quick/qquickborderimage/data/colors-mirror.png b/tests/auto/quick/qquickborderimage/data/colors-mirror.png
new file mode 100644
index 0000000000..e30870dd1e
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/colors-mirror.png
Binary files differ
diff --git a/tests/auto/quick/qquickborderimage/data/colors-round-quotes.sci b/tests/auto/quick/qquickborderimage/data/colors-round-quotes.sci
new file mode 100644
index 0000000000..294f3cfe48
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/colors-round-quotes.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:"colors.png"
diff --git a/tests/auto/quick/qquickborderimage/data/colors-round-remote.sci b/tests/auto/quick/qquickborderimage/data/colors-round-remote.sci
new file mode 100644
index 0000000000..c673bed598
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/colors-round-remote.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:http://127.0.0.1:14446/colors.png
diff --git a/tests/auto/quick/qquickborderimage/data/colors-round.sci b/tests/auto/quick/qquickborderimage/data/colors-round.sci
new file mode 100644
index 0000000000..5d2f49f0e1
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/colors-round.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.right:30
+border.bottom:40
+horizontalTileRule:Round
+verticalTileRule:Repeat
+source:colors.png
diff --git a/tests/auto/quick/qquickborderimage/data/colors.png b/tests/auto/quick/qquickborderimage/data/colors.png
new file mode 100644
index 0000000000..dfb62f3d64
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/colors.png
Binary files differ
diff --git a/tests/auto/quick/qquickborderimage/data/heart200.png b/tests/auto/quick/qquickborderimage/data/heart200.png
new file mode 100644
index 0000000000..5a31ae8f4d
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/heart200.png
Binary files differ
diff --git a/tests/auto/quick/qquickborderimage/data/heart200_copy.png b/tests/auto/quick/qquickborderimage/data/heart200_copy.png
new file mode 100644
index 0000000000..5a31ae8f4d
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/heart200_copy.png
Binary files differ
diff --git a/tests/auto/quick/qquickborderimage/data/invalid.sci b/tests/auto/quick/qquickborderimage/data/invalid.sci
new file mode 100644
index 0000000000..98c72c9bf1
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/invalid.sci
@@ -0,0 +1,7 @@
+border.left:10
+border.top:20
+border.down:30
+border.up:40
+horizontalTileRule:Roun
+verticalTileRule:Repea
+source:colors.png
diff --git a/tests/auto/quick/qquickborderimage/data/mirror.qml b/tests/auto/quick/qquickborderimage/data/mirror.qml
new file mode 100644
index 0000000000..abab076e08
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/mirror.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+BorderImage {
+ source: "colors-mirror.png"
+ width: 300; height: 300
+ border { top: 30; right: 30; bottom: 30; left: 30 }
+}
diff --git a/tests/auto/quick/qquickborderimage/data/valid1.sci b/tests/auto/quick/qquickborderimage/data/valid1.sci
new file mode 100644
index 0000000000..6925c48af6
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/valid1.sci
@@ -0,0 +1,7 @@
+border.left: 10
+border.top: 20
+border.right: 30
+border.bottom: 40
+horizontalTileMode: Round
+verticalTileMode: Repeat
+source: colors.png
diff --git a/tests/auto/quick/qquickborderimage/data/valid2.sci b/tests/auto/quick/qquickborderimage/data/valid2.sci
new file mode 100644
index 0000000000..a0247818bb
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/valid2.sci
@@ -0,0 +1,7 @@
+border.left: 10
+border.top: 20
+border.right: 30
+border.bottom: 40
+horizontalTileMode: "Round"
+verticalTileMode: "Repeat"
+source: colors.png
diff --git a/tests/auto/quick/qquickborderimage/data/valid3.sci b/tests/auto/quick/qquickborderimage/data/valid3.sci
new file mode 100644
index 0000000000..688b072a87
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/valid3.sci
@@ -0,0 +1,7 @@
+border.left: 10
+border.top: 20
+border.right: 30
+border.bottom: 40
+horizontalTileMode: BorderImage.Round
+verticalTileMode: BorderImage.Repeat
+source: colors.png
diff --git a/tests/auto/quick/qquickborderimage/data/valid4.sci b/tests/auto/quick/qquickborderimage/data/valid4.sci
new file mode 100644
index 0000000000..39db0aeb8a
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/data/valid4.sci
@@ -0,0 +1,7 @@
+border.left: 10
+border.top: 20
+border.right: 30
+border.bottom: 40
+horizontalTileMode: "BorderImage.Round"
+verticalTileMode: "BorderImage.Repeat"
+source: colors.png
diff --git a/tests/auto/quick/qquickborderimage/qquickborderimage.pro b/tests/auto/quick/qquickborderimage/qquickborderimage.pro
new file mode 100644
index 0000000000..ac213f0265
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/qquickborderimage.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickborderimage
+macx:CONFIG -= app_bundle
+
+HEADERS += ../../shared/testhttpserver.h
+SOURCES += tst_qquickborderimage.cpp \
+ ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
new file mode 100644
index 0000000000..b795d23da4
--- /dev/null
+++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
@@ -0,0 +1,589 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QTextDocument>
+#include <QTcpServer>
+#include <QTcpSocket>
+#include <QDir>
+#include <QPainter>
+#include <QSignalSpy>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <private/qquickborderimage_p.h>
+#include <private/qquickimagebase_p.h>
+#include <private/qquickscalegrid_p_p.h>
+#include <private/qquickloader_p.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlcontext.h>
+
+#include "../../shared/testhttpserver.h"
+#include "../../shared/util.h"
+
+#define SERVER_PORT 14446
+#define SERVER_ADDR "http://127.0.0.1:14446"
+
+Q_DECLARE_METATYPE(QQuickImageBase::Status)
+
+class tst_qquickborderimage : public QQmlDataTest
+
+{
+ Q_OBJECT
+public:
+ tst_qquickborderimage();
+
+private slots:
+ void cleanup();
+ void noSource();
+ void imageSource();
+ void imageSource_data();
+ void clearSource();
+ void resized();
+ void smooth();
+ void mirror();
+ void tileModes();
+ void sciSource();
+ void sciSource_data();
+ void invalidSciFile();
+ void validSciFiles_data();
+ void validSciFiles();
+ void pendingRemoteRequest();
+ void pendingRemoteRequest_data();
+ void statusChanges();
+ void statusChanges_data();
+ void sourceSizeChanges();
+ void progressAndStatusChanges();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qquickborderimage::cleanup()
+{
+ QQuickWindow window;
+ window.releaseResources();
+ engine.clearComponentCache();
+}
+
+tst_qquickborderimage::tst_qquickborderimage()
+{
+}
+
+void tst_qquickborderimage::noSource()
+{
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->source(), QUrl());
+ QCOMPARE(obj->width(), 0.);
+ QCOMPARE(obj->height(), 0.);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Stretch);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Stretch);
+
+ delete obj;
+}
+
+void tst_qquickborderimage::imageSource_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<bool>("remote");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("local") << testFileUrl("colors.png").toString() << false << "";
+ QTest::newRow("local not found") << testFileUrl("no-such-file.png").toString() << false
+ << "file::2:1: QML BorderImage: Cannot open: " + testFileUrl("no-such-file.png").toString();
+ QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << "";
+ QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true
+ << "file::2:1: QML BorderImage: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
+}
+
+void tst_qquickborderimage::imageSource()
+{
+ QFETCH(QString, source);
+ QFETCH(bool, remote);
+ QFETCH(QString, error);
+
+ TestHTTPServer *server = 0;
+ if (remote) {
+ server = new TestHTTPServer(SERVER_PORT);
+ QVERIFY(server->isValid());
+ server->serveDirectory(dataDirectory());
+ }
+
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ if (remote)
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Loading);
+
+ QCOMPARE(obj->source(), remote ? source : QUrl(source));
+
+ if (error.isEmpty()) {
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Ready);
+ QCOMPARE(obj->width(), 120.);
+ QCOMPARE(obj->height(), 120.);
+ QCOMPARE(obj->sourceSize().width(), 120);
+ QCOMPARE(obj->sourceSize().height(), 120);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Stretch);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Stretch);
+ } else {
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Error);
+ }
+
+ delete obj;
+ delete server;
+}
+
+void tst_qquickborderimage::clearSource()
+{
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: srcImage }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QQuickBorderImage::Ready);
+ QCOMPARE(obj->width(), 120.);
+ QCOMPARE(obj->height(), 120.);
+
+ ctxt->setContextProperty("srcImage", "");
+ QVERIFY(obj->source().isEmpty());
+ QVERIFY(obj->status() == QQuickBorderImage::Null);
+ QCOMPARE(obj->width(), 0.);
+ QCOMPARE(obj->height(), 0.);
+
+ delete obj;
+}
+
+void tst_qquickborderimage::resized()
+{
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFileUrl("colors.png").toString() + "\"; width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->sourceSize().width(), 120);
+ QCOMPARE(obj->sourceSize().height(), 120);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Stretch);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Stretch);
+
+ delete obj;
+}
+
+void tst_qquickborderimage::smooth()
+{
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFile("colors.png") + "\"; smooth: true; width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->smooth(), true);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Stretch);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Stretch);
+
+ delete obj;
+}
+
+void tst_qquickborderimage::mirror()
+{
+ QQuickView *window = new QQuickView;
+ window->setSource(testFileUrl("mirror.qml"));
+ QQuickBorderImage *image = qobject_cast<QQuickBorderImage*>(window->rootObject());
+ QVERIFY(image != 0);
+
+ QImage screenshot = window->grabWindow();
+
+ QImage srcPixmap(screenshot);
+ QTransform transform;
+ transform.translate(image->width(), 0).scale(-1, 1.0);
+ srcPixmap = srcPixmap.transformed(transform);
+
+ image->setProperty("mirror", true);
+ screenshot = window->grabWindow();
+ QCOMPARE(screenshot, srcPixmap);
+
+ delete window;
+}
+
+void tst_qquickborderimage::tileModes()
+{
+ {
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFile("colors.png") + "\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 100.);
+ QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Repeat);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Repeat);
+
+ delete obj;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFile("colors.png") + "\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 150.);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Round);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Round);
+
+ delete obj;
+ }
+}
+
+void tst_qquickborderimage::sciSource()
+{
+ QFETCH(QString, source);
+ QFETCH(bool, valid);
+
+ bool remote = source.startsWith("http");
+ TestHTTPServer *server = 0;
+ if (remote) {
+ server = new TestHTTPServer(SERVER_PORT);
+ QVERIFY(server->isValid());
+ server->serveDirectory(dataDirectory());
+ }
+
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ if (remote)
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Loading);
+
+ QCOMPARE(obj->source(), remote ? source : QUrl(source));
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 300.);
+
+ if (valid) {
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Ready);
+ QCOMPARE(obj->border()->left(), 10);
+ QCOMPARE(obj->border()->top(), 20);
+ QCOMPARE(obj->border()->right(), 30);
+ QCOMPARE(obj->border()->bottom(), 40);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Round);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Repeat);
+ } else {
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Error);
+ }
+
+ delete obj;
+ delete server;
+}
+
+void tst_qquickborderimage::sciSource_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<bool>("valid");
+
+ QTest::newRow("local") << testFileUrl("colors-round.sci").toString() << true;
+ QTest::newRow("local quoted filename") << testFileUrl("colors-round-quotes.sci").toString() << true;
+ QTest::newRow("local not found") << testFileUrl("no-such-file.sci").toString() << false;
+ QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true;
+ QTest::newRow("remote filename quoted") << SERVER_ADDR "/colors-round-quotes.sci" << true;
+ QTest::newRow("remote image") << SERVER_ADDR "/colors-round-remote.sci" << true;
+ QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.sci" << false;
+}
+
+void tst_qquickborderimage::invalidSciFile()
+{
+ QTest::ignoreMessage(QtWarningMsg, "QQuickGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Roun"
+ QTest::ignoreMessage(QtWarningMsg, "QQuickGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Repea"
+
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFileUrl("invalid.sci").toString() +"\"; width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->status(), QQuickImageBase::Error);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Stretch);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Stretch);
+
+ delete obj;
+}
+
+void tst_qquickborderimage::validSciFiles_data()
+{
+ QTest::addColumn<QString>("source");
+
+ QTest::newRow("valid1") << testFileUrl("valid1.sci").toString();
+ QTest::newRow("valid2") << testFileUrl("valid2.sci").toString();
+ QTest::newRow("valid3") << testFileUrl("valid3.sci").toString();
+ QTest::newRow("valid4") << testFileUrl("valid4.sci").toString();
+}
+
+void tst_qquickborderimage::validSciFiles()
+{
+ QFETCH(QString, source);
+
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source +"\"; width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Round);
+ QCOMPARE(obj->verticalTileMode(), QQuickBorderImage::Repeat);
+
+ delete obj;
+}
+
+void tst_qquickborderimage::pendingRemoteRequest()
+{
+ QFETCH(QString, source);
+
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->status(), QQuickBorderImage::Loading);
+
+ // verify no crash
+ // This will cause a delayed "QThread: Destroyed while thread is still running" warning
+ delete obj;
+ QTest::qWait(50);
+}
+
+void tst_qquickborderimage::pendingRemoteRequest_data()
+{
+ QTest::addColumn<QString>("source");
+
+ QTest::newRow("png file") << "http://localhost/none.png";
+ QTest::newRow("sci file") << "http://localhost/none.sci";
+}
+
+//QTBUG-26155
+void tst_qquickborderimage::statusChanges_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<int>("emissions");
+ QTest::addColumn<bool>("remote");
+ QTest::addColumn<QQuickImageBase::Status>("finalStatus");
+
+ QTest::newRow("localfile") << testFileUrl("colors.png").toString() << 1 << false << QQuickImageBase::Ready;
+ QTest::newRow("nofile") << "" << 0 << false << QQuickImageBase::Null;
+ QTest::newRow("nonexistent") << testFileUrl("thisfiledoesnotexist.png").toString() << 1 << false << QQuickImageBase::Error;
+ QTest::newRow("noprotocol") << QString("thisfiledoesnotexisteither.png") << 2 << false << QQuickImageBase::Error;
+ QTest::newRow("remote") << "http://localhost:14446/colors.png" << 2 << true << QQuickImageBase::Ready;
+}
+
+void tst_qquickborderimage::statusChanges()
+{
+ QFETCH(QString, source);
+ QFETCH(int, emissions);
+ QFETCH(bool, remote);
+ QFETCH(QQuickImageBase::Status, finalStatus);
+
+ TestHTTPServer *server = 0;
+ if (remote) {
+ server = new TestHTTPServer(SERVER_PORT);
+ QVERIFY(server->isValid());
+ server->serveDirectory(dataDirectory(), TestHTTPServer::Delay);
+ }
+
+ QString componentStr = "import QtQuick 2.0\nBorderImage { width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl(""));
+
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ qRegisterMetaType<QQuickImageBase::Status>();
+ QSignalSpy spy(obj, SIGNAL(statusChanged(QQuickImageBase::Status)));
+ QVERIFY(obj != 0);
+ obj->setSource(source);
+ if (remote)
+ server->sendDelayedItem();
+ QTRY_VERIFY(obj->status() == finalStatus);
+ QCOMPARE(spy.count(), emissions);
+
+ delete obj;
+ delete server;
+}
+
+void tst_qquickborderimage::sourceSizeChanges()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nBorderImage { source: srcImage }", QUrl::fromLocalFile(""));
+ QTRY_VERIFY(component.isReady());
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", "");
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged()));
+
+ // Local
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Null);
+ QTRY_COMPARE(sourceSizeSpy.count(), 0);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("heart200.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("heart200.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("heart200_copy.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 2);
+
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Null);
+ QTRY_COMPARE(sourceSizeSpy.count(), 3);
+
+ // Remote
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/heart200.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/heart200.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/heart200_copy.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/colors.png"));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 5);
+
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(obj->status(), QQuickBorderImage::Null);
+ QTRY_COMPARE(sourceSizeSpy.count(), 6);
+
+ delete obj;
+}
+
+void tst_qquickborderimage::progressAndStatusChanges()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nBorderImage { source: srcImage }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", testFileUrl("heart200.png"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QQuickBorderImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+
+ qRegisterMetaType<QQuickBorderImage::Status>();
+ QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &)));
+ QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal)));
+ QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QQuickImageBase::Status)));
+
+ // Same file
+ ctxt->setContextProperty("srcImage", testFileUrl("heart200.png"));
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 0);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 0);
+
+ // Loading local file
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 1);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 1);
+
+ // Loading remote file
+ ctxt->setContextProperty("srcImage", "http://127.0.0.1:14449/heart200.png");
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Loading);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 2);
+ QTRY_VERIFY(progressSpy.count() > 1);
+ QTRY_COMPARE(statusSpy.count(), 3);
+
+ ctxt->setContextProperty("srcImage", "");
+ QTRY_VERIFY(obj->status() == QQuickBorderImage::Null);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_COMPARE(sourceSpy.count(), 3);
+ QTRY_VERIFY(progressSpy.count() > 2);
+ QTRY_COMPARE(statusSpy.count(), 4);
+
+ delete obj;
+}
+
+QTEST_MAIN(tst_qquickborderimage)
+
+#include "tst_qquickborderimage.moc"
diff --git a/tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml b/tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml
new file mode 100644
index 0000000000..000888a36f
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/CanvasComponent.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Component {
+ id:canvas
+ Canvas {
+ id:c
+ antialiasing: false;
+ width:100;height:100
+ onPaint :{} //this line is needed for some tests (make sure onPaint handler always called
+ property alias paintCount:spyPaint.count
+ property alias paintedCount:spyPainted.count
+ property alias canvasSizeChangedCount:spyCanvasSizeChanged.count
+ property alias tileSizeChangedCount:spyTileSizeChanged.count
+ property alias renderStrategyChangedCount:spyRenderStrategyChanged.count
+ property alias canvasWindowChangedCount:spyCanvasWindowChanged.count
+ property alias renderTargetChangedCount:spyRenderTargetChanged.count
+ property alias imageLoadedCount:spyImageLoaded.count
+ property alias availableChangedCount:spyAvailableChanged.count
+
+ SignalSpy {id: spyPaint;target:c;signalName: "paint"}
+ SignalSpy {id: spyPainted;target:c;signalName: "painted"}
+ SignalSpy {id: spyCanvasSizeChanged;target:c;signalName: "canvasSizeChanged"}
+ SignalSpy {id: spyTileSizeChanged;target:c;signalName: "tileSizeChanged"}
+ SignalSpy {id: spyRenderStrategyChanged;target:c;signalName: "renderStrategyChanged"}
+ SignalSpy {id: spyCanvasWindowChanged;target:c;signalName: "canvasWindowChanged"}
+ SignalSpy {id: spyRenderTargetChanged;target:c;signalName: "renderTargetChanged"}
+ SignalSpy {id: spyImageLoaded;target:c;signalName: "imageLoaded"}
+ SignalSpy {id: spyAvailableChanged;target:c;signalName: "availableChanged"}
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml b/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml
new file mode 100644
index 0000000000..bc11d349fa
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+TestCase {
+ id:testCase
+ when:windowShown
+ width:100
+ height:100
+ property Component component:CanvasComponent{}
+ function cleanupTestCase() {
+ wait(100) //wait for a short while to make sure no leaked textures
+ }
+ function testData(type) {
+ if (type === "2d")
+ return [
+ { tag:"image threaded", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Threaded}},
+// { tag:"image cooperative", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Cooperative}},
+ { tag:"image immediate", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Immediate}},
+// { tag:"fbo cooperative", properties:{width:100, height:100, renderTarget:Canvas.FramebufferObject, renderStrategy:Canvas.Cooperative}},
+// { tag:"fbo immediate", properties:{width:100, height:100, renderTarget:Canvas.FramebufferObject, renderStrategy:Canvas.Immediate}},
+// { tag:"fbo threaded", properties:{width:100, height:100, renderTarget:Canvas.FramebufferObject, renderStrategy:Canvas.Threaded}}
+ ];
+ return [];
+ }
+
+ function createCanvasObject(data) {
+ return component.createObject(testCase, data.properties);
+ }
+
+ function comparePixel(ctx,x,y,r,g,b,a, d)
+ {
+ var c = ctx.getImageData(x,y,1,1).data;
+ if (d === undefined)
+ d = 0;
+ r = Math.round(r);
+ g = Math.round(g);
+ b = Math.round(b);
+ a = Math.round(a);
+
+ var notSame = Math.abs(c[0]-r)>d || Math.abs(c[1]-g)>d || Math.abs(c[2]-b)>d || Math.abs(c[3]-a)>d;
+ if (notSame)
+ qtest_fail('Pixel compare fail:\nactual :[' + c[0]+','+c[1]+','+c[2]+','+c[3] + ']\nexpected:['+r+','+g+','+b+','+a+'] +/- '+d, 1);
+ }
+
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/anim-gr.gif b/tests/auto/quick/qquickcanvasitem/data/anim-gr.gif
new file mode 100644
index 0000000000..45263e0afb
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/anim-gr.gif
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/anim-gr.png b/tests/auto/quick/qquickcanvasitem/data/anim-gr.png
new file mode 100644
index 0000000000..925e2efc9a
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/anim-gr.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/anim-poster-gr.png b/tests/auto/quick/qquickcanvasitem/data/anim-poster-gr.png
new file mode 100644
index 0000000000..6941207373
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/anim-poster-gr.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/background.png b/tests/auto/quick/qquickcanvasitem/data/background.png
new file mode 100644
index 0000000000..6db6c6b1b9
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/background.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/broken.png b/tests/auto/quick/qquickcanvasitem/data/broken.png
new file mode 100644
index 0000000000..f2581017b4
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/broken.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/ggrr-256x256.png b/tests/auto/quick/qquickcanvasitem/data/ggrr-256x256.png
new file mode 100644
index 0000000000..0342e4a384
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/ggrr-256x256.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/green-16x16.png b/tests/auto/quick/qquickcanvasitem/data/green-16x16.png
new file mode 100644
index 0000000000..e19a3ffddd
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/green-16x16.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/green-1x1.png b/tests/auto/quick/qquickcanvasitem/data/green-1x1.png
new file mode 100644
index 0000000000..862d1dd10c
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/green-1x1.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/green-256x256.png b/tests/auto/quick/qquickcanvasitem/data/green-256x256.png
new file mode 100644
index 0000000000..b06945c310
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/green-256x256.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/green-2x2.png b/tests/auto/quick/qquickcanvasitem/data/green-2x2.png
new file mode 100644
index 0000000000..adc059449c
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/green-2x2.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/green.png b/tests/auto/quick/qquickcanvasitem/data/green.png
new file mode 100644
index 0000000000..28a1faab37
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/green.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/grgr-256x256.png b/tests/auto/quick/qquickcanvasitem/data/grgr-256x256.png
new file mode 100644
index 0000000000..b8c7189d62
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/grgr-256x256.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/red-16x16.png b/tests/auto/quick/qquickcanvasitem/data/red-16x16.png
new file mode 100644
index 0000000000..9038fef784
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/red-16x16.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/red.png b/tests/auto/quick/qquickcanvasitem/data/red.png
new file mode 100644
index 0000000000..a6e195d59c
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/red.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/redtransparent.png b/tests/auto/quick/qquickcanvasitem/data/redtransparent.png
new file mode 100644
index 0000000000..75da08c3d6
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/redtransparent.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/rgrg-256x256.png b/tests/auto/quick/qquickcanvasitem/data/rgrg-256x256.png
new file mode 100644
index 0000000000..e6fba3daa5
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/rgrg-256x256.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/rrgg-256x256.png b/tests/auto/quick/qquickcanvasitem/data/rrgg-256x256.png
new file mode 100644
index 0000000000..7f63515654
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/rrgg-256x256.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/transparent.png b/tests/auto/quick/qquickcanvasitem/data/transparent.png
new file mode 100644
index 0000000000..2b498699a8
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/transparent.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/transparent50.png b/tests/auto/quick/qquickcanvasitem/data/transparent50.png
new file mode 100644
index 0000000000..55f8e69325
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/transparent50.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_arc.qml b/tests/auto/quick/qquickcanvasitem/data/tst_arc.qml
new file mode 100644
index 0000000000..33fffd4cb1
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_arc.qml
@@ -0,0 +1,525 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "arc"
+ function init_data() { return testData("2d"); }
+ function test_angle_1(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(100, 0);
+ ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true);
+ ctx.fill();
+ comparePixel(ctx,50,25, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_angle_2(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(100, 0);
+ ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true);
+ ctx.fill();
+ comparePixel(ctx,50,25, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_angle_3(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(100, 0);
+ ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true);
+ ctx.fill();
+ /*FIXME: from: http://www.w3.org/TR/2dcontext/#dom-context-2d-arc
+ If the anticlockwise argument is omitted or false and endAngle-startAngle is equal to or greater than 2Ï€, or, if the anticlockwise argument is true and startAngle-endAngle is equal to or greater than 2Ï€, then the arc is the whole circumference of this circle.
+ //comparePixel(ctx,50,25, 0,255,0,255);
+ */
+ canvas.destroy();
+ }
+ function test_angle_4(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false);
+ ctx.fill();
+ comparePixel(ctx,1,1, 0,255,0,255);
+ comparePixel(ctx,98,1, 0,255,0,255);
+ comparePixel(ctx,1,48, 0,255,0,255);
+ comparePixel(ctx,98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_angle_5(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(100, 0);
+ ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false);
+ ctx.fill();
+ /*FIXME: from: http://www.w3.org/TR/2dcontext/#dom-context-2d-arc
+ If the anticlockwise argument is omitted or false and endAngle-startAngle is equal to or greater than 2Ï€, or, if the anticlockwise argument is true and startAngle-endAngle is equal to or greater than 2Ï€, then the arc is the whole circumference of this circle.
+ //comparePixel(ctx,50,25, 0,255,0,255);
+ */
+ canvas.destroy();
+ }
+
+ function test_angle_6(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true);
+ ctx.fill();
+
+ comparePixel(ctx,1,1, 0,255,0,255);
+ comparePixel(ctx,98,1, 0,255,0,255);
+ comparePixel(ctx,1,48, 0,255,0,255);
+ comparePixel(ctx,98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_empty(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.arc(200, 25, 5, 0, 2*Math.PI, true);
+ ctx.stroke();
+ comparePixel(ctx,50,25, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_nonempty(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arc(200, 25, 5, 0, 2*Math.PI, true);
+ ctx.stroke();
+ comparePixel(ctx,50,25, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_nonfinite(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true);
+ ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true);
+ ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true);
+ ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true);
+ ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true);
+ ctx.arc(0, NaN, 50, 0, 2*Math.PI, true);
+ ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true);
+ ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true);
+ ctx.arc(0, 0, NaN, 0, 2*Math.PI, true);
+ ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true);
+ ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true);
+ ctx.arc(0, 0, 50, NaN, 2*Math.PI, true);
+ ctx.arc(0, 0, 50, 0, Infinity, true);
+ ctx.arc(0, 0, 50, 0, -Infinity, true);
+ ctx.arc(0, 0, 50, 0, NaN, true);
+ ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true);
+ ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true);
+ ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true);
+ ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true);
+ ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true);
+ ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true);
+ ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true);
+ ctx.arc(Infinity, Infinity, 50, 0, Infinity, true);
+ ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true);
+ ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true);
+ ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true);
+ ctx.arc(Infinity, 0, Infinity, 0, Infinity, true);
+ ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true);
+ ctx.arc(Infinity, 0, 50, Infinity, Infinity, true);
+ ctx.arc(Infinity, 0, 50, 0, Infinity, true);
+ ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true);
+ ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true);
+ ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true);
+ ctx.arc(0, Infinity, Infinity, 0, Infinity, true);
+ ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true);
+ ctx.arc(0, Infinity, 50, Infinity, Infinity, true);
+ ctx.arc(0, Infinity, 50, 0, Infinity, true);
+ ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true);
+ ctx.arc(0, 0, Infinity, Infinity, Infinity, true);
+ ctx.arc(0, 0, Infinity, 0, Infinity, true);
+ ctx.arc(0, 0, 50, Infinity, Infinity, true);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx,50,25, 0,255,0,255);
+ comparePixel(ctx,90,45, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_end(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(-100, 0);
+ ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true);
+ ctx.lineTo(100, 25);
+ ctx.stroke();
+ comparePixel(ctx,50,25, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_negative(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ try { var err = false;
+ ctx.arc(0, 0, -1, 0, 0, true);
+ } catch (e) {
+ if (e.code != DOMException.INDEX_SIZE_ERR)
+ fail("expected exception of type INDEX_SIZE_ERR, got: "+e.message);
+ err = true;
+ } finally {
+ verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.arc(0, 0, -1, 0, 0, true)");
+ }
+
+ canvas.destroy();
+ }
+
+ function test_scale_1(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.scale(2, 0.5);
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.arc(25, 50, 56, 0, 2*Math.PI, false);
+ ctx.fill();
+ ctx.fillStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(-25, 50);
+ ctx.arc(-25, 50, 24, 0, 2*Math.PI, false);
+ ctx.moveTo(75, 50);
+ ctx.arc(75, 50, 24, 0, 2*Math.PI, false);
+ ctx.moveTo(25, -25);
+ ctx.arc(25, -25, 24, 0, 2*Math.PI, false);
+ ctx.moveTo(25, 125);
+ ctx.arc(25, 125, 24, 0, 2*Math.PI, false);
+ ctx.fill();
+
+ comparePixel(ctx, 0,0, 0,255,0,255);
+ comparePixel(ctx, 50,0, 0,255,0,255);
+ comparePixel(ctx, 99,0, 0,255,0,255);
+ comparePixel(ctx, 0,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 99,25, 0,255,0,255);
+ comparePixel(ctx, 0,49, 0,255,0,255);
+ comparePixel(ctx, 50,49, 0,255,0,255);
+ comparePixel(ctx, 99,49, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_scale_2(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.scale(100, 100);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 1.2;
+ ctx.beginPath();
+ ctx.arc(0, 0, 0.6, 0, Math.PI/2, false);
+ ctx.stroke();
+
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 50,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 98,25, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 50,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_selfintersect_1(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 200;
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.arc(100, 50, 25, 0, -Math.PI/2, true);
+ ctx.stroke();
+ ctx.beginPath();
+ ctx.arc(0, 0, 25, 0, -Math.PI/2, true);
+ ctx.stroke();
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_selfintersect_2(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 180;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.arc(-50, 50, 25, 0, -Math.PI/2, true);
+ ctx.stroke();
+ ctx.beginPath();
+ ctx.arc(100, 0, 25, 0, -Math.PI/2, true);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 90,10, 0,255,0,255);
+ comparePixel(ctx, 97,1, 0,255,0,255);
+ comparePixel(ctx, 97,2, 0,255,0,255);
+ comparePixel(ctx, 97,3, 0,255,0,255);
+ comparePixel(ctx, 2,48, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_shape_1(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.arc(50, 50, 50, 0, Math.PI, false);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 20,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_shape_2(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 100;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.arc(50, 50, 50, 0, Math.PI, true);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 20,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+ function test_shape_3(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 100;
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.arc(0, 50, 50, 0, -Math.PI/2, false);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_shape_4(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 150;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.arc(-50, 50, 100, 0, -Math.PI/2, true);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_shape_5(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 200;
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.arc(300, 0, 100, 0, 5*Math.PI, false);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_twopie(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true);
+ ctx.stroke();
+ comparePixel(ctx, 50,20, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false);
+ ctx.stroke();
+ comparePixel(ctx, 50,20, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true);
+ ctx.stroke();
+ //FIXME:still different behavior from browsers, > 2pi span issue
+ //comparePixel(ctx, 50,20, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false);
+ ctx.stroke();
+ comparePixel(ctx, 50,20, 0,255,0,255);
+ canvas.destroy();
+ }
+
+ function test_zero(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.arc(50, 25, 50, 0, 0, true);
+ ctx.stroke();
+ comparePixel(ctx, 50,20, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.arc(50, 25, 50, 0, 0, false);
+ ctx.stroke();
+ comparePixel(ctx, 50,20, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00'
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arc(200, 25, 0, 0, Math.PI, true);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy();
+ }
+} \ No newline at end of file
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml b/tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml
new file mode 100644
index 0000000000..d9017150a4
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_arcto.qml
@@ -0,0 +1,417 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "arcTo"
+ function init_data() { return testData("2d"); }
+
+ function test_coincide(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(0, 25, 50, 1000, 1);
+ ctx.lineTo(100, 25);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.arcTo(50, 25, 100, 25, 1);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,1, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 50,48, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(100, 25, 100, 25, 1);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ }
+ function test_collinear(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(100, 25, 200, 25, 1);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(-100, 25);
+ ctx.arcTo(0, 25, 100, 25, 1);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(100, 25, 10, 25, 1);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(100, 25);
+ ctx.arcTo(200, 25, 110, 25, 1);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(100, 25, -100, 25, 1);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(100, 25);
+ ctx.arcTo(200, 25, 0, 25, 1);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(-100, 25);
+ ctx.arcTo(0, 25, -200, 25, 1);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ }
+ function test_subpath(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.arcTo(100, 50, 200, 50, 0.1);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.arcTo(0, 25, 50, 250, 0.1);
+ ctx.lineTo(100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ }
+
+ function test_negative(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ try { var err = false;
+ ctx.arcTo(0, 0, 0, 0, -1);
+ } catch (e) {
+ if (e.code != DOMException.INDEX_SIZE_ERR)
+ fail("expectes INDEX_SIZE_ERR, got: "+e.message);
+ err = true;
+ }
+ finally {
+ verify(err, "should throw INDEX_SIZE_ERR: ctx.arcTo(0, 0, 0, 0, -1)");
+ }
+ }
+
+ function test_nonfinite(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.arcTo(Infinity, 50, 0, 50, 0);
+ ctx.arcTo(-Infinity, 50, 0, 50, 0);
+ ctx.arcTo(NaN, 50, 0, 50, 0);
+ ctx.arcTo(0, Infinity, 0, 50, 0);
+ ctx.arcTo(0, -Infinity, 0, 50, 0);
+ ctx.arcTo(0, NaN, 0, 50, 0);
+ ctx.arcTo(0, 50, Infinity, 50, 0);
+ ctx.arcTo(0, 50, -Infinity, 50, 0);
+ ctx.arcTo(0, 50, NaN, 50, 0);
+ ctx.arcTo(0, 50, 0, Infinity, 0);
+ ctx.arcTo(0, 50, 0, -Infinity, 0);
+ ctx.arcTo(0, 50, 0, NaN, 0);
+ ctx.arcTo(0, 50, 0, 50, Infinity);
+ ctx.arcTo(0, 50, 0, 50, -Infinity);
+ ctx.arcTo(0, 50, 0, 50, NaN);
+ ctx.arcTo(Infinity, Infinity, 0, 50, 0);
+ ctx.arcTo(Infinity, Infinity, Infinity, 50, 0);
+ ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0);
+ ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity);
+ ctx.arcTo(Infinity, Infinity, 0, Infinity, 0);
+ ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.arcTo(Infinity, Infinity, 0, 50, Infinity);
+ ctx.arcTo(Infinity, 50, Infinity, 50, 0);
+ ctx.arcTo(Infinity, 50, Infinity, Infinity, 0);
+ ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity);
+ ctx.arcTo(Infinity, 50, Infinity, 50, Infinity);
+ ctx.arcTo(Infinity, 50, 0, Infinity, 0);
+ ctx.arcTo(Infinity, 50, 0, Infinity, Infinity);
+ ctx.arcTo(Infinity, 50, 0, 50, Infinity);
+ ctx.arcTo(0, Infinity, Infinity, 50, 0);
+ ctx.arcTo(0, Infinity, Infinity, Infinity, 0);
+ ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity);
+ ctx.arcTo(0, Infinity, Infinity, 50, Infinity);
+ ctx.arcTo(0, Infinity, 0, Infinity, 0);
+ ctx.arcTo(0, Infinity, 0, Infinity, Infinity);
+ ctx.arcTo(0, Infinity, 0, 50, Infinity);
+ ctx.arcTo(0, 50, Infinity, Infinity, 0);
+ ctx.arcTo(0, 50, Infinity, Infinity, Infinity);
+ ctx.arcTo(0, 50, Infinity, 50, Infinity);
+ ctx.arcTo(0, 50, 0, Infinity, Infinity);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 90,45, 0,255,0,255);
+
+ }
+ function test_scale(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 50);
+ ctx.translate(100, 0);
+ ctx.scale(0.1, 1);
+ ctx.arcTo(50, 50, 50, 0, 50);
+ ctx.lineTo(-1000, 0);
+ ctx.fill();
+
+ //FIXME
+ //comparePixel(ctx, 0,0, 0,255,0,255);
+ //comparePixel(ctx, 50,0, 0,255,0,255);
+ //comparePixel(ctx, 99,0, 0,255,0,255);
+ //comparePixel(ctx, 0,25, 0,255,0,255);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 99,25, 0,255,0,255);
+ //comparePixel(ctx, 0,49, 0,255,0,255);
+ //comparePixel(ctx, 50,49, 0,255,0,255);
+ //comparePixel(ctx, 99,49, 0,255,0,255);
+ }
+
+ function test_shape(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ var tol = 1.5; // tolerance to avoid antialiasing artifacts
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 10;
+ ctx.beginPath();
+ ctx.moveTo(10, 25);
+ ctx.arcTo(75, 25, 75, 60, 20);
+ ctx.stroke();
+
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.rect(10, 20, 45, 10);
+ ctx.moveTo(80, 45);
+ ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true);
+ ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 55,19, 0,255,0,255);
+ comparePixel(ctx, 55,20, 0,255,0,255);
+ comparePixel(ctx, 55,21, 0,255,0,255);
+ comparePixel(ctx, 64,22, 0,255,0,255);
+ comparePixel(ctx, 65,21, 0,255,0,255);
+ comparePixel(ctx, 72,28, 0,255,0,255);
+ comparePixel(ctx, 73,27, 0,255,0,255);
+ comparePixel(ctx, 78,36, 0,255,0,255);
+ comparePixel(ctx, 79,35, 0,255,0,255);
+ comparePixel(ctx, 80,44, 0,255,0,255);
+ comparePixel(ctx, 80,45, 0,255,0,255);
+ comparePixel(ctx, 80,46, 0,255,0,255);
+ comparePixel(ctx, 65,45, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#f00';
+ ctx.beginPath();
+ ctx.rect(10, 20, 45, 10);
+ ctx.moveTo(80, 45);
+ ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true);
+ ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false);
+ ctx.fill();
+
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 10;
+ ctx.beginPath();
+ ctx.moveTo(10, 25);
+ ctx.arcTo(75, 25, 75, 60, 20);
+ ctx.stroke();
+
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 55,19, 0,255,0,255);
+ comparePixel(ctx, 55,20, 0,255,0,255);
+ if (canvas.renderTarget === Canvas.Image) {
+ //FIXME:broken for Canvas.FramebufferObject
+ comparePixel(ctx, 55,21, 0,255,0,255);
+ }
+ comparePixel(ctx, 64,22, 0,255,0,255);
+ comparePixel(ctx, 65,21, 0,255,0,255);
+ comparePixel(ctx, 72,28, 0,255,0,255);
+ comparePixel(ctx, 73,27, 0,255,0,255);
+ comparePixel(ctx, 78,36, 0,255,0,255);
+ comparePixel(ctx, 79,35, 0,255,0,255);
+ comparePixel(ctx, 80,44, 0,255,0,255);
+ comparePixel(ctx, 80,45, 0,255,0,255);
+ comparePixel(ctx, 80,46, 0,255,0,255);
+ ctx.reset();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.moveTo(-100, -100);
+ ctx.arcTo(-100, 25, 200, 25, 10);
+ ctx.stroke();
+
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(200, 25, 200, 50, 10);
+ ctx.stroke();
+
+ //FIXME
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+ }
+
+ function test_transform(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 50);
+ ctx.translate(100, 0);
+ ctx.arcTo(50, 50, 50, 0, 50);
+ ctx.lineTo(-100, 0);
+ ctx.fill();
+
+ comparePixel(ctx, 0,0, 0,255,0,255);
+ comparePixel(ctx, 50,0, 0,255,0,255);
+ comparePixel(ctx, 99,0, 0,255,0,255);
+ comparePixel(ctx, 0,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 99,25, 0,255,0,255);
+ comparePixel(ctx, 0,49, 0,255,0,255);
+ comparePixel(ctx, 50,49, 0,255,0,255);
+ comparePixel(ctx, 99,49, 0,255,0,255);
+ }
+ function test_zero(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(100, 25, 100, 100, 0);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(0, -25);
+ ctx.arcTo(50, -25, 50, 50, 0);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.lineWidth = 50;
+
+ ctx.strokeStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.arcTo(100, 25, -100, 25, 0);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(100, 25);
+ ctx.arcTo(200, 25, 50, 25, 0);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
new file mode 100644
index 0000000000..f13039ad95
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
@@ -0,0 +1,234 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "canvas"
+ function init_data() { return testData("2d"); }
+
+ function test_canvasSize(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+ verify(ctx);
+
+ tryCompare(c, "availableChangedCount", 1);
+ //by default canvasSize is same with canvas' actual size
+ // when canvas size changes, canvasSize should be changed as well.
+ compare(c.canvasSize.width, c.width);
+ compare(c.canvasSize.height, c.height);
+ c.width = 20;
+ compare(c.canvasSize.width, 20);
+ compare(c.canvasSizeChangedCount, 1);
+ c.height = 5;
+ compare(c.canvasSizeChangedCount, 2);
+ compare(c.canvasSize.height, 5);
+
+ //change canvasSize manually, then canvasSize detaches from canvas
+ //actual size.
+ c.canvasSize.width = 100;
+ compare(c.canvasSizeChangedCount, 3);
+ compare(c.canvasSize.width, 100);
+ compare(c.width, 20);
+ c.canvasSize.height = 50;
+ compare(c.canvasSizeChangedCount, 4);
+ compare(c.canvasSize.height, 50);
+ compare(c.height, 5);
+
+ c.width = 10;
+ compare(c.canvasSizeChangedCount, 4);
+ compare(c.canvasSize.width, 100);
+ compare(c.canvasSize.height, 50);
+
+ c.height = 10;
+
+ compare(c.canvasSizeChangedCount, 4);
+ compare(c.canvasSize.width, 100);
+ compare(c.canvasSize.height, 50);
+ c.destroy();
+ }
+ function test_tileSize(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+ verify(ctx);
+ tryCompare(c, "availableChangedCount", 1);
+
+ compare(c.tileSize.width, c.width);
+ compare(c.tileSize.height, c.height);
+ c.width = 20;
+ compare(c.tileSize.width, 20);
+ compare(c.tileSizeChangedCount, 1);
+ c.height = 5;
+ compare(c.tileSizeChangedCount, 2);
+ compare(c.tileSize.height, 5);
+
+ c.tileSize.width = 100;
+ compare(c.tileSizeChangedCount, 3);
+ compare(c.tileSize.width, 100);
+ compare(c.width, 20);
+ c.tileSize.height = 50;
+ compare(c.tileSizeChangedCount, 4);
+ compare(c.tileSize.height, 50);
+ compare(c.height, 5);
+
+ c.width = 10;
+ compare(c.tileSizeChangedCount, 4);
+ compare(c.tileSize.width, 100);
+ compare(c.tileSize.height, 50);
+
+ c.height = 10;
+ compare(c.tileSizeChangedCount, 4);
+ compare(c.tileSize.width, 100);
+ compare(c.tileSize.height, 50);
+ c.destroy();
+
+ }
+
+ function test_canvasWindow(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+ verify(ctx);
+
+ tryCompare(c, "availableChangedCount", 1);
+ compare(c.canvasWindow.x, 0);
+ compare(c.canvasWindow.y, 0);
+ compare(c.canvasWindow.width, c.width);
+ compare(c.canvasWindow.height, c.height);
+
+ c.width = 20;
+ compare(c.canvasWindow.width, 20);
+ compare(c.canvasWindowChangedCount, 1);
+ c.height = 5;
+ compare(c.canvasWindowChangedCount, 2);
+ compare(c.canvasWindow.height, 5);
+
+ c.canvasWindow.x = 5;
+ c.canvasWindow.y = 6;
+ c.canvasWindow.width = 10;
+ c.canvasWindow.height =20;
+ compare(c.canvasWindowChangedCount, 6);
+ compare(c.canvasWindow.width, 10);
+ compare(c.canvasWindow.height, 20);
+ compare(c.canvasWindow.x, 5);
+ compare(c.canvasWindow.y, 6);
+ c.destroy();
+
+ }
+
+ function test_save(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+
+ tryCompare(c, "availableChangedCount", 1);
+
+ c.requestPaint();
+ verify(c.save("c.png"));
+ c.loadImage("c.png");
+ wait(200);
+ verify(c.isImageLoaded("c.png"));
+ verify(!c.isImageLoading("c.png"));
+ verify(!c.isImageError("c.png"));
+ c.destroy();
+ }
+
+ function test_toDataURL(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+ verify(ctx);
+
+ tryCompare(c, "availableChangedCount", 1);
+
+ var imageTypes = [
+ {mimeType:"image/png"},
+ {mimeType:"image/bmp"},
+ {mimeType:"image/jpeg"},
+ {mimeType:"image/x-portable-pixmap"},
+ //{mimeType:"image/tiff"}, QTBUG-23980
+ {mimeType:"image/xpm"},
+ ];
+ for (var i = 0; i < imageTypes.length; i++) {
+ ctx.fillStyle = "red";
+ ctx.fillRect(0, 0, c.width, c.height);
+
+ var dataUrl = c.toDataURL();
+ verify(dataUrl !== "data:,");
+ dataUrl = c.toDataURL("image/invalid");
+ verify(dataUrl === "data:,");
+
+ dataUrl = c.toDataURL(imageTypes[i].mimeType);
+ verify(dataUrl !== "data:,");
+
+ ctx.save();
+ ctx.fillStyle = "blue";
+ ctx.fillRect(0, 0, c.width, c.height);
+ ctx.restore();
+
+ var dataUrl2 = c.toDataURL(imageTypes[i].mimeType);
+ verify (dataUrl2 !== "data:,");
+ verify (dataUrl2 !== dataUrl);
+ }
+ c.destroy();
+
+ }
+ function test_paint(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+ tryCompare(c, "availableChangedCount", 1);
+ //scene graph could be available immediately
+ //in this case, we force waiting a short while until the init paint finished
+ tryCompare(c, "paintedCount", 1);
+ ctx.fillRect(0, 0, c.width, c.height);
+ c.toDataURL();
+ tryCompare(c, "paintedCount", 2);
+ tryCompare(c, "paintCount", 1);
+ c.destroy();
+ }
+ function test_loadImage(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+ verify(ctx);
+
+ tryCompare(c, "availableChangedCount", 1);
+
+ verify(!c.isImageLoaded("red.png"));
+ c.loadImage("red.png");
+ wait(200);
+ verify(c.isImageLoaded("red.png"));
+ verify(!c.isImageLoading("red.png"));
+ verify(!c.isImageError("red.png"));
+
+ c.unloadImage("red.png");
+ verify(!c.isImageLoaded("red.png"));
+ verify(!c.isImageLoading("red.png"));
+ verify(!c.isImageError("red.png"));
+ c.destroy();
+
+ }
+
+ function test_getContext(row) {
+ var c = createCanvasObject(row);
+ verify(c);
+ var ctx = c.getContext("2d");
+ verify(ctx);
+ tryCompare(c, "availableChangedCount", 1);
+
+ compare(ctx.canvas, c);
+ ctx = c.getContext('2d');
+ verify(ctx);
+ compare(ctx.canvas, c);
+ ctx = c.getContext('2D');
+ verify(ctx);
+ compare(ctx.canvas, c);
+ ignoreWarning(Qt.resolvedUrl("CanvasComponent.qml") + ":6:9: QML Canvas: Canvas already initialized with a different context type");
+ ctx = c.getContext('invalid');
+ verify(!ctx);
+ c.destroy();
+
+ }
+}
+
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_composite.qml b/tests/auto/quick/qquickcanvasitem/data/tst_composite.qml
new file mode 100644
index 0000000000..8a5a52cf1e
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_composite.qml
@@ -0,0 +1,388 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "composite"
+ function init_data() { return testData("2d"); }
+ function test_clearRect(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-atop';
+ ctx.clearRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,0,0,0);
+ }
+
+ function test_clip(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ var composites = [ {compsite:"copy"},
+ {compsite:"destination-atop"},
+ {compsite:"destination-in"},
+ {compsite:"destination-out"},
+ {compsite:"destination-over"},
+ // {compsite:"lighter"}, //qt doesn't support lighter
+ {compsite:"source-atop"},
+ {compsite:"source-in"},
+ {compsite:"source-out"},
+ {compsite:"source-over"},
+ {compsite:"xor"}
+ ];
+ for (var i=0; i<composites.length; i++) {
+// console.log("composite:" + composites[i].compsite);
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = composites[i].compsite;
+ ctx.rect(-20, -20, 10, 10);
+ ctx.clip();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 50, 50);
+ comparePixel(ctx, 25,25, 0,255,0,255);
+ comparePixel(ctx, 75,25, 0,255,0,255);
+ }
+ }
+
+ function test_globalAlpha(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ compare(ctx.globalAlpha, 1.0);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalAlpha = 0.01; // avoid any potential alpha=0 optimizations
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 2,253,0,255, 2);
+
+ ctx.reset();
+ ctx.globalAlpha = 0.5;
+ var a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons
+ ctx.globalAlpha = Infinity;
+ compare(ctx.globalAlpha, a);
+ ctx.globalAlpha = -Infinity;
+ compare(ctx.globalAlpha, a);
+ ctx.globalAlpha = NaN;
+ compare(ctx.globalAlpha, a);
+
+ ctx.globalAlpha = 0.5;
+ a = ctx.globalAlpha; // might not be exactly 0.5, if it is rounded/quantised, so remember for future comparisons
+ ctx.globalAlpha = 1.1;
+ compare(ctx.globalAlpha, a);
+ ctx.globalAlpha = -0.1;
+ compare(ctx.globalAlpha, a);
+ ctx.globalAlpha = 0;
+ compare(ctx.globalAlpha, 0);
+ ctx.globalAlpha = 1;
+ compare(ctx.globalAlpha, 1);
+
+ }
+
+ function test_operation(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.globalCompositeOperation = 'xor';
+ ctx.globalCompositeOperation = 'Source-over';
+ compare(ctx.globalCompositeOperation, 'xor');
+
+ ctx.reset();
+ ctx.globalCompositeOperation = 'xor';
+ ctx.globalCompositeOperation = 'clear';
+ compare(ctx.globalCompositeOperation, 'xor');
+
+ ctx.reset();
+ ctx.globalCompositeOperation = 'xor';
+ ctx.globalCompositeOperation = 'darker';
+ compare(ctx.globalCompositeOperation, 'xor');
+
+ ctx.reset();
+ compare(ctx.globalCompositeOperation, 'source-over');
+
+
+ ctx.reset();
+ var modes = ['source-atop', 'source-in', 'source-out', 'source-over',
+ 'destination-atop', 'destination-in', 'destination-out', 'destination-over',
+ 'lighter', 'copy', 'xor'];
+ for (var i = 0; i < modes.length; ++i)
+ {
+ ctx.globalCompositeOperation = modes[i];
+ compare(ctx.globalCompositeOperation, modes[i]);
+ }
+
+ ctx.reset();
+ ctx.globalCompositeOperation = 'xor';
+ ctx.globalCompositeOperation = 'highlight';
+ compare(ctx.globalCompositeOperation, 'xor');
+
+ ctx.reset();
+ ctx.globalCompositeOperation = 'xor';
+ ctx.globalCompositeOperation = 'source-over\\0';
+ compare(ctx.globalCompositeOperation, 'xor');
+
+ ctx.reset();
+ ctx.globalCompositeOperation = 'xor';
+ ctx.globalCompositeOperation = 'over';
+ compare(ctx.globalCompositeOperation, 'xor');
+
+
+ ctx.reset();
+ ctx.globalCompositeOperation = 'xor';
+ ctx.globalCompositeOperation = 'nonexistent';
+ compare(ctx.globalCompositeOperation, 'xor');
+ }
+
+ function test_solid(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = Qt.rgba(0, 1, 1, 1.0);
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'copy';
+ ctx.fillStyle = Qt.rgba(1, 1, 0, 1.0);
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 255,255,0, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-atop';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,255,255,255, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-in';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,255,255,255, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-out';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,0,0,0, 5);
+
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-over';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,255,255,255, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'lighter';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 255,255,255,255, 5);
+
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-atop';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 255,255,0, 5);
+
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-in';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 255,255,0, 5);
+
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-out';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ // comparePixel(ctx, 50,25, 0,0,0,0, 5);
+
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-over';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 255,255,0, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 255, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'xor';
+ ctx.fillStyle = 'rgba(255, 255, 0, 1.0)';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,0,0,0, 5);
+ }
+ function test_transparent(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'copy';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,0,255,191, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'copy';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,0,255,191, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-in';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,95, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-out';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,31, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-over';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,145,109,223, 5);
+
+
+// qt does not support lighter...
+// ctx.reset();
+// ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+// ctx.fillRect(0, 0, 100, 50);
+// ctx.globalCompositeOperation = 'lighter';
+// ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+// ctx.fillRect(0, 0, 100, 50);
+ //FIXME
+ //comparePixel(ctx, 50,25, 0,127,191,255, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-atop';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,63,191,127, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-in';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,0,255,95, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-out';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,0,255,95, 5);
+
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-over';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,36,218,223, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'xor';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,63,191,127, 5);
+
+ }
+
+ function test_uncovered(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'copy';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.translate(0, 25);
+ ctx.fillRect(0, 50, 100, 50);
+ //FIXME
+ //comparePixel(ctx, 50,25, 0,0,0,0, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-atop';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.translate(0, 25);
+ ctx.fillRect(0, 50, 100, 50);
+ //FIXME
+ //comparePixel(ctx, 50,25, 0,0,0,0, 5);
+
+
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-in';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.translate(0, 25);
+ ctx.fillRect(0, 50, 100, 50);
+ //FIXME
+ //comparePixel(ctx, 50,25, 0,0,0,0, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-in';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.translate(0, 25);
+ ctx.fillRect(0, 50, 100, 50);
+ //FIXME
+ //comparePixel(ctx, 50,25, 0,0,0,0, 5);
+
+ ctx.reset();
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'source-out';
+ ctx.fillStyle = 'rgba(0, 0, 255, 0.75)';
+ ctx.translate(0, 25);
+ ctx.fillRect(0, 50, 100, 50);
+ //FIXME
+ //comparePixel(ctx, 50,25, 0,0,0,0, 5);
+
+ }
+
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_context.qml b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
new file mode 100644
index 0000000000..b72e755ed9
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml
@@ -0,0 +1,73 @@
+
+import QtQuick 2.0
+import QtTest 1.0
+
+Canvas {
+ id: canvas
+ width: 1
+ height: 1
+ contextType: "2d"
+
+ property var contextInPaint
+
+ SignalSpy {
+ id: paintedSpy
+ target: canvas
+ signalName: "paint"
+ }
+
+ SignalSpy {
+ id: contextSpy
+ target: canvas
+ signalName: "contextChanged"
+ }
+
+ onPaint: {
+ contextInPaint = context;
+ }
+
+ TestCase {
+ name: "ContextTypeStored"
+ when: windowShown
+
+ function test_contextType() {
+ compare(canvas.contextType, "2d");
+ }
+ }
+
+ TestCase {
+ name: "ContextValidWhenTypePredefined"
+ when: canvas.available
+
+ function test_context() {
+ // Wait for the context to become active
+ wait(100);
+ compare(contextSpy.count, 1);
+
+ // Context is available
+ verify(canvas.context)
+ }
+
+ function test_contextIsConsistent() {
+ // Wait for the context to become active
+ wait(100);
+ compare(contextSpy.count, 1);
+
+ // getContext("2d") is the same as the context property
+ compare(canvas.getContext("2d"), canvas.context);
+ }
+
+ function test_paintHadContext() {
+ // Make there was a paint signal
+ wait(100);
+ verify(paintedSpy.count, 1)
+
+ // Paint was called with a valid context when contextType is
+ // specified
+ verify(canvas.contextInPaint)
+
+ // paints context was the correct one
+ compare(canvas.contextInPaint, canvas.getContext("2d"));
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml b/tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml
new file mode 100644
index 0000000000..58ea6d7f59
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_fillStyle.qml
@@ -0,0 +1,117 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "fillStyle"
+ function init_data() { return testData("2d"); }
+ function test_default(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ verify(ctx.fillStyle, "#000000");
+ ctx.clearRect(0, 0, 1, 1);
+ compare(ctx.fillStyle, "#000000");
+ }
+ function test_get(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#fa0';
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = Qt.rgba(0,0,0,0);
+ compare(ctx.fillStyle, 'rgba(0, 0, 0, 0.0)');
+ }
+ function test_hex(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ compare(ctx.fillStyle, '#ff0000');
+ ctx.fillStyle = "#0f0";
+ compare(ctx.fillStyle, '#00ff00');
+ ctx.fillStyle = "#0fF";
+ compare(ctx.fillStyle, '#00ffff');
+ ctx.fillStyle = "#0aCCfb";
+ compare(ctx.fillStyle, '#0accfb');
+
+ }
+ function test_invalid(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#fa0';
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = "invalid";
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = "rgb (1, 2, 3)";
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = '#fa0';
+
+ ctx.fillStyle = "rgba(3, 1, 2)";
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = "rgb((3,4,1)";
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = "rgb(1, 3, 4, 0.5)";
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = "hsl(2, 3, 4, 0.8)";
+ compare(ctx.fillStyle, '#ffaa00');
+ ctx.fillStyle = "hsl(2, 3, 4";
+ compare(ctx.fillStyle, '#ffaa00');
+ }
+ function test_saverestore(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ var old = ctx.fillStyle;
+ ctx.save();
+ ctx.fillStyle = "#ffaaff";
+ ctx.restore();
+ compare(ctx.fillStyle, old);
+
+ ctx.fillStyle = "#ffcc88";
+ old = ctx.fillStyle;
+ ctx.save();
+ compare(ctx.fillStyle, old);
+ ctx.restore();
+ }
+ function test_namedColor(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = "red";
+ ctx.fillRect(0,0,1,1);
+ comparePixel(ctx,0,0,255,0,0,255);
+
+ ctx.fillStyle = "black";
+ ctx.fillRect(0,0,1,1);
+ comparePixel(ctx,0,0,0,0,0,255);
+
+ ctx.fillStyle = "white";
+ ctx.fillRect(0,0,1,1);
+ comparePixel(ctx,0,0,255,255,255,255);
+ }
+ function test_rgba(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = "rgb(-100, 300, 255)";
+ compare(ctx.fillStyle, "#00ffff");
+ ctx.fillStyle = "rgba(-100, 300, 255, 0.0)";
+ compare(ctx.fillStyle, "rgba(0, 255, 255, 0.0)");
+ ctx.fillStyle = "rgb(-10%, 110%, 50%)";
+ compare(ctx.fillStyle, "#00ff80");
+
+ ctx.clearRect(0, 0, 1, 1);
+ ctx.fillStyle = 'rgba(0%, 100%, 0%, 0.499)';
+ ctx.fillRect(0, 0, 1, 1);
+ comparePixel(ctx, 0,0, 0,255,0,127);
+ }
+
+ function test_hsla(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = "hsla(120, 100%, 50%, 0.499)";
+ ctx.fillRect(0, 0, 1, 1);
+ comparePixel(ctx,0,0,0,255,0,127);
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml b/tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml
new file mode 100644
index 0000000000..ce1c27c6bc
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_fillrect.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "fillRect"
+ function init_data() { return testData("2d"); }
+ function test_fillRect(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = "red";
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ var imageData = ctx.getImageData(0, 0, 1, 1);
+ var d = imageData.data;
+ compare(d.length, 4);
+ compare(d[0], 255);
+ compare(d[1], 0);
+ compare(d[2], 0);
+ compare(d[3], 255);
+ }
+
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml b/tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml
new file mode 100644
index 0000000000..00a12f2edc
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_gradient.qml
@@ -0,0 +1,986 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "gradient"
+ function init_data() { return testData("2d"); }
+ function test_basic(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ var g = ctx.createLinearGradient(0, 0, 0, 50);
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,255,0,255,2);
+ }
+
+ function test_interpolate(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#ff0';
+ ctx.fillRect(0, 0, 100, 50);
+ var g = ctx.createLinearGradient(0, 0, 100, 0);
+ g.addColorStop(0, 'rgba(0,0,255, 0)');
+ g.addColorStop(1, 'rgba(0,0,255, 1)');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 25,25, 191,191,63,255,3);
+ //comparePixel(ctx, 50,25, 127,127,127,255,3);
+ //comparePixel(ctx, 75,25, 63,63,191,255,3);
+
+ ctx.reset();
+ var g = ctx.createLinearGradient(0, 0, 100, 0);
+ g.addColorStop(0, '#ff0');
+ g.addColorStop(1, '#00f');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 25,25, 191,191,63,255,3);
+ //comparePixel(ctx, 50,25, 127,127,127,255,3);
+ //comparePixel(ctx, 75,25, 63,63,191,255,3);
+
+
+ ctx.reset();
+ var g = ctx.createLinearGradient(0, 0, 100, 0);
+ g.addColorStop(0, 'rgba(255,255,0, 0)');
+ g.addColorStop(1, 'rgba(0,0,255, 1)');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 25,25, 191,191,63,63,3);
+ //comparePixel(ctx, 50,25, 127,127,127,127,3);
+ //comparePixel(ctx, 75,25, 63,63,191,191,3);
+
+ ctx.reset();
+ canvas.width = 200;
+ var g = ctx.createLinearGradient(0, 0, 200, 0);
+ g.addColorStop(0, '#ff0');
+ g.addColorStop(0.5, '#0ff');
+ g.addColorStop(1, '#f0f');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 200, 50);
+ //comparePixel(ctx, 50,25, 127,255,127,255,3);
+ //comparePixel(ctx, 100,25, 0,255,255,255,3);
+ //comparePixel(ctx, 150,25, 127,127,255,255,3);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ var g = ctx.createLinearGradient(25, 0, 75, 0);
+ g.addColorStop(0.4, '#0f0');
+ g.addColorStop(0.6, '#0f0');
+
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 20,25, 0,255,0,255,2);
+ //comparePixel(ctx, 50,25, 0,255,0,255,2);
+ //comparePixel(ctx, 80,25, 0,255,0,255,2);
+
+
+ ctx.reset();
+ ctx.canvas.width = 200;
+ var g = ctx.createLinearGradient(0, 0, 200, 0);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(0, '#ff0');
+ g.addColorStop(0.25, '#00f');
+ g.addColorStop(0.25, '#0f0');
+ g.addColorStop(0.25, '#0f0');
+ g.addColorStop(0.25, '#0f0');
+ g.addColorStop(0.25, '#ff0');
+ g.addColorStop(0.5, '#00f');
+ g.addColorStop(0.5, '#0f0');
+ g.addColorStop(0.75, '#00f');
+ g.addColorStop(0.75, '#f00');
+ g.addColorStop(0.75, '#ff0');
+ g.addColorStop(0.5, '#0f0');
+ g.addColorStop(0.5, '#0f0');
+ g.addColorStop(0.5, '#ff0');
+ g.addColorStop(1, '#00f');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 200, 50);
+ //comparePixel(ctx, 49,25, 0,0,255,255,16);
+ //comparePixel(ctx, 51,25, 255,255,0,255,16);
+ //comparePixel(ctx, 99,25, 0,0,255,255,16);
+ //comparePixel(ctx, 101,25, 255,255,0,255,16);
+ //comparePixel(ctx, 149,25, 0,0,255,255,16);
+ //comparePixel(ctx, 151,25, 255,255,0,255,16);
+ ctx.canvas.width = 100;
+
+ ctx.reset();
+ var g = ctx.createLinearGradient(0, 0, 100, 0);
+ var ps = [ 0, 1/10, 1/4, 1/3, 1/2, 3/4, 1 ];
+ for (var p = 0; p < ps.length; ++p)
+ {
+ g.addColorStop(ps[p], '#0f0');
+ for (var i = 0; i < 15; ++i)
+ g.addColorStop(ps[p], '#f00');
+ g.addColorStop(ps[p], '#0f0');
+ }
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 1,25, 0,255,0,255);
+ //comparePixel(ctx, 30,25, 0,255,0,255);
+ //comparePixel(ctx, 40,25, 0,255,0,255);
+ //comparePixel(ctx, 60,25, 0,255,0,255);
+ //comparePixel(ctx, 80,25, 0,255,0,255);
+
+
+ ctx.reset();
+ var g = ctx.createLinearGradient(0, 0, 100, 0);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(1, '#0f0');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+
+
+
+ ctx.reset();
+ var g = ctx.createLinearGradient(0, 0, 0, 50);
+ g.addColorStop(0, '#ff0');
+ g.addColorStop(1, '#00f');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,12, 191,191,63,255,10);
+ //comparePixel(ctx, 50,25, 127,127,127,255,5);
+ //comparePixel(ctx, 50,37, 63,63,191,255,10);
+
+
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ var g = ctx.createLinearGradient(50, 25, 50, 25); // zero-length line (undefined direction)
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 40,20, 0,255,0,255,2);
+
+
+
+ }
+ function test_radial(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ var g = ctx.createRadialGradient(0, 100, 40, 100, 100, 50);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(210, 25, 100, 230, 25, 101);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(210, 25, 100, 230, 25, 100);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(311, 25, 10, 210, 25, 100);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#0f0');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(30+tol, 40);
+ ctx.lineTo(110, -20+tol);
+ ctx.lineTo(110, 100-tol);
+ ctx.fill();
+
+ g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(1, '#0f0');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(30+10*5/2, 40, 10*3/2, 30+10*15/4, 40, 10*9/4);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.moveTo(30-tol, 40);
+ ctx.lineTo(110, -20-tol);
+ ctx.lineTo(110, 100+tol);
+ ctx.fill();
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(230, 25, 100, 100, 25, 101);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#0f0');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(50, 25, 20, 50, 25, 20);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(50, 25, 100, 50, 25, 200);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#0f0');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(50, 25, 200, 50, 25, 100);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(0.993, '#f00');
+ g.addColorStop(1, '#0f0');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, -0.1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.createRadialGradient(0, 0, -0.1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, 0, -0.1);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.createRadialGradient(0, 0, 1, 0, 0, -0.1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, -0.1, 0, 0, -0.1);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.createRadialGradient(0, 0, -0.1, 0, 0, -0.1)"); }
+
+
+ ctx.reset();
+
+
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, NaN, 1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, NaN, 1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, NaN, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, NaN, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, NaN, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, NaN, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, NaN, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, 0, NaN, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, 0, NaN);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, 0, 0, NaN)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity)"); }
+ try { var err = false;
+ ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity)"); }
+
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ g = ctx.createRadialGradient(200, 25, 10, 200, 25, 20);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#0f0');
+ ctx.fillStyle = g;ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);//comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);//comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);//comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);//comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ g = ctx.createRadialGradient(200, 25, 20, 200, 25, 10);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(0.001, '#f00');
+ g.addColorStop(1, '#f00');ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);//comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);//comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ g = ctx.createRadialGradient(150, 25, 50, 200, 25, 100);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);//comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);//comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ g = ctx.createRadialGradient(-80, 25, 70, 0, 25, 150);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(0.01, '#0f0');
+ g.addColorStop(0.99, '#0f0');g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);//comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);//comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ g = ctx.createRadialGradient(120, -15, 25, 140, -30, 50);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);//comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);//comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(0.5, '#0f0');g.addColorStop(0.51, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.translate(50, 25);ctx.scale(10, 10);
+ ctx.fillRect(-5, -2.5, 10, 5);
+ //comparePixel(ctx, 25,25, 0,255,0,255);
+ //comparePixel(ctx, 50,25, 0,255,0,255);//comparePixel(ctx, 75,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.translate(100, 0);
+ g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2);
+ g.addColorStop(0, '#0f0');g.addColorStop(0.5, '#0f0');
+ g.addColorStop(0.51, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;ctx.translate(-50, 25);
+ ctx.scale(10, 10);
+ ctx.fillRect(-5, -2.5, 10, 5);
+ //comparePixel(ctx, 25,25, 0,255,0,255);//comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 75,25, 0,255,0,255);
+
+
+ ctx.reset();
+ g = ctx.createRadialGradient(0, 0, 0, 0, 0, 11.2);
+ g.addColorStop(0, '#0f0');
+ g.addColorStop(0.5, '#0f0');g.addColorStop(0.51, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);ctx.translate(50, 25);
+ ctx.scale(10, 10);
+ ctx.fillRect(-5, -2.5, 10, 5);
+ //comparePixel(ctx, 25,25, 0,255,0,255);//comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 75,25, 0,255,0,255);
+
+
+ }
+ function test_linear(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, 0, 1, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, 0, 1, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(-Infinity, 0, 1, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(-Infinity, 0, 1, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(NaN, 0, 1, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(NaN, 0, 1, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, Infinity, 1, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, Infinity, 1, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, -Infinity, 1, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, -Infinity, 1, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, NaN, 1, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, NaN, 1, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, 0, Infinity, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, 0, Infinity, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, 0, -Infinity, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, 0, -Infinity, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, 0, NaN, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, 0, NaN, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, 0, 1, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, 0, 1, Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, 0, 1, -Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, 0, 1, -Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, 0, 1, NaN);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, 0, 1, NaN)"); }
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, Infinity, 1, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, Infinity, 1, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, Infinity, Infinity, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, Infinity, Infinity, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, Infinity, 1, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, Infinity, 1, Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, 0, Infinity, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, 0, Infinity, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, 0, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(Infinity, 0, 1, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(Infinity, 0, 1, Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, Infinity, Infinity, 0);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, Infinity, Infinity, 0)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, Infinity, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, Infinity, Infinity, Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, Infinity, 1, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, Infinity, 1, Infinity)"); }
+ try { var err = false;
+ ctx.createLinearGradient(0, 0, Infinity, Infinity);
+ } catch (e) { if (e.code != DOMException.NOT_SUPPORTED_ERR) fail("Failed assertion: expected exception of type NOT_SUPPORTED_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type NOT_SUPPORTED_ERR: ctx.createLinearGradient(0, 0, Infinity, Infinity)"); }
+
+ ctx.reset();
+ var g = ctx.createLinearGradient(0, 0, 200, 0);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(0.25, '#0f0');
+ g.addColorStop(0.75, '#0f0');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.translate(-50, 0);
+ ctx.fillRect(50, 0, 100, 50);
+ comparePixel(ctx, 25,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 75,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.translate(100, 0);
+ g = ctx.createLinearGradient(0, 0, 200, 0);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(0.25, '#0f0');
+ g.addColorStop(0.75, '#0f0');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.translate(-150, 0);
+ ctx.fillRect(50, 0, 100, 50);
+ comparePixel(ctx, 25,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 75,25, 0,255,0,255);
+
+
+ ctx.reset();
+ g = ctx.createLinearGradient(0, 0, 200, 0);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(0.25, '#0f0');
+ g.addColorStop(0.75, '#0f0');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.translate(-50, 0);
+ ctx.fillRect(50, 0, 100, 50);
+
+ if (canvas.renderTarget === Canvas.Image) //FIXME:broken on FramebufferObject
+ comparePixel(ctx, 25,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 75,25, 0,255,0,255);
+
+ }
+ function test_object(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ var g1 = ctx.createLinearGradient(0, 0, 100, 0);
+ var g2 = ctx.createLinearGradient(0, 0, 100, 0);
+ ctx.fillStyle = g1;
+
+
+ ctx.reset();
+ var g = ctx.createLinearGradient(0, 0, 100, 0);
+ try { var err = false;
+ g.addColorStop(0, "");
+ } catch (e) { if (e.code != DOMException.SYNTAX_ERR) fail("Failed assertion: expected exception of type SYNTAX_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type SYNTAX_ERR: g.addColorStop(0, \"\")"); }
+ try { var err = false;
+ g.addColorStop(0, 'undefined');
+ } catch (e) { if (e.code != DOMException.SYNTAX_ERR) fail("Failed assertion: expected exception of type SYNTAX_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type SYNTAX_ERR: g.addColorStop(0, 'undefined')"); }
+
+
+ ctx.reset();
+ g = ctx.createLinearGradient(0, 0, 100, 0);
+ try { var err = false;
+ g.addColorStop(-1, '#000');
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: g.addColorStop(-1, '#000')"); }
+ try { var err = false;
+ g.addColorStop(2, '#000');
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: g.addColorStop(2, '#000')"); }
+ try { var err = false;
+ g.addColorStop(Infinity, '#000');
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: g.addColorStop(Infinity, '#000')"); }
+ try { var err = false;
+ g.addColorStop(-Infinity, '#000');
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: g.addColorStop(-Infinity, '#000')"); }
+ try { var err = false;
+ g.addColorStop(NaN, '#000');
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: g.addColorStop(NaN, '#000')"); }
+
+
+ ctx.reset();
+ g = ctx.createLinearGradient(-100, 0, 200, 0);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ g.addColorStop(0.1, '#0f0');
+ g.addColorStop(0.9, '#0f0');
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,255,0,255,2);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ g = ctx.createRadialGradient(120, 25, 10, 211, 25, 100);
+ g.addColorStop(0, '#f00');
+ g.addColorStop(1, '#f00');
+ ctx.fillStyle = g;
+ ctx.fillRect(0, 0, 100, 50);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 50,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ //comparePixel(ctx, 1,25, 0,255,0,255,16);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 98,25, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ //comparePixel(ctx, 50,48, 0,255,0,255);
+ //comparePixel(ctx, 98,48, 0,255,0,255);
+
+
+ }
+
+ function test_conical(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ var g = ctx.createConicalGradient(10, 10, 50);
+ //TODO
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_image.qml b/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
new file mode 100644
index 0000000000..72b6dcdb00
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_image.qml
@@ -0,0 +1,707 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "image"
+ function init_data() { return testData("2d"); }
+
+ function loadImages(canvas) {
+ canvas.loadImage('green.png');
+ canvas.loadImage('red.png');
+ canvas.loadImage('rgrg-256x256.png');
+ canvas.loadImage('ggrr-256x256.png');
+ canvas.loadImage('broken.png');
+ if (!canvas.isImageLoaded('green.png'))
+ wait(200);
+ }
+
+ function test_3args(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+ ctx.reset();
+
+ ctx.drawImage('green.png', 0, 0);
+ ctx.drawImage('red.png', -100, 0);
+ ctx.drawImage('red.png', 100, 0);
+ ctx.drawImage('red.png', 0, -50);
+ ctx.drawImage('red.png', 0, 50);
+
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+ }
+ function test_5args(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('green.png', 50, 0, 50, 50);
+ ctx.drawImage('red.png', 0, 0, 50, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 50, 50);
+
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+ }
+ function test_9args(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('green.png', 0, 0, 100, 50, 0, 0, 100, 50);
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('green.png', 0, 0, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage('red.png', 0, 0, 100, 50, -100, 0, 100, 50);
+ ctx.drawImage('red.png', 0, 0, 100, 50, 100, 0, 100, 50);
+ ctx.drawImage('red.png', 0, 0, 100, 50, 0, -50, 100, 50);
+ ctx.drawImage('red.png', 0, 0, 100, 50, 0, 50, 100, 50);
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('green.png', 1, 1, 1, 1, 0, 0, 100, 50);
+ ctx.drawImage('red.png', 0, 0, 100, 50, -50, 0, 50, 50);
+ ctx.drawImage('red.png', 0, 0, 100, 50, 100, 0, 50, 50);
+ ctx.drawImage('red.png', 0, 0, 100, 50, 0, -25, 100, 25);
+ ctx.drawImage('red.png', 0, 0, 100, 50, 0, 50, 100, 25);
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('rgrg-256x256.png', 140, 20, 100, 50, 0, 0, 100, 50);
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('rgrg-256x256.png', 0, 0, 256, 256, 0, 0, 100, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 51, 26);
+ ctx.fillRect(49, 24, 51, 26);
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+ comparePixel(ctx, 20,20, 0,255,0,255,2);
+ comparePixel(ctx, 80,20, 0,255,0,255,2);
+ comparePixel(ctx, 20,30, 0,255,0,255,2);
+ comparePixel(ctx, 80,30, 0,255,0,255,2);
+
+ }
+ function test_animated(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ //should animated image be supported at all?
+ }
+ function test_clip(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.rect(-10, -10, 1, 1);
+ ctx.clip();
+ ctx.drawImage('red.png', 0, 0);
+ comparePixel(ctx, 50,25, 0,255,0,255,2);
+
+
+ }
+ function test_self(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 50, 50);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(50, 0, 50, 50);
+ ctx.drawImage(canvas, 50, 0);
+
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 1, 100, 49);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 1);
+ ctx.drawImage(canvas, 0, 1);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 2);
+
+ comparePixel(ctx, 0,0, 0,255,0,255,2);
+ comparePixel(ctx, 99,0, 0,255,0,255,2);
+ comparePixel(ctx, 0,49, 0,255,0,255,2);
+ comparePixel(ctx, 99,49, 0,255,0,255,2);
+ }
+
+ function test_outsidesource(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+
+ ctx.drawImage('green.png', 10.5, 10.5, 89.5, 39.5, 0, 0, 100, 50);
+ ctx.drawImage('green.png', 5.5, 5.5, -5.5, -5.5, 0, 0, 100, 50);
+ ctx.drawImage('green.png', 100, 50, -5, -5, 0, 0, 100, 50);
+ try { var err = false;
+ ctx.drawImage('red.png', -0.001, 0, 100, 50, 0, 0, 100, 50);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', -0.001, 0, 100, 50, 0, 0, 100, 50)"); }
+ try { var err = false;
+ ctx.drawImage('red.png', 0, -0.001, 100, 50, 0, 0, 100, 50);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, -0.001, 100, 50, 0, 0, 100, 50)"); }
+ try { var err = false;
+ ctx.drawImage('red.png', 0, 0, 100.001, 50, 0, 0, 100, 50);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 100.001, 50, 0, 0, 100, 50)"); }
+ try { var err = false;
+ ctx.drawImage('red.png', 0, 0, 100, 50.001, 0, 0, 100, 50);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 100, 50.001, 0, 0, 100, 50)"); }
+ try { var err = false;
+ ctx.drawImage('red.png', 50, 0, 50.001, 50, 0, 0, 100, 50);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 50, 0, 50.001, 50, 0, 0, 100, 50)"); }
+ try { var err = false;
+ ctx.drawImage('red.png', 0, 0, -5, 5, 0, 0, 100, 50);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, -5, 5, 0, 0, 100, 50)"); }
+ try { var err = false;
+ ctx.drawImage('red.png', 0, 0, 5, -5, 0, 0, 100, 50);
+ } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 5, -5, 0, 0, 100, 50)"); }
+// try { var err = false;
+// ctx.drawImage('red.png', 110, 60, -20, -20, 0, 0, 100, 50);
+// } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 110, 60, -20, -20, 0, 0, 100, 50)"); }
+// comparePixel(ctx, 50,25, 0,255,0,255,2);
+
+ }
+
+ function test_null(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ try { var err = false;
+ ctx.drawImage(null, 0, 0);
+ } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(null, 0, 0)"); }
+
+ }
+
+ function test_composite(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalCompositeOperation = 'destination-over';
+ ctx.drawImage('red.png', 0, 0);
+ comparePixel(ctx, 50,25, 0,255,0,255,2);
+
+ }
+ function test_path(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ }
+ function test_transform(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.translate(100, 0);
+ ctx.drawImage('red.png', 0, 0);
+ comparePixel(ctx, 50,25, 0,255,0,255,2);
+
+ }
+
+ function test_imageitem(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ //TODO
+ }
+
+ function test_imageData(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ //TODO
+ }
+
+ function test_wrongtype(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+
+ try { var err = false;
+ ctx.drawImage(undefined, 0, 0);
+ } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(undefined, 0, 0)"); }
+ try { var err = false;
+ ctx.drawImage(0, 0, 0);
+ } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(0, 0, 0)"); }
+ try { var err = false;
+ ctx.drawImage("", 0, 0);
+ } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(\"\", 0, 0)"); }
+ }
+
+ function test_nonfinite(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ var red = 'red.png';
+ ctx.drawImage(red, Infinity, 0);
+ ctx.drawImage(red, -Infinity, 0);
+ ctx.drawImage(red, NaN, 0);
+ ctx.drawImage(red, 0, Infinity);
+ ctx.drawImage(red, 0, -Infinity);
+ ctx.drawImage(red, 0, NaN);
+ ctx.drawImage(red, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50);
+ ctx.drawImage(red, -Infinity, 0, 100, 50);
+ ctx.drawImage(red, NaN, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, -Infinity, 100, 50);
+ ctx.drawImage(red, 0, NaN, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, -Infinity, 50);
+ ctx.drawImage(red, 0, 0, NaN, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, -Infinity);
+ ctx.drawImage(red, 0, 0, 100, NaN);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, -Infinity, 0, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, NaN, 0, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, -Infinity, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, NaN, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, -Infinity, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, NaN, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, -Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, NaN, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, -Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, NaN, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, -Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, NaN, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, 0, -Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, 0, NaN, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, -Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, NaN);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, 50);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, Infinity);
+ ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, Infinity);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ }
+
+ function test_negative(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('ggrr-256x256.png', 100, 78, 50, 50, 0, 50, 50, -50);
+ ctx.drawImage('ggrr-256x256.png', 100, 128, 50, -50, 100, 50, -50, -50);
+// comparePixel(ctx, 1,1, 0,255,0,255,2);
+// comparePixel(ctx, 1,48, 0,255,0,255,2);
+// comparePixel(ctx, 98,1, 0,255,0,255,2);
+// comparePixel(ctx, 98,48, 0,255,0,255,2);
+// comparePixel(ctx, 48,1, 0,255,0,255,2);
+// comparePixel(ctx, 48,48, 0,255,0,255,2);
+// comparePixel(ctx, 51,1, 0,255,0,255,2);
+// comparePixel(ctx, 51,48, 0,255,0,255,2);
+// comparePixel(ctx, 25,25, 0,255,0,255,2);
+// comparePixel(ctx, 75,25, 0,255,0,255,2);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('ggrr-256x256.png', 0, 178, 50, -100, 0, 0, 50, 100);
+ ctx.drawImage('ggrr-256x256.png', 0, 78, 50, 100, 50, 100, 50, -100);
+// comparePixel(ctx, 1,1, 0,255,0,255,2);
+// comparePixel(ctx, 1,48, 0,255,0,255,2);
+// comparePixel(ctx, 98,1, 0,255,0,255,2);
+// comparePixel(ctx, 98,48, 0,255,0,255,2);
+// comparePixel(ctx, 48,1, 0,255,0,255,2);
+// comparePixel(ctx, 48,48, 0,255,0,255,2);
+// comparePixel(ctx, 51,1, 0,255,0,255,2);
+// comparePixel(ctx, 51,48, 0,255,0,255,2);
+// comparePixel(ctx, 25,25, 0,255,0,255,2);
+// comparePixel(ctx, 75,25, 0,255,0,255,2);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('ggrr-256x256.png', 100, 78, -100, 50, 0, 0, 50, 50);
+ ctx.drawImage('ggrr-256x256.png', 100, 128, -100, -50, 50, 0, 50, 50);
+// comparePixel(ctx, 1,1, 0,255,0,255,2);
+// comparePixel(ctx, 1,48, 0,255,0,255,2);
+// comparePixel(ctx, 98,1, 0,255,0,255,2);
+// comparePixel(ctx, 98,48, 0,255,0,255,2);
+// comparePixel(ctx, 48,1, 0,255,0,255,2);
+// comparePixel(ctx, 48,48, 0,255,0,255,2);
+// comparePixel(ctx, 51,1, 0,255,0,255,2);
+// comparePixel(ctx, 51,48, 0,255,0,255,2);
+// comparePixel(ctx, 25,25, 0,255,0,255,2);
+// comparePixel(ctx, 75,25, 0,255,0,255,2);
+
+ }
+
+ function test_canvas(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ var canvas2 = Qt.createQmlObject("import QtQuick 2.0; Canvas{renderTarget:Canvas.Image; renderStrategy:Canvas.Immediate}", canvas);
+ canvas2.width = 100;
+ canvas2.height = 50;
+ var ctx2 = canvas2.getContext('2d');
+ ctx2.fillStyle = '#0f0';
+ ctx2.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#f00';
+ ctx.drawImage(canvas2, 0, 0);
+
+ //comparePixel(ctx, 0,0, 0,255,0,255,2);
+ //comparePixel(ctx, 99,0, 0,255,0,255,2);
+ //comparePixel(ctx, 0,49, 0,255,0,255,2);
+ //comparePixel(ctx, 99,49, 0,255,0,255,2);
+
+ }
+
+ function test_broken(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ var img = 'broken.png';
+ verify(!img.complete);
+ ctx.drawImage(img, 0, 0);
+ }
+
+ function test_alpha(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.globalAlpha = 0;
+ ctx.drawImage('red.png', 0, 0);
+ comparePixel(ctx, 50,25, 0,255,0,255, 2);
+
+ }
+ function test_multiple_painting(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ loadImages(canvas);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.drawImage('red.png', 0, 0, 50, 50);
+ ctx.drawImage('red.png', 50, 0, 100, 50);
+ comparePixel(ctx, 25,25, 255,0,0,255, 2);
+ comparePixel(ctx, 75,25, 255,0,0,255, 2);
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_line.qml b/tests/auto/quick/qquickcanvasitem/data/tst_line.qml
new file mode 100644
index 0000000000..750f37638d
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_line.qml
@@ -0,0 +1,838 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "line"
+ function init_data() { return testData("2d"); }
+ function test_default(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ compare(ctx.lineWidth, 1);
+ compare(ctx.lineCap, 'butt');
+ compare(ctx.lineJoin, 'miter');
+ compare(ctx.miterLimit, 10);
+ }
+
+ function test_cross(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 200;
+ ctx.lineJoin = 'bevel';
+
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(110, 50);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(100, 60);
+ ctx.stroke();
+
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 48,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+
+ if (canvas.renderTarget === Canvas.Image) {
+ //FIXME: broken for Canvas.FramebufferObject
+ comparePixel(ctx, 48,48, 0,255,0,255);
+ }
+ }
+
+ function test_join(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 20, 20);
+ ctx.fillRect(20, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(30, 20);
+ ctx.lineTo(40-tol, 20);
+ ctx.lineTo(30, 10+tol);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 20, 20);
+ ctx.fillRect(70, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(80, 20);
+ ctx.lineTo(90+tol, 20);
+ ctx.lineTo(80, 10-tol);
+ ctx.fill();
+
+ comparePixel(ctx, 34,16, 0,255,0,255);
+ comparePixel(ctx, 34,15, 0,255,0,255);
+ comparePixel(ctx, 35,15, 0,255,0,255);
+ comparePixel(ctx, 36,15, 0,255,0,255);
+ comparePixel(ctx, 36,14, 0,255,0,255);
+
+ comparePixel(ctx, 84,16, 0,255,0,255);
+ comparePixel(ctx, 84,15, 0,255,0,255);
+ comparePixel(ctx, 85,15, 0,255,0,255);
+ comparePixel(ctx, 86,15, 0,255,0,255);
+ comparePixel(ctx, 86,14, 0,255,0,255);
+
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'miter';
+ ctx.lineWidth = 200;
+
+ ctx.beginPath();
+ ctx.moveTo(100, 50);
+ ctx.lineTo(100, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 50);
+ ctx.closePath();
+ ctx.stroke();
+
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 48,1, 0,255,0,255);
+ comparePixel(ctx, 48,48, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+
+
+ ctx.reset();
+ ctx.lineJoin = 'bevel'
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'invalid';
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'ROUND';
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'round\\0';
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'round ';
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = "";
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineJoin = 'butt';
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'miter';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 30, 20);
+ ctx.fillRect(20, 10, 20, 30);
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 30, 20);
+ ctx.fillRect(70, 10, 20, 30);
+
+ comparePixel(ctx, 38,12, 0,255,0,255);
+ comparePixel(ctx, 39,11, 0,255,0,255);
+ comparePixel(ctx, 40,10, 0,255,0,255);
+ comparePixel(ctx, 41,9, 0,255,0,255);
+ comparePixel(ctx, 42,8, 0,255,0,255);
+
+ comparePixel(ctx, 88,12, 0,255,0,255);
+ comparePixel(ctx, 89,11, 0,255,0,255);
+ comparePixel(ctx, 90,10, 0,255,0,255);
+ comparePixel(ctx, 91,9, 0,255,0,255);
+ comparePixel(ctx, 92,8, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'miter';
+ ctx.lineWidth = 200;
+
+ ctx.beginPath();
+ ctx.moveTo(100, 50);
+ ctx.lineTo(100, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 50);
+ ctx.lineTo(100, 50);
+ ctx.stroke();
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 48,1, 0,255,0,255);
+ //comparePixel(ctx, 48,48, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 300;
+ ctx.lineJoin = 'round';
+ ctx.beginPath();
+ ctx.moveTo(-100, 25);
+ ctx.lineTo(0, 25);
+ ctx.lineTo(-100, 25);
+ ctx.stroke();
+
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 48,1, 0,255,0,255);
+ comparePixel(ctx, 48,48, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineJoin = 'round';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.fillRect(10, 10, 20, 20);
+ ctx.fillRect(20, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(30, 20);
+ ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(10, 20);
+ ctx.lineTo(30, 20);
+ ctx.lineTo(30, 40);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(60, 20);
+ ctx.lineTo(80, 20);
+ ctx.lineTo(80, 40);
+ ctx.stroke();
+
+ ctx.fillRect(60, 10, 20, 20);
+ ctx.fillRect(70, 20, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(80, 20);
+ ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true);
+ ctx.fill();
+
+ comparePixel(ctx, 36,14, 0,255,0,255);
+ comparePixel(ctx, 36,13, 0,255,0,255);
+ comparePixel(ctx, 37,13, 0,255,0,255);
+ comparePixel(ctx, 38,13, 0,255,0,255);
+ comparePixel(ctx, 38,12, 0,255,0,255);
+
+ comparePixel(ctx, 86,14, 0,255,0,255);
+ comparePixel(ctx, 86,13, 0,255,0,255);
+ comparePixel(ctx, 87,13, 0,255,0,255);
+ comparePixel(ctx, 88,13, 0,255,0,255);
+ comparePixel(ctx, 88,12, 0,255,0,255);
+
+ ctx.reset();
+ ctx.lineJoin = 'bevel'
+ compare(ctx.lineJoin, 'bevel');
+
+ ctx.lineJoin = 'round';
+ compare(ctx.lineJoin, 'round');
+
+ ctx.lineJoin = 'miter';
+ compare(ctx.lineJoin, 'miter');
+
+ }
+ function test_miter(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 200;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 2.614;
+ ctx.beginPath();
+ ctx.moveTo(100, 1000);
+ ctx.lineTo(100, 100);
+ ctx.lineTo(1000, 1000);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 2.613;
+ ctx.beginPath();
+ ctx.moveTo(100, 1000);
+ ctx.lineTo(100, 100);
+ ctx.lineTo(1000, 1000);
+ ctx.stroke();
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 48,1, 0,255,0,255);
+ //comparePixel(ctx, 48,48, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 201); // slightly non-right-angle to avoid being a special case
+ ctx.stroke();
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 48,1, 0,255,0,255);
+ //comparePixel(ctx, 48,48, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.miterLimit = 1.5;
+ compare(ctx.miterLimit, 1.5);
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = 0;
+ compare(ctx.miterLimit, 1.5);
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = -1;
+ compare(ctx.miterLimit, 1.5);
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = Infinity;
+ compare(ctx.miterLimit, 1.5);
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = -Infinity;
+ compare(ctx.miterLimit, 1.5);
+
+ ctx.miterLimit = 1.5;
+ ctx.miterLimit = NaN;
+ compare(ctx.miterLimit, 1.5);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 200;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.strokeRect(100, 25, 200, 0);
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 48,1, 0,255,0,255);
+ //comparePixel(ctx, 48,48, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 1600;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 1.083;
+ ctx.beginPath();
+ ctx.moveTo(800, 10000);
+ ctx.lineTo(800, 300);
+ ctx.lineTo(10000, -8900);
+ ctx.stroke();
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.082;
+ ctx.beginPath();
+ ctx.moveTo(800, 10000);
+ ctx.lineTo(800, 300);
+ ctx.lineTo(10000, -8900);
+ ctx.stroke();
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 48,1, 0,255,0,255);
+ //comparePixel(ctx, 48,48, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#f00';
+ ctx.miterLimit = 1.414;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 200);
+ ctx.stroke();
+
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 48,1, 0,255,0,255);
+ //comparePixel(ctx, 48,48, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.miterLimit = 1.5;
+ compare(ctx.miterLimit, 1.5);
+
+ ctx.miterLimit = "1e1";
+ compare(ctx.miterLimit, 10);
+
+ ctx.miterLimit = 1/1024;
+ compare(ctx.miterLimit, 1/1024);
+
+ ctx.miterLimit = 1000;
+ compare(ctx.miterLimit, 1000);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+
+ ctx.strokeStyle = '#0f0';
+ ctx.miterLimit = 1.416;
+ ctx.beginPath();
+ ctx.moveTo(200, 1000);
+ ctx.lineTo(200, 200);
+ ctx.lineTo(1000, 201);
+ ctx.stroke();
+
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 48,1, 0,255,0,255);
+ comparePixel(ctx, 48,48, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+
+
+ }
+ function test_width(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 20;
+ // Draw a green line over a red box, to check the line is not too small
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ // Draw a green box over a red line, to check the line is not too large
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 15, 20, 20);
+
+ comparePixel(ctx, 14,25, 0,255,0,255);
+ comparePixel(ctx, 15,25, 0,255,0,255);
+ comparePixel(ctx, 16,25, 0,255,0,255);
+ comparePixel(ctx, 25,25, 0,255,0,255);
+ comparePixel(ctx, 34,25, 0,255,0,255);
+ comparePixel(ctx, 35,25, 0,255,0,255);
+ comparePixel(ctx, 36,25, 0,255,0,255);
+
+ comparePixel(ctx, 64,25, 0,255,0,255);
+ comparePixel(ctx, 65,25, 0,255,0,255);
+ comparePixel(ctx, 66,25, 0,255,0,255);
+ comparePixel(ctx, 75,25, 0,255,0,255);
+ comparePixel(ctx, 84,25, 0,255,0,255);
+ comparePixel(ctx, 85,25, 0,255,0,255);
+ comparePixel(ctx, 86,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.lineWidth = 1.5;
+ compare(ctx.lineWidth, 1.5);
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = 0;
+ compare(ctx.lineWidth, 1.5);
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = -1;
+ compare(ctx.lineWidth, 1.5);
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = Infinity;
+ compare(ctx.lineWidth, 1.5);
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = -Infinity;
+ compare(ctx.lineWidth, 1.5);
+
+ ctx.lineWidth = 1.5;
+ ctx.lineWidth = NaN;
+ compare(ctx.lineWidth, 1.5);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.scale(50, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.moveTo(0, 0.5);
+ ctx.lineTo(2, 0.5);
+ ctx.stroke();
+
+ //comparePixel(ctx, 25,25, 0,255,0,255);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 75,25, 0,255,0,255);
+ //comparePixel(ctx, 50,5, 0,255,0,255);
+ //comparePixel(ctx, 50,45, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 4;
+ // Draw a green line over a red box, to check the line is not too small
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.save();
+ ctx.scale(5, 1);
+ ctx.beginPath();
+ ctx.moveTo(5, 15);
+ ctx.lineTo(5, 35);
+ ctx.stroke();
+ ctx.restore();
+
+ // Draw a green box over a red line, to check the line is not too large
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.save();
+ ctx.scale(-5, 1);
+ ctx.beginPath();
+ ctx.moveTo(-15, 15);
+ ctx.lineTo(-15, 35);
+ ctx.stroke();
+ ctx.restore();
+ ctx.fillRect(65, 15, 20, 20);
+
+ comparePixel(ctx, 14,25, 0,255,0,255);
+ //comparePixel(ctx, 15,25, 0,255,0,255);
+ //comparePixel(ctx, 16,25, 0,255,0,255);
+ //comparePixel(ctx, 25,25, 0,255,0,255);
+ //comparePixel(ctx, 34,25, 0,255,0,255);
+ //comparePixel(ctx, 35,25, 0,255,0,255);
+ //comparePixel(ctx, 36,25, 0,255,0,255);
+
+ //comparePixel(ctx, 64,25, 0,255,0,255);
+ //comparePixel(ctx, 65,25, 0,255,0,255);
+ //comparePixel(ctx, 66,25, 0,255,0,255);
+ //comparePixel(ctx, 75,25, 0,255,0,255);
+ //comparePixel(ctx, 84,25, 0,255,0,255);
+ //comparePixel(ctx, 85,25, 0,255,0,255);
+ //comparePixel(ctx, 86,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.lineWidth = 1.5;
+ compare(ctx.lineWidth, 1.5);
+
+ ctx.lineWidth = "1e1";
+ compare(ctx.lineWidth, 10);
+
+ ctx.lineWidth = 1/1024;
+ compare(ctx.lineWidth, 1/1024);
+
+ ctx.lineWidth = 1000;
+ compare(ctx.lineWidth, 1000);
+
+ }
+ function test_cap(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineCap = 'butt';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 15, 20, 20);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 15, 20, 20);
+
+ comparePixel(ctx, 25,14, 0,255,0,255);
+ comparePixel(ctx, 25,15, 0,255,0,255);
+ comparePixel(ctx, 25,16, 0,255,0,255);
+ comparePixel(ctx, 25,34, 0,255,0,255);
+ comparePixel(ctx, 25,35, 0,255,0,255);
+ comparePixel(ctx, 25,36, 0,255,0,255);
+
+ comparePixel(ctx, 75,14, 0,255,0,255);
+ comparePixel(ctx, 75,15, 0,255,0,255);
+ comparePixel(ctx, 75,16, 0,255,0,255);
+ comparePixel(ctx, 75,34, 0,255,0,255);
+ comparePixel(ctx, 75,35, 0,255,0,255);
+ comparePixel(ctx, 75,36, 0,255,0,255);
+
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineCap = 'square';
+ ctx.lineWidth = 400;
+
+ ctx.beginPath();
+ ctx.moveTo(200, 200);
+ ctx.lineTo(200, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 200);
+ ctx.closePath();
+ ctx.stroke();
+
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 48,1, 0,255,0,255);
+ comparePixel(ctx, 48,48, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ ctx.reset();
+
+ ctx.lineCap = 'butt'
+ compare(ctx.lineCap, 'butt');
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'invalid';
+ compare(ctx.lineCap, 'butt');
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'ROUND';
+ compare(ctx.lineCap, 'butt');
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'round\\0';
+ compare(ctx.lineCap, 'butt');
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'round ';
+ compare(ctx.lineCap, 'butt');
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = "";
+ compare(ctx.lineCap, 'butt');
+
+ ctx.lineCap = 'butt';
+ ctx.lineCap = 'bevel';
+ compare(ctx.lineCap, 'butt');
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineJoin = 'bevel';
+ ctx.lineCap = 'square';
+ ctx.lineWidth = 400;
+
+ ctx.beginPath();
+ ctx.moveTo(200, 200);
+ ctx.lineTo(200, 1000);
+ ctx.lineTo(1000, 1000);
+ ctx.lineTo(1000, 200);
+ ctx.lineTo(200, 200);
+ ctx.stroke();
+
+ //FIXME:!!!
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 48,1, 0,255,0,255);
+ //comparePixel(ctx, 48,48, 0,255,0,255);
+ //comparePixel(ctx, 1,48, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ var tol = 1; // tolerance to avoid antialiasing artifacts
+
+ ctx.lineCap = 'round';
+ ctx.lineWidth = 20;
+
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+
+ ctx.beginPath();
+ ctx.moveTo(35-tol, 15);
+ ctx.arc(25, 15, 10-tol, 0, Math.PI, true);
+ ctx.arc(25, 35, 10-tol, Math.PI, 0, true);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(85+tol, 15);
+ ctx.arc(75, 15, 10+tol, 0, Math.PI, true);
+ ctx.arc(75, 35, 10+tol, Math.PI, 0, true);
+ ctx.fill();
+
+ comparePixel(ctx, 17,6, 0,255,0,255);
+ comparePixel(ctx, 25,6, 0,255,0,255);
+ comparePixel(ctx, 32,6, 0,255,0,255);
+ comparePixel(ctx, 17,43, 0,255,0,255);
+ comparePixel(ctx, 25,43, 0,255,0,255);
+ comparePixel(ctx, 32,43, 0,255,0,255);
+
+ comparePixel(ctx, 67,6, 0,255,0,255);
+ comparePixel(ctx, 75,6, 0,255,0,255);
+ comparePixel(ctx, 82,6, 0,255,0,255);
+ comparePixel(ctx, 67,43, 0,255,0,255);
+ comparePixel(ctx, 75,43, 0,255,0,255);
+ comparePixel(ctx, 82,43, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineCap = 'square';
+ ctx.lineWidth = 20;
+
+ ctx.fillStyle = '#f00';
+ ctx.strokeStyle = '#0f0';
+ ctx.fillRect(15, 5, 20, 40);
+ ctx.beginPath();
+ ctx.moveTo(25, 15);
+ ctx.lineTo(25, 35);
+ ctx.stroke();
+
+ ctx.fillStyle = '#0f0';
+ ctx.strokeStyle = '#f00';
+ ctx.beginPath();
+ ctx.moveTo(75, 15);
+ ctx.lineTo(75, 35);
+ ctx.stroke();
+ ctx.fillRect(65, 5, 20, 40);
+
+ comparePixel(ctx, 25,4, 0,255,0,255);
+ comparePixel(ctx, 25,5, 0,255,0,255);
+ comparePixel(ctx, 25,6, 0,255,0,255);
+ comparePixel(ctx, 25,44, 0,255,0,255);
+ comparePixel(ctx, 25,45, 0,255,0,255);
+ comparePixel(ctx, 25,46, 0,255,0,255);
+
+ comparePixel(ctx, 75,4, 0,255,0,255);
+ comparePixel(ctx, 75,5, 0,255,0,255);
+ comparePixel(ctx, 75,6, 0,255,0,255);
+ comparePixel(ctx, 75,44, 0,255,0,255);
+ comparePixel(ctx, 75,45, 0,255,0,255);
+ comparePixel(ctx, 75,46, 0,255,0,255);
+
+ ctx.reset();
+ ctx.lineCap = 'butt'
+ compare(ctx.lineCap, 'butt');
+
+ ctx.lineCap = 'round';
+ compare(ctx.lineCap, 'round');
+
+ ctx.lineCap = 'square';
+ compare(ctx.lineCap, 'square');
+
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_path.qml b/tests/auto/quick/qquickcanvasitem/data/tst_path.qml
new file mode 100644
index 0000000000..60c782c8fa
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_path.qml
@@ -0,0 +1,1468 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "path"
+ function init_data() { return testData("2d"); }
+ function test_basic(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.closePath();
+ ctx.fillStyle = '#f00';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.rect(0, 0, 100, 50);
+ ctx.restore();
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+
+ canvas.width = 100;
+ ctx.rect(0, 0, 100, 50);
+ canvas.width = 100;
+ ctx.fillStyle = '#f00';
+ ctx.fill();
+ //comparePixel(ctx, 20,20, 0,0,0,0);
+ canvas.destroy()
+ }
+ function test_beginPath(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.rect(0, 0, 100, 50);
+ ctx.beginPath();
+ ctx.fillStyle = '#f00';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_closePath(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.closePath();
+ ctx.fillStyle = '#f00';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.moveTo(-100, 25);
+ ctx.lineTo(-100, -100);
+ ctx.lineTo(200, -100);
+ ctx.lineTo(200, 25);
+ ctx.closePath();
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.moveTo(-100, 25);
+ ctx.lineTo(-100, -1000);
+ ctx.closePath();
+ ctx.lineTo(1000, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+
+ function test_isPointInPath(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.arc(50, 25, 10, 0, Math.PI, false);
+ verify(!ctx.isPointInPath(50, 10));
+ verify(!ctx.isPointInPath(50, 20));
+ //verify(!ctx.isPointInPath(50, 30));
+ verify(!ctx.isPointInPath(50, 40));
+ verify(!ctx.isPointInPath(30, 20));
+ verify(!ctx.isPointInPath(70, 20));
+ verify(!ctx.isPointInPath(30, 30));
+ verify(!ctx.isPointInPath(70, 30));
+
+ ctx.reset();
+ ctx.rect(0, 0, 20, 20);
+ verify(ctx.isPointInPath(10, 10));
+ verify(!ctx.isPointInPath(30, 10));
+
+ ctx.reset();
+ ctx.rect(20, 0, 20, 20);
+ verify(!ctx.isPointInPath(10, 10));
+ verify(ctx.isPointInPath(30, 10));
+
+ ctx.reset();
+ ctx.bezierCurveTo(50, -50, 50, 100, 75, 25);
+ verify(!ctx.isPointInPath(25, 20));
+ verify(!ctx.isPointInPath(25, 30));
+ //verify(ctx.isPointInPath(30, 20));
+ verify(!ctx.isPointInPath(30, 30));
+ verify(!ctx.isPointInPath(40, 2));
+ //verify(ctx.isPointInPath(40, 20));
+ verify(!ctx.isPointInPath(40, 30));
+ verify(!ctx.isPointInPath(40, 47));
+ //verify(ctx.isPointInPath(45, 20));
+ verify(!ctx.isPointInPath(45, 30));
+ //verify(!ctx.isPointInPath(55, 20));
+ //verify(ctx.isPointInPath(55, 30));
+ //verify(!ctx.isPointInPath(60, 2));
+ //verify(!ctx.isPointInPath(60, 20));
+ verify(ctx.isPointInPath(60, 30));
+ verify(!ctx.isPointInPath(60, 47));
+ //verify(!ctx.isPointInPath(70, 20));
+ verify(ctx.isPointInPath(70, 30));
+ verify(!ctx.isPointInPath(75, 20));
+ verify(!ctx.isPointInPath(75, 30));
+
+ ctx.reset();
+ ctx.arc(50, 25, 10, 0, 7, false);
+ verify(!ctx.isPointInPath(50, 10));
+ verify(ctx.isPointInPath(50, 20));
+ verify(ctx.isPointInPath(50, 30));
+ verify(!ctx.isPointInPath(50, 40));
+ verify(!ctx.isPointInPath(30, 20));
+ verify(!ctx.isPointInPath(70, 20));
+ verify(!ctx.isPointInPath(30, 30));
+ //verify(!ctx.isPointInPath(70, 30));
+
+ ctx.reset();
+ ctx.rect(0, 0, 20, 20);
+ verify(ctx.isPointInPath(0, 0));
+ verify(ctx.isPointInPath(10, 0));
+ verify(ctx.isPointInPath(20, 0));
+ verify(ctx.isPointInPath(20, 10));
+ verify(ctx.isPointInPath(20, 20));
+ verify(ctx.isPointInPath(10, 20));
+ verify(ctx.isPointInPath(0, 20));
+ verify(ctx.isPointInPath(0, 10));
+ verify(!ctx.isPointInPath(10, -0.01));
+ verify(!ctx.isPointInPath(10, 20.01));
+ verify(!ctx.isPointInPath(-0.01, 10));
+ verify(!ctx.isPointInPath(20.01, 10));
+
+ ctx.reset();
+ verify(!ctx.isPointInPath(0, 0));
+
+
+ ctx.reset();
+ ctx.rect(-100, -50, 200, 100);
+ verify(!ctx.isPointInPath(Infinity, 0));
+ verify(!ctx.isPointInPath(-Infinity, 0));
+ verify(!ctx.isPointInPath(NaN, 0));
+ verify(!ctx.isPointInPath(0, Infinity));
+ verify(!ctx.isPointInPath(0, -Infinity));
+ verify(!ctx.isPointInPath(0, NaN));
+ verify(!ctx.isPointInPath(NaN, NaN));
+
+ ctx.reset();
+ ctx.rect(0, -100, 20, 20);
+ ctx.rect(20, -10, 20, 20);
+ verify(!ctx.isPointInPath(10, -110));
+ verify(ctx.isPointInPath(10, -90));
+ verify(!ctx.isPointInPath(10, -70));
+ verify(!ctx.isPointInPath(30, -20));
+ verify(ctx.isPointInPath(30, 0));
+ verify(!ctx.isPointInPath(30, 20));
+
+ ctx.reset();
+ ctx.rect(0, 0, 20, 20);
+ ctx.beginPath();
+ ctx.rect(20, 0, 20, 20);
+ ctx.closePath();
+ ctx.rect(40, 0, 20, 20);
+ verify(!ctx.isPointInPath(10, 10));
+ verify(ctx.isPointInPath(30, 10));
+ verify(ctx.isPointInPath(50, 10));
+
+ ctx.reset();
+ ctx.translate(50, 0);
+ ctx.rect(0, 0, 20, 20);
+ verify(!ctx.isPointInPath(-40, 10));
+ verify(!ctx.isPointInPath(10, 10));
+ verify(!ctx.isPointInPath(49, 10));
+ verify(ctx.isPointInPath(51, 10));
+ verify(ctx.isPointInPath(69, 10));
+ verify(!ctx.isPointInPath(71, 10));
+
+ ctx.reset();
+ ctx.rect(50, 0, 20, 20);
+ ctx.translate(50, 0);
+ verify(!ctx.isPointInPath(-40, 10));
+ verify(!ctx.isPointInPath(10, 10));
+ verify(!ctx.isPointInPath(49, 10));
+ verify(ctx.isPointInPath(51, 10));
+ verify(ctx.isPointInPath(69, 10));
+ verify(!ctx.isPointInPath(71, 10));
+
+ ctx.reset();
+ ctx.scale(-1, 1);
+ ctx.rect(-70, 0, 20, 20);
+ verify(!ctx.isPointInPath(-40, 10));
+ verify(!ctx.isPointInPath(10, 10));
+ verify(!ctx.isPointInPath(49, 10));
+ verify(ctx.isPointInPath(51, 10));
+ verify(ctx.isPointInPath(69, 10));
+ verify(!ctx.isPointInPath(71, 10));
+
+ ctx.reset();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(20, 0);
+ ctx.lineTo(20, 20);
+ ctx.lineTo(0, 20);
+ verify(ctx.isPointInPath(10, 10));
+ verify(!ctx.isPointInPath(30, 10));
+
+ ctx.reset();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(50, 0);
+ ctx.lineTo(50, 50);
+ ctx.lineTo(0, 50);
+ ctx.lineTo(0, 0);
+ ctx.lineTo(10, 10);
+ ctx.lineTo(10, 40);
+ ctx.lineTo(40, 40);
+ ctx.lineTo(40, 10);
+ ctx.lineTo(10, 10);
+
+ verify(ctx.isPointInPath(5, 5));
+ verify(ctx.isPointInPath(25, 5));
+ verify(ctx.isPointInPath(45, 5));
+ verify(ctx.isPointInPath(5, 25));
+ verify(!ctx.isPointInPath(25, 25));
+ verify(ctx.isPointInPath(45, 25));
+ verify(ctx.isPointInPath(5, 45));
+ verify(ctx.isPointInPath(25, 45));
+ verify(ctx.isPointInPath(45, 45));
+ canvas.destroy()
+ }
+
+
+ function test_fill(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#0f0';
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+
+ ctx.reset();
+ ctx.fillStyle = '#00f';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.lineTo(100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.fill();
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+
+ comparePixel(ctx, 90,10, 0,255,0,255);
+ comparePixel(ctx, 10,40, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#000';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.rect(0, 0, 100, 50);
+ ctx.closePath();
+ ctx.rect(10, 10, 80, 30);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,127,0,255, 1);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#0f0';
+ ctx.moveTo(-10, -10);
+ ctx.lineTo(110, -10);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(-10, 60);
+ ctx.lineTo(-10, -10);
+ ctx.lineTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#f00';
+ ctx.moveTo(-10, -10);
+ ctx.lineTo(110, -10);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(-10, 60);
+ ctx.lineTo(-10, -10);
+ ctx.lineTo(0, 0);
+ ctx.lineTo(0, 50);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(100, 0);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#f00';
+ ctx.moveTo(-10, -10);
+ ctx.lineTo(110, -10);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(-10, 60);
+ ctx.moveTo(0, 0);
+ ctx.lineTo(0, 50);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(100, 0);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#0f0';
+ ctx.moveTo(-10, -10);
+ ctx.lineTo(110, -10);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(-10, 60);
+ ctx.lineTo(-10, -10);
+ ctx.lineTo(-20, -20);
+ ctx.lineTo(120, -20);
+ ctx.lineTo(120, 70);
+ ctx.lineTo(-20, 70);
+ ctx.lineTo(-20, -20);
+ ctx.lineTo(0, 0);
+ ctx.lineTo(0, 50);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(100, 0);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_stroke(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
+
+ ctx.beginPath();
+ ctx.moveTo(40, 25);
+ ctx.moveTo(60, 25);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#000';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)';
+ ctx.lineWidth = 50;
+ ctx.moveTo(0, 20);
+ ctx.lineTo(100, 20);
+ ctx.moveTo(0, 30);
+ ctx.lineTo(100, 30);
+ ctx.stroke();
+
+ //comparePixel(ctx, 50,25, 0,127,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
+
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.arcTo(50, 25, 150, 25, 10);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.arc(50, 25, 10, 0, 0, false);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
+
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.lineTo(50, 25);
+ ctx.closePath();
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 400;
+ ctx.lineJoin = 'miter';
+ ctx.miterLimit = 1.4;
+
+ ctx.beginPath();
+ ctx.moveTo(-1000, 200, 0, 0);
+ ctx.lineTo(-100, 200);
+ ctx.lineTo(-100, 200);
+ ctx.lineTo(-100, 200);
+ ctx.lineTo(-100, 1000);
+ ctx.stroke();
+
+ //FIXME:lineJoin with miterLimit test fail!
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
+
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.quadraticCurveTo(50, 25, 50, 25);
+ ctx.stroke();
+
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.bezierCurveTo(50, 25, 50, 25, 50, 25);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
+
+ ctx.beginPath();
+ ctx.moveTo(50, 25);
+ ctx.lineTo(50, 25);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'round';
+
+ ctx.beginPath();
+ ctx.rect(50, 25, 0, 0);
+ ctx.stroke();
+
+ ctx.strokeRect(50, 25, 0, 0);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.rect(25, 12.5, 50, 25);
+ ctx.save();
+ ctx.scale(50, 25);
+ ctx.strokeStyle = '#0f0';
+ ctx.stroke();
+ ctx.restore();
+
+ ctx.beginPath();
+ ctx.rect(-25, -12.5, 150, 75);
+ ctx.save();
+ ctx.scale(50, 25);
+ ctx.strokeStyle = '#f00';
+ ctx.stroke();
+ ctx.restore();
+
+ //comparePixel(ctx, 0,0, 0,255,0,255);
+ //comparePixel(ctx, 50,0, 0,255,0,255);
+ //comparePixel(ctx, 99,0, 0,255,0,255);
+ //comparePixel(ctx, 0,25, 0,255,0,255);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 99,25, 0,255,0,255);
+ //comparePixel(ctx, 0,49, 0,255,0,255);
+ //comparePixel(ctx, 50,49, 0,255,0,255);
+ //comparePixel(ctx, 99,49, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.rect(25, 12.5, 50, 25);
+ ctx.save();
+ ctx.rotate(Math.PI/2);
+ ctx.scale(25, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.stroke();
+ ctx.restore();
+
+ ctx.beginPath();
+ ctx.rect(-25, -12.5, 150, 75);
+ ctx.save();
+ ctx.rotate(Math.PI/2);
+ ctx.scale(25, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.stroke();
+ ctx.restore();
+
+ comparePixel(ctx, 0,0, 0,255,0,255);
+ comparePixel(ctx, 50,0, 0,255,0,255);
+ comparePixel(ctx, 99,0, 0,255,0,255);
+ comparePixel(ctx, 0,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 99,25, 0,255,0,255);
+ comparePixel(ctx, 0,49, 0,255,0,255);
+ comparePixel(ctx, 50,49, 0,255,0,255);
+ comparePixel(ctx, 99,49, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.save();
+ ctx.beginPath();
+ ctx.moveTo(49, -50);
+ ctx.lineTo(201, -50);
+ ctx.rotate(Math.PI/4);
+ ctx.scale(1, 283);
+ ctx.strokeStyle = '#0f0';
+ ctx.stroke();
+ ctx.restore();
+
+ ctx.save();
+ ctx.beginPath();
+ ctx.translate(-150, 0);
+ ctx.moveTo(49, -50);
+ ctx.lineTo(199, -50);
+ ctx.rotate(Math.PI/4);
+ ctx.scale(1, 142);
+ ctx.strokeStyle = '#f00';
+ ctx.stroke();
+ ctx.restore();
+
+ ctx.save();
+ ctx.beginPath();
+ ctx.translate(-150, 0);
+ ctx.moveTo(49, -50);
+ ctx.lineTo(199, -50);
+ ctx.rotate(Math.PI/4);
+ ctx.scale(1, 142);
+ ctx.strokeStyle = '#f00';
+ ctx.stroke();
+ ctx.restore();
+
+ //comparePixel(ctx, 0,0, 0,255,0,255);
+ comparePixel(ctx, 50,0, 0,255,0,255);
+ //comparePixel(ctx, 99,0, 0,255,0,255);
+ //comparePixel(ctx, 0,25, 0,255,0,255);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 99,25, 0,255,0,255);
+ //comparePixel(ctx, 0,49, 0,255,0,255);
+ comparePixel(ctx, 50,49, 0,255,0,255);
+ comparePixel(ctx, 99,49, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.lineWidth = 50;
+ ctx.moveTo(-100, 25);
+ ctx.lineTo(-100, -100);
+ ctx.lineTo(200, -100);
+ ctx.lineTo(200, 25);
+ ctx.strokeStyle = '#f00';
+ ctx.stroke();
+
+ ctx.closePath();
+ ctx.strokeStyle = '#0f0';
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 40;
+ ctx.moveTo(0, 10);
+ ctx.lineTo(100, 10);
+ ctx.moveTo(100, 40);
+ ctx.lineTo(0, 40);
+ ctx.stroke();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_clip(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.rect(0, 0, 100, 50);
+ ctx.clip();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.rect(-100, 0, 100, 50);
+ ctx.clip();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.clip();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.rect(0, 0, 50, 50);
+ ctx.clip();
+ ctx.beginPath();
+ ctx.rect(50, 0, 50, 50)
+ ctx.clip();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#0f0';
+
+ ctx.beginPath();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(0, 50);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(100, 0);
+ ctx.clip();
+
+ ctx.lineTo(0, 0);
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.moveTo(-10, -10);
+ ctx.lineTo(110, -10);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(-10, 60);
+ ctx.lineTo(-10, -10);
+ ctx.lineTo(0, 0);
+ ctx.lineTo(0, 50);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(100, 0);
+ ctx.clip();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.beginPath();
+ ctx.moveTo(-10, -10);
+ ctx.lineTo(110, -10);
+ ctx.lineTo(110, 60);
+ ctx.lineTo(-10, 60);
+ ctx.lineTo(-10, -10);
+ ctx.clip();
+
+ ctx.beginPath();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(0, 50);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(100, 0);
+ ctx.lineTo(0, 0);
+ ctx.clip();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+
+ function test_moveTo(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.rect(0, 0, 10, 50);
+ ctx.moveTo(100, 0);
+ ctx.lineTo(10, 0);
+ ctx.lineTo(10, 50);
+ ctx.lineTo(100, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 90,25, 0,255,0,255);
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.moveTo(0, 25);
+ ctx.moveTo(100, 25);
+ ctx.moveTo(0, 25);
+ ctx.lineTo(100, 25);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.beginPath();
+ ctx.moveTo(0, 0);
+ ctx.moveTo(100, 0);
+ ctx.moveTo(100, 50);
+ ctx.moveTo(0, 50);
+ ctx.fillStyle = '#f00';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.moveTo(Infinity, 50);
+ ctx.moveTo(-Infinity, 50);
+ ctx.moveTo(NaN, 50);
+ ctx.moveTo(0, Infinity);
+ ctx.moveTo(0, -Infinity);
+ ctx.moveTo(0, NaN);
+ ctx.moveTo(Infinity, Infinity);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_lineTo(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.lineTo(100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.lineTo(100, 50);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.lineTo(0, 25);
+ ctx.lineTo(100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.moveTo(-100, -100);
+ ctx.lineTo(0, 25);
+ ctx.lineTo(100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.lineTo(Infinity, 50);
+ ctx.lineTo(-Infinity, 50);
+ ctx.lineTo(NaN, 50);
+ ctx.lineTo(0, Infinity);
+ ctx.lineTo(0, -Infinity);
+ ctx.lineTo(0, NaN);
+ ctx.lineTo(Infinity, Infinity);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 90,45, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_bezierCurveTo(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.bezierCurveTo(100, 25, 100, 25, 100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.bezierCurveTo(100, 50, 200, 50, 200, 50);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 95,45, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.bezierCurveTo(0, 25, 100, 25, 100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 5,45, 0,255,0,255);
+
+ ctx.reset();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50);
+ ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50);
+ ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50);
+ ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50);
+ ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50);
+ ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50);
+ ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50);
+ ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50);
+ ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50);
+ ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50);
+ ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50);
+ ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50);
+ ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50);
+ ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50);
+ ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50);
+ ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity);
+ ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity);
+ ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50);
+ ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity);
+ ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50);
+ ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50);
+ ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50);
+ ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity);
+ ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50);
+ ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50);
+ ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity);
+ ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50);
+ ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50);
+ ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity);
+ ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity);
+ ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50);
+ ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity);
+ ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity);
+ ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 90,45, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.scale(1000, 1000);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 0.055;
+ ctx.beginPath();
+ ctx.moveTo(-2, 3.1);
+ ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 55;
+ ctx.beginPath();
+ ctx.moveTo(-2000, 3100);
+ ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_quadraticCurveTo(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.moveTo(0, 25);
+ ctx.quadraticCurveTo(100, 25, 100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.quadraticCurveTo(100, 50, 200, 50);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 95,45, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.beginPath();
+ ctx.quadraticCurveTo(0, 25, 100, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 5,45, 0,255,0,255);
+
+ ctx.reset();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.quadraticCurveTo(Infinity, 50, 0, 50);
+ ctx.quadraticCurveTo(-Infinity, 50, 0, 50);
+ ctx.quadraticCurveTo(NaN, 50, 0, 50);
+ ctx.quadraticCurveTo(0, Infinity, 0, 50);
+ ctx.quadraticCurveTo(0, -Infinity, 0, 50);
+ ctx.quadraticCurveTo(0, NaN, 0, 50);
+ ctx.quadraticCurveTo(0, 50, Infinity, 50);
+ ctx.quadraticCurveTo(0, 50, -Infinity, 50);
+ ctx.quadraticCurveTo(0, 50, NaN, 50);
+ ctx.quadraticCurveTo(0, 50, 0, Infinity);
+ ctx.quadraticCurveTo(0, 50, 0, -Infinity);
+ ctx.quadraticCurveTo(0, 50, 0, NaN);
+ ctx.quadraticCurveTo(Infinity, Infinity, 0, 50);
+ ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50);
+ ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity);
+ ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity);
+ ctx.quadraticCurveTo(Infinity, 50, Infinity, 50);
+ ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity);
+ ctx.quadraticCurveTo(Infinity, 50, 0, Infinity);
+ ctx.quadraticCurveTo(0, Infinity, Infinity, 50);
+ ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity);
+ ctx.quadraticCurveTo(0, Infinity, 0, Infinity);
+ ctx.quadraticCurveTo(0, 50, Infinity, Infinity);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 90,45, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.scale(1000, 1000);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 0.055;
+ ctx.beginPath();
+ ctx.moveTo(-1, 1.05);
+ ctx.quadraticCurveTo(0, -1, 1.2, 1.05);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 55;
+ ctx.beginPath();
+ ctx.moveTo(-1000, 1050);
+ ctx.quadraticCurveTo(0, -1000, 1200, 1050);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ //comparePixel(ctx, 1,1, 0,255,0,255);
+ //comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_rect(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.rect(0, 0, 100, 50);
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 200;
+ ctx.lineJoin = 'miter';
+ ctx.rect(100, 50, 100, 100);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 100;
+ ctx.rect(200, 100, 400, 1000);
+ ctx.lineTo(-2000, -1000);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 450;
+ ctx.lineCap = 'round';
+ ctx.lineJoin = 'bevel';
+ ctx.rect(150, 150, 2000, 2000);
+ ctx.lineTo(160, 160);
+ ctx.stroke();
+ comparePixel(ctx, 1,1, 0,255,0,255);
+ comparePixel(ctx, 98,1, 0,255,0,255);
+ comparePixel(ctx, 1,48, 0,255,0,255);
+ comparePixel(ctx, 98,48, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.beginPath();
+ ctx.fillStyle = '#0f0';
+ ctx.rect(0, 0, 50, 25);
+ ctx.rect(100, 0, -50, 25);
+ ctx.rect(0, 50, 50, -25);
+ ctx.rect(100, 50, -50, -25);
+ ctx.fill();
+ comparePixel(ctx, 25,12, 0,255,0,255);
+ comparePixel(ctx, 75,12, 0,255,0,255);
+ comparePixel(ctx, 25,37, 0,255,0,255);
+ comparePixel(ctx, 75,37, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.beginPath();
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 50;
+ ctx.moveTo(-100, 25);
+ ctx.lineTo(-50, 25);
+ ctx.rect(200, 25, 1, 1);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+
+ ctx.reset();
+ ctx.moveTo(0, 0);
+ ctx.lineTo(100, 0);
+ ctx.rect(Infinity, 50, 1, 1);
+ ctx.rect(-Infinity, 50, 1, 1);
+ ctx.rect(NaN, 50, 1, 1);
+ ctx.rect(0, Infinity, 1, 1);
+ ctx.rect(0, -Infinity, 1, 1);
+ ctx.rect(0, NaN, 1, 1);
+ ctx.rect(0, 50, Infinity, 1);
+ ctx.rect(0, 50, -Infinity, 1);
+ ctx.rect(0, 50, NaN, 1);
+ ctx.rect(0, 50, 1, Infinity);
+ ctx.rect(0, 50, 1, -Infinity);
+ ctx.rect(0, 50, 1, NaN);
+ ctx.rect(Infinity, Infinity, 1, 1);
+ ctx.rect(Infinity, Infinity, Infinity, 1);
+ ctx.rect(Infinity, Infinity, Infinity, Infinity);
+ ctx.rect(Infinity, Infinity, 1, Infinity);
+ ctx.rect(Infinity, 50, Infinity, 1);
+ ctx.rect(Infinity, 50, Infinity, Infinity);
+ ctx.rect(Infinity, 50, 1, Infinity);
+ ctx.rect(0, Infinity, Infinity, 1);
+ ctx.rect(0, Infinity, Infinity, Infinity);
+ ctx.rect(0, Infinity, 1, Infinity);
+ ctx.rect(0, 50, Infinity, Infinity);
+ ctx.lineTo(100, 50);
+ ctx.lineTo(0, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 90,45, 0,255,0,255);
+
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 90;
+ ctx.beginPath();
+ ctx.rect(45, 20, 10, 10);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.beginPath();
+ ctx.fillStyle = '#f00';
+ ctx.rect(0, 0, 50, 50);
+ ctx.rect(100, 50, -50, -50);
+ ctx.rect(0, 25, 100, -25);
+ ctx.rect(100, 25, -100, 25);
+ ctx.fill();
+ comparePixel(ctx, 25,12, 0,255,0,255);
+ comparePixel(ctx, 75,12, 0,255,0,255);
+ comparePixel(ctx, 25,37, 0,255,0,255);
+ comparePixel(ctx, 75,37, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.rect(0, 50, 100, 0);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.rect(50, -100, 0, 250);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 100;
+ ctx.beginPath();
+ ctx.rect(50, 25, 0, 0);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#0f0';
+ ctx.lineWidth = 50;
+ ctx.rect(100, 25, 0, 0);
+ ctx.lineTo(0, 25);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 50;
+ ctx.moveTo(0, 0);
+ ctx.rect(100, 25, 0, 0);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineJoin = 'miter';
+ ctx.miterLimit = 1.5;
+ ctx.lineWidth = 200;
+ ctx.beginPath();
+ ctx.rect(100, 25, 1000, 0);
+ ctx.stroke();
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+
+ function test_clearRect(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.beginPath();
+ ctx.rect(0, 0, 100, 50);
+ ctx.clearRect(0, 0, 16, 16);
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_fillRect(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.beginPath();
+ ctx.rect(0, 0, 100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 16, 16);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+
+ function test_strokeRect(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.beginPath();
+ ctx.rect(0, 0, 100, 50);
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 5;
+ ctx.strokeRect(0, 0, 16, 16);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_transform(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.translate(-100, 0);
+ ctx.rect(100, 0, 100, 50);
+ ctx.translate(0, -100);
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.moveTo(0, 0);
+ ctx.translate(100, 0);
+ ctx.lineTo(0, 0);
+ ctx.translate(0, 50);
+ ctx.lineTo(0, 0);
+ ctx.translate(-100, 0);
+ ctx.lineTo(0, 0);
+ ctx.translate(1000, 1000);
+ ctx.rotate(Math.PI/2);
+ ctx.scale(0.1, 0.1);
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+
+ ctx.reset();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.fillStyle = '#f00';
+ ctx.translate(-100, 0);
+ ctx.rect(0, 0, 100, 50);
+ ctx.fill();
+ ctx.translate(100, 0);
+ ctx.fill();
+
+ ctx.beginPath();
+ ctx.strokeStyle = '#f00';
+ ctx.lineWidth = 50;
+ ctx.translate(0, -50);
+ ctx.moveTo(0, 25);
+ ctx.lineTo(100, 25);
+ ctx.stroke();
+ ctx.translate(0, 50);
+ ctx.stroke();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml b/tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml
new file mode 100644
index 0000000000..1d7fd2c12f
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_pattern.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "pattern"
+ function init_data() { return testData("2d"); }
+ function test_basic(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_animated(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_image(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_modified(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_paint(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_repeat(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml
new file mode 100644
index 0000000000..487f7dc903
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+CanvasTestCase {
+ id:testCase
+ name: "pixel"
+ function init_data() { return testData("2d"); }
+ function test_createImageData(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ var imageData = ctx.createImageData(1, 1);
+ var imageDataValues = imageData.data;
+ imageDataValues[0] = 255;
+ imageDataValues[0] = 0;
+ if (imageDataValues[0] != 0)
+ qtest_fail('ImageData value access fail, expecting 0, got ' + imageDataValues[0]);
+
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_getImageData(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_object(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_putImageData(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_filters(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml b/tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml
new file mode 100644
index 0000000000..2baaa072d0
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_shadow.qml
@@ -0,0 +1,77 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "shadow"
+ function init_data() { return testData("2d"); }
+ function test_basic(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_blur(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+
+ function test_clip(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+
+ function test_composite(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+
+ function test_enable(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+
+ function test_gradient(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_image(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_offset(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_pattern(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_stroke(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_tranform(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_state.qml b/tests/auto/quick/qquickcanvasitem/data/tst_state.qml
new file mode 100644
index 0000000000..1ceb17b31b
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_state.qml
@@ -0,0 +1,408 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "state"
+ function init_data() { return testData("2d"); }
+ function test_bitmap(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.restore();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_clip(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.rect(0, 0, 1, 1);
+ ctx.clip();
+ ctx.restore();
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ //comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_fillStyle(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ // Test that restore() undoes any modifications
+ var old = ctx.fillStyle;
+ ctx.save();
+ ctx.fillStyle = "#ff0000";
+ ctx.restore();
+ compare(ctx.fillStyle, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.fillStyle = "#ff0000";
+ old = ctx.fillStyle;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "#ff0000"
+ ctx.save();
+ compare(ctx.fillStyle, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_font(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.font;
+ ctx.save();
+ ctx.font = "25px serif";
+ ctx.restore();
+ compare(ctx.font, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.font = "25px serif";
+ old = ctx.font;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "25px serif"
+ ctx.save();
+ compare(ctx.font, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_globalAlpha(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.globalAlpha;
+ ctx.save();
+ ctx.globalAlpha = 0.5;
+ ctx.restore();
+ compare(ctx.globalAlpha, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.globalAlpha = 0.5;
+ old = ctx.globalAlpha;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against 0.5
+ ctx.save();
+ compare(ctx.globalAlpha, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_globalCompositeOperation(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.globalCompositeOperation;
+ ctx.save();
+ ctx.globalCompositeOperation = "copy";
+ ctx.restore();
+ compare(ctx.globalCompositeOperation, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.globalCompositeOperation = "copy";
+ old = ctx.globalCompositeOperation;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "copy"
+ ctx.save();
+ compare(ctx.globalCompositeOperation, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_lineCap(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineCap;
+ ctx.save();
+ ctx.lineCap = "round";
+ ctx.restore();
+ compare(ctx.lineCap, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.lineCap = "round";
+ old = ctx.lineCap;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "round"
+ ctx.save();
+ compare(ctx.lineCap, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_lineJoin(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineJoin;
+ ctx.save();
+ ctx.lineJoin = "round";
+ ctx.restore();
+ compare(ctx.lineJoin, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.lineJoin = "round";
+ old = ctx.lineJoin;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "round"
+ ctx.save();
+ compare(ctx.lineJoin, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_lineWidth(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.lineJoin;
+ ctx.save();
+ ctx.lineJoin = "round";
+ ctx.restore();
+ compare(ctx.lineJoin, old, "ctx.lineJoin", "old");
+
+ // Also test that save() doesn't modify the values
+ ctx.lineJoin = "round";
+ old = ctx.lineJoin;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "round"
+ ctx.save();
+ compare(ctx.lineJoin, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_miterLimit(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.miterLimit;
+ ctx.save();
+ ctx.miterLimit = 0.5;
+ ctx.restore();
+ compare(ctx.miterLimit, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.miterLimit = 0.5;
+ old = ctx.miterLimit;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against 0.5
+ ctx.save();
+ compare(ctx.miterLimit, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_path(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.rect(0, 0, 100, 50);
+ ctx.restore();
+ ctx.fillStyle = '#0f0';
+ ctx.fill();
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_shadow(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowBlur;
+ ctx.save();
+ ctx.shadowBlur = 5;
+ ctx.restore();
+ compare(ctx.shadowBlur, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowBlur = 5;
+ old = ctx.shadowBlur;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against 5
+ ctx.save();
+ compare(ctx.shadowBlur, old);
+ ctx.restore();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowColor;
+ ctx.save();
+ ctx.shadowColor = "#ff0000";
+ ctx.restore();
+ compare(ctx.shadowColor, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowColor = "#ff0000";
+ old = ctx.shadowColor;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "#ff0000"
+ ctx.save();
+ compare(ctx.shadowColor, old);
+ ctx.restore();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowOffsetX;
+ ctx.save();
+ ctx.shadowOffsetX = 5;
+ ctx.restore();
+ compare(ctx.shadowOffsetX, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowOffsetX = 5;
+ old = ctx.shadowOffsetX;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against 5
+ ctx.save();
+ compare(ctx.shadowOffsetX, old);
+ ctx.restore();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.shadowOffsetY;
+ ctx.save();
+ ctx.shadowOffsetY = 5;
+ ctx.restore();
+ compare(ctx.shadowOffsetY, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.shadowOffsetY = 5;
+ old = ctx.shadowOffsetY;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against 5
+ ctx.save();
+ compare(ctx.shadowOffsetY, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_stack(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.lineWidth = 1;
+ ctx.save();
+ ctx.lineWidth = 2;
+ ctx.save();
+ ctx.lineWidth = 3;
+ compare(ctx.lineWidth, 3);
+ ctx.restore();
+ compare(ctx.lineWidth, 2);
+ ctx.restore();
+ compare(ctx.lineWidth, 1);
+
+ var limit = 512;
+ for (var i = 1; i < limit; ++i)
+ {
+ ctx.save();
+ ctx.lineWidth = i;
+ }
+ for (var i = limit-1; i > 0; --i)
+ {
+ testCase.compare(ctx.lineWidth, i); //strange javascript error here
+ ctx.restore();
+ }
+
+ for (var i = 0; i < 16; ++i)
+ ctx.restore();
+ ctx.lineWidth = 0.5;
+ ctx.restore();
+ compare(ctx.lineWidth, 0.5);
+ canvas.destroy()
+ }
+ function test_strokeStyle(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.strokeStyle;
+ ctx.save();
+ ctx.strokeStyle = "#ff0000";
+ ctx.restore();
+ compare(ctx.strokeStyle, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.strokeStyle = "#ff0000";
+ old = ctx.strokeStyle;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "#ff0000"
+ ctx.save();
+ compare(ctx.strokeStyle, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+
+ function test_text(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.textAlign;
+ ctx.save();
+ ctx.textAlign = "center";
+ ctx.restore();
+ compare(ctx.textAlign, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.textAlign = "center";
+ old = ctx.textAlign;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "center"
+ ctx.save();
+ compare(ctx.textAlign, old);
+ ctx.restore();
+
+ // Test that restore() undoes any modifications
+ var old = ctx.textBaseline;
+ ctx.save();
+ ctx.textBaseline = "bottom";
+ ctx.restore();
+ compare(ctx.textBaseline, old);
+
+ // Also test that save() doesn't modify the values
+ ctx.textBaseline = "bottom";
+ old = ctx.textBaseline;
+ // we're not interested in failures caused by get(set(x)) != x (e.g.
+ // from rounding), so compare against 'old' instead of against "bottom"
+ ctx.save();
+ compare(ctx.textBaseline, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+
+ function test_transform(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.save();
+ ctx.translate(200, 0);
+ ctx.restore();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(-200, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml b/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml
new file mode 100644
index 0000000000..22803a19ce
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_strokeStyle.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "strokeStyle"
+ function init_data() { return testData("2d"); }
+ function test_default(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ compare(ctx.strokeStyle, "#000000")
+ ctx.clearRect(0, 0, 1, 1);
+ compare(ctx.strokeStyle, "#000000")
+ canvas.destroy()
+ }
+ function test_saverestore(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ var old = ctx.strokeStyle;
+ ctx.save();
+ ctx.strokeStyle = "#ffaaff";
+ ctx.restore();
+ compare(ctx.strokeStyle, old);
+
+ ctx.strokeStyle = "#ffcc88";
+ old = ctx.strokeStyle;
+ ctx.save();
+ compare(ctx.strokeStyle, old);
+ ctx.restore();
+ canvas.destroy()
+ }
+ function test_namedColor(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.strokeStyle = "red";
+ ctx.strokeRect(0,0,1,1);
+ comparePixel(ctx,0,0,255,0,0,255);
+
+ ctx.strokeStyle = "black";
+ ctx.strokeRect(0,0,1,1);
+ comparePixel(ctx,0,0,0,0,0,255);
+
+ ctx.strokeStyle = "white";
+ ctx.strokeRect(0,0,1,1);
+ comparePixel(ctx,0,0,255,255,255,255);
+ canvas.destroy()
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_svgpath.qml b/tests/auto/quick/qquickcanvasitem/data/tst_svgpath.qml
new file mode 100644
index 0000000000..2b39357bed
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_svgpath.qml
@@ -0,0 +1,58 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "svgpath"
+ function init_data() { return testData("2d"); }
+ function test_svgpath(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ var svgs = [
+ // Absolute coordinates, explicit commands.
+ "M50 0 V50 H0 Q0 25 25 25 T50 0 C25 0 50 50 25 50 S25 0 0 0 Z",
+ // Absolute coordinates, implicit commands.
+ "M50 0 50 50 0 50 Q0 25 25 25 Q50 25 50 0 C25 0 50 50 25 50 C0 50 25 0 0 0 Z",
+ // Relative coordinates, explicit commands.
+ "m50 0 v50 h-50 q0 -25 25 -25 t25 -25 c-25 0 0 50 -25 50 s0 -50 -25 -50 z",
+ // Relative coordinates, implicit commands.
+ "m50 0 0 50 -50 0 q0 -25 25 -25 25 0 25 -25 c-25 0 0 50 -25 50 -25 0 0 -50 -25 -50 z",
+ // Absolute coordinates, explicit commands, minimal whitespace.
+ "m50 0v50h-50q0-25 25-25t25-25c-25 0 0 50-25 50s0-50-25-50z",
+ // Absolute coordinates, explicit commands, extra whitespace.
+ " M 50 0 V 50 H 0 Q 0 25 25 25 T 50 0 C 25 0 50 50 25 50 S 25 0 0 0 Z"
+ ];
+
+ var blues = [
+ -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 0, 0, 0, 0, 0, 0,-1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 1, 0,
+ 1, 1, 1, 0,-1, 1, 1, 1, 0, 0,
+ 1, 1, 0, 1, 1, 1, 1, 1, 0, 0,
+ 1, 0, 0, 1, 1, 1, 1, 1, 0, 0,
+ 1, 0, 0, 1, 1, 1, 1, 1, 0, 0,
+ -1, 0, 0, 0, 1, 1, 1, 0, 0, 0
+ ];
+
+ ctx.fillRule = Qt.OddEvenFill;
+ for (var i = 0; i < svgs.length; i++) {
+ ctx.fillStyle = "blue";
+ ctx.fillRect(0, 0, 50, 50);
+ ctx.fillStyle = "red";
+ ctx.path = svgs[i];
+ ctx.fill();
+ var x, y;
+ for (x=0; x < 10; x++) {
+ for (y=0; y < 10; y++) {
+ if (blues[y*10 +x] == -1) continue; //edge point, different render target may have different value
+ if (blues[y * 10 + x]) {
+ comparePixel(ctx, x * 5, y * 5, 0, 0, 255, 255);
+ } else {
+ comparePixel(ctx, x * 5, y * 5, 255, 0, 0, 255);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_text.qml b/tests/auto/quick/qquickcanvasitem/data/tst_text.qml
new file mode 100644
index 0000000000..bfc4067040
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_text.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "text"
+ function init_data() { return testData("2d"); }
+ function test_baseLine(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_align(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_stroke(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_fill(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_font(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+ function test_measure(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ canvas.destroy()
+ }
+
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_transform.qml b/tests/auto/quick/qquickcanvasitem/data/tst_transform.qml
new file mode 100644
index 0000000000..b2f5b51fa5
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_transform.qml
@@ -0,0 +1,492 @@
+import QtQuick 2.0
+
+CanvasTestCase {
+ id:testCase
+ name: "transform"
+ function init_data() { return testData("2d"); }
+ function test_order(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.scale(2, 1);
+ ctx.rotate(Math.PI / 2);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, -50, 50, 50);
+ comparePixel(ctx, 75,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_rotate(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.rotate(Math.PI / 2);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, -100, 50, 100);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.translate(100, 10);
+ ctx.rotate(Infinity);
+ ctx.rotate(-Infinity);
+ ctx.rotate(NaN);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -10, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.rotate(Math.PI); // should fail obviously if this is 3.1 degrees
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -50, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.rotate(Math.PI * (1 + 4096)); // == pi (mod 2*pi)
+ // We need about pi +/- 0.001 in order to get correct-looking results
+ // 32-bit floats can store pi*4097 with precision 2^-10, so that should
+ // be safe enough on reasonable implementations
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -50, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 98,2, 0,255,0,255);
+ comparePixel(ctx, 98,47, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.rotate(-Math.PI * (1 + 4096));
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -50, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ comparePixel(ctx, 98,2, 0,255,0,255);
+ comparePixel(ctx, 98,47, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.rotate(0);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_scale(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.scale(2, 4);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 50, 12.5);
+ comparePixel(ctx, 90,40, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.scale(1e5, 1e5);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 1, 1);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.scale(Math.sqrt(2), Math.sqrt(2));
+ ctx.scale(Math.sqrt(2), Math.sqrt(2));
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 50, 25);
+ comparePixel(ctx, 90,40, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.save();
+ ctx.scale(-1, 1);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-50, 0, 50, 50);
+ ctx.restore();
+
+ ctx.save();
+ ctx.scale(1, -1);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(50, -50, 50, 50);
+ ctx.restore();
+ comparePixel(ctx, 25,25, 0,255,0,255);
+ comparePixel(ctx, 75,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.translate(100, 10);
+ ctx.scale(Infinity, 0.1);
+ ctx.scale(-Infinity, 0.1);
+ ctx.scale(NaN, 0.1);
+ ctx.scale(0.1, Infinity);
+ ctx.scale(0.1, -Infinity);
+ ctx.scale(0.1, NaN);
+ ctx.scale(Infinity, Infinity);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -10, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.save();
+ ctx.translate(50, 0);
+ ctx.scale(0, 1);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.restore();
+
+ ctx.save();
+ ctx.translate(0, 25);
+ ctx.scale(1, 0);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.restore();
+
+ // Firefox has a bug where it renders the canvas as empty and toDataURL throws an exception
+ canvas.toDataURL();
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_setTransform(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.setTransform(1/2,0, 0,1/2, 0,0);
+ ctx.setTransform(2,0, 0,2, 0,0);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 50, 25);
+ comparePixel(ctx, 75,35, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.translate(100, 10);
+ ctx.setTransform(Infinity, 0, 0, 0, 0, 0);
+ ctx.setTransform(-Infinity, 0, 0, 0, 0, 0);
+ ctx.setTransform(NaN, 0, 0, 0, 0, 0);
+ ctx.setTransform(0, Infinity, 0, 0, 0, 0);
+ ctx.setTransform(0, -Infinity, 0, 0, 0, 0);
+ ctx.setTransform(0, NaN, 0, 0, 0, 0);
+ ctx.setTransform(0, 0, Infinity, 0, 0, 0);
+ ctx.setTransform(0, 0, -Infinity, 0, 0, 0);
+ ctx.setTransform(0, 0, NaN, 0, 0, 0);
+ ctx.setTransform(0, 0, 0, Infinity, 0, 0);
+ ctx.setTransform(0, 0, 0, -Infinity, 0, 0);
+ ctx.setTransform(0, 0, 0, NaN, 0, 0);
+ ctx.setTransform(0, 0, 0, 0, Infinity, 0);
+ ctx.setTransform(0, 0, 0, 0, -Infinity, 0);
+ ctx.setTransform(0, 0, 0, 0, NaN, 0);
+ ctx.setTransform(0, 0, 0, 0, 0, Infinity);
+ ctx.setTransform(0, 0, 0, 0, 0, -Infinity);
+ ctx.setTransform(0, 0, 0, 0, 0, NaN);
+ ctx.setTransform(Infinity, Infinity, 0, 0, 0, 0);
+ ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, 0);
+ ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, 0);
+ ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, 0);
+ ctx.setTransform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.setTransform(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
+ ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, 0);
+ ctx.setTransform(Infinity, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.setTransform(Infinity, Infinity, Infinity, 0, 0, Infinity);
+ ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, 0);
+ ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, 0);
+ ctx.setTransform(Infinity, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.setTransform(Infinity, Infinity, 0, Infinity, 0, Infinity);
+ ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, 0);
+ ctx.setTransform(Infinity, Infinity, 0, 0, Infinity, Infinity);
+ ctx.setTransform(Infinity, Infinity, 0, 0, 0, Infinity);
+ ctx.setTransform(Infinity, 0, Infinity, 0, 0, 0);
+ ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, 0);
+ ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, 0);
+ ctx.setTransform(Infinity, 0, Infinity, Infinity, Infinity, Infinity);
+ ctx.setTransform(Infinity, 0, Infinity, Infinity, 0, Infinity);
+ ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, 0);
+ ctx.setTransform(Infinity, 0, Infinity, 0, Infinity, Infinity);
+ ctx.setTransform(Infinity, 0, Infinity, 0, 0, Infinity);
+ ctx.setTransform(Infinity, 0, 0, Infinity, 0, 0);
+ ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, 0);
+ ctx.setTransform(Infinity, 0, 0, Infinity, Infinity, Infinity);
+ ctx.setTransform(Infinity, 0, 0, Infinity, 0, Infinity);
+ ctx.setTransform(Infinity, 0, 0, 0, Infinity, 0);
+ ctx.setTransform(Infinity, 0, 0, 0, Infinity, Infinity);
+ ctx.setTransform(Infinity, 0, 0, 0, 0, Infinity);
+ ctx.setTransform(0, Infinity, Infinity, 0, 0, 0);
+ ctx.setTransform(0, Infinity, Infinity, Infinity, 0, 0);
+ ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, 0);
+ ctx.setTransform(0, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.setTransform(0, Infinity, Infinity, Infinity, 0, Infinity);
+ ctx.setTransform(0, Infinity, Infinity, 0, Infinity, 0);
+ ctx.setTransform(0, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.setTransform(0, Infinity, Infinity, 0, 0, Infinity);
+ ctx.setTransform(0, Infinity, 0, Infinity, 0, 0);
+ ctx.setTransform(0, Infinity, 0, Infinity, Infinity, 0);
+ ctx.setTransform(0, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.setTransform(0, Infinity, 0, Infinity, 0, Infinity);
+ ctx.setTransform(0, Infinity, 0, 0, Infinity, 0);
+ ctx.setTransform(0, Infinity, 0, 0, Infinity, Infinity);
+ ctx.setTransform(0, Infinity, 0, 0, 0, Infinity);
+ ctx.setTransform(0, 0, Infinity, Infinity, 0, 0);
+ ctx.setTransform(0, 0, Infinity, Infinity, Infinity, 0);
+ ctx.setTransform(0, 0, Infinity, Infinity, Infinity, Infinity);
+ ctx.setTransform(0, 0, Infinity, Infinity, 0, Infinity);
+ ctx.setTransform(0, 0, Infinity, 0, Infinity, 0);
+ ctx.setTransform(0, 0, Infinity, 0, Infinity, Infinity);
+ ctx.setTransform(0, 0, Infinity, 0, 0, Infinity);
+ ctx.setTransform(0, 0, 0, Infinity, Infinity, 0);
+ ctx.setTransform(0, 0, 0, Infinity, Infinity, Infinity);
+ ctx.setTransform(0, 0, 0, Infinity, 0, Infinity);
+ ctx.setTransform(0, 0, 0, 0, Infinity, Infinity);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -10, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ // Create green with a red square ring inside it
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(20, 10, 60, 30);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(40, 20, 20, 10);
+
+ // Draw a skewed shape to fill that gap, to make sure it is aligned correctly
+ ctx.setTransform(1,4, 2,3, 5,6);
+ // Post-transform coordinates:
+ // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]];
+ // Hence pre-transform coordinates:
+ var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2],
+ [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2],
+ [-7.4,11.2]];
+ ctx.beginPath();
+ ctx.moveTo(pts[0][0], pts[0][1]);
+ for (var i = 0; i < pts.length; ++i)
+ ctx.lineTo(pts[i][0], pts[i][1]);
+ ctx.fill();
+ /*
+ //FIXME:
+ comparePixel(ctx, 21,11, 0,255,0,255);
+ comparePixel(ctx, 79,11, 0,255,0,255);
+ comparePixel(ctx, 21,39, 0,255,0,255);
+ comparePixel(ctx, 79,39, 0,255,0,255);
+ comparePixel(ctx, 39,19, 0,255,0,255);
+ comparePixel(ctx, 61,19, 0,255,0,255);
+ comparePixel(ctx, 39,31, 0,255,0,255);
+ comparePixel(ctx, 61,31, 0,255,0,255);
+ */
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.transform(1,0, 0,1, 0,0);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+ function test_transform(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.transform(1,2, 3,4, 5,6);
+ ctx.transform(-2,1, 3/2,-1/2, 1,-2);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.translate(100, 10);
+ ctx.transform(Infinity, 0, 0, 0, 0, 0);
+ ctx.transform(-Infinity, 0, 0, 0, 0, 0);
+ ctx.transform(NaN, 0, 0, 0, 0, 0);
+ ctx.transform(0, Infinity, 0, 0, 0, 0);
+ ctx.transform(0, -Infinity, 0, 0, 0, 0);
+ ctx.transform(0, NaN, 0, 0, 0, 0);
+ ctx.transform(0, 0, Infinity, 0, 0, 0);
+ ctx.transform(0, 0, -Infinity, 0, 0, 0);
+ ctx.transform(0, 0, NaN, 0, 0, 0);
+ ctx.transform(0, 0, 0, Infinity, 0, 0);
+ ctx.transform(0, 0, 0, -Infinity, 0, 0);
+ ctx.transform(0, 0, 0, NaN, 0, 0);
+ ctx.transform(0, 0, 0, 0, Infinity, 0);
+ ctx.transform(0, 0, 0, 0, -Infinity, 0);
+ ctx.transform(0, 0, 0, 0, NaN, 0);
+ ctx.transform(0, 0, 0, 0, 0, Infinity);
+ ctx.transform(0, 0, 0, 0, 0, -Infinity);
+ ctx.transform(0, 0, 0, 0, 0, NaN);
+ ctx.transform(Infinity, Infinity, 0, 0, 0, 0);
+ ctx.transform(Infinity, Infinity, Infinity, 0, 0, 0);
+ ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, 0);
+ ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, 0);
+ ctx.transform(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.transform(Infinity, Infinity, Infinity, Infinity, 0, Infinity);
+ ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, 0);
+ ctx.transform(Infinity, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.transform(Infinity, Infinity, Infinity, 0, 0, Infinity);
+ ctx.transform(Infinity, Infinity, 0, Infinity, 0, 0);
+ ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, 0);
+ ctx.transform(Infinity, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.transform(Infinity, Infinity, 0, Infinity, 0, Infinity);
+ ctx.transform(Infinity, Infinity, 0, 0, Infinity, 0);
+ ctx.transform(Infinity, Infinity, 0, 0, Infinity, Infinity);
+ ctx.transform(Infinity, Infinity, 0, 0, 0, Infinity);
+ ctx.transform(Infinity, 0, Infinity, 0, 0, 0);
+ ctx.transform(Infinity, 0, Infinity, Infinity, 0, 0);
+ ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, 0);
+ ctx.transform(Infinity, 0, Infinity, Infinity, Infinity, Infinity);
+ ctx.transform(Infinity, 0, Infinity, Infinity, 0, Infinity);
+ ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0);
+ ctx.transform(Infinity, 0, Infinity, 0, Infinity, 0);
+ ctx.transform(Infinity, 0, Infinity, 0, Infinity, Infinity);
+ ctx.transform(Infinity, 0, Infinity, 0, 0, Infinity);
+ ctx.transform(Infinity, 0, 0, Infinity, 0, 0);
+ ctx.transform(Infinity, 0, 0, Infinity, Infinity, 0);
+ ctx.transform(Infinity, 0, 0, Infinity, Infinity, Infinity);
+ ctx.transform(Infinity, 0, 0, Infinity, 0, Infinity);
+ ctx.transform(Infinity, 0, 0, 0, Infinity, 0);
+ ctx.transform(Infinity, 0, 0, 0, Infinity, Infinity);
+ ctx.transform(Infinity, 0, 0, 0, 0, Infinity);
+ ctx.transform(0, Infinity, Infinity, 0, 0, 0);
+ ctx.transform(0, Infinity, Infinity, Infinity, 0, 0);
+ ctx.transform(0, Infinity, Infinity, Infinity, Infinity, 0);
+ ctx.transform(0, Infinity, Infinity, Infinity, Infinity, Infinity);
+ ctx.transform(0, Infinity, Infinity, Infinity, 0, Infinity);
+ ctx.transform(0, Infinity, Infinity, 0, Infinity, 0);
+ ctx.transform(0, Infinity, Infinity, 0, Infinity, Infinity);
+ ctx.transform(0, Infinity, Infinity, 0, 0, Infinity);
+ ctx.transform(0, Infinity, 0, Infinity, 0, 0);
+ ctx.transform(0, Infinity, 0, Infinity, Infinity, 0);
+ ctx.transform(0, Infinity, 0, Infinity, Infinity, Infinity);
+ ctx.transform(0, Infinity, 0, Infinity, 0, Infinity);
+ ctx.transform(0, Infinity, 0, 0, Infinity, 0);
+ ctx.transform(0, Infinity, 0, 0, Infinity, Infinity);
+ ctx.transform(0, Infinity, 0, 0, 0, Infinity);
+ ctx.transform(0, 0, Infinity, Infinity, 0, 0);
+ ctx.transform(0, 0, Infinity, Infinity, Infinity, 0);
+ ctx.transform(0, 0, Infinity, Infinity, Infinity, Infinity);
+ ctx.transform(0, 0, Infinity, Infinity, 0, Infinity);
+ ctx.transform(0, 0, Infinity, 0, Infinity, 0);
+ ctx.transform(0, 0, Infinity, 0, Infinity, Infinity);
+ ctx.transform(0, 0, Infinity, 0, 0, Infinity);
+ ctx.transform(0, 0, 0, Infinity, Infinity, 0);
+ ctx.transform(0, 0, 0, Infinity, Infinity, Infinity);
+ ctx.transform(0, 0, 0, Infinity, 0, Infinity);
+ ctx.transform(0, 0, 0, 0, Infinity, Infinity);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -10, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ ctx.reset();
+
+ // Create green with a red square ring inside it
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 50);
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(20, 10, 60, 30);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(40, 20, 20, 10);
+
+ // Draw a skewed shape to fill that gap, to make sure it is aligned correctly
+ ctx.transform(1,4, 2,3, 5,6);
+ // Post-transform coordinates:
+ // [[20,10],[80,10],[80,40],[20,40],[20,10],[40,20],[40,30],[60,30],[60,20],[40,20],[20,10]];
+ // Hence pre-transform coordinates:
+ var pts=[[-7.4,11.2],[-43.4,59.2],[-31.4,53.2],[4.6,5.2],[-7.4,11.2],
+ [-15.4,25.2],[-11.4,23.2],[-23.4,39.2],[-27.4,41.2],[-15.4,25.2],
+ [-7.4,11.2]];
+ ctx.beginPath();
+ ctx.moveTo(pts[0][0], pts[0][1]);
+ for (var i = 0; i < pts.length; ++i)
+ ctx.lineTo(pts[i][0], pts[i][1]);
+ ctx.fill();
+ /*
+ //FIXME:
+ comparePixel(ctx, 21,11, 0,255,0,255);
+ comparePixel(ctx, 79,11, 0,255,0,255);
+ comparePixel(ctx, 21,39, 0,255,0,255);
+ comparePixel(ctx, 79,39, 0,255,0,255);
+ comparePixel(ctx, 39,19, 0,255,0,255);
+ comparePixel(ctx, 61,19, 0,255,0,255);
+ comparePixel(ctx, 39,31, 0,255,0,255);
+ comparePixel(ctx, 61,31, 0,255,0,255);
+ */
+ canvas.destroy()
+ }
+ function test_translate(row) {
+ var canvas = createCanvasObject(row);
+ var ctx = canvas.getContext('2d');
+ ctx.reset();
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.translate(100, 50);
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -50, 100, 50);
+ comparePixel(ctx, 90,40, 0,255,0,255);
+ ctx.reset();
+
+ ctx.fillStyle = '#f00';
+ ctx.fillRect(0, 0, 100, 50);
+
+ ctx.translate(100, 10);
+ ctx.translate(Infinity, 0.1);
+ ctx.translate(-Infinity, 0.1);
+ ctx.translate(NaN, 0.1);
+ ctx.translate(0.1, Infinity);
+ ctx.translate(0.1, -Infinity);
+ ctx.translate(0.1, NaN);
+ ctx.translate(Infinity, Infinity);
+
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(-100, -10, 100, 50);
+
+ comparePixel(ctx, 50,25, 0,255,0,255);
+ canvas.destroy()
+ }
+}
diff --git a/tests/auto/quick/qquickcanvasitem/data/yellow.png b/tests/auto/quick/qquickcanvasitem/data/yellow.png
new file mode 100644
index 0000000000..51e8aaf38c
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/yellow.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/data/yellow75.png b/tests/auto/quick/qquickcanvasitem/data/yellow75.png
new file mode 100644
index 0000000000..2bb82c9834
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/data/yellow75.png
Binary files differ
diff --git a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro
new file mode 100644
index 0000000000..a164de735a
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro
@@ -0,0 +1,32 @@
+QT += core-private gui-private qml-private
+TEMPLATE=app
+TARGET=tst_qquickcanvasitem
+
+CONFIG += qmltestcase
+SOURCES += tst_qquickcanvasitem.cpp
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/testhelper.js \
+ data/tst_transform.qml \
+ data/tst_text.qml \
+ data/tst_strokeStyle.qml \
+ data/tst_state.qml \
+ data/tst_shadow.qml \
+ data/tst_pattern.qml \
+ data/tst_path.qml \
+ data/tst_line.qml \
+ data/tst_fillStyle.qml \
+ data/tst_fillrect.qml \
+ data/tst_drawimage.qml \
+ data/tst_composite.qml \
+ data/tst_canvas.qml \
+ data/tst_pixel.qml \
+ data/tst_gradient.qml \
+ data/tst_arcto.qml \
+ data/tst_arc.qml \
+ data/tst_context.qml
+
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickcanvasitem/tst_qquickcanvasitem.cpp b/tests/auto/quick/qquickcanvasitem/tst_qquickcanvasitem.cpp
new file mode 100644
index 0000000000..1776e9f855
--- /dev/null
+++ b/tests/auto/quick/qquickcanvasitem/tst_qquickcanvasitem.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(qquickcanvasitem)
diff --git a/tests/auto/quick/qquickdrag/qquickdrag.pro b/tests/auto/quick/qquickdrag/qquickdrag.pro
new file mode 100644
index 0000000000..6e02a4d443
--- /dev/null
+++ b/tests/auto/quick/qquickdrag/qquickdrag.pro
@@ -0,0 +1,10 @@
+TARGET = tst_qquickdrag
+CONFIG += testcase
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickdrag.cpp
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
new file mode 100644
index 0000000000..dbb4736c05
--- /dev/null
+++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
@@ -0,0 +1,1233 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlexpression.h>
+
+template <typename T> static T evaluate(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ QVariant result = expr.evaluate();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+ return result.value<T>();
+}
+
+template <> void evaluate<void>(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ expr.evaluate();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+}
+
+Q_DECLARE_METATYPE(Qt::DropActions)
+
+class TestDropTarget : public QQuickItem
+{
+ Q_OBJECT
+public:
+ TestDropTarget(QQuickItem *parent = 0)
+ : QQuickItem(parent)
+ , enterEvents(0)
+ , moveEvents(0)
+ , leaveEvents(0)
+ , dropEvents(0)
+ , acceptAction(Qt::MoveAction)
+ , defaultAction(Qt::IgnoreAction)
+ , proposedAction(Qt::IgnoreAction)
+ , accept(true)
+ {
+ setFlags(ItemAcceptsDrops);
+ }
+
+ void reset()
+ {
+ enterEvents = 0;
+ moveEvents = 0;
+ leaveEvents = 0;
+ dropEvents = 0;
+ defaultAction = Qt::IgnoreAction;
+ proposedAction = Qt::IgnoreAction;
+ supportedActions = Qt::IgnoreAction;
+ }
+
+ void dragEnterEvent(QDragEnterEvent *event)
+ {
+ ++enterEvents;
+ position = event->pos();
+ defaultAction = event->dropAction();
+ proposedAction = event->proposedAction();
+ supportedActions = event->possibleActions();
+ event->setAccepted(accept);
+ }
+
+ void dragMoveEvent(QDragMoveEvent *event)
+ {
+ ++moveEvents;
+ position = event->pos();
+ defaultAction = event->dropAction();
+ proposedAction = event->proposedAction();
+ supportedActions = event->possibleActions();
+ event->setAccepted(accept);
+ }
+
+ void dragLeaveEvent(QDragLeaveEvent *event)
+ {
+ ++leaveEvents;
+ event->setAccepted(accept);
+ }
+
+ void dropEvent(QDropEvent *event)
+ {
+ ++dropEvents;
+ position = event->pos();
+ defaultAction = event->dropAction();
+ proposedAction = event->proposedAction();
+ supportedActions = event->possibleActions();
+ event->setDropAction(acceptAction);
+ event->setAccepted(accept);
+ }
+
+ int enterEvents;
+ int moveEvents;
+ int leaveEvents;
+ int dropEvents;
+ Qt::DropAction acceptAction;
+ Qt::DropAction defaultAction;
+ Qt::DropAction proposedAction;
+ Qt::DropActions supportedActions;
+ QPointF position;
+ bool accept;
+};
+
+class tst_QQuickDrag: public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void active();
+ void drop();
+ void move();
+ void parentChange();
+ void hotSpot();
+ void supportedActions();
+ void proposedAction();
+ void keys();
+ void source();
+ void recursion_data();
+ void recursion();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_QQuickDrag::initTestCase()
+{
+
+}
+
+void tst_QQuickDrag::cleanupTestCase()
+{
+
+}
+
+void tst_QQuickDrag::active()
+{
+ QQuickWindow window;
+ TestDropTarget dropTarget(window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property bool dragActive: Drag.active\n"
+ "property Item dragTarget: Drag.target\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(&dropTarget);
+
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.cancel()");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ // Start while a drag is active, cancels the previous drag and starts a new one.
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 1);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.cancel()");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1);
+
+ // Enter events aren't sent to items without the QQuickItem::ItemAcceptsDrops flag.
+ dropTarget.setFlags(QQuickItem::Flags());
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.setFlags(QQuickItem::ItemAcceptsDrops);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.setFlags(QQuickItem::Flags());
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1);
+
+ // Follow up events aren't sent to items if the enter event isn't accepted.
+ dropTarget.setFlags(QQuickItem::ItemAcceptsDrops);
+ dropTarget.accept = false;
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.accept = true;
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ dropTarget.accept = false;
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1);
+
+ // Events are sent to hidden or disabled items.
+ dropTarget.accept = true;
+ dropTarget.setVisible(false);
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ evaluate<void>(item, "Drag.active = false");
+ dropTarget.setVisible(true);
+
+ dropTarget.setOpacity(0.0);
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&dropTarget));
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ evaluate<void>(item, "Drag.active = false");
+ dropTarget.setOpacity(1.0);
+
+ dropTarget.setEnabled(false);
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0);
+
+ evaluate<void>(item, "Drag.active = false");
+ dropTarget.setEnabled(true);
+ dropTarget.reset();
+
+ // Queued move events are discarded if the drag is cancelled.
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.moveEvents, 0);
+
+ dropTarget.reset();
+ item->setPosition(QPointF(80, 80));
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.moveEvents, 0);
+
+ evaluate<void>(item, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); QCOMPARE(dropTarget.moveEvents, 0);
+
+ dropTarget.reset();
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.moveEvents, 0);
+}
+
+void tst_QQuickDrag::drop()
+{
+ QQuickWindow window;
+ TestDropTarget outerTarget(window.contentItem());
+ outerTarget.setSize(QSizeF(100, 100));
+ outerTarget.acceptAction = Qt::CopyAction;
+ TestDropTarget innerTarget(&outerTarget);
+ innerTarget.setSize(QSizeF(100, 100));
+ innerTarget.acceptAction = Qt::MoveAction;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property bool dragActive: Drag.active\n"
+ "property Item dragTarget: Drag.target\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(&outerTarget);
+
+ innerTarget.reset(); outerTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&innerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&innerTarget));
+ QCOMPARE(outerTarget.enterEvents, 1); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0);
+ QCOMPARE(innerTarget.enterEvents, 1); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0);
+
+ innerTarget.reset(); outerTarget.reset();
+ QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.MoveAction"), true);
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&innerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&innerTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 1); QCOMPARE(outerTarget.dropEvents, 0);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 1);
+
+ innerTarget.reset(); outerTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&innerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&innerTarget));
+ QCOMPARE(outerTarget.enterEvents, 1); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0);
+ QCOMPARE(innerTarget.enterEvents, 1); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0);
+
+ // Inner target declines the drop so it is propagated to the outer target.
+ innerTarget.accept = false;
+
+ innerTarget.reset(); outerTarget.reset();
+ QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.CopyAction"), true);
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 1);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 1);
+
+
+ // Inner target doesn't accept enter so drop goes directly to outer.
+ innerTarget.accept = true;
+ innerTarget.setFlags(QQuickItem::Flags());
+
+ innerTarget.reset(); outerTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 1); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0);
+
+ innerTarget.reset(); outerTarget.reset();
+ QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.CopyAction"), true);
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 1);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0);
+
+ // Neither target accepts drop so Qt::IgnoreAction is returned.
+ innerTarget.reset(); outerTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 1); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0);
+
+ outerTarget.accept = false;
+
+ innerTarget.reset(); outerTarget.reset();
+ QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.IgnoreAction"), true);
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 1);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0);
+
+ // drop doesn't send an event and returns Qt.IgnoreAction if not active.
+ innerTarget.accept = true;
+ outerTarget.accept = true;
+ innerTarget.reset(); outerTarget.reset();
+ QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.IgnoreAction"), true);
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0);
+
+ // Queued move event is delivered before a drop event.
+ innerTarget.reset(); outerTarget.reset();
+ evaluate<void>(item, "Drag.active = true");
+ item->setPosition(QPointF(80, 80));
+ evaluate<void>(item, "Drag.drop()");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 1); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 1); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0); QCOMPARE(innerTarget.moveEvents, 0);
+
+ innerTarget.reset(); outerTarget.reset();
+ QCoreApplication::processEvents();
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0); QCOMPARE(outerTarget.moveEvents, 0);
+ QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0); QCOMPARE(innerTarget.moveEvents, 0);
+}
+
+void tst_QQuickDrag::move()
+{
+ QQuickWindow window;
+ TestDropTarget outerTarget(window.contentItem());
+ outerTarget.setSize(QSizeF(100, 100));
+ TestDropTarget leftTarget(&outerTarget);
+ leftTarget.setPosition(QPointF(0, 35));
+ leftTarget.setSize(QSizeF(30, 30));
+ TestDropTarget rightTarget(&outerTarget);
+ rightTarget.setPosition(QPointF(70, 35));
+ rightTarget.setSize(QSizeF(30, 30));
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property bool dragActive: Drag.active\n"
+ "property Item dragTarget: Drag.target\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(&outerTarget);
+
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 1); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 0);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(50)); QCOMPARE(outerTarget.position.y(), qreal(50));
+
+ // Move within the outer target.
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(60, 50));
+ // Move event is delivered in the event loop.
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 0);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(60)); QCOMPARE(outerTarget.position.y(), qreal(50));
+
+ // Move into the right target.
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ // Setting X and Y individually should still only generate on move.
+ item->setX(75);
+ item->setY(50);
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 0);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&rightTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&rightTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 1); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(75)); QCOMPARE(outerTarget.position.y(), qreal(50));
+ QCOMPARE(rightTarget.position.x(), qreal(5)); QCOMPARE(rightTarget.position.y(), qreal(15));
+
+ // Move into the left target.
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(25, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&leftTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&leftTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(leftTarget .enterEvents, 1); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 1); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(25)); QCOMPARE(outerTarget.position.y(), qreal(50));
+ QCOMPARE(leftTarget.position.x(), qreal(25)); QCOMPARE(leftTarget.position.y(), qreal(15));
+
+ // Move within the left target.
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(25, 40));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&leftTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&leftTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 1);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(25)); QCOMPARE(outerTarget.position.y(), qreal(40));
+ QCOMPARE(leftTarget.position.x(), qreal(25)); QCOMPARE(leftTarget.position.y(), qreal(5));
+
+ // Move out of all targets.
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(110, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 1); QCOMPARE(outerTarget.moveEvents, 0);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 1); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+
+ // Stop the right target accepting drag events and move into it.
+ rightTarget.accept = false;
+
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(80, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 1); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 0);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 1); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(80)); QCOMPARE(outerTarget.position.y(), qreal(50));
+
+ // Stop the outer target accepting drag events after it has accepted an enter event.
+ outerTarget.accept = false;
+
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(60, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(60)); QCOMPARE(outerTarget.position.y(), qreal(50));
+
+ // Clear the QQuickItem::ItemAcceptsDrops flag from the outer target after it accepted an enter event.
+ outerTarget.setFlags(QQuickItem::Flags());
+
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(40, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(40)); QCOMPARE(outerTarget.position.y(), qreal(50));
+
+ // Clear the QQuickItem::ItemAcceptsDrops flag from the left target before it accepts an enter event.
+ leftTarget.setFlags(QQuickItem::Flags());
+
+ outerTarget.reset(); leftTarget.reset(); rightTarget.reset();
+ item->setPosition(QPointF(25, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(&outerTarget));
+ QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 1);
+ QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0);
+ QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0);
+ QCOMPARE(outerTarget.position.x(), qreal(25)); QCOMPARE(outerTarget.position.y(), qreal(50));
+}
+
+void tst_QQuickDrag::parentChange()
+{
+ QQuickWindow window1;
+ TestDropTarget dropTarget1(window1.contentItem());
+ dropTarget1.setSize(QSizeF(100, 100));
+
+ QQuickWindow window2;
+ TestDropTarget dropTarget2(window2.contentItem());
+ dropTarget2.setSize(QSizeF(100, 100));
+
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property real hotSpotX: Drag.hotSpot.x\n"
+ "property real hotSpotY: Drag.hotSpot.y\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "Drag.active: true\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+
+ // Verify setting a parent item for an item with an active drag sends an enter event.
+ item->setParentItem(window1.contentItem());
+ QCOMPARE(dropTarget1.enterEvents, 0);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget1.enterEvents, 1);
+
+ // Changing the parent within the same window should send a move event.
+ item->setParentItem(&dropTarget1);
+ QCOMPARE(dropTarget1.enterEvents, 1);
+ QCOMPARE(dropTarget1.moveEvents, 0);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget1.enterEvents, 1);
+ QCOMPARE(dropTarget1.moveEvents, 1);
+
+ // Changing the parent to an item in another window sends a leave event in the old window
+ // and an enter on the new window.
+ item->setParentItem(window2.contentItem());
+ QCOMPARE(dropTarget1.enterEvents, 1);
+ QCOMPARE(dropTarget1.moveEvents, 1);
+ QCOMPARE(dropTarget1.leaveEvents, 0);
+ QCOMPARE(dropTarget2.enterEvents, 0);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget1.enterEvents, 1);
+ QCOMPARE(dropTarget1.moveEvents, 1);
+ QCOMPARE(dropTarget1.leaveEvents, 1);
+ QCOMPARE(dropTarget2.enterEvents, 1);
+
+ // Removing then parent item sends a leave event.
+ item->setParentItem(0);
+ QCOMPARE(dropTarget1.enterEvents, 1);
+ QCOMPARE(dropTarget1.moveEvents, 1);
+ QCOMPARE(dropTarget1.leaveEvents, 1);
+ QCOMPARE(dropTarget2.enterEvents, 1);
+ QCOMPARE(dropTarget2.leaveEvents, 0);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget1.enterEvents, 1);
+ QCOMPARE(dropTarget1.moveEvents, 1);
+ QCOMPARE(dropTarget1.leaveEvents, 1);
+ QCOMPARE(dropTarget2.enterEvents, 1);
+ QCOMPARE(dropTarget2.leaveEvents, 1);
+
+ // Go around again and verify no events if active is false.
+ evaluate<void>(item, "Drag.active = false");
+ item->setParentItem(window1.contentItem());
+ QCoreApplication::processEvents();
+
+ item->setParentItem(&dropTarget1);
+ QCoreApplication::processEvents();
+
+ item->setParentItem(window2.contentItem());
+ QCoreApplication::processEvents();
+
+ item->setParentItem(0);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget1.enterEvents, 1);
+ QCOMPARE(dropTarget1.moveEvents, 1);
+ QCOMPARE(dropTarget1.leaveEvents, 1);
+ QCOMPARE(dropTarget2.enterEvents, 1);
+ QCOMPARE(dropTarget2.leaveEvents, 1);
+}
+
+void tst_QQuickDrag::hotSpot()
+{
+ QQuickWindow window;
+ TestDropTarget dropTarget(window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property real hotSpotX: Drag.hotSpot.x\n"
+ "property real hotSpotY: Drag.hotSpot.y\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(&dropTarget);
+
+ QCOMPARE(evaluate<qreal>(item, "Drag.hotSpot.x"), qreal(0));
+ QCOMPARE(evaluate<qreal>(item, "Drag.hotSpot.y"), qreal(0));
+ QCOMPARE(evaluate<qreal>(item, "hotSpotX"), qreal(0));
+ QCOMPARE(evaluate<qreal>(item, "hotSpotY"), qreal(0));
+
+ evaluate<void>(item, "{ Drag.start(); Drag.cancel() }");
+ QCOMPARE(dropTarget.position.x(), qreal(50));
+ QCOMPARE(dropTarget.position.y(), qreal(50));
+
+ evaluate<void>(item, "{ Drag.hotSpot.x = 5, Drag.hotSpot.y = 5 }");
+ QCOMPARE(evaluate<qreal>(item, "Drag.hotSpot.x"), qreal(5));
+ QCOMPARE(evaluate<qreal>(item, "Drag.hotSpot.y"), qreal(5));
+ QCOMPARE(evaluate<qreal>(item, "hotSpotX"), qreal(5));
+ QCOMPARE(evaluate<qreal>(item, "hotSpotY"), qreal(5));
+
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(dropTarget.position.x(), qreal(55));
+ QCOMPARE(dropTarget.position.y(), qreal(55));
+
+ item->setPosition(QPointF(30, 20));
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.position.x(), qreal(35));
+ QCOMPARE(dropTarget.position.y(), qreal(25));
+
+ evaluate<void>(item, "{ Drag.hotSpot.x = 10; Drag.hotSpot.y = 10 }");
+ QCOMPARE(evaluate<qreal>(item, "Drag.hotSpot.x"), qreal(10));
+ QCOMPARE(evaluate<qreal>(item, "Drag.hotSpot.y"), qreal(10));
+ QCOMPARE(evaluate<qreal>(item, "hotSpotX"), qreal(10));
+ QCOMPARE(evaluate<qreal>(item, "hotSpotY"), qreal(10));
+
+ // Setting the hotSpot will deliver a move event in the event loop.
+ QCOMPARE(dropTarget.position.x(), qreal(35));
+ QCOMPARE(dropTarget.position.y(), qreal(25));
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.position.x(), qreal(40));
+ QCOMPARE(dropTarget.position.y(), qreal(30));
+
+ item->setPosition(QPointF(10, 20));
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.position.x(), qreal(20));
+ QCOMPARE(dropTarget.position.y(), qreal(30));
+
+ evaluate<void>(item, "{ Drag.hotSpot.x = 10; Drag.hotSpot.y = 10 }");
+}
+
+void tst_QQuickDrag::supportedActions()
+{
+ QQuickWindow window;
+ TestDropTarget dropTarget(window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property int supportedActions: Drag.supportedActions\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(&dropTarget);
+
+ QCOMPARE(evaluate<bool>(item, "Drag.supportedActions == Qt.CopyAction | Qt.MoveAction | Qt.LinkAction"), true);
+ QCOMPARE(evaluate<bool>(item, "supportedActions == Qt.CopyAction | Qt.MoveAction | Qt.LinkAction"), true);
+ evaluate<void>(item, "{ Drag.start(); Drag.cancel() }");
+ QCOMPARE(dropTarget.supportedActions, Qt::CopyAction | Qt::MoveAction | Qt::LinkAction);
+
+ dropTarget.reset();
+ evaluate<void>(item, "Drag.supportedActions = Qt.CopyAction | Qt.MoveAction");
+ QCOMPARE(evaluate<bool>(item, "Drag.supportedActions == Qt.CopyAction | Qt.MoveAction"), true);
+ QCOMPARE(evaluate<bool>(item, "supportedActions == Qt.CopyAction | Qt.MoveAction"), true);
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(dropTarget.supportedActions, Qt::CopyAction | Qt::MoveAction);
+ QCOMPARE(dropTarget.leaveEvents, 0);
+ QCOMPARE(dropTarget.enterEvents, 1);
+
+ // Changing the supported actions will restart the drag, after a delay to avoid any
+ // recursion.
+ evaluate<void>(item, "Drag.supportedActions = Qt.MoveAction");
+ QCOMPARE(evaluate<bool>(item, "Drag.supportedActions == Qt.MoveAction"), true);
+ QCOMPARE(evaluate<bool>(item, "supportedActions == Qt.MoveAction"), true);
+ item->setPosition(QPointF(60, 60));
+ QCOMPARE(dropTarget.supportedActions, Qt::CopyAction | Qt::MoveAction);
+ QCOMPARE(dropTarget.leaveEvents, 0);
+ QCOMPARE(dropTarget.enterEvents, 1);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.supportedActions, Qt::MoveAction);
+ QCOMPARE(dropTarget.leaveEvents, 1);
+ QCOMPARE(dropTarget.enterEvents, 2);
+
+ // Calling start with proposed actions will override the current actions for the next sequence.
+ evaluate<void>(item, "Drag.start(Qt.CopyAction)");
+ QCOMPARE(evaluate<bool>(item, "Drag.supportedActions == Qt.MoveAction"), true);
+ QCOMPARE(evaluate<bool>(item, "supportedActions == Qt.MoveAction"), true);
+ QCOMPARE(dropTarget.supportedActions, Qt::CopyAction);
+
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(evaluate<bool>(item, "Drag.supportedActions == Qt.MoveAction"), true);
+ QCOMPARE(evaluate<bool>(item, "supportedActions == Qt.MoveAction"), true);
+ QCOMPARE(dropTarget.supportedActions, Qt::MoveAction);
+}
+
+void tst_QQuickDrag::proposedAction()
+{
+ QQuickWindow window;
+ TestDropTarget dropTarget(window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property int proposedAction: Drag.proposedAction\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(&dropTarget);
+
+ QCOMPARE(evaluate<bool>(item, "Drag.proposedAction == Qt.MoveAction"), true);
+ QCOMPARE(evaluate<bool>(item, "proposedAction == Qt.MoveAction"), true);
+ evaluate<void>(item, "{ Drag.start(); Drag.cancel() }");
+ QCOMPARE(dropTarget.defaultAction, Qt::MoveAction);
+ QCOMPARE(dropTarget.proposedAction, Qt::MoveAction);
+
+ evaluate<void>(item, "Drag.proposedAction = Qt.CopyAction");
+ QCOMPARE(evaluate<bool>(item, "Drag.proposedAction == Qt.CopyAction"), true);
+ QCOMPARE(evaluate<bool>(item, "proposedAction == Qt.CopyAction"), true);
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(dropTarget.defaultAction, Qt::CopyAction);
+ QCOMPARE(dropTarget.proposedAction, Qt::CopyAction);
+
+ // The proposed action can change during a drag.
+ evaluate<void>(item, "Drag.proposedAction = Qt.MoveAction");
+ QCOMPARE(evaluate<bool>(item, "Drag.proposedAction == Qt.MoveAction"), true);
+ QCOMPARE(evaluate<bool>(item, "proposedAction == Qt.MoveAction"), true);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.defaultAction, Qt::MoveAction);
+ QCOMPARE(dropTarget.proposedAction, Qt::MoveAction);
+
+ evaluate<void>(item, "Drag.proposedAction = Qt.LinkAction");
+ QCOMPARE(evaluate<bool>(item, "Drag.proposedAction == Qt.LinkAction"), true);
+ QCOMPARE(evaluate<bool>(item, "proposedAction == Qt.LinkAction"), true);
+ evaluate<void>(item, "Drag.drop()");
+ QCOMPARE(dropTarget.defaultAction, Qt::LinkAction);
+ QCOMPARE(dropTarget.proposedAction, Qt::LinkAction);
+}
+
+void tst_QQuickDrag::keys()
+{
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property variant keys: Drag.keys\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+
+ QCOMPARE(evaluate<QStringList>(item, "Drag.keys"), QStringList());
+ QCOMPARE(evaluate<QStringList>(item, "keys"), QStringList());
+ QCOMPARE(item->property("keys").toStringList(), QStringList());
+
+ evaluate<void>(item, "Drag.keys = [\"red\", \"blue\"]");
+ QCOMPARE(evaluate<QStringList>(item, "Drag.keys"), QStringList() << "red" << "blue");
+ QCOMPARE(evaluate<QStringList>(item, "keys"), QStringList() << "red" << "blue");
+ QCOMPARE(item->property("keys").toStringList(), QStringList() << "red" << "blue");
+
+ // Test changing the keys restarts a drag.
+ QQuickWindow window;
+ item->setParentItem(window.contentItem());
+ TestDropTarget dropTarget(window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(dropTarget.leaveEvents, 0);
+ QCOMPARE(dropTarget.enterEvents, 1);
+
+ evaluate<void>(item, "Drag.keys = [\"green\"]");
+ QCOMPARE(dropTarget.leaveEvents, 0);
+ QCOMPARE(dropTarget.enterEvents, 1);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.leaveEvents, 1);
+ QCOMPARE(dropTarget.enterEvents, 2);
+}
+
+void tst_QQuickDrag::source()
+{
+
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property Item source: Drag.source\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "Item { id: proxySource; objectName: \"proxySource\" }\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+
+ QCOMPARE(evaluate<QObject *>(item, "Drag.source"), static_cast<QObject *>(item));
+ QCOMPARE(evaluate<QObject *>(item, "source"), static_cast<QObject *>(item));
+
+ QQuickItem *proxySource = item->findChild<QQuickItem *>("proxySource");
+ QVERIFY(proxySource);
+
+ evaluate<void>(item, "Drag.source = proxySource");
+ QCOMPARE(evaluate<QObject *>(item, "Drag.source"), static_cast<QObject *>(proxySource));
+ QCOMPARE(evaluate<QObject *>(item, "source"), static_cast<QObject *>(proxySource));
+
+ evaluate<void>(item, "Drag.source = undefined");
+ QCOMPARE(evaluate<QObject *>(item, "Drag.source"), static_cast<QObject *>(item));
+ QCOMPARE(evaluate<QObject *>(item, "source"), static_cast<QObject *>(item));
+
+ // Test changing the source restarts a drag.
+ QQuickWindow window;
+ item->setParentItem(window.contentItem());
+ TestDropTarget dropTarget(window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(dropTarget.leaveEvents, 0);
+ QCOMPARE(dropTarget.enterEvents, 1);
+
+ evaluate<void>(item, "Drag.source = proxySource");
+ QCOMPARE(dropTarget.leaveEvents, 0);
+ QCOMPARE(dropTarget.enterEvents, 1);
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.leaveEvents, 1);
+ QCOMPARE(dropTarget.enterEvents, 2);
+}
+
+class RecursingDropTarget : public TestDropTarget
+{
+public:
+ RecursingDropTarget(const QString &script, int type, QQuickItem *parent)
+ : TestDropTarget(parent), script(script), type(type), item(0) {}
+
+ void setItem(QQuickItem *i) { item = i; }
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event)
+ {
+ TestDropTarget::dragEnterEvent(event);
+ if (type == QEvent::DragEnter && enterEvents < 2)
+ evaluate<void>(item, script);
+ }
+
+ void dragMoveEvent(QDragMoveEvent *event)
+ {
+ TestDropTarget::dragMoveEvent(event);
+ if (type == QEvent::DragMove && moveEvents < 2)
+ evaluate<void>(item, script);
+ }
+
+ void dragLeaveEvent(QDragLeaveEvent *event)
+ {
+ TestDropTarget::dragLeaveEvent(event);
+ if (type == QEvent::DragLeave && leaveEvents < 2)
+ evaluate<void>(item, script);
+ }
+
+ void dropEvent(QDropEvent *event)
+ {
+ TestDropTarget::dropEvent(event);
+ if (type == QEvent::Drop && dropEvents < 2)
+ evaluate<void>(item, script);
+ }
+
+private:
+ QString script;
+ int type;
+ QQuickItem *item;
+
+};
+
+void tst_QQuickDrag::recursion_data()
+{
+ QTest::addColumn<QString>("script");
+ QTest::addColumn<int>("type");
+ QTest::addColumn<QByteArray>("warning");
+
+ QTest::newRow("Drag.start() in Enter")
+ << QString("Drag.start()")
+ << int(QEvent::DragEnter)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: start() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.cancel() in Enter")
+ << QString("Drag.cancel()")
+ << int(QEvent::DragEnter)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: cancel() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.drop() in Enter")
+ << QString("Drag.drop()")
+ << int(QEvent::DragEnter)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: drop() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.active = true in Enter")
+ << QString("Drag.active = true")
+ << int(QEvent::DragEnter)
+ << QByteArray();
+ QTest::newRow("Drag.active = false in Enter")
+ << QString("Drag.active = false")
+ << int(QEvent::DragEnter)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: active cannot be changed from within a drag event handler");
+ QTest::newRow("move in Enter")
+ << QString("x = 23")
+ << int(QEvent::DragEnter)
+ << QByteArray();
+
+ QTest::newRow("Drag.start() in Move")
+ << QString("Drag.start()")
+ << int(QEvent::DragMove)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: start() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.cancel() in Move")
+ << QString("Drag.cancel()")
+ << int(QEvent::DragMove)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: cancel() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.drop() in Move")
+ << QString("Drag.drop()")
+ << int(QEvent::DragMove)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: drop() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.active = true in Move")
+ << QString("Drag.active = true")
+ << int(QEvent::DragMove)
+ << QByteArray();
+ QTest::newRow("Drag.active = false in Move")
+ << QString("Drag.active = false")
+ << int(QEvent::DragMove)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: active cannot be changed from within a drag event handler");
+ QTest::newRow("move in Move")
+ << QString("x = 23")
+ << int(QEvent::DragMove)
+ << QByteArray();
+
+ QTest::newRow("Drag.start() in Leave")
+ << QString("Drag.start()")
+ << int(QEvent::DragLeave)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: start() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.cancel() in Leave")
+ << QString("Drag.cancel()")
+ << int(QEvent::DragLeave)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: cancel() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.drop() in Leave")
+ << QString("Drag.drop()")
+ << int(QEvent::DragLeave)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: drop() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.active = true in Leave")
+ << QString("Drag.active = true")
+ << int(QEvent::DragLeave)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: active cannot be changed from within a drag event handler");
+ QTest::newRow("Drag.active = false in Leave")
+ << QString("Drag.active = false")
+ << int(QEvent::DragLeave)
+ << QByteArray();
+ QTest::newRow("move in Leave")
+ << QString("x = 23")
+ << int(QEvent::DragLeave)
+ << QByteArray();
+
+ QTest::newRow("Drag.start() in Drop")
+ << QString("Drag.start()")
+ << int(QEvent::Drop)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: start() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.cancel() in Drop")
+ << QString("Drag.cancel()")
+ << int(QEvent::Drop)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: cancel() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.drop() in Drop")
+ << QString("Drag.drop()")
+ << int(QEvent::Drop)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: drop() cannot be called from within a drag event handler");
+ QTest::newRow("Drag.active = true in Drop")
+ << QString("Drag.active = true")
+ << int(QEvent::Drop)
+ << QByteArray("<Unknown File>: QML QQuickDragAttached: active cannot be changed from within a drag event handler");
+ QTest::newRow("Drag.active = false in Drop")
+ << QString("Drag.active = false")
+ << int(QEvent::Drop)
+ << QByteArray();
+ QTest::newRow("move in Drop")
+ << QString("x = 23")
+ << int(QEvent::Drop)
+ << QByteArray();
+}
+
+void tst_QQuickDrag::recursion()
+{
+ QFETCH(QString, script);
+ QFETCH(int, type);
+ QFETCH(QByteArray, warning);
+
+ if (!warning.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, warning.constData());
+
+ QQuickWindow window;
+ RecursingDropTarget dropTarget(script, type, window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(window.contentItem());
+
+ dropTarget.setItem(item);
+
+ evaluate<void>(item, "Drag.start()");
+ QCOMPARE(dropTarget.enterEvents, 1);
+ QCOMPARE(dropTarget.moveEvents, 0);
+ QCOMPARE(dropTarget.dropEvents, 0);
+ QCOMPARE(dropTarget.leaveEvents, 0);
+
+ evaluate<void>(item, "y = 15");
+ QCoreApplication::processEvents();
+ QCOMPARE(dropTarget.enterEvents, 1);
+ QCOMPARE(dropTarget.moveEvents, 1);
+ QCOMPARE(dropTarget.dropEvents, 0);
+ QCOMPARE(dropTarget.leaveEvents, 0);
+
+ if (type == QEvent::Drop) {
+ QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.MoveAction"), true);
+ QCOMPARE(dropTarget.enterEvents, 1);
+ QCOMPARE(dropTarget.moveEvents, 1);
+ QCOMPARE(dropTarget.dropEvents, 1);
+ QCOMPARE(dropTarget.leaveEvents, 0);
+ } else {
+ evaluate<void>(item, "Drag.cancel()");
+ QCOMPARE(dropTarget.enterEvents, 1);
+ QCOMPARE(dropTarget.moveEvents, 1);
+ QCOMPARE(dropTarget.dropEvents, 0);
+ QCOMPARE(dropTarget.leaveEvents, 1);
+ }
+}
+
+
+QTEST_MAIN(tst_QQuickDrag)
+
+#include "tst_qquickdrag.moc"
diff --git a/tests/auto/quick/qquickdroparea/qquickdroparea.pro b/tests/auto/quick/qquickdroparea/qquickdroparea.pro
new file mode 100644
index 0000000000..c7ffbfd427
--- /dev/null
+++ b/tests/auto/quick/qquickdroparea/qquickdroparea.pro
@@ -0,0 +1,10 @@
+TARGET = tst_qquickdroparea
+CONFIG += testcase
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickdroparea.cpp
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
new file mode 100644
index 0000000000..b65e766190
--- /dev/null
+++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp
@@ -0,0 +1,1122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlexpression.h>
+
+#include <qpa/qplatformdrag.h>
+#include <qpa/qwindowsysteminterface.h>
+
+template <typename T> static T evaluate(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ QVariant result = expr.evaluate();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+ return result.value<T>();
+}
+
+template <> void evaluate<void>(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ expr.evaluate();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+}
+
+class tst_QQuickDropArea: public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void containsDrag_internal();
+ void containsDrag_external();
+ void keys_internal();
+ void keys_external();
+ void source_internal();
+// void source_external();
+ void position_internal();
+ void position_external();
+ void drop_internal();
+// void drop_external();
+ void simultaneousDrags();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_QQuickDropArea::initTestCase()
+{
+
+}
+
+void tst_QQuickDropArea::cleanupTestCase()
+{
+
+}
+
+void tst_QQuickDropArea::containsDrag_internal()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property bool hasDrag: containsDrag\n"
+ "property int enterEvents: 0\n"
+ "property int exitEvents: 0\n"
+ "width: 100; height: 100\n"
+ "onEntered: {++enterEvents}\n"
+ "onExited: {++exitEvents}\n"
+ "Item {\n"
+ "objectName: \"dragItem\"\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QQuickItem *dragItem = dropArea->findChild<QQuickItem *>("dragItem");
+ QVERIFY(dragItem);
+
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 1);
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
+
+ dragItem->setPosition(QPointF(150, 50));
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
+
+ dragItem->setPosition(QPointF(50, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
+ dragItem->setPosition(QPointF(150, 50));
+ QCoreApplication::processEvents();
+
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 1);
+
+ evaluate<void>(dragItem, "Drag.active = false");
+}
+
+void tst_QQuickDropArea::containsDrag_external()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property bool hasDrag: containsDrag\n"
+ "property int enterEvents: 0\n"
+ "property int exitEvents: 0\n"
+ "width: 100; height: 100\n"
+ "onEntered: {++enterEvents}\n"
+ "onExited: {++exitEvents}\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QMimeData data;
+ QQuickWindow alternateWindow;
+
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 1);
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(150, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 0);
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; exitEvents = 0 }");
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(150, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<bool>(dropArea, "hasDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "exitEvents"), 1);
+
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(150, 50), Qt::CopyAction);
+}
+
+void tst_QQuickDropArea::keys_internal()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property variant dragKeys\n"
+ "property variant dropKeys: keys\n"
+ "property int enterEvents: 0\n"
+ "width: 100; height: 100\n"
+ "onEntered: {++enterEvents; dragKeys = drag.keys }\n"
+ "Item {\n"
+ "objectName: \"dragItem\"\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "Drag.keys: [\"red\", \"blue\"]\n"
+ "}\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QQuickItem *dragItem = dropArea->findChild<QQuickItem *>("dragItem");
+ QVERIFY(dragItem);
+
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "red" << "blue");
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dropArea, "keys = \"blue\"");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "blue");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "blue");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "red" << "blue");
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dropArea, "keys = \"red\"");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "red");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "red");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "red" << "blue");
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dropArea, "keys = \"green\"");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "green");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "green");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dropArea, "keys = [\"red\", \"green\"]");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "red" << "green");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "red" << "green");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "red" << "blue");
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dragItem, "Drag.keys = []");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dropArea, "keys = []");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList());
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList());
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList());
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dropArea, "keys = []");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList());
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ evaluate<void>(dragItem, "Drag.keys = [\"red\", \"blue\"]");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "red" << "blue");
+}
+
+void tst_QQuickDropArea::keys_external()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property variant dragKeys\n"
+ "property variant dropKeys: keys\n"
+ "property int enterEvents: 0\n"
+ "width: 100; height: 100\n"
+ "onEntered: {++enterEvents; dragKeys = drag.keys }\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ dropArea->setParentItem(window.contentItem());
+
+ QMimeData data;
+ QQuickWindow alternateWindow;
+
+ data.setData("text/x-red", "red");
+ data.setData("text/x-blue", "blue");
+
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ evaluate<void>(dropArea, "keys = \"text/x-blue\"");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-blue");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-blue");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ evaluate<void>(dropArea, "keys = \"text/x-red\"");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-red");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-red");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ evaluate<void>(dropArea, "keys = \"text/x-green\"");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-green");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-green");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ evaluate<void>(dropArea, "keys = [\"text/x-red\", \"text/x-green\"]");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList() << "text/x-red" << "text/x-green");
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList() << "text/x-red" << "text/x-green");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ data.removeFormat("text/x-red");
+ data.removeFormat("text/x-blue");
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ evaluate<void>(dropArea, "keys = []");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList());
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList());
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList());
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ data.setData("text/x-red", "red");
+ data.setData("text/x-blue", "blue");
+ QCOMPARE(dropArea->property("keys").toStringList(), QStringList());
+ QCOMPARE(dropArea->property("dropKeys").toStringList(), QStringList());
+ evaluate<void>(dropArea, "{ enterEvents = 0; dragKeys = undefined }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(dropArea->property("dragKeys").toStringList(), QStringList() << "text/x-red" << "text/x-blue");
+
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(50, 50), Qt::CopyAction);
+}
+
+void tst_QQuickDropArea::source_internal()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property Item source: drag.source\n"
+ "property Item eventSource\n"
+ "width: 100; height: 100\n"
+ "onEntered: {eventSource = drag.source}\n"
+ "Item {\n"
+ "objectName: \"dragItem\"\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}\n"
+ "Item { id: dragSource; objectName: \"dragSource\" }\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QQuickItem *dragItem = dropArea->findChild<QQuickItem *>("dragItem");
+ QVERIFY(dragItem);
+
+ QQuickItem *dragSource = dropArea->findChild<QQuickItem *>("dragSource");
+ QVERIFY(dragSource);
+
+ QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0));
+
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(dragItem));
+ QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(dragItem));
+ QCOMPARE(evaluate<QObject *>(dropArea, "eventSource"), static_cast<QObject *>(dragItem));
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0));
+
+
+ evaluate<void>(dropArea, "{ eventSource = null }");
+ evaluate<void>(dragItem, "Drag.source = dragSource");
+
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(dragSource));
+ QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(dragSource));
+ QCOMPARE(evaluate<QObject *>(dropArea, "eventSource"), static_cast<QObject *>(dragSource));
+
+ evaluate<void>(dragItem, "Drag.active = false");
+ QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0));
+ QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0));
+}
+
+// Setting a source can't be emulated using the QWindowSystemInterface API.
+
+//void tst_QQuickDropArea::source_external()
+//{
+//}
+
+void tst_QQuickDropArea::position_internal()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property real dragX: drag.x\n"
+ "property real dragY: drag.y\n"
+ "property real eventX\n"
+ "property real eventY\n"
+ "property int enterEvents: 0\n"
+ "property int moveEvents: 0\n"
+ "width: 100; height: 100\n"
+ "onEntered: {++enterEvents; eventX = drag.x; eventY = drag.y}\n"
+ "onPositionChanged: {++moveEvents; eventX = drag.x; eventY = drag.y}\n"
+ "Item {\n"
+ "objectName: \"dragItem\"\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QQuickItem *dragItem = dropArea->findChild<QQuickItem *>("dragItem");
+ QVERIFY(dragItem);
+
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 0);
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.y"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragX"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragY"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
+ dragItem->setPosition(QPointF(40, 50));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(40));
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.y"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragX"), qreal(40));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragY"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(40));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
+ dragItem->setPosition(QPointF(75, 25));
+ QCoreApplication::processEvents();
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(75));
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.y"), qreal(25));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragX"), qreal(75));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragY"), qreal(25));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(75));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(25));
+
+ evaluate<void>(dragItem, "Drag.active = false");
+}
+
+void tst_QQuickDropArea::position_external()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property real dragX: drag.x\n"
+ "property real dragY: drag.y\n"
+ "property real eventX\n"
+ "property real eventY\n"
+ "property int enterEvents: 0\n"
+ "property int moveEvents: 0\n"
+ "width: 100; height: 100\n"
+ "onEntered: {++enterEvents; eventX = drag.x; eventY = drag.y}\n"
+ "onPositionChanged: {++moveEvents; eventX = drag.x; eventY = drag.y}\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QMimeData data;
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.y"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragX"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragY"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(40, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(40));
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.y"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragX"), qreal(40));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragY"), qreal(50));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(40));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(50));
+
+ evaluate<void>(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(75, 25), Qt::CopyAction);
+ QCOMPARE(evaluate<int>(dropArea, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea, "moveEvents"), 1);
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.x"), qreal(75));
+ QCOMPARE(evaluate<qreal>(dropArea, "drag.y"), qreal(25));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragX"), qreal(75));
+ QCOMPARE(evaluate<qreal>(dropArea, "dragY"), qreal(25));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventX"), qreal(75));
+ QCOMPARE(evaluate<qreal>(dropArea, "eventY"), qreal(25));
+
+ QWindowSystemInterface::handleDrop(&window, &data, QPoint(75, 25), Qt::CopyAction);
+}
+
+void tst_QQuickDropArea::drop_internal()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property bool accept: false\n"
+ "property bool setAccepted: false\n"
+ "property bool acceptDropAction: false\n"
+ "property bool setDropAction: false\n"
+ "property int dropAction: Qt.IgnoreAction\n"
+ "property int proposedAction: Qt.IgnoreAction\n"
+ "property int supportedActions: Qt.IgnoreAction\n"
+ "property int dropEvents: 0\n"
+ "width: 100; height: 100\n"
+ "onDropped: {\n"
+ "++dropEvents\n"
+ "supportedActions = drop.supportedActions\n"
+ "proposedAction = drop.action\n"
+ "if (setDropAction)\n"
+ "drop.action = dropAction\n"
+ "if (acceptDropAction)\n"
+ "drop.accept(dropAction)\n"
+ "else if (setAccepted)\n"
+ "drop.accepted = accept\n"
+ "else if (accept)\n"
+ "drop.accept()\n"
+ "}\n"
+ "Item {\n"
+ "objectName: \"dragItem\"\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea);
+ dropArea->setParentItem(window.contentItem());
+
+ QQuickItem *dragItem = dropArea->findChild<QQuickItem *>("dragItem");
+ QVERIFY(dragItem);
+
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::IgnoreAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ accept = true; setDropAction = true; dropAction = Qt.LinkAction }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ setAccepted = true; }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ accept = false; setAccepted = true; }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::IgnoreAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ setAccepted = false; setDropAction = false; acceptDropAction = true; }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ acceptDropAction = false; dropAction = Qt.IgnoreAction; accept = true }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::MoveAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ setAccepted = true }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::MoveAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ setAccepted = false }");
+ evaluate<void>(dragItem, "Drag.supportedActions = Qt.LinkAction");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::MoveAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ setAccepted = true }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::MoveAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::MoveAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ setAccepted = false }");
+ evaluate<void>(dragItem, "Drag.proposedAction = Qt.LinkAction");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::LinkAction));
+
+ evaluate<void>(dropArea, "{ dropEvents = 0; proposedAction = Qt.IgnoreAction; supportedActions = Qt.IgnoreAction }");
+ evaluate<void>(dropArea, "{ setAccepted = true }");
+ evaluate<void>(dragItem, "Drag.active = true");
+ QCOMPARE(evaluate<int>(dragItem, "Drag.drop()"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "dropEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea, "supportedActions"), int(Qt::LinkAction));
+ QCOMPARE(evaluate<int>(dropArea, "proposedAction"), int(Qt::LinkAction));
+}
+
+// Setting the supportedActions can't be emulated using the QWindowSystemInterface API.
+
+//void tst_QQuickDropArea::drop_external()
+//{
+//}
+
+void tst_QQuickDropArea::simultaneousDrags()
+{
+ QQuickWindow window;
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "DropArea {\n"
+ "property int enterEvents: 0\n"
+ "property int exitEvents: 0\n"
+ "width: 100; height: 100\n"
+ "keys: [\"red\", \"text/x-red\"]\n"
+ "onEntered: {++enterEvents}\n"
+ "onExited: {++exitEvents}\n"
+ "DropArea {\n"
+ "objectName: \"dropArea2\"\n"
+ "property int enterEvents: 0\n"
+ "property int exitEvents: 0\n"
+ "width: 100; height: 100\n"
+ "keys: [\"blue\", \"text/x-blue\"]\n"
+ "onEntered: {++enterEvents}\n"
+ "onExited: {++exitEvents}\n"
+ "}\n"
+ "Item {\n"
+ "objectName: \"dragItem1\"\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "Drag.keys: [\"red\", \"blue\"]"
+ "}\n"
+ "Item {\n"
+ "objectName: \"dragItem2\"\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "Drag.keys: [\"red\", \"blue\"]"
+ "}\n"
+ "}", QUrl());
+
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *dropArea1 = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(dropArea1);
+ dropArea1->setParentItem(window.contentItem());
+
+ QQuickItem *dropArea2 = dropArea1->findChild<QQuickItem *>("dropArea2");
+ QVERIFY(dropArea2);
+
+ QQuickItem *dragItem1 = dropArea1->findChild<QQuickItem *>("dragItem1");
+ QVERIFY(dragItem1);
+
+ QQuickItem *dragItem2 = dropArea1->findChild<QQuickItem *>("dragItem2");
+ QVERIFY(dragItem2);
+
+ QMimeData data;
+ data.setData("text/x-red", "red");
+ data.setData("text/x-blue", "blue");
+
+ QQuickWindow alternateWindow;
+
+ // Mixed internal drags.
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem1, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dragItem2, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dragItem2, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dragItem1, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ // internal then external.
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem1, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dragItem1, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ // external then internal.
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dragItem2, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dragItem2, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ // Different acceptance
+ evaluate<void>(dragItem1, "Drag.keys = \"red\"");
+ evaluate<void>(dragItem2, "Drag.keys = \"blue\"");
+ data.removeFormat("text/x-red");
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem1, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem1, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem2, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
+
+ // internal then external
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem1, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 1);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dragItem1, "Drag.active = false");
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 1);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), true);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 0);
+
+ evaluate<void>(dropArea1, "{ enterEvents = 0; exitEvents = 0 }");
+ evaluate<void>(dropArea2, "{ enterEvents = 0; exitEvents = 0 }");
+ QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+ QCOMPARE(evaluate<bool>(dropArea1, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea1, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea1, "exitEvents"), 0);
+ QCOMPARE(evaluate<bool>(dropArea2, "containsDrag"), false);
+ QCOMPARE(evaluate<int>(dropArea2, "enterEvents"), 0);
+ QCOMPARE(evaluate<int>(dropArea2, "exitEvents"), 1);
+
+ QWindowSystemInterface::handleDrop(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction);
+}
+
+QTEST_MAIN(tst_QQuickDropArea)
+
+#include "tst_qquickdroparea.moc"
diff --git a/tests/auto/quick/qquickdynamicpropertyanimation/data/MyItem.qml b/tests/auto/quick/qquickdynamicpropertyanimation/data/MyItem.qml
new file mode 100644
index 0000000000..2fc8b90ac8
--- /dev/null
+++ b/tests/auto/quick/qquickdynamicpropertyanimation/data/MyItem.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item
+{
+ property int testInt: 0
+ property double testDouble: 0.0
+ property real testReal: 0.0
+ property point testPoint: Qt.point(0, 0)
+ property size testSize: Qt.size(0, 0)
+ property rect testRect: Qt.rect(0, 0, 0, 0)
+ property color testColor: Qt.rgba(0.0, 0.0, 0.0, 0.0)
+ property var testVar: 0
+}
diff --git a/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro b/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro
new file mode 100644
index 0000000000..a67daa91ba
--- /dev/null
+++ b/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickdynamicpropertyanimation
+SOURCES += tst_qquickdynamicpropertyanimation.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core gui qml quick testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickdynamicpropertyanimation/tst_qquickdynamicpropertyanimation.cpp b/tests/auto/quick/qquickdynamicpropertyanimation/tst_qquickdynamicpropertyanimation.cpp
new file mode 100644
index 0000000000..78f2d17e9b
--- /dev/null
+++ b/tests/auto/quick/qquickdynamicpropertyanimation/tst_qquickdynamicpropertyanimation.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlProperty>
+#include <QtQuick/QQuickView>
+#include <QtQuick/QQuickItem>
+#include <QtCore/QPropertyAnimation>
+#include <QtCore/QPoint>
+#include <QtCore/QSize>
+#include <QtCore/QRect>
+#include <QtGui/QColor>
+
+#include "../../shared/util.h"
+
+class tst_qquickdynamicpropertyanimation : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickdynamicpropertyanimation() {}
+
+private:
+ template<class T>
+ void dynamicPropertyAnimation(const QByteArray & propertyName, T toValue)
+ {
+ QQuickView view(testFileUrl("MyItem.qml"));
+ QQuickItem * item = qobject_cast<QQuickItem *>(view.rootObject());
+ QVERIFY(item);
+ QQmlProperty testProp(item, propertyName);
+ QPropertyAnimation animation(item, propertyName, this);
+ animation.setEndValue(toValue);
+ QVERIFY(animation.targetObject() == item);
+ QVERIFY(animation.propertyName() == propertyName);
+ QVERIFY(animation.endValue().value<T>() == toValue);
+ animation.start();
+ QVERIFY(animation.state() == QAbstractAnimation::Running);
+ QTest::qWait(animation.duration());
+ QTRY_COMPARE(testProp.read().value<T>(), toValue);
+ }
+
+private slots:
+ void initTestCase()
+ {
+ QQmlEngine engine; // ensure types are registered
+ QQmlDataTest::initTestCase();
+ }
+
+ void dynamicIntPropertyAnimation();
+ void dynamicDoublePropertyAnimation();
+ void dynamicRealPropertyAnimation();
+ void dynamicPointPropertyAnimation();
+ void dynamicSizePropertyAnimation();
+ void dynamicRectPropertyAnimation();
+ void dynamicColorPropertyAnimation();
+ void dynamicVarPropertyAnimation();
+};
+
+void tst_qquickdynamicpropertyanimation::dynamicIntPropertyAnimation()
+{
+ dynamicPropertyAnimation("testInt", 1);
+}
+
+void tst_qquickdynamicpropertyanimation::dynamicDoublePropertyAnimation()
+{
+ dynamicPropertyAnimation("testDouble", 1.0);
+}
+
+void tst_qquickdynamicpropertyanimation::dynamicRealPropertyAnimation()
+{
+ dynamicPropertyAnimation("testReal", qreal(1.0));
+}
+
+void tst_qquickdynamicpropertyanimation::dynamicPointPropertyAnimation()
+{
+ dynamicPropertyAnimation("testPoint", QPoint(1, 1));
+}
+
+void tst_qquickdynamicpropertyanimation::dynamicSizePropertyAnimation()
+{
+ dynamicPropertyAnimation("testSize", QSize(1,1));
+}
+
+void tst_qquickdynamicpropertyanimation::dynamicRectPropertyAnimation()
+{
+ dynamicPropertyAnimation("testRect", QRect(1, 1, 1, 1));
+}
+
+void tst_qquickdynamicpropertyanimation::dynamicColorPropertyAnimation()
+{
+ dynamicPropertyAnimation("testColor", QColor::fromRgbF(1.0, 1.0, 1.0, 1.0));
+}
+
+void tst_qquickdynamicpropertyanimation::dynamicVarPropertyAnimation()
+{
+ dynamicPropertyAnimation("testVar", QVariant::fromValue(1));
+}
+
+QTEST_MAIN(tst_qquickdynamicpropertyanimation)
+
+#include "tst_qquickdynamicpropertyanimation.moc"
diff --git a/tests/auto/quick/qquickflickable/data/cancel.qml b/tests/auto/quick/qquickflickable/data/cancel.qml
new file mode 100644
index 0000000000..d1c3fddbf2
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/cancel.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Flickable {
+ width: 200; height: 200
+ contentWidth: row.width; contentHeight: row.height
+
+ Row {
+ id: row
+ objectName: "row"
+ Repeater {
+ model: 4
+ Rectangle { width: 400; height: 600; color: "yellow"; border.width: 1 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/disabled.qml b/tests/auto/quick/qquickflickable/data/disabled.qml
new file mode 100644
index 0000000000..9b679827c7
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/disabled.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 100; height: 100
+ property bool clicked: false
+
+ Flickable {
+ objectName: "flickable"
+ width: 100; height: 100
+ contentWidth: column.width; contentHeight: column.height
+ enabled: false
+
+ Column {
+ id: column
+ Repeater {
+ model: 4
+ Rectangle {
+ width: 200; height: 300; color: "blue"
+ MouseArea { anchors.fill: parent; onClicked: { } }
+ }
+ }
+ }
+ }
+
+ MouseArea {
+ width: 100; height: 30
+ onClicked: root.clicked = true
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/flickable01.qml b/tests/auto/quick/qquickflickable/data/flickable01.qml
new file mode 100644
index 0000000000..cbec44bb4f
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/flickable01.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+Flickable {
+}
diff --git a/tests/auto/quick/qquickflickable/data/flickable02.qml b/tests/auto/quick/qquickflickable/data/flickable02.qml
new file mode 100644
index 0000000000..80caa32da5
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/flickable02.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Flickable {
+ width: 100; height: 100
+ contentWidth: row.width; contentHeight: row.height
+
+ Row {
+ id: row
+ Repeater {
+ model: 4
+ Rectangle { width: 200; height: 300; color: "blue" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/flickable03.qml b/tests/auto/quick/qquickflickable/data/flickable03.qml
new file mode 100644
index 0000000000..1549034576
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/flickable03.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Flickable {
+ property bool movingInContentX: true
+ property bool movingInContentY: true
+ property bool draggingInContentX: true
+ property bool draggingInContentY: true
+
+ width: 100; height: 400
+ contentWidth: column.width; contentHeight: column.height
+
+ onContentXChanged: {
+ movingInContentX = movingInContentX && movingHorizontally
+ draggingInContentX = draggingInContentX && draggingHorizontally
+ }
+ onContentYChanged: {
+ movingInContentY = movingInContentY && movingVertically
+ draggingInContentY = draggingInContentY && draggingVertically
+ }
+
+ Column {
+ id: column
+ Repeater {
+ model: 20
+ Rectangle { width: 200; height: 300; border.width: 1; color: "yellow" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/flickable04.qml b/tests/auto/quick/qquickflickable/data/flickable04.qml
new file mode 100644
index 0000000000..b2f30b84ec
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/flickable04.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Flickable {
+ property bool ok: false
+ function check() {
+ if (column.parent == contentItem)
+ ok = true;
+ }
+
+ width: 100; height: 100
+ contentWidth: column.width; contentHeight: column.height
+ pressDelay: 200; boundsBehavior: Flickable.StopAtBounds; interactive: false
+ maximumFlickVelocity: 2000
+
+ Column {
+ id: column
+ Repeater {
+ model: 4
+ Rectangle { width: 200; height: 300; color: "blue" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/flickableqgraphicswidget.qml b/tests/auto/quick/qquickflickable/data/flickableqgraphicswidget.qml
new file mode 100644
index 0000000000..bb8f1eefc6
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/flickableqgraphicswidget.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Flickable {
+ width: 100; height: 100
+
+ QGraphicsWidget { objectName: "widget1"; width: 200; height: 300 }
+}
diff --git a/tests/auto/quick/qquickflickable/data/longList.qml b/tests/auto/quick/qquickflickable/data/longList.qml
new file mode 100644
index 0000000000..424f2890ea
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/longList.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Flickable {
+ id: flick
+
+ width: 200
+ height: 480
+
+ contentHeight: 100 * 100
+
+ Grid {
+ columns: 1
+ Repeater {
+ model: 100
+ Rectangle {
+ width: flick.width
+ height: 100
+ color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/margins.qml b/tests/auto/quick/qquickflickable/data/margins.qml
new file mode 100644
index 0000000000..4866bd8301
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/margins.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Flickable {
+ width: 200; height: 200
+ contentWidth: row.width; contentHeight: row.height
+
+ topMargin: 20
+ bottomMargin: 30
+ leftMargin: 40
+ rightMargin: 50
+
+ Row {
+ id: row
+ Repeater {
+ model: 4
+ Rectangle { width: 400; height: 600; color: "blue" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/nestedPressDelay.qml b/tests/auto/quick/qquickflickable/data/nestedPressDelay.qml
new file mode 100644
index 0000000000..742656641f
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/nestedPressDelay.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Flickable {
+ property bool pressed: ma.pressed
+ width: 240
+ height: 320
+ contentWidth: 480
+ contentHeight: 320
+ flickableDirection: Flickable.HorizontalFlick
+ pressDelay: 10000
+ Rectangle {
+ x: 20
+ y: 20
+ width: 400
+ height: 300
+ color: "yellow"
+ Flickable {
+ objectName: "innerFlickable"
+ anchors.fill: parent
+ flickableDirection: Flickable.HorizontalFlick
+ contentWidth: 1480
+ contentHeight: 400
+ pressDelay: 50
+ Rectangle {
+ y: 100
+ x: 80
+ width: 240
+ height: 100
+ color: ma.pressed ? 'blue' : 'green'
+ MouseArea {
+ id: ma
+ objectName: "mouseArea"
+ anchors.fill: parent
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickflickable/data/nestedStopAtBounds.qml b/tests/auto/quick/qquickflickable/data/nestedStopAtBounds.qml
new file mode 100644
index 0000000000..59318e5b95
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/nestedStopAtBounds.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Flickable {
+ id: outer
+ objectName: "outerFlickable"
+ width: 400
+ height: 400
+ contentX: 50
+ contentY: 50
+ contentWidth: 500
+ contentHeight: 500
+ flickableDirection: inner.flickableDirection
+
+ Rectangle {
+ x: 100
+ y: 100
+ width: 300
+ height: 300
+
+ color: "yellow"
+ Flickable {
+ id: inner
+ objectName: "innerFlickable"
+ anchors.fill: parent
+ contentX: 100
+ contentY: 100
+ contentWidth: 400
+ contentHeight: 400
+ boundsBehavior: Flickable.StopAtBounds
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 100
+ color: "blue"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/pressDelay.qml b/tests/auto/quick/qquickflickable/data/pressDelay.qml
new file mode 100644
index 0000000000..18a5840504
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/pressDelay.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Flickable {
+ flickableDirection: Flickable.VerticalFlick
+ width: 480
+ height: 320
+ contentWidth: 480
+ contentHeight: 400
+ pressDelay: 100
+
+ MouseArea {
+ id: ma
+ objectName: "mouseArea"
+ y: 100
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 240
+ height: 100
+
+ Rectangle {
+ anchors.fill: parent
+ color: parent.pressed ? 'blue' : 'green'
+
+ Text {
+ anchors.fill: parent
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ text: 'Hello'
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickflickable/data/rebound.qml b/tests/auto/quick/qquickflickable/data/rebound.qml
new file mode 100644
index 0000000000..d46f9dd189
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/rebound.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Flickable {
+ id: flick
+
+ property int transitionDuration: 100
+ property bool transitionEnabled: true
+ property int transitionsStarted
+
+ width: 200
+ height: 200
+
+ contentWidth: width * 1.25
+ contentHeight: width * 1.25
+
+ rebound: Transition {
+ objectName: "rebound"
+ enabled: flick.transitionEnabled
+ SequentialAnimation {
+ PropertyAction { target: flick; property: "transitionsStarted"; value: flick.transitionsStarted + 1 }
+ NumberAnimation {
+ properties: "x,y"
+ easing.type: Easing.OutElastic
+ duration: flick.transitionDuration
+ }
+ }
+ }
+
+ Grid {
+ columns: 2
+ Repeater {
+ model: 4
+ Rectangle {
+ width: flick.contentWidth/2
+ height: flick.contentHeight/2
+ color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickflickable/data/resize.qml b/tests/auto/quick/qquickflickable/data/resize.qml
new file mode 100644
index 0000000000..2f7ae7b8bb
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/resize.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Rectangle {
+ function resizeContent() {
+ flick.resizeContent(600, 600, Qt.point(100, 100))
+ }
+ function returnToBounds() {
+ flick.returnToBounds()
+ }
+ width: 400
+ height: 360
+ color: "gray"
+
+ Flickable {
+ id: flick
+ objectName: "flick"
+ anchors.fill: parent
+ contentWidth: 300
+ contentHeight: 300
+
+ rebound: setRebound ? boundsTransition : null
+ Transition {
+ id: boundsTransition
+ objectName: "rebound"
+ NumberAnimation {
+ properties: "x,y"
+ easing.type: Easing.OutElastic
+ }
+ }
+
+ Rectangle {
+ width: flick.contentWidth
+ height: flick.contentHeight
+ color: "red"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/transformedFlickable.qml b/tests/auto/quick/qquickflickable/data/transformedFlickable.qml
new file mode 100644
index 0000000000..ed5b0ae8c5
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/transformedFlickable.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ x: 100
+ y: 100
+ width: 200
+ height: 200
+ rotation: 45
+
+ Rectangle {
+ scale: 0.5
+ color: "#888888"
+ anchors.fill: parent
+
+ Flickable {
+ id: flickable
+ contentHeight: 300
+ anchors.fill: parent
+ objectName: "flickable"
+
+ property alias itemPressed: mouseArea.pressed
+
+ Rectangle {
+ x: 50
+ y: 50
+ width: 100
+ height: 100
+ scale: 0.4
+ color: "red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/data/wheel.qml b/tests/auto/quick/qquickflickable/data/wheel.qml
new file mode 100644
index 0000000000..2928bbcd72
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/wheel.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ color: "gray"
+
+ Flickable {
+ id: flick
+ objectName: "flick"
+ anchors.fill: parent
+ contentWidth: 800
+ contentHeight: 800
+
+ Rectangle {
+ width: flick.contentWidth
+ height: flick.contentHeight
+ color: "red"
+ Rectangle {
+ width: 50; height: 50; color: "blue"
+ anchors.centerIn: parent
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/qquickflickable.pro b/tests/auto/quick/qquickflickable/qquickflickable.pro
new file mode 100644
index 0000000000..67d5fc12f0
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/qquickflickable.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickflickable
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickflickable.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+CONFIG+=insignificant_test
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
new file mode 100644
index 0000000000..3575dfa012
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -0,0 +1,1366 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtGui/QStyleHints>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <private/qquickflickable_p.h>
+#include <private/qquickflickable_p_p.h>
+#include <private/qquicktransition_p.h>
+#include <private/qqmlvaluetype_p.h>
+#include <math.h>
+#include "../../shared/util.h"
+#include "../shared/viewtestutil.h"
+#include "../shared/visualtestutil.h"
+
+#include <qpa/qwindowsysteminterface.h>
+
+using namespace QQuickViewTestUtil;
+using namespace QQuickVisualTestUtil;
+
+class tst_qquickflickable : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void create();
+ void horizontalViewportSize();
+ void verticalViewportSize();
+ void properties();
+ void boundsBehavior();
+ void rebound();
+ void maximumFlickVelocity();
+ void flickDeceleration();
+ void pressDelay();
+ void nestedPressDelay();
+ void flickableDirection();
+ void resizeContent();
+ void returnToBounds();
+ void returnToBounds_data();
+ void wheel();
+ void movingAndFlicking();
+ void movingAndFlicking_data();
+ void movingAndDragging();
+ void movingAndDragging_data();
+ void flickOnRelease();
+ void pressWhileFlicking();
+ void disabled();
+ void flickVelocity();
+ void margins();
+ void cancelOnMouseGrab();
+ void clickAndDragWhenTransformed();
+ void flickTwiceUsingTouches();
+ void nestedStopAtBounds();
+ void nestedStopAtBounds_data();
+
+private:
+ void flickWithTouch(QWindow *window, QTouchDevice *touchDevice);
+ QQmlEngine engine;
+};
+
+void tst_qquickflickable::create()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("flickable01.qml"));
+ QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create());
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->isAtXBeginning(), true);
+ QCOMPARE(obj->isAtXEnd(), false);
+ QCOMPARE(obj->isAtYBeginning(), true);
+ QCOMPARE(obj->isAtYEnd(), false);
+ QCOMPARE(obj->contentX(), 0.);
+ QCOMPARE(obj->contentY(), 0.);
+
+ QCOMPARE(obj->horizontalVelocity(), 0.);
+ QCOMPARE(obj->verticalVelocity(), 0.);
+
+ QCOMPARE(obj->isInteractive(), true);
+ QCOMPARE(obj->boundsBehavior(), QQuickFlickable::DragAndOvershootBounds);
+ QCOMPARE(obj->pressDelay(), 0);
+ QCOMPARE(obj->maximumFlickVelocity(), 2500.);
+
+ delete obj;
+}
+
+void tst_qquickflickable::horizontalViewportSize()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("flickable02.qml"));
+ QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create());
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->contentWidth(), 800.);
+ QCOMPARE(obj->contentHeight(), 300.);
+ QCOMPARE(obj->isAtXBeginning(), true);
+ QCOMPARE(obj->isAtXEnd(), false);
+ QCOMPARE(obj->isAtYBeginning(), true);
+ QCOMPARE(obj->isAtYEnd(), false);
+
+ delete obj;
+}
+
+void tst_qquickflickable::verticalViewportSize()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("flickable03.qml"));
+ QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create());
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->contentWidth(), 200.);
+ QCOMPARE(obj->contentHeight(), 6000.);
+ QCOMPARE(obj->isAtXBeginning(), true);
+ QCOMPARE(obj->isAtXEnd(), false);
+ QCOMPARE(obj->isAtYBeginning(), true);
+ QCOMPARE(obj->isAtYEnd(), false);
+
+ delete obj;
+}
+
+void tst_qquickflickable::properties()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("flickable04.qml"));
+ QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create());
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->isInteractive(), false);
+ QCOMPARE(obj->boundsBehavior(), QQuickFlickable::StopAtBounds);
+ QCOMPARE(obj->pressDelay(), 200);
+ QCOMPARE(obj->maximumFlickVelocity(), 2000.);
+
+ QVERIFY(obj->property("ok").toBool() == false);
+ QMetaObject::invokeMethod(obj, "check");
+ QVERIFY(obj->property("ok").toBool() == true);
+
+ delete obj;
+}
+
+void tst_qquickflickable::boundsBehavior()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Flickable { boundsBehavior: Flickable.StopAtBounds }", QUrl::fromLocalFile(""));
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
+ QSignalSpy spy(flickable, SIGNAL(boundsBehaviorChanged()));
+
+ QVERIFY(flickable);
+ QVERIFY(flickable->boundsBehavior() == QQuickFlickable::StopAtBounds);
+
+ flickable->setBoundsBehavior(QQuickFlickable::DragAndOvershootBounds);
+ QVERIFY(flickable->boundsBehavior() == QQuickFlickable::DragAndOvershootBounds);
+ QCOMPARE(spy.count(),1);
+ flickable->setBoundsBehavior(QQuickFlickable::DragAndOvershootBounds);
+ QCOMPARE(spy.count(),1);
+
+ flickable->setBoundsBehavior(QQuickFlickable::DragOverBounds);
+ QVERIFY(flickable->boundsBehavior() == QQuickFlickable::DragOverBounds);
+ QCOMPARE(spy.count(),2);
+ flickable->setBoundsBehavior(QQuickFlickable::DragOverBounds);
+ QCOMPARE(spy.count(),2);
+
+ flickable->setBoundsBehavior(QQuickFlickable::StopAtBounds);
+ QVERIFY(flickable->boundsBehavior() == QQuickFlickable::StopAtBounds);
+ QCOMPARE(spy.count(),3);
+ flickable->setBoundsBehavior(QQuickFlickable::StopAtBounds);
+ QCOMPARE(spy.count(),3);
+
+ delete flickable;
+}
+
+void tst_qquickflickable::rebound()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("rebound.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QQuickTransition *rebound = window->rootObject()->findChild<QQuickTransition*>("rebound");
+ QVERIFY(rebound);
+ QSignalSpy reboundSpy(rebound, SIGNAL(runningChanged()));
+
+ QSignalSpy movementStartedSpy(flickable, SIGNAL(movementStarted()));
+ QSignalSpy movementEndedSpy(flickable, SIGNAL(movementEnded()));
+ QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged()));
+ QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged()));
+
+ // flick and test the transition is run
+ flick(window.data(), QPoint(20,20), QPoint(120,120), 200);
+
+ QTRY_COMPARE(window->rootObject()->property("transitionsStarted").toInt(), 2);
+ QCOMPARE(hMoveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), 1);
+ QCOMPARE(movementStartedSpy.count(), 1);
+ QCOMPARE(movementEndedSpy.count(), 0);
+ QVERIFY(rebound->running());
+
+ QTRY_VERIFY(!flickable->isMoving());
+ QCOMPARE(flickable->contentX(), 0.0);
+ QCOMPARE(flickable->contentY(), 0.0);
+
+ QCOMPARE(hMoveSpy.count(), 2);
+ QCOMPARE(vMoveSpy.count(), 2);
+ QCOMPARE(movementStartedSpy.count(), 1);
+ QCOMPARE(movementEndedSpy.count(), 1);
+ QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 2);
+ QVERIFY(!rebound->running());
+ QCOMPARE(reboundSpy.count(), 2);
+
+ hMoveSpy.clear();
+ vMoveSpy.clear();
+ movementStartedSpy.clear();
+ movementEndedSpy.clear();
+ window->rootObject()->setProperty("transitionsStarted", 0);
+ window->rootObject()->setProperty("transitionsFinished", 0);
+
+#ifdef Q_OS_MAC
+ QSKIP("QTBUG-26696 - sometimes fails on Mac");
+ return;
+#endif
+
+ // flick and trigger the transition multiple times
+ // (moving signals are emitted as soon as the first transition starts)
+ flick(window.data(), QPoint(20,20), QPoint(120,120), 200); // both x and y will bounce back
+ flick(window.data(), QPoint(20,120), QPoint(120,20), 200); // only x will bounce back
+
+ QVERIFY(flickable->isMoving());
+ QVERIFY(window->rootObject()->property("transitionsStarted").toInt() >= 1);
+ QCOMPARE(hMoveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), 1);
+ QCOMPARE(movementStartedSpy.count(), 1);
+
+ QTRY_VERIFY(!flickable->isMoving());
+ QCOMPARE(flickable->contentX(), 0.0);
+
+ // moving started/stopped signals should only have been emitted once,
+ // and when they are, all transitions should have finished
+ QCOMPARE(hMoveSpy.count(), 2);
+ QCOMPARE(vMoveSpy.count(), 2);
+ QCOMPARE(movementStartedSpy.count(), 1);
+ QCOMPARE(movementEndedSpy.count(), 1);
+
+ hMoveSpy.clear();
+ vMoveSpy.clear();
+ movementStartedSpy.clear();
+ movementEndedSpy.clear();
+ window->rootObject()->setProperty("transitionsStarted", 0);
+ window->rootObject()->setProperty("transitionsFinished", 0);
+
+ // disable and the default transition should run
+ // (i.e. moving but transition->running = false)
+ window->rootObject()->setProperty("transitionEnabled", false);
+
+ flick(window.data(), QPoint(20,20), QPoint(120,120), 200);
+ QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0);
+ QCOMPARE(hMoveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), 1);
+ QCOMPARE(movementStartedSpy.count(), 1);
+ QCOMPARE(movementEndedSpy.count(), 0);
+
+ QTRY_VERIFY(!flickable->isMoving());
+ QCOMPARE(hMoveSpy.count(), 2);
+ QCOMPARE(vMoveSpy.count(), 2);
+ QCOMPARE(movementStartedSpy.count(), 1);
+ QCOMPARE(movementEndedSpy.count(), 1);
+ QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0);
+}
+
+void tst_qquickflickable::maximumFlickVelocity()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile(""));
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
+ QSignalSpy spy(flickable, SIGNAL(maximumFlickVelocityChanged()));
+
+ QVERIFY(flickable);
+ QCOMPARE(flickable->maximumFlickVelocity(), 1.0);
+
+ flickable->setMaximumFlickVelocity(2.0);
+ QCOMPARE(flickable->maximumFlickVelocity(), 2.0);
+ QCOMPARE(spy.count(),1);
+ flickable->setMaximumFlickVelocity(2.0);
+ QCOMPARE(spy.count(),1);
+
+ delete flickable;
+}
+
+void tst_qquickflickable::flickDeceleration()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile(""));
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
+ QSignalSpy spy(flickable, SIGNAL(flickDecelerationChanged()));
+
+ QVERIFY(flickable);
+ QCOMPARE(flickable->flickDeceleration(), 1.0);
+
+ flickable->setFlickDeceleration(2.0);
+ QCOMPARE(flickable->flickDeceleration(), 2.0);
+ QCOMPARE(spy.count(),1);
+ flickable->setFlickDeceleration(2.0);
+ QCOMPARE(spy.count(),1);
+
+ delete flickable;
+}
+
+void tst_qquickflickable::pressDelay()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("pressDelay.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QSignalSpy spy(flickable, SIGNAL(pressDelayChanged()));
+
+ QVERIFY(flickable);
+ QCOMPARE(flickable->pressDelay(), 100);
+
+ flickable->setPressDelay(200);
+ QCOMPARE(flickable->pressDelay(), 200);
+ QCOMPARE(spy.count(),1);
+ flickable->setPressDelay(200);
+ QCOMPARE(spy.count(),1);
+
+ QQuickItem *mouseArea = window->rootObject()->findChild<QQuickItem*>("mouseArea");
+ QSignalSpy clickedSpy(mouseArea, SIGNAL(clicked(QQuickMouseEvent*)));
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+
+ // The press should not occur immediately
+ QVERIFY(mouseArea->property("pressed").toBool() == false);
+
+ // But, it should occur eventually
+ QTRY_VERIFY(mouseArea->property("pressed").toBool() == true);
+
+ QCOMPARE(clickedSpy.count(),0);
+
+ // On release the clicked signal should be emitted
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+ QCOMPARE(clickedSpy.count(),1);
+}
+
+// QTBUG-17361
+void tst_qquickflickable::nestedPressDelay()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("nestedPressDelay.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(outer != 0);
+
+ QQuickFlickable *inner = window->rootObject()->findChild<QQuickFlickable*>("innerFlickable");
+ QVERIFY(inner != 0);
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+ // the MouseArea is not pressed immediately
+ QVERIFY(outer->property("pressed").toBool() == false);
+ QVERIFY(inner->property("pressed").toBool() == false);
+
+ // The inner pressDelay will prevail (50ms, vs. 10sec)
+ // QTRY_VERIFY() has 5sec timeout, so will timeout well within 10sec.
+ QTRY_VERIFY(outer->property("pressed").toBool() == true);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+
+ // Dragging inner Flickable should work
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(80, 150));
+ // the MouseArea is not pressed immediately
+ QVERIFY(outer->property("pressed").toBool() == false);
+ QVERIFY(inner->property("pressed").toBool() == false);
+
+ QTest::mouseMove(window.data(), QPoint(60, 150));
+ QTest::mouseMove(window.data(), QPoint(40, 150));
+ QTest::mouseMove(window.data(), QPoint(20, 150));
+
+ QVERIFY(inner->property("moving").toBool() == true);
+ QVERIFY(outer->property("moving").toBool() == false);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(20, 150));
+
+ // Dragging the MouseArea in the inner Flickable should move the inner Flickable
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+ // the MouseArea is not pressed immediately
+ QVERIFY(outer->property("pressed").toBool() == false);
+
+ QTest::mouseMove(window.data(), QPoint(130, 150));
+ QTest::mouseMove(window.data(), QPoint(110, 150));
+ QTest::mouseMove(window.data(), QPoint(90, 150));
+
+
+ QVERIFY(outer->property("moving").toBool() == false);
+ QVERIFY(inner->property("moving").toBool() == true);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(90, 150));
+}
+
+void tst_qquickflickable::flickableDirection()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile(""));
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
+ QSignalSpy spy(flickable, SIGNAL(flickableDirectionChanged()));
+
+ QVERIFY(flickable);
+ QCOMPARE(flickable->flickableDirection(), QQuickFlickable::VerticalFlick);
+
+ flickable->setFlickableDirection(QQuickFlickable::HorizontalAndVerticalFlick);
+ QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalAndVerticalFlick);
+ QCOMPARE(spy.count(),1);
+
+ flickable->setFlickableDirection(QQuickFlickable::AutoFlickDirection);
+ QCOMPARE(flickable->flickableDirection(), QQuickFlickable::AutoFlickDirection);
+ QCOMPARE(spy.count(),2);
+
+ flickable->setFlickableDirection(QQuickFlickable::HorizontalFlick);
+ QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalFlick);
+ QCOMPARE(spy.count(),3);
+
+ flickable->setFlickableDirection(QQuickFlickable::HorizontalFlick);
+ QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalFlick);
+ QCOMPARE(spy.count(),3);
+
+ delete flickable;
+}
+
+// QtQuick 1.1
+void tst_qquickflickable::resizeContent()
+{
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("setRebound", QVariant::fromValue(false));
+ QQmlComponent c(&engine, testFileUrl("resize.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
+ QQuickFlickable *obj = findItem<QQuickFlickable>(root, "flick");
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->contentX(), 0.);
+ QCOMPARE(obj->contentY(), 0.);
+ QCOMPARE(obj->contentWidth(), 300.);
+ QCOMPARE(obj->contentHeight(), 300.);
+
+ QMetaObject::invokeMethod(root, "resizeContent");
+
+ QCOMPARE(obj->contentX(), 100.);
+ QCOMPARE(obj->contentY(), 100.);
+ QCOMPARE(obj->contentWidth(), 600.);
+ QCOMPARE(obj->contentHeight(), 600.);
+
+ delete root;
+}
+
+void tst_qquickflickable::returnToBounds()
+{
+ QFETCH(bool, setRebound);
+
+ QScopedPointer<QQuickView> window(new QQuickView);
+
+ window->rootContext()->setContextProperty("setRebound", setRebound);
+ window->setSource(testFileUrl("resize.qml"));
+ QVERIFY(window->rootObject() != 0);
+ QQuickFlickable *obj = findItem<QQuickFlickable>(window->rootObject(), "flick");
+
+ QQuickTransition *rebound = window->rootObject()->findChild<QQuickTransition*>("rebound");
+ QVERIFY(rebound);
+ QSignalSpy reboundSpy(rebound, SIGNAL(runningChanged()));
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->contentX(), 0.);
+ QCOMPARE(obj->contentY(), 0.);
+ QCOMPARE(obj->contentWidth(), 300.);
+ QCOMPARE(obj->contentHeight(), 300.);
+
+ obj->setContentX(100);
+ obj->setContentY(400);
+ QTRY_COMPARE(obj->contentX(), 100.);
+ QTRY_COMPARE(obj->contentY(), 400.);
+
+ QMetaObject::invokeMethod(window->rootObject(), "returnToBounds");
+
+ if (setRebound)
+ QTRY_VERIFY(rebound->running());
+
+ QTRY_COMPARE(obj->contentX(), 0.);
+ QTRY_COMPARE(obj->contentY(), 0.);
+
+ QVERIFY(!rebound->running());
+ QCOMPARE(reboundSpy.count(), setRebound ? 2 : 0);
+}
+
+void tst_qquickflickable::returnToBounds_data()
+{
+ QTest::addColumn<bool>("setRebound");
+
+ QTest::newRow("with bounds transition") << true;
+ QTest::newRow("with bounds transition") << false;
+}
+
+void tst_qquickflickable::wheel()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("wheel.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick");
+ QVERIFY(flick != 0);
+
+ {
+ QPoint pos(200, 200);
+ QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(0,-120), -120, Qt::Vertical, Qt::NoButton, Qt::NoModifier);
+ event.setAccepted(false);
+ QGuiApplication::sendEvent(window.data(), &event);
+ }
+
+ QTRY_VERIFY(flick->contentY() > 0);
+ QVERIFY(flick->contentX() == 0);
+
+ flick->setContentY(0);
+ QVERIFY(flick->contentY() == 0);
+
+ {
+ QPoint pos(200, 200);
+ QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(-120,0), -120, Qt::Horizontal, Qt::NoButton, Qt::NoModifier);
+
+ event.setAccepted(false);
+ QGuiApplication::sendEvent(window.data(), &event);
+ }
+
+ QTRY_VERIFY(flick->contentX() > 0);
+ QVERIFY(flick->contentY() == 0);
+}
+
+void tst_qquickflickable::movingAndFlicking_data()
+{
+ QTest::addColumn<bool>("verticalEnabled");
+ QTest::addColumn<bool>("horizontalEnabled");
+ QTest::addColumn<QPoint>("flickToWithoutSnapBack");
+ QTest::addColumn<QPoint>("flickToWithSnapBack");
+
+ QTest::newRow("vertical")
+ << true << false
+ << QPoint(50, 100)
+ << QPoint(50, 300);
+
+ QTest::newRow("horizontal")
+ << false << true
+ << QPoint(-50, 200)
+ << QPoint(150, 200);
+
+ QTest::newRow("both")
+ << true << true
+ << QPoint(-50, 100)
+ << QPoint(150, 300);
+}
+
+void tst_qquickflickable::movingAndFlicking()
+{
+ QFETCH(bool, verticalEnabled);
+ QFETCH(bool, horizontalEnabled);
+ QFETCH(QPoint, flickToWithoutSnapBack);
+ QFETCH(QPoint, flickToWithSnapBack);
+
+ const QPoint flickFrom(50, 200); // centre
+
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("flickable03.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged()));
+ QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged()));
+ QSignalSpy moveSpy(flickable, SIGNAL(movingChanged()));
+ QSignalSpy vFlickSpy(flickable, SIGNAL(flickingVerticallyChanged()));
+ QSignalSpy hFlickSpy(flickable, SIGNAL(flickingHorizontallyChanged()));
+ QSignalSpy flickSpy(flickable, SIGNAL(flickingChanged()));
+
+ QSignalSpy moveStartSpy(flickable, SIGNAL(movementStarted()));
+ QSignalSpy moveEndSpy(flickable, SIGNAL(movementEnded()));
+ QSignalSpy flickStartSpy(flickable, SIGNAL(flickStarted()));
+ QSignalSpy flickEndSpy(flickable, SIGNAL(flickEnded()));
+
+ // do a flick that keeps the view within the bounds
+ flick(window.data(), flickFrom, flickToWithoutSnapBack, 200);
+
+ QTRY_VERIFY(flickable->isMoving());
+ QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isMovingVertically(), verticalEnabled);
+ QVERIFY(flickable->isFlicking());
+ QCOMPARE(flickable->isFlickingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isFlickingVertically(), verticalEnabled);
+ // contentX/contentY are either unchanged, or moving is true when the value changed.
+ QCOMPARE(flickable->property("movingInContentX").value<bool>(), true);
+ QCOMPARE(flickable->property("movingInContentY").value<bool>(), true);
+
+ QCOMPARE(moveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0);
+ QCOMPARE(flickSpy.count(), 1);
+ QCOMPARE(vFlickSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 1 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(flickStartSpy.count(), 1);
+
+ // wait for any motion to end
+ QTRY_VERIFY(!flickable->isMoving());
+
+ QVERIFY(!flickable->isMovingHorizontally());
+ QVERIFY(!flickable->isMovingVertically());
+ QVERIFY(!flickable->isFlicking());
+ QVERIFY(!flickable->isFlickingHorizontally());
+ QVERIFY(!flickable->isFlickingVertically());
+
+ QCOMPARE(moveSpy.count(), 2);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0);
+ QCOMPARE(flickSpy.count(), 2);
+ QCOMPARE(vFlickSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 2 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(moveEndSpy.count(), 1);
+ QCOMPARE(flickStartSpy.count(), 1);
+ QCOMPARE(flickEndSpy.count(), 1);
+
+ // Stop on a full pixel after user interaction
+ if (verticalEnabled)
+ QCOMPARE(flickable->contentY(), (qreal)qRound(flickable->contentY()));
+ if (horizontalEnabled)
+ QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX()));
+
+ // clear for next flick
+ vMoveSpy.clear(); hMoveSpy.clear(); moveSpy.clear();
+ vFlickSpy.clear(); hFlickSpy.clear(); flickSpy.clear();
+ moveStartSpy.clear(); moveEndSpy.clear();
+ flickStartSpy.clear(); flickEndSpy.clear();
+
+ // do a flick that flicks the view out of bounds
+ flickable->setContentX(0);
+ flickable->setContentY(0);
+ QTRY_VERIFY(!flickable->isMoving());
+ flick(window.data(), flickFrom, flickToWithSnapBack, 10);
+
+ QTRY_VERIFY(flickable->isMoving());
+ QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isMovingVertically(), verticalEnabled);
+ QVERIFY(flickable->isFlicking());
+ QCOMPARE(flickable->isFlickingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isFlickingVertically(), verticalEnabled);
+
+ QCOMPARE(moveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0);
+ QCOMPARE(flickSpy.count(), 1);
+ QCOMPARE(vFlickSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 1 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(moveEndSpy.count(), 0);
+ QCOMPARE(flickStartSpy.count(), 1);
+ QCOMPARE(flickEndSpy.count(), 0);
+
+ // wait for any motion to end
+ QTRY_VERIFY(!flickable->isMoving());
+
+ QVERIFY(!flickable->isMovingHorizontally());
+ QVERIFY(!flickable->isMovingVertically());
+ QVERIFY(!flickable->isFlicking());
+ QVERIFY(!flickable->isFlickingHorizontally());
+ QVERIFY(!flickable->isFlickingVertically());
+
+ QCOMPARE(moveSpy.count(), 2);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0);
+ QCOMPARE(flickSpy.count(), 2);
+ QCOMPARE(vFlickSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 2 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(moveEndSpy.count(), 1);
+ QCOMPARE(flickStartSpy.count(), 1);
+ QCOMPARE(flickEndSpy.count(), 1);
+
+ QCOMPARE(flickable->contentX(), 0.0);
+ QCOMPARE(flickable->contentY(), 0.0);
+}
+
+
+void tst_qquickflickable::movingAndDragging_data()
+{
+ QTest::addColumn<bool>("verticalEnabled");
+ QTest::addColumn<bool>("horizontalEnabled");
+ QTest::addColumn<QPoint>("moveByWithoutSnapBack");
+ QTest::addColumn<QPoint>("moveByWithSnapBack");
+
+ QTest::newRow("vertical")
+ << true << false
+ << QPoint(0, -10)
+ << QPoint(0, 20);
+
+ QTest::newRow("horizontal")
+ << false << true
+ << QPoint(-10, 0)
+ << QPoint(20, 0);
+
+ QTest::newRow("both")
+ << true << true
+ << QPoint(-10, -10)
+ << QPoint(20, 20);
+}
+
+void tst_qquickflickable::movingAndDragging()
+{
+ QFETCH(bool, verticalEnabled);
+ QFETCH(bool, horizontalEnabled);
+ QFETCH(QPoint, moveByWithoutSnapBack);
+ QFETCH(QPoint, moveByWithSnapBack);
+
+ const QPoint moveFrom(50, 200); // centre
+
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("flickable03.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QSignalSpy vDragSpy(flickable, SIGNAL(draggingVerticallyChanged()));
+ QSignalSpy hDragSpy(flickable, SIGNAL(draggingHorizontallyChanged()));
+ QSignalSpy dragSpy(flickable, SIGNAL(draggingChanged()));
+ QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged()));
+ QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged()));
+ QSignalSpy moveSpy(flickable, SIGNAL(movingChanged()));
+
+ QSignalSpy dragStartSpy(flickable, SIGNAL(dragStarted()));
+ QSignalSpy dragEndSpy(flickable, SIGNAL(dragEnded()));
+ QSignalSpy moveStartSpy(flickable, SIGNAL(movementStarted()));
+ QSignalSpy moveEndSpy(flickable, SIGNAL(movementEnded()));
+
+ // start the drag
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, moveFrom);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithoutSnapBack);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithoutSnapBack*2);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithoutSnapBack*3);
+
+ QTRY_VERIFY(flickable->isMoving());
+ QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isMovingVertically(), verticalEnabled);
+ QVERIFY(flickable->isDragging());
+ QCOMPARE(flickable->isDraggingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isDraggingVertically(), verticalEnabled);
+ // contentX/contentY are either unchanged, or moving and dragging are true when the value changes.
+ QCOMPARE(flickable->property("movingInContentX").value<bool>(), true);
+ QCOMPARE(flickable->property("movingInContentY").value<bool>(), true);
+ QCOMPARE(flickable->property("draggingInContentX").value<bool>(), true);
+ QCOMPARE(flickable->property("draggingInContentY").value<bool>(), true);
+
+ QCOMPARE(moveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0);
+ QCOMPARE(dragSpy.count(), 1);
+ QCOMPARE(vDragSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hDragSpy.count(), horizontalEnabled ? 1 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(dragStartSpy.count(), 1);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithoutSnapBack*3);
+
+ QVERIFY(!flickable->isDragging());
+ QVERIFY(!flickable->isDraggingHorizontally());
+ QVERIFY(!flickable->isDraggingVertically());
+ QCOMPARE(dragSpy.count(), 2);
+ QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0);
+ QCOMPARE(dragStartSpy.count(), 1);
+ QCOMPARE(dragEndSpy.count(), 1);
+ // Don't test whether moving finished because a flick could occur
+
+ // wait for any motion to end
+ QTRY_VERIFY(flickable->isMoving() == false);
+
+ QVERIFY(!flickable->isMovingHorizontally());
+ QVERIFY(!flickable->isMovingVertically());
+ QVERIFY(!flickable->isDragging());
+ QVERIFY(!flickable->isDraggingHorizontally());
+ QVERIFY(!flickable->isDraggingVertically());
+
+ QCOMPARE(dragSpy.count(), 2);
+ QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0);
+ QCOMPARE(moveSpy.count(), 2);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0);
+
+ QCOMPARE(dragStartSpy.count(), 1);
+ QCOMPARE(dragEndSpy.count(), 1);
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(moveEndSpy.count(), 1);
+
+ // Stop on a full pixel after user interaction
+ if (verticalEnabled)
+ QCOMPARE(flickable->contentY(), (qreal)qRound(flickable->contentY()));
+ if (horizontalEnabled)
+ QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX()));
+
+ // clear for next drag
+ vMoveSpy.clear(); hMoveSpy.clear(); moveSpy.clear();
+ vDragSpy.clear(); hDragSpy.clear(); dragSpy.clear();
+ moveStartSpy.clear(); moveEndSpy.clear();
+ dragStartSpy.clear(); dragEndSpy.clear();
+
+ // do a drag that drags the view out of bounds
+ flickable->setContentX(0);
+ flickable->setContentY(0);
+ QTRY_VERIFY(!flickable->isMoving());
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, moveFrom);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithSnapBack);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithSnapBack*2);
+ QTest::mouseMove(window.data(), moveFrom + moveByWithSnapBack*3);
+
+ QVERIFY(flickable->isMoving());
+ QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isMovingVertically(), verticalEnabled);
+ QVERIFY(flickable->isDragging());
+ QCOMPARE(flickable->isDraggingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isDraggingVertically(), verticalEnabled);
+
+ QCOMPARE(moveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0);
+ QCOMPARE(dragSpy.count(), 1);
+ QCOMPARE(vDragSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hDragSpy.count(), horizontalEnabled ? 1 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(moveEndSpy.count(), 0);
+ QCOMPARE(dragStartSpy.count(), 1);
+ QCOMPARE(dragEndSpy.count(), 0);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithSnapBack*3);
+
+ // should now start snapping back to bounds (moving but not dragging)
+ QVERIFY(flickable->isMoving());
+ QCOMPARE(flickable->isMovingHorizontally(), horizontalEnabled);
+ QCOMPARE(flickable->isMovingVertically(), verticalEnabled);
+ QVERIFY(!flickable->isDragging());
+ QVERIFY(!flickable->isDraggingHorizontally());
+ QVERIFY(!flickable->isDraggingVertically());
+
+ QCOMPARE(moveSpy.count(), 1);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0);
+ QCOMPARE(dragSpy.count(), 2);
+ QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(moveEndSpy.count(), 0);
+
+ // wait for any motion to end
+ QTRY_VERIFY(!flickable->isMoving());
+
+ QVERIFY(!flickable->isMovingHorizontally());
+ QVERIFY(!flickable->isMovingVertically());
+ QVERIFY(!flickable->isDragging());
+ QVERIFY(!flickable->isDraggingHorizontally());
+ QVERIFY(!flickable->isDraggingVertically());
+
+ QCOMPARE(moveSpy.count(), 2);
+ QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0);
+ QCOMPARE(dragSpy.count(), 2);
+ QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0);
+ QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0);
+
+ QCOMPARE(moveStartSpy.count(), 1);
+ QCOMPARE(moveEndSpy.count(), 1);
+ QCOMPARE(dragStartSpy.count(), 1);
+ QCOMPARE(dragEndSpy.count(), 1);
+
+ QCOMPARE(flickable->contentX(), 0.0);
+ QCOMPARE(flickable->contentY(), 0.0);
+}
+
+void tst_qquickflickable::flickOnRelease()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("flickable03.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ // Vertical with a quick press-move-release: should cause a flick in release.
+ QSignalSpy vFlickSpy(flickable, SIGNAL(flickingVerticallyChanged()));
+ // Use something that generates a huge velocity just to make it testable.
+ // In practice this feature matters on touchscreen devices where the
+ // underlying drivers will hopefully provide a pre-calculated velocity
+ // (based on more data than what the UI gets), thus making this use case
+ // working even with small movements.
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 300));
+ QTest::mouseMove(window.data(), QPoint(50, 10), 10);
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10), 10);
+
+ QCOMPARE(vFlickSpy.count(), 1);
+
+ // wait for any motion to end
+ QTRY_VERIFY(flickable->isMoving() == false);
+
+#ifdef Q_OS_MAC
+ QEXPECT_FAIL("", "QTBUG-26094 stopping on a full pixel doesn't work on OS X", Continue);
+#endif
+ // Stop on a full pixel after user interaction
+ QCOMPARE(flickable->contentY(), (qreal)qRound(flickable->contentY()));
+}
+
+void tst_qquickflickable::pressWhileFlicking()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("flickable03.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged()));
+ QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged()));
+ QSignalSpy moveSpy(flickable, SIGNAL(movingChanged()));
+ QSignalSpy hFlickSpy(flickable, SIGNAL(flickingHorizontallyChanged()));
+ QSignalSpy vFlickSpy(flickable, SIGNAL(flickingVerticallyChanged()));
+ QSignalSpy flickSpy(flickable, SIGNAL(flickingChanged()));
+
+ // flick then press while it is still moving
+ // flicking == false, moving == true;
+ flick(window.data(), QPoint(20,190), QPoint(20, 50), 200);
+ QVERIFY(flickable->verticalVelocity() > 0.0);
+ QTRY_VERIFY(flickable->isFlicking());
+ QVERIFY(flickable->isFlickingVertically());
+ QVERIFY(!flickable->isFlickingHorizontally());
+ QVERIFY(flickable->isMoving());
+ QVERIFY(flickable->isMovingVertically());
+ QVERIFY(!flickable->isMovingHorizontally());
+ QCOMPARE(vMoveSpy.count(), 1);
+ QCOMPARE(hMoveSpy.count(), 0);
+ QCOMPARE(moveSpy.count(), 1);
+ QCOMPARE(vFlickSpy.count(), 1);
+ QCOMPARE(hFlickSpy.count(), 0);
+ QCOMPARE(flickSpy.count(), 1);
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(20, 50));
+ QTRY_VERIFY(!flickable->isFlicking());
+ QVERIFY(!flickable->isFlickingVertically());
+ QVERIFY(flickable->isMoving());
+ QVERIFY(flickable->isMovingVertically());
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(20,50));
+ QVERIFY(!flickable->isFlicking());
+ QVERIFY(!flickable->isFlickingVertically());
+ QTRY_VERIFY(!flickable->isMoving());
+ QVERIFY(!flickable->isMovingVertically());
+ // Stop on a full pixel after user interaction
+ QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX()));
+}
+
+void tst_qquickflickable::disabled()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("disabled.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flick != 0);
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 90));
+
+ QTest::mouseMove(window.data(), QPoint(50, 80));
+ QTest::mouseMove(window.data(), QPoint(50, 70));
+ QTest::mouseMove(window.data(), QPoint(50, 60));
+
+ QVERIFY(flick->isMoving() == false);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 60));
+
+ // verify that mouse clicks on other elements still work (QTBUG-20584)
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 10));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10));
+
+ QTRY_VERIFY(window->rootObject()->property("clicked").toBool() == true);
+}
+
+void tst_qquickflickable::flickVelocity()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("flickable03.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ // flick up
+ flick(window.data(), QPoint(20,190), QPoint(20, 50), 200);
+ QVERIFY(flickable->verticalVelocity() > 0.0);
+ QTRY_VERIFY(flickable->verticalVelocity() == 0.0);
+
+ // flick down
+ flick(window.data(), QPoint(20,10), QPoint(20, 140), 200);
+ QTRY_VERIFY(flickable->verticalVelocity() < 0.0);
+ QTRY_VERIFY(flickable->verticalVelocity() == 0.0);
+
+#ifdef Q_OS_MAC
+ QSKIP("boost doesn't work on OS X");
+ return;
+#endif
+
+ // Flick multiple times and verify that flick acceleration is applied.
+ QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flickable);
+ bool boosted = false;
+ for (int i = 0; i < 6; ++i) {
+ flick(window.data(), QPoint(20,390), QPoint(20, 50), 100);
+ boosted |= fp->flickBoost > 1.0;
+ }
+ QVERIFY(boosted);
+
+ // Flick in opposite direction -> boost cancelled.
+ flick(window.data(), QPoint(20,10), QPoint(20, 340), 200);
+ QTRY_VERIFY(flickable->verticalVelocity() < 0.0);
+ QVERIFY(fp->flickBoost == 1.0);
+}
+
+void tst_qquickflickable::margins()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("margins.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
+ QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root);
+ QVERIFY(obj != 0);
+
+ // starting state
+ QCOMPARE(obj->contentX(), -40.);
+ QCOMPARE(obj->contentY(), -20.);
+ QCOMPARE(obj->contentWidth(), 1600.);
+ QCOMPARE(obj->contentHeight(), 600.);
+ QCOMPARE(obj->originX(), 0.);
+ QCOMPARE(obj->originY(), 0.);
+
+ // Reduce left margin
+ obj->setLeftMargin(30);
+ QTRY_COMPARE(obj->contentX(), -30.);
+
+ // Reduce top margin
+ obj->setTopMargin(20);
+ QTRY_COMPARE(obj->contentY(), -20.);
+
+ // position to the far right, including margin
+ obj->setContentX(1600 + 50 - obj->width());
+ obj->returnToBounds();
+ QTest::qWait(200);
+ QCOMPARE(obj->contentX(), 1600. + 50. - obj->width());
+
+ // position beyond the far right, including margin
+ obj->setContentX(1600 + 50 - obj->width() + 1.);
+ obj->returnToBounds();
+ QTRY_COMPARE(obj->contentX(), 1600. + 50. - obj->width());
+
+ // Reduce right margin
+ obj->setRightMargin(40);
+ QTRY_COMPARE(obj->contentX(), 1600. + 40. - obj->width());
+ QCOMPARE(obj->contentWidth(), 1600.);
+
+ // position to the far bottom, including margin
+ obj->setContentY(600 + 30 - obj->height());
+ obj->returnToBounds();
+ QTest::qWait(200);
+ QCOMPARE(obj->contentY(), 600. + 30. - obj->height());
+
+ // position beyond the far bottom, including margin
+ obj->setContentY(600 + 30 - obj->height() + 1.);
+ obj->returnToBounds();
+ QTRY_COMPARE(obj->contentY(), 600. + 30. - obj->height());
+
+ // Reduce bottom margin
+ obj->setBottomMargin(20);
+ QTRY_COMPARE(obj->contentY(), 600. + 20. - obj->height());
+ QCOMPARE(obj->contentHeight(), 600.);
+
+ delete root;
+}
+
+void tst_qquickflickable::cancelOnMouseGrab()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("cancel.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
+ // drag out of bounds
+ QTest::mouseMove(window.data(), QPoint(50, 50));
+ QTest::mouseMove(window.data(), QPoint(100, 100));
+ QTest::mouseMove(window.data(), QPoint(150, 150));
+
+ QVERIFY(flickable->contentX() != 0);
+ QVERIFY(flickable->contentY() != 0);
+ QVERIFY(flickable->isMoving());
+ QVERIFY(flickable->isDragging());
+
+ // grabbing mouse will cancel flickable interaction.
+ QQuickItem *item = window->rootObject()->findChild<QQuickItem*>("row");
+ item->grabMouse();
+
+ QTRY_COMPARE(flickable->contentX(), 0.);
+ QTRY_COMPARE(flickable->contentY(), 0.);
+ QTRY_VERIFY(!flickable->isMoving());
+ QTRY_VERIFY(!flickable->isDragging());
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10));
+
+}
+
+void tst_qquickflickable::clickAndDragWhenTransformed()
+{
+ QScopedPointer<QQuickView> view(new QQuickView);
+ view->setSource(testFileUrl("transformedFlickable.qml"));
+ view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
+ QVERIFY(view->rootObject() != 0);
+
+ QQuickFlickable *flickable = view->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flickable != 0);
+
+ // click outside child rect
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(190, 190));
+ QTest::qWait(10);
+ QCOMPARE(flickable->property("itemPressed").toBool(), false);
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(190, 190));
+
+ // click inside child rect
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(200, 200));
+ QTest::qWait(10);
+ QCOMPARE(flickable->property("itemPressed").toBool(), true);
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(200, 200));
+
+ const int threshold = qApp->styleHints()->startDragDistance();
+
+ // drag outside bounds
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(160, 160));
+ QTest::qWait(10);
+ QTest::mouseMove(view.data(), QPoint(160 + threshold * 2, 160));
+ QTest::mouseMove(view.data(), QPoint(160 + threshold * 3, 160));
+ QCOMPARE(flickable->isDragging(), false);
+ QCOMPARE(flickable->property("itemPressed").toBool(), false);
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(180, 160));
+
+ // drag inside bounds
+ QTest::mousePress(view.data(), Qt::LeftButton, 0, QPoint(200, 140));
+ QTest::qWait(10);
+ QTest::mouseMove(view.data(), QPoint(200 + threshold * 2, 140));
+ QTest::mouseMove(view.data(), QPoint(200 + threshold * 3, 140));
+ QCOMPARE(flickable->isDragging(), true);
+ QCOMPARE(flickable->property("itemPressed").toBool(), false);
+ QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(220, 140));
+}
+
+void tst_qquickflickable::flickTwiceUsingTouches()
+{
+ QTouchDevice *touchDevice = new QTouchDevice;
+ touchDevice->setName("Fake Touchscreen");
+ touchDevice->setType(QTouchDevice::TouchScreen);
+ touchDevice->setCapabilities(QTouchDevice::Position);
+ QWindowSystemInterface::registerTouchDevice(touchDevice);
+
+ QQuickView *window = new QQuickView;
+ window->setSource(testFileUrl("longList.qml"));
+ window->show();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QCOMPARE(flickable->contentY(), 0.0f);
+ flickWithTouch(window, touchDevice);
+
+ qreal contentYAfterFirstFlick = flickable->contentY();
+ qDebug() << "contentYAfterFirstFlick " << contentYAfterFirstFlick;
+ QVERIFY(contentYAfterFirstFlick > 50.0f);
+
+ flickWithTouch(window, touchDevice);
+
+ // In the original bug, that second flick would cause Flickable to halt immediately
+ qreal contentYAfterSecondFlick = flickable->contentY();
+ qDebug() << "contentYAfterSecondFlick " << contentYAfterSecondFlick;
+ QVERIFY(contentYAfterSecondFlick > (contentYAfterFirstFlick + 80.0f));
+
+ delete window;
+}
+
+void tst_qquickflickable::flickWithTouch(QWindow *window, QTouchDevice *touchDevice)
+{
+ QTest::touchEvent(window, touchDevice)
+ .press(0, QPoint(100, 400), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .move(0, QPoint(100, 380), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .move(0, QPoint(100, 360), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .move(0, QPoint(100, 340), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .move(0, QPoint(100, 320), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .move(0, QPoint(100, 300), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .move(0, QPoint(100, 280), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .move(0, QPoint(100, 260), window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, touchDevice)
+ .release(0, QPoint(100, 240), window);
+ QTest::qWait(1);
+}
+
+void tst_qquickflickable::nestedStopAtBounds_data()
+{
+ QTest::addColumn<bool>("transpose");
+ QTest::addColumn<bool>("invert");
+
+ QTest::newRow("left") << false << false;
+ QTest::newRow("right") << false << true;
+ QTest::newRow("top") << true << false;
+ QTest::newRow("bottom") << true << true;
+}
+
+void tst_qquickflickable::nestedStopAtBounds()
+{
+ QFETCH(bool, transpose);
+ QFETCH(bool, invert);
+
+ QQuickView view;
+ view.setSource(testFileUrl("nestedStopAtBounds.qml"));
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(view.rootObject());
+
+ QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(view.rootObject());
+ QVERIFY(outer);
+
+ QQuickFlickable *inner = outer->findChild<QQuickFlickable*>("innerFlickable");
+ QVERIFY(inner);
+ inner->setFlickableDirection(transpose ? QQuickFlickable::VerticalFlick : QQuickFlickable::HorizontalFlick);
+ inner->setContentX(invert ? 0 : 100);
+ inner->setContentY(invert ? 0 : 100);
+
+ const int threshold = qApp->styleHints()->startDragDistance();
+
+ QPoint position(200, 200);
+ int &axis = transpose ? position.ry() : position.rx();
+
+ // drag toward the aligned boundary. Outer flickable dragged.
+ QTest::mousePress(&view, Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? threshold * 2 : -threshold * 2;
+ QTest::mouseMove(&view, position);
+ axis += invert ? threshold : -threshold;
+ QTest::mouseMove(&view, position);
+ QCOMPARE(outer->isDragging(), true);
+ QCOMPARE(inner->isDragging(), false);
+ QTest::mouseRelease(&view, Qt::LeftButton, 0, position);
+
+ QVERIFY(!outer->isDragging());
+ QTRY_VERIFY(!outer->isMoving());
+
+ axis = 200;
+ outer->setContentX(50);
+ outer->setContentY(50);
+
+ // drag away from the aligned boundary. Inner flickable dragged.
+ QTest::mousePress(&view, Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? -threshold * 2 : threshold * 2;
+ QTest::mouseMove(&view, position);
+ axis += invert ? -threshold : threshold;
+ QTest::mouseMove(&view, position);
+ QCOMPARE(outer->isDragging(), false);
+ QCOMPARE(inner->isDragging(), true);
+ QTest::mouseRelease(&view, Qt::LeftButton, 0, position);
+
+ QTRY_VERIFY(!outer->isMoving());
+}
+
+QTEST_MAIN(tst_qquickflickable)
+
+#include "tst_qquickflickable.moc"
diff --git a/tests/auto/quick/qquickflipable/data/crash.qml b/tests/auto/quick/qquickflipable/data/crash.qml
new file mode 100644
index 0000000000..a0327918cb
--- /dev/null
+++ b/tests/auto/quick/qquickflipable/data/crash.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Flipable {
+ transform: Rotation {
+ axis.y: 1
+ axis.z: 0
+ angle: 180
+ }
+}
diff --git a/tests/auto/quick/qquickflipable/data/flip-flipable.qml b/tests/auto/quick/qquickflipable/data/flip-flipable.qml
new file mode 100644
index 0000000000..4f22a0df6d
--- /dev/null
+++ b/tests/auto/quick/qquickflipable/data/flip-flipable.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Flipable {
+ id: flipable
+ width: 640; height: 480
+ property bool flipped: false
+
+ front: Rectangle { color: "red"; anchors.fill: flipable }
+ back: Rectangle { color: "blue"; anchors.fill: flipable }
+
+ transform: Rotation {
+ id: rotation
+ origin.x: flipable.width/2
+ origin.y: flipable.height/2
+ axis.x: 0; axis.y: 1; axis.z: 0 // set axis.y to 1 to rotate around y-axis
+ angle: 0 // the default angle
+ }
+
+ states: State {
+ name: "back"
+ PropertyChanges { target: rotation; angle: 540 }
+ when: flipable.flipped
+ }
+
+ transitions: Transition {
+ NumberAnimation { target: rotation; property: "angle"; duration: 500 }
+ }
+}
diff --git a/tests/auto/quick/qquickflipable/data/flipable-abort.qml b/tests/auto/quick/qquickflipable/data/flipable-abort.qml
new file mode 100644
index 0000000000..90fc03a5f9
--- /dev/null
+++ b/tests/auto/quick/qquickflipable/data/flipable-abort.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Rectangle {
+ Flipable {
+ id: flipable
+ }
+ Rectangle {
+ visible: flipable.side == Flipable.Front
+ }
+}
diff --git a/tests/auto/quick/qquickflipable/data/test-flipable.qml b/tests/auto/quick/qquickflipable/data/test-flipable.qml
new file mode 100644
index 0000000000..dff6d3fe39
--- /dev/null
+++ b/tests/auto/quick/qquickflipable/data/test-flipable.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Flipable {
+ id: flipable
+ width: 640; height: 480
+
+ front: Rectangle { anchors.fill: flipable }
+ back: Rectangle { anchors.fill: flipable }
+}
diff --git a/tests/auto/quick/qquickflipable/qquickflipable.pro b/tests/auto/quick/qquickflipable/qquickflipable.pro
new file mode 100644
index 0000000000..d07aab8d71
--- /dev/null
+++ b/tests/auto/quick/qquickflipable/qquickflipable.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickflipable
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickflipable.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp
new file mode 100644
index 0000000000..83f0520b65
--- /dev/null
+++ b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <private/qquickflipable_p.h>
+#include <private/qqmlvaluetype_p.h>
+#include <QFontMetrics>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <math.h>
+#include "../../shared/util.h"
+
+class tst_qquickflipable : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void create();
+ void checkFrontAndBack();
+ void setFrontAndBack();
+ void flipFlipable();
+
+ // below here task issues
+ void QTBUG_9161_crash();
+ void QTBUG_8474_qgv_abort();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qquickflipable::create()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-flipable.qml"));
+ QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create());
+
+ QVERIFY(obj != 0);
+ delete obj;
+}
+
+void tst_qquickflipable::checkFrontAndBack()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-flipable.qml"));
+ QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->front() != 0);
+ QVERIFY(obj->back() != 0);
+ delete obj;
+}
+
+void tst_qquickflipable::setFrontAndBack()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-flipable.qml"));
+ QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->front() != 0);
+ QVERIFY(obj->back() != 0);
+
+ QString message = c.url().toString() + ":3:1: QML Flipable: front is a write-once property";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ obj->setFront(new QQuickRectangle());
+
+ message = c.url().toString() + ":3:1: QML Flipable: back is a write-once property";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
+ obj->setBack(new QQuickRectangle());
+ delete obj;
+}
+
+void tst_qquickflipable::flipFlipable()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("flip-flipable.qml"));
+ QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->side() == QQuickFlipable::Front);
+ obj->setProperty("flipped", QVariant(true));
+ QTRY_VERIFY(obj->side() == QQuickFlipable::Back);
+ QTRY_VERIFY(obj->side() == QQuickFlipable::Front);
+ QTRY_VERIFY(obj->side() == QQuickFlipable::Back);
+ delete obj;
+}
+
+void tst_qquickflipable::QTBUG_9161_crash()
+{
+ QQuickView *window = new QQuickView;
+ window->setSource(testFileUrl("crash.qml"));
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+ window->show();
+ delete window;
+}
+
+void tst_qquickflipable::QTBUG_8474_qgv_abort()
+{
+ QQuickView *window = new QQuickView;
+ window->setSource(testFileUrl("flipable-abort.qml"));
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+ window->show();
+ delete window;
+}
+
+QTEST_MAIN(tst_qquickflipable)
+
+#include "tst_qquickflipable.moc"
diff --git a/tests/auto/quick/qquickfocusscope/data/canvasFocus.qml b/tests/auto/quick/qquickfocusscope/data/canvasFocus.qml
new file mode 100644
index 0000000000..7d8dac5a22
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/canvasFocus.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Column {
+ FocusScope {
+ objectName: "scope1"
+ width: 20 ;height: 20
+ focus: true
+ Rectangle {
+ objectName: "item1"
+ anchors.fill: parent
+ focus: true
+ }
+ }
+ FocusScope {
+ objectName: "scope2"
+ width: 20 ;height: 20
+ Rectangle {
+ objectName: "item2"
+ anchors.fill: parent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/chain.qml b/tests/auto/quick/qquickfocusscope/data/chain.qml
new file mode 100644
index 0000000000..4b96662318
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/chain.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width:300; height:400
+
+ property bool focus1: root.activeFocus
+ property bool focus2: item1.activeFocus
+ property bool focus3: fs1.activeFocus
+ property bool focus4: fs2.activeFocus
+ property bool focus5: theItem.activeFocus
+
+ Item {
+ id: item1
+ FocusScope {
+ id: fs1
+ focus: true
+ FocusScope {
+ id: fs2
+ focus: true
+ Item {
+ id: theItem
+ focus: true
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/forceActiveFocus.qml b/tests/auto/quick/qquickfocusscope/data/forceActiveFocus.qml
new file mode 100644
index 0000000000..74d2106888
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/forceActiveFocus.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "root"
+ FocusScope {
+ objectName: "scope"
+ Item {
+ objectName: "item-a1"
+ FocusScope {
+ objectName: "scope-a"
+ Item {
+ objectName: "item-a2"
+ }
+ }
+ }
+ Item {
+ objectName: "item-b1"
+ FocusScope {
+ objectName: "scope-b"
+ Item {
+ objectName: "item-b2"
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/forcefocus.qml b/tests/auto/quick/qquickfocusscope/data/forcefocus.qml
new file mode 100644
index 0000000000..f41582a951
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/forcefocus.qml
@@ -0,0 +1,81 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 800; height: 600
+
+ FocusScope {
+ focus: true
+
+ FocusScope {
+ id: firstScope
+ objectName: "item0"
+ focus: true
+
+ Rectangle {
+ height: 120; width: 420
+
+ color: "transparent"
+ border.width: 5; border.color: firstScope.activeFocus?"blue":"black"
+
+ Rectangle {
+ id: item1; objectName: "item1"
+ x: 10; y: 10; width: 100; height: 100; color: "green"
+ border.width: 5; border.color: activeFocus?"blue":"black"
+ focus: true
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+
+ Rectangle {
+ id: item2; objectName: "item2"
+ x: 310; y: 10; width: 100; height: 100; color: "green"
+ border.width: 5; border.color: activeFocus?"blue":"black"
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+ }
+ }
+
+ FocusScope {
+ id: secondScope
+ objectName: "item3"
+
+ Rectangle {
+ y: 160; height: 120; width: 420
+
+ color: "transparent"
+ border.width: 5; border.color: secondScope.activeFocus?"blue":"black"
+
+ Rectangle {
+ id: item4; objectName: "item4"
+ x: 10; y: 10; width: 100; height: 100; color: "green"
+ border.width: 5; border.color: activeFocus?"blue":"black"
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+
+ Rectangle {
+ id: item5; objectName: "item5"
+ x: 310; y: 10; width: 100; height: 100; color: "green"
+ border.width: 5; border.color: activeFocus?"blue":"black"
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+ }
+ }
+ }
+ Keys.onDigit4Pressed: item4.focus = true
+ Keys.onDigit5Pressed: item5.forceActiveFocus()
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/qtBug13380.qml b/tests/auto/quick/qquickfocusscope/data/qtBug13380.qml
new file mode 100644
index 0000000000..29de046b38
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/qtBug13380.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ property bool showRect: false
+ onShowRectChanged: if (showRect) rect.visible = true
+ property bool noFocus: !fs2.activeFocus
+
+ FocusScope {
+ id: fs1
+ focus: true
+ }
+ Rectangle {
+ id: rect
+ visible: false
+ FocusScope {
+ id: fs2
+ Rectangle {
+ focus: true
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/signalEmission.qml b/tests/auto/quick/qquickfocusscope/data/signalEmission.qml
new file mode 100644
index 0000000000..999a40c5ad
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/signalEmission.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+
+ FocusScope {
+ focus: true
+ Rectangle {
+ objectName: "item1"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ Rectangle {
+ objectName: "item2"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ }
+
+ FocusScope {
+ Rectangle {
+ objectName: "item3"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ Rectangle {
+ objectName: "item4"
+ color: "blue"
+ onFocusChanged: focus ? color = "red" : color = "blue"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/test.qml b/tests/auto/quick/qquickfocusscope/data/test.qml
new file mode 100644
index 0000000000..67be29c3fb
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/test.qml
@@ -0,0 +1,77 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 800
+ height: 600
+
+ Keys.onDigit9Pressed: console.log("Error - Root")
+
+ FocusScope {
+ id: myScope
+ objectName: "item0"
+ focus: true
+
+ Keys.onDigit9Pressed: console.log("Error - FocusScope")
+
+ Rectangle {
+ height: 120
+ width: 420
+
+ color: "transparent"
+ border.width: 5
+ border.color: myScope.activeFocus?"blue":"black"
+
+ Rectangle {
+ id: item1; objectName: "item1"
+ x: 10; y: 10
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: activeFocus?"blue":"black"
+ Keys.onDigit9Pressed: console.debug("Top Left");
+ KeyNavigation.right: item2
+ focus: true
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+
+ Rectangle {
+ id: item2; objectName: "item2"
+ x: 310; y: 10
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: activeFocus?"blue":"black"
+ KeyNavigation.left: item1
+ Keys.onDigit9Pressed: console.log("Top Right");
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+ }
+ KeyNavigation.down: item3
+ }
+
+ Text { x:100; y:170; text: "Blue border indicates scoped focus\nBlack border indicates NOT scoped focus\nRed box indicates active focus\nUse arrow keys to navigate\nPress \"9\" to print currently focused item" }
+
+ Rectangle {
+ id: item3; objectName: "item3"
+ x: 10; y: 300
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: activeFocus?"blue":"black"
+
+ Keys.onDigit9Pressed: console.log("Bottom Left");
+ KeyNavigation.up: myScope
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/test2.qml b/tests/auto/quick/qquickfocusscope/data/test2.qml
new file mode 100644
index 0000000000..ad74f3e9f4
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/test2.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 800
+ height: 600
+
+ Text { text: "All five rectangles should be red" }
+
+ FocusScope {
+ y: 100
+ focus: true; objectName: "item1"
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
+
+ FocusScope {
+ y: 100
+ focus: true; objectName: "item2"
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
+
+ FocusScope {
+ y: 100
+ focus: true; objectName: "item3"
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
+
+ FocusScope {
+ y: 100
+ focus: true; objectName: "item4"
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
+
+ FocusScope {
+ y: 100
+ focus: true; objectName: "item5"
+ Rectangle { width: 50; height: 50; color: parent.activeFocus?"red":"blue" }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/test3.qml b/tests/auto/quick/qquickfocusscope/data/test3.qml
new file mode 100644
index 0000000000..537c30816e
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/test3.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 800
+ height: 600
+
+ ListModel {
+ id: model
+ ListElement { name: "1" }
+ ListElement { name: "2" }
+ ListElement { name: "3" }
+ ListElement { name: "4" }
+ ListElement { name: "5" }
+ ListElement { name: "6" }
+ ListElement { name: "7" }
+ ListElement { name: "8" }
+ ListElement { name: "9" }
+ }
+
+ Component {
+ id: verticalDelegate
+ FocusScope {
+ id: root
+ width: 50; height: 50;
+ Keys.onDigit9Pressed: console.log("Error - " + name)
+ Rectangle {
+ focus: true
+ Keys.onDigit9Pressed: console.log(name)
+ width: 50; height: 50;
+ color: root.ListView.isCurrentItem?"red":"green"
+ Text { text: name; anchors.centerIn: parent }
+ }
+ }
+ }
+
+ ListView {
+ width: 800; height: 50; orientation: "Horizontal"
+ focus: true
+ model: model
+ delegate: verticalDelegate
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 100
+ highlightRangeMode: "StrictlyEnforceRange"
+ }
+
+
+ Text {
+ y: 100; x: 50
+ text: "Currently selected element should be red\nPressing \"9\" should print the number of the currently selected item\nBe sure to scroll all the way to the right, pause, and then all the way to the left."
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/test4.qml b/tests/auto/quick/qquickfocusscope/data/test4.qml
new file mode 100644
index 0000000000..0eea649f5d
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/test4.qml
@@ -0,0 +1,76 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 800
+ height: 600
+
+ Keys.onDigit9Pressed: console.log("Error - Root")
+
+ FocusScope {
+ id: myScope
+
+ Keys.onDigit9Pressed: console.log("Error - FocusScope")
+
+ Rectangle {
+ objectName: "item0"
+ height: 120
+ width: 420
+
+ color: "transparent"
+ border.width: 5
+ border.color: myScope.activeFocus?"blue":"black"
+
+ Rectangle {
+ id: item1; objectName: "item1"
+ x: 10; y: 10
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: activeFocus?"blue":"black"
+ Keys.onDigit9Pressed: console.log("Error - Top Left");
+ KeyNavigation.right: item2
+ focus: true
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+
+ Rectangle {
+ id: item2; objectName: "item2"
+ x: 310; y: 10
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: activeFocus?"blue":"black"
+ KeyNavigation.left: item1
+ Keys.onDigit9Pressed: console.log("Error - Top Right");
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+ }
+ KeyNavigation.down: item3
+ }
+
+ Text { x:100; y:170; text: "There should be no blue borders, or red squares.\nPressing \"9\" should do nothing.\nArrow keys should have no effect." }
+
+ Rectangle {
+ id: item3; objectName: "item3"
+ x: 10; y: 300
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: activeFocus?"blue":"black"
+
+ Keys.onDigit9Pressed: console.log("Error - Bottom Left");
+ KeyNavigation.up: myScope
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+
+}
diff --git a/tests/auto/quick/qquickfocusscope/data/test5.qml b/tests/auto/quick/qquickfocusscope/data/test5.qml
new file mode 100644
index 0000000000..9c37cd1303
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/data/test5.qml
@@ -0,0 +1,84 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 800
+ height: 600
+
+ Keys.onReturnPressed: console.log("Error - Root")
+
+ FocusScope {
+ id: myScope
+ objectName: "item0"
+ focus: true
+
+ Keys.onReturnPressed: console.log("Error - FocusScope")
+
+ Rectangle {
+ height: 120
+ width: 420
+
+ color: "transparent"
+ border.width: 5
+ border.color: myScope.activeFocus?"blue":"black"
+
+ Rectangle {
+ x: 10; y: 10
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: item1.activeFocus?"blue":"black"
+ }
+
+ TextEdit {
+ id: item1; objectName: "item1"
+ x: 20; y: 20
+ width: 90; height: 90
+ color: "white"
+ font.pixelSize: 20
+ Keys.onReturnPressed: console.log("Top Left");
+ KeyNavigation.right: item2
+ focus: true
+ wrapMode: TextEdit.WordWrap
+ text: "Box 1"
+ }
+
+ Rectangle {
+ id: item2; objectName: "item2"
+ x: 310; y: 10
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: activeFocus?"blue":"black"
+ KeyNavigation.left: item1
+ Keys.onReturnPressed: console.log("Top Right");
+
+ Rectangle {
+ width: 50; height: 50; anchors.centerIn: parent
+ color: parent.activeFocus?"red":"transparent"
+ }
+ }
+ }
+ KeyNavigation.down: item3
+ }
+
+ Text { x:100; y:170; text: "Blue border indicates scoped focus\nBlack border indicates NOT scoped focus\nRed box or flashing cursor indicates active focus\nUse arrow keys to navigate\nPress Ctrl-Return to print currently focused item" }
+
+ Rectangle {
+ x: 10; y: 300
+ width: 100; height: 100; color: "green"
+ border.width: 5
+ border.color: item3.activeFocus?"blue":"black"
+ }
+
+ TextEdit {
+ id: item3; objectName: "item3"
+ x: 20; y: 310
+ width: 90; height: 90
+ color: "white"
+ font.pixelSize: 20
+ text: "Box 3"
+
+ Keys.onReturnPressed: console.log("Bottom Left");
+ KeyNavigation.up: myScope
+ wrapMode: TextEdit.WordWrap
+ }
+}
diff --git a/tests/auto/quick/qquickfocusscope/qquickfocusscope.pro b/tests/auto/quick/qquickfocusscope/qquickfocusscope.pro
new file mode 100644
index 0000000000..9ec643dc4d
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/qquickfocusscope.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+TARGET = tst_qquickfocusscope
+SOURCES += tst_qquickfocusscope.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp
new file mode 100644
index 0000000000..b350abe953
--- /dev/null
+++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp
@@ -0,0 +1,635 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QSignalSpy>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <private/qquicktextedit_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickfocusscope_p.h>
+#include "../../shared/util.h"
+#include "../shared/visualtestutil.h"
+
+using namespace QQuickVisualTestUtil;
+
+class tst_qquickfocusscope : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickfocusscope() {}
+
+private slots:
+ void basic();
+ void nested();
+ void noFocus();
+ void textEdit();
+ void forceFocus();
+ void noParentFocus();
+ void signalEmission();
+ void qtBug13380();
+ void forceActiveFocus();
+ void canvasFocus();
+};
+
+void tst_qquickfocusscope::basic()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("test.qml"));
+
+ QQuickFocusScope *item0 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item0"));
+ QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1"));
+ QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2"));
+ QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3"));
+ QVERIFY(item0 != 0);
+ QVERIFY(item1 != 0);
+ QVERIFY(item2 != 0);
+ QVERIFY(item3 != 0);
+
+ view->show();
+ view->requestActivate();
+
+ QTest::qWaitForWindowActive(view);
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+
+ QVERIFY(view->isTopLevel());
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_Right);
+ QTest::qWait(50);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == true);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_Down);
+ QTest::qWait(50);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == true);
+
+ delete view;
+}
+
+void tst_qquickfocusscope::nested()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("test2.qml"));
+
+ QQuickFocusScope *item1 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item1"));
+ QQuickFocusScope *item2 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item2"));
+ QQuickFocusScope *item3 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item3"));
+ QQuickFocusScope *item4 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item4"));
+ QQuickFocusScope *item5 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item5"));
+ QVERIFY(item1 != 0);
+ QVERIFY(item2 != 0);
+ QVERIFY(item3 != 0);
+ QVERIFY(item4 != 0);
+ QVERIFY(item5 != 0);
+
+ view->show();
+ view->requestActivate();
+
+ QTest::qWaitForWindowActive(view);
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == true);
+ QVERIFY(item3->hasActiveFocus() == true);
+ QVERIFY(item4->hasActiveFocus() == true);
+ QVERIFY(item5->hasActiveFocus() == true);
+ delete view;
+}
+
+void tst_qquickfocusscope::noFocus()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("test4.qml"));
+
+ QQuickRectangle *item0 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item0"));
+ QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1"));
+ QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2"));
+ QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3"));
+ QVERIFY(item0 != 0);
+ QVERIFY(item1 != 0);
+ QVERIFY(item2 != 0);
+ QVERIFY(item3 != 0);
+
+ view->show();
+ view->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(view));
+ QVERIFY(view == qGuiApp->focusWindow());
+
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_Right);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_Down);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ delete view;
+}
+
+void tst_qquickfocusscope::textEdit()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("test5.qml"));
+
+ QQuickFocusScope *item0 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item0"));
+ QQuickTextEdit *item1 = findItem<QQuickTextEdit>(view->rootObject(), QLatin1String("item1"));
+ QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2"));
+ QQuickTextEdit *item3 = findItem<QQuickTextEdit>(view->rootObject(), QLatin1String("item3"));
+ QVERIFY(item0 != 0);
+ QVERIFY(item1 != 0);
+ QVERIFY(item2 != 0);
+ QVERIFY(item3 != 0);
+
+ view->show();
+ view->requestActivate();
+
+ QTest::qWaitForWindowActive(view);
+
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_Right);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_Right);
+ QTest::keyClick(view, Qt::Key_Right);
+ QTest::keyClick(view, Qt::Key_Right);
+ QTest::keyClick(view, Qt::Key_Right);
+ QTest::keyClick(view, Qt::Key_Right);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == true);
+ QVERIFY(item3->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_Down);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == true);
+
+ delete view;
+}
+
+void tst_qquickfocusscope::forceFocus()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("forcefocus.qml"));
+
+ QQuickFocusScope *item0 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item0"));
+ QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1"));
+ QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2"));
+ QQuickFocusScope *item3 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item3"));
+ QQuickRectangle *item4 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item4"));
+ QQuickRectangle *item5 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item5"));
+ QVERIFY(item0 != 0);
+ QVERIFY(item1 != 0);
+ QVERIFY(item2 != 0);
+ QVERIFY(item3 != 0);
+ QVERIFY(item4 != 0);
+ QVERIFY(item5 != 0);
+
+ view->show();
+ view->requestActivate();
+ QTest::qWaitForWindowActive(view);
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+ QVERIFY(item4->hasActiveFocus() == false);
+ QVERIFY(item5->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_4);
+ QVERIFY(item0->hasActiveFocus() == true);
+ QVERIFY(item1->hasActiveFocus() == true);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == false);
+ QVERIFY(item4->hasActiveFocus() == false);
+ QVERIFY(item5->hasActiveFocus() == false);
+
+ QTest::keyClick(view, Qt::Key_5);
+ QVERIFY(item0->hasActiveFocus() == false);
+ QVERIFY(item1->hasActiveFocus() == false);
+ QVERIFY(item2->hasActiveFocus() == false);
+ QVERIFY(item3->hasActiveFocus() == true);
+ QVERIFY(item4->hasActiveFocus() == false);
+ QVERIFY(item5->hasActiveFocus() == true);
+
+ delete view;
+}
+
+void tst_qquickfocusscope::noParentFocus()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("chain.qml"));
+ QVERIFY(view->rootObject());
+
+ view->show();
+ view->requestActivate();
+ QTest::qWaitForWindowActive(view);
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+
+ QVERIFY(view->rootObject()->property("focus1") == false);
+ QVERIFY(view->rootObject()->property("focus2") == false);
+ QVERIFY(view->rootObject()->property("focus3") == true);
+ QVERIFY(view->rootObject()->property("focus4") == true);
+ QVERIFY(view->rootObject()->property("focus5") == true);
+
+ delete view;
+}
+
+void tst_qquickfocusscope::signalEmission()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("signalEmission.qml"));
+
+ QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1"));
+ QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2"));
+ QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3"));
+ QQuickRectangle *item4 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item4"));
+ QVERIFY(item1 != 0);
+ QVERIFY(item2 != 0);
+ QVERIFY(item3 != 0);
+ QVERIFY(item4 != 0);
+
+ view->show();
+ view->requestActivate();
+
+ QTest::qWaitForWindowActive(view);
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+
+ QVariant blue(QColor("blue"));
+ QVariant red(QColor("red"));
+
+ item1->setFocus(true);
+ QCOMPARE(item1->property("color"), red);
+ QCOMPARE(item2->property("color"), blue);
+ QCOMPARE(item3->property("color"), blue);
+ QCOMPARE(item4->property("color"), blue);
+
+ item2->setFocus(true);
+ QCOMPARE(item1->property("color"), blue);
+ QCOMPARE(item2->property("color"), red);
+ QCOMPARE(item3->property("color"), blue);
+ QCOMPARE(item4->property("color"), blue);
+
+ item3->setFocus(true);
+ QCOMPARE(item1->property("color"), blue);
+ QCOMPARE(item2->property("color"), red);
+ QCOMPARE(item3->property("color"), red);
+ QCOMPARE(item4->property("color"), blue);
+
+ item4->setFocus(true);
+ QCOMPARE(item1->property("color"), blue);
+ QCOMPARE(item2->property("color"), red);
+ QCOMPARE(item3->property("color"), blue);
+ QCOMPARE(item4->property("color"), red);
+
+ item4->setFocus(false);
+ QCOMPARE(item1->property("color"), blue);
+ QCOMPARE(item2->property("color"), red);
+ QCOMPARE(item3->property("color"), blue);
+ QCOMPARE(item4->property("color"), blue);
+
+ delete view;
+}
+
+void tst_qquickfocusscope::qtBug13380()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("qtBug13380.qml"));
+
+ view->show();
+ QVERIFY(view->rootObject());
+ view->requestActivate();
+ qApp->processEvents();
+
+ QVERIFY(QTest::qWaitForWindowExposed(view));
+
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+ QVERIFY(view->rootObject()->property("noFocus").toBool());
+
+ view->rootObject()->setProperty("showRect", true);
+ QVERIFY(view->rootObject()->property("noFocus").toBool());
+
+ delete view;
+}
+
+void tst_qquickfocusscope::forceActiveFocus()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("forceActiveFocus.qml"));
+
+ view->show();
+ view->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(view));
+ QTRY_VERIFY(view == qGuiApp->focusWindow());
+
+ QQuickItem *rootObject = view->rootObject();
+ QVERIFY(rootObject);
+
+ QQuickItem *scope = findItem<QQuickItem>(rootObject, QLatin1String("scope"));
+ QQuickItem *itemA1 = findItem<QQuickItem>(rootObject, QLatin1String("item-a1"));
+ QQuickItem *scopeA = findItem<QQuickItem>(rootObject, QLatin1String("scope-a"));
+ QQuickItem *itemA2 = findItem<QQuickItem>(rootObject, QLatin1String("item-a2"));
+ QQuickItem *itemB1 = findItem<QQuickItem>(rootObject, QLatin1String("item-b1"));
+ QQuickItem *scopeB = findItem<QQuickItem>(rootObject, QLatin1String("scope-b"));
+ QQuickItem *itemB2 = findItem<QQuickItem>(rootObject, QLatin1String("item-b2"));
+
+ QVERIFY(scope);
+ QVERIFY(itemA1);
+ QVERIFY(scopeA);
+ QVERIFY(itemA2);
+ QVERIFY(itemB1);
+ QVERIFY(scopeB);
+ QVERIFY(itemB2);
+
+ QSignalSpy rootSpy(rootObject, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scopeSpy(scope, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scopeASpy(scopeA, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scopeBSpy(scopeB, SIGNAL(activeFocusChanged(bool)));
+
+ // First, walk the focus from item-a1 down to item-a2 and back again
+ itemA1->forceActiveFocus();
+ QVERIFY(itemA1->hasActiveFocus());
+ QVERIFY(!rootObject->hasActiveFocus());
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeA->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemA2->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(itemA2->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeA->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(itemA2->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemA1->forceActiveFocus();
+ QVERIFY(itemA1->hasActiveFocus());
+ QVERIFY(!scopeA->hasActiveFocus());
+ QVERIFY(!itemA2->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 2);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ // Then jump back and forth between branch 'a' and 'b'
+ itemB1->forceActiveFocus();
+ QVERIFY(itemB1->hasActiveFocus());
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeA->forceActiveFocus();
+ QVERIFY(!itemA1->hasActiveFocus());
+ QVERIFY(!itemB1->hasActiveFocus());
+ QVERIFY(scopeA->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 3);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ scopeB->forceActiveFocus();
+ QVERIFY(!scopeA->hasActiveFocus());
+ QVERIFY(!itemB1->hasActiveFocus());
+ QVERIFY(scopeB->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 4);
+ QCOMPARE(scopeBSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemA2->forceActiveFocus();
+ QVERIFY(!scopeB->hasActiveFocus());
+ QVERIFY(itemA2->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 5);
+ QCOMPARE(scopeBSpy.count(), 2);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ itemB2->forceActiveFocus();
+ QVERIFY(!itemA2->hasActiveFocus());
+ QVERIFY(itemB2->hasActiveFocus());
+ QCOMPARE(scopeASpy.count(), 6);
+ QCOMPARE(scopeBSpy.count(), 3);
+ QCOMPARE(rootSpy.count(), 0);
+ QCOMPARE(scopeSpy.count(), 1);
+
+ delete view;
+}
+
+void tst_qquickfocusscope::canvasFocus()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("canvasFocus.qml"));
+
+ QQuickView alternateView;
+
+ QQuickItem *rootObject = view->rootObject();
+ QVERIFY(rootObject);
+
+ QQuickItem *rootItem = view->contentItem();
+ QQuickItem *scope1 = findItem<QQuickItem>(rootObject, QLatin1String("scope1"));
+ QQuickItem *item1 = findItem<QQuickItem>(rootObject, QLatin1String("item1"));
+ QQuickItem *scope2 = findItem<QQuickItem>(rootObject, QLatin1String("scope2"));
+ QQuickItem *item2 = findItem<QQuickItem>(rootObject, QLatin1String("item2"));
+
+ QVERIFY(scope1);
+ QVERIFY(item1);
+ QVERIFY(scope2);
+ QVERIFY(item2);
+
+ QSignalSpy rootFocusSpy(rootItem, SIGNAL(focusChanged(bool)));
+ QSignalSpy scope1FocusSpy(scope1, SIGNAL(focusChanged(bool)));
+ QSignalSpy item1FocusSpy(item1, SIGNAL(focusChanged(bool)));
+ QSignalSpy scope2FocusSpy(scope2, SIGNAL(focusChanged(bool)));
+ QSignalSpy item2FocusSpy(item2, SIGNAL(focusChanged(bool)));
+ QSignalSpy rootActiveFocusSpy(rootItem, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scope1ActiveFocusSpy(scope1, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy item1ActiveFocusSpy(item1, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy scope2ActiveFocusSpy(scope2, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy item2ActiveFocusSpy(item2, SIGNAL(activeFocusChanged(bool)));
+
+ QCOMPARE(rootItem->hasFocus(), false);
+ QCOMPARE(rootItem->hasActiveFocus(), false);
+ QCOMPARE(scope1->hasFocus(), true);
+ QCOMPARE(scope1->hasActiveFocus(), false);
+ QCOMPARE(item1->hasFocus(), true);
+ QCOMPARE(item1->hasActiveFocus(), false);
+ QCOMPARE(scope2->hasFocus(), false);
+ QCOMPARE(scope2->hasActiveFocus(), false);
+ QCOMPARE(item2->hasFocus(), false);
+ QCOMPARE(item2->hasActiveFocus(), false);
+
+ view->show();
+ view->requestActivate();
+
+ QVERIFY(QTest::qWaitForWindowActive(view));
+ QVERIFY(view == qGuiApp->focusWindow());
+
+ // Now the window has focus, active focus given to item1
+ QCOMPARE(rootItem->hasFocus(), true);
+ QCOMPARE(rootItem->hasActiveFocus(), true);
+ QCOMPARE(scope1->hasFocus(), true);
+ QCOMPARE(scope1->hasActiveFocus(), true);
+ QCOMPARE(item1->hasFocus(), true);
+ QCOMPARE(item1->hasActiveFocus(), true);
+ QCOMPARE(scope2->hasFocus(), false);
+ QCOMPARE(scope2->hasActiveFocus(), false);
+ QCOMPARE(item2->hasFocus(), false);
+ QCOMPARE(item2->hasActiveFocus(), false);
+
+ QCOMPARE(rootFocusSpy.count(), 1);
+ QCOMPARE(rootActiveFocusSpy.count(), 1);
+ QCOMPARE(scope1FocusSpy.count(), 0);
+ QCOMPARE(scope1ActiveFocusSpy.count(), 1);
+ QCOMPARE(item1FocusSpy.count(), 0);
+ QCOMPARE(item1ActiveFocusSpy.count(), 1);
+
+
+ // view->hide(); // seemingly doesn't remove focus, so have an another view steal it.
+ alternateView.show();
+ alternateView.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&alternateView));
+ QVERIFY(QGuiApplication::focusWindow() == &alternateView);
+
+ QCOMPARE(rootItem->hasFocus(), false);
+ QCOMPARE(rootItem->hasActiveFocus(), false);
+ QCOMPARE(scope1->hasFocus(), true);
+ QCOMPARE(scope1->hasActiveFocus(), false);
+ QCOMPARE(item1->hasFocus(), true);
+ QCOMPARE(item1->hasActiveFocus(), false);
+
+ QCOMPARE(rootFocusSpy.count(), 2);
+ QCOMPARE(rootActiveFocusSpy.count(), 2);
+ QCOMPARE(scope1FocusSpy.count(), 0);
+ QCOMPARE(scope1ActiveFocusSpy.count(), 2);
+ QCOMPARE(item1FocusSpy.count(), 0);
+ QCOMPARE(item1ActiveFocusSpy.count(), 2);
+
+
+ // window does not have focus, so item2 will not get active focus
+ item2->forceActiveFocus();
+
+ QCOMPARE(rootItem->hasFocus(), false);
+ QCOMPARE(rootItem->hasActiveFocus(), false);
+ QCOMPARE(scope1->hasFocus(), false);
+ QCOMPARE(scope1->hasActiveFocus(), false);
+ QCOMPARE(item1->hasFocus(), true);
+ QCOMPARE(item1->hasActiveFocus(), false);
+ QCOMPARE(scope2->hasFocus(), true);
+ QCOMPARE(scope2->hasActiveFocus(), false);
+ QCOMPARE(item2->hasFocus(), true);
+ QCOMPARE(item2->hasActiveFocus(), false);
+
+ QCOMPARE(rootFocusSpy.count(), 2);
+ QCOMPARE(rootActiveFocusSpy.count(), 2);
+ QCOMPARE(scope1FocusSpy.count(), 1);
+ QCOMPARE(scope1ActiveFocusSpy.count(), 2);
+ QCOMPARE(item1FocusSpy.count(), 0);
+ QCOMPARE(item1ActiveFocusSpy.count(), 2);
+ QCOMPARE(scope2FocusSpy.count(), 1);
+ QCOMPARE(scope2ActiveFocusSpy.count(), 0);
+ QCOMPARE(item2FocusSpy.count(), 1);
+ QCOMPARE(item2ActiveFocusSpy.count(), 0);
+
+ // give the window focus, and item2 will get active focus
+ view->show();
+ view->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(view));
+ QVERIFY(QGuiApplication::focusWindow() == view);
+
+ QCOMPARE(rootItem->hasFocus(), true);
+ QCOMPARE(rootItem->hasActiveFocus(), true);
+ QCOMPARE(scope2->hasFocus(), true);
+ QCOMPARE(scope2->hasActiveFocus(), true);
+ QCOMPARE(item2->hasFocus(), true);
+ QCOMPARE(item2->hasActiveFocus(), true);
+ QCOMPARE(rootFocusSpy.count(), 3);
+ QCOMPARE(rootActiveFocusSpy.count(), 3);
+ QCOMPARE(scope2FocusSpy.count(), 1);
+ QCOMPARE(scope2ActiveFocusSpy.count(), 1);
+ QCOMPARE(item2FocusSpy.count(), 1);
+ QCOMPARE(item2ActiveFocusSpy.count(), 1);
+
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickfocusscope)
+
+#include "tst_qquickfocusscope.moc"
diff --git a/tests/auto/quick/qquickfontloader/data/daniel.ttf b/tests/auto/quick/qquickfontloader/data/daniel.ttf
new file mode 100644
index 0000000000..aae50d5035
--- /dev/null
+++ b/tests/auto/quick/qquickfontloader/data/daniel.ttf
Binary files differ
diff --git a/tests/auto/quick/qquickfontloader/data/dummy.ttf b/tests/auto/quick/qquickfontloader/data/dummy.ttf
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/quick/qquickfontloader/data/dummy.ttf
diff --git a/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml b/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml
new file mode 100644
index 0000000000..0eafdfa17b
--- /dev/null
+++ b/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: test
+ property variant fontloader: fontloaderelement
+ height: 100; width: 100
+ property bool usename: false
+ property int statenum: 1
+ property alias name: fontloaderelement.name
+ property alias source: fontloaderelement.source
+ property alias status: fontloaderelement.status
+
+ FontLoader {
+ id: fontloaderelement
+ }
+
+ states: [
+ State { name: "start"; when: !usename
+ PropertyChanges { target: fontloaderelement; source: "tarzeau_ocr_a.ttf" }
+ },
+ State { name: "changefont"; when: usename
+ PropertyChanges { target: fontloaderelement; name: "Tahoma" }
+ }
+ ]
+
+ Text { id: textelement; text: fontloaderelement.name; color: "black" }
+}
diff --git a/tests/auto/quick/qquickfontloader/data/tarzeau_ocr_a.ttf b/tests/auto/quick/qquickfontloader/data/tarzeau_ocr_a.ttf
new file mode 100644
index 0000000000..cf93f9651f
--- /dev/null
+++ b/tests/auto/quick/qquickfontloader/data/tarzeau_ocr_a.ttf
Binary files differ
diff --git a/tests/auto/quick/qquickfontloader/qquickfontloader.pro b/tests/auto/quick/qquickfontloader/qquickfontloader.pro
new file mode 100644
index 0000000000..2e7300564e
--- /dev/null
+++ b/tests/auto/quick/qquickfontloader/qquickfontloader.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickfontloader
+macx:CONFIG -= app_bundle
+
+HEADERS += ../../shared/testhttpserver.h
+SOURCES += tst_qquickfontloader.cpp \
+ ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
new file mode 100644
index 0000000000..bcb496eab7
--- /dev/null
+++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
@@ -0,0 +1,256 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQuick/private/qquickfontloader_p.h>
+#include "../../shared/util.h"
+#include "../../shared/testhttpserver.h"
+#include <QtQuick/QQuickView>
+#include <QtQuick/QQuickItem>
+
+#define SERVER_PORT 14457
+#define SERVER_ADDR "http://localhost:14457"
+
+class tst_qquickfontloader : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickfontloader();
+
+private slots:
+ void initTestCase();
+ void noFont();
+ void namedFont();
+ void localFont();
+ void failLocalFont();
+ void webFont();
+ void redirWebFont();
+ void failWebFont();
+ void changeFont();
+ void changeFontSourceViaState();
+
+private:
+ QQmlEngine engine;
+ TestHTTPServer server;
+};
+
+tst_qquickfontloader::tst_qquickfontloader() :
+ server(SERVER_PORT)
+{
+}
+
+void tst_qquickfontloader::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ server.serveDirectory(dataDirectory());
+ QVERIFY(server.isValid());
+}
+
+void tst_qquickfontloader::noFont()
+{
+ QString componentStr = "import QtQuick 2.0\nFontLoader { }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QCOMPARE(fontObject->name(), QString(""));
+ QCOMPARE(fontObject->source(), QUrl(""));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Null);
+
+ delete fontObject;
+}
+
+void tst_qquickfontloader::namedFont()
+{
+ QString componentStr = "import QtQuick 2.0\nFontLoader { name: \"Helvetica\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QCOMPARE(fontObject->source(), QUrl(""));
+ QCOMPARE(fontObject->name(), QString("Helvetica"));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+}
+
+void tst_qquickfontloader::localFont()
+{
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFileUrl("tarzeau_ocr_a.ttf").toString() + "\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QVERIFY(fontObject->source() != QUrl(""));
+ QTRY_COMPARE(fontObject->name(), QString("OCRA"));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+}
+
+void tst_qquickfontloader::failLocalFont()
+{
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFileUrl("dummy.ttf").toString() + "\" }";
+ QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + testFileUrl("dummy.ttf").toString() + "\"").toUtf8().constData());
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QVERIFY(fontObject->source() != QUrl(""));
+ QTRY_COMPARE(fontObject->name(), QString(""));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Error);
+}
+
+void tst_qquickfontloader::webFont()
+{
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SERVER_ADDR "/tarzeau_ocr_a.ttf\" }";
+ QQmlComponent component(&engine);
+
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QVERIFY(fontObject->source() != QUrl(""));
+ QTRY_COMPARE(fontObject->name(), QString("OCRA"));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+}
+
+void tst_qquickfontloader::redirWebFont()
+{
+ server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf");
+
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SERVER_ADDR "/olddir/oldname.ttf\" }";
+ QQmlComponent component(&engine);
+
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QVERIFY(fontObject->source() != QUrl(""));
+ QTRY_COMPARE(fontObject->name(), QString("OCRA"));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+}
+
+void tst_qquickfontloader::failWebFont()
+{
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SERVER_ADDR "/nonexist.ttf\" }";
+ QTest::ignoreMessage(QtWarningMsg, "file::2:1: QML FontLoader: Cannot load font: \"" SERVER_ADDR "/nonexist.ttf\"");
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+ QVERIFY(fontObject->source() != QUrl(""));
+ QTRY_COMPARE(fontObject->name(), QString(""));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Error);
+}
+
+void tst_qquickfontloader::changeFont()
+{
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: font }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("font", testFileUrl("tarzeau_ocr_a.ttf"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
+
+ QVERIFY(fontObject != 0);
+
+ QSignalSpy nameSpy(fontObject, SIGNAL(nameChanged()));
+ QSignalSpy statusSpy(fontObject, SIGNAL(statusChanged()));
+
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+ QCOMPARE(nameSpy.count(), 0);
+ QCOMPARE(statusSpy.count(), 0);
+ QTRY_COMPARE(fontObject->name(), QString("OCRA"));
+
+ ctxt->setContextProperty("font", SERVER_ADDR "/daniel.ttf");
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Loading);
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+ QCOMPARE(nameSpy.count(), 1);
+ QCOMPARE(statusSpy.count(), 2);
+ QTRY_COMPARE(fontObject->name(), QString("Daniel"));
+
+ ctxt->setContextProperty("font", testFileUrl("tarzeau_ocr_a.ttf"));
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+ QCOMPARE(nameSpy.count(), 2);
+ QCOMPARE(statusSpy.count(), 2);
+ QTRY_COMPARE(fontObject->name(), QString("OCRA"));
+
+ ctxt->setContextProperty("font", SERVER_ADDR "/daniel.ttf");
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+ QCOMPARE(nameSpy.count(), 3);
+ QCOMPARE(statusSpy.count(), 2);
+ QTRY_COMPARE(fontObject->name(), QString("Daniel"));
+}
+
+void tst_qquickfontloader::changeFontSourceViaState()
+{
+ QQuickView window(testFileUrl("qtbug-20268.qml"));
+ window.show();
+ window.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&window));
+ QCOMPARE(&window, qGuiApp->focusWindow());
+
+ QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(qvariant_cast<QObject *>(window.rootObject()->property("fontloader")));
+ QVERIFY(fontObject != 0);
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+ QVERIFY(fontObject->source() != QUrl(""));
+ QTRY_COMPARE(fontObject->name(), QString("OCRA"));
+
+ window.rootObject()->setProperty("usename", true);
+
+ // This warning should probably not be printed once QTBUG-20268 is fixed
+ QString warning = QString(testFileUrl("qtbug-20268.qml").toString()) +
+ QLatin1String(":13:5: QML FontLoader: Cannot load font: \"\"");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QEXPECT_FAIL("", "QTBUG-20268", Abort);
+ QTRY_VERIFY(fontObject->status() == QQuickFontLoader::Ready);
+ QCOMPARE(window.rootObject()->property("name").toString(), QString("Tahoma"));
+}
+
+QTEST_MAIN(tst_qquickfontloader)
+
+#include "tst_qquickfontloader.moc"
diff --git a/tests/auto/quick/qquickgridview/data/ComponentView.qml b/tests/auto/quick/qquickgridview/data/ComponentView.qml
new file mode 100644
index 0000000000..12ab6c92d1
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/ComponentView.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+GridView {
+ id: view
+
+ property string title
+
+ width: 100; height: 100;
+
+ model: 1
+ delegate: Text { objectName: "listItem"; text: view.title }
+ header: Text { objectName: "header"; text: view.title }
+ footer: Text { objectName: "footer"; text: view.title }
+}
diff --git a/tests/auto/quick/qquickgridview/data/addTransitions.qml b/tests/auto/quick/qquickgridview/data/addTransitions.qml
new file mode 100644
index 0000000000..14ed2dc265
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/addTransitions.qml
@@ -0,0 +1,130 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 550
+ height: 600
+
+ property int duration: 10
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == targetItems_transitionFrom)
+ model_targetItems_transitionFrom.addItem(name, "")
+ if (Qt.point(x, y) == displacedItems_transitionVia)
+ model_displacedItems_transitionVia.addItem(name, "")
+ }
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var targetTrans_items: new Object()
+ property var targetTrans_targetIndexes: new Array()
+ property var targetTrans_targetItems: new Array()
+
+ property var displacedTrans_items: new Object()
+ property var displacedTrans_targetIndexes: new Array()
+ property var displacedTrans_targetItems: new Array()
+
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ anchors.centerIn: parent
+ model: testModel
+ delegate: myDelegate
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ add: Transition {
+ id: targetTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.targetTrans_items[targetTransition.ViewTransition.item.nameData] = targetTransition.ViewTransition.index
+ grid.targetTrans_targetIndexes.push(targetTransition.ViewTransition.targetIndexes)
+ grid.targetTrans_targetItems.push(grid.copyList(targetTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: targetItems_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: targetItems_transitionFrom.y; duration: root.duration }
+ }
+
+ ScriptAction { script: grid.targetTransitionsDone += 1 }
+ }
+ }
+
+ addDisplaced: Transition {
+ id: displaced
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.displacedTrans_items[displaced.ViewTransition.item.nameData] = displaced.ViewTransition.index
+ grid.displacedTrans_targetIndexes.push(displaced.ViewTransition.targetIndexes)
+ grid.displacedTrans_targetItems.push(grid.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; duration: root.duration; to: displacedItems_transitionVia.x }
+ NumberAnimation { properties: "y"; duration: root.duration; to: displacedItems_transitionVia.y }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: grid.displaceTransitionsDone += 1 }
+ }
+
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+}
+
+
diff --git a/tests/auto/quick/qquickgridview/data/asyncloader.qml b/tests/auto/quick/qquickgridview/data/asyncloader.qml
new file mode 100644
index 0000000000..ab66f20a1e
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/asyncloader.qml
@@ -0,0 +1,36 @@
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 300; height: 400
+ color: "#2200FF00"
+
+ Loader {
+ asynchronous: true
+ sourceComponent: viewComp
+ anchors.fill: parent
+ }
+
+ Component {
+ id: viewComp
+ GridView {
+ objectName: "view"
+ width: 300; height: 400
+ model: 40
+ delegate: aDelegate
+
+ highlight: Rectangle { color: "lightsteelblue" }
+ }
+ }
+ // The delegate for each list
+ Component {
+ id: aDelegate
+ Item {
+ objectName: "wrapper"
+ width: 100
+ height: 100
+ Text { text: 'Index: ' + index }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/attachedSignals.qml b/tests/auto/quick/qquickgridview/data/attachedSignals.qml
new file mode 100644
index 0000000000..73c10d8caf
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/attachedSignals.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+GridView {
+ id: view
+ width: 240; height: 320
+
+ property variant addedDelegates: []
+ property int removedDelegateCount
+
+ model: testModel
+
+ cellWidth: delegateWidth; cellHeight: delegateHeight
+
+ delegate: Rectangle {
+ width: delegateWidth; height: delegateHeight
+ border.width: 1
+ GridView.onAdd: {
+ var obj = GridView.view.addedDelegates
+ obj.push(model.name)
+ GridView.view.addedDelegates = obj
+ }
+ GridView.onRemove: {
+ view.removedDelegateCount += 1
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickgridview/data/creationContext.qml b/tests/auto/quick/qquickgridview/data/creationContext.qml
new file mode 100644
index 0000000000..79a682788b
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/creationContext.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+ComponentView {
+ title: "Hello!"
+}
diff --git a/tests/auto/quick/qquickgridview/data/displacedTransitions.qml b/tests/auto/quick/qquickgridview/data/displacedTransitions.qml
new file mode 100644
index 0000000000..4c36b76b21
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/displacedTransitions.qml
@@ -0,0 +1,175 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ Text {
+ text: index
+ }
+ Text {
+ x: 40
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ y: 20
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ y: 40
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ border.width: 1
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == displaced_transitionVia)
+ model_displaced_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == addDisplaced_transitionVia)
+ model_addDisplaced_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == moveDisplaced_transitionVia)
+ model_moveDisplaced_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == removeDisplaced_transitionVia)
+ model_removeDisplaced_transitionVia.addItem(name, "")
+ }
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var displacedTargetIndexes: new Array()
+ property var displacedTargetItems: new Array()
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ objectName: "grid"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ displaced: useDisplaced ? displaced : null
+ addDisplaced: useAddDisplaced ? addDisplaced : null
+ moveDisplaced: useMoveDisplaced ? moveDisplaced : null
+ removeDisplaced: useRemoveDisplaced ? removeDisplaced : null
+
+ Transition {
+ id: displaced
+ enabled: displacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.displacedTargetIndexes.push(displaced.ViewTransition.targetIndexes)
+ grid.displacedTargetItems.push(grid.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: displaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: displaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+
+ Transition {
+ id: addDisplaced
+ enabled: addDisplacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.displacedTargetIndexes.push(addDisplaced.ViewTransition.targetIndexes)
+ grid.displacedTargetItems.push(grid.copyList(addDisplaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: addDisplaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: addDisplaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+
+ Transition {
+ id: moveDisplaced
+ enabled: moveDisplacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.displacedTargetIndexes.push(moveDisplaced.ViewTransition.targetIndexes)
+ grid.displacedTargetItems.push(grid.copyList(moveDisplaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: moveDisplaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: moveDisplaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+
+ Transition {
+ id: removeDisplaced
+ enabled: removeDisplacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.displacedTargetIndexes.push(removeDisplaced.ViewTransition.targetIndexes)
+ grid.displacedTargetItems.push(grid.copyList(removeDisplaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: removeDisplaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: removeDisplaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+}
+
diff --git a/tests/auto/quick/qquickgridview/data/displaygrid.qml b/tests/auto/quick/qquickgridview/data/displaygrid.qml
new file mode 100644
index 0000000000..1da4fe50ac
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/displaygrid.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.color: "blue"
+ Text {
+ text: index
+ }
+ Text {
+ y: 20
+ id: displayText
+ objectName: "displayText"
+ text: display
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ]
+ GridView {
+ id: grid
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ model: testModel
+ delegate: myDelegate
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/footer.qml b/tests/auto/quick/qquickgridview/data/footer.qml
new file mode 100644
index 0000000000..9083f9f57c
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/footer.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Rectangle {
+ property bool showHeader: false
+
+ function changeFooter() {
+ grid.footer = footer2
+ }
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.color: "blue"
+ Text {
+ text: index
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ Component {
+ id: headerComponent
+ Text { objectName: "header"; text: "Header " + x + "," + y; width: 100; height: 30 }
+ }
+
+ GridView {
+ id: grid
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ model: testModel
+ delegate: myDelegate
+ header: parent.showHeader ? headerComponent : null
+ footer: Text { objectName: "footer"; text: "Footer " + x + "," + y; width: 100; height: 30 }
+ }
+
+ Component {
+ id: footer2
+ Text { objectName: "footer2"; text: "Footer 2" + x + "," + y; width: 50; height: 20 }
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml b/tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml
new file mode 100644
index 0000000000..2bfe7da78e
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/gridview-enforcerange.qml
@@ -0,0 +1,58 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ objectName: "wrapper"
+ height: 100
+ width: 100
+ Text {
+ text: index
+ }
+ Text {
+ y: 25
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ y: 50
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ y: 75
+ text: wrapper.y
+ }
+ }
+ }
+
+ Component {
+ id: myHighlight
+ Rectangle {
+ color: "lightsteelblue"
+ }
+ }
+
+ GridView {
+ id: grid
+ objectName: "grid"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ highlight: myHighlight
+ flow: (testTopToBottom == true) ? GridView.TopToBottom : GridView.LeftToRight
+ layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 100
+ highlightRangeMode: "StrictlyEnforceRange"
+ focus: true
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml b/tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml
new file mode 100644
index 0000000000..af35d2fa1b
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/gridview-initCurrent.qml
@@ -0,0 +1,67 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ property int current: grid.currentIndex
+ property bool showHeader: false
+ property bool showFooter: false
+
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.color: "blue"
+ Text {
+ text: index
+ }
+ Text {
+ x: 40
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ y: 20
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ y: 40
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ]
+
+ Component {
+ id: headerFooter
+ Rectangle { height: 30; width: 240; color: "blue" }
+ }
+
+ GridView {
+ id: grid
+ objectName: "grid"
+ focus: true
+ width: 240
+ height: 320
+ currentIndex: 35
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ delegate: myDelegate
+ highlightMoveDuration: 400
+ model: testModel
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/gridview-noCurrent.qml b/tests/auto/quick/qquickgridview/data/gridview-noCurrent.qml
new file mode 100644
index 0000000000..4867075289
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/gridview-noCurrent.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+
+Rectangle {
+ property int current: grid.currentIndex
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.color: "blue"
+ Text {
+ text: index
+ }
+ Text {
+ x: 40
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ y: 20
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ y: 40
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ]
+ GridView {
+ id: grid
+ objectName: "grid"
+ focus: true
+ width: 240
+ height: 320
+ currentIndex: -1
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ delegate: myDelegate
+ model: testModel
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/gridview1.qml b/tests/auto/quick/qquickgridview/data/gridview1.qml
new file mode 100644
index 0000000000..c381101925
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/gridview1.qml
@@ -0,0 +1,72 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ property int count: grid.count
+ property bool showHeader: false
+ property bool showFooter: false
+ property real cacheBuffer: 0
+ property int added: -1
+ property variant removed
+ property int lastKey: 0
+
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.color: "blue"
+ property string name: model.name
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ text: wrapper.x + ", " + wrapper.y
+ font.pixelSize: 12
+ }
+ Text {
+ y: 20
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ y: 40
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ GridView.onAdd: root.added = index
+ GridView.onRemove: root.removed = name
+ }
+ },
+ Component {
+ id: headerFooter
+ Rectangle { width: 30; height: 320; color: "blue" }
+ }
+ ]
+ GridView {
+ id: grid
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ model: testModel
+ delegate: myDelegate
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
+ cacheBuffer: root.cacheBuffer
+ focus: true
+ }
+
+ Keys.onPressed: lastKey = event.key
+}
diff --git a/tests/auto/quick/qquickgridview/data/gridview2.qml b/tests/auto/quick/qquickgridview/data/gridview2.qml
new file mode 100644
index 0000000000..5fb45a1613
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/gridview2.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+GridView {
+ anchors.fill: parent
+ width: 320; height: 200
+ cellWidth: 100; cellHeight: 100; cacheBuffer: 200; focus: true
+ keyNavigationWraps: true; highlightFollowsCurrentItem: false
+
+ model: ListModel {
+ id: appModel
+ ListElement { lColor: "red" }
+ ListElement { lColor: "yellow" }
+ ListElement { lColor: "green" }
+ ListElement { lColor: "blue" }
+ }
+
+ delegate: Item {
+ width: 100; height: 100
+ Rectangle {
+ color: lColor; x: 4; y: 4
+ width: 92; height: 92
+ }
+ }
+
+ highlight: Rectangle { width: 100; height: 100; color: "black" }
+}
diff --git a/tests/auto/quick/qquickgridview/data/gridview3.qml b/tests/auto/quick/qquickgridview/data/gridview3.qml
new file mode 100644
index 0000000000..a8c1c5a0f7
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/gridview3.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+GridView {
+ anchors.fill: parent
+ width: 320; height: 200
+}
diff --git a/tests/auto/quick/qquickgridview/data/gridview4.qml b/tests/auto/quick/qquickgridview/data/gridview4.qml
new file mode 100644
index 0000000000..eed3a2bdb1
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/gridview4.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+GridView {
+ width: 405
+ height: 200
+ cellWidth: width/9
+ cellHeight: height/2
+
+ model: 18
+ delegate: Rectangle { objectName: "delegate"; width: 10; height: 10; color: "green" }
+}
diff --git a/tests/auto/quick/qquickgridview/data/header.qml b/tests/auto/quick/qquickgridview/data/header.qml
new file mode 100644
index 0000000000..648e2a2298
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/header.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Rectangle {
+ function changeHeader() {
+ grid.header = header2
+ }
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.color: "blue"
+ Text {
+ text: index
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ GridView {
+ id: grid
+ objectName: "grid"
+ width: initialViewWidth
+ height: initialViewHeight
+ cellWidth: 80
+ cellHeight: 60
+ model: testModel
+ delegate: myDelegate
+ header: Text { objectName: "header"; text: "Header " + x + "," + y; width: 100; height: 30 }
+ }
+
+ Component {
+ id: header2
+ Text { objectName: "header2"; text: "Header 2 " + x + "," + y; width: 50; height: 20 }
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/headerfooter.qml b/tests/auto/quick/qquickgridview/data/headerfooter.qml
new file mode 100644
index 0000000000..a1f31ea224
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/headerfooter.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+GridView {
+ id: view
+
+ width: 240
+ height: 320
+
+ model: testModel
+
+ header: Rectangle {
+ objectName: "header"
+ width: flow == GridView.TopToBottom ? 20 : view.width
+ height: flow == GridView.TopToBottom ? view.height : 20
+ color: "red"
+ }
+ footer: Rectangle {
+ objectName: "footer"
+ width: flow == GridView.TopToBottom ? 30 : view.width
+ height: flow == GridView.TopToBottom ? view.height : 30
+ color: "blue"
+ }
+
+ cellWidth: 80;
+ cellHeight: 60;
+
+ delegate: Rectangle {
+ width: 80; height: 60
+ border.width: 1
+ Text { text: index + "(" + parent.x + "," + parent.y + ")" }
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/initialZValues.qml b/tests/auto/quick/qquickgridview/data/initialZValues.qml
new file mode 100644
index 0000000000..9768b2c695
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/initialZValues.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+
+ GridView {
+ id: grid
+
+ property real initialZ: 342
+
+ anchors.fill: parent
+ objectName: "grid"
+ model: ListModel {}
+
+ delegate: Text {
+ objectName: "wrapper"
+ font.pointSize: 20
+ text: index
+ }
+
+ header: Rectangle {
+ width: 240
+ height: 30
+ z: grid.initialZ
+ }
+
+ footer: Rectangle {
+ width: 240
+ height: 30
+ z: grid.initialZ
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickgridview/data/layouts.qml b/tests/auto/quick/qquickgridview/data/layouts.qml
new file mode 100644
index 0000000000..1ae0606a0f
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/layouts.qml
@@ -0,0 +1,67 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 320
+
+ property bool showHeader: false
+ property bool showFooter: false
+ property bool enforceRange: false
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Text { text: index }
+ Text {
+ x: 30
+ text: wrapper.x + ", " + wrapper.y
+ font.pixelSize: 12
+ }
+ Text {
+ y: 20
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ y: 40
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+
+ property string theName: name
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ Component {
+ id: headerFooter
+ Rectangle { width: 30; height: 30; color: "blue" }
+ }
+
+ GridView {
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom
+ layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
+ verticalLayoutDirection: (testBottomToTop == true) ? GridView.BottomToTop : GridView.TopToBottom
+ highlightRangeMode: enforceRange ? GridView.StrictlyEnforceRange : GridView.NoHighlightRange
+ preferredHighlightBegin: enforceRange ? 120 : 0
+ preferredHighlightEnd: enforceRange ? 120 : 0
+ model: testModel
+ delegate: myDelegate
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/manual-highlight.qml b/tests/auto/quick/qquickgridview/data/manual-highlight.qml
new file mode 100644
index 0000000000..c2f1d20fb1
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/manual-highlight.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Item {
+
+ ListModel {
+ id: model
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bob Brown"
+ number: "555 5845"
+ }
+ }
+
+ Component {
+ id: highlight
+ Rectangle {
+ objectName: "highlight"
+ width: 80; height: 80
+ color: "lightsteelblue"; radius: 5
+ y: grid.currentItem.y+5
+ x: grid.currentItem.x+5
+ }
+ }
+
+ GridView {
+ id: grid
+ objectName: "grid"
+ anchors.fill: parent
+ model: model
+ delegate: Text { objectName: "wrapper"; text: name; width: 80; height: 80 }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+ }
+
+}
diff --git a/tests/auto/quick/qquickgridview/data/margins.qml b/tests/auto/quick/qquickgridview/data/margins.qml
new file mode 100644
index 0000000000..e2ee6d6ac6
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/margins.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 100
+ height: 80
+ border.color: "blue"
+ property string name: model.name
+ Text {
+ text: index
+ }
+ Text {
+ x: 40
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ y: 20
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ y: 40
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ GridView {
+ id: grid
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 100
+ cellHeight: 80
+ cacheBuffer: 0
+ leftMargin: 30
+ rightMargin: 50
+ flow: GridView.TopToBottom
+ layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
+ model: testModel
+ delegate: myDelegate
+ }
+ Text { anchors.bottom: parent.bottom; text: grid.contentX }
+}
diff --git a/tests/auto/quick/qquickgridview/data/mirroring.qml b/tests/auto/quick/qquickgridview/data/mirroring.qml
new file mode 100644
index 0000000000..b9aff501c1
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/mirroring.qml
@@ -0,0 +1,43 @@
+// This example demonstrates how item positioning
+// changes in right-to-left layout direction
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "lightgray"
+ width: 340
+ height: 370
+
+ VisualItemModel {
+ id: itemModel
+ objectName: "itemModel"
+ Rectangle {
+ objectName: "item1"
+ height: 110; width: 120; color: "#FFFEF0"
+ Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: 130; width: 150; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item3"
+ height: 170; width: 190; color: "#F4F0FF"
+ Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ GridView {
+ id: view
+ objectName: "view"
+ cellWidth: 190
+ cellHeight: 170
+ anchors.fill: parent
+ anchors.bottomMargin: 30
+ model: itemModel
+ highlightRangeMode: "StrictlyEnforceRange"
+ flow: GridView.TopToBottom
+ flickDeceleration: 2000
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/moveTransitions.qml b/tests/auto/quick/qquickgridview/data/moveTransitions.qml
new file mode 100644
index 0000000000..8850b46c12
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/moveTransitions.qml
@@ -0,0 +1,144 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == targetItems_transitionVia)
+ model_targetItems_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == displacedItems_transitionVia)
+ model_displacedItems_transitionVia.addItem(name, "")
+ }
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var targetTrans_items: new Object()
+ property var targetTrans_targetIndexes: new Array()
+ property var targetTrans_targetItems: new Array()
+
+ property var displacedTrans_items: new Object()
+ property var displacedTrans_targetIndexes: new Array()
+ property var displacedTrans_targetItems: new Array()
+
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ anchors.centerIn: parent
+ model: testModel
+ delegate: myDelegate
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ move: Transition {
+ id: targetTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.targetTrans_items[targetTransition.ViewTransition.item.nameData] = targetTransition.ViewTransition.index
+ grid.targetTrans_targetIndexes.push(targetTransition.ViewTransition.targetIndexes)
+ grid.targetTrans_targetItems.push(grid.copyList(targetTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: targetItems_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: targetItems_transitionVia.y; duration: root.duration }
+ }
+
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: grid.targetTransitionsDone += 1 }
+ }
+ }
+
+ moveDisplaced: Transition {
+ id: displaced
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.displacedTrans_items[displaced.ViewTransition.item.nameData] = displaced.ViewTransition.index
+ grid.displacedTrans_targetIndexes.push(displaced.ViewTransition.targetIndexes)
+ grid.displacedTrans_targetItems.push(grid.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ properties: "x"; duration: root.duration
+ to: displacedItems_transitionVia.x
+ }
+ NumberAnimation {
+ properties: "y"; duration: root.duration
+ to: displacedItems_transitionVia.y
+ }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: grid.displaceTransitionsDone += 1 }
+ }
+
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 10000 }
+ }
+}
+
+
diff --git a/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml
new file mode 100644
index 0000000000..973f0ac48a
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/multipleDisplaced.qml
@@ -0,0 +1,82 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property var displaceTransitionsStarted: new Object()
+ property bool displaceTransitionsDone: false
+
+ objectName: "grid"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ cellWidth: 80
+ cellHeight: 60
+ model: testModel
+ delegate: myDelegate
+
+ displaced: Transition {
+ id: transition
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ var name = transition.ViewTransition.item.nameData
+ if (grid.displaceTransitionsStarted[name] == undefined)
+ grid.displaceTransitionsStarted[name] = 0
+ grid.displaceTransitionsStarted[name] += 1
+ }
+ }
+ NumberAnimation {
+ properties: "x,y"
+ duration: root.duration
+ easing.type: Easing.OutBounce
+ easing.amplitude: 10.0 // longer-lasting bounce to trigger bug
+ }
+ PropertyAction { target: grid; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+}
+
diff --git a/tests/auto/quick/qquickgridview/data/multipleTransitions.qml b/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
new file mode 100644
index 0000000000..8112fea22d
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
@@ -0,0 +1,156 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ // time to pause between each add, remove, etc.
+ // (obviously, must be less than 'duration' value to actually test that
+ // interrupting transitions will still produce the correct result)
+ property int timeBetweenActions: duration / 2
+
+ property int duration: 100
+
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property bool populateDone
+
+ property bool runningAddTargets: false
+ property bool runningAddDisplaced: false
+ property bool runningMoveTargets: false
+ property bool runningMoveDisplaced: false
+ property bool runningRemoveTargets: false
+ property bool runningRemoveDisplaced: false
+
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ anchors.centerIn: parent
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ add: Transition {
+ id: addTargets
+ enabled: enableAddTransitions
+ SequentialAnimation {
+ ScriptAction { script: grid.runningAddTargets = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: addTargets_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: addTargets_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: grid.runningAddTargets = false }
+ }
+ }
+
+ addDisplaced: Transition {
+ id: addDisplaced
+ enabled: enableAddTransitions
+ SequentialAnimation {
+ ScriptAction { script: grid.runningAddDisplaced = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: addDisplaced_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: addDisplaced_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: grid.runningAddDisplaced = false }
+ }
+ }
+
+ move: Transition {
+ id: moveTargets
+ enabled: enableMoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: grid.runningMoveTargets = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: moveTargets_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: moveTargets_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: grid.runningMoveTargets = false }
+ }
+ }
+
+ moveDisplaced: Transition {
+ id: moveDisplaced
+ enabled: enableMoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: grid.runningMoveDisplaced = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: moveDisplaced_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: moveDisplaced_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: grid.runningMoveDisplaced = false }
+ }
+ }
+
+ remove: Transition {
+ id: removeTargets
+ enabled: enableRemoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: grid.runningRemoveTargets = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: removeTargets_transitionTo.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: removeTargets_transitionTo.y; duration: root.duration }
+ }
+ ScriptAction { script: grid.runningRemoveTargets = false }
+ }
+ }
+
+ removeDisplaced: Transition {
+ id: removeDisplaced
+ enabled: enableRemoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: grid.runningRemoveDisplaced = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: removeDisplaced_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: removeDisplaced_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: grid.runningRemoveDisplaced = false }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 100000 }
+ }
+}
+
+
+
diff --git a/tests/auto/quick/qquickgridview/data/populateTransitions.qml b/tests/auto/quick/qquickgridview/data/populateTransitions.qml
new file mode 100644
index 0000000000..9060a4bc1e
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/populateTransitions.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == transitionFrom)
+ model_transitionFrom.addItem(name, "")
+ if (Qt.point(x, y) == transitionVia)
+ model_transitionVia.addItem(name, "")
+ }
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property int countPopulateTransitions
+ property int countAddTransitions
+
+ objectName: "grid"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ populate: usePopulateTransition ? popTransition : null
+
+ add: Transition {
+ SequentialAnimation {
+ ScriptAction { script: grid.countAddTransitions += 1 }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ }
+ }
+ }
+
+ Transition {
+ id: popTransition
+ SequentialAnimation {
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: transitionFrom.x; to: transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: transitionFrom.y; to: transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ ScriptAction { script: grid.countPopulateTransitions += 1 }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Component.onCompleted: {
+ if (dynamicallyPopulate) {
+ for (var i=0; i<30; i++)
+ testModel.addItem("item " + i, "")
+ }
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 100000 }
+ }
+}
+
+
diff --git a/tests/auto/quick/qquickgridview/data/propertychangestest.qml b/tests/auto/quick/qquickgridview/data/propertychangestest.qml
new file mode 100644
index 0000000000..97efbe78f5
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/propertychangestest.qml
@@ -0,0 +1,69 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 360; height: 120; color: "white"
+ Component {
+ id: delegate
+ Item {
+ id: wrapper
+ width: 180; height: 40;
+ Column {
+ x: 5; y: 5
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+ Component {
+ id: highlightRed
+ Rectangle {
+ color: "red"
+ radius: 10
+ opacity: 0.5
+ }
+ }
+ GridView {
+ cellWidth:180
+ cellHeight:40
+ objectName: "gridView"
+ anchors.fill: parent
+ model: listModel
+ delegate: delegate
+ highlight: highlightRed
+ focus: true
+ keyNavigationWraps: true
+ cacheBuffer: 10
+ flow: GridView.LeftToRight
+ }
+
+ data:[
+ ListModel {
+ id: listModel
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ },
+ ListModel {
+ objectName: "alternateModel"
+ ListElement {
+ name: "Jack"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Mary"
+ number: "555 3264"
+ }
+ }
+ ]
+}
+
+
diff --git a/tests/auto/quick/qquickgridview/data/removeTransitions.qml b/tests/auto/quick/qquickgridview/data/removeTransitions.qml
new file mode 100644
index 0000000000..ec9156d651
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/removeTransitions.qml
@@ -0,0 +1,147 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: grid.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ Text {
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == targetItems_transitionTo) {
+ model_targetItems_transitionTo.addItem(nameData, "") // name is invalid once model removes the item
+ }
+ if (Qt.point(x, y) == displacedItems_transitionVia) {
+ model_displacedItems_transitionVia.addItem(name, "")
+ }
+ }
+ }
+ }
+
+ GridView {
+ id: grid
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var targetTrans_items: new Object()
+ property var targetTrans_targetIndexes: new Array()
+ property var targetTrans_targetItems: new Array()
+
+ property var displacedTrans_items: new Object()
+ property var displacedTrans_targetIndexes: new Array()
+ property var displacedTrans_targetItems: new Array()
+
+ objectName: "grid"
+ width: 240
+ height: 320
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ anchors.centerIn: parent
+ model: testModel
+ delegate: myDelegate
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ remove: Transition {
+ id: targetTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.targetTrans_items[targetTransition.ViewTransition.item.nameData] = targetTransition.ViewTransition.index
+ grid.targetTrans_targetIndexes.push(targetTransition.ViewTransition.targetIndexes)
+ grid.targetTrans_targetItems.push(grid.copyList(targetTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: targetItems_transitionTo.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: targetItems_transitionTo.y; duration: root.duration }
+ }
+ ScriptAction { script: grid.targetTransitionsDone += 1 }
+
+ // delay deleting this item so that it stays valid for the tests
+ // (this doesn't delay the test itself)
+ PauseAnimation { duration: 10000 }
+ }
+ }
+
+ removeDisplaced: Transition {
+ id: displaced
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ grid.displacedTrans_items[displaced.ViewTransition.item.nameData] = displaced.ViewTransition.index
+ grid.displacedTrans_targetIndexes.push(displaced.ViewTransition.targetIndexes)
+ grid.displacedTrans_targetItems.push(grid.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ properties: "x"; duration: root.duration
+ to: displacedItems_transitionVia.x
+ }
+ NumberAnimation {
+ properties: "y"; duration: root.duration
+ to: displacedItems_transitionVia.y
+ }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: grid.displaceTransitionsDone += 1 }
+ }
+
+ }
+ }
+
+ Rectangle {
+ anchors.fill: grid
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 10000 }
+ }
+}
+
+
diff --git a/tests/auto/quick/qquickgridview/data/resizegrid.qml b/tests/auto/quick/qquickgridview/data/resizegrid.qml
new file mode 100644
index 0000000000..7ea2f120e8
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/resizegrid.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ Text { text: index }
+ Text {
+ x: 30
+ text: wrapper.x + ", " + wrapper.y
+ font.pixelSize: 12
+ }
+ Text {
+ y: 20
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ // the grid is specifically placed inside another item to test a bug where
+ // resizing from anchor changes did not update the content pos correctly
+ Item {
+ anchors.fill: parent
+
+ GridView {
+ clip: true
+ objectName: "grid"
+ anchors.fill: parent
+ cellWidth: 80
+ cellHeight: 60
+
+ flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom
+ layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
+ verticalLayoutDirection: (testBottomToTop == true) ? GridView.BottomToTop : GridView.TopToBottom
+ model: testModel
+ delegate: myDelegate
+ }
+
+ }
+}
+
diff --git a/tests/auto/quick/qquickgridview/data/resizeview.qml b/tests/auto/quick/qquickgridview/data/resizeview.qml
new file mode 100644
index 0000000000..eb7fb49245
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/resizeview.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 240
+ height: 320
+
+ GridView {
+ id: grid
+ objectName: "grid"
+ width: initialWidth
+ height: initialHeight
+ cellWidth: 80
+ cellHeight: 60
+ cacheBuffer: 0
+ model: testModel
+ delegate: Rectangle {
+ objectName: "wrapper"
+ width: 80
+ height: 60
+ border.width: 1
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickgridview/data/setindex.qml b/tests/auto/quick/qquickgridview/data/setindex.qml
new file mode 100644
index 0000000000..ef80f3a2fb
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/setindex.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+ Component {
+ id: appDelegate
+
+ Item {
+ id : wrapper
+ function startupFunction() {
+ if (index == 5) view.currentIndex = index;
+ }
+ Component.onCompleted: startupFunction();
+ width: 30; height: 30
+ Text { text: index }
+ }
+ }
+
+ GridView {
+ id: view
+ objectName: "grid"
+ anchors.fill: parent
+ cellWidth: 30; cellHeight: 30
+ model: 35
+ delegate: appDelegate
+ focus: true
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/snapOneRow.qml b/tests/auto/quick/qquickgridview/data/snapOneRow.qml
new file mode 100644
index 0000000000..597c5efa9c
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/snapOneRow.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 240
+ color: "#ffffff"
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 120
+ width: 120
+ Column {
+ Text {
+ text: index
+ }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "transparent"
+ }
+ }
+ GridView {
+ id: grid
+ objectName: "grid"
+ anchors.fill: parent
+ cellWidth: 120
+ cellHeight: 120
+ preferredHighlightBegin: 20
+ preferredHighlightEnd: 140
+ snapMode: GridView.SnapOneRow
+ layoutDirection: Qt.RightToLeft
+ flow: GridView.TopToBottom
+ highlightRangeMode: GridView.StrictlyEnforceRange
+ highlight: Rectangle { width: 120; height: 120; color: "yellow" }
+ model: 8
+ delegate: myDelegate
+ }
+
+ Text {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ text: grid.contentX + ", " + grid.contentY
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/snapToRow.qml b/tests/auto/quick/qquickgridview/data/snapToRow.qml
new file mode 100644
index 0000000000..e3963b0c4a
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/snapToRow.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 240
+ color: "#ffffff"
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 80
+ width: 80
+ Column {
+ Text {
+ text: index
+ }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ }
+ color: GridView.isCurrentItem ? "lightsteelblue" : "transparent"
+ }
+ }
+ GridView {
+ id: grid
+ objectName: "grid"
+ anchors.fill: parent
+ cellWidth: 80
+ cellHeight: 80
+ preferredHighlightBegin: 20
+ preferredHighlightEnd: 100
+ snapMode: GridView.SnapToRow
+ layoutDirection: Qt.RightToLeft
+ flow: GridView.TopToBottom
+ highlightRangeMode: GridView.StrictlyEnforceRange
+ highlight: Rectangle { width: 80; height: 80; color: "yellow" }
+ model: 39
+ delegate: myDelegate
+ }
+
+ Text {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ text: grid.contentX + ", " + grid.contentY
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/data/unaligned.qml b/tests/auto/quick/qquickgridview/data/unaligned.qml
new file mode 100644
index 0000000000..445400e8b4
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/unaligned.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+GridView {
+ width: 400
+ height: 200
+ cellWidth: width/9
+ cellHeight: height/2
+
+ model: testModel
+ delegate: Rectangle {
+ objectName: "wrapper"; width: 10; height: 10; color: "green"
+ Text { text: index }
+ }
+}
+
diff --git a/tests/auto/quick/qquickgridview/data/unrequestedItems.qml b/tests/auto/quick/qquickgridview/data/unrequestedItems.qml
new file mode 100644
index 0000000000..bedb90b849
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/unrequestedItems.qml
@@ -0,0 +1,73 @@
+import QtQuick 2.0
+
+Item {
+ width: 240
+ height: 320
+
+ Component {
+ id: myDelegate
+
+ Package {
+ Rectangle {
+ id: leftWrapper
+ objectName: "wrapper"
+ Package.name: "left"
+ height: 80
+ width: 60
+ Column {
+ Text { text: index }
+ Text { text: name }
+ Text { text: leftWrapper.x + ", " + leftWrapper.y }
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ Rectangle {
+ id: rightWrapper
+ objectName: "wrapper"
+ Package.name: "right"
+ height: 80
+ width: 60
+ Column {
+ Text { text: index }
+ Text { text: name }
+ Text { text: rightWrapper.x + ", " + rightWrapper.y }
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ }
+
+ VisualDataModel {
+ id: visualModel
+
+ delegate: myDelegate
+ model: testModel
+ }
+
+ GridView {
+ id: leftList
+ objectName: "leftGrid"
+ anchors {
+ left: parent.left; top: parent.top;
+ right: parent.horizontalCenter; bottom: parent.bottom
+ }
+ model: visualModel.parts.left
+ cellWidth: 60
+ cellHeight: 80
+ cacheBuffer: 0
+ }
+
+ GridView {
+ id: rightList
+ objectName: "rightGrid"
+ anchors {
+ left: parent.horizontalCenter; top: parent.top;
+ right: parent.right; bottom: parent.bottom
+ }
+ model: visualModel.parts.right
+ cellWidth: 60
+ cellHeight: 80
+ cacheBuffer: 0
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/qquickgridview.pro b/tests/auto/quick/qquickgridview/qquickgridview.pro
new file mode 100644
index 0000000000..dd69cda49e
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/qquickgridview.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+testcase.timeout = 1100 # this test can be slow
+TARGET = tst_qquickgridview
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickgridview.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+mac:CONFIG+=insignificant_test # QTBUG-27890
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
new file mode 100644
index 0000000000..0c9788ab8e
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -0,0 +1,6292 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/qstringlistmodel.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlincubator.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickgridview_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
+#include "../../shared/util.h"
+#include "../shared/viewtestutil.h"
+#include "../shared/visualtestutil.h"
+#include <QtGui/qguiapplication.h>
+#include "qplatformdefs.h"
+
+Q_DECLARE_METATYPE(QQuickGridView::Flow)
+Q_DECLARE_METATYPE(Qt::LayoutDirection)
+Q_DECLARE_METATYPE(QQuickItemView::VerticalLayoutDirection)
+Q_DECLARE_METATYPE(QQuickItemView::PositionMode)
+Q_DECLARE_METATYPE(Qt::Key)
+
+using namespace QQuickViewTestUtil;
+using namespace QQuickVisualTestUtil;
+
+#define SHARE_VIEWS
+
+class tst_QQuickGridView : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickGridView();
+
+private slots:
+ void init();
+ void cleanupTestCase();
+ void items();
+ void changed();
+ void inserted_basic();
+ void inserted_defaultLayout(QQuickGridView::Flow flow = QQuickGridView::FlowLeftToRight, Qt::LayoutDirection horizLayout = Qt::LeftToRight, QQuickItemView::VerticalLayoutDirection verticalLayout = QQuickItemView::TopToBottom);
+ void inserted_defaultLayout_data();
+ void insertBeforeVisible();
+ void insertBeforeVisible_data();
+ void removed_basic();
+ void removed_defaultLayout(QQuickGridView::Flow flow = QQuickGridView::FlowLeftToRight, Qt::LayoutDirection horizLayout = Qt::LeftToRight, QQuickItemView::VerticalLayoutDirection verticalLayout = QQuickItemView::TopToBottom);
+ void removed_defaultLayout_data();
+ void addOrRemoveBeforeVisible();
+ void addOrRemoveBeforeVisible_data();
+ void clear();
+ void moved_defaultLayout(QQuickGridView::Flow flow = QQuickGridView::FlowLeftToRight, Qt::LayoutDirection horizLayout = Qt::LeftToRight, QQuickItemView::VerticalLayoutDirection verticalLayout = QQuickItemView::TopToBottom);
+ void moved_defaultLayout_data();
+ void multipleChanges_condensed() { multipleChanges(true); }
+ void multipleChanges_condensed_data() { multipleChanges_data(); }
+ void multipleChanges_uncondensed() { multipleChanges(false); }
+ void multipleChanges_uncondensed_data() { multipleChanges_data(); }
+ void swapWithFirstItem();
+ void changeFlow();
+ void currentIndex();
+ void noCurrentIndex();
+ void keyNavigation();
+ void keyNavigation_data();
+ void defaultValues();
+ void properties();
+ void propertyChanges();
+ void componentChanges();
+ void modelChanges();
+ void positionViewAtBeginningEnd();
+ void positionViewAtIndex();
+ void positionViewAtIndex_data();
+ void mirroring();
+ void snapping();
+ void resetModel();
+ void enforceRange();
+ void enforceRange_rightToLeft();
+ void QTBUG_8456();
+ void manualHighlight();
+ void footer();
+ void footer_data();
+ void initialZValues();
+ void header();
+ void header_data();
+ void extents();
+ void extents_data();
+ void resetModel_headerFooter();
+ void resizeViewAndRepaint();
+ void resizeGrid();
+ void resizeGrid_data();
+ void changeColumnCount();
+ void indexAt_itemAt_data();
+ void indexAt_itemAt();
+ void onAdd();
+ void onAdd_data();
+ void onRemove();
+ void onRemove_data();
+ void columnCount();
+ void margins();
+ void creationContext();
+ void snapToRow_data();
+ void snapToRow();
+ void snapOneRow_data();
+ void snapOneRow();
+ void unaligned();
+ void cacheBuffer();
+ void asynchronous();
+ void unrequestedVisibility();
+
+ void populateTransitions();
+ void populateTransitions_data();
+ void addTransitions();
+ void addTransitions_data();
+ void moveTransitions();
+ void moveTransitions_data();
+ void removeTransitions();
+ void removeTransitions_data();
+ void displacedTransitions();
+ void displacedTransitions_data();
+ void multipleTransitions();
+ void multipleTransitions_data();
+ void multipleDisplaced();
+
+ void inserted_leftToRight_RtL_TtB();
+ void inserted_leftToRight_RtL_TtB_data();
+ void inserted_leftToRight_LtR_BtT();
+ void inserted_leftToRight_LtR_BtT_data();
+ void inserted_leftToRight_RtL_BtT();
+ void inserted_leftToRight_RtL_BtT_data();
+ void inserted_topToBottom_LtR_TtB();
+ void inserted_topToBottom_LtR_TtB_data();
+ void inserted_topToBottom_RtL_TtB();
+ void inserted_topToBottom_RtL_TtB_data();
+ void inserted_topToBottom_LtR_BtT();
+ void inserted_topToBottom_LtR_BtT_data();
+ void inserted_topToBottom_RtL_BtT();
+ void inserted_topToBottom_RtL_BtT_data();
+
+ void removed_leftToRight_RtL_TtB();
+ void removed_leftToRight_RtL_TtB_data();
+ void removed_leftToRight_LtR_BtT();
+ void removed_leftToRight_LtR_BtT_data();
+ void removed_leftToRight_RtL_BtT();
+ void removed_leftToRight_RtL_BtT_data();
+ void removed_topToBottom_LtR_TtB();
+ void removed_topToBottom_LtR_TtB_data();
+ void removed_topToBottom_RtL_TtB();
+ void removed_topToBottom_RtL_TtB_data();
+ void removed_topToBottom_LtR_BtT();
+ void removed_topToBottom_LtR_BtT_data();
+ void removed_topToBottom_RtL_BtT();
+ void removed_topToBottom_RtL_BtT_data();
+
+ void moved_leftToRight_RtL_TtB();
+ void moved_leftToRight_RtL_TtB_data();
+ void moved_leftToRight_LtR_BtT();
+ void moved_leftToRight_LtR_BtT_data();
+ void moved_leftToRight_RtL_BtT();
+ void moved_leftToRight_RtL_BtT_data();
+ void moved_topToBottom_LtR_TtB();
+ void moved_topToBottom_LtR_TtB_data();
+ void moved_topToBottom_RtL_TtB();
+ void moved_topToBottom_RtL_TtB_data();
+ void moved_topToBottom_LtR_BtT();
+ void moved_topToBottom_LtR_BtT_data();
+ void moved_topToBottom_RtL_BtT();
+ void moved_topToBottom_RtL_BtT_data();
+
+private:
+ QList<int> toIntList(const QVariantList &list);
+ void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes);
+ void matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes);
+ void matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems);
+
+ void multipleChanges(bool condensed);
+ void multipleChanges_data();
+
+ QPointF expectedItemPos(QQuickGridView *grid, int index, qreal rowOffset = 0) {
+ qreal x;
+ qreal y;
+ if (grid->flow() == QQuickGridView::FlowLeftToRight) {
+ int columns = grid->width() / grid->cellWidth();
+ x = (index % columns) * grid->cellWidth();
+ y = (index / columns) * grid->cellHeight();
+ if (grid->effectiveLayoutDirection() == Qt::RightToLeft) {
+ int col = (index % columns) * grid->cellWidth();
+ x = grid->cellWidth() * (columns - 1) - col;
+ }
+
+ qreal offset = grid->cellHeight() * rowOffset;
+ if (grid->verticalLayoutDirection() == QQuickItemView::TopToBottom)
+ y += offset;
+ else
+ y = -grid->cellHeight() - y - offset;
+ } else {
+ int rows = grid->height() / grid->cellHeight();
+ x = (index / rows) * grid->cellWidth();
+ y = (index % rows) * grid->cellHeight();
+ if (grid->effectiveLayoutDirection() == Qt::RightToLeft)
+ x = -x - grid->cellWidth();
+
+ qreal offset = grid->cellWidth() * rowOffset;
+ if (grid->effectiveLayoutDirection() == Qt::RightToLeft)
+ x -= offset;
+ else
+ x += offset;
+ if (grid->verticalLayoutDirection() == QQuickItemView::BottomToTop)
+ y = -grid->cellHeight() - y;
+ }
+ return QPointF(x, y);
+ }
+
+ // Sets contentY (or contentX in TopToBottom flow) according to given row offset
+ // (in LeftToRight flow) or col offset (in TopToBottom).
+ bool setContentPos(QQuickGridView *gridview, qreal rowOrColOffset) {
+ bool contentPosChanged = (rowOrColOffset != 0);
+ qreal contentOffset = gridview->flow() == QQuickGridView::FlowLeftToRight
+ ? rowOrColOffset * gridview->cellHeight()
+ : rowOrColOffset * gridview->cellWidth();
+
+ if (gridview->flow() == QQuickGridView::FlowLeftToRight) {
+ if (gridview->verticalLayoutDirection() == QQuickItemView::BottomToTop)
+ contentOffset = -gridview->height() - contentOffset;
+ } else {
+ if (gridview->effectiveLayoutDirection() == Qt::RightToLeft)
+ contentOffset = -gridview->width() - contentOffset;
+ }
+ if (gridview->flow() == QQuickGridView::FlowLeftToRight)
+ gridview->setContentY(contentOffset);
+ else
+ gridview->setContentX(contentOffset);
+ return contentPosChanged;
+ }
+
+#ifdef SHARE_VIEWS
+ QQuickView *getView() {
+ if (m_view) {
+ if (QString(QTest::currentTestFunction()) != testForView) {
+ delete m_view;
+ m_view = 0;
+ } else {
+ m_view->setSource(QUrl());
+ return m_view;
+ }
+ }
+
+ testForView = QTest::currentTestFunction();
+ m_view = createView();
+ return m_view;
+ }
+ void releaseView(QQuickView *view) {
+ Q_ASSERT(view == m_view);
+ Q_UNUSED(view)
+ m_view->setSource(QUrl());
+ }
+#else
+ QQuickView *getView() {
+ return createView();
+ }
+ void releaseView(QQuickView *view) {
+ delete view;
+ }
+#endif
+
+ QQuickView *m_view;
+ QString testForView;
+};
+
+tst_QQuickGridView::tst_QQuickGridView() : m_view(0)
+{
+}
+
+void tst_QQuickGridView::init()
+{
+#ifdef SHARE_VIEWS
+ if (m_view && QString(QTest::currentTestFunction()) != testForView) {
+ testForView = QString();
+ delete m_view;
+ m_view = 0;
+ }
+#endif
+}
+
+void tst_QQuickGridView::cleanupTestCase()
+{
+#ifdef SHARE_VIEWS
+ testForView = QString();
+ delete m_view;
+ m_view = 0;
+#endif
+}
+
+void tst_QQuickGridView::items()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Billy", "22345");
+ model.addItem("Sam", "2945");
+ model.addItem("Ben", "04321");
+ model.addItem("Jim", "0780");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("gridview1.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(gridview->count(), model.count());
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
+
+ for (int i = 0; i < model.count(); ++i) {
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ // set an empty model and confirm that items are destroyed
+ QaimModel model2;
+ ctxt->setContextProperty("testModel", &model2);
+
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ QTRY_VERIFY(itemCount == 0);
+
+ delete window;
+}
+
+void tst_QQuickGridView::changed()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Billy", "22345");
+ model.addItem("Sam", "2945");
+ model.addItem("Ben", "04321");
+ model.addItem("Jim", "0780");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("gridview1.qml"));
+ qApp->processEvents();
+
+ QQuickFlickable *gridview = findItem<QQuickFlickable>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ model.modifyItem(1, "Will", "9876");
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(1));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(1));
+
+ delete window;
+}
+
+void tst_QQuickGridView::inserted_basic()
+{
+ QQuickView *window = createView();
+ window->show();
+
+ QaimModel model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ model.insertItem(1, "Will", "9876");
+
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(1));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(1));
+
+ // Checks that onAdd is called
+ int added = window->rootObject()->property("added").toInt();
+ QTRY_COMPARE(added, 1);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ }
+
+ model.insertItem(0, "Foo", "1111"); // zero index, and current item
+
+ QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
+
+ name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(0));
+ number = findItem<QQuickText>(contentItem, "textNumber", 0);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(0));
+
+ QTRY_COMPARE(gridview->currentIndex(), 1);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item->x() == (i%3)*80);
+ QTRY_VERIFY(item->y() == (i/3)*60);
+ }
+
+ for (int i = model.count(); i < 30; ++i)
+ model.insertItem(i, "Hello", QString::number(i));
+
+ gridview->setContentY(120);
+
+ // Insert item outside visible area
+ model.insertItem(1, "Hello", "1324");
+
+ QTRY_VERIFY(gridview->contentY() == 120);
+
+ delete window;
+}
+
+void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow,
+ Qt::LayoutDirection horizLayout,
+ QQuickItemView::VerticalLayoutDirection verticalLayout)
+{
+ QFETCH(qreal, contentYRowOffset);
+ QFETCH(int, insertIndex);
+ QFETCH(int, insertCount);
+ QFETCH(int, insertIndex_ttb);
+ QFETCH(int, insertCount_ttb);
+ QFETCH(qreal, rowOffsetAfterMove);
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testTopToBottom", flow == QQuickGridView::FlowTopToBottom);
+ ctxt->setContextProperty("testRightToLeft", horizLayout == Qt::RightToLeft);
+ ctxt->setContextProperty("testBottomToTop", verticalLayout == QQuickGridView::BottomToTop);
+ window->setSource(testFileUrl("layouts.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ if (flow == QQuickGridView::FlowTopToBottom) {
+ insertIndex = insertIndex_ttb;
+ insertCount = insertCount_ttb;
+ }
+ if (setContentPos(gridview, contentYRowOffset))
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QList<QPair<QString, QString> > newData;
+ for (int i=0; i<insertCount; i++)
+ newData << qMakePair(QString("value %1").arg(i), QString::number(i));
+ model.insertItems(insertIndex, newData);
+ QTRY_COMPARE(gridview->property("count").toInt(), model.count());
+
+ // check visibleItems.first() is in correct position
+ QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item0);
+ QPointF firstPos(0, 0);
+ if (horizLayout == Qt::RightToLeft)
+ firstPos.rx() = flow == QQuickGridView::FlowLeftToRight ? gridview->width() - gridview->cellWidth() : -gridview->cellWidth();
+ if (verticalLayout == QQuickItemView::BottomToTop)
+ firstPos.ry() -= gridview->cellHeight();
+ QCOMPARE(item0->position(), firstPos);
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (item && delegateVisible(item)) {
+ firstVisibleIndex = i;
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // Confirm items positioned correctly and indexes correct
+ for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::inserted_defaultLayout_data()
+{
+ QTest::addColumn<qreal>("contentYRowOffset");
+ QTest::addColumn<int>("insertIndex");
+ QTest::addColumn<int>("insertCount");
+ QTest::addColumn<int>("insertIndex_ttb");
+ QTest::addColumn<int>("insertCount_ttb");
+ QTest::addColumn<qreal>("rowOffsetAfterMove");
+
+ QTest::newRow("add 1, before visible items")
+ << 2.0 // show 6-23
+ << 5 << 1
+ << 9 << 1
+ << 0.0; // insert 1 above first visible, grid is rearranged; first visible moves forward within its row
+ // new 1st visible item is at 0
+
+ QTest::newRow("add 2, before visible items")
+ << 2.0 // show 6-23
+ << 5 << 2
+ << 9 << 2
+ << 0.0; // insert 2 above first visible, grid is rearranged; first visible moves forward within its row
+
+ QTest::newRow("add 3, before visible items")
+ << 2.0 // show 6-23
+ << 5 << 3
+ << 9 << 5
+ << -1.0; // insert 3 (1 row) above first visible in negative pos, first visible does not move
+
+ QTest::newRow("add 5, before visible items")
+ << 2.0 // show 6-23
+ << 5 << 5
+ << 9 << 7
+ << -1.0; // insert 1 row + 2 items above first visible, 1 row added at negative pos,
+ // grid is rearranged and first visible moves forward within its row
+
+ QTest::newRow("add 6, before visible items")
+ << 2.0 // show 6-23
+ << 5 << 6
+ << 9 << 10
+ << -1.0 * 2; // insert 2 rows above first visible in negative pos, first visible does not move
+
+
+
+ QTest::newRow("add 1, at start of visible, content at start")
+ << 0.0
+ << 0 << 1
+ << 0 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, at start of visible, content at start")
+ << 0.0
+ << 0 << 3
+ << 0 << 5
+ << 0.0;
+
+ QTest::newRow("add 1, at start of visible, content not at start")
+ << 2.0 // show 6-23
+ << 6 << 1
+ << 10 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, at start of visible, content not at start")
+ << 2.0 // show 6-23
+ << 6 << 3
+ << 10 << 5
+ << 0.0;
+
+
+ QTest::newRow("add 1, at end of visible, content at start")
+ << 0.0
+ << 17 << 1
+ << 14 << 1
+ << 0.0;
+
+ QTest::newRow("add row, at end of visible, content at start")
+ << 0.0
+ << 17 << 3
+ << 14 << 5
+ << 0.0;
+
+ QTest::newRow("add 1, at end of visible, content not at start")
+ << 2.0 // show 6-23
+ << 17+6 << 1
+ << 14+10 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, at end of visible, content not at start")
+ << 2.0 // show 6-23
+ << 17+6 << 3
+ << 14+10 << 5
+ << 0.0;
+
+
+ QTest::newRow("add 1, after visible, content at start")
+ << 0.0
+ << 20 << 1
+ << 18 << 1
+ << 0.0;
+
+ QTest::newRow("add row, after visible, content at start")
+ << 0.0
+ << 20 << 3
+ << 18 << 5
+ << 0.0;
+
+ QTest::newRow("add 1, after visible, content not at start")
+ << 2.0 // show 6-23
+ << 20+6 << 1
+ << 18+10 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, after visible, content not at start")
+ << 2.0 // show 6-23
+ << 20+6 << 3
+ << 18+10 << 3
+ << 0.0;
+}
+
+void tst_QQuickGridView::insertBeforeVisible()
+{
+ QFETCH(int, insertIndex);
+ QFETCH(int, insertCount);
+ QFETCH(int, cacheBuffer);
+
+ QQuickText *name;
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ gridview->setCacheBuffer(cacheBuffer);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // trigger a refill (not just setting contentY) so that the visibleItems grid is updated
+ int firstVisibleIndex = 12; // move to an index where the top item is not visible
+ gridview->setContentY(firstVisibleIndex/3 * 60.0);
+ gridview->setCurrentIndex(firstVisibleIndex);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QTRY_COMPARE(gridview->currentIndex(), firstVisibleIndex);
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", firstVisibleIndex);
+ QVERIFY(item);
+ QCOMPARE(item->y(), gridview->contentY());
+
+ QList<QPair<QString, QString> > newData;
+ for (int i=0; i<insertCount; i++)
+ newData << qMakePair(QString("value %1").arg(i), QString::number(i));
+ model.insertItems(insertIndex, newData);
+ QTRY_COMPARE(gridview->property("count").toInt(), model.count());
+
+ // now, moving to the top of the view should position the inserted items correctly
+ int itemsOffsetAfterMove = (insertCount / 3) * -60.0;
+ gridview->setCurrentIndex(0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ QTRY_COMPARE(gridview->currentIndex(), 0);
+ QTRY_COMPARE(gridview->contentY(), 0.0 + itemsOffsetAfterMove);
+
+ // Confirm items positioned correctly and indexes correct
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), (i%3)*80.0);
+ QCOMPARE(item->y(), (i/3)*60.0 + itemsOffsetAfterMove);
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::insertBeforeVisible_data()
+{
+ QTest::addColumn<int>("insertIndex");
+ QTest::addColumn<int>("insertCount");
+ QTest::addColumn<int>("cacheBuffer");
+
+ QTest::newRow("insert 1 at 0, 0 buffer") << 0 << 1 << 0;
+ QTest::newRow("insert 1 at 0, 100 buffer") << 0 << 1 << 100;
+ QTest::newRow("insert 1 at 0, 500 buffer") << 0 << 1 << 500;
+
+ QTest::newRow("insert 1 at 1, 0 buffer") << 1 << 1 << 0;
+ QTest::newRow("insert 1 at 1, 100 buffer") << 1 << 1 << 100;
+ QTest::newRow("insert 1 at 1, 500 buffer") << 1 << 1 << 500;
+
+ QTest::newRow("insert multiple at 0, 0 buffer") << 0 << 6 << 0;
+ QTest::newRow("insert multiple at 0, 100 buffer") << 0 << 6 << 100;
+ QTest::newRow("insert multiple at 0, 500 buffer") << 0 << 6 << 500;
+
+ QTest::newRow("insert multiple at 1, 0 buffer") << 1 << 6 << 0;
+ QTest::newRow("insert multiple at 1, 100 buffer") << 1 << 6 << 100;
+ QTest::newRow("insert multiple at 1, 500 buffer") << 1 << 6 << 500;
+}
+
+void tst_QQuickGridView::removed_basic()
+{
+ QQuickView *window = createView();
+ window->show();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ model.removeItem(1);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(1));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(1));
+
+
+ // Checks that onRemove is called
+ QString removed = window->rootObject()->property("removed").toString();
+ QTRY_COMPARE(removed, QString("Item1"));
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item->x() == (i%3)*80);
+ QTRY_VERIFY(item->y() == (i/3)*60);
+ }
+
+ // Remove first item (which is the current item);
+ model.removeItem(0);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(0));
+ number = findItem<QQuickText>(contentItem, "textNumber", 0);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(0));
+
+
+ // Confirm items positioned correctly
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item->x() == (i%3)*80);
+ QTRY_VERIFY(item->y() == (i/3)*60);
+ }
+
+ // Remove items not visible
+ model.removeItem(25);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ // Confirm items positioned correctly
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item->x() == (i%3)*80);
+ QTRY_VERIFY(item->y() == (i/3)*60);
+ }
+
+ // Remove items before visible
+ gridview->setContentY(120);
+ gridview->setCurrentIndex(10);
+
+ // Setting currentIndex above shouldn't cause view to scroll
+ QTRY_COMPARE(gridview->contentY(), 120.0);
+
+ model.removeItem(1);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ // Confirm items positioned correctly
+ for (int i = 6; i < 18; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item->x() == (i%3)*80);
+ QTRY_VERIFY(item->y() == (i/3)*60);
+ }
+
+ // Remove currentIndex
+ QQuickItem *oldCurrent = gridview->currentItem();
+ model.removeItem(9);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ QTRY_COMPARE(gridview->currentIndex(), 9);
+ QTRY_VERIFY(gridview->currentItem() != oldCurrent);
+
+ gridview->setContentY(0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item->x() == (i%3)*80);
+ QTRY_VERIFY(item->y() == (i/3)*60);
+ }
+
+ // remove item outside current view.
+ gridview->setCurrentIndex(32);
+ gridview->setContentY(240);
+
+ model.removeItem(30);
+ QTRY_VERIFY(gridview->currentIndex() == 31);
+
+ // remove current item beyond visible items.
+ gridview->setCurrentIndex(20);
+ gridview->setContentY(0);
+ model.removeItem(20);
+
+ QTRY_COMPARE(gridview->currentIndex(), 20);
+ QTRY_VERIFY(gridview->currentItem() != 0);
+
+ // remove item before current, but visible
+ gridview->setCurrentIndex(8);
+ gridview->setContentY(240);
+ oldCurrent = gridview->currentItem();
+ model.removeItem(6);
+
+ QTRY_COMPARE(gridview->currentIndex(), 7);
+ QTRY_VERIFY(gridview->currentItem() == oldCurrent);
+
+ delete window;
+}
+
+void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow,
+ Qt::LayoutDirection horizLayout,
+ QQuickItemView::VerticalLayoutDirection verticalLayout)
+{
+ QFETCH(qreal, contentYRowOffset);
+ QFETCH(int, removeIndex);
+ QFETCH(int, removeCount);
+ QFETCH(int, removeIndex_ttb);
+ QFETCH(int, removeCount_ttb);
+ QFETCH(qreal, rowOffsetAfterMove);
+ QFETCH(QString, firstVisible);
+ QFETCH(QString, firstVisible_ttb);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testTopToBottom", flow == QQuickGridView::FlowTopToBottom);
+ ctxt->setContextProperty("testRightToLeft", horizLayout == Qt::RightToLeft);
+ ctxt->setContextProperty("testBottomToTop", verticalLayout == QQuickGridView::BottomToTop);
+ window->setSource(testFileUrl("layouts.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ if (flow == QQuickGridView::FlowTopToBottom) {
+ removeIndex = removeIndex_ttb;
+ removeCount = removeCount_ttb;
+ firstVisible = firstVisible_ttb;
+ }
+ if (setContentPos(gridview, contentYRowOffset))
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ model.removeItems(removeIndex, removeCount);
+ QTRY_COMPARE(gridview->property("count").toInt(), model.count());
+
+ QString firstName;
+ int firstVisibleIndex = -1;
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ QRectF viewRect(gridview->contentX(), gridview->contentY(), gridview->width(), gridview->height());
+ for (int i=0; i<items.count(); i++) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (item) {
+ QRectF itemRect(item->x(), item->y(), item->width(), item->height());
+ if (delegateVisible(item) && viewRect.intersects(itemRect)) {
+ firstVisibleIndex = i;
+ QQmlExpression en(qmlContext(item), item, "name");
+ firstName = en.evaluate().toString();
+ break;
+ }
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+ QCOMPARE(firstName, firstVisible);
+
+ // Confirm items positioned correctly and indexes correct
+ for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::removed_defaultLayout_data()
+{
+ QTest::addColumn<qreal>("contentYRowOffset");
+ QTest::addColumn<int>("removeIndex");
+ QTest::addColumn<int>("removeCount");
+ QTest::addColumn<int>("removeIndex_ttb");
+ QTest::addColumn<int>("removeCount_ttb");
+ QTest::addColumn<qreal>("rowOffsetAfterMove");
+ QTest::addColumn<QString>("firstVisible");
+ QTest::addColumn<QString>("firstVisible_ttb");
+
+ QTest::newRow("remove 1, before visible items")
+ << 2.0 // show 6-23
+ << 2 << 1
+ << 4 << 1
+ << 0.0 << "Item7" << "Item11";
+
+ QTest::newRow("remove 1, before visible position")
+ << 2.0 // show 6-23
+ << 3 << 1
+ << 5 << 1
+ << 0.0 << "Item7" << "Item11";
+
+ QTest::newRow("remove multiple (1 row), all before visible items")
+ << 2.0
+ << 1 << 3
+ << 1 << 5
+ << 1.0 << "Item6" << "Item10"; // removed top row, slide down by 1 row
+
+ QTest::newRow("remove multiple, all before visible items, remove item 0")
+ << 2.0
+ << 0 << 4
+ << 0 << 6
+ << 1.0 << "Item7" << "Item11"; // removed top row, slide down by 1 row
+
+ QTest::newRow("remove multiple rows, all before visible items")
+ << 4.0 // show 12-29
+ << 1 << 7
+ << 1 << 12
+ << 2.0 << "Item13" << "Item17";
+
+ QTest::newRow("remove one row before visible, content y not on item border")
+ << 1.5
+ << 0 << 3
+ << 0 << 5
+ << 1.0 << "Item3" << "Item5"; // 1 row removed
+
+ QTest::newRow("remove mix of visible/non-visible")
+ << 2.0 // show 6-23
+ << 2 << 3
+ << 4 << 3
+ << 1.0 << "Item6" << "Item8"; // 1 row removed
+
+
+ // remove 3,4,5 before the visible pos, first row moves down to just before the visible pos,
+ // items 6,7 are removed from view, item 8 slides up to original pos of item 6 (120px)
+ QTest::newRow("remove multiple, mix of items from before and within visible items")
+ << 2.0
+ << 3 << 5
+ << 5 << 7
+ << 1.0 << "Item8" << "Item12"; // adjust for the 1 row removed before the visible
+
+ QTest::newRow("remove multiple, mix of items from before and within visible items, remove item 0")
+ << 2.0
+ << 0 << 8
+ << 0 << 12
+ << 1.0 * 2 << "Item8" << "Item12"; // adjust for the 2 rows removed before the visible
+
+
+ QTest::newRow("remove 1, from start of visible, content at start")
+ << 0.0
+ << 0 << 1
+ << 0 << 1
+ << 0.0 << "Item1" << "Item1";
+
+ QTest::newRow("remove multiple, from start of visible, content at start")
+ << 0.0
+ << 0 << 3
+ << 0 << 5
+ << 0.0 << "Item3" << "Item5";
+
+ QTest::newRow("remove 1, from start of visible, content not at start")
+ << 2.0 // show 6-23
+ << 4 << 1
+ << 7 << 1
+ << 0.0 << "Item7" << "Item11";
+
+ QTest::newRow("remove multiple, from start of visible, content not at start")
+ << 2.0 // show 6-23
+ << 4 << 3
+ << 7 << 5
+ << 0.0 << "Item9" << "Item15";
+
+
+ QTest::newRow("remove 1, from middle of visible, content at start")
+ << 0.0
+ << 10 << 1
+ << 12 << 1
+ << 0.0 << "Item0" << "Item0";
+
+ QTest::newRow("remove multiple, from middle of visible, content at start")
+ << 0.0
+ << 10 << 5
+ << 12 << 5
+ << 0.0 << "Item0" << "Item0";
+
+ QTest::newRow("remove 1, from middle of visible, content not at start")
+ << 2.0 // show 6-23
+ << 10 << 1
+ << 12 << 1
+ << 0.0 << "Item6" << "Item10";
+
+ QTest::newRow("remove multiple, from middle of visible, content not at start")
+ << 2.0 // show 6-23
+ << 10 << 5
+ << 12 << 7
+ << 0.0 << "Item6" << "Item10";
+
+
+ QTest::newRow("remove 1, after visible, content at start")
+ << 0.0
+ << 16 << 1
+ << 15 << 1
+ << 0.0 << "Item0" << "Item0";
+
+ QTest::newRow("remove multiple, after visible, content at start")
+ << 0.0
+ << 16 << 5
+ << 15 << 7
+ << 0.0 << "Item0" << "Item0";
+
+ QTest::newRow("remove 1, after visible, content not at start")
+ << 2.0 // show 6-23
+ << 16+4 << 1
+ << 15+10 << 1
+ << 0.0 << "Item6" << "Item10";
+
+ QTest::newRow("remove multiple, after visible, content not at start")
+ << 2.0 // show 6-23
+ << 16+4 << 5
+ << 15+10 << 7
+ << 0.0 << "Item6" << "Item10";
+
+ QTest::newRow("remove multiple, mix of items from within and after visible items")
+ << 2.0 // show 6-23
+ << 20 << 5
+ << 22 << 7
+ << 0.0 << "Item6" << "Item10";
+}
+
+void tst_QQuickGridView::addOrRemoveBeforeVisible()
+{
+ // QTBUG-21588: ensure re-layout is done on grid after adding or removing
+ // items from before the visible area
+
+ QFETCH(bool, doAdd);
+ QFETCH(qreal, newTopContentY);
+
+ QQuickView *window = getView();
+ window->show();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_COMPARE(name->text(), QString("Item0"));
+
+ gridview->setCurrentIndex(0);
+ qApp->processEvents();
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // scroll down until item 0 is no longer drawn
+ // (bug not triggered if we just move using content y, since that doesn't
+ // refill and change the visible items)
+ gridview->setCurrentIndex(24);
+ qApp->processEvents();
+
+ QTRY_COMPARE(gridview->currentIndex(), 24);
+ QTRY_COMPARE(gridview->contentY(), 220.0);
+
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 0)); // 0 shouldn't be visible
+
+ if (doAdd) {
+ model.insertItem(0, "New Item", "New Item number");
+ QTRY_COMPARE(gridview->count(), 31);
+ } else {
+ model.removeItem(0);
+ QTRY_COMPARE(gridview->count(), 29);
+ }
+
+ // scroll back up and item 0 should be gone
+ gridview->setCurrentIndex(0);
+ qApp->processEvents();
+ QTRY_COMPARE(gridview->currentIndex(), 0);
+ QTRY_COMPARE(gridview->contentY(), newTopContentY);
+
+ name = findItem<QQuickText>(contentItem, "textName", 0);
+ if (doAdd)
+ QCOMPARE(name->text(), QString("New Item"));
+ else
+ QCOMPARE(name->text(), QString("Item1"));
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QTRY_VERIFY(findItem<QQuickItem>(contentItem, "wrapper", i));
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item->x() == (i%3)*80);
+ QTRY_VERIFY(item->y() == (i/3)*60 + newTopContentY);
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::addOrRemoveBeforeVisible_data()
+{
+ QTest::addColumn<bool>("doAdd");
+ QTest::addColumn<qreal>("newTopContentY");
+
+ QTest::newRow("add") << true << -60.0;
+ QTest::newRow("remove") << false << -60.0;
+}
+
+void tst_QQuickGridView::clear()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QVERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ model.clear();
+
+ QVERIFY(gridview->count() == 0);
+ QVERIFY(gridview->currentItem() == 0);
+ QVERIFY(gridview->contentY() == 0);
+ QVERIFY(gridview->currentIndex() == -1);
+ QCOMPARE(gridview->contentHeight(), 0.0);
+
+ // confirm sanity when adding an item to cleared list
+ model.addItem("New", "1");
+ QTRY_COMPARE(gridview->count(), 1);
+ QVERIFY(gridview->currentItem() != 0);
+ QVERIFY(gridview->currentIndex() == 0);
+
+ delete window;
+}
+
+void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow,
+ Qt::LayoutDirection horizLayout,
+ QQuickItemView::VerticalLayoutDirection verticalLayout)
+{
+ QFETCH(qreal, contentYRowOffset);
+ QFETCH(int, from);
+ QFETCH(int, to);
+ QFETCH(int, count);
+ QFETCH(int, from_ttb);
+ QFETCH(int, to_ttb);
+ QFETCH(int, count_ttb);
+ QFETCH(qreal, rowOffsetAfterMove);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testTopToBottom", flow == QQuickGridView::FlowTopToBottom);
+ ctxt->setContextProperty("testRightToLeft", horizLayout == Qt::RightToLeft);
+ ctxt->setContextProperty("testBottomToTop", verticalLayout == QQuickGridView::BottomToTop);
+ window->setSource(testFileUrl("layouts.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QQuickItem *currentItem = gridview->currentItem();
+ QTRY_VERIFY(currentItem != 0);
+
+ if (flow == QQuickGridView::FlowTopToBottom) {
+ from = from_ttb;
+ to = to_ttb;
+ count = count_ttb;
+ }
+ if (setContentPos(gridview, contentYRowOffset))
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ model.moveItems(from, to, count);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // Confirm items positioned correctly and indexes correct
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (item && delegateVisible(item)) {
+ firstVisibleIndex = i;
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item &&
+ ( (flow == QQuickGridView::FlowLeftToRight && i >= firstVisibleIndex + (3*6))
+ || (flow == QQuickGridView::FlowTopToBottom && i >= firstVisibleIndex + (5*3)) ) ) {
+ continue; // index has moved out of view
+ }
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+
+ // current index should have been updated
+ if (item == currentItem)
+ QTRY_COMPARE(gridview->currentIndex(), i);
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::moved_defaultLayout_data()
+{
+ QTest::addColumn<qreal>("contentYRowOffset");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<int>("to");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<int>("from_ttb");
+ QTest::addColumn<int>("to_ttb");
+ QTest::addColumn<int>("count_ttb");
+ QTest::addColumn<qreal>("rowOffsetAfterMove");
+
+ // model starts with 30 items, each 80x60, in area 240x320
+ // 18 items should be visible at a time
+
+ // The first visible item should not move upwards and out of the view
+ // if items are moved/removed before it.
+
+
+ QTest::newRow("move 1 forwards, within visible items")
+ << 0.0
+ << 1 << 8 << 1
+ << 2 << 12 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 forwards, from non-visible -> visible")
+ << 2.0 // show 6-23
+ << 1 << 8+6 << 1
+ << 2 << 12+10 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 forwards, from non-visible -> visible (move first item)")
+ << 2.0 // // show 6-23
+ << 0 << 6 << 1
+ << 0 << 10 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 forwards, from visible -> non-visible")
+ << 0.0
+ << 1 << 20 << 1
+ << 1 << 20 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 forwards, from visible -> non-visible (move first item)")
+ << 0.0
+ << 0 << 20 << 1
+ << 0 << 20 << 1
+ << 0.0;
+
+
+ QTest::newRow("move 1 backwards, within visible items")
+ << 0.0
+ << 10 << 5 << 1
+ << 10 << 5 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, within visible items (to first index)")
+ << 0.0
+ << 10 << 0 << 1
+ << 10 << 0 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, from non-visible -> visible")
+ << 0.0
+ << 28 << 8 << 1
+ << 28 << 8 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, from non-visible -> visible (move last item)")
+ << 0.0
+ << 29 << 14 << 1
+ << 29 << 14 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, from visible -> non-visible")
+ << 2.0 // show 6-23
+ << 7 << 1 << 1
+ << 10 << 1 << 1
+ << 0.0; // only 1 item moved back, so items shift accordingly and first row doesn't move
+
+ QTest::newRow("move 1 backwards, from visible -> non-visible (move first item)")
+ << 2.0 // show 6-23
+ << 7 << 0 << 1
+ << 10 << 0 << 1
+ << 0.0; // only 1 item moved back, so items shift accordingly and first row doesn't move
+
+
+ QTest::newRow("move multiple forwards, within visible items")
+ << 0.0
+ << 0 << 5 << 3
+ << 0 << 7 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, within visible items (move first item)")
+ << 0.0
+ << 10 << 0 << 3
+ << 12 << 0 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, before visible items")
+ << 2.0 // show 6-23
+ << 3 << 4 << 3 // 3, 4, 5 move to after 6
+ << 5 << 6 << 5
+ << 1.0; // row of 3,4,5 has moved down
+
+ QTest::newRow("move multiple forwards, from non-visible -> visible")
+ << 2.0 // show 6-23
+ << 1 << 6 << 3
+ << 1 << 10 << 5
+ << 1.0; // 1st row (it's above visible area) disappears, 0 drops down 1 row, first visible item (6) stays where it is
+
+ QTest::newRow("move multiple forwards, from non-visible -> visible (move first item)")
+ << 2.0 // show 6-23
+ << 0 << 6 << 3
+ << 0 << 10 << 5
+ << 1.0; // top row moved and shifted to below 3rd row, all items should shift down by 1 row
+
+ QTest::newRow("move multiple forwards, mix of non-visible/visible")
+ << 2.0
+ << 3 << 16 << 6
+ << 5 << 18 << 10
+ << 1.0; // top two rows removed, third row is now the first visible
+
+ QTest::newRow("move multiple forwards, to bottom of view")
+ << 0.0
+ << 5 << 13 << 5
+ << 1 << 8 << 6
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, first row -> last")
+ << 0.0
+ << 0 << 15 << 3
+ << 0 << 10 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, content y not 0")
+ << 2.0
+ << 5+4 << 13+4 << 5
+ << 11 << 19 << 6
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, from visible -> non-visible")
+ << 0.0
+ << 1 << 16 << 3
+ << 1 << 18 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, from visible -> non-visible (move first item)")
+ << 0.0
+ << 0 << 16 << 3
+ << 1 << 18 << 5
+ << 0.0;
+
+
+ QTest::newRow("move multiple backwards, within visible items")
+ << 0.0
+ << 4 << 1 << 3
+ << 7 << 1 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, from non-visible -> visible")
+ << 0.0
+ << 20 << 4 << 3
+ << 20 << 4 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, from non-visible -> visible (move last item)")
+ << 0.0
+ << 27 << 10 << 3
+ << 25 << 8 << 5
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, from visible -> non-visible")
+ << 2.0 // show 6-23
+ << 16 << 1 << 3
+ << 17 << 1 << 5
+ << -1.0; // to minimize movement, items are added above visible area, all items move up by 1 row
+
+ QTest::newRow("move multiple backwards, from visible -> non-visible (move first item)")
+ << 2.0 // show 6-23
+ << 16 << 0 << 3
+ << 17 << 0 << 5
+ << -1.0; // 16,17,18 move to above item 0, all items move up by 1 row
+}
+
+void tst_QQuickGridView::multipleChanges(bool condensed)
+{
+ QFETCH(int, startCount);
+ QFETCH(QList<ListChange>, changes);
+ QFETCH(int, newCount);
+ QFETCH(int, newCurrentIndex);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < startCount; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ for (int i=0; i<changes.count(); i++) {
+ switch (changes[i].type) {
+ case ListChange::Inserted:
+ {
+ QList<QPair<QString, QString> > items;
+ for (int j=changes[i].index; j<changes[i].index + changes[i].count; ++j)
+ items << qMakePair(QString("new item " + j), QString::number(j));
+ model.insertItems(changes[i].index, items);
+ break;
+ }
+ case ListChange::Removed:
+ model.removeItems(changes[i].index, changes[i].count);
+ break;
+ case ListChange::Moved:
+ model.moveItems(changes[i].index, changes[i].to, changes[i].count);
+ break;
+ case ListChange::SetCurrent:
+ gridview->setCurrentIndex(changes[i].index);
+ break;
+ case ListChange::SetContentY:
+ gridview->setContentY(changes[i].pos);
+ break;
+ case ListChange::Polish:
+ break;
+ }
+ if (condensed) {
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ }
+ }
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QCOMPARE(gridview->count(), newCount);
+ QCOMPARE(gridview->count(), model.count());
+ QCOMPARE(gridview->currentIndex(), newCurrentIndex);
+
+ QQuickText *name;
+ QQuickText *number;
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QVERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::multipleChanges_data()
+{
+ QTest::addColumn<int>("startCount");
+ QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<int>("newCount");
+ QTest::addColumn<int>("newCurrentIndex");
+
+ QList<ListChange> changes;
+
+ for (int i=1; i<30; i++)
+ changes << ListChange::remove(0);
+ QTest::newRow("remove all but 1, first->last") << 30 << changes << 1 << 0;
+
+ changes << ListChange::remove(0);
+ QTest::newRow("remove all") << 30 << changes << 0 << -1;
+
+ changes.clear();
+ changes << ListChange::setCurrent(29);
+ for (int i=29; i>0; i--)
+ changes << ListChange::remove(i);
+ QTest::newRow("remove last (current) -> first") << 30 << changes << 1 << 0;
+
+ QTest::newRow("remove then insert at 0") << 10 << (QList<ListChange>()
+ << ListChange::remove(0, 1)
+ << ListChange::insert(0, 1)
+ ) << 10 << 1;
+
+ QTest::newRow("remove then insert at non-zero index") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(2)
+ << ListChange::remove(2, 1)
+ << ListChange::insert(2, 1)
+ ) << 10 << 3;
+
+ QTest::newRow("remove current then insert below it") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(1)
+ << ListChange::remove(1, 3)
+ << ListChange::insert(2, 2)
+ ) << 9 << 1;
+
+ QTest::newRow("remove current index then move it down") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(2)
+ << ListChange::remove(1, 3)
+ << ListChange::move(1, 5, 1)
+ ) << 7 << 5;
+
+ QTest::newRow("remove current index then move it up") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::remove(4, 3)
+ << ListChange::move(4, 1, 1)
+ ) << 7 << 1;
+
+
+ QTest::newRow("insert multiple times") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 2)
+ << ListChange::insert(0, 4)
+ << ListChange::insert(0, 6)
+ ) << 12 << 10;
+
+ QTest::newRow("insert multiple times with current index changes") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 2)
+ << ListChange::insert(0, 4)
+ << ListChange::insert(0, 6)
+ << ListChange::setCurrent(3)
+ << ListChange::insert(3, 2)
+ ) << 14 << 5;
+
+ QTest::newRow("insert and remove all") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 30)
+ << ListChange::remove(0, 30)
+ ) << 0 << -1;
+
+ QTest::newRow("insert and remove current") << 30 << (QList<ListChange>()
+ << ListChange::insert(1)
+ << ListChange::setCurrent(1)
+ << ListChange::remove(1)
+ ) << 30 << 1;
+
+ QTest::newRow("insert before 0, then remove cross section of new and old items") << 10 << (QList<ListChange>()
+ << ListChange::insert(0, 10)
+ << ListChange::remove(5, 10)
+ ) << 10 << 5;
+
+ QTest::newRow("insert multiple, then move new items to end") << 10 << (QList<ListChange>()
+ << ListChange::insert(0, 3)
+ << ListChange::move(0, 10, 3)
+ ) << 13 << 0;
+
+ QTest::newRow("insert multiple, then move new and some old items to end") << 10 << (QList<ListChange>()
+ << ListChange::insert(0, 3)
+ << ListChange::move(0, 8, 5)
+ ) << 13 << 11;
+
+ QTest::newRow("insert multiple at end, then move new and some old items to start") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(9)
+ << ListChange::insert(10, 3)
+ << ListChange::move(8, 0, 5)
+ ) << 13 << 1;
+
+
+ QTest::newRow("move back and forth to same index") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(1)
+ << ListChange::move(1, 2, 2)
+ << ListChange::move(2, 1, 2)
+ ) << 10 << 1;
+
+ QTest::newRow("move forwards then back") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(2)
+ << ListChange::move(1, 2, 3)
+ << ListChange::move(3, 0, 5)
+ ) << 10 << 0;
+
+ QTest::newRow("move current, then remove it") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::move(5, 0, 1)
+ << ListChange::remove(0)
+ ) << 9 << 0;
+
+ QTest::newRow("move current, then insert before it") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::move(5, 0, 1)
+ << ListChange::insert(0)
+ ) << 11 << 1;
+
+ QTest::newRow("move multiple, then remove them") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(1)
+ << ListChange::move(5, 1, 3)
+ << ListChange::remove(1, 3)
+ ) << 7 << 1;
+
+ QTest::newRow("move multiple, then insert before them") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::move(5, 1, 3)
+ << ListChange::insert(1, 5)
+ ) << 15 << 6;
+
+ QTest::newRow("move multiple, then insert after them") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(3)
+ << ListChange::move(0, 1, 2)
+ << ListChange::insert(3, 5)
+ ) << 15 << 8;
+
+
+ QTest::newRow("clear current") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 5)
+ << ListChange::setCurrent(-1)
+ << ListChange::remove(0, 5)
+ << ListChange::insert(0, 5)
+ ) << 5 << -1;
+
+ QTest::newRow("remove, scroll") << 30 << (QList<ListChange>()
+ << ListChange::remove(20, 5)
+ << ListChange::setContentY(20)
+ ) << 25 << 0;
+
+ QTest::newRow("insert, scroll") << 10 << (QList<ListChange>()
+ << ListChange::insert(9, 5)
+ << ListChange::setContentY(20)
+ ) << 15 << 0;
+
+ QTest::newRow("move, scroll") << 20 << (QList<ListChange>()
+ << ListChange::move(15, 8, 3)
+ << ListChange::setContentY(0)
+ ) << 20 << 0;
+
+ QTest::newRow("clear, insert, scroll") << 30 << (QList<ListChange>()
+ << ListChange::setContentY(20)
+ << ListChange::remove(0, 30)
+ << ListChange::insert(0, 2)
+ << ListChange::setContentY(0)
+ ) << 2 << 0;
+}
+
+
+void tst_QQuickGridView::swapWithFirstItem()
+{
+ // QTBUG_9697
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ // ensure content position is stable
+ gridview->setContentY(0);
+ model.moveItem(10, 0);
+ QTRY_VERIFY(gridview->contentY() == 0);
+
+ delete window;
+}
+
+void tst_QQuickGridView::currentIndex()
+{
+ QaimModel initModel;
+ for (int i = 0; i < 60; i++)
+ initModel.addItem("Item" + QString::number(i), QString::number(i));
+
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+ window->show();
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &initModel);
+
+ QString filename(testFile("gridview-initCurrent.qml"));
+ window->setSource(QUrl::fromLocalFile(filename));
+
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QVERIFY(gridview != 0);
+ QTRY_VERIFY(!QQuickItemPrivate::get(gridview)->polishScheduled);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ // currentIndex is initialized to 35
+ // currentItem should be in view
+ QCOMPARE(gridview->currentIndex(), 35);
+ QCOMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 35));
+ QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y());
+ QCOMPARE(gridview->contentY(), 400.0);
+
+ // changing model should reset currentIndex to 0
+ QaimModel model;
+ for (int i = 0; i < 60; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+ ctxt->setContextProperty("testModel", &model);
+
+ QCOMPARE(gridview->currentIndex(), 0);
+ QCOMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0));
+
+ // confirm that the velocity is updated
+ gridview->setCurrentIndex(35);
+ QTRY_VERIFY(gridview->verticalVelocity() != 0.0);
+ gridview->setCurrentIndex(0);
+ QTRY_VERIFY(gridview->verticalVelocity() == 0.0);
+
+ // footer should become visible if it is out of view, and then current index moves to the first row
+ window->rootObject()->setProperty("showFooter", true);
+ QTRY_VERIFY(gridview->footerItem());
+ gridview->setCurrentIndex(model.count()-3);
+ QTRY_VERIFY(gridview->footerItem()->y() > gridview->contentY() + gridview->height());
+ gridview->setCurrentIndex(model.count()-2);
+ QTRY_COMPARE(gridview->contentY() + gridview->height(), (60.0 * model.count()/3) + gridview->footerItem()->height());
+ window->rootObject()->setProperty("showFooter", false);
+
+ // header should become visible if it is out of view, and then current index moves to the last row
+ window->rootObject()->setProperty("showHeader", true);
+ QTRY_VERIFY(gridview->headerItem());
+ gridview->setCurrentIndex(3);
+ QTRY_VERIFY(gridview->headerItem()->y() + gridview->headerItem()->height() < gridview->contentY());
+ gridview->setCurrentIndex(1);
+ QTRY_COMPARE(gridview->contentY(), -gridview->headerItem()->height());
+ window->rootObject()->setProperty("showHeader", false);
+
+ // turn off auto highlight
+ gridview->setHighlightFollowsCurrentItem(false);
+ QVERIFY(gridview->highlightFollowsCurrentItem() == false);
+ QVERIFY(gridview->highlightItem());
+ qreal hlPosX = gridview->highlightItem()->x();
+ qreal hlPosY = gridview->highlightItem()->y();
+
+ gridview->setCurrentIndex(5);
+ QTRY_COMPARE(gridview->highlightItem()->x(), hlPosX);
+ QTRY_COMPARE(gridview->highlightItem()->y(), hlPosY);
+
+ // insert item before currentIndex
+ gridview->setCurrentIndex(28);
+ model.insertItem(0, "Foo", "1111");
+ QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
+
+ // check removing highlight by setting currentIndex to -1;
+ gridview->setCurrentIndex(-1);
+
+ QCOMPARE(gridview->currentIndex(), -1);
+ QVERIFY(!gridview->highlightItem());
+ QVERIFY(!gridview->currentItem());
+
+ // moving currentItem out of view should make it invisible
+ gridview->setCurrentIndex(0);
+ QTRY_VERIFY(delegateVisible(gridview->currentItem()));
+ gridview->setContentY(200);
+ QTRY_VERIFY(!delegateVisible(gridview->currentItem()));
+
+ delete window;
+}
+
+void tst_QQuickGridView::noCurrentIndex()
+{
+ QaimModel model;
+ for (int i = 0; i < 60; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ QString filename(testFile("gridview-noCurrent.qml"));
+ window->setSource(QUrl::fromLocalFile(filename));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QVERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // current index should be -1
+ QCOMPARE(gridview->currentIndex(), -1);
+ QVERIFY(!gridview->currentItem());
+ QVERIFY(!gridview->highlightItem());
+ QCOMPARE(gridview->contentY(), 0.0);
+
+ gridview->setCurrentIndex(5);
+ QCOMPARE(gridview->currentIndex(), 5);
+ QVERIFY(gridview->currentItem());
+ QVERIFY(gridview->highlightItem());
+
+ delete window;
+}
+
+void tst_QQuickGridView::keyNavigation()
+{
+ QFETCH(QQuickGridView::Flow, flow);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(Qt::Key, forwardsKey);
+ QFETCH(Qt::Key, backwardsKey);
+ QFETCH(QPointF, contentPosAtFirstItem);
+ QFETCH(QPointF, contentPosAtLastItem);
+ QFETCH(int, indexRightOf7);
+ QFETCH(int, indexLeftOf7);
+ QFETCH(int, indexUpFrom7);
+ QFETCH(int, indexDownFrom7);
+
+ QaimModel model;
+ for (int i = 0; i < 18; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ window->show();
+ QTest::qWaitForWindowActive(window);
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+ gridview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ window->requestActivate();
+ QTest::qWaitForWindowActive(window);
+ QTRY_VERIFY(qGuiApp->focusWindow() == window);
+ QCOMPARE(gridview->currentIndex(), 0);
+
+ QTest::keyClick(window, forwardsKey);
+ QCOMPARE(gridview->currentIndex(), 1);
+
+ QTest::keyClick(window, backwardsKey);
+ QCOMPARE(gridview->currentIndex(), 0);
+
+ gridview->setCurrentIndex(7);
+ gridview->moveCurrentIndexRight();
+ QCOMPARE(gridview->currentIndex(), indexRightOf7);
+ gridview->moveCurrentIndexLeft();
+ QCOMPARE(gridview->currentIndex(), 7);
+ gridview->moveCurrentIndexLeft();
+ QCOMPARE(gridview->currentIndex(), indexLeftOf7);
+ gridview->moveCurrentIndexRight();
+ QCOMPARE(gridview->currentIndex(), 7);
+ gridview->moveCurrentIndexUp();
+ QCOMPARE(gridview->currentIndex(), indexUpFrom7);
+ gridview->moveCurrentIndexDown();
+ QCOMPARE(gridview->currentIndex(), 7);
+ gridview->moveCurrentIndexDown();
+ QCOMPARE(gridview->currentIndex(), indexDownFrom7);
+
+ gridview->setCurrentIndex(7);
+ QTest::keyClick(window, Qt::Key_Right);
+ QCOMPARE(gridview->currentIndex(), indexRightOf7);
+ QTest::keyClick(window, Qt::Key_Left);
+ QCOMPARE(gridview->currentIndex(), 7);
+ QTest::keyClick(window, Qt::Key_Left);
+ QCOMPARE(gridview->currentIndex(), indexLeftOf7);
+ QTest::keyClick(window, Qt::Key_Right);
+ QCOMPARE(gridview->currentIndex(), 7);
+ QTest::keyClick(window, Qt::Key_Up);
+ QCOMPARE(gridview->currentIndex(), indexUpFrom7);
+ QTest::keyClick(window, Qt::Key_Down);
+ QCOMPARE(gridview->currentIndex(), 7);
+ QTest::keyClick(window, Qt::Key_Down);
+ QCOMPARE(gridview->currentIndex(), indexDownFrom7);
+
+ // hold down a key to go forwards
+ gridview->setCurrentIndex(0);
+ for (int i=0; i<model.count()-1; i++) {
+// QTest::qWait(500);
+ QTest::simulateEvent(window, true, forwardsKey, Qt::NoModifier, "", true);
+ QTRY_COMPARE(gridview->currentIndex(), i+1);
+ }
+ QTest::keyRelease(window, forwardsKey);
+ QTRY_COMPARE(gridview->currentIndex(), model.count()-1);
+ QTRY_COMPARE(gridview->contentX(), contentPosAtLastItem.x());
+ QTRY_COMPARE(gridview->contentY(), contentPosAtLastItem.y());
+
+ // hold down a key to go backwards
+ for (int i=model.count()-1; i > 0; i--) {
+ QTest::simulateEvent(window, true, backwardsKey, Qt::NoModifier, "", true);
+ QTRY_COMPARE(gridview->currentIndex(), i-1);
+ }
+ QTest::keyRelease(window, backwardsKey);
+ QTRY_COMPARE(gridview->currentIndex(), 0);
+ QTRY_COMPARE(gridview->contentX(), contentPosAtFirstItem.x());
+ QTRY_COMPARE(gridview->contentY(), contentPosAtFirstItem.y());
+
+ // no wrap
+ QVERIFY(!gridview->isWrapEnabled());
+ QTest::keyClick(window, forwardsKey);
+ QCOMPARE(gridview->currentIndex(), 1);
+ QTest::keyClick(window, backwardsKey);
+ QCOMPARE(gridview->currentIndex(), 0);
+
+ QTest::keyClick(window, backwardsKey);
+ QCOMPARE(gridview->currentIndex(), 0);
+
+ // with wrap
+ gridview->setWrapEnabled(true);
+ QVERIFY(gridview->isWrapEnabled());
+
+ QTest::keyClick(window, backwardsKey);
+ QCOMPARE(gridview->currentIndex(), model.count()-1);
+ QTRY_COMPARE(gridview->contentX(), contentPosAtLastItem.x());
+ QTRY_COMPARE(gridview->contentY(), contentPosAtLastItem.y());
+
+ QTest::keyClick(window, forwardsKey);
+ QCOMPARE(gridview->currentIndex(), 0);
+ QTRY_COMPARE(gridview->contentX(), contentPosAtFirstItem.x());
+ QTRY_COMPARE(gridview->contentY(), contentPosAtFirstItem.y());
+
+ // Test key press still accepted when position wraps to same index.
+ window->rootObject()->setProperty("lastKey", 0);
+ model.removeItems(1, model.count() - 1);
+
+ QTest::keyClick(window, backwardsKey);
+ QCOMPARE(window->rootObject()->property("lastKey").toInt(), 0);
+
+ QTest::keyClick(window, forwardsKey);
+ QCOMPARE(window->rootObject()->property("lastKey").toInt(), 0);
+
+ // Test key press not accepted at limits when wrap is disabled.
+ gridview->setWrapEnabled(false);
+
+ QTest::keyClick(window, backwardsKey);
+ QCOMPARE(window->rootObject()->property("lastKey").toInt(), int(backwardsKey));
+
+ QTest::keyClick(window, forwardsKey);
+ QCOMPARE(window->rootObject()->property("lastKey").toInt(), int(forwardsKey));
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::keyNavigation_data()
+{
+ QTest::addColumn<QQuickGridView::Flow>("flow");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<Qt::Key>("forwardsKey");
+ QTest::addColumn<Qt::Key>("backwardsKey");
+ QTest::addColumn<QPointF>("contentPosAtFirstItem");
+ QTest::addColumn<QPointF>("contentPosAtLastItem");
+ QTest::addColumn<int>("indexRightOf7");
+ QTest::addColumn<int>("indexLeftOf7");
+ QTest::addColumn<int>("indexUpFrom7");
+ QTest::addColumn<int>("indexDownFrom7");
+
+ QTest::newRow("LeftToRight, LtR, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << Qt::Key_Right << Qt::Key_Left
+ << QPointF(0, 0)
+ << QPointF(0, 40)
+ << 8 << 6 << 4 << 10;
+
+ QTest::newRow("LeftToRight, RtL, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << Qt::Key_Left << Qt::Key_Right
+ << QPointF(0, 0)
+ << QPointF(0, 40)
+ << 6 << 8 << 4 << 10;
+
+ QTest::newRow("LeftToRight, LtR, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << Qt::Key_Right << Qt::Key_Left
+ << QPointF(0, -320)
+ << QPointF(0, -360)
+ << 8 << 6 << 10 << 4;
+
+ QTest::newRow("LeftToRight, RtL, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << Qt::Key_Left << Qt::Key_Right
+ << QPointF(0, -320)
+ << QPointF(0, -360)
+ << 6 << 8 << 10 << 4;
+
+ QTest::newRow("TopToBottom, LtR, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << Qt::Key_Down << Qt::Key_Up
+ << QPointF(0, 0)
+ << QPointF(80, 0)
+ << 12 << 2 << 6 << 8;
+
+ QTest::newRow("TopToBottom, RtL, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << Qt::Key_Down << Qt::Key_Up
+ << QPointF(-240, 0)
+ << QPointF(-320, 0)
+ << 2 << 12 << 6 << 8;
+
+ QTest::newRow("TopToBottom, LtR, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << Qt::Key_Up << Qt::Key_Down
+ << QPointF(0, -320)
+ << QPointF(80, -320)
+ << 12 << 2 << 8 << 6;
+
+ QTest::newRow("TopToBottom, RtL, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << Qt::Key_Up << Qt::Key_Down
+ << QPointF(-240, -320)
+ << QPointF(-320, -320)
+ << 2 << 12 << 8 << 6;
+}
+
+void tst_QQuickGridView::changeFlow()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testRightToLeft", QVariant(false));
+ ctxt->setContextProperty("testTopToBottom", QVariant(false));
+ ctxt->setContextProperty("testBottomToTop", QVariant(false));
+
+ window->setSource(testFileUrl("layouts.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // Confirm items positioned correctly and indexes correct
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal((i%3)*80));
+ QTRY_COMPARE(item->y(), qreal((i/3)*60));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ ctxt->setContextProperty("testTopToBottom", QVariant(true));
+
+ // Confirm items positioned correctly and indexes correct
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal((i/5)*80));
+ QTRY_COMPARE(item->y(), qreal((i%5)*60));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ ctxt->setContextProperty("testRightToLeft", QVariant(true));
+
+ // Confirm items positioned correctly and indexes correct
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal(-(i/5)*80 - item->width()));
+ QTRY_COMPARE(item->y(), qreal((i%5)*60));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+ gridview->setContentX(100);
+ QTRY_COMPARE(gridview->contentX(), 100.);
+ ctxt->setContextProperty("testTopToBottom", QVariant(false));
+ QTRY_COMPARE(gridview->contentX(), 0.);
+
+ // Confirm items positioned correctly and indexes correct
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal(240 - (i%3+1)*80));
+ QTRY_COMPARE(item->y(), qreal((i/3)*60));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::defaultValues()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("gridview3.qml"));
+ QQuickGridView *obj = qobject_cast<QQuickGridView*>(c.create());
+
+ QTRY_VERIFY(obj != 0);
+ QTRY_VERIFY(obj->model() == QVariant());
+ QTRY_VERIFY(obj->delegate() == 0);
+ QTRY_COMPARE(obj->currentIndex(), -1);
+ QTRY_VERIFY(obj->currentItem() == 0);
+ QTRY_COMPARE(obj->count(), 0);
+ QTRY_VERIFY(obj->highlight() == 0);
+ QTRY_VERIFY(obj->highlightItem() == 0);
+ QTRY_COMPARE(obj->highlightFollowsCurrentItem(), true);
+ QTRY_VERIFY(obj->flow() == 0);
+ QTRY_COMPARE(obj->isWrapEnabled(), false);
+#ifdef QML_VIEW_DEFAULTCACHEBUFFER
+ QTRY_COMPARE(obj->cacheBuffer(), QML_VIEW_DEFAULTCACHEBUFFER);
+#else
+ QTRY_COMPARE(obj->cacheBuffer(), 320);
+#endif
+ QTRY_COMPARE(obj->cellWidth(), qreal(100)); //### Should 100 be the default?
+ QTRY_COMPARE(obj->cellHeight(), qreal(100));
+ delete obj;
+}
+
+void tst_QQuickGridView::properties()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("gridview2.qml"));
+ QQuickGridView *obj = qobject_cast<QQuickGridView*>(c.create());
+
+ QTRY_VERIFY(obj != 0);
+ QTRY_VERIFY(obj->model() != QVariant());
+ QTRY_VERIFY(obj->delegate() != 0);
+ QTRY_COMPARE(obj->currentIndex(), 0);
+ QTRY_VERIFY(obj->currentItem() != 0);
+ QTRY_COMPARE(obj->count(), 4);
+ QTRY_VERIFY(obj->highlight() != 0);
+ QTRY_VERIFY(obj->highlightItem() != 0);
+ QTRY_COMPARE(obj->highlightFollowsCurrentItem(), false);
+ QTRY_VERIFY(obj->flow() == 0);
+ QTRY_COMPARE(obj->isWrapEnabled(), true);
+ QTRY_COMPARE(obj->cacheBuffer(), 200);
+ QTRY_COMPARE(obj->cellWidth(), qreal(100));
+ QTRY_COMPARE(obj->cellHeight(), qreal(100));
+ delete obj;
+}
+
+void tst_QQuickGridView::propertyChanges()
+{
+ QQuickView *window = createView();
+ QTRY_VERIFY(window);
+ window->setSource(testFileUrl("propertychangestest.qml"));
+
+ QQuickGridView *gridView = window->rootObject()->findChild<QQuickGridView*>("gridView");
+ QTRY_VERIFY(gridView);
+
+ QSignalSpy keyNavigationWrapsSpy(gridView, SIGNAL(keyNavigationWrapsChanged()));
+ QSignalSpy cacheBufferSpy(gridView, SIGNAL(cacheBufferChanged()));
+ QSignalSpy layoutSpy(gridView, SIGNAL(layoutDirectionChanged()));
+ QSignalSpy flowSpy(gridView, SIGNAL(flowChanged()));
+
+ QTRY_COMPARE(gridView->isWrapEnabled(), true);
+ QTRY_COMPARE(gridView->cacheBuffer(), 10);
+ QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowLeftToRight);
+
+ gridView->setWrapEnabled(false);
+ gridView->setCacheBuffer(3);
+ gridView->setFlow(QQuickGridView::FlowTopToBottom);
+
+ QTRY_COMPARE(gridView->isWrapEnabled(), false);
+ QTRY_COMPARE(gridView->cacheBuffer(), 3);
+ QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowTopToBottom);
+
+ QTRY_COMPARE(keyNavigationWrapsSpy.count(),1);
+ QTRY_COMPARE(cacheBufferSpy.count(),1);
+ QTRY_COMPARE(flowSpy.count(),1);
+
+ gridView->setWrapEnabled(false);
+ gridView->setCacheBuffer(3);
+ gridView->setFlow(QQuickGridView::FlowTopToBottom);
+
+ QTRY_COMPARE(keyNavigationWrapsSpy.count(),1);
+ QTRY_COMPARE(cacheBufferSpy.count(),1);
+ QTRY_COMPARE(flowSpy.count(),1);
+
+ gridView->setFlow(QQuickGridView::FlowLeftToRight);
+ QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowLeftToRight);
+
+ gridView->setWrapEnabled(true);
+ gridView->setCacheBuffer(5);
+ gridView->setLayoutDirection(Qt::RightToLeft);
+
+ QTRY_COMPARE(gridView->isWrapEnabled(), true);
+ QTRY_COMPARE(gridView->cacheBuffer(), 5);
+ QTRY_COMPARE(gridView->layoutDirection(), Qt::RightToLeft);
+
+ QTRY_COMPARE(keyNavigationWrapsSpy.count(),2);
+ QTRY_COMPARE(cacheBufferSpy.count(),2);
+ QTRY_COMPARE(layoutSpy.count(),1);
+ QTRY_COMPARE(flowSpy.count(),2);
+
+ gridView->setWrapEnabled(true);
+ gridView->setCacheBuffer(5);
+ gridView->setLayoutDirection(Qt::RightToLeft);
+
+ QTRY_COMPARE(keyNavigationWrapsSpy.count(),2);
+ QTRY_COMPARE(cacheBufferSpy.count(),2);
+ QTRY_COMPARE(layoutSpy.count(),1);
+ QTRY_COMPARE(flowSpy.count(),2);
+
+ gridView->setFlow(QQuickGridView::FlowTopToBottom);
+ QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowTopToBottom);
+ QTRY_COMPARE(flowSpy.count(),3);
+
+ gridView->setFlow(QQuickGridView::FlowTopToBottom);
+ QTRY_COMPARE(flowSpy.count(),3);
+
+ delete window;
+}
+
+void tst_QQuickGridView::componentChanges()
+{
+ QQuickView *window = createView();
+ QTRY_VERIFY(window);
+ window->setSource(testFileUrl("propertychangestest.qml"));
+
+ QQuickGridView *gridView = window->rootObject()->findChild<QQuickGridView*>("gridView");
+ QTRY_VERIFY(gridView);
+
+ QQmlComponent component(window->engine());
+ component.setData("import QtQuick 2.0; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile(""));
+
+ QQmlComponent delegateComponent(window->engine());
+ delegateComponent.setData("import QtQuick 2.0; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile(""));
+
+ QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged()));
+ QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged()));
+ QSignalSpy headerSpy(gridView, SIGNAL(headerChanged()));
+ QSignalSpy footerSpy(gridView, SIGNAL(footerChanged()));
+ QSignalSpy headerItemSpy(gridView, SIGNAL(headerItemChanged()));
+ QSignalSpy footerItemSpy(gridView, SIGNAL(footerItemChanged()));
+
+ gridView->setHighlight(&component);
+ gridView->setDelegate(&delegateComponent);
+ gridView->setHeader(&component);
+ gridView->setFooter(&component);
+
+ QTRY_COMPARE(gridView->highlight(), &component);
+ QTRY_COMPARE(gridView->delegate(), &delegateComponent);
+ QTRY_COMPARE(gridView->header(), &component);
+ QTRY_COMPARE(gridView->footer(), &component);
+
+ QVERIFY(gridView->headerItem());
+ QVERIFY(gridView->footerItem());
+
+ QTRY_COMPARE(highlightSpy.count(),1);
+ QTRY_COMPARE(delegateSpy.count(),1);
+ QTRY_COMPARE(headerSpy.count(),1);
+ QTRY_COMPARE(footerSpy.count(),1);
+ QTRY_COMPARE(headerItemSpy.count(),1);
+ QTRY_COMPARE(footerItemSpy.count(),1);
+
+ gridView->setHighlight(&component);
+ gridView->setDelegate(&delegateComponent);
+ gridView->setHeader(&component);
+ gridView->setFooter(&component);
+
+ QTRY_COMPARE(highlightSpy.count(),1);
+ QTRY_COMPARE(delegateSpy.count(),1);
+ QTRY_COMPARE(headerSpy.count(),1);
+ QTRY_COMPARE(footerSpy.count(),1);
+ QTRY_COMPARE(headerItemSpy.count(),1);
+ QTRY_COMPARE(footerItemSpy.count(),1);
+
+ delete window;
+}
+
+void tst_QQuickGridView::modelChanges()
+{
+ QQuickView *window = createView();
+ QTRY_VERIFY(window);
+ window->setSource(testFileUrl("propertychangestest.qml"));
+
+ QQuickGridView *gridView = window->rootObject()->findChild<QQuickGridView*>("gridView");
+ QTRY_VERIFY(gridView);
+
+ QQmlListModel *alternateModel = window->rootObject()->findChild<QQmlListModel*>("alternateModel");
+ QTRY_VERIFY(alternateModel);
+ QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
+ QSignalSpy modelSpy(gridView, SIGNAL(modelChanged()));
+
+ gridView->setModel(modelVariant);
+ QTRY_COMPARE(gridView->model(), modelVariant);
+ QTRY_COMPARE(modelSpy.count(),1);
+
+ gridView->setModel(modelVariant);
+ QTRY_COMPARE(modelSpy.count(),1);
+
+ gridView->setModel(QVariant());
+ QTRY_COMPARE(modelSpy.count(),2);
+ delete window;
+}
+
+void tst_QQuickGridView::positionViewAtBeginningEnd()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testRightToLeft", QVariant(false));
+ ctxt->setContextProperty("testTopToBottom", QVariant(false));
+ ctxt->setContextProperty("testBottomToTop", QVariant(false));
+
+ window->setSource(testFileUrl("layouts.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // positionViewAtBeginning
+ gridview->setContentY(150);
+ gridview->positionViewAtBeginning();
+ QTRY_COMPARE(gridview->contentY(), 0.);
+
+ gridview->setContentY(80);
+ window->rootObject()->setProperty("showHeader", true);
+ gridview->positionViewAtBeginning();
+ QTRY_COMPARE(gridview->contentY(), -30.);
+
+ // positionViewAtEnd
+ gridview->setContentY(150);
+ gridview->positionViewAtEnd();
+ QTRY_COMPARE(gridview->contentY(), 520.); // 14*60 - 320 (14 rows)
+
+ gridview->setContentY(80);
+ window->rootObject()->setProperty("showFooter", true);
+ gridview->positionViewAtEnd();
+ QTRY_COMPARE(gridview->contentY(), 550.);
+
+ // Test for Top To Bottom layout
+ ctxt->setContextProperty("testTopToBottom", QVariant(true));
+ window->rootObject()->setProperty("showHeader", false);
+ window->rootObject()->setProperty("showFooter", false);
+
+ // positionViewAtBeginning
+ gridview->setContentX(150);
+ gridview->positionViewAtBeginning();
+ QTRY_COMPARE(gridview->contentX(), 0.);
+
+ gridview->setContentX(80);
+ window->rootObject()->setProperty("showHeader", true);
+ gridview->positionViewAtBeginning();
+ QTRY_COMPARE(gridview->contentX(), -30.);
+
+ // positionViewAtEnd
+ gridview->positionViewAtEnd();
+ QTRY_COMPARE(gridview->contentX(), 400.); // 8*80 - 240 (8 columns)
+
+ gridview->setContentX(80);
+ window->rootObject()->setProperty("showFooter", true);
+ gridview->positionViewAtEnd();
+ QTRY_COMPARE(gridview->contentX(), 430.);
+
+ // set current item to outside visible view, position at beginning
+ // and ensure highlight moves to current item
+ gridview->setCurrentIndex(6);
+ gridview->positionViewAtBeginning();
+ QTRY_COMPARE(gridview->contentX(), -30.);
+ QVERIFY(gridview->highlightItem());
+ QCOMPARE(gridview->highlightItem()->x(), 80.);
+
+ delete window;
+}
+
+void tst_QQuickGridView::positionViewAtIndex()
+{
+ QFETCH(bool, enforceRange);
+ QFETCH(bool, topToBottom);
+ QFETCH(bool, rightToLeft);
+ QFETCH(qreal, initContentPos);
+ QFETCH(int, index);
+ QFETCH(QQuickGridView::PositionMode, mode);
+ QFETCH(qreal, contentPos);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testRightToLeft", QVariant(rightToLeft));
+ ctxt->setContextProperty("testTopToBottom", QVariant(topToBottom));
+ ctxt->setContextProperty("testBottomToTop", QVariant(false));
+
+ window->setSource(testFileUrl("layouts.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ window->rootObject()->setProperty("enforceRange", enforceRange);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ if (topToBottom)
+ gridview->setContentX(initContentPos);
+ else
+ gridview->setContentY(initContentPos);
+
+ gridview->positionViewAtIndex(index, mode);
+ if (topToBottom)
+ QTRY_COMPARE(gridview->contentX(), contentPos);
+ else
+ QTRY_COMPARE(gridview->contentY(), contentPos);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = index; i < model.count() && i < itemCount-index-1; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ if (topToBottom) {
+ if (rightToLeft) {
+ QTRY_COMPARE(item->x(), qreal(-(i/5)*80-item->width()));
+ QTRY_COMPARE(item->y(), qreal((i%5)*60));
+ } else {
+ QTRY_COMPARE(item->x(), (i/5)*80.);
+ QTRY_COMPARE(item->y(), (i%5)*60.);
+ }
+ } else {
+ QTRY_COMPARE(item->x(), (i%3)*80.);
+ QTRY_COMPARE(item->y(), (i/3)*60.);
+ }
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::positionViewAtIndex_data()
+{
+ QTest::addColumn<bool>("enforceRange");
+ QTest::addColumn<bool>("topToBottom");
+ QTest::addColumn<bool>("rightToLeft");
+ QTest::addColumn<qreal>("initContentPos");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<QQuickGridView::PositionMode>("mode");
+ QTest::addColumn<qreal>("contentPos");
+
+ QTest::newRow("no range, 4 at Beginning") << false << false << false << 0. << 4 << QQuickGridView::Beginning << 60.;
+ QTest::newRow("no range, 4 at End") << false << false << false << 0. << 4 << QQuickGridView::End << 0.;
+ QTest::newRow("no range, 21 at Beginning") << false << false << false << 0. << 21 << QQuickGridView::Beginning << 420.;
+ // Position on an item that would leave empty space if positioned at the top
+ QTest::newRow("no range, 31 at Beginning") << false << false << false << 0. << 31 << QQuickGridView::Beginning << 520.;
+ QTest::newRow("no range, 30 at End") << false << false << false << 0. << 30 << QQuickGridView::End << 340.;
+ QTest::newRow("no range, 15 at Center") << false << false << false << 0. << 15 << QQuickGridView::Center << 170.;
+ // Ensure at least partially visible
+ QTest::newRow("no range, 15 visible => Visible") << false << false << false << 302. << 15 << QQuickGridView::Visible << 302.;
+ QTest::newRow("no range, 15 after visible => Visible") << false << false << false << 360. << 15 << QQuickGridView::Visible << 300.;
+ QTest::newRow("no range, 20 visible => Visible") << false << false << false << 60. << 20 << QQuickGridView::Visible << 60.;
+ QTest::newRow("no range, 20 before visible => Visible") << false << false << false << 20. << 20 << QQuickGridView::Visible << 100.;
+ // Ensure completely visible
+ QTest::newRow("no range, 20 visible => Contain") << false << false << false << 120. << 20 << QQuickGridView::Contain << 120.;
+ QTest::newRow("no range, 15 partially visible => Contain") << false << false << false << 302. << 15 << QQuickGridView::Contain << 300.;
+ QTest::newRow("no range, 20 partially visible => Contain") << false << false << false << 60. << 20 << QQuickGridView::Contain << 100.;
+
+ QTest::newRow("strict range, 4 at End") << true << false << false << 0. << 4 << QQuickGridView::End << -120.;
+ QTest::newRow("strict range, 38 at Beginning") << true << false << false << 0. << 38 << QQuickGridView::Beginning << 660.;
+ QTest::newRow("strict range, 15 at Center") << true << false << false << 0. << 15 << QQuickGridView::Center << 180.;
+ QTest::newRow("strict range, 4 at SnapPosition") << true << false << false << 0. << 4 << QQuickGridView::SnapPosition << -60.;
+ QTest::newRow("strict range, 10 at SnapPosition") << true << false << false << 0. << 10 << QQuickGridView::SnapPosition << 60.;
+ QTest::newRow("strict range, 38 at SnapPosition") << true << false << false << 0. << 38 << QQuickGridView::SnapPosition << 600.;
+
+ // TopToBottom
+ QTest::newRow("no range, ttb, 30 at End") << false << true << false << 0. << 30 << QQuickGridView::End << 320.;
+ QTest::newRow("no range, ttb, 15 at Center") << false << true << false << 0. << 15 << QQuickGridView::Center << 160.;
+ QTest::newRow("no range, ttb, 15 visible => Visible") << false << true << false << 160. << 15 << QQuickGridView::Visible << 160.;
+ QTest::newRow("no range, ttb, 25 partially visible => Visible") << false << true << false << 170. << 25 << QQuickGridView::Visible << 170.;
+ QTest::newRow("no range, ttb, 30 before visible => Visible") << false << true << false << 170. << 30 << QQuickGridView::Visible << 320.;
+ QTest::newRow("no range, ttb, 25 partially visible => Contain") << false << true << false << 170. << 25 << QQuickGridView::Contain << 240.;
+
+ // RightToLeft
+ QTest::newRow("no range, rtl, ttb, 6 at Beginning") << false << true << true << 0. << 6 << QQuickGridView::Beginning << -320.;
+ QTest::newRow("no range, rtl, ttb, 21 at Beginning") << false << true << true << 0. << 21 << QQuickGridView::Beginning << -560.;
+ // Position on an item that would leave empty space if positioned at the top
+ QTest::newRow("no range, rtl, ttb, 31 at Beginning") << false << true << true << 0. << 31 << QQuickGridView::Beginning << -640.;
+ QTest::newRow("no range, rtl, ttb, 0 at Beginning") << false << true << true << -400. << 0 << QQuickGridView::Beginning << -240.;
+ QTest::newRow("no range, rtl, ttb, 30 at End") << false << true << true << 0. << 30 << QQuickGridView::End << -560.;
+ QTest::newRow("no range, rtl, ttb, 15 at Center") << false << true << true << 0. << 15 << QQuickGridView::Center << -400.;
+ QTest::newRow("no range, rtl, ttb, 15 visible => Visible") << false << true << true << -555. << 15 << QQuickGridView::Visible << -555.;
+ QTest::newRow("no range, rtl, ttb, 15 not visible => Visible") << false << true << true << -239. << 15 << QQuickGridView::Visible << -320.;
+ QTest::newRow("no range, rtl, ttb, 15 partially visible => Visible") << false << true << true << -300. << 15 << QQuickGridView::Visible << -300.;
+ QTest::newRow("no range, rtl, ttb, 20 visible => Contain") << false << true << true << -400. << 20 << QQuickGridView::Contain << -400.;
+ QTest::newRow("no range, rtl, ttb, 15 partially visible => Contain") << false << true << true << -315. << 15 << QQuickGridView::Contain << -320.;
+}
+
+void tst_QQuickGridView::snapping()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ gridview->setHeight(220);
+ QCOMPARE(gridview->height(), 220.);
+
+ gridview->positionViewAtIndex(12, QQuickGridView::Visible);
+ QCOMPARE(gridview->contentY(), 80.);
+
+ gridview->setContentY(0);
+ QCOMPARE(gridview->contentY(), 0.);
+
+ gridview->setSnapMode(QQuickGridView::SnapToRow);
+ QCOMPARE(gridview->snapMode(), QQuickGridView::SnapToRow);
+
+ gridview->positionViewAtIndex(12, QQuickGridView::Visible);
+ QCOMPARE(gridview->contentY(), 60.);
+
+ gridview->positionViewAtIndex(15, QQuickGridView::End);
+ QCOMPARE(gridview->contentY(), 120.);
+
+ delete window;
+
+}
+
+void tst_QQuickGridView::mirroring()
+{
+ QQuickView *windowA = createView();
+ windowA->setSource(testFileUrl("mirroring.qml"));
+ QQuickGridView *gridviewA = findItem<QQuickGridView>(windowA->rootObject(), "view");
+ QTRY_VERIFY(gridviewA != 0);
+
+ QQuickView *windowB = createView();
+ windowB->setSource(testFileUrl("mirroring.qml"));
+ QQuickGridView *gridviewB = findItem<QQuickGridView>(windowB->rootObject(), "view");
+ QTRY_VERIFY(gridviewA != 0);
+ qApp->processEvents();
+
+ QList<QString> objectNames;
+ objectNames << "item1" << "item2"; // << "item3"
+
+ gridviewA->setProperty("layoutDirection", Qt::LeftToRight);
+ gridviewB->setProperty("layoutDirection", Qt::RightToLeft);
+ QCOMPARE(gridviewA->layoutDirection(), gridviewA->effectiveLayoutDirection());
+
+ // LTR != RTL
+ foreach (const QString objectName, objectNames)
+ QVERIFY(findItem<QQuickItem>(gridviewA, objectName)->x() != findItem<QQuickItem>(gridviewB, objectName)->x());
+
+ gridviewA->setProperty("layoutDirection", Qt::LeftToRight);
+ gridviewB->setProperty("layoutDirection", Qt::LeftToRight);
+
+ // LTR == LTR
+ foreach (const QString objectName, objectNames)
+ QCOMPARE(findItem<QQuickItem>(gridviewA, objectName)->x(), findItem<QQuickItem>(gridviewB, objectName)->x());
+
+ QVERIFY(gridviewB->layoutDirection() == gridviewB->effectiveLayoutDirection());
+ QQuickItemPrivate::get(gridviewB)->setLayoutMirror(true);
+ QVERIFY(gridviewB->layoutDirection() != gridviewB->effectiveLayoutDirection());
+
+ // LTR != LTR+mirror
+ foreach (const QString objectName, objectNames)
+ QVERIFY(findItem<QQuickItem>(gridviewA, objectName)->x() != findItem<QQuickItem>(gridviewB, objectName)->x());
+
+ gridviewA->setProperty("layoutDirection", Qt::RightToLeft);
+
+ // RTL == LTR+mirror
+ foreach (const QString objectName, objectNames)
+ QCOMPARE(findItem<QQuickItem>(gridviewA, objectName)->x(), findItem<QQuickItem>(gridviewB, objectName)->x());
+
+ gridviewB->setProperty("layoutDirection", Qt::RightToLeft);
+
+ // RTL != RTL+mirror
+ foreach (const QString objectName, objectNames)
+ QVERIFY(findItem<QQuickItem>(gridviewA, objectName)->x() != findItem<QQuickItem>(gridviewB, objectName)->x());
+
+ gridviewA->setProperty("layoutDirection", Qt::LeftToRight);
+
+ // LTR == RTL+mirror
+ foreach (const QString objectName, objectNames)
+ QCOMPARE(findItem<QQuickItem>(gridviewA, objectName)->x(), findItem<QQuickItem>(gridviewB, objectName)->x());
+
+ delete windowA;
+ delete windowB;
+}
+
+void tst_QQuickGridView::resetModel()
+{
+ QQuickView *window = createView();
+
+ QStringList strings;
+ strings << "one" << "two" << "three";
+ QStringListModel model(strings);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("displaygrid.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QTRY_COMPARE(gridview->count(), model.rowCount());
+
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i);
+ QTRY_VERIFY(display != 0);
+ QTRY_COMPARE(display->text(), strings.at(i));
+ }
+
+ strings.clear();
+ strings << "four" << "five" << "six" << "seven";
+ model.setStringList(strings);
+
+ QTRY_COMPARE(gridview->count(), model.rowCount());
+
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i);
+ QTRY_VERIFY(display != 0);
+ QTRY_COMPARE(display->text(), strings.at(i));
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::enforceRange()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testRightToLeft", QVariant(false));
+ ctxt->setContextProperty("testTopToBottom", QVariant(false));
+
+ window->setSource(testFileUrl("gridview-enforcerange.qml"));
+ window->show();
+ qApp->processEvents();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QTRY_COMPARE(gridview->preferredHighlightBegin(), 100.0);
+ QTRY_COMPARE(gridview->preferredHighlightEnd(), 100.0);
+ QTRY_COMPARE(gridview->highlightRangeMode(), QQuickGridView::StrictlyEnforceRange);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // view should be positioned at the top of the range.
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(gridview->contentY(), -100.0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(0));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(0));
+
+ // Check currentIndex is updated when contentItem moves
+ gridview->setContentY(0);
+ QTRY_COMPARE(gridview->currentIndex(), 2);
+
+ gridview->setCurrentIndex(5);
+ QTRY_COMPARE(gridview->contentY(), 100.);
+
+ QaimModel model2;
+ for (int i = 0; i < 5; i++)
+ model2.addItem("Item" + QString::number(i), "");
+
+ ctxt->setContextProperty("testModel", &model2);
+ QCOMPARE(gridview->count(), 5);
+
+ delete window;
+}
+
+void tst_QQuickGridView::enforceRange_rightToLeft()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testRightToLeft", QVariant(true));
+ ctxt->setContextProperty("testTopToBottom", QVariant(true));
+
+ window->setSource(testFileUrl("gridview-enforcerange.qml"));
+ window->show();
+ QTRY_VERIFY(window->isExposed());
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QCOMPARE(gridview->preferredHighlightBegin(), 100.0);
+ QCOMPARE(gridview->preferredHighlightEnd(), 100.0);
+ QCOMPARE(gridview->highlightRangeMode(), QQuickGridView::StrictlyEnforceRange);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ // view should be positioned at the top of the range.
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QTRY_COMPARE(gridview->contentX(), -140.);
+ QTRY_COMPARE(gridview->contentY(), 0.0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(0));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(0));
+
+ // Check currentIndex is updated when contentItem moves
+ gridview->setContentX(-240);
+ QTRY_COMPARE(gridview->currentIndex(), 3);
+
+ gridview->setCurrentIndex(7);
+ QTRY_COMPARE(gridview->contentX(), -340.);
+ QTRY_COMPARE(gridview->contentY(), 0.0);
+
+ QaimModel model2;
+ for (int i = 0; i < 5; i++)
+ model2.addItem("Item" + QString::number(i), "");
+
+ ctxt->setContextProperty("testModel", &model2);
+ QCOMPARE(gridview->count(), 5);
+
+ delete window;
+}
+
+void tst_QQuickGridView::QTBUG_8456()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("setindex.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QTRY_COMPARE(gridview->currentIndex(), 0);
+
+ delete window;
+}
+
+void tst_QQuickGridView::manualHighlight()
+{
+ QQuickView *window = createView();
+
+ QString filename(testFile("manual-highlight.qml"));
+ window->setSource(QUrl::fromLocalFile(filename));
+
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(gridview->currentIndex(), 0);
+ QTRY_COMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0));
+ QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x());
+
+ gridview->setCurrentIndex(2);
+
+ QTRY_COMPARE(gridview->currentIndex(), 2);
+ QTRY_COMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 2));
+ QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x());
+
+ gridview->positionViewAtIndex(8, QQuickGridView::Contain);
+
+ QTRY_COMPARE(gridview->currentIndex(), 2);
+ QTRY_COMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 2));
+ QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x());
+
+ gridview->setFlow(QQuickGridView::FlowTopToBottom);
+ QTRY_COMPARE(gridview->flow(), QQuickGridView::FlowTopToBottom);
+
+ gridview->setCurrentIndex(0);
+ QTRY_COMPARE(gridview->currentIndex(), 0);
+ QTRY_COMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0));
+ QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x());
+
+ delete window;
+}
+
+
+void tst_QQuickGridView::footer()
+{
+ QFETCH(QQuickGridView::Flow, flow);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, initialFooterPos);
+ QFETCH(QPointF, changedFooterPos);
+ QFETCH(QPointF, initialContentPos);
+ QFETCH(QPointF, firstDelegatePos);
+ QFETCH(QPointF, resizeContentPos);
+
+ QQuickView *window = getView();
+ window->show();
+
+ QaimModel model;
+ for (int i = 0; i < 7; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("footer.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+ gridview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *footer = findItem<QQuickText>(contentItem, "footer");
+ QVERIFY(footer);
+ QVERIFY(footer == gridview->footerItem());
+
+ QCOMPARE(footer->position(), initialFooterPos);
+ QCOMPARE(footer->width(), 100.);
+ QCOMPARE(footer->height(), 30.);
+ QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos);
+
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentHeight(), (model.count()+2) / 3 * 60. + footer->height());
+ else
+ QCOMPARE(gridview->contentWidth(), (model.count()+3) / 5 * 80. + footer->width());
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ if (flow == QQuickGridView::FlowLeftToRight) {
+ // shrink by one row
+ model.removeItem(2);
+ if (verticalLayoutDirection == QQuickItemView::TopToBottom)
+ QTRY_COMPARE(footer->y(), initialFooterPos.y() - gridview->cellHeight());
+ else
+ QTRY_COMPARE(footer->y(), initialFooterPos.y() + gridview->cellHeight());
+ } else {
+ // shrink by one column
+ model.removeItem(2);
+ model.removeItem(3);
+ if (layoutDirection == Qt::LeftToRight)
+ QTRY_COMPARE(footer->x(), initialFooterPos.x() - gridview->cellWidth());
+ else
+ QTRY_COMPARE(footer->x(), initialFooterPos.x() + gridview->cellWidth());
+ }
+
+ // remove all items
+ model.clear();
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QTRY_COMPARE(gridview->contentHeight(), footer->height());
+ else
+ QTRY_COMPARE(gridview->contentWidth(), footer->width());
+
+ QPointF posWhenNoItems(0, 0);
+ if (layoutDirection == Qt::RightToLeft)
+ posWhenNoItems.setX(flow == QQuickGridView::FlowLeftToRight ? gridview->width() - footer->width() : -footer->width());
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop)
+ posWhenNoItems.setY(-footer->height());
+ QTRY_COMPARE(footer->position(), posWhenNoItems);
+
+ // if header is toggled, it shouldn't affect the footer position
+ window->rootObject()->setProperty("showHeader", true);
+ QVERIFY(findItem<QQuickItem>(contentItem, "header") != 0);
+ QTRY_COMPARE(footer->position(), posWhenNoItems);
+ window->rootObject()->setProperty("showHeader", false);
+
+ // add 30 items
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QSignalSpy footerItemSpy(gridview, SIGNAL(footerItemChanged()));
+ QMetaObject::invokeMethod(window->rootObject(), "changeFooter");
+
+ QCOMPARE(footerItemSpy.count(), 1);
+
+ footer = findItem<QQuickText>(contentItem, "footer");
+ QVERIFY(!footer);
+ footer = findItem<QQuickText>(contentItem, "footer2");
+ QVERIFY(footer);
+ QVERIFY(footer == gridview->footerItem());
+
+ QCOMPARE(footer->position(), changedFooterPos);
+ QCOMPARE(footer->width(), 50.);
+ QCOMPARE(footer->height(), 20.);
+
+ // changing the footer shouldn't change the content pos
+ QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ gridview->positionViewAtEnd();
+ footer->setHeight(10);
+ footer->setWidth(40);
+ QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), resizeContentPos);
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::footer_data()
+{
+ QTest::addColumn<QQuickGridView::Flow>("flow");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("initialFooterPos");
+ QTest::addColumn<QPointF>("changedFooterPos");
+ QTest::addColumn<QPointF>("initialContentPos");
+ QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
+
+ // footer1 = 100 x 30
+ // footer2 = 50 x 20
+ // cells = 80 * 60
+ // view width = 240
+ // view height = 320
+
+ // footer below items, bottom left
+ QTest::newRow("LeftToRight, LtR, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, 3 * 60) // 180 = height of 3 rows (cell height is 60)
+ << QPointF(0, 10 * 60) // 30 items = 10 rows
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, (10 * 60) - 320 + 10);
+
+ // footer below items, bottom right
+ QTest::newRow("LeftToRight, RtL, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(240 - 100, 3 * 60)
+ << QPointF((240 - 100) + 50, 10 * 60) // 50 = width diff between old and new footers
+ << QPointF(0, 0)
+ << QPointF(240 - 80, 0)
+ << QPointF(0, (10 * 60) - 320 + 10);
+
+ // footer above items, top left
+ QTest::newRow("LeftToRight, LtR, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, -(3 * 60) - 30)
+ << QPointF(0, -(10 * 60) - 20)
+ << QPointF(0, -320)
+ << QPointF(0, -60)
+ << QPointF(0, -(10 * 60) - 10);
+
+ // footer above items, top right
+ QTest::newRow("LeftToRight, RtL, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(240 - 100, -(3 * 60) - 30)
+ << QPointF((240 - 100) + 50, -(10 * 60) - 20)
+ << QPointF(0, -320)
+ << QPointF(240 - 80, -60)
+ << QPointF(0, -(10 * 60) - 10);
+
+
+ // footer to right of items, bottom right
+ QTest::newRow("TopToBottom, LtR, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(2 * 80, 0) // 2 columns, cell width 80
+ << QPointF(6 * 80, 0) // 30 items = 6 columns
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF((6 * 80) - 240 + 40, 0);
+
+ // footer to left of items, bottom right
+ QTest::newRow("TopToBottom, RtL, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(-(2 * 80) - 100, 0)
+ << QPointF(-(6 * 80) - 50, 0) // 50 = new footer width
+ << QPointF(-240, 0)
+ << QPointF(-80, 0)
+ << QPointF(-(6 * 80) - 40, 0);
+
+ // footer to right of items, top right
+ QTest::newRow("TopToBottom, LtR, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(2 * 80, -30)
+ << QPointF(6 * 80, -20)
+ << QPointF(0, -320)
+ << QPointF(0, -60)
+ << QPointF((6 * 80) - 240 + 40, -320);
+
+ // footer to left of items, top left
+ QTest::newRow("TopToBottom, RtL, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(-(2 * 80) - 100, -30)
+ << QPointF(-(6 * 80) - 50, -20)
+ << QPointF(-240, -320)
+ << QPointF(-80, -60)
+ << QPointF(-(6 * 80) - 40, -320);
+}
+
+void tst_QQuickGridView::initialZValues()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("initialZValues.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QVERIFY(gridview->headerItem());
+ QTRY_COMPARE(gridview->headerItem()->z(), gridview->property("initialZ").toReal());
+
+ QVERIFY(gridview->footerItem());
+ QTRY_COMPARE(gridview->footerItem()->z(), gridview->property("initialZ").toReal());
+
+ delete window;
+}
+
+void tst_QQuickGridView::header()
+{
+ QFETCH(QQuickGridView::Flow, flow);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, initialHeaderPos);
+ QFETCH(QPointF, changedHeaderPos);
+ QFETCH(QPointF, initialContentPos);
+ QFETCH(QPointF, changedContentPos);
+ QFETCH(QPointF, firstDelegatePos);
+ QFETCH(QPointF, resizeContentPos);
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->rootContext()->setContextProperty("initialViewWidth", 240);
+ window->rootContext()->setContextProperty("initialViewHeight", 320);
+ window->setSource(testFileUrl("header.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+ gridview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *header = findItem<QQuickText>(contentItem, "header");
+ QVERIFY(header);
+ QVERIFY(header == gridview->headerItem());
+
+ QCOMPARE(header->position(), initialHeaderPos);
+ QCOMPARE(header->width(), 100.);
+ QCOMPARE(header->height(), 30.);
+ QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos);
+
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentHeight(), (model.count()+2) / 3 * 60. + header->height());
+ else
+ QCOMPARE(gridview->contentWidth(), (model.count()+3) / 5 * 80. + header->width());
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ model.clear();
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ QCOMPARE(header->position(), initialHeaderPos); // header should stay where it is
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentHeight(), header->height());
+ else
+ QCOMPARE(gridview->contentWidth(), header->width());
+
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QSignalSpy headerItemSpy(gridview, SIGNAL(headerItemChanged()));
+ QMetaObject::invokeMethod(window->rootObject(), "changeHeader");
+
+ QCOMPARE(headerItemSpy.count(), 1);
+
+ header = findItem<QQuickText>(contentItem, "header");
+ QVERIFY(!header);
+ header = findItem<QQuickText>(contentItem, "header2");
+ QVERIFY(header);
+
+ QVERIFY(header == gridview->headerItem());
+
+ QCOMPARE(header->position(), changedHeaderPos);
+ QCOMPARE(header->width(), 50.);
+ QCOMPARE(header->height(), 20.);
+ QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), changedContentPos);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ header->setHeight(10);
+ header->setWidth(40);
+ QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), resizeContentPos);
+
+ releaseView(window);
+
+
+ // QTBUG-21207 header should become visible if view resizes from initial empty size
+
+ window = getView();
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->rootContext()->setContextProperty("initialViewWidth", 240);
+ window->rootContext()->setContextProperty("initialViewHeight", 320);
+ window->setSource(testFileUrl("header.qml"));
+ window->show();
+ qApp->processEvents();
+
+ gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+ gridview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ gridview->setWidth(240);
+ gridview->setHeight(320);
+ QTRY_COMPARE(gridview->headerItem()->position(), initialHeaderPos);
+ QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos);
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::header_data()
+{
+ QTest::addColumn<QQuickGridView::Flow>("flow");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("initialHeaderPos");
+ QTest::addColumn<QPointF>("changedHeaderPos");
+ QTest::addColumn<QPointF>("initialContentPos");
+ QTest::addColumn<QPointF>("changedContentPos");
+ QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
+
+ // header1 = 100 x 30
+ // header2 = 50 x 20
+ // cells = 80 x 60
+ // view width = 240
+
+ // header above items, top left
+ QTest::newRow("LeftToRight, LtR, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(0, 0)
+ << QPointF(0, -10);
+
+ // header above items, top right
+ QTest::newRow("LeftToRight, RtL, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(240 - 100, -30)
+ << QPointF((240 - 100) + 50, -20) // 50 = width diff between old and new headers
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(160, 0)
+ << QPointF(0, -10);
+
+ // header below items, bottom left
+ QTest::newRow("LeftToRight, LtR, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, -320 + 30)
+ << QPointF(0, -320 + 20)
+ << QPointF(0, -60)
+ << QPointF(0, -320 + 10);
+
+ // header above items, top right
+ QTest::newRow("LeftToRight, RtL, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(240 - 100, 0)
+ << QPointF((240 - 100) + 50, 0)
+ << QPointF(0, -320 + 30)
+ << QPointF(0, -320 + 20)
+ << QPointF(160, -60)
+ << QPointF(0, -320 + 10);
+
+
+ // header to left of items, bottom left
+ QTest::newRow("TopToBottom, LtR, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(-100, 0)
+ << QPointF(-50, 0)
+ << QPointF(-100, 0)
+ << QPointF(-50, 0)
+ << QPointF(0, 0)
+ << QPointF(-40, 0);
+
+ // header to right of items, bottom right
+ QTest::newRow("TopToBottom, RtL, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(-(240 - 100), 0)
+ << QPointF(-(240 - 50), 0)
+ << QPointF(-80, 0)
+ << QPointF(-(240 - 40), 0);
+
+ // header to left of items, top left
+ QTest::newRow("TopToBottom, LtR, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(-100, -30)
+ << QPointF(-50, -20)
+ << QPointF(-100, -320)
+ << QPointF(-50, -320)
+ << QPointF(0, -60)
+ << QPointF(-40, -320);
+
+ // header to right of items, top right
+ QTest::newRow("TopToBottom, RtL, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(-(240 - 100), -320)
+ << QPointF(-(240 - 50), -320)
+ << QPointF(-80, -60)
+ << QPointF(-(240 - 40), -320);
+}
+
+class GVAccessor : public QQuickGridView
+{
+public:
+ qreal minY() const { return minYExtent(); }
+ qreal maxY() const { return maxYExtent(); }
+ qreal minX() const { return minXExtent(); }
+ qreal maxX() const { return maxXExtent(); }
+};
+
+void tst_QQuickGridView::extents()
+{
+ QFETCH(QQuickGridView::Flow, flow);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, headerPos);
+ QFETCH(QPointF, footerPos);
+ QFETCH(QPointF, minPos);
+ QFETCH(QPointF, maxPos);
+ QFETCH(QPointF, origin_empty);
+ QFETCH(QPointF, origin_nonEmpty);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ QQmlContext *ctxt = window->rootContext();
+
+ ctxt->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("headerfooter.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject());
+ QTRY_VERIFY(gridview != 0);
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+ gridview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->position(), headerPos);
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->position(), footerPos);
+
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->minX(), minPos.x());
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->minY(), minPos.y());
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->maxX(), maxPos.x());
+ QCOMPARE(static_cast<GVAccessor*>(gridview)->maxY(), maxPos.y());
+
+ QCOMPARE(gridview->originX(), origin_empty.x());
+ QCOMPARE(gridview->originY(), origin_empty.y());
+ for (int i=0; i<30; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QTRY_COMPARE(gridview->count(), model.count());
+ QCOMPARE(gridview->originX(), origin_nonEmpty.x());
+ QCOMPARE(gridview->originY(), origin_nonEmpty.y());
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::extents_data()
+{
+ QTest::addColumn<QQuickGridView::Flow>("flow");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("headerPos");
+ QTest::addColumn<QPointF>("footerPos");
+ QTest::addColumn<QPointF>("minPos");
+ QTest::addColumn<QPointF>("maxPos");
+ QTest::addColumn<QPointF>("origin_empty");
+ QTest::addColumn<QPointF>("origin_nonEmpty");
+
+ // header is 240x20 (or 20x320 in TopToBottom)
+ // footer is 240x30 (or 30x320 in TopToBottom)
+ // grid has 10 rows in LeftToRight mode and 6 columns in TopToBottom
+
+ QTest::newRow("LeftToRight, LtR, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, -20) << QPointF(0, 0)
+ << QPointF(0, 20) << QPointF(240, 20)
+ << QPointF(0, -20) << QPointF(0, -20);
+
+ QTest::newRow("LeftToRight, RtL, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(0, -20) << QPointF(0, 0)
+ << QPointF(0, 20) << QPointF(240, 20)
+ << QPointF(0, -20) << QPointF(0, -20);
+
+ QTest::newRow("LeftToRight, LtR, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, 0) << QPointF(0, -30)
+ << QPointF(0, 320 - 20) << QPointF(240, 320 - 20) // content flow is reversed
+ << QPointF(0, -30) << QPointF(0, (-60.0 * 10) - 30);
+
+ QTest::newRow("LeftToRight, RtL, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(0, 0) << QPointF(0, -30)
+ << QPointF(0, 320 - 20) << QPointF(240, 320 - 20) // content flow is reversed
+ << QPointF(0, -30) << QPointF(0, (-60.0 * 10) - 30);
+
+
+ QTest::newRow("TopToBottom, LtR, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(-20, 0) << QPointF(0, 0)
+ << QPointF(20, 0) << QPointF(20, 320)
+ << QPointF(-20, 0) << QPointF(-20, 0);
+
+ QTest::newRow("TopToBottom, RtL, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(0, 0) << QPointF(-30, 0)
+ << QPointF(240 - 20, 0) << QPointF(240 - 20, 320) // content flow is reversed
+ << QPointF(-30, 0) << QPointF((-80.0 * 6) - 30, 0);
+
+ QTest::newRow("TopToBottom, LtR, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(-20, -320) << QPointF(0, -320)
+ << QPointF(20, 0) << QPointF(20, 320)
+ << QPointF(-20, 0) << QPointF(-20, 0);
+
+ QTest::newRow("TopToBottom, RtL, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(0, -320) << QPointF(-30, -320)
+ << QPointF(240 - 20, 0) << QPointF(240 - 20, 320) // content flow is reversed
+ << QPointF(-30, 0) << QPointF((-80.0 * 6) - 30, 0);
+}
+
+void tst_QQuickGridView::resetModel_headerFooter()
+{
+ // Resetting a model shouldn't crash in views with header/footer
+
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 6; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("headerfooter.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject());
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 60.*2);
+
+ model.reset();
+
+ header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 60.*2);
+
+ delete window;
+}
+
+void tst_QQuickGridView::resizeViewAndRepaint()
+{
+ QQuickView *window = createView();
+ window->show();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("initialWidth", 240);
+ ctxt->setContextProperty("initialHeight", 100);
+
+ window->setSource(testFileUrl("resizeview.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // item at index 10 should not be currently visible
+ QVERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 10));
+
+ gridview->setHeight(320);
+ QTRY_VERIFY(findItem<QQuickItem>(contentItem, "wrapper", 10));
+
+ gridview->setHeight(100);
+ QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 10));
+
+ // Ensure we handle -ve sizes
+ gridview->setHeight(-100);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 3);
+
+ gridview->setCacheBuffer(120);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 9);
+
+ // ensure items in cache become visible
+ gridview->setHeight(120);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 15);
+
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal((i%3)*80));
+ QTRY_COMPARE(item->y(), qreal((i/3)*60));
+ QCOMPARE(delegateVisible(item), i < 9); // inside view visible, outside not visible
+ }
+
+ // ensure items outside view become invisible
+ gridview->setHeight(60);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 12);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), qreal((i%3)*80));
+ QTRY_COMPARE(item->y(), qreal((i/3)*60));
+ QCOMPARE(delegateVisible(item), i < 6); // inside view visible, outside not visible
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::resizeGrid()
+{
+ QFETCH(QQuickGridView::Flow, flow);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, initialContentPos);
+ QFETCH(QPointF, firstItemPos);
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testTopToBottom", flow == QQuickGridView::FlowTopToBottom);
+ ctxt->setContextProperty("testRightToLeft", layoutDirection == Qt::RightToLeft);
+ ctxt->setContextProperty("testBottomToTop", verticalLayoutDirection == QQuickGridView::BottomToTop);
+ window->setSource(testFileUrl("resizegrid.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // set the width to slightly larger than 3 items across, to test
+ // items are aligned correctly in right-to-left
+ window->rootObject()->setWidth(260);
+ window->rootObject()->setHeight(320);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QCOMPARE(gridview->contentX(), initialContentPos.x());
+ QCOMPARE(gridview->contentY(), initialContentPos.y());
+
+ QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item0);
+ QCOMPARE(item0->position(), firstItemPos);
+
+ // Confirm items positioned correctly and indexes correct
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ QVERIFY(items.count() >= 18 && items.count() <= 21);
+ for (int i = 0; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->position(), expectedItemPos(gridview, i, 0));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(i));
+ }
+
+ // change from 3x5 grid to 4x7
+ window->rootObject()->setWidth(window->rootObject()->width() + 80);
+ window->rootObject()->setHeight(window->rootObject()->height() + 60*2);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // other than in LeftToRight+RightToLeft layout, the first item should not move
+ // if view is resized
+ QCOMPARE(findItem<QQuickItem>(contentItem, "wrapper", 0), item0);
+ if (flow == QQuickGridView::FlowLeftToRight && layoutDirection == Qt::RightToLeft)
+ firstItemPos.rx() += 80;
+ QCOMPARE(item0->position(), firstItemPos);
+
+ QPointF newContentPos = initialContentPos;
+ if (flow == QQuickGridView::FlowTopToBottom && layoutDirection == Qt::RightToLeft)
+ newContentPos.rx() -= 80.0;
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop)
+ newContentPos.ry() -= 60.0 * 2;
+ QCOMPARE(gridview->contentX(), newContentPos.x());
+ QCOMPARE(gridview->contentY(), newContentPos.y());
+
+ // Confirm items positioned correctly and indexes correct
+ items = findItems<QQuickItem>(contentItem, "wrapper");
+ QVERIFY(items.count() >= 28);
+ for (int i = 0; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->position(), expectedItemPos(gridview, i, 0));
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::resizeGrid_data()
+{
+ QTest::addColumn<QQuickGridView::Flow>("flow");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("initialContentPos");
+ QTest::addColumn<QPointF>("firstItemPos");
+
+ // Initial view width is 260, so in LeftToRight + right-to-left mode the
+ // content x should be -20
+
+ QTest::newRow("LeftToRight, LtR, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, 0)
+ << QPointF(0, 0);
+
+ QTest::newRow("LeftToRight, RtL, TtB")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(-20.0, 0)
+ << QPointF(80.0 * 2, 0);
+
+ QTest::newRow("LeftToRight, LtR, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, -320)
+ << QPointF(0, -60.0);
+
+ QTest::newRow("LeftToRight, RtL, BtT")
+ << QQuickGridView::FlowLeftToRight << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(-20.0, -320)
+ << QPointF(80.0 * 2, -60.0);
+
+
+ QTest::newRow("TopToBottom, LtR, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, 0)
+ << QPointF(0, 0);
+
+ QTest::newRow("TopToBottom, RtL, TtB")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(-260, 0)
+ << QPointF(-80.0, 0);
+
+ QTest::newRow("TopToBottom, LtR, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, -320)
+ << QPointF(0, -60.0);
+
+ QTest::newRow("TopToBottom, RtL, BtT")
+ << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << QQuickItemView::BottomToTop
+ << QPointF(-260, -320)
+ << QPointF(-80.0, -60.0);
+}
+
+
+void tst_QQuickGridView::changeColumnCount()
+{
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = createView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("initialWidth", 100);
+ ctxt->setContextProperty("initialHeight", 320);
+ window->setSource(testFileUrl("resizeview.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ // a single column of 6 items are visible
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ QCOMPARE(itemCount, 6);
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), 0.0);
+ QCOMPARE(item->y(), qreal(i*60));
+ }
+
+ // now 6x3 grid is visible, plus 1 extra below for refill
+ gridview->setWidth(240);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ QCOMPARE(itemCount, 6*3 + 1);
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), qreal((i%3)*80));
+ QCOMPARE(item->y(), qreal((i/3)*60));
+ }
+
+ // back to single column
+ gridview->setWidth(100);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ QCOMPARE(itemCount, 6);
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), 0.0);
+ QCOMPARE(item->y(), qreal(i*60));
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::indexAt_itemAt_data()
+{
+ QTest::addColumn<qreal>("x");
+ QTest::addColumn<qreal>("y");
+ QTest::addColumn<int>("index");
+
+ QTest::newRow("Item 0 - 0, 0") << 0. << 0. << 0;
+ QTest::newRow("Item 0 - 79, 59") << 79. << 59. << 0;
+ QTest::newRow("Item 1 - 80, 0") << 80. << 0. << 1;
+ QTest::newRow("Item 3 - 0, 60") << 0. << 60. << 3;
+ QTest::newRow("No Item - 240, 0") << 240. << 0. << -1;
+}
+
+void tst_QQuickGridView::indexAt_itemAt()
+{
+ QFETCH(qreal, x);
+ QFETCH(qreal, y);
+ QFETCH(int, index);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Billy", "22345");
+ model.addItem("Sam", "2945");
+ model.addItem("Ben", "04321");
+ model.addItem("Jim", "0780");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(gridview->count(), model.count());
+
+ QQuickItem *item = 0;
+ if (index >= 0) {
+ item = findItem<QQuickItem>(contentItem, "wrapper", index);
+ QVERIFY(item);
+ }
+ QCOMPARE(gridview->indexAt(x, y), index);
+ QVERIFY(gridview->itemAt(x, y) == item);
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::onAdd()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(int, itemsToAdd);
+
+ const int delegateWidth = 50;
+ const int delegateHeight = 100;
+ QaimModel model;
+ QQuickView *window = getView();
+ window->setGeometry(0,0,5 * delegateWidth, 5 * delegateHeight); // just ensure all items fit
+
+ // these initial items should not trigger GridView.onAdd
+ for (int i=0; i<initialItemCount; i++)
+ model.addItem("dummy value", "dummy value");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("delegateWidth", delegateWidth);
+ ctxt->setContextProperty("delegateHeight", delegateHeight);
+ window->setSource(testFileUrl("attachedSignals.qml"));
+
+ QObject *object = window->rootObject();
+ object->setProperty("width", window->width());
+ object->setProperty("height", window->height());
+ qApp->processEvents();
+
+ QList<QPair<QString, QString> > items;
+ for (int i=0; i<itemsToAdd; i++)
+ items << qMakePair(QString("value %1").arg(i), QString::number(i));
+ model.addItems(items);
+
+ QTRY_COMPARE(model.count(), qobject_cast<QQuickGridView*>(window->rootObject())->count());
+ qApp->processEvents();
+
+ QVariantList result = object->property("addedDelegates").toList();
+ QTRY_COMPARE(result.count(), items.count());
+ for (int i=0; i<items.count(); i++)
+ QCOMPARE(result[i].toString(), items[i].first);
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::onAdd_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<int>("itemsToAdd");
+
+ QTest::newRow("0, add 1") << 0 << 1;
+ QTest::newRow("0, add 2") << 0 << 2;
+ QTest::newRow("0, add 10") << 0 << 10;
+
+ QTest::newRow("1, add 1") << 1 << 1;
+ QTest::newRow("1, add 2") << 1 << 2;
+ QTest::newRow("1, add 10") << 1 << 10;
+
+ QTest::newRow("5, add 1") << 5 << 1;
+ QTest::newRow("5, add 2") << 5 << 2;
+ QTest::newRow("5, add 10") << 5 << 10;
+}
+
+void tst_QQuickGridView::onRemove()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(int, indexToRemove);
+ QFETCH(int, removeCount);
+
+ const int delegateWidth = 50;
+ const int delegateHeight = 100;
+ QaimModel model;
+ for (int i=0; i<initialItemCount; i++)
+ model.addItem(QString("value %1").arg(i), "dummy value");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("delegateWidth", delegateWidth);
+ ctxt->setContextProperty("delegateHeight", delegateHeight);
+ window->setSource(testFileUrl("attachedSignals.qml"));
+ QObject *object = window->rootObject();
+
+ model.removeItems(indexToRemove, removeCount);
+ QTRY_COMPARE(model.count(), qobject_cast<QQuickGridView*>(window->rootObject())->count());
+ QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount));
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::onRemove_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<int>("indexToRemove");
+ QTest::addColumn<int>("removeCount");
+
+ QTest::newRow("remove first") << 1 << 0 << 1;
+ QTest::newRow("two items, remove first") << 2 << 0 << 1;
+ QTest::newRow("two items, remove last") << 2 << 1 << 1;
+ QTest::newRow("two items, remove all") << 2 << 0 << 2;
+
+ QTest::newRow("four items, remove first") << 4 << 0 << 1;
+ QTest::newRow("four items, remove 0-2") << 4 << 0 << 2;
+ QTest::newRow("four items, remove 1-3") << 4 << 1 << 2;
+ QTest::newRow("four items, remove 2-4") << 4 << 2 << 2;
+ QTest::newRow("four items, remove last") << 4 << 3 << 1;
+ QTest::newRow("four items, remove all") << 4 << 0 << 4;
+
+ QTest::newRow("ten items, remove 1-8") << 10 << 0 << 8;
+ QTest::newRow("ten items, remove 2-7") << 10 << 2 << 5;
+ QTest::newRow("ten items, remove 4-10") << 10 << 4 << 6;
+}
+
+void tst_QQuickGridView::columnCount()
+{
+ QQuickView window;
+ window.setSource(testFileUrl("gridview4.qml"));
+ window.show();
+ window.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&window));
+
+ QQuickGridView *view = qobject_cast<QQuickGridView*>(window.rootObject());
+
+ QCOMPARE(view->cellWidth(), qreal(405)/qreal(9));
+ QCOMPARE(view->cellHeight(), qreal(100));
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(view, "delegate");
+ QCOMPARE(items.size(), 18);
+ QCOMPARE(items.at(8)->y(), qreal(0));
+ QCOMPARE(items.at(9)->y(), qreal(100));
+}
+
+void tst_QQuickGridView::margins()
+{
+ {
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testRightToLeft", QVariant(false));
+
+ window->setSource(testFileUrl("margins.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QCOMPARE(gridview->contentX(), -30.);
+ QCOMPARE(gridview->originX(), 0.);
+
+ // check end bound
+ gridview->positionViewAtEnd();
+ qreal pos = gridview->contentX();
+ gridview->setContentX(pos + 80);
+ gridview->returnToBounds();
+ QTRY_COMPARE(gridview->contentX(), pos + 50);
+
+ // remove item before visible and check that left margin is maintained
+ // and originX is updated
+ gridview->setContentX(200);
+ model.removeItems(0, 4);
+ QTest::qWait(100);
+ gridview->setContentX(-50);
+ gridview->returnToBounds();
+ QCOMPARE(gridview->originX(), 100.);
+ QTRY_COMPARE(gridview->contentX(), 70.);
+
+ // reduce left margin
+ gridview->setLeftMargin(20);
+ QCOMPARE(gridview->originX(), 100.);
+ QTRY_COMPARE(gridview->contentX(), 80.);
+
+ // check end bound
+ gridview->positionViewAtEnd();
+ QCOMPARE(gridview->originX(), 0.); // positionViewAtEnd() resets origin
+ pos = gridview->contentX();
+ gridview->setContentX(pos + 80);
+ gridview->returnToBounds();
+ QTRY_COMPARE(gridview->contentX(), pos + 50);
+
+ // reduce right margin
+ pos = gridview->contentX();
+ gridview->setRightMargin(40);
+ QCOMPARE(gridview->originX(), 0.);
+ QTRY_COMPARE(gridview->contentX(), pos-10);
+
+ delete window;
+ }
+ {
+ //RTL
+ QQuickView *window = createView();
+ window->show();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testRightToLeft", QVariant(true));
+
+ window->setSource(testFileUrl("margins.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(gridview->contentX(), -240+50.);
+ QTRY_COMPARE(gridview->originX(), -100. * 10);
+
+ // check end bound
+ gridview->positionViewAtEnd();
+ qreal pos = gridview->contentX();
+ gridview->setContentX(pos - 80);
+ gridview->returnToBounds();
+ QTRY_COMPARE(gridview->contentX(), pos - 30);
+
+ // remove item before visible and check that left margin is maintained
+ // and originX is updated
+ gridview->setContentX(-400);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ model.removeItems(0, 4);
+ QTRY_COMPARE(model.count(), gridview->count());
+ gridview->setContentX(-240+50);
+ gridview->returnToBounds();
+ QCOMPARE(gridview->originX(), -1000.);
+ QTRY_COMPARE(gridview->contentX(), -240-50.);
+
+ // reduce right margin
+ pos = gridview->contentX();
+ gridview->setRightMargin(40);
+ QCOMPARE(gridview->originX(), -1000.);
+ QTRY_COMPARE(gridview->contentX(), -240-100 + 40.);
+
+ // check end bound
+ gridview->positionViewAtEnd();
+ QCOMPARE(gridview->originX(), -900.); // positionViewAtEnd() resets origin
+ pos = gridview->contentX();
+ gridview->setContentX(pos - 80);
+ gridview->returnToBounds();
+ QTRY_COMPARE(gridview->contentX(), pos - 30);
+
+ // reduce left margin
+ pos = gridview->contentX();
+ gridview->setLeftMargin(20);
+ QCOMPARE(gridview->originX(), -900.);
+ QTRY_COMPARE(gridview->contentX(), pos+10);
+
+ delete window;
+ }
+}
+
+void tst_QQuickGridView::creationContext()
+{
+ QQuickView window;
+ window.setGeometry(0,0,240,320);
+ window.setSource(testFileUrl("creationContext.qml"));
+ qApp->processEvents();
+
+ QQuickItem *rootItem = qobject_cast<QQuickItem *>(window.rootObject());
+ QVERIFY(rootItem);
+ QVERIFY(rootItem->property("count").toInt() > 0);
+
+ QQuickItem *item;
+ QVERIFY(item = findItem<QQuickItem>(rootItem, "listItem"));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+ QVERIFY(item = rootItem->findChild<QQuickItem *>("header"));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+ QVERIFY(item = rootItem->findChild<QQuickItem *>("footer"));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+}
+
+void tst_QQuickGridView::snapToRow_data()
+{
+ QTest::addColumn<QQuickGridView::Flow>("flow");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<int>("highlightRangeMode");
+ QTest::addColumn<QPoint>("flickStart");
+ QTest::addColumn<QPoint>("flickEnd");
+ QTest::addColumn<qreal>("snapAlignment");
+ QTest::addColumn<qreal>("endExtent");
+ QTest::addColumn<qreal>("startExtent");
+
+ QTest::newRow("vertical, left to right") << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 800.0 << 0.0;
+
+ QTest::newRow("horizontal, left to right") << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 800.0 << 0.0;
+
+ QTest::newRow("horizontal, right to left") << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 << -240.0;
+
+ QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 940.0 << -20.0;
+
+ QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 940.0 << -20.0;
+
+ QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 - 140.0 << -220.0;
+}
+
+void tst_QQuickGridView::snapToRow()
+{
+ QFETCH(QQuickGridView::Flow, flow);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(int, highlightRangeMode);
+ QFETCH(QPoint, flickStart);
+ QFETCH(QPoint, flickEnd);
+ QFETCH(qreal, snapAlignment);
+ QFETCH(qreal, endExtent);
+ QFETCH(qreal, startExtent);
+
+ QQuickView *window = getView();
+
+ window->setSource(testFileUrl("snapToRow.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+ gridview->setHighlightRangeMode(QQuickItemView::HighlightRangeMode(highlightRangeMode));
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // confirm that a flick hits an item boundary
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(qreal(fmod(gridview->contentY(),80.0)), snapAlignment);
+ else
+ QCOMPARE(qreal(fmod(gridview->contentX(),80.0)), snapAlignment);
+
+ // flick to end
+ do {
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops
+ } while (flow == QQuickGridView::FlowLeftToRight
+ ? !gridview->isAtYEnd()
+ : layoutDirection == Qt::LeftToRight ? !gridview->isAtXEnd() : !gridview->isAtXBeginning());
+
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentY(), endExtent);
+ else
+ QCOMPARE(gridview->contentX(), endExtent);
+
+ // flick to start
+ do {
+ flick(window, flickEnd, flickStart, 180);
+ QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops
+ } while (flow == QQuickGridView::FlowLeftToRight
+ ? !gridview->isAtYBeginning()
+ : layoutDirection == Qt::LeftToRight ? !gridview->isAtXBeginning() : !gridview->isAtXEnd());
+
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentY(), startExtent);
+ else
+ QCOMPARE(gridview->contentX(), startExtent);
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::snapOneRow_data()
+{
+ QTest::addColumn<QQuickGridView::Flow>("flow");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<int>("highlightRangeMode");
+ QTest::addColumn<QPoint>("flickStart");
+ QTest::addColumn<QPoint>("flickEnd");
+ QTest::addColumn<qreal>("snapAlignment");
+ QTest::addColumn<qreal>("endExtent");
+ QTest::addColumn<qreal>("startExtent");
+
+ QTest::newRow("vertical, left to right") << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 160) << QPoint(20, 20) << 100.0 << 240.0 << 0.0;
+
+ QTest::newRow("horizontal, left to right") << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
+ << QPoint(160, 20) << QPoint(20, 20) << 100.0 << 240.0 << 0.0;
+
+ QTest::newRow("horizontal, right to left") << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 20) << QPoint(160, 20) << -340.0 << -240.0 - 240.0 << -240.0;
+
+ QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 160) << QPoint(20, 20) << 100.0 << 340.0 << -20.0;
+
+ QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(160, 20) << QPoint(20, 20) << 100.0 << 340.0 << -20.0;
+
+ QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 20) << QPoint(160, 20) << -340.0 << -240.0 - 240.0 - 100.0 << -220.0;
+}
+
+void tst_QQuickGridView::snapOneRow()
+{
+ QFETCH(QQuickGridView::Flow, flow);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(int, highlightRangeMode);
+ QFETCH(QPoint, flickStart);
+ QFETCH(QPoint, flickEnd);
+ QFETCH(qreal, snapAlignment);
+ QFETCH(qreal, endExtent);
+ QFETCH(qreal, startExtent);
+
+ QQuickView *window = getView();
+
+ window->setSource(testFileUrl("snapOneRow.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ gridview->setFlow(flow);
+ gridview->setLayoutDirection(layoutDirection);
+ gridview->setHighlightRangeMode(QQuickItemView::HighlightRangeMode(highlightRangeMode));
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QSignalSpy currentIndexSpy(gridview, SIGNAL(currentIndexChanged()));
+
+ // confirm that a flick hits next row boundary
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentY(), snapAlignment);
+ else
+ QCOMPARE(gridview->contentX(), snapAlignment);
+
+ if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
+ QCOMPARE(gridview->currentIndex(), 2);
+ QCOMPARE(currentIndexSpy.count(), 1);
+ }
+
+ // flick to end
+ do {
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops
+ } while (flow == QQuickGridView::FlowLeftToRight
+ ? !gridview->isAtYEnd()
+ : layoutDirection == Qt::LeftToRight ? !gridview->isAtXEnd() : !gridview->isAtXBeginning());
+
+ if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
+ QCOMPARE(gridview->currentIndex(), 6);
+ QCOMPARE(currentIndexSpy.count(), 3);
+ }
+
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentY(), endExtent);
+ else
+ QCOMPARE(gridview->contentX(), endExtent);
+
+ // flick to start
+ do {
+ flick(window, flickEnd, flickStart, 180);
+ QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops
+ } while (flow == QQuickGridView::FlowLeftToRight
+ ? !gridview->isAtYBeginning()
+ : layoutDirection == Qt::LeftToRight ? !gridview->isAtXBeginning() : !gridview->isAtXEnd());
+
+ if (flow == QQuickGridView::FlowLeftToRight)
+ QCOMPARE(gridview->contentY(), startExtent);
+ else
+ QCOMPARE(gridview->contentX(), startExtent);
+
+ if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
+ QCOMPARE(gridview->currentIndex(), 0);
+ QCOMPARE(currentIndexSpy.count(), 6);
+ }
+
+ releaseView(window);
+}
+
+
+void tst_QQuickGridView::unaligned()
+{
+ QQuickView *window = createView();
+ window->show();
+
+ QaimModel model;
+ for (int i = 0; i < 10; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("unaligned.qml"));
+ qApp->processEvents();
+
+ QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject());
+ QVERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ for (int i = 0; i < 10; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QVERIFY(item);
+ QCOMPARE(item->x(), qreal((i%9)*gridview->cellWidth()));
+ QCOMPARE(item->y(), qreal((i/9)*gridview->cellHeight()));
+ }
+
+ // appending
+ for (int i = 10; i < 18; ++i) {
+ model.addItem("Item" + QString::number(i), "");
+ QQuickItem *item = 0;
+ QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i));
+ QCOMPARE(item->x(), qreal((i%9)*gridview->cellWidth()));
+ QCOMPARE(item->y(), qreal((i/9)*gridview->cellHeight()));
+ }
+
+ // inserting
+ for (int i = 0; i < 10; ++i) {
+ model.insertItem(i, "Item" + QString::number(i), "");
+ QQuickItem *item = 0;
+ QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i));
+ QCOMPARE(item->x(), qreal((i%9)*gridview->cellWidth()));
+ QCOMPARE(item->y(), qreal((i/9)*gridview->cellHeight()));
+ }
+
+ // removing
+ model.removeItems(7, 10);
+ QTRY_COMPARE(model.count(), gridview->count());
+ for (int i = 0; i < 18; ++i) {
+ QQuickItem *item = 0;
+ QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i));
+ QCOMPARE(item->x(), qreal(i%9)*gridview->cellWidth());
+ QCOMPARE(item->y(), qreal(i/9)*gridview->cellHeight());
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::populateTransitions()
+{
+ QFETCH(bool, staticallyPopulate);
+ QFETCH(bool, dynamicallyPopulate);
+ QFETCH(bool, usePopulateTransition);
+
+ QPointF transitionFrom(-50, -50);
+ QPointF transitionVia(100, 100);
+ QaimModel model_transitionFrom;
+ QaimModel model_transitionVia;
+
+ QaimModel model;
+ if (staticallyPopulate) {
+ for (int i = 0; i < 30; i++)
+ model.addItem("item" + QString::number(i), "");
+ }
+
+ QQuickView *window = getView();
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->rootContext()->setContextProperty("usePopulateTransition", usePopulateTransition);
+ window->rootContext()->setContextProperty("dynamicallyPopulate", dynamicallyPopulate);
+ window->rootContext()->setContextProperty("transitionFrom", transitionFrom);
+ window->rootContext()->setContextProperty("transitionVia", transitionVia);
+ window->rootContext()->setContextProperty("model_transitionFrom", &model_transitionFrom);
+ window->rootContext()->setContextProperty("model_transitionVia", &model_transitionVia);
+ window->setSource(testFileUrl("populateTransitions.qml"));
+ window->show();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QVERIFY(gridview);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem);
+
+ // check the populate transition is run
+ if (staticallyPopulate && usePopulateTransition) {
+ QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), 18);
+ QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 0);
+ } else if (dynamicallyPopulate) {
+ QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), 0);
+ QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 18);
+ } else {
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ QCOMPARE(gridview->property("countPopulateTransitions").toInt(), 0);
+ QCOMPARE(gridview->property("countAddTransitions").toInt(), 0);
+ }
+
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ gridview->setProperty("countPopulateTransitions", 0);
+ gridview->setProperty("countAddTransitions", 0);
+
+ // add an item and check this is done with add transition, not populate
+ model.insertItem(0, "another item", "");
+ QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 1);
+ QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), 0);
+
+ // clear the model
+ window->rootContext()->setContextProperty("testModel", QVariant());
+ QTRY_COMPARE(gridview->count(), 0);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0);
+ gridview->setProperty("countPopulateTransitions", 0);
+ gridview->setProperty("countAddTransitions", 0);
+
+ // set to a valid model and check populate transition is run a second time
+ model.clear();
+ for (int i = 0; i < 30; i++)
+ model.addItem("item" + QString::number(i), "");
+ window->rootContext()->setContextProperty("testModel", &model);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 18 : 0);
+ QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 0);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ // reset model and check populate transition is run again
+ gridview->setProperty("countPopulateTransitions", 0);
+ gridview->setProperty("countAddTransitions", 0);
+ model.reset();
+ QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 18 : 0);
+ QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 0);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::populateTransitions_data()
+{
+ QTest::addColumn<bool>("staticallyPopulate");
+ QTest::addColumn<bool>("dynamicallyPopulate");
+ QTest::addColumn<bool>("usePopulateTransition");
+
+ QTest::newRow("static") << true << false << true;
+ QTest::newRow("static, no populate") << true << false << false;
+
+ QTest::newRow("dynamic") << false << true << true;
+ QTest::newRow("dynamic, no populate") << false << true << false;
+
+ QTest::newRow("empty to start with") << false << false << true;
+ QTest::newRow("empty to start with, no populate") << false << false << false;
+}
+
+void tst_QQuickGridView::addTransitions()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(bool, shouldAnimateTargets);
+ QFETCH(qreal, contentYRowOffset);
+ QFETCH(int, insertionIndex);
+ QFETCH(int, insertionCount);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ // added items should start here
+ QPointF targetItems_transitionFrom(-50, -50);
+
+ // displaced items should pass through this point
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_targetItems_transitionFrom;
+ QaimModel model_displacedItems_transitionVia;
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ window->setSource(testFileUrl("addTransitions.qml"));
+ window->show();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ if (contentYRowOffset != 0) {
+ gridview->setContentY(contentYRowOffset * 60.0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ }
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+
+ // only target items that will become visible should be animated
+ QList<QPair<QString, QString> > newData;
+ QList<QPair<QString, QString> > expectedTargetData;
+ QList<int> targetIndexes;
+ if (shouldAnimateTargets) {
+ for (int i=insertionIndex; i<insertionIndex+insertionCount; i++) {
+ newData << qMakePair(QString("New item %1").arg(i), QString(""));
+
+ // last visible item is the first item of the row beneath the view
+ if (i >= (gridview->contentY() / 60)*3 && i < qCeil((gridview->contentY() + gridview->height()) / 60.0)*3) {
+ expectedTargetData << newData.last();
+ targetIndexes << i;
+ }
+ }
+ QVERIFY(expectedTargetData.count() > 0);
+ }
+
+ // start animation
+ if (!newData.isEmpty()) {
+ model.insertItems(insertionIndex, newData);
+ QTRY_COMPARE(model.count(), gridview->count());
+ }
+
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes);
+
+ if (shouldAnimateTargets) {
+ QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count());
+ QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(),
+ expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0);
+
+ // check the target and displaced items were animated
+ model_targetItems_transitionFrom.matchAgainst(expectedTargetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos");
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ matchItemsAndIndexes(gridview->property("targetTrans_items").toMap(), model, targetIndexes);
+ matchIndexLists(gridview->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(gridview->property("targetTrans_targetItems").toList(), targetItems);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes = adjustIndexesForAddDisplaced(expectedDisplacedIndexes.indexes, insertionIndex, insertionCount);
+ matchItemsAndIndexes(gridview->property("displacedTrans_items").toMap(), model, displacedIndexes);
+ matchIndexLists(gridview->property("displacedTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(gridview->property("displacedTrans_targetItems").toList(), targetItems);
+ }
+ } else {
+ QTRY_COMPARE(model_targetItems_transitionFrom.count(), 0);
+ QTRY_COMPARE(model_displacedItems_transitionVia.count(), 0);
+ }
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ if (items[i]->y() >= gridview->contentY()) {
+ QQmlExpression e(qmlContext(items[i]), items[i], "index");
+ firstVisibleIndex = e.evaluate().toInt();
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // verify all items moved to the correct final positions
+ for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), (i%3)*80.0);
+ QCOMPARE(item->y(), (i/3)*60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::addTransitions_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<qreal>("contentYRowOffset");
+ QTest::addColumn<bool>("shouldAnimateTargets");
+ QTest::addColumn<int>("insertionIndex");
+ QTest::addColumn<int>("insertionCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ // if inserting a full row before visible index, items don't appear or animate in, even if there are > 1 new items
+ QTest::newRow("insert 1, just before start")
+ << 30 << 1.0 << false
+ << 0 << 1 << ListRange();
+ QTest::newRow("insert 1, way before start")
+ << 30 << 1.0 << false
+ << 0 << 1 << ListRange();
+ QTest::newRow("insert multiple, just before start")
+ << 30 << 1.0 << false
+ << 0 << 3 << ListRange();
+ QTest::newRow("insert multiple (< 1 row), just before start")
+ << 30 << 1.0 << false
+ << 0 << 2 << ListRange();
+ QTest::newRow("insert multiple, way before start")
+ << 30 << 3.0 << false
+ << 0 << 3 << ListRange();
+
+ QTest::newRow("insert 1 at start")
+ << 30 << 0.0 << true
+ << 0 << 1 << ListRange(0, 17);
+ QTest::newRow("insert multiple at start")
+ << 30 << 0.0 << true
+ << 0 << 3 << ListRange(0, 17);
+ QTest::newRow("insert multiple (> 1 row) at start")
+ << 30 << 0.0 << true
+ << 0 << 5 << ListRange(0, 17);
+ QTest::newRow("insert 1 at start, content y not 0")
+ << 30 << 1.0 << true // first visible is index 3
+ << 3 << 1 << ListRange(0 + 3, 17 + 3);
+ QTest::newRow("insert multiple at start, content y not 0")
+ << 30 << 1.0 << true // first visible is index 3
+ << 3 << 3 << ListRange(0 + 3, 17 + 3);
+ QTest::newRow("insert multiple (> 1 row) at start, content y not 0")
+ << 30 << 1.0 << true // first visible is index 3
+ << 3 << 5 << ListRange(0 + 3, 17 + 3);
+
+ QTest::newRow("insert 1 at start, to empty grid")
+ << 0 << 0.0 << true
+ << 0 << 1 << ListRange();
+ QTest::newRow("insert multiple at start, to empty grid")
+ << 0 << 0.0 << true
+ << 0 << 3 << ListRange();
+
+ QTest::newRow("insert 1 at middle")
+ << 30 << 0.0 << true
+ << 7 << 1 << ListRange(7, 17);
+ QTest::newRow("insert multiple at middle")
+ << 30 << 0.0 << true
+ << 7 << 3 << ListRange(7, 17);
+ QTest::newRow("insert multiple (> 1 row) at middle")
+ << 30 << 0.0 << true
+ << 7 << 5 << ListRange(7, 17);
+
+ QTest::newRow("insert 1 at bottom")
+ << 30 << 0.0 << true
+ << 17 << 1 << ListRange(17, 17);
+ QTest::newRow("insert multiple at bottom")
+ << 30 << 0.0 << true
+ << 17 << 3 << ListRange(17, 17);
+ QTest::newRow("insert 1 at bottom, content y not 0")
+ << 30 << 1.0 << true
+ << 17 + 3 << 1 << ListRange(17 + 3, 17 + 3);
+ QTest::newRow("insert multiple at bottom, content y not 0")
+ << 30 << 1.0 << true
+ << 17 + 3 << 3 << ListRange(17 + 3, 17 + 3);
+
+
+ // items added after the last visible will not be animated in, since they
+ // do not appear in the final view
+ QTest::newRow("insert 1 after end")
+ << 30 << 0.0 << false
+ << 18 << 1 << ListRange();
+ QTest::newRow("insert multiple after end")
+ << 30 << 0.0 << false
+ << 18 << 3 << ListRange();
+}
+
+void tst_QQuickGridView::moveTransitions()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(qreal, contentYRowOffset);
+ QFETCH(qreal, rowOffsetAfterMove);
+ QFETCH(int, moveFrom);
+ QFETCH(int, moveTo);
+ QFETCH(int, moveCount);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ // target and displaced items should pass through these points
+ QPointF targetItems_transitionVia(-50, 50);
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_targetItems_transitionVia;
+ QaimModel model_displacedItems_transitionVia;
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_targetItems_transitionVia", &model_targetItems_transitionVia);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionVia", targetItems_transitionVia);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ window->setSource(testFileUrl("moveTransitions.qml"));
+ window->show();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QQuickText *name;
+
+ if (contentYRowOffset != 0) {
+ gridview->setContentY(contentYRowOffset * 60.0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ }
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+
+ // Items moving to *or* from visible positions should be animated.
+ // Otherwise, they should not be animated.
+ QList<QPair<QString, QString> > expectedTargetData;
+ QList<int> targetIndexes;
+ for (int i=moveFrom; i<moveFrom+moveCount; i++) {
+ int toIndex = moveTo + (i - moveFrom);
+ int firstVisibleIndex = (gridview->contentY() / 60) * 3;
+ int lastVisibleIndex = (qCeil((gridview->contentY() + gridview->height()) / 60.0)*3) - 1;
+ if ((i >= firstVisibleIndex && i <= lastVisibleIndex)
+ || (toIndex >= firstVisibleIndex && toIndex <= lastVisibleIndex)) {
+ expectedTargetData << qMakePair(model.name(i), model.number(i));
+ targetIndexes << i;
+ }
+ }
+ // ViewTransition.index provides the indices that items are moving to, not from
+ targetIndexes = adjustIndexesForMove(targetIndexes, moveFrom, moveTo, moveCount);
+
+ // start animation
+ model.moveItems(moveFrom, moveTo, moveCount);
+
+ QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count());
+ QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(),
+ expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0);
+
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes);
+
+ // check the target and displaced items were animated
+ model_targetItems_transitionVia.matchAgainst(expectedTargetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos");
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ matchItemsAndIndexes(gridview->property("targetTrans_items").toMap(), model, targetIndexes);
+ matchIndexLists(gridview->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(gridview->property("targetTrans_targetItems").toList(), targetItems);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes = adjustIndexesForMove(expectedDisplacedIndexes.indexes, moveFrom, moveTo, moveCount);
+ matchItemsAndIndexes(gridview->property("displacedTrans_items").toMap(), model, displacedIndexes);
+ matchIndexLists(gridview->property("displacedTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(gridview->property("displacedTrans_targetItems").toList(), targetItems);
+ }
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ if (items[i]->y() >= gridview->contentY()) {
+ QQmlExpression e(qmlContext(items[i]), items[i], "index");
+ firstVisibleIndex = e.evaluate().toInt();
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // verify all items moved to the correct final positions
+ qreal pixelOffset = 60 * rowOffsetAfterMove;
+ for (int i=firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), (i%3)*80.0);
+ QCOMPARE(item->y(), (i/3)*60.0 + pixelOffset);
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::moveTransitions_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<qreal>("contentYRowOffset");
+ QTest::addColumn<qreal>("rowOffsetAfterMove");
+ QTest::addColumn<int>("moveFrom");
+ QTest::addColumn<int>("moveTo");
+ QTest::addColumn<int>("moveCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ QTest::newRow("move from above view, outside visible items, move 1")
+ << 30 << 2.0 << 0.0
+ << 1 << 10 << 1 << ListRange(6, 10);
+ QTest::newRow("move from above view, outside visible items, move 1 (first item)")
+ << 30 << 2.0 << 0.0
+ << 0 << 10 << 1 << ListRange(6, 10);
+ QTest::newRow("move from above view, outside visible items, move multiple")
+ << 30 << 2.0 << 1.0
+ << 1 << 10 << 3 << ListRange(13, 23);
+ QTest::newRow("move from above view, mix of visible/non-visible")
+ << 30 << 2.0 << 1.0
+ << 1 << 10 << 6 << (ListRange(7, 15) + ListRange(16, 23));
+ QTest::newRow("move from above view, mix of visible/non-visible (move first)")
+ << 30 << 2.0 << 2.0
+ << 0 << 10 << 6 << ListRange(16, 23);
+
+ QTest::newRow("move within view, move 1 down")
+ << 30 << 0.0 << 0.0
+ << 1 << 10 << 1 << ListRange(2, 10);
+ QTest::newRow("move within view, move 1 down, move first item")
+ << 30 << 0.0 << 0.0
+ << 0 << 10 << 1 << ListRange(1, 10);
+ QTest::newRow("move within view, move 1 down, move first item, contentY not 0")
+ << 30 << 2.0 << 0.0
+ << 0+6 << 10+6 << 1 << ListRange(1+6, 10+6);
+ QTest::newRow("move within view, move 1 down, to last item")
+ << 30 << 0.0 << 0.0
+ << 10 << 17 << 1 << ListRange(11, 17);
+ QTest::newRow("move within view, move first->last")
+ << 30 << 0.0 << 0.0
+ << 0 << 17 << 1 << ListRange(1, 17);
+
+ QTest::newRow("move within view, move multiple down")
+ << 30 << 0.0 << 0.0
+ << 1 << 10 << 3 << ListRange(4, 12);
+ QTest::newRow("move within view, move multiple down, move first item")
+ << 30 << 0.0 << 0.0
+ << 0 << 10 << 3 << ListRange(3, 12);
+ QTest::newRow("move within view, move multiple down, move first item, contentY not 0")
+ << 30 << 1.0 << 0.0
+ << 0+3 << 10+3 << 3 << ListRange(3+3, 12+3);
+ QTest::newRow("move within view, move multiple down, displace last item")
+ << 30 << 0.0 << 0.0
+ << 5 << 15 << 3 << ListRange(8, 17);
+ QTest::newRow("move within view, move multiple down, move first->last")
+ << 30 << 0.0 << 0.0
+ << 0 << 15 << 3 << ListRange(3, 17);
+
+ QTest::newRow("move within view, move 1 up")
+ << 30 << 0.0 << 0.0
+ << 10 << 1 << 1 << ListRange(1, 9);
+ QTest::newRow("move within view, move 1 up, move to first index")
+ << 30 << 0.0 << 0.0
+ << 10 << 0 << 1 << ListRange(0, 9);
+ QTest::newRow("move within view, move 1 up, move to first index, contentY not 0")
+ << 30 << 2.0 << 0.0
+ << 10+6 << 0+6 << 1 << ListRange(0+6, 9+6);
+ QTest::newRow("move within view, move 1 up, move to first index, contentY not on item border")
+ << 30 << 1.5 << 0.0
+ << 10+3 << 0+3 << 1 << ListRange(0+3, 9+3);
+ QTest::newRow("move within view, move 1 up, move last item")
+ << 30 << 0.0 << 0.0
+ << 17 << 10 << 1 << ListRange(10, 16);
+ QTest::newRow("move within view, move 1 up, move last->first")
+ << 30 << 0.0 << 0.0
+ << 17 << 0 << 1 << ListRange(0, 16);
+
+ QTest::newRow("move within view, move multiple up")
+ << 30 << 0.0 << 0.0
+ << 10 << 1 << 3 << ListRange(1, 9);
+ QTest::newRow("move within view, move multiple (> 1 row) up")
+ << 30 << 0.0 << 0.0
+ << 10 << 1 << 5 << ListRange(1, 9);
+ QTest::newRow("move within view, move multiple up, move to first index")
+ << 30 << 0.0 << 0.0
+ << 10 << 0 << 3 << ListRange(0, 9);
+ QTest::newRow("move within view, move multiple up, move to first index, contentY not 0")
+ << 30 << 1.0 << 0.0
+ << 10+3 << 0+3 << 3 << ListRange(0+3, 9+3);
+ QTest::newRow("move within view, move multiple up (> 1 row), move to first index, contentY not on border")
+ << 30 << 1.5 << 0.0
+ << 10+3 << 0+3 << 5 << ListRange(0+3, 9+3);
+ QTest::newRow("move within view, move multiple up, move last item")
+ << 30 << 0.0 << 0.0
+ << 15 << 5 << 3 << ListRange(5, 14);
+ QTest::newRow("move within view, move multiple up, move last->first")
+ << 30 << 0.0 << 0.0
+ << 15 << 0 << 3 << ListRange(0, 14);
+
+ QTest::newRow("move from below view, move 1 up")
+ << 30 << 0.0 << 0.0
+ << 20 << 5 << 1 << ListRange(5, 17);
+ QTest::newRow("move from below view, move 1 up, move to top")
+ << 30 << 0.0 << 0.0
+ << 20 << 0 << 1 << ListRange(0, 17);
+ QTest::newRow("move from below view, move 1 up, move to top, contentY not 0")
+ << 30 << 1.0 << 0.0
+ << 25 << 3 << 1 << ListRange(0+3, 17+3);
+ QTest::newRow("move from below view, move multiple (> 1 row) up")
+ << 30 << 0.0 << 0.0
+ << 20 << 5 << 5 << ListRange(5, 17);
+ QTest::newRow("move from below view, move multiple up, move to top")
+ << 30 << 0.0 << 0.0
+ << 20 << 0 << 3 << ListRange(0, 17);
+ QTest::newRow("move from below view, move multiple up, move to top, contentY not 0")
+ << 30 << 1.0 << 0.0
+ << 25 << 3 << 3 << ListRange(0+3, 17+3);
+
+ QTest::newRow("move from below view, move 1 up, move to bottom")
+ << 30 << 0.0 << 0.0
+ << 20 << 17 << 1 << ListRange(17, 17);
+ QTest::newRow("move from below view, move 1 up, move to bottom, contentY not 0")
+ << 30 << 1.0 << 0.0
+ << 25 << 17+3 << 1 << ListRange(17+3, 17+3);
+ QTest::newRow("move from below view, move multiple up, move to bottom")
+ << 30 << 0.0 << 0.0
+ << 20 << 17 << 3 << ListRange(17, 17);
+ QTest::newRow("move from below view, move multiple up, move to bottom, contentY not 0")
+ << 30 << 1.0 << 0.0
+ << 25 << 17+3 << 3 << ListRange(17+3, 17+3);
+}
+
+void tst_QQuickGridView::removeTransitions()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(bool, shouldAnimateTargets);
+ QFETCH(qreal, contentYRowOffset);
+ QFETCH(int, removalIndex);
+ QFETCH(int, removalCount);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ // added items should end here
+ QPointF targetItems_transitionTo(-50, -50);
+
+ // displaced items should pass through this points
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_targetItems_transitionTo;
+ QaimModel model_displacedItems_transitionVia;
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_targetItems_transitionTo", &model_targetItems_transitionTo);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionTo", targetItems_transitionTo);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ window->setSource(testFileUrl("removeTransitions.qml"));
+ window->show();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ if (contentYRowOffset != 0) {
+ gridview->setContentY(contentYRowOffset * 60.0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ }
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+
+ // only target items that are visible should be animated
+ QList<QPair<QString, QString> > expectedTargetData;
+ QList<int> targetIndexes;
+ if (shouldAnimateTargets) {
+ for (int i=removalIndex; i<removalIndex+removalCount; i++) {
+ int firstVisibleIndex = (gridview->contentY() / 60.0)*3;
+ int lastVisibleIndex = (qCeil((gridview->contentY() + gridview->height()) / 60.0)*3) - 1;
+ if (i >= firstVisibleIndex && i <= lastVisibleIndex) {
+ expectedTargetData << qMakePair(model.name(i), model.number(i));
+ targetIndexes << i;
+ }
+ }
+ QVERIFY(expectedTargetData.count() > 0);
+ }
+
+ // calculate targetItems and expectedTargets before model changes
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes);
+ QVariantMap expectedTargets;
+ for (int i=0; i<targetIndexes.count(); i++)
+ expectedTargets[model.name(targetIndexes[i])] = targetIndexes[i];
+
+ // start animation
+ model.removeItems(removalIndex, removalCount);
+ QTRY_COMPARE(model.count(), gridview->count());
+
+ if (shouldAnimateTargets || expectedDisplacedIndexes.isValid()) {
+ QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count());
+ QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(),
+ expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0);
+
+ // check the target and displaced items were animated
+ model_targetItems_transitionTo.matchAgainst(expectedTargetData, "wasn't animated to target 'to' pos", "shouldn't have been animated to target 'to' pos");
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ QCOMPARE(gridview->property("targetTrans_items").toMap(), expectedTargets);
+ matchIndexLists(gridview->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(gridview->property("targetTrans_targetItems").toList(), targetItems);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes = adjustIndexesForRemoveDisplaced(expectedDisplacedIndexes.indexes, removalIndex, removalCount);
+ matchItemsAndIndexes(gridview->property("displacedTrans_items").toMap(), model, displacedIndexes);
+ matchIndexLists(gridview->property("displacedTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(gridview->property("displacedTrans_targetItems").toList(), targetItems);
+ }
+ } else {
+ QTRY_COMPARE(model_targetItems_transitionTo.count(), 0);
+ QTRY_COMPARE(model_displacedItems_transitionVia.count(), 0);
+ }
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int itemCount = items.count();
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ QQmlExpression e(qmlContext(items[i]), items[i], "index");
+ int index = e.evaluate().toInt();
+ if (firstVisibleIndex < 0 && items[i]->y() >= gridview->contentY())
+ firstVisibleIndex = index;
+ else if (index < 0)
+ itemCount--; // exclude deleted items
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // verify all items moved to the correct final positions
+ for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), (i%3)*80.0);
+ QCOMPARE(item->y(), gridview->contentY() + ((i-firstVisibleIndex)/3) * 60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::removeTransitions_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<qreal>("contentYRowOffset");
+ QTest::addColumn<bool>("shouldAnimateTargets");
+ QTest::addColumn<int>("removalIndex");
+ QTest::addColumn<int>("removalCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ // All items that are visible following the remove operation should be animated.
+ // Remove targets that are outside of the view should not be animated.
+
+ // For a GridView, removing any number of items other than a full row before the start
+ // should displace all items in the view
+ QTest::newRow("remove 1 before start")
+ << 30 << 2.0 << false
+ << 2 << 1 << ListRange(6, 24); // 6-24 are displaced
+ QTest::newRow("remove 1 row, before start")
+ << 30 << 2.0 << false
+ << 3 << 3 << ListRange();
+ QTest::newRow("remove between 1-2 rows, before start")
+ << 30 << 2.0 << false
+ << 0 << 5 << ListRange(6, 25);
+ QTest::newRow("remove 2 rows, before start")
+ << 30 << 2.0 << false
+ << 0 << 6 << ListRange();
+ QTest::newRow("remove mix of before and after start")
+ << 30 << 1.0 << true
+ << 2 << 3 << ListRange(5, 23); // 5-23 are displaced into view
+
+
+ QTest::newRow("remove 1 from start")
+ << 30 << 0.0 << true
+ << 0 << 1 << ListRange(1, 18); // 1-18 are displaced into view
+ QTest::newRow("remove multiple from start")
+ << 30 << 0.0 << true
+ << 0 << 3 << ListRange(3, 20); // 3-18 are displaced into view
+ QTest::newRow("remove 1 from start, content y not 0")
+ << 30 << 1.0 << true
+ << 3 << 1 << ListRange(1 + 3, 18 + 3);
+ QTest::newRow("remove multiple from start, content y not 0")
+ << 30 << 1.0 << true
+ << 3 << 3 << ListRange(3 + 3, 20 + 3);
+
+
+ QTest::newRow("remove 1 from middle")
+ << 30 << 0.0 << true
+ << 5 << 1 << ListRange(6, 18);
+ QTest::newRow("remove multiple from middle")
+ << 30 << 0.0 << true
+ << 5 << 3 << ListRange(8, 20);
+
+
+ QTest::newRow("remove 1 from bottom")
+ << 30 << 0.0 << true
+ << 17 << 1 << ListRange(18, 18);
+ QTest::newRow("remove multiple (1 row) from bottom")
+ << 30 << 0.0 << true
+ << 15 << 3 << ListRange(18, 20);
+ QTest::newRow("remove multiple (> 1 row) from bottom")
+ << 30 << 0.0 << true
+ << 15 << 5 << ListRange(20, 22);
+ QTest::newRow("remove 1 from bottom, content y not 0")
+ << 30 << 1.0 << true
+ << 17 + 3 << 1 << ListRange(18 + 3, 18 + 3);
+ QTest::newRow("remove multiple (1 row) from bottom, content y not 0")
+ << 30 << 1.0 << true
+ << 15 + 3 << 3 << ListRange(18 + 3, 20 + 3);
+
+
+ QTest::newRow("remove 1 after end")
+ << 30 << 0.0 << false
+ << 18 << 1 << ListRange();
+ QTest::newRow("remove multiple after end")
+ << 30 << 0.0 << false
+ << 18 << 3 << ListRange();
+}
+
+void tst_QQuickGridView::displacedTransitions()
+{
+ QFETCH(bool, useDisplaced);
+ QFETCH(bool, displacedEnabled);
+ QFETCH(bool, useAddDisplaced);
+ QFETCH(bool, addDisplacedEnabled);
+ QFETCH(bool, useMoveDisplaced);
+ QFETCH(bool, moveDisplacedEnabled);
+ QFETCH(bool, useRemoveDisplaced);
+ QFETCH(bool, removeDisplacedEnabled);
+ QFETCH(ListChange, change);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_displaced_transitionVia;
+ QaimModel model_addDisplaced_transitionVia;
+ QaimModel model_moveDisplaced_transitionVia;
+ QaimModel model_removeDisplaced_transitionVia;
+
+ QPointF displaced_transitionVia(-50, -100);
+ QPointF addDisplaced_transitionVia(-150, 100);
+ QPointF moveDisplaced_transitionVia(50, -100);
+ QPointF removeDisplaced_transitionVia(150, 100);
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_displaced_transitionVia", &model_displaced_transitionVia);
+ ctxt->setContextProperty("model_addDisplaced_transitionVia", &model_addDisplaced_transitionVia);
+ ctxt->setContextProperty("model_moveDisplaced_transitionVia", &model_moveDisplaced_transitionVia);
+ ctxt->setContextProperty("model_removeDisplaced_transitionVia", &model_removeDisplaced_transitionVia);
+ ctxt->setContextProperty("displaced_transitionVia", displaced_transitionVia);
+ ctxt->setContextProperty("addDisplaced_transitionVia", addDisplaced_transitionVia);
+ ctxt->setContextProperty("moveDisplaced_transitionVia", moveDisplaced_transitionVia);
+ ctxt->setContextProperty("removeDisplaced_transitionVia", removeDisplaced_transitionVia);
+ ctxt->setContextProperty("useDisplaced", useDisplaced);
+ ctxt->setContextProperty("displacedEnabled", displacedEnabled);
+ ctxt->setContextProperty("useAddDisplaced", useAddDisplaced);
+ ctxt->setContextProperty("addDisplacedEnabled", addDisplacedEnabled);
+ ctxt->setContextProperty("useMoveDisplaced", useMoveDisplaced);
+ ctxt->setContextProperty("moveDisplacedEnabled", moveDisplacedEnabled);
+ ctxt->setContextProperty("useRemoveDisplaced", useRemoveDisplaced);
+ ctxt->setContextProperty("removeDisplacedEnabled", removeDisplacedEnabled);
+ window->setSource(testFileUrl("displacedTransitions.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+ gridview->setProperty("displaceTransitionsDone", false);
+
+ switch (change.type) {
+ case ListChange::Inserted:
+ {
+ QList<QPair<QString, QString> > targetItemData;
+ for (int i=change.index; i<change.index + change.count; ++i)
+ targetItemData << qMakePair(QString("new item %1").arg(i), QString::number(i));
+ model.insertItems(change.index, targetItemData);
+ QTRY_COMPARE(model.count(), gridview->count());
+ break;
+ }
+ case ListChange::Removed:
+ model.removeItems(change.index, change.count);
+ QTRY_COMPARE(model.count(), gridview->count());
+ break;
+ case ListChange::Moved:
+ model.moveItems(change.index, change.to, change.count);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ break;
+ case ListChange::SetCurrent:
+ case ListChange::SetContentY:
+ case ListChange::Polish:
+ break;
+ }
+
+ QVariantList resultTargetIndexes = gridview->property("displacedTargetIndexes").toList();
+ QVariantList resultTargetItems = gridview->property("displacedTargetItems").toList();
+
+ if ((useDisplaced && displacedEnabled)
+ || (useAddDisplaced && addDisplacedEnabled)
+ || (useMoveDisplaced && moveDisplacedEnabled)
+ || (useRemoveDisplaced && removeDisplacedEnabled)) {
+ QTRY_VERIFY(gridview->property("displaceTransitionsDone").toBool());
+
+ // check the correct number of target items and indexes were received
+ QCOMPARE(resultTargetIndexes.count(), expectedDisplacedIndexes.count());
+ for (int i=0; i<resultTargetIndexes.count(); i++)
+ QCOMPARE(resultTargetIndexes[i].value<QList<int> >().count(), change.count);
+ QCOMPARE(resultTargetItems.count(), expectedDisplacedIndexes.count());
+ for (int i=0; i<resultTargetItems.count(); i++)
+ QCOMPARE(resultTargetItems[i].toList().count(), change.count);
+ } else {
+ QCOMPARE(resultTargetIndexes.count(), 0);
+ QCOMPARE(resultTargetItems.count(), 0);
+ }
+
+ if (change.type == ListChange::Inserted && useAddDisplaced && addDisplacedEnabled)
+ model_addDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with add displaced", "shouldn't have been animated with add displaced");
+ else
+ QCOMPARE(model_addDisplaced_transitionVia.count(), 0);
+ if (change.type == ListChange::Moved && useMoveDisplaced && moveDisplacedEnabled)
+ model_moveDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with move displaced", "shouldn't have been animated with move displaced");
+ else
+ QCOMPARE(model_moveDisplaced_transitionVia.count(), 0);
+ if (change.type == ListChange::Removed && useRemoveDisplaced && removeDisplacedEnabled)
+ model_removeDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with remove displaced", "shouldn't have been animated with remove displaced");
+ else
+ QCOMPARE(model_removeDisplaced_transitionVia.count(), 0);
+
+ if (useDisplaced && displacedEnabled
+ && ( (change.type == ListChange::Inserted && (!useAddDisplaced || !addDisplacedEnabled))
+ || (change.type == ListChange::Moved && (!useMoveDisplaced || !moveDisplacedEnabled))
+ || (change.type == ListChange::Removed && (!useRemoveDisplaced || !removeDisplacedEnabled))) ) {
+ model_displaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with generic displaced", "shouldn't have been animated with generic displaced");
+ } else {
+ QCOMPARE(model_displaced_transitionVia.count(), 0);
+ }
+
+ // verify all items moved to the correct final positions
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ for (int i=0; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), (i%3)*80.0);
+ QCOMPARE(item->y(), (i/3)*60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::displacedTransitions_data()
+{
+ QTest::addColumn<bool>("useDisplaced");
+ QTest::addColumn<bool>("displacedEnabled");
+ QTest::addColumn<bool>("useAddDisplaced");
+ QTest::addColumn<bool>("addDisplacedEnabled");
+ QTest::addColumn<bool>("useMoveDisplaced");
+ QTest::addColumn<bool>("moveDisplacedEnabled");
+ QTest::addColumn<bool>("useRemoveDisplaced");
+ QTest::addColumn<bool>("removeDisplacedEnabled");
+ QTest::addColumn<ListChange>("change");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ QTest::newRow("no displaced transitions at all")
+ << false << false
+ << false << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 17);
+
+ QTest::newRow("just displaced")
+ << true << true
+ << false << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 17);
+
+ QTest::newRow("just displaced (not enabled)")
+ << true << false
+ << false << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 17);
+
+ QTest::newRow("displaced + addDisplaced")
+ << true << true
+ << true << true
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 17);
+
+ QTest::newRow("displaced + addDisplaced (not enabled)")
+ << true << true
+ << true << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 17);
+
+ QTest::newRow("displaced + moveDisplaced")
+ << true << true
+ << false << false
+ << true << true
+ << false << false
+ << ListChange::move(0, 10, 1) << ListRange(1, 10);
+
+ QTest::newRow("displaced + moveDisplaced (not enabled)")
+ << true << true
+ << false << false
+ << true << false
+ << false << false
+ << ListChange::move(0, 10, 1) << ListRange(1, 10);
+
+ QTest::newRow("displaced + removeDisplaced")
+ << true << true
+ << false << false
+ << false << false
+ << true << true
+ << ListChange::remove(0, 1) << ListRange(1, 18);
+
+ QTest::newRow("displaced + removeDisplaced (not enabled)")
+ << true << true
+ << false << false
+ << false << false
+ << true << false
+ << ListChange::remove(0, 1) << ListRange(1, 18);
+
+
+ QTest::newRow("displaced + add, should use generic displaced for a remove")
+ << true << true
+ << true << true
+ << false << false
+ << true << false
+ << ListChange::remove(0, 1) << ListRange(1, 18);
+}
+
+void tst_QQuickGridView::multipleTransitions()
+{
+ // Tests that if you interrupt a transition in progress with another action that
+ // cancels the previous transition, the resulting items are still placed correctly.
+
+ QFETCH(int, initialCount);
+ QFETCH(qreal, contentY);
+ QFETCH(QList<ListChange>, changes);
+ QFETCH(bool, enableAddTransitions);
+ QFETCH(bool, enableMoveTransitions);
+ QFETCH(bool, enableRemoveTransitions);
+ QFETCH(bool, rippleAddDisplaced);
+
+ // add transitions on the left, moves on the right
+ QPointF addTargets_transitionFrom(-50, -50);
+ QPointF addDisplaced_transitionFrom(-50, 50);
+ QPointF moveTargets_transitionFrom(50, -50);
+ QPointF moveDisplaced_transitionFrom(50, 50);
+ QPointF removeTargets_transitionTo(-100, 300);
+ QPointF removeDisplaced_transitionFrom(100, 300);
+
+ QaimModel model;
+ for (int i = 0; i < initialCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("addTargets_transitionFrom", addTargets_transitionFrom);
+ ctxt->setContextProperty("addDisplaced_transitionFrom", addDisplaced_transitionFrom);
+ ctxt->setContextProperty("moveTargets_transitionFrom", moveTargets_transitionFrom);
+ ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom);
+ ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo);
+ ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom);
+ ctxt->setContextProperty("enableAddTransitions", enableAddTransitions);
+ ctxt->setContextProperty("enableMoveTransitions", enableMoveTransitions);
+ ctxt->setContextProperty("enableRemoveTransitions", enableRemoveTransitions);
+ ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced);
+ window->setSource(testFileUrl("multipleTransitions.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ if (contentY != 0) {
+ gridview->setContentY(contentY);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ }
+
+ int timeBetweenActions = window->rootObject()->property("timeBetweenActions").toInt();
+
+ for (int i=0; i<changes.count(); i++) {
+ switch (changes[i].type) {
+ case ListChange::Inserted:
+ {
+ QList<QPair<QString, QString> > targetItems;
+ for (int j=changes[i].index; j<changes[i].index + changes[i].count; ++j)
+ targetItems << qMakePair(QString("new item %1").arg(j), QString::number(j));
+ model.insertItems(changes[i].index, targetItems);
+ QTRY_COMPARE(model.count(), gridview->count());
+ if (i == changes.count() - 1) {
+ QTRY_VERIFY(!gridview->property("runningAddTargets").toBool());
+ QTRY_VERIFY(!gridview->property("runningAddDisplaced").toBool());
+ } else {
+ QTest::qWait(timeBetweenActions);
+ }
+ break;
+ }
+ case ListChange::Removed:
+ model.removeItems(changes[i].index, changes[i].count);
+ QTRY_COMPARE(model.count(), gridview->count());
+ if (i == changes.count() - 1) {
+ QTRY_VERIFY(!gridview->property("runningRemoveTargets").toBool());
+ QTRY_VERIFY(!gridview->property("runningRemoveDisplaced").toBool());
+ } else {
+ QTest::qWait(timeBetweenActions);
+ }
+ break;
+ case ListChange::Moved:
+ model.moveItems(changes[i].index, changes[i].to, changes[i].count);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ if (i == changes.count() - 1) {
+ QTRY_VERIFY(!gridview->property("runningMoveTargets").toBool());
+ QTRY_VERIFY(!gridview->property("runningMoveDisplaced").toBool());
+ } else {
+ QTest::qWait(timeBetweenActions);
+ }
+ break;
+ case ListChange::SetCurrent:
+ gridview->setCurrentIndex(changes[i].index);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ break;
+ case ListChange::SetContentY:
+ gridview->setContentY(changes[i].pos);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+ break;
+ case ListChange::Polish:
+ break;
+ }
+ }
+ QCOMPARE(gridview->count(), model.count());
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ if (items[i]->y() >= contentY) {
+ QQmlExpression e(qmlContext(items[i]), items[i], "index");
+ firstVisibleIndex = e.evaluate().toInt();
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // verify all items moved to the correct final positions
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickGridView::multipleTransitions_data()
+{
+ QTest::addColumn<int>("initialCount");
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<bool>("enableAddTransitions");
+ QTest::addColumn<bool>("enableMoveTransitions");
+ QTest::addColumn<bool>("enableRemoveTransitions");
+ QTest::addColumn<bool>("rippleAddDisplaced");
+
+ // the added item and displaced items should move to final dest correctly
+ QTest::newRow("add item, then move it immediately") << 10 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::move(0, 3, 1)
+ )
+ << true << true << true << false;
+
+ // items affected by the add should change from move to add transition
+ QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::move(1, 10, 3)
+ << ListChange::insert(0, 1)
+ )
+ << true << true << true << false;
+
+ // items should be placed correctly if you trigger a transition then refill for that index
+ QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::setContentY(160.0)
+ << ListChange::setContentY(0.0)
+ << ListChange::insert(0, 1)
+ )
+ << true << true << true << false;
+
+ QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(1, 1)
+ << ListChange::remove(1, 1)
+ )
+ << true << true << true << true;
+
+ // if item is removed while undergoing a displaced transition, all other items should end up at their correct positions,
+ // even if a remove-displace transition is not present to re-animate them
+ QTest::newRow("insert then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+
+ // if last item is not flush with the edge of the view, it should still be refilled in correctly after a
+ // remove has changed the position of where it will move to
+ QTest::newRow("insert twice then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::setContentY(-10.0)
+ << ListChange::insert(0, 1)
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+}
+
+void tst_QQuickGridView::multipleDisplaced()
+{
+ // multiple move() operations should only restart displace transitions for items that
+ // moved from previously set positions, and not those that have moved from their current
+ // item positions (which may e.g. still be changing from easing bounces in the last transition)
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ QQuickView *window = createView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("multipleDisplaced.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
+
+ model.moveItems(12, 8, 1);
+ QTest::qWait(window->rootObject()->property("duration").toInt() / 2);
+ model.moveItems(8, 3, 1);
+ QTRY_VERIFY(gridview->property("displaceTransitionsDone").toBool());
+
+ QVariantMap transitionsStarted = gridview->property("displaceTransitionsStarted").toMap();
+ foreach (const QString &name, transitionsStarted.keys()) {
+ QVERIFY2(transitionsStarted[name] == 1,
+ QTest::toString(QString("%1 was displaced %2 times").arg(name).arg(transitionsStarted[name].toInt())));
+ }
+
+ // verify all items moved to the correct final positions
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ for (int i=0; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::cacheBuffer()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 90; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("gridview1.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QVERIFY(gridview != 0);
+
+ QQuickItem *contentItem = gridview->contentItem();
+ QVERIFY(contentItem != 0);
+ QVERIFY(gridview->delegate() != 0);
+ QVERIFY(gridview->model() != 0);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ }
+
+ QQmlIncubationController controller;
+ window->engine()->setIncubationController(&controller);
+
+ window->rootObject()->setProperty("cacheBuffer", 200);
+ QTRY_VERIFY(gridview->cacheBuffer() == 200);
+
+ // items will be created one at a time
+ for (int i = itemCount; i < qMin(itemCount+9,model.count()); ++i) {
+ QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(gridview, "wrapper", i);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ int newItemCount = 0;
+ newItemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count() && i < newItemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ }
+
+ // move view and confirm items in view are visible immediately and outside are created async
+ gridview->setContentY(300);
+
+ for (int i = 15; i < 34; ++i) { // 34 due to staggered item creation
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
+ }
+
+ QVERIFY(findItem<QQuickItem>(gridview, "wrapper", 34) == 0);
+
+ // ensure buffered items are created
+ for (int i = 34; i < qMin(44,model.count()); ++i) {
+ QQuickItem *item = 0;
+ while (!item) {
+ qGuiApp->processEvents(); // allow refill to happen
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(gridview, "wrapper", i);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::asynchronous()
+{
+ QQuickView *window = createView();
+ window->show();
+ QQmlIncubationController controller;
+ window->engine()->setIncubationController(&controller);
+
+ window->setSource(testFileUrl("asyncloader.qml"));
+
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootObject);
+
+ QQuickGridView *gridview = 0;
+ while (!gridview) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ gridview = rootObject->findChild<QQuickGridView*>("view");
+ }
+
+ // items will be created one at a time
+ for (int i = 0; i < 12; ++i) {
+ QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(gridview, "wrapper", i);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ // verify positioning
+ QQuickItem *contentItem = gridview->contentItem();
+ for (int i = 0; i < 12; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QVERIFY(item->x() == (i%3)*100);
+ QVERIFY(item->y() == (i/3)*100);
+ }
+
+ delete window;
+}
+
+void tst_QQuickGridView::unrequestedVisibility()
+{
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testWrap", QVariant(false));
+
+ window->setSource(testFileUrl("unrequestedItems.qml"));
+
+ window->show();
+
+ qApp->processEvents();
+
+ QQuickGridView *leftview = findItem<QQuickGridView>(window->rootObject(), "leftGrid");
+ QTRY_VERIFY(leftview != 0);
+
+ QQuickGridView *rightview = findItem<QQuickGridView>(window->rootObject(), "rightGrid");
+ QTRY_VERIFY(rightview != 0);
+
+ QQuickItem *leftContent = leftview->contentItem();
+ QTRY_VERIFY(leftContent != 0);
+
+ QQuickItem *rightContent = rightview->contentItem();
+ QTRY_VERIFY(rightContent != 0);
+
+ rightview->setCurrentIndex(12);
+
+ QTRY_COMPARE(leftview->contentY(), 0.0);
+ QTRY_COMPARE(rightview->contentY(), 240.0);
+
+ QQuickItem *item;
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 11));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 11));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 9));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 10));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), true);
+
+ rightview->setCurrentIndex(0);
+
+ QTRY_COMPARE(leftview->contentY(), 0.0);
+ QTRY_COMPARE(rightview->contentY(), 0.0);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ QVERIFY(!findItem<QQuickItem>(leftContent, "wrapper", 11));
+ QVERIFY(!findItem<QQuickItem>(rightContent, "wrapper", 11));
+
+ leftview->setCurrentIndex(12);
+
+ QTRY_COMPARE(leftview->contentY(), 240.0);
+ QTRY_COMPARE(rightview->contentY(), 0.0);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QTRY_COMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 11));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 11));
+ QCOMPARE(delegateVisible(item), false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 9));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 10));
+ QCOMPARE(delegateVisible(item), false);
+
+ // move a non-visible item into view
+ model.moveItems(10, 9, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QTRY_VERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 11));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 11));
+ QCOMPARE(delegateVisible(item), false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 9));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 10));
+ QCOMPARE(delegateVisible(item), false);
+
+ // move a visible item out of view
+ model.moveItems(5, 3, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 9));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 10));
+ QCOMPARE(delegateVisible(item), false);
+
+ // move a non-visible item into view
+ model.moveItems(3, 5, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 9));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 10));
+ QCOMPARE(delegateVisible(item), false);
+
+ // move a visible item out of view
+ model.moveItems(9, 10, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 9));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 10));
+ QCOMPARE(delegateVisible(item), false);
+
+ // move a non-visible item into view
+ model.moveItems(10, 9, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 9));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 10));
+ QCOMPARE(delegateVisible(item), false);
+
+ delete window;
+}
+
+
+void tst_QQuickGridView::inserted_leftToRight_RtL_TtB()
+{
+ inserted_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::RightToLeft);
+}
+
+void tst_QQuickGridView::inserted_leftToRight_RtL_TtB_data()
+{
+ inserted_defaultLayout_data();
+}
+
+void tst_QQuickGridView::inserted_topToBottom_LtR_TtB()
+{
+ inserted_defaultLayout(QQuickGridView::FlowTopToBottom);
+}
+
+void tst_QQuickGridView::inserted_topToBottom_LtR_TtB_data()
+{
+ inserted_defaultLayout_data();
+}
+
+void tst_QQuickGridView::inserted_topToBottom_RtL_TtB()
+{
+ inserted_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::RightToLeft);
+}
+
+void tst_QQuickGridView::inserted_topToBottom_RtL_TtB_data()
+{
+ inserted_defaultLayout_data();
+}
+
+void tst_QQuickGridView::inserted_leftToRight_LtR_BtT()
+{
+ inserted_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::LeftToRight, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::inserted_leftToRight_LtR_BtT_data()
+{
+ inserted_defaultLayout_data();
+}
+
+void tst_QQuickGridView::inserted_leftToRight_RtL_BtT()
+{
+ inserted_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::RightToLeft, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::inserted_leftToRight_RtL_BtT_data()
+{
+ inserted_defaultLayout_data();
+}
+
+void tst_QQuickGridView::inserted_topToBottom_LtR_BtT()
+{
+ inserted_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::LeftToRight, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::inserted_topToBottom_LtR_BtT_data()
+{
+ inserted_defaultLayout_data();
+}
+
+void tst_QQuickGridView::inserted_topToBottom_RtL_BtT()
+{
+ inserted_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::RightToLeft, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::inserted_topToBottom_RtL_BtT_data()
+{
+ inserted_defaultLayout_data();
+}
+
+
+void tst_QQuickGridView::removed_leftToRight_RtL_TtB()
+{
+ removed_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::RightToLeft);
+}
+
+void tst_QQuickGridView::removed_leftToRight_RtL_TtB_data()
+{
+ removed_defaultLayout_data();
+}
+
+void tst_QQuickGridView::removed_topToBottom_LtR_TtB()
+{
+ removed_defaultLayout(QQuickGridView::FlowTopToBottom);
+}
+
+void tst_QQuickGridView::removed_topToBottom_LtR_TtB_data()
+{
+ removed_defaultLayout_data();
+}
+
+void tst_QQuickGridView::removed_topToBottom_RtL_TtB()
+{
+ removed_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::RightToLeft);
+}
+
+void tst_QQuickGridView::removed_topToBottom_RtL_TtB_data()
+{
+ removed_defaultLayout_data();
+}
+
+void tst_QQuickGridView::removed_leftToRight_LtR_BtT()
+{
+ removed_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::LeftToRight, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::removed_leftToRight_LtR_BtT_data()
+{
+ removed_defaultLayout_data();
+}
+
+void tst_QQuickGridView::removed_leftToRight_RtL_BtT()
+{
+ removed_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::RightToLeft, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::removed_leftToRight_RtL_BtT_data()
+{
+ removed_defaultLayout_data();
+}
+
+void tst_QQuickGridView::removed_topToBottom_LtR_BtT()
+{
+ removed_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::LeftToRight, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::removed_topToBottom_LtR_BtT_data()
+{
+ removed_defaultLayout_data();
+}
+
+void tst_QQuickGridView::removed_topToBottom_RtL_BtT()
+{
+ removed_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::RightToLeft, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::removed_topToBottom_RtL_BtT_data()
+{
+ removed_defaultLayout_data();
+}
+
+
+void tst_QQuickGridView::moved_leftToRight_RtL_TtB()
+{
+ moved_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::RightToLeft);
+}
+
+void tst_QQuickGridView::moved_leftToRight_RtL_TtB_data()
+{
+ moved_defaultLayout_data();
+}
+
+void tst_QQuickGridView::moved_topToBottom_LtR_TtB()
+{
+ moved_defaultLayout(QQuickGridView::FlowTopToBottom);
+}
+
+void tst_QQuickGridView::moved_topToBottom_LtR_TtB_data()
+{
+ moved_defaultLayout_data();
+}
+
+void tst_QQuickGridView::moved_topToBottom_RtL_TtB()
+{
+ moved_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::RightToLeft);
+}
+
+void tst_QQuickGridView::moved_topToBottom_RtL_TtB_data()
+{
+ moved_defaultLayout_data();
+}
+
+void tst_QQuickGridView::moved_leftToRight_LtR_BtT()
+{
+ moved_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::LeftToRight, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::moved_leftToRight_LtR_BtT_data()
+{
+ moved_defaultLayout_data();
+}
+
+void tst_QQuickGridView::moved_leftToRight_RtL_BtT()
+{
+ moved_defaultLayout(QQuickGridView::FlowLeftToRight, Qt::RightToLeft, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::moved_leftToRight_RtL_BtT_data()
+{
+ moved_defaultLayout_data();
+}
+
+void tst_QQuickGridView::moved_topToBottom_LtR_BtT()
+{
+ moved_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::LeftToRight, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::moved_topToBottom_LtR_BtT_data()
+{
+ moved_defaultLayout_data();
+}
+
+void tst_QQuickGridView::moved_topToBottom_RtL_BtT()
+{
+ moved_defaultLayout(QQuickGridView::FlowTopToBottom, Qt::RightToLeft, QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickGridView::moved_topToBottom_RtL_BtT_data()
+{
+ moved_defaultLayout_data();
+}
+
+
+QList<int> tst_QQuickGridView::toIntList(const QVariantList &list)
+{
+ QList<int> ret;
+ bool ok = true;
+ for (int i=0; i<list.count(); i++) {
+ ret << list[i].toInt(&ok);
+ if (!ok)
+ qWarning() << "tst_QQuickGridView::toIntList(): not a number:" << list[i];
+ }
+
+ return ret;
+}
+
+void tst_QQuickGridView::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes)
+{
+ for (int i=0; i<indexLists.count(); i++) {
+ QSet<int> current = indexLists[i].value<QList<int> >().toSet();
+ if (current != expectedIndexes.toSet())
+ qDebug() << "Cannot match actual targets" << current << "with expected" << expectedIndexes;
+ QCOMPARE(current, expectedIndexes.toSet());
+ }
+}
+
+void tst_QQuickGridView::matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes)
+{
+ for (QVariantMap::const_iterator it = items.begin(); it != items.end(); ++it) {
+ QVERIFY(it.value().type() == QVariant::Int);
+ QString name = it.key();
+ int itemIndex = it.value().toInt();
+ QVERIFY2(expectedIndexes.contains(itemIndex), QTest::toString(QString("Index %1 not found in expectedIndexes").arg(itemIndex)));
+ if (model.name(itemIndex) != name)
+ qDebug() << itemIndex;
+ QCOMPARE(model.name(itemIndex), name);
+ }
+ QCOMPARE(items.count(), expectedIndexes.count());
+}
+
+void tst_QQuickGridView::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems)
+{
+ for (int i=0; i<itemLists.count(); i++) {
+ QVariantList current = itemLists[i].toList();
+ for (int j=0; j<current.count(); j++) {
+ QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>());
+ QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j)));
+ QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j)));
+ }
+ QCOMPARE(current.count(), expectedItems.count());
+ }
+}
+
+QTEST_MAIN(tst_QQuickGridView)
+
+#include "tst_qquickgridview.moc"
+
diff --git a/tests/auto/quick/qquickimage/data/aspectratio.qml b/tests/auto/quick/qquickimage/data/aspectratio.qml
new file mode 100644
index 0000000000..b26f0e1f04
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/aspectratio.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Image {
+ source: "heart.png"
+ fillMode: Image.PreserveAspectFit;
+}
diff --git a/tests/auto/quick/qquickimage/data/big.jpeg b/tests/auto/quick/qquickimage/data/big.jpeg
new file mode 100644
index 0000000000..bed7bd65c3
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/big.jpeg
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/big256.png b/tests/auto/quick/qquickimage/data/big256.png
new file mode 100644
index 0000000000..1dc1596d03
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/big256.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/colors.png b/tests/auto/quick/qquickimage/data/colors.png
new file mode 100644
index 0000000000..dfb62f3d64
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/colors.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/colors1.png b/tests/auto/quick/qquickimage/data/colors1.png
new file mode 100644
index 0000000000..dfb62f3d64
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/colors1.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/correctStatus.qml b/tests/auto/quick/qquickimage/data/correctStatus.qml
new file mode 100644
index 0000000000..2326078657
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/correctStatus.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ property alias status: image1.status
+
+ Image {
+ id: image1
+ asynchronous: true
+ source: "image://test/first-image.png"
+ }
+
+ Image {
+ id: image2
+ asynchronous: true
+ source: "image://test/first-image.png"
+ }
+
+ Timer {
+ interval: 50
+ running: true
+ repeat: false
+ onTriggered: {
+ image1.source = "image://test/second-image.png"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickimage/data/green.png b/tests/auto/quick/qquickimage/data/green.png
new file mode 100644
index 0000000000..0a2e153ba1
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/green.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/heart-win32.png b/tests/auto/quick/qquickimage/data/heart-win32.png
new file mode 100644
index 0000000000..351da13772
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/heart-win32.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/heart.png b/tests/auto/quick/qquickimage/data/heart.png
new file mode 100644
index 0000000000..abe97fee4b
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/heart.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/heart.svg b/tests/auto/quick/qquickimage/data/heart.svg
new file mode 100644
index 0000000000..8c982cd93c
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/heart.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="841.88976pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
+<metadata>
+<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<cc:Work rdf:about="">
+<dc:title>Heart Left-Highlight</dc:title>
+<dc:description>This is a normal valentines day heart.</dc:description>
+<dc:subject>
+<rdf:Bag>
+<rdf:li>holiday</rdf:li>
+<rdf:li>valentines</rdf:li>
+<rdf:li></rdf:li>
+<rdf:li>valentine</rdf:li>
+<rdf:li>hash(0x8a091c0)</rdf:li>
+<rdf:li>hash(0x8a0916c)</rdf:li>
+<rdf:li>signs_and_symbols</rdf:li>
+<rdf:li>hash(0x8a091f0)</rdf:li>
+<rdf:li>day</rdf:li>
+</rdf:Bag>
+</dc:subject>
+<dc:publisher>
+<cc:Agent rdf:about="http://www.openclipart.org">
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:publisher>
+<dc:creator>
+<cc:Agent>
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:creator>
+<dc:rights>
+<cc:Agent>
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:rights>
+<dc:date></dc:date>
+<dc:format>image/svg+xml</dc:format>
+<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
+<dc:language>en</dc:language>
+</cc:Work>
+<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
+<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+</cc:License>
+</rdf:RDF>
+</metadata>
+<defs id="defs3"/>
+<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/>
+<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
+<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
+<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
+</g>
+</svg>
diff --git a/tests/auto/quick/qquickimage/data/heart.svgz b/tests/auto/quick/qquickimage/data/heart.svgz
new file mode 100644
index 0000000000..c1cb1109fa
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/heart.svgz
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/heart200-win32.png b/tests/auto/quick/qquickimage/data/heart200-win32.png
new file mode 100644
index 0000000000..4976ff98ba
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/heart200-win32.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/heart200.png b/tests/auto/quick/qquickimage/data/heart200.png
new file mode 100644
index 0000000000..7fbb13c5bb
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/heart200.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/heart_copy.png b/tests/auto/quick/qquickimage/data/heart_copy.png
new file mode 100644
index 0000000000..abe97fee4b
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/heart_copy.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/htiling.qml b/tests/auto/quick/qquickimage/data/htiling.qml
new file mode 100644
index 0000000000..eb7222a767
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/htiling.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+
+ Image {
+ objectName: "tiling"; anchors.fill: parent
+ source: "green.png"; fillMode: Image.TileHorizontally
+ }
+}
+
diff --git a/tests/auto/quick/qquickimage/data/mirror.qml b/tests/auto/quick/qquickimage/data/mirror.qml
new file mode 100644
index 0000000000..ba230500bb
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/mirror.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 250
+ Image {
+ objectName: "image"
+ smooth: false
+ anchors.fill: parent
+ source: "pattern.png"
+ }
+}
diff --git a/tests/auto/quick/qquickimage/data/nullpixmap.qml b/tests/auto/quick/qquickimage/data/nullpixmap.qml
new file mode 100644
index 0000000000..d52f41f164
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/nullpixmap.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Image {
+ width: 10; height:10; fillMode: Image.PreserveAspectFit
+ source: ""
+}
diff --git a/tests/auto/quick/qquickimage/data/pattern.png b/tests/auto/quick/qquickimage/data/pattern.png
new file mode 100644
index 0000000000..d3d5e1e007
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/pattern.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/qtbug_16389.qml b/tests/auto/quick/qquickimage/data/qtbug_16389.qml
new file mode 100644
index 0000000000..7b8adecb11
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/qtbug_16389.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+Rectangle {
+ width: 400
+ height: 400
+
+ Item {
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.bottom: blueHandle.top
+ anchors.right: blueHandle.left
+
+ Image {
+ id: iconImage
+ objectName: "iconImage"
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ source: "heart200.png"
+ fillMode: Image.PreserveAspectFit
+ smooth: true
+ }
+ }
+
+ Rectangle {
+ id: blueHandle
+ objectName: "blueHandle"
+ color: "blue"
+ width: 25
+ height: 25
+ }
+}
diff --git a/tests/auto/quick/qquickimage/data/qtbug_22125.qml b/tests/auto/quick/qquickimage/data/qtbug_22125.qml
new file mode 100644
index 0000000000..9b68c0a125
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/qtbug_22125.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 800
+ height: 800
+
+ GridView {
+ anchors.fill: parent
+ delegate: Image {
+ source: imagePath;
+ asynchronous: true
+ smooth: true
+ width: 200
+ height: 200
+ }
+ model: ListModel {
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/big256.png"
+ }
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/big256.png"
+ }
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/big256.png"
+ }
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/colors.png"
+ }
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/colors1.png"
+ }
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/big.jpeg"
+ }
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/heart.png"
+ }
+ ListElement {
+ imagePath: "http://127.0.0.1:14451/green.png"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickimage/data/rect.png b/tests/auto/quick/qquickimage/data/rect.png
new file mode 100644
index 0000000000..d564a2d5a5
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/rect.png
Binary files differ
diff --git a/tests/auto/quick/qquickimage/data/sourceSize.qml b/tests/auto/quick/qquickimage/data/sourceSize.qml
new file mode 100644
index 0000000000..8e25c254d3
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/sourceSize.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Image {
+ source: "heart.png"
+ sourceSize.width: srcWidth
+ sourceSize.height: srcHeight
+}
diff --git a/tests/auto/quick/qquickimage/data/vtiling.qml b/tests/auto/quick/qquickimage/data/vtiling.qml
new file mode 100644
index 0000000000..84bb18c6e8
--- /dev/null
+++ b/tests/auto/quick/qquickimage/data/vtiling.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+
+ Image {
+ objectName: "tiling"; anchors.fill: parent
+ source: "green.png"; fillMode: Image.TileVertically
+ }
+}
+
diff --git a/tests/auto/quick/qquickimage/qquickimage.pro b/tests/auto/quick/qquickimage/qquickimage.pro
new file mode 100644
index 0000000000..9581ae02d1
--- /dev/null
+++ b/tests/auto/quick/qquickimage/qquickimage.pro
@@ -0,0 +1,15 @@
+CONFIG += testcase
+TARGET = tst_qquickimage
+macx:CONFIG -= app_bundle
+
+HEADERS += ../../shared/testhttpserver.h
+SOURCES += tst_qquickimage.cpp \
+ ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
new file mode 100644
index 0000000000..0804c7b900
--- /dev/null
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -0,0 +1,922 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QTextDocument>
+#include <QTcpServer>
+#include <QTcpSocket>
+#include <QDir>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <private/qquickimage_p.h>
+#include <private/qquickimagebase_p.h>
+#include <private/qquickloader_p.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtTest/QSignalSpy>
+#include <QtGui/QPainter>
+#include <QtGui/QImageReader>
+#include <QQuickWindow>
+#include <QQuickImageProvider>
+
+#include "../../shared/util.h"
+#include "../../shared/testhttpserver.h"
+#include "../shared/visualtestutil.h"
+
+#define SERVER_PORT 14451
+#define SERVER_ADDR "http://127.0.0.1:14451"
+
+
+using namespace QQuickVisualTestUtil;
+
+Q_DECLARE_METATYPE(QQuickImageBase::Status)
+
+class tst_qquickimage : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickimage();
+
+private slots:
+ void cleanup();
+ void noSource();
+ void imageSource();
+ void imageSource_data();
+ void clearSource();
+ void resized();
+ void preserveAspectRatio();
+ void smooth();
+ void mirror();
+ void svg();
+ void svg_data();
+ void geometry();
+ void geometry_data();
+ void big();
+ void tiling_QTBUG_6716();
+ void tiling_QTBUG_6716_data();
+ void noLoading();
+ void paintedWidthHeight();
+ void sourceSize_QTBUG_14303();
+ void sourceSize_QTBUG_16389();
+ void nullPixmapPaint();
+ void imageCrash_QTBUG_22125();
+ void sourceSize_data();
+ void sourceSize();
+ void progressAndStatusChanges();
+ void sourceSizeChanges();
+ void correctStatus();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qquickimage::tst_qquickimage()
+{
+}
+
+void tst_qquickimage::cleanup()
+{
+ QQuickWindow window;
+ window.releaseResources();
+ engine.clearComponentCache();
+}
+
+void tst_qquickimage::noSource()
+{
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->source(), QUrl());
+ QVERIFY(obj->status() == QQuickImage::Null);
+ QCOMPARE(obj->width(), 0.);
+ QCOMPARE(obj->height(), 0.);
+ QCOMPARE(obj->fillMode(), QQuickImage::Stretch);
+ QCOMPARE(obj->progress(), 0.0);
+
+ delete obj;
+}
+
+void tst_qquickimage::imageSource_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<double>("width");
+ QTest::addColumn<double>("height");
+ QTest::addColumn<bool>("remote");
+ QTest::addColumn<bool>("async");
+ QTest::addColumn<bool>("cache");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("local") << testFileUrl("colors.png").toString() << 120.0 << 120.0 << false << false << true << "";
+ QTest::newRow("local no cache") << testFileUrl("colors.png").toString() << 120.0 << 120.0 << false << false << false << "";
+ QTest::newRow("local async") << testFileUrl("colors1.png").toString() << 120.0 << 120.0 << false << true << true << "";
+ QTest::newRow("local not found") << testFileUrl("no-such-file.png").toString() << 0.0 << 0.0 << false
+ << false << true << "file::2:1: QML Image: Cannot open: " + testFileUrl("no-such-file.png").toString();
+ QTest::newRow("local async not found") << testFileUrl("no-such-file-1.png").toString() << 0.0 << 0.0 << false
+ << true << true << "file::2:1: QML Image: Cannot open: " + testFileUrl("no-such-file-1.png").toString();
+ QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << true << "";
+ QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << false << "";
+ if (QImageReader::supportedImageFormats().contains("svg"))
+ QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << false << "";
+ if (QImageReader::supportedImageFormats().contains("svgz"))
+ QTest::newRow("remote svgz") << SERVER_ADDR "/heart.svgz" << 550.0 << 500.0 << true << false << false << "";
+ QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true
+ << false << true << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
+
+}
+
+void tst_qquickimage::imageSource()
+{
+ QFETCH(QString, source);
+ QFETCH(double, width);
+ QFETCH(double, height);
+ QFETCH(bool, remote);
+ QFETCH(bool, async);
+ QFETCH(bool, cache);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(SERVER_PORT);
+ if (remote) {
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+ server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
+ }
+
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + source + "\"; asynchronous: "
+ + (async ? QLatin1String("true") : QLatin1String("false")) + "; cache: "
+ + (cache ? QLatin1String("true") : QLatin1String("false")) + " }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ if (async)
+ QVERIFY(obj->asynchronous() == true);
+ else
+ QVERIFY(obj->asynchronous() == false);
+
+ if (cache)
+ QVERIFY(obj->cache() == true);
+ else
+ QVERIFY(obj->cache() == false);
+
+ if (remote || async)
+ QTRY_VERIFY(obj->status() == QQuickImage::Loading);
+
+ QCOMPARE(obj->source(), remote ? source : QUrl(source));
+
+ if (error.isEmpty()) {
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QCOMPARE(obj->width(), qreal(width));
+ QCOMPARE(obj->height(), qreal(height));
+ QCOMPARE(obj->fillMode(), QQuickImage::Stretch);
+ QCOMPARE(obj->progress(), 1.0);
+ } else {
+ QTRY_VERIFY(obj->status() == QQuickImage::Error);
+ }
+
+ delete obj;
+}
+
+void tst_qquickimage::clearSource()
+{
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QQuickImage::Ready);
+ QCOMPARE(obj->width(), 120.);
+ QCOMPARE(obj->height(), 120.);
+ QCOMPARE(obj->progress(), 1.0);
+
+ ctxt->setContextProperty("srcImage", "");
+ QVERIFY(obj->source().isEmpty());
+ QVERIFY(obj->status() == QQuickImage::Null);
+ QCOMPARE(obj->width(), 0.);
+ QCOMPARE(obj->height(), 0.);
+ QCOMPARE(obj->progress(), 0.0);
+
+ delete obj;
+}
+
+void tst_qquickimage::resized()
+{
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + testFile("colors.png") + "\"; width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->fillMode(), QQuickImage::Stretch);
+ delete obj;
+}
+
+
+void tst_qquickimage::preserveAspectRatio()
+{
+ QQuickView *window = new QQuickView(0);
+ window->show();
+
+ window->setSource(testFileUrl("aspectratio.qml"));
+ QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject());
+ QVERIFY(image != 0);
+ image->setWidth(80.0);
+ QCOMPARE(image->width(), 80.);
+ QCOMPARE(image->height(), 80.);
+
+ window->setSource(testFileUrl("aspectratio.qml"));
+ image = qobject_cast<QQuickImage*>(window->rootObject());
+ image->setHeight(60.0);
+ QVERIFY(image != 0);
+ QCOMPARE(image->height(), 60.);
+ QCOMPARE(image->width(), 60.);
+ delete window;
+}
+
+void tst_qquickimage::smooth()
+{
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + testFile("colors.png") + "\"; smooth: true; width: 300; height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.);
+ QCOMPARE(obj->height(), 300.);
+ QCOMPARE(obj->smooth(), true);
+ QCOMPARE(obj->fillMode(), QQuickImage::Stretch);
+
+ delete obj;
+}
+
+void tst_qquickimage::mirror()
+{
+ QMap<QQuickImage::FillMode, QImage> screenshots;
+ QList<QQuickImage::FillMode> fillModes;
+ fillModes << QQuickImage::Stretch << QQuickImage::PreserveAspectFit << QQuickImage::PreserveAspectCrop
+ << QQuickImage::Tile << QQuickImage::TileVertically << QQuickImage::TileHorizontally << QQuickImage::Pad;
+
+ qreal width = 300;
+ qreal height = 250;
+
+ foreach (QQuickImage::FillMode fillMode, fillModes) {
+ QQuickView *window = new QQuickView;
+ window->setSource(testFileUrl("mirror.qml"));
+
+ QQuickImage *obj = window->rootObject()->findChild<QQuickImage*>("image");
+ QVERIFY(obj != 0);
+
+ obj->setFillMode(fillMode);
+ obj->setProperty("mirror", true);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QImage screenshot = window->grabWindow();
+ screenshots[fillMode] = screenshot;
+ delete window;
+ }
+
+ foreach (QQuickImage::FillMode fillMode, fillModes) {
+ QPixmap srcPixmap;
+ QVERIFY(srcPixmap.load(testFile("pattern.png")));
+
+ QPixmap expected(width, height);
+ expected.fill();
+ QPainter p_e(&expected);
+ QTransform transform;
+ transform.translate(width, 0).scale(-1, 1.0);
+ p_e.setTransform(transform);
+
+ QPoint offset(width / 2 - srcPixmap.width() / 2, height / 2 - srcPixmap.height() / 2);
+
+ switch (fillMode) {
+ case QQuickImage::Stretch:
+ p_e.drawPixmap(QRect(0, 0, width, height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height()));
+ break;
+ case QQuickImage::PreserveAspectFit:
+ p_e.drawPixmap(QRect(25, 0, height, height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height()));
+ break;
+ case QQuickImage::PreserveAspectCrop:
+ {
+ qreal ratio = width/srcPixmap.width(); // width is the longer side
+ QRect rect(0, 0, srcPixmap.width()*ratio, srcPixmap.height()*ratio);
+ rect.moveCenter(QRect(0, 0, width, height).center());
+ p_e.drawPixmap(rect, srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height()));
+ break;
+ }
+ case QQuickImage::Tile:
+ p_e.drawTiledPixmap(QRect(0, 0, width, height), srcPixmap, -offset);
+ break;
+ case QQuickImage::TileVertically:
+ transform.scale(width / srcPixmap.width(), 1.0);
+ p_e.setTransform(transform);
+ p_e.drawTiledPixmap(QRect(0, 0, width, height), srcPixmap, QPoint(0, -offset.y()));
+ break;
+ case QQuickImage::TileHorizontally:
+ transform.scale(1.0, height / srcPixmap.height());
+ p_e.setTransform(transform);
+ p_e.drawTiledPixmap(QRect(0, 0, width, height), srcPixmap, QPoint(-offset.x(), 0));
+ break;
+ case QQuickImage::Pad:
+ p_e.drawPixmap(offset, srcPixmap);
+ break;
+ }
+
+ QImage img = expected.toImage();
+ QCOMPARE(screenshots[fillMode], img);
+ }
+}
+
+void tst_qquickimage::svg_data()
+{
+ QTest::addColumn<QString>("src");
+ QTest::addColumn<QByteArray>("format");
+
+ QTest::newRow("svg") << testFileUrl("heart.svg").toString() << QByteArray("svg");
+ QTest::newRow("svgz") << testFileUrl("heart.svgz").toString() << QByteArray("svgz");
+}
+
+void tst_qquickimage::svg()
+{
+ QFETCH(QString, src);
+ QFETCH(QByteArray, format);
+ if (!QImageReader::supportedImageFormats().contains(format))
+ QSKIP("svg support not available");
+
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 300.0);
+ QCOMPARE(obj->height(), 273.0);
+ obj->setSourceSize(QSize(200,200));
+
+ QCOMPARE(obj->width(), 200.0);
+ QCOMPARE(obj->height(), 182.0);
+ delete obj;
+}
+
+void tst_qquickimage::geometry_data()
+{
+ QTest::addColumn<QString>("fillMode");
+ QTest::addColumn<bool>("explicitWidth");
+ QTest::addColumn<bool>("explicitHeight");
+ QTest::addColumn<double>("itemWidth");
+ QTest::addColumn<double>("paintedWidth");
+ QTest::addColumn<double>("boundingWidth");
+ QTest::addColumn<double>("itemHeight");
+ QTest::addColumn<double>("paintedHeight");
+ QTest::addColumn<double>("boundingHeight");
+
+ // tested image has width 200, height 100
+
+ // bounding rect and item rect are equal with fillMode PreserveAspectFit, painted rect may be smaller if the aspect ratio doesn't match
+ QTest::newRow("PreserveAspectFit") << "PreserveAspectFit" << false << false << 200.0 << 200.0 << 200.0 << 100.0 << 100.0 << 100.0;
+ QTest::newRow("PreserveAspectFit explicit width 300") << "PreserveAspectFit" << true << false << 300.0 << 200.0 << 300.0 << 100.0 << 100.0 << 100.0;
+ QTest::newRow("PreserveAspectFit explicit height 400") << "PreserveAspectFit" << false << true << 200.0 << 200.0 << 200.0 << 400.0 << 100.0 << 400.0;
+ QTest::newRow("PreserveAspectFit explicit width 300, height 400") << "PreserveAspectFit" << true << true << 300.0 << 300.0 << 300.0 << 400.0 << 150.0 << 400.0;
+
+ // bounding rect and painted rect are equal with fillMode PreserveAspectCrop, item rect may be smaller if the aspect ratio doesn't match
+ QTest::newRow("PreserveAspectCrop") << "PreserveAspectCrop" << false << false << 200.0 << 200.0 << 200.0 << 100.0 << 100.0 << 100.0;
+ QTest::newRow("PreserveAspectCrop explicit width 300") << "PreserveAspectCrop" << true << false << 300.0 << 300.0 << 300.0 << 100.0 << 150.0 << 150.0;
+ QTest::newRow("PreserveAspectCrop explicit height 400") << "PreserveAspectCrop" << false << true << 200.0 << 800.0 << 800.0 << 400.0 << 400.0 << 400.0;
+ QTest::newRow("PreserveAspectCrop explicit width 300, height 400") << "PreserveAspectCrop" << true << true << 300.0 << 800.0 << 800.0 << 400.0 << 400.0 << 400.0;
+
+ // bounding rect, painted rect and item rect are equal in stretching and tiling images
+ QStringList fillModes;
+ fillModes << "Stretch" << "Tile" << "TileVertically" << "TileHorizontally";
+ foreach (QString fillMode, fillModes) {
+ QTest::newRow(fillMode.toLatin1()) << fillMode << false << false << 200.0 << 200.0 << 200.0 << 100.0 << 100.0 << 100.0;
+ QTest::newRow(QString(fillMode + " explicit width 300").toLatin1()) << fillMode << true << false << 300.0 << 300.0 << 300.0 << 100.0 << 100.0 << 100.0;
+ QTest::newRow(QString(fillMode + " explicit height 400").toLatin1()) << fillMode << false << true << 200.0 << 200.0 << 200.0 << 400.0 << 400.0 << 400.0;
+ QTest::newRow(QString(fillMode + " explicit width 300, height 400").toLatin1()) << fillMode << true << true << 300.0 << 300.0 << 300.0 << 400.0 << 400.0 << 400.0;
+ }
+}
+
+void tst_qquickimage::geometry()
+{
+ QFETCH(QString, fillMode);
+ QFETCH(bool, explicitWidth);
+ QFETCH(bool, explicitHeight);
+ QFETCH(double, itemWidth);
+ QFETCH(double, itemHeight);
+ QFETCH(double, paintedWidth);
+ QFETCH(double, paintedHeight);
+ QFETCH(double, boundingWidth);
+ QFETCH(double, boundingHeight);
+
+ QString src = testFileUrl("rect.png").toString();
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; fillMode: Image." + fillMode + "; ";
+
+ if (explicitWidth)
+ componentStr.append("width: 300; ");
+ if (explicitHeight)
+ componentStr.append("height: 400; ");
+ componentStr.append("}");
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->width(), itemWidth);
+ QCOMPARE(obj->paintedWidth(), paintedWidth);
+ QCOMPARE(obj->boundingRect().width(), boundingWidth);
+
+ QCOMPARE(obj->height(), itemHeight);
+ QCOMPARE(obj->paintedHeight(), paintedHeight);
+ QCOMPARE(obj->boundingRect().height(), boundingHeight);
+ delete obj;
+}
+
+void tst_qquickimage::big()
+{
+ // If the JPEG loader does not implement scaling efficiently, it would
+ // have to build a 400 MB image. That would be a bug in the JPEG loader.
+
+ QString src = testFileUrl("big.jpeg").toString();
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }";
+
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 100.0);
+ QCOMPARE(obj->height(), 256.0);
+
+ delete obj;
+}
+
+void tst_qquickimage::tiling_QTBUG_6716()
+{
+ QFETCH(QString, source);
+
+ QQuickView view(testFileUrl(source));
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QQuickImage *tiling = findItem<QQuickImage>(view.rootObject(), "tiling");
+
+ QVERIFY(tiling != 0);
+ QImage img = view.grabWindow();
+ for (int x = 0; x < tiling->width(); ++x) {
+ for (int y = 0; y < tiling->height(); ++y) {
+ QVERIFY(img.pixel(x, y) == qRgb(0, 255, 0));
+ }
+ }
+}
+
+void tst_qquickimage::tiling_QTBUG_6716_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::newRow("vertical_tiling") << "vtiling.qml";
+ QTest::newRow("horizontal_tiling") << "htiling.qml";
+}
+
+void tst_qquickimage::noLoading()
+{
+ qRegisterMetaType<QQuickImageBase::Status>();
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+ server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
+
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage; cache: true }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", testFileUrl("heart.png"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QQuickImage::Ready);
+
+ QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &)));
+ QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal)));
+ QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QQuickImageBase::Status)));
+
+ // Loading local file
+ ctxt->setContextProperty("srcImage", testFileUrl("green.png"));
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 1);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 1);
+
+ // Loading remote file
+ ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png");
+ QTRY_VERIFY(obj->status() == QQuickImage::Loading);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 2);
+ QTRY_COMPARE(progressSpy.count(), 2);
+ QTRY_COMPARE(statusSpy.count(), 3);
+
+ // Loading remote file again - should not go through 'Loading' state.
+ ctxt->setContextProperty("srcImage", testFileUrl("green.png"));
+ ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png");
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 4);
+ QTRY_COMPARE(progressSpy.count(), 2);
+ QTRY_COMPARE(statusSpy.count(), 5);
+
+ delete obj;
+}
+
+void tst_qquickimage::paintedWidthHeight()
+{
+ {
+ QString src = testFileUrl("heart.png").toString();
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 200; height: 25; fillMode: Image.PreserveAspectFit }";
+
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 200.0);
+ QCOMPARE(obj->height(), 25.0);
+ QCOMPARE(obj->paintedWidth(), 25.0);
+ QCOMPARE(obj->paintedHeight(), 25.0);
+
+ delete obj;
+ }
+
+ {
+ QString src = testFileUrl("heart.png").toString();
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 26; height: 175; fillMode: Image.PreserveAspectFit }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->width(), 26.0);
+ QCOMPARE(obj->height(), 175.0);
+ QCOMPARE(obj->paintedWidth(), 26.0);
+ QCOMPARE(obj->paintedHeight(), 26.0);
+
+ delete obj;
+ }
+}
+
+void tst_qquickimage::sourceSize_QTBUG_14303()
+{
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", testFileUrl("heart200.png"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+
+ QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged()));
+
+ QTRY_VERIFY(obj != 0);
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+
+ QTRY_COMPARE(obj->sourceSize().width(), 200);
+ QTRY_COMPARE(obj->sourceSize().height(), 200);
+ QTRY_COMPARE(sourceSizeSpy.count(), 0);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
+ QTRY_COMPARE(obj->sourceSize().width(), 120);
+ QTRY_COMPARE(obj->sourceSize().height(), 120);
+ QTRY_COMPARE(sourceSizeSpy.count(), 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("heart200.png"));
+ QTRY_COMPARE(obj->sourceSize().width(), 200);
+ QTRY_COMPARE(obj->sourceSize().height(), 200);
+ QTRY_COMPARE(sourceSizeSpy.count(), 2);
+
+ delete obj;
+}
+
+void tst_qquickimage::sourceSize_QTBUG_16389()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("qtbug_16389.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickImage *image = findItem<QQuickImage>(window->rootObject(), "iconImage");
+ QQuickItem *handle = findItem<QQuickItem>(window->rootObject(), "blueHandle");
+
+ QCOMPARE(image->sourceSize().width(), 200);
+ QCOMPARE(image->sourceSize().height(), 200);
+ QCOMPARE(image->paintedWidth(), 0.0);
+ QCOMPARE(image->paintedHeight(), 0.0);
+
+ handle->setY(20);
+
+ QCOMPARE(image->sourceSize().width(), 200);
+ QCOMPARE(image->sourceSize().height(), 200);
+ QCOMPARE(image->paintedWidth(), 20.0);
+ QCOMPARE(image->paintedHeight(), 20.0);
+
+ delete window;
+}
+
+// QTBUG-15690
+void tst_qquickimage::nullPixmapPaint()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("nullpixmap.qml"));
+ window->show();
+
+ QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject());
+ QTRY_VERIFY(image != 0);
+ image->setSource(SERVER_ADDR + QString("/no-such-file.png"));
+
+ QQmlTestMessageHandler messageHandler;
+ // used to print "QTransform::translate with NaN called"
+ QPixmap pm = QPixmap::fromImage(window->grabWindow());
+ const QStringList glErrors = messageHandler.messages().filter(QLatin1String("QGLContext::makeCurrent(): Failed."), Qt::CaseInsensitive);
+ QVERIFY2(glErrors.size() == messageHandler.messages().size(), qPrintable(messageHandler.messageString()));
+ delete image;
+
+ delete window;
+}
+
+void tst_qquickimage::imageCrash_QTBUG_22125()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
+
+ {
+ QQuickView view(testFileUrl("qtbug_22125.qml"));
+ view.show();
+ qApp->processEvents();
+ qApp->processEvents();
+ // shouldn't crash when the view drops out of scope due to
+ // QQuickPixmapData attempting to dereference a pointer to
+ // the destroyed reader.
+ }
+
+ // shouldn't crash when deleting cancelled QQmlPixmapReplys.
+ server.sendDelayedItem();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+}
+
+void tst_qquickimage::sourceSize_data()
+{
+ QTest::addColumn<int>("sourceWidth");
+ QTest::addColumn<int>("sourceHeight");
+ QTest::addColumn<qreal>("implicitWidth");
+ QTest::addColumn<qreal>("implicitHeight");
+
+ QTest::newRow("unscaled") << 0 << 0 << 300.0 << 300.0;
+ QTest::newRow("scale width") << 100 << 0 << 100.0 << 100.0;
+ QTest::newRow("scale height") << 0 << 150 << 150.0 << 150.0;
+ QTest::newRow("larger sourceSize") << 400 << 400 << 300.0 << 300.0;
+}
+
+void tst_qquickimage::sourceSize()
+{
+ QFETCH(int, sourceWidth);
+ QFETCH(int, sourceHeight);
+ QFETCH(qreal, implicitWidth);
+ QFETCH(qreal, implicitHeight);
+
+ QQuickView *window = new QQuickView(0);
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("srcWidth", sourceWidth);
+ ctxt->setContextProperty("srcHeight", sourceHeight);
+
+ window->setSource(testFileUrl("sourceSize.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject());
+ QVERIFY(image);
+
+ QCOMPARE(image->sourceSize().width(), sourceWidth);
+ QCOMPARE(image->sourceSize().height(), sourceHeight);
+ QCOMPARE(image->implicitWidth(), implicitWidth);
+ QCOMPARE(image->implicitHeight(), implicitHeight);
+
+ delete window;
+}
+
+void tst_qquickimage::sourceSizeChanges()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nImage { source: srcImage }", QUrl::fromLocalFile(""));
+ QTRY_VERIFY(component.isReady());
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", "");
+ QQuickImage *img = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(img != 0);
+
+ QSignalSpy sourceSizeSpy(img, SIGNAL(sourceSizeChanged()));
+
+ // Local
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(img->status(), QQuickImage::Null);
+ QTRY_COMPARE(sourceSizeSpy.count(), 0);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("heart.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("heart.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("heart_copy.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 1);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 2);
+
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(img->status(), QQuickImage::Null);
+ QTRY_COMPARE(sourceSizeSpy.count(), 3);
+
+ // Remote
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/heart.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/heart.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/heart_copy.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 4);
+
+ ctxt->setContextProperty("srcImage", QUrl("http://127.0.0.1:14449/colors.png"));
+ QTRY_COMPARE(img->status(), QQuickImage::Ready);
+ QTRY_COMPARE(sourceSizeSpy.count(), 5);
+
+ ctxt->setContextProperty("srcImage", QUrl(""));
+ QTRY_COMPARE(img->status(), QQuickImage::Null);
+ QTRY_COMPARE(sourceSizeSpy.count(), 6);
+
+ delete img;
+}
+
+void tst_qquickimage::progressAndStatusChanges()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlEngine engine;
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", testFileUrl("heart.png"));
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+
+ qRegisterMetaType<QQuickImageBase::Status>();
+ QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &)));
+ QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal)));
+ QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QQuickImageBase::Status)));
+
+ // Same image
+ ctxt->setContextProperty("srcImage", testFileUrl("heart.png"));
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 0);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 0);
+
+ // Loading local file
+ ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 1);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 1);
+
+ // Loading remote file
+ ctxt->setContextProperty("srcImage", "http://127.0.0.1:14449/heart.png");
+ QTRY_VERIFY(obj->status() == QQuickImage::Loading);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 2);
+ QTRY_VERIFY(progressSpy.count() > 1);
+ QTRY_COMPARE(statusSpy.count(), 3);
+
+ ctxt->setContextProperty("srcImage", "");
+ QTRY_VERIFY(obj->status() == QQuickImage::Null);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_COMPARE(sourceSpy.count(), 3);
+ QTRY_VERIFY(progressSpy.count() > 2);
+ QTRY_COMPARE(statusSpy.count(), 4);
+
+ delete obj;
+}
+
+class TestQImageProvider : public QQuickImageProvider
+{
+public:
+ TestQImageProvider() : QQuickImageProvider(Image) {}
+
+ QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize)
+ {
+ if (id == QLatin1String("first-image.png")) {
+ QTest::qWait(50);
+ int width = 100;
+ int height = 100;
+ QImage image(width, height, QImage::Format_RGB32);
+ image.fill(QColor("yellow").rgb());
+ if (size)
+ *size = QSize(width, height);
+ return image;
+ }
+
+ QTest::qWait(400);
+ int width = 100;
+ int height = 100;
+ QImage image(width, height, QImage::Format_RGB32);
+ image.fill(QColor("green").rgb());
+ if (size)
+ *size = QSize(width, height);
+ return image;
+ }
+};
+
+void tst_qquickimage::correctStatus()
+{
+ QQmlEngine engine;
+ engine.addImageProvider(QLatin1String("test"), new TestQImageProvider());
+
+ QQmlComponent component(&engine, testFileUrl("correctStatus.qml"));
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ QTest::qWait(200);
+
+ // at this point image1 should be attempting to load second-image.png,
+ // and should be in the loading state. Without a clear prior to that load,
+ // the status can mistakenly be in the ready state.
+ QCOMPARE(obj->property("status").toInt(), int(QQuickImage::Loading));
+
+ QTest::qWait(400);
+ delete obj;
+}
+
+QTEST_MAIN(tst_qquickimage)
+
+#include "tst_qquickimage.moc"
diff --git a/tests/auto/quick/qquickimageprovider/qquickimageprovider.pro b/tests/auto/quick/qquickimageprovider/qquickimageprovider.pro
new file mode 100644
index 0000000000..496dc31d30
--- /dev/null
+++ b/tests/auto/quick/qquickimageprovider/qquickimageprovider.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qquickimageprovider
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickimageprovider.cpp
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
new file mode 100644
index 0000000000..a790c7b9de
--- /dev/null
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -0,0 +1,443 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtQml/qqmlengine.h>
+#include <QtQuick/qquickimageprovider.h>
+#include <private/qquickimage_p.h>
+#include <QImageReader>
+#include <QWaitCondition>
+
+Q_DECLARE_METATYPE(QQuickImageProvider*);
+
+class tst_qquickimageprovider : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qquickimageprovider()
+ {
+ }
+
+private slots:
+ void requestImage_sync_data();
+ void requestImage_sync();
+ void requestImage_async_data();
+ void requestImage_async();
+ void requestImage_async_forced_data();
+ void requestImage_async_forced();
+
+ void requestPixmap_sync_data();
+ void requestPixmap_sync();
+ void requestPixmap_async();
+
+ void removeProvider_data();
+ void removeProvider();
+
+ void threadTest();
+
+private:
+ QString newImageFileName() const;
+ void fillRequestTestsData(const QString &id);
+ void runTest(bool async, QQuickImageProvider *provider);
+};
+
+
+class TestQImageProvider : public QQuickImageProvider
+{
+public:
+ TestQImageProvider(bool *deleteWatch = 0, bool forceAsync = false)
+ : QQuickImageProvider(Image, (forceAsync ? ForceAsynchronousImageLoading : Flags()))
+ , deleteWatch(deleteWatch)
+ {
+ }
+
+ ~TestQImageProvider()
+ {
+ if (deleteWatch)
+ *deleteWatch = true;
+ }
+
+ QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize)
+ {
+ lastImageId = id;
+
+ if (id == QLatin1String("no-such-file.png"))
+ return QImage();
+
+ int width = 100;
+ int height = 100;
+ QImage image(width, height, QImage::Format_RGB32);
+ if (size)
+ *size = QSize(width, height);
+ if (requestedSize.isValid())
+ image = image.scaled(requestedSize);
+ return image;
+ }
+
+ bool *deleteWatch;
+ QString lastImageId;
+};
+Q_DECLARE_METATYPE(TestQImageProvider*);
+
+
+class TestQPixmapProvider : public QQuickImageProvider
+{
+public:
+ TestQPixmapProvider(bool *deleteWatch = 0)
+ : QQuickImageProvider(Pixmap), deleteWatch(deleteWatch)
+ {
+ }
+
+ ~TestQPixmapProvider()
+ {
+ if (deleteWatch)
+ *deleteWatch = true;
+ }
+
+ QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize)
+ {
+ lastImageId = id;
+
+ if (id == QLatin1String("no-such-file.png"))
+ return QPixmap();
+
+ int width = 100;
+ int height = 100;
+ QPixmap image(width, height);
+ if (size)
+ *size = QSize(width, height);
+ if (requestedSize.isValid())
+ image = image.scaled(requestedSize);
+ return image;
+ }
+
+ bool *deleteWatch;
+ QString lastImageId;
+};
+Q_DECLARE_METATYPE(TestQPixmapProvider*);
+
+
+QString tst_qquickimageprovider::newImageFileName() const
+{
+ // need to generate new filenames each time or else images are loaded
+ // from cache and we won't get loading status changes when testing
+ // async loading
+ static int count = 0;
+ return QString("image://test/image-%1.png").arg(count++);
+}
+
+void tst_qquickimageprovider::fillRequestTestsData(const QString &id)
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<QString>("imageId");
+ QTest::addColumn<QString>("properties");
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QString>("error");
+
+ QString fileName = newImageFileName();
+ QTest::newRow(QTest::toString(id + " simple test"))
+ << "image://test/" + fileName << fileName << "" << QSize(100,100) << "";
+
+ fileName = newImageFileName();
+ QTest::newRow(QTest::toString(id + " simple test with capitalization"))//As it's a URL, should make no difference
+ << "image://Test/" + fileName << fileName << "" << QSize(100,100) << "";
+
+ fileName = newImageFileName();
+ QTest::newRow(QTest::toString(id + " url with no id"))
+ << "image://test/" + fileName << "" + fileName << "" << QSize(100,100) << "";
+
+ fileName = newImageFileName();
+ QTest::newRow(QTest::toString(id + " url with path"))
+ << "image://test/test/path" + fileName << "test/path" + fileName << "" << QSize(100,100) << "";
+
+ fileName = newImageFileName();
+ QTest::newRow(QTest::toString(id + " url with fragment"))
+ << "image://test/faq.html?#question13" + fileName << "faq.html?#question13" + fileName << "" << QSize(100,100) << "";
+
+ fileName = newImageFileName();
+ QTest::newRow(QTest::toString(id + " url with query"))
+ << "image://test/cgi-bin/drawgraph.cgi?type=pie&color=green" + fileName << "cgi-bin/drawgraph.cgi?type=pie&color=green" + fileName
+ << "" << QSize(100,100) << "";
+
+ fileName = newImageFileName();
+ QTest::newRow(QTest::toString(id + " scaled image"))
+ << "image://test/" + fileName << fileName << "sourceSize: \"80x30\"" << QSize(80,30) << "";
+
+ QTest::newRow(QTest::toString(id + " missing"))
+ << "image://test/no-such-file.png" << "no-such-file.png" << "" << QSize(100,100)
+ << "file::2:1: QML Image: Failed to get image from provider: image://test/no-such-file.png";
+
+ QTest::newRow(QTest::toString(id + " unknown provider"))
+ << "image://bogus/exists.png" << "" << "" << QSize()
+ << "file::2:1: QML Image: Invalid image provider: image://bogus/exists.png";
+}
+
+void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider)
+{
+ QFETCH(QString, source);
+ QFETCH(QString, imageId);
+ QFETCH(QString, properties);
+ QFETCH(QSize, size);
+ QFETCH(QString, error);
+
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
+ QQmlEngine engine;
+
+ engine.addImageProvider("test", provider);
+ QVERIFY(engine.imageProvider("test") != 0);
+
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + source + "\"; "
+ + (async ? "asynchronous: true; " : "")
+ + properties + " }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ // From this point on, treat forced async providers as async behaviour-wise
+ if (engine.imageProvider(QUrl(source).host()) == provider)
+ async |= (provider->flags() & QQuickImageProvider::ForceAsynchronousImageLoading) != 0;
+
+ if (async)
+ QTRY_VERIFY(obj->status() == QQuickImage::Loading);
+
+ QCOMPARE(obj->source(), QUrl(source));
+
+ if (error.isEmpty()) {
+ if (async)
+ QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ else
+ QVERIFY(obj->status() == QQuickImage::Ready);
+ if (QByteArray(QTest::currentDataTag()).startsWith("qimage"))
+ QCOMPARE(static_cast<TestQImageProvider*>(provider)->lastImageId, imageId);
+ else
+ QCOMPARE(static_cast<TestQPixmapProvider*>(provider)->lastImageId, imageId);
+
+ QCOMPARE(obj->width(), qreal(size.width()));
+ QCOMPARE(obj->height(), qreal(size.height()));
+ QCOMPARE(obj->fillMode(), QQuickImage::Stretch);
+ QCOMPARE(obj->progress(), 1.0);
+ } else {
+ if (async)
+ QTRY_VERIFY(obj->status() == QQuickImage::Error);
+ else
+ QVERIFY(obj->status() == QQuickImage::Error);
+ }
+
+ delete obj;
+}
+
+void tst_qquickimageprovider::requestImage_sync_data()
+{
+ fillRequestTestsData("qimage|sync");
+}
+
+void tst_qquickimageprovider::requestImage_sync()
+{
+ bool deleteWatch = false;
+ runTest(false, new TestQImageProvider(&deleteWatch));
+ QVERIFY(deleteWatch);
+}
+
+void tst_qquickimageprovider::requestImage_async_data()
+{
+ fillRequestTestsData("qimage|async");
+}
+
+void tst_qquickimageprovider::requestImage_async()
+{
+ bool deleteWatch = false;
+ runTest(true, new TestQImageProvider(&deleteWatch));
+ QVERIFY(deleteWatch);
+}
+
+void tst_qquickimageprovider::requestImage_async_forced_data()
+{
+ fillRequestTestsData("qimage|async_forced");
+}
+
+void tst_qquickimageprovider::requestImage_async_forced()
+{
+ bool deleteWatch = false;
+ runTest(false, new TestQImageProvider(&deleteWatch, true));
+ QVERIFY(deleteWatch);
+}
+
+void tst_qquickimageprovider::requestPixmap_sync_data()
+{
+ fillRequestTestsData("qpixmap");
+}
+
+void tst_qquickimageprovider::requestPixmap_sync()
+{
+ bool deleteWatch = false;
+ runTest(false, new TestQPixmapProvider(&deleteWatch));
+ QVERIFY(deleteWatch);
+}
+
+void tst_qquickimageprovider::requestPixmap_async()
+{
+ QQmlEngine engine;
+ QQuickImageProvider *provider = new TestQPixmapProvider();
+
+ engine.addImageProvider("test", provider);
+ QVERIFY(engine.imageProvider("test") != 0);
+
+ // pixmaps are loaded synchronously regardless of 'asynchronous' value
+ QString componentStr = "import QtQuick 2.0\nImage { asynchronous: true; source: \"image://test/pixmap-async-test.png\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ delete obj;
+}
+
+void tst_qquickimageprovider::removeProvider_data()
+{
+ QTest::addColumn<QQuickImageProvider*>("provider");
+
+ QTest::newRow("qimage") << static_cast<QQuickImageProvider*>(new TestQImageProvider);
+ QTest::newRow("qpixmap") << static_cast<QQuickImageProvider*>(new TestQPixmapProvider);
+}
+
+void tst_qquickimageprovider::removeProvider()
+{
+ QFETCH(QQuickImageProvider*, provider);
+
+ QQmlEngine engine;
+
+ engine.addImageProvider("test", provider);
+ QVERIFY(engine.imageProvider("test") != 0);
+
+ // add provider, confirm it works
+ QString componentStr = "import QtQuick 2.0\nImage { source: \"" + newImageFileName() + "\" }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->status(), QQuickImage::Ready);
+
+ // remove the provider and confirm
+ QString fileName = newImageFileName();
+ QString error("file::2:1: QML Image: Invalid image provider: " + fileName);
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
+ engine.removeImageProvider("test");
+
+ obj->setSource(QUrl(fileName));
+ QCOMPARE(obj->status(), QQuickImage::Error);
+
+ delete obj;
+}
+
+class TestThreadProvider : public QQuickImageProvider
+{
+ public:
+ TestThreadProvider() : QQuickImageProvider(Image), ok(false) {}
+
+ ~TestThreadProvider() {}
+
+ QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize)
+ {
+ mutex.lock();
+ if (!ok)
+ cond.wait(&mutex);
+ mutex.unlock();
+ QVector<int> v;
+ for (int i = 0; i < 10000; i++)
+ v.prepend(i); //do some computation
+ QImage image(50,50, QImage::Format_RGB32);
+ image.fill(QColor(id).rgb());
+ if (size)
+ *size = image.size();
+ if (requestedSize.isValid())
+ image = image.scaled(requestedSize);
+ return image;
+ }
+
+ QWaitCondition cond;
+ QMutex mutex;
+ bool ok;
+};
+
+
+void tst_qquickimageprovider::threadTest()
+{
+ QQmlEngine engine;
+
+ TestThreadProvider *provider = new TestThreadProvider;
+
+ engine.addImageProvider("test_thread", provider);
+ QVERIFY(engine.imageProvider("test_thread") != 0);
+
+ QString componentStr = "import QtQuick 2.0\nItem { \n"
+ "Image { source: \"image://test_thread/blue\"; asynchronous: true; }\n"
+ "Image { source: \"image://test_thread/red\"; asynchronous: true; }\n"
+ "Image { source: \"image://test_thread/green\"; asynchronous: true; }\n"
+ "Image { source: \"image://test_thread/yellow\"; asynchronous: true; }\n"
+ " }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QObject *obj = component.create();
+ //MUST not deadlock
+ QVERIFY(obj != 0);
+ QList<QQuickImage *> images = obj->findChildren<QQuickImage *>();
+ QCOMPARE(images.count(), 4);
+ QTest::qWait(100);
+ foreach (QQuickImage *img, images) {
+ QCOMPARE(img->status(), QQuickImage::Loading);
+ }
+ provider->ok = true;
+ provider->cond.wakeAll();
+ QTest::qWait(250);
+ foreach (QQuickImage *img, images) {
+ QTRY_VERIFY(img->status() == QQuickImage::Ready);
+ }
+}
+
+
+QTEST_MAIN(tst_qquickimageprovider)
+
+#include "tst_qquickimageprovider.moc"
diff --git a/tests/auto/quick/qquickitem/data/focusSubItemInNonFocusScope.qml b/tests/auto/quick/qquickitem/data/focusSubItemInNonFocusScope.qml
new file mode 100644
index 0000000000..0e50710717
--- /dev/null
+++ b/tests/auto/quick/qquickitem/data/focusSubItemInNonFocusScope.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ FocusScope {
+ width: 400; height: 400
+ focus: true
+ Item {
+ width: 400; height: 400
+ Item {
+ id: dummy
+ objectName: "dummyItem"
+ focus: true
+ }
+ TextInput {
+ id: ti
+ objectName: "textInput"
+ focus: true
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem/data/multipleFocusClears.qml b/tests/auto/quick/qquickitem/data/multipleFocusClears.qml
new file mode 100644
index 0000000000..f68a8901ab
--- /dev/null
+++ b/tests/auto/quick/qquickitem/data/multipleFocusClears.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+
+ FocusScope {
+ id: focusScope
+ anchors.fill: parent
+
+ TextInput {
+ anchors.centerIn: parent
+ text: "Some text"
+ onActiveFocusChanged: if (!activeFocus) focusScope.focus = false
+ Component.onCompleted: forceActiveFocus()
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem/data/order.1.qml b/tests/auto/quick/qquickitem/data/order.1.qml
new file mode 100644
index 0000000000..963288b257
--- /dev/null
+++ b/tests/auto/quick/qquickitem/data/order.1.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ Item { objectName: "1" }
+ Item { objectName: "2" }
+ Item { objectName: "3" }
+}
diff --git a/tests/auto/quick/qquickitem/data/order.2.qml b/tests/auto/quick/qquickitem/data/order.2.qml
new file mode 100644
index 0000000000..5609c77e28
--- /dev/null
+++ b/tests/auto/quick/qquickitem/data/order.2.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item {
+ Item { objectName: "1" }
+ Item { objectName: "2"; z: 1.0 }
+ Item { objectName: "3" }
+}
diff --git a/tests/auto/quick/qquickitem/data/polishOnCompleted.qml b/tests/auto/quick/qquickitem/data/polishOnCompleted.qml
new file mode 100644
index 0000000000..7008cdc67e
--- /dev/null
+++ b/tests/auto/quick/qquickitem/data/polishOnCompleted.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+TestPolishItem {
+ width: 200
+ height: 200
+
+ Component.onCompleted: {
+ doPolish()
+ }
+}
diff --git a/tests/auto/quick/qquickitem/qquickitem.pro b/tests/auto/quick/qquickitem/qquickitem.pro
new file mode 100644
index 0000000000..ea6ae8f4af
--- /dev/null
+++ b/tests/auto/quick/qquickitem/qquickitem.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qquickitem
+SOURCES += tst_qquickitem.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
new file mode 100644
index 0000000000..a7343f686f
--- /dev/null
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -0,0 +1,1728 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickwindow.h>
+#include <QtQuick/qquickview.h>
+#include <QtWidgets/QGraphicsSceneMouseEvent>
+#include "private/qquickfocusscope_p.h"
+#include "private/qquickitem_p.h"
+#include <qpa/qwindowsysteminterface.h>
+#include <QDebug>
+#include <QTimer>
+#include "../../shared/util.h"
+
+class TestItem : public QQuickItem
+{
+Q_OBJECT
+public:
+ TestItem(QQuickItem *parent = 0)
+ : QQuickItem(parent), focused(false), pressCount(0), releaseCount(0)
+ , wheelCount(0), acceptIncomingTouchEvents(true)
+ , touchEventReached(false) {}
+
+ bool focused;
+ int pressCount;
+ int releaseCount;
+ int wheelCount;
+ bool acceptIncomingTouchEvents;
+ bool touchEventReached;
+protected:
+ virtual void focusInEvent(QFocusEvent *) { Q_ASSERT(!focused); focused = true; }
+ virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; }
+ virtual void mousePressEvent(QMouseEvent *event) { event->accept(); ++pressCount; }
+ virtual void mouseReleaseEvent(QMouseEvent *event) { event->accept(); ++releaseCount; }
+ virtual void touchEvent(QTouchEvent *event) {
+ touchEventReached = true;
+ event->setAccepted(acceptIncomingTouchEvents);
+ }
+ virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; }
+};
+
+class TestWindow: public QQuickWindow
+{
+public:
+ TestWindow()
+ : QQuickWindow()
+ {}
+
+ virtual bool event(QEvent *event)
+ {
+ return QQuickWindow::event(event);
+ }
+};
+
+class TestPolishItem : public QQuickItem
+{
+Q_OBJECT
+public:
+ TestPolishItem(QQuickItem *parent = 0)
+ : QQuickItem(parent), wasPolished(false) {
+
+ }
+
+ bool wasPolished;
+
+protected:
+ virtual void updatePolish() {
+ wasPolished = true;
+ }
+
+public slots:
+ void doPolish() {
+ polish();
+ }
+};
+
+class TestFocusScope : public QQuickFocusScope
+{
+Q_OBJECT
+public:
+ TestFocusScope(QQuickItem *parent = 0) : QQuickFocusScope(parent), focused(false) {}
+
+ bool focused;
+protected:
+ virtual void focusInEvent(QFocusEvent *) { Q_ASSERT(!focused); focused = true; }
+ virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; }
+};
+
+class tst_qquickitem : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void initTestCase();
+
+ void noWindow();
+ void simpleFocus();
+ void scopedFocus();
+ void addedToWindow();
+ void changeParent();
+ void multipleFocusClears();
+ void focusSubItemInNonFocusScope();
+ void parentItemWithFocus();
+ void reparentFocusedItem();
+
+ void constructor();
+ void setParentItem();
+
+ void visible();
+ void enabled();
+ void enabledFocus();
+
+ void mouseGrab();
+ void touchEventAcceptIgnore_data();
+ void touchEventAcceptIgnore();
+ void polishOutsideAnimation();
+ void polishOnCompleted();
+
+ void wheelEvent_data();
+ void wheelEvent();
+ void hoverEvent_data();
+ void hoverEvent();
+ void hoverEventInParent();
+
+ void paintOrder_data();
+ void paintOrder();
+
+ void acceptedMouseButtons();
+
+private:
+
+ enum PaintOrderOp {
+ NoOp, Append, Remove, StackBefore, StackAfter, SetZ
+ };
+
+ void ensureFocus(QWindow *w) {
+ if (w->width() <=0 || w->height() <= 0)
+ w->setGeometry(100, 100, 400, 300);
+ w->show();
+ w->requestActivate();
+ QTest::qWaitForWindowActive(w);
+ }
+};
+
+void tst_qquickitem::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<TestPolishItem>("Qt.test", 1, 0, "TestPolishItem");
+}
+
+// Focus still updates when outside a window
+void tst_qquickitem::noWindow()
+{
+ QQuickItem *root = new TestItem;
+ QQuickItem *child = new TestItem(root);
+ QQuickItem *scope = new TestItem(root);
+ QQuickFocusScope *scopedChild = new TestFocusScope(scope);
+ QQuickFocusScope *scopedChild2 = new TestFocusScope(scope);
+
+ QCOMPARE(root->hasFocus(), false);
+ QCOMPARE(child->hasFocus(), false);
+ QCOMPARE(scope->hasFocus(), false);
+ QCOMPARE(scopedChild->hasFocus(), false);
+ QCOMPARE(scopedChild2->hasFocus(), false);
+
+ root->setFocus(true);
+ scope->setFocus(true);
+ scopedChild2->setFocus(true);
+ QCOMPARE(root->hasFocus(), false);
+ QCOMPARE(child->hasFocus(), false);
+ QCOMPARE(scope->hasFocus(), false);
+ QCOMPARE(scopedChild->hasFocus(), false);
+ QCOMPARE(scopedChild2->hasFocus(), true);
+
+ root->setFocus(false);
+ child->setFocus(true);
+ scopedChild->setFocus(true);
+ scope->setFocus(false);
+ QCOMPARE(root->hasFocus(), false);
+ QCOMPARE(child->hasFocus(), false);
+ QCOMPARE(scope->hasFocus(), false);
+ QCOMPARE(scopedChild->hasFocus(), true);
+ QCOMPARE(scopedChild2->hasFocus(), false);
+
+ delete root;
+}
+
+struct FocusData {
+ FocusData() : focus(false), activeFocus(false) {}
+
+ void set(bool f, bool af) { focus = f; activeFocus = af; }
+ bool focus;
+ bool activeFocus;
+};
+struct FocusState : public QHash<QQuickItem *, FocusData>
+{
+ FocusState() : activeFocusItem(0) {}
+ FocusState &operator<<(QQuickItem *item) {
+ insert(item, FocusData());
+ return *this;
+ }
+
+ void active(QQuickItem *i) {
+ activeFocusItem = i;
+ }
+ QQuickItem *activeFocusItem;
+};
+
+#define FVERIFY() \
+ do { \
+ if (focusState.activeFocusItem) { \
+ QCOMPARE(window.activeFocusItem(), focusState.activeFocusItem); \
+ if (qobject_cast<TestItem *>(window.activeFocusItem())) \
+ QCOMPARE(qobject_cast<TestItem *>(window.activeFocusItem())->focused, true); \
+ else if (qobject_cast<TestFocusScope *>(window.activeFocusItem())) \
+ QCOMPARE(qobject_cast<TestFocusScope *>(window.activeFocusItem())->focused, true); \
+ } else { \
+ QCOMPARE(window.activeFocusItem(), window.contentItem()); \
+ } \
+ for (QHash<QQuickItem *, FocusData>::Iterator iter = focusState.begin(); \
+ iter != focusState.end(); \
+ iter++) { \
+ QCOMPARE(iter.key()->hasFocus(), iter.value().focus); \
+ QCOMPARE(iter.key()->hasActiveFocus(), iter.value().activeFocus); \
+ } \
+ } while (false)
+
+// Tests a simple set of top-level scoped items
+void tst_qquickitem::simpleFocus()
+{
+ QQuickWindow window;
+ ensureFocus(&window);
+
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+
+ QQuickItem *l1c1 = new TestItem(window.contentItem());
+ QQuickItem *l1c2 = new TestItem(window.contentItem());
+ QQuickItem *l1c3 = new TestItem(window.contentItem());
+
+ QQuickItem *l2c1 = new TestItem(l1c1);
+ QQuickItem *l2c2 = new TestItem(l1c1);
+ QQuickItem *l2c3 = new TestItem(l1c3);
+
+ FocusState focusState;
+ focusState << l1c1 << l1c2 << l1c3
+ << l2c1 << l2c2 << l2c3;
+ FVERIFY();
+
+ l1c1->setFocus(true);
+ focusState[l1c1].set(true, true);
+ focusState.active(l1c1);
+ FVERIFY();
+
+ l2c3->setFocus(true);
+ focusState[l1c1].set(false, false);
+ focusState[l2c3].set(true, true);
+ focusState.active(l2c3);
+ FVERIFY();
+
+ l1c3->setFocus(true);
+ focusState[l2c3].set(false, false);
+ focusState[l1c3].set(true, true);
+ focusState.active(l1c3);
+ FVERIFY();
+
+ l1c2->setFocus(false);
+ FVERIFY();
+
+ l1c3->setFocus(false);
+ focusState[l1c3].set(false, false);
+ focusState.active(0);
+ FVERIFY();
+
+ l2c1->setFocus(true);
+ focusState[l2c1].set(true, true);
+ focusState.active(l2c1);
+ FVERIFY();
+}
+
+// Items with a focus scope
+void tst_qquickitem::scopedFocus()
+{
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+
+ QQuickItem *l1c1 = new TestItem(window.contentItem());
+ QQuickItem *l1c2 = new TestItem(window.contentItem());
+ QQuickItem *l1c3 = new TestItem(window.contentItem());
+
+ QQuickItem *l2c1 = new TestItem(l1c1);
+ QQuickItem *l2c2 = new TestItem(l1c1);
+ QQuickItem *l2c3 = new TestFocusScope(l1c3);
+
+ QQuickItem *l3c1 = new TestItem(l2c3);
+ QQuickItem *l3c2 = new TestFocusScope(l2c3);
+
+ QQuickItem *l4c1 = new TestItem(l3c2);
+ QQuickItem *l4c2 = new TestItem(l3c2);
+
+ FocusState focusState;
+ focusState << l1c1 << l1c2 << l1c3
+ << l2c1 << l2c2 << l2c3
+ << l3c1 << l3c2
+ << l4c1 << l4c2;
+ FVERIFY();
+
+ l4c2->setFocus(true);
+ focusState[l4c2].set(true, false);
+ FVERIFY();
+
+ l4c1->setFocus(true);
+ focusState[l4c2].set(false, false);
+ focusState[l4c1].set(true, false);
+ FVERIFY();
+
+ l1c1->setFocus(true);
+ focusState[l1c1].set(true, true);
+ focusState.active(l1c1);
+ FVERIFY();
+
+ l3c2->setFocus(true);
+ focusState[l3c2].set(true, false);
+ FVERIFY();
+
+ l2c3->setFocus(true);
+ focusState[l1c1].set(false, false);
+ focusState[l2c3].set(true, true);
+ focusState[l3c2].set(true, true);
+ focusState[l4c1].set(true, true);
+ focusState.active(l4c1);
+ FVERIFY();
+
+ l3c2->setFocus(false);
+ focusState[l3c2].set(false, false);
+ focusState[l4c1].set(true, false);
+ focusState.active(l2c3);
+ FVERIFY();
+
+ l3c2->setFocus(true);
+ focusState[l3c2].set(true, true);
+ focusState[l4c1].set(true, true);
+ focusState.active(l4c1);
+ FVERIFY();
+
+ l4c1->setFocus(false);
+ focusState[l4c1].set(false, false);
+ focusState.active(l3c2);
+ FVERIFY();
+
+ l1c3->setFocus(true);
+ focusState[l1c3].set(true, true);
+ focusState[l2c3].set(false, false);
+ focusState[l3c2].set(true, false);
+ focusState.active(l1c3);
+ FVERIFY();
+}
+
+// Tests focus corrects itself when a tree is added to a window for the first time
+void tst_qquickitem::addedToWindow()
+{
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+
+ QQuickItem *item = new TestItem;
+
+ FocusState focusState;
+ focusState << item;
+
+ item->setFocus(true);
+ focusState[item].set(true, false);
+ FVERIFY();
+
+ item->setParentItem(window.contentItem());
+ focusState[item].set(true, true);
+ focusState.active(item);
+ FVERIFY();
+ }
+
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+
+ QQuickItem *item = new TestItem(window.contentItem());
+
+ QQuickItem *tree = new TestItem;
+ QQuickItem *c1 = new TestItem(tree);
+ QQuickItem *c2 = new TestItem(tree);
+
+ FocusState focusState;
+ focusState << item << tree << c1 << c2;
+
+ item->setFocus(true);
+ c1->setFocus(true);
+ c2->setFocus(true);
+ focusState[item].set(true, true);
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, false);
+ focusState.active(item);
+ FVERIFY();
+
+ tree->setParentItem(item);
+ focusState[c1].set(false, false);
+ focusState[c2].set(false, false);
+ FVERIFY();
+ }
+
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+
+ QQuickItem *tree = new TestItem;
+ QQuickItem *c1 = new TestItem(tree);
+ QQuickItem *c2 = new TestItem(tree);
+
+ FocusState focusState;
+ focusState << tree << c1 << c2;
+ c1->setFocus(true);
+ c2->setFocus(true);
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, false);
+ FVERIFY();
+
+ tree->setParentItem(window.contentItem());
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, true);
+ focusState.active(c2);
+ FVERIFY();
+ }
+
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *tree = new TestFocusScope;
+ QQuickItem *c1 = new TestItem(tree);
+ QQuickItem *c2 = new TestItem(tree);
+
+ FocusState focusState;
+ focusState << tree << c1 << c2;
+ c1->setFocus(true);
+ c2->setFocus(true);
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, false);
+ FVERIFY();
+
+ tree->setParentItem(window.contentItem());
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, false);
+ FVERIFY();
+
+ tree->setFocus(true);
+ focusState[tree].set(true, true);
+ focusState[c2].set(true, true);
+ focusState.active(c2);
+ FVERIFY();
+ }
+
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *tree = new TestFocusScope;
+ QQuickItem *c1 = new TestItem(tree);
+ QQuickItem *c2 = new TestItem(tree);
+
+ FocusState focusState;
+ focusState << tree << c1 << c2;
+ tree->setFocus(true);
+ c1->setFocus(true);
+ c2->setFocus(true);
+ focusState[tree].set(true, false);
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, false);
+ FVERIFY();
+
+ tree->setParentItem(window.contentItem());
+ focusState[tree].set(true, true);
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, true);
+ focusState.active(c2);
+ FVERIFY();
+ }
+
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *child = new TestItem(window.contentItem());
+ QQuickItem *tree = new TestFocusScope;
+ QQuickItem *c1 = new TestItem(tree);
+ QQuickItem *c2 = new TestItem(tree);
+
+ FocusState focusState;
+ focusState << child << tree << c1 << c2;
+ child->setFocus(true);
+ tree->setFocus(true);
+ c1->setFocus(true);
+ c2->setFocus(true);
+ focusState[child].set(true, true);
+ focusState[tree].set(true, false);
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, false);
+ focusState.active(child);
+ FVERIFY();
+
+ tree->setParentItem(window.contentItem());
+ focusState[tree].set(false, false);
+ focusState[c1].set(false, false);
+ focusState[c2].set(true, false);
+ FVERIFY();
+
+ tree->setFocus(true);
+ focusState[child].set(false, false);
+ focusState[tree].set(true, true);
+ focusState[c2].set(true, true);
+ focusState.active(c2);
+ FVERIFY();
+ }
+}
+
+void tst_qquickitem::changeParent()
+{
+ // Parent to no parent
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *child = new TestItem(window.contentItem());
+
+ FocusState focusState;
+ focusState << child;
+ FVERIFY();
+
+ child->setFocus(true);
+ focusState[child].set(true, true);
+ focusState.active(child);
+ FVERIFY();
+
+ child->setParentItem(0);
+ focusState[child].set(true, false);
+ focusState.active(0);
+ FVERIFY();
+ }
+
+ // Different parent, same focus scope
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *child = new TestItem(window.contentItem());
+ QQuickItem *child2 = new TestItem(window.contentItem());
+
+ FocusState focusState;
+ focusState << child << child2;
+ FVERIFY();
+
+ child->setFocus(true);
+ focusState[child].set(true, true);
+ focusState.active(child);
+ FVERIFY();
+
+ child->setParentItem(child2);
+ FVERIFY();
+ }
+
+ // Different parent, different focus scope
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *child = new TestItem(window.contentItem());
+ QQuickItem *child2 = new TestFocusScope(window.contentItem());
+ QQuickItem *item = new TestItem(child);
+
+ FocusState focusState;
+ focusState << child << child2 << item;
+ FVERIFY();
+
+ item->setFocus(true);
+ focusState[item].set(true, true);
+ focusState.active(item);
+ FVERIFY();
+
+ item->setParentItem(child2);
+ focusState[item].set(true, false);
+ focusState.active(0);
+ FVERIFY();
+ }
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *child = new TestItem(window.contentItem());
+ QQuickItem *child2 = new TestFocusScope(window.contentItem());
+ QQuickItem *item = new TestItem(child2);
+
+ FocusState focusState;
+ focusState << child << child2 << item;
+ FVERIFY();
+
+ item->setFocus(true);
+ focusState[item].set(true, false);
+ focusState.active(0);
+ FVERIFY();
+
+ item->setParentItem(child);
+ focusState[item].set(true, true);
+ focusState.active(item);
+ FVERIFY();
+ }
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *child = new TestItem(window.contentItem());
+ QQuickItem *child2 = new TestFocusScope(window.contentItem());
+ QQuickItem *item = new TestItem(child2);
+
+ FocusState focusState;
+ focusState << child << child2 << item;
+ FVERIFY();
+
+ child->setFocus(true);
+ item->setFocus(true);
+ focusState[child].set(true, true);
+ focusState[item].set(true, false);
+ focusState.active(child);
+ FVERIFY();
+
+ item->setParentItem(child);
+ focusState[item].set(false, false);
+ FVERIFY();
+ }
+
+ // child has active focus, then its fs parent changes parent to 0, then
+ // child is deleted, then its parent changes again to a valid parent
+ {
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ QQuickItem *item = new TestFocusScope(window.contentItem());
+ QQuickItem *child = new TestItem(item);
+ QQuickItem *child2 = new TestItem;
+
+ FocusState focusState;
+ focusState << item << child;
+ FVERIFY();
+
+ item->setFocus(true);
+ child->setFocus(true);
+ focusState[child].set(true, true);
+ focusState[item].set(true, true);
+ focusState.active(child);
+ FVERIFY();
+
+ item->setParentItem(0);
+ focusState[child].set(true, false);
+ focusState[item].set(true, false);
+ focusState.active(0);
+ FVERIFY();
+
+ focusState.remove(child);
+ delete child;
+ item->setParentItem(window.contentItem());
+ focusState[item].set(true, true);
+ focusState.active(item);
+ FVERIFY();
+ delete child2;
+ }
+}
+
+void tst_qquickitem::multipleFocusClears()
+{
+ //Multiple clears of focus inside a focus scope shouldn't crash. QTBUG-24714
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("multipleFocusClears.qml"));
+ view->show();
+ ensureFocus(view);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == view);
+}
+
+void tst_qquickitem::focusSubItemInNonFocusScope()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("focusSubItemInNonFocusScope.qml"));
+ view->show();
+ QTest::qWaitForWindowActive(view);
+
+ QQuickItem *dummyItem = view->rootObject()->findChild<QQuickItem *>("dummyItem");
+ QVERIFY(dummyItem);
+
+ QQuickItem *textInput = view->rootObject()->findChild<QQuickItem *>("textInput");
+ QVERIFY(textInput);
+
+ QVERIFY(dummyItem->hasFocus());
+ QVERIFY(!textInput->hasFocus());
+ QVERIFY(dummyItem->hasActiveFocus());
+
+ QVERIFY(QMetaObject::invokeMethod(textInput, "forceActiveFocus"));
+
+ QVERIFY(!dummyItem->hasFocus());
+ QVERIFY(textInput->hasFocus());
+ QVERIFY(textInput->hasActiveFocus());
+
+ delete view;
+}
+
+void tst_qquickitem::parentItemWithFocus()
+{
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+ {
+ QQuickItem parent;
+ QQuickItem child;
+
+ FocusState focusState;
+ focusState << &parent << &child;
+ FVERIFY();
+
+ parent.setFocus(true);
+ child.setFocus(true);
+ focusState[&parent].set(true, false);
+ focusState[&child].set(true, false);
+ FVERIFY();
+
+ child.setParentItem(&parent);
+ focusState[&parent].set(true, false);
+ focusState[&child].set(false, false);
+ FVERIFY();
+
+ parent.setParentItem(window.contentItem());
+ focusState[&parent].set(true, true);
+ focusState[&child].set(false, false);
+ focusState.active(&parent);
+ FVERIFY();
+
+ child.forceActiveFocus();
+ focusState[&parent].set(false, false);
+ focusState[&child].set(true, true);
+ focusState.active(&child);
+ FVERIFY();
+ } {
+ QQuickItem parent;
+ QQuickItem child;
+ QQuickItem grandchild(&child);
+
+ FocusState focusState;
+ focusState << &parent << &child << &grandchild;
+ FVERIFY();
+
+ parent.setFocus(true);
+ grandchild.setFocus(true);
+ focusState[&parent].set(true, false);
+ focusState[&child].set(false, false);
+ focusState[&grandchild].set(true, false);
+ FVERIFY();
+
+ child.setParentItem(&parent);
+ focusState[&parent].set(true, false);
+ focusState[&child].set(false, false);
+ focusState[&grandchild].set(false, false);
+ FVERIFY();
+
+ parent.setParentItem(window.contentItem());
+ focusState[&parent].set(true, true);
+ focusState[&child].set(false, false);
+ focusState[&grandchild].set(false, false);
+ focusState.active(&parent);
+ FVERIFY();
+
+ grandchild.forceActiveFocus();
+ focusState[&parent].set(false, false);
+ focusState[&child].set(false, false);
+ focusState[&grandchild].set(true, true);
+ focusState.active(&grandchild);
+ FVERIFY();
+ }
+
+ {
+ QQuickItem parent;
+ QQuickItem child1;
+ QQuickItem child2;
+
+ FocusState focusState;
+ focusState << &parent << &child1 << &child2;
+ parent.setFocus(true);
+ child1.setParentItem(&parent);
+ child2.setParentItem(&parent);
+ focusState[&parent].set(true, false);
+ focusState[&child1].set(false, false);
+ focusState[&child2].set(false, false);
+ FVERIFY();
+
+ child1.setFocus(true);
+ focusState[&parent].set(false, false);
+ focusState[&child1].set(true, false);
+ FVERIFY();
+
+ parent.setFocus(true);
+ focusState[&parent].set(true, false);
+ focusState[&child1].set(false, false);
+ FVERIFY();
+ }
+}
+
+void tst_qquickitem::reparentFocusedItem()
+{
+ QQuickWindow window;
+ ensureFocus(&window);
+ QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
+
+ QQuickItem parent(window.contentItem());
+ QQuickItem child(&parent);
+ QQuickItem sibling(&parent);
+ QQuickItem grandchild(&child);
+
+ FocusState focusState;
+ focusState << &parent << &child << &sibling << &grandchild;
+ FVERIFY();
+
+ grandchild.setFocus(true);
+ focusState[&parent].set(false, false);
+ focusState[&child].set(false, false);
+ focusState[&sibling].set(false, false);
+ focusState[&grandchild].set(true, true);
+ focusState.active(&grandchild);
+ FVERIFY();
+
+ // Parenting the item to another item within the same focus scope shouldn't change it's focus.
+ child.setParentItem(&sibling);
+ FVERIFY();
+}
+
+void tst_qquickitem::constructor()
+{
+ QQuickItem *root = new QQuickItem;
+ QVERIFY(root->parent() == 0);
+ QVERIFY(root->parentItem() == 0);
+
+ QQuickItem *child1 = new QQuickItem(root);
+ QVERIFY(child1->parent() == root);
+ QVERIFY(child1->parentItem() == root);
+ QCOMPARE(root->childItems().count(), 1);
+ QCOMPARE(root->childItems().at(0), child1);
+
+ QQuickItem *child2 = new QQuickItem(root);
+ QVERIFY(child2->parent() == root);
+ QVERIFY(child2->parentItem() == root);
+ QCOMPARE(root->childItems().count(), 2);
+ QCOMPARE(root->childItems().at(0), child1);
+ QCOMPARE(root->childItems().at(1), child2);
+
+ delete root;
+}
+
+void tst_qquickitem::setParentItem()
+{
+ QQuickItem *root = new QQuickItem;
+ QVERIFY(root->parent() == 0);
+ QVERIFY(root->parentItem() == 0);
+
+ QQuickItem *child1 = new QQuickItem;
+ QVERIFY(child1->parent() == 0);
+ QVERIFY(child1->parentItem() == 0);
+
+ child1->setParentItem(root);
+ QVERIFY(child1->parent() == 0);
+ QVERIFY(child1->parentItem() == root);
+ QCOMPARE(root->childItems().count(), 1);
+ QCOMPARE(root->childItems().at(0), child1);
+
+ QQuickItem *child2 = new QQuickItem;
+ QVERIFY(child2->parent() == 0);
+ QVERIFY(child2->parentItem() == 0);
+ child2->setParentItem(root);
+ QVERIFY(child2->parent() == 0);
+ QVERIFY(child2->parentItem() == root);
+ QCOMPARE(root->childItems().count(), 2);
+ QCOMPARE(root->childItems().at(0), child1);
+ QCOMPARE(root->childItems().at(1), child2);
+
+ child1->setParentItem(0);
+ QVERIFY(child1->parent() == 0);
+ QVERIFY(child1->parentItem() == 0);
+ QCOMPARE(root->childItems().count(), 1);
+ QCOMPARE(root->childItems().at(0), child2);
+
+ delete root;
+
+ QVERIFY(child1->parent() == 0);
+ QVERIFY(child1->parentItem() == 0);
+ QVERIFY(child2->parent() == 0);
+ QVERIFY(child2->parentItem() == 0);
+
+ delete child1;
+ delete child2;
+}
+
+void tst_qquickitem::visible()
+{
+ QQuickItem *root = new QQuickItem;
+
+ QQuickItem *child1 = new QQuickItem;
+ child1->setParentItem(root);
+
+ QQuickItem *child2 = new QQuickItem;
+ child2->setParentItem(root);
+
+ QVERIFY(child1->isVisible());
+ QVERIFY(child2->isVisible());
+
+ root->setVisible(false);
+ QVERIFY(!child1->isVisible());
+ QVERIFY(!child2->isVisible());
+
+ root->setVisible(true);
+ QVERIFY(child1->isVisible());
+ QVERIFY(child2->isVisible());
+
+ child1->setVisible(false);
+ QVERIFY(!child1->isVisible());
+ QVERIFY(child2->isVisible());
+
+ child2->setParentItem(child1);
+ QVERIFY(!child1->isVisible());
+ QVERIFY(!child2->isVisible());
+
+ child2->setParentItem(root);
+ QVERIFY(!child1->isVisible());
+ QVERIFY(child2->isVisible());
+
+ delete root;
+ delete child1;
+ delete child2;
+}
+
+void tst_qquickitem::enabled()
+{
+ QQuickItem *root = new QQuickItem;
+
+ QQuickItem *child1 = new QQuickItem;
+ child1->setParentItem(root);
+
+ QQuickItem *child2 = new QQuickItem;
+ child2->setParentItem(root);
+
+ QVERIFY(child1->isEnabled());
+ QVERIFY(child2->isEnabled());
+
+ root->setEnabled(false);
+ QVERIFY(!child1->isEnabled());
+ QVERIFY(!child2->isEnabled());
+
+ root->setEnabled(true);
+ QVERIFY(child1->isEnabled());
+ QVERIFY(child2->isEnabled());
+
+ child1->setEnabled(false);
+ QVERIFY(!child1->isEnabled());
+ QVERIFY(child2->isEnabled());
+
+ child2->setParentItem(child1);
+ QVERIFY(!child1->isEnabled());
+ QVERIFY(!child2->isEnabled());
+
+ child2->setParentItem(root);
+ QVERIFY(!child1->isEnabled());
+ QVERIFY(child2->isEnabled());
+
+ delete root;
+ delete child1;
+ delete child2;
+}
+
+void tst_qquickitem::enabledFocus()
+{
+ QQuickWindow window;
+ ensureFocus(&window);
+
+ QQuickFocusScope root;
+
+ root.setFocus(true);
+ root.setEnabled(false);
+
+ QCOMPARE(root.isEnabled(), false);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), false);
+
+ root.setParentItem(window.contentItem());
+
+ QCOMPARE(root.isEnabled(), false);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), window.contentItem());
+
+ root.setEnabled(true);
+ QCOMPARE(root.isEnabled(), true);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), true);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&root));
+
+ QQuickItem child1;
+ child1.setParentItem(&root);
+
+ QCOMPARE(child1.isEnabled(), true);
+ QCOMPARE(child1.hasFocus(), false);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&root));
+
+ QQuickItem child2;
+ child2.setFocus(true);
+ child2.setParentItem(&root);
+
+ QCOMPARE(root.isEnabled(), true);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), true);
+ QCOMPARE(child2.isEnabled(), true);
+ QCOMPARE(child2.hasFocus(), true);
+ QCOMPARE(child2.hasActiveFocus(), true);
+ QCOMPARE(window.activeFocusItem(), &child2);
+
+ child2.setEnabled(false);
+
+ QCOMPARE(root.isEnabled(), true);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), true);
+ QCOMPARE(child1.isEnabled(), true);
+ QCOMPARE(child1.hasFocus(), false);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), true);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&root));
+
+ child1.setEnabled(false);
+ QCOMPARE(child1.isEnabled(), false);
+ QCOMPARE(child1.hasFocus(), false);
+ QCOMPARE(child1.hasActiveFocus(), false);
+
+ child1.setFocus(true);
+ QCOMPARE(child1.isEnabled(), false);
+ QCOMPARE(child1.hasFocus(), true);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), false);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&root));
+
+ child1.setEnabled(true);
+ QCOMPARE(child1.isEnabled(), true);
+ QCOMPARE(child1.hasFocus(), true);
+ QCOMPARE(child1.hasActiveFocus(), true);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&child1));
+
+ root.setFocus(false);
+ QCOMPARE(root.isEnabled(), true);
+ QCOMPARE(root.hasFocus(), false);
+ QCOMPARE(root.hasActiveFocus(), false);
+ QCOMPARE(child1.isEnabled(), true);
+ QCOMPARE(child1.hasFocus(), true);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), window.contentItem());
+
+ child2.forceActiveFocus();
+ QCOMPARE(root.isEnabled(), true);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), true);
+ QCOMPARE(child1.isEnabled(), true);
+ QCOMPARE(child1.hasFocus(), false);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), true);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&root));
+
+ root.setEnabled(false);
+ QCOMPARE(root.isEnabled(), false);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), false);
+ QCOMPARE(child1.isEnabled(), false);
+ QCOMPARE(child1.hasFocus(), false);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), true);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), window.contentItem());
+
+ child1.forceActiveFocus();
+ QCOMPARE(root.isEnabled(), false);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), false);
+ QCOMPARE(child1.isEnabled(), false);
+ QCOMPARE(child1.hasFocus(), true);
+ QCOMPARE(child1.hasActiveFocus(), false);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), false);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), window.contentItem());
+
+ root.setEnabled(true);
+ QCOMPARE(root.isEnabled(), true);
+ QCOMPARE(root.hasFocus(), true);
+ QCOMPARE(root.hasActiveFocus(), true);
+ QCOMPARE(child1.isEnabled(), true);
+ QCOMPARE(child1.hasFocus(), true);
+ QCOMPARE(child1.hasActiveFocus(), true);
+ QCOMPARE(child2.isEnabled(), false);
+ QCOMPARE(child2.hasFocus(), false);
+ QCOMPARE(child2.hasActiveFocus(), false);
+ QCOMPARE(window.activeFocusItem(), static_cast<QQuickItem *>(&child1));
+}
+
+void tst_qquickitem::mouseGrab()
+{
+ QQuickWindow *window = new QQuickWindow;
+ window->resize(200, 200);
+ window->show();
+
+ TestItem *child1 = new TestItem;
+ child1->setAcceptedMouseButtons(Qt::LeftButton);
+ child1->setSize(QSizeF(200, 100));
+ child1->setParentItem(window->contentItem());
+
+ TestItem *child2 = new TestItem;
+ child2->setAcceptedMouseButtons(Qt::LeftButton);
+ child2->setY(51);
+ child2->setSize(QSizeF(200, 100));
+ child2->setParentItem(window->contentItem());
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(100);
+ QVERIFY(window->mouseGrabberItem() == child1);
+ QTest::qWait(100);
+
+ QCOMPARE(child1->pressCount, 1);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QVERIFY(window->mouseGrabberItem() == 0);
+ QCOMPARE(child1->releaseCount, 1);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QVERIFY(window->mouseGrabberItem() == child1);
+ QCOMPARE(child1->pressCount, 2);
+ child1->setEnabled(false);
+ QVERIFY(window->mouseGrabberItem() == 0);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QCOMPARE(child1->releaseCount, 1);
+ child1->setEnabled(true);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QVERIFY(window->mouseGrabberItem() == child1);
+ QCOMPARE(child1->pressCount, 3);
+ child1->setVisible(false);
+ QVERIFY(window->mouseGrabberItem() == 0);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50,50));
+ QCOMPARE(child1->releaseCount, 1);
+ child1->setVisible(true);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QVERIFY(window->mouseGrabberItem() == child1);
+ QCOMPARE(child1->pressCount, 4);
+ child2->grabMouse();
+ QVERIFY(window->mouseGrabberItem() == child2);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QCOMPARE(child1->releaseCount, 1);
+ QCOMPARE(child2->releaseCount, 1);
+
+ child2->grabMouse();
+ QVERIFY(window->mouseGrabberItem() == child2);
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QCOMPARE(child1->pressCount, 4);
+ QCOMPARE(child2->pressCount, 1);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50,50));
+ QTest::qWait(50);
+ QCOMPARE(child1->releaseCount, 1);
+ QCOMPARE(child2->releaseCount, 2);
+
+ delete child1;
+ delete child2;
+ delete window;
+}
+
+void tst_qquickitem::touchEventAcceptIgnore_data()
+{
+ QTest::addColumn<bool>("itemSupportsTouch");
+
+ QTest::newRow("with touch") << true;
+ QTest::newRow("without touch") << false;
+}
+
+void tst_qquickitem::touchEventAcceptIgnore()
+{
+ QFETCH(bool, itemSupportsTouch);
+
+ TestWindow *window = new TestWindow;
+ window->resize(100, 100);
+ window->show();
+
+ TestItem *item = new TestItem;
+ item->setSize(QSizeF(100, 100));
+ item->setParentItem(window->contentItem());
+ item->acceptIncomingTouchEvents = itemSupportsTouch;
+
+ static QTouchDevice* device = 0;
+ if (!device) {
+ device =new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+ }
+
+ // Send Begin, Update & End touch sequence
+ {
+ QTouchEvent::TouchPoint point;
+ point.setId(1);
+ point.setPos(QPointF(50, 50));
+ point.setScreenPos(point.pos());
+ point.setState(Qt::TouchPointPressed);
+
+ QTouchEvent event(QEvent::TouchBegin, device,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ QList<QTouchEvent::TouchPoint>() << point);
+ event.setAccepted(true);
+
+ item->touchEventReached = false;
+
+ bool accepted = window->event(&event);
+
+ QVERIFY(item->touchEventReached);
+ QCOMPARE(accepted && event.isAccepted(), itemSupportsTouch);
+ }
+ {
+ QTouchEvent::TouchPoint point;
+ point.setId(1);
+ point.setPos(QPointF(60, 60));
+ point.setScreenPos(point.pos());
+ point.setState(Qt::TouchPointMoved);
+
+ QTouchEvent event(QEvent::TouchUpdate, device,
+ Qt::NoModifier,
+ Qt::TouchPointMoved,
+ QList<QTouchEvent::TouchPoint>() << point);
+ event.setAccepted(true);
+
+ item->touchEventReached = false;
+
+ bool accepted = window->event(&event);
+
+ QCOMPARE(item->touchEventReached, itemSupportsTouch);
+ QCOMPARE(accepted && event.isAccepted(), itemSupportsTouch);
+ }
+ {
+ QTouchEvent::TouchPoint point;
+ point.setId(1);
+ point.setPos(QPointF(60, 60));
+ point.setScreenPos(point.pos());
+ point.setState(Qt::TouchPointReleased);
+
+ QTouchEvent event(QEvent::TouchEnd, device,
+ Qt::NoModifier,
+ Qt::TouchPointReleased,
+ QList<QTouchEvent::TouchPoint>() << point);
+ event.setAccepted(true);
+
+ item->touchEventReached = false;
+
+ bool accepted = window->event(&event);
+
+ QCOMPARE(item->touchEventReached, itemSupportsTouch);
+ QCOMPARE(accepted && event.isAccepted(), itemSupportsTouch);
+ }
+
+ delete item;
+ delete window;
+}
+
+void tst_qquickitem::polishOutsideAnimation()
+{
+ QQuickWindow *window = new QQuickWindow;
+ window->resize(200, 200);
+ window->show();
+
+ TestPolishItem *item = new TestPolishItem(window->contentItem());
+ item->setSize(QSizeF(200, 100));
+ QTest::qWait(50);
+
+ QTimer::singleShot(10, item, SLOT(doPolish()));
+ QTRY_VERIFY(item->wasPolished);
+
+ delete item;
+ delete window;
+}
+
+void tst_qquickitem::polishOnCompleted()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("polishOnCompleted.qml"));
+ view->show();
+
+ TestPolishItem *item = qobject_cast<TestPolishItem*>(view->rootObject());
+ QVERIFY(item);
+
+ QTRY_VERIFY(item->wasPolished);
+
+ delete view;
+}
+
+void tst_qquickitem::wheelEvent_data()
+{
+ QTest::addColumn<bool>("visible");
+ QTest::addColumn<bool>("enabled");
+
+ QTest::newRow("visible and enabled") << true << true;
+ QTest::newRow("visible and disabled") << true << false;
+ QTest::newRow("invisible and enabled") << false << true;
+ QTest::newRow("invisible and disabled") << false << false;
+}
+
+void tst_qquickitem::wheelEvent()
+{
+ QFETCH(bool, visible);
+ QFETCH(bool, enabled);
+
+ const bool shouldReceiveWheelEvents = visible && enabled;
+
+ QQuickWindow *window = new QQuickWindow;
+ window->resize(200, 200);
+ window->show();
+
+ TestItem *item = new TestItem;
+ item->setSize(QSizeF(200, 100));
+ item->setParentItem(window->contentItem());
+
+ item->setEnabled(enabled);
+ item->setVisible(visible);
+
+ QWheelEvent event(QPoint(100, 50), -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ event.setAccepted(false);
+ QGuiApplication::sendEvent(window, &event);
+
+ if (shouldReceiveWheelEvents) {
+ QVERIFY(event.isAccepted());
+ QCOMPARE(item->wheelCount, 1);
+ } else {
+ QVERIFY(!event.isAccepted());
+ QCOMPARE(item->wheelCount, 0);
+ }
+
+ delete window;
+}
+
+class HoverItem : public QQuickItem
+{
+Q_OBJECT
+public:
+ HoverItem(QQuickItem *parent = 0)
+ : QQuickItem(parent), hoverEnterCount(0), hoverMoveCount(0), hoverLeaveCount(0)
+ { }
+ void resetCounters() {
+ hoverEnterCount = 0;
+ hoverMoveCount = 0;
+ hoverLeaveCount = 0;
+ }
+ int hoverEnterCount;
+ int hoverMoveCount;
+ int hoverLeaveCount;
+protected:
+ virtual void hoverEnterEvent(QHoverEvent *event) {
+ event->accept();
+ ++hoverEnterCount;
+ }
+ virtual void hoverMoveEvent(QHoverEvent *event) {
+ event->accept();
+ ++hoverMoveCount;
+ }
+ virtual void hoverLeaveEvent(QHoverEvent *event) {
+ event->accept();
+ ++hoverLeaveCount;
+ }
+};
+
+void tst_qquickitem::hoverEvent_data()
+{
+ QTest::addColumn<bool>("visible");
+ QTest::addColumn<bool>("enabled");
+ QTest::addColumn<bool>("acceptHoverEvents");
+
+ QTest::newRow("visible, enabled, accept hover") << true << true << true;
+ QTest::newRow("visible, disabled, accept hover") << true << false << true;
+ QTest::newRow("invisible, enabled, accept hover") << false << true << true;
+ QTest::newRow("invisible, disabled, accept hover") << false << false << true;
+
+ QTest::newRow("visible, enabled, not accept hover") << true << true << false;
+ QTest::newRow("visible, disabled, not accept hover") << true << false << false;
+ QTest::newRow("invisible, enabled, not accept hover") << false << true << false;
+ QTest::newRow("invisible, disabled, not accept hover") << false << false << false;
+}
+
+// ### For some unknown reason QTest::mouseMove() isn't working correctly.
+static void sendMouseMove(QObject *object, const QPoint &position)
+{
+ QMouseEvent moveEvent(QEvent::MouseMove, position, Qt::NoButton, Qt::NoButton, 0);
+ QGuiApplication::sendEvent(object, &moveEvent);
+}
+
+void tst_qquickitem::hoverEvent()
+{
+ QFETCH(bool, visible);
+ QFETCH(bool, enabled);
+ QFETCH(bool, acceptHoverEvents);
+
+ QQuickWindow *window = new QQuickWindow();
+ window->resize(200, 200);
+ window->show();
+
+ HoverItem *item = new HoverItem;
+ item->setSize(QSizeF(100, 100));
+ item->setParentItem(window->contentItem());
+
+ item->setEnabled(enabled);
+ item->setVisible(visible);
+ item->setAcceptHoverEvents(acceptHoverEvents);
+
+ const QPoint outside(150, 150);
+ const QPoint inside(50, 50);
+ const QPoint anotherInside(51, 51);
+
+ sendMouseMove(window, outside);
+ item->resetCounters();
+
+ // Enter, then move twice inside, then leave.
+ sendMouseMove(window, inside);
+ sendMouseMove(window, anotherInside);
+ sendMouseMove(window, inside);
+ sendMouseMove(window, outside);
+
+ const bool shouldReceiveHoverEvents = visible && enabled && acceptHoverEvents;
+ if (shouldReceiveHoverEvents) {
+ QCOMPARE(item->hoverEnterCount, 1);
+ QCOMPARE(item->hoverMoveCount, 2);
+ QCOMPARE(item->hoverLeaveCount, 1);
+ } else {
+ QCOMPARE(item->hoverEnterCount, 0);
+ QCOMPARE(item->hoverMoveCount, 0);
+ QCOMPARE(item->hoverLeaveCount, 0);
+ }
+
+ delete window;
+}
+
+void tst_qquickitem::hoverEventInParent()
+{
+ QQuickWindow *window = new QQuickWindow();
+ window->resize(200, 200);
+ window->show();
+
+ HoverItem *parentItem = new HoverItem(window->contentItem());
+ parentItem->setSize(QSizeF(200, 200));
+ parentItem->setAcceptHoverEvents(true);
+
+ HoverItem *leftItem = new HoverItem(parentItem);
+ leftItem->setSize(QSizeF(100, 200));
+ leftItem->setAcceptHoverEvents(true);
+
+ HoverItem *rightItem = new HoverItem(parentItem);
+ rightItem->setSize(QSizeF(100, 200));
+ rightItem->setPosition(QPointF(100, 0));
+ rightItem->setAcceptHoverEvents(true);
+
+ const QPoint insideLeft(50, 100);
+ const QPoint insideRight(150, 100);
+
+ sendMouseMove(window, insideLeft);
+ parentItem->resetCounters();
+ leftItem->resetCounters();
+ rightItem->resetCounters();
+
+ sendMouseMove(window, insideRight);
+ QCOMPARE(parentItem->hoverEnterCount, 0);
+ QCOMPARE(parentItem->hoverLeaveCount, 0);
+ QCOMPARE(leftItem->hoverEnterCount, 0);
+ QCOMPARE(leftItem->hoverLeaveCount, 1);
+ QCOMPARE(rightItem->hoverEnterCount, 1);
+ QCOMPARE(rightItem->hoverLeaveCount, 0);
+
+ sendMouseMove(window, insideLeft);
+ QCOMPARE(parentItem->hoverEnterCount, 0);
+ QCOMPARE(parentItem->hoverLeaveCount, 0);
+ QCOMPARE(leftItem->hoverEnterCount, 1);
+ QCOMPARE(leftItem->hoverLeaveCount, 1);
+ QCOMPARE(rightItem->hoverEnterCount, 1);
+ QCOMPARE(rightItem->hoverLeaveCount, 1);
+
+ delete window;
+}
+
+void tst_qquickitem::paintOrder_data()
+{
+ const QUrl order1Url = testFileUrl("order.1.qml");
+ const QUrl order2Url = testFileUrl("order.2.qml");
+
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<int>("op");
+ QTest::addColumn<QVariant>("param1");
+ QTest::addColumn<QVariant>("param2");
+ QTest::addColumn<QStringList>("expected");
+
+ QTest::newRow("test 1 noop") << order1Url
+ << int(NoOp) << QVariant() << QVariant()
+ << (QStringList() << "1" << "2" << "3");
+ QTest::newRow("test 1 add") << order1Url
+ << int(Append) << QVariant("new") << QVariant()
+ << (QStringList() << "1" << "2" << "3" << "new");
+ QTest::newRow("test 1 remove") << order1Url
+ << int(Remove) << QVariant(1) << QVariant()
+ << (QStringList() << "1" << "3");
+ QTest::newRow("test 1 stack before") << order1Url
+ << int(StackBefore) << QVariant(2) << QVariant(1)
+ << (QStringList() << "1" << "3" << "2");
+ QTest::newRow("test 1 stack after") << order1Url
+ << int(StackAfter) << QVariant(0) << QVariant(1)
+ << (QStringList() << "2" << "1" << "3");
+ QTest::newRow("test 1 set z") << order1Url
+ << int(SetZ) << QVariant(1) << QVariant(qreal(1.))
+ << (QStringList() << "1" << "3" << "2");
+
+ QTest::newRow("test 2 noop") << order2Url
+ << int(NoOp) << QVariant() << QVariant()
+ << (QStringList() << "1" << "3" << "2");
+ QTest::newRow("test 2 add") << order2Url
+ << int(Append) << QVariant("new") << QVariant()
+ << (QStringList() << "1" << "3" << "new" << "2");
+ QTest::newRow("test 2 remove 1") << order2Url
+ << int(Remove) << QVariant(1) << QVariant()
+ << (QStringList() << "1" << "3");
+ QTest::newRow("test 2 remove 2") << order2Url
+ << int(Remove) << QVariant(2) << QVariant()
+ << (QStringList() << "1" << "2");
+ QTest::newRow("test 2 stack before 1") << order2Url
+ << int(StackBefore) << QVariant(1) << QVariant(0)
+ << (QStringList() << "1" << "3" << "2");
+ QTest::newRow("test 2 stack before 2") << order2Url
+ << int(StackBefore) << QVariant(2) << QVariant(0)
+ << (QStringList() << "3" << "1" << "2");
+ QTest::newRow("test 2 stack after 1") << order2Url
+ << int(StackAfter) << QVariant(0) << QVariant(1)
+ << (QStringList() << "1" << "3" << "2");
+ QTest::newRow("test 2 stack after 2") << order2Url
+ << int(StackAfter) << QVariant(0) << QVariant(2)
+ << (QStringList() << "3" << "1" << "2");
+ QTest::newRow("test 1 set z") << order1Url
+ << int(SetZ) << QVariant(2) << QVariant(qreal(2.))
+ << (QStringList() << "1" << "2" << "3");
+}
+
+void tst_qquickitem::paintOrder()
+{
+ QFETCH(QUrl, source);
+ QFETCH(int, op);
+ QFETCH(QVariant, param1);
+ QFETCH(QVariant, param2);
+ QFETCH(QStringList, expected);
+
+ QQuickView view;
+ view.setSource(source);
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(view.rootObject());
+ QVERIFY(root);
+
+ switch (op) {
+ case Append: {
+ QQuickItem *item = new QQuickItem(root);
+ item->setObjectName(param1.toString());
+ }
+ break;
+ case Remove: {
+ QQuickItem *item = root->childItems().at(param1.toInt());
+ delete item;
+ }
+ break;
+ case StackBefore: {
+ QQuickItem *item1 = root->childItems().at(param1.toInt());
+ QQuickItem *item2 = root->childItems().at(param2.toInt());
+ item1->stackBefore(item2);
+ }
+ break;
+ case StackAfter: {
+ QQuickItem *item1 = root->childItems().at(param1.toInt());
+ QQuickItem *item2 = root->childItems().at(param2.toInt());
+ item1->stackAfter(item2);
+ }
+ break;
+ case SetZ: {
+ QQuickItem *item = root->childItems().at(param1.toInt());
+ item->setZ(param2.toReal());
+ }
+ break;
+ default:
+ break;
+ }
+
+ QList<QQuickItem*> list = QQuickItemPrivate::get(root)->paintOrderChildItems();
+
+ QStringList items;
+ for (int i = 0; i < list.count(); ++i)
+ items << list.at(i)->objectName();
+
+ QCOMPARE(items, expected);
+}
+
+void tst_qquickitem::acceptedMouseButtons()
+{
+ TestItem item;
+ QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::NoButton));
+
+ QQuickWindow window;
+ item.setSize(QSizeF(200,100));
+ item.setParentItem(window.contentItem());
+
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 0);
+ QCOMPARE(item.releaseCount, 0);
+
+ QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 0);
+ QCOMPARE(item.releaseCount, 0);
+
+ QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 0);
+ QCOMPARE(item.releaseCount, 0);
+
+ item.setAcceptedMouseButtons(Qt::LeftButton);
+ QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::LeftButton));
+
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 1);
+ QCOMPARE(item.releaseCount, 1);
+
+ QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 1);
+ QCOMPARE(item.releaseCount, 1);
+
+ QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 1);
+ QCOMPARE(item.releaseCount, 1);
+
+ item.setAcceptedMouseButtons(Qt::RightButton | Qt::MiddleButton);
+ QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::RightButton | Qt::MiddleButton));
+
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 1);
+ QCOMPARE(item.releaseCount, 1);
+
+ QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 2);
+ QCOMPARE(item.releaseCount, 2);
+
+ QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50));
+ QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50));
+ QCOMPARE(item.pressCount, 3);
+ QCOMPARE(item.releaseCount, 3);
+}
+
+
+QTEST_MAIN(tst_qquickitem)
+
+#include "tst_qquickitem.moc"
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml
new file mode 100644
index 0000000000..f8f81e306a
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab.qml
@@ -0,0 +1,136 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 800
+ height: 600
+ focus: true
+ Component.onCompleted: button12.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: parent.left
+ Item {
+ id: button11
+ objectName: "button11"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button12
+ objectName: "button12"
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button11.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button13
+ objectName: "button13"
+ enabled: false
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button14
+ objectName: "button14"
+ visible: false
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: true
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub1.right
+ Item {
+ id: button21
+ objectName: "button21"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button22
+ objectName: "button22"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: button21.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub3
+ objectName: "sub3"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub2.right
+ TextEdit {
+ id: edit
+ objectName: "edit"
+ width: 230
+ height: 400
+ readOnly: false
+ activeFocusOnTab: true
+ wrapMode: TextEdit.Wrap
+ textFormat: TextEdit.RichText
+
+ text: "aaa\n"
+ +"bbb\n"
+ +"ccc\n"
+ +"ddd\n"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml
new file mode 100644
index 0000000000..480c0d4863
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab3.qml
@@ -0,0 +1,250 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 400
+ height: 700
+ focus: true
+ Component.onCompleted: button1.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ activeFocusOnTab: false
+ width: 100
+ height: 50
+ anchors.top: parent.top
+ Item {
+ id: button1
+ objectName: "button1"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ Row {
+ id: row_repeater
+ objectName: "row_repeater"
+ activeFocusOnTab: false
+ anchors.top: sub1.bottom
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: false
+ anchors.top: row_repeater.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button2
+ objectName: "button2"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ Row {
+ id: row
+ objectName: "row"
+ activeFocusOnTab: false
+ anchors.top: sub2.bottom
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "yellow"; width: 50; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "green"; width: 20; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "blue"; width: 50; height: 20 }
+ }
+ Item {
+ id: sub3
+ objectName: "sub3"
+ activeFocusOnTab: false
+ anchors.top: row.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button3
+ objectName: "button3"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ Flow {
+ id: flow
+ objectName: "flow"
+ activeFocusOnTab: false
+ anchors.top: sub3.bottom
+ width: parent.width
+ anchors.margins: 4
+ spacing: 10
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "yellow"; width: 50; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "green"; width: 20; height: 50 }
+ Rectangle { activeFocusOnTab: true; color: activeFocus ? "red" : "blue"; width: 50; height: 20 }
+ }
+ Item {
+ id: sub4
+ objectName: "sub4"
+ activeFocusOnTab: false
+ anchors.top: flow.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button4
+ objectName: "button4"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ FocusScope {
+ id: focusscope
+ objectName: "focusscope"
+ activeFocusOnTab: false
+ anchors.top: sub4.bottom
+ height: 40
+ Row {
+ id: row_focusscope
+ objectName: "row_focusscope"
+ activeFocusOnTab: false
+ anchors.fill: parent
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ }
+ Item {
+ id: sub5
+ objectName: "sub5"
+ activeFocusOnTab: false
+ anchors.top: focusscope.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button5
+ objectName: "button5"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ FocusScope {
+ id: focusscope2
+ objectName: "focusscope2"
+ activeFocusOnTab: true
+ anchors.top: sub5.bottom
+ height: 40
+ Row {
+ id: row_focusscope2
+ objectName: "row_focusscope2"
+ activeFocusOnTab: false
+ anchors.fill: parent
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ focus: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ }
+ Item {
+ id: sub6
+ objectName: "sub6"
+ activeFocusOnTab: false
+ anchors.top: focusscope2.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button6
+ objectName: "button6"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+ FocusScope {
+ id: focusscope3
+ objectName: "focusscope3"
+ activeFocusOnTab: true
+ anchors.top: sub6.bottom
+ height: 40
+ Row {
+ id: row_focusscope3
+ objectName: "row_focusscope3"
+ activeFocusOnTab: false
+ anchors.fill: parent
+ Repeater {
+ activeFocusOnTab: false
+ model: 3
+ Rectangle {
+ activeFocusOnTab: true
+ width: 100; height: 40
+ border.width: 1
+ color: activeFocus ? "red" : "yellow"
+ }
+ }
+ }
+ }
+ Item {
+ id: sub7
+ objectName: "sub7"
+ activeFocusOnTab: false
+ anchors.top: focusscope3.bottom
+ width: 100
+ height: 50
+ Item {
+ id: button7
+ objectName: "button7"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml
new file mode 100644
index 0000000000..0c8586294d
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab4.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 800
+ height: 600
+ focus: true
+ Component.onCompleted: button11.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ width: 230
+ height: 600
+ activeFocusOnTab: false
+ anchors.top: parent.top
+ anchors.left: parent.left
+ Item {
+ id: button11
+ objectName: "button11"
+ width: 100
+ height: 50
+ activeFocusOnTab: false
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: false
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub1.right
+ Item {
+ id: button21
+ objectName: "button21"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/childrenProperty.qml b/tests/auto/quick/qquickitem2/data/childrenProperty.qml
new file mode 100644
index 0000000000..85ddbc1446
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/childrenProperty.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property bool test1: root.children.length == 3
+ property bool test2: root.children[0] == item1
+ property bool test3: root.children[1] == item2
+ property bool test4: root.children[2] == item3
+ property bool test5: root.children[3] == null
+
+ children: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+}
+
diff --git a/tests/auto/quick/qquickitem2/data/childrenRect.qml b/tests/auto/quick/qquickitem2/data/childrenRect.qml
new file mode 100644
index 0000000000..ebc57aefbe
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/childrenRect.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ property int childCount: 0;
+
+ Item {
+ objectName: "testItem"
+ width: childrenRect.width
+ height: childrenRect.height
+
+ Repeater {
+ id: repeater
+ model: childCount
+ delegate: Rectangle {
+ x: index*10
+ y: index*20
+ width: 10
+ height: 20
+
+ color: "red"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/childrenRectBug.qml b/tests/auto/quick/qquickitem2/data/childrenRectBug.qml
new file mode 100644
index 0000000000..86a4f19c5c
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/childrenRectBug.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 200
+
+ Item {
+ objectName: "theItem"
+ anchors.centerIn: parent
+ width: childrenRect.width
+ height: childrenRect.height
+ Rectangle {
+ id: text1
+ anchors.verticalCenter: parent.verticalCenter
+ width: 100; height: 100; color: "green"
+ }
+ Rectangle {
+ anchors.left: text1.right
+ anchors.verticalCenter: parent.verticalCenter
+ width: 100; height: 100; color: "green"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/childrenRectBug2.qml b/tests/auto/quick/qquickitem2/data/childrenRectBug2.qml
new file mode 100644
index 0000000000..6e80ed28af
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/childrenRectBug2.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+
+Rectangle {
+ width:360;
+ height: 200
+
+ Item {
+ objectName: "theItem"
+ anchors.centerIn: parent
+ width: childrenRect.width
+ height: childrenRect.height
+ Rectangle {
+ id: header1
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ width: 100; height: 50
+ color: "green"
+ }
+ Rectangle {
+ id: text1
+ anchors.top: header1.bottom
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 100; height: 50
+ color: "blue"
+ }
+ }
+
+ states: [
+ State {
+ name: "row"
+ AnchorChanges {
+ target: header1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.top: undefined
+ }
+ AnchorChanges {
+ target: text1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.top: undefined
+ anchors.left: header1.right
+ }
+ PropertyChanges {
+ target: text1
+ anchors.leftMargin: 10
+ anchors.topMargin: 0
+ }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickitem2/data/childrenRectBug3.qml b/tests/auto/quick/qquickitem2/data/childrenRectBug3.qml
new file mode 100644
index 0000000000..518e76509e
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/childrenRectBug3.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 300
+
+ Rectangle {
+ height: childrenRect.height
+
+ Repeater {
+ model: 1
+ Rectangle { }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/hollowTestItem.qml b/tests/auto/quick/qquickitem2/data/hollowTestItem.qml
new file mode 100644
index 0000000000..d07d89c4f4
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/hollowTestItem.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+import Test 1.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ x: 100
+ y: 100
+ width: 200
+ height: 200
+ rotation: 45
+
+ Rectangle {
+ scale: 0.5
+ color: "black"
+ anchors.fill: parent
+ radius: hollowItem.circle ? 100 : 0
+
+ Rectangle {
+ color: "white"
+ anchors.centerIn: parent
+ width: hollowItem.holeRadius * 2
+ height: hollowItem.holeRadius * 2
+ radius: hollowItem.circle ? 100 : 0
+ }
+
+ HollowTestItem {
+ id: hollowItem
+ anchors.fill: parent
+ objectName: "hollowItem"
+ holeRadius: 50
+ circle: circleShapeTest
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/implicitsize.qml b/tests/auto/quick/qquickitem2/data/implicitsize.qml
new file mode 100644
index 0000000000..756e230a87
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/implicitsize.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item {
+ implicitWidth: 200
+ implicitHeight: 100
+
+ width: 80
+ height: 60
+
+ function resetSize() {
+ width = undefined
+ height = undefined
+ }
+
+ function changeImplicit() {
+ implicitWidth = 150
+ implicitHeight = 80
+ }
+
+ function increaseImplicit() {
+ implicitWidth = 200
+ implicitHeight = 100
+ }
+
+ function assignImplicitBinding() {
+ width = Qt.binding(function() { return implicitWidth < 175 ? implicitWidth : 175 })
+ height = Qt.binding(function() { return implicitHeight < 90 ? implicitHeight : 90 })
+ }
+
+ function assignUndefinedBinding() {
+ width = Qt.binding(function() { return implicitWidth < 175 ? undefined : 175 })
+ height = Qt.binding(function() { return implicitHeight < 90 ? undefined : 90 })
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/keynavigationtest.qml b/tests/auto/quick/qquickitem2/data/keynavigationtest.qml
new file mode 100644
index 0000000000..aacb621fb0
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/keynavigationtest.qml
@@ -0,0 +1,87 @@
+import QtQuick 2.0
+
+Grid {
+ columns: 2
+ width: 100; height: 100
+ function verify() {
+ if (item1.KeyNavigation.right != item2)
+ return false;
+ if (item1.KeyNavigation.down != item3)
+ return false;
+ if (item1.KeyNavigation.tab != item2)
+ return false;
+ if (item1.KeyNavigation.backtab != item4)
+ return false;
+
+ if (item2.KeyNavigation.left != item1)
+ return false;
+ if (item2.KeyNavigation.down != item4)
+ return false;
+ if (item2.KeyNavigation.tab != item3)
+ return false;
+ if (item2.KeyNavigation.backtab != item1)
+ return false;
+
+ if (item3.KeyNavigation.right != item4)
+ return false;
+ if (item3.KeyNavigation.up != item1)
+ return false;
+ if (item3.KeyNavigation.tab != item4)
+ return false;
+ if (item3.KeyNavigation.backtab != item2)
+ return false;
+
+ if (item4.KeyNavigation.left != item3)
+ return false;
+ if (item4.KeyNavigation.up != item2)
+ return false;
+ if (item4.KeyNavigation.tab != item1)
+ return false;
+ if (item4.KeyNavigation.backtab != item3)
+ return false;
+
+ return true;
+ }
+
+ Rectangle {
+ id: item1
+ objectName: "item1"
+ focus: true
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item2
+ KeyNavigation.down: item3
+ KeyNavigation.tab: item2
+ KeyNavigation.backtab: item4
+ }
+ Rectangle {
+ id: item2
+ objectName: "item2"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item1
+ KeyNavigation.down: item4
+ KeyNavigation.tab: item3
+ KeyNavigation.backtab: item1
+ }
+ Rectangle {
+ id: item3
+ objectName: "item3"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item4
+ KeyNavigation.up: item1
+ KeyNavigation.tab: item4
+ KeyNavigation.backtab: item2
+ }
+ Rectangle {
+ id: item4
+ objectName: "item4"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item3
+ KeyNavigation.up: item2
+ KeyNavigation.tab: item1
+ KeyNavigation.backtab: item3
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/keynavigationtest_implicit.qml b/tests/auto/quick/qquickitem2/data/keynavigationtest_implicit.qml
new file mode 100644
index 0000000000..92d4ae23de
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/keynavigationtest_implicit.qml
@@ -0,0 +1,68 @@
+import QtQuick 2.0
+
+Grid {
+ columns: 2
+ width: 100; height: 100
+ function verify() {
+ if (item1.KeyNavigation.tab != item2)
+ return false;
+ if (item1.KeyNavigation.backtab != item4)
+ return false;
+
+ if (item2.KeyNavigation.left != item1)
+ return false;
+ if (item2.KeyNavigation.down != item4)
+ return false;
+ if (item2.KeyNavigation.tab != item3)
+ return false;
+ if (item2.KeyNavigation.backtab != item1)
+ return false;
+
+ if (item3.KeyNavigation.right != item4)
+ return false;
+ if (item3.KeyNavigation.up != item1)
+ return false;
+ if (item3.KeyNavigation.tab != item4)
+ return false;
+ if (item3.KeyNavigation.backtab != item2)
+ return false;
+
+ return true;
+ }
+
+ Rectangle {
+ id: item1
+ objectName: "item1"
+ focus: true
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.tab: item2
+ KeyNavigation.backtab: item4
+ }
+ Rectangle {
+ id: item2
+ objectName: "item2"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.left: item1
+ KeyNavigation.down: item4
+ KeyNavigation.tab: item3
+ KeyNavigation.backtab: item1
+ }
+ Rectangle {
+ id: item3
+ objectName: "item3"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ KeyNavigation.right: item4
+ KeyNavigation.up: item1
+ KeyNavigation.tab: item4
+ KeyNavigation.backtab: item2
+ }
+ Rectangle {
+ id: item4
+ objectName: "item4"
+ width: 50; height: 50
+ color: focus ? "red" : "lightgray"
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/keysim.qml b/tests/auto/quick/qquickitem2/data/keysim.qml
new file mode 100644
index 0000000000..7da8a47681
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/keysim.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ focus: true
+
+ Keys.forwardTo: [ item2 ]
+
+ TextInput {
+ id: item2
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/keyspriority.qml b/tests/auto/quick/qquickitem2/data/keyspriority.qml
new file mode 100644
index 0000000000..ae51aae776
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/keyspriority.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import Test 1.0
+
+KeyTestItem {
+ focus: true
+ Keys.onPressed: keysTestObject.keyPress(event.key, event.text, event.modifiers)
+ Keys.onReleased: { keysTestObject.keyRelease(event.key, event.text, event.modifiers); event.accepted = true; }
+ Keys.priority: keysTestObject.processLast ? Keys.AfterItem : Keys.BeforeItem
+
+ property int priorityTest: Keys.priority
+}
diff --git a/tests/auto/quick/qquickitem2/data/keystest.qml b/tests/auto/quick/qquickitem2/data/keystest.qml
new file mode 100644
index 0000000000..c968172f4f
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/keystest.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ focus: true
+
+ property bool isEnabled: Keys.enabled
+
+ Keys.onPressed: keysTestObject.keyPress(event.key, event.text, event.modifiers)
+ Keys.onReleased: { keysTestObject.keyRelease(event.key, event.text, event.modifiers); event.accepted = true; }
+ Keys.onReturnPressed: keysTestObject.keyPress(event.key, "Return", event.modifiers)
+ Keys.onDigit0Pressed: keysTestObject.keyPress(event.key, event.text, event.modifiers)
+ Keys.onDigit9Pressed: { event.accepted = false; keysTestObject.keyPress(event.key, event.text, event.modifiers) }
+ Keys.onTabPressed: keysTestObject.keyPress(event.key, "Tab", event.modifiers)
+ Keys.onBacktabPressed: keysTestObject.keyPress(event.key, "Backtab", event.modifiers)
+ Keys.forwardTo: [ item2 ]
+ Keys.enabled: enableKeyHanding
+ Keys.onVolumeUpPressed: keysTestObject.specialKey(event.key, event.text, event.nativeScanCode)
+
+ Item {
+ id: item2
+ visible: forwardeeVisible
+ Keys.onPressed: keysTestObject.forwardedKey(event.key)
+ Keys.onReleased: keysTestObject.forwardedKey(event.key)
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/layoutmirroring.qml b/tests/auto/quick/qquickitem2/data/layoutmirroring.qml
new file mode 100644
index 0000000000..036819740c
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/layoutmirroring.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+Item {
+ property bool childrenInherit: true
+ Item {
+ objectName: "mirrored1"
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: parent.childrenInherit
+ Item {
+ Item {
+ objectName: "notMirrored1"
+ LayoutMirroring.enabled: false
+ Item {
+ objectName: "inheritedMirror1"
+ }
+ }
+ Item {
+ objectName: "inheritedMirror2"
+ }
+ }
+ }
+ Item {
+ objectName: "mirrored2"
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: false
+ Item {
+ objectName: "notMirrored2"
+ }
+ }
+ Item {
+ LayoutMirroring.enabled: true
+ LayoutMirroring.childrenInherit: true
+ Loader {
+ id: loader
+ }
+ }
+ states: State {
+ name: "newContent"
+ PropertyChanges {
+ target: loader
+ sourceComponent: component
+ }
+ }
+ Component {
+ id: component
+ Item {
+ objectName: "notMirrored3"
+ LayoutMirroring.enabled: false
+ Item {
+ objectName: "inheritedMirror3"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinates.qml b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
new file mode 100644
index 0000000000..0c5106e1c9
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/mapCoordinates.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root; objectName: "root"
+ width: 200; height: 200
+
+ Item { id: itemA; objectName: "itemA"; x: 50; y: 50 }
+
+ Item {
+ x: 50; y: 50
+ Item { id: itemB; objectName: "itemB"; x: 100; y: 100 }
+ }
+
+ function mapAToB(x, y) {
+ var pos = itemA.mapToItem(itemB, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function mapAFromB(x, y) {
+ var pos = itemA.mapFromItem(itemB, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function mapAToNull(x, y) {
+ var pos = itemA.mapToItem(null, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function mapAFromNull(x, y) {
+ var pos = itemA.mapFromItem(null, x, y)
+ return Qt.point(pos.x, pos.y)
+ }
+
+ function checkMapAToInvalid(x, y) {
+ var pos = itemA.mapToItem(1122, x, y)
+ return pos == undefined;
+ }
+
+ function checkMapAFromInvalid(x, y) {
+ var pos = itemA.mapFromItem(1122, x, y)
+ return pos == undefined;
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml
new file mode 100644
index 0000000000..c490130058
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/mapCoordinatesRect.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root; objectName: "root"
+ width: 200; height: 200
+
+ Item { id: itemA; objectName: "itemA"; x: 50; y: 50; width: 25; height: 70 }
+
+ Item {
+ x: 50; y: 50
+ rotation: 45
+ Item { id: itemB; objectName: "itemB"; x: 100; y: 100; width: 30; height: 45 }
+ }
+
+ function mapAToB(x, y, w, h) {
+ var pos = itemA.mapToItem(itemB, x, y, w, h)
+ return Qt.rect(pos.x, pos.y, pos.width, pos.height)
+ }
+
+ function mapAFromB(x, y, w, h) {
+ var pos = itemA.mapFromItem(itemB, x, y, w, h)
+ return Qt.rect(pos.x, pos.y, pos.width, pos.height)
+ }
+
+ function mapAToNull(x, y, w, h) {
+ var pos = itemA.mapToItem(null, x, y, w, h)
+ return Qt.rect(pos.x, pos.y, pos.width, pos.height)
+ }
+
+ function mapAFromNull(x, y, w, h) {
+ var pos = itemA.mapFromItem(null, x, y, w, h)
+ return Qt.rect(pos.x, pos.y, pos.width, pos.height)
+ }
+
+ function checkMapAToInvalid(x, y, w, h) {
+ var pos = itemA.mapToItem(1122, x, y, w, h)
+ return pos == undefined;
+ }
+
+ function checkMapAFromInvalid(x, y, w, h) {
+ var pos = itemA.mapFromItem(1122, x, y, w, h)
+ return pos == undefined;
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/parentLoop.qml b/tests/auto/quick/qquickitem2/data/parentLoop.qml
new file mode 100644
index 0000000000..7b6560fbf7
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/parentLoop.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ Item {
+ id: item1
+ objectName: "item1"
+
+ Item {
+ id: item2
+ objectName: "item2"
+ }
+ }
+ Component.onCompleted: item1.parent = item2
+}
diff --git a/tests/auto/quick/qquickitem2/data/propertychanges.qml b/tests/auto/quick/qquickitem2/data/propertychanges.qml
new file mode 100644
index 0000000000..3fa5ea9c23
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/propertychanges.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ Item {
+ objectName: "item"
+ }
+ Item {
+ objectName: "parentItem"
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/qtbug_16871.qml b/tests/auto/quick/qquickitem2/data/qtbug_16871.qml
new file mode 100644
index 0000000000..f1e7377730
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/qtbug_16871.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ children: [ 10 ]
+}
diff --git a/tests/auto/quick/qquickitem2/data/resourcesProperty.qml b/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
new file mode 100644
index 0000000000..b8f18bb375
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property bool test1
+ property bool test2
+ property bool test3
+ property bool test4
+ property bool test5
+
+ Component.onCompleted: {
+ test1 = (root.resources.length >= 3)
+ test2 = root.resources[0] == item1
+ test3 = root.resources[1] == item2
+ test4 = root.resources[2] == item3
+ test5 = root.resources[10] == null
+ }
+
+ resources: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+}
diff --git a/tests/auto/quick/qquickitem2/data/transformCrash.qml b/tests/auto/quick/qquickitem2/data/transformCrash.qml
new file mode 100644
index 0000000000..284e85f0e0
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/transformCrash.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ id: wrapper
+ width: 200
+ height: 200
+
+ QtObject {
+ id: object
+ }
+
+ Component.onCompleted: wrapper.transform = object
+}
diff --git a/tests/auto/quick/qquickitem2/data/visiblechildren.qml b/tests/auto/quick/qquickitem2/data/visiblechildren.qml
new file mode 100644
index 0000000000..e51eb3551b
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/visiblechildren.qml
@@ -0,0 +1,143 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 400
+ height: 300
+
+ Row {
+ id: row
+ Item { id: item1
+ Item { id: item1_1; visible: true }
+ Item { id: item1_2; visible: true }
+ }
+ Item { id: item2 }
+ Item { id: item3
+ Item { id: item3_1; visible: false }
+ Item { id: item3_2; visible: false }
+ }
+ Item { id: item4; visible: false
+ Item { id: item4_1 // implicitly invisible
+ Item { id: item4_1_1 } // implicitly invisible
+ Item { id: item4_1_2 } // implicitly invisible
+ }
+ }
+ }
+
+ property int row_changeEventCalls: 0
+ property int item1_changeEventCalls: 0
+ property int item2_changeEventCalls: 0
+ property int item3_changeEventCalls: 0
+ property int item4_1_changeEventCalls: 0
+ property int item4_1_1_changeEventCalls: 0
+ Connections { target: row; onVisibleChildrenChanged: row_changeEventCalls++ }
+ Connections { target: item1; onVisibleChildrenChanged: item1_changeEventCalls++ }
+ Connections { target: item2; onVisibleChildrenChanged: item2_changeEventCalls++ }
+ Connections { target: item3; onVisibleChildrenChanged: item3_changeEventCalls++ }
+ Connections { target: item4_1; onVisibleChildrenChanged: item4_1_changeEventCalls++ }
+ Connections { target: item4_1_1; onVisibleChildrenChanged: item4_1_1_changeEventCalls++ }
+
+ // Make sure there are three visible children and no signals fired yet
+ property bool test1_1: row.visibleChildren.length == 3
+ property bool test1_2: row.visibleChildren[0] == item1 && row.visibleChildren[1] == item2 && row.visibleChildren[2] == item3
+ property bool test1_3: row_changeEventCalls == 0
+ property bool test1_4: item1_changeEventCalls == 0 && item2_changeEventCalls == 0 && item3_changeEventCalls == 0
+
+ // Next test
+ function hideFirstAndLastRowChild() {
+ item1.visible = false;
+ item3.visible = false;
+ }
+
+ // Make sure row is signaled twice and item1 only once, and item3 not at all, and that item2 is the visible child
+ property bool test2_1: row.visibleChildren.length == 1
+ property bool test2_2: row.visibleChildren[0] == item2
+ property bool test2_3: row_changeEventCalls == 2
+ property bool test2_4: item1_changeEventCalls == 1 && item2_changeEventCalls == 0 && item3_changeEventCalls == 0
+
+ // Next test
+ function showLastRowChildsLastChild() {
+ item3_2.visible = true;
+ }
+
+ // Make sure item3_changeEventCalls is not signaled
+ property bool test3_1: row.visibleChildren.length == 1
+ property bool test3_2: row.visibleChildren[0] == item2
+ property bool test3_3: row_changeEventCalls == 2
+ property bool test3_4: item1_changeEventCalls == 1 && item2_changeEventCalls == 0 && item3_changeEventCalls == 0
+
+ // Next test
+ function showLastRowChild() {
+ item3.visible = true;
+ }
+
+ // Make sure row and item3 are signaled
+ property bool test4_1: row.visibleChildren.length == 2
+ property bool test4_2: row.visibleChildren[0] == item2 && row.visibleChildren[1] == item3
+ property bool test4_3: row_changeEventCalls == 3
+ property bool test4_4: item1_changeEventCalls == 1 && item2_changeEventCalls == 0 && item3_changeEventCalls == 1
+
+ // Next test
+ function tryWriteToReadonlyVisibleChildren() {
+ var foo = fooComponent.createObject(root);
+ if (Qt.isQtObject(foo) && foo.children.length == 3 && foo.visibleChildren.length == 3) {
+ test5_1 = true;
+ }
+
+ foo.visibleChildren.length = 10; // make sure this has no effect
+ test5_1 = (foo.visibleChildren.length == 3);
+ delete foo;
+ }
+
+ Component {
+ id: fooComponent
+ Item {
+ children: [ Item {},Item {},Item {} ]
+ visibleChildren: [ Item {} ]
+ }
+ }
+
+ // Make sure visibleChildren.length is 3 and stays that way
+ property bool test5_1: false
+
+ // Next test
+ function reparentVisibleItem3() {
+ item3.parent = hiddenItem; // item3 has one visible children
+ }
+
+ Item { id: hiddenItem; visible: false }
+
+ property bool test6_1: row.visibleChildren.length == 1 && row_changeEventCalls == 4
+ property bool test6_2: item3_changeEventCalls == 2
+ property bool test6_3: item3.visible == false
+
+ // Next test
+
+ property bool test6_4: item4_1.visible == false && item4_1_changeEventCalls == 0
+
+ function reparentImlicitlyInvisibleItem4_1() {
+ item4_1.parent = visibleItem;
+ }
+
+ Item { id: visibleItem; visible: true }
+ property int visibleItem_changeEventCalls: 0
+ Connections { target: visibleItem; onVisibleChildrenChanged: visibleItem_changeEventCalls++ }
+
+
+ // Make sure that an item with implictly invisible children will be signaled when reparented to a visible parent
+ property bool test7_1: row.visibleChildren.length == 1 && row_changeEventCalls == 4
+ property bool test7_2: item4_1.visible == true
+ property bool test7_3: item4_1_changeEventCalls == 1
+ property bool test7_4: visibleItem_changeEventCalls == 1
+
+
+
+ // FINALLY make sure nothing has changes while we weren't paying attention
+
+ property bool test8_1: row.visibleChildren.length == 1 && row.visibleChildren[0] == item2 && row_changeEventCalls == 4
+ property bool test8_2: item1_changeEventCalls == 1 && item1.visible == false
+ property bool test8_3: item2_changeEventCalls == 0 && item2.visible == true
+ property bool test8_4: item3_changeEventCalls == 2 && item3.visible == false
+ property bool test8_5: item4_1_1_changeEventCalls == 0 && item4_1_1.visible == true
+
+}
diff --git a/tests/auto/quick/qquickitem2/qquickitem2.pro b/tests/auto/quick/qquickitem2/qquickitem2.pro
new file mode 100644
index 0000000000..62c6ee361c
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/qquickitem2.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qquickitem2
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickitem.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
new file mode 100644
index 0000000000..f2d25e81ed
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -0,0 +1,2135 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQuick/qquickview.h>
+#include <QtGui/private/qinputmethod_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquicktextinput_p.h>
+#include <private/qquickitem_p.h>
+#include "../../shared/util.h"
+#include "../shared/visualtestutil.h"
+#include "../../shared/platforminputcontext.h"
+
+using namespace QQuickVisualTestUtil;
+
+class tst_QQuickItem : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickItem();
+
+private slots:
+ void initTestCase();
+ void cleanup();
+
+ void activeFocusOnTab();
+ void activeFocusOnTab2();
+ void activeFocusOnTab3();
+ void activeFocusOnTab4();
+ void activeFocusOnTab5();
+
+ void keys();
+ void keysProcessingOrder();
+ void keysim();
+ void keyNavigation();
+ void keyNavigation_RightToLeft();
+ void keyNavigation_skipNotVisible();
+ void keyNavigation_implicitSetting();
+ void layoutMirroring();
+ void layoutMirroringIllegalParent();
+ void smooth();
+ void antialiasing();
+ void clip();
+ void mapCoordinates();
+ void mapCoordinates_data();
+ void mapCoordinatesRect();
+ void mapCoordinatesRect_data();
+ void propertyChanges();
+ void transforms();
+ void transforms_data();
+ void childrenRect();
+ void childrenRectBug();
+ void childrenRectBug2();
+ void childrenRectBug3();
+
+ void childrenProperty();
+ void resourcesProperty();
+
+ void transformCrash();
+ void implicitSize();
+ void qtbug_16871();
+ void visibleChildren();
+ void parentLoop();
+ void contains_data();
+ void contains();
+ void childAt();
+
+private:
+ QQmlEngine engine;
+};
+
+class KeysTestObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(bool processLast READ processLast NOTIFY processLastChanged)
+
+public:
+ KeysTestObject() : mKey(0), mModifiers(0), mForwardedKey(0), mLast(false), mNativeScanCode(0) {}
+
+ void reset() {
+ mKey = 0;
+ mText = QString();
+ mModifiers = 0;
+ mForwardedKey = 0;
+ mNativeScanCode = 0;
+ }
+
+ bool processLast() const { return mLast; }
+ void setProcessLast(bool b) {
+ if (b != mLast) {
+ mLast = b;
+ emit processLastChanged();
+ }
+ }
+
+public slots:
+ void keyPress(int key, QString text, int modifiers) {
+ mKey = key;
+ mText = text;
+ mModifiers = modifiers;
+ }
+ void keyRelease(int key, QString text, int modifiers) {
+ mKey = key;
+ mText = text;
+ mModifiers = modifiers;
+ }
+ void forwardedKey(int key) {
+ mForwardedKey = key;
+ }
+ void specialKey(int key, QString text, quint32 nativeScanCode) {
+ mKey = key;
+ mText = text;
+ mNativeScanCode = nativeScanCode;
+ }
+
+signals:
+ void processLastChanged();
+
+public:
+ int mKey;
+ QString mText;
+ int mModifiers;
+ int mForwardedKey;
+ bool mLast;
+ quint32 mNativeScanCode;
+
+private:
+};
+
+class KeyTestItem : public QQuickItem
+{
+ Q_OBJECT
+public:
+ KeyTestItem(QQuickItem *parent=0) : QQuickItem(parent), mKey(0) {}
+
+protected:
+ void keyPressEvent(QKeyEvent *e) {
+ mKey = e->key();
+
+ if (e->key() == Qt::Key_A)
+ e->accept();
+ else
+ e->ignore();
+ }
+
+ void keyReleaseEvent(QKeyEvent *e) {
+ if (e->key() == Qt::Key_B)
+ e->accept();
+ else
+ e->ignore();
+ }
+
+public:
+ int mKey;
+};
+
+QML_DECLARE_TYPE(KeyTestItem);
+
+class HollowTestItem : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(bool circle READ isCircle WRITE setCircle)
+ Q_PROPERTY(qreal holeRadius READ holeRadius WRITE setHoleRadius)
+
+public:
+ HollowTestItem(QQuickItem *parent = 0)
+ : QQuickItem(parent),
+ m_isPressed(false),
+ m_isHovered(false),
+ m_isCircle(false),
+ m_holeRadius(50)
+ {
+ setAcceptHoverEvents(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+ }
+
+ bool isPressed() const { return m_isPressed; }
+ bool isHovered() const { return m_isHovered; }
+
+ bool isCircle() const { return m_isCircle; }
+ void setCircle(bool circle) { m_isCircle = circle; }
+
+ qreal holeRadius() const { return m_holeRadius; }
+ void setHoleRadius(qreal radius) { m_holeRadius = radius; }
+
+ bool contains(const QPointF &point) const {
+ const qreal w = width();
+ const qreal h = height();
+ const qreal r = m_holeRadius;
+
+ // check boundaries
+ if (!QRectF(0, 0, w, h).contains(point))
+ return false;
+
+ // square shape
+ if (!m_isCircle)
+ return !QRectF(w / 2 - r, h / 2 - r, r * 2, r * 2).contains(point);
+
+ // circle shape
+ const qreal dx = point.x() - (w / 2);
+ const qreal dy = point.y() - (h / 2);
+ const qreal dd = (dx * dx) + (dy * dy);
+ const qreal outerRadius = qMin<qreal>(w / 2, h / 2);
+ return dd > (r * r) && dd <= outerRadius * outerRadius;
+ }
+
+protected:
+ void hoverEnterEvent(QHoverEvent *) { m_isHovered = true; }
+ void hoverLeaveEvent(QHoverEvent *) { m_isHovered = false; }
+ void mousePressEvent(QMouseEvent *) { m_isPressed = true; }
+ void mouseReleaseEvent(QMouseEvent *) { m_isPressed = false; }
+
+private:
+ bool m_isPressed;
+ bool m_isHovered;
+ bool m_isCircle;
+ qreal m_holeRadius;
+};
+
+QML_DECLARE_TYPE(HollowTestItem);
+
+
+tst_QQuickItem::tst_QQuickItem()
+{
+}
+
+void tst_QQuickItem::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<KeyTestItem>("Test",1,0,"KeyTestItem");
+ qmlRegisterType<HollowTestItem>("Test", 1, 0, "HollowTestItem");
+}
+
+void tst_QQuickItem::cleanup()
+{
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
+}
+
+void tst_QQuickItem::activeFocusOnTab()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button12
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button12->sub2
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "sub2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: sub2->button21
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button21->button22
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button22");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button22->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: edit->button22
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button22");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button22->button21
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button21->sub2
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "sub2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: sub2->button12
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button12->button11
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button11->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab2()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button12
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button12->button11
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button11->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab3()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab3.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button1
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button1->button2, through a repeater
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button2->button3, through a row
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button3->button4, through a flow
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button4->button5, through a focusscope
+ // parent is activeFocusOnTab:false, one of children is focus:true
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button5");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button5->button6, through a focusscope
+ // parent is activeFocusOnTab:true, one of children is focus:true
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button6");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 5 Tabs: button6->button7, through a focusscope
+ // parent is activeFocusOnTab:true, none of children is focus:true
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 5; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button7");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button7->button6, through a focusscope
+ // parent is activeFocusOnTab:true, one of children got focus:true in previous code
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button6");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 Tabs: button6->button7, through a focusscope
+ // parent is activeFocusOnTab:true, one of children got focus:true in previous code
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);;
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button7");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button7->button6, through a focusscope
+ // parent is activeFocusOnTab:true, one of children got focus:true in previous code
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button6");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button6->button5, through a focusscope(parent is activeFocusOnTab: false)
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button5");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button5->button4, through a focusscope(parent is activeFocusOnTab: false)
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button4->button3, through a flow
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button3->button2, through a row
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // 4 BackTabs: button2->button1, through a repeater
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ for (int i = 0; i < 4; ++i) {
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+ }
+
+ item = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab4()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab4.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button11
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button11");
+ item->setActiveFocusOnTab(true);
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button11->button21
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab5()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab4.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button11 in sub1
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ QQuickItem *item2 = findItem<QQuickItem>(window->rootObject(), "sub1");
+ item2->setActiveFocusOnTab(true);
+
+ // Tab: button11->button21
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::keys()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ KeysTestObject *testObject = new KeysTestObject;
+ window->rootContext()->setContextProperty("keysTestObject", testObject);
+
+ window->rootContext()->setContextProperty("enableKeyHanding", QVariant(true));
+ window->rootContext()->setContextProperty("forwardeeVisible", QVariant(true));
+
+ window->setSource(testFileUrl("keystest.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QVERIFY(window->rootObject());
+ QCOMPARE(window->rootObject()->property("isEnabled").toBool(), true);
+
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mText, QLatin1String("A"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(!key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ShiftModifier, "A", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mText, QLatin1String("A"));
+ QVERIFY(testObject->mModifiers == Qt::ShiftModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_Return));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Return));
+ QCOMPARE(testObject->mText, QLatin1String("Return"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_0, Qt::NoModifier, "0", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_0));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_0));
+ QCOMPARE(testObject->mText, QLatin1String("0"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_9, Qt::NoModifier, "9", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_9));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_9));
+ QCOMPARE(testObject->mText, QLatin1String("9"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(!key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_Tab));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Tab));
+ QCOMPARE(testObject->mText, QLatin1String("Tab"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_Backtab));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Backtab));
+ QCOMPARE(testObject->mText, QLatin1String("Backtab"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_VolumeUp, Qt::NoModifier, 1234, 0, 0);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_VolumeUp));
+ QCOMPARE(testObject->mForwardedKey, int(Qt::Key_VolumeUp));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(testObject->mNativeScanCode == 1234);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ window->rootContext()->setContextProperty("forwardeeVisible", QVariant(false));
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mForwardedKey, 0);
+ QCOMPARE(testObject->mText, QLatin1String("A"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(!key.isAccepted());
+
+ testObject->reset();
+
+ window->rootContext()->setContextProperty("enableKeyHanding", QVariant(false));
+ QCOMPARE(window->rootObject()->property("isEnabled").toBool(), false);
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, 0);
+ QVERIFY(!key.isAccepted());
+
+ window->rootContext()->setContextProperty("enableKeyHanding", QVariant(true));
+ QCOMPARE(window->rootObject()->property("isEnabled").toBool(), true);
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_Return));
+ QVERIFY(key.isAccepted());
+
+ delete window;
+ delete testObject;
+}
+
+void tst_QQuickItem::keysProcessingOrder()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ KeysTestObject *testObject = new KeysTestObject;
+ window->rootContext()->setContextProperty("keysTestObject", testObject);
+
+ window->setSource(testFileUrl("keyspriority.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ KeyTestItem *testItem = qobject_cast<KeyTestItem*>(window->rootObject());
+ QVERIFY(testItem);
+
+ QCOMPARE(testItem->property("priorityTest").toInt(), 0);
+
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_A));
+ QCOMPARE(testObject->mText, QLatin1String("A"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ testObject->setProcessLast(true);
+
+ QCOMPARE(testItem->property("priorityTest").toInt(), 1);
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, 0);
+ QVERIFY(key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_B, Qt::NoModifier, "B", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, int(Qt::Key_B));
+ QCOMPARE(testObject->mText, QLatin1String("B"));
+ QVERIFY(testObject->mModifiers == Qt::NoModifier);
+ QVERIFY(!key.isAccepted());
+
+ testObject->reset();
+
+ key = QKeyEvent(QEvent::KeyRelease, Qt::Key_B, Qt::NoModifier, "B", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QCOMPARE(testObject->mKey, 0);
+ QVERIFY(key.isAccepted());
+
+ delete window;
+ delete testObject;
+}
+
+void tst_QQuickItem::keysim()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ window->setSource(testFileUrl("keysim.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QVERIFY(window->rootObject());
+ QVERIFY(window->rootObject()->hasFocus() && window->rootObject()->hasActiveFocus());
+
+ QQuickTextInput *input = window->rootObject()->findChild<QQuickTextInput*>();
+ QVERIFY(input);
+
+ QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(qGuiApp->focusObject(), &ev);
+
+ QEXPECT_FAIL("", "QTBUG-24280", Continue);
+ QCOMPARE(input->text(), QLatin1String("Hello world!"));
+
+ delete window;
+}
+
+QQuickItemPrivate *childPrivate(QQuickItem *rootItem, const char * itemString)
+{
+ QQuickItem *item = findItem<QQuickItem>(rootItem, QString(QLatin1String(itemString)));
+ QQuickItemPrivate* itemPrivate = QQuickItemPrivate::get(item);
+ return itemPrivate;
+}
+
+QVariant childProperty(QQuickItem *rootItem, const char * itemString, const char * property)
+{
+ QQuickItem *item = findItem<QQuickItem>(rootItem, QString(QLatin1String(itemString)));
+ return item->property(property);
+}
+
+bool anchorsMirrored(QQuickItem *rootItem, const char * itemString)
+{
+ QQuickItem *item = findItem<QQuickItem>(rootItem, QString(QLatin1String(itemString)));
+ QQuickItemPrivate* itemPrivate = QQuickItemPrivate::get(item);
+ return itemPrivate->anchors()->mirrored();
+}
+
+void tst_QQuickItem::layoutMirroring()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("layoutmirroring.qml"));
+ window->show();
+
+ QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootItem);
+ QQuickItemPrivate *rootPrivate = QQuickItemPrivate::get(rootItem);
+ QVERIFY(rootPrivate);
+
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->effectiveLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "mirrored2")->effectiveLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->effectiveLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored2")->effectiveLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->effectiveLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->effectiveLayoutMirror, true);
+
+ QCOMPARE(anchorsMirrored(rootItem, "mirrored1"), true);
+ QCOMPARE(anchorsMirrored(rootItem, "mirrored2"), true);
+ QCOMPARE(anchorsMirrored(rootItem, "notMirrored1"), false);
+ QCOMPARE(anchorsMirrored(rootItem, "notMirrored2"), false);
+ QCOMPARE(anchorsMirrored(rootItem, "inheritedMirror1"), true);
+ QCOMPARE(anchorsMirrored(rootItem, "inheritedMirror2"), true);
+
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "mirrored2")->inheritedLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "notMirrored2")->inheritedLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritedLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, true);
+
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->isMirrorImplicit, false);
+ QCOMPARE(childPrivate(rootItem, "mirrored2")->isMirrorImplicit, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->isMirrorImplicit, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored2")->isMirrorImplicit, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->isMirrorImplicit, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->isMirrorImplicit, true);
+
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritMirrorFromParent, true);
+ QCOMPARE(childPrivate(rootItem, "mirrored2")->inheritMirrorFromParent, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritMirrorFromParent, true);
+ QCOMPARE(childPrivate(rootItem, "notMirrored2")->inheritMirrorFromParent, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritMirrorFromParent, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritMirrorFromParent, true);
+
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritMirrorFromItem, true);
+ QCOMPARE(childPrivate(rootItem, "mirrored2")->inheritMirrorFromItem, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritMirrorFromItem, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored2")->inheritMirrorFromItem, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritMirrorFromItem, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritMirrorFromItem, false);
+
+ // load dynamic content using Loader that needs to inherit mirroring
+ rootItem->setProperty("state", "newContent");
+ QCOMPARE(childPrivate(rootItem, "notMirrored3")->effectiveLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->effectiveLayoutMirror, true);
+
+ QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritedLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->inheritedLayoutMirror, true);
+
+ QCOMPARE(childPrivate(rootItem, "notMirrored3")->isMirrorImplicit, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->isMirrorImplicit, true);
+
+ QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritMirrorFromParent, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->inheritMirrorFromParent, true);
+
+ QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritMirrorFromItem, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritMirrorFromItem, false);
+
+ // disable inheritance
+ rootItem->setProperty("childrenInherit", false);
+
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->effectiveLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->effectiveLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->effectiveLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->effectiveLayoutMirror, false);
+
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritedLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, false);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, false);
+
+ // re-enable inheritance
+ rootItem->setProperty("childrenInherit", true);
+
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->effectiveLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->effectiveLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->effectiveLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->effectiveLayoutMirror, false);
+
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritedLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, true);
+ QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, true);
+
+ //
+ // dynamic parenting
+ //
+ QQuickItem *parentItem1 = new QQuickItem();
+ QQuickItemPrivate::get(parentItem1)->effectiveLayoutMirror = true; // LayoutMirroring.enabled: true
+ QQuickItemPrivate::get(parentItem1)->isMirrorImplicit = false;
+ QQuickItemPrivate::get(parentItem1)->inheritMirrorFromItem = true; // LayoutMirroring.childrenInherit: true
+ QQuickItemPrivate::get(parentItem1)->resolveLayoutMirror();
+
+ // inherit in constructor
+ QQuickItem *childItem1 = new QQuickItem(parentItem1);
+ QCOMPARE(QQuickItemPrivate::get(childItem1)->effectiveLayoutMirror, true);
+ QCOMPARE(QQuickItemPrivate::get(childItem1)->inheritMirrorFromParent, true);
+
+ // inherit through a parent change
+ QQuickItem *childItem2 = new QQuickItem();
+ QCOMPARE(QQuickItemPrivate::get(childItem2)->effectiveLayoutMirror, false);
+ QCOMPARE(QQuickItemPrivate::get(childItem2)->inheritMirrorFromParent, false);
+ childItem2->setParentItem(parentItem1);
+ QCOMPARE(QQuickItemPrivate::get(childItem2)->effectiveLayoutMirror, true);
+ QCOMPARE(QQuickItemPrivate::get(childItem2)->inheritMirrorFromParent, true);
+
+ // stop inherting through a parent change
+ QQuickItem *parentItem2 = new QQuickItem();
+ QQuickItemPrivate::get(parentItem2)->effectiveLayoutMirror = true; // LayoutMirroring.enabled: true
+ QQuickItemPrivate::get(parentItem2)->resolveLayoutMirror();
+ childItem2->setParentItem(parentItem2);
+ QCOMPARE(QQuickItemPrivate::get(childItem2)->effectiveLayoutMirror, false);
+ QCOMPARE(QQuickItemPrivate::get(childItem2)->inheritMirrorFromParent, false);
+
+ delete parentItem1;
+ delete parentItem2;
+}
+
+void tst_QQuickItem::layoutMirroringIllegalParent()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; QtObject { LayoutMirroring.enabled: true; LayoutMirroring.childrenInherit: true }", QUrl::fromLocalFile(""));
+ QTest::ignoreMessage(QtWarningMsg, "file::1:21: QML QtObject: LayoutDirection attached property only works with Items");
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_QQuickItem::keyNavigation()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ window->setSource(testFileUrl("keynavigationtest.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ QVariant result;
+ QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "verify",
+ Q_RETURN_ARG(QVariant, result)));
+ QVERIFY(result.toBool());
+
+ // right
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // down
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // left
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // up
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // tab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // backtab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::keyNavigation_RightToLeft()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ window->setSource(testFileUrl("keynavigationtest.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootItem);
+ QQuickItemPrivate* rootItemPrivate = QQuickItemPrivate::get(rootItem);
+
+ rootItemPrivate->effectiveLayoutMirror = true; // LayoutMirroring.mirror: true
+ rootItemPrivate->isMirrorImplicit = false;
+ rootItemPrivate->inheritMirrorFromItem = true; // LayoutMirroring.inherit: true
+ rootItemPrivate->resolveLayoutMirror();
+
+ QEvent wa(QEvent::WindowActivate);
+ QGuiApplication::sendEvent(window, &wa);
+ QFocusEvent fe(QEvent::FocusIn);
+ QGuiApplication::sendEvent(window, &fe);
+
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ QVariant result;
+ QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "verify",
+ Q_RETURN_ARG(QVariant, result)));
+ QVERIFY(result.toBool());
+
+ // right
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // left
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::keyNavigation_skipNotVisible()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ window->setSource(testFileUrl("keynavigationtest.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Set item 2 to not visible
+ item = findItem<QQuickItem>(window->rootObject(), "item2");
+ QVERIFY(item);
+ item->setVisible(false);
+ QVERIFY(!item->isVisible());
+
+ // right
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // tab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // backtab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ //Set item 3 to not visible
+ item = findItem<QQuickItem>(window->rootObject(), "item3");
+ QVERIFY(item);
+ item->setVisible(false);
+ QVERIFY(!item->isVisible());
+
+ // tab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // backtab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::keyNavigation_implicitSetting()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ window->setSource(testFileUrl("keynavigationtest_implicit.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QEvent wa(QEvent::WindowActivate);
+ QGuiApplication::sendEvent(window, &wa);
+ QFocusEvent fe(QEvent::FocusIn);
+ QGuiApplication::sendEvent(window, &fe);
+
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ QVariant result;
+ QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "verify",
+ Q_RETURN_ARG(QVariant, result)));
+ QVERIFY(result.toBool());
+
+ // right
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // back to item1
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // down
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // move to item4
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // left
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // back to item4
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // up
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item2");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // back to item4
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // tab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item1");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // back to item4
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item4");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // backtab
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "item3");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::smooth()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Item { smooth: false; }", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QSignalSpy spy(item, SIGNAL(smoothChanged(bool)));
+
+ QVERIFY(item);
+ QVERIFY(!item->smooth());
+
+ item->setSmooth(true);
+ QVERIFY(item->smooth());
+ QCOMPARE(spy.count(),1);
+ QList<QVariant> arguments = spy.first();
+ QVERIFY(arguments.count() == 1);
+ QVERIFY(arguments.at(0).toBool() == true);
+
+ item->setSmooth(true);
+ QCOMPARE(spy.count(),1);
+
+ item->setSmooth(false);
+ QVERIFY(!item->smooth());
+ QCOMPARE(spy.count(),2);
+ item->setSmooth(false);
+ QCOMPARE(spy.count(),2);
+
+ delete item;
+}
+
+void tst_QQuickItem::antialiasing()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; Item { antialiasing: false; }", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QSignalSpy spy(item, SIGNAL(antialiasingChanged(bool)));
+
+ QVERIFY(item);
+ QVERIFY(!item->antialiasing());
+
+ item->setAntialiasing(true);
+ QVERIFY(item->antialiasing());
+ QCOMPARE(spy.count(),1);
+ QList<QVariant> arguments = spy.first();
+ QVERIFY(arguments.count() == 1);
+ QVERIFY(arguments.at(0).toBool() == true);
+
+ item->setAntialiasing(true);
+ QCOMPARE(spy.count(),1);
+
+ item->setAntialiasing(false);
+ QVERIFY(!item->antialiasing());
+ QCOMPARE(spy.count(),2);
+ item->setAntialiasing(false);
+ QCOMPARE(spy.count(),2);
+
+ delete item;
+}
+
+void tst_QQuickItem::clip()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem { clip: false\n }", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QSignalSpy spy(item, SIGNAL(clipChanged(bool)));
+
+ QVERIFY(item);
+ QVERIFY(!item->clip());
+
+ item->setClip(true);
+ QVERIFY(item->clip());
+
+ QList<QVariant> arguments = spy.first();
+ QVERIFY(arguments.count() == 1);
+ QVERIFY(arguments.at(0).toBool() == true);
+
+ QCOMPARE(spy.count(),1);
+ item->setClip(true);
+ QCOMPARE(spy.count(),1);
+
+ item->setClip(false);
+ QVERIFY(!item->clip());
+ QCOMPARE(spy.count(),2);
+ item->setClip(false);
+ QCOMPARE(spy.count(),2);
+
+ delete item;
+}
+
+void tst_QQuickItem::mapCoordinates()
+{
+ QFETCH(int, x);
+ QFETCH(int, y);
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(300, 300));
+ window->setSource(testFileUrl("mapCoordinates.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root != 0);
+ QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA");
+ QVERIFY(a != 0);
+ QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB");
+ QVERIFY(b != 0);
+
+ QVariant result;
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAToB",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
+ QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapToItem(b, QPointF(x, y)));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAFromB",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
+ QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapFromItem(b, QPointF(x, y)));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAToNull",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
+ QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapToScene(QPointF(x, y)));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAFromNull",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
+ QCOMPARE(result.value<QPointF>(), qobject_cast<QQuickItem*>(a)->mapFromScene(QPointF(x, y)));
+
+ QString warning1 = testFileUrl("mapCoordinates.qml").toString() + ":48:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item";
+ QString warning2 = testFileUrl("mapCoordinates.qml").toString() + ":48:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item";
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QVERIFY(QMetaObject::invokeMethod(root, "checkMapAToInvalid",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
+ QVERIFY(result.toBool());
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QVERIFY(QMetaObject::invokeMethod(root, "checkMapAFromInvalid",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
+ QVERIFY(result.toBool());
+
+ delete window;
+}
+
+void tst_QQuickItem::mapCoordinates_data()
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+
+ for (int i=-20; i<=20; i+=10)
+ QTest::newRow(QTest::toString(i)) << i << i;
+}
+
+void tst_QQuickItem::mapCoordinatesRect()
+{
+ QFETCH(int, x);
+ QFETCH(int, y);
+ QFETCH(int, width);
+ QFETCH(int, height);
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(300, 300));
+ window->setSource(testFileUrl("mapCoordinatesRect.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root != 0);
+ QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA");
+ QVERIFY(a != 0);
+ QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB");
+ QVERIFY(b != 0);
+
+ QVariant result;
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAToB",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height)));
+ QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectToItem(b, QRectF(x, y, width, height)));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAFromB",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height)));
+ QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectFromItem(b, QRectF(x, y, width, height)));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAToNull",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height)));
+ QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectToScene(QRectF(x, y, width, height)));
+
+ QVERIFY(QMetaObject::invokeMethod(root, "mapAFromNull",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height)));
+ QCOMPARE(result.value<QRectF>(), qobject_cast<QQuickItem*>(a)->mapRectFromScene(QRectF(x, y, width, height)));
+
+ QString warning1 = testFileUrl("mapCoordinatesRect.qml").toString() + ":48:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item";
+ QString warning2 = testFileUrl("mapCoordinatesRect.qml").toString() + ":48:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item";
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QVERIFY(QMetaObject::invokeMethod(root, "checkMapAToInvalid",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height)));
+ QVERIFY(result.toBool());
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QVERIFY(QMetaObject::invokeMethod(root, "checkMapAFromInvalid",
+ Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y), Q_ARG(QVariant, width), Q_ARG(QVariant, height)));
+ QVERIFY(result.toBool());
+
+ delete window;
+}
+
+void tst_QQuickItem::mapCoordinatesRect_data()
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+ QTest::addColumn<int>("width");
+ QTest::addColumn<int>("height");
+
+ for (int i=-20; i<=20; i+=5)
+ QTest::newRow(QTest::toString(i)) << i << i << i << i;
+}
+
+void tst_QQuickItem::transforms_data()
+{
+ QTest::addColumn<QByteArray>("qml");
+ QTest::addColumn<QTransform>("transform");
+ QTest::newRow("translate") << QByteArray("Translate { x: 10; y: 20 }")
+ << QTransform(1,0,0,0,1,0,10,20,1);
+ QTest::newRow("rotation") << QByteArray("Rotation { angle: 90 }")
+ << QTransform(0,1,0,-1,0,0,0,0,1);
+ QTest::newRow("scale") << QByteArray("Scale { xScale: 1.5; yScale: -2 }")
+ << QTransform(1.5,0,0,0,-2,0,0,0,1);
+ QTest::newRow("sequence") << QByteArray("[ Translate { x: 10; y: 20 }, Scale { xScale: 1.5; yScale: -2 } ]")
+ << QTransform(1,0,0,0,1,0,10,20,1) * QTransform(1.5,0,0,0,-2,0,0,0,1);
+}
+
+void tst_QQuickItem::transforms()
+{
+ QFETCH(QByteArray, qml);
+ QFETCH(QTransform, transform);
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem { transform: "+qml+"}", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(item->itemTransform(0,0), transform);
+}
+
+void tst_QQuickItem::childrenProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("childrenProperty.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ delete o;
+}
+
+void tst_QQuickItem::resourcesProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("resourcesProperty.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ delete o;
+}
+
+void tst_QQuickItem::propertyChanges()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(300, 300));
+ window->setSource(testFileUrl("propertychanges.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "item");
+ QQuickItem *parentItem = findItem<QQuickItem>(window->rootObject(), "parentItem");
+
+ QVERIFY(item);
+ QVERIFY(parentItem);
+
+ QSignalSpy parentSpy(item, SIGNAL(parentChanged(QQuickItem *)));
+ QSignalSpy widthSpy(item, SIGNAL(widthChanged()));
+ QSignalSpy heightSpy(item, SIGNAL(heightChanged()));
+ QSignalSpy baselineOffsetSpy(item, SIGNAL(baselineOffsetChanged(qreal)));
+ QSignalSpy childrenRectSpy(parentItem, SIGNAL(childrenRectChanged(QRectF)));
+ QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool)));
+ QSignalSpy wantsFocusSpy(parentItem, SIGNAL(activeFocusChanged(bool)));
+ QSignalSpy childrenChangedSpy(parentItem, SIGNAL(childrenChanged()));
+ QSignalSpy xSpy(item, SIGNAL(xChanged()));
+ QSignalSpy ySpy(item, SIGNAL(yChanged()));
+
+ item->setParentItem(parentItem);
+ item->setWidth(100.0);
+ item->setHeight(200.0);
+ item->setFocus(true);
+ item->setBaselineOffset(10.0);
+
+ QCOMPARE(item->parentItem(), parentItem);
+ QCOMPARE(parentSpy.count(),1);
+ QList<QVariant> parentArguments = parentSpy.first();
+ QVERIFY(parentArguments.count() == 1);
+ QCOMPARE(item->parentItem(), qvariant_cast<QQuickItem *>(parentArguments.at(0)));
+ QCOMPARE(childrenChangedSpy.count(),1);
+
+ item->setParentItem(parentItem);
+ QCOMPARE(childrenChangedSpy.count(),1);
+
+ QCOMPARE(item->width(), 100.0);
+ QCOMPARE(widthSpy.count(),1);
+
+ QCOMPARE(item->height(), 200.0);
+ QCOMPARE(heightSpy.count(),1);
+
+ QCOMPARE(item->baselineOffset(), 10.0);
+ QCOMPARE(baselineOffsetSpy.count(),1);
+ QList<QVariant> baselineOffsetArguments = baselineOffsetSpy.first();
+ QVERIFY(baselineOffsetArguments.count() == 1);
+ QCOMPARE(item->baselineOffset(), baselineOffsetArguments.at(0).toReal());
+
+ QCOMPARE(parentItem->childrenRect(), QRectF(0.0,0.0,100.0,200.0));
+ QCOMPARE(childrenRectSpy.count(),1);
+ QList<QVariant> childrenRectArguments = childrenRectSpy.at(0);
+ QVERIFY(childrenRectArguments.count() == 1);
+ QCOMPARE(parentItem->childrenRect(), childrenRectArguments.at(0).toRectF());
+
+ QCOMPARE(item->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(),1);
+ QList<QVariant> focusArguments = focusSpy.first();
+ QVERIFY(focusArguments.count() == 1);
+ QCOMPARE(focusArguments.at(0).toBool(), true);
+
+ QCOMPARE(parentItem->hasActiveFocus(), false);
+ QCOMPARE(parentItem->hasFocus(), false);
+ QCOMPARE(wantsFocusSpy.count(),0);
+
+ item->setX(10.0);
+ QCOMPARE(item->x(), 10.0);
+ QCOMPARE(xSpy.count(), 1);
+
+ item->setY(10.0);
+ QCOMPARE(item->y(), 10.0);
+ QCOMPARE(ySpy.count(), 1);
+
+ delete window;
+}
+
+void tst_QQuickItem::childrenRect()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("childrenRect.qml"));
+ window->setBaseSize(QSize(240,320));
+ window->show();
+
+ QQuickItem *o = window->rootObject();
+ QQuickItem *item = o->findChild<QQuickItem*>("testItem");
+ QCOMPARE(item->width(), qreal(0));
+ QCOMPARE(item->height(), qreal(0));
+
+ o->setProperty("childCount", 1);
+ QCOMPARE(item->width(), qreal(10));
+ QCOMPARE(item->height(), qreal(20));
+
+ o->setProperty("childCount", 5);
+ QCOMPARE(item->width(), qreal(50));
+ QCOMPARE(item->height(), qreal(100));
+
+ o->setProperty("childCount", 0);
+ QCOMPARE(item->width(), qreal(0));
+ QCOMPARE(item->height(), qreal(0));
+
+ delete o;
+ delete window;
+}
+
+// QTBUG-11383
+void tst_QQuickItem::childrenRectBug()
+{
+ QQuickView *window = new QQuickView(0);
+
+ QString warning = testFileUrl("childrenRectBug.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"height\"";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ window->setSource(testFileUrl("childrenRectBug.qml"));
+ window->show();
+
+ QQuickItem *o = window->rootObject();
+ QQuickItem *item = o->findChild<QQuickItem*>("theItem");
+ QCOMPARE(item->width(), qreal(200));
+ QCOMPARE(item->height(), qreal(100));
+ QCOMPARE(item->x(), qreal(100));
+
+ delete window;
+}
+
+// QTBUG-11465
+void tst_QQuickItem::childrenRectBug2()
+{
+ QQuickView *window = new QQuickView(0);
+
+ QString warning1 = testFileUrl("childrenRectBug2.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"width\"";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QString warning2 = testFileUrl("childrenRectBug2.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"height\"";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ window->setSource(testFileUrl("childrenRectBug2.qml"));
+ window->show();
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(window->rootObject());
+ QVERIFY(rect);
+ QQuickItem *item = rect->findChild<QQuickItem*>("theItem");
+ QCOMPARE(item->width(), qreal(100));
+ QCOMPARE(item->height(), qreal(110));
+ QCOMPARE(item->x(), qreal(130));
+
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ rectPrivate->setState("row");
+ QCOMPARE(item->width(), qreal(210));
+ QCOMPARE(item->height(), qreal(50));
+ QCOMPARE(item->x(), qreal(75));
+
+ delete window;
+}
+
+// QTBUG-12722
+void tst_QQuickItem::childrenRectBug3()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("childrenRectBug3.qml"));
+ window->show();
+
+ //don't crash on delete
+ delete window;
+}
+
+// QTBUG-13893
+void tst_QQuickItem::transformCrash()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("transformCrash.qml"));
+ window->show();
+
+ delete window;
+}
+
+void tst_QQuickItem::implicitSize()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("implicitsize.qml"));
+ window->show();
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(item);
+ QCOMPARE(item->width(), qreal(80));
+ QCOMPARE(item->height(), qreal(60));
+
+ QCOMPARE(item->implicitWidth(), qreal(200));
+ QCOMPARE(item->implicitHeight(), qreal(100));
+
+ QMetaObject::invokeMethod(item, "resetSize");
+
+ QCOMPARE(item->width(), qreal(200));
+ QCOMPARE(item->height(), qreal(100));
+
+ QMetaObject::invokeMethod(item, "changeImplicit");
+
+ QCOMPARE(item->implicitWidth(), qreal(150));
+ QCOMPARE(item->implicitHeight(), qreal(80));
+ QCOMPARE(item->width(), qreal(150));
+ QCOMPARE(item->height(), qreal(80));
+
+ QMetaObject::invokeMethod(item, "assignImplicitBinding");
+
+ QCOMPARE(item->implicitWidth(), qreal(150));
+ QCOMPARE(item->implicitHeight(), qreal(80));
+ QCOMPARE(item->width(), qreal(150));
+ QCOMPARE(item->height(), qreal(80));
+
+ QMetaObject::invokeMethod(item, "increaseImplicit");
+
+ QCOMPARE(item->implicitWidth(), qreal(200));
+ QCOMPARE(item->implicitHeight(), qreal(100));
+ QCOMPARE(item->width(), qreal(175));
+ QCOMPARE(item->height(), qreal(90));
+
+ QMetaObject::invokeMethod(item, "changeImplicit");
+
+ QCOMPARE(item->implicitWidth(), qreal(150));
+ QCOMPARE(item->implicitHeight(), qreal(80));
+ QCOMPARE(item->width(), qreal(150));
+ QCOMPARE(item->height(), qreal(80));
+
+ QMetaObject::invokeMethod(item, "assignUndefinedBinding");
+
+ QCOMPARE(item->implicitWidth(), qreal(150));
+ QCOMPARE(item->implicitHeight(), qreal(80));
+ QCOMPARE(item->width(), qreal(150));
+ QCOMPARE(item->height(), qreal(80));
+
+ QMetaObject::invokeMethod(item, "increaseImplicit");
+
+ QCOMPARE(item->implicitWidth(), qreal(200));
+ QCOMPARE(item->implicitHeight(), qreal(100));
+ QCOMPARE(item->width(), qreal(175));
+ QCOMPARE(item->height(), qreal(90));
+
+ QMetaObject::invokeMethod(item, "changeImplicit");
+
+ QCOMPARE(item->implicitWidth(), qreal(150));
+ QCOMPARE(item->implicitHeight(), qreal(80));
+ QCOMPARE(item->width(), qreal(150));
+ QCOMPARE(item->height(), qreal(80));
+
+ delete window;
+}
+
+void tst_QQuickItem::qtbug_16871()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_16871.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ delete o;
+}
+
+
+void tst_QQuickItem::visibleChildren()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl("visiblechildren.qml"));
+ window->show();
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root);
+
+ QCOMPARE(root->property("test1_1").toBool(), true);
+ QCOMPARE(root->property("test1_2").toBool(), true);
+ QCOMPARE(root->property("test1_3").toBool(), true);
+ QCOMPARE(root->property("test1_4").toBool(), true);
+
+ QMetaObject::invokeMethod(root, "hideFirstAndLastRowChild");
+ QCOMPARE(root->property("test2_1").toBool(), true);
+ QCOMPARE(root->property("test2_2").toBool(), true);
+ QCOMPARE(root->property("test2_3").toBool(), true);
+ QCOMPARE(root->property("test2_4").toBool(), true);
+
+ QMetaObject::invokeMethod(root, "showLastRowChildsLastChild");
+ QCOMPARE(root->property("test3_1").toBool(), true);
+ QCOMPARE(root->property("test3_2").toBool(), true);
+ QCOMPARE(root->property("test3_3").toBool(), true);
+ QCOMPARE(root->property("test3_4").toBool(), true);
+
+ QMetaObject::invokeMethod(root, "showLastRowChild");
+ QCOMPARE(root->property("test4_1").toBool(), true);
+ QCOMPARE(root->property("test4_2").toBool(), true);
+ QCOMPARE(root->property("test4_3").toBool(), true);
+ QCOMPARE(root->property("test4_4").toBool(), true);
+
+ QString warning1 = testFileUrl("visiblechildren.qml").toString() + ":87: TypeError: Cannot read property 'visibleChildren' of null";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QMetaObject::invokeMethod(root, "tryWriteToReadonlyVisibleChildren");
+
+ QMetaObject::invokeMethod(root, "reparentVisibleItem3");
+ QCOMPARE(root->property("test6_1").toBool(), true);
+ QCOMPARE(root->property("test6_2").toBool(), true);
+ QCOMPARE(root->property("test6_3").toBool(), true);
+ QCOMPARE(root->property("test6_4").toBool(), true);
+
+ QMetaObject::invokeMethod(root, "reparentImlicitlyInvisibleItem4_1");
+ QCOMPARE(root->property("test7_1").toBool(), true);
+ QCOMPARE(root->property("test7_2").toBool(), true);
+ QCOMPARE(root->property("test7_3").toBool(), true);
+ QCOMPARE(root->property("test7_4").toBool(), true);
+
+ // FINALLY TEST THAT EVERYTHING IS AS EXPECTED
+ QCOMPARE(root->property("test8_1").toBool(), true);
+ QCOMPARE(root->property("test8_2").toBool(), true);
+ QCOMPARE(root->property("test8_3").toBool(), true);
+ QCOMPARE(root->property("test8_4").toBool(), true);
+ QCOMPARE(root->property("test8_5").toBool(), true);
+
+ delete window;
+}
+
+void tst_QQuickItem::parentLoop()
+{
+ QQuickView *window = new QQuickView(0);
+
+ QTest::ignoreMessage(QtWarningMsg, "QQuickItem::setParentItem: Parent is already part of this items subtree.");
+ window->setSource(testFileUrl("parentLoop.qml"));
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root);
+
+ QQuickItem *item1 = root->findChild<QQuickItem*>("item1");
+ QVERIFY(item1);
+ QCOMPARE(item1->parentItem(), root);
+
+ QQuickItem *item2 = root->findChild<QQuickItem*>("item2");
+ QVERIFY(item2);
+ QCOMPARE(item2->parentItem(), item1);
+
+ delete window;
+}
+
+void tst_QQuickItem::contains_data()
+{
+ QTest::addColumn<bool>("circleTest");
+ QTest::addColumn<bool>("insideTarget");
+ QTest::addColumn<QList<QPoint> >("points");
+
+ QList<QPoint> points;
+
+ points << QPoint(176, 176)
+ << QPoint(176, 226)
+ << QPoint(226, 176)
+ << QPoint(226, 226)
+ << QPoint(150, 200)
+ << QPoint(200, 150)
+ << QPoint(200, 250)
+ << QPoint(250, 200);
+ QTest::newRow("hollow square: testing points inside") << false << true << points;
+
+ points.clear();
+ points << QPoint(162, 162)
+ << QPoint(162, 242)
+ << QPoint(242, 162)
+ << QPoint(242, 242)
+ << QPoint(200, 200)
+ << QPoint(175, 200)
+ << QPoint(200, 175)
+ << QPoint(200, 228)
+ << QPoint(228, 200)
+ << QPoint(200, 122)
+ << QPoint(122, 200)
+ << QPoint(200, 280)
+ << QPoint(280, 200);
+ QTest::newRow("hollow square: testing points outside") << false << false << points;
+
+ points.clear();
+ points << QPoint(174, 174)
+ << QPoint(174, 225)
+ << QPoint(225, 174)
+ << QPoint(225, 225)
+ << QPoint(165, 200)
+ << QPoint(200, 165)
+ << QPoint(200, 235)
+ << QPoint(235, 200);
+ QTest::newRow("hollow circle: testing points inside") << true << true << points;
+
+ points.clear();
+ points << QPoint(160, 160)
+ << QPoint(160, 240)
+ << QPoint(240, 160)
+ << QPoint(240, 240)
+ << QPoint(200, 200)
+ << QPoint(185, 185)
+ << QPoint(185, 216)
+ << QPoint(216, 185)
+ << QPoint(216, 216)
+ << QPoint(145, 200)
+ << QPoint(200, 145)
+ << QPoint(255, 200)
+ << QPoint(200, 255);
+ QTest::newRow("hollow circle: testing points outside") << true << false << points;
+}
+
+void tst_QQuickItem::contains()
+{
+ QFETCH(bool, circleTest);
+ QFETCH(bool, insideTarget);
+ QFETCH(QList<QPoint>, points);
+
+ QQuickView *window = new QQuickView(0);
+ window->rootContext()->setContextProperty("circleShapeTest", circleTest);
+ window->setBaseSize(QSize(400, 400));
+ window->setSource(testFileUrl("hollowTestItem.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *root = qobject_cast<QQuickItem *>(window->rootObject());
+ QVERIFY(root);
+
+ HollowTestItem *hollowItem = root->findChild<HollowTestItem *>("hollowItem");
+ QVERIFY(hollowItem);
+
+ foreach (const QPoint &point, points) {
+ // check mouse hover
+ QTest::mouseMove(window, point);
+ QTest::qWait(10);
+ QCOMPARE(hollowItem->isHovered(), insideTarget);
+
+ // check mouse press
+ QTest::mousePress(window, Qt::LeftButton, 0, point);
+ QTest::qWait(10);
+ QCOMPARE(hollowItem->isPressed(), insideTarget);
+
+ // check mouse release
+ QTest::mouseRelease(window, Qt::LeftButton, 0, point);
+ QTest::qWait(10);
+ QCOMPARE(hollowItem->isPressed(), false);
+ }
+
+ delete window;
+}
+
+void tst_QQuickItem::childAt()
+{
+ QQuickItem parent;
+
+ QQuickItem child1;
+ child1.setX(0);
+ child1.setY(0);
+ child1.setWidth(100);
+ child1.setHeight(100);
+ child1.setParentItem(&parent);
+
+ QQuickItem child2;
+ child2.setX(50);
+ child2.setY(50);
+ child2.setWidth(100);
+ child2.setHeight(100);
+ child2.setParentItem(&parent);
+
+ QQuickItem child3;
+ child3.setX(0);
+ child3.setY(200);
+ child3.setWidth(50);
+ child3.setHeight(50);
+ child3.setParentItem(&parent);
+
+ QCOMPARE(parent.childAt(0, 0), &child1);
+ QCOMPARE(parent.childAt(0, 100), &child1);
+ QCOMPARE(parent.childAt(25, 25), &child1);
+ QCOMPARE(parent.childAt(25, 75), &child1);
+ QCOMPARE(parent.childAt(75, 25), &child1);
+ QCOMPARE(parent.childAt(75, 75), &child2);
+ QCOMPARE(parent.childAt(150, 150), &child2);
+ QCOMPARE(parent.childAt(25, 200), &child3);
+ QCOMPARE(parent.childAt(0, 150), static_cast<QQuickItem *>(0));
+ QCOMPARE(parent.childAt(300, 300), static_cast<QQuickItem *>(0));
+}
+
+
+QTEST_MAIN(tst_QQuickItem)
+
+#include "tst_qquickitem.moc"
diff --git a/tests/auto/quick/qquickitemlayer/data/DisableLayer.qml b/tests/auto/quick/qquickitemlayer/data/DisableLayer.qml
new file mode 100644
index 0000000000..70fc05e937
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/DisableLayer.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+ Rectangle {
+ width: 100
+ height: 100
+ color: "red"
+ layer.enabled: true
+ Component.onCompleted: {
+ layer.enabled = false
+ visible = false
+ width = 120
+ x = 10
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/Effect.qml b/tests/auto/quick/qquickitemlayer/data/Effect.qml
new file mode 100644
index 0000000000..678f86538d
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/Effect.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+
+Item
+{
+ width: 200
+ height: 100
+
+ Rectangle {
+ id: box
+ width: 200
+ height: 100
+
+ color: "#0000ff"
+
+ Rectangle {
+ x: 100
+ width: 100
+ height: 100
+ color: "#00ff00"
+ }
+
+ layer.enabled: true
+ layer.effect: ShaderEffect {
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord0).bgra * qt_Opacity;
+ }"
+ }
+
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/Enabled.qml b/tests/auto/quick/qquickitemlayer/data/Enabled.qml
new file mode 100644
index 0000000000..0e7d4f56b8
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/Enabled.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item
+{
+ width: 200
+ height: 200
+
+ Item {
+ width: 20
+ height: 20
+ scale: 10
+
+ layer.enabled: true
+ anchors.centerIn: parent
+
+ Rectangle {
+ width: 20
+ height: 20
+ gradient: Gradient {
+ GradientStop { position: 0; color: "white" }
+ GradientStop { position: 1; color: "black" }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/ItemEffect.qml b/tests/auto/quick/qquickitemlayer/data/ItemEffect.qml
new file mode 100644
index 0000000000..2f17d78efd
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/ItemEffect.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 99
+ gradient: Gradient {
+ GradientStop { position: 0.3; color: "red" }
+ GradientStop { position: 0.7; color: "blue" }
+ }
+ layer.enabled: true
+ layer.effect: Item {
+ property variant source
+ ShaderEffect {
+ anchors.fill: parent
+ anchors.margins: -99
+ property variant source: parent.source
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/Mipmap.qml b/tests/auto/quick/qquickitemlayer/data/Mipmap.qml
new file mode 100644
index 0000000000..8de41076e9
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/Mipmap.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Item
+{
+ width: 100
+ height: 100
+
+ Rectangle {
+ id: box
+ width: 600
+ height: 600
+
+ scale: 1 / 6.
+
+ color: "black"
+
+ layer.enabled: true
+ layer.mipmap: true
+ layer.smooth: true
+
+ anchors.centerIn: parent
+
+ Rectangle {
+ x: 1
+ width: 1
+ height: parent.height
+ color: "white"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/RectangleEffect.qml b/tests/auto/quick/qquickitemlayer/data/RectangleEffect.qml
new file mode 100644
index 0000000000..94c43f2caf
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/RectangleEffect.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+ Rectangle {
+ width: 100
+ height: 100
+ x: 50
+ y: 50
+ scale: 1.5
+ z: 1
+ rotation: 45
+ color: "#ff0000"
+ layer.enabled: true
+ layer.effect: Rectangle { color: "#0000ff" }
+ }
+ Rectangle {
+ anchors.fill: parent
+ color: "#00ff00"
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/SamplerNameChange.qml b/tests/auto/quick/qquickitemlayer/data/SamplerNameChange.qml
new file mode 100644
index 0000000000..a4c2ebff6b
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/SamplerNameChange.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+ color: "blue"
+ layer.enabled: true
+ layer.effect: ShaderEffect {
+ fragmentShader: "
+ uniform sampler2D foo;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = texture2D(foo, qt_TexCoord0) * qt_Opacity;
+ }"
+ }
+ Component.onCompleted: layer.samplerName = "foo"
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/Smooth.qml b/tests/auto/quick/qquickitemlayer/data/Smooth.qml
new file mode 100644
index 0000000000..3f9575bb0b
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/Smooth.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+
+Item {
+ width: 200
+ height: 100
+
+ Row {
+ id: layerRoot
+
+ width: 20
+ height: 10
+
+ Rectangle { width: 10; height: 10; color: "red" }
+ Rectangle { width: 10; height: 10; color: "blue" }
+
+ layer.enabled: true
+ layer.smooth: true
+
+ anchors.centerIn: parent
+ scale: 10
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/SourceRect.qml b/tests/auto/quick/qquickitemlayer/data/SourceRect.qml
new file mode 100644
index 0000000000..a161760028
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/SourceRect.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Item
+{
+ width: 200
+ height: 100
+
+ Rectangle {
+ id: box
+ width: 200
+ height: 100
+
+ color: "#ff0000"
+
+ layer.enabled: true
+ layer.sourceRect: Qt.rect(-10, -10, box.width + 20, box.height + 20);
+
+ // A shader that pads the transparent pixels with blue.
+ layer.effect: ShaderEffect {
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ vec4 c = texture2D(source, qt_TexCoord0);
+ if (c.a == 0.)
+ c = vec4(0, 0, 1, 1);
+ gl_FragColor = c * qt_Opacity;
+ }
+ "
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/TextureProvider.qml b/tests/auto/quick/qquickitemlayer/data/TextureProvider.qml
new file mode 100644
index 0000000000..427bd41310
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/TextureProvider.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item
+{
+ width: 200
+ height: 100
+
+ Rectangle {
+ id: box
+ width: 200
+ height: 100
+
+ color: "#0000ff"
+
+ Rectangle {
+ x: 100
+ width: 100
+ height: 100
+ color: "#00ff00"
+ }
+
+ visible: false
+
+ layer.enabled: true
+ }
+
+ ShaderEffect {
+ anchors.fill: parent
+ property variant source: box
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord0).bgra * qt_Opacity;
+ }"
+ }
+
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/ToggleLayerAndEffect.qml b/tests/auto/quick/qquickitemlayer/data/ToggleLayerAndEffect.qml
new file mode 100644
index 0000000000..174b669b6c
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/ToggleLayerAndEffect.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+ Rectangle {
+ width: 100
+ height: 100
+ color: "red"
+ Component.onCompleted: {
+ layer.enabled = true
+ layer.effect = effectComponent
+ layer.enabled = false
+ visible = false
+ width = 120
+ x = 10
+ }
+ }
+ Component {
+ id: effectComponent
+ ShaderEffect { }
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/Visible.qml b/tests/auto/quick/qquickitemlayer/data/Visible.qml
new file mode 100644
index 0000000000..8267f18250
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/Visible.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.0
+
+Item
+{
+ id: root
+
+ width: 100
+ height: 100
+
+ property bool layerEffect: false;
+ onLayerEffectChanged: root.maybeUse();
+ Component.onCompleted: root.maybeUse();
+
+ property real layerOpacity: 1;
+ property bool layerVisible: true;
+
+ function maybeUse() {
+ if (root.layerEffect)
+ box.layer.effect = shaderEffect
+ }
+
+ Component {
+ id: shaderEffect
+ ShaderEffect {
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = texture2D(source, qt_TexCoord0).bgra * qt_Opacity;
+ }
+ "
+ }
+
+ }
+
+ Rectangle {
+ id: box
+ width: 100
+ height: 100
+
+ color: "#0000ff"
+ visible: parent.layerVisible;
+ opacity: parent.layerOpacity;
+
+ Rectangle {
+ x: 50
+ width: 50
+ height: 100
+ color: "#00ff00"
+ }
+
+ layer.enabled: true
+
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/ZOrder.qml b/tests/auto/quick/qquickitemlayer/data/ZOrder.qml
new file mode 100644
index 0000000000..59ccb32224
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/ZOrder.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+
+Item
+{
+ id: root
+
+ width: 200
+ height: 200
+
+ Component {
+ id: shaderEffect
+ ShaderEffect { }
+ }
+
+ property bool layerEffect: false;
+ onLayerEffectChanged: root.maybeUse();
+ Component.onCompleted: root.maybeUse();
+
+ function maybeUse() {
+ if (root.layerEffect)
+ box.layer.effect = shaderEffect
+ }
+
+
+ Rectangle {
+ color: "red"
+ anchors.left: parent.left
+ anchors.top: parent.top
+ width: 100
+ height: 100
+ z: 1
+ }
+
+ Rectangle {
+ color: "#00ff00"
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ width: 100
+ height: 100
+ z: 3
+ }
+
+ Rectangle {
+ id: box
+ color: "blue"
+ anchors.fill: parent
+ anchors.margins: 10
+ layer.enabled: true
+ z: 2
+ }
+
+}
diff --git a/tests/auto/quick/qquickitemlayer/data/ZOrderChange.qml b/tests/auto/quick/qquickitemlayer/data/ZOrderChange.qml
new file mode 100644
index 0000000000..ebbd3b7e15
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/data/ZOrderChange.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+ property bool layerEffect: false
+ property bool layerEnabled: false
+ property real layerZ: 0
+ Rectangle {
+ anchors.fill: parent
+ color: "#00ffff"
+ }
+ Rectangle {
+ id: foo
+ anchors.fill: parent
+ color: "#ffff00"
+ Rectangle {
+ width: 100
+ height: 100
+ color: "#00ffff"
+ }
+ layer.enabled: parent.layerEnabled
+ layer.effect: parent.layerEffect ? effectComponent : null
+ opacity: 0.5
+ z: layerZ
+ }
+ Rectangle {
+ width: 100
+ height: 100
+ x: 100
+ color: "#ff0000"
+ }
+ Rectangle {
+ width: 100
+ height: 100
+ y: 100
+ color: "#0000ff"
+ z: 1
+ }
+ Component {
+ id: effectComponent
+ ShaderEffect {
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() { gl_FragColor = texture2D(source, qt_TexCoord0).xzyw * qt_Opacity; }"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro b/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro
new file mode 100644
index 0000000000..d7e75a9924
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/qquickitemlayer.pro
@@ -0,0 +1,29 @@
+CONFIG += testcase
+TARGET = tst_qquickitemlayer
+SOURCES += tst_qquickitemlayer.cpp
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+include(../../shared/util.pri)
+
+CONFIG += parallel_test
+QT += core-private gui-private v8-private qml-private quick-private testlib
+
+OTHER_FILES += \
+ data/Smooth.qml \
+ data/Enabled.qml \
+ data/Mipmap.qml \
+ data/Effect.qml \
+ data/SourceRect.qml \
+ data/TextureProvider.qml \
+ data/Visible.qml \
+ data/ZOrder.qml \
+ data/ZOrderChange.qml \
+ data/ToggleLayerAndEffect.qml \
+ data/DisableLayer.qml \
+ data/SamplerNameChange.qml \
+ data/ItemEffect.qml \
+ data/RectangleEffect.qml
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
new file mode 100644
index 0000000000..4f103bd1fa
--- /dev/null
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -0,0 +1,436 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+#include <QtGui/qopenglcontext.h>
+
+#include "../../shared/util.h"
+
+class tst_QQuickItemLayer: public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickItemLayer();
+
+ QImage runTest(const QString &fileName)
+ {
+ QQuickView view;
+ view.setSource(testFileUrl(fileName));
+
+ view.show();
+ QTest::qWaitForWindowExposed(&view);
+
+ return view.grabWindow();
+ }
+
+private slots:
+ void layerEnabled();
+ void layerSmooth();
+ void layerMipmap();
+ void layerEffect();
+
+ void layerVisibility_data();
+ void layerVisibility();
+
+ void layerSourceRect();
+
+ void layerZOrder_data();
+ void layerZOrder();
+
+ void layerIsTextureProvider();
+
+ void changeZOrder_data();
+ void changeZOrder();
+
+ void toggleLayerAndEffect();
+ void disableLayer();
+ void changeSamplerName();
+ void itemEffect();
+ void rectangleEffect();
+
+private:
+ bool m_isMesaSoftwareRasterizer;
+ int m_mesaVersion;
+};
+
+tst_QQuickItemLayer::tst_QQuickItemLayer()
+ : m_mesaVersion(0)
+{
+ QWindow window;
+ QOpenGLContext context;
+ window.setSurfaceType(QWindow::OpenGLSurface);
+ window.create();
+ context.create();
+ context.makeCurrent(&window);
+ const char *vendor = (const char *)glGetString(GL_VENDOR);
+ const char *renderer = (const char *)glGetString(GL_RENDERER);
+ m_isMesaSoftwareRasterizer = strcmp(vendor, "Mesa Project") == 0
+ && strcmp(renderer, "Software Rasterizer") == 0;
+ if (m_isMesaSoftwareRasterizer) {
+ // Expects format: <OpenGL version> Mesa <Mesa version>[-devel] [...]
+ const char *version = (const char *)glGetString(GL_VERSION);
+ QList<QByteArray> list = QByteArray(version).split(' ');
+ if (list.size() >= 3) {
+ list = list.at(2).split('-').at(0).split('.');
+ int major = 0;
+ int minor = 0;
+ int patch = 0;
+ if (list.size() >= 1)
+ major = list.at(0).toInt();
+ if (list.size() >= 2)
+ minor = list.at(1).toInt();
+ if (list.size() >= 3)
+ patch = list.at(2).toInt();
+ m_mesaVersion = QT_VERSION_CHECK(major, minor, patch);
+ }
+ }
+}
+
+// The test draws a red and a blue box next to each other and tests that the
+// output is still red and blue on the left and right and a combination of
+// the two in the middle.
+
+void tst_QQuickItemLayer::layerSmooth()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+ QImage fb = runTest("Smooth.qml");
+ QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
+ QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0, 0xff));
+
+ uint pixel = fb.pixel(fb.width() / 2, 0);
+ QVERIFY(qRed(pixel) > 0);
+ QVERIFY(qBlue(pixel) > 0);
+}
+
+
+
+// The test draws a gradient at a small size into a layer and scales the
+// layer. If the layer is enabled there should be very visible bands in
+// the gradient.
+
+void tst_QQuickItemLayer::layerEnabled()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+ QImage fb = runTest("Enabled.qml");
+ // Verify the banding
+ QCOMPARE(fb.pixel(0, 0), fb.pixel(0, 1));
+ // Verify the gradient
+ QVERIFY(fb.pixel(0, 0) != fb.pixel(0, fb.height() - 1));
+}
+
+
+
+// The test draws a one pixel wide line and scales it down by more than a a factor 2
+// If mipmpping works, the pixels should be gray, not white or black
+
+void tst_QQuickItemLayer::layerMipmap()
+{
+ if (m_isMesaSoftwareRasterizer)
+ QSKIP("Mipmapping does not work with the Mesa Software Rasterizer.");
+ QImage fb = runTest("Mipmap.qml");
+ QVERIFY(fb.pixel(0, 0) != 0xff000000);
+ QVERIFY(fb.pixel(0, 0) != 0xffffffff);
+}
+
+
+
+// The test implements an rgb swapping effect sourced from a blue rectangle. The
+// resulting pixel should be red
+
+void tst_QQuickItemLayer::layerEffect()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+ QImage fb = runTest("Effect.qml");
+ QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
+ QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0));
+}
+
+
+
+// The test draws a rectangle and verifies that there is padding on each side
+// as the source rect spans outside the item. The padding is verified using
+// a shader that pads transparent to blue. Everything else is red.
+void tst_QQuickItemLayer::layerSourceRect()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+
+ QImage fb = runTest("SourceRect.qml");
+
+ // Check that the edges are converted to blue
+ QCOMPARE(fb.pixel(0, 0), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(0, fb.height() - 1), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(fb.width() - 1, fb.height() - 1), qRgb(0, 0, 0xff));
+
+ // The center pixel should be red
+ QCOMPARE(fb.pixel(fb.width() / 2, fb.height() / 2), qRgb(0xff, 0, 0));
+}
+
+
+
+// Same as the effect test up above, but this time use the item
+// directly in a stand alone ShaderEffect
+void tst_QQuickItemLayer::layerIsTextureProvider()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+ QImage fb = runTest("TextureProvider.qml");
+ QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
+ QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0));
+}
+
+
+void tst_QQuickItemLayer::layerVisibility_data()
+{
+ QTest::addColumn<bool>("visible");
+ QTest::addColumn<bool>("effect");
+ QTest::addColumn<qreal>("opacity");
+
+ QTest::newRow("!effect, !visible, a=1") << false << false << 1.;
+ QTest::newRow("!effect, visible, a=1") << false << true << 1.;
+ QTest::newRow("effect, !visible, a=1") << true << false << 1.;
+ QTest::newRow("effect, visible, a=1") << true << true << 1.;
+
+ QTest::newRow("!effect, !visible, a=.5") << false << false << .5;
+ QTest::newRow("!effect, visible, a=.5") << false << true << .5;
+ QTest::newRow("effect, !visible, a=.5") << true << false << .5;
+ QTest::newRow("effect, visible, a=.5") << true << true << .5;
+
+ QTest::newRow("!effect, !visible, a=0") << false << false << 0.;
+ QTest::newRow("!effect, visible, a=0") << false << true << 0.;
+ QTest::newRow("effect, !visible, a=0") << true << false << 0.;
+ QTest::newRow("effect, visible, a=0") << true << true << 0.;
+}
+
+void tst_QQuickItemLayer::layerVisibility()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+
+ QFETCH(bool, visible);
+ QFETCH(bool, effect);
+ QFETCH(qreal, opacity);
+
+ QQuickView view;
+ view.setSource(testFileUrl("Visible.qml"));
+
+ QQuickItem *child = view.contentItem()->childItems().at(0);
+ child->setProperty("layerVisible", visible);
+ child->setProperty("layerEffect", effect);
+ child->setProperty("layerOpacity", opacity);
+
+ view.show();
+
+ QTest::qWaitForWindowExposed(&view);
+
+ QImage fb = view.grabWindow();
+ uint pixel = fb.pixel(0, 0);
+
+ if (!visible || opacity == 0) {
+ QCOMPARE(pixel, qRgb(0xff, 0xff, 0xff));
+ } else if (effect) {
+ QCOMPARE(qRed(pixel), 0xff);
+ QVERIFY(qGreen(pixel) < 0xff);
+ QVERIFY(qBlue(pixel) < 0xff);
+ } else { // no effect
+ QCOMPARE(qBlue(pixel), 0xff);
+ QVERIFY(qGreen(pixel) < 0xff);
+ QVERIFY(qRed(pixel) < 0xff);
+ }
+}
+
+
+
+
+void tst_QQuickItemLayer::layerZOrder_data()
+{
+ QTest::addColumn<bool>("effect");
+
+ QTest::newRow("!effect") << false;
+ QTest::newRow("effect") << true;
+}
+
+void tst_QQuickItemLayer::layerZOrder()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+
+ QFETCH(bool, effect);
+
+ QQuickView view;
+ view.setSource(testFileUrl("ZOrder.qml"));
+
+ QQuickItem *child = view.contentItem()->childItems().at(0);
+ child->setProperty("layerEffect", effect);
+
+ view.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QImage fb = view.grabWindow();
+
+ QCOMPARE(fb.pixel(50, 50), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(150, 150), qRgb(0, 0xff, 00));
+
+}
+
+void tst_QQuickItemLayer::changeZOrder_data()
+{
+ QTest::addColumn<bool>("layered");
+ QTest::addColumn<bool>("effect");
+
+ QTest::newRow("layered, effect") << true << true;
+ QTest::newRow("layered, !effect") << true << false;
+ QTest::newRow("!layered") << false << false;
+}
+
+void tst_QQuickItemLayer::changeZOrder()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+
+ QFETCH(bool, layered);
+ QFETCH(bool, effect);
+
+ QQuickView view;
+ view.setSource(testFileUrl("ZOrderChange.qml"));
+
+ QQuickItem *child = view.contentItem()->childItems().at(0);
+ child->setProperty("layerEnabled", layered);
+ child->setProperty("layerEffect", effect);
+ child->setProperty("layerZ", 1);
+
+ view.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QImage fb = view.grabWindow();
+
+ QRgb topLeft = fb.pixel(50, 50);
+ QRgb topRight = fb.pixel(150, 50);
+ QRgb bottomLeft = fb.pixel(50, 150);
+ QRgb bottomRight = fb.pixel(150, 150);
+
+ QCOMPARE(bottomLeft, qRgb(0, 0, 0xff));
+
+ if (layered) {
+ QCOMPARE(topLeft, qRgb(0, 0xff, 0xff));
+ } else {
+ QCOMPARE(qGreen(topLeft), 0xff);
+ QVERIFY(qAbs(qRed(topLeft) - 0x3f) < 4);
+ QVERIFY(qAbs(qBlue(topLeft) - 0xbf) < 4);
+ }
+
+ if (layered && effect) {
+ QCOMPARE(qRed(topRight), 0xff);
+ QCOMPARE(qGreen(topRight), 0x00);
+ QVERIFY(qAbs(qBlue(topRight) - 0x7f) < 4);
+
+ QVERIFY(qAbs(qRed(bottomRight) - 0x7f) < 4);
+ QCOMPARE(qBlue(bottomRight), 0xff);
+ QVERIFY(qAbs(qGreen(bottomRight) - 0x7f) < 4);
+ } else {
+ QCOMPARE(qRed(topRight), 0xff);
+ QCOMPARE(qBlue(topRight), 0x00);
+ QVERIFY(qAbs(qGreen(topRight) - 0x7f) < 4);
+
+ QVERIFY(qAbs(qRed(bottomRight) - 0x7f) < 4);
+ QCOMPARE(qGreen(bottomRight), 0xff);
+ QVERIFY(qAbs(qBlue(bottomRight) - 0x7f) < 4);
+ }
+}
+
+void tst_QQuickItemLayer::toggleLayerAndEffect()
+{
+ // This test passes if it doesn't crash.
+ runTest("ToggleLayerAndEffect.qml");
+}
+
+void tst_QQuickItemLayer::disableLayer()
+{
+ // This test passes if it doesn't crash.
+ runTest("DisableLayer.qml");
+}
+
+void tst_QQuickItemLayer::changeSamplerName()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+ QImage fb = runTest("SamplerNameChange.qml");
+ QCOMPARE(fb.pixel(0, 0), qRgb(0, 0, 0xff));
+}
+
+void tst_QQuickItemLayer::itemEffect()
+{
+ if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
+ QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
+ QImage fb = runTest("ItemEffect.qml");
+ QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
+ QCOMPARE(fb.pixel(199, 0), qRgb(0xff, 0, 0));
+ QCOMPARE(fb.pixel(0, 199), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(199, 199), qRgb(0, 0, 0xff));
+}
+
+void tst_QQuickItemLayer::rectangleEffect()
+{
+ QImage fb = runTest("RectangleEffect.qml");
+ QCOMPARE(fb.pixel(0, 0), qRgb(0, 0xff, 0));
+ QCOMPARE(fb.pixel(199, 0), qRgb(0, 0xff, 0));
+ QCOMPARE(fb.pixel(0, 199), qRgb(0, 0xff, 0));
+ QCOMPARE(fb.pixel(199, 199), qRgb(0, 0xff, 0));
+
+ QCOMPARE(fb.pixel(100, 0), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(199, 100), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(100, 199), qRgb(0, 0, 0xff));
+ QCOMPARE(fb.pixel(0, 100), qRgb(0, 0, 0xff));
+}
+
+
+QTEST_MAIN(tst_QQuickItemLayer)
+
+#include "tst_qquickitemlayer.moc"
diff --git a/tests/auto/quick/qquicklistview/data/ComponentView.qml b/tests/auto/quick/qquicklistview/data/ComponentView.qml
new file mode 100644
index 0000000000..3e87be8799
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/ComponentView.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+ListView {
+ id: view
+
+ property string title
+
+ width: 100; height: 100;
+
+ model: 1
+ delegate: Text { objectName: "listItem"; text: view.title }
+ header: Text { objectName: "header"; text: view.title }
+ footer: Text { objectName: "footer"; text: view.title }
+ section.delegate: Text { objectName: "section"; text: view.title }
+ section.property: "modelData"
+}
diff --git a/tests/auto/quick/qquicklistview/data/Page.qml b/tests/auto/quick/qquicklistview/data/Page.qml
new file mode 100644
index 0000000000..abe4364315
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/Page.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Item {
+ anchors.fill: parent
+ default property alias contentArea: contentItem.data
+ Item {
+ id: contentItem
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/addTransitions.qml b/tests/auto/quick/qquicklistview/data/addTransitions.qml
new file mode 100644
index 0000000000..69e6ba1eea
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/addTransitions.qml
@@ -0,0 +1,135 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: list.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text { text: index }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == targetItems_transitionFrom)
+ model_targetItems_transitionFrom.addItem(name, "")
+ if (Qt.point(x, y) == displacedItems_transitionVia)
+ model_displacedItems_transitionVia.addItem(name, "")
+ }
+ }
+ }
+
+ ListView {
+ id: list
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var targetTrans_items: new Object()
+ property var targetTrans_targetIndexes: new Array()
+ property var targetTrans_targetItems: new Array()
+
+ property var displacedTrans_items: new Object()
+ property var displacedTrans_targetIndexes: new Array()
+ property var displacedTrans_targetItems: new Array()
+
+ objectName: "list"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ add: Transition {
+ id: targetTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.targetTrans_items[targetTransition.ViewTransition.item.nameData] = targetTransition.ViewTransition.index
+ list.targetTrans_targetIndexes.push(targetTransition.ViewTransition.targetIndexes)
+ list.targetTrans_targetItems.push(list.copyList(targetTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: targetItems_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: targetItems_transitionFrom.y; duration: root.duration }
+ }
+
+ ScriptAction { script: list.targetTransitionsDone += 1 }
+ }
+ }
+
+ addDisplaced: Transition {
+ id: displaced
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.displacedTrans_items[displaced.ViewTransition.item.nameData] = displaced.ViewTransition.index
+ list.displacedTrans_targetIndexes.push(displaced.ViewTransition.targetIndexes)
+ list.displacedTrans_targetItems.push(list.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; duration: root.duration; to: displacedItems_transitionVia.x }
+ NumberAnimation { properties: "y"; duration: root.duration; to: displacedItems_transitionVia.y }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: list.displaceTransitionsDone += 1 }
+ }
+
+ }
+ }
+
+ Rectangle {
+ anchors.fill: list
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ // XXX will it pass without these if I just wait for polish?
+ // check all of these tests - if not, then mark this bit with the bug number!
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 100000 }
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/asyncloader.qml b/tests/auto/quick/qquicklistview/data/asyncloader.qml
new file mode 100644
index 0000000000..f038f0960c
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/asyncloader.qml
@@ -0,0 +1,36 @@
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 300; height: 400
+ color: "#2200FF00"
+
+ Loader {
+ asynchronous: true
+ sourceComponent: viewComp
+ anchors.fill: parent
+ }
+
+ Component {
+ id: viewComp
+ ListView {
+ objectName: "view"
+ width: 300; height: 400
+ model: 20
+ delegate: aDelegate
+
+ highlight: Rectangle { color: "lightsteelblue" }
+ }
+ }
+ // The delegate for each list
+ Component {
+ id: aDelegate
+ Item {
+ objectName: "wrapper"
+ width: 300
+ height: 50
+ Text { text: 'Index: ' + index }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/attachedSignals.qml b/tests/auto/quick/qquicklistview/data/attachedSignals.qml
new file mode 100644
index 0000000000..2c3c0bbada
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/attachedSignals.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+ListView {
+ id: view
+ width: 240; height: 320
+
+ property variant addedDelegates: []
+ property int removedDelegateCount
+
+ model: testModel
+
+ delegate: Rectangle {
+ width: 200; height: delegateHeight
+ border.width: 1
+ ListView.onAdd: {
+ var obj = ListView.view.addedDelegates
+ obj.push(model.name)
+ ListView.view.addedDelegates = obj
+ }
+ ListView.onRemove: {
+ view.removedDelegateCount += 1
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/creationContext.qml b/tests/auto/quick/qquicklistview/data/creationContext.qml
new file mode 100644
index 0000000000..79a682788b
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/creationContext.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+ComponentView {
+ title: "Hello!"
+}
diff --git a/tests/auto/quick/qquicklistview/data/destroyItemOnCreation.qml b/tests/auto/quick/qquicklistview/data/destroyItemOnCreation.qml
new file mode 100644
index 0000000000..12f43b029a
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/destroyItemOnCreation.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 240
+ height: 320
+
+ property int createdIndex: -1
+
+ Component {
+ id: myDelegate
+
+ Rectangle {
+ id: wrapper
+ width: 240; height: 20
+ objectName: "wrapper"
+
+ Text { text: index }
+
+ Component.onCompleted: {
+ root.createdIndex = index
+ ListView.view.model.removeItem(index)
+ }
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ delegate: myDelegate
+ model: testModel
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/displacedTransitions.qml b/tests/auto/quick/qquicklistview/data/displacedTransitions.qml
new file mode 100644
index 0000000000..d83ccfedf4
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/displacedTransitions.qml
@@ -0,0 +1,164 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: list.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text { text: index }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == displaced_transitionVia)
+ model_displaced_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == addDisplaced_transitionVia)
+ model_addDisplaced_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == moveDisplaced_transitionVia)
+ model_moveDisplaced_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == removeDisplaced_transitionVia)
+ model_removeDisplaced_transitionVia.addItem(name, "")
+ }
+ }
+ }
+
+ ListView {
+ id: list
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var displacedTargetIndexes: new Array()
+ property var displacedTargetItems: new Array()
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ objectName: "list"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ displaced: useDisplaced ? displaced : null
+ addDisplaced: useAddDisplaced ? addDisplaced : null
+ moveDisplaced: useMoveDisplaced ? moveDisplaced : null
+ removeDisplaced: useRemoveDisplaced ? removeDisplaced : null
+
+ Transition {
+ id: displaced
+ enabled: displacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.displacedTargetIndexes.push(displaced.ViewTransition.targetIndexes)
+ list.displacedTargetItems.push(list.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: displaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: displaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: list; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+
+ Transition {
+ id: addDisplaced
+ enabled: addDisplacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.displacedTargetIndexes.push(addDisplaced.ViewTransition.targetIndexes)
+ list.displacedTargetItems.push(list.copyList(addDisplaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: addDisplaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: addDisplaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: list; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+
+ Transition {
+ id: moveDisplaced
+ enabled: moveDisplacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.displacedTargetIndexes.push(moveDisplaced.ViewTransition.targetIndexes)
+ list.displacedTargetItems.push(list.copyList(moveDisplaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: moveDisplaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: moveDisplaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: list; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+
+ Transition {
+ id: removeDisplaced
+ enabled: removeDisplacedEnabled
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.displacedTargetIndexes.push(removeDisplaced.ViewTransition.targetIndexes)
+ list.displacedTargetItems.push(list.copyList(removeDisplaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: removeDisplaced_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: removeDisplaced_transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ PropertyAction { target: list; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: list
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/displaylist.qml b/tests/auto/quick/qquicklistview/data/displaylist.qml
new file mode 100644
index 0000000000..63c332bc0e
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/displaylist.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ property real delegateHeight: 20
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: root.delegateHeight
+ Behavior on height { NumberAnimation { duration: 200} }
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ objectName: "displayText"
+ text: display
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ },
+ Component {
+ id: myHighlight
+ Rectangle { color: "green" }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ highlight: myHighlight
+ highlightMoveVelocity: 1000
+ highlightResizeVelocity: 1000
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/emptymodel.qml b/tests/auto/quick/qquicklistview/data/emptymodel.qml
new file mode 100644
index 0000000000..16bcd3f9ae
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/emptymodel.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+Rectangle {
+ ListModel {
+ id: model
+ ListElement { name: "hello"}
+ }
+ ListView {
+ id: list
+ model: model
+ delegate: Item {
+ }
+ }
+ function remove() {
+ model.remove(0)
+ isCurrentItemNull = list.currentItem === null //check no seg fault
+ }
+
+ function add() {
+ model.append({name: "hello"})
+ isCurrentItemNull = list.currentItem === null
+ }
+ property bool isCurrentItemNull
+}
diff --git a/tests/auto/quick/qquicklistview/data/fillModelOnComponentCompleted.qml b/tests/auto/quick/qquicklistview/data/fillModelOnComponentCompleted.qml
new file mode 100644
index 0000000000..906e6adb6b
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/fillModelOnComponentCompleted.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ ListModel { id: testModel }
+
+ ListView {
+ id: list
+ objectName: "list"
+ width: parent.width
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ model: testModel
+
+ delegate: Text {
+ objectName: "wrapper"
+ font.pointSize: 20
+ text: index
+ }
+ footer: Rectangle {
+ width: parent.width
+ height: 40
+ color: "green"
+ }
+ header: Text { objectName: "header"; text: "Header" }
+ }
+
+ Component.onCompleted: {
+ if (setCurrentToZero == 0)
+ list.currentIndex = 0
+ for (var i=0; i<30; i++) testModel.append({"name" : i, "val": i})
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/flickBeyondBoundsBug.qml b/tests/auto/quick/qquicklistview/data/flickBeyondBoundsBug.qml
new file mode 100644
index 0000000000..01b9ce3396
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/flickBeyondBoundsBug.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: column.height
+ Column {
+ id: column
+ Text {
+ text: "index: " + index + ", delegate A"
+ Component.onCompleted: height = index % 2 ? 30 : 20
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ height: 25
+ }
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "#EEEEEE"
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: 2
+ delegate: myDelegate
+ highlightMoveVelocity: 1000
+ highlightResizeVelocity: 1000
+ cacheBuffer: 400
+ }
+ Text { anchors.bottom: parent.bottom; text: list.contentY }
+}
diff --git a/tests/auto/quick/qquicklistview/data/footer.qml b/tests/auto/quick/qquicklistview/data/footer.qml
new file mode 100644
index 0000000000..2a5619999e
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/footer.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+
+Rectangle {
+ property bool showHeader: false
+
+ function changeFooter() {
+ list.footer = footer2
+ }
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 40
+ Text {
+ text: index + " " + x + "," + y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ Component {
+ id: headerComponent
+ Text { objectName: "header"; text: "Header " + x + "," + y; width: 100; height: 30 }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ header: parent.showHeader ? headerComponent : null
+ footer: Text { objectName: "footer"; text: "Footer " + x + "," + y; width: 100; height: 30 }
+ }
+
+ Component {
+ id: footer2
+ Text { objectName: "footer2"; text: "Footer 2 " + x + "," + y; width: 50; height: 20 }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/header.qml b/tests/auto/quick/qquicklistview/data/header.qml
new file mode 100644
index 0000000000..076bf9cb97
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/header.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Rectangle {
+ function changeHeader() {
+ list.header = header2
+ }
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 30
+ width: 240
+ Text {
+ text: index + " " + parent.x + "," + parent.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: initialViewWidth
+ height: initialViewHeight
+ cacheBuffer: 0
+ snapMode: ListView.SnapToItem
+ model: testModel
+ delegate: myDelegate
+ header: Text { objectName: "header"; text: "Header " + x + "," + y; width: 100; height: 30 }
+ }
+ Component {
+ id: header2
+ Text { objectName: "header2"; text: "Header " + x + "," + y; width: 50; height: 20 }
+ }
+
+}
diff --git a/tests/auto/quick/qquicklistview/data/headerfooter.qml b/tests/auto/quick/qquicklistview/data/headerfooter.qml
new file mode 100644
index 0000000000..592e2ce6a5
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/headerfooter.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+ListView {
+ id: view
+
+ width: 240
+ height: 320
+
+ model: testModel
+
+ header: Rectangle {
+ objectName: "header"
+ width: orientation == ListView.Horizontal ? 20 : view.width
+ height: orientation == ListView.Horizontal ? view.height : 20
+ color: "red"
+ }
+ footer: Rectangle {
+ objectName: "footer"
+ width: orientation == ListView.Horizontal ? 30 : view.width
+ height: orientation == ListView.Horizontal ? view.height : 30
+ color: "blue"
+ }
+
+ delegate: Rectangle {
+ width: view.width
+ height: 30
+ Text { text: index + "(" + x + ")" }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/initialZValues.qml b/tests/auto/quick/qquicklistview/data/initialZValues.qml
new file mode 100644
index 0000000000..3a8e78debb
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/initialZValues.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+
+ ListView {
+ id: list
+
+ property real initialZ: 342
+
+ anchors.fill: parent
+ objectName: "list"
+ model: ListModel {}
+
+ delegate: Text {
+ objectName: "wrapper"
+ font.pointSize: 20
+ text: index
+ }
+
+ header: Rectangle {
+ width: 240
+ height: 30
+ z: list.initialZ
+ }
+
+ footer: Rectangle {
+ width: 240
+ height: 30
+ z: list.initialZ
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml b/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
new file mode 100644
index 0000000000..c0cc807bc0
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/itemlist-flicker.qml
@@ -0,0 +1,46 @@
+// This example demonstrates placing items in a view using
+// a VisualItemModel
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "lightgray"
+ width: 240
+ height: 320
+
+ VisualItemModel {
+ id: itemModel
+ objectName: "itemModel"
+ Rectangle {
+ objectName: "item1"
+ height: view.height / 3
+ width: view.width; color: "#FFFEF0"
+ Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: view.height / 3
+ width: view.width; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item3"
+ height: view.height / 3
+ width: view.width; color: "#F4F0FF"
+ Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ ListView {
+ id: view
+ objectName: "view"
+ anchors.fill: parent
+ anchors.bottomMargin: 30
+ model: itemModel
+ preferredHighlightBegin: 0
+ preferredHighlightEnd: 0
+ highlightRangeMode: "StrictlyEnforceRange"
+ orientation: ListView.Vertical
+ flickDeceleration: 2000
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/itemlist.qml b/tests/auto/quick/qquicklistview/data/itemlist.qml
new file mode 100644
index 0000000000..5c7ecdd5e8
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/itemlist.qml
@@ -0,0 +1,46 @@
+// This example demonstrates placing items in a view using
+// a VisualItemModel
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "lightgray"
+ width: 240
+ height: 320
+
+ VisualItemModel {
+ id: itemModel
+ objectName: "itemModel"
+ Rectangle {
+ objectName: "item1"
+ height: ListView.view ? ListView.view.height : 0
+ width: view.width; color: "#FFFEF0"
+ Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: ListView.view ? ListView.view.height : 0
+ width: view.width; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item3"
+ height: ListView.view ? ListView.view.height : 0
+ width: view.width; color: "#F4F0FF"
+ Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ ListView {
+ id: view
+ objectName: "view"
+ anchors.fill: parent
+ anchors.bottomMargin: 30
+ model: itemModel
+ preferredHighlightBegin: 0
+ preferredHighlightEnd: 0
+ highlightRangeMode: "StrictlyEnforceRange"
+ orientation: ListView.Horizontal
+ flickDeceleration: 2000
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listview-enforcerange-nohighlight.qml b/tests/auto/quick/qquicklistview/data/listview-enforcerange-nohighlight.qml
new file mode 100644
index 0000000000..1db1096499
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-enforcerange-nohighlight.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ color: "transparent"
+ 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
+ }
+ }
+ }
+
+ Rectangle { // current listview item should be always in this area
+ y: 100
+ height: 20
+ width: 240
+ color: "purple"
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ focus: true
+
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 100
+ highlightRangeMode: "StrictlyEnforceRange"
+
+ section.property: "number"
+ section.delegate: Rectangle { width: 240; height: 10; color: "lightsteelblue" }
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/listview-enforcerange.qml b/tests/auto/quick/qquicklistview/data/listview-enforcerange.qml
new file mode 100644
index 0000000000..f1052b1482
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-enforcerange.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ 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
+ }
+ }
+ }
+
+ Component {
+ id: myHighlight
+ Rectangle {
+ color: "lightsteelblue"
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+ highlight: myHighlight
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 100
+ highlightRangeMode: "StrictlyEnforceRange"
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listview-initCurrent.qml b/tests/auto/quick/qquicklistview/data/listview-initCurrent.qml
new file mode 100644
index 0000000000..a02b66b8af
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-initCurrent.qml
@@ -0,0 +1,64 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ property int current: list.currentIndex
+ property bool showHeader: false
+ property bool showFooter: false
+
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ]
+
+ Component {
+ id: headerFooter
+ Rectangle { height: 30; width: 240; color: "blue" }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ currentIndex: 20
+ width: 240
+ height: 320
+ keyNavigationWraps: testWrap
+ delegate: myDelegate
+ highlightMoveVelocity: 1000
+ model: testModel
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listview-noCurrent.qml b/tests/auto/quick/qquicklistview/data/listview-noCurrent.qml
new file mode 100644
index 0000000000..fa7430c4cb
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-noCurrent.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.0
+
+Rectangle {
+ property int current: list.currentIndex
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ currentIndex: -1
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ delegate: myDelegate
+ highlightMoveVelocity: 1000
+ model: testModel
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listview-sections-package.qml b/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
new file mode 100644
index 0000000000..e0daf50b32
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-sections-package.qml
@@ -0,0 +1,73 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Package {
+ Item {
+ id: wrapper
+ objectName: "wrapper"
+ height: ListView.previousSection != ListView.section ? 40 : 20;
+ width: 240
+ Package.name: "package"
+ Rectangle {
+ y: wrapper.ListView.previousSection != wrapper.ListView.section ? 20 : 0
+ height: 20
+ width: parent.width
+ color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 100
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ objectName: "nextSection"
+ x: 150
+ text: wrapper.ListView.nextSection
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ }
+ Rectangle {
+ color: "#99bb99"
+ height: wrapper.ListView.previousSection != wrapper.ListView.section ? 20 : 0
+ width: parent.width
+ visible: wrapper.ListView.previousSection != wrapper.ListView.section ? true : false
+ Text { text: wrapper.ListView.section }
+ }
+ }
+ }
+ },
+ VisualDataModel {
+ id: visualModel
+ model: testModel
+ delegate: myDelegate
+ }
+
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: visualModel.parts.package
+ section.property: "number"
+ cacheBuffer: 0
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listview-sections.qml b/tests/auto/quick/qquicklistview/data/listview-sections.qml
new file mode 100644
index 0000000000..d5b8a4400d
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-sections.qml
@@ -0,0 +1,64 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ objectName: "wrapper"
+ height: ListView.previousSection != ListView.section ? 40 : 20;
+ width: 240
+ Rectangle {
+ y: wrapper.ListView.previousSection != wrapper.ListView.section ? 20 : 0
+ height: 20
+ width: parent.width
+ color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 100
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ objectName: "nextSection"
+ x: 150
+ text: wrapper.ListView.nextSection
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ }
+ Rectangle {
+ color: "#99bb99"
+ height: wrapper.ListView.previousSection != wrapper.ListView.section ? 20 : 0
+ width: parent.width
+ visible: wrapper.ListView.previousSection != wrapper.ListView.section ? true : false
+ Text { text: wrapper.ListView.section }
+ }
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ section.property: "number"
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listview-sections_delegate.qml b/tests/auto/quick/qquicklistview/data/listview-sections_delegate.qml
new file mode 100644
index 0000000000..d82ff4c63a
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listview-sections_delegate.qml
@@ -0,0 +1,72 @@
+import QtQuick 2.0
+
+Rectangle {
+ property string sectionProperty: "number"
+ property int sectionPositioning: ViewSection.InlineLabels
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20;
+ width: 240
+ Rectangle {
+ height: 20
+ width: parent.width
+ color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 100
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ objectName: "nextSection"
+ x: 150
+ text: wrapper.ListView.nextSection
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ }
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "height"; to: 0; duration: 100; easing.type: Easing.InOutQuad }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+ }
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+ section.property: sectionProperty
+ section.delegate: Rectangle {
+ objectName: "sect_" + section
+ color: "#99bb99"
+ height: 20
+ width: list.width
+ Text { text: section + ", " + parent.y + ", " + parent.objectName }
+ }
+ section.labelPositioning: sectionPositioning
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listviewtest-package.qml b/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
new file mode 100644
index 0000000000..14d265162c
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listviewtest-package.qml
@@ -0,0 +1,145 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ property int count: list.count
+ property bool showHeader: false
+ property bool showFooter: false
+ property real hr: list.visibleArea.heightRatio
+ function heightRatio() {
+ return list.visibleArea.heightRatio
+ }
+
+ function checkProperties() {
+ testObject.error = false;
+ if (visualModel.model != testModel) {
+ console.log("model property incorrect");
+ testObject.error = true;
+ }
+ if (!testObject.animate && visualModel.delegate != myDelegate) {
+ console.log("delegate property incorrect - expected myDelegate");
+ testObject.error = true;
+ }
+ if (testObject.animate && visualModel.delegate != animatedDelegate) {
+ console.log("delegate property incorrect - expected animatedDelegate");
+ testObject.error = true;
+ }
+ if (testObject.invalidHighlight && list.highlight != invalidHl) {
+ console.log("highlight property incorrect - expected invalidHl");
+ testObject.error = true;
+ }
+ if (!testObject.invalidHighlight && list.highlight != myHighlight) {
+ console.log("highlight property incorrect - expected myHighlight");
+ testObject.error = true;
+ }
+ }
+ resources: [
+ Component {
+ id: myDelegate
+ Package {
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Package.name: "package"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ },
+ Component {
+ id: animatedDelegate
+ Package {
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Package.name: "package"
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+
+ }
+ }
+ }
+ },
+ Component {
+ id: myHighlight
+ Rectangle { color: "green" }
+ },
+ Component {
+ id: invalidHl
+ SmoothedAnimation {}
+ },
+ Component {
+ id: headerFooter
+ Rectangle { height: 30; width: 240; color: "blue" }
+ },
+ VisualDataModel {
+ id: visualModel
+
+ model: testModel
+ delegate: testObject.animate ? animatedDelegate : myDelegate
+ }
+
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: visualModel.parts.package
+ highlight: testObject.invalidHighlight ? invalidHl : myHighlight
+ highlightMoveVelocity: 1000
+ highlightResizeVelocity: 1000
+ cacheBuffer: testObject.cacheBuffer
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/listviewtest.qml b/tests/auto/quick/qquicklistview/data/listviewtest.qml
new file mode 100644
index 0000000000..159483a2d7
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/listviewtest.qml
@@ -0,0 +1,137 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ property int count: list.count
+ property bool showHeader: false
+ property bool showFooter: false
+ property bool enforceRange: false
+ property real hr: list.visibleArea.heightRatio
+ function heightRatio() {
+ return list.visibleArea.heightRatio
+ }
+
+ function checkProperties() {
+ testObject.error = false;
+ if (list.model != testModel) {
+ console.log("model property incorrect");
+ testObject.error = true;
+ }
+ if (!testObject.animate && list.delegate != myDelegate) {
+ console.log("delegate property incorrect - expected myDelegate");
+ testObject.error = true;
+ }
+ if (testObject.animate && list.delegate != animatedDelegate) {
+ console.log("delegate property incorrect - expected animatedDelegate");
+ testObject.error = true;
+ }
+ if (testObject.invalidHighlight && list.highlight != invalidHl) {
+ console.log("highlight property incorrect - expected invalidHl");
+ testObject.error = true;
+ }
+ if (!testObject.invalidHighlight && list.highlight != myHighlight) {
+ console.log("highlight property incorrect - expected myHighlight");
+ testObject.error = true;
+ }
+ }
+ resources: [
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "#EEEEEE"
+ }
+ },
+ Component {
+ id: animatedDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+
+ }
+ }
+ },
+ Component {
+ id: myHighlight
+ Rectangle { color: "green" }
+ },
+ Component {
+ id: invalidHl
+ SmoothedAnimation {}
+ },
+ Component {
+ id: headerFooter
+ Rectangle { height: 30; width: 240; color: "blue" }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: testObject.animate ? animatedDelegate : myDelegate
+ highlight: testObject.invalidHighlight ? invalidHl : myHighlight
+ highlightMoveVelocity: 1000
+ highlightResizeVelocity: 1000
+ preferredHighlightBegin: enforceRange ? 120 : 0
+ preferredHighlightEnd: enforceRange ? 120 : 0
+ highlightRangeMode: enforceRange ? ListView.StrictlyEnforceRange : ListView.NoHighlightRange
+ cacheBuffer: testObject.cacheBuffer
+ header: root.showHeader ? headerFooter : null
+ footer: root.showFooter ? headerFooter : null
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/manual-highlight.qml b/tests/auto/quick/qquicklistview/data/manual-highlight.qml
new file mode 100644
index 0000000000..aac4599f01
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/manual-highlight.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Item {
+
+ ListModel {
+ id: model
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bob Brown"
+ number: "555 5845"
+ }
+ }
+
+ Component {
+ id: highlight
+ Rectangle {
+ objectName: "highlight"
+ width: 180; height: 20
+ color: "lightsteelblue"; radius: 5
+ y: list.currentItem.y+5
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+ model: model
+ delegate: Text { objectName: "wrapper"; text: name }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+ }
+
+}
diff --git a/tests/auto/quick/qquicklistview/data/margins.qml b/tests/auto/quick/qquicklistview/data/margins.qml
new file mode 100644
index 0000000000..2d7b7ca59a
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/margins.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text {
+ text: index
+ }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 120
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+ topMargin: 30
+ bottomMargin: 50
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/margins2.qml b/tests/auto/quick/qquicklistview/data/margins2.qml
new file mode 100644
index 0000000000..4b1f2546bf
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/margins2.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ width: 200; height: 200
+ Page {
+ Rectangle {
+ anchors.fill: parent
+ color: "lightsteelblue"
+ }
+ ListView {
+ objectName: "listview"
+ topMargin: 40
+ bottomMargin: 20
+ leftMargin: 40
+ rightMargin: 20
+ anchors.fill: parent
+
+ model: 20
+ delegate: Rectangle {
+ color: "skyblue"
+ width: 60; height: 60
+ Text {
+ id: txt
+ text: "test" + index
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/moveTransitions.qml b/tests/auto/quick/qquicklistview/data/moveTransitions.qml
new file mode 100644
index 0000000000..c4dce99208
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/moveTransitions.qml
@@ -0,0 +1,142 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: list.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text { text: index }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == targetItems_transitionVia)
+ model_targetItems_transitionVia.addItem(name, "")
+ if (Qt.point(x, y) == displacedItems_transitionVia)
+ model_displacedItems_transitionVia.addItem(name, "")
+ }
+ }
+ }
+
+ ListView {
+ id: list
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var targetTrans_items: new Object()
+ property var targetTrans_targetIndexes: new Array()
+ property var targetTrans_targetItems: new Array()
+
+ property var displacedTrans_items: new Object()
+ property var displacedTrans_targetIndexes: new Array()
+ property var displacedTrans_targetItems: new Array()
+
+ objectName: "list"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ move: Transition {
+ id: targetTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.targetTrans_items[targetTransition.ViewTransition.item.nameData] = targetTransition.ViewTransition.index
+ list.targetTrans_targetIndexes.push(targetTransition.ViewTransition.targetIndexes)
+ list.targetTrans_targetItems.push(list.copyList(targetTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: targetItems_transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: targetItems_transitionVia.y; duration: root.duration }
+ }
+
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: list.targetTransitionsDone += 1 }
+ }
+ }
+
+ moveDisplaced: Transition {
+ id: displaced
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.displacedTrans_items[displaced.ViewTransition.item.nameData] = displaced.ViewTransition.index
+ list.displacedTrans_targetIndexes.push(displaced.ViewTransition.targetIndexes)
+ list.displacedTrans_targetItems.push(list.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ properties: "x"; duration: root.duration
+ to: displacedItems_transitionVia.x
+ }
+ NumberAnimation {
+ properties: "y"; duration: root.duration
+ to: displacedItems_transitionVia.y
+ }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: list.displaceTransitionsDone += 1 }
+ }
+
+ }
+ }
+
+ Rectangle {
+ anchors.fill: list
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 10000 }
+ }
+}
+
+
diff --git a/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml b/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml
new file mode 100644
index 0000000000..5893c30447
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/multipleDisplaced.qml
@@ -0,0 +1,79 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: list.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text { text: index }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ ListView {
+ id: list
+
+ property var displaceTransitionsStarted: new Object()
+ property bool displaceTransitionsDone: false
+
+ objectName: "list"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ displaced: Transition {
+ id: transition
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ var name = transition.ViewTransition.item.nameData
+ if (list.displaceTransitionsStarted[name] == undefined)
+ list.displaceTransitionsStarted[name] = 0
+ list.displaceTransitionsStarted[name] += 1
+ }
+ }
+ NumberAnimation {
+ properties: "x,y"
+ duration: root.duration
+ easing.type: Easing.OutBounce
+ easing.amplitude: 10.0 // longer-lasting bounce to trigger bug
+ }
+ PropertyAction { target: list; property: "displaceTransitionsDone"; value: true }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: list
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/multipleTransitions.qml b/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
new file mode 100644
index 0000000000..4fcc80be2d
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
@@ -0,0 +1,155 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ // time to pause between each add, remove, etc.
+ // (obviously, must be less than 'duration' value to actually test that
+ // interrupting transitions will still produce the correct result)
+ property int timeBetweenActions: duration / 2
+
+ property int duration: 100
+
+ property int count: list.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text { text: index }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ ListView {
+ id: list
+
+ property bool populateDone
+
+ property bool runningAddTargets: false
+ property bool runningAddDisplaced: false
+ property bool runningMoveTargets: false
+ property bool runningMoveDisplaced: false
+ property bool runningRemoveTargets: false
+ property bool runningRemoveDisplaced: false
+
+ objectName: "list"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ add: Transition {
+ id: addTargets
+ enabled: enableAddTransitions
+ SequentialAnimation {
+ ScriptAction { script: list.runningAddTargets = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: addTargets_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: addTargets_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: list.runningAddTargets = false }
+ }
+ }
+
+ addDisplaced: Transition {
+ id: addDisplaced
+ enabled: enableAddTransitions
+ SequentialAnimation {
+ ScriptAction { script: list.runningAddDisplaced = true }
+ PauseAnimation { duration: rippleAddDisplaced ? addDisplaced.ViewTransition.index * root.duration/10 : 0 }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: addDisplaced_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: addDisplaced_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: list.runningAddDisplaced = false }
+ }
+ }
+
+ move: Transition {
+ id: moveTargets
+ enabled: enableMoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: list.runningMoveTargets = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: moveTargets_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: moveTargets_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: list.runningMoveTargets = false }
+ }
+ }
+
+ moveDisplaced: Transition {
+ id: moveDisplaced
+ enabled: enableMoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: list.runningMoveDisplaced = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: moveDisplaced_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: moveDisplaced_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: list.runningMoveDisplaced = false }
+ }
+ }
+
+ remove: Transition {
+ id: removeTargets
+ enabled: enableRemoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: list.runningRemoveTargets = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: removeTargets_transitionTo.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: removeTargets_transitionTo.y; duration: root.duration }
+ }
+ ScriptAction { script: list.runningRemoveTargets = false }
+ }
+ }
+
+ removeDisplaced: Transition {
+ id: removeDisplaced
+ enabled: enableRemoveTransitions
+ SequentialAnimation {
+ ScriptAction { script: list.runningRemoveDisplaced = true }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: removeDisplaced_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: removeDisplaced_transitionFrom.y; duration: root.duration }
+ }
+ ScriptAction { script: list.runningRemoveDisplaced = false }
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: list
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 100000 }
+ }
+}
+
+
+
diff --git a/tests/auto/quick/qquicklistview/data/parentBinding.qml b/tests/auto/quick/qquicklistview/data/parentBinding.qml
new file mode 100644
index 0000000000..b56372888d
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/parentBinding.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+ListView {
+ width: 320; height: 480
+ model: ListModel {}
+ cacheBuffer: 300
+ delegate: Rectangle {
+ objectName: "wrapper"
+ width: parent.width
+ height: parent.parent.height/12
+ color: index % 2 ? "red" : "blue"
+ }
+ Component.onCompleted: {
+ for (var i = 0; i < 100; ++i)
+ model.append({"foo":"bar"+i})
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/populateTransitions.qml b/tests/auto/quick/qquicklistview/data/populateTransitions.qml
new file mode 100644
index 0000000000..84b5b6bc1f
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/populateTransitions.qml
@@ -0,0 +1,103 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: list.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text { text: index }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == transitionFrom)
+ model_transitionFrom.addItem(name, "")
+ if (Qt.point(x, y) == transitionVia) {
+ model_transitionVia.addItem(name, "")
+ }
+ }
+ }
+ }
+
+ ListView {
+ id: list
+
+ property int countPopulateTransitions
+ property int countAddTransitions
+
+ objectName: "list"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ populate: usePopulateTransition ? popTransition : null
+
+ add: Transition {
+ SequentialAnimation {
+ ScriptAction { script: list.countAddTransitions += 1 }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ }
+ }
+ }
+
+ Transition {
+ id: popTransition
+ SequentialAnimation {
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: transitionFrom.x; to: transitionVia.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: transitionFrom.y; to: transitionVia.y; duration: root.duration }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+ ScriptAction { script: list.countPopulateTransitions += 1 }
+ }
+ }
+
+
+ Rectangle {
+ anchors.fill: list
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Component.onCompleted: {
+ if (dynamicallyPopulate) {
+ for (var i=0; i<30; i++)
+ testModel.addItem("item " + i, "")
+ }
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 100000 }
+ }
+}
+
+
diff --git a/tests/auto/quick/qquicklistview/data/propertychangestest.qml b/tests/auto/quick/qquicklistview/data/propertychangestest.qml
new file mode 100644
index 0000000000..146f3f13b0
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/propertychangestest.qml
@@ -0,0 +1,71 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 180; height: 120; color: "white"
+ Component {
+ id: delegate
+ Item {
+ id: wrapper
+ width: 180; height: 40;
+ Column {
+ x: 5; y: 5
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+ Component {
+ id: highlightRed
+ Rectangle {
+ color: "red"
+ radius: 10
+ opacity: 0.5
+ }
+ }
+ ListView {
+ objectName: "listView"
+ anchors.fill: parent
+ model: listModel
+ delegate: delegate
+ highlight: highlightRed
+ focus: true
+ highlightFollowsCurrentItem: true
+ preferredHighlightBegin: 0.0
+ preferredHighlightEnd: 0.0
+ highlightRangeMode: ListView.ApplyRange
+ keyNavigationWraps: true
+ cacheBuffer: 10
+ snapMode: ListView.SnapToItem
+ }
+
+ data:[
+ ListModel {
+ id: listModel
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ },
+ ListModel {
+ objectName: "alternateModel"
+ ListElement {
+ name: "Jack"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Mary"
+ number: "555 3264"
+ }
+ }
+ ]
+}
+
+
diff --git a/tests/auto/quick/qquicklistview/data/qtbug-21742.qml b/tests/auto/quick/qquicklistview/data/qtbug-21742.qml
new file mode 100644
index 0000000000..774f9041fb
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug-21742.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Rectangle {
+ height: 200
+ width: 200
+ property int count: menuView.count
+
+ Component.onCompleted: { setModel(); }
+
+ function setModel()
+ {
+ menuModel.append({"enabledItem" : true});
+ menuView.currentIndex = 0;
+ }
+
+ ListModel {
+ id: menuModel
+ }
+
+ ListView {
+ id: menuView
+ anchors.fill: parent
+ model: menuModel
+ delegate: mything
+ }
+
+ Component {
+ id: mything
+ Rectangle {
+ height: 50
+ width: 200
+ color: index == menuView.currentIndex ? "green" : "blue"
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tests/auto/quick/qquicklistview/data/qtbug14821.qml b/tests/auto/quick/qquicklistview/data/qtbug14821.qml
new file mode 100644
index 0000000000..0a5e0acbb4
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug14821.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+ListView {
+ id: view
+ width: 300; height: 200
+ focus: true
+ keyNavigationWraps: true
+
+ model: 100
+
+ preferredHighlightBegin: 90
+ preferredHighlightEnd: 110
+
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlight: Component {
+ Rectangle {
+ border.color: "blue"
+ border.width: 3
+ color: "transparent"
+ width: 300; height: 15
+ }
+ }
+
+ delegate: Component {
+ Item {
+ height: 15 + (view.currentIndex == index ? 20 : 0)
+ width: 200
+ Text { text: 'Index: ' + index; anchors.verticalCenter: parent.verticalCenter }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/qtbug16037.qml b/tests/auto/quick/qquicklistview/data/qtbug16037.qml
new file mode 100644
index 0000000000..21faeb3f32
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug16037.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+
+ function setModel() {
+ listView.model = listModel1
+ }
+
+ ListModel {
+ id: listModel1
+ ListElement { text: "Apple" }
+ ListElement { text: "Banana" }
+ ListElement { text: "Orange" }
+ ListElement { text: "Coconut" }
+ }
+
+ Rectangle {
+ width: 200
+ height: listView.contentHeight
+ color: "yellow"
+ anchors.centerIn: parent
+
+ ListView {
+ id: listView
+ objectName: "listview"
+ anchors.fill: parent
+
+ delegate: Item {
+ width: 200
+ height: 20
+ Text { text: model.text; anchors.centerIn: parent }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/removeTransitions.qml b/tests/auto/quick/qquicklistview/data/removeTransitions.qml
new file mode 100644
index 0000000000..861cf42d94
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/removeTransitions.qml
@@ -0,0 +1,145 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 600
+
+ property int duration: 10
+ property int count: list.count
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+
+ property string nameData: name
+
+ objectName: "wrapper"
+ height: 20
+ width: 240
+ Text { text: index }
+ Text {
+ x: 30
+ id: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 200
+ text: wrapper.y
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+
+ onXChanged: checkPos()
+ onYChanged: checkPos()
+
+ function checkPos() {
+ if (Qt.point(x, y) == targetItems_transitionTo) {
+ model_targetItems_transitionTo.addItem(nameData, "") // name is invalid once model removes the item
+ }
+ if (Qt.point(x, y) == displacedItems_transitionVia) {
+ model_displacedItems_transitionVia.addItem(name, "")
+ }
+ }
+ }
+ }
+
+ ListView {
+ id: list
+
+ property int targetTransitionsDone
+ property int displaceTransitionsDone
+
+ property var targetTrans_items: new Object()
+ property var targetTrans_targetIndexes: new Array()
+ property var targetTrans_targetItems: new Array()
+
+ property var displacedTrans_items: new Object()
+ property var displacedTrans_targetIndexes: new Array()
+ property var displacedTrans_targetItems: new Array()
+
+ objectName: "list"
+ focus: true
+ anchors.centerIn: parent
+ width: 240
+ height: 320
+ cacheBuffer: 0
+ model: testModel
+ delegate: myDelegate
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ remove: Transition {
+ id: targetTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.targetTrans_items[targetTransition.ViewTransition.item.nameData] = targetTransition.ViewTransition.index
+ list.targetTrans_targetIndexes.push(targetTransition.ViewTransition.targetIndexes)
+ list.targetTrans_targetItems.push(list.copyList(targetTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; to: targetItems_transitionTo.x; duration: root.duration }
+ NumberAnimation { properties: "y"; to: targetItems_transitionTo.y; duration: root.duration }
+ }
+ ScriptAction { script: list.targetTransitionsDone += 1 }
+
+ // delay deleting this item so that it stays valid for the tests
+ // (this doesn't delay the test itself)
+ PauseAnimation { duration: 10000 }
+ }
+ }
+
+ removeDisplaced: Transition {
+ id: displaced
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ list.displacedTrans_items[displaced.ViewTransition.item.nameData] = displaced.ViewTransition.index
+ list.displacedTrans_targetIndexes.push(displaced.ViewTransition.targetIndexes)
+ list.displacedTrans_targetItems.push(list.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ properties: "x"; duration: root.duration
+ to: displacedItems_transitionVia.x
+ }
+ NumberAnimation {
+ properties: "y"; duration: root.duration
+ to: displacedItems_transitionVia.y
+ }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: list.displaceTransitionsDone += 1 }
+ }
+
+ }
+ }
+
+ Rectangle {
+ anchors.fill: list
+ color: "lightsteelblue"
+ opacity: 0.2
+ }
+
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: 20; height: 20
+ color: "white"
+ NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 10000 }
+ }
+}
+
+
diff --git a/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml b/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
new file mode 100644
index 0000000000..d79ca100f4
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/repositionResizedDelegate.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+
+ListView {
+ id: root
+
+ width: 200; height: 200
+
+ orientation: (testHorizontal == true) ? Qt.Horizontal : Qt.Vertical
+ layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
+ verticalLayoutDirection: (testBottomToTop == true) ? ListView.BottomToTop : ListView.TopToBottom
+
+ model: VisualItemModel {
+ Rectangle {
+ objectName: "red"
+ width: 200; height: 200; color: "red"
+ Text { text: parent.x + ", " + parent.y }
+ }
+ Grid {
+ id: grid
+ objectName: "positioner"
+ columns: root.orientation == Qt.Vertical ? 1 : 2
+ Repeater {
+ id: rpt
+ model: 1
+ Rectangle {
+ width: 120; height: 120; color: "orange"; border.width: 1
+ Column {
+ Text { text: grid.x + ", " + grid.y }
+ Text { text: index }
+ }
+ }
+ }
+ }
+ Rectangle {
+ objectName: "yellow"
+ width: 200; height: 200; color: "yellow"
+ Text { text: parent.x + ", " + parent.y }
+ }
+ }
+
+ focus: true
+
+ function incrementRepeater() {
+ rpt.model += 1
+ }
+
+ function decrementRepeater() {
+ rpt.model -= 1
+ }
+
+ Text { anchors.right: parent.right; anchors.bottom: parent.bottom; text: root.contentX + ", " + root.contentY }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/resizeview.qml b/tests/auto/quick/qquicklistview/data/resizeview.qml
new file mode 100644
index 0000000000..931e7b9949
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/resizeview.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 240
+ height: 240
+
+ property real initialHeight
+
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ cacheBuffer: 0
+ height: initialHeight
+ model: testModel
+ delegate: Rectangle {
+ objectName: "wrapper"
+ width: 240
+ height: 20
+ border.width: 1
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/rightToLeft.qml b/tests/auto/quick/qquicklistview/data/rightToLeft.qml
new file mode 100644
index 0000000000..6d77de26f4
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/rightToLeft.qml
@@ -0,0 +1,42 @@
+// This example demonstrates how item positioning
+// changes in right-to-left layout direction
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "lightgray"
+ width: 640
+ height: 320
+
+ VisualItemModel {
+ id: itemModel
+ objectName: "itemModel"
+ Rectangle {
+ objectName: "item1"
+ height: view.height; width: 100; color: "#FFFEF0"
+ Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: view.height; width: 200; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item3"
+ height: view.height; width: 240; color: "#F4F0FF"
+ Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ ListView {
+ id: view
+ objectName: "view"
+ anchors.fill: parent
+ anchors.bottomMargin: 30
+ model: itemModel
+ highlightRangeMode: "StrictlyEnforceRange"
+ orientation: ListView.Horizontal
+ flickDeceleration: 2000
+ layoutDirection: Qt.RightToLeft
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml b/tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml
new file mode 100644
index 0000000000..eee15ed2e0
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+
+ListView {
+ width: 240
+ height: 320
+
+ function switchDelegates() {
+ section.delegate = section.delegate === delegate1
+ ? delegate2
+ : delegate1
+ }
+
+ Component {
+ id: delegate1
+
+ Rectangle {
+ objectName: "section1"
+ color: "lightsteelblue"
+ border.width: 1;
+ width: 240
+ height: 25
+
+ Text {
+ anchors.centerIn: parent
+ text: section
+ }
+ }
+ }
+ Component {
+ id: delegate2
+
+ Rectangle {
+ objectName: "section2"
+ color: "yellow"
+ border.width: 1;
+ width: 240
+ height: 50
+
+ Text {
+ anchors.centerIn: parent
+ text: section
+ }
+ }
+ }
+
+ section.property: "modelData"
+ section.delegate: delegate1
+
+ model: 20
+ delegate: Rectangle {
+ objectName: "item"
+ border.width: 1
+ width: 240
+ height: 25
+
+ Text {
+ anchors.centerIn: parent
+ text: modelData
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/sectionpropertychange.qml b/tests/auto/quick/qquicklistview/data/sectionpropertychange.qml
new file mode 100644
index 0000000000..feb22404d0
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/sectionpropertychange.qml
@@ -0,0 +1,95 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320; height: 480
+
+ Rectangle {
+ id: groupButtons
+ width: 300; height: 30
+ color: "yellow"
+ border.width: 1
+ Text {
+ anchors.centerIn: parent
+ text: "swap"
+ }
+ anchors {
+ top: parent.top
+ horizontalCenter: parent.horizontalCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: switchGroups()
+ }
+ }
+
+ function switchGroups() {
+ myListView.model.move(0,1,1)
+ if ("title" === myListView.groupBy)
+ myListView.groupBy = "genre"
+ else
+ myListView.groupBy = "title"
+ }
+
+ function switchGrouped() {
+ if ("pageCount" === myListView.groupBy)
+ myListView.groupBy = "genre"
+ else
+ myListView.groupBy = "pageCount"
+ }
+
+ Component.onCompleted: {
+ myListView.model = generateModel(myListView)
+ }
+
+ ListView {
+ id: myListView
+ objectName: "list"
+
+ clip: true
+ property string groupBy: "title"
+
+ anchors {
+ top: groupButtons.bottom
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+
+ delegate: Item {
+ objectName: "wrapper"
+ height: 50
+ width: 320
+ Text { id: t; text: model.title }
+ Text { text: model.author; font.pixelSize: 10; anchors.top: t.bottom }
+ Text { text: parent.y; anchors.right: parent.right }
+ }
+
+ section {
+ criteria: ViewSection.FullString
+ delegate: Rectangle { width: 320; height: 25; color: "lightblue"
+ objectName: "sect"
+ Text {text: section }
+ Text { text: parent.y; anchors.right: parent.right }
+ }
+ property: myListView.groupBy
+ }
+ }
+
+ function generateModel(theParent)
+ {
+ var books = [
+ { "author": "Billy Bob", "genre": "Anarchism", "title": "Frogs and Love", "pageCount": 80 },
+ { "author": "Lefty Smith", "genre": "Horror", "title": "Chainsaws for Noobs", "pageCount": 80 }
+ ];
+
+ var model = Qt.createQmlObject("import QtQuick 2.0; ListModel {}", theParent);
+
+ for (var i = 0; i < books.length; ++i) {
+ var book = books[i];
+ model.append(book);
+ }
+ return model;
+ }
+
+}
+
diff --git a/tests/auto/quick/qquicklistview/data/sizelessthan1.qml b/tests/auto/quick/qquicklistview/data/sizelessthan1.qml
new file mode 100644
index 0000000000..aa9dc20ae9
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/sizelessthan1.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 0.5
+ width: 240
+ color: ((index % 2) == 1 ? "red" : "blue")
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ focus: true
+ width: 240
+ height: 320
+ model: testModel
+ delegate: myDelegate
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/snapOneItem.qml b/tests/auto/quick/qquicklistview/data/snapOneItem.qml
new file mode 100644
index 0000000000..d67d8040ca
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/snapOneItem.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 240
+ color: "#ffffff"
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 200
+ width: 200
+ Column {
+ Text {
+ text: index
+ }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "transparent"
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+ preferredHighlightBegin: 20
+ preferredHighlightEnd: 220
+ snapMode: ListView.SnapOneItem
+ orientation: ListView.Horizontal
+ layoutDirection: Qt.RightToLeft
+ highlightRangeMode: ListView.StrictlyEnforceRange
+// highlightRangeMode: ListView.NoHighlightRange
+ highlight: Rectangle { width: 200; height: 200; color: "yellow" }
+ flickDeceleration: 200 // encourages long flick
+ model: 4
+ delegate: myDelegate
+ }
+
+ Text {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ text: list.contentX + ", " + list.contentY
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/snapToItem.qml b/tests/auto/quick/qquicklistview/data/snapToItem.qml
new file mode 100644
index 0000000000..91d31adfc7
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/snapToItem.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 240
+ height: 240
+ color: "#ffffff"
+
+ Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 80
+ width: 80
+ Column {
+ Text {
+ text: index
+ }
+ Text {
+ text: wrapper.x + ", " + wrapper.y
+ }
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "transparent"
+ }
+ }
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+// preferredHighlightBegin: 20
+// preferredHighlightEnd: 100
+ preferredHighlightBegin: 20
+ preferredHighlightEnd: 100
+ snapMode: ListView.SnapToItem
+ orientation: ListView.Horizontal
+ layoutDirection: Qt.RightToLeft
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlight: Rectangle { width: 80; height: 80; color: "yellow" }
+ model: 10
+ delegate: myDelegate
+ }
+
+ Text {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ text: list.contentX + ", " + list.contentY
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/data/strictlyenforcerange.qml b/tests/auto/quick/qquicklistview/data/strictlyenforcerange.qml
new file mode 100644
index 0000000000..7960ac4abb
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/strictlyenforcerange.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+ListView {
+ id: list
+ objectName: "list"
+ width: 320
+ height: 480
+
+ function fillModel() {
+ list.model.append({"col": "red"});
+ list.currentIndex = list.count-1
+ list.model.append({"col": "blue"});
+ list.currentIndex = list.count-1
+ list.model.append({"col": "green"});
+ list.currentIndex = list.count-1
+ }
+
+ model: ListModel { id: listModel } // empty model
+ delegate: Rectangle { id: wrapper; objectName: "wrapper"; color: col; width: 300; height: 400 }
+ orientation: "Horizontal"
+ snapMode: "SnapToItem"
+ cacheBuffer: 1000
+
+ preferredHighlightBegin: 10
+ preferredHighlightEnd: 10
+
+ highlightRangeMode: "StrictlyEnforceRange"
+ focus: true
+}
diff --git a/tests/auto/quick/qquicklistview/data/unrequestedItems.qml b/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
new file mode 100644
index 0000000000..e3719a8be0
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/unrequestedItems.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+
+Item {
+ width: 240
+ height: 320
+
+ Component {
+ id: myDelegate
+
+ Package {
+ Rectangle {
+ id: leftWrapper
+ objectName: "wrapper"
+ Package.name: "left"
+ height: 20
+ width: 120
+ Text {
+ text: index
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ Rectangle {
+ id: rightWrapper
+ objectName: "wrapper"
+ Package.name: "right"
+ height: 20
+ width: 120
+ Text {
+ text: index
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ }
+
+ VisualDataModel {
+ id: visualModel
+
+ delegate: myDelegate
+ model: testModel
+ }
+
+ ListView {
+ id: leftList
+ objectName: "leftList"
+ cacheBuffer: 0
+ anchors {
+ left: parent.left; top: parent.top;
+ right: parent.horizontalCenter; bottom: parent.bottom
+ }
+ model: visualModel.parts.left
+ }
+
+ ListView {
+ id: rightList
+ objectName: "rightList"
+ cacheBuffer: 0
+ anchors {
+ left: parent.horizontalCenter; top: parent.top;
+ right: parent.right; bottom: parent.bottom
+ }
+ model: visualModel.parts.right
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/incrementalmodel.cpp b/tests/auto/quick/qquicklistview/incrementalmodel.cpp
new file mode 100644
index 0000000000..473d52eb28
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/incrementalmodel.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "incrementalmodel.h"
+#include <QGuiApplication>
+#include <QDebug>
+
+IncrementalModel::IncrementalModel(QObject *parent)
+ : QAbstractListModel(parent), count(0)
+{
+ for (int i = 0; i < 100; ++i)
+ list.append("Item " + QString::number(i));
+}
+
+int IncrementalModel::rowCount(const QModelIndex & /* parent */) const
+{
+ return count;
+}
+
+QVariant IncrementalModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ if (index.row() >= list.size() || index.row() < 0)
+ return QVariant();
+
+ if (role == Qt::DisplayRole)
+ return list.at(index.row());
+ return QVariant();
+}
+
+bool IncrementalModel::canFetchMore(const QModelIndex & /* index */) const
+{
+ if (count < list.size())
+ return true;
+ else
+ return false;
+}
+
+void IncrementalModel::fetchMore(const QModelIndex & /* index */)
+{
+ int remainder = list.size() - count;
+ int itemsToFetch = qMin(5, remainder);
+
+ beginInsertRows(QModelIndex(), count, count+itemsToFetch-1);
+
+ count += itemsToFetch;
+
+ endInsertRows();
+}
diff --git a/tests/auto/quick/qquicklistview/incrementalmodel.h b/tests/auto/quick/qquicklistview/incrementalmodel.h
new file mode 100644
index 0000000000..32d9702117
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/incrementalmodel.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef IncrementalModel_H
+#define IncrementalModel_H
+
+#include <QAbstractListModel>
+#include <QList>
+#include <QStringList>
+
+class IncrementalModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+public:
+ IncrementalModel(QObject *parent = 0);
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+protected:
+ bool canFetchMore(const QModelIndex &parent) const;
+ void fetchMore(const QModelIndex &parent);
+
+private:
+ QStringList list;
+ int count;
+};
+
+#endif
diff --git a/tests/auto/quick/qquicklistview/qquicklistview.pro b/tests/auto/quick/qquicklistview/qquicklistview.pro
new file mode 100644
index 0000000000..b0b1fc2518
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/qquicklistview.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+testcase.timeout = 900 # this test is slow
+TARGET = tst_qquicklistview
+macx:CONFIG -= app_bundle
+
+HEADERS += incrementalmodel.h
+SOURCES += tst_qquicklistview.cpp \
+ incrementalmodel.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private v8-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+mac:CONFIG += insignificant_test # QTBUG-27740
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
new file mode 100644
index 0000000000..f8c7de6635
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -0,0 +1,6837 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtCore/QStringListModel>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlincubator.h>
+#include <QtQuick/private/qquicklistview_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQml/private/qqmlobjectmodel_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
+#include "../../shared/util.h"
+#include "../shared/viewtestutil.h"
+#include "../shared/visualtestutil.h"
+#include "incrementalmodel.h"
+#include <math.h>
+
+Q_DECLARE_METATYPE(Qt::LayoutDirection)
+Q_DECLARE_METATYPE(QQuickItemView::VerticalLayoutDirection)
+Q_DECLARE_METATYPE(QQuickItemView::PositionMode)
+Q_DECLARE_METATYPE(QQuickListView::Orientation)
+Q_DECLARE_METATYPE(Qt::Key)
+
+using namespace QQuickViewTestUtil;
+using namespace QQuickVisualTestUtil;
+
+#define SHARE_VIEWS
+
+class tst_QQuickListView : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickListView();
+
+private slots:
+ void init();
+ void cleanupTestCase();
+ // Test QAbstractItemModel model types
+ void qAbstractItemModel_package_items();
+ void qAbstractItemModel_items();
+
+ void qAbstractItemModel_package_changed();
+ void qAbstractItemModel_changed();
+
+ void qAbstractItemModel_package_inserted();
+ void qAbstractItemModel_inserted();
+ void qAbstractItemModel_inserted_more();
+ void qAbstractItemModel_inserted_more_data();
+ void qAbstractItemModel_inserted_more_bottomToTop();
+ void qAbstractItemModel_inserted_more_bottomToTop_data();
+
+ void qAbstractItemModel_package_removed();
+ void qAbstractItemModel_removed();
+ void qAbstractItemModel_removed_more();
+ void qAbstractItemModel_removed_more_data();
+ void qAbstractItemModel_removed_more_bottomToTop();
+ void qAbstractItemModel_removed_more_bottomToTop_data();
+
+ void qAbstractItemModel_package_moved();
+ void qAbstractItemModel_package_moved_data();
+ void qAbstractItemModel_moved();
+ void qAbstractItemModel_moved_data();
+ void qAbstractItemModel_moved_bottomToTop();
+ void qAbstractItemModel_moved_bottomToTop_data();
+
+ void multipleChanges_condensed() { multipleChanges(true); }
+ void multipleChanges_condensed_data() { multipleChanges_data(); }
+ void multipleChanges_uncondensed() { multipleChanges(false); }
+ void multipleChanges_uncondensed_data() { multipleChanges_data(); }
+
+ void qAbstractItemModel_package_clear();
+ void qAbstractItemModel_clear();
+ void qAbstractItemModel_clear_bottomToTop();
+
+ void insertBeforeVisible();
+ void insertBeforeVisible_data();
+ void swapWithFirstItem();
+ void itemList();
+ void itemListFlicker();
+ void currentIndex_delayedItemCreation();
+ void currentIndex_delayedItemCreation_data();
+ void currentIndex();
+ void noCurrentIndex();
+ void keyNavigation();
+ void keyNavigation_data();
+ void enforceRange();
+ void enforceRange_withoutHighlight();
+ void spacing();
+ void qAbstractItemModel_package_sections();
+ void qAbstractItemModel_sections();
+ void sectionsPositioning();
+ void sectionsDelegate();
+ void sectionsDragOutsideBounds_data();
+ void sectionsDragOutsideBounds();
+ void sectionsDelegate_headerVisibility();
+ void sectionPropertyChange();
+ void sectionDelegateChange();
+ void cacheBuffer();
+ void positionViewAtBeginningEnd();
+ void positionViewAtIndex();
+ void positionViewAtIndex_data();
+ void resetModel();
+ void propertyChanges();
+ void componentChanges();
+ void modelChanges();
+ void manualHighlight();
+ void initialZValues();
+ void header();
+ void header_data();
+ void header_delayItemCreation();
+ void footer();
+ void footer_data();
+ void extents();
+ void extents_data();
+ void resetModel_headerFooter();
+ void resizeView();
+ void resizeViewAndRepaint();
+ void sizeLessThan1();
+ void QTBUG_14821();
+ void resizeDelegate();
+ void resizeFirstDelegate();
+ void repositionResizedDelegate();
+ void repositionResizedDelegate_data();
+ void QTBUG_16037();
+ void indexAt_itemAt_data();
+ void indexAt_itemAt();
+ void incrementalModel();
+ void onAdd();
+ void onAdd_data();
+ void onRemove();
+ void onRemove_data();
+ void rightToLeft();
+ void test_mirroring();
+ void margins();
+ void marginsResize();
+ void marginsResize_data();
+ void creationContext();
+ void snapToItem_data();
+ void snapToItem();
+ void snapOneItem_data();
+ void snapOneItem();
+
+ void QTBUG_9791();
+ void QTBUG_11105();
+ void QTBUG_21742();
+
+ void asynchronous();
+ void unrequestedVisibility();
+
+ void populateTransitions();
+ void populateTransitions_data();
+ void addTransitions();
+ void addTransitions_data();
+ void moveTransitions();
+ void moveTransitions_data();
+ void removeTransitions();
+ void removeTransitions_data();
+ void displacedTransitions();
+ void displacedTransitions_data();
+ void multipleTransitions();
+ void multipleTransitions_data();
+ void multipleDisplaced();
+
+ void flickBeyondBounds();
+ void destroyItemOnCreation();
+
+ void parentBinding();
+ void defaultHighlightMoveDuration();
+ void accessEmptyCurrentItem_QTBUG_30227();
+
+private:
+ template <class T> void items(const QUrl &source, bool forceLayout);
+ template <class T> void changed(const QUrl &source, bool forceLayout);
+ template <class T> void inserted(const QUrl &source);
+ template <class T> void inserted_more(QQuickItemView::VerticalLayoutDirection verticalLayoutDirection = QQuickItemView::TopToBottom);
+ template <class T> void removed(const QUrl &source, bool animated);
+ template <class T> void removed_more(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection = QQuickItemView::TopToBottom);
+ template <class T> void moved(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection = QQuickItemView::TopToBottom);
+ template <class T> void clear(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection = QQuickItemView::TopToBottom);
+ template <class T> void sections(const QUrl &source);
+
+ void multipleChanges(bool condensed);
+ void multipleChanges_data();
+
+ QList<int> toIntList(const QVariantList &list);
+ void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes);
+ void matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes);
+ void matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems);
+
+ void inserted_more_data();
+ void removed_more_data();
+ void moved_data();
+
+#ifdef SHARE_VIEWS
+ QQuickView *getView() {
+ if (m_view) {
+ if (QString(QTest::currentTestFunction()) != testForView) {
+ delete m_view;
+ m_view = 0;
+ } else {
+ m_view->setSource(QUrl());
+ return m_view;
+ }
+ }
+
+ testForView = QTest::currentTestFunction();
+ m_view = createView();
+ return m_view;
+ }
+ void releaseView(QQuickView *view) {
+ Q_ASSERT(view == m_view);
+ m_view->setSource(QUrl());
+ }
+#else
+ QQuickView *getView() {
+ return createView();
+ }
+ void releaseView(QQuickView *view) {
+ delete view;
+ }
+#endif
+
+ QQuickView *m_view;
+ QString testForView;
+};
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(bool error READ error WRITE setError NOTIFY changedError)
+ Q_PROPERTY(bool animate READ animate NOTIFY changedAnim)
+ Q_PROPERTY(bool invalidHighlight READ invalidHighlight NOTIFY changedHl)
+ Q_PROPERTY(int cacheBuffer READ cacheBuffer NOTIFY changedCacheBuffer)
+
+public:
+ TestObject(QObject *parent = 0)
+ : QObject(parent), mError(true), mAnimate(false), mInvalidHighlight(false)
+ , mCacheBuffer(0) {}
+
+ bool error() const { return mError; }
+ void setError(bool err) { mError = err; emit changedError(); }
+
+ bool animate() const { return mAnimate; }
+ void setAnimate(bool anim) { mAnimate = anim; emit changedAnim(); }
+
+ bool invalidHighlight() const { return mInvalidHighlight; }
+ void setInvalidHighlight(bool invalid) { mInvalidHighlight = invalid; emit changedHl(); }
+
+ int cacheBuffer() const { return mCacheBuffer; }
+ void setCacheBuffer(int buffer) { mCacheBuffer = buffer; emit changedCacheBuffer(); }
+
+signals:
+ void changedError();
+ void changedAnim();
+ void changedHl();
+ void changedCacheBuffer();
+
+public:
+ bool mError;
+ bool mAnimate;
+ bool mInvalidHighlight;
+ int mCacheBuffer;
+};
+
+tst_QQuickListView::tst_QQuickListView() : m_view(0)
+{
+}
+
+void tst_QQuickListView::init()
+{
+#ifdef SHARE_VIEWS
+ if (m_view && QString(QTest::currentTestFunction()) != testForView) {
+ testForView = QString();
+ delete m_view;
+ m_view = 0;
+ }
+#endif
+}
+
+void tst_QQuickListView::cleanupTestCase()
+{
+#ifdef SHARE_VIEWS
+ testForView = QString();
+ delete m_view;
+ m_view = 0;
+#endif
+}
+
+template <class T>
+void tst_QQuickListView::items(const QUrl &source, bool forceLayout)
+{
+ QQuickView *window = createView();
+
+ T model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(source);
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QTRY_VERIFY(testObject->error() == false);
+
+ QTRY_VERIFY(listview->highlightItem() != 0);
+ QTRY_COMPARE(listview->count(), model.count());
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
+
+ // current item should be first item
+ QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0));
+
+ for (int i = 0; i < model.count(); ++i) {
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ // switch to other delegate
+ testObject->setAnimate(true);
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QTRY_VERIFY(testObject->error() == false);
+ QTRY_VERIFY(listview->currentItem());
+
+ // set invalid highlight
+ testObject->setInvalidHighlight(true);
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QTRY_VERIFY(testObject->error() == false);
+ QTRY_VERIFY(listview->currentItem());
+ QTRY_VERIFY(listview->highlightItem() == 0);
+
+ // back to normal highlight
+ testObject->setInvalidHighlight(false);
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QTRY_VERIFY(testObject->error() == false);
+ QTRY_VERIFY(listview->currentItem());
+ QTRY_VERIFY(listview->highlightItem() != 0);
+
+ // set an empty model and confirm that items are destroyed
+ T model2;
+ ctxt->setContextProperty("testModel", &model2);
+
+ // Force a layout, necessary if ListView is completed before VisualDataModel.
+ if (forceLayout)
+ QCOMPARE(listview->property("count").toInt(), 0);
+
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ QTRY_VERIFY(itemCount == 0);
+
+ QTRY_COMPARE(listview->highlightResizeVelocity(), 1000.0);
+ QTRY_COMPARE(listview->highlightMoveVelocity(), 1000.0);
+
+ delete window;
+ delete testObject;
+}
+
+
+template <class T>
+void tst_QQuickListView::changed(const QUrl &source, bool forceLayout)
+{
+ QQuickView *window = createView();
+
+ T model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(source);
+ qApp->processEvents();
+
+ QQuickFlickable *listview = findItem<QQuickFlickable>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // Force a layout, necessary if ListView is completed before VisualDataModel.
+ if (forceLayout)
+ QCOMPARE(listview->property("count").toInt(), model.count());
+
+ model.modifyItem(1, "Will", "9876");
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(1));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(1));
+
+ delete window;
+ delete testObject;
+}
+
+template <class T>
+void tst_QQuickListView::inserted(const QUrl &source)
+{
+ QQuickView *window = createView();
+ window->show();
+
+ T model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(source);
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ model.insertItem(1, "Will", "9876");
+
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(1));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(1));
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_COMPARE(item->y(), i*20.0);
+ }
+
+ model.insertItem(0, "Foo", "1111"); // zero index, and current item
+
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+ QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
+
+ name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(0));
+ number = findItem<QQuickText>(contentItem, "textNumber", 0);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(0));
+
+ QTRY_COMPARE(listview->currentIndex(), 1);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_COMPARE(item->y(), i*20.0);
+ }
+
+ for (int i = model.count(); i < 30; ++i)
+ model.insertItem(i, "Hello", QString::number(i));
+
+ listview->setContentY(80);
+
+ // Insert item outside visible area
+ model.insertItem(1, "Hello", "1324");
+
+ QTRY_VERIFY(listview->contentY() == 80);
+
+ // Confirm items positioned correctly
+ for (int i = 5; i < 5+15; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.0 - 20.0);
+ }
+
+// QTRY_COMPARE(listview->contentItemHeight(), model.count() * 20.0);
+
+ // QTBUG-19675
+ model.clear();
+ model.insertItem(0, "Hello", "1234");
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->y(), 0.);
+ QTRY_VERIFY(listview->contentY() == 0);
+
+ delete window;
+ delete testObject;
+}
+
+template <class T>
+void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection verticalLayoutDirection)
+{
+ QFETCH(qreal, contentY);
+ QFETCH(int, insertIndex);
+ QFETCH(int, insertCount);
+ QFETCH(qreal, itemsOffsetAfterMove);
+
+ T model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ bool waitForPolish = (contentY != 0);
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop) {
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ contentY = -listview->height() - contentY;
+ }
+ listview->setContentY(contentY);
+ if (waitForPolish)
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QList<QPair<QString, QString> > newData;
+ for (int i=0; i<insertCount; i++)
+ newData << qMakePair(QString("value %1").arg(i), QString::number(i));
+ model.insertItems(insertIndex, newData);
+ QTRY_COMPARE(listview->property("count").toInt(), model.count());
+
+ // check visibleItems.first() is in correct position
+ QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item0);
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop)
+ QCOMPARE(item0->y(), -item0->height() - itemsOffsetAfterMove);
+ else
+ QCOMPARE(item0->y(), itemsOffsetAfterMove);
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (item && !QQuickItemPrivate::get(item)->culled) {
+ firstVisibleIndex = i;
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // Confirm items positioned correctly and indexes correct
+ QQuickText *name;
+ QQuickText *number;
+ for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ qreal pos = i*20.0 + itemsOffsetAfterMove;
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop)
+ pos = -item0->height() - pos;
+ QTRY_COMPARE(item->y(), pos);
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QVERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::inserted_more_data()
+{
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<int>("insertIndex");
+ QTest::addColumn<int>("insertCount");
+ QTest::addColumn<qreal>("itemsOffsetAfterMove");
+
+ QTest::newRow("add 1, before visible items")
+ << 80.0 // show 4-19
+ << 3 << 1
+ << -20.0; // insert above first visible i.e. 0 is at -20, first visible should not move
+
+ QTest::newRow("add multiple, before visible")
+ << 80.0 // show 4-19
+ << 3 << 3
+ << -20.0 * 3; // again first visible should not move
+
+ QTest::newRow("add 1, at start of visible, content at start")
+ << 0.0
+ << 0 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, start of visible, content at start")
+ << 0.0
+ << 0 << 3
+ << 0.0;
+
+ QTest::newRow("add 1, at start of visible, content not at start")
+ << 80.0 // show 4-19
+ << 4 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, at start of visible, content not at start")
+ << 80.0 // show 4-19
+ << 4 << 3
+ << 0.0;
+
+
+ QTest::newRow("add 1, at end of visible, content at start")
+ << 0.0
+ << 15 << 1
+ << 0.0;
+
+ QTest::newRow("add 1, at end of visible, content at start")
+ << 0.0
+ << 15 << 3
+ << 0.0;
+
+ QTest::newRow("add 1, at end of visible, content not at start")
+ << 80.0 // show 4-19
+ << 19 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, at end of visible, content not at start")
+ << 80.0 // show 4-19
+ << 19 << 3
+ << 0.0;
+
+
+ QTest::newRow("add 1, after visible, content at start")
+ << 0.0
+ << 16 << 1
+ << 0.0;
+
+ QTest::newRow("add 1, after visible, content at start")
+ << 0.0
+ << 16 << 3
+ << 0.0;
+
+ QTest::newRow("add 1, after visible, content not at start")
+ << 80.0 // show 4-19
+ << 20 << 1
+ << 0.0;
+
+ QTest::newRow("add multiple, after visible, content not at start")
+ << 80.0 // show 4-19
+ << 20 << 3
+ << 0.0;
+}
+
+void tst_QQuickListView::insertBeforeVisible()
+{
+ QFETCH(int, insertIndex);
+ QFETCH(int, insertCount);
+ QFETCH(int, cacheBuffer);
+
+ QQuickText *name;
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ listview->setCacheBuffer(cacheBuffer);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // trigger a refill (not just setting contentY) so that the visibleItems grid is updated
+ int firstVisibleIndex = 20; // move to an index where the top item is not visible
+ listview->setContentY(firstVisibleIndex * 20.0);
+ listview->setCurrentIndex(firstVisibleIndex);
+
+ qApp->processEvents();
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_COMPARE(listview->currentIndex(), firstVisibleIndex);
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", firstVisibleIndex);
+ QVERIFY(item);
+ QCOMPARE(item->y(), listview->contentY());
+
+ QList<QPair<QString, QString> > newData;
+ for (int i=0; i<insertCount; i++)
+ newData << qMakePair(QString("value %1").arg(i), QString::number(i));
+ model.insertItems(insertIndex, newData);
+ QTRY_COMPARE(listview->property("count").toInt(), model.count());
+
+ // now, moving to the top of the view should position the inserted items correctly
+ int itemsOffsetAfterMove = -(insertCount * 20);
+ listview->setCurrentIndex(0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_COMPARE(listview->currentIndex(), 0);
+ QTRY_COMPARE(listview->contentY(), 0.0 + itemsOffsetAfterMove);
+
+ // Confirm items positioned correctly and indexes correct
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->y(), i*20.0 + itemsOffsetAfterMove);
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::insertBeforeVisible_data()
+{
+ QTest::addColumn<int>("insertIndex");
+ QTest::addColumn<int>("insertCount");
+ QTest::addColumn<int>("cacheBuffer");
+
+ QTest::newRow("insert 1 at 0, 0 buffer") << 0 << 1 << 0;
+ QTest::newRow("insert 1 at 0, 100 buffer") << 0 << 1 << 100;
+ QTest::newRow("insert 1 at 0, 500 buffer") << 0 << 1 << 500;
+
+ QTest::newRow("insert 1 at 1, 0 buffer") << 1 << 1 << 0;
+ QTest::newRow("insert 1 at 1, 100 buffer") << 1 << 1 << 100;
+ QTest::newRow("insert 1 at 1, 500 buffer") << 1 << 1 << 500;
+
+ QTest::newRow("insert multiple at 0, 0 buffer") << 0 << 3 << 0;
+ QTest::newRow("insert multiple at 0, 100 buffer") << 0 << 3 << 100;
+ QTest::newRow("insert multiple at 0, 500 buffer") << 0 << 3 << 500;
+
+ QTest::newRow("insert multiple at 1, 0 buffer") << 1 << 3 << 0;
+ QTest::newRow("insert multiple at 1, 100 buffer") << 1 << 3 << 100;
+ QTest::newRow("insert multiple at 1, 500 buffer") << 1 << 3 << 500;
+}
+
+template <class T>
+void tst_QQuickListView::removed(const QUrl &source, bool /* animated */)
+{
+ QQuickView *window = createView();
+
+ T model;
+ for (int i = 0; i < 50; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(source);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ model.removeItem(1);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(1));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(1));
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*20);
+ }
+
+ // Remove first item (which is the current item);
+ model.removeItem(0);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(0));
+ number = findItem<QQuickText>(contentItem, "textNumber", 0);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(0));
+
+ // Confirm items positioned correctly
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(),i*20.0);
+ }
+
+ // Remove items not visible
+ model.removeItem(18);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ // Confirm items positioned correctly
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(),i*20.0);
+ }
+
+ // Remove items before visible
+ listview->setContentY(80);
+ listview->setCurrentIndex(10);
+
+ model.removeItem(1); // post: top item will be at 20
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ // Confirm items positioned correctly
+ for (int i = 2; i < 18; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(),20+i*20.0);
+ }
+
+ // Remove current index
+ QTRY_VERIFY(listview->currentIndex() == 9);
+ QQuickItem *oldCurrent = listview->currentItem();
+ model.removeItem(9);
+
+ QTRY_COMPARE(listview->currentIndex(), 9);
+ QTRY_VERIFY(listview->currentItem() != oldCurrent);
+
+ listview->setContentY(20); // That's the top now
+ // let transitions settle.
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(),20+i*20.0);
+ }
+
+ // remove current item beyond visible items.
+ listview->setCurrentIndex(20);
+ listview->setContentY(40);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ model.removeItem(20);
+ QTRY_COMPARE(listview->currentIndex(), 20);
+ QTRY_VERIFY(listview->currentItem() != 0);
+
+ // remove item before current, but visible
+ listview->setCurrentIndex(8);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ oldCurrent = listview->currentItem();
+ model.removeItem(6);
+
+ QTRY_COMPARE(listview->currentIndex(), 7);
+ QTRY_VERIFY(listview->currentItem() == oldCurrent);
+
+ listview->setContentY(80);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // remove all visible items
+ model.removeItems(1, 18);
+ QTRY_COMPARE(listview->count() , model.count());
+
+ // Confirm items positioned correctly
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount-1; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i+1);
+ if (!item) qWarning() << "Item" << i+1 << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(),80+i*20.0);
+ }
+
+ model.removeItems(1, 17);
+ QTRY_COMPARE(listview->count() , model.count());
+
+ model.removeItems(2, 1);
+ QTRY_COMPARE(listview->count() , model.count());
+
+ model.addItem("New", "1");
+ QTRY_COMPARE(listview->count() , model.count());
+
+ QTRY_VERIFY(name = findItem<QQuickText>(contentItem, "textName", model.count()-1));
+ QCOMPARE(name->text(), QString("New"));
+
+ // Add some more items so that we don't run out
+ model.clear();
+ for (int i = 0; i < 50; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ // QTBUG-QTBUG-20575
+ listview->setCurrentIndex(0);
+ listview->setContentY(30);
+ model.removeItem(0);
+ QTRY_VERIFY(name = findItem<QQuickText>(contentItem, "textName", 0));
+
+ // QTBUG-19198 move to end and remove all visible items one at a time.
+ listview->positionViewAtEnd();
+ for (int i = 0; i < 18; ++i)
+ model.removeItems(model.count() - 1, 1);
+ QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() > 16);
+
+ delete window;
+ delete testObject;
+}
+
+template <class T>
+void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection)
+{
+ QFETCH(qreal, contentY);
+ QFETCH(int, removeIndex);
+ QFETCH(int, removeCount);
+ QFETCH(qreal, itemsOffsetAfterMove);
+
+ QQuickView *window = getView();
+
+ T model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(source);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ bool waitForPolish = (contentY != 0);
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop) {
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ contentY = -listview->height() - contentY;
+ }
+ listview->setContentY(contentY);
+ if (waitForPolish)
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ model.removeItems(removeIndex, removeCount);
+ QTRY_COMPARE(listview->property("count").toInt(), model.count());
+
+ // check visibleItems.first() is in correct position
+ QQuickItem *item0 = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item0);
+ QVERIFY(item0);
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop)
+ QCOMPARE(item0->y(), -item0->height() - itemsOffsetAfterMove);
+ else
+ QCOMPARE(item0->y(), itemsOffsetAfterMove);
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (item && delegateVisible(item)) {
+ firstVisibleIndex = i;
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // Confirm items positioned correctly and indexes correct
+ QQuickText *name;
+ QQuickText *number;
+ for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ qreal pos = i*20.0 + itemsOffsetAfterMove;
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop)
+ pos = -item0->height() - pos;
+ QTRY_COMPARE(item->y(), pos);
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QVERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::removed_more_data()
+{
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<int>("removeIndex");
+ QTest::addColumn<int>("removeCount");
+ QTest::addColumn<qreal>("itemsOffsetAfterMove");
+
+ QTest::newRow("remove 1, before visible items")
+ << 80.0 // show 4-19
+ << 3 << 1
+ << 20.0; // visible items slide down by 1 item so that first visible does not move
+
+ QTest::newRow("remove multiple, all before visible items")
+ << 80.0
+ << 1 << 3
+ << 20.0 * 3;
+
+ QTest::newRow("remove multiple, all before visible items, remove item 0")
+ << 80.0
+ << 0 << 4
+ << 20.0 * 4;
+
+ // remove 1,2,3 before the visible pos, 0 moves down to just before the visible pos,
+ // items 4,5 are removed from view, item 6 slides up to original pos of item 4 (80px)
+ QTest::newRow("remove multiple, mix of items from before and within visible items")
+ << 80.0
+ << 1 << 5
+ << 20.0 * 3; // adjust for the 3 items removed before the visible
+
+ QTest::newRow("remove multiple, mix of items from before and within visible items, remove item 0")
+ << 80.0
+ << 0 << 6
+ << 20.0 * 4; // adjust for the 3 items removed before the visible
+
+
+ QTest::newRow("remove 1, from start of visible, content at start")
+ << 0.0
+ << 0 << 1
+ << 0.0;
+
+ QTest::newRow("remove multiple, from start of visible, content at start")
+ << 0.0
+ << 0 << 3
+ << 0.0;
+
+ QTest::newRow("remove 1, from start of visible, content not at start")
+ << 80.0 // show 4-19
+ << 4 << 1
+ << 0.0;
+
+ QTest::newRow("remove multiple, from start of visible, content not at start")
+ << 80.0 // show 4-19
+ << 4 << 3
+ << 0.0;
+
+
+ QTest::newRow("remove 1, from middle of visible, content at start")
+ << 0.0
+ << 10 << 1
+ << 0.0;
+
+ QTest::newRow("remove multiple, from middle of visible, content at start")
+ << 0.0
+ << 10 << 5
+ << 0.0;
+
+ QTest::newRow("remove 1, from middle of visible, content not at start")
+ << 80.0 // show 4-19
+ << 10 << 1
+ << 0.0;
+
+ QTest::newRow("remove multiple, from middle of visible, content not at start")
+ << 80.0 // show 4-19
+ << 10 << 5
+ << 0.0;
+
+
+ QTest::newRow("remove 1, after visible, content at start")
+ << 0.0
+ << 16 << 1
+ << 0.0;
+
+ QTest::newRow("remove multiple, after visible, content at start")
+ << 0.0
+ << 16 << 5
+ << 0.0;
+
+ QTest::newRow("remove 1, after visible, content not at middle")
+ << 80.0 // show 4-19
+ << 16+4 << 1
+ << 0.0;
+
+ QTest::newRow("remove multiple, after visible, content not at start")
+ << 80.0 // show 4-19
+ << 16+4 << 5
+ << 0.0;
+
+ QTest::newRow("remove multiple, mix of items from within and after visible items")
+ << 80.0
+ << 18 << 5
+ << 0.0;
+}
+
+template <class T>
+void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection)
+{
+ QQuickView *window = createView();
+
+ T model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(source);
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ model.clear();
+
+ QTRY_COMPARE(findItems<QQuickListView>(contentItem, "wrapper").count(), 0);
+ QTRY_VERIFY(listview->count() == 0);
+ QTRY_VERIFY(listview->currentItem() == 0);
+ if (verticalLayoutDirection == QQuickItemView::TopToBottom)
+ QTRY_COMPARE(listview->contentY(), 0.0);
+ else
+ QTRY_COMPARE(listview->contentY(), -listview->height());
+ QVERIFY(listview->currentIndex() == -1);
+
+ QCOMPARE(listview->contentHeight(), 0.0);
+
+ // confirm sanity when adding an item to cleared list
+ model.addItem("New", "1");
+ QTRY_VERIFY(listview->count() == 1);
+ QVERIFY(listview->currentItem() != 0);
+ QVERIFY(listview->currentIndex() == 0);
+
+ delete window;
+ delete testObject;
+}
+
+template <class T>
+void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection)
+{
+ QFETCH(qreal, contentY);
+ QFETCH(int, from);
+ QFETCH(int, to);
+ QFETCH(int, count);
+ QFETCH(qreal, itemsOffsetAfterMove);
+
+ QQuickText *name;
+ QQuickText *number;
+ QQuickView *window = getView();
+
+ T model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(source);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // always need to wait for view to be painted before the first move()
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ bool waitForPolish = (contentY != 0);
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop) {
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ contentY = -listview->height() - contentY;
+ }
+ listview->setContentY(contentY);
+ if (waitForPolish)
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ model.moveItems(from, to, count);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (item && delegateVisible(item)) {
+ firstVisibleIndex = i;
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // Confirm items positioned correctly and indexes correct
+ for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ qreal pos = i*20.0 + itemsOffsetAfterMove;
+ if (verticalLayoutDirection == QQuickItemView::BottomToTop)
+ pos = -item->height() - pos;
+ QTRY_COMPARE(item->y(), pos);
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QVERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+
+ // current index should have been updated
+ if (item == listview->currentItem())
+ QTRY_COMPARE(listview->currentIndex(), i);
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::moved_data()
+{
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<int>("to");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<qreal>("itemsOffsetAfterMove");
+
+ // model starts with 30 items, each 20px high, in area 320px high
+ // 16 items should be visible at a time
+ // itemsOffsetAfterMove should be > 0 whenever items above the visible pos have moved
+
+ QTest::newRow("move 1 forwards, within visible items")
+ << 0.0
+ << 1 << 4 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 forwards, from non-visible -> visible")
+ << 80.0 // show 4-19
+ << 1 << 18 << 1
+ << 20.0; // removed 1 item above the first visible, so item 0 should drop down by 1 to minimize movement
+
+ QTest::newRow("move 1 forwards, from non-visible -> visible (move first item)")
+ << 80.0 // show 4-19
+ << 0 << 4 << 1
+ << 20.0; // first item has moved to below item4, everything drops down by size of 1 item
+
+ QTest::newRow("move 1 forwards, from visible -> non-visible")
+ << 0.0
+ << 1 << 16 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 forwards, from visible -> non-visible (move first item)")
+ << 0.0
+ << 0 << 16 << 1
+ << 0.0;
+
+
+ QTest::newRow("move 1 backwards, within visible items")
+ << 0.0
+ << 4 << 1 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, within visible items (to first index)")
+ << 0.0
+ << 4 << 0 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, from non-visible -> visible")
+ << 0.0
+ << 20 << 4 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, from non-visible -> visible (move last item)")
+ << 0.0
+ << 29 << 15 << 1
+ << 0.0;
+
+ QTest::newRow("move 1 backwards, from visible -> non-visible")
+ << 80.0 // show 4-19
+ << 16 << 1 << 1
+ << -20.0; // to minimize movement, item 0 moves to -20, and other items do not move
+
+ QTest::newRow("move 1 backwards, from visible -> non-visible (move first item)")
+ << 80.0 // show 4-19
+ << 16 << 0 << 1
+ << -20.0; // to minimize movement, item 16 (now at 0) moves to -20, and other items do not move
+
+
+ QTest::newRow("move multiple forwards, within visible items")
+ << 0.0
+ << 0 << 5 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, before visible items")
+ << 140.0 // show 7-22
+ << 4 << 5 << 3 // 4,5,6 move to below 7
+ << 20.0 * 3; // 4,5,6 moved down
+
+ QTest::newRow("move multiple forwards, from non-visible -> visible")
+ << 80.0 // show 4-19
+ << 1 << 5 << 3
+ << 20.0 * 3; // moving 3 from above the content y should adjust y positions accordingly
+
+ QTest::newRow("move multiple forwards, from non-visible -> visible (move first item)")
+ << 80.0 // show 4-19
+ << 0 << 5 << 3
+ << 20.0 * 3; // moving 3 from above the content y should adjust y positions accordingly
+
+ QTest::newRow("move multiple forwards, mix of non-visible/visible")
+ << 40.0
+ << 1 << 16 << 2
+ << 20.0; // item 1,2 are removed, item 3 is now first visible
+
+ QTest::newRow("move multiple forwards, to bottom of view")
+ << 0.0
+ << 5 << 13 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, first->last")
+ << 0.0
+ << 0 << 13 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, to bottom of view, content y not 0")
+ << 80.0
+ << 5+4 << 13+4 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, from visible -> non-visible")
+ << 0.0
+ << 1 << 16 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple forwards, from visible -> non-visible (move first item)")
+ << 0.0
+ << 0 << 16 << 3
+ << 0.0;
+
+
+ QTest::newRow("move multiple backwards, within visible items")
+ << 0.0
+ << 4 << 1 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, within visible items (move first item)")
+ << 0.0
+ << 10 << 0 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, from non-visible -> visible")
+ << 0.0
+ << 20 << 4 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, from non-visible -> visible (move last item)")
+ << 0.0
+ << 27 << 10 << 3
+ << 0.0;
+
+ QTest::newRow("move multiple backwards, from visible -> non-visible")
+ << 80.0 // show 4-19
+ << 16 << 1 << 3
+ << -20.0 * 3; // to minimize movement, 0 moves by -60, and other items do not move
+
+ QTest::newRow("move multiple backwards, from visible -> non-visible (move first item)")
+ << 80.0 // show 4-19
+ << 16 << 0 << 3
+ << -20.0 * 3; // to minimize movement, 16,17,18 move to above item 0, and other items do not move
+}
+
+void tst_QQuickListView::multipleChanges(bool condensed)
+{
+ QFETCH(int, startCount);
+ QFETCH(QList<ListChange>, changes);
+ QFETCH(int, newCount);
+ QFETCH(int, newCurrentIndex);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < startCount; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ for (int i=0; i<changes.count(); i++) {
+ switch (changes[i].type) {
+ case ListChange::Inserted:
+ {
+ QList<QPair<QString, QString> > items;
+ for (int j=changes[i].index; j<changes[i].index + changes[i].count; ++j)
+ items << qMakePair(QString("new item %1").arg(j), QString::number(j));
+ model.insertItems(changes[i].index, items);
+ break;
+ }
+ case ListChange::Removed:
+ model.removeItems(changes[i].index, changes[i].count);
+ break;
+ case ListChange::Moved:
+ model.moveItems(changes[i].index, changes[i].to, changes[i].count);
+ break;
+ case ListChange::SetCurrent:
+ listview->setCurrentIndex(changes[i].index);
+ break;
+ case ListChange::SetContentY:
+ listview->setContentY(changes[i].pos);
+ break;
+ default:
+ continue;
+ }
+ if (!condensed) {
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ }
+ }
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QCOMPARE(listview->count(), newCount);
+ QCOMPARE(listview->count(), model.count());
+ QCOMPARE(listview->currentIndex(), newCurrentIndex);
+
+ QQuickText *name;
+ QQuickText *number;
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ number = findItem<QQuickText>(contentItem, "textNumber", i);
+ QVERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(i));
+ }
+
+ delete testObject;
+ releaseView(window);
+}
+
+void tst_QQuickListView::multipleChanges_data()
+{
+ QTest::addColumn<int>("startCount");
+ QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<int>("newCount");
+ QTest::addColumn<int>("newCurrentIndex");
+
+ QList<ListChange> changes;
+
+ for (int i=1; i<30; i++)
+ changes << ListChange::remove(0);
+ QTest::newRow("remove all but 1, first->last") << 30 << changes << 1 << 0;
+
+ changes << ListChange::remove(0);
+ QTest::newRow("remove all") << 30 << changes << 0 << -1;
+
+ changes.clear();
+ changes << ListChange::setCurrent(29);
+ for (int i=29; i>0; i--)
+ changes << ListChange::remove(i);
+ QTest::newRow("remove last (current) -> first") << 30 << changes << 1 << 0;
+
+ QTest::newRow("remove then insert at 0") << 10 << (QList<ListChange>()
+ << ListChange::remove(0, 1)
+ << ListChange::insert(0, 1)
+ ) << 10 << 1;
+
+ QTest::newRow("remove then insert at non-zero index") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(2)
+ << ListChange::remove(2, 1)
+ << ListChange::insert(2, 1)
+ ) << 10 << 3;
+
+ QTest::newRow("remove current then insert below it") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(1)
+ << ListChange::remove(1, 3)
+ << ListChange::insert(2, 2)
+ ) << 9 << 1;
+
+ QTest::newRow("remove current index then move it down") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(2)
+ << ListChange::remove(1, 3)
+ << ListChange::move(1, 5, 1)
+ ) << 7 << 5;
+
+ QTest::newRow("remove current index then move it up") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::remove(4, 3)
+ << ListChange::move(4, 1, 1)
+ ) << 7 << 1;
+
+
+ QTest::newRow("insert multiple times") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 2)
+ << ListChange::insert(0, 4)
+ << ListChange::insert(0, 6)
+ ) << 12 << 10;
+
+ QTest::newRow("insert multiple times with current index changes") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 2)
+ << ListChange::insert(0, 4)
+ << ListChange::insert(0, 6)
+ << ListChange::setCurrent(3)
+ << ListChange::insert(3, 2)
+ ) << 14 << 5;
+
+ QTest::newRow("insert and remove all") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 30)
+ << ListChange::remove(0, 30)
+ ) << 0 << -1;
+
+ QTest::newRow("insert and remove current") << 30 << (QList<ListChange>()
+ << ListChange::insert(1)
+ << ListChange::setCurrent(1)
+ << ListChange::remove(1)
+ ) << 30 << 1;
+
+ QTest::newRow("insert before 0, then remove cross section of new and old items") << 10 << (QList<ListChange>()
+ << ListChange::insert(0, 10)
+ << ListChange::remove(5, 10)
+ ) << 10 << 5;
+
+ QTest::newRow("insert multiple, then move new items to end") << 10 << (QList<ListChange>()
+ << ListChange::insert(0, 3)
+ << ListChange::move(0, 10, 3)
+ ) << 13 << 0;
+
+ QTest::newRow("insert multiple, then move new and some old items to end") << 10 << (QList<ListChange>()
+ << ListChange::insert(0, 3)
+ << ListChange::move(0, 8, 5)
+ ) << 13 << 11;
+
+ QTest::newRow("insert multiple at end, then move new and some old items to start") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(9)
+ << ListChange::insert(10, 3)
+ << ListChange::move(8, 0, 5)
+ ) << 13 << 1;
+
+
+ QTest::newRow("move back and forth to same index") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(1)
+ << ListChange::move(1, 2, 2)
+ << ListChange::move(2, 1, 2)
+ ) << 10 << 1;
+
+ QTest::newRow("move forwards then back") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(2)
+ << ListChange::move(1, 2, 3)
+ << ListChange::move(3, 0, 5)
+ ) << 10 << 0;
+
+ QTest::newRow("move current, then remove it") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::move(5, 0, 1)
+ << ListChange::remove(0)
+ ) << 9 << 0;
+
+ QTest::newRow("move current, then insert before it") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::move(5, 0, 1)
+ << ListChange::insert(0)
+ ) << 11 << 1;
+
+ QTest::newRow("move multiple, then remove them") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(1)
+ << ListChange::move(5, 1, 3)
+ << ListChange::remove(1, 3)
+ ) << 7 << 1;
+
+ QTest::newRow("move multiple, then insert before them") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(5)
+ << ListChange::move(5, 1, 3)
+ << ListChange::insert(1, 5)
+ ) << 15 << 6;
+
+ QTest::newRow("move multiple, then insert after them") << 10 << (QList<ListChange>()
+ << ListChange::setCurrent(3)
+ << ListChange::move(0, 1, 2)
+ << ListChange::insert(3, 5)
+ ) << 15 << 8;
+
+ QTest::newRow("clear current") << 0 << (QList<ListChange>()
+ << ListChange::insert(0, 5)
+ << ListChange::setCurrent(-1)
+ << ListChange::remove(0, 5)
+ << ListChange::insert(0, 5)
+ ) << 5 << -1;
+
+ QTest::newRow("remove, scroll") << 30 << (QList<ListChange>()
+ << ListChange::remove(20, 5)
+ << ListChange::setContentY(20)
+ ) << 25 << 0;
+
+ QTest::newRow("insert, scroll") << 10 << (QList<ListChange>()
+ << ListChange::insert(9, 5)
+ << ListChange::setContentY(20)
+ ) << 15 << 0;
+
+ QTest::newRow("move, scroll") << 20 << (QList<ListChange>()
+ << ListChange::move(15, 8, 3)
+ << ListChange::setContentY(0)
+ ) << 20 << 0;
+
+ QTest::newRow("clear, insert, scroll") << 30 << (QList<ListChange>()
+ << ListChange::setContentY(20)
+ << ListChange::remove(0, 30)
+ << ListChange::insert(0, 2)
+ << ListChange::setContentY(0)
+ ) << 2 << 0;
+}
+
+void tst_QQuickListView::swapWithFirstItem()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // ensure content position is stable
+ listview->setContentY(0);
+ model.moveItem(1, 0);
+ QTRY_VERIFY(listview->contentY() == 0);
+
+ delete testObject;
+ delete window;
+}
+
+void tst_QQuickListView::enforceRange()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("listview-enforcerange.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QTRY_COMPARE(listview->preferredHighlightBegin(), 100.0);
+ QTRY_COMPARE(listview->preferredHighlightEnd(), 100.0);
+ QTRY_COMPARE(listview->highlightRangeMode(), QQuickListView::StrictlyEnforceRange);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // view should be positioned at the top of the range.
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(listview->contentY(), -100.0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0);
+ QTRY_VERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(0));
+ QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0);
+ QTRY_VERIFY(number != 0);
+ QTRY_COMPARE(number->text(), model.number(0));
+
+ // Check currentIndex is updated when contentItem moves
+ listview->setContentY(20);
+
+ QTRY_COMPARE(listview->currentIndex(), 6);
+
+ // change model
+ QaimModel model2;
+ for (int i = 0; i < 5; i++)
+ model2.addItem("Item" + QString::number(i), "");
+
+ ctxt->setContextProperty("testModel", &model2);
+ QCOMPARE(listview->count(), 5);
+
+ delete window;
+}
+
+void tst_QQuickListView::enforceRange_withoutHighlight()
+{
+ // QTBUG-20287
+ // If no highlight is set but StrictlyEnforceRange is used, the content should still move
+ // to the correct position (i.e. to the next/previous item, not next/previous section)
+ // when moving up/down via incrementCurrentIndex() and decrementCurrentIndex()
+
+ QQuickView *window = createView();
+
+ QaimModel model;
+ model.addItem("Item 0", "a");
+ model.addItem("Item 1", "b");
+ model.addItem("Item 2", "b");
+ model.addItem("Item 3", "c");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("listview-enforcerange-nohighlight.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ qreal expectedPos = -100.0;
+
+ expectedPos += 10.0; // scroll past 1st section's delegate (10px height)
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ expectedPos += 20 + 10; // scroll past 1st section and section delegate of 2nd section
+ QTest::keyClick(window, Qt::Key_Down);
+
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ expectedPos += 20; // scroll past 1st item of 2nd section
+ QTest::keyClick(window, Qt::Key_Down);
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ expectedPos += 20 + 10; // scroll past 2nd item of 2nd section and section delegate of 3rd section
+ QTest::keyClick(window, Qt::Key_Down);
+ QTRY_COMPARE(listview->contentY(), expectedPos);
+
+ delete window;
+}
+
+void tst_QQuickListView::spacing()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*20);
+ }
+
+ listview->setSpacing(10);
+ QTRY_VERIFY(listview->spacing() == 10);
+
+ // Confirm items positioned correctly
+ QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() == 11);
+ for (int i = 0; i < 11; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*30);
+ }
+
+ listview->setSpacing(0);
+
+ // Confirm items positioned correctly
+ QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() >= 16);
+ for (int i = 0; i < 16; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.0);
+ }
+
+ delete window;
+ delete testObject;
+}
+
+template <typename T>
+void tst_QQuickListView::sections(const QUrl &source)
+{
+ QQuickView *window = createView();
+
+ T model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i/5));
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(source);
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20));
+ QQuickText *next = findItem<QQuickText>(item, "nextSection");
+ QCOMPARE(next->text().toInt(), (i+1)/5);
+ }
+
+ QSignalSpy currentSectionChangedSpy(listview, SIGNAL(currentSectionChanged()));
+
+ // Remove section boundary
+ model.removeItem(5);
+ QTRY_COMPARE(listview->count(), model.count());
+
+ // New section header created
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 5);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->height(), 40.0);
+
+ model.insertItem(3, "New Item", "0");
+ QTRY_COMPARE(listview->count(), model.count());
+
+ // Section header moved
+ item = findItem<QQuickItem>(contentItem, "wrapper", 5);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->height(), 20.0);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 6);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->height(), 40.0);
+
+ // insert item which will become a section header
+ model.insertItem(6, "Replace header", "1");
+ QTRY_COMPARE(listview->count(), model.count());
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 6);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->height(), 40.0);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 7);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->height(), 20.0);
+
+ QTRY_COMPARE(listview->currentSection(), QString("0"));
+
+ listview->setContentY(140);
+ QTRY_COMPARE(listview->currentSection(), QString("1"));
+
+ QTRY_COMPARE(currentSectionChangedSpy.count(), 1);
+
+ listview->setContentY(20);
+ QTRY_COMPARE(listview->currentSection(), QString("0"));
+
+ QTRY_COMPARE(currentSectionChangedSpy.count(), 2);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 1);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->height(), 20.0);
+
+ // check that headers change when item changes
+ listview->setContentY(0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ model.modifyItem(0, "changed", "2");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 1);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->height(), 40.0);
+
+ delete window;
+}
+
+void tst_QQuickListView::sectionsDelegate()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i/5));
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("listview-sections_delegate.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20 + ((i+5)/5) * 20));
+ QQuickText *next = findItem<QQuickText>(item, "nextSection");
+ QCOMPARE(next->text().toInt(), (i+1)/5);
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "sect_" + QString::number(i));
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20*6));
+ }
+
+ // change section
+ model.modifyItem(0, "One", "aaa");
+ model.modifyItem(1, "Two", "aaa");
+ model.modifyItem(2, "Three", "aaa");
+ model.modifyItem(3, "Four", "aaa");
+ model.modifyItem(4, "Five", "aaa");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ for (int i = 0; i < 3; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem,
+ "sect_" + (i == 0 ? QString("aaa") : QString::number(i)));
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20*6));
+ }
+
+ // remove section boundary
+ model.removeItem(5);
+ QTRY_COMPARE(listview->count(), model.count());
+ for (int i = 0; i < 3; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem,
+ "sect_" + (i == 0 ? QString("aaa") : QString::number(i)));
+ QVERIFY(item);
+ }
+
+ // QTBUG-17606
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "sect_1");
+ QCOMPARE(items.count(), 1);
+
+ // QTBUG-17759
+ model.modifyItem(0, "One", "aaa");
+ model.modifyItem(1, "One", "aaa");
+ model.modifyItem(2, "One", "aaa");
+ model.modifyItem(3, "Four", "aaa");
+ model.modifyItem(4, "Four", "aaa");
+ model.modifyItem(5, "Four", "aaa");
+ model.modifyItem(6, "Five", "aaa");
+ model.modifyItem(7, "Five", "aaa");
+ model.modifyItem(8, "Five", "aaa");
+ model.modifyItem(9, "Two", "aaa");
+ model.modifyItem(10, "Two", "aaa");
+ model.modifyItem(11, "Two", "aaa");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_aaa").count(), 1);
+ window->rootObject()->setProperty("sectionProperty", "name");
+ // ensure view has settled.
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_Four").count(), 1);
+ for (int i = 0; i < 4; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem,
+ "sect_" + model.name(i*3));
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20*4));
+ }
+
+ delete window;
+}
+
+void tst_QQuickListView::sectionsDragOutsideBounds_data()
+{
+ QTest::addColumn<int>("distance");
+ QTest::addColumn<int>("cacheBuffer");
+
+ QTest::newRow("500, no cache buffer") << 500 << 0;
+ QTest::newRow("1000, no cache buffer") << 1000 << 0;
+ QTest::newRow("500, cache buffer") << 500 << 320;
+ QTest::newRow("1000, cache buffer") << 1000 << 320;
+}
+
+void tst_QQuickListView::sectionsDragOutsideBounds()
+{
+ QFETCH(int, distance);
+ QFETCH(int, cacheBuffer);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 10; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i/5));
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("listview-sections_delegate.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ listview->setCacheBuffer(cacheBuffer);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // QTBUG-17769
+ // Drag view up beyond bounds
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(20,20));
+ QTest::mouseMove(window, QPoint(20,0));
+ QTest::mouseMove(window, QPoint(20,-50));
+ QTest::mouseMove(window, QPoint(20,-distance));
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(20,-distance));
+ // view should settle back at 0
+ QTRY_COMPARE(listview->contentY(), 0.0);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(20,0));
+ QTest::mouseMove(window, QPoint(20,20));
+ QTest::mouseMove(window, QPoint(20,70));
+ QTest::mouseMove(window, QPoint(20,distance));
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(20,distance));
+ // view should settle back at 0
+ QTRY_COMPARE(listview->contentY(), 0.0);
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::sectionsDelegate_headerVisibility()
+{
+ QSKIP("QTBUG-24395");
+
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i/5));
+
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("listview-sections_delegate.qml"));
+ window->show();
+ window->requestActivate();
+ QTest::qWaitForWindowActive(window);
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // ensure section header is maintained in view
+ listview->setCurrentIndex(20);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_VERIFY(qFuzzyCompare(listview->contentY(), 200.0));
+ QTRY_VERIFY(listview->isMoving() == false);
+ listview->setCurrentIndex(0);
+ QTRY_VERIFY(qFuzzyIsNull(listview->contentY()));
+
+ delete window;
+}
+
+void tst_QQuickListView::sectionsPositioning()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i/5));
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("listview-sections_delegate.qml"));
+ window->show();
+ qApp->processEvents();
+ window->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart | QQuickViewSection::NextLabelAtEnd)));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ for (int i = 0; i < 3; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "sect_" + QString::number(i));
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20*6));
+ }
+
+ QQuickItem *topItem = findVisibleChild(contentItem, "sect_0"); // section header
+ QVERIFY(topItem);
+ QCOMPARE(topItem->y(), 0.);
+
+ QQuickItem *bottomItem = findVisibleChild(contentItem, "sect_3"); // section footer
+ QVERIFY(bottomItem);
+ QCOMPARE(bottomItem->y(), 300.);
+
+ // move down a little and check that section header is at top
+ listview->setContentY(10);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QCOMPARE(topItem->y(), 0.);
+
+ // push the top header up
+ listview->setContentY(110);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ topItem = findVisibleChild(contentItem, "sect_0"); // section header
+ QVERIFY(topItem);
+ QCOMPARE(topItem->y(), 100.);
+
+ QQuickItem *item = findVisibleChild(contentItem, "sect_1");
+ QVERIFY(item);
+ QCOMPARE(item->y(), 120.);
+
+ bottomItem = findVisibleChild(contentItem, "sect_4"); // section footer
+ QVERIFY(bottomItem);
+ QCOMPARE(bottomItem->y(), 410.);
+
+ // Move past section 0
+ listview->setContentY(120);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ topItem = findVisibleChild(contentItem, "sect_0"); // section header
+ QVERIFY(!topItem);
+
+ // Push section footer down
+ listview->setContentY(70);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ bottomItem = findVisibleChild(contentItem, "sect_4"); // section footer
+ QVERIFY(bottomItem);
+ QCOMPARE(bottomItem->y(), 380.);
+
+ // Change current section, and verify case insensitive comparison
+ listview->setContentY(10);
+ model.modifyItem(0, "One", "aaa");
+ model.modifyItem(1, "Two", "AAA");
+ model.modifyItem(2, "Three", "aAa");
+ model.modifyItem(3, "Four", "aaA");
+ model.modifyItem(4, "Five", "Aaa");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QTRY_COMPARE(listview->currentSection(), QString("aaa"));
+
+ for (int i = 0; i < 3; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem,
+ "sect_" + (i == 0 ? QString("aaa") : QString::number(i)));
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20*6));
+ }
+
+ QTRY_VERIFY(topItem = findVisibleChild(contentItem, "sect_aaa")); // section header
+ QCOMPARE(topItem->y(), 10.);
+
+ // remove section boundary
+ listview->setContentY(120);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ model.removeItem(5);
+ QTRY_COMPARE(listview->count(), model.count());
+ for (int i = 1; i < 3; ++i) {
+ QQuickItem *item = findVisibleChild(contentItem,
+ "sect_" + QString::number(i));
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20*6));
+ }
+
+ QVERIFY(topItem = findVisibleChild(contentItem, "sect_1"));
+ QTRY_COMPARE(topItem->y(), 120.);
+
+ // Change the next section
+ listview->setContentY(0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ bottomItem = findVisibleChild(contentItem, "sect_3"); // section footer
+ QVERIFY(bottomItem);
+ QTRY_COMPARE(bottomItem->y(), 300.);
+
+ model.modifyItem(14, "New", "new");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QTRY_VERIFY(bottomItem = findVisibleChild(contentItem, "sect_new")); // section footer
+ QTRY_COMPARE(bottomItem->y(), 300.);
+
+ // delegate size increase should push section footer down
+ listview->setContentY(70);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_VERIFY(bottomItem = findVisibleChild(contentItem, "sect_3")); // section footer
+ QTRY_COMPARE(bottomItem->y(), 370.);
+ QQuickItem *inlineSection = findVisibleChild(contentItem, "sect_new");
+ item = findItem<QQuickItem>(contentItem, "wrapper", 13);
+ QVERIFY(item);
+ item->setHeight(40.);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_COMPARE(bottomItem->y(), 380.);
+ QCOMPARE(inlineSection->y(), 360.);
+ item->setHeight(20.);
+
+ // Turn sticky footer off
+ listview->setContentY(20);
+ window->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart)));
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_VERIFY(item = findVisibleChild(contentItem, "sect_new")); // inline label restored
+ QCOMPARE(item->y(), 340.);
+
+ // Turn sticky header off
+ listview->setContentY(30);
+ window->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels)));
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QTRY_VERIFY(item = findVisibleChild(contentItem, "sect_aaa")); // inline label restored
+ QCOMPARE(item->y(), 0.);
+
+ // if an empty model is set the header/footer should be cleaned up
+ window->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart | QQuickViewSection::NextLabelAtEnd)));
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_new")); // section footer
+ QaimModel model1;
+ ctxt->setContextProperty("testModel", &model1);
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_new")); // section footer
+
+ // clear model - header/footer should be cleaned up
+ ctxt->setContextProperty("testModel", &model);
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(findVisibleChild(contentItem, "sect_new")); // section footer
+ model.clear();
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_aaa")); // section header
+ QTRY_VERIFY(!findVisibleChild(contentItem, "sect_new")); // section footer
+
+ delete window;
+}
+
+void tst_QQuickListView::sectionPropertyChange()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("sectionpropertychange.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*75.));
+ }
+
+ QMetaObject::invokeMethod(window->rootObject(), "switchGroups");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*75.));
+ }
+
+ QMetaObject::invokeMethod(window->rootObject(), "switchGroups");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*75.));
+ }
+
+ QMetaObject::invokeMethod(window->rootObject(), "switchGrouped");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*50.));
+ }
+
+ QMetaObject::invokeMethod(window->rootObject(), "switchGrouped");
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*75.));
+ }
+
+ delete window;
+}
+
+void tst_QQuickListView::sectionDelegateChange()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("sectiondelegatechange.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQUICK_VERIFY_POLISH(listview);
+
+ QVERIFY(findItems<QQuickItem>(contentItem, "section1").count() > 0);
+ QCOMPARE(findItems<QQuickItem>(contentItem, "section2").count(), 0);
+
+ for (int i = 0; i < 3; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "item", i);
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(25. + i*50.));
+ }
+
+ QMetaObject::invokeMethod(window->rootObject(), "switchDelegates");
+ QQUICK_VERIFY_POLISH(listview);
+
+ QCOMPARE(findItems<QQuickItem>(contentItem, "section1").count(), 0);
+ QVERIFY(findItems<QQuickItem>(contentItem, "section2").count() > 0);
+
+ for (int i = 0; i < 3; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "item", i);
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(50. + i*75.));
+ }
+
+ delete window;
+}
+
+void tst_QQuickListView::currentIndex_delayedItemCreation()
+{
+ QFETCH(bool, setCurrentToZero);
+
+ QQuickView *window = getView();
+
+ // test currentIndexChanged() is emitted even if currentIndex = 0 on start up
+ // (since the currentItem will have changed and that shares the same index)
+ window->rootContext()->setContextProperty("setCurrentToZero", setCurrentToZero);
+
+ window->setSource(testFileUrl("fillModelOnComponentCompleted.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QSignalSpy spy(listview, SIGNAL(currentItemChanged()));
+ QCOMPARE(listview->currentIndex(), 0);
+ QTRY_COMPARE(spy.count(), 1);
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::currentIndex_delayedItemCreation_data()
+{
+ QTest::addColumn<bool>("setCurrentToZero");
+
+ QTest::newRow("set to 0") << true;
+ QTest::newRow("don't set to 0") << false;
+}
+
+void tst_QQuickListView::currentIndex()
+{
+ QaimModel initModel;
+
+ for (int i = 0; i < 30; i++)
+ initModel.addItem("Item" + QString::number(i), QString::number(i));
+
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &initModel);
+ ctxt->setContextProperty("testWrap", QVariant(false));
+
+ QString filename(testFile("listview-initCurrent.qml"));
+ window->setSource(QUrl::fromLocalFile(filename));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // currentIndex is initialized to 20
+ // currentItem should be in view
+ QCOMPARE(listview->currentIndex(), 20);
+ QCOMPARE(listview->contentY(), 100.0);
+ QCOMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 20));
+ QCOMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
+
+ // changing model should reset currentIndex to 0
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+ ctxt->setContextProperty("testModel", &model);
+
+ QCOMPARE(listview->currentIndex(), 0);
+ QCOMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0));
+
+ // confirm that the velocity is updated
+ listview->setCurrentIndex(20);
+ QTRY_VERIFY(listview->verticalVelocity() != 0.0);
+ listview->setCurrentIndex(0);
+ QTRY_VERIFY(listview->verticalVelocity() == 0.0);
+
+ // footer should become visible if it is out of view, and then current index is set to count-1
+ window->rootObject()->setProperty("showFooter", true);
+ QTRY_VERIFY(listview->footerItem());
+ listview->setCurrentIndex(model.count()-2);
+ QTRY_VERIFY(listview->footerItem()->y() > listview->contentY() + listview->height());
+ listview->setCurrentIndex(model.count()-1);
+ QTRY_COMPARE(listview->contentY() + listview->height(), (20.0 * model.count()) + listview->footerItem()->height());
+ window->rootObject()->setProperty("showFooter", false);
+
+ // header should become visible if it is out of view, and then current index is set to 0
+ window->rootObject()->setProperty("showHeader", true);
+ QTRY_VERIFY(listview->headerItem());
+ listview->setCurrentIndex(1);
+ QTRY_VERIFY(listview->headerItem()->y() + listview->headerItem()->height() < listview->contentY());
+ listview->setCurrentIndex(0);
+ QTRY_COMPARE(listview->contentY(), -listview->headerItem()->height());
+ window->rootObject()->setProperty("showHeader", false);
+
+ // turn off auto highlight
+ listview->setHighlightFollowsCurrentItem(false);
+ QVERIFY(listview->highlightFollowsCurrentItem() == false);
+
+ QVERIFY(listview->highlightItem());
+ qreal hlPos = listview->highlightItem()->y();
+
+ listview->setCurrentIndex(4);
+ QTRY_COMPARE(listview->highlightItem()->y(), hlPos);
+
+ // insert item before currentIndex
+ listview->setCurrentIndex(28);
+ model.insertItem(0, "Foo", "1111");
+ QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
+
+ // check removing highlight by setting currentIndex to -1;
+ listview->setCurrentIndex(-1);
+
+ QCOMPARE(listview->currentIndex(), -1);
+ QVERIFY(!listview->highlightItem());
+ QVERIFY(!listview->currentItem());
+
+ // moving currentItem out of view should make it invisible
+ listview->setCurrentIndex(0);
+ QTRY_VERIFY(delegateVisible(listview->currentItem()));
+ listview->setContentY(200);
+ QTRY_VERIFY(!delegateVisible(listview->currentItem()));
+
+ delete window;
+}
+
+void tst_QQuickListView::noCurrentIndex()
+{
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ QString filename(testFile("listview-noCurrent.qml"));
+ window->setSource(QUrl::fromLocalFile(filename));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // current index should be -1 at startup
+ // and we should not have a currentItem or highlightItem
+ QCOMPARE(listview->currentIndex(), -1);
+ QCOMPARE(listview->contentY(), 0.0);
+ QVERIFY(!listview->highlightItem());
+ QVERIFY(!listview->currentItem());
+
+ listview->setCurrentIndex(2);
+ QCOMPARE(listview->currentIndex(), 2);
+ QVERIFY(listview->highlightItem());
+ QVERIFY(listview->currentItem());
+
+ delete window;
+}
+
+void tst_QQuickListView::keyNavigation()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(Qt::Key, forwardsKey);
+ QFETCH(Qt::Key, backwardsKey);
+ QFETCH(QPointF, contentPosAtFirstItem);
+ QFETCH(QPointF, contentPosAtLastItem);
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ TestObject *testObject = new TestObject;
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->rootContext()->setContextProperty("testObject", testObject);
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ QTest::qWaitForWindowActive(window);
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ window->requestActivate();
+ QTest::qWaitForWindowActive(window);
+ QTRY_VERIFY(qGuiApp->focusWindow() == window);
+
+ QTest::keyClick(window, forwardsKey);
+ QCOMPARE(listview->currentIndex(), 1);
+
+ QTest::keyClick(window, backwardsKey);
+ QCOMPARE(listview->currentIndex(), 0);
+
+ // hold down a key to go forwards
+ for (int i=0; i<model.count()-1; i++) {
+ QTest::simulateEvent(window, true, forwardsKey, Qt::NoModifier, "", true);
+ QTRY_COMPARE(listview->currentIndex(), i+1);
+ }
+ QTest::keyRelease(window, forwardsKey);
+ QTRY_COMPARE(listview->currentIndex(), model.count()-1);
+ QTRY_COMPARE(listview->contentX(), contentPosAtLastItem.x());
+ QTRY_COMPARE(listview->contentY(), contentPosAtLastItem.y());
+
+ // hold down a key to go backwards
+ for (int i=model.count()-1; i > 0; i--) {
+ QTest::simulateEvent(window, true, backwardsKey, Qt::NoModifier, "", true);
+ QTRY_COMPARE(listview->currentIndex(), i-1);
+ }
+ QTest::keyRelease(window, backwardsKey);
+ QTRY_COMPARE(listview->currentIndex(), 0);
+ QTRY_COMPARE(listview->contentX(), contentPosAtFirstItem.x());
+ QTRY_COMPARE(listview->contentY(), contentPosAtFirstItem.y());
+
+ // no wrap
+ QVERIFY(!listview->isWrapEnabled());
+ listview->incrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 1);
+ listview->decrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 0);
+
+ listview->decrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 0);
+
+ // with wrap
+ listview->setWrapEnabled(true);
+ QVERIFY(listview->isWrapEnabled());
+
+ listview->decrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), model.count()-1);
+ QTRY_COMPARE(listview->contentX(), contentPosAtLastItem.x());
+ QTRY_COMPARE(listview->contentY(), contentPosAtLastItem.y());
+
+ listview->incrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 0);
+ QTRY_COMPARE(listview->contentX(), contentPosAtFirstItem.x());
+ QTRY_COMPARE(listview->contentY(), contentPosAtFirstItem.y());
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::keyNavigation_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<Qt::Key>("forwardsKey");
+ QTest::addColumn<Qt::Key>("backwardsKey");
+ QTest::addColumn<QPointF>("contentPosAtFirstItem");
+ QTest::addColumn<QPointF>("contentPosAtLastItem");
+
+ QTest::newRow("Vertical, TopToBottom")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << Qt::Key_Down << Qt::Key_Up
+ << QPointF(0, 0)
+ << QPointF(0, 30*20 - 320);
+
+ QTest::newRow("Vertical, BottomToTop")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << Qt::Key_Up << Qt::Key_Down
+ << QPointF(0, -320)
+ << QPointF(0, -(30 * 20));
+
+ QTest::newRow("Horizontal, LeftToRight")
+ << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << Qt::Key_Right << Qt::Key_Left
+ << QPointF(0, 0)
+ << QPointF(30*240 - 240, 0);
+
+ QTest::newRow("Horizontal, RightToLeft")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << Qt::Key_Left << Qt::Key_Right
+ << QPointF(-240, 0)
+ << QPointF(-(30 * 240), 0);
+}
+
+void tst_QQuickListView::itemList()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("itemlist.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel");
+ QTRY_VERIFY(model != 0);
+
+ QTRY_VERIFY(model->count() == 3);
+ QTRY_COMPARE(listview->currentIndex(), 0);
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "item1");
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), 0.0);
+ QCOMPARE(item->height(), listview->height());
+
+ QQuickText *text = findItem<QQuickText>(contentItem, "text1");
+ QTRY_VERIFY(text);
+ QTRY_COMPARE(text->text(), QLatin1String("index: 0"));
+
+ listview->setCurrentIndex(2);
+
+ item = findItem<QQuickItem>(contentItem, "item3");
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), 480.0);
+
+ text = findItem<QQuickText>(contentItem, "text3");
+ QTRY_VERIFY(text);
+ QTRY_COMPARE(text->text(), QLatin1String("index: 2"));
+
+ delete window;
+}
+
+void tst_QQuickListView::itemListFlicker()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("itemlist-flicker.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel");
+ QTRY_VERIFY(model != 0);
+
+ QTRY_VERIFY(model->count() == 3);
+ QTRY_COMPARE(listview->currentIndex(), 0);
+
+ QQuickItem *item;
+
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item1"));
+ QVERIFY(delegateVisible(item));
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item2"));
+ QVERIFY(delegateVisible(item));
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item3"));
+ QVERIFY(delegateVisible(item));
+
+ listview->setCurrentIndex(1);
+
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item1"));
+ QVERIFY(delegateVisible(item));
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item2"));
+ QVERIFY(delegateVisible(item));
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item3"));
+ QVERIFY(delegateVisible(item));
+
+ listview->setCurrentIndex(2);
+
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item1"));
+ QVERIFY(delegateVisible(item));
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item2"));
+ QVERIFY(delegateVisible(item));
+ QVERIFY(item = findItem<QQuickItem>(contentItem, "item3"));
+ QVERIFY(delegateVisible(item));
+
+ delete window;
+}
+
+void tst_QQuickListView::cacheBuffer()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 90; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_VERIFY(listview->delegate() != 0);
+ QTRY_VERIFY(listview->model() != 0);
+ QTRY_VERIFY(listview->highlight() != 0);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*20);
+ }
+
+ QQmlIncubationController controller;
+ window->engine()->setIncubationController(&controller);
+
+ testObject->setCacheBuffer(200);
+ QTRY_VERIFY(listview->cacheBuffer() == 200);
+
+ // items will be created one at a time
+ for (int i = itemCount; i < qMin(itemCount+10,model.count()); ++i) {
+ QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(listview, "wrapper", i);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ int newItemCount = 0;
+ newItemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count() && i < newItemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*20);
+ }
+
+ // move view and confirm items in view are visible immediately and outside are created async
+ listview->setContentY(300);
+
+ for (int i = 15; i < 32; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QVERIFY(item);
+ QVERIFY(item->y() == i*20);
+ }
+
+ QVERIFY(findItem<QQuickItem>(listview, "wrapper", 32) == 0);
+
+ // ensure buffered items are created
+ for (int i = 32; i < qMin(41,model.count()); ++i) {
+ QQuickItem *item = 0;
+ while (!item) {
+ qGuiApp->processEvents(); // allow refill to happen
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(listview, "wrapper", i);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ delete window;
+ delete testObject;
+}
+
+void tst_QQuickListView::positionViewAtBeginningEnd()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+ window->show();
+ window->setSource(testFileUrl("listviewtest.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ listview->setContentY(100);
+
+ // positionAtBeginnging
+ listview->positionViewAtBeginning();
+ QTRY_COMPARE(listview->contentY(), 0.);
+
+ listview->setContentY(80);
+ window->rootObject()->setProperty("showHeader", true);
+ listview->positionViewAtBeginning();
+ QTRY_COMPARE(listview->contentY(), -30.);
+
+ // positionAtEnd
+ listview->positionViewAtEnd();
+ QTRY_COMPARE(listview->contentY(), 480.); // 40*20 - 320
+
+ listview->setContentY(80);
+ window->rootObject()->setProperty("showFooter", true);
+ listview->positionViewAtEnd();
+ QTRY_COMPARE(listview->contentY(), 510.);
+
+ // set current item to outside visible view, position at beginning
+ // and ensure highlight moves to current item
+ listview->setCurrentIndex(1);
+ listview->positionViewAtBeginning();
+ QTRY_COMPARE(listview->contentY(), -30.);
+ QVERIFY(listview->highlightItem());
+ QCOMPARE(listview->highlightItem()->y(), 20.);
+
+ delete window;
+ delete testObject;
+}
+
+void tst_QQuickListView::positionViewAtIndex()
+{
+ QFETCH(bool, enforceRange);
+ QFETCH(qreal, initContentY);
+ QFETCH(int, index);
+ QFETCH(QQuickListView::PositionMode, mode);
+ QFETCH(qreal, contentY);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+ window->show();
+ window->setSource(testFileUrl("listviewtest.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ window->rootObject()->setProperty("enforceRange", enforceRange);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ listview->setContentY(initContentY);
+
+ listview->positionViewAtIndex(index, mode);
+ QTRY_COMPARE(listview->contentY(), contentY);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = index; i < model.count() && i < itemCount-index-1; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.);
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::positionViewAtIndex_data()
+{
+ QTest::addColumn<bool>("enforceRange");
+ QTest::addColumn<qreal>("initContentY");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<QQuickListView::PositionMode>("mode");
+ QTest::addColumn<qreal>("contentY");
+
+ QTest::newRow("no range, 3 at Beginning") << false << 0. << 3 << QQuickListView::Beginning << 60.;
+ QTest::newRow("no range, 3 at End") << false << 0. << 3 << QQuickListView::End << 0.;
+ QTest::newRow("no range, 22 at Beginning") << false << 0. << 22 << QQuickListView::Beginning << 440.;
+ // Position on an item that would leave empty space if positioned at the top
+ QTest::newRow("no range, 28 at Beginning") << false << 0. << 28 << QQuickListView::Beginning << 480.;
+ // Position at End using last index
+ QTest::newRow("no range, last at End") << false << 0. << 39 << QQuickListView::End << 480.;
+ // Position at End
+ QTest::newRow("no range, 20 at End") << false << 0. << 20 << QQuickListView::End << 100.;
+ // Position in Center
+ QTest::newRow("no range, 15 at Center") << false << 0. << 15 << QQuickListView::Center << 150.;
+ // Ensure at least partially visible
+ QTest::newRow("no range, 15 visible => Visible") << false << 150. << 15 << QQuickListView::Visible << 150.;
+ QTest::newRow("no range, 15 partially visible => Visible") << false << 302. << 15 << QQuickListView::Visible << 302.;
+ QTest::newRow("no range, 15 before visible => Visible") << false << 320. << 15 << QQuickListView::Visible << 300.;
+ QTest::newRow("no range, 20 visible => Visible") << false << 85. << 20 << QQuickListView::Visible << 85.;
+ QTest::newRow("no range, 20 before visible => Visible") << false << 75. << 20 << QQuickListView::Visible << 100.;
+ QTest::newRow("no range, 20 after visible => Visible") << false << 480. << 20 << QQuickListView::Visible << 400.;
+ // Ensure completely visible
+ QTest::newRow("no range, 20 visible => Contain") << false << 120. << 20 << QQuickListView::Contain << 120.;
+ QTest::newRow("no range, 15 partially visible => Contain") << false << 302. << 15 << QQuickListView::Contain << 300.;
+ QTest::newRow("no range, 20 partially visible => Contain") << false << 85. << 20 << QQuickListView::Contain << 100.;
+
+ QTest::newRow("strict range, 3 at End") << true << 0. << 3 << QQuickListView::End << -120.;
+ QTest::newRow("strict range, 38 at Beginning") << true << 0. << 38 << QQuickListView::Beginning << 660.;
+ QTest::newRow("strict range, 15 at Center") << true << 0. << 15 << QQuickListView::Center << 140.;
+ QTest::newRow("strict range, 3 at SnapPosition") << true << 0. << 3 << QQuickListView::SnapPosition << -60.;
+ QTest::newRow("strict range, 10 at SnapPosition") << true << 0. << 10 << QQuickListView::SnapPosition << 80.;
+ QTest::newRow("strict range, 38 at SnapPosition") << true << 0. << 38 << QQuickListView::SnapPosition << 640.;
+}
+
+void tst_QQuickListView::resetModel()
+{
+ QQuickView *window = createView();
+
+ QStringList strings;
+ strings << "one" << "two" << "three";
+ QStringListModel model(strings);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("displaylist.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QTRY_COMPARE(listview->count(), model.rowCount());
+
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i);
+ QTRY_VERIFY(display != 0);
+ QTRY_COMPARE(display->text(), strings.at(i));
+ }
+
+ strings.clear();
+ strings << "four" << "five" << "six" << "seven";
+ model.setStringList(strings);
+
+ QTRY_COMPARE(listview->count(), model.rowCount());
+
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i);
+ QTRY_VERIFY(display != 0);
+ QTRY_COMPARE(display->text(), strings.at(i));
+ }
+
+ delete window;
+}
+
+void tst_QQuickListView::propertyChanges()
+{
+ QQuickView *window = createView();
+ QTRY_VERIFY(window);
+ window->setSource(testFileUrl("propertychangestest.qml"));
+
+ QQuickListView *listView = window->rootObject()->findChild<QQuickListView*>("listView");
+ QTRY_VERIFY(listView);
+
+ QSignalSpy highlightFollowsCurrentItemSpy(listView, SIGNAL(highlightFollowsCurrentItemChanged()));
+ QSignalSpy preferredHighlightBeginSpy(listView, SIGNAL(preferredHighlightBeginChanged()));
+ QSignalSpy preferredHighlightEndSpy(listView, SIGNAL(preferredHighlightEndChanged()));
+ QSignalSpy highlightRangeModeSpy(listView, SIGNAL(highlightRangeModeChanged()));
+ QSignalSpy keyNavigationWrapsSpy(listView, SIGNAL(keyNavigationWrapsChanged()));
+ QSignalSpy cacheBufferSpy(listView, SIGNAL(cacheBufferChanged()));
+ QSignalSpy snapModeSpy(listView, SIGNAL(snapModeChanged()));
+
+ QTRY_COMPARE(listView->highlightFollowsCurrentItem(), true);
+ QTRY_COMPARE(listView->preferredHighlightBegin(), 0.0);
+ QTRY_COMPARE(listView->preferredHighlightEnd(), 0.0);
+ QTRY_COMPARE(listView->highlightRangeMode(), QQuickListView::ApplyRange);
+ QTRY_COMPARE(listView->isWrapEnabled(), true);
+ QTRY_COMPARE(listView->cacheBuffer(), 10);
+ QTRY_COMPARE(listView->snapMode(), QQuickListView::SnapToItem);
+
+ listView->setHighlightFollowsCurrentItem(false);
+ listView->setPreferredHighlightBegin(1.0);
+ listView->setPreferredHighlightEnd(1.0);
+ listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
+ listView->setWrapEnabled(false);
+ listView->setCacheBuffer(3);
+ listView->setSnapMode(QQuickListView::SnapOneItem);
+
+ QTRY_COMPARE(listView->highlightFollowsCurrentItem(), false);
+ QTRY_COMPARE(listView->preferredHighlightBegin(), 1.0);
+ QTRY_COMPARE(listView->preferredHighlightEnd(), 1.0);
+ QTRY_COMPARE(listView->highlightRangeMode(), QQuickListView::StrictlyEnforceRange);
+ QTRY_COMPARE(listView->isWrapEnabled(), false);
+ QTRY_COMPARE(listView->cacheBuffer(), 3);
+ QTRY_COMPARE(listView->snapMode(), QQuickListView::SnapOneItem);
+
+ QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1);
+ QTRY_COMPARE(preferredHighlightBeginSpy.count(),1);
+ QTRY_COMPARE(preferredHighlightEndSpy.count(),1);
+ QTRY_COMPARE(highlightRangeModeSpy.count(),1);
+ QTRY_COMPARE(keyNavigationWrapsSpy.count(),1);
+ QTRY_COMPARE(cacheBufferSpy.count(),1);
+ QTRY_COMPARE(snapModeSpy.count(),1);
+
+ listView->setHighlightFollowsCurrentItem(false);
+ listView->setPreferredHighlightBegin(1.0);
+ listView->setPreferredHighlightEnd(1.0);
+ listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
+ listView->setWrapEnabled(false);
+ listView->setCacheBuffer(3);
+ listView->setSnapMode(QQuickListView::SnapOneItem);
+
+ QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1);
+ QTRY_COMPARE(preferredHighlightBeginSpy.count(),1);
+ QTRY_COMPARE(preferredHighlightEndSpy.count(),1);
+ QTRY_COMPARE(highlightRangeModeSpy.count(),1);
+ QTRY_COMPARE(keyNavigationWrapsSpy.count(),1);
+ QTRY_COMPARE(cacheBufferSpy.count(),1);
+ QTRY_COMPARE(snapModeSpy.count(),1);
+
+ delete window;
+}
+
+void tst_QQuickListView::componentChanges()
+{
+ QQuickView *window = createView();
+ QTRY_VERIFY(window);
+ window->setSource(testFileUrl("propertychangestest.qml"));
+
+ QQuickListView *listView = window->rootObject()->findChild<QQuickListView*>("listView");
+ QTRY_VERIFY(listView);
+
+ QQmlComponent component(window->engine());
+ component.setData("import QtQuick 2.0; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile(""));
+
+ QQmlComponent delegateComponent(window->engine());
+ delegateComponent.setData("import QtQuick 2.0; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile(""));
+
+ QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged()));
+ QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged()));
+ QSignalSpy headerSpy(listView, SIGNAL(headerChanged()));
+ QSignalSpy footerSpy(listView, SIGNAL(footerChanged()));
+
+ listView->setHighlight(&component);
+ listView->setHeader(&component);
+ listView->setFooter(&component);
+ listView->setDelegate(&delegateComponent);
+
+ QTRY_COMPARE(listView->highlight(), &component);
+ QTRY_COMPARE(listView->header(), &component);
+ QTRY_COMPARE(listView->footer(), &component);
+ QTRY_COMPARE(listView->delegate(), &delegateComponent);
+
+ QTRY_COMPARE(highlightSpy.count(),1);
+ QTRY_COMPARE(delegateSpy.count(),1);
+ QTRY_COMPARE(headerSpy.count(),1);
+ QTRY_COMPARE(footerSpy.count(),1);
+
+ listView->setHighlight(&component);
+ listView->setHeader(&component);
+ listView->setFooter(&component);
+ listView->setDelegate(&delegateComponent);
+
+ QTRY_COMPARE(highlightSpy.count(),1);
+ QTRY_COMPARE(delegateSpy.count(),1);
+ QTRY_COMPARE(headerSpy.count(),1);
+ QTRY_COMPARE(footerSpy.count(),1);
+
+ delete window;
+}
+
+void tst_QQuickListView::modelChanges()
+{
+ QQuickView *window = createView();
+ QTRY_VERIFY(window);
+ window->setSource(testFileUrl("propertychangestest.qml"));
+
+ QQuickListView *listView = window->rootObject()->findChild<QQuickListView*>("listView");
+ QTRY_VERIFY(listView);
+
+ QQmlListModel *alternateModel = window->rootObject()->findChild<QQmlListModel*>("alternateModel");
+ QTRY_VERIFY(alternateModel);
+ QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
+ QSignalSpy modelSpy(listView, SIGNAL(modelChanged()));
+
+ listView->setModel(modelVariant);
+ QTRY_COMPARE(listView->model(), modelVariant);
+ QTRY_COMPARE(modelSpy.count(),1);
+
+ listView->setModel(modelVariant);
+ QTRY_COMPARE(modelSpy.count(),1);
+
+ listView->setModel(QVariant());
+ QTRY_COMPARE(modelSpy.count(),2);
+
+ delete window;
+}
+
+void tst_QQuickListView::QTBUG_9791()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("strictlyenforcerange.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_VERIFY(listview->delegate() != 0);
+ QTRY_VERIFY(listview->model() != 0);
+
+ QMetaObject::invokeMethod(listview, "fillModel");
+ qApp->processEvents();
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+ QCOMPARE(itemCount, 3);
+
+ for (int i = 0; i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), i*300.0);
+ }
+
+ // check that view is positioned correctly
+ QTRY_COMPARE(listview->contentX(), 590.0);
+
+ delete window;
+}
+
+void tst_QQuickListView::manualHighlight()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ QString filename(testFile("manual-highlight.qml"));
+ window->setSource(QUrl::fromLocalFile(filename));
+
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(listview->currentIndex(), 0);
+ QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0));
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
+
+ listview->setCurrentIndex(2);
+
+ QTRY_COMPARE(listview->currentIndex(), 2);
+ QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 2));
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
+
+ // QTBUG-15972
+ listview->positionViewAtIndex(3, QQuickListView::Contain);
+
+ QTRY_COMPARE(listview->currentIndex(), 2);
+ QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 2));
+ QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y());
+
+ delete window;
+}
+
+void tst_QQuickListView::QTBUG_11105()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*20);
+ }
+
+ listview->positionViewAtIndex(20, QQuickListView::Beginning);
+ QCOMPARE(listview->contentY(), 280.);
+
+ QaimModel model2;
+ for (int i = 0; i < 5; i++)
+ model2.addItem("Item" + QString::number(i), "");
+
+ ctxt->setContextProperty("testModel", &model2);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ QCOMPARE(itemCount, 5);
+
+ delete window;
+ delete testObject;
+}
+
+void tst_QQuickListView::initialZValues()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("initialZValues.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QVERIFY(listview->headerItem());
+ QTRY_COMPARE(listview->headerItem()->z(), listview->property("initialZ").toReal());
+
+ QVERIFY(listview->footerItem());
+ QTRY_COMPARE(listview->footerItem()->z(), listview->property("initialZ").toReal());
+
+ delete window;
+}
+
+void tst_QQuickListView::header()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, initialHeaderPos);
+ QFETCH(QPointF, changedHeaderPos);
+ QFETCH(QPointF, initialContentPos);
+ QFETCH(QPointF, changedContentPos);
+ QFETCH(QPointF, firstDelegatePos);
+ QFETCH(QPointF, resizeContentPos);
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->rootContext()->setContextProperty("initialViewWidth", 240);
+ window->rootContext()->setContextProperty("initialViewHeight", 320);
+ window->setSource(testFileUrl("header.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *header = 0;
+ QTRY_VERIFY(header = findItem<QQuickText>(contentItem, "header"));
+ QVERIFY(header == listview->headerItem());
+
+ QCOMPARE(header->width(), 100.);
+ QCOMPARE(header->height(), 30.);
+ QCOMPARE(header->position(), initialHeaderPos);
+ QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos);
+
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentHeight(), model.count() * 30. + header->height());
+ else
+ QCOMPARE(listview->contentWidth(), model.count() * 240. + header->width());
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ model.clear();
+ QTRY_COMPARE(listview->count(), model.count());
+ QCOMPARE(header->position(), initialHeaderPos); // header should stay where it is
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentHeight(), header->height());
+ else
+ QCOMPARE(listview->contentWidth(), header->width());
+
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QSignalSpy headerItemSpy(listview, SIGNAL(headerItemChanged()));
+ QMetaObject::invokeMethod(window->rootObject(), "changeHeader");
+
+ QCOMPARE(headerItemSpy.count(), 1);
+
+ header = findItem<QQuickText>(contentItem, "header");
+ QVERIFY(!header);
+ header = findItem<QQuickText>(contentItem, "header2");
+ QVERIFY(header);
+
+ QVERIFY(header == listview->headerItem());
+
+ QCOMPARE(header->position(), changedHeaderPos);
+ QCOMPARE(header->width(), 50.);
+ QCOMPARE(header->height(), 20.);
+ QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), changedContentPos);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ listview->positionViewAtBeginning();
+ header->setHeight(10);
+ header->setWidth(40);
+ QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), resizeContentPos);
+
+ releaseView(window);
+
+
+ // QTBUG-21207 header should become visible if view resizes from initial empty size
+
+ window = getView();
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->rootContext()->setContextProperty("initialViewWidth", 0.0);
+ window->rootContext()->setContextProperty("initialViewHeight", 0.0);
+ window->setSource(testFileUrl("header.qml"));
+ window->show();
+ qApp->processEvents();
+
+ listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ listview->setWidth(240);
+ listview->setHeight(320);
+ QTRY_COMPARE(listview->headerItem()->position(), initialHeaderPos);
+ QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos);
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::header_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("initialHeaderPos");
+ QTest::addColumn<QPointF>("changedHeaderPos");
+ QTest::addColumn<QPointF>("initialContentPos");
+ QTest::addColumn<QPointF>("changedContentPos");
+ QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
+
+ // header1 = 100 x 30
+ // header2 = 50 x 20
+ // delegates = 240 x 30
+ // view width = 240
+
+ // header above items, top left
+ QTest::newRow("vertical, left to right") << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(0, 0)
+ << QPointF(0, -10);
+
+ // header above items, top right
+ QTest::newRow("vertical, layout right to left") << QQuickListView::Vertical << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(0, -30)
+ << QPointF(0, -20)
+ << QPointF(0, 0)
+ << QPointF(0, -10);
+
+ // header to left of items
+ QTest::newRow("horizontal, layout left to right") << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(-100, 0)
+ << QPointF(-50, 0)
+ << QPointF(-100, 0)
+ << QPointF(-50, 0)
+ << QPointF(0, 0)
+ << QPointF(-40, 0);
+
+ // header to right of items
+ QTest::newRow("horizontal, layout right to left") << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(-240 + 100, 0)
+ << QPointF(-240 + 50, 0)
+ << QPointF(-240, 0)
+ << QPointF(-240 + 40, 0);
+
+ // header below items
+ QTest::newRow("vertical, bottom to top") << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, -320 + 30)
+ << QPointF(0, -320 + 20)
+ << QPointF(0, -30)
+ << QPointF(0, -320 + 10);
+}
+
+void tst_QQuickListView::header_delayItemCreation()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+
+ window->rootContext()->setContextProperty("setCurrentToZero", QVariant(false));
+ window->setSource(testFileUrl("fillModelOnComponentCompleted.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *header = findItem<QQuickText>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ QCOMPARE(listview->contentY(), -header->height());
+
+ model.clear();
+ QTRY_COMPARE(header->y(), -header->height());
+
+ delete window;
+}
+
+void tst_QQuickListView::footer()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, initialFooterPos);
+ QFETCH(QPointF, firstDelegatePos);
+ QFETCH(QPointF, initialContentPos);
+ QFETCH(QPointF, changedFooterPos);
+ QFETCH(QPointF, changedContentPos);
+ QFETCH(QPointF, resizeContentPos);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 3; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("footer.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickText *footer = findItem<QQuickText>(contentItem, "footer");
+ QVERIFY(footer);
+
+ QVERIFY(footer == listview->footerItem());
+
+ QCOMPARE(footer->position(), initialFooterPos);
+ QCOMPARE(footer->width(), 100.);
+ QCOMPARE(footer->height(), 30.);
+ QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos);
+
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentHeight(), model.count() * 20. + footer->height());
+ else
+ QCOMPARE(listview->contentWidth(), model.count() * 40. + footer->width());
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ // remove one item
+ model.removeItem(1);
+
+ if (orientation == QQuickListView::Vertical) {
+ QTRY_COMPARE(footer->y(), verticalLayoutDirection == QQuickItemView::TopToBottom ?
+ initialFooterPos.y() - 20 : initialFooterPos.y() + 20); // delegate width = 40
+ } else {
+ QTRY_COMPARE(footer->x(), layoutDirection == Qt::LeftToRight ?
+ initialFooterPos.x() - 40 : initialFooterPos.x() + 40); // delegate width = 40
+ }
+
+ // remove all items
+ model.clear();
+ if (orientation == QQuickListView::Vertical)
+ QTRY_COMPARE(listview->contentHeight(), footer->height());
+ else
+ QTRY_COMPARE(listview->contentWidth(), footer->width());
+
+ QPointF posWhenNoItems(0, 0);
+ if (orientation == QQuickListView::Horizontal && layoutDirection == Qt::RightToLeft)
+ posWhenNoItems.setX(-100);
+ else if (orientation == QQuickListView::Vertical && verticalLayoutDirection == QQuickItemView::BottomToTop)
+ posWhenNoItems.setY(-30);
+ QTRY_COMPARE(footer->position(), posWhenNoItems);
+
+ // if header is present, it's at a negative pos, so the footer should not move
+ window->rootObject()->setProperty("showHeader", true);
+ QTRY_COMPARE(footer->position(), posWhenNoItems);
+ window->rootObject()->setProperty("showHeader", false);
+
+ // add 30 items
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QSignalSpy footerItemSpy(listview, SIGNAL(footerItemChanged()));
+ QMetaObject::invokeMethod(window->rootObject(), "changeFooter");
+
+ QCOMPARE(footerItemSpy.count(), 1);
+
+ footer = findItem<QQuickText>(contentItem, "footer");
+ QVERIFY(!footer);
+ footer = findItem<QQuickText>(contentItem, "footer2");
+ QVERIFY(footer);
+
+ QVERIFY(footer == listview->footerItem());
+
+ QCOMPARE(footer->position(), changedFooterPos);
+ QCOMPARE(footer->width(), 50.);
+ QCOMPARE(footer->height(), 20.);
+ QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), changedContentPos);
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->position(), firstDelegatePos);
+
+ listview->positionViewAtEnd();
+ footer->setHeight(10);
+ footer->setWidth(40);
+ QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), resizeContentPos);
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::footer_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("initialFooterPos");
+ QTest::addColumn<QPointF>("changedFooterPos");
+ QTest::addColumn<QPointF>("initialContentPos");
+ QTest::addColumn<QPointF>("changedContentPos");
+ QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
+
+ // footer1 = 100 x 30
+ // footer2 = 50 x 20
+ // delegates = 40 x 20
+ // view width = 240
+ // view height = 320
+
+ // footer below items, bottom left
+ QTest::newRow("vertical, layout left to right") << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, 3 * 20)
+ << QPointF(0, 30 * 20) // added 30 items
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, 30 * 20 - 320 + 10);
+
+ // footer below items, bottom right
+ QTest::newRow("vertical, layout right to left") << QQuickListView::Vertical << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(0, 3 * 20)
+ << QPointF(0, 30 * 20)
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, 30 * 20 - 320 + 10);
+
+ // footer to right of items
+ QTest::newRow("horizontal, layout left to right") << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(40 * 3, 0)
+ << QPointF(40 * 30, 0)
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(0, 0)
+ << QPointF(40 * 30 - 240 + 40, 0);
+
+ // footer to left of items
+ QTest::newRow("horizontal, layout right to left") << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(-(40 * 3) - 100, 0)
+ << QPointF(-(40 * 30) - 50, 0) // 50 = new footer width
+ << QPointF(-240, 0)
+ << QPointF(-240, 0)
+ << QPointF(-40, 0)
+ << QPointF(-(40 * 30) - 40, 0);
+
+ // footer above items
+ QTest::newRow("vertical, layout left to right") << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, -(3 * 20) - 30)
+ << QPointF(0, -(30 * 20) - 20)
+ << QPointF(0, -320)
+ << QPointF(0, -320)
+ << QPointF(0, -20)
+ << QPointF(0, -(30 * 20) - 10);
+}
+
+class LVAccessor : public QQuickListView
+{
+public:
+ qreal minY() const { return minYExtent(); }
+ qreal maxY() const { return maxYExtent(); }
+ qreal minX() const { return minXExtent(); }
+ qreal maxX() const { return maxXExtent(); }
+};
+
+
+void tst_QQuickListView::extents()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, headerPos);
+ QFETCH(QPointF, footerPos);
+ QFETCH(QPointF, minPos);
+ QFETCH(QPointF, maxPos);
+ QFETCH(QPointF, origin_empty);
+ QFETCH(QPointF, origin_nonEmpty);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ QQmlContext *ctxt = window->rootContext();
+
+ ctxt->setContextProperty("testModel", &model);
+ window->setSource(testFileUrl("headerfooter.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QTRY_VERIFY(listview != 0);
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->position(), headerPos);
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->position(), footerPos);
+
+ QCOMPARE(static_cast<LVAccessor*>(listview)->minX(), minPos.x());
+ QCOMPARE(static_cast<LVAccessor*>(listview)->minY(), minPos.y());
+ QCOMPARE(static_cast<LVAccessor*>(listview)->maxX(), maxPos.x());
+ QCOMPARE(static_cast<LVAccessor*>(listview)->maxY(), maxPos.y());
+
+ QCOMPARE(listview->originX(), origin_empty.x());
+ QCOMPARE(listview->originY(), origin_empty.y());
+ for (int i=0; i<30; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QTRY_COMPARE(listview->count(), model.count());
+ QCOMPARE(listview->originX(), origin_nonEmpty.x());
+ QCOMPARE(listview->originY(), origin_nonEmpty.y());
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::extents_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("headerPos");
+ QTest::addColumn<QPointF>("footerPos");
+ QTest::addColumn<QPointF>("minPos");
+ QTest::addColumn<QPointF>("maxPos");
+ QTest::addColumn<QPointF>("origin_empty");
+ QTest::addColumn<QPointF>("origin_nonEmpty");
+
+ // header is 240x20 (or 20x320 in Horizontal orientation)
+ // footer is 240x30 (or 30x320 in Horizontal orientation)
+
+ QTest::newRow("Vertical, TopToBottom")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, -20) << QPointF(0, 0)
+ << QPointF(0, 20) << QPointF(240, 20)
+ << QPointF(0, -20) << QPointF(0, -20);
+
+ QTest::newRow("Vertical, BottomToTop")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, 0) << QPointF(0, -30)
+ << QPointF(0, 320 - 20) << QPointF(240, 320 - 20) // content flow is reversed
+ << QPointF(0, -30) << QPointF(0, (-30.0 * 30) - 30);
+
+ QTest::newRow("Horizontal, LeftToRight")
+ << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(-20, 0) << QPointF(0, 0)
+ << QPointF(20, 0) << QPointF(20, 320)
+ << QPointF(-20, 0) << QPointF(-20, 0);
+
+ QTest::newRow("Horizontal, RightToLeft")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(0, 0) << QPointF(-30, 0)
+ << QPointF(240 - 20, 0) << QPointF(240 - 20, 320) // content flow is reversed
+ << QPointF(-30, 0) << QPointF((-240.0 * 30) - 30, 0);
+}
+
+void tst_QQuickListView::resetModel_headerFooter()
+{
+ // Resetting a model shouldn't crash in views with header/footer
+
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 4; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("headerfooter.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QQuickItem *header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ QQuickItem *footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 30.*4);
+
+ model.reset();
+
+ header = findItem<QQuickItem>(contentItem, "header");
+ QVERIFY(header);
+ QCOMPARE(header->y(), -header->height());
+
+ footer = findItem<QQuickItem>(contentItem, "footer");
+ QVERIFY(footer);
+ QCOMPARE(footer->y(), 30.*4);
+
+ delete window;
+}
+
+void tst_QQuickListView::resizeView()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.);
+ }
+
+ QVariant heightRatio;
+ QMetaObject::invokeMethod(window->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio));
+ QCOMPARE(heightRatio.toReal(), 0.4);
+
+ listview->setHeight(200);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QMetaObject::invokeMethod(window->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio));
+ QCOMPARE(heightRatio.toReal(), 0.25);
+
+ // Ensure we handle -ve sizes
+ listview->setHeight(-100);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 1);
+
+ listview->setCacheBuffer(200);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 11);
+
+ // ensure items in cache become visible
+ listview->setHeight(200);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 21);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.);
+ QCOMPARE(delegateVisible(item), i < 11); // inside view visible, outside not visible
+ }
+
+ // ensure items outside view become invisible
+ listview->setHeight(100);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 16);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*20.);
+ QCOMPARE(delegateVisible(item), i < 6); // inside view visible, outside not visible
+ }
+
+ delete window;
+ delete testObject;
+}
+
+void tst_QQuickListView::resizeViewAndRepaint()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("initialHeight", 100);
+
+ window->setSource(testFileUrl("resizeview.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // item at index 10 should not be currently visible
+ QVERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 10));
+
+ listview->setHeight(320);
+
+ QTRY_VERIFY(findItem<QQuickItem>(contentItem, "wrapper", 10));
+
+ listview->setHeight(100);
+ QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 10));
+
+ delete window;
+}
+
+void tst_QQuickListView::sizeLessThan1()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("sizelessthan1.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Confirm items positioned correctly
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i = 0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->y(), i*0.5);
+ }
+
+ delete window;
+ delete testObject;
+}
+
+void tst_QQuickListView::QTBUG_14821()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("qtbug14821.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ listview->decrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 99);
+
+ listview->incrementCurrentIndex();
+ QCOMPARE(listview->currentIndex(), 0);
+
+ delete window;
+}
+
+void tst_QQuickListView::resizeDelegate()
+{
+ QQuickView *window = createView();
+
+ QStringList strings;
+ for (int i = 0; i < 30; ++i)
+ strings << QString::number(i);
+ QStringListModel model(strings);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("displaylist.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QVERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QCOMPARE(listview->count(), model.rowCount());
+
+ listview->setCurrentIndex(25);
+ listview->setContentY(0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ for (int i = 0; i < 16; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QCOMPARE(item->y(), i*20.0);
+ }
+
+ QCOMPARE(listview->currentItem()->y(), 500.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 500.0);
+
+ window->rootObject()->setProperty("delegateHeight", 30);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ for (int i = 0; i < 11; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QTRY_COMPARE(item->y(), i*30.0);
+ }
+
+ QTRY_COMPARE(listview->currentItem()->y(), 750.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 750.0);
+
+ listview->setCurrentIndex(1);
+ listview->positionViewAtIndex(25, QQuickListView::Beginning);
+ listview->positionViewAtIndex(5, QQuickListView::Beginning);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ for (int i = 5; i < 16; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QCOMPARE(item->y(), i*30.0);
+ }
+
+ QTRY_COMPARE(listview->currentItem()->y(), 30.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 30.0);
+
+ window->rootObject()->setProperty("delegateHeight", 20);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ for (int i = 5; i < 11; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QTRY_COMPARE(item->y(), 150 + (i-5)*20.0);
+ }
+
+ QTRY_COMPARE(listview->currentItem()->y(), 70.0);
+ QTRY_COMPARE(listview->highlightItem()->y(), 70.0);
+
+ delete window;
+}
+
+void tst_QQuickListView::resizeFirstDelegate()
+{
+ // QTBUG-20712: Content Y jumps constantly if first delegate height == 0
+ // and other delegates have height > 0
+
+ QQuickView *window = createView();
+
+ // bug only occurs when all items in the model are visible
+ QaimModel model;
+ for (int i = 0; i < 10; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QVERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *item = 0;
+ for (int i = 0; i < model.count(); ++i) {
+ item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QCOMPARE(item->y(), i*20.0);
+ }
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ item->setHeight(0);
+
+ // check the content y has not jumped up and down
+ QCOMPARE(listview->contentY(), 0.0);
+ QSignalSpy spy(listview, SIGNAL(contentYChanged()));
+ QTest::qWait(100);
+ QCOMPARE(spy.count(), 0);
+
+ for (int i = 1; i < model.count(); ++i) {
+ item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY(item != 0);
+ QTRY_COMPARE(item->y(), (i-1)*20.0);
+ }
+
+
+ // QTBUG-22014: refill doesn't clear items scrolling off the top of the
+ // list if they follow a zero-sized delegate
+
+ for (int i = 0; i < 10; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QTRY_COMPARE(listview->count(), model.count());
+
+ item = findItem<QQuickItem>(contentItem, "wrapper", 1);
+ QVERIFY(item);
+ item->setHeight(0);
+
+ listview->setCurrentIndex(19);
+ qApp->processEvents();
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // items 0-2 should have been deleted
+ for (int i=0; i<3; i++) {
+ QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", i));
+ }
+
+ delete testObject;
+ delete window;
+}
+
+void tst_QQuickListView::repositionResizedDelegate()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(QPointF, contentPos_itemFirstHalfVisible);
+ QFETCH(QPointF, contentPos_itemSecondHalfVisible);
+ QFETCH(QRectF, origPositionerRect);
+ QFETCH(QRectF, resizedPositionerRect);
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testHorizontal", orientation == QQuickListView::Horizontal);
+ ctxt->setContextProperty("testRightToLeft", layoutDirection == Qt::RightToLeft);
+ ctxt->setContextProperty("testBottomToTop", verticalLayoutDirection == QQuickListView::BottomToTop);
+ window->setSource(testFileUrl("repositionResizedDelegate.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QTRY_VERIFY(listview != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *positioner = findItem<QQuickItem>(window->rootObject(), "positioner");
+ QVERIFY(positioner);
+ QTRY_COMPARE(positioner->boundingRect().size(), origPositionerRect.size());
+ QTRY_COMPARE(positioner->position(), origPositionerRect.topLeft());
+ QSignalSpy spy(listview, orientation == QQuickListView::Vertical ? SIGNAL(contentYChanged()) : SIGNAL(contentXChanged()));
+ int prevSpyCount = 0;
+
+ // When an item is resized while it is partially visible, it should resize in the
+ // direction of the content flow. If a RightToLeft or BottomToTop layout is used,
+ // the item should also be re-positioned so its end position stays the same.
+
+ listview->setContentX(contentPos_itemFirstHalfVisible.x());
+ listview->setContentY(contentPos_itemFirstHalfVisible.y());
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ prevSpyCount = spy.count();
+ QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater"));
+ QTRY_COMPARE(positioner->boundingRect().size(), resizedPositionerRect.size());
+ QTRY_COMPARE(positioner->position(), resizedPositionerRect.topLeft());
+ QCOMPARE(listview->contentX(), contentPos_itemFirstHalfVisible.x());
+ QCOMPARE(listview->contentY(), contentPos_itemFirstHalfVisible.y());
+ QCOMPARE(spy.count(), prevSpyCount);
+
+ QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "decrementRepeater"));
+ QTRY_COMPARE(positioner->boundingRect().size(), origPositionerRect.size());
+ QTRY_COMPARE(positioner->position(), origPositionerRect.topLeft());
+ QCOMPARE(listview->contentX(), contentPos_itemFirstHalfVisible.x());
+ QCOMPARE(listview->contentY(), contentPos_itemFirstHalfVisible.y());
+
+ listview->setContentX(contentPos_itemSecondHalfVisible.x());
+ listview->setContentY(contentPos_itemSecondHalfVisible.y());
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ prevSpyCount = spy.count();
+
+ QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater"));
+ positioner = findItem<QQuickItem>(window->rootObject(), "positioner");
+ QTRY_COMPARE(positioner->boundingRect().size(), resizedPositionerRect.size());
+ QTRY_COMPARE(positioner->position(), resizedPositionerRect.topLeft());
+ QCOMPARE(listview->contentX(), contentPos_itemSecondHalfVisible.x());
+ QCOMPARE(listview->contentY(), contentPos_itemSecondHalfVisible.y());
+ qApp->processEvents();
+ QCOMPARE(spy.count(), prevSpyCount);
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::repositionResizedDelegate_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickListView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<QPointF>("contentPos_itemFirstHalfVisible");
+ QTest::addColumn<QPointF>("contentPos_itemSecondHalfVisible");
+ QTest::addColumn<QRectF>("origPositionerRect");
+ QTest::addColumn<QRectF>("resizedPositionerRect");
+
+ QTest::newRow("vertical")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(0, 60) << QPointF(0, 200 + 60)
+ << QRectF(0, 200, 120, 120)
+ << QRectF(0, 200, 120, 120 * 2);
+
+ QTest::newRow("vertical, BottomToTop")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << QPointF(0, -200 - 60) << QPointF(0, -200 - 260)
+ << QRectF(0, -200 - 120, 120, 120)
+ << QRectF(0, -200 - 120*2, 120, 120 * 2);
+
+ QTest::newRow("horizontal")
+ << QQuickListView::Horizontal<< Qt::LeftToRight << QQuickItemView::TopToBottom
+ << QPointF(60, 0) << QPointF(260, 0)
+ << QRectF(200, 0, 120, 120)
+ << QRectF(200, 0, 120 * 2, 120);
+
+ QTest::newRow("horizontal, rtl")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << QPointF(-200 - 60, 0) << QPointF(-200 - 260, 0)
+ << QRectF(-200 - 120, 0, 120, 120)
+ << QRectF(-200 - 120 * 2, 0, 120 * 2, 120);
+}
+
+void tst_QQuickListView::QTBUG_16037()
+{
+ QQuickView *window = createView();
+ window->show();
+
+ window->setSource(testFileUrl("qtbug16037.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "listview");
+ QTRY_VERIFY(listview != 0);
+
+ QVERIFY(listview->contentHeight() <= 0.0);
+
+ QMetaObject::invokeMethod(window->rootObject(), "setModel");
+
+ QTRY_COMPARE(listview->contentHeight(), 80.0);
+
+ delete window;
+}
+
+void tst_QQuickListView::indexAt_itemAt_data()
+{
+ QTest::addColumn<qreal>("x");
+ QTest::addColumn<qreal>("y");
+ QTest::addColumn<int>("index");
+
+ QTest::newRow("Item 0 - 0, 0") << 0. << 0. << 0;
+ QTest::newRow("Item 0 - 0, 19") << 0. << 19. << 0;
+ QTest::newRow("Item 0 - 239, 19") << 239. << 19. << 0;
+ QTest::newRow("Item 1 - 0, 20") << 0. << 20. << 1;
+ QTest::newRow("No Item - 240, 20") << 240. << 20. << -1;
+}
+
+void tst_QQuickListView::indexAt_itemAt()
+{
+ QFETCH(qreal, x);
+ QFETCH(qreal, y);
+ QFETCH(int, index);
+
+ QQuickView *window = getView();
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("listviewtest.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *item = 0;
+ if (index >= 0) {
+ item = findItem<QQuickItem>(contentItem, "wrapper", index);
+ QVERIFY(item);
+ }
+ QCOMPARE(listview->indexAt(x,y), index);
+ QVERIFY(listview->itemAt(x,y) == item);
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::incrementalModel()
+{
+ QQuickView *window = createView();
+
+ IncrementalModel model;
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("displaylist.qml"));
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(listview->count(), 20);
+
+ listview->positionViewAtIndex(10, QQuickListView::Beginning);
+
+ QTRY_COMPARE(listview->count(), 25);
+
+ delete window;
+}
+
+void tst_QQuickListView::onAdd()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(int, itemsToAdd);
+
+ const int delegateHeight = 10;
+ QaimModel model;
+
+ // these initial items should not trigger ListView.onAdd
+ for (int i=0; i<initialItemCount; i++)
+ model.addItem("dummy value", "dummy value");
+
+ QQuickView *window = createView();
+ window->setGeometry(0,0,200, delegateHeight * (initialItemCount + itemsToAdd));
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("delegateHeight", delegateHeight);
+ window->setSource(testFileUrl("attachedSignals.qml"));
+
+ QObject *object = window->rootObject();
+ object->setProperty("width", window->width());
+ object->setProperty("height", window->height());
+ qApp->processEvents();
+
+ QList<QPair<QString, QString> > items;
+ for (int i=0; i<itemsToAdd; i++)
+ items << qMakePair(QString("value %1").arg(i), QString::number(i));
+ model.addItems(items);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ QVariantList result = object->property("addedDelegates").toList();
+ QCOMPARE(result.count(), items.count());
+ for (int i=0; i<items.count(); i++)
+ QCOMPARE(result[i].toString(), items[i].first);
+
+ delete window;
+}
+
+void tst_QQuickListView::onAdd_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<int>("itemsToAdd");
+
+ QTest::newRow("0, add 1") << 0 << 1;
+ QTest::newRow("0, add 2") << 0 << 2;
+ QTest::newRow("0, add 10") << 0 << 10;
+
+ QTest::newRow("1, add 1") << 1 << 1;
+ QTest::newRow("1, add 2") << 1 << 2;
+ QTest::newRow("1, add 10") << 1 << 10;
+
+ QTest::newRow("5, add 1") << 5 << 1;
+ QTest::newRow("5, add 2") << 5 << 2;
+ QTest::newRow("5, add 10") << 5 << 10;
+}
+
+void tst_QQuickListView::onRemove()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(int, indexToRemove);
+ QFETCH(int, removeCount);
+
+ const int delegateHeight = 10;
+ QaimModel model;
+ for (int i=0; i<initialItemCount; i++)
+ model.addItem(QString("value %1").arg(i), "dummy value");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("delegateHeight", delegateHeight);
+ window->setSource(testFileUrl("attachedSignals.qml"));
+
+ QObject *object = window->rootObject();
+
+ model.removeItems(indexToRemove, removeCount);
+ QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count());
+
+ QCOMPARE(object->property("removedDelegateCount"), QVariant(removeCount));
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::onRemove_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<int>("indexToRemove");
+ QTest::addColumn<int>("removeCount");
+
+ QTest::newRow("remove first") << 1 << 0 << 1;
+ QTest::newRow("two items, remove first") << 2 << 0 << 1;
+ QTest::newRow("two items, remove last") << 2 << 1 << 1;
+ QTest::newRow("two items, remove all") << 2 << 0 << 2;
+
+ QTest::newRow("four items, remove first") << 4 << 0 << 1;
+ QTest::newRow("four items, remove 0-2") << 4 << 0 << 2;
+ QTest::newRow("four items, remove 1-3") << 4 << 1 << 2;
+ QTest::newRow("four items, remove 2-4") << 4 << 2 << 2;
+ QTest::newRow("four items, remove last") << 4 << 3 << 1;
+ QTest::newRow("four items, remove all") << 4 << 0 << 4;
+
+ QTest::newRow("ten items, remove 1-8") << 10 << 0 << 8;
+ QTest::newRow("ten items, remove 2-7") << 10 << 2 << 5;
+ QTest::newRow("ten items, remove 4-10") << 10 << 4 << 6;
+}
+
+void tst_QQuickListView::rightToLeft()
+{
+ QQuickView *window = createView();
+ window->setGeometry(0,0,640,320);
+ window->setSource(testFileUrl("rightToLeft.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QVERIFY(window->rootObject() != 0);
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel");
+ QTRY_VERIFY(model != 0);
+
+ QTRY_VERIFY(model->count() == 3);
+ QTRY_COMPARE(listview->currentIndex(), 0);
+
+ // initial position at first item, right edge aligned
+ QCOMPARE(listview->contentX(), -640.);
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "item1");
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), -100.0);
+ QCOMPARE(item->height(), listview->height());
+
+ QQuickText *text = findItem<QQuickText>(contentItem, "text1");
+ QTRY_VERIFY(text);
+ QTRY_COMPARE(text->text(), QLatin1String("index: 0"));
+
+ listview->setCurrentIndex(2);
+
+ item = findItem<QQuickItem>(contentItem, "item3");
+ QTRY_VERIFY(item);
+ QTRY_COMPARE(item->x(), -540.0);
+
+ text = findItem<QQuickText>(contentItem, "text3");
+ QTRY_VERIFY(text);
+ QTRY_COMPARE(text->text(), QLatin1String("index: 2"));
+
+ QCOMPARE(listview->contentX(), -640.);
+
+ // Ensure resizing maintains position relative to right edge
+ qobject_cast<QQuickItem*>(window->rootObject())->setWidth(600);
+ QTRY_COMPARE(listview->contentX(), -600.);
+
+ delete window;
+}
+
+void tst_QQuickListView::test_mirroring()
+{
+ QQuickView *windowA = createView();
+ windowA->setSource(testFileUrl("rightToLeft.qml"));
+ QQuickListView *listviewA = findItem<QQuickListView>(windowA->rootObject(), "view");
+ QTRY_VERIFY(listviewA != 0);
+
+ QQuickView *windowB = createView();
+ windowB->setSource(testFileUrl("rightToLeft.qml"));
+ QQuickListView *listviewB = findItem<QQuickListView>(windowB->rootObject(), "view");
+ QTRY_VERIFY(listviewA != 0);
+ qApp->processEvents();
+
+ QList<QString> objectNames;
+ objectNames << "item1" << "item2"; // << "item3"
+
+ listviewA->setProperty("layoutDirection", Qt::LeftToRight);
+ listviewB->setProperty("layoutDirection", Qt::RightToLeft);
+ QCOMPARE(listviewA->layoutDirection(), listviewA->effectiveLayoutDirection());
+
+ // LTR != RTL
+ foreach (const QString objectName, objectNames)
+ QVERIFY(findItem<QQuickItem>(listviewA, objectName)->x() != findItem<QQuickItem>(listviewB, objectName)->x());
+
+ listviewA->setProperty("layoutDirection", Qt::LeftToRight);
+ listviewB->setProperty("layoutDirection", Qt::LeftToRight);
+
+ // LTR == LTR
+ foreach (const QString objectName, objectNames)
+ QCOMPARE(findItem<QQuickItem>(listviewA, objectName)->x(), findItem<QQuickItem>(listviewB, objectName)->x());
+
+ QVERIFY(listviewB->layoutDirection() == listviewB->effectiveLayoutDirection());
+ QQuickItemPrivate::get(listviewB)->setLayoutMirror(true);
+ QVERIFY(listviewB->layoutDirection() != listviewB->effectiveLayoutDirection());
+
+ // LTR != LTR+mirror
+ foreach (const QString objectName, objectNames)
+ QVERIFY(findItem<QQuickItem>(listviewA, objectName)->x() != findItem<QQuickItem>(listviewB, objectName)->x());
+
+ listviewA->setProperty("layoutDirection", Qt::RightToLeft);
+
+ // RTL == LTR+mirror
+ foreach (const QString objectName, objectNames)
+ QCOMPARE(findItem<QQuickItem>(listviewA, objectName)->x(), findItem<QQuickItem>(listviewB, objectName)->x());
+
+ listviewB->setProperty("layoutDirection", Qt::RightToLeft);
+
+ // RTL != RTL+mirror
+ foreach (const QString objectName, objectNames)
+ QVERIFY(findItem<QQuickItem>(listviewA, objectName)->x() != findItem<QQuickItem>(listviewB, objectName)->x());
+
+ listviewA->setProperty("layoutDirection", Qt::LeftToRight);
+
+ // LTR == RTL+mirror
+ foreach (const QString objectName, objectNames)
+ QCOMPARE(findItem<QQuickItem>(listviewA, objectName)->x(), findItem<QQuickItem>(listviewB, objectName)->x());
+
+ delete windowA;
+ delete windowB;
+}
+
+void tst_QQuickListView::margins()
+{
+ QQuickView *window = createView();
+
+ QaimModel model;
+ for (int i = 0; i < 50; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("margins.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QCOMPARE(listview->contentY(), -30.);
+ QCOMPARE(listview->originY(), 0.);
+
+ // check end bound
+ listview->positionViewAtEnd();
+ qreal pos = listview->contentY();
+ listview->setContentY(pos + 80);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ listview->returnToBounds();
+ QTRY_COMPARE(listview->contentY(), pos + 50);
+
+ // remove item before visible and check that top margin is maintained
+ // and originY is updated
+ listview->setContentY(100);
+ model.removeItem(1);
+ QTRY_COMPARE(listview->count(), model.count());
+ listview->setContentY(-50);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ listview->returnToBounds();
+ QCOMPARE(listview->originY(), 20.);
+ QTRY_COMPARE(listview->contentY(), -10.);
+
+ // reduce top margin
+ listview->setTopMargin(20);
+ QCOMPARE(listview->originY(), 20.);
+ QTRY_COMPARE(listview->contentY(), 0.);
+
+ // check end bound
+ listview->positionViewAtEnd();
+ pos = listview->contentY();
+ listview->setContentY(pos + 80);
+ listview->returnToBounds();
+ QTRY_COMPARE(listview->contentY(), pos + 50);
+
+ // reduce bottom margin
+ pos = listview->contentY();
+ listview->setBottomMargin(40);
+ QCOMPARE(listview->originY(), 20.);
+ QTRY_COMPARE(listview->contentY(), pos-10);
+
+ delete window;
+}
+
+// QTBUG-24028
+void tst_QQuickListView::marginsResize()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(qreal, start);
+ QFETCH(qreal, end);
+
+ QPoint flickStart(20, 20);
+ QPoint flickEnd(20, 20);
+ if (orientation == QQuickListView::Vertical)
+ flickStart.ry() += (verticalLayoutDirection == QQuickItemView::TopToBottom) ? 180 : -180;
+ else
+ flickStart.rx() += (layoutDirection == Qt::LeftToRight) ? 180 : -180;
+
+ QQuickView *window = getView();
+
+ window->setSource(testFileUrl("margins2.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "listview");
+ QTRY_VERIFY(listview != 0);
+
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // view is resized after componentCompleted - top margin should still be visible
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentY(), start);
+ else
+ QCOMPARE(listview->contentX(), start);
+
+ // move to last index and ensure bottom margin is visible.
+ listview->setCurrentIndex(19);
+ if (orientation == QQuickListView::Vertical)
+ QTRY_COMPARE(listview->contentY(), end);
+ else
+ QTRY_COMPARE(listview->contentX(), end);
+
+ // flick past the end and check content pos still settles on correct extents
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(listview->isMoving() == false);
+ if (orientation == QQuickListView::Vertical)
+ QTRY_COMPARE(listview->contentY(), end);
+ else
+ QTRY_COMPARE(listview->contentX(), end);
+
+ // back to top - top margin should be visible.
+ listview->setCurrentIndex(0);
+ if (orientation == QQuickListView::Vertical)
+ QTRY_COMPARE(listview->contentY(), start);
+ else
+ QTRY_COMPARE(listview->contentX(), start);
+
+ // flick past the beginning and check content pos still settles on correct extents
+ flick(window, flickEnd, flickStart, 180);
+ QTRY_VERIFY(listview->isMoving() == false);
+ if (orientation == QQuickListView::Vertical)
+ QTRY_COMPARE(listview->contentY(), start);
+ else
+ QTRY_COMPARE(listview->contentX(), start);
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::marginsResize_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickListView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<qreal>("start");
+ QTest::addColumn<qreal>("end");
+
+ // in Right to Left mode, leftMargin still means leftMargin - it doesn't reverse to mean rightMargin
+
+ QTest::newRow("vertical")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom
+ << -40.0 << 1020.0;
+
+ QTest::newRow("vertical, BottomToTop")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop
+ << -180.0 << -1240.0;
+
+ QTest::newRow("horizontal")
+ << QQuickListView::Horizontal<< Qt::LeftToRight << QQuickItemView::TopToBottom
+ << -40.0 << 1020.0;
+
+ QTest::newRow("horizontal, rtl")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom
+ << -180.0 << -1240.0;
+}
+
+void tst_QQuickListView::snapToItem_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<int>("highlightRangeMode");
+ QTest::addColumn<QPoint>("flickStart");
+ QTest::addColumn<QPoint>("flickEnd");
+ QTest::addColumn<qreal>("snapAlignment");
+ QTest::addColumn<qreal>("endExtent");
+ QTest::addColumn<qreal>("startExtent");
+
+ QTest::newRow("vertical, top to bottom")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 560.0 << 0.0;
+
+ QTest::newRow("vertical, bottom to top")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 20) << QPoint(20, 200) << -60.0 << -560.0 - 240.0 << -240.0;
+
+ QTest::newRow("horizontal, left to right")
+ << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::NoHighlightRange)
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 560.0 << 0.0;
+
+ QTest::newRow("horizontal, right to left")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 << -240.0;
+
+ QTest::newRow("vertical, top to bottom, enforce range")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 700.0 << -20.0;
+
+ QTest::newRow("vertical, bottom to top, enforce range")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 20) << QPoint(20, 200) << -60.0 << -560.0 - 240.0 - 140.0 << -220.0;
+
+ QTest::newRow("horizontal, left to right, enforce range")
+ << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 700.0 << -20.0;
+
+ QTest::newRow("horizontal, right to left, enforce range")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 - 140.0 << -220.0;
+}
+
+void tst_QQuickListView::snapToItem()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(int, highlightRangeMode);
+ QFETCH(QPoint, flickStart);
+ QFETCH(QPoint, flickEnd);
+ QFETCH(qreal, snapAlignment);
+ QFETCH(qreal, endExtent);
+ QFETCH(qreal, startExtent);
+
+ QQuickView *window = getView();
+
+ window->setSource(testFileUrl("snapToItem.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ listview->setHighlightRangeMode(QQuickItemView::HighlightRangeMode(highlightRangeMode));
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ // confirm that a flick hits an item boundary
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(listview->isMoving() == false); // wait until it stops
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(qreal(fmod(listview->contentY(),80.0)), snapAlignment);
+ else
+ QCOMPARE(qreal(fmod(listview->contentX(),80.0)), snapAlignment);
+
+ // flick to end
+ do {
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(listview->isMoving() == false); // wait until it stops
+ } while (orientation == QQuickListView::Vertical
+ ? verticalLayoutDirection == QQuickItemView::TopToBottom ? !listview->isAtYEnd() : !listview->isAtYBeginning()
+ : layoutDirection == Qt::LeftToRight ? !listview->isAtXEnd() : !listview->isAtXBeginning());
+
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentY(), endExtent);
+ else
+ QCOMPARE(listview->contentX(), endExtent);
+
+ // flick to start
+ do {
+ flick(window, flickEnd, flickStart, 180);
+ QTRY_VERIFY(listview->isMoving() == false); // wait until it stops
+ } while (orientation == QQuickListView::Vertical
+ ? verticalLayoutDirection == QQuickItemView::TopToBottom ? !listview->isAtYBeginning() : !listview->isAtYEnd()
+ : layoutDirection == Qt::LeftToRight ? !listview->isAtXBeginning() : !listview->isAtXEnd());
+
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentY(), startExtent);
+ else
+ QCOMPARE(listview->contentX(), startExtent);
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_items()
+{
+ items<QaimModel>(testFileUrl("listviewtest-package.qml"), true);
+}
+
+void tst_QQuickListView::qAbstractItemModel_items()
+{
+ items<QaimModel>(testFileUrl("listviewtest.qml"), false);
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_changed()
+{
+ changed<QaimModel>(testFileUrl("listviewtest-package.qml"), true);
+}
+
+void tst_QQuickListView::qAbstractItemModel_changed()
+{
+ changed<QaimModel>(testFileUrl("listviewtest.qml"), false);
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_inserted()
+{
+ inserted<QaimModel>(testFileUrl("listviewtest-package.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_inserted()
+{
+ inserted<QaimModel>(testFileUrl("listviewtest.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_inserted_more()
+{
+ inserted_more<QaimModel>();
+}
+
+void tst_QQuickListView::qAbstractItemModel_inserted_more_data()
+{
+ inserted_more_data();
+}
+
+void tst_QQuickListView::qAbstractItemModel_inserted_more_bottomToTop()
+{
+ inserted_more<QaimModel>(QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickListView::qAbstractItemModel_inserted_more_bottomToTop_data()
+{
+ inserted_more_data();
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_removed()
+{
+ removed<QaimModel>(testFileUrl("listviewtest-package.qml"), false);
+ removed<QaimModel>(testFileUrl("listviewtest-package.qml"), true);
+}
+
+void tst_QQuickListView::qAbstractItemModel_removed()
+{
+ removed<QaimModel>(testFileUrl("listviewtest.qml"), false);
+ removed<QaimModel>(testFileUrl("listviewtest.qml"), true);
+}
+
+void tst_QQuickListView::qAbstractItemModel_removed_more()
+{
+ removed_more<QaimModel>(testFileUrl("listviewtest.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_removed_more_data()
+{
+ removed_more_data();
+}
+
+void tst_QQuickListView::qAbstractItemModel_removed_more_bottomToTop()
+{
+ removed_more<QaimModel>(testFileUrl("listviewtest.qml"), QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickListView::qAbstractItemModel_removed_more_bottomToTop_data()
+{
+ removed_more_data();
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_moved()
+{
+ moved<QaimModel>(testFileUrl("listviewtest-package.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_moved_data()
+{
+ moved_data();
+}
+
+void tst_QQuickListView::qAbstractItemModel_moved()
+{
+ moved<QaimModel>(testFileUrl("listviewtest.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_moved_data()
+{
+ moved_data();
+}
+
+void tst_QQuickListView::qAbstractItemModel_moved_bottomToTop()
+{
+ moved<QaimModel>(testFileUrl("listviewtest-package.qml"), QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickListView::qAbstractItemModel_moved_bottomToTop_data()
+{
+ moved_data();
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_clear()
+{
+ clear<QaimModel>(testFileUrl("listviewtest-package.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_clear()
+{
+ clear<QaimModel>(testFileUrl("listviewtest.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_clear_bottomToTop()
+{
+ clear<QaimModel>(testFileUrl("listviewtest.qml"), QQuickItemView::BottomToTop);
+}
+
+void tst_QQuickListView::qAbstractItemModel_package_sections()
+{
+ sections<QaimModel>(testFileUrl("listview-sections-package.qml"));
+}
+
+void tst_QQuickListView::qAbstractItemModel_sections()
+{
+ sections<QaimModel>(testFileUrl("listview-sections.qml"));
+}
+
+void tst_QQuickListView::creationContext()
+{
+ QQuickView window;
+ window.setGeometry(0,0,240,320);
+ window.setSource(testFileUrl("creationContext.qml"));
+ qApp->processEvents();
+
+ QQuickItem *rootItem = qobject_cast<QQuickItem *>(window.rootObject());
+ QVERIFY(rootItem);
+ QVERIFY(rootItem->property("count").toInt() > 0);
+
+ QQuickItem *item;
+ QVERIFY(item = findItem<QQuickItem>(rootItem, "listItem"));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+ QVERIFY(item = rootItem->findChild<QQuickItem *>("header"));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+ QVERIFY(item = rootItem->findChild<QQuickItem *>("footer"));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+ QVERIFY(item = rootItem->findChild<QQuickItem *>("section"));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+}
+
+void tst_QQuickListView::QTBUG_21742()
+{
+ QQuickView window;
+ window.setGeometry(0,0,200,200);
+ window.setSource(testFileUrl("qtbug-21742.qml"));
+ qApp->processEvents();
+
+ QQuickItem *rootItem = qobject_cast<QQuickItem *>(window.rootObject());
+ QVERIFY(rootItem);
+ QCOMPARE(rootItem->property("count").toInt(), 1);
+}
+
+void tst_QQuickListView::asynchronous()
+{
+ QQuickView *window = createView();
+ window->show();
+ QQmlIncubationController controller;
+ window->engine()->setIncubationController(&controller);
+
+ window->setSource(testFileUrl("asyncloader.qml"));
+
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootObject);
+
+ QQuickListView *listview = 0;
+ while (!listview) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ listview = rootObject->findChild<QQuickListView*>("view");
+ }
+
+ // items will be created one at a time
+ for (int i = 0; i < 8; ++i) {
+ QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(listview, "wrapper", i);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ // verify positioning
+ QQuickItem *contentItem = listview->contentItem();
+ for (int i = 0; i < 8; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QTRY_COMPARE(item->y(), i*50.0);
+ }
+
+ delete window;
+}
+
+void tst_QQuickListView::snapOneItem_data()
+{
+ QTest::addColumn<QQuickListView::Orientation>("orientation");
+ QTest::addColumn<Qt::LayoutDirection>("layoutDirection");
+ QTest::addColumn<QQuickItemView::VerticalLayoutDirection>("verticalLayoutDirection");
+ QTest::addColumn<int>("highlightRangeMode");
+ QTest::addColumn<QPoint>("flickStart");
+ QTest::addColumn<QPoint>("flickEnd");
+ QTest::addColumn<qreal>("snapAlignment");
+ QTest::addColumn<qreal>("endExtent");
+ QTest::addColumn<qreal>("startExtent");
+
+ QTest::newRow("vertical, top to bottom")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 200) << QPoint(20, 20) << 180.0 << 560.0 << 0.0;
+
+ QTest::newRow("vertical, bottom to top")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 20) << QPoint(20, 200) << -420.0 << -560.0 - 240.0 << -240.0;
+
+ QTest::newRow("horizontal, left to right")
+ << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::NoHighlightRange)
+ << QPoint(200, 20) << QPoint(20, 20) << 180.0 << 560.0 << 0.0;
+
+ QTest::newRow("horizontal, right to left")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom << int(QQuickItemView::NoHighlightRange)
+ << QPoint(20, 20) << QPoint(200, 20) << -420.0 << -560.0 - 240.0 << -240.0;
+
+ QTest::newRow("vertical, top to bottom, enforce range")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 200) << QPoint(20, 20) << 180.0 << 580.0 << -20.0;
+
+ QTest::newRow("vertical, bottom to top, enforce range")
+ << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 20) << QPoint(20, 200) << -420.0 << -580.0 - 240.0 << -220.0;
+
+ QTest::newRow("horizontal, left to right, enforce range")
+ << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(200, 20) << QPoint(20, 20) << 180.0 << 580.0 << -20.0;
+
+ QTest::newRow("horizontal, right to left, enforce range")
+ << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom << int(QQuickItemView::StrictlyEnforceRange)
+ << QPoint(20, 20) << QPoint(200, 20) << -420.0 << -580.0 - 240.0 << -220.0;
+}
+
+void tst_QQuickListView::snapOneItem()
+{
+ QFETCH(QQuickListView::Orientation, orientation);
+ QFETCH(Qt::LayoutDirection, layoutDirection);
+ QFETCH(QQuickItemView::VerticalLayoutDirection, verticalLayoutDirection);
+ QFETCH(int, highlightRangeMode);
+ QFETCH(QPoint, flickStart);
+ QFETCH(QPoint, flickEnd);
+ QFETCH(qreal, snapAlignment);
+ QFETCH(qreal, endExtent);
+ QFETCH(qreal, startExtent);
+
+ QQuickView *window = getView();
+
+ window->setSource(testFileUrl("snapOneItem.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ listview->setOrientation(orientation);
+ listview->setLayoutDirection(layoutDirection);
+ listview->setVerticalLayoutDirection(verticalLayoutDirection);
+ listview->setHighlightRangeMode(QQuickItemView::HighlightRangeMode(highlightRangeMode));
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+
+ QSignalSpy currentIndexSpy(listview, SIGNAL(currentIndexChanged()));
+
+ // confirm that a flick hits the next item boundary
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(listview->isMoving() == false); // wait until it stops
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentY(), snapAlignment);
+ else
+ QCOMPARE(listview->contentX(), snapAlignment);
+
+ if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
+ QCOMPARE(listview->currentIndex(), 1);
+ QCOMPARE(currentIndexSpy.count(), 1);
+ }
+
+ // flick to end
+ do {
+ flick(window, flickStart, flickEnd, 180);
+ QTRY_VERIFY(listview->isMoving() == false); // wait until it stops
+ } while (orientation == QQuickListView::Vertical
+ ? verticalLayoutDirection == QQuickItemView::TopToBottom ? !listview->isAtYEnd() : !listview->isAtYBeginning()
+ : layoutDirection == Qt::LeftToRight ? !listview->isAtXEnd() : !listview->isAtXBeginning());
+
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentY(), endExtent);
+ else
+ QCOMPARE(listview->contentX(), endExtent);
+
+ if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
+ QCOMPARE(listview->currentIndex(), 3);
+ QCOMPARE(currentIndexSpy.count(), 3);
+ }
+
+ // flick to start
+ do {
+ flick(window, flickEnd, flickStart, 180);
+ QTRY_VERIFY(listview->isMoving() == false); // wait until it stops
+ } while (orientation == QQuickListView::Vertical
+ ? verticalLayoutDirection == QQuickItemView::TopToBottom ? !listview->isAtYBeginning() : !listview->isAtYEnd()
+ : layoutDirection == Qt::LeftToRight ? !listview->isAtXBeginning() : !listview->isAtXEnd());
+
+ if (orientation == QQuickListView::Vertical)
+ QCOMPARE(listview->contentY(), startExtent);
+ else
+ QCOMPARE(listview->contentX(), startExtent);
+
+ if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
+ QCOMPARE(listview->currentIndex(), 0);
+ QCOMPARE(currentIndexSpy.count(), 6);
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::unrequestedVisibility()
+{
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testWrap", QVariant(false));
+
+ window->setSource(testFileUrl("unrequestedItems.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *leftview = findItem<QQuickListView>(window->rootObject(), "leftList");
+ QTRY_VERIFY(leftview != 0);
+
+ QQuickListView *rightview = findItem<QQuickListView>(window->rootObject(), "rightList");
+ QTRY_VERIFY(rightview != 0);
+
+ QQuickItem *leftContent = leftview->contentItem();
+ QTRY_VERIFY(leftContent != 0);
+
+ QQuickItem *rightContent = rightview->contentItem();
+ QTRY_VERIFY(rightContent != 0);
+
+ rightview->setCurrentIndex(20);
+
+ QTRY_COMPARE(leftview->contentY(), 0.0);
+ QTRY_COMPARE(rightview->contentY(), 100.0);
+
+ QQuickItem *item;
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 19));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 19));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 16));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 17));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), true);
+
+ rightview->setCurrentIndex(0);
+
+ QTRY_COMPARE(leftview->contentY(), 0.0);
+ QTRY_COMPARE(rightview->contentY(), 0.0);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ QVERIFY(!findItem<QQuickItem>(leftContent, "wrapper", 19));
+ QVERIFY(!findItem<QQuickItem>(rightContent, "wrapper", 19));
+
+ leftview->setCurrentIndex(20);
+
+ QTRY_COMPARE(leftview->contentY(), 100.0);
+ QTRY_COMPARE(rightview->contentY(), 0.0);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QTRY_COMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 19));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 19));
+ QCOMPARE(delegateVisible(item), false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 3));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ QCOMPARE(delegateVisible(item), false);
+
+ model.moveItems(19, 1, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QTRY_VERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 1));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 19));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 19));
+ QCOMPARE(delegateVisible(item), false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ QCOMPARE(delegateVisible(item), false);
+
+ model.moveItems(3, 4, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ QCOMPARE(delegateVisible(item), false);
+
+ model.moveItems(4, 3, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ QCOMPARE(delegateVisible(item), false);
+
+ model.moveItems(16, 17, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ QCOMPARE(delegateVisible(item), false);
+
+ model.moveItems(17, 16, 1);
+ QTRY_COMPARE(QQuickItemPrivate::get(leftview)->polishScheduled, false);
+
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 4));
+ QCOMPARE(delegateVisible(item), false);
+ QVERIFY(item = findItem<QQuickItem>(leftContent, "wrapper", 5));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 16));
+ QCOMPARE(delegateVisible(item), true);
+ QVERIFY(item = findItem<QQuickItem>(rightContent, "wrapper", 17));
+ QCOMPARE(delegateVisible(item), false);
+
+ delete window;
+}
+
+void tst_QQuickListView::populateTransitions()
+{
+ QFETCH(bool, staticallyPopulate);
+ QFETCH(bool, dynamicallyPopulate);
+ QFETCH(bool, usePopulateTransition);
+
+ QPointF transitionFrom(-50, -50);
+ QPointF transitionVia(100, 100);
+ QaimModel model_transitionFrom;
+ QaimModel model_transitionVia;
+
+ QaimModel model;
+ if (staticallyPopulate) {
+ for (int i = 0; i < 30; i++)
+ model.addItem("item" + QString::number(i), "");
+ }
+
+ QQuickView *window = getView();
+ window->rootContext()->setContextProperty("testModel", &model);
+ window->rootContext()->setContextProperty("testObject", new TestObject(window->rootContext()));
+ window->rootContext()->setContextProperty("usePopulateTransition", usePopulateTransition);
+ window->rootContext()->setContextProperty("dynamicallyPopulate", dynamicallyPopulate);
+ window->rootContext()->setContextProperty("transitionFrom", transitionFrom);
+ window->rootContext()->setContextProperty("transitionVia", transitionVia);
+ window->rootContext()->setContextProperty("model_transitionFrom", &model_transitionFrom);
+ window->rootContext()->setContextProperty("model_transitionVia", &model_transitionVia);
+ window->setSource(testFileUrl("populateTransitions.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QVERIFY(listview);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem);
+
+ if (staticallyPopulate && usePopulateTransition) {
+ QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), 16);
+ QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 0);
+ } else if (dynamicallyPopulate) {
+ QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), 0);
+ QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 16);
+ } else {
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ QCOMPARE(listview->property("countPopulateTransitions").toInt(), 0);
+ QCOMPARE(listview->property("countAddTransitions").toInt(), 0);
+ }
+
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), 0.0);
+ QTRY_COMPARE(item->y(), i*20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ listview->setProperty("countPopulateTransitions", 0);
+ listview->setProperty("countAddTransitions", 0);
+
+ // add an item and check this is done with add transition, not populate
+ model.insertItem(0, "another item", "");
+ QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 1);
+ QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), 0);
+
+ // clear the model
+ window->rootContext()->setContextProperty("testModel", QVariant());
+ QTRY_COMPARE(listview->count(), 0);
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0);
+ listview->setProperty("countPopulateTransitions", 0);
+ listview->setProperty("countAddTransitions", 0);
+
+ // set to a valid model and check populate transition is run a second time
+ model.clear();
+ for (int i = 0; i < 30; i++)
+ model.addItem("item" + QString::number(i), "");
+ window->rootContext()->setContextProperty("testModel", &model);
+ QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 16 : 0);
+ QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 0);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), 0.0);
+ QTRY_COMPARE(item->y(), i*20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ // reset model and check populate transition is run again
+ listview->setProperty("countPopulateTransitions", 0);
+ listview->setProperty("countAddTransitions", 0);
+ model.reset();
+ QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 16 : 0);
+ QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 0);
+
+ itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=0; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), 0.0);
+ QTRY_COMPARE(item->y(), i*20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::populateTransitions_data()
+{
+ QTest::addColumn<bool>("staticallyPopulate");
+ QTest::addColumn<bool>("dynamicallyPopulate");
+ QTest::addColumn<bool>("usePopulateTransition");
+
+ QTest::newRow("static") << true << false << true;
+ QTest::newRow("static, no populate") << true << false << false;
+
+ QTest::newRow("dynamic") << false << true << true;
+ QTest::newRow("dynamic, no populate") << false << true << false;
+
+ QTest::newRow("empty to start with") << false << false << true;
+ QTest::newRow("empty to start with, no populate") << false << false << false;
+}
+
+void tst_QQuickListView::addTransitions()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(bool, shouldAnimateTargets);
+ QFETCH(qreal, contentY);
+ QFETCH(int, insertionIndex);
+ QFETCH(int, insertionCount);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ // added items should start here
+ QPointF targetItems_transitionFrom(-50, -50);
+
+ // displaced items should pass through this point
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_targetItems_transitionFrom;
+ QaimModel model_displacedItems_transitionVia;
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ ctxt->setContextProperty("testObject", testObject);
+ window->setSource(testFileUrl("addTransitions.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ if (contentY != 0) {
+ listview->setContentY(contentY);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ }
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+
+ // only target items that will become visible should be animated
+ QList<QPair<QString, QString> > newData;
+ QList<QPair<QString, QString> > expectedTargetData;
+ QList<int> targetIndexes;
+ if (shouldAnimateTargets) {
+ for (int i=insertionIndex; i<insertionIndex+insertionCount; i++) {
+ newData << qMakePair(QString("New item %1").arg(i), QString(""));
+
+ if (i >= contentY / 20 && i < (contentY + listview->height()) / 20) { // only grab visible items
+ expectedTargetData << newData.last();
+ targetIndexes << i;
+ }
+ }
+ QVERIFY(expectedTargetData.count() > 0);
+ }
+
+ // start animation
+ if (!newData.isEmpty()) {
+ model.insertItems(insertionIndex, newData);
+ QTRY_COMPARE(model.count(), listview->count());
+ }
+
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes);
+
+ if (shouldAnimateTargets) {
+ QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count());
+ QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(),
+ expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0);
+
+ // check the target and displaced items were animated
+ model_targetItems_transitionFrom.matchAgainst(expectedTargetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos");
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ matchItemsAndIndexes(listview->property("targetTrans_items").toMap(), model, targetIndexes);
+ matchIndexLists(listview->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(listview->property("targetTrans_targetItems").toList(), targetItems);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes = adjustIndexesForAddDisplaced(expectedDisplacedIndexes.indexes, insertionIndex, insertionCount);
+ matchItemsAndIndexes(listview->property("displacedTrans_items").toMap(), model, displacedIndexes);
+ matchIndexLists(listview->property("displacedTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(listview->property("displacedTrans_targetItems").toList(), targetItems);
+ }
+
+ } else {
+ QTRY_COMPARE(model_targetItems_transitionFrom.count(), 0);
+ QTRY_COMPARE(model_displacedItems_transitionVia.count(), 0);
+ }
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ int itemCount = items.count();
+ for (int i=0; i<items.count(); i++) {
+ if (items[i]->y() >= contentY) {
+ QQmlExpression e(qmlContext(items[i]), items[i], "index");
+ firstVisibleIndex = e.evaluate().toInt();
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // verify all items moved to the correct final positions
+ for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->y(), i*20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::addTransitions_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<bool>("shouldAnimateTargets");
+ QTest::addColumn<int>("insertionIndex");
+ QTest::addColumn<int>("insertionCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ // if inserting before visible index, items should not appear or animate in, even if there are > 1 new items
+ QTest::newRow("insert 1, just before start")
+ << 30 << 20.0 << false
+ << 0 << 1 << ListRange();
+ QTest::newRow("insert 1, way before start")
+ << 30 << 20.0 << false
+ << 0 << 1 << ListRange();
+ QTest::newRow("insert multiple, just before start")
+ << 30 << 100.0 << false
+ << 0 << 3 << ListRange();
+ QTest::newRow("insert multiple, way before start")
+ << 30 << 100.0 << false
+ << 0 << 3 << ListRange();
+
+ QTest::newRow("insert 1 at start")
+ << 30 << 0.0 << true
+ << 0 << 1 << ListRange(0, 15);
+ QTest::newRow("insert multiple at start")
+ << 30 << 0.0 << true
+ << 0 << 3 << ListRange(0, 15);
+ QTest::newRow("insert 1 at start, content y not 0")
+ << 30 << 40.0 << true // first visible is index 2, so translate the displaced indexes by 2
+ << 2 << 1 << ListRange(0 + 2, 15 + 2);
+ QTest::newRow("insert multiple at start, content y not 0")
+ << 30 << 40.0 << true // first visible is index 2
+ << 2 << 3 << ListRange(0 + 2, 15 + 2);
+
+ QTest::newRow("insert 1 at start, to empty list")
+ << 0 << 0.0 << true
+ << 0 << 1 << ListRange();
+ QTest::newRow("insert multiple at start, to empty list")
+ << 0 << 0.0 << true
+ << 0 << 3 << ListRange();
+
+ QTest::newRow("insert 1 at middle")
+ << 30 << 0.0 << true
+ << 5 << 1 << ListRange(5, 15);
+ QTest::newRow("insert multiple at middle")
+ << 30 << 0.0 << true
+ << 5 << 3 << ListRange(5, 15);
+
+ QTest::newRow("insert 1 at bottom")
+ << 30 << 0.0 << true
+ << 15 << 1 << ListRange(15, 15);
+ QTest::newRow("insert multiple at bottom")
+ << 30 << 0.0 << true
+ << 15 << 3 << ListRange(15, 15);
+ QTest::newRow("insert 1 at bottom, content y not 0")
+ << 30 << 20.0 * 3 << true
+ << 15 + 3 << 1 << ListRange(15 + 3, 15 + 3);
+ QTest::newRow("insert multiple at bottom, content y not 0")
+ << 30 << 20.0 * 3 << true
+ << 15 + 3 << 3 << ListRange(15 + 3, 15 + 3);
+
+ // items added after the last visible will not be animated in, since they
+ // do not appear in the final view
+ QTest::newRow("insert 1 after end")
+ << 30 << 0.0 << false
+ << 17 << 1 << ListRange();
+ QTest::newRow("insert multiple after end")
+ << 30 << 0.0 << false
+ << 17 << 3 << ListRange();
+}
+
+void tst_QQuickListView::moveTransitions()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(qreal, contentY);
+ QFETCH(qreal, itemsOffsetAfterMove);
+ QFETCH(int, moveFrom);
+ QFETCH(int, moveTo);
+ QFETCH(int, moveCount);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ // target and displaced items should pass through these points
+ QPointF targetItems_transitionVia(-50, 50);
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_targetItems_transitionVia;
+ QaimModel model_displacedItems_transitionVia;
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_targetItems_transitionVia", &model_targetItems_transitionVia);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionVia", targetItems_transitionVia);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ ctxt->setContextProperty("testObject", testObject);
+ window->setSource(testFileUrl("moveTransitions.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QQuickText *name;
+
+ if (contentY != 0) {
+ listview->setContentY(contentY);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ }
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+
+ // Items moving to *or* from visible positions should be animated.
+ // Otherwise, they should not be animated.
+ QList<QPair<QString, QString> > expectedTargetData;
+ QList<int> targetIndexes;
+ for (int i=moveFrom; i<moveFrom+moveCount; i++) {
+ int toIndex = moveTo + (i - moveFrom);
+ if (i <= (contentY + listview->height()) / 20
+ || toIndex < (contentY + listview->height()) / 20) {
+ expectedTargetData << qMakePair(model.name(i), model.number(i));
+ targetIndexes << i;
+ }
+ }
+ // ViewTransition.index provides the indices that items are moving to, not from
+ targetIndexes = adjustIndexesForMove(targetIndexes, moveFrom, moveTo, moveCount);
+
+ // start animation
+ model.moveItems(moveFrom, moveTo, moveCount);
+
+ QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count());
+ QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(),
+ expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0);
+
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes);
+
+ // check the target and displaced items were animated
+ model_targetItems_transitionVia.matchAgainst(expectedTargetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos");
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ matchItemsAndIndexes(listview->property("targetTrans_items").toMap(), model, targetIndexes);
+ matchIndexLists(listview->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(listview->property("targetTrans_targetItems").toList(), targetItems);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes = adjustIndexesForMove(expectedDisplacedIndexes.indexes, moveFrom, moveTo, moveCount);
+ matchItemsAndIndexes(listview->property("displacedTrans_items").toMap(), model, displacedIndexes);
+ matchIndexLists(listview->property("displacedTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(listview->property("displacedTrans_targetItems").toList(), targetItems);
+ }
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ for (int i=0; i<items.count(); i++) {
+ if (items[i]->y() >= contentY) {
+ QQmlExpression e(qmlContext(items[i]), items[i], "index");
+ firstVisibleIndex = e.evaluate().toInt();
+ break;
+ }
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // verify all items moved to the correct final positions
+ int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
+ for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->y(), i*20.0 + itemsOffsetAfterMove);
+ name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::moveTransitions_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<qreal>("itemsOffsetAfterMove");
+ QTest::addColumn<int>("moveFrom");
+ QTest::addColumn<int>("moveTo");
+ QTest::addColumn<int>("moveCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ // when removing from above the visible, all items shift down depending on how many
+ // items have been removed from above the visible
+ QTest::newRow("move from above view, outside visible items, move 1") << 30 << 4*20.0 << 20.0
+ << 1 << 10 << 1 << ListRange(11, 15+4);
+ QTest::newRow("move from above view, outside visible items, move 1 (first item)") << 30 << 4*20.0 << 20.0
+ << 0 << 10 << 1 << ListRange(11, 15+4);
+ QTest::newRow("move from above view, outside visible items, move multiple") << 30 << 4*20.0 << 2*20.0
+ << 1 << 10 << 2 << ListRange(12, 15+4);
+ QTest::newRow("move from above view, outside visible items, move multiple (first item)") << 30 << 4*20.0 << 3*20.0
+ << 0 << 10 << 3 << ListRange(13, 15+4);
+ QTest::newRow("move from above view, mix of visible/non-visible") << 30 << 4*20.0 << 3*20.0
+ << 1 << 10 << 5 << ListRange(6, 14) + ListRange(15, 15+4);
+ QTest::newRow("move from above view, mix of visible/non-visible (move first)") << 30 << 4*20.0 << 4*20.0
+ << 0 << 10 << 5 << ListRange(5, 14) + ListRange(15, 15+4);
+
+ QTest::newRow("move within view, move 1 down") << 30 << 0.0 << 0.0
+ << 1 << 10 << 1 << ListRange(2, 10);
+ QTest::newRow("move within view, move 1 down, move first item") << 30 << 0.0 << 0.0
+ << 0 << 10 << 1 << ListRange(1, 10);
+ QTest::newRow("move within view, move 1 down, move first item, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 0+4 << 10+4 << 1 << ListRange(1+4, 10+4);
+ QTest::newRow("move within view, move 1 down, to last item") << 30 << 0.0 << 0.0
+ << 10 << 15 << 1 << ListRange(11, 15);
+ QTest::newRow("move within view, move first->last") << 30 << 0.0 << 0.0
+ << 0 << 15 << 1 << ListRange(1, 15);
+
+ QTest::newRow("move within view, move multiple down") << 30 << 0.0 << 0.0
+ << 1 << 10 << 3 << ListRange(4, 12);
+ QTest::newRow("move within view, move multiple down, move first item") << 30 << 0.0 << 0.0
+ << 0 << 10 << 3 << ListRange(3, 12);
+ QTest::newRow("move within view, move multiple down, move first item, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 0+4 << 10+4 << 3 << ListRange(3+4, 12+4);
+ QTest::newRow("move within view, move multiple down, displace last item") << 30 << 0.0 << 0.0
+ << 5 << 13 << 3 << ListRange(8, 15);
+ QTest::newRow("move within view, move multiple down, move first->last") << 30 << 0.0 << 0.0
+ << 0 << 13 << 3 << ListRange(3, 15);
+
+ QTest::newRow("move within view, move 1 up") << 30 << 0.0 << 0.0
+ << 10 << 1 << 1 << ListRange(1, 9);
+ QTest::newRow("move within view, move 1 up, move to first index") << 30 << 0.0 << 0.0
+ << 10 << 0 << 1 << ListRange(0, 9);
+ QTest::newRow("move within view, move 1 up, move to first index, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 10+4 << 0+4 << 1 << ListRange(0+4, 9+4);
+ QTest::newRow("move within view, move 1 up, move to first index, contentY not on item border") << 30 << 4*20.0 - 10 << 0.0
+ << 10+4 << 0+4 << 1 << ListRange(0+4, 9+4);
+ QTest::newRow("move within view, move 1 up, move last item") << 30 << 0.0 << 0.0
+ << 15 << 10 << 1 << ListRange(10, 14);
+ QTest::newRow("move within view, move 1 up, move last->first") << 30 << 0.0 << 0.0
+ << 15 << 0 << 1 << ListRange(0, 14);
+
+ QTest::newRow("move within view, move multiple up") << 30 << 0.0 << 0.0
+ << 10 << 1 << 3 << ListRange(1, 9);
+ QTest::newRow("move within view, move multiple up, move to first index") << 30 << 0.0 << 0.0
+ << 10 << 0 << 3 << ListRange(0, 9);
+ QTest::newRow("move within view, move multiple up, move to first index, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 10+4 << 0+4 << 3 << ListRange(0+4, 9+4);
+ QTest::newRow("move within view, move multiple up, move last item") << 30 << 0.0 << 0.0
+ << 13 << 5 << 3 << ListRange(5, 12);
+ QTest::newRow("move within view, move multiple up, move last->first") << 30 << 0.0 << 0.0
+ << 13 << 0 << 3 << ListRange(0, 12);
+
+ QTest::newRow("move from below view, move 1 up, move to top") << 30 << 0.0 << 0.0
+ << 20 << 0 << 1 << ListRange(0, 15);
+ QTest::newRow("move from below view, move 1 up, move to top, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 25 << 4 << 1 << ListRange(0+4, 15+4);
+ QTest::newRow("move from below view, move multiple up, move to top") << 30 << 0.0 << 0.0
+ << 20 << 0 << 3 << ListRange(0, 15);
+ QTest::newRow("move from below view, move multiple up, move to top, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 25 << 4 << 3 << ListRange(0+4, 15+4);
+
+ QTest::newRow("move from below view, move 1 up, move to bottom") << 30 << 0.0 << 0.0
+ << 20 << 15 << 1 << ListRange(15, 15);
+ QTest::newRow("move from below view, move 1 up, move to bottom, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 25 << 15+4 << 1 << ListRange(15+4, 15+4);
+ QTest::newRow("move from below view, move multiple up, move to bottom") << 30 << 0.0 << 0.0
+ << 20 << 15 << 3 << ListRange(15, 15);
+ QTest::newRow("move from below view, move multiple up, move to bottom, contentY not 0") << 30 << 4*20.0 << 0.0
+ << 25 << 15+4 << 3 << ListRange(15+4, 15+4);
+}
+
+void tst_QQuickListView::removeTransitions()
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(bool, shouldAnimateTargets);
+ QFETCH(qreal, contentY);
+ QFETCH(int, removalIndex);
+ QFETCH(int, removalCount);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ // added items should end here
+ QPointF targetItems_transitionTo(-50, -50);
+
+ // displaced items should pass through this points
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_targetItems_transitionTo;
+ QaimModel model_displacedItems_transitionVia;
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_targetItems_transitionTo", &model_targetItems_transitionTo);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionTo", targetItems_transitionTo);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ ctxt->setContextProperty("testObject", testObject);
+ window->setSource(testFileUrl("removeTransitions.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ if (contentY != 0) {
+ listview->setContentY(contentY);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ }
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+
+ // only target items that are visible should be animated
+ QList<QPair<QString, QString> > expectedTargetData;
+ QList<int> targetIndexes;
+ if (shouldAnimateTargets) {
+ for (int i=removalIndex; i<removalIndex+removalCount; i++) {
+ if (i >= contentY / 20 && i < (contentY + listview->height()) / 20) {
+ expectedTargetData << qMakePair(model.name(i), model.number(i));
+ targetIndexes << i;
+ }
+ }
+ QVERIFY(expectedTargetData.count() > 0);
+ }
+
+ // calculate targetItems and expectedTargets before model changes
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes);
+ QVariantMap expectedTargets;
+ for (int i=0; i<targetIndexes.count(); i++)
+ expectedTargets[model.name(targetIndexes[i])] = targetIndexes[i];
+
+ // start animation
+ model.removeItems(removalIndex, removalCount);
+ QTRY_COMPARE(model.count(), listview->count());
+
+ if (shouldAnimateTargets) {
+ QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count());
+ QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(),
+ expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0);
+
+ // check the target and displaced items were animated
+ model_targetItems_transitionTo.matchAgainst(expectedTargetData, "wasn't animated to target 'to' pos", "shouldn't have been animated to target 'to' pos");
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ QCOMPARE(listview->property("targetTrans_items").toMap(), expectedTargets);
+ matchIndexLists(listview->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(listview->property("targetTrans_targetItems").toList(), targetItems);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes = adjustIndexesForRemoveDisplaced(expectedDisplacedIndexes.indexes, removalIndex, removalCount);
+ matchItemsAndIndexes(listview->property("displacedTrans_items").toMap(), model, displacedIndexes);
+ matchIndexLists(listview->property("displacedTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(listview->property("displacedTrans_targetItems").toList(), targetItems);
+ }
+ } else {
+ QTRY_COMPARE(model_targetItems_transitionTo.count(), 0);
+ QTRY_COMPARE(model_displacedItems_transitionVia.count(), 0);
+ }
+
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ int firstVisibleIndex = -1;
+ int itemCount = items.count();
+
+ for (int i=0; i<items.count(); i++) {
+ QQmlExpression e(qmlContext(items[i]), items[i], "index");
+ int index = e.evaluate().toInt();
+ if (firstVisibleIndex < 0 && items[i]->y() >= contentY)
+ firstVisibleIndex = index;
+ if (index < 0)
+ itemCount--; // exclude deleted items
+ }
+ QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex));
+
+ // verify all items moved to the correct final positions
+ for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), 0.0);
+ QCOMPARE(item->y(), contentY + (i-firstVisibleIndex) * 20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::removeTransitions_data()
+{
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<bool>("shouldAnimateTargets");
+ QTest::addColumn<int>("removalIndex");
+ QTest::addColumn<int>("removalCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ // All items that are visible following the remove operation should be animated.
+ // Remove targets that are outside of the view should not be animated.
+
+ QTest::newRow("remove 1 before start")
+ << 30 << 20.0 * 3 << false
+ << 2 << 1 << ListRange();
+ QTest::newRow("remove multiple, all before start")
+ << 30 << 20.0 * 3 << false
+ << 0 << 3 << ListRange();
+ QTest::newRow("remove mix of before and after start")
+ << 30 << 20.0 * 3 << true
+ << 2 << 3 << ListRange(5, 20); // 5-20 are visible after the remove
+
+ QTest::newRow("remove 1 from start")
+ << 30 << 0.0 << true
+ << 0 << 1 << ListRange(1, 16); // 1-16 are visible after the remove
+ QTest::newRow("remove multiple from start")
+ << 30 << 0.0 << true
+ << 0 << 3 << ListRange(3, 18); // 3-18 are visible after the remove
+ QTest::newRow("remove 1 from start, content y not 0")
+ << 30 << 20.0 * 2 << true // first visible is index 2, so translate the displaced indexes by 2
+ << 2 << 1 << ListRange(1 + 2, 16 + 2);
+ QTest::newRow("remove multiple from start, content y not 0")
+ << 30 << 20.0 * 2 << true // first visible is index 2
+ << 2 << 3 << ListRange(3 + 2, 18 + 2);
+
+ QTest::newRow("remove 1 from middle")
+ << 30 << 0.0 << true
+ << 5 << 1 << ListRange(6, 16);
+ QTest::newRow("remove multiple from middle")
+ << 30 << 0.0 << true
+ << 5 << 3 << ListRange(8, 18);
+
+
+ QTest::newRow("remove 1 from bottom")
+ << 30 << 0.0 << true
+ << 15 << 1 << ListRange(16, 16);
+
+ // remove 15, 16, 17
+ // 15 will animate as the target item, 16 & 17 won't be animated since they are outside
+ // the view, and 18 will be animated as the displaced item to replace the last item
+ QTest::newRow("remove multiple from bottom")
+ << 30 << 0.0 << true
+ << 15 << 3 << ListRange(18, 18);
+
+ QTest::newRow("remove 1 from bottom, content y not 0")
+ << 30 << 20.0 * 2 << true
+ << 15 + 2 << 1 << ListRange(16 + 2, 16 + 2);
+ QTest::newRow("remove multiple from bottom, content y not 0")
+ << 30 << 20.0 * 2 << true
+ << 15 + 2 << 3 << ListRange(18 + 2, 18 + 2);
+
+
+ QTest::newRow("remove 1 after end")
+ << 30 << 0.0 << false
+ << 17 << 1 << ListRange();
+ QTest::newRow("remove multiple after end")
+ << 30 << 0.0 << false
+ << 17 << 3 << ListRange();
+}
+
+void tst_QQuickListView::displacedTransitions()
+{
+ QFETCH(bool, useDisplaced);
+ QFETCH(bool, displacedEnabled);
+ QFETCH(bool, useAddDisplaced);
+ QFETCH(bool, addDisplacedEnabled);
+ QFETCH(bool, useMoveDisplaced);
+ QFETCH(bool, moveDisplacedEnabled);
+ QFETCH(bool, useRemoveDisplaced);
+ QFETCH(bool, removeDisplacedEnabled);
+ QFETCH(ListChange, change);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ QaimModel model_displaced_transitionVia;
+ QaimModel model_addDisplaced_transitionVia;
+ QaimModel model_moveDisplaced_transitionVia;
+ QaimModel model_removeDisplaced_transitionVia;
+
+ QPointF displaced_transitionVia(-50, -100);
+ QPointF addDisplaced_transitionVia(-150, 100);
+ QPointF moveDisplaced_transitionVia(50, -100);
+ QPointF removeDisplaced_transitionVia(150, 100);
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject(window);
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testObject", testObject);
+ ctxt->setContextProperty("model_displaced_transitionVia", &model_displaced_transitionVia);
+ ctxt->setContextProperty("model_addDisplaced_transitionVia", &model_addDisplaced_transitionVia);
+ ctxt->setContextProperty("model_moveDisplaced_transitionVia", &model_moveDisplaced_transitionVia);
+ ctxt->setContextProperty("model_removeDisplaced_transitionVia", &model_removeDisplaced_transitionVia);
+ ctxt->setContextProperty("displaced_transitionVia", displaced_transitionVia);
+ ctxt->setContextProperty("addDisplaced_transitionVia", addDisplaced_transitionVia);
+ ctxt->setContextProperty("moveDisplaced_transitionVia", moveDisplaced_transitionVia);
+ ctxt->setContextProperty("removeDisplaced_transitionVia", removeDisplaced_transitionVia);
+ ctxt->setContextProperty("useDisplaced", useDisplaced);
+ ctxt->setContextProperty("displacedEnabled", displacedEnabled);
+ ctxt->setContextProperty("useAddDisplaced", useAddDisplaced);
+ ctxt->setContextProperty("addDisplacedEnabled", addDisplacedEnabled);
+ ctxt->setContextProperty("useMoveDisplaced", useMoveDisplaced);
+ ctxt->setContextProperty("moveDisplacedEnabled", moveDisplacedEnabled);
+ ctxt->setContextProperty("useRemoveDisplaced", useRemoveDisplaced);
+ ctxt->setContextProperty("removeDisplacedEnabled", removeDisplacedEnabled);
+ window->setSource(testFileUrl("displacedTransitions.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+ listview->setProperty("displaceTransitionsDone", false);
+
+ switch (change.type) {
+ case ListChange::Inserted:
+ {
+ QList<QPair<QString, QString> > targetItemData;
+ for (int i=change.index; i<change.index + change.count; ++i)
+ targetItemData << qMakePair(QString("new item %1").arg(i), QString::number(i));
+ model.insertItems(change.index, targetItemData);
+ QTRY_COMPARE(model.count(), listview->count());
+ break;
+ }
+ case ListChange::Removed:
+ model.removeItems(change.index, change.count);
+ QTRY_COMPARE(model.count(), listview->count());
+ break;
+ case ListChange::Moved:
+ model.moveItems(change.index, change.to, change.count);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ break;
+ case ListChange::SetCurrent:
+ case ListChange::SetContentY:
+ case ListChange::Polish:
+ break;
+ }
+
+ QVariantList resultTargetIndexes = listview->property("displacedTargetIndexes").toList();
+ QVariantList resultTargetItems = listview->property("displacedTargetItems").toList();
+
+ if ((useDisplaced && displacedEnabled)
+ || (useAddDisplaced && addDisplacedEnabled)
+ || (useMoveDisplaced && moveDisplacedEnabled)
+ || (useRemoveDisplaced && removeDisplacedEnabled)) {
+ QTRY_VERIFY(listview->property("displaceTransitionsDone").toBool());
+
+ // check the correct number of target items and indexes were received
+ QCOMPARE(resultTargetIndexes.count(), expectedDisplacedIndexes.count());
+ for (int i=0; i<resultTargetIndexes.count(); i++)
+ QCOMPARE(resultTargetIndexes[i].value<QList<int> >().count(), change.count);
+ QCOMPARE(resultTargetItems.count(), expectedDisplacedIndexes.count());
+ for (int i=0; i<resultTargetItems.count(); i++)
+ QCOMPARE(resultTargetItems[i].toList().count(), change.count);
+ } else {
+ QCOMPARE(resultTargetIndexes.count(), 0);
+ QCOMPARE(resultTargetItems.count(), 0);
+ }
+
+ if (change.type == ListChange::Inserted && useAddDisplaced && addDisplacedEnabled)
+ model_addDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with add displaced", "shouldn't have been animated with add displaced");
+ else
+ QCOMPARE(model_addDisplaced_transitionVia.count(), 0);
+ if (change.type == ListChange::Moved && useMoveDisplaced && moveDisplacedEnabled)
+ model_moveDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with move displaced", "shouldn't have been animated with move displaced");
+ else
+ QCOMPARE(model_moveDisplaced_transitionVia.count(), 0);
+ if (change.type == ListChange::Removed && useRemoveDisplaced && removeDisplacedEnabled)
+ model_removeDisplaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with remove displaced", "shouldn't have been animated with remove displaced");
+ else
+ QCOMPARE(model_removeDisplaced_transitionVia.count(), 0);
+
+ if (useDisplaced && displacedEnabled
+ && ( (change.type == ListChange::Inserted && (!useAddDisplaced || !addDisplacedEnabled))
+ || (change.type == ListChange::Moved && (!useMoveDisplaced || !moveDisplacedEnabled))
+ || (change.type == ListChange::Removed && (!useRemoveDisplaced || !removeDisplacedEnabled))) ) {
+ model_displaced_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with generic displaced", "shouldn't have been animated with generic displaced");
+ } else {
+ QCOMPARE(model_displaced_transitionVia.count(), 0);
+ }
+
+ // verify all items moved to the correct final positions
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ for (int i=0; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QCOMPARE(item->x(), 0.0);
+ QCOMPARE(item->y(), i * 20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+void tst_QQuickListView::displacedTransitions_data()
+{
+ QTest::addColumn<bool>("useDisplaced");
+ QTest::addColumn<bool>("displacedEnabled");
+ QTest::addColumn<bool>("useAddDisplaced");
+ QTest::addColumn<bool>("addDisplacedEnabled");
+ QTest::addColumn<bool>("useMoveDisplaced");
+ QTest::addColumn<bool>("moveDisplacedEnabled");
+ QTest::addColumn<bool>("useRemoveDisplaced");
+ QTest::addColumn<bool>("removeDisplacedEnabled");
+ QTest::addColumn<ListChange>("change");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ QTest::newRow("no displaced transitions at all")
+ << false << false
+ << false << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 15);
+
+ QTest::newRow("just displaced")
+ << true << true
+ << false << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 15);
+
+ QTest::newRow("just displaced (not enabled)")
+ << true << false
+ << false << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 15);
+
+ QTest::newRow("displaced + addDisplaced")
+ << true << true
+ << true << true
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 15);
+
+ QTest::newRow("displaced + addDisplaced (not enabled)")
+ << true << true
+ << true << false
+ << false << false
+ << false << false
+ << ListChange::insert(0, 1) << ListRange(0, 15);
+
+ QTest::newRow("displaced + moveDisplaced")
+ << true << true
+ << false << false
+ << true << true
+ << false << false
+ << ListChange::move(0, 10, 1) << ListRange(1, 10);
+
+ QTest::newRow("displaced + moveDisplaced (not enabled)")
+ << true << true
+ << false << false
+ << true << false
+ << false << false
+ << ListChange::move(0, 10, 1) << ListRange(1, 10);
+
+ QTest::newRow("displaced + removeDisplaced")
+ << true << true
+ << false << false
+ << false << false
+ << true << true
+ << ListChange::remove(0, 1) << ListRange(1, 16);
+
+ QTest::newRow("displaced + removeDisplaced (not enabled)")
+ << true << true
+ << false << false
+ << false << false
+ << true << false
+ << ListChange::remove(0, 1) << ListRange(1, 16);
+
+
+ QTest::newRow("displaced + add, should use generic displaced for a remove")
+ << true << true
+ << true << true
+ << false << false
+ << true << false
+ << ListChange::remove(0, 1) << ListRange(1, 16);
+}
+
+void tst_QQuickListView::multipleTransitions()
+{
+ // Tests that if you interrupt a transition in progress with another action that
+ // cancels the previous transition, the resulting items are still placed correctly.
+
+ QFETCH(int, initialCount);
+ QFETCH(qreal, contentY);
+ QFETCH(QList<ListChange>, changes);
+ QFETCH(bool, enableAddTransitions);
+ QFETCH(bool, enableMoveTransitions);
+ QFETCH(bool, enableRemoveTransitions);
+ QFETCH(bool, rippleAddDisplaced);
+
+ QPointF addTargets_transitionFrom(-50, -50);
+ QPointF addDisplaced_transitionFrom(-50, 50);
+ QPointF moveTargets_transitionFrom(50, -50);
+ QPointF moveDisplaced_transitionFrom(50, 50);
+ QPointF removeTargets_transitionTo(-100, 300);
+ QPointF removeDisplaced_transitionFrom(100, 300);
+
+ QaimModel model;
+ for (int i = 0; i < initialCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testObject", testObject);
+ ctxt->setContextProperty("addTargets_transitionFrom", addTargets_transitionFrom);
+ ctxt->setContextProperty("addDisplaced_transitionFrom", addDisplaced_transitionFrom);
+ ctxt->setContextProperty("moveTargets_transitionFrom", moveTargets_transitionFrom);
+ ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom);
+ ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo);
+ ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom);
+ ctxt->setContextProperty("enableAddTransitions", enableAddTransitions);
+ ctxt->setContextProperty("enableMoveTransitions", enableMoveTransitions);
+ ctxt->setContextProperty("enableRemoveTransitions", enableRemoveTransitions);
+ ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced);
+ window->setSource(testFileUrl("multipleTransitions.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ if (contentY != 0) {
+ listview->setContentY(contentY);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ }
+
+ int timeBetweenActions = window->rootObject()->property("timeBetweenActions").toInt();
+
+ for (int i=0; i<changes.count(); i++) {
+ switch (changes[i].type) {
+ case ListChange::Inserted:
+ {
+ QList<QPair<QString, QString> > targetItems;
+ for (int j=changes[i].index; j<changes[i].index + changes[i].count; ++j)
+ targetItems << qMakePair(QString("new item %1").arg(j), QString::number(j));
+ model.insertItems(changes[i].index, targetItems);
+ QTRY_COMPARE(model.count(), listview->count());
+ if (i == changes.count() - 1) {
+ QTRY_VERIFY(!listview->property("runningAddTargets").toBool());
+ QTRY_VERIFY(!listview->property("runningAddDisplaced").toBool());
+ } else {
+ QTest::qWait(timeBetweenActions);
+ }
+ break;
+ }
+ case ListChange::Removed:
+ model.removeItems(changes[i].index, changes[i].count);
+ QTRY_COMPARE(model.count(), listview->count());
+ if (i == changes.count() - 1) {
+ QTRY_VERIFY(!listview->property("runningRemoveTargets").toBool());
+ QTRY_VERIFY(!listview->property("runningRemoveDisplaced").toBool());
+ } else {
+ QTest::qWait(timeBetweenActions);
+ }
+ break;
+ case ListChange::Moved:
+ model.moveItems(changes[i].index, changes[i].to, changes[i].count);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ if (i == changes.count() - 1) {
+ QTRY_VERIFY(!listview->property("runningMoveTargets").toBool());
+ QTRY_VERIFY(!listview->property("runningMoveDisplaced").toBool());
+ } else {
+ QTest::qWait(timeBetweenActions);
+ }
+ break;
+ case ListChange::SetCurrent:
+ listview->setCurrentIndex(changes[i].index);
+ break;
+ case ListChange::SetContentY:
+ listview->setContentY(changes[i].pos);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+ break;
+ case ListChange::Polish:
+ break;
+ }
+ }
+ QCOMPARE(listview->count(), model.count());
+
+ // verify all items moved to the correct final positions
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ for (int i=0; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), 0.0);
+ QTRY_COMPARE(item->y(), i*20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+ delete testObject;
+}
+
+void tst_QQuickListView::multipleTransitions_data()
+{
+ QTest::addColumn<int>("initialCount");
+ QTest::addColumn<qreal>("contentY");
+ QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<bool>("enableAddTransitions");
+ QTest::addColumn<bool>("enableMoveTransitions");
+ QTest::addColumn<bool>("enableRemoveTransitions");
+ QTest::addColumn<bool>("rippleAddDisplaced");
+
+ // the added item and displaced items should move to final dest correctly
+ QTest::newRow("add item, then move it immediately") << 10 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::move(0, 3, 1)
+ )
+ << true << true << true << false;
+
+ // items affected by the add should change from move to add transition
+ QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::move(1, 10, 3)
+ << ListChange::insert(0, 1)
+ )
+ << true << true << true << false;
+
+ // items should be placed correctly if you trigger a transition then refill for that index
+ QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::setContentY(80.0)
+ << ListChange::setContentY(0.0)
+ << ListChange::insert(0, 1)
+ )
+ << true << true << true << false;
+
+ QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(1, 1)
+ << ListChange::remove(1, 1)
+ )
+ << true << true << true << true;
+
+ // if item is removed while undergoing a displaced transition, all other items should end up at their correct positions,
+ // even if a remove-displace transition is not present to re-animate them
+ QTest::newRow("insert then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+
+ // if last item is not flush with the edge of the view, it should still be refilled in correctly after a
+ // remove has changed the position of where it will move to
+ QTest::newRow("insert twice then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::setContentY(-10.0)
+ << ListChange::insert(0, 1)
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+}
+
+void tst_QQuickListView::multipleDisplaced()
+{
+ // multiple move() operations should only restart displace transitions for items that
+ // moved from previously set positions, and not those that have moved from their current
+ // item positions (which may e.g. still be changing from easing bounces in the last transition)
+
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ QQuickView *window = getView();
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("testObject", new TestObject(window));
+ window->setSource(testFileUrl("multipleDisplaced.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ model.moveItems(12, 8, 1);
+ QTest::qWait(window->rootObject()->property("duration").toInt() / 2);
+ model.moveItems(8, 3, 1);
+ QTRY_VERIFY(listview->property("displaceTransitionsDone").toBool());
+
+ QVariantMap transitionsStarted = listview->property("displaceTransitionsStarted").toMap();
+ foreach (const QString &name, transitionsStarted.keys()) {
+ QVERIFY2(transitionsStarted[name] == 1,
+ QTest::toString(QString("%1 was displaced %2 times").arg(name).arg(transitionsStarted[name].toInt())));
+ }
+
+ // verify all items moved to the correct final positions
+ QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper");
+ for (int i=0; i < model.count() && i < items.count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+ QTRY_COMPARE(item->x(), 0.0);
+ QTRY_COMPARE(item->y(), i*20.0);
+ QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model.name(i));
+ }
+
+ releaseView(window);
+}
+
+QList<int> tst_QQuickListView::toIntList(const QVariantList &list)
+{
+ QList<int> ret;
+ bool ok = true;
+ for (int i=0; i<list.count(); i++) {
+ ret << list[i].toInt(&ok);
+ if (!ok)
+ qWarning() << "tst_QQuickListView::toIntList(): not a number:" << list[i];
+ }
+
+ return ret;
+}
+
+void tst_QQuickListView::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes)
+{
+ for (int i=0; i<indexLists.count(); i++) {
+ QSet<int> current = indexLists[i].value<QList<int> >().toSet();
+ if (current != expectedIndexes.toSet())
+ qDebug() << "Cannot match actual targets" << current << "with expected" << expectedIndexes;
+ QCOMPARE(current, expectedIndexes.toSet());
+ }
+}
+
+void tst_QQuickListView::matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes)
+{
+ for (QVariantMap::const_iterator it = items.begin(); it != items.end(); ++it) {
+ QVERIFY(it.value().type() == QVariant::Int);
+ QString name = it.key();
+ int itemIndex = it.value().toInt();
+ QVERIFY2(expectedIndexes.contains(itemIndex), QTest::toString(QString("Index %1 not found in expectedIndexes").arg(itemIndex)));
+ if (model.name(itemIndex) != name)
+ qDebug() << itemIndex;
+ QCOMPARE(model.name(itemIndex), name);
+ }
+ QCOMPARE(items.count(), expectedIndexes.count());
+}
+
+void tst_QQuickListView::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems)
+{
+ for (int i=0; i<itemLists.count(); i++) {
+ QVERIFY(itemLists[i].type() == QVariant::List);
+ QVariantList current = itemLists[i].toList();
+ for (int j=0; j<current.count(); j++) {
+ QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>());
+ QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j)));
+ QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j)));
+ }
+ QCOMPARE(current.count(), expectedItems.count());
+ }
+}
+
+void tst_QQuickListView::flickBeyondBounds()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("flickBeyondBoundsBug.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QTRY_VERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ // Flick view up beyond bounds
+ flick(window, QPoint(10, 10), QPoint(10, -1000), 180);
+ QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() == 0);
+
+ // We're really testing that we don't get stuck in a loop,
+ // but also confirm items positioned correctly.
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 2);
+ for (int i = 0; i < 2; ++i) {
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
+ if (!item) qWarning() << "Item" << i << "not found";
+ QTRY_VERIFY(item);
+ QTRY_VERIFY(item->y() == i*45);
+ }
+
+ delete window;
+}
+
+void tst_QQuickListView::destroyItemOnCreation()
+{
+ QaimModel model;
+ QQuickView *window = createView();
+ window->rootContext()->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("destroyItemOnCreation.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QCOMPARE(window->rootObject()->property("createdIndex").toInt(), -1);
+ model.addItem("new item", "");
+ QTRY_COMPARE(window->rootObject()->property("createdIndex").toInt(), 0);
+
+ QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0);
+ QCOMPARE(model.count(), 0);
+
+ delete window;
+}
+
+void tst_QQuickListView::parentBinding()
+{
+ QQuickView *window = createView();
+
+ QQmlTestMessageHandler messageHandler;
+
+ window->setSource(testFileUrl("parentBinding.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+ QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->width(), listview->width());
+ QCOMPARE(item->height(), listview->height()/12);
+
+ // there should be no transient binding error
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+
+ delete window;
+}
+
+void tst_QQuickListView::defaultHighlightMoveDuration()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0; ListView {}", QUrl::fromLocalFile(""));
+
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ QCOMPARE(obj->property("highlightMoveDuration").toInt(), -1);
+}
+
+void tst_QQuickListView::accessEmptyCurrentItem_QTBUG_30227()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("emptymodel.qml"));
+
+ QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
+ QTRY_VERIFY(listview != 0);
+
+ QMetaObject::invokeMethod(window->rootObject(), "remove");
+ QVERIFY(window->rootObject()->property("isCurrentItemNull").toBool());
+
+ QMetaObject::invokeMethod(window->rootObject(), "add");
+ QVERIFY(!window->rootObject()->property("isCurrentItemNull").toBool());
+}
+
+QTEST_MAIN(tst_QQuickListView)
+
+#include "tst_qquicklistview.moc"
+
+
diff --git a/tests/auto/quick/qquickloader/data/ActiveComponent.qml b/tests/auto/quick/qquickloader/data/ActiveComponent.qml
new file mode 100644
index 0000000000..24c6f7ad91
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/ActiveComponent.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ id: behaviorCounter
+ property int behaviorCount: 0
+ property int canary: 0
+
+ Behavior on canary {
+ NumberAnimation { target: behaviorCounter; property: "behaviorCount"; to: (behaviorCounter.behaviorCount + 1); duration: 0 }
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/AnchoredLoader.qml b/tests/auto/quick/qquickloader/data/AnchoredLoader.qml
new file mode 100644
index 0000000000..1a2a620d7f
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/AnchoredLoader.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 200
+ color: "blue"
+ Loader {
+ objectName: "loader"
+ anchors.fill: parent
+ sourceComponent: Component {
+ Rectangle { color: "red"; objectName: "sourceElement" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/BigComponent.qml b/tests/auto/quick/qquickloader/data/BigComponent.qml
new file mode 100644
index 0000000000..490079ed34
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/BigComponent.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+import LoaderTest 1.0
+
+Item {
+ SlowComponent {}
+}
diff --git a/tests/auto/quick/qquickloader/data/BlueRect.qml b/tests/auto/quick/qquickloader/data/BlueRect.qml
new file mode 100644
index 0000000000..e96ac00f21
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/BlueRect.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "blue"
+ width: 100
+ height: 100
+ color: "blue"
+}
diff --git a/tests/auto/quick/qquickloader/data/CreationContextLoader.qml b/tests/auto/quick/qquickloader/data/CreationContextLoader.qml
new file mode 100644
index 0000000000..4dd73e797c
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/CreationContextLoader.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Loader {
+ id: myLoader
+ property int testProperty: 1912
+ sourceComponent: loaderComponent
+ Component {
+ id: loaderComponent
+ Item {
+ Component.onCompleted: {
+ test = (myLoader.testProperty == 1912);
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/GraphicsWidget250x250.qml b/tests/auto/quick/qquickloader/data/GraphicsWidget250x250.qml
new file mode 100644
index 0000000000..dae8e3fbbb
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/GraphicsWidget250x250.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QGraphicsWidget {
+ size: "250x250"
+}
diff --git a/tests/auto/quick/qquickloader/data/GreenRect.qml b/tests/auto/quick/qquickloader/data/GreenRect.qml
new file mode 100644
index 0000000000..99cefaf176
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/GreenRect.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 100; height: 100
+ color: "green"
+ Component.onCompleted: myLoader.source = "BlueRect.qml"
+}
diff --git a/tests/auto/quick/qquickloader/data/InitialPropertyValuesComponent.qml b/tests/auto/quick/qquickloader/data/InitialPropertyValuesComponent.qml
new file mode 100644
index 0000000000..24c6f7ad91
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/InitialPropertyValuesComponent.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ id: behaviorCounter
+ property int behaviorCount: 0
+ property int canary: 0
+
+ Behavior on canary {
+ NumberAnimation { target: behaviorCounter; property: "behaviorCount"; to: (behaviorCounter.behaviorCount + 1); duration: 0 }
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml b/tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml
new file mode 100644
index 0000000000..7efa4a5f61
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ RandomError
+}
diff --git a/tests/auto/quick/qquickloader/data/NoResize.qml b/tests/auto/quick/qquickloader/data/NoResize.qml
new file mode 100644
index 0000000000..9b3ea6410b
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/NoResize.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Item {
+ width: 200; height: 80
+ Loader {
+ source: "Rect120x60.qml"
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/NoResizeGraphicsWidget.qml b/tests/auto/quick/qquickloader/data/NoResizeGraphicsWidget.qml
new file mode 100644
index 0000000000..c0f51d8c35
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/NoResizeGraphicsWidget.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 80
+ Loader {
+ source: "GraphicsWidget250x250.qml"
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/QTBUG_16928.qml b/tests/auto/quick/qquickloader/data/QTBUG_16928.qml
new file mode 100644
index 0000000000..903d7f0812
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/QTBUG_16928.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "green"
+ width: loader.implicitWidth+50
+ height: loader.implicitHeight+50
+
+ Loader {
+ id: loader
+ sourceComponent: Item {
+ anchors.centerIn: parent
+
+ implicitWidth: 200
+ implicitHeight: 200
+ Rectangle {
+ color: "red"
+ anchors.fill: parent
+ }
+ }
+ anchors.fill: parent
+ anchors.margins: 15
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/QTBUG_17114.qml b/tests/auto/quick/qquickloader/data/QTBUG_17114.qml
new file mode 100644
index 0000000000..7402037553
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/QTBUG_17114.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ property real loaderWidth: loader.width
+ property real loaderHeight: loader.height
+ width: 200
+ height: 200
+
+ Loader {
+ id: loader
+ sourceComponent: Item {
+ property real iwidth: 32
+ property real iheight: 32
+ width: iwidth
+ height: iheight
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/QTBUG_30183.qml b/tests/auto/quick/qquickloader/data/QTBUG_30183.qml
new file mode 100644
index 0000000000..1f626d969f
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/QTBUG_30183.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Loader {
+ width: implicitWidth
+ height: implicitHeight
+
+ sourceComponent: Rectangle {
+ color: "green"
+ implicitWidth: 240
+ implicitHeight: 120
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/Rect120x60.qml b/tests/auto/quick/qquickloader/data/Rect120x60.qml
new file mode 100644
index 0000000000..fc9e447e69
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/Rect120x60.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 120
+ height:60
+}
diff --git a/tests/auto/quick/qquickloader/data/RedRect.qml b/tests/auto/quick/qquickloader/data/RedRect.qml
new file mode 100644
index 0000000000..0eec9b56b7
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/RedRect.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "red"
+ width: 100
+ height: 100
+ color: "red"
+}
diff --git a/tests/auto/quick/qquickloader/data/SetSourceComponent.qml b/tests/auto/quick/qquickloader/data/SetSourceComponent.qml
new file mode 100644
index 0000000000..83cc358f7d
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/SetSourceComponent.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ function clear() {
+ loader.sourceComponent = undefined
+ }
+ Component { id: comp; Rectangle { width: 100; height: 50 } }
+ Loader { id: loader; sourceComponent: comp }
+}
diff --git a/tests/auto/quick/qquickloader/data/SizeGraphicsWidgetToLoader.qml b/tests/auto/quick/qquickloader/data/SizeGraphicsWidgetToLoader.qml
new file mode 100644
index 0000000000..2a63b4d34f
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/SizeGraphicsWidgetToLoader.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Loader {
+ width: 200
+ height: 80
+ source: "GraphicsWidget250x250.qml"
+}
diff --git a/tests/auto/quick/qquickloader/data/SizeLoaderToGraphicsWidget.qml b/tests/auto/quick/qquickloader/data/SizeLoaderToGraphicsWidget.qml
new file mode 100644
index 0000000000..a9875d8e21
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/SizeLoaderToGraphicsWidget.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Loader {
+ source: "GraphicsWidget250x250.qml"
+}
diff --git a/tests/auto/quick/qquickloader/data/SizeToItem.qml b/tests/auto/quick/qquickloader/data/SizeToItem.qml
new file mode 100644
index 0000000000..866365754f
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/SizeToItem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Loader {
+ source: "Rect120x60.qml"
+}
diff --git a/tests/auto/quick/qquickloader/data/SizeToLoader.qml b/tests/auto/quick/qquickloader/data/SizeToLoader.qml
new file mode 100644
index 0000000000..dad18c6939
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/SizeToLoader.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Loader {
+ width: 200; height: 80
+ source: "Rect120x60.qml"
+}
diff --git a/tests/auto/quick/qquickloader/data/TestComponent.2.qml b/tests/auto/quick/qquickloader/data/TestComponent.2.qml
new file mode 100644
index 0000000000..d6e99028b5
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/TestComponent.2.qml
@@ -0,0 +1,592 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + 1
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ Item {
+ id: c3
+ objectName: "c3"
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+ if (c3.children.length != 500) success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/TestComponent.qml b/tests/auto/quick/qquickloader/data/TestComponent.qml
new file mode 100644
index 0000000000..81ea07cb88
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/TestComponent.qml
@@ -0,0 +1,89 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ objectName: "root"
+ property int zero: 0
+ property int one: 1
+
+ Item {
+ id: c1
+ objectName: "c1"
+ property int one: zero + parent.one
+
+ Item {
+ id: c1c1
+ objectName: "c1c1"
+ property bool two: c2c1c1.two
+ }
+
+ Item {
+ id: c1c2
+ objectName: "c1c2"
+ property string three: "three"
+
+ Rectangle {
+ id: c1c2c3
+ objectName: "c1c2c3"
+ property alias othercolor: c2c1.color
+ color: if (c2c1.color == Qt.rgba(0,0,1)) Qt.rgba(1,0,0); else Qt.rgba(0,1,0);
+ }
+ }
+ }
+
+ Item {
+ id: c2
+ objectName: "c2"
+ property string two: "two"
+
+ Rectangle {
+ id: c2c1
+ objectName: "c2c1"
+ property string three: "2" + c1c2.three
+ color: "blue"
+
+ MouseArea {
+ id: c2c1c1
+ objectName: "c2c1c1"
+ property bool two: false
+ onClicked: two = !two
+ }
+
+ Item {
+ id: c2c1c2
+ objectName: "c2c1c2"
+ property string three: "1" + parent.three
+ }
+ }
+ }
+
+ property alias c1one: c1.one
+ property bool success: true
+ Component.onCompleted: {
+ // test state after initial bindings evaluation
+ if (zero != 0) success = false;
+ if (c1.one != 1) success = false;
+ if (c1c1.two != false) success = false;
+ if (c1c2.three != "three") success = false;
+ if (c1c2c3.color != Qt.rgba(1,0,0)) success = false;
+ if (c2.two != "two") success = false;
+ if (c2c1.three != "2three") success = false;
+ if (c2c1.color != Qt.rgba(0,0,1)) success = false;
+ if (c2c1c1.two != false) success = false;
+ if (c2c1c2.three != "12three") success = false;
+
+ // now retrigger bindings evaluation
+ root.zero = 5;
+ if (c1.one != 6) success = false;
+ root.one = 50;
+ if (c1.one != 55) success = false;
+ c2c1c1.two = true;
+ if (c1c1.two != true) success = false;
+ c1c2.three = "3";
+ if (c2c1.three != "23") success = false;
+ if (c2c1c2.three != "123") success = false;
+ c2c1.color = Qt.rgba(1,0,0);
+ if (c1c2c3.color != Qt.rgba(0,1,0)) success = false;
+ if (c1c2c3.othercolor != Qt.rgba(1,0,0)) success = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/VmeError.qml b/tests/auto/quick/qquickloader/data/VmeError.qml
new file mode 100644
index 0000000000..0443aa9054
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/VmeError.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 100; height: 100; color: "red"
+ signal somethingHappened
+ onSomethingHappened: QtObject {}
+}
diff --git a/tests/auto/quick/qquickloader/data/active.1.qml b/tests/auto/quick/qquickloader/data/active.1.qml
new file mode 100644
index 0000000000..2dbd1a0887
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.1.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ active: false
+ }
+
+ Component {
+ id: inlineTestComponent
+ Item {
+ id: inlineTestItem
+ property int someProperty: 5
+ }
+ }
+
+ function doSetSource() {
+ loader.source = "ActiveComponent.qml";
+ }
+
+ function doSetSourceComponent() {
+ loader.sourceComponent = inlineTestComponent;
+ }
+
+ function doSetActive() {
+ loader.active = true;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/active.2.qml b/tests/auto/quick/qquickloader/data/active.2.qml
new file mode 100644
index 0000000000..e561744c63
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.2.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ source: "ActiveComponent.qml";
+
+ property int statusChangedCount: 0
+ onStatusChanged: statusChangedCount = statusChangedCount + 1
+ }
+
+ function doSetInactive() {
+ loader.active = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/active.3.qml b/tests/auto/quick/qquickloader/data/active.3.qml
new file mode 100644
index 0000000000..0fbba959bb
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.3.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ source: "ActiveComponent.qml";
+
+ property int sourceChangedCount: 0
+ onSourceChanged: sourceChangedCount = sourceChangedCount + 1
+ }
+
+ function doSetInactive() {
+ loader.active = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/active.4.qml b/tests/auto/quick/qquickloader/data/active.4.qml
new file mode 100644
index 0000000000..63fd46e2da
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.4.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Component {
+ id: inlineTestComponent
+ Item {
+ id: inlineTestItem
+ property int someProperty: 5
+ }
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: inlineTestComponent
+
+ property int sourceComponentChangedCount: 0
+ onSourceComponentChanged: sourceComponentChangedCount = sourceComponentChangedCount + 1
+ }
+
+ function doSetInactive() {
+ loader.active = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/active.5.qml b/tests/auto/quick/qquickloader/data/active.5.qml
new file mode 100644
index 0000000000..903f458a41
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.5.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ source: "ActiveComponent.qml";
+
+ property int itemChangedCount: 0
+ onItemChanged: itemChangedCount = itemChangedCount + 1
+ }
+
+ function doSetInactive() {
+ loader.active = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/active.6.qml b/tests/auto/quick/qquickloader/data/active.6.qml
new file mode 100644
index 0000000000..f769a4e184
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.6.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+
+ property int activeChangedCount: 0
+ onActiveChanged: activeChangedCount = activeChangedCount + 1
+ }
+
+ function doSetActive() {
+ loader.active = true;
+ }
+
+ function doSetInactive() {
+ loader.active = false;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/active.7.qml b/tests/auto/quick/qquickloader/data/active.7.qml
new file mode 100644
index 0000000000..a29e932f5e
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.7.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+Rectangle {
+ id: root
+ color: "blue"
+ width: 100; height: 100
+ property bool success: true
+
+ Loader {
+ active: false
+ anchors.fill: parent
+ sourceComponent: Rectangle { color: "red" }
+ onLoaded: { root.success = false; } // shouldn't be triggered if active is false
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/active.8.qml b/tests/auto/quick/qquickloader/data/active.8.qml
new file mode 100644
index 0000000000..3a66d3e99a
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/active.8.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+Rectangle {
+ id: root
+ color: "blue"
+ width: 100; height: 100
+ property bool success: false
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: Rectangle { color: "red" }
+ onLoaded: { root.success = true; } // should be triggered since active is true by default
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/asynchronous.qml b/tests/auto/quick/qquickloader/data/asynchronous.qml
new file mode 100644
index 0000000000..29570525ad
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/asynchronous.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ property string comp
+ function loadComponent() {
+ loader.source = comp
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ asynchronous: true
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/crash.qml b/tests/auto/quick/qquickloader/data/crash.qml
new file mode 100644
index 0000000000..e6ddc33a10
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/crash.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ function setLoaderSource() {
+ myLoader.source = "GreenRect.qml"
+ }
+
+ Loader {
+ id: myLoader
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/creationContext.qml b/tests/auto/quick/qquickloader/data/creationContext.qml
new file mode 100644
index 0000000000..17a596cc74
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/creationContext.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Item {
+ property bool test: false
+
+ CreationContextLoader {
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/differentorigin.qml b/tests/auto/quick/qquickloader/data/differentorigin.qml
new file mode 100644
index 0000000000..56a3034fe0
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/differentorigin.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Loader { source: "http://evil.place/evil.qml" }
diff --git a/tests/auto/quick/qquickloader/data/implicitSize.qml b/tests/auto/quick/qquickloader/data/implicitSize.qml
new file mode 100644
index 0000000000..ae8c0b8b30
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/implicitSize.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Rectangle {
+ property real implWidth: 0
+ property real implHeight: 0
+ function changeImplicitSize () {
+ loader.item.implicitWidth = 200
+ loader.item.implicitHeight = 300
+ }
+ color: "green"
+ width: loader.implicitWidth+50
+ height: loader.implicitHeight+50
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: Item {
+ anchors.centerIn: parent
+
+ implicitWidth: 100
+ implicitHeight: 100
+ Rectangle {
+ color: "red"
+ anchors.fill: parent
+ }
+ }
+
+ anchors.fill: parent
+ anchors.margins: 50
+ onImplicitWidthChanged: implWidth = implicitWidth
+ onImplicitHeightChanged: implHeight = loader.implicitHeight
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.1.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.1.qml
new file mode 100644
index 0000000000..ae371797ce
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.1.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int initialValue: 0
+ property int behaviorCount: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+
+ onLoaded: {
+ loader.item.canary = 1; // will trigger the behavior, setting behaviorCount -> 1
+ }
+ }
+
+ Component.onCompleted: {
+ loader.source = "InitialPropertyValuesComponent.qml";
+ root.initialValue = loader.item.canary; // should be one, since onLoaded will have triggered by now
+ root.behaviorCount = loader.item.behaviorCount; // should be one, since onLoaded will have triggered by now
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.2.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.2.qml
new file mode 100644
index 0000000000..76c7bc2fd6
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.2.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int initialValue: 0
+ property int behaviorCount: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ onLoaded: {
+ root.initialValue = loader.item.canary; // should be two
+ root.behaviorCount = loader.item.behaviorCount; // should be zero
+ }
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", {"canary": 2});
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.3.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.3.qml
new file mode 100644
index 0000000000..3b08e6ee42
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.3.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int initialValue: 0
+ property int behaviorCount: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ active: false
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", {"canary": 3});
+ root.initialValue = loader.item.canary; // error - item should not yet exist.
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.4.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.4.qml
new file mode 100644
index 0000000000..e8310044e8
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.4.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int initialValue: 0
+ property int behaviorCount: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ active: false
+ onLoaded: {
+ root.initialValue = loader.item.canary; // should be four
+ root.behaviorCount = loader.item.behaviorCount; // should be zero
+ }
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", {"canary": 4});
+ loader.active = true
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.5.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.5.qml
new file mode 100644
index 0000000000..03ee599aba
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.5.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int initialValue: 0
+ property int behaviorCount: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ onLoaded: {
+ root.initialValue = loader.item.canary; // should be zero, but no error
+ root.behaviorCount = loader.item.behaviorCount; // should be zero
+ }
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml");
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.6.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.6.qml
new file mode 100644
index 0000000000..66452b512b
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.6.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int initialValue: 0
+ property int behaviorCount: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ onLoaded: {
+ root.initialValue = loader.item.canary; // should be six
+ root.behaviorCount = loader.item.behaviorCount; // should be zero
+ }
+ }
+
+ Item {
+ id: child
+ property int bindable: 6
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", {"canary": child.bindable});
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.7.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.7.qml
new file mode 100644
index 0000000000..02349f7ddf
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.7.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int loaderValue: 0
+ property int createObjectValue: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ onLoaded: {
+ root.loaderValue = loader.item.canary; // should still be one
+ }
+ }
+
+ Item {
+ id: child
+ property int bindable: 1;
+ }
+
+ property InitialPropertyValuesComponent ipvc
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", {"canary": child.bindable});
+ var dynComp = Qt.createComponent("InitialPropertyValuesComponent.qml");
+ ipvc = dynComp.createObject(root, {"canary": child.bindable});
+ child.bindable = 7; // won't cause re-evaluation, since not used in a binding.
+ root.createObjectValue = ipvc.canary; // should still be one
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.8.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.8.qml
new file mode 100644
index 0000000000..fff67f361e
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.8.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int initialValue: 0
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ active: false
+ onLoaded: {
+ root.initialValue = loader.item.canary; // should be six
+ }
+ }
+
+ Component.onCompleted: {
+ loader.setSource("http://127.0.0.1:14458/InitialPropertyValuesComponent.qml", {"canary": 6});
+ loader.active = true;
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.binding.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.binding.qml
new file mode 100644
index 0000000000..2ee60b0b50
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.binding.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property InitialPropertyValuesComponent testInstance
+ testInstance: loader.item
+
+ property int bindable: 1
+ property int canaryValue: testInstance.canary
+ property int behaviorCount: testInstance.behaviorCount
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", {"canary": Qt.binding(function() { return root.bindable })});
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.error.1.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.1.qml
new file mode 100644
index 0000000000..f324dbddac
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.1.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", 3); // invalid initial properties object
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.error.2.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.2.qml
new file mode 100644
index 0000000000..89aba313c7
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.2.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ }
+
+ Component.onCompleted: {
+ loader.setSource("NonexistentSourceComponent.qml", {"canary":3});
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.error.3.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.3.qml
new file mode 100644
index 0000000000..c862007402
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.3.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InvalidSourceComponent.qml", {"canary":3});
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/initialPropertyValues.error.4.qml b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.4.qml
new file mode 100644
index 0000000000..9a80b2156d
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/initialPropertyValues.error.4.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int canary: loader.item.canary
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ }
+
+ Component.onCompleted: {
+ loader.setSource("InitialPropertyValuesComponent.qml", 3); // invalid initial properties object
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/loadedSignal.2.qml b/tests/auto/quick/qquickloader/data/loadedSignal.2.qml
new file mode 100644
index 0000000000..a4a663c71f
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/loadedSignal.2.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ width: 200
+ height: 200
+
+ property bool success: true
+ property int loadCount: 0
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ active: false
+ source: "TestComponent.qml"
+ onLoaded: {
+ if (status !== Loader.Ready) {
+ root.success = false;
+ }
+ root.loadCount++;
+ }
+ }
+
+ function triggerLoading() {
+ // we set source to a valid path (but which is an invalid / erroneous component)
+ // we should not get onLoaded, since the status should not be Ready.
+ loader.source = "GreenRect.qml" // causes reference error.
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/loadedSignal.qml b/tests/auto/quick/qquickloader/data/loadedSignal.qml
new file mode 100644
index 0000000000..7cc0fed001
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/loadedSignal.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ width: 200
+ height: 200
+
+ property bool success: true
+ property int loadCount: 0
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ active: false
+ source: "TestComponent.qml"
+ onLoaded: {
+ if (status !== Loader.Ready) {
+ root.success = false;
+ }
+ root.loadCount++;
+ }
+ }
+
+ function triggerLoading() {
+ // we set active to true, which triggers loading.
+ // we then immediately set active to false.
+ // this should clear the incubator and stop loading.
+ loader.active = true;
+ loader.active = false;
+ }
+
+ function activate() {
+ loader.active = true;
+ }
+
+ function deactivate() {
+ loader.active = false;
+ }
+
+ function triggerMultipleLoad() {
+ loader.active = false; // deactivate as a precondition.
+ loader.source = "BlueRect.qml"
+ loader.active = true; // should trigger loading to begin
+ loader.source = "RedRect.qml"; // should clear the incubator and restart loading
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/nonItem.qml b/tests/auto/quick/qquickloader/data/nonItem.qml
new file mode 100644
index 0000000000..8cfa0d8efb
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/nonItem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Loader {
+ sourceComponent: QtObject {}
+}
diff --git a/tests/auto/quick/qquickloader/data/parented.qml b/tests/auto/quick/qquickloader/data/parented.qml
new file mode 100644
index 0000000000..1c19d4d1a5
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/parented.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 300; height: 300
+
+ Component {
+ id: comp
+ Rectangle {
+ objectName: "comp"
+ parent: root
+ anchors.fill: parent
+ color: "blue"
+ }
+ }
+
+ Loader {
+ width: 200; height: 200
+ sourceComponent: comp
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/qmldir b/tests/auto/quick/qquickloader/data/qmldir
new file mode 100644
index 0000000000..bf42b507c0
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/qmldir
@@ -0,0 +1 @@
+# For tst_QDeclarativeLoader::networkRequestUrl; no types needed though.
diff --git a/tests/auto/quick/qquickloader/data/sameorigin-load.qml b/tests/auto/quick/qquickloader/data/sameorigin-load.qml
new file mode 100644
index 0000000000..3332500be6
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/sameorigin-load.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Item { }
diff --git a/tests/auto/quick/qquickloader/data/sameorigin.qml b/tests/auto/quick/qquickloader/data/sameorigin.qml
new file mode 100644
index 0000000000..84846b6aba
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/sameorigin.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+Loader { source: "sameorigin-load.qml" }
diff --git a/tests/auto/quick/qquickloader/data/simultaneous.qml b/tests/auto/quick/qquickloader/data/simultaneous.qml
new file mode 100644
index 0000000000..cab6498863
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/simultaneous.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ function loadComponents() {
+ asyncLoader.source = "TestComponent.2.qml"
+ syncLoader.source = "TestComponent.qml"
+ }
+
+ Loader {
+ id: asyncLoader
+ objectName: "asyncLoader"
+ asynchronous: true
+ }
+
+ Loader {
+ id: syncLoader
+ objectName: "syncLoader"
+ asynchronous: false
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/sizebound.qml b/tests/auto/quick/qquickloader/data/sizebound.qml
new file mode 100644
index 0000000000..09cf32426a
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/sizebound.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Item {
+ width: 200; height: 200
+
+ function switchComponent() {
+ load.sourceComponent = comp2
+ }
+
+ Component {
+ id: comp
+ Rectangle {
+ width: 50; height: 60; color: "red"
+ }
+ }
+
+ Component {
+ id: comp2
+ Rectangle {
+ width: 80; height: 90; color: "green"
+ }
+ }
+
+ Loader {
+ id: load
+ objectName: "loader"
+ sourceComponent: comp
+ height: item ? item.height : 0
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/subdir/Test.qml b/tests/auto/quick/qquickloader/data/subdir/Test.qml
new file mode 100644
index 0000000000..3abbd89d46
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/subdir/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ id: test
+}
diff --git a/tests/auto/quick/qquickloader/data/vmeErrors.qml b/tests/auto/quick/qquickloader/data/vmeErrors.qml
new file mode 100644
index 0000000000..8e6c89dc8e
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/vmeErrors.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Loader {
+ source: "VmeError.qml"
+}
+
diff --git a/tests/auto/quick/qquickloader/qquickloader.pro b/tests/auto/quick/qquickloader/qquickloader.pro
new file mode 100644
index 0000000000..567917877c
--- /dev/null
+++ b/tests/auto/quick/qquickloader/qquickloader.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qquickloader
+macx:CONFIG -= app_bundle
+
+INCLUDEPATH += ../../shared/
+HEADERS += ../../shared/testhttpserver.h
+
+SOURCES += tst_qquickloader.cpp \
+ ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
new file mode 100644
index 0000000000..50ded4d95a
--- /dev/null
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -0,0 +1,1149 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+
+#include <QSignalSpy>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlincubator.h>
+#include <private/qquickloader_p.h>
+#include "testhttpserver.h"
+#include "../../shared/util.h"
+
+#define SERVER_PORT 14458
+#define SERVER_ADDR "http://localhost:14458"
+
+class SlowComponent : public QQmlComponent
+{
+ Q_OBJECT
+public:
+ SlowComponent() {
+ QTest::qSleep(500);
+ }
+};
+
+class PeriodicIncubationController : public QObject,
+ public QQmlIncubationController
+{
+public:
+ PeriodicIncubationController() : incubated(false) {}
+
+ void start() { startTimer(20); }
+
+ bool incubated;
+
+protected:
+ virtual void timerEvent(QTimerEvent *) {
+ incubateFor(15);
+ }
+
+ virtual void incubatingObjectCountChanged(int count) {
+ if (count)
+ incubated = true;
+ }
+};
+
+class tst_QQuickLoader : public QQmlDataTest
+
+{
+ Q_OBJECT
+public:
+ tst_QQuickLoader();
+
+private slots:
+ void cleanup();
+
+ void sourceOrComponent();
+ void sourceOrComponent_data();
+ void clear();
+ void urlToComponent();
+ void componentToUrl();
+ void anchoredLoader();
+ void sizeLoaderToItem();
+ void sizeItemToLoader();
+ void noResize();
+ void networkRequestUrl();
+ void failNetworkRequest();
+ void networkComponent();
+ void active();
+ void initialPropertyValues_data();
+ void initialPropertyValues();
+ void initialPropertyValuesBinding();
+ void initialPropertyValuesError_data();
+ void initialPropertyValuesError();
+
+ void deleteComponentCrash();
+ void nonItem();
+ void vmeErrors();
+ void creationContext();
+ void QTBUG_16928();
+ void implicitSize();
+ void QTBUG_17114();
+ void asynchronous_data();
+ void asynchronous();
+ void asynchronous_clear();
+ void simultaneousSyncAsync();
+ void loadedSignal();
+
+ void parented();
+ void sizeBound();
+ void QTBUG_30183();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_QQuickLoader::cleanup()
+{
+ // clear components. otherwise we even bypass the test server by using the cache.
+ engine.clearComponentCache();
+}
+
+tst_QQuickLoader::tst_QQuickLoader()
+{
+ qmlRegisterType<SlowComponent>("LoaderTest", 1, 0, "SlowComponent");
+}
+
+void tst_QQuickLoader::sourceOrComponent()
+{
+ QFETCH(QString, sourceOrComponent);
+ QFETCH(QString, sourceDefinition);
+ QFETCH(QUrl, sourceUrl);
+ QFETCH(QString, errorString);
+
+ bool error = !errorString.isEmpty();
+ if (error)
+ QTest::ignoreMessage(QtWarningMsg, errorString.toUtf8().constData());
+
+ QQmlComponent component(&engine);
+ component.setData(QByteArray(
+ "import QtQuick 2.0\n"
+ "Loader {\n"
+ " property int onItemChangedCount: 0\n"
+ " property int onSourceChangedCount: 0\n"
+ " property int onSourceComponentChangedCount: 0\n"
+ " property int onStatusChangedCount: 0\n"
+ " property int onProgressChangedCount: 0\n"
+ " property int onLoadedCount: 0\n")
+ + sourceDefinition.toUtf8()
+ + QByteArray(
+ " onItemChanged: onItemChangedCount += 1\n"
+ " onSourceChanged: onSourceChangedCount += 1\n"
+ " onSourceComponentChanged: onSourceComponentChangedCount += 1\n"
+ " onStatusChanged: onStatusChangedCount += 1\n"
+ " onProgressChanged: onProgressChangedCount += 1\n"
+ " onLoaded: onLoadedCount += 1\n"
+ "}")
+ , dataDirectoryUrl());
+
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->item() == 0, error);
+ QCOMPARE(loader->source(), sourceUrl);
+ QCOMPARE(loader->progress(), 1.0);
+
+ QCOMPARE(loader->status(), error ? QQuickLoader::Error : QQuickLoader::Ready);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), error ? 0: 1);
+
+ if (!error) {
+ bool sourceComponentIsChildOfLoader = false;
+ for (int ii = 0; ii < loader->children().size(); ++ii) {
+ QQmlComponent *c = qobject_cast<QQmlComponent*>(loader->children().at(ii));
+ if (c && c == loader->sourceComponent()) {
+ sourceComponentIsChildOfLoader = true;
+ }
+ }
+ QVERIFY(sourceComponentIsChildOfLoader);
+ }
+
+ if (sourceOrComponent == "component") {
+ QCOMPARE(loader->property("onSourceComponentChangedCount").toInt(), 1);
+ QCOMPARE(loader->property("onSourceChangedCount").toInt(), 0);
+ } else {
+ QCOMPARE(loader->property("onSourceComponentChangedCount").toInt(), 0);
+ QCOMPARE(loader->property("onSourceChangedCount").toInt(), 1);
+ }
+ QCOMPARE(loader->property("onStatusChangedCount").toInt(), 1);
+ QCOMPARE(loader->property("onProgressChangedCount").toInt(), 1);
+
+ QCOMPARE(loader->property("onItemChangedCount").toInt(), 1);
+ QCOMPARE(loader->property("onLoadedCount").toInt(), error ? 0 : 1);
+
+ delete loader;
+}
+
+void tst_QQuickLoader::sourceOrComponent_data()
+{
+ QTest::addColumn<QString>("sourceOrComponent");
+ QTest::addColumn<QString>("sourceDefinition");
+ QTest::addColumn<QUrl>("sourceUrl");
+ QTest::addColumn<QString>("errorString");
+
+ QTest::newRow("source") << "source" << "source: 'Rect120x60.qml'\n" << testFileUrl("Rect120x60.qml") << "";
+ QTest::newRow("source with subdir") << "source" << "source: 'subdir/Test.qml'\n" << testFileUrl("subdir/Test.qml") << "";
+ QTest::newRow("source with encoded subdir literal") << "source" << "source: 'subdir%2fTest.qml'\n" << testFileUrl("subdir/Test.qml") << "";
+ QTest::newRow("source with encoded subdir optimized binding") << "source" << "source: 'subdir' + '%2fTest.qml'\n" << testFileUrl("subdir/Test.qml") << "";
+ QTest::newRow("source with encoded subdir binding") << "source" << "source: encodeURIComponent('subdir/Test.qml')\n" << testFileUrl("subdir/Test.qml") << "";
+ QTest::newRow("sourceComponent") << "component" << "Component { id: comp; Rectangle { width: 100; height: 50 } }\n sourceComponent: comp\n" << QUrl() << "";
+ QTest::newRow("invalid source") << "source" << "source: 'IDontExist.qml'\n" << testFileUrl("IDontExist.qml")
+ << QString(testFileUrl("IDontExist.qml").toString() + ": File not found");
+}
+
+void tst_QQuickLoader::clear()
+{
+ {
+ QQmlComponent component(&engine);
+ component.setData(QByteArray(
+ "import QtQuick 2.0\n"
+ " Loader { id: loader\n"
+ " source: 'Rect120x60.qml'\n"
+ " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n"
+ " }")
+ , dataDirectoryUrl());
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+
+ QTRY_VERIFY(loader->item() == 0);
+ QCOMPARE(loader->progress(), 0.0);
+ QCOMPARE(loader->status(), QQuickLoader::Null);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0);
+
+ delete loader;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("/SetSourceComponent.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(item->QQuickItem::childItems().at(0));
+ QVERIFY(loader);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+
+ loader->setSourceComponent(0);
+
+ QVERIFY(loader->item() == 0);
+ QCOMPARE(loader->progress(), 0.0);
+ QCOMPARE(loader->status(), QQuickLoader::Null);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0);
+
+ delete item;
+ }
+ {
+ QQmlComponent component(&engine, testFileUrl("/SetSourceComponent.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(item->QQuickItem::childItems().at(0));
+ QVERIFY(loader);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+
+ QMetaObject::invokeMethod(item, "clear");
+
+ QVERIFY(loader->item() == 0);
+ QCOMPARE(loader->progress(), 0.0);
+ QCOMPARE(loader->status(), QQuickLoader::Null);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0);
+
+ delete item;
+ }
+}
+
+void tst_QQuickLoader::urlToComponent()
+{
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQuick 2.0\n"
+ "Loader {\n"
+ " id: loader\n"
+ " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n"
+ " source: \"Rect120x60.qml\"\n"
+ " Timer { interval: 100; running: true; onTriggered: loader.sourceComponent = myComp }\n"
+ "}" )
+ , dataDirectoryUrl());
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QTest::qWait(200);
+ QTRY_VERIFY(loader != 0);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+ QCOMPARE(loader->width(), 10.0);
+ QCOMPARE(loader->height(), 10.0);
+
+ delete loader;
+}
+
+void tst_QQuickLoader::componentToUrl()
+{
+ QQmlComponent component(&engine, testFileUrl("/SetSourceComponent.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(item->QQuickItem::childItems().at(0));
+ QVERIFY(loader);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+
+ loader->setSource(testFileUrl("/Rect120x60.qml"));
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+ QCOMPARE(loader->width(), 120.0);
+ QCOMPARE(loader->height(), 60.0);
+
+ delete item;
+}
+
+void tst_QQuickLoader::anchoredLoader()
+{
+ QQmlComponent component(&engine, testFileUrl("/AnchoredLoader.qml"));
+ QQuickItem *rootItem = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(rootItem != 0);
+ QQuickItem *loader = rootItem->findChild<QQuickItem*>("loader");
+ QQuickItem *sourceElement = rootItem->findChild<QQuickItem*>("sourceElement");
+
+ QVERIFY(loader != 0);
+ QVERIFY(sourceElement != 0);
+
+ QCOMPARE(rootItem->width(), 300.0);
+ QCOMPARE(rootItem->height(), 200.0);
+
+ QCOMPARE(loader->width(), 300.0);
+ QCOMPARE(loader->height(), 200.0);
+
+ QCOMPARE(sourceElement->width(), 300.0);
+ QCOMPARE(sourceElement->height(), 200.0);
+}
+
+void tst_QQuickLoader::sizeLoaderToItem()
+{
+ QQmlComponent component(&engine, testFileUrl("/SizeToItem.qml"));
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->width(), 120.0);
+ QCOMPARE(loader->height(), 60.0);
+
+ // Check resize
+ QQuickItem *rect = qobject_cast<QQuickItem*>(loader->item());
+ QVERIFY(rect);
+ rect->setWidth(150);
+ rect->setHeight(45);
+ QCOMPARE(loader->width(), 150.0);
+ QCOMPARE(loader->height(), 45.0);
+
+ // Check explicit width
+ loader->setWidth(200.0);
+ QCOMPARE(loader->width(), 200.0);
+ QCOMPARE(rect->width(), 200.0);
+ rect->setWidth(100.0); // when rect changes ...
+ QCOMPARE(rect->width(), 100.0); // ... it changes
+ QCOMPARE(loader->width(), 200.0); // ... but loader stays the same
+
+ // Check explicit height
+ loader->setHeight(200.0);
+ QCOMPARE(loader->height(), 200.0);
+ QCOMPARE(rect->height(), 200.0);
+ rect->setHeight(100.0); // when rect changes ...
+ QCOMPARE(rect->height(), 100.0); // ... it changes
+ QCOMPARE(loader->height(), 200.0); // ... but loader stays the same
+
+ // Switch mode
+ loader->setWidth(180);
+ loader->setHeight(30);
+ QCOMPARE(rect->width(), 180.0);
+ QCOMPARE(rect->height(), 30.0);
+
+ delete loader;
+}
+
+void tst_QQuickLoader::sizeItemToLoader()
+{
+ QQmlComponent component(&engine, testFileUrl("/SizeToLoader.qml"));
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->width(), 200.0);
+ QCOMPARE(loader->height(), 80.0);
+
+ QQuickItem *rect = qobject_cast<QQuickItem*>(loader->item());
+ QVERIFY(rect);
+ QCOMPARE(rect->width(), 200.0);
+ QCOMPARE(rect->height(), 80.0);
+
+ // Check resize
+ loader->setWidth(180);
+ loader->setHeight(30);
+ QCOMPARE(rect->width(), 180.0);
+ QCOMPARE(rect->height(), 30.0);
+
+ // Switch mode
+ loader->resetWidth(); // reset explicit size
+ loader->resetHeight();
+ rect->setWidth(160);
+ rect->setHeight(45);
+ QCOMPARE(loader->width(), 160.0);
+ QCOMPARE(loader->height(), 45.0);
+
+ delete loader;
+}
+
+void tst_QQuickLoader::noResize()
+{
+ QQmlComponent component(&engine, testFileUrl("/NoResize.qml"));
+ QQuickItem* item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item != 0);
+ QCOMPARE(item->width(), 200.0);
+ QCOMPARE(item->height(), 80.0);
+
+ delete item;
+}
+
+void tst_QQuickLoader::networkRequestUrl()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQuick 2.0\nLoader { property int signalCount : 0; source: \"" SERVER_ADDR "/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), testFileUrl("../dummy.qml"));
+ if (component.isError())
+ qDebug() << component.errors();
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+
+ QTRY_VERIFY(loader->status() == QQuickLoader::Ready);
+
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(loader->property("signalCount").toInt(), 1);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+
+ delete loader;
+}
+
+/* XXX Component waits until all dependencies are loaded. Is this actually possible? */
+void tst_QQuickLoader::networkComponent()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
+
+ QQmlComponent component(&engine);
+ component.setData(QByteArray(
+ "import QtQuick 2.0\n"
+ "import \"" SERVER_ADDR "/\" as NW\n"
+ "Item {\n"
+ " Component { id: comp; NW.Rect120x60 {} }\n"
+ " Loader { sourceComponent: comp } }")
+ , dataDirectory());
+ QCOMPARE(component.status(), QQmlComponent::Loading);
+ server.sendDelayedItem();
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(item->children().at(1));
+ QVERIFY(loader);
+ QTRY_VERIFY(loader->status() == QQuickLoader::Ready);
+
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(loader->status(), QQuickLoader::Ready);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->children().count(), 1);
+
+ delete loader;
+}
+
+void tst_QQuickLoader::failNetworkRequest()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ QTest::ignoreMessage(QtWarningMsg, SERVER_ADDR "/IDontExist.qml: File not found");
+
+ QQmlComponent component(&engine);
+ component.setData(QByteArray("import QtQuick 2.0\nLoader { property int did_load: 123; source: \"" SERVER_ADDR "/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl(QString(SERVER_ADDR "/dummy.qml")));
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+
+ QTRY_VERIFY(loader->status() == QQuickLoader::Error);
+
+ QVERIFY(loader->item() == 0);
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(loader->property("did_load").toInt(), 123);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0);
+
+ delete loader;
+}
+
+void tst_QQuickLoader::active()
+{
+ // check that the item isn't instantiated until active is set to true
+ {
+ QQmlComponent component(&engine, testFileUrl("active.1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+
+ QVERIFY(loader->active() == false); // set manually to false
+ QVERIFY(loader->item() == 0);
+ QMetaObject::invokeMethod(object, "doSetSourceComponent");
+ QVERIFY(loader->item() == 0);
+ QMetaObject::invokeMethod(object, "doSetSource");
+ QVERIFY(loader->item() == 0);
+ QMetaObject::invokeMethod(object, "doSetActive");
+ QVERIFY(loader->item() != 0);
+
+ delete object;
+ }
+
+ // check that the status is Null if active is set to false
+ {
+ QQmlComponent component(&engine, testFileUrl("active.2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+
+ QVERIFY(loader->active() == true); // active is true by default
+ QCOMPARE(loader->status(), QQuickLoader::Ready);
+ int currStatusChangedCount = loader->property("statusChangedCount").toInt();
+ QMetaObject::invokeMethod(object, "doSetInactive");
+ QCOMPARE(loader->status(), QQuickLoader::Null);
+ QCOMPARE(loader->property("statusChangedCount").toInt(), (currStatusChangedCount+1));
+
+ delete object;
+ }
+
+ // check that the source is not cleared if active is set to false
+ {
+ QQmlComponent component(&engine, testFileUrl("active.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+
+ QVERIFY(loader->active() == true); // active is true by default
+ QVERIFY(!loader->source().isEmpty());
+ int currSourceChangedCount = loader->property("sourceChangedCount").toInt();
+ QMetaObject::invokeMethod(object, "doSetInactive");
+ QVERIFY(!loader->source().isEmpty());
+ QCOMPARE(loader->property("sourceChangedCount").toInt(), currSourceChangedCount);
+
+ delete object;
+ }
+
+ // check that the sourceComponent is not cleared if active is set to false
+ {
+ QQmlComponent component(&engine, testFileUrl("active.4.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+
+ QVERIFY(loader->active() == true); // active is true by default
+ QVERIFY(loader->sourceComponent() != 0);
+ int currSourceComponentChangedCount = loader->property("sourceComponentChangedCount").toInt();
+ QMetaObject::invokeMethod(object, "doSetInactive");
+ QVERIFY(loader->sourceComponent() != 0);
+ QCOMPARE(loader->property("sourceComponentChangedCount").toInt(), currSourceComponentChangedCount);
+
+ delete object;
+ }
+
+ // check that the item is released if active is set to false
+ {
+ QQmlComponent component(&engine, testFileUrl("active.5.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+
+ QVERIFY(loader->active() == true); // active is true by default
+ QVERIFY(loader->item() != 0);
+ int currItemChangedCount = loader->property("itemChangedCount").toInt();
+ QMetaObject::invokeMethod(object, "doSetInactive");
+ QVERIFY(loader->item() == 0);
+ QCOMPARE(loader->property("itemChangedCount").toInt(), (currItemChangedCount+1));
+
+ delete object;
+ }
+
+ // check that the activeChanged signal is emitted correctly
+ {
+ QQmlComponent component(&engine, testFileUrl("active.6.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+
+ QVERIFY(loader->active() == true); // active is true by default
+ loader->setActive(true); // no effect
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 0);
+ loader->setActive(false); // change signal should be emitted
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 1);
+ loader->setActive(false); // no effect
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 1);
+ loader->setActive(true); // change signal should be emitted
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 2);
+ loader->setActive(false); // change signal should be emitted
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 3);
+ QMetaObject::invokeMethod(object, "doSetActive");
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 4);
+ QMetaObject::invokeMethod(object, "doSetActive");
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 4);
+ QMetaObject::invokeMethod(object, "doSetInactive");
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 5);
+ loader->setActive(true); // change signal should be emitted
+ QCOMPARE(loader->property("activeChangedCount").toInt(), 6);
+
+ delete object;
+ }
+
+ // check that the component isn't loaded until active is set to true
+ {
+ QQmlComponent component(&engine, testFileUrl("active.7.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+ delete object;
+ }
+
+ // check that the component is loaded if active is not set (true by default)
+ {
+ QQmlComponent component(&engine, testFileUrl("active.8.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("success").toBool(), true);
+ delete object;
+ }
+}
+
+void tst_QQuickLoader::initialPropertyValues_data()
+{
+ QTest::addColumn<QUrl>("qmlFile");
+ QTest::addColumn<QStringList>("expectedWarnings");
+ QTest::addColumn<QStringList>("propertyNames");
+ QTest::addColumn<QVariantList>("propertyValues");
+
+ QTest::newRow("source url with value set in onLoaded, initially active = true") << testFileUrl("initialPropertyValues.1.qml")
+ << QStringList()
+ << (QStringList() << "initialValue" << "behaviorCount")
+ << (QVariantList() << 1 << 1);
+
+ QTest::newRow("set source with initial property values specified, active = true") << testFileUrl("initialPropertyValues.2.qml")
+ << QStringList()
+ << (QStringList() << "initialValue" << "behaviorCount")
+ << (QVariantList() << 2 << 0);
+
+ QTest::newRow("set source with initial property values specified, active = false") << testFileUrl("initialPropertyValues.3.qml")
+ << (QStringList() << QString(testFileUrl("initialPropertyValues.3.qml").toString() + QLatin1String(":16: TypeError: Cannot read property 'canary' of null")))
+ << (QStringList())
+ << (QVariantList());
+
+ QTest::newRow("set source with initial property values specified, active = false, with active set true later") << testFileUrl("initialPropertyValues.4.qml")
+ << QStringList()
+ << (QStringList() << "initialValue" << "behaviorCount")
+ << (QVariantList() << 4 << 0);
+
+ QTest::newRow("set source without initial property values specified, active = true") << testFileUrl("initialPropertyValues.5.qml")
+ << QStringList()
+ << (QStringList() << "initialValue" << "behaviorCount")
+ << (QVariantList() << 0 << 0);
+
+ QTest::newRow("set source with initial property values specified with binding, active = true") << testFileUrl("initialPropertyValues.6.qml")
+ << QStringList()
+ << (QStringList() << "initialValue" << "behaviorCount")
+ << (QVariantList() << 6 << 0);
+
+ QTest::newRow("ensure initial property value semantics mimic createObject") << testFileUrl("initialPropertyValues.7.qml")
+ << QStringList()
+ << (QStringList() << "loaderValue" << "createObjectValue")
+ << (QVariantList() << 1 << 1);
+
+ QTest::newRow("ensure initial property values aren't disposed prior to component completion") << testFileUrl("initialPropertyValues.8.qml")
+ << QStringList()
+ << (QStringList() << "initialValue")
+ << (QVariantList() << 6);
+}
+
+void tst_QQuickLoader::initialPropertyValues()
+{
+ QFETCH(QUrl, qmlFile);
+ QFETCH(QStringList, expectedWarnings);
+ QFETCH(QStringList, propertyNames);
+ QFETCH(QVariantList, propertyValues);
+
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(dataDirectory());
+
+ foreach (const QString &warning, expectedWarnings)
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
+
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ if (expectedWarnings.isEmpty()) {
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+ QTRY_VERIFY(loader->item());
+ }
+
+ for (int i = 0; i < propertyNames.size(); ++i)
+ QCOMPARE(object->property(propertyNames.at(i).toLatin1().constData()), propertyValues.at(i));
+
+ delete object;
+}
+
+void tst_QQuickLoader::initialPropertyValuesBinding()
+{
+ QQmlComponent component(&engine, testFileUrl("initialPropertyValues.binding.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(object->setProperty("bindable", QVariant(8)));
+ QCOMPARE(object->property("canaryValue").toInt(), 8);
+
+ delete object;
+}
+
+void tst_QQuickLoader::initialPropertyValuesError_data()
+{
+ QTest::addColumn<QUrl>("qmlFile");
+ QTest::addColumn<QStringList>("expectedWarnings");
+
+ QTest::newRow("invalid initial property values object") << testFileUrl("initialPropertyValues.error.1.qml")
+ << (QStringList() << QString(testFileUrl("initialPropertyValues.error.1.qml").toString() + ":6:5: QML Loader: setSource: value is not an object"));
+
+ QTest::newRow("nonexistent source url") << testFileUrl("initialPropertyValues.error.2.qml")
+ << (QStringList() << QString(testFileUrl("NonexistentSourceComponent.qml").toString() + ": File not found"));
+
+ QTest::newRow("invalid source url") << testFileUrl("initialPropertyValues.error.3.qml")
+ << (QStringList() << QString(testFileUrl("InvalidSourceComponent.qml").toString() + ":5:1: Syntax error"));
+
+ QTest::newRow("invalid initial property values object with invalid property access") << testFileUrl("initialPropertyValues.error.4.qml")
+ << (QStringList() << QString(testFileUrl("initialPropertyValues.error.4.qml").toString() + ":7:5: QML Loader: setSource: value is not an object")
+ << QString(testFileUrl("initialPropertyValues.error.4.qml").toString() + ":5: TypeError: Cannot read property 'canary' of null"));
+}
+
+void tst_QQuickLoader::initialPropertyValuesError()
+{
+ QFETCH(QUrl, qmlFile);
+ QFETCH(QStringList, expectedWarnings);
+
+ foreach (const QString &warning, expectedWarnings)
+ QTest::ignoreMessage(QtWarningMsg, warning.toUtf8().constData());
+
+ QQmlComponent component(&engine, qmlFile);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QQuickLoader *loader = object->findChild<QQuickLoader*>("loader");
+ QVERIFY(loader != 0);
+ QVERIFY(loader->item() == 0);
+ delete object;
+}
+
+// QTBUG-9241
+void tst_QQuickLoader::deleteComponentCrash()
+{
+ QQmlComponent component(&engine, testFileUrl("crash.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ item->metaObject()->invokeMethod(item, "setLoaderSource");
+
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(item->QQuickItem::childItems().at(0));
+ QVERIFY(loader);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->item()->objectName(), QLatin1String("blue"));
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(loader->status(), QQuickLoader::Ready);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+ QVERIFY(loader->source() == testFileUrl("BlueRect.qml"));
+
+ delete item;
+}
+
+void tst_QQuickLoader::nonItem()
+{
+ QQmlComponent component(&engine, testFileUrl("nonItem.qml"));
+
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader);
+ QVERIFY(loader->item());
+
+ QCOMPARE(loader, loader->item()->parent());
+
+ QPointer<QObject> item = loader->item();
+ loader->setActive(false);
+ QVERIFY(!loader->item());
+ QTRY_VERIFY(!item);
+
+ delete loader;
+}
+
+void tst_QQuickLoader::vmeErrors()
+{
+ QQmlComponent component(&engine, testFileUrl("vmeErrors.qml"));
+ QString err = testFileUrl("VmeError.qml").toString() + ":6: Cannot assign object type QObject with no default method";
+ QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData());
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader);
+ QVERIFY(loader->item() == 0);
+
+ delete loader;
+}
+
+// QTBUG-13481
+void tst_QQuickLoader::creationContext()
+{
+ QQmlComponent component(&engine, testFileUrl("creationContext.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toBool(), true);
+
+ delete o;
+}
+
+void tst_QQuickLoader::QTBUG_16928()
+{
+ QQmlComponent component(&engine, testFileUrl("QTBUG_16928.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ QCOMPARE(item->width(), 250.);
+ QCOMPARE(item->height(), 250.);
+
+ delete item;
+}
+
+void tst_QQuickLoader::implicitSize()
+{
+ QQmlComponent component(&engine, testFileUrl("implicitSize.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ QCOMPARE(item->width(), 150.);
+ QCOMPARE(item->height(), 150.);
+
+ QCOMPARE(item->property("implHeight").toReal(), 100.);
+ QCOMPARE(item->property("implWidth").toReal(), 100.);
+
+ QQuickLoader *loader = item->findChild<QQuickLoader*>("loader");
+ QSignalSpy implWidthSpy(loader, SIGNAL(implicitWidthChanged()));
+ QSignalSpy implHeightSpy(loader, SIGNAL(implicitHeightChanged()));
+
+ QMetaObject::invokeMethod(item, "changeImplicitSize");
+
+ QCOMPARE(loader->property("implicitWidth").toReal(), 200.);
+ QCOMPARE(loader->property("implicitHeight").toReal(), 300.);
+
+ QCOMPARE(implWidthSpy.count(), 1);
+ QCOMPARE(implHeightSpy.count(), 1);
+
+ delete item;
+}
+
+void tst_QQuickLoader::QTBUG_17114()
+{
+ QQmlComponent component(&engine, testFileUrl("QTBUG_17114.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+
+ QCOMPARE(item->property("loaderWidth").toReal(), 32.);
+ QCOMPARE(item->property("loaderHeight").toReal(), 32.);
+
+ delete item;
+}
+
+void tst_QQuickLoader::asynchronous_data()
+{
+ QTest::addColumn<QUrl>("qmlFile");
+ QTest::addColumn<QStringList>("expectedWarnings");
+
+ QTest::newRow("Valid component") << testFileUrl("BigComponent.qml")
+ << QStringList();
+
+ QTest::newRow("Non-existent component") << testFileUrl("IDoNotExist.qml")
+ << (QStringList() << QString(testFileUrl("IDoNotExist.qml").toString() + ": File not found"));
+
+ QTest::newRow("Invalid component") << testFileUrl("InvalidSourceComponent.qml")
+ << (QStringList() << QString(testFileUrl("InvalidSourceComponent.qml").toString() + ":5:1: Syntax error"));
+}
+
+void tst_QQuickLoader::asynchronous()
+{
+ QFETCH(QUrl, qmlFile);
+ QFETCH(QStringList, expectedWarnings);
+
+ PeriodicIncubationController *controller = new PeriodicIncubationController;
+ QQmlIncubationController *previous = engine.incubationController();
+ engine.setIncubationController(controller);
+ delete previous;
+
+ QQmlComponent component(&engine, testFileUrl("asynchronous.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(root);
+
+ QQuickLoader *loader = root->findChild<QQuickLoader*>("loader");
+ QVERIFY(loader);
+
+ foreach (const QString &warning, expectedWarnings)
+ QTest::ignoreMessage(QtWarningMsg, warning.toUtf8().constData());
+
+ QVERIFY(!loader->item());
+ QCOMPARE(loader->progress(), 0.0);
+ root->setProperty("comp", qmlFile.toString());
+ QMetaObject::invokeMethod(root, "loadComponent");
+ QVERIFY(!loader->item());
+
+ if (expectedWarnings.isEmpty()) {
+ QCOMPARE(loader->status(), QQuickLoader::Loading);
+
+ controller->start();
+ QVERIFY(!controller->incubated); // asynchronous compilation means not immediately compiled/incubating.
+ QTRY_VERIFY(controller->incubated); // but should start incubating once compilation is complete.
+ QTRY_VERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(loader->status(), QQuickLoader::Ready);
+ } else {
+ QTRY_COMPARE(loader->progress(), 1.0);
+ QTRY_COMPARE(loader->status(), QQuickLoader::Error);
+ }
+
+ delete root;
+}
+
+void tst_QQuickLoader::asynchronous_clear()
+{
+ PeriodicIncubationController *controller = new PeriodicIncubationController;
+ QQmlIncubationController *previous = engine.incubationController();
+ engine.setIncubationController(controller);
+ delete previous;
+
+ QQmlComponent component(&engine, testFileUrl("asynchronous.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(root);
+
+ QQuickLoader *loader = root->findChild<QQuickLoader*>("loader");
+ QVERIFY(loader);
+
+ QVERIFY(!loader->item());
+ root->setProperty("comp", "BigComponent.qml");
+ QMetaObject::invokeMethod(root, "loadComponent");
+ QVERIFY(!loader->item());
+
+ controller->start();
+ QCOMPARE(loader->status(), QQuickLoader::Loading);
+ QTRY_COMPARE(engine.incubationController()->incubatingObjectCount(), 1);
+
+ // clear before component created
+ root->setProperty("comp", "");
+ QMetaObject::invokeMethod(root, "loadComponent");
+ QVERIFY(!loader->item());
+ QCOMPARE(engine.incubationController()->incubatingObjectCount(), 0);
+
+ QCOMPARE(loader->progress(), 0.0);
+ QCOMPARE(loader->status(), QQuickLoader::Null);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0);
+
+ // check loading component
+ root->setProperty("comp", "BigComponent.qml");
+ QMetaObject::invokeMethod(root, "loadComponent");
+ QVERIFY(!loader->item());
+
+ QCOMPARE(loader->status(), QQuickLoader::Loading);
+ QCOMPARE(engine.incubationController()->incubatingObjectCount(), 1);
+
+ QTRY_VERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(loader->status(), QQuickLoader::Ready);
+ QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1);
+
+ delete root;
+}
+
+void tst_QQuickLoader::simultaneousSyncAsync()
+{
+ PeriodicIncubationController *controller = new PeriodicIncubationController;
+ QQmlIncubationController *previous = engine.incubationController();
+ engine.setIncubationController(controller);
+ delete previous;
+
+ QQmlComponent component(&engine, testFileUrl("simultaneous.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(root);
+
+ QQuickLoader *asyncLoader = root->findChild<QQuickLoader*>("asyncLoader");
+ QQuickLoader *syncLoader = root->findChild<QQuickLoader*>("syncLoader");
+ QVERIFY(asyncLoader);
+ QVERIFY(syncLoader);
+
+ QVERIFY(!asyncLoader->item());
+ QVERIFY(!syncLoader->item());
+ QMetaObject::invokeMethod(root, "loadComponents");
+ QVERIFY(!asyncLoader->item());
+ QVERIFY(syncLoader->item());
+
+ controller->start();
+ QCOMPARE(asyncLoader->status(), QQuickLoader::Loading);
+ QVERIFY(!controller->incubated); // asynchronous compilation means not immediately compiled/incubating.
+ QTRY_VERIFY(controller->incubated); // but should start incubating once compilation is complete.
+ QTRY_VERIFY(asyncLoader->item());
+ QCOMPARE(asyncLoader->progress(), 1.0);
+ QCOMPARE(asyncLoader->status(), QQuickLoader::Ready);
+
+ delete root;
+}
+
+void tst_QQuickLoader::loadedSignal()
+{
+ PeriodicIncubationController *controller = new PeriodicIncubationController;
+ QQmlIncubationController *previous = engine.incubationController();
+ engine.setIncubationController(controller);
+ delete previous;
+
+ {
+ // ensure that triggering loading (by setting active = true)
+ // and then immediately setting active to false, causes the
+ // loader to be deactivated, including disabling the incubator.
+ QQmlComponent component(&engine, testFileUrl("loadedSignal.qml"));
+ QObject *obj = component.create();
+
+ QMetaObject::invokeMethod(obj, "triggerLoading");
+ QTest::qWait(100); // ensure that loading would have finished if it wasn't deactivated
+ QCOMPARE(obj->property("loadCount").toInt(), 0);
+ QVERIFY(obj->property("success").toBool());
+
+ QMetaObject::invokeMethod(obj, "triggerLoading");
+ QTest::qWait(100);
+ QCOMPARE(obj->property("loadCount").toInt(), 0);
+ QVERIFY(obj->property("success").toBool());
+
+ QMetaObject::invokeMethod(obj, "triggerMultipleLoad");
+ controller->start();
+ QTest::qWait(100);
+ QTRY_COMPARE(obj->property("loadCount").toInt(), 1); // only one loaded signal should be emitted.
+ QVERIFY(obj->property("success").toBool());
+
+ delete obj;
+ }
+
+ {
+ // ensure that an error doesn't result in the onLoaded signal being emitted.
+ QQmlComponent component(&engine, testFileUrl("loadedSignal.2.qml"));
+ QObject *obj = component.create();
+
+ QMetaObject::invokeMethod(obj, "triggerLoading");
+ QTest::qWait(100);
+ QCOMPARE(obj->property("loadCount").toInt(), 0);
+ QVERIFY(obj->property("success").toBool());
+
+ delete obj;
+ }
+}
+
+void tst_QQuickLoader::parented()
+{
+ QQmlComponent component(&engine, testFileUrl("parented.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(root);
+
+ QQuickItem *item = root->findChild<QQuickItem*>("comp");
+ QVERIFY(item);
+
+ QVERIFY(item->parentItem() == root);
+
+ QCOMPARE(item->width(), 300.);
+ QCOMPARE(item->height(), 300.);
+
+ delete root;
+}
+
+void tst_QQuickLoader::sizeBound()
+{
+ QQmlComponent component(&engine, testFileUrl("sizebound.qml"));
+ QQuickItem *root = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(root);
+ QQuickLoader *loader = root->findChild<QQuickLoader*>("loader");
+ QVERIFY(loader != 0);
+
+ QVERIFY(loader->item());
+
+ QCOMPARE(loader->width(), 50.0);
+ QCOMPARE(loader->height(), 60.0);
+
+ QMetaObject::invokeMethod(root, "switchComponent");
+
+ QCOMPARE(loader->width(), 80.0);
+ QCOMPARE(loader->height(), 90.0);
+
+ delete root;
+}
+
+void tst_QQuickLoader::QTBUG_30183()
+{
+ QQmlComponent component(&engine, testFileUrl("/QTBUG_30183.qml"));
+ QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->width(), 240.0);
+ QCOMPARE(loader->height(), 120.0);
+
+ // the loaded item must follow the size
+ QQuickItem *rect = qobject_cast<QQuickItem*>(loader->item());
+ QVERIFY(rect);
+ QCOMPARE(rect->width(), 240.0);
+ QCOMPARE(rect->height(), 120.0);
+
+ delete loader;
+}
+
+QTEST_MAIN(tst_QQuickLoader)
+
+#include "tst_qquickloader.moc"
diff --git a/tests/auto/quick/qquickmousearea/data/changeAxis.qml b/tests/auto/quick/qquickmousearea/data/changeAxis.qml
new file mode 100644
index 0000000000..4463f467a2
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/changeAxis.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: blackRect
+ drag.axis: blackRect.x <= 75 ? Drag.XAndYAxis : Drag.YAxis
+ }
+ }
+ }
diff --git a/tests/auto/quick/qquickmousearea/data/clickThrough.qml b/tests/auto/quick/qquickmousearea/data/clickThrough.qml
new file mode 100644
index 0000000000..3c03161faa
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/clickThrough.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item{
+ width: 200
+ height: 200
+ property int doubleClicks: 0
+ property int clicks: 0
+ property int pressAndHolds: 0
+ property int presses: 0
+ MouseArea{
+ z: 0
+ anchors.fill: parent
+ propagateComposedEvents: true
+ onPressed: presses++
+ onClicked: clicks++
+ onPressAndHold: pressAndHolds++
+ onDoubleClicked: doubleClicks++
+ }
+ MouseArea{
+ z: 1
+ propagateComposedEvents: true
+ enabled: true
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/clickThrough2.qml b/tests/auto/quick/qquickmousearea/data/clickThrough2.qml
new file mode 100644
index 0000000000..2624108225
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/clickThrough2.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Item{
+ width: 300
+ height: 300
+ property int doubleClicks: 0
+ property int clicks: 0
+ property int pressAndHolds: 0
+ property int presses: 0
+ property bool letThrough: false
+ property bool noPropagation: false
+ Rectangle{
+ z: 0
+ color: "lightsteelblue"
+ width: 150
+ height: 150
+ MouseArea{
+ anchors.fill: parent
+ propagateComposedEvents: true
+ onPressed: presses++
+ onClicked: clicks++
+ onPressAndHold: pressAndHolds++
+ onDoubleClicked: doubleClicks++
+ }
+ }
+ MouseArea{
+ z: 1
+ enabled: true
+ anchors.fill: parent
+ propagateComposedEvents: !noPropagation
+ onClicked: mouse.accepted = !letThrough;
+ onDoubleClicked: mouse.accepted = !letThrough;
+ onPressAndHold: mouse.accepted = !letThrough;
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/clickandhold.qml b/tests/auto/quick/qquickmousearea/data/clickandhold.qml
new file mode 100644
index 0000000000..5e4e48f6db
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/clickandhold.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool clicked: false
+ property bool held: false
+
+ MouseArea {
+ width: 200; height: 200
+ onClicked: { root.clicked = true }
+ onPressAndHold: { root.held = true }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/clicktwice.qml b/tests/auto/quick/qquickmousearea/data/clicktwice.qml
new file mode 100644
index 0000000000..7fd10b27f3
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/clicktwice.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int clicked: 0
+ property int pressed: 0
+ property int released: 0
+
+ MouseArea {
+ objectName: "mousearea"
+ width: 200; height: 200
+ onPressed: { root.pressed++ }
+ onClicked: { root.clicked++ }
+ onReleased: { root.released++ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickmousearea/data/doubleclick.qml b/tests/auto/quick/qquickmousearea/data/doubleclick.qml
new file mode 100644
index 0000000000..3c0e99bacb
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/doubleclick.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int clicked: 0
+ property int doubleClicked: 0
+ property int released: 0
+
+ MouseArea {
+ objectName: "mousearea"
+ width: 200; height: 200
+ onClicked: { root.clicked++ }
+ onDoubleClicked: { root.doubleClicked++ }
+ onReleased: { root.released++ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickmousearea/data/dragging.qml b/tests/auto/quick/qquickmousearea/data/dragging.qml
new file mode 100644
index 0000000000..4e0dbe6277
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/dragging.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: blackRect
+ drag.axis: Drag.XAndYAxis
+ drag.minimumX: 0
+ drag.maximumX: whiteRect.width-blackRect.width
+ drag.minimumY: 0
+ drag.maximumY: whiteRect.height-blackRect.height
+ }
+ }
+ }
diff --git a/tests/auto/quick/qquickmousearea/data/dragproperties.qml b/tests/auto/quick/qquickmousearea/data/dragproperties.qml
new file mode 100644
index 0000000000..d8d7b3bb6e
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/dragproperties.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: blackRect
+ drag.axis: Drag.XAndYAxis
+ drag.minimumX: 0
+ drag.maximumX: whiteRect.width-blackRect.width
+ drag.minimumY: 0
+ drag.maximumY: whiteRect.height-blackRect.height
+ }
+ }
+ }
diff --git a/tests/auto/quick/qquickmousearea/data/dragreset.qml b/tests/auto/quick/qquickmousearea/data/dragreset.qml
new file mode 100644
index 0000000000..3259dcf87d
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/dragreset.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: haveTarget ? blackRect : undefined
+ drag.axis: Drag.XAndYAxis
+ drag.minimumX: 0
+ drag.maximumX: whiteRect.width-blackRect.width
+ drag.minimumY: 0
+ drag.maximumY: whiteRect.height-blackRect.height
+ }
+ }
+ }
diff --git a/tests/auto/quick/qquickmousearea/data/hoverPosition.qml b/tests/auto/quick/qquickmousearea/data/hoverPosition.qml
new file mode 100644
index 0000000000..834f91ff29
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/hoverPosition.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400;
+
+ property real mouseX: mousetracker.mouseX
+ property real mouseY: mousetracker.mouseY
+
+ Rectangle {
+ width: 100; height: 100;
+ MouseArea {
+ id: mousetracker;
+ anchors.fill: parent;
+ hoverEnabled: true
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/hoverPropagation.qml b/tests/auto/quick/qquickmousearea/data/hoverPropagation.qml
new file mode 100644
index 0000000000..c47c794132
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/hoverPropagation.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+Item{
+ width: 400
+ height: 200
+ property bool point1: ma2.containsMouse && !ma1.containsMouse
+ property bool point2: ma3.containsMouse && ma4.containsMouse
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma1.containsMouse ? "red" : "white"
+ MouseArea{
+ id: ma1
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma2.containsMouse ? "blue" : "white"
+ MouseArea{
+ id: ma2
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ }
+ }
+
+ Item{
+ x:200
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma3.containsMouse ? "yellow" : "white"
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma4.containsMouse ? "green" : "white"
+ }
+ }
+ MouseArea{
+ id: ma3
+ hoverEnabled: true
+ width: 200
+ height: 200
+ MouseArea{
+ id: ma4
+ width: 100
+ height: 100
+ hoverEnabled: true
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/hoverVisible.qml b/tests/auto/quick/qquickmousearea/data/hoverVisible.qml
new file mode 100644
index 0000000000..2d65b5573e
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/hoverVisible.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400;
+
+ Rectangle {
+ width: 100; height: 100;
+ MouseArea {
+ id: mousetracker; objectName: "mousetracker"
+ anchors.fill: parent
+ visible: false
+ hoverEnabled: true
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml b/tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml
new file mode 100644
index 0000000000..6c68f0c7c8
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+MouseArea {
+ width: 200
+ height: 200
+
+ property bool hadMove: false
+ property bool hadRelease: false
+
+ onPressed: mouse.accepted = false
+ onPositionChanged: hadMove = true
+ onReleased: hadRelease = true
+}
+
diff --git a/tests/auto/quick/qquickmousearea/data/nestedStopAtBounds.qml b/tests/auto/quick/qquickmousearea/data/nestedStopAtBounds.qml
new file mode 100644
index 0000000000..1fd39bb321
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/nestedStopAtBounds.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ MouseArea {
+ id: outer
+ objectName: "outer"
+ x: 50
+ y: 50
+ width: 300
+ height: 300
+
+ drag.target: outer
+ drag.filterChildren: true
+
+ Rectangle {
+ anchors.fill: parent
+ color: "yellow"
+ }
+
+ MouseArea {
+ id: inner
+ objectName: "inner"
+
+ x: 0
+ y: 0
+ width: 200
+ height: 200
+
+ drag.target: inner
+ drag.minimumX: 0
+ drag.maximumX: 100
+ drag.minimumY: 0
+ drag.maximumY: 100
+
+ Rectangle {
+ anchors.fill: parent
+ color: "blue"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/noclickandhold.qml b/tests/auto/quick/qquickmousearea/data/noclickandhold.qml
new file mode 100644
index 0000000000..6647de001d
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/noclickandhold.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool clicked: false
+
+ MouseArea {
+ width: 200; height: 200
+ onClicked: { root.clicked = true }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
new file mode 100644
index 0000000000..14630b8962
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0
+
+Rectangle {
+ id: root
+ color: "#ffffff"
+ width: 320; height: 240
+ property bool pressed:mouse.pressed
+ property bool canceled: false
+ property bool released: false
+ property alias secondWindow: secondWindow
+
+ Window {
+ id: secondWindow
+ x: root.x + root.width
+ }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onPressed: { root.canceled = false }
+ onCanceled: {root.canceled = true}
+ onReleased: {root.released = true; root.canceled = false}
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/pressedOrdering.qml b/tests/auto/quick/qquickmousearea/data/pressedOrdering.qml
new file mode 100644
index 0000000000..7aa3098100
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/pressedOrdering.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property string value: "base"
+
+ MouseArea {
+ id: mouseArea
+ width: 200; height: 200
+ onClicked: toggleState.state = "toggled"
+ }
+
+ StateGroup {
+ states: State {
+ name: "pressed"
+ when: mouseArea.pressed
+ PropertyChanges { target: root; value: "pressed" }
+ }
+ }
+
+ StateGroup {
+ id: toggleState
+ states: State {
+ name: "toggled"
+ PropertyChanges { target: root; value: "toggled" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/preventstealing.qml b/tests/auto/quick/qquickmousearea/data/preventstealing.qml
new file mode 100644
index 0000000000..fb0d6955c1
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/preventstealing.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Flickable {
+ property bool stealing: true
+ width: 200
+ height: 200
+ contentWidth: 400
+ contentHeight: 400
+ Rectangle {
+ color: "black"
+ width: 400
+ height: 400
+ Rectangle {
+ x: 50; y: 50
+ width: 100; height: 100
+ color: "steelblue"
+ MouseArea {
+ objectName: "mousearea"
+ anchors.fill: parent
+ preventStealing: stealing
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/rejectEvent.qml b/tests/auto/quick/qquickmousearea/data/rejectEvent.qml
new file mode 100644
index 0000000000..816fc76fac
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/rejectEvent.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "#ffffff"
+ width: 320; height: 240
+ property bool mr1_pressed: false
+ property bool mr1_released: false
+ property bool mr1_canceled: false
+ property bool mr2_pressed: false
+ property bool mr2_released: false
+ property bool mr2_canceled: false
+
+ MouseArea {
+ id: mouseRegion1
+ anchors.fill: parent
+ onPressed: { root.mr1_pressed = true }
+ onReleased: { root.mr1_released = true }
+ onCanceled: { root.mr1_canceled = true }
+ }
+ MouseArea {
+ id: mouseRegion2
+ width: 120; height: 120
+ onPressed: { root.mr2_pressed = true; mouse.accepted = false }
+ onReleased: { root.mr2_released = true }
+ onCanceled: { root.mr2_canceled = true }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/setDragOnPressed.qml b/tests/auto/quick/qquickmousearea/data/setDragOnPressed.qml
new file mode 100644
index 0000000000..fc57319d75
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/setDragOnPressed.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+MouseArea {
+ width: 200; height: 200
+
+ Item {
+ id: dragTarget
+ objectName: "target"
+ x: 50; y: 50
+ width: 100; height: 100
+ }
+
+ onPressed: {
+ drag.target = dragTarget
+ drag.axis = Drag.XAxis
+ }
+ onReleased: drag.target = null
+}
diff --git a/tests/auto/quick/qquickmousearea/data/simple.qml b/tests/auto/quick/qquickmousearea/data/simple.qml
new file mode 100644
index 0000000000..56d561e5af
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/simple.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ MouseArea {
+ objectName: "mousearea"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/transformedMouseArea.qml b/tests/auto/quick/qquickmousearea/data/transformedMouseArea.qml
new file mode 100644
index 0000000000..80cdda77d3
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/transformedMouseArea.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ x: 100
+ y: 100
+ width: 200
+ height: 200
+ rotation: 45
+
+ MouseArea {
+ scale: 0.5
+ hoverEnabled: true
+ anchors.fill: parent
+ objectName: "mouseArea"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/updateMousePosOnClick.qml b/tests/auto/quick/qquickmousearea/data/updateMousePosOnClick.qml
new file mode 100644
index 0000000000..7377a2e86c
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/updateMousePosOnClick.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "#ffffff"
+ width: 320; height: 240
+ MouseArea {
+ id: mouseRegion
+ objectName: "mouseregion"
+ anchors.fill: parent
+ Rectangle {
+ id: ball
+ objectName: "ball"
+ width: 20; height: 20
+ radius: 10
+ color: "#0000ff"
+ x: { mouseRegion.mouseX }
+ y: mouseRegion.mouseY
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml b/tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml
new file mode 100644
index 0000000000..55af864060
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Rectangle {
+ color: "#ffffff"
+ width: 320; height: 240
+ Rectangle {
+ id: brother
+ objectName: "brother"
+ color: "lightgreen"
+ x: 200; y: 100
+ width: 120; height: 120
+ }
+ MouseArea {
+ id: mouseRegion
+ objectName: "mouseregion"
+
+ property int x1
+ property int y1
+ property int x2
+ property int y2
+ property bool emitPositionChanged: false
+ property bool mouseMatchesPos: true
+
+ anchors.fill: brother
+ onPressed: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x1 = mouseX; y1 = mouseY
+ anchors.fill = parent
+ }
+ onPositionChanged: { emitPositionChanged = true }
+ onMouseXChanged: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x2 = mouseX; y2 = mouseY
+ }
+ onMouseYChanged: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x2 = mouseX; y2 = mouseY
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/data/wheel.qml b/tests/auto/quick/qquickmousearea/data/wheel.qml
new file mode 100644
index 0000000000..3e0c0c2a48
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/wheel.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ property var angleDeltaY
+ property real mouseX
+ property real mouseY
+ property bool controlPressed
+
+ width: 400
+ height: 400
+
+ MouseArea {
+ anchors.fill: parent
+
+ onWheel: {
+ root.angleDeltaY = wheel.angleDelta.y;
+ root.mouseX = wheel.x;
+ root.mouseY = wheel.y;
+ root.controlPressed = wheel.modifiers & Qt.ControlModifier;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/qquickmousearea.pro b/tests/auto/quick/qquickmousearea/qquickmousearea.pro
new file mode 100644
index 0000000000..dd7b434898
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/qquickmousearea.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickmousearea
+macx:CONFIG -= app_bundle
+
+HEADERS += ../../shared/testhttpserver.h
+SOURCES += tst_qquickmousearea.cpp \
+ ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
new file mode 100644
index 0000000000..fa33f3f626
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -0,0 +1,1496 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtQuick/private/qquickmousearea_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <private/qquickflickable_p.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlengine.h>
+#include "../../shared/util.h"
+#include <QtGui/qstylehints.h>
+
+class tst_QQuickMouseArea: public QQmlDataTest
+{
+ Q_OBJECT
+private slots:
+ void dragProperties();
+ void resetDrag();
+ void dragging_data() { acceptedButton_data(); }
+ void dragging();
+ void invalidDrag_data() { rejectedButton_data(); }
+ void invalidDrag();
+ void setDragOnPressed();
+ void updateMouseAreaPosOnClick();
+ void updateMouseAreaPosOnResize();
+ void noOnClickedWithPressAndHold();
+ void onMousePressRejected();
+ void pressedCanceledOnWindowDeactivate();
+ void doubleClick_data() { acceptedButton_data(); }
+ void doubleClick();
+ void clickTwice_data() { acceptedButton_data(); }
+ void clickTwice();
+ void invalidClick_data() { rejectedButton_data(); }
+ void invalidClick();
+ void pressedOrdering();
+ void preventStealing();
+ void clickThrough();
+ void hoverPosition();
+ void hoverPropagation();
+ void hoverVisible();
+ void disableAfterPress();
+ void onWheel();
+ void transformedMouseArea_data();
+ void transformedMouseArea();
+ void pressedMultipleButtons_data();
+ void pressedMultipleButtons();
+ void changeAxis();
+#ifndef QT_NO_CURSOR
+ void cursorShape();
+#endif
+ void moveAndReleaseWithoutPress();
+ void nestedStopAtBounds();
+ void nestedStopAtBounds_data();
+
+private:
+ void acceptedButton_data();
+ void rejectedButton_data();
+
+ QQuickView *createView();
+};
+
+Q_DECLARE_METATYPE(Qt::MouseButton)
+Q_DECLARE_METATYPE(Qt::MouseButtons)
+
+void tst_QQuickMouseArea::acceptedButton_data()
+{
+ QTest::addColumn<Qt::MouseButtons>("acceptedButtons");
+ QTest::addColumn<Qt::MouseButton>("button");
+
+ QTest::newRow("left") << Qt::MouseButtons(Qt::LeftButton) << Qt::LeftButton;
+ QTest::newRow("right") << Qt::MouseButtons(Qt::RightButton) << Qt::RightButton;
+ QTest::newRow("middle") << Qt::MouseButtons(Qt::MiddleButton) << Qt::MiddleButton;
+
+ QTest::newRow("left (left|right)") << Qt::MouseButtons(Qt::LeftButton | Qt::RightButton) << Qt::LeftButton;
+ QTest::newRow("right (right|middle)") << Qt::MouseButtons(Qt::RightButton | Qt::MiddleButton) << Qt::RightButton;
+ QTest::newRow("middle (left|middle)") << Qt::MouseButtons(Qt::LeftButton | Qt::MiddleButton) << Qt::MiddleButton;
+}
+
+void tst_QQuickMouseArea::rejectedButton_data()
+{
+ QTest::addColumn<Qt::MouseButtons>("acceptedButtons");
+ QTest::addColumn<Qt::MouseButton>("button");
+
+ QTest::newRow("middle (left|right)") << Qt::MouseButtons(Qt::LeftButton | Qt::RightButton) << Qt::MiddleButton;
+ QTest::newRow("left (right|middle)") << Qt::MouseButtons(Qt::RightButton | Qt::MiddleButton) << Qt::LeftButton;
+ QTest::newRow("right (left|middle)") << Qt::MouseButtons(Qt::LeftButton | Qt::MiddleButton) << Qt::RightButton;
+}
+
+void tst_QQuickMouseArea::dragProperties()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("dragproperties.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QQuickDrag *drag = mouseRegion->drag();
+ QVERIFY(mouseRegion != 0);
+ QVERIFY(drag != 0);
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == drag->target());
+ QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootItem != 0);
+ QSignalSpy targetSpy(drag, SIGNAL(targetChanged()));
+ drag->setTarget(rootItem);
+ QCOMPARE(targetSpy.count(),1);
+ drag->setTarget(rootItem);
+ QCOMPARE(targetSpy.count(),1);
+
+ // axis
+ QCOMPARE(drag->axis(), QQuickDrag::XAndYAxis);
+ QSignalSpy axisSpy(drag, SIGNAL(axisChanged()));
+ drag->setAxis(QQuickDrag::XAxis);
+ QCOMPARE(drag->axis(), QQuickDrag::XAxis);
+ QCOMPARE(axisSpy.count(),1);
+ drag->setAxis(QQuickDrag::XAxis);
+ QCOMPARE(axisSpy.count(),1);
+
+ // minimum and maximum properties
+ QSignalSpy xminSpy(drag, SIGNAL(minimumXChanged()));
+ QSignalSpy xmaxSpy(drag, SIGNAL(maximumXChanged()));
+ QSignalSpy yminSpy(drag, SIGNAL(minimumYChanged()));
+ QSignalSpy ymaxSpy(drag, SIGNAL(maximumYChanged()));
+
+ QCOMPARE(drag->xmin(), 0.0);
+ QCOMPARE(drag->xmax(), rootItem->width()-blackRect->width());
+ QCOMPARE(drag->ymin(), 0.0);
+ QCOMPARE(drag->ymax(), rootItem->height()-blackRect->height());
+
+ drag->setXmin(10);
+ drag->setXmax(10);
+ drag->setYmin(10);
+ drag->setYmax(10);
+
+ QCOMPARE(drag->xmin(), 10.0);
+ QCOMPARE(drag->xmax(), 10.0);
+ QCOMPARE(drag->ymin(), 10.0);
+ QCOMPARE(drag->ymax(), 10.0);
+
+ QCOMPARE(xminSpy.count(),1);
+ QCOMPARE(xmaxSpy.count(),1);
+ QCOMPARE(yminSpy.count(),1);
+ QCOMPARE(ymaxSpy.count(),1);
+
+ drag->setXmin(10);
+ drag->setXmax(10);
+ drag->setYmin(10);
+ drag->setYmax(10);
+
+ QCOMPARE(xminSpy.count(),1);
+ QCOMPARE(xmaxSpy.count(),1);
+ QCOMPARE(yminSpy.count(),1);
+ QCOMPARE(ymaxSpy.count(),1);
+
+ // filterChildren
+ QSignalSpy filterChildrenSpy(drag, SIGNAL(filterChildrenChanged()));
+
+ drag->setFilterChildren(true);
+
+ QVERIFY(drag->filterChildren());
+ QCOMPARE(filterChildrenSpy.count(), 1);
+
+ drag->setFilterChildren(true);
+ QCOMPARE(filterChildrenSpy.count(), 1);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::resetDrag()
+{
+ QQuickView *window = createView();
+
+ window->rootContext()->setContextProperty("haveTarget", QVariant(true));
+ window->setSource(testFileUrl("dragreset.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QQuickDrag *drag = mouseRegion->drag();
+ QVERIFY(mouseRegion != 0);
+ QVERIFY(drag != 0);
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == drag->target());
+ QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootItem != 0);
+ QSignalSpy targetSpy(drag, SIGNAL(targetChanged()));
+ QVERIFY(drag->target() != 0);
+ window->rootContext()->setContextProperty("haveTarget", QVariant(false));
+ QCOMPARE(targetSpy.count(),1);
+ QVERIFY(drag->target() == 0);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::dragging()
+{
+ QFETCH(Qt::MouseButtons, acceptedButtons);
+ QFETCH(Qt::MouseButton, button);
+
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("dragging.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QQuickDrag *drag = mouseRegion->drag();
+ QVERIFY(mouseRegion != 0);
+ QVERIFY(drag != 0);
+
+ mouseRegion->setAcceptedButtons(acceptedButtons);
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == drag->target());
+
+ QVERIFY(!drag->active());
+
+ QTest::mousePress(window, button, 0, QPoint(100,100));
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 50.0);
+ QCOMPARE(blackRect->y(), 50.0);
+
+ // First move event triggers drag, second is acted upon.
+ // This is due to possibility of higher stacked area taking precedence.
+ // The item is moved relative to the position of the mouse when the drag
+ // was triggered, this prevents a sudden change in position when the drag
+ // threshold is exceeded.
+ QTest::mouseMove(window, QPoint(111,111), 50);
+ QTest::mouseMove(window, QPoint(116,116), 50);
+ QTest::mouseMove(window, QPoint(122,122), 50);
+
+ QTRY_VERIFY(drag->active());
+ QTRY_COMPARE(blackRect->x(), 61.0);
+ QCOMPARE(blackRect->y(), 61.0);
+
+ QTest::mouseRelease(window, button, 0, QPoint(122,122));
+
+ QTRY_VERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 61.0);
+ QCOMPARE(blackRect->y(), 61.0);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::invalidDrag()
+{
+ QFETCH(Qt::MouseButtons, acceptedButtons);
+ QFETCH(Qt::MouseButton, button);
+
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("dragging.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QQuickDrag *drag = mouseRegion->drag();
+ QVERIFY(mouseRegion != 0);
+ QVERIFY(drag != 0);
+
+ mouseRegion->setAcceptedButtons(acceptedButtons);
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == drag->target());
+
+ QVERIFY(!drag->active());
+
+ QTest::mousePress(window, button, 0, QPoint(100,100));
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 50.0);
+ QCOMPARE(blackRect->y(), 50.0);
+
+ // First move event triggers drag, second is acted upon.
+ // This is due to possibility of higher stacked area taking precedence.
+
+ QTest::mouseMove(window, QPoint(111,111));
+ QTest::qWait(50);
+ QTest::mouseMove(window, QPoint(122,122));
+ QTest::qWait(50);
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 50.0);
+ QCOMPARE(blackRect->y(), 50.0);
+
+ QTest::mouseRelease(window, button, 0, QPoint(122,122));
+ QTest::qWait(50);
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 50.0);
+ QCOMPARE(blackRect->y(), 50.0);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::setDragOnPressed()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("setDragOnPressed.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(window->rootObject());
+ QVERIFY(mouseArea);
+
+ // target
+ QQuickItem *target = mouseArea->findChild<QQuickItem*>("target");
+ QVERIFY(target);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QQuickDrag *drag = mouseArea->drag();
+ QVERIFY(drag);
+ QVERIFY(!drag->active());
+
+ QCOMPARE(target->x(), 50.0);
+ QCOMPARE(target->y(), 50.0);
+
+ // First move event triggers drag, second is acted upon.
+ // This is due to possibility of higher stacked area taking precedence.
+
+ QTest::mouseMove(window, QPoint(111,102));
+ QTest::qWait(50);
+ QTest::mouseMove(window, QPoint(122,122));
+ QTest::qWait(50);
+
+ QVERIFY(drag->active());
+ QCOMPARE(target->x(), 61.0);
+ QCOMPARE(target->y(), 50.0);
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(122,122));
+ QTest::qWait(50);
+
+ QVERIFY(!drag->active());
+ QCOMPARE(target->x(), 61.0);
+ QCOMPARE(target->y(), 50.0);
+
+ delete window;
+}
+
+QQuickView *tst_QQuickMouseArea::createView()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(240,320));
+
+ return window;
+}
+
+void tst_QQuickMouseArea::updateMouseAreaPosOnClick()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("updateMousePosOnClick.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QVERIFY(mouseRegion != 0);
+
+ QQuickRectangle *rect = window->rootObject()->findChild<QQuickRectangle*>("ball");
+ QVERIFY(rect != 0);
+
+ QCOMPARE(mouseRegion->mouseX(), rect->x());
+ QCOMPARE(mouseRegion->mouseY(), rect->y());
+
+ QMouseEvent event(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &event);
+
+ QCOMPARE(mouseRegion->mouseX(), 100.0);
+ QCOMPARE(mouseRegion->mouseY(), 100.0);
+
+ QCOMPARE(mouseRegion->mouseX(), rect->x());
+ QCOMPARE(mouseRegion->mouseY(), rect->y());
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::updateMouseAreaPosOnResize()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("updateMousePosOnResize.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QVERIFY(mouseRegion != 0);
+
+ QQuickRectangle *rect = window->rootObject()->findChild<QQuickRectangle*>("brother");
+ QVERIFY(rect != 0);
+
+ QCOMPARE(mouseRegion->mouseX(), 0.0);
+ QCOMPARE(mouseRegion->mouseY(), 0.0);
+
+ QMouseEvent event(QEvent::MouseButtonPress, rect->position().toPoint(), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &event);
+
+ QVERIFY(!mouseRegion->property("emitPositionChanged").toBool());
+ QVERIFY(mouseRegion->property("mouseMatchesPos").toBool());
+
+ QCOMPARE(mouseRegion->property("x1").toReal(), 0.0);
+ QCOMPARE(mouseRegion->property("y1").toReal(), 0.0);
+
+ QCOMPARE(mouseRegion->property("x2").toReal(), rect->x());
+ QCOMPARE(mouseRegion->property("y2").toReal(), rect->y());
+
+ QCOMPARE(mouseRegion->mouseX(), rect->x());
+ QCOMPARE(mouseRegion->mouseY(), rect->y());
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::noOnClickedWithPressAndHold()
+{
+ {
+ // We handle onPressAndHold, therefore no onClicked
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("clickandhold.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+ QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea*>(window->rootObject()->children().first());
+ QVERIFY(mouseArea);
+
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QVERIFY(mouseArea->pressedButtons() == Qt::LeftButton);
+ QVERIFY(!window->rootObject()->property("clicked").toBool());
+ QVERIFY(!window->rootObject()->property("held").toBool());
+
+ // timeout is 800 (in qquickmousearea.cpp)
+ QTest::qWait(1000);
+ QCoreApplication::processEvents();
+
+ QVERIFY(!window->rootObject()->property("clicked").toBool());
+ QVERIFY(window->rootObject()->property("held").toBool());
+
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QTRY_VERIFY(window->rootObject()->property("held").toBool());
+ QVERIFY(!window->rootObject()->property("clicked").toBool());
+
+ delete window;
+ }
+
+ {
+ // We do not handle onPressAndHold, therefore we get onClicked
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("noclickandhold.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QVERIFY(!window->rootObject()->property("clicked").toBool());
+
+ QTest::qWait(1000);
+
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QVERIFY(window->rootObject()->property("clicked").toBool());
+
+ delete window;
+ }
+}
+
+void tst_QQuickMouseArea::onMousePressRejected()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("rejectEvent.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+ QVERIFY(window->rootObject()->property("enabled").toBool());
+
+ QVERIFY(!window->rootObject()->property("mr1_pressed").toBool());
+ QVERIFY(!window->rootObject()->property("mr1_released").toBool());
+ QVERIFY(!window->rootObject()->property("mr1_canceled").toBool());
+ QVERIFY(!window->rootObject()->property("mr2_pressed").toBool());
+ QVERIFY(!window->rootObject()->property("mr2_released").toBool());
+ QVERIFY(!window->rootObject()->property("mr2_canceled").toBool());
+
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QVERIFY(window->rootObject()->property("mr1_pressed").toBool());
+ QVERIFY(!window->rootObject()->property("mr1_released").toBool());
+ QVERIFY(!window->rootObject()->property("mr1_canceled").toBool());
+ QVERIFY(window->rootObject()->property("mr2_pressed").toBool());
+ QVERIFY(!window->rootObject()->property("mr2_released").toBool());
+ QVERIFY(window->rootObject()->property("mr2_canceled").toBool());
+
+ QTest::qWait(200);
+
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QVERIFY(window->rootObject()->property("mr1_released").toBool());
+ QVERIFY(!window->rootObject()->property("mr1_canceled").toBool());
+ QVERIFY(!window->rootObject()->property("mr2_released").toBool());
+
+ delete window;
+}
+void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("pressedCanceled.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+ QVERIFY(!window->rootObject()->property("pressed").toBool());
+ QVERIFY(!window->rootObject()->property("canceled").toBool());
+ QVERIFY(!window->rootObject()->property("released").toBool());
+
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QVERIFY(window->rootObject()->property("pressed").toBool());
+ QVERIFY(!window->rootObject()->property("canceled").toBool());
+ QVERIFY(!window->rootObject()->property("released").toBool());
+
+ QWindow *secondWindow = qvariant_cast<QWindow*>(window->rootObject()->property("secondWindow"));
+ secondWindow->setProperty("visible", true);
+ QTest::qWaitForWindowActive(secondWindow);
+
+ QVERIFY(!window->rootObject()->property("pressed").toBool());
+ QVERIFY(window->rootObject()->property("canceled").toBool());
+ QVERIFY(!window->rootObject()->property("released").toBool());
+
+ //press again
+ QGuiApplication::sendEvent(window, &pressEvent);
+ QVERIFY(window->rootObject()->property("pressed").toBool());
+ QVERIFY(!window->rootObject()->property("canceled").toBool());
+ QVERIFY(!window->rootObject()->property("released").toBool());
+
+ QTest::qWait(200);
+
+ //release
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+ QVERIFY(!window->rootObject()->property("pressed").toBool());
+ QVERIFY(!window->rootObject()->property("canceled").toBool());
+ QVERIFY(window->rootObject()->property("released").toBool());
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::doubleClick()
+{
+ QFETCH(Qt::MouseButtons, acceptedButtons);
+ QFETCH(Qt::MouseButton, button);
+
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("doubleclick.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mousearea");
+ QVERIFY(mouseArea);
+ mouseArea->setAcceptedButtons(acceptedButtons);
+
+ // The sequence for a double click is:
+ // press, release, (click), press, double click, release
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QCOMPARE(window->rootObject()->property("released").toInt(), 1);
+
+ QGuiApplication::sendEvent(window, &pressEvent);
+ pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QCOMPARE(window->rootObject()->property("clicked").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("doubleClicked").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("released").toInt(), 2);
+
+ delete window;
+}
+
+// QTBUG-14832
+void tst_QQuickMouseArea::clickTwice()
+{
+ QFETCH(Qt::MouseButtons, acceptedButtons);
+ QFETCH(Qt::MouseButton, button);
+
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("clicktwice.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mousearea");
+ QVERIFY(mouseArea);
+ mouseArea->setAcceptedButtons(acceptedButtons);
+
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QCOMPARE(window->rootObject()->property("pressed").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("released").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("clicked").toInt(), 1);
+
+ QGuiApplication::sendEvent(window, &pressEvent);
+ pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QCOMPARE(window->rootObject()->property("pressed").toInt(), 2);
+ QCOMPARE(window->rootObject()->property("released").toInt(), 2);
+ QCOMPARE(window->rootObject()->property("clicked").toInt(), 2);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::invalidClick()
+{
+ QFETCH(Qt::MouseButtons, acceptedButtons);
+ QFETCH(Qt::MouseButton, button);
+
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("doubleclick.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mousearea");
+ QVERIFY(mouseArea);
+ mouseArea->setAcceptedButtons(acceptedButtons);
+
+ // The sequence for a double click is:
+ // press, release, (click), press, double click, release
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QCOMPARE(window->rootObject()->property("released").toInt(), 0);
+
+ QGuiApplication::sendEvent(window, &pressEvent);
+ pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QCOMPARE(window->rootObject()->property("clicked").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("doubleClicked").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("released").toInt(), 0);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::pressedOrdering()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("pressedOrdering.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QCOMPARE(window->rootObject()->property("value").toString(), QLatin1String("base"));
+
+ QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QCOMPARE(window->rootObject()->property("value").toString(), QLatin1String("pressed"));
+
+ QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
+ QGuiApplication::sendEvent(window, &releaseEvent);
+
+ QCOMPARE(window->rootObject()->property("value").toString(), QLatin1String("toggled"));
+
+ QGuiApplication::sendEvent(window, &pressEvent);
+
+ QCOMPARE(window->rootObject()->property("value").toString(), QLatin1String("pressed"));
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::preventStealing()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("preventstealing.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea*>("mousearea");
+ QVERIFY(mouseArea != 0);
+
+ QSignalSpy mousePositionSpy(mouseArea, SIGNAL(positionChanged(QQuickMouseEvent*)));
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(80, 80));
+
+ // Without preventStealing, mouse movement over MouseArea would
+ // cause the Flickable to steal mouse and trigger content movement.
+
+ QTest::mouseMove(window,QPoint(69,69));
+ QTest::mouseMove(window,QPoint(58,58));
+ QTest::mouseMove(window,QPoint(47,47));
+
+ // We should have received all three move events
+ QCOMPARE(mousePositionSpy.count(), 3);
+ QVERIFY(mouseArea->pressed());
+
+ // Flickable content should not have moved.
+ QCOMPARE(flickable->contentX(), 0.);
+ QCOMPARE(flickable->contentY(), 0.);
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(47, 47));
+
+ // Now allow stealing and confirm Flickable does its thing.
+ window->rootObject()->setProperty("stealing", false);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(80, 80));
+
+ // Without preventStealing, mouse movement over MouseArea would
+ // cause the Flickable to steal mouse and trigger content movement.
+
+ QTest::mouseMove(window,QPoint(69,69));
+ QTest::mouseMove(window,QPoint(58,58));
+ QTest::mouseMove(window,QPoint(47,47));
+
+ // We should only have received the first move event
+ QCOMPARE(mousePositionSpy.count(), 4);
+ // Our press should be taken away
+ QVERIFY(!mouseArea->pressed());
+
+ // Flickable content should have moved.
+
+ QCOMPARE(flickable->contentX(), 11.);
+ QCOMPARE(flickable->contentY(), 11.);
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50, 50));
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::clickThrough()
+{
+ QSKIP("QTBUG-23976 Unstable");
+ //With no handlers defined click, doubleClick and PressAndHold should propagate to those with handlers
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("clickThrough.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QTRY_COMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1);
+
+ // to avoid generating a double click.
+ int doubleClickInterval = qApp->styleHints()->mouseDoubleClickInterval() + 10;
+ QTest::qWait(doubleClickInterval);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(1000);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QTRY_COMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1);
+ QTRY_COMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1);
+
+ QTest::mouseDClick(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(100);
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 2);
+ QTRY_COMPARE(window->rootObject()->property("doubleClicks").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1);
+
+ delete window;
+
+ //With handlers defined click, doubleClick and PressAndHold should propagate only when explicitly ignored
+ window = createView();
+ window->setSource(testFileUrl("clickThrough2.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("clicks").toInt(), 0);
+
+ QTest::qWait(doubleClickInterval); // to avoid generating a double click.
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(1000);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(100);
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("clicks").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 0);
+
+ QTest::mouseDClick(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(100);
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("clicks").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("doubleClicks").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 0);
+
+ window->rootObject()->setProperty("letThrough", QVariant(true));
+
+ QTest::qWait(doubleClickInterval); // to avoid generating a double click.
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1);
+
+ QTest::qWait(doubleClickInterval); // to avoid generating a double click.
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(1000);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(100);
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("clicks").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1);
+
+ QTest::mouseDClick(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(100);
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 2);
+ QCOMPARE(window->rootObject()->property("doubleClicks").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1);
+
+ window->rootObject()->setProperty("noPropagation", QVariant(true));
+
+ QTest::qWait(doubleClickInterval); // to avoid generating a double click.
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QTest::qWait(doubleClickInterval); // to avoid generating a double click.
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(1000);
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(100);
+
+ QTest::mouseDClick(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(100);
+
+ QCOMPARE(window->rootObject()->property("presses").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 2);
+ QCOMPARE(window->rootObject()->property("doubleClicks").toInt(), 1);
+ QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::hoverPosition()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("hoverPosition.qml"));
+
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+
+ QCOMPARE(root->property("mouseX").toReal(), qreal(0));
+ QCOMPARE(root->property("mouseY").toReal(), qreal(0));
+
+ QTest::mouseMove(window,QPoint(10,32));
+
+
+ QCOMPARE(root->property("mouseX").toReal(), qreal(10));
+ QCOMPARE(root->property("mouseY").toReal(), qreal(32));
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::hoverPropagation()
+{
+ //QTBUG-18175, to behave like GV did.
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("hoverPropagation.qml"));
+
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+
+ QCOMPARE(root->property("point1").toBool(), false);
+ QCOMPARE(root->property("point2").toBool(), false);
+
+ QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, 0);
+ QGuiApplication::sendEvent(window, &moveEvent);
+
+ QCOMPARE(root->property("point1").toBool(), true);
+ QCOMPARE(root->property("point2").toBool(), false);
+
+ QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, 0);
+ QGuiApplication::sendEvent(window, &moveEvent2);
+ QCOMPARE(root->property("point1").toBool(), false);
+ QCOMPARE(root->property("point2").toBool(), true);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::hoverVisible()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("hoverVisible.qml"));
+
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+
+ QQuickMouseArea *mouseTracker = window->rootObject()->findChild<QQuickMouseArea*>("mousetracker");
+ QVERIFY(mouseTracker != 0);
+
+ QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered()));
+
+ // Note: We need to use a position that is different from the position in the last event
+ // generated in the previous test case. Otherwise it is not interpreted as a move.
+ QTest::mouseMove(window,QPoint(11,33));
+
+ QCOMPARE(mouseTracker->hovered(), false);
+ QCOMPARE(enteredSpy.count(), 0);
+
+ mouseTracker->setVisible(true);
+
+ QCOMPARE(mouseTracker->hovered(), true);
+ QCOMPARE(enteredSpy.count(), 1);
+
+ QCOMPARE(QPointF(mouseTracker->mouseX(), mouseTracker->mouseY()), QPointF(11,33));
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::disableAfterPress()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("dragging.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QQuickDrag *drag = mouseArea->drag();
+ QVERIFY(mouseArea != 0);
+ QVERIFY(drag != 0);
+
+ QSignalSpy mousePositionSpy(mouseArea, SIGNAL(positionChanged(QQuickMouseEvent*)));
+ QSignalSpy mousePressSpy(mouseArea, SIGNAL(pressed(QQuickMouseEvent*)));
+ QSignalSpy mouseReleaseSpy(mouseArea, SIGNAL(released(QQuickMouseEvent*)));
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == drag->target());
+
+ QVERIFY(!drag->active());
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QTRY_COMPARE(mousePressSpy.count(), 1);
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 50.0);
+ QCOMPARE(blackRect->y(), 50.0);
+
+ // First move event triggers drag, second is acted upon.
+ // This is due to possibility of higher stacked area taking precedence.
+
+ QTest::mouseMove(window, QPoint(111,111));
+ QTest::qWait(50);
+ QTest::mouseMove(window, QPoint(122,122));
+
+ QTRY_COMPARE(mousePositionSpy.count(), 2);
+
+ QVERIFY(drag->active());
+ QCOMPARE(blackRect->x(), 61.0);
+ QCOMPARE(blackRect->y(), 61.0);
+
+ mouseArea->setEnabled(false);
+
+ // move should still be acted upon
+ QTest::mouseMove(window, QPoint(133,133));
+ QTest::qWait(50);
+ QTest::mouseMove(window, QPoint(144,144));
+
+ QTRY_COMPARE(mousePositionSpy.count(), 4);
+
+ QVERIFY(drag->active());
+ QCOMPARE(blackRect->x(), 83.0);
+ QCOMPARE(blackRect->y(), 83.0);
+
+ QVERIFY(mouseArea->pressed());
+ QVERIFY(mouseArea->hovered());
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(144,144));
+
+ QTRY_COMPARE(mouseReleaseSpy.count(), 1);
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 83.0);
+ QCOMPARE(blackRect->y(), 83.0);
+
+ QVERIFY(!mouseArea->pressed());
+ QVERIFY(!mouseArea->hovered()); // since hover is not enabled
+
+ // Next press will be ignored
+ blackRect->setX(50);
+ blackRect->setY(50);
+
+ mousePressSpy.clear();
+ mousePositionSpy.clear();
+ mouseReleaseSpy.clear();
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+ QTest::qWait(50);
+ QCOMPARE(mousePressSpy.count(), 0);
+
+ QTest::mouseMove(window, QPoint(111,111));
+ QTest::qWait(50);
+ QTest::mouseMove(window, QPoint(122,122));
+ QTest::qWait(50);
+
+ QCOMPARE(mousePositionSpy.count(), 0);
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 50.0);
+ QCOMPARE(blackRect->y(), 50.0);
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(122,122));
+ QTest::qWait(50);
+
+ QCOMPARE(mouseReleaseSpy.count(), 0);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::onWheel()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("wheel.qml"));
+
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+
+ QWheelEvent wheelEvent(QPoint(10, 32), QPoint(10, 32), QPoint(60, 20), QPoint(0, 120),
+ 0, Qt::Vertical,Qt::NoButton, Qt::ControlModifier);
+ QGuiApplication::sendEvent(window, &wheelEvent);
+
+ QCOMPARE(root->property("angleDeltaY").toInt(), 120);
+ QCOMPARE(root->property("mouseX").toReal(), qreal(10));
+ QCOMPARE(root->property("mouseY").toReal(), qreal(32));
+ QCOMPARE(root->property("controlPressed").toBool(), true);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::transformedMouseArea_data()
+{
+ QTest::addColumn<bool>("insideTarget");
+ QTest::addColumn<QList<QPoint> >("points");
+
+ QList<QPoint> pointsInside;
+ pointsInside << QPoint(200, 140)
+ << QPoint(140, 200)
+ << QPoint(200, 200)
+ << QPoint(260, 200)
+ << QPoint(200, 260);
+ QTest::newRow("checking points inside") << true << pointsInside;
+
+ QList<QPoint> pointsOutside;
+ pointsOutside << QPoint(140, 140)
+ << QPoint(260, 140)
+ << QPoint(120, 200)
+ << QPoint(280, 200)
+ << QPoint(140, 260)
+ << QPoint(260, 260);
+ QTest::newRow("checking points outside") << false << pointsOutside;
+}
+
+void tst_QQuickMouseArea::transformedMouseArea()
+{
+ QFETCH(bool, insideTarget);
+ QFETCH(QList<QPoint>, points);
+
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("transformedMouseArea.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *mouseArea = window->rootObject()->findChild<QQuickMouseArea *>("mouseArea");
+ QVERIFY(mouseArea != 0);
+
+ foreach (const QPoint &point, points) {
+ // check hover
+ QTest::mouseMove(window, point);
+ QTest::qWait(10);
+ QCOMPARE(mouseArea->property("containsMouse").toBool(), insideTarget);
+
+ // check mouse press
+ QTest::mousePress(window, Qt::LeftButton, 0, point);
+ QTest::qWait(10);
+ QCOMPARE(mouseArea->property("pressed").toBool(), insideTarget);
+
+ // check mouse release
+ QTest::mouseRelease(window, Qt::LeftButton, 0, point);
+ QTest::qWait(10);
+ QCOMPARE(mouseArea->property("pressed").toBool(), false);
+ }
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::pressedMultipleButtons_data()
+{
+ QTest::addColumn<Qt::MouseButtons>("accepted");
+ QTest::addColumn<QList<Qt::MouseButtons> >("buttons");
+ QTest::addColumn<QList<bool> >("pressed");
+ QTest::addColumn<QList<Qt::MouseButtons> >("pressedButtons");
+ QTest::addColumn<int>("changeCount");
+
+ QList<Qt::MouseButtons> buttons;
+ QList<bool> pressed;
+ QList<Qt::MouseButtons> pressedButtons;
+ buttons << Qt::LeftButton
+ << (Qt::LeftButton | Qt::RightButton)
+ << Qt::LeftButton
+ << 0;
+ pressed << true
+ << true
+ << true
+ << false;
+ pressedButtons << Qt::LeftButton
+ << Qt::LeftButton
+ << Qt::LeftButton
+ << 0;
+ QTest::newRow("Accept Left - Press left, Press Right, Release Right")
+ << Qt::MouseButtons(Qt::LeftButton) << buttons << pressed << pressedButtons << 2;
+
+ buttons.clear();
+ pressed.clear();
+ pressedButtons.clear();
+ buttons << Qt::LeftButton
+ << (Qt::LeftButton | Qt::RightButton)
+ << Qt::RightButton
+ << 0;
+ pressed << true
+ << true
+ << false
+ << false;
+ pressedButtons << Qt::LeftButton
+ << Qt::LeftButton
+ << 0
+ << 0;
+ QTest::newRow("Accept Left - Press left, Press Right, Release Left")
+ << Qt::MouseButtons(Qt::LeftButton) << buttons << pressed << pressedButtons << 2;
+
+ buttons.clear();
+ pressed.clear();
+ pressedButtons.clear();
+ buttons << Qt::LeftButton
+ << (Qt::LeftButton | Qt::RightButton)
+ << Qt::LeftButton
+ << 0;
+ pressed << true
+ << true
+ << true
+ << false;
+ pressedButtons << Qt::LeftButton
+ << (Qt::LeftButton | Qt::RightButton)
+ << Qt::LeftButton
+ << 0;
+ QTest::newRow("Accept Left|Right - Press left, Press Right, Release Right")
+ << (Qt::LeftButton | Qt::RightButton) << buttons << pressed << pressedButtons << 4;
+
+ buttons.clear();
+ pressed.clear();
+ pressedButtons.clear();
+ buttons << Qt::RightButton
+ << (Qt::LeftButton | Qt::RightButton)
+ << Qt::LeftButton
+ << 0;
+ pressed << true
+ << true
+ << false
+ << false;
+ pressedButtons << Qt::RightButton
+ << Qt::RightButton
+ << 0
+ << 0;
+ QTest::newRow("Accept Right - Press Right, Press Left, Release Right")
+ << Qt::MouseButtons(Qt::RightButton) << buttons << pressed << pressedButtons << 2;
+}
+
+void tst_QQuickMouseArea::pressedMultipleButtons()
+{
+ QFETCH(Qt::MouseButtons, accepted);
+ QFETCH(QList<Qt::MouseButtons>, buttons);
+ QFETCH(QList<bool>, pressed);
+ QFETCH(QList<Qt::MouseButtons>, pressedButtons);
+ QFETCH(int, changeCount);
+
+ QQuickView *view = createView();
+ view->setSource(testFileUrl("simple.qml"));
+ view->show();
+ QTest::qWaitForWindowExposed(view);
+ QVERIFY(view->rootObject() != 0);
+
+ QQuickMouseArea *mouseArea = view->rootObject()->findChild<QQuickMouseArea *>("mousearea");
+ QVERIFY(mouseArea != 0);
+
+ QSignalSpy pressedSpy(mouseArea, SIGNAL(pressedChanged()));
+ QSignalSpy pressedButtonsSpy(mouseArea, SIGNAL(pressedButtonsChanged()));
+ mouseArea->setAcceptedMouseButtons(accepted);
+
+ QPoint point(10,10);
+
+ for (int i = 0; i < buttons.count(); ++i) {
+ int btns = buttons.at(i);
+
+ // The windowsysteminterface takes care of sending releases
+ QTest::mousePress(view, (Qt::MouseButton)btns, 0, point);
+
+ QCOMPARE(mouseArea->pressed(), pressed.at(i));
+ QCOMPARE(mouseArea->pressedButtons(), pressedButtons.at(i));
+ }
+
+ QTest::mousePress(view, Qt::NoButton, 0, point);
+ QCOMPARE(mouseArea->pressed(), false);
+
+ QCOMPARE(pressedSpy.count(), 2);
+ QCOMPARE(pressedButtonsSpy.count(), changeCount);
+
+ delete view;
+}
+
+void tst_QQuickMouseArea::changeAxis()
+{
+ QQuickView *view = createView();
+
+ view->setSource(testFileUrl("changeAxis.qml"));
+ view->show();
+ QTest::qWaitForWindowExposed(view);
+ QTRY_VERIFY(view->rootObject() != 0);
+
+ QQuickMouseArea *mouseRegion = view->rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ QQuickDrag *drag = mouseRegion->drag();
+ QVERIFY(mouseRegion != 0);
+ QVERIFY(drag != 0);
+
+ mouseRegion->setAcceptedButtons(Qt::LeftButton);
+
+ // target
+ QQuickItem *blackRect = view->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == drag->target());
+
+ QVERIFY(!drag->active());
+
+ // Start a diagonal drag
+ QTest::mousePress(view, Qt::LeftButton, 0, QPoint(100, 100));
+
+ QVERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 50.0);
+ QCOMPARE(blackRect->y(), 50.0);
+
+ QTest::mouseMove(view, QPoint(111, 111));
+ QTest::qWait(50);
+ QTest::mouseMove(view, QPoint(122, 122));
+
+ QTRY_VERIFY(drag->active());
+ QCOMPARE(blackRect->x(), 61.0);
+ QCOMPARE(blackRect->y(), 61.0);
+ QCOMPARE(drag->axis(), QQuickDrag::XAndYAxis);
+
+ /* When blackRect.x becomes bigger than 75, the drag axis is changed to
+ * Drag.YAxis by the QML code. Verify that this happens, and that the drag
+ * movement is effectively constrained to the Y axis. */
+ QTest::mouseMove(view, QPoint(144, 144));
+
+ QTRY_COMPARE(blackRect->x(), 83.0);
+ QTRY_COMPARE(blackRect->y(), 83.0);
+ QTRY_COMPARE(drag->axis(), QQuickDrag::YAxis);
+
+ QTest::mouseMove(view, QPoint(155, 155));
+
+ QTRY_COMPARE(blackRect->y(), 94.0);
+ QCOMPARE(blackRect->x(), 83.0);
+
+ QTest::mouseRelease(view, Qt::LeftButton, 0, QPoint(155, 155));
+
+ QTRY_VERIFY(!drag->active());
+ QCOMPARE(blackRect->x(), 83.0);
+ QCOMPARE(blackRect->y(), 94.0);
+
+ delete view;
+}
+
+#ifndef QT_NO_CURSOR
+void tst_QQuickMouseArea::cursorShape()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n MouseArea {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(object.data());
+ QVERIFY(mouseArea);
+
+ QSignalSpy spy(mouseArea, SIGNAL(cursorShapeChanged()));
+
+ QCOMPARE(mouseArea->cursorShape(), Qt::ArrowCursor);
+ QCOMPARE(mouseArea->cursor().shape(), Qt::ArrowCursor);
+
+ mouseArea->setCursorShape(Qt::IBeamCursor);
+ QCOMPARE(mouseArea->cursorShape(), Qt::IBeamCursor);
+ QCOMPARE(mouseArea->cursor().shape(), Qt::IBeamCursor);
+ QCOMPARE(spy.count(), 1);
+
+ mouseArea->setCursorShape(Qt::IBeamCursor);
+ QCOMPARE(spy.count(), 1);
+
+ mouseArea->setCursorShape(Qt::WaitCursor);
+ QCOMPARE(mouseArea->cursorShape(), Qt::WaitCursor);
+ QCOMPARE(mouseArea->cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(spy.count(), 2);
+}
+#endif
+
+void tst_QQuickMouseArea::moveAndReleaseWithoutPress()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("moveAndReleaseWithoutPress.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QObject *root = window->rootObject();
+ QVERIFY(root);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, QPoint(100,100));
+
+ QTest::mouseMove(window, QPoint(110,110), 50);
+ QTRY_COMPARE(root->property("hadMove").toBool(), false);
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(110,110));
+ QTRY_COMPARE(root->property("hadRelease").toBool(), false);
+
+ delete window;
+}
+
+void tst_QQuickMouseArea::nestedStopAtBounds_data()
+{
+ QTest::addColumn<bool>("transpose");
+ QTest::addColumn<bool>("invert");
+
+ QTest::newRow("left") << false << false;
+ QTest::newRow("right") << false << true;
+ QTest::newRow("top") << true << false;
+ QTest::newRow("bottom") << true << true;
+}
+
+void tst_QQuickMouseArea::nestedStopAtBounds()
+{
+ QFETCH(bool, transpose);
+ QFETCH(bool, invert);
+
+ QQuickView view;
+ view.setSource(testFileUrl("nestedStopAtBounds.qml"));
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(view.rootObject());
+
+ QQuickMouseArea *outer = view.rootObject()->findChild<QQuickMouseArea*>("outer");
+ QVERIFY(outer);
+
+ QQuickMouseArea *inner = outer->findChild<QQuickMouseArea*>("inner");
+ QVERIFY(inner);
+ inner->drag()->setAxis(transpose ? QQuickDrag::YAxis : QQuickDrag::XAxis);
+ inner->setX(invert ? 100 : 0);
+ inner->setY(invert ? 100 : 0);
+
+ const int threshold = qApp->styleHints()->startDragDistance();
+
+ QPoint position(200, 200);
+ int &axis = transpose ? position.ry() : position.rx();
+
+ // drag toward the aligned boundary. Outer mouse area dragged.
+ QTest::mousePress(&view, Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? threshold * 2 : -threshold * 2;
+ QTest::mouseMove(&view, position);
+ axis += invert ? threshold : -threshold;
+ QTest::mouseMove(&view, position);
+ QCOMPARE(outer->drag()->active(), true);
+ QCOMPARE(inner->drag()->active(), false);
+ QTest::mouseRelease(&view, Qt::LeftButton, 0, position);
+
+ QVERIFY(!outer->drag()->active());
+
+ axis = 200;
+ outer->setX(50);
+ outer->setY(50);
+
+ // drag away from the aligned boundary. Inner mouse area dragged.
+ QTest::mousePress(&view, Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? -threshold * 2 : threshold * 2;
+ QTest::mouseMove(&view, position);
+ axis += invert ? -threshold : threshold;
+ QTest::mouseMove(&view, position);
+ QCOMPARE(outer->drag()->active(), false);
+ QCOMPARE(inner->drag()->active(), true);
+ QTest::mouseRelease(&view, Qt::LeftButton, 0, position);
+}
+
+QTEST_MAIN(tst_QQuickMouseArea)
+
+#include "tst_qquickmousearea.moc"
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/basic.qml b/tests/auto/quick/qquickmultipointtoucharea/data/basic.qml
new file mode 100644
index 0000000000..cd6ce8146f
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/basic.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+MultiPointTouchArea {
+ width: 240
+ height: 320
+
+ minimumTouchPoints: 1
+ maximumTouchPoints: 4
+ touchPoints: [
+ TouchPoint { objectName: "point1" },
+ TouchPoint { objectName: "point2" },
+ TouchPoint { objectName: "point3" },
+ TouchPoint { objectName: "point4" }
+ ]
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml
new file mode 100644
index 0000000000..9c9132d0b0
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Flickable {
+ width: 240
+ height: 320
+
+ contentWidth: width
+ contentHeight: height * 2
+
+ property int cancelCount: 0
+ property int touchCount: 0
+
+ MultiPointTouchArea {
+ anchors.fill: parent
+ minimumTouchPoints: 2
+ maximumTouchPoints: 2
+ onGestureStarted: {
+ if ((Math.abs(point2.x - point2.startX) > gesture.dragThreshold/2) && (Math.abs(point1.x - point1.startX) > gesture.dragThreshold/2)) {
+ gesture.grab()
+ }
+ }
+ touchPoints: [
+ TouchPoint { id: point1; objectName: "point1" },
+ TouchPoint { id: point2; objectName: "point2" }
+ ]
+
+ onCanceled: cancelCount = touchPoints.length
+ onTouchUpdated: touchCount = touchPoints.length
+ }
+}
+
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml
new file mode 100644
index 0000000000..48773a1eb0
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 400
+
+ Flickable {
+ objectName: "flickable"
+ width: 100
+ height: 400
+
+ flickableDirection: Flickable.VerticalFlick
+ contentHeight: 800
+
+ Rectangle {
+ property bool highlight: false
+ width: 300
+ height: 350
+ color: "green"
+
+ MultiPointTouchArea {
+ anchors.fill: parent
+ minimumTouchPoints: 1
+ maximumTouchPoints: 1
+ touchPoints: [ TouchPoint { id: point1; objectName: "point1" } ]
+ }
+ }
+
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/nested.qml b/tests/auto/quick/qquickmultipointtoucharea/data/nested.qml
new file mode 100644
index 0000000000..37b8820aa0
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/nested.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+MultiPointTouchArea {
+ width: 240
+ height: 320
+
+ property bool grabInnerArea: true
+
+ minimumTouchPoints: 2
+ maximumTouchPoints: 3
+ touchPoints: [
+ TouchPoint { objectName: "point11" },
+ TouchPoint { objectName: "point12" }
+ ]
+
+ MultiPointTouchArea {
+ anchors.fill: parent
+ minimumTouchPoints: 3
+ maximumTouchPoints: 3
+ onGestureStarted: if (grabInnerArea) gesture.grab()
+ touchPoints: [
+ TouchPoint { objectName: "point21" },
+ TouchPoint { objectName: "point22" },
+ TouchPoint { objectName: "point23" }
+ ]
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml b/tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml
new file mode 100644
index 0000000000..039607e26c
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/nonOverlapping.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+
+ MultiPointTouchArea {
+ width: parent.width
+ height: 160
+ minimumTouchPoints: 2
+ maximumTouchPoints: 2
+ onGestureStarted: gesture.grab()
+ touchPoints: [
+ TouchPoint { objectName: "point11" },
+ TouchPoint { objectName: "point12" }
+ ]
+ }
+
+ MultiPointTouchArea {
+ width: parent.width
+ height: 160
+ y: 160
+ minimumTouchPoints: 3
+ maximumTouchPoints: 3
+ onGestureStarted: gesture.grab()
+ touchPoints: [
+ TouchPoint { objectName: "point21" },
+ TouchPoint { objectName: "point22" },
+ TouchPoint { objectName: "point23" }
+ ]
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/properties.qml b/tests/auto/quick/qquickmultipointtoucharea/data/properties.qml
new file mode 100644
index 0000000000..98ef1a9cbe
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/properties.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+MultiPointTouchArea {
+ width: 240
+ height: 320
+
+ minimumTouchPoints: 2
+ maximumTouchPoints: 4
+ touchPoints: [
+ TouchPoint {},
+ TouchPoint {},
+ TouchPoint {},
+ TouchPoint {}
+ ]
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml b/tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml
new file mode 100644
index 0000000000..54b160c182
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/signalTest.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+MultiPointTouchArea {
+ width: 240
+ height: 320
+
+ function clearCounts() {
+ touchPointPressCount = 0;
+ touchPointUpdateCount = 0;
+ touchPointReleaseCount = 0;
+ touchCount = 0;
+ touchUpdatedHandled = false;
+ }
+
+ property int touchPointPressCount: 0
+ property int touchPointUpdateCount: 0
+ property int touchPointReleaseCount: 0
+ property int touchCount: 0
+ property bool touchUpdatedHandled: false
+
+ maximumTouchPoints: 5
+
+ onPressed: { touchPointPressCount = touchPoints.length }
+ onUpdated: { touchPointUpdateCount = touchPoints.length }
+ onReleased: { touchPointReleaseCount = touchPoints.length }
+ onTouchUpdated: {
+ touchCount = touchPoints.length
+ touchUpdatedHandled = true
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml b/tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml
new file mode 100644
index 0000000000..296bf7996f
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/transformedMultiPointTouchArea.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ x: 100
+ y: 100
+ width: 200
+ height: 200
+ rotation: 45
+
+ MultiPointTouchArea {
+ scale: 0.5
+ anchors.fill: parent
+ maximumTouchPoints: 5
+ objectName: "touchArea"
+
+ property int pointCount: 0
+
+ onPressed: pointCount = touchPoints.length;
+ onTouchUpdated: pointCount = touchPoints.length;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
new file mode 100644
index 0000000000..d3abc198d9
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
@@ -0,0 +1,13 @@
+TARGET = tst_qquickmultipointtoucharea
+CONFIG += testcase
+CONFIG += parallel_test
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickmultipointtoucharea.cpp
+
+TESTDATA = data/*
+
+include(../../shared/util.pri)
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
new file mode 100644
index 0000000000..663d02d921
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -0,0 +1,861 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <private/qquickmultipointtoucharea_p.h>
+#include <private/qquickflickable_p.h>
+#include <qpa/qwindowsysteminterface.h>
+#include <QtQuick/qquickview.h>
+#include "../../shared/util.h"
+
+class tst_QQuickMultiPointTouchArea : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickMultiPointTouchArea() : device(0) { }
+private slots:
+ void initTestCase() {
+ QQmlDataTest::initTestCase();
+ if (!device) {
+ device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+ }
+ }
+ void cleanupTestCase() {}
+
+ void properties();
+ void signalTest();
+ void release();
+ void reuse();
+ void nonOverlapping();
+ void nested();
+ void inFlickable();
+ void inFlickable2();
+ void invisible();
+ void transformedTouchArea_data();
+ void transformedTouchArea();
+
+private:
+ QQuickView *createAndShowView(const QString &file);
+ QTouchDevice *device;
+};
+
+void tst_QQuickMultiPointTouchArea::properties()
+{
+ QQuickView *window = createAndShowView("properties.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject());
+ QVERIFY(area != 0);
+
+ QCOMPARE(area->minimumTouchPoints(), 2);
+ QCOMPARE(area->maximumTouchPoints(), 4);
+
+ QQmlListReference ref(area, "touchPoints");
+ QCOMPARE(ref.count(), 4);
+
+ delete window;
+}
+
+void tst_QQuickMultiPointTouchArea::signalTest()
+{
+ QQuickView *window = createAndShowView("signalTest.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject());
+ QVERIFY(area != 0);
+
+ QPoint p1(20,100);
+ QPoint p2(40,100);
+ QPoint p3(60,100);
+ QPoint p4(80,100);
+ QPoint p5(100,100);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(window, device);
+
+ sequence.press(0, p1).press(1, p2).commit();
+
+ QCOMPARE(area->property("touchPointPressCount").toInt(), 2);
+ QCOMPARE(area->property("touchPointUpdateCount").toInt(), 0);
+ QCOMPARE(area->property("touchPointReleaseCount").toInt(), 0);
+ QCOMPARE(area->property("touchCount").toInt(), 2);
+ QMetaObject::invokeMethod(area, "clearCounts");
+
+ sequence.stationary(0).stationary(1).press(2, p3).commit();
+
+ QCOMPARE(area->property("touchPointPressCount").toInt(), 1);
+ QCOMPARE(area->property("touchPointUpdateCount").toInt(), 0);
+ QCOMPARE(area->property("touchPointReleaseCount").toInt(), 0);
+ QCOMPARE(area->property("touchCount").toInt(), 3);
+ QMetaObject::invokeMethod(area, "clearCounts");
+
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ sequence.move(0, p1).move(1, p2).stationary(2).commit();
+
+ QCOMPARE(area->property("touchPointPressCount").toInt(), 0);
+ QCOMPARE(area->property("touchPointUpdateCount").toInt(), 2);
+ QCOMPARE(area->property("touchPointReleaseCount").toInt(), 0);
+ QCOMPARE(area->property("touchCount").toInt(), 3);
+ QMetaObject::invokeMethod(area, "clearCounts");
+
+ p3 += QPoint(10,10);
+ sequence.release(0, p1).release(1, p2)
+ .move(2, p3).press(3, p4).press(4, p5).commit();
+
+ QCOMPARE(area->property("touchPointPressCount").toInt(), 2);
+ QCOMPARE(area->property("touchPointUpdateCount").toInt(), 1);
+ QCOMPARE(area->property("touchPointReleaseCount").toInt(), 2);
+ QCOMPARE(area->property("touchCount").toInt(), 3);
+ QMetaObject::invokeMethod(area, "clearCounts");
+
+ sequence.release(2, p3).release(3, p4).release(4, p5).commit();
+
+ QCOMPARE(area->property("touchPointPressCount").toInt(), 0);
+ QCOMPARE(area->property("touchPointUpdateCount").toInt(), 0);
+ QCOMPARE(area->property("touchPointReleaseCount").toInt(), 3);
+ QCOMPARE(area->property("touchCount").toInt(), 0);
+ QCOMPARE(area->property("touchUpdatedHandled").toBool(), true);
+ QMetaObject::invokeMethod(area, "clearCounts");
+
+ delete window;
+}
+
+void tst_QQuickMultiPointTouchArea::release()
+{
+ QQuickView *window = createAndShowView("basic.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickTouchPoint *point1 = window->rootObject()->findChild<QQuickTouchPoint*>("point1");
+
+ QCOMPARE(point1->pressed(), false);
+
+ QPoint p1(20,100);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(window, device);
+
+ sequence.press(0, p1).commit();
+
+ QCOMPARE(point1->pressed(), true);
+
+ p1 += QPoint(0,10);
+
+ sequence.move(0, p1).commit();
+
+ QCOMPARE(point1->pressed(), true);
+ QCOMPARE(point1->x(), qreal(20)); QCOMPARE(point1->y(), qreal(110));
+
+ p1 += QPoint(4,10);
+
+ sequence.release(0, p1).commit();
+
+ //test that a release without a prior move to the release position successfully updates the point's position
+ QCOMPARE(point1->pressed(), false);
+ QCOMPARE(point1->x(), qreal(24)); QCOMPARE(point1->y(), qreal(120));
+
+ delete window;
+}
+
+void tst_QQuickMultiPointTouchArea::reuse()
+{
+ QQuickView *window = createAndShowView("basic.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickTouchPoint *point1 = window->rootObject()->findChild<QQuickTouchPoint*>("point1");
+ QQuickTouchPoint *point2 = window->rootObject()->findChild<QQuickTouchPoint*>("point2");
+ QQuickTouchPoint *point3 = window->rootObject()->findChild<QQuickTouchPoint*>("point3");
+
+ QCOMPARE(point1->pressed(), false);
+ QCOMPARE(point2->pressed(), false);
+
+ QPoint p1(20,100);
+ QPoint p2(40,100);
+ QPoint p3(60,100);
+ QPoint p4(80,100);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(window, device);
+
+ sequence.press(0, p1).press(1, p2).commit();
+
+ QCOMPARE(point1->pressed(), true);
+ QCOMPARE(point2->pressed(), true);
+ QCOMPARE(point3->pressed(), false);
+
+ sequence.release(0, p1).stationary(1).press(2, p3).commit();
+
+ //we shouldn't reuse point 1 yet
+ QCOMPARE(point1->pressed(), false);
+ QCOMPARE(point2->pressed(), true);
+ QCOMPARE(point3->pressed(), true);
+
+ //back to base state (no touches)
+ sequence.release(1, p2).release(2, p3).commit();
+
+ QCOMPARE(point1->pressed(), false);
+ QCOMPARE(point2->pressed(), false);
+ QCOMPARE(point3->pressed(), false);
+
+ sequence.press(0, p1).press(1, p2).commit();
+
+ QCOMPARE(point1->pressed(), true);
+ QCOMPARE(point2->pressed(), true);
+ QCOMPARE(point3->pressed(), false);
+
+ sequence.release(0, p1).stationary(1).commit();
+
+ QCOMPARE(point1->pressed(), false);
+ QCOMPARE(point2->pressed(), true);
+ QCOMPARE(point3->pressed(), false);
+
+ sequence.press(4, p4).stationary(1).commit();
+
+ //the new touch point should reuse point 1
+ QCOMPARE(point1->pressed(), true);
+ QCOMPARE(point2->pressed(), true);
+ QCOMPARE(point3->pressed(), false);
+
+ QCOMPARE(point1->x(), qreal(80)); QCOMPARE(point1->y(), qreal(100));
+
+ delete window;
+}
+
+void tst_QQuickMultiPointTouchArea::nonOverlapping()
+{
+ QQuickView *window = createAndShowView("nonOverlapping.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point11");
+ QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point12");
+ QQuickTouchPoint *point21 = window->rootObject()->findChild<QQuickTouchPoint*>("point21");
+ QQuickTouchPoint *point22 = window->rootObject()->findChild<QQuickTouchPoint*>("point22");
+ QQuickTouchPoint *point23 = window->rootObject()->findChild<QQuickTouchPoint*>("point23");
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ QPoint p1(20,100);
+ QPoint p2(40,100);
+ QPoint p3(60,180);
+ QPoint p4(80,180);
+ QPoint p5(100,180);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(window, device);
+
+ sequence.press(0, p1).commit();
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ sequence.stationary(0).press(1, p2).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(100));
+ QCOMPARE(point12->x(), qreal(40)); QCOMPARE(point12->y(), qreal(100));
+
+ p1 += QPoint(0,10);
+ p2 += QPoint(5,0);
+ sequence.move(0, p1).move(1, p2).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110));
+ QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100));
+
+ sequence.stationary(0).stationary(1).press(2, p3).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ sequence.stationary(0).stationary(1).stationary(2).press(3, p4).press(4, p5).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110));
+ QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100));
+ QCOMPARE(point21->x(), qreal(60)); QCOMPARE(point21->y(), qreal(20));
+ QCOMPARE(point22->x(), qreal(80)); QCOMPARE(point22->y(), qreal(20));
+ QCOMPARE(point23->x(), qreal(100)); QCOMPARE(point23->y(), qreal(20));
+
+ p1 += QPoint(4,10);
+ p2 += QPoint(17,17);
+ p3 += QPoint(3,0);
+ p4 += QPoint(1,-1);
+ p5 += QPoint(-7,10);
+ sequence.move(0, p1).move(1, p2).move(2, p3).move(3, p4).move(4, p5).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ QCOMPARE(point11->x(), qreal(24)); QCOMPARE(point11->y(), qreal(120));
+ QCOMPARE(point12->x(), qreal(62)); QCOMPARE(point12->y(), qreal(117));
+ QCOMPARE(point21->x(), qreal(63)); QCOMPARE(point21->y(), qreal(20));
+ QCOMPARE(point22->x(), qreal(81)); QCOMPARE(point22->y(), qreal(19));
+ QCOMPARE(point23->x(), qreal(93)); QCOMPARE(point23->y(), qreal(30));
+
+ sequence.release(0, p1).release(1, p2).release(2, p3).release(3, p4).release(4, p5).commit();
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ delete window;
+}
+
+void tst_QQuickMultiPointTouchArea::nested()
+{
+ QQuickView *window = createAndShowView("nested.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point11");
+ QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point12");
+ QQuickTouchPoint *point21 = window->rootObject()->findChild<QQuickTouchPoint*>("point21");
+ QQuickTouchPoint *point22 = window->rootObject()->findChild<QQuickTouchPoint*>("point22");
+ QQuickTouchPoint *point23 = window->rootObject()->findChild<QQuickTouchPoint*>("point23");
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ QPoint p1(20,100);
+ QPoint p2(40,100);
+ QPoint p3(60,180);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(window, device);
+
+ sequence.press(0, p1).commit();
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ sequence.stationary(0).press(1, p2).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(100));
+ QCOMPARE(point12->x(), qreal(40)); QCOMPARE(point12->y(), qreal(100));
+
+ p1 += QPoint(0,10);
+ p2 += QPoint(5,0);
+ sequence.move(0, p1).move(1, p2).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110));
+ QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100));
+
+ sequence.stationary(0).stationary(1).press(2, p3).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ //point11 should be same as point21, point12 same as point22
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110));
+ QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100));
+ QCOMPARE(point21->x(), qreal(20)); QCOMPARE(point21->y(), qreal(110));
+ QCOMPARE(point22->x(), qreal(45)); QCOMPARE(point22->y(), qreal(100));
+ QCOMPARE(point23->x(), qreal(60)); QCOMPARE(point23->y(), qreal(180));
+
+ sequence.stationary(0).stationary(1).stationary(2).press(3, QPoint(80,180)).press(4, QPoint(100,180)).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ //new touch points should be ignored (have no impact on our existing touch points)
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110));
+ QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100));
+ QCOMPARE(point21->x(), qreal(20)); QCOMPARE(point21->y(), qreal(110));
+ QCOMPARE(point22->x(), qreal(45)); QCOMPARE(point22->y(), qreal(100));
+ QCOMPARE(point23->x(), qreal(60)); QCOMPARE(point23->y(), qreal(180));
+
+ sequence.stationary(0).stationary(1).stationary(2).release(3, QPoint(80,180)).release(4, QPoint(100,180)).commit();
+
+ p1 += QPoint(4,10);
+ p2 += QPoint(17,17);
+ p3 += QPoint(3,0);
+ sequence.move(0, p1).move(1, p2).move(2, p3).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ QCOMPARE(point21->x(), qreal(24)); QCOMPARE(point21->y(), qreal(120));
+ QCOMPARE(point22->x(), qreal(62)); QCOMPARE(point22->y(), qreal(117));
+ QCOMPARE(point21->x(), qreal(24)); QCOMPARE(point21->y(), qreal(120));
+ QCOMPARE(point22->x(), qreal(62)); QCOMPARE(point22->y(), qreal(117));
+ QCOMPARE(point23->x(), qreal(63)); QCOMPARE(point23->y(), qreal(180));
+
+ p1 += QPoint(4,10);
+ p2 += QPoint(17,17);
+ p3 += QPoint(3,0);
+ sequence.move(0, p1).move(1, p2).move(2, p3).commit();
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ //first two remain the same (touches now grabbed by inner touch area)
+ QCOMPARE(point11->x(), qreal(24)); QCOMPARE(point11->y(), qreal(120));
+ QCOMPARE(point12->x(), qreal(62)); QCOMPARE(point12->y(), qreal(117));
+ QCOMPARE(point21->x(), qreal(28)); QCOMPARE(point21->y(), qreal(130));
+ QCOMPARE(point22->x(), qreal(79)); QCOMPARE(point22->y(), qreal(134));
+ QCOMPARE(point23->x(), qreal(66)); QCOMPARE(point23->y(), qreal(180));
+
+ sequence.release(0, p1).release(1, p2).release(2, p3).commit();
+
+ sequence.press(0, p1).commit();
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(point21->pressed(), false);
+ QCOMPARE(point22->pressed(), false);
+ QCOMPARE(point23->pressed(), false);
+
+ sequence.release(0, p1).commit();
+
+ //test with grabbing turned off
+ window->rootObject()->setProperty("grabInnerArea", false);
+
+ sequence.press(0, p1).press(1, p2).press(2, p3).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ p1 -= QPoint(4,10);
+ p2 -= QPoint(17,17);
+ p3 -= QPoint(3,0);
+ sequence.move(0, p1).move(1, p2).move(2, p3).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ QCOMPARE(point21->x(), qreal(24)); QCOMPARE(point21->y(), qreal(120));
+ QCOMPARE(point22->x(), qreal(62)); QCOMPARE(point22->y(), qreal(117));
+ QCOMPARE(point21->x(), qreal(24)); QCOMPARE(point21->y(), qreal(120));
+ QCOMPARE(point22->x(), qreal(62)); QCOMPARE(point22->y(), qreal(117));
+ QCOMPARE(point23->x(), qreal(63)); QCOMPARE(point23->y(), qreal(180));
+
+ p1 -= QPoint(4,10);
+ p2 -= QPoint(17,17);
+ p3 -= QPoint(3,0);
+ sequence.move(0, p1).move(1, p2).move(2, p3).commit();
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(point21->pressed(), true);
+ QCOMPARE(point22->pressed(), true);
+ QCOMPARE(point23->pressed(), true);
+
+ //all change (touches not grabbed by inner touch area)
+ QCOMPARE(point11->x(), qreal(20)); QCOMPARE(point11->y(), qreal(110));
+ QCOMPARE(point12->x(), qreal(45)); QCOMPARE(point12->y(), qreal(100));
+ QCOMPARE(point21->x(), qreal(20)); QCOMPARE(point21->y(), qreal(110));
+ QCOMPARE(point22->x(), qreal(45)); QCOMPARE(point22->y(), qreal(100));
+ QCOMPARE(point23->x(), qreal(60)); QCOMPARE(point23->y(), qreal(180));
+
+ sequence.release(0, p1).release(1, p2).release(2, p3).commit();
+
+ delete window;
+}
+
+void tst_QQuickMultiPointTouchArea::inFlickable()
+{
+ QQuickView *window = createAndShowView("inFlickable.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1");
+ QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point2");
+
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+
+ QPoint p1(20,100);
+ QPoint p2(40,100);
+
+ //moving one point vertically
+ QTest::touchEvent(window, device).press(0, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ QVERIFY(flickable->contentY() < 0);
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+
+ QTest::touchEvent(window, device).release(0, p1);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(!flickable->isMoving());
+
+ //moving two points vertically
+ p1 = QPoint(20,100);
+ QTest::touchEvent(window, device).press(0, p1).press(1, p2);
+ QTest::mousePress(window, Qt::LeftButton, 0, p1);
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+ QCOMPARE(flickable->property("cancelCount").toInt(), 0);
+ QCOMPARE(flickable->property("touchCount").toInt(), 2);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ QVERIFY(flickable->contentY() < 0);
+ QCOMPARE(point11->pressed(), false);
+ QCOMPARE(point12->pressed(), false);
+ QCOMPARE(flickable->property("cancelCount").toInt(), 2);
+ QCOMPARE(flickable->property("touchCount").toInt(), 0);
+
+ QTest::touchEvent(window, device).release(0, p1).release(1, p2);
+ QTest::mouseRelease(window,Qt::LeftButton, 0, p1);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(!flickable->isMoving());
+
+ //moving two points horizontally, then one point vertically
+ p1 = QPoint(20,100);
+ p2 = QPoint(40,100);
+ QTest::touchEvent(window, device).press(0, p1).press(1, p2);
+ QTest::mousePress(window, Qt::LeftButton, 0, p1);
+
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+
+ p1 += QPoint(15,0); p2 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(15,0); p2 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(15,0); p2 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(15,0); p2 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(0,15); p2 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1).move(1, p2);
+ QTest::mouseMove(window, p1);
+
+ QVERIFY(flickable->contentY() == 0);
+ QCOMPARE(point11->pressed(), true);
+ QCOMPARE(point12->pressed(), true);
+
+ QTest::touchEvent(window, device).release(0, p1).release(1, p2);
+ QTest::mouseRelease(window,Qt::LeftButton, 0, p1);
+ QTest::qWait(50);
+
+ delete window;
+}
+
+// test that dragging out of a Flickable containing a MPTA doesn't harm Flickable's state.
+void tst_QQuickMultiPointTouchArea::inFlickable2()
+{
+ QQuickView *window = createAndShowView("inFlickable2.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flickable != 0);
+
+ QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1");
+ QVERIFY(point11);
+
+ QCOMPARE(point11->pressed(), false);
+
+ QPoint p1(50,100);
+
+ // move point horizontally, out of Flickable area
+ QTest::touchEvent(window, device).press(0, p1);
+ QTest::mousePress(window, Qt::LeftButton, 0, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1);
+ QTest::mouseMove(window, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(window, device).move(0, p1);
+ QTest::mouseMove(window, p1);
+
+ QVERIFY(!flickable->isMoving());
+ QVERIFY(point11->pressed());
+
+ QTest::touchEvent(window, device).release(0, p1);
+ QTest::mouseRelease(window,Qt::LeftButton, 0, p1);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(!flickable->isMoving());
+
+ // Check that we can still move the Flickable
+ p1 = QPoint(50,100);
+ QTest::touchEvent(window, device).press(0, p1);
+
+ QCOMPARE(point11->pressed(), true);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(window, device).move(0, p1);
+
+ QVERIFY(flickable->contentY() < 0);
+ QVERIFY(flickable->isMoving());
+ QCOMPARE(point11->pressed(), true);
+
+ QTest::touchEvent(window, device).release(0, p1);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(!flickable->isMoving());
+
+
+ delete window;
+}
+
+// QTBUG-23327
+void tst_QQuickMultiPointTouchArea::invisible()
+{
+ QQuickView *window = createAndShowView("signalTest.qml");
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject());
+ QVERIFY(area != 0);
+
+ area->setVisible(false);
+
+ QPoint p1(20,100);
+ QPoint p2(40,100);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(window, device);
+
+ sequence.press(0, p1).press(1, p2).commit();
+
+ QCOMPARE(area->property("touchPointPressCount").toInt(), 0);
+ QCOMPARE(area->property("touchPointUpdateCount").toInt(), 0);
+ QCOMPARE(area->property("touchPointReleaseCount").toInt(), 0);
+ QCOMPARE(area->property("touchCount").toInt(), 0);
+
+ delete window;
+}
+
+void tst_QQuickMultiPointTouchArea::transformedTouchArea_data()
+{
+ QTest::addColumn<QPoint>("p1");
+ QTest::addColumn<QPoint>("p2");
+ QTest::addColumn<QPoint>("p3");
+ QTest::addColumn<int>("total1");
+ QTest::addColumn<int>("total2");
+ QTest::addColumn<int>("total3");
+
+ QTest::newRow("1st point inside")
+ << QPoint(140, 200) << QPoint(260, 260) << QPoint(0, 140) << 1 << 1 << 1;
+
+ QTest::newRow("2nd point inside")
+ << QPoint(260, 260) << QPoint(200, 200) << QPoint(0, 0) << 0 << 1 << 1;
+
+ QTest::newRow("3rd point inside")
+ << QPoint(140, 260) << QPoint(260, 140) << QPoint(200, 140) << 0 << 0 << 1;
+
+ QTest::newRow("all points inside")
+ << QPoint(200, 140) << QPoint(200, 260) << QPoint(140, 200) << 1 << 2 << 3;
+
+ QTest::newRow("all points outside")
+ << QPoint(140, 140) << QPoint(260, 260) << QPoint(260, 140) << 0 << 0 << 0;
+
+ QTest::newRow("1st and 2nd points inside")
+ << QPoint(200, 260) << QPoint(200, 140) << QPoint(140, 140) << 1 << 2 << 2;
+
+ QTest::newRow("1st and 3rd points inside")
+ << QPoint(200, 200) << QPoint(0, 0) << QPoint(200, 260) << 1 << 1 << 2;
+}
+
+void tst_QQuickMultiPointTouchArea::transformedTouchArea()
+{
+ QFETCH(QPoint, p1);
+ QFETCH(QPoint, p2);
+ QFETCH(QPoint, p3);
+ QFETCH(int, total1);
+ QFETCH(int, total2);
+ QFETCH(int, total3);
+
+ QQuickView *view = createAndShowView("transformedMultiPointTouchArea.qml");
+ QVERIFY(view->rootObject() != 0);
+
+ QQuickMultiPointTouchArea *area = view->rootObject()->findChild<QQuickMultiPointTouchArea *>("touchArea");
+ QVERIFY(area != 0);
+
+ QTest::QTouchEventSequence sequence = QTest::touchEvent(view, device);
+
+ sequence.press(0, p1).commit();
+ QCOMPARE(area->property("pointCount").toInt(), total1);
+
+ sequence.stationary(0).press(1, p2).commit();
+ QCOMPARE(area->property("pointCount").toInt(), total2);
+
+ sequence.stationary(0).stationary(1).press(2, p3).commit();
+ QCOMPARE(area->property("pointCount").toInt(), total3);
+
+ delete view;
+}
+
+QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file)
+{
+ QQuickView *window = new QQuickView(0);
+ window->setSource(testFileUrl(file));
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+
+ return window;
+}
+
+QTEST_MAIN(tst_QQuickMultiPointTouchArea)
+
+#include "tst_qquickmultipointtoucharea.moc"
diff --git a/tests/auto/quick/qquickpainteditem/qquickpainteditem.pro b/tests/auto/quick/qquickpainteditem/qquickpainteditem.pro
new file mode 100644
index 0000000000..1f03b0ed5d
--- /dev/null
+++ b/tests/auto/quick/qquickpainteditem/qquickpainteditem.pro
@@ -0,0 +1,10 @@
+TARGET = tst_qquickpainteditem
+CONFIG += testcase
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickpainteditem.cpp
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private v8-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp
new file mode 100644
index 0000000000..0bdce65d8f
--- /dev/null
+++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp
@@ -0,0 +1,491 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtQuick/qquickpainteditem.h>
+#include <QtQuick/qquickview.h>
+
+#include <private/qquickitem_p.h>
+#include <private/qsgpainternode_p.h>
+
+class tst_QQuickPaintedItem: public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase();
+ void update();
+ void opaquePainting();
+ void antialiasing();
+ void mipmap();
+ void performanceHints();
+ void contentsSize();
+ void contentScale();
+ void contentsBoundingRect();
+ void fillColor();
+ void renderTarget();
+
+private:
+ QQuickWindow window;
+};
+
+class TestPaintedItem : public QQuickPaintedItem
+{
+ Q_OBJECT
+public:
+ TestPaintedItem(QQuickItem *parent = 0)
+ : QQuickPaintedItem(parent)
+ , paintNode(0)
+ , paintRequests(0)
+ {
+ }
+
+ void paint(QPainter *painter)
+ {
+ ++paintRequests;
+ clipRect = painter->clipBoundingRect();
+ }
+
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
+ {
+ paintNode = static_cast<QSGPainterNode *>(QQuickPaintedItem::updatePaintNode(oldNode, data));
+ return paintNode;
+ }
+
+ QSGPainterNode *paintNode;
+ int paintRequests;
+ QRectF clipRect;
+};
+
+static bool hasDirtyContentFlag(QQuickItem *item) {
+ return QQuickItemPrivate::get(item)->dirtyAttributes & QQuickItemPrivate::Content; }
+static void clearDirtyContentFlag(QQuickItem *item) {
+ QQuickItemPrivate::get(item)->dirtyAttributes &= ~QQuickItemPrivate::Content; }
+
+void tst_QQuickPaintedItem::initTestCase()
+{
+ window.resize(320, 240);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+}
+
+void tst_QQuickPaintedItem::update()
+{
+ TestPaintedItem item;
+ item.setParentItem(window.contentItem());
+
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ item.update();
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(item.paintRequests, 0); // Size empty
+
+ item.setSize(QSizeF(320, 240));
+
+ item.update();
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(item.paintRequests, 1);
+ QCOMPARE(item.clipRect, QRectF(0, 0, 0, 0));
+
+ item.update(QRect(30, 25, 12, 11));
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(item.paintRequests, 2);
+ QCOMPARE(item.clipRect, QRectF(30, 25, 12, 11));
+
+ item.update(QRect(30, 25, 12, 11));
+ item.update(QRect(112, 56, 20, 20));
+
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(item.paintRequests, 3);
+ QCOMPARE(item.clipRect, QRectF(30, 25, 102, 51));
+}
+
+void tst_QQuickPaintedItem::opaquePainting()
+{
+ TestPaintedItem item;
+ item.setSize(QSizeF(320, 240));
+ item.setParentItem(window.contentItem());
+
+ QCOMPARE(item.opaquePainting(), false);
+
+ item.setOpaquePainting(false);
+ QCOMPARE(item.opaquePainting(), false);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.update();
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->opaquePainting(), false);
+
+ item.setOpaquePainting(true);
+ QCOMPARE(item.opaquePainting(), true);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->opaquePainting(), true);
+
+ item.setOpaquePainting(true);
+ QCOMPARE(item.opaquePainting(), true);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.setOpaquePainting(false);
+ QCOMPARE(item.opaquePainting(), false);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->opaquePainting(), false);
+}
+
+void tst_QQuickPaintedItem::antialiasing()
+{
+ TestPaintedItem item;
+ item.setSize(QSizeF(320, 240));
+ item.setParentItem(window.contentItem());
+
+ QCOMPARE(item.antialiasing(), false);
+
+ item.setAntialiasing(false);
+ QCOMPARE(item.antialiasing(), false);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.update();
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->smoothPainting(), false);
+
+ item.setAntialiasing(true);
+ QCOMPARE(item.antialiasing(), true);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->smoothPainting(), true);
+
+ item.setAntialiasing(true);
+ QCOMPARE(item.antialiasing(), true);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.setAntialiasing(false);
+ QCOMPARE(item.antialiasing(), false);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->smoothPainting(), false);
+}
+
+void tst_QQuickPaintedItem::mipmap()
+{
+ TestPaintedItem item;
+ item.setSize(QSizeF(320, 240));
+ item.setParentItem(window.contentItem());
+
+ QCOMPARE(item.mipmap(), false);
+
+ item.setMipmap(false);
+ QCOMPARE(item.mipmap(), false);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.update();
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->mipmapping(), false);
+
+ item.setMipmap(true);
+ QCOMPARE(item.mipmap(), true);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->mipmapping(), true);
+
+ item.setMipmap(true);
+ QCOMPARE(item.mipmap(), true);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.setMipmap(false);
+ QCOMPARE(item.mipmap(), false);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->mipmapping(), false);
+}
+
+void tst_QQuickPaintedItem::performanceHints()
+{
+ TestPaintedItem item;
+ item.setSize(QSizeF(320, 240));
+ item.setParentItem(window.contentItem());
+
+ QCOMPARE(item.performanceHints(), QQuickPaintedItem::PerformanceHints());
+
+ item.setPerformanceHints(QQuickPaintedItem::PerformanceHints());
+ QCOMPARE(item.performanceHints(), QQuickPaintedItem::PerformanceHints());
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.update();
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->fastFBOResizing(), false);
+
+ item.setPerformanceHints(QQuickPaintedItem::PerformanceHints(QQuickPaintedItem::FastFBOResizing));
+ QCOMPARE(item.performanceHints(), QQuickPaintedItem::PerformanceHints(QQuickPaintedItem::FastFBOResizing));
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->fastFBOResizing(), true);
+
+ item.setPerformanceHint(QQuickPaintedItem::FastFBOResizing, true);
+ QCOMPARE(item.performanceHints(), QQuickPaintedItem::PerformanceHints(QQuickPaintedItem::FastFBOResizing));
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+
+ item.setPerformanceHint(QQuickPaintedItem::FastFBOResizing, false);
+ QCOMPARE(item.performanceHints(), QQuickPaintedItem::PerformanceHints());
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->fastFBOResizing(), false);
+}
+
+void tst_QQuickPaintedItem::contentsSize()
+{
+ TestPaintedItem item;
+
+ QSignalSpy spy(&item, SIGNAL(contentsSizeChanged()));
+
+ QCOMPARE(item.contentsSize(), QSize());
+
+ item.setContentsSize(QSize());
+ QCOMPARE(item.contentsSize(), QSize());
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 0);
+
+ item.setContentsSize(QSize(320, 240));
+ QCOMPARE(item.contentsSize(), QSize(320, 240));
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 1);
+
+ clearDirtyContentFlag(&item);
+
+ item.setContentsSize(QSize(320, 240));
+ QCOMPARE(item.contentsSize(), QSize(320, 240));
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 1);
+
+ item.resetContentsSize();
+ QCOMPARE(item.contentsSize(), QSize());
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_QQuickPaintedItem::contentScale()
+{
+ TestPaintedItem item;
+ item.setSize(QSizeF(320, 240));
+ item.setParentItem(window.contentItem());
+
+ QSignalSpy spy(&item, SIGNAL(contentsScaleChanged()));
+
+ QCOMPARE(item.contentsScale(), 1.);
+
+ item.setContentsScale(1.);
+ QCOMPARE(item.contentsScale(), 1.);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 0);
+
+ item.update();
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->contentsScale(), 1.0);
+
+ item.setContentsScale(0.4);
+ QCOMPARE(item.contentsScale(), 0.4);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 1);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->contentsScale(), 0.4);
+
+ item.setContentsScale(0.4);
+ QCOMPARE(item.contentsScale(), 0.4);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 1);
+
+ item.setContentsScale(2.5);
+ QCOMPARE(item.contentsScale(), 2.5);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 2);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->contentsScale(), 2.5);
+}
+
+void tst_QQuickPaintedItem::contentsBoundingRect()
+{
+ TestPaintedItem item;
+ item.setSize(QSizeF(320, 240));
+ item.setParentItem(window.contentItem());
+
+ QCOMPARE(item.contentsBoundingRect(), QRectF(0, 0, 320, 240));
+
+ item.setContentsSize(QSize(500, 500));
+ QCOMPARE(item.contentsBoundingRect(), QRectF(0, 0, 500, 500));
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->size(), QSize(500, 500));
+
+ item.setContentsScale(0.5);
+ QCOMPARE(item.contentsBoundingRect(), QRectF(0, 0, 320, 250));
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->size(), QSize(320, 250));
+
+ item.setContentsSize(QSize(150, 150));
+ QCOMPARE(item.contentsBoundingRect(), QRectF(0, 0, 320, 240));
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->size(), QSize(320, 240));
+
+ item.setContentsScale(2.0);
+ QCOMPARE(item.contentsBoundingRect(), QRectF(0, 0, 320, 300));
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->size(), QSize(320, 300));
+
+}
+
+void tst_QQuickPaintedItem::fillColor()
+{
+ TestPaintedItem item;
+ item.setSize(QSizeF(320, 240));
+ item.setParentItem(window.contentItem());
+
+ QSignalSpy spy(&item, SIGNAL(fillColorChanged()));
+
+ QCOMPARE(item.fillColor(), QColor(Qt::transparent));
+
+ item.setFillColor(QColor(Qt::transparent));
+ QCOMPARE(item.fillColor(), QColor(Qt::transparent));
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 0);
+
+ item.update();
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->fillColor(), QColor(Qt::transparent));
+
+ item.setFillColor(QColor(Qt::green));
+ QCOMPARE(item.fillColor(), QColor(Qt::green));
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 1);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->fillColor(), QColor(Qt::green));
+
+ item.setFillColor(QColor(Qt::green));
+ QCOMPARE(item.fillColor(), QColor(Qt::green));
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 1);
+
+ item.setFillColor(QColor(Qt::blue));
+ QCOMPARE(item.fillColor(), QColor(Qt::blue));
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 2);
+
+ QTRY_COMPARE(hasDirtyContentFlag(&item), false);
+ QVERIFY(item.paintNode);
+ QCOMPARE(item.paintNode->fillColor(), QColor(Qt::blue));
+
+}
+
+void tst_QQuickPaintedItem::renderTarget()
+{
+ TestPaintedItem item;
+
+ QSignalSpy spy(&item, SIGNAL(renderTargetChanged()));
+
+ QCOMPARE(item.renderTarget(), QQuickPaintedItem::Image);
+
+ item.setRenderTarget(QQuickPaintedItem::Image);
+ QCOMPARE(item.renderTarget(), QQuickPaintedItem::Image);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 0);
+
+ item.setRenderTarget(QQuickPaintedItem::FramebufferObject);
+ QCOMPARE(item.renderTarget(), QQuickPaintedItem::FramebufferObject);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 1);
+
+ clearDirtyContentFlag(&item);
+
+ item.setRenderTarget(QQuickPaintedItem::FramebufferObject);
+ QCOMPARE(item.renderTarget(), QQuickPaintedItem::FramebufferObject);
+ QCOMPARE(hasDirtyContentFlag(&item), false);
+ QCOMPARE(spy.count(), 1);
+
+ item.setRenderTarget(QQuickPaintedItem::InvertedYFramebufferObject);
+ QCOMPARE(item.renderTarget(), QQuickPaintedItem::InvertedYFramebufferObject);
+ QCOMPARE(hasDirtyContentFlag(&item), true);
+ QCOMPARE(spy.count(), 2);
+}
+
+QTEST_MAIN(tst_QQuickPaintedItem)
+
+#include "tst_qquickpainteditem.moc"
diff --git a/tests/auto/quick/qquickpath/data/arc.qml b/tests/auto/quick/qquickpath/data/arc.qml
new file mode 100644
index 0000000000..000221c784
--- /dev/null
+++ b/tests/auto/quick/qquickpath/data/arc.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Path {
+ startX: 0; startY: 0
+
+ PathArc {
+ x: 100; y: 100
+ radiusX: 100; radiusY: 100
+ direction: PathArc.Clockwise
+ }
+}
diff --git a/tests/auto/quick/qquickpath/data/closedcurve.qml b/tests/auto/quick/qquickpath/data/closedcurve.qml
new file mode 100644
index 0000000000..bb4a715e28
--- /dev/null
+++ b/tests/auto/quick/qquickpath/data/closedcurve.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Path {
+ startX: 50; startY: 50
+
+ PathCurve { x: 100; y: 100 }
+ PathCurve { x: 50; y: 150 }
+ PathCurve { x: 50; y: 50 }
+}
diff --git a/tests/auto/quick/qquickpath/data/curve.qml b/tests/auto/quick/qquickpath/data/curve.qml
new file mode 100644
index 0000000000..c571186496
--- /dev/null
+++ b/tests/auto/quick/qquickpath/data/curve.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Path {
+ startX: 0; startY: 0
+
+ PathCurve { x: 100; y: 50 }
+ PathCurve { x: 50; y: 100 }
+ PathCurve { x: 100; y: 150 }
+}
diff --git a/tests/auto/quick/qquickpath/data/svg.qml b/tests/auto/quick/qquickpath/data/svg.qml
new file mode 100644
index 0000000000..cec0f75061
--- /dev/null
+++ b/tests/auto/quick/qquickpath/data/svg.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Path {
+ PathSvg { path: "M200,300 Q400,50 600,300 T1000,300" }
+}
diff --git a/tests/auto/quick/qquickpath/qquickpath.pro b/tests/auto/quick/qquickpath/qquickpath.pro
new file mode 100644
index 0000000000..f91c872ad9
--- /dev/null
+++ b/tests/auto/quick/qquickpath/qquickpath.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickpath
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickpath.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickpath/tst_qquickpath.cpp b/tests/auto/quick/qquickpath/tst_qquickpath.cpp
new file mode 100644
index 0000000000..fa68442329
--- /dev/null
+++ b/tests/auto/quick/qquickpath/tst_qquickpath.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/private/qquickpath_p.h>
+
+#include "../../shared/util.h"
+
+class tst_QuickPath : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QuickPath() {}
+
+private slots:
+ void arc();
+ void catmullromCurve();
+ void closedCatmullromCurve();
+ void svg();
+ void line();
+};
+
+void tst_QuickPath::arc()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("arc.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->startX(), 0.);
+ QCOMPARE(obj->startY(), 0.);
+
+ QQmlListReference list(obj, "pathElements");
+ QCOMPARE(list.count(), 1);
+
+ QQuickPathArc* arc = qobject_cast<QQuickPathArc*>(list.at(0));
+ QVERIFY(arc != 0);
+ QCOMPARE(arc->x(), 100.);
+ QCOMPARE(arc->y(), 100.);
+ QCOMPARE(arc->radiusX(), 100.);
+ QCOMPARE(arc->radiusY(), 100.);
+ QCOMPARE(arc->useLargeArc(), false);
+ QCOMPARE(arc->direction(), QQuickPathArc::Clockwise);
+
+ QPainterPath path = obj->path();
+ QVERIFY(path != QPainterPath());
+
+ QPointF pos = obj->pointAt(0);
+ QCOMPARE(pos, QPointF(0,0));
+ pos = obj->pointAt(.25);
+ QCOMPARE(pos.toPoint(), QPoint(39,8)); //fuzzy compare
+ pos = obj->pointAt(.75);
+ QCOMPARE(pos.toPoint(), QPoint(92,61)); //fuzzy compare
+ pos = obj->pointAt(1);
+ QCOMPARE(pos, QPointF(100,100));
+}
+
+void tst_QuickPath::catmullromCurve()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("curve.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->startX(), 0.);
+ QCOMPARE(obj->startY(), 0.);
+
+ QQmlListReference list(obj, "pathElements");
+ QCOMPARE(list.count(), 3);
+
+ QQuickPathCatmullRomCurve* curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(0));
+ QVERIFY(curve != 0);
+ QCOMPARE(curve->x(), 100.);
+ QCOMPARE(curve->y(), 50.);
+
+ curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(2));
+ QVERIFY(curve != 0);
+ QCOMPARE(curve->x(), 100.);
+ QCOMPARE(curve->y(), 150.);
+
+ QPainterPath path = obj->path();
+ QVERIFY(path != QPainterPath());
+
+ QPointF pos = obj->pointAt(0);
+ QCOMPARE(pos, QPointF(0,0));
+ pos = obj->pointAt(.25);
+ QCOMPARE(pos.toPoint(), QPoint(63,26)); //fuzzy compare
+ pos = obj->pointAt(.75);
+ QCOMPARE(pos.toPoint(), QPoint(51,105)); //fuzzy compare
+ pos = obj->pointAt(1);
+ QCOMPARE(pos, QPointF(100,150));
+}
+
+void tst_QuickPath::closedCatmullromCurve()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("closedcurve.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->startX(), 50.);
+ QCOMPARE(obj->startY(), 50.);
+
+ QQmlListReference list(obj, "pathElements");
+ QCOMPARE(list.count(), 3);
+
+ QQuickPathCatmullRomCurve* curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(2));
+ QVERIFY(curve != 0);
+ QCOMPARE(curve->x(), 50.);
+ QCOMPARE(curve->y(), 50.);
+
+ QVERIFY(obj->isClosed());
+
+ QPainterPath path = obj->path();
+ QVERIFY(path != QPainterPath());
+
+ QPointF pos = obj->pointAt(0);
+ QCOMPARE(pos, QPointF(50,50));
+ pos = obj->pointAt(.1);
+ QCOMPARE(pos.toPoint(), QPoint(67,56)); //fuzzy compare
+ pos = obj->pointAt(.75);
+ QCOMPARE(pos.toPoint(), QPoint(44,116)); //fuzzy compare
+ pos = obj->pointAt(1);
+ QCOMPARE(pos, QPointF(50,50));
+}
+
+void tst_QuickPath::svg()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("svg.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->startX(), 0.);
+ QCOMPARE(obj->startY(), 0.);
+
+ QQmlListReference list(obj, "pathElements");
+ QCOMPARE(list.count(), 1);
+
+ QQuickPathSvg* svg = qobject_cast<QQuickPathSvg*>(list.at(0));
+ QVERIFY(svg != 0);
+ QCOMPARE(svg->path(), QLatin1String("M200,300 Q400,50 600,300 T1000,300"));
+
+ QPainterPath path = obj->path();
+ QVERIFY(path != QPainterPath());
+
+ QPointF pos = obj->pointAt(0);
+ QCOMPARE(pos, QPointF(200,300));
+ pos = obj->pointAt(.25);
+ QCOMPARE(pos.toPoint(), QPoint(400,175)); //fuzzy compare
+ pos = obj->pointAt(.75);
+ QCOMPARE(pos.toPoint(), QPoint(800,425)); //fuzzy compare
+ pos = obj->pointAt(1);
+ QCOMPARE(pos, QPointF(1000,300));
+}
+
+void tst_QuickPath::line()
+{
+ QQmlEngine engine;
+ QQmlComponent c1(&engine);
+ c1.setData(
+ "import QtQuick 2.0\n"
+ "Path {\n"
+ "startX: 0; startY: 0\n"
+ "PathLine { x: 100; y: 100 }\n"
+ "}", QUrl());
+ QScopedPointer<QObject> o1(c1.create());
+ QQuickPath *path1 = qobject_cast<QQuickPath *>(o1.data());
+ QVERIFY(path1);
+
+ QQmlComponent c2(&engine);
+ c2.setData(
+ "import QtQuick 2.0\n"
+ "Path {\n"
+ "startX: 0; startY: 0\n"
+ "PathLine { x: 50; y: 50 }\n"
+ "PathLine { x: 100; y: 100 }\n"
+ "}", QUrl());
+ QScopedPointer<QObject> o2(c2.create());
+ QQuickPath *path2 = qobject_cast<QQuickPath *>(o2.data());
+ QVERIFY(path2);
+
+ for (int i = 0; i < 167; ++i) {
+ qreal t = i / 167.0;
+
+ QPointF p1 = path1->pointAt(t);
+ QCOMPARE(p1.x(), p1.y());
+
+ QPointF p2 = path2->pointAt(t);
+ QCOMPARE(p1, p2);
+ }
+}
+
+
+QTEST_MAIN(tst_QuickPath)
+
+#include "tst_qquickpath.moc"
diff --git a/tests/auto/quick/qquickpathview/data/ComponentView.qml b/tests/auto/quick/qquickpathview/data/ComponentView.qml
new file mode 100644
index 0000000000..b61033d375
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/ComponentView.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+PathView {
+ id: view
+
+ property string title
+
+ width: 100; height: 100;
+
+ model: 1
+ delegate: Text { objectName: "listItem"; text: view.title }
+
+ path: Path {
+ startX: 25; startY: 25;
+ PathLine { x: 75; y: 75 }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/asyncloader.qml b/tests/auto/quick/qquickpathview/data/asyncloader.qml
new file mode 100644
index 0000000000..94f560f3e7
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/asyncloader.qml
@@ -0,0 +1,71 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ property real delegateWidth: 60
+ property real delegateHeight: 20
+ property real delegateScale: 1.0
+ width: 240
+ height: 320
+ color: "#ffffff"
+
+ Loader {
+ asynchronous: true
+ sourceComponent: viewComponent
+ anchors.fill: parent
+ }
+
+ Component {
+ id: adelegate
+ Rectangle {
+ objectName: "wrapper"
+ property bool onPath: PathView.onPath
+ height: root.delegateHeight
+ width: root.delegateWidth
+ scale: root.delegateScale
+ color: PathView.isCurrentItem ? "lightsteelblue" : "white"
+ border.color: "black"
+ Text {
+ text: index
+ }
+ }
+ }
+ Component {
+ id: viewComponent
+ PathView {
+ id: view
+ objectName: "view"
+ width: 240
+ height: 320
+ model: 5
+ delegate: adelegate
+ highlight: Rectangle {
+ width: 60
+ height: 20
+ color: "yellow"
+ }
+ 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: 0
+ control2X: 200
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/closedPath.qml b/tests/auto/quick/qquickpathview/data/closedPath.qml
new file mode 100644
index 0000000000..3ca34056c8
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/closedPath.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+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/quick/qquickpathview/data/creationContext.qml b/tests/auto/quick/qquickpathview/data/creationContext.qml
new file mode 100644
index 0000000000..79a682788b
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/creationContext.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+ComponentView {
+ title: "Hello!"
+}
diff --git a/tests/auto/quick/qquickpathview/data/datamodel.qml b/tests/auto/quick/qquickpathview/data/datamodel.qml
new file mode 100644
index 0000000000..44f2aecc0a
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/datamodel.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+PathView {
+ id: pathview
+ property int viewCount: count
+ objectName: "pathview"
+ width: 240; height: 320
+ pathItemCount: testObject.pathItemCount
+
+ function checkProperties() {
+ testObject.error = false;
+ if (testObject.useModel && pathview.model != testData) {
+ console.log("model property incorrect");
+ testObject.error = true;
+ }
+ }
+
+ model: testObject.useModel ? testData : 0
+
+ delegate: Component {
+ id: myDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ property bool onPath: PathView.onPath
+ width: 20; height: 20; color: name
+ Text {
+ objectName: "myText"
+ text: name
+ }
+ }
+ }
+
+ path: Path {
+ startX: 120; startY: 20;
+ PathLine { x: 120; y: 300 }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/displaypath.qml b/tests/auto/quick/qquickpathview/data/displaypath.qml
new file mode 100644
index 0000000000..af0f381fc4
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/displaypath.qml
@@ -0,0 +1,59 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: delegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ height: 20
+ width: 60
+ color: "white"
+ border.color: "black"
+ Text {
+ text: index
+ }
+ Text {
+ x: 20
+ id: displayText
+ objectName: "displayText"
+ text: display
+ }
+ }
+ }
+ ]
+ PathView {
+ id: view
+ objectName: "view"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: delegate
+ 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/quick/qquickpathview/data/dragpath.qml b/tests/auto/quick/qquickpathview/data/dragpath.qml
new file mode 100644
index 0000000000..6ba778bb80
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/dragpath.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+PathView {
+ width: 400
+ height: 200
+ model: 100
+ pathItemCount: 20
+ path: Path {
+ startX: 0; startY: 100
+ PathLine { x: 400; y: 100 }
+ }
+ delegate: Rectangle { objectName: "wrapper"; height: 100; width: 2; color: PathView.isCurrentItem?"red" : "black" }
+ dragMargin: 100
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ Text {
+ objectName: "text"
+ text: "current index: " + parent.currentIndex
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/emptymodel.qml b/tests/auto/quick/qquickpathview/data/emptymodel.qml
new file mode 100644
index 0000000000..eb4d3006f4
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/emptymodel.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+PathView {
+ model: emptyModel
+}
diff --git a/tests/auto/quick/qquickpathview/data/emptypath.qml b/tests/auto/quick/qquickpathview/data/emptypath.qml
new file mode 100644
index 0000000000..d68cf4491b
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/emptypath.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+PathView {
+ model: 1
+ delegate: Item {}
+}
diff --git a/tests/auto/quick/qquickpathview/data/initialCurrentIndex.qml b/tests/auto/quick/qquickpathview/data/initialCurrentIndex.qml
new file mode 100644
index 0000000000..86f7fe4246
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/initialCurrentIndex.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+PathView {
+ id: photoPathView
+ y: 100; width: 800; height: 330; pathItemCount: 4
+ currentIndex: 3
+ dragMargin: 24
+ preferredHighlightBegin: 0.50
+ preferredHighlightEnd: 0.50
+
+ path: Path {
+ startX: -50; startY: 40;
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: -45 }
+
+ PathCubic {
+ x: 400; y: 220
+ control1X: 140; control1Y: 40
+ control2X: 210; control2Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 1.2 }
+ PathAttribute { name: "angle"; value: 0 }
+
+ PathCubic {
+ x: 850; y: 40
+ control2X: 660; control2Y: 40
+ control1X: 590; control1Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: 45 }
+ }
+
+ model: ListModel {
+ id: rssModel
+ ListElement { lColor: "red" }
+ ListElement { lColor: "green" }
+ ListElement { lColor: "yellow" }
+ ListElement { lColor: "blue" }
+ ListElement { lColor: "purple" }
+ ListElement { lColor: "gray" }
+ ListElement { lColor: "brown" }
+ ListElement { lColor: "thistle" }
+ }
+
+ delegate: Component {
+ id: photoDelegate
+ Rectangle {
+ id: wrapper
+ width: 85; height: 85; color: lColor
+
+ transform: Rotation {
+ id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
+ axis.y: 1; axis.z: 0
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/missingPercent.qml b/tests/auto/quick/qquickpathview/data/missingPercent.qml
new file mode 100644
index 0000000000..97af8e8982
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/missingPercent.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Path {
+ startY: 0
+ startX: 0
+ PathLine { x: 0; y: 50 }
+ PathPercent { value: .5 }
+ PathLine { x: 50; y: 50 }
+}
diff --git a/tests/auto/quick/qquickpathview/data/openPath.qml b/tests/auto/quick/qquickpathview/data/openPath.qml
new file mode 100644
index 0000000000..1bd8375d9e
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/openPath.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Path {
+ startY: 120
+ startX: 160
+ PathLine {
+ y: 160
+ x: 20
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/panels.qml b/tests/auto/quick/qquickpathview/data/panels.qml
new file mode 100644
index 0000000000..a111e45736
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/panels.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property bool snapOne: false
+ property bool enforceRange: false
+ width: 320; height: 480
+
+ VisualItemModel {
+ id: itemModel
+
+ Rectangle {
+ width: root.width
+ height: root.height
+ color: "blue"
+ }
+ Rectangle {
+ width: root.width
+ height: root.height
+ color: "yellow"
+ }
+ Rectangle {
+ width: root.width
+ height: root.height
+ color: "green"
+ }
+ }
+
+ PathView {
+ id: view
+ objectName: "view"
+ anchors.fill: parent
+ model: itemModel
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ flickDeceleration: 30
+ highlightRangeMode: enforceRange ? PathView.StrictlyEnforceRange : PathView.NoHighlightRange
+ snapMode: root.snapOne ? PathView.SnapOneItem : PathView.SnapToItem
+ path: Path {
+ startX: -root.width; startY: root.height/2
+ PathLine { x: root.width*2; y: root.height/2 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathUpdate.qml b/tests/auto/quick/qquickpathview/data/pathUpdate.qml
new file mode 100644
index 0000000000..e729291025
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathUpdate.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ PathView {
+ id: view
+ objectName: "pathView"
+ anchors.fill: parent
+ model: 10
+ delegate: Rectangle { objectName: "wrapper"; color: "green"; width: 100; height: 100 }
+ path: Path {
+ startX: view.width/2; startY: 0
+ PathLine { x: view.width/2; y: view.height }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathUpdateOnStartChanged.qml b/tests/auto/quick/qquickpathview/data/pathUpdateOnStartChanged.qml
new file mode 100644
index 0000000000..89084b2a37
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathUpdateOnStartChanged.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 800
+ height: 480
+ color: "black"
+ resources: [
+ ListModel {
+ id: appModel
+ ListElement { color: "green" }
+ },
+ Component {
+ id: appDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ color: "green"
+ width: 100
+ height: 100
+ }
+ }
+ ]
+ PathView {
+ id: pathView
+ objectName: "pathView"
+ model: appModel
+ anchors.fill: parent
+
+ transformOrigin: "Top"
+ delegate: appDelegate
+ path: Path {
+ objectName: "path"
+ startX: pathView.width / 2 // startX: 400 <- this works as expected
+ startY: 300
+ PathLine { x: 400; y: 120 }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathline.qml b/tests/auto/quick/qquickpathview/data/pathline.qml
new file mode 100644
index 0000000000..4c1c785bce
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathline.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: app
+ width: 360
+ height: 360
+
+ PathView {
+ id: pathView
+ objectName: "view"
+ x: (app.width-pathView.width)/2
+ y: 100
+ width: 240
+ height: 100
+
+ model: testModel
+
+ Rectangle {
+ anchors.fill: parent
+ color: "white"
+ border.color: "black"
+ }
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+
+ delegate: Rectangle {
+ objectName: "wrapper"
+ width: 100
+ height: 100
+ color: PathView.isCurrentItem ? "red" : "yellow"
+ Text {
+ text: index
+ anchors.centerIn: parent
+ }
+ z: (PathView.isCurrentItem?1:0)
+ }
+ path: Path {
+ id: path
+ startX: -100+pathView.width/2
+ startY: pathView.height/2
+ PathLine {
+ id: line
+ x: 100+pathView.width/2
+ y: pathView.height/2
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathtest.qml b/tests/auto/quick/qquickpathview/data/pathtest.qml
new file mode 100644
index 0000000000..736d58d2a9
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathtest.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Path {
+ startX: 120; startY: 100
+
+ PathAttribute { name: "scale"; value: 1.0 }
+ PathQuad { x: 120; y: 25; controlX: 260; controlY: 75 }
+ PathPercent { value: 0.3 }
+ PathLine { x: 120; y: 100 }
+ PathCubic {
+ x: 180; y: 0; control1X: -10; control1Y: 90
+ control2X: 210; control2Y: 90
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathview0.qml b/tests/auto/quick/qquickpathview/data/pathview0.qml
new file mode 100644
index 0000000000..8b9378163f
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathview0.qml
@@ -0,0 +1,85 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ property int count: view.count
+ property int currentA: -1
+ property int currentB: -1
+ property real delegateWidth: 60
+ property real delegateHeight: 20
+ property real delegateScale: 1.0
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: delegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ property bool onPath: PathView.onPath
+ height: root.delegateHeight
+ width: root.delegateWidth
+ scale: root.delegateScale
+ color: PathView.isCurrentItem ? "lightsteelblue" : "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.onCurrentItemChanged: {
+ if (PathView.isCurrentItem) {
+ root.currentA = index;
+ root.currentB = wrapper.PathView.view.currentIndex;
+ }
+ }
+ }
+ }
+ ]
+ PathView {
+ id: view
+ objectName: "view"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: delegate
+ highlight: Rectangle {
+ width: 60
+ height: 20
+ color: "yellow"
+ }
+ 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/quick/qquickpathview/data/pathview1.qml b/tests/auto/quick/qquickpathview/data/pathview1.qml
new file mode 100644
index 0000000000..53d375e596
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathview1.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+PathView {
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathview2.qml b/tests/auto/quick/qquickpathview/data/pathview2.qml
new file mode 100644
index 0000000000..1d279c42a0
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathview2.qml
@@ -0,0 +1,57 @@
+import QtQuick 2.0
+
+PathView {
+ id: photoPathView
+ y: 100; width: 800; height: 330; pathItemCount: 10; z: 1
+
+ path: Path {
+ startX: -50; startY: 40;
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: -45 }
+
+ PathCubic {
+ x: 400; y: 220
+ control1X: 140; control1Y: 40
+ control2X: 210; control2Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 1.2 }
+ PathAttribute { name: "angle"; value: 0 }
+
+ PathCubic {
+ x: 850; y: 40
+ control2X: 660; control2Y: 40
+ control1X: 590; control1Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: 45 }
+ }
+
+ model: ListModel {
+ id: rssModel
+ ListElement { lColor: "red" }
+ ListElement { lColor: "green" }
+ ListElement { lColor: "yellow" }
+ ListElement { lColor: "blue" }
+ ListElement { lColor: "purple" }
+ ListElement { lColor: "gray" }
+ ListElement { lColor: "brown" }
+ ListElement { lColor: "thistle" }
+ }
+
+ delegate: Component {
+ id: photoDelegate
+ Rectangle {
+ id: wrapper
+ width: 85; height: 85; color: lColor
+ scale: wrapper.PathView.scale
+
+ transform: Rotation {
+ id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
+ axis.y: 1; axis.z: 0; angle: wrapper.PathView.angle
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathview3.qml b/tests/auto/quick/qquickpathview/data/pathview3.qml
new file mode 100644
index 0000000000..4687776e0b
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathview3.qml
@@ -0,0 +1,69 @@
+import QtQuick 2.0
+
+PathView {
+ id: photoPathView
+ property bool enforceRange: true
+ width: 800; height: 330; pathItemCount: 4; offset: 1
+ dragMargin: 24
+ highlightRangeMode: enforceRange ? PathView.StrictlyEnforceRange : PathView.NoHighlightRange
+ preferredHighlightBegin: 0.50
+ preferredHighlightEnd: 0.50
+
+ function addColor(color) {
+ model.append({"lColor":color})
+ }
+
+ path: Path {
+ startX: -50; startY: 40;
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: -45 }
+
+ PathCubic {
+ x: 400; y: 220
+ control1X: 140; control1Y: 40
+ control2X: 210; control2Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 1.2 }
+ PathAttribute { name: "angle"; value: 0 }
+
+ PathCubic {
+ x: 850; y: 40
+ control2X: 660; control2Y: 40
+ control1X: 590; control1Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: 45 }
+ }
+
+ model: ListModel {
+ ListElement { lColor: "red" }
+ ListElement { lColor: "green" }
+ ListElement { lColor: "yellow" }
+ ListElement { lColor: "blue" }
+ ListElement { lColor: "purple" }
+ ListElement { lColor: "gray" }
+ ListElement { lColor: "brown" }
+ ListElement { lColor: "thistle" }
+ }
+
+ delegate: Component {
+ id: photoDelegate
+ Rectangle {
+ id: wrapper
+ objectName: "wrapper"
+ width: 85; height: 85; color: lColor
+
+ Text { text: index }
+
+ transform: Rotation {
+ id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
+ axis.y: 1; axis.z: 0
+ }
+ }
+ }
+
+ Text { text: "Offset: " + photoPathView.offset }
+}
diff --git a/tests/auto/quick/qquickpathview/data/pathview_package.qml b/tests/auto/quick/qquickpathview/data/pathview_package.qml
new file mode 100644
index 0000000000..2af57e6bb1
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathview_package.qml
@@ -0,0 +1,88 @@
+import QtQuick 2.0
+
+Item {
+ width: 800; height: 600
+ Component {
+ id: photoDelegate
+ Package {
+ Item { id: pathItem; objectName: "pathItem"; Package.name: 'path'; width: 85; height: 85; scale: pathItem.PathView.scale }
+ Item { id: linearItem; Package.name: 'linear'; width: 85; height: 85 }
+ Rectangle {
+ id: wrapper
+ width: 85; height: 85; color: lColor
+
+ transform: Rotation {
+ id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
+ axis.y: 1; axis.z: 0
+ }
+ state: 'path'
+ states: [
+ State {
+ name: 'path'
+ ParentChange { target: wrapper; parent: pathItem; x: 0; y: 0 }
+ PropertyChanges { target: wrapper; opacity: pathItem.PathView.onPath ? 1.0 : 0 }
+ }
+ ]
+ }
+ }
+ }
+ ListModel {
+ id: rssModel
+ ListElement { lColor: "red" }
+ ListElement { lColor: "green" }
+ ListElement { lColor: "yellow" }
+ ListElement { lColor: "blue" }
+ ListElement { lColor: "purple" }
+ ListElement { lColor: "gray" }
+ ListElement { lColor: "brown" }
+ ListElement { lColor: "thistle" }
+ }
+ VisualDataModel { id: visualModel; model: rssModel; delegate: photoDelegate }
+
+ PathView {
+ id: photoPathView
+ objectName: "photoPathView"
+ width: 800; height: 330; pathItemCount: 4; offset: 1
+ dragMargin: 24
+ preferredHighlightBegin: 0.50
+ preferredHighlightEnd: 0.50
+
+ path: Path {
+ startX: -50; startY: 40;
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: -45 }
+
+ PathCubic {
+ x: 400; y: 220
+ control1X: 140; control1Y: 40
+ control2X: 210; control2Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 1.2 }
+ PathAttribute { name: "angle"; value: 0 }
+
+ PathCubic {
+ x: 850; y: 40
+ control2X: 660; control2Y: 40
+ control1X: 590; control1Y: 220
+ }
+
+ PathAttribute { name: "scale"; value: 0.5 }
+ PathAttribute { name: "angle"; value: 45 }
+ }
+
+ model: visualModel.parts.path
+ }
+
+ PathView {
+ y: 400; width: 800; height: 330; pathItemCount: 8
+
+ path: Path {
+ startX: 0; startY: 40;
+ PathLine { x: 800; y: 40 }
+ }
+
+ model: visualModel.parts.linear
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/propertychanges.qml b/tests/auto/quick/qquickpathview/data/propertychanges.qml
new file mode 100644
index 0000000000..09b309f86f
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/propertychanges.qml
@@ -0,0 +1,116 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 350; height: 220; color: "white"
+ Component {
+ id: myDelegate
+ Item {
+ id: wrapper
+ width: 180; height: 40;
+ opacity: PathView.opacity
+ Column {
+ x: 5; y: 5
+ Text { text: '<b>Name:</b> ' + name }
+ Text { text: '<b>Number:</b> ' + number }
+ }
+ }
+ }
+
+ PathView {
+ preferredHighlightBegin: 0.1
+ preferredHighlightEnd: 0.1
+ dragMargin: 5.0
+ id: pathView
+ objectName: "pathView"
+ anchors.fill: parent
+ model: listModel
+ delegate: myDelegate
+ focus: true
+ path: Path {
+ id: myPath
+ objectName: "path"
+ startX: 220; startY: 200
+ PathAttribute { name: "opacity"; value: 1.0; objectName: "pathAttribute"; }
+ PathQuad { x: 220; y: 25; controlX: 260; controlY: 75 }
+ PathAttribute { name: "opacity"; value: 0.3 }
+ PathQuad { x: 220; y: 200; controlX: -20; controlY: 75 }
+ }
+ Timer {
+ interval: 2000; running: true; repeat: true
+ onTriggered: {
+ if (pathView.path == alternatePath)
+ pathView.path = myPath;
+ else
+ pathView.path = alternatePath;
+ }
+ }
+ }
+
+ data:[
+ ListModel {
+ id: listModel
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ },
+ ListModel {
+ objectName: "alternateModel"
+ ListElement {
+ name: "Jack"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Mary"
+ number: "555 3264"
+ }
+ },
+ Path {
+ id: alternatePath
+ objectName: "alternatePath"
+ startX: 100; startY: 40
+ PathAttribute { name: "opacity"; value: 0.0 }
+ PathLine { x: 100; y: 160 }
+ PathAttribute { name: "opacity"; value: 0.2 }
+ PathLine { x: 300; y: 160 }
+ PathAttribute { name: "opacity"; value: 0.0 }
+ PathLine { x: 300; y: 40 }
+ PathAttribute { name: "opacity"; value: 0.2 }
+ PathLine { x: 100; y: 40 }
+ }
+ ]
+}
+
+
diff --git a/tests/auto/quick/qquickpathview/data/treemodel.qml b/tests/auto/quick/qquickpathview/data/treemodel.qml
new file mode 100644
index 0000000000..fcf6922d00
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/treemodel.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+PathView {
+ width: 320
+ height: 240
+ function setRoot(index) {
+ vdm.rootIndex = vdm.modelIndex(index);
+ }
+ model: VisualDataModel {
+ id: vdm
+ model: myModel
+ delegate: Text { objectName: "wrapper"; text: display }
+ }
+
+ path: Path {
+ startX: 0; startY: 120
+ PathLine { x: 320; y: 120 }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/undefinedpath.qml b/tests/auto/quick/qquickpathview/data/undefinedpath.qml
new file mode 100644
index 0000000000..674e7cca8d
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/undefinedpath.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+PathView {
+ id: pathView
+ width: 240; height: 200
+ path: Path {
+ startX: pathView.undef/2.0; startY: 0
+ PathLine { x: pathView.undef/2.0; y: 0 }
+ }
+
+ delegate: Text { text: value }
+ model: ListModel {
+ ListElement { value: "one" }
+ ListElement { value: "two" }
+ ListElement { value: "three" }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/data/vdm.qml b/tests/auto/quick/qquickpathview/data/vdm.qml
new file mode 100644
index 0000000000..839393d9bd
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/vdm.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+PathView {
+ id: pathView
+ width: 240; height: 320
+
+ pathItemCount: 4
+ preferredHighlightBegin : 0.5
+ preferredHighlightEnd : 0.5
+
+ path: Path {
+ startX: 120; startY: 20;
+ PathLine { x: 120; y: 300 }
+ }
+
+ ListModel {
+ id: mo
+ ListElement { value: "one" }
+ ListElement { value: "two" }
+ ListElement { value: "three" }
+ }
+
+ model: VisualDataModel {
+ delegate: Text { text: model.value }
+ model : mo
+ }
+}
+
diff --git a/tests/auto/quick/qquickpathview/qquickpathview.pro b/tests/auto/quick/qquickpathview/qquickpathview.pro
new file mode 100644
index 0000000000..fb02caebdc
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/qquickpathview.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickpathview
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickpathview.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+qtHaveModule(widgets): QT += widgets
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
new file mode 100644
index 0000000000..274b93e81a
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -0,0 +1,2088 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlincubator.h>
+#include <QtQuick/private/qquickpathview_p.h>
+#include <QtQuick/private/qquickpath_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQml/private/qqmllistmodel_p.h>
+#include <QtQml/private/qqmlvaluetype_p.h>
+#include <QtGui/qstandarditemmodel.h>
+#include <QStringListModel>
+#include <QFile>
+
+#include "../../shared/util.h"
+#include "../shared/viewtestutil.h"
+#include "../shared/visualtestutil.h"
+
+using namespace QQuickViewTestUtil;
+using namespace QQuickVisualTestUtil;
+
+Q_DECLARE_METATYPE(QQuickPathView::HighlightRangeMode)
+Q_DECLARE_METATYPE(QQuickPathView::PositionMode)
+
+static void initStandardTreeModel(QStandardItemModel *model)
+{
+ QStandardItem *item;
+ item = new QStandardItem(QLatin1String("Row 1 Item"));
+ model->insertRow(0, item);
+
+ item = new QStandardItem(QLatin1String("Row 2 Item"));
+ item->setCheckable(true);
+ model->insertRow(1, item);
+
+ QStandardItem *childItem = new QStandardItem(QLatin1String("Row 2 Child Item"));
+ item->setChild(0, childItem);
+
+ item = new QStandardItem(QLatin1String("Row 3 Item"));
+ item->setIcon(QIcon());
+ model->insertRow(2, item);
+}
+
+class tst_QQuickPathView : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickPathView();
+
+private slots:
+ void initValues();
+ void items();
+ void dataModel();
+ void pathview2();
+ void pathview3();
+ void initialCurrentIndex();
+ void insertModel_data();
+ void insertModel();
+ void removeModel_data();
+ void removeModel();
+ void moveModel_data();
+ void moveModel();
+ void consecutiveModelChanges_data();
+ void consecutiveModelChanges();
+ void path();
+ void pathMoved();
+ void offset_data();
+ void offset();
+ void setCurrentIndex();
+ void resetModel();
+ void propertyChanges();
+ void pathChanges();
+ void componentChanges();
+ void modelChanges();
+ void pathUpdateOnStartChanged();
+ void package();
+ void emptyModel();
+ void emptyPath();
+ void closed();
+ void pathUpdate();
+ void visualDataModel();
+ void undefinedPath();
+ void mouseDrag();
+ void treeModel();
+ void changePreferredHighlight();
+ void missingPercent();
+ void creationContext();
+ void currentOffsetOnInsertion();
+ void asynchronous();
+ void cancelDrag();
+ void maximumFlickVelocity();
+ void snapToItem();
+ void snapToItem_data();
+ void snapOneItem();
+ void snapOneItem_data();
+ void positionViewAtIndex();
+ void positionViewAtIndex_data();
+ void indexAt_itemAt();
+ void indexAt_itemAt_data();
+ void cacheItemCount();
+};
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(bool error READ error WRITE setError)
+ Q_PROPERTY(bool useModel READ useModel NOTIFY useModelChanged)
+ Q_PROPERTY(int pathItemCount READ pathItemCount NOTIFY pathItemCountChanged)
+
+public:
+ TestObject() : QObject(), mError(true), mUseModel(true), mPathItemCount(-1) {}
+
+ bool error() const { return mError; }
+ void setError(bool err) { mError = err; }
+
+ bool useModel() const { return mUseModel; }
+ void setUseModel(bool use) { mUseModel = use; emit useModelChanged(); }
+
+ int pathItemCount() const { return mPathItemCount; }
+ void setPathItemCount(int count) { mPathItemCount = count; emit pathItemCountChanged(); }
+
+signals:
+ void useModelChanged();
+ void pathItemCountChanged();
+
+private:
+ bool mError;
+ bool mUseModel;
+ int mPathItemCount;
+};
+
+tst_QQuickPathView::tst_QQuickPathView()
+{
+}
+
+void tst_QQuickPathView::initValues()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathview1.qml"));
+ QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->path() == 0);
+ QVERIFY(obj->delegate() == 0);
+ QCOMPARE(obj->model(), QVariant());
+ QCOMPARE(obj->currentIndex(), 0);
+ QCOMPARE(obj->offset(), 0.);
+ QCOMPARE(obj->preferredHighlightBegin(), 0.);
+ QCOMPARE(obj->dragMargin(), 0.);
+ QCOMPARE(obj->count(), 0);
+ QCOMPARE(obj->pathItemCount(), -1);
+
+ delete obj;
+}
+
+void tst_QQuickPathView::items()
+{
+ QScopedPointer<QQuickView> window(createView());
+
+ QaimModel model;
+ model.addItem("Fred", "12345");
+ model.addItem("John", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Bill", "4321");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathview0.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ QCOMPARE(pathview->count(), model.count());
+ QCOMPARE(window->rootObject()->property("count").toInt(), model.count());
+ QCOMPARE(pathview->childItems().count(), model.count()+1); // assumes all are visible, including highlight
+
+ for (int i = 0; i < model.count(); ++i) {
+ QQuickText *name = findItem<QQuickText>(pathview, "textName", i);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(i));
+ QQuickText *number = findItem<QQuickText>(pathview, "textNumber", i);
+ QVERIFY(number != 0);
+ QCOMPARE(number->text(), model.number(i));
+ }
+
+ QQuickPath *path = qobject_cast<QQuickPath*>(pathview->path());
+ QVERIFY(path);
+
+ QVERIFY(pathview->highlightItem());
+ QPointF start = path->pointAt(0.0);
+ QPointF offset;
+ offset.setX(pathview->highlightItem()->width()/2);
+ offset.setY(pathview->highlightItem()->height()/2);
+ QCOMPARE(pathview->highlightItem()->position() + offset, start);
+}
+
+void tst_QQuickPathView::pathview2()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathview2.qml"));
+ QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->path() != 0);
+ QVERIFY(obj->delegate() != 0);
+ QVERIFY(obj->model() != QVariant());
+ QCOMPARE(obj->currentIndex(), 0);
+ QCOMPARE(obj->offset(), 0.);
+ QCOMPARE(obj->preferredHighlightBegin(), 0.);
+ QCOMPARE(obj->dragMargin(), 0.);
+ QCOMPARE(obj->count(), 8);
+ QCOMPARE(obj->pathItemCount(), 10);
+
+ delete obj;
+}
+
+void tst_QQuickPathView::pathview3()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathview3.qml"));
+ QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->path() != 0);
+ QVERIFY(obj->delegate() != 0);
+ QVERIFY(obj->model() != QVariant());
+ QCOMPARE(obj->currentIndex(), 7);
+ QCOMPARE(obj->offset(), 1.0);
+ QCOMPARE(obj->preferredHighlightBegin(), 0.5);
+ QCOMPARE(obj->dragMargin(), 24.);
+ QCOMPARE(obj->count(), 8);
+ QCOMPARE(obj->pathItemCount(), 4);
+
+ delete obj;
+}
+
+void tst_QQuickPathView::initialCurrentIndex()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("initialCurrentIndex.qml"));
+ QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->path() != 0);
+ QVERIFY(obj->delegate() != 0);
+ QVERIFY(obj->model() != QVariant());
+ QCOMPARE(obj->currentIndex(), 3);
+ QCOMPARE(obj->offset(), 5.0);
+ QCOMPARE(obj->preferredHighlightBegin(), 0.5);
+ QCOMPARE(obj->dragMargin(), 24.);
+ QCOMPARE(obj->count(), 8);
+ QCOMPARE(obj->pathItemCount(), 4);
+
+ delete obj;
+}
+
+void tst_QQuickPathView::insertModel_data()
+{
+ QTest::addColumn<int>("mode");
+ QTest::addColumn<int>("idx");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<qreal>("offset");
+ QTest::addColumn<int>("currentIndex");
+
+ // We have 8 items, with currentIndex == 4
+ QTest::newRow("insert after current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 6 << 1 << qreal(5.) << 4;
+ QTest::newRow("insert before current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 1 << qreal(4.)<< 5;
+ QTest::newRow("insert multiple after current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 2 << qreal(6.) << 4;
+ QTest::newRow("insert multiple before current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 1 << 2 << qreal(4.) << 6;
+ QTest::newRow("insert at end")
+ << int(QQuickPathView::StrictlyEnforceRange) << 8 << 1 << qreal(5.) << 4;
+ QTest::newRow("insert at beginning")
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << qreal(4.) << 5;
+ QTest::newRow("insert at current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 4 << 1 << qreal(4.) << 5;
+
+ QTest::newRow("no range - insert after current")
+ << int(QQuickPathView::NoHighlightRange) << 6 << 1 << qreal(5.) << 4;
+ QTest::newRow("no range - insert before current")
+ << int(QQuickPathView::NoHighlightRange) << 2 << 1 << qreal(4.) << 5;
+ QTest::newRow("no range - insert multiple after current")
+ << int(QQuickPathView::NoHighlightRange) << 5 << 2 << qreal(6.) << 4;
+ QTest::newRow("no range - insert multiple before current")
+ << int(QQuickPathView::NoHighlightRange) << 1 << 2 << qreal(4.) << 6;
+ QTest::newRow("no range - insert at end")
+ << int(QQuickPathView::NoHighlightRange) << 8 << 1 << qreal(5.) << 4;
+ QTest::newRow("no range - insert at beginning")
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << qreal(4.) << 5;
+ QTest::newRow("no range - insert at current")
+ << int(QQuickPathView::NoHighlightRange) << 4 << 1 << qreal(4.) << 5;
+}
+
+void tst_QQuickPathView::insertModel()
+{
+ QFETCH(int, mode);
+ QFETCH(int, idx);
+ QFETCH(int, count);
+ QFETCH(qreal, offset);
+ QFETCH(int, currentIndex);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QaimModel model;
+ model.addItem("Ben", "12345");
+ model.addItem("Bohn", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Bill", "4321");
+ model.addItem("Jinny", "679");
+ model.addItem("Milly", "73378");
+ model.addItem("Jimmy", "3535");
+ model.addItem("Barb", "9039");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathview0.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode);
+
+ pathview->setCurrentIndex(4);
+ if (mode == QQuickPathView::StrictlyEnforceRange)
+ QTRY_COMPARE(pathview->offset(), 4.0);
+ else
+ pathview->setOffset(4);
+
+ QList<QPair<QString, QString> > items;
+ for (int i = 0; i < count; ++i)
+ items.append(qMakePair(QString("New"), QString::number(i)));
+
+ model.insertItems(idx, items);
+ QTRY_COMPARE(pathview->offset(), offset);
+
+ QCOMPARE(pathview->currentIndex(), currentIndex);
+}
+
+void tst_QQuickPathView::removeModel_data()
+{
+ QTest::addColumn<int>("mode");
+ QTest::addColumn<int>("idx");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<qreal>("offset");
+ QTest::addColumn<int>("currentIndex");
+
+ // We have 8 items, with currentIndex == 4
+ QTest::newRow("remove after current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 6 << 1 << qreal(3.) << 4;
+ QTest::newRow("remove before current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 1 << qreal(4.) << 3;
+ QTest::newRow("remove multiple after current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 2 << qreal(2.) << 4;
+ QTest::newRow("remove multiple before current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 1 << 2 << qreal(4.) << 2;
+ QTest::newRow("remove last")
+ << int(QQuickPathView::StrictlyEnforceRange) << 7 << 1 << qreal(3.) << 4;
+ QTest::newRow("remove first")
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << qreal(4.) << 3;
+ QTest::newRow("remove current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 4 << 1 << qreal(3.) << 4;
+ QTest::newRow("remove all")
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 8 << qreal(0.) << 0;
+
+ QTest::newRow("no range - remove after current")
+ << int(QQuickPathView::NoHighlightRange) << 6 << 1 << qreal(3.) << 4;
+ QTest::newRow("no range - remove before current")
+ << int(QQuickPathView::NoHighlightRange) << 2 << 1 << qreal(4.) << 3;
+ QTest::newRow("no range - remove multiple after current")
+ << int(QQuickPathView::NoHighlightRange) << 5 << 2 << qreal(2.) << 4;
+ QTest::newRow("no range - remove multiple before current")
+ << int(QQuickPathView::NoHighlightRange) << 1 << 2 << qreal(4.) << 2;
+ QTest::newRow("no range - remove last")
+ << int(QQuickPathView::NoHighlightRange) << 7 << 1 << qreal(3.) << 4;
+ QTest::newRow("no range - remove first")
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << qreal(4.) << 3;
+ QTest::newRow("no range - remove current offset")
+ << int(QQuickPathView::NoHighlightRange) << 4 << 1 << qreal(4.) << 4;
+ QTest::newRow("no range - remove all")
+ << int(QQuickPathView::NoHighlightRange) << 0 << 8 << qreal(0.) << 0;
+}
+
+void tst_QQuickPathView::removeModel()
+{
+ QFETCH(int, mode);
+ QFETCH(int, idx);
+ QFETCH(int, count);
+ QFETCH(qreal, offset);
+ QFETCH(int, currentIndex);
+
+ QScopedPointer<QQuickView> window(createView());
+
+ window->show();
+
+ QaimModel model;
+ model.addItem("Ben", "12345");
+ model.addItem("Bohn", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Bill", "4321");
+ model.addItem("Jinny", "679");
+ model.addItem("Milly", "73378");
+ model.addItem("Jimmy", "3535");
+ model.addItem("Barb", "9039");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathview0.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode);
+
+ pathview->setCurrentIndex(4);
+ if (mode == QQuickPathView::StrictlyEnforceRange)
+ QTRY_COMPARE(pathview->offset(), 4.0);
+ else
+ pathview->setOffset(4);
+
+ model.removeItems(idx, count);
+ QTRY_COMPARE(pathview->offset(), offset);
+
+ QCOMPARE(pathview->currentIndex(), currentIndex);
+}
+
+
+void tst_QQuickPathView::moveModel_data()
+{
+ QTest::addColumn<int>("mode");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<int>("to");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<qreal>("offset");
+ QTest::addColumn<int>("currentIndex");
+
+ // We have 8 items, with currentIndex == 4
+ QTest::newRow("move after current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 6 << 1 << qreal(4.) << 4;
+ QTest::newRow("move before current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 3 << 1 << qreal(4.) << 4;
+ QTest::newRow("move before current to after")
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 6 << 1 << qreal(5.) << 3;
+ QTest::newRow("move multiple after current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 5 << 6 << 2 << qreal(4.) << 4;
+ QTest::newRow("move multiple before current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 0 << 1 << 2 << qreal(4.) << 4;
+ QTest::newRow("move before current to end")
+ << int(QQuickPathView::StrictlyEnforceRange) << 2 << 7 << 1 << qreal(5.) << 3;
+ QTest::newRow("move last to beginning")
+ << int(QQuickPathView::StrictlyEnforceRange) << 7 << 0 << 1 << qreal(3.) << 5;
+ QTest::newRow("move current")
+ << int(QQuickPathView::StrictlyEnforceRange) << 4 << 6 << 1 << qreal(2.) << 6;
+
+ QTest::newRow("no range - move after current")
+ << int(QQuickPathView::NoHighlightRange) << 5 << 6 << 1 << qreal(4.) << 4;
+ QTest::newRow("no range - move before current")
+ << int(QQuickPathView::NoHighlightRange) << 2 << 3 << 1 << qreal(4.) << 4;
+ QTest::newRow("no range - move before current to after")
+ << int(QQuickPathView::NoHighlightRange) << 2 << 6 << 1 << qreal(5.) << 3;
+ QTest::newRow("no range - move multiple after current")
+ << int(QQuickPathView::NoHighlightRange) << 5 << 6 << 2 << qreal(4.) << 4;
+ QTest::newRow("no range - move multiple before current")
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 2 << qreal(4.) << 4;
+ QTest::newRow("no range - move before current to end")
+ << int(QQuickPathView::NoHighlightRange) << 2 << 7 << 1 << qreal(5.) << 3;
+ QTest::newRow("no range - move last to beginning")
+ << int(QQuickPathView::NoHighlightRange) << 7 << 0 << 1 << qreal(3.) << 5;
+ QTest::newRow("no range - move current")
+ << int(QQuickPathView::NoHighlightRange) << 4 << 6 << 1 << qreal(4.) << 6;
+ QTest::newRow("no range - move multiple incl. current")
+ << int(QQuickPathView::NoHighlightRange) << 0 << 1 << 5 << qreal(4.) << 5;
+}
+
+void tst_QQuickPathView::moveModel()
+{
+ QFETCH(int, mode);
+ QFETCH(int, from);
+ QFETCH(int, to);
+ QFETCH(int, count);
+ QFETCH(qreal, offset);
+ QFETCH(int, currentIndex);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QaimModel model;
+ model.addItem("Ben", "12345");
+ model.addItem("Bohn", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Bill", "4321");
+ model.addItem("Jinny", "679");
+ model.addItem("Milly", "73378");
+ model.addItem("Jimmy", "3535");
+ model.addItem("Barb", "9039");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathview0.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode);
+
+ pathview->setCurrentIndex(4);
+ if (mode == QQuickPathView::StrictlyEnforceRange)
+ QTRY_COMPARE(pathview->offset(), 4.0);
+ else
+ pathview->setOffset(4);
+
+ model.moveItems(from, to, count);
+ QTRY_COMPARE(pathview->offset(), offset);
+
+ QCOMPARE(pathview->currentIndex(), currentIndex);
+}
+
+void tst_QQuickPathView::consecutiveModelChanges_data()
+{
+ QTest::addColumn<QQuickPathView::HighlightRangeMode>("mode");
+ QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<qreal>("offset");
+ QTest::addColumn<int>("currentIndex");
+
+ QTest::newRow("no range - insert after, insert before")
+ << QQuickPathView::NoHighlightRange
+ << (QList<ListChange>()
+ << ListChange::insert(7, 2)
+ << ListChange::insert(1, 3))
+ << 13
+ << 6.
+ << 7;
+ QTest::newRow("no range - remove after, remove before")
+ << QQuickPathView::NoHighlightRange
+ << (QList<ListChange>()
+ << ListChange::remove(6, 2)
+ << ListChange::remove(1, 3))
+ << 3
+ << 2.
+ << 1;
+
+ QTest::newRow("no range - remove after, insert before")
+ << QQuickPathView::NoHighlightRange
+ << (QList<ListChange>()
+ << ListChange::remove(5, 2)
+ << ListChange::insert(1, 3))
+ << 9
+ << 2.
+ << 7;
+
+ QTest::newRow("no range - insert after, remove before")
+ << QQuickPathView::NoHighlightRange
+ << (QList<ListChange>()
+ << ListChange::insert(6, 2)
+ << ListChange::remove(1, 3))
+ << 7
+ << 6.
+ << 1;
+
+ QTest::newRow("no range - insert, remove all, polish, insert")
+ << QQuickPathView::NoHighlightRange
+ << (QList<ListChange>()
+ << ListChange::insert(3, 1)
+ << ListChange::remove(0, 9)
+ << ListChange::polish()
+ << ListChange::insert(0, 3))
+ << 3
+ << 0.
+ << 0;
+}
+
+void tst_QQuickPathView::consecutiveModelChanges()
+{
+ QFETCH(QQuickPathView::HighlightRangeMode, mode);
+ QFETCH(QList<ListChange>, changes);
+ QFETCH(int, count);
+ QFETCH(qreal, offset);
+ QFETCH(int, currentIndex);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QaimModel model;
+ model.addItem("Ben", "12345");
+ model.addItem("Bohn", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Bill", "4321");
+ model.addItem("Jinny", "679");
+ model.addItem("Milly", "73378");
+ model.addItem("Jimmy", "3535");
+ model.addItem("Barb", "9039");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathview0.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ pathview->setHighlightRangeMode(mode);
+
+ pathview->setCurrentIndex(4);
+ if (mode == QQuickPathView::StrictlyEnforceRange)
+ QTRY_COMPARE(pathview->offset(), 4.0);
+ else
+ pathview->setOffset(4);
+
+ for (int i=0; i<changes.count(); i++) {
+ switch (changes[i].type) {
+ case ListChange::Inserted:
+ {
+ QList<QPair<QString, QString> > items;
+ for (int j=changes[i].index; j<changes[i].index + changes[i].count; ++j)
+ items << qMakePair(QString("new item %1").arg(j), QString::number(j));
+ model.insertItems(changes[i].index, items);
+ break;
+ }
+ case ListChange::Removed:
+ model.removeItems(changes[i].index, changes[i].count);
+ break;
+ case ListChange::Moved:
+ model.moveItems(changes[i].index, changes[i].to, changes[i].count);
+ break;
+ case ListChange::SetCurrent:
+ pathview->setCurrentIndex(changes[i].index);
+ break;
+ case ListChange::Polish:
+ QQUICK_VERIFY_POLISH(pathview);
+ break;
+ default:
+ continue;
+ }
+ }
+ QQUICK_VERIFY_POLISH(pathview);
+
+ QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), count);
+ QCOMPARE(pathview->count(), count);
+ QTRY_COMPARE(pathview->offset(), offset);
+
+ QCOMPARE(pathview->currentIndex(), currentIndex);
+
+}
+
+void tst_QQuickPathView::path()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathtest.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->startX(), 120.);
+ QCOMPARE(obj->startY(), 100.);
+ QVERIFY(obj->path() != QPainterPath());
+
+ QQmlListReference list(obj, "pathElements");
+ QCOMPARE(list.count(), 5);
+
+ QQuickPathAttribute* attr = qobject_cast<QQuickPathAttribute*>(list.at(0));
+ QVERIFY(attr != 0);
+ QCOMPARE(attr->name(), QString("scale"));
+ QCOMPARE(attr->value(), 1.0);
+
+ QQuickPathQuad* quad = qobject_cast<QQuickPathQuad*>(list.at(1));
+ QVERIFY(quad != 0);
+ QCOMPARE(quad->x(), 120.);
+ QCOMPARE(quad->y(), 25.);
+ QCOMPARE(quad->controlX(), 260.);
+ QCOMPARE(quad->controlY(), 75.);
+
+ QQuickPathPercent* perc = qobject_cast<QQuickPathPercent*>(list.at(2));
+ QVERIFY(perc != 0);
+ QCOMPARE(perc->value(), 0.3);
+
+ QQuickPathLine* line = qobject_cast<QQuickPathLine*>(list.at(3));
+ QVERIFY(line != 0);
+ QCOMPARE(line->x(), 120.);
+ QCOMPARE(line->y(), 100.);
+
+ QQuickPathCubic* cubic = qobject_cast<QQuickPathCubic*>(list.at(4));
+ QVERIFY(cubic != 0);
+ QCOMPARE(cubic->x(), 180.);
+ QCOMPARE(cubic->y(), 0.);
+ QCOMPARE(cubic->control1X(), -10.);
+ QCOMPARE(cubic->control1Y(), 90.);
+ QCOMPARE(cubic->control2X(), 210.);
+ QCOMPARE(cubic->control2Y(), 90.);
+
+ delete obj;
+}
+
+void tst_QQuickPathView::dataModel()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ QaimModel model;
+ model.addItem("red", "1");
+ model.addItem("green", "2");
+ model.addItem("blue", "3");
+ model.addItem("purple", "4");
+ model.addItem("gray", "5");
+ model.addItem("brown", "6");
+ model.addItem("yellow", "7");
+ model.addItem("thistle", "8");
+ model.addItem("cyan", "9");
+ model.addItem("peachpuff", "10");
+ model.addItem("powderblue", "11");
+ model.addItem("gold", "12");
+ model.addItem("sandybrown", "13");
+
+ ctxt->setContextProperty("testData", &model);
+
+ window->setSource(testFileUrl("datamodel.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QVERIFY(testObject->error() == false);
+
+ QQuickItem *item = findItem<QQuickItem>(pathview, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->x(), 110.0);
+ QCOMPARE(item->y(), 10.0);
+
+ model.insertItem(4, "orange", "10");
+ QTest::qWait(100);
+
+ QCOMPARE(window->rootObject()->property("viewCount").toInt(), model.count());
+ QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 14);
+
+ QVERIFY(pathview->currentIndex() == 0);
+ QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 0));
+
+ QQuickText *text = findItem<QQuickText>(pathview, "myText", 4);
+ QVERIFY(text);
+ QCOMPARE(text->text(), model.name(4));
+
+ model.removeItem(2);
+ QCOMPARE(window->rootObject()->property("viewCount").toInt(), model.count());
+ text = findItem<QQuickText>(pathview, "myText", 2);
+ QVERIFY(text);
+ QCOMPARE(text->text(), model.name(2));
+ QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 0));
+
+ testObject->setPathItemCount(5);
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QVERIFY(testObject->error() == false);
+
+ QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5);
+
+ QQuickRectangle *testItem = findItem<QQuickRectangle>(pathview, "wrapper", 4);
+ QVERIFY(testItem != 0);
+ testItem = findItem<QQuickRectangle>(pathview, "wrapper", 5);
+ QVERIFY(testItem == 0);
+
+ pathview->setCurrentIndex(1);
+ QTRY_COMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1));
+ QTest::qWait(100);
+
+ model.insertItem(2, "pink", "2");
+ QTest::qWait(100);
+
+ QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5);
+ QVERIFY(pathview->currentIndex() == 1);
+ QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1));
+
+ text = findItem<QQuickText>(pathview, "myText", 2);
+ QVERIFY(text);
+ QCOMPARE(text->text(), model.name(2));
+
+ model.removeItem(3);
+ QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5);
+ text = findItem<QQuickText>(pathview, "myText", 3);
+ QVERIFY(text);
+ QCOMPARE(text->text(), model.name(3));
+ QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1));
+
+ model.moveItem(3, 5);
+ QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5);
+ QList<QQuickItem*> items = findItems<QQuickItem>(pathview, "wrapper");
+ foreach (QQuickItem *item, items) {
+ QVERIFY(item->property("onPath").toBool());
+ }
+ QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1));
+
+ // QTBUG-14199
+ pathview->setOffset(7);
+ pathview->setOffset(0);
+ QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5);
+
+ pathview->setCurrentIndex(model.count()-1);
+ QTRY_COMPARE(pathview->offset(), 1.0);
+ model.removeItem(model.count()-1);
+ QCOMPARE(pathview->currentIndex(), model.count()-1);
+
+ delete testObject;
+}
+
+void tst_QQuickPathView::pathMoved()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QaimModel model;
+ model.addItem("Ben", "12345");
+ model.addItem("Bohn", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Bill", "4321");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathview0.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QQuickPath *path = qobject_cast<QQuickPath*>(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);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ pathview->setOffset(1.0);
+
+ for (int i=0; i<model.count(); i++) {
+ QQuickRectangle *curItem = findItem<QQuickRectangle>(pathview, "wrapper", i);
+ QPointF itemPos(path->pointAt(0.25 + i*0.25));
+ QCOMPARE(curItem->position() + offset, QPointF(itemPos.x(), itemPos.y()));
+ }
+
+ QCOMPARE(pathview->currentIndex(), 3);
+
+ pathview->setOffset(0.0);
+ QCOMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentIndex(), 0);
+
+ // Change delegate size
+ pathview->setOffset(0.1);
+ pathview->setOffset(0.0);
+ window->rootObject()->setProperty("delegateWidth", 30);
+ QCOMPARE(firstItem->width(), 30.0);
+ offset.setX(firstItem->width()/2);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+
+ // Change delegate scale
+ pathview->setOffset(0.1);
+ pathview->setOffset(0.0);
+ window->rootObject()->setProperty("delegateScale", 1.2);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+
+}
+
+void tst_QQuickPathView::offset_data()
+{
+ QTest::addColumn<qreal>("offset");
+ QTest::addColumn<int>("currentIndex");
+
+ QTest::newRow("0.0") << 0.0 << 0;
+ QTest::newRow("1.0") << 7.0 << 1;
+ QTest::newRow("5.0") << 5.0 << 3;
+ QTest::newRow("4.6") << 4.6 << 3;
+ QTest::newRow("4.4") << 4.4 << 4;
+ QTest::newRow("5.4") << 5.4 << 3;
+ QTest::newRow("5.6") << 5.6 << 2;
+}
+
+void tst_QQuickPathView::offset()
+{
+ QFETCH(qreal, offset);
+ QFETCH(int, currentIndex);
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathview3.qml"));
+ QQuickPathView *view = qobject_cast<QQuickPathView*>(c.create());
+
+ view->setOffset(offset);
+ QCOMPARE(view->currentIndex(), currentIndex);
+
+ delete view;
+}
+
+void tst_QQuickPathView::setCurrentIndex()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QaimModel model;
+ model.addItem("Ben", "12345");
+ model.addItem("Bohn", "2345");
+ model.addItem("Bob", "54321");
+ model.addItem("Bill", "4321");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathview0.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QQuickPath *path = qobject_cast<QQuickPath*>(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->position() + offset, start);
+ QCOMPARE(window->rootObject()->property("currentA").toInt(), 0);
+ QCOMPARE(window->rootObject()->property("currentB").toInt(), 0);
+
+ pathview->setCurrentIndex(2);
+
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 2);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(window->rootObject()->property("currentA").toInt(), 2);
+ QCOMPARE(window->rootObject()->property("currentB").toInt(), 2);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 1);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 1);
+ QVERIFY(firstItem);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 0);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 3);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 3);
+ QVERIFY(firstItem);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->incrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 0);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ // Test positive indexes are wrapped.
+ pathview->setCurrentIndex(6);
+ QTRY_COMPARE(pathview->currentIndex(), 2);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 2);
+ QVERIFY(firstItem);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ // Test negative indexes are wrapped.
+ pathview->setCurrentIndex(-3);
+ QTRY_COMPARE(pathview->currentIndex(), 1);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 1);
+ QVERIFY(firstItem);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ // move an item, set move duration to 0, and change currentIndex to moved item. QTBUG-22786
+ model.moveItem(0, 3);
+ pathview->setHighlightMoveDuration(0);
+ pathview->setCurrentIndex(3);
+ QCOMPARE(pathview->currentIndex(), 3);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 3);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ model.moveItem(3, 0);
+ pathview->setCurrentIndex(0);
+ pathview->setHighlightMoveDuration(300);
+
+ // Check the current item is still created when outside the bounds of pathItemCount.
+ pathview->setPathItemCount(2);
+ pathview->setHighlightRangeMode(QQuickPathView::NoHighlightRange);
+ QVERIFY(findItem<QQuickRectangle>(pathview, "wrapper", 0));
+ QVERIFY(findItem<QQuickRectangle>(pathview, "wrapper", 1));
+ QVERIFY(!findItem<QQuickRectangle>(pathview, "wrapper", 2));
+ QVERIFY(!findItem<QQuickRectangle>(pathview, "wrapper", 3));
+
+ pathview->setCurrentIndex(2);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 2);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(false));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 1);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 1);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 0);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+ pathview->decrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 3);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 3);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(false));
+
+ pathview->incrementCurrentIndex();
+ QTRY_COMPARE(pathview->currentIndex(), 0);
+ firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QCOMPARE(pathview->currentItem(), firstItem);
+ QCOMPARE(firstItem->property("onPath"), QVariant(true));
+
+}
+
+void tst_QQuickPathView::resetModel()
+{
+ QScopedPointer<QQuickView> window(createView());
+
+ QStringList strings;
+ strings << "one" << "two" << "three";
+ QStringListModel model(strings);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("displaypath.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ QCOMPARE(pathview->count(), model.rowCount());
+
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QQuickText *display = findItem<QQuickText>(pathview, "displayText", i);
+ QVERIFY(display != 0);
+ QCOMPARE(display->text(), strings.at(i));
+ }
+
+ strings.clear();
+ strings << "four" << "five" << "six" << "seven";
+ model.setStringList(strings);
+
+ QCOMPARE(pathview->count(), model.rowCount());
+
+ for (int i = 0; i < model.rowCount(); ++i) {
+ QQuickText *display = findItem<QQuickText>(pathview, "displayText", i);
+ QVERIFY(display != 0);
+ QCOMPARE(display->text(), strings.at(i));
+ }
+
+}
+
+void tst_QQuickPathView::propertyChanges()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QVERIFY(window);
+ window->setSource(testFileUrl("propertychanges.qml"));
+
+ QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("pathView");
+ QVERIFY(pathView);
+
+ QSignalSpy snapPositionSpy(pathView, SIGNAL(preferredHighlightBeginChanged()));
+ QSignalSpy dragMarginSpy(pathView, SIGNAL(dragMarginChanged()));
+
+ QCOMPARE(pathView->preferredHighlightBegin(), 0.1);
+ QCOMPARE(pathView->dragMargin(), 5.0);
+
+ pathView->setPreferredHighlightBegin(0.4);
+ pathView->setPreferredHighlightEnd(0.4);
+ pathView->setDragMargin(20.0);
+
+ QCOMPARE(pathView->preferredHighlightBegin(), 0.4);
+ QCOMPARE(pathView->preferredHighlightEnd(), 0.4);
+ QCOMPARE(pathView->dragMargin(), 20.0);
+
+ QCOMPARE(snapPositionSpy.count(), 1);
+ QCOMPARE(dragMarginSpy.count(), 1);
+
+ pathView->setPreferredHighlightBegin(0.4);
+ pathView->setPreferredHighlightEnd(0.4);
+ pathView->setDragMargin(20.0);
+
+ QCOMPARE(snapPositionSpy.count(), 1);
+ QCOMPARE(dragMarginSpy.count(), 1);
+
+ QSignalSpy maximumFlickVelocitySpy(pathView, SIGNAL(maximumFlickVelocityChanged()));
+ pathView->setMaximumFlickVelocity(1000);
+ QCOMPARE(maximumFlickVelocitySpy.count(), 1);
+ pathView->setMaximumFlickVelocity(1000);
+ QCOMPARE(maximumFlickVelocitySpy.count(), 1);
+
+}
+
+void tst_QQuickPathView::pathChanges()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QVERIFY(window);
+ window->setSource(testFileUrl("propertychanges.qml"));
+
+ QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("pathView");
+ QVERIFY(pathView);
+
+ QQuickPath *path = window->rootObject()->findChild<QQuickPath*>("path");
+ QVERIFY(path);
+
+ QSignalSpy startXSpy(path, SIGNAL(startXChanged()));
+ QSignalSpy startYSpy(path, SIGNAL(startYChanged()));
+
+ QCOMPARE(path->startX(), 220.0);
+ QCOMPARE(path->startY(), 200.0);
+
+ path->setStartX(240.0);
+ path->setStartY(220.0);
+
+ QCOMPARE(path->startX(), 240.0);
+ QCOMPARE(path->startY(), 220.0);
+
+ QCOMPARE(startXSpy.count(),1);
+ QCOMPARE(startYSpy.count(),1);
+
+ path->setStartX(240);
+ path->setStartY(220);
+
+ QCOMPARE(startXSpy.count(),1);
+ QCOMPARE(startYSpy.count(),1);
+
+ QQuickPath *alternatePath = window->rootObject()->findChild<QQuickPath*>("alternatePath");
+ QVERIFY(alternatePath);
+
+ QSignalSpy pathSpy(pathView, SIGNAL(pathChanged()));
+
+ QCOMPARE(pathView->path(), path);
+
+ pathView->setPath(alternatePath);
+ QCOMPARE(pathView->path(), alternatePath);
+ QCOMPARE(pathSpy.count(),1);
+
+ pathView->setPath(alternatePath);
+ QCOMPARE(pathSpy.count(),1);
+
+ QQuickPathAttribute *pathAttribute = window->rootObject()->findChild<QQuickPathAttribute*>("pathAttribute");
+ QVERIFY(pathAttribute);
+
+ QSignalSpy nameSpy(pathAttribute, SIGNAL(nameChanged()));
+ QCOMPARE(pathAttribute->name(), QString("opacity"));
+
+ pathAttribute->setName("scale");
+ QCOMPARE(pathAttribute->name(), QString("scale"));
+ QCOMPARE(nameSpy.count(),1);
+
+ pathAttribute->setName("scale");
+ QCOMPARE(nameSpy.count(),1);
+}
+
+void tst_QQuickPathView::componentChanges()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QVERIFY(window);
+ window->setSource(testFileUrl("propertychanges.qml"));
+
+ QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("pathView");
+ QVERIFY(pathView);
+
+ QQmlComponent delegateComponent(window->engine());
+ delegateComponent.setData("import QtQuick 2.0; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile(""));
+
+ QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged()));
+
+ pathView->setDelegate(&delegateComponent);
+ QCOMPARE(pathView->delegate(), &delegateComponent);
+ QCOMPARE(delegateSpy.count(),1);
+
+ pathView->setDelegate(&delegateComponent);
+ QCOMPARE(delegateSpy.count(),1);
+}
+
+void tst_QQuickPathView::modelChanges()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QVERIFY(window);
+ window->setSource(testFileUrl("propertychanges.qml"));
+
+ QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("pathView");
+ QVERIFY(pathView);
+ pathView->setCurrentIndex(3);
+ QTRY_COMPARE(pathView->offset(), 6.0);
+
+ QQmlListModel *alternateModel = window->rootObject()->findChild<QQmlListModel*>("alternateModel");
+ QVERIFY(alternateModel);
+ QVariant modelVariant = QVariant::fromValue<QObject *>(alternateModel);
+ QSignalSpy modelSpy(pathView, SIGNAL(modelChanged()));
+ QSignalSpy currentIndexSpy(pathView, SIGNAL(currentIndexChanged()));
+
+ QCOMPARE(pathView->currentIndex(), 3);
+ pathView->setModel(modelVariant);
+ QCOMPARE(pathView->model(), modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+ QCOMPARE(pathView->currentIndex(), 0);
+ QCOMPARE(currentIndexSpy.count(), 1);
+
+ pathView->setModel(modelVariant);
+ QCOMPARE(modelSpy.count(),1);
+
+ pathView->setModel(QVariant());
+ QCOMPARE(modelSpy.count(),2);
+ QCOMPARE(pathView->currentIndex(), 0);
+ QCOMPARE(currentIndexSpy.count(), 1);
+
+}
+
+void tst_QQuickPathView::pathUpdateOnStartChanged()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QVERIFY(window);
+ window->setSource(testFileUrl("pathUpdateOnStartChanged.qml"));
+
+ QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("pathView");
+ QVERIFY(pathView);
+
+ QQuickPath *path = window->rootObject()->findChild<QQuickPath*>("path");
+ QVERIFY(path);
+ QCOMPARE(path->startX(), 400.0);
+ QCOMPARE(path->startY(), 300.0);
+
+ QQuickItem *item = findItem<QQuickItem>(pathView, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->x(), path->startX() - item->width() / 2.0);
+ QCOMPARE(item->y(), path->startY() - item->height() / 2.0);
+
+}
+
+void tst_QQuickPathView::package()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QVERIFY(window);
+ window->setSource(testFileUrl("pathview_package.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+
+ QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("photoPathView");
+ QVERIFY(pathView);
+
+#ifdef Q_OS_MAC
+ QSKIP("QTBUG-27170 view does not reliably receive polish without a running animation");
+#endif
+
+ QQuickItem *item = findItem<QQuickItem>(pathView, "pathItem");
+ QVERIFY(item);
+ QVERIFY(item->scale() != 1.0);
+
+}
+
+//QTBUG-13017
+void tst_QQuickPathView::emptyModel()
+{
+ QScopedPointer<QQuickView> window(createView());
+
+ QStringListModel model;
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("emptyModel", &model);
+
+ window->setSource(testFileUrl("emptymodel.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QCOMPARE(pathview->offset(), qreal(0.0));
+
+}
+
+void tst_QQuickPathView::emptyPath()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("emptypath.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ delete window;
+}
+
+void tst_QQuickPathView::closed()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent c(&engine, testFileUrl("openPath.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+ QVERIFY(obj);
+ QCOMPARE(obj->isClosed(), false);
+ delete obj;
+ }
+
+ {
+ QQmlComponent c(&engine, testFileUrl("closedPath.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+ QVERIFY(obj);
+ QCOMPARE(obj->isClosed(), true);
+ delete obj;
+ }
+}
+
+// QTBUG-14239
+void tst_QQuickPathView::pathUpdate()
+{
+ QScopedPointer<QQuickView> window(createView());
+ QVERIFY(window);
+ window->setSource(testFileUrl("pathUpdate.qml"));
+
+ QQuickPathView *pathView = window->rootObject()->findChild<QQuickPathView*>("pathView");
+ QVERIFY(pathView);
+
+ QQuickItem *item = findItem<QQuickItem>(pathView, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->x(), 150.0);
+
+}
+
+void tst_QQuickPathView::visualDataModel()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("vdm.qml"));
+
+ QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->count(), 3);
+
+ delete obj;
+}
+
+void tst_QQuickPathView::undefinedPath()
+{
+ QQmlEngine engine;
+
+ // QPainterPath warnings are only received if QT_NO_DEBUG is not defined
+ if (QLibraryInfo::isDebugBuild()) {
+ QString warning1("QPainterPath::moveTo: Adding point where x or y is NaN or Inf, ignoring call");
+ QTest::ignoreMessage(QtWarningMsg,qPrintable(warning1));
+
+ QString warning2("QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call");
+ QTest::ignoreMessage(QtWarningMsg,qPrintable(warning2));
+ }
+
+ QQmlComponent c(&engine, testFileUrl("undefinedpath.qml"));
+
+ QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create());
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->count(), 3);
+
+ delete obj;
+}
+
+void tst_QQuickPathView::mouseDrag()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("dragpath.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QSignalSpy movingSpy(pathview, SIGNAL(movingChanged()));
+ QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted()));
+ QSignalSpy moveEndedSpy(pathview, SIGNAL(movementEnded()));
+ QSignalSpy draggingSpy(pathview, SIGNAL(draggingChanged()));
+ QSignalSpy dragStartedSpy(pathview, SIGNAL(dragStarted()));
+ QSignalSpy dragEndedSpy(pathview, SIGNAL(dragEnded()));
+
+ int current = pathview->currentIndex();
+
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100));
+ QTest::qWait(100);
+
+ {
+ QMouseEvent mv(QEvent::MouseMove, QPoint(30,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QGuiApplication::sendEvent(window.data(), &mv);
+ }
+ // first move beyond threshold does not trigger drag
+ QVERIFY(!pathview->isMoving());
+ QVERIFY(!pathview->isDragging());
+ QCOMPARE(movingSpy.count(), 0);
+ QCOMPARE(moveStartedSpy.count(), 0);
+ QCOMPARE(moveEndedSpy.count(), 0);
+ QCOMPARE(draggingSpy.count(), 0);
+ QCOMPARE(dragStartedSpy.count(), 0);
+ QCOMPARE(dragEndedSpy.count(), 0);
+
+ {
+ QMouseEvent mv(QEvent::MouseMove, QPoint(90,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QGuiApplication::sendEvent(window.data(), &mv);
+ }
+ // next move beyond threshold does trigger drag
+ QVERIFY(pathview->isMoving());
+ QVERIFY(pathview->isDragging());
+ QCOMPARE(movingSpy.count(), 1);
+ QCOMPARE(moveStartedSpy.count(), 1);
+ QCOMPARE(moveEndedSpy.count(), 0);
+ QCOMPARE(draggingSpy.count(), 1);
+ QCOMPARE(dragStartedSpy.count(), 1);
+ QCOMPARE(dragEndedSpy.count(), 0);
+
+ QVERIFY(pathview->currentIndex() != current);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100));
+ QVERIFY(!pathview->isDragging());
+ QCOMPARE(draggingSpy.count(), 2);
+ QCOMPARE(dragStartedSpy.count(), 1);
+ QCOMPARE(dragEndedSpy.count(), 1);
+ QTRY_COMPARE(movingSpy.count(), 2);
+ QTRY_COMPARE(moveEndedSpy.count(), 1);
+ QCOMPARE(moveStartedSpy.count(), 1);
+
+}
+
+void tst_QQuickPathView::treeModel()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+ window->engine()->rootContext()->setContextProperty("myModel", &model);
+
+ window->setSource(testFileUrl("treemodel.qml"));
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+ QCOMPARE(pathview->count(), 3);
+
+ QQuickText *item = findItem<QQuickText>(pathview, "wrapper", 0);
+ QVERIFY(item);
+ QCOMPARE(item->text(), QLatin1String("Row 1 Item"));
+
+ QVERIFY(QMetaObject::invokeMethod(pathview, "setRoot", Q_ARG(QVariant, 1)));
+ QCOMPARE(pathview->count(), 1);
+
+ QTRY_VERIFY(item = findItem<QQuickText>(pathview, "wrapper", 0));
+ QTRY_COMPARE(item->text(), QLatin1String("Row 2 Child Item"));
+
+}
+
+void tst_QQuickPathView::changePreferredHighlight()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setGeometry(0,0,400,200);
+ window->setSource(testFileUrl("dragpath.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ int current = pathview->currentIndex();
+ QCOMPARE(current, 0);
+
+ QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QQuickPath *path = qobject_cast<QQuickPath*>(pathview->path());
+ QVERIFY(path);
+ QPointF start = path->pointAt(0.5);
+ QPointF offset;//Center of item is at point, but pos is from corner
+ offset.setX(firstItem->width()/2);
+ offset.setY(firstItem->height()/2);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+
+ pathview->setPreferredHighlightBegin(0.8);
+ pathview->setPreferredHighlightEnd(0.8);
+ start = path->pointAt(0.8);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ QCOMPARE(pathview->currentIndex(), 0);
+
+}
+
+void tst_QQuickPathView::creationContext()
+{
+ QQuickView window;
+ window.setGeometry(0,0,240,320);
+ window.setSource(testFileUrl("creationContext.qml"));
+
+ QQuickItem *rootItem = qobject_cast<QQuickItem *>(window.rootObject());
+ QVERIFY(rootItem);
+ QVERIFY(rootItem->property("count").toInt() > 0);
+
+ QQuickItem *item;
+ QVERIFY(item = findItem<QQuickItem>(rootItem, "listItem", 0));
+ QCOMPARE(item->property("text").toString(), QString("Hello!"));
+}
+
+// QTBUG-21320
+void tst_QQuickPathView::currentOffsetOnInsertion()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+
+ QaimModel model;
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ window->setSource(testFileUrl("pathline.qml"));
+ qApp->processEvents();
+
+ QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view");
+ QVERIFY(pathview != 0);
+
+ pathview->setPreferredHighlightBegin(0.5);
+ pathview->setPreferredHighlightEnd(0.5);
+
+ QCOMPARE(pathview->count(), model.count());
+
+ model.addItem("item0", "0");
+
+ QCOMPARE(pathview->count(), model.count());
+
+ QQuickRectangle *item = 0;
+ QTRY_VERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 0));
+
+ QQuickPath *path = qobject_cast<QQuickPath*>(pathview->path());
+ QVERIFY(path);
+
+ QPointF start = path->pointAt(0.5);
+ QPointF offset;//Center of item is at point, but pos is from corner
+ offset.setX(item->width()/2);
+ offset.setY(item->height()/2);
+ QCOMPARE(item->position() + offset, start);
+
+ QSignalSpy currentIndexSpy(pathview, SIGNAL(currentIndexChanged()));
+
+ // insert an item at the beginning
+ model.insertItem(0, "item1", "1");
+ qApp->processEvents();
+
+ QCOMPARE(currentIndexSpy.count(), 1);
+
+ // currentIndex is now 1
+ QVERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 1));
+
+ // verify that current item (item 1) is still at offset 0.5
+ QCOMPARE(item->position() + offset, start);
+
+ // insert another item at the beginning
+ model.insertItem(0, "item2", "2");
+ qApp->processEvents();
+
+ QCOMPARE(currentIndexSpy.count(), 2);
+
+ // currentIndex is now 2
+ QVERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 2));
+
+ // verify that current item (item 2) is still at offset 0.5
+ QCOMPARE(item->position() + offset, start);
+
+ // verify that remove before current maintains current item
+ model.removeItem(0);
+ qApp->processEvents();
+
+ QCOMPARE(currentIndexSpy.count(), 3);
+
+ // currentIndex is now 1
+ QVERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 1));
+
+ // verify that current item (item 1) is still at offset 0.5
+ QCOMPARE(item->position() + offset, start);
+
+}
+
+void tst_QQuickPathView::asynchronous()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->show();
+ QQmlIncubationController controller;
+ window->engine()->setIncubationController(&controller);
+
+ window->setSource(testFileUrl("asyncloader.qml"));
+
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootObject);
+
+ QQuickPathView *pathview = 0;
+ while (!pathview) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ pathview = rootObject->findChild<QQuickPathView*>("view");
+ }
+
+ // items will be created one at a time
+ for (int i = 0; i < 5; ++i) {
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", i) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(pathview, "wrapper", i);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ // verify positioning
+ QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QQuickPath *path = qobject_cast<QQuickPath*>(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);
+ QTRY_COMPARE(firstItem->position() + offset, start);
+ pathview->setOffset(1.0);
+
+ for (int i=0; i<5; i++) {
+ QQuickItem *curItem = findItem<QQuickItem>(pathview, "wrapper", i);
+ QPointF itemPos(path->pointAt(0.2 + i*0.2));
+ QCOMPARE(curItem->position() + offset, itemPos);
+ }
+
+}
+
+void tst_QQuickPathView::missingPercent()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("missingPercent.qml"));
+ QQuickPath *obj = qobject_cast<QQuickPath*>(c.create());
+ QVERIFY(obj);
+ QCOMPARE(obj->attributeAt("_qfx_percent", 1.0), qreal(1.0));
+ delete obj;
+}
+
+void tst_QQuickPathView::cancelDrag()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("dragpath.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QSignalSpy draggingSpy(pathview, SIGNAL(draggingChanged()));
+ QSignalSpy dragStartedSpy(pathview, SIGNAL(dragStarted()));
+ QSignalSpy dragEndedSpy(pathview, SIGNAL(dragEnded()));
+
+ // drag between snap points
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100));
+ QTest::qWait(100);
+ QTest::mouseMove(window.data(), QPoint(30, 100));
+ QTest::mouseMove(window.data(), QPoint(85, 100));
+
+ QTRY_VERIFY(pathview->offset() != qFloor(pathview->offset()));
+ QTRY_VERIFY(pathview->isMoving());
+ QVERIFY(pathview->isDragging());
+ QCOMPARE(draggingSpy.count(), 1);
+ QCOMPARE(dragStartedSpy.count(), 1);
+ QCOMPARE(dragEndedSpy.count(), 0);
+
+ // steal mouse grab - cancels PathView dragging
+ QQuickItem *item = window->rootObject()->findChild<QQuickItem*>("text");
+ item->grabMouse();
+
+ // returns to a snap point.
+ QTRY_VERIFY(pathview->offset() == qFloor(pathview->offset()));
+ QTRY_VERIFY(!pathview->isMoving());
+ QVERIFY(!pathview->isDragging());
+ QCOMPARE(draggingSpy.count(), 2);
+ QCOMPARE(dragStartedSpy.count(), 1);
+ QCOMPARE(dragEndedSpy.count(), 1);
+
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100));
+
+}
+
+void tst_QQuickPathView::maximumFlickVelocity()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("dragpath.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ pathview->setMaximumFlickVelocity(700);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
+ QVERIFY(pathview->isMoving());
+ QVERIFY(pathview->isFlicking());
+ QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
+
+ double dist1 = 100 - pathview->offset();
+
+ pathview->setOffset(0.);
+ pathview->setMaximumFlickVelocity(300);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
+ QVERIFY(pathview->isMoving());
+ QVERIFY(pathview->isFlicking());
+ QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
+
+ double dist2 = 100 - pathview->offset();
+
+ pathview->setOffset(0.);
+ pathview->setMaximumFlickVelocity(500);
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
+ QVERIFY(pathview->isMoving());
+ QVERIFY(pathview->isFlicking());
+ QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
+
+ double dist3 = 100 - pathview->offset();
+
+ QVERIFY(dist1 > dist2);
+ QVERIFY(dist3 > dist2);
+ QVERIFY(dist2 < dist1);
+
+}
+
+void tst_QQuickPathView::snapToItem()
+{
+ QFETCH(bool, enforceRange);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("panels.qml"));
+ QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view");
+ QVERIFY(pathview != 0);
+
+ window->rootObject()->setProperty("enforceRange", enforceRange);
+ QTRY_VERIFY(!pathview->isMoving()); // ensure stable
+
+ int currentIndex = pathview->currentIndex();
+
+ QSignalSpy snapModeSpy(pathview, SIGNAL(snapModeChanged()));
+
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
+
+ QVERIFY(pathview->isMoving());
+ QTRY_VERIFY_WITH_TIMEOUT(!pathview->isMoving(), 50000);
+
+ QVERIFY(pathview->offset() == qFloor(pathview->offset()));
+
+ if (enforceRange)
+ QVERIFY(pathview->currentIndex() != currentIndex);
+ else
+ QVERIFY(pathview->currentIndex() == currentIndex);
+
+}
+
+void tst_QQuickPathView::snapToItem_data()
+{
+ QTest::addColumn<bool>("enforceRange");
+
+ QTest::newRow("no enforce range") << false;
+ QTest::newRow("enforce range") << true;
+}
+
+void tst_QQuickPathView::snapOneItem()
+{
+ QFETCH(bool, enforceRange);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("panels.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view");
+ QVERIFY(pathview != 0);
+
+ window->rootObject()->setProperty("enforceRange", enforceRange);
+
+ QSignalSpy snapModeSpy(pathview, SIGNAL(snapModeChanged()));
+
+ window->rootObject()->setProperty("snapOne", true);
+ QVERIFY(snapModeSpy.count() == 1);
+ QTRY_VERIFY(!pathview->isMoving()); // ensure stable
+
+ int currentIndex = pathview->currentIndex();
+
+ double startOffset = pathview->offset();
+ flick(window.data(), QPoint(200,10), QPoint(10,10), 180);
+
+ QVERIFY(pathview->isMoving());
+ QTRY_VERIFY(!pathview->isMoving());
+
+ // must have moved only one item
+ QCOMPARE(pathview->offset(), fmodf(3.0 + startOffset - 1.0, 3.0));
+
+ if (enforceRange)
+ QVERIFY(pathview->currentIndex() == currentIndex+1);
+ else
+ QVERIFY(pathview->currentIndex() == currentIndex);
+
+}
+
+void tst_QQuickPathView::snapOneItem_data()
+{
+ QTest::addColumn<bool>("enforceRange");
+
+ QTest::newRow("no enforce range") << false;
+ QTest::newRow("enforce range") << true;
+}
+
+void tst_QQuickPathView::positionViewAtIndex()
+{
+ QFETCH(bool, enforceRange);
+ QFETCH(int, pathItemCount);
+ QFETCH(qreal, initOffset);
+ QFETCH(int, index);
+ QFETCH(QQuickPathView::PositionMode, mode);
+ QFETCH(qreal, offset);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("pathview3.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ window->rootObject()->setProperty("enforceRange", enforceRange);
+ if (pathItemCount == -1)
+ pathview->resetPathItemCount();
+ else
+ pathview->setPathItemCount(pathItemCount);
+ pathview->setOffset(initOffset);
+
+ pathview->positionViewAtIndex(index, mode);
+
+ QCOMPARE(pathview->offset(), offset);
+
+}
+
+void tst_QQuickPathView::positionViewAtIndex_data()
+{
+ QTest::addColumn<bool>("enforceRange");
+ QTest::addColumn<int>("pathItemCount");
+ QTest::addColumn<qreal>("initOffset");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<QQuickPathView::PositionMode>("mode");
+ QTest::addColumn<qreal>("offset");
+
+ QTest::newRow("no range, all items, Beginning") << false << -1 << 0.0 << 3 << QQuickPathView::Beginning << 5.0;
+ QTest::newRow("no range, all items, Center") << false << -1 << 0.0 << 3 << QQuickPathView::Center << 1.0;
+ QTest::newRow("no range, all items, End") << false << -1 << 0.0 << 3 << QQuickPathView::End << 5.0;
+ QTest::newRow("no range, 5 items, Beginning") << false << 5 << 0.0 << 3 << QQuickPathView::Beginning << 5.0;
+ QTest::newRow("no range, 5 items, Center") << false << 5 << 0.0 << 3 << QQuickPathView::Center << 7.5;
+ QTest::newRow("no range, 5 items, End") << false << 5 << 0.0 << 3 << QQuickPathView::End << 2.0;
+ QTest::newRow("no range, 5 items, Contain") << false << 5 << 0.0 << 3 << QQuickPathView::Contain << 0.0;
+ QTest::newRow("no range, 5 items, init offset 4.0, Contain") << false << 5 << 4.0 << 3 << QQuickPathView::Contain << 5.0;
+ QTest::newRow("no range, 5 items, init offset 3.0, Contain") << false << 5 << 3.0 << 3 << QQuickPathView::Contain << 2.0;
+
+ QTest::newRow("strict range, all items, Beginning") << true << -1 << 0.0 << 3 << QQuickPathView::Beginning << 1.0;
+ QTest::newRow("strict range, all items, Center") << true << -1 << 0.0 << 3 << QQuickPathView::Center << 5.0;
+ QTest::newRow("strict range, all items, End") << true << -1 << 0.0 << 3 << QQuickPathView::End << 0.0;
+ QTest::newRow("strict range, all items, Contain") << true << -1 << 0.0 << 3 << QQuickPathView::Contain << 0.0;
+ QTest::newRow("strict range, all items, init offset 1.0, Contain") << true << -1 << 1.0 << 3 << QQuickPathView::Contain << 1.0;
+ QTest::newRow("strict range, all items, SnapPosition") << true << -1 << 0.0 << 3 << QQuickPathView::SnapPosition << 5.0;
+ QTest::newRow("strict range, 5 items, Beginning") << true << 5 << 0.0 << 3 << QQuickPathView::Beginning << 3.0;
+ QTest::newRow("strict range, 5 items, Center") << true << 5 << 0.0 << 3 << QQuickPathView::Center << 5.0;
+ QTest::newRow("strict range, 5 items, End") << true << 5 << 0.0 << 3 << QQuickPathView::End << 7.0;
+ QTest::newRow("strict range, 5 items, Contain") << true << 5 << 0.0 << 3 << QQuickPathView::Contain << 7.0;
+ QTest::newRow("strict range, 5 items, init offset 1.0, Contain") << true << 5 << 1.0 << 3 << QQuickPathView::Contain << 7.0;
+ QTest::newRow("strict range, 5 items, init offset 2.0, Contain") << true << 5 << 2.0 << 3 << QQuickPathView::Contain << 3.0;
+ QTest::newRow("strict range, 5 items, SnapPosition") << true << 5 << 0.0 << 3 << QQuickPathView::SnapPosition << 5.0;
+}
+
+void tst_QQuickPathView::indexAt_itemAt()
+{
+ QFETCH(qreal, x);
+ QFETCH(qreal, y);
+ QFETCH(int, index);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("pathview3.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QCOMPARE(window.data(), qGuiApp->focusWindow());
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QQuickItem *item = 0;
+ if (index >= 0) {
+ item = findItem<QQuickItem>(pathview, "wrapper", index);
+ QVERIFY(item);
+ }
+ QCOMPARE(pathview->indexAt(x,y), index);
+ QVERIFY(pathview->itemAt(x,y) == item);
+
+}
+
+void tst_QQuickPathView::indexAt_itemAt_data()
+{
+ QTest::addColumn<qreal>("x");
+ QTest::addColumn<qreal>("y");
+ QTest::addColumn<int>("index");
+
+ QTest::newRow("Item 0 - 585, 95") << qreal(585.) << qreal(95.) << 0;
+ QTest::newRow("Item 0 - 660, 165") << qreal(660.) << qreal(165.) << 0;
+ QTest::newRow("No Item a - 580, 95") << qreal(580.) << qreal(95.) << -1;
+ QTest::newRow("No Item b - 585, 85") << qreal(585.) << qreal(85.) << -1;
+ QTest::newRow("Item 7 - 360, 200") << qreal(360.) << qreal(200.) << 7;
+}
+
+void tst_QQuickPathView::cacheItemCount()
+{
+ QScopedPointer<QQuickView> window(createView());
+
+ window->setSource(testFileUrl("pathview3.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview != 0);
+
+ QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("orange")));
+ QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("lightsteelblue")));
+ QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("teal")));
+ QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("aqua")));
+
+ pathview->setOffset(0);
+
+ pathview->setCacheItemCount(3);
+ QVERIFY(pathview->cacheItemCount() == 3);
+
+ QQmlIncubationController controller;
+ window->engine()->setIncubationController(&controller);
+
+ // Items on the path are created immediately
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 0));
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 1));
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 11));
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 10));
+
+ const int cached[] = { 2, 3, 9, -1 }; // two appended, one prepended
+
+ int i = 0;
+ while (cached[i] >= 0) {
+ // items will be created one at a time
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", cached[i]) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(pathview, "wrapper", cached[i]);
+ }
+ ++i;
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ // move view and confirm items in view are visible immediately and outside are created async
+ pathview->setOffset(4);
+
+ // Items on the path are created immediately
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 6));
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 7));
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 8));
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 9));
+ // already created items within cache stay created
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 10));
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 11));
+
+ // one item prepended async.
+ QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 5) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(pathview, "wrapper", 5);
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+}
+
+QTEST_MAIN(tst_QQuickPathView)
+
+#include "tst_qquickpathview.moc"
diff --git a/tests/auto/quick/qquickpincharea/data/pinchproperties.qml b/tests/auto/quick/qquickpincharea/data/pinchproperties.qml
new file mode 100644
index 0000000000..37d706fc8e
--- /dev/null
+++ b/tests/auto/quick/qquickpincharea/data/pinchproperties.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+Rectangle {
+ id: whiteRect
+ property variant center
+ property real scale
+ property int pointCount: 0
+ property bool pinchActive: false
+ width: 240; height: 320
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ PinchArea {
+ id: pincharea
+ objectName: "pincharea"
+ anchors.fill: parent
+ pinch.target: blackRect
+ pinch.dragAxis: Drag.XAndYAxis
+ pinch.minimumX: 0
+ pinch.maximumX: whiteRect.width-blackRect.width
+ pinch.minimumY: 0
+ pinch.maximumY: whiteRect.height-blackRect.height
+ pinch.minimumScale: 1.0
+ pinch.maximumScale: 2.0
+ pinch.minimumRotation: 0.0
+ pinch.maximumRotation: 90.0
+ onPinchStarted: {
+ whiteRect.center = pinch.center
+ whiteRect.scale = pinch.scale
+ whiteRect.pointCount = pinch.pointCount;
+ whiteRect.pinchActive = true;
+ }
+ onPinchUpdated: {
+ whiteRect.center = pinch.center
+ whiteRect.scale = pinch.scale
+ whiteRect.pointCount = pinch.pointCount;
+ }
+ onPinchFinished: {
+ whiteRect.center = pinch.center
+ whiteRect.scale = pinch.scale
+ whiteRect.pointCount = pinch.pointCount;
+ whiteRect.pinchActive = false;
+ }
+ }
+ }
+ }
diff --git a/tests/auto/quick/qquickpincharea/data/transformedPinchArea.qml b/tests/auto/quick/qquickpincharea/data/transformedPinchArea.qml
new file mode 100644
index 0000000000..292838ed2a
--- /dev/null
+++ b/tests/auto/quick/qquickpincharea/data/transformedPinchArea.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Rectangle {
+ x: 100
+ y: 100
+ width: 200
+ height: 200
+ rotation: 45
+
+ Rectangle {
+ id: rect
+ scale: 0.5
+ color: "black"
+ anchors.fill: parent
+
+ PinchArea {
+ anchors.fill: parent
+ objectName: "pinchArea"
+
+ property bool pinching: false
+
+ pinch.target: rect
+ pinch.dragAxis: Drag.XAndYAxis
+ onPinchStarted: pinching = true
+ onPinchFinished: pinching = false
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpincharea/qquickpincharea.pro b/tests/auto/quick/qquickpincharea/qquickpincharea.pro
new file mode 100644
index 0000000000..970ce48851
--- /dev/null
+++ b/tests/auto/quick/qquickpincharea/qquickpincharea.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qquickpincharea
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickpincharea.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
new file mode 100644
index 0000000000..18595133d0
--- /dev/null
+++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
@@ -0,0 +1,481 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtGui/QStyleHints>
+#include <qpa/qwindowsysteminterface.h>
+#include <private/qquickpincharea_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlcontext.h>
+#include "../../shared/util.h"
+
+class tst_QQuickPinchArea: public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickPinchArea() : device(0) { }
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void pinchProperties();
+ void scale();
+ void pan();
+ void retouch();
+ void transformedPinchArea_data();
+ void transformedPinchArea();
+
+private:
+ QQuickView *createView();
+ QTouchDevice *device;
+};
+void tst_QQuickPinchArea::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ if (!device) {
+ device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+ }
+}
+
+void tst_QQuickPinchArea::cleanupTestCase()
+{
+
+}
+void tst_QQuickPinchArea::pinchProperties()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("pinchproperties.qml"));
+ window->show();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QQuickPinch *pinch = pinchArea->pinch();
+ QVERIFY(pinchArea != 0);
+ QVERIFY(pinch != 0);
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == pinch->target());
+ QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootItem != 0);
+ QSignalSpy targetSpy(pinch, SIGNAL(targetChanged()));
+ pinch->setTarget(rootItem);
+ QCOMPARE(targetSpy.count(),1);
+ pinch->setTarget(rootItem);
+ QCOMPARE(targetSpy.count(),1);
+
+ // axis
+ QCOMPARE(pinch->axis(), QQuickPinch::XAndYAxis);
+ QSignalSpy axisSpy(pinch, SIGNAL(dragAxisChanged()));
+ pinch->setAxis(QQuickPinch::XAxis);
+ QCOMPARE(pinch->axis(), QQuickPinch::XAxis);
+ QCOMPARE(axisSpy.count(),1);
+ pinch->setAxis(QQuickPinch::XAxis);
+ QCOMPARE(axisSpy.count(),1);
+
+ // minimum and maximum drag properties
+ QSignalSpy xminSpy(pinch, SIGNAL(minimumXChanged()));
+ QSignalSpy xmaxSpy(pinch, SIGNAL(maximumXChanged()));
+ QSignalSpy yminSpy(pinch, SIGNAL(minimumYChanged()));
+ QSignalSpy ymaxSpy(pinch, SIGNAL(maximumYChanged()));
+
+ QCOMPARE(pinch->xmin(), 0.0);
+ QCOMPARE(pinch->xmax(), rootItem->width()-blackRect->width());
+ QCOMPARE(pinch->ymin(), 0.0);
+ QCOMPARE(pinch->ymax(), rootItem->height()-blackRect->height());
+
+ pinch->setXmin(10);
+ pinch->setXmax(10);
+ pinch->setYmin(10);
+ pinch->setYmax(10);
+
+ QCOMPARE(pinch->xmin(), 10.0);
+ QCOMPARE(pinch->xmax(), 10.0);
+ QCOMPARE(pinch->ymin(), 10.0);
+ QCOMPARE(pinch->ymax(), 10.0);
+
+ QCOMPARE(xminSpy.count(),1);
+ QCOMPARE(xmaxSpy.count(),1);
+ QCOMPARE(yminSpy.count(),1);
+ QCOMPARE(ymaxSpy.count(),1);
+
+ pinch->setXmin(10);
+ pinch->setXmax(10);
+ pinch->setYmin(10);
+ pinch->setYmax(10);
+
+ QCOMPARE(xminSpy.count(),1);
+ QCOMPARE(xmaxSpy.count(),1);
+ QCOMPARE(yminSpy.count(),1);
+ QCOMPARE(ymaxSpy.count(),1);
+
+ // minimum and maximum scale properties
+ QSignalSpy scaleMinSpy(pinch, SIGNAL(minimumScaleChanged()));
+ QSignalSpy scaleMaxSpy(pinch, SIGNAL(maximumScaleChanged()));
+
+ QCOMPARE(pinch->minimumScale(), 1.0);
+ QCOMPARE(pinch->maximumScale(), 2.0);
+
+ pinch->setMinimumScale(0.5);
+ pinch->setMaximumScale(1.5);
+
+ QCOMPARE(pinch->minimumScale(), 0.5);
+ QCOMPARE(pinch->maximumScale(), 1.5);
+
+ QCOMPARE(scaleMinSpy.count(),1);
+ QCOMPARE(scaleMaxSpy.count(),1);
+
+ pinch->setMinimumScale(0.5);
+ pinch->setMaximumScale(1.5);
+
+ QCOMPARE(scaleMinSpy.count(),1);
+ QCOMPARE(scaleMaxSpy.count(),1);
+
+ // minimum and maximum rotation properties
+ QSignalSpy rotMinSpy(pinch, SIGNAL(minimumRotationChanged()));
+ QSignalSpy rotMaxSpy(pinch, SIGNAL(maximumRotationChanged()));
+
+ QCOMPARE(pinch->minimumRotation(), 0.0);
+ QCOMPARE(pinch->maximumRotation(), 90.0);
+
+ pinch->setMinimumRotation(-90.0);
+ pinch->setMaximumRotation(45.0);
+
+ QCOMPARE(pinch->minimumRotation(), -90.0);
+ QCOMPARE(pinch->maximumRotation(), 45.0);
+
+ QCOMPARE(rotMinSpy.count(),1);
+ QCOMPARE(rotMaxSpy.count(),1);
+
+ pinch->setMinimumRotation(-90.0);
+ pinch->setMaximumRotation(45.0);
+
+ QCOMPARE(rotMinSpy.count(),1);
+ QCOMPARE(rotMaxSpy.count(),1);
+}
+
+QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i)
+{
+ QTouchEvent::TouchPoint touchPoint(id);
+ touchPoint.setPos(i->mapFromScene(p));
+ touchPoint.setScreenPos(v->mapToGlobal(p));
+ touchPoint.setScenePos(p);
+ return touchPoint;
+}
+
+void tst_QQuickPinchArea::scale()
+{
+ QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
+ window->setSource(testFileUrl("pinchproperties.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject() != 0);
+ qApp->processEvents();
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QQuickPinch *pinch = pinchArea->pinch();
+ QVERIFY(pinchArea != 0);
+ QVERIFY(pinch != 0);
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root != 0);
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+
+ QPoint p1(80, 80);
+ QPoint p2(100, 100);
+ {
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
+ pinchSequence.press(0, p1, window).commit();
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object. Otherwise if we let it
+ // be destroyed and then start a new sequence, point 0 will default to being
+ // stationary at 0, 0, and PinchArea will filter out that touchpoint because
+ // it is outside its bounds.
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1,window).move(1, p2,window).commit();
+
+ QCOMPARE(root->property("scale").toReal(), 1.0);
+ QVERIFY(root->property("pinchActive").toBool());
+
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1,window).move(1, p2,window).commit();
+
+ QCOMPARE(root->property("scale").toReal(), 1.5);
+ QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50
+ QCOMPARE(blackRect->scale(), 1.5);
+ }
+
+ // scale beyond bound
+ p1 -= QPoint(50,50);
+ p2 += QPoint(50,50);
+ {
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ QCOMPARE(blackRect->scale(), 2.0);
+ pinchSequence.release(0, p1, window).release(1, p2, window).commit();
+ }
+ QVERIFY(!root->property("pinchActive").toBool());
+}
+
+void tst_QQuickPinchArea::pan()
+{
+ QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
+ window->setSource(testFileUrl("pinchproperties.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject() != 0);
+ qApp->processEvents();
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QQuickPinch *pinch = pinchArea->pinch();
+ QVERIFY(pinchArea != 0);
+ QVERIFY(pinch != 0);
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root != 0);
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+
+ QPoint p1(80, 80);
+ QPoint p2(100, 100);
+ {
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
+ pinchSequence.press(0, p1, window).commit();
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object.
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ p1 += QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1,window).move(1, p2,window).commit();
+
+ QCOMPARE(root->property("scale").toReal(), 1.0);
+ QVERIFY(root->property("pinchActive").toBool());
+
+ p1 += QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1,window).move(1, p2,window).commit();
+ }
+
+ QCOMPARE(root->property("center").toPointF(), QPointF(60, 60)); // blackrect is at 50,50
+ QCOMPARE(blackRect->x(), 60.0);
+ QCOMPARE(blackRect->y(), 60.0);
+
+ // pan x beyond bound
+ p1 += QPoint(100,100);
+ p2 += QPoint(100,100);
+ QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
+
+ QCOMPARE(blackRect->x(), 140.0);
+ QCOMPARE(blackRect->y(), 160.0);
+
+ QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
+ QVERIFY(!root->property("pinchActive").toBool());
+}
+
+// test pinch, release one point, touch again to continue pinch
+void tst_QQuickPinchArea::retouch()
+{
+ QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
+ window->setSource(testFileUrl("pinchproperties.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject() != 0);
+ qApp->processEvents();
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QQuickPinch *pinch = pinchArea->pinch();
+ QVERIFY(pinchArea != 0);
+ QVERIFY(pinch != 0);
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root != 0);
+
+ QSignalSpy startedSpy(pinchArea, SIGNAL(pinchStarted(QQuickPinchEvent *)));
+ QSignalSpy finishedSpy(pinchArea, SIGNAL(pinchFinished(QQuickPinchEvent *)));
+
+ // target
+ QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+
+ QPoint p1(80, 80);
+ QPoint p2(100, 100);
+ {
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
+ pinchSequence.press(0, p1, window).commit();
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object.
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1,window).move(1, p2,window).commit();
+
+ QCOMPARE(root->property("scale").toReal(), 1.0);
+ QVERIFY(root->property("pinchActive").toBool());
+
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1,window).move(1, p2,window).commit();
+
+ QCOMPARE(startedSpy.count(), 1);
+
+ QCOMPARE(root->property("scale").toReal(), 1.5);
+ QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50
+ QCOMPARE(blackRect->scale(), 1.5);
+
+ QCOMPARE(window->rootObject()->property("pointCount").toInt(), 2);
+
+ QCOMPARE(startedSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 0);
+
+ // Hold down the first finger but release the second one
+ pinchSequence.stationary(0).release(1, p2, window).commit();
+
+ QCOMPARE(startedSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 0);
+
+ QCOMPARE(window->rootObject()->property("pointCount").toInt(), 1);
+
+ // Keep holding down the first finger and re-touch the second one, then move them both
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+
+ // Lifting and retouching results in onPinchStarted being called again
+ QCOMPARE(startedSpy.count(), 2);
+ QCOMPARE(finishedSpy.count(), 0);
+
+ QCOMPARE(window->rootObject()->property("pointCount").toInt(), 2);
+
+ pinchSequence.release(0, p1, window).release(1, p2, window).commit();
+
+ QVERIFY(!root->property("pinchActive").toBool());
+ QCOMPARE(startedSpy.count(), 2);
+ QCOMPARE(finishedSpy.count(), 1);
+ }
+}
+
+void tst_QQuickPinchArea::transformedPinchArea_data()
+{
+ QTest::addColumn<QPoint>("p1");
+ QTest::addColumn<QPoint>("p2");
+ QTest::addColumn<bool>("shouldPinch");
+
+ QTest::newRow("checking inner pinch 1")
+ << QPoint(200, 140) << QPoint(200, 260) << true;
+
+ QTest::newRow("checking inner pinch 2")
+ << QPoint(140, 200) << QPoint(200, 140) << true;
+
+ QTest::newRow("checking inner pinch 3")
+ << QPoint(140, 200) << QPoint(260, 200) << true;
+
+ QTest::newRow("checking outer pinch 1")
+ << QPoint(140, 140) << QPoint(260, 260) << false;
+
+ QTest::newRow("checking outer pinch 2")
+ << QPoint(140, 140) << QPoint(200, 200) << false;
+
+ QTest::newRow("checking outer pinch 3")
+ << QPoint(140, 260) << QPoint(260, 260) << false;
+}
+
+void tst_QQuickPinchArea::transformedPinchArea()
+{
+ QFETCH(QPoint, p1);
+ QFETCH(QPoint, p2);
+ QFETCH(bool, shouldPinch);
+
+ QQuickView *view = createView();
+ QScopedPointer<QQuickView> scope(view);
+ view->setSource(testFileUrl("transformedPinchArea.qml"));
+ view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view));
+ QVERIFY(view->rootObject() != 0);
+ qApp->processEvents();
+
+ QQuickPinchArea *pinchArea = view->rootObject()->findChild<QQuickPinchArea*>("pinchArea");
+ QVERIFY(pinchArea != 0);
+
+ const int threshold = qApp->styleHints()->startDragDistance();
+
+ {
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(view, device);
+ // start pinch
+ pinchSequence.press(0, p1, view).commit();
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object.
+ pinchSequence.stationary(0).press(1, p2, view).commit();
+ pinchSequence.stationary(0).move(1, p2 + QPoint(threshold * 2, 0), view).commit();
+ QCOMPARE(pinchArea->property("pinching").toBool(), shouldPinch);
+
+ // release pinch
+ pinchSequence.release(0, p1, view).release(1, p2, view).commit();
+ QCOMPARE(pinchArea->property("pinching").toBool(), false);
+ }
+}
+
+QQuickView *tst_QQuickPinchArea::createView()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ return window;
+}
+
+QTEST_MAIN(tst_QQuickPinchArea)
+
+#include "tst_qquickpincharea.moc"
diff --git a/tests/auto/quick/qquickpixmapcache/data/dataLeak.qml b/tests/auto/quick/qquickpixmapcache/data/dataLeak.qml
new file mode 100644
index 0000000000..724ce5d816
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/dataLeak.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 800
+ height: 800
+
+ Image {
+ id: i1
+ source: "exists1.png";
+ anchors.top: parent.top;
+ }
+ Image {
+ id: i2
+ source: "exists2.png"
+ anchors.top: i1.bottom;
+ }
+}
diff --git a/tests/auto/quick/qquickpixmapcache/data/exists.png b/tests/auto/quick/qquickpixmapcache/data/exists.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/exists.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/exists1.png b/tests/auto/quick/qquickpixmapcache/data/exists1.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/exists1.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/exists2.png b/tests/auto/quick/qquickpixmapcache/data/exists2.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/exists2.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists.png b/tests/auto/quick/qquickpixmapcache/data/http/exists.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists1.png b/tests/auto/quick/qquickpixmapcache/data/http/exists1.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists1.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists2.png b/tests/auto/quick/qquickpixmapcache/data/http/exists2.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists2.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists3.png b/tests/auto/quick/qquickpixmapcache/data/http/exists3.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists3.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists4.png b/tests/auto/quick/qquickpixmapcache/data/http/exists4.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists4.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists5.png b/tests/auto/quick/qquickpixmapcache/data/http/exists5.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists5.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists6.png b/tests/auto/quick/qquickpixmapcache/data/http/exists6.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists6.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists7.png b/tests/auto/quick/qquickpixmapcache/data/http/exists7.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists7.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/http/exists8.png b/tests/auto/quick/qquickpixmapcache/data/http/exists8.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/http/exists8.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/data/massive.png b/tests/auto/quick/qquickpixmapcache/data/massive.png
new file mode 100644
index 0000000000..bc6cc9e6ca
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/data/massive.png
Binary files differ
diff --git a/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro
new file mode 100644
index 0000000000..62678dc660
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_qquickpixmapcache
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickpixmapcache.cpp \
+ ../../shared/testhttpserver.cpp
+HEADERS += ../../shared/testhttpserver.h
+INCLUDEPATH += ../../shared/
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
+
+QT += core-private gui-private qml-private quick-private network testlib concurrent
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp
new file mode 100644
index 0000000000..75bd468aef
--- /dev/null
+++ b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp
@@ -0,0 +1,531 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtQuick/private/qquickpixmapcache_p.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQuick/qquickimageprovider.h>
+#include <QNetworkReply>
+#include "../../shared/util.h"
+#include "testhttpserver.h"
+#include <QtNetwork/QNetworkConfigurationManager>
+
+#ifndef QT_NO_CONCURRENT
+#include <qtconcurrentrun.h>
+#include <qfuture.h>
+#endif
+
+#define PIXMAP_DATA_LEAK_TEST 0
+
+class tst_qquickpixmapcache : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickpixmapcache() : server(14452) {}
+
+private slots:
+ void initTestCase();
+ void single();
+ void single_data();
+ void parallel();
+ void parallel_data();
+ void massive();
+ void cancelcrash();
+ void shrinkcache();
+#ifndef QT_NO_CONCURRENT
+ void networkCrash();
+#endif
+ void lockingCrash();
+ void uncached();
+#if PIXMAP_DATA_LEAK_TEST
+ void dataLeak();
+#endif
+private:
+ QQmlEngine engine;
+ TestHTTPServer server;
+};
+
+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_qquickpixmapcache::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+
+ // This avoids a race condition/deadlock bug in network config
+ // manager when it is accessed by the HTTP server thread before
+ // anything else. Bug report can be found at:
+ // https://bugreports.qt-project.org/browse/QTBUG-26355
+ QNetworkConfigurationManager cm;
+ cm.updateConfigurations();
+
+ server.serveDirectory(testFile("http"));
+}
+
+void tst_qquickpixmapcache::single_data()
+{
+ // Note, since QQuickPixmapCache is shared, tests affect each other!
+ // so use different files fore all test functions.
+
+ QTest::addColumn<QUrl>("target");
+ QTest::addColumn<bool>("incache");
+ QTest::addColumn<bool>("exists");
+ QTest::addColumn<bool>("neterror");
+
+ // File URLs are optimized
+ QTest::newRow("local") << testFileUrl("exists.png") << localfile_optimized << true << false;
+ QTest::newRow("local") << testFileUrl("notexists.png") << localfile_optimized << false << false;
+ QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/exists.png") << false << true << false;
+ QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/notexists.png") << false << false << true;
+}
+
+void tst_qquickpixmapcache::single()
+{
+ QFETCH(QUrl, target);
+ QFETCH(bool, incache);
+ QFETCH(bool, exists);
+ QFETCH(bool, neterror);
+
+ QString expectedError;
+ if (neterror) {
+ expectedError = "Error downloading " + target.toString() + " - server replied: Not found";
+ } else if (!exists) {
+ expectedError = "Cannot open: " + target.toString();
+ }
+
+ QQuickPixmap pixmap;
+ QVERIFY(pixmap.width() <= 0); // Check Qt assumption
+
+ pixmap.load(&engine, target);
+
+ if (incache) {
+ QCOMPARE(pixmap.error(), expectedError);
+ if (exists) {
+ QVERIFY(pixmap.status() == QQuickPixmap::Ready);
+ QVERIFY(pixmap.width() > 0);
+ } else {
+ QVERIFY(pixmap.status() == QQuickPixmap::Error);
+ QVERIFY(pixmap.width() <= 0);
+ }
+ } else {
+ QVERIFY(pixmap.width() <= 0);
+
+ Slotter getter;
+ pixmap.connectFinished(&getter, SLOT(got()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(getter.gotslot);
+ if (exists) {
+ QVERIFY(pixmap.status() == QQuickPixmap::Ready);
+ QVERIFY(pixmap.width() > 0);
+ } else {
+ QVERIFY(pixmap.status() == QQuickPixmap::Error);
+ QVERIFY(pixmap.width() <= 0);
+ }
+ QCOMPARE(pixmap.error(), expectedError);
+ }
+}
+
+void tst_qquickpixmapcache::parallel_data()
+{
+ // Note, since QQuickPixmapCache 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::newRow("local")
+ << testFileUrl("exists1.png")
+ << testFileUrl("exists2.png")
+ << (localfile_optimized ? 2 : 0)
+ << -1;
+
+ QTest::newRow("remote")
+ << QUrl("http://127.0.0.1:14452/exists2.png")
+ << QUrl("http://127.0.0.1:14452/exists3.png")
+ << 0
+ << -1;
+
+ QTest::newRow("remoteagain")
+ << QUrl("http://127.0.0.1:14452/exists2.png")
+ << QUrl("http://127.0.0.1:14452/exists3.png")
+ << 2
+ << -1;
+
+ QTest::newRow("remotecopy")
+ << QUrl("http://127.0.0.1:14452/exists4.png")
+ << QUrl("http://127.0.0.1:14452/exists4.png")
+ << 0
+ << -1;
+
+ QTest::newRow("remotecopycancel")
+ << QUrl("http://127.0.0.1:14452/exists5.png")
+ << QUrl("http://127.0.0.1:14452/exists5.png")
+ << 0
+ << 0;
+}
+
+void tst_qquickpixmapcache::parallel()
+{
+ QFETCH(QUrl, target1);
+ QFETCH(QUrl, target2);
+ QFETCH(int, incache);
+ QFETCH(int, cancel);
+
+ QList<QUrl> targets;
+ targets << target1 << target2;
+
+ QList<QQuickPixmap *> pixmaps;
+ QList<bool> pending;
+ QList<Slotter*> getters;
+
+ for (int i=0; i<targets.count(); ++i) {
+ QUrl target = targets.at(i);
+ QQuickPixmap *pixmap = new QQuickPixmap;
+
+ pixmap->load(&engine, target);
+
+ QVERIFY(pixmap->status() != QQuickPixmap::Error);
+ pixmaps.append(pixmap);
+ if (pixmap->isReady()) {
+ QVERIFY(pixmap->width() > 0);
+ getters.append(0);
+ pending.append(false);
+ } else {
+ QVERIFY(pixmap->width() <= 0);
+ getters.append(new Slotter);
+ pixmap->connectFinished(getters[i], SLOT(got()));
+ pending.append(true);
+ }
+ }
+
+ QCOMPARE(incache+slotters, targets.count());
+
+ if (cancel >= 0) {
+ pixmaps.at(cancel)->clear(getters[cancel]);
+ slotters--;
+ }
+
+ if (slotters) {
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ }
+
+ for (int i=0; i<targets.count(); ++i) {
+ QQuickPixmap *pixmap = pixmaps[i];
+
+ if (i == cancel) {
+ QVERIFY(!getters[i]->gotslot);
+ } else {
+ if (pending[i])
+ QVERIFY(getters[i]->gotslot);
+
+ QVERIFY(pixmap->isReady());
+ QVERIFY(pixmap->width() > 0);
+ delete getters[i];
+ }
+ }
+
+ qDeleteAll(pixmaps);
+}
+
+void tst_qquickpixmapcache::massive()
+{
+ QQmlEngine engine;
+ QUrl url = testFileUrl("massive.png");
+
+ // Confirm that massive images remain in the cache while they are
+ // in use by the application.
+ {
+ qint64 cachekey = 0;
+ QQuickPixmap p(&engine, url);
+ QVERIFY(p.isReady());
+ QVERIFY(p.image().size() == QSize(10000, 1000));
+ cachekey = p.image().cacheKey();
+
+ QQuickPixmap p2(&engine, url);
+ QVERIFY(p2.isReady());
+ QVERIFY(p2.image().size() == QSize(10000, 1000));
+
+ QVERIFY(p2.image().cacheKey() == cachekey);
+ }
+
+ // Confirm that massive images are removed from the cache when
+ // they become unused
+ {
+ qint64 cachekey = 0;
+ {
+ QQuickPixmap p(&engine, url);
+ QVERIFY(p.isReady());
+ QVERIFY(p.image().size() == QSize(10000, 1000));
+ cachekey = p.image().cacheKey();
+ }
+
+ QQuickPixmap p2(&engine, url);
+ QVERIFY(p2.isReady());
+ QVERIFY(p2.image().size() == QSize(10000, 1000));
+
+ QVERIFY(p2.image().cacheKey() != cachekey);
+ }
+}
+
+// QTBUG-12729
+void tst_qquickpixmapcache::cancelcrash()
+{
+ QUrl url("http://127.0.0.1:14452/cancelcrash_notexist.png");
+ for (int ii = 0; ii < 1000; ++ii) {
+ QQuickPixmap pix(&engine, url);
+ }
+}
+
+class MyPixmapProvider : public QQuickImageProvider
+{
+public:
+ MyPixmapProvider()
+ : QQuickImageProvider(Pixmap) {}
+
+ virtual QPixmap requestPixmap(const QString &d, QSize *, const QSize &) {
+ Q_UNUSED(d)
+ QPixmap pix(800, 600);
+ pix.fill(fillColor);
+ return pix;
+ }
+
+ static QRgb fillColor;
+};
+
+QRgb MyPixmapProvider::fillColor = qRgb(255, 0, 0);
+
+// QTBUG-13345
+void tst_qquickpixmapcache::shrinkcache()
+{
+ QQmlEngine engine;
+ engine.addImageProvider(QLatin1String("mypixmaps"), new MyPixmapProvider);
+
+ for (int ii = 0; ii < 4000; ++ii) {
+ QUrl url("image://mypixmaps/" + QString::number(ii));
+ QQuickPixmap p(&engine, url);
+ }
+}
+
+#ifndef QT_NO_CONCURRENT
+
+void createNetworkServer()
+{
+ QEventLoop eventLoop;
+ TestHTTPServer server(14453);
+ server.serveDirectory(QQmlDataTest::instance()->testFile("http"));
+ QTimer::singleShot(100, &eventLoop, SLOT(quit()));
+ eventLoop.exec();
+}
+
+#ifndef QT_NO_CONCURRENT
+// QT-3957
+void tst_qquickpixmapcache::networkCrash()
+{
+ QFuture<void> future = QtConcurrent::run(createNetworkServer);
+ QQmlEngine engine;
+ for (int ii = 0; ii < 100 ; ++ii) {
+ QQuickPixmap* pixmap = new QQuickPixmap;
+ pixmap->load(&engine, QUrl(QString("http://127.0.0.1:14453/exists.png")));
+ QTest::qSleep(1);
+ pixmap->clear();
+ delete pixmap;
+ }
+ future.cancel();
+}
+#endif
+
+#endif
+
+// QTBUG-22125
+void tst_qquickpixmapcache::lockingCrash()
+{
+ TestHTTPServer server(14453);
+ server.serveDirectory(testFile("http"), TestHTTPServer::Delay);
+
+ {
+ QQuickPixmap* p = new QQuickPixmap;
+ {
+ QQmlEngine e;
+ p->load(&e, QUrl(QString("http://127.0.0.1:14453/exists6.png")));
+ }
+ p->clear();
+ QVERIFY(p->isNull());
+ delete p;
+ server.sendDelayedItem();
+ }
+}
+
+void tst_qquickpixmapcache::uncached()
+{
+ QQmlEngine engine;
+ engine.addImageProvider(QLatin1String("mypixmaps"), new MyPixmapProvider);
+
+ QUrl url("image://mypixmaps/mypix");
+ {
+ QQuickPixmap p;
+ p.load(&engine, url, 0);
+ QImage img = p.image();
+ QCOMPARE(img.pixel(0,0), qRgb(255, 0, 0));
+ }
+
+ // uncached, so we will get a different colored image
+ MyPixmapProvider::fillColor = qRgb(0, 255, 0);
+ {
+ QQuickPixmap p;
+ p.load(&engine, url, 0);
+ QImage img = p.image();
+ QCOMPARE(img.pixel(0,0), qRgb(0, 255, 0));
+ }
+
+ // Load the image with cache enabled
+ MyPixmapProvider::fillColor = qRgb(0, 0, 255);
+ {
+ QQuickPixmap p;
+ p.load(&engine, url, QQuickPixmap::Cache);
+ QImage img = p.image();
+ QCOMPARE(img.pixel(0,0), qRgb(0, 0, 255));
+ }
+
+ // We should not get the cached version if we request uncached
+ MyPixmapProvider::fillColor = qRgb(255, 0, 255);
+ {
+ QQuickPixmap p;
+ p.load(&engine, url, 0);
+ QImage img = p.image();
+ QCOMPARE(img.pixel(0,0), qRgb(255, 0, 255));
+ }
+
+ // If we again load the image with cache enabled, we should get the previously cached version
+ MyPixmapProvider::fillColor = qRgb(0, 255, 255);
+ {
+ QQuickPixmap p;
+ p.load(&engine, url, QQuickPixmap::Cache);
+ QImage img = p.image();
+ QCOMPARE(img.pixel(0,0), qRgb(0, 0, 255));
+ }
+}
+
+
+#if PIXMAP_DATA_LEAK_TEST
+// This test should not be enabled by default as it
+// produces spurious output in the expected case.
+#include <QtQuick/QQuickView>
+class DataLeakView : public QQuickView
+{
+ Q_OBJECT
+
+public:
+ explicit DataLeakView() : QQuickView()
+ {
+ setSource(testFileUrl("dataLeak.qml"));
+ }
+
+ void showFor2Seconds()
+ {
+ showFullScreen();
+ QTimer::singleShot(2000, this, SIGNAL(ready()));
+ }
+
+signals:
+ void ready();
+};
+
+// QTBUG-22742
+Q_GLOBAL_STATIC(QQuickPixmap, dataLeakPixmap)
+void tst_qquickpixmapcache::dataLeak()
+{
+ // Should not leak cached QQuickPixmapData.
+ // Unfortunately, since the QQuickPixmapStore
+ // is a global static, and it releases the cache
+ // entries on dtor (application exit), we must use
+ // valgrind to determine whether it leaks or not.
+ QQuickPixmap *p1 = new QQuickPixmap;
+ QQuickPixmap *p2 = new QQuickPixmap;
+ {
+ QScopedPointer<DataLeakView> test(new DataLeakView);
+ test->showFor2Seconds();
+ dataLeakPixmap()->load(test->engine(), testFileUrl("exists.png"));
+ p1->load(test->engine(), testFileUrl("exists.png"));
+ p2->load(test->engine(), testFileUrl("exists2.png"));
+ QTest::qWait(2005); // 2 seconds + a few more millis.
+ }
+
+ // When the (global static) dataLeakPixmap is deleted, it
+ // shouldn't attempt to dereference a QQuickPixmapData
+ // which has been deleted by the QQuickPixmapStore
+ // destructor.
+}
+#endif
+#undef PIXMAP_DATA_LEAK_TEST
+
+QTEST_MAIN(tst_qquickpixmapcache)
+
+#include "tst_qquickpixmapcache.moc"
diff --git a/tests/auto/quick/qquickpositioners/data/allInvisible.qml b/tests/auto/quick/qquickpositioners/data/allInvisible.qml
new file mode 100644
index 0000000000..5894171434
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/allInvisible.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item{
+ width: 400
+ height: 400
+ Column{
+ spacing: 20
+ objectName: "column"
+ Item{
+ width: 0
+ height: 20
+ visible: false
+ }
+ Item{
+ width: 20
+ height: 0
+ visible: false
+ }
+ Item{
+ width: 20
+ height: 20
+ visible: false
+ }
+ }
+ Row{
+ spacing: 20
+ objectName: "row"
+ Item{
+ width: 0
+ height: 20
+ visible: false
+ }
+ Item{
+ width: 20
+ height: 0
+ visible: false
+ }
+ Item{
+ width: 20
+ height: 20
+ visible: false
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/attachedproperties-column.qml b/tests/auto/quick/qquickpositioners/data/attachedproperties-column.qml
new file mode 100644
index 0000000000..4c667aa205
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/attachedproperties-column.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 100
+ height: 200
+
+ Column {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/attachedproperties-dynamic.qml b/tests/auto/quick/qquickpositioners/data/attachedproperties-dynamic.qml
new file mode 100644
index 0000000000..894749dc16
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/attachedproperties-dynamic.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Rectangle
+{
+ width: 300
+ height: 100
+
+ Row {
+ id: pos
+ objectName: "pos"
+ anchors.fill: parent
+
+ Rectangle {
+ objectName: "rect0"
+ width: 100
+ height: 100
+ color: 'red'
+ property int index: Positioner.index
+ property bool firstItem: Positioner.isFirstItem
+ property bool lastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ objectName: "rect1"
+ width: 100
+ height: 100
+ color: 'green'
+ property int index: Positioner.index
+ property bool firstItem: Positioner.isFirstItem
+ property bool lastItem: Positioner.isLastItem
+ }
+
+ property QtObject subRect;
+
+ function createSubRect() {
+ var component = Qt.createComponent("rectangleComponent.qml");
+ subRect = component.createObject(pos, {});
+ }
+
+ function destroySubRect() {
+ subRect.destroy();
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/attachedproperties-flow.qml b/tests/auto/quick/qquickpositioners/data/attachedproperties-flow.qml
new file mode 100644
index 0000000000..e7f9a63e2a
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/attachedproperties-flow.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Flow {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/attachedproperties-grid.qml b/tests/auto/quick/qquickpositioners/data/attachedproperties-grid.qml
new file mode 100644
index 0000000000..2094309b9f
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/attachedproperties-grid.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Grid {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/attachedproperties-row.qml b/tests/auto/quick/qquickpositioners/data/attachedproperties-row.qml
new file mode 100644
index 0000000000..212a26b431
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/attachedproperties-row.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Row {
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'red'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: 'green'
+ property int posIndex: Positioner.index
+ property bool isFirstItem: Positioner.isFirstItem
+ property bool isLastItem: Positioner.isLastItem
+ }
+
+ Rectangle {
+ width: 100
+ height: 100
+ color: 'blue'
+ visible: false
+ }
+
+ Rectangle {
+ objectName: "yellowRect"
+ width: 100
+ height: 100
+ color: 'yellow'
+
+ property int posIndex: -1
+ property bool isFirstItem: false
+ property bool isLastItem: false
+
+ function onDemandPositioner() {
+ posIndex = Positioner.index;
+ isFirstItem = Positioner.isFirstItem
+ isLastItem = Positioner.isLastItem
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/flow-testimplicitsize.qml b/tests/auto/quick/qquickpositioners/data/flow-testimplicitsize.qml
new file mode 100644
index 0000000000..c32b78676c
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/flow-testimplicitsize.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300; height: 200;
+
+ property int flowLayout: 1
+
+ Flow {
+ objectName: "flow"
+ layoutDirection: (flowLayout == 2) ? Qt.RightToLeft : Qt.LeftToRight
+ flow: (flowLayout == 1) ? Flow.TopToBottom : Flow.LeftToRight;
+
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+ Rectangle { color: "red"; width: 100; height: 50 }
+ Rectangle { color: "blue"; width: 100; height: 50 }
+ }
+}
+
diff --git a/tests/auto/quick/qquickpositioners/data/flowtest-toptobottom.qml b/tests/auto/quick/qquickpositioners/data/flowtest-toptobottom.qml
new file mode 100644
index 0000000000..a7d3ee13c7
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/flowtest-toptobottom.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ height: 90
+ width: 480
+ property bool testRightToLeft: false
+
+ Flow {
+ objectName: "flow"
+ height: parent.height
+ layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ flow: Flow.TopToBottom
+ 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/quick/qquickpositioners/data/flowtest.qml b/tests/auto/quick/qquickpositioners/data/flowtest.qml
new file mode 100644
index 0000000000..40b042dd79
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/flowtest.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Item {
+ width: 90
+ height: 480
+ property bool testRightToLeft: false
+
+ Flow {
+ objectName: "flow"
+ width: parent.width
+ layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ 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/quick/qquickpositioners/data/grid-animated.qml b/tests/auto/quick/qquickpositioners/data/grid-animated.qml
new file mode 100644
index 0000000000..8a5e43834e
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/grid-animated.qml
@@ -0,0 +1,69 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ property bool testRightToLeft: true
+
+ Grid {
+ objectName: "grid"
+ columns: 3
+ layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ populate: Transition {
+ NumberAnimation {
+ properties: "x,y";
+ }
+ }
+ add: Transition {
+ NumberAnimation {
+ properties: "x,y";
+ }
+ }
+ move: Transition {
+ NumberAnimation {
+ properties: "x,y";
+ }
+ }
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ x: -100
+ y: -100
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ x: -100
+ y: -100
+ visible: false
+ color: "green"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ color: "blue"
+ x: -100
+ y: -100
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "four"
+ color: "cyan"
+ x: -100
+ y: -100
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "five"
+ color: "magenta"
+ x: -100
+ y: -100
+ width: 50
+ height: 50
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/grid-row-column-spacing.qml b/tests/auto/quick/qquickpositioners/data/grid-row-column-spacing.qml
new file mode 100644
index 0000000000..49bbd337e7
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/grid-row-column-spacing.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Grid {
+ objectName: "grid"
+ columns: 3
+ spacing: 4
+ rowSpacing: 7
+ columnSpacing: 11
+ 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/quick/qquickpositioners/data/grid-spacing.qml b/tests/auto/quick/qquickpositioners/data/grid-spacing.qml
new file mode 100644
index 0000000000..535a39037f
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/grid-spacing.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Grid {
+ objectName: "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/quick/qquickpositioners/data/grid-toptobottom.qml b/tests/auto/quick/qquickpositioners/data/grid-toptobottom.qml
new file mode 100644
index 0000000000..45559aab5d
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/grid-toptobottom.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Grid {
+ objectName: "grid"
+ rows: 3
+ flow: Grid.TopToBottom
+ 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/quick/qquickpositioners/data/gridtest.qml b/tests/auto/quick/qquickpositioners/data/gridtest.qml
new file mode 100644
index 0000000000..fbe0b22b15
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/gridtest.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.1
+
+Item {
+ width: 640
+ height: 480
+ property bool testRightToLeft: false
+ property int testHAlignment: Grid.AlignLeft;
+ property int testVAlignment: Grid.AlignTop;
+ Grid {
+ layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ horizontalItemAlignment: testHAlignment
+ verticalItemAlignment: testVAlignment
+ objectName: "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: 30
+ 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/quick/qquickpositioners/data/gridzerocolumns.qml b/tests/auto/quick/qquickpositioners/data/gridzerocolumns.qml
new file mode 100644
index 0000000000..a252f279c3
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/gridzerocolumns.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Grid {
+ objectName: "grid"
+ columns: 0
+ 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/quick/qquickpositioners/data/horizontal-animated-disabled.qml b/tests/auto/quick/qquickpositioners/data/horizontal-animated-disabled.qml
new file mode 100644
index 0000000000..8723ffc78f
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/horizontal-animated-disabled.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+
+ Row {
+ objectName: "row"
+ add: Transition {
+ enabled: false
+ NumberAnimation { properties: "x" }
+ }
+ move: Transition {
+ enabled: false
+ NumberAnimation { properties: "x" }
+ }
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ x: -100;
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "blue"
+ x: -100;
+ visible: false
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ x: -100;
+ color: "green"
+ width: 50
+ height: 50
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/horizontal-animated.qml b/tests/auto/quick/qquickpositioners/data/horizontal-animated.qml
new file mode 100644
index 0000000000..b68367022c
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/horizontal-animated.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ property bool testRightToLeft: false
+ property bool testEnabled: false
+
+ Row {
+ objectName: "row"
+ layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ populate: Transition {
+ enabled: testEnabled ? false : true
+ NumberAnimation {
+ properties: "x";
+ }
+ }
+ add: Transition {
+ enabled: testEnabled ? false : true
+ NumberAnimation {
+ properties: "x";
+ }
+ }
+ move: Transition {
+ enabled: testEnabled ? false : true
+ NumberAnimation {
+ properties: "x";
+ }
+ }
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ x: -100;
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "blue"
+ x: -100;
+ visible: false
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ x: -100;
+ color: "green"
+ width: 50
+ height: 50
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/horizontal-spacing.qml b/tests/auto/quick/qquickpositioners/data/horizontal-spacing.qml
new file mode 100644
index 0000000000..c6ff75ac6b
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/horizontal-spacing.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ property bool testRightToLeft: false
+
+ Row {
+ objectName: "row"
+ spacing: 10
+ layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ 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/quick/qquickpositioners/data/horizontal.qml b/tests/auto/quick/qquickpositioners/data/horizontal.qml
new file mode 100644
index 0000000000..235ee78c9b
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/horizontal.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ property bool testRightToLeft: false
+ Row {
+ objectName: "row"
+ layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight
+ 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/quick/qquickpositioners/data/propertychangestest.qml b/tests/auto/quick/qquickpositioners/data/propertychangestest.qml
new file mode 100644
index 0000000000..c9fd62b012
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/propertychangestest.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Grid {
+ id: myGrid
+
+ width: 270
+ height: 270
+ x: 3
+ y: 3
+ columns: 4
+ spacing: 3
+
+ add: columnTransition
+ move: columnTransition
+
+ Repeater {
+ model: 20
+ Rectangle { color: "black"; width: 50; height: 50 }
+ }
+
+ data: [
+ Transition {
+ id: rowTransition
+ objectName: "rowTransition"
+ NumberAnimation {
+ properties: "x,y";
+ easing.type: "OutInCubic"
+ }
+ },
+ Transition {
+ id: columnTransition
+ objectName: "columnTransition"
+ NumberAnimation {
+ properties: "x,y";
+ easing.type: "OutInCubic"
+ }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickpositioners/data/rectangleComponent.qml b/tests/auto/quick/qquickpositioners/data/rectangleComponent.qml
new file mode 100644
index 0000000000..de1bb99593
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/rectangleComponent.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0;
+
+Rectangle {
+ objectName: "rect2"
+ color: "blue"
+ width: 100
+ height: 100
+ property int index: Positioner.index
+ property bool firstItem: Positioner.isFirstItem
+ property bool lastItem: Positioner.isLastItem
+}
diff --git a/tests/auto/quick/qquickpositioners/data/repeatertest.qml b/tests/auto/quick/qquickpositioners/data/repeatertest.qml
new file mode 100644
index 0000000000..d90e1cf160
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/repeatertest.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Row {
+ Repeater{ model: 3;
+ delegate: Component {
+ Rectangle {
+ color: "red"
+ width: 50
+ height: 50
+ z: {if(index == 0){2;}else if(index == 1){1;} else{3;}}
+ objectName: {if(index == 0){"one";}else if(index == 1){"two";} else{"three";}}
+ }
+ }
+ }
+ }
+
+ //This crashed once (QTBUG-16959) because the repeater ended up on the end of the list
+ //If this grid just instantiates without crashing, then it has not regressed.
+ Grid {
+ id: grid
+ rows: 2
+ flow: Grid.TopToBottom
+
+ Repeater {
+ model: 13
+ Rectangle {
+ color: "goldenrod"
+ width: 100
+ height: 100
+ radius: 10
+ border.width: 1
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/transitions.qml b/tests/auto/quick/qquickpositioners/data/transitions.qml
new file mode 100644
index 0000000000..a1f27bb06e
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/transitions.qml
@@ -0,0 +1,235 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 500
+ height: 500
+
+ property int duration: 50
+
+ property real incrementalSize: 5
+
+ property int populateTransitionsDone
+ property int addTransitionsDone
+ property int displaceTransitionsDone
+
+ property var targetTrans_items: new Object()
+ property var targetTrans_targetIndexes: new Array()
+ property var targetTrans_targetItems: new Array()
+
+ property var displacedTrans_items: new Object()
+ property var displacedTrans_targetIndexes: new Array()
+ property var displacedTrans_targetItems: new Array()
+
+ // for QQmlListProperty types
+ function copyList(propList) {
+ var temp = new Array()
+ for (var i=0; i<propList.length; i++)
+ temp.push(propList[i])
+ return temp
+ }
+
+ function checkPos(x, y, name) {
+ if (Qt.point(x, y) == targetItems_transitionFrom)
+ model_targetItems_transitionFrom.addItem(name, "")
+ if (Qt.point(x, y) == displacedItems_transitionVia)
+ model_displacedItems_transitionVia.addItem(name, "")
+ }
+
+ Component.onCompleted: {
+ if (dynamicallyPopulate) {
+ for (var i=0; i<30; i++)
+ testModel.addItem("item " + i, "")
+ }
+ }
+
+ Transition {
+ id: populateTransition
+ enabled: usePopulateTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ root.targetTrans_items[populateTransition.ViewTransition.item.nameData] = populateTransition.ViewTransition.index
+ root.targetTrans_targetIndexes.push(populateTransition.ViewTransition.targetIndexes)
+ root.targetTrans_targetItems.push(root.copyList(populateTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: targetItems_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: targetItems_transitionFrom.y; duration: root.duration }
+ }
+
+ ScriptAction { script: root.populateTransitionsDone += 1 }
+ }
+ }
+
+ Transition {
+ id: addTransition
+ enabled: enableAddTransition
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ root.targetTrans_items[addTransition.ViewTransition.item.nameData] = addTransition.ViewTransition.index
+ root.targetTrans_targetIndexes.push(addTransition.ViewTransition.targetIndexes)
+ root.targetTrans_targetItems.push(root.copyList(addTransition.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; from: targetItems_transitionFrom.x; duration: root.duration }
+ NumberAnimation { properties: "y"; from: targetItems_transitionFrom.y; duration: root.duration }
+ }
+
+ ScriptAction { script: root.addTransitionsDone += 1 }
+ }
+ }
+
+ Transition {
+ id: displaced
+
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ root.displacedTrans_items[displaced.ViewTransition.item.nameData] = displaced.ViewTransition.index
+ root.displacedTrans_targetIndexes.push(displaced.ViewTransition.targetIndexes)
+ root.displacedTrans_targetItems.push(root.copyList(displaced.ViewTransition.targetItems))
+ }
+ }
+ ParallelAnimation {
+ NumberAnimation { properties: "x"; duration: root.duration; to: displacedItems_transitionVia.x }
+ NumberAnimation { properties: "y"; duration: root.duration; to: displacedItems_transitionVia.y }
+ }
+ NumberAnimation { properties: "x,y"; duration: root.duration }
+
+ ScriptAction { script: root.displaceTransitionsDone += 1 }
+ }
+
+ }
+
+ Row {
+ objectName: "row"
+
+ property int count: children.length - 1 // omit Repeater
+
+ x: 50; y: 50
+ width: 400; height: 400
+ Repeater {
+ objectName: "repeater"
+ model: testedPositioner == "row" ? testModel : undefined
+ Rectangle {
+ property string nameData: name
+ objectName: "wrapper"
+ width: 30 + index*root.incrementalSize
+ height: 30 + index*root.incrementalSize
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text { objectName: "name"; text: name }
+ Text { text: parent.parent.y }
+ }
+ onXChanged: root.checkPos(x, y, name)
+ onYChanged: root.checkPos(x, y, name)
+ }
+ }
+
+ populate: populateTransition
+ add: addTransition
+ move: displaced
+ }
+
+ Column {
+ objectName: "column"
+
+ property int count: children.length - 1 // omit Repeater
+
+ x: 50; y: 50
+ width: 400; height: 400
+ Repeater {
+ objectName: "repeater"
+ model: testedPositioner == "column" ? testModel : undefined
+ Rectangle {
+ property string nameData: name
+ objectName: "wrapper"
+ width: 30 + index*root.incrementalSize
+ height: 30 + index*root.incrementalSize
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text { objectName: "name"; text: name }
+ Text { text: parent.parent.y }
+ }
+ onXChanged: root.checkPos(x, y, name)
+ onYChanged: root.checkPos(x, y, name)
+ }
+ }
+
+ populate: populateTransition
+ add: addTransition
+ move: displaced
+ }
+
+ Grid {
+ objectName: "grid"
+
+ property int count: children.length - 1 // omit Repeater
+
+ x: 50; y: 50
+ width: 400; height: 400
+ Repeater {
+ objectName: "repeater"
+ model: testedPositioner == "grid" ? testModel : undefined
+ Rectangle {
+ property string nameData: name
+ objectName: "wrapper"
+ width: 30 + index*root.incrementalSize
+ height: 30 + index*root.incrementalSize
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text { objectName: "name"; text: name }
+ Text { text: parent.parent.y }
+ }
+
+ onXChanged: root.checkPos(x, y, name)
+ onYChanged: root.checkPos(x, y, name)
+ }
+ }
+
+ populate: populateTransition
+ add: addTransition
+ move: displaced
+ }
+
+ Flow {
+ objectName: "flow"
+
+ property int count: children.length - 1 // omit Repeater
+
+ x: 50; y: 50
+ width: 400; height: 400
+ Repeater {
+ objectName: "repeater"
+ model: testedPositioner == "flow" ? testModel : undefined
+ Rectangle {
+ property string nameData: name
+ objectName: "wrapper"
+ width: 30 + index*root.incrementalSize
+ height: 30 + index*root.incrementalSize
+ border.width: 1
+ Column {
+ Text { text: index }
+ Text { objectName: "name"; text: name }
+ Text { text: parent.parent.x + " " + parent.parent.y }
+ }
+ onXChanged: root.checkPos(x, y, name)
+ onYChanged: root.checkPos(x, y, name)
+ }
+ }
+
+ populate: populateTransition
+ add: addTransition
+ move: displaced
+ }
+}
+
diff --git a/tests/auto/quick/qquickpositioners/data/vertical-animated.qml b/tests/auto/quick/qquickpositioners/data/vertical-animated.qml
new file mode 100644
index 0000000000..1ea359e26c
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/vertical-animated.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Column {
+ objectName: "column"
+ populate: Transition {
+ NumberAnimation {
+ properties: "y";
+ }
+ }
+ add: Transition {
+ NumberAnimation {
+ properties: "y";
+ }
+ }
+ move: Transition {
+ NumberAnimation {
+ properties: "y";
+ }
+ }
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ y: -100
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "blue"
+ y: -100
+ visible: false
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ color: "red"
+ y: -100
+ width: 50
+ height: 50
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpositioners/data/vertical-spacing.qml b/tests/auto/quick/qquickpositioners/data/vertical-spacing.qml
new file mode 100644
index 0000000000..7087961651
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/vertical-spacing.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Column {
+ objectName: "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/quick/qquickpositioners/data/vertical.qml b/tests/auto/quick/qquickpositioners/data/vertical.qml
new file mode 100644
index 0000000000..0c3a81f008
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/data/vertical.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 480
+ Column {
+ objectName: "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/quick/qquickpositioners/qquickpositioners.pro b/tests/auto/quick/qquickpositioners/qquickpositioners.pro
new file mode 100644
index 0000000000..c625080d7c
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/qquickpositioners.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickpositioners
+SOURCES += tst_qquickpositioners.cpp
+
+include (../shared/util.pri)
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+QT += testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
new file mode 100644
index 0000000000..1f472a3f46
--- /dev/null
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -0,0 +1,2159 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <QtQuick/qquickview.h>
+#include <qqmlengine.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquickpositioners_p.h>
+#include <QtQuick/private/qquicktransition_p.h>
+#include <private/qquickitem_p.h>
+#include <qqmlexpression.h>
+#include "../shared/viewtestutil.h"
+#include "../shared/visualtestutil.h"
+#include "../../shared/util.h"
+
+using namespace QQuickViewTestUtil;
+using namespace QQuickVisualTestUtil;
+
+class tst_qquickpositioners : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickpositioners();
+
+private slots:
+ void test_horizontal();
+ void test_horizontal_rtl();
+ void test_horizontal_spacing();
+ void test_horizontal_spacing_rightToLeft();
+ void test_horizontal_animated();
+ void test_horizontal_animated_rightToLeft();
+ void test_horizontal_animated_disabled();
+ void test_vertical();
+ void test_vertical_spacing();
+ void test_vertical_animated();
+ void test_grid();
+ void test_grid_topToBottom();
+ void test_grid_rightToLeft();
+ void test_grid_spacing();
+ void test_grid_row_column_spacing();
+ void test_grid_animated();
+ void test_grid_animated_rightToLeft();
+ void test_grid_zero_columns();
+ void test_grid_H_alignment();
+ void test_grid_V_alignment();
+ void test_propertychanges();
+ void test_repeater();
+ void test_flow();
+ void test_flow_rightToLeft();
+ void test_flow_topToBottom();
+ void test_flow_resize();
+ void test_flow_resize_rightToLeft();
+ void test_flow_implicit_resize();
+ void test_conflictinganchors();
+ void test_mirroring();
+ void test_allInvisible();
+ void test_attachedproperties();
+ void test_attachedproperties_data();
+ void test_attachedproperties_dynamic();
+
+ void populateTransitions_row();
+ void populateTransitions_row_data();
+ void populateTransitions_column();
+ void populateTransitions_column_data();
+ void populateTransitions_grid();
+ void populateTransitions_grid_data();
+ void populateTransitions_flow();
+ void populateTransitions_flow_data();
+ void addTransitions_row();
+ void addTransitions_row_data();
+ void addTransitions_column();
+ void addTransitions_column_data();
+ void addTransitions_grid();
+ void addTransitions_grid_data();
+ void addTransitions_flow();
+ void addTransitions_flow_data();
+ void moveTransitions_row();
+ void moveTransitions_row_data();
+ void moveTransitions_column();
+ void moveTransitions_column_data();
+ void moveTransitions_grid();
+ void moveTransitions_grid_data();
+ void moveTransitions_flow();
+ void moveTransitions_flow_data();
+
+private:
+ QQuickView *createView(const QString &filename, bool wait=true);
+
+ void populateTransitions(const QString &positionerObjectName);
+ void populateTransitions_data();
+ void addTransitions(const QString &positionerObjectName);
+ void addTransitions_data();
+ void moveTransitions(const QString &positionerObjectName);
+ void moveTransitions_data();
+ void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes);
+ void matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes);
+ void matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems);
+ void checkItemPositions(QQuickItem *positioner, QaimModel *model, qreal incrementalSize);
+};
+
+void tst_qquickpositioners::populateTransitions_row()
+{
+ populateTransitions("row");
+}
+
+void tst_qquickpositioners::populateTransitions_row_data()
+{
+ populateTransitions_data();
+}
+
+void tst_qquickpositioners::populateTransitions_column()
+{
+ populateTransitions("column");
+}
+
+void tst_qquickpositioners::populateTransitions_column_data()
+{
+ populateTransitions_data();
+}
+
+void tst_qquickpositioners::populateTransitions_grid()
+{
+ populateTransitions("grid");
+}
+
+void tst_qquickpositioners::populateTransitions_grid_data()
+{
+ populateTransitions_data();
+}
+
+void tst_qquickpositioners::populateTransitions_flow()
+{
+ populateTransitions("flow");
+}
+
+void tst_qquickpositioners::populateTransitions_flow_data()
+{
+ populateTransitions_data();
+}
+
+void tst_qquickpositioners::addTransitions_row()
+{
+ addTransitions("row");
+}
+
+void tst_qquickpositioners::addTransitions_row_data()
+{
+ addTransitions_data();
+}
+
+void tst_qquickpositioners::addTransitions_column()
+{
+ addTransitions("column");
+}
+
+void tst_qquickpositioners::addTransitions_column_data()
+{
+ addTransitions_data();
+}
+
+void tst_qquickpositioners::addTransitions_grid()
+{
+ addTransitions("grid");
+}
+
+void tst_qquickpositioners::addTransitions_grid_data()
+{
+ // don't use addTransitions_data() because grid displaces items differently
+ // (adding items further down the grid can cause displace transitions at
+ // previous indexes, since grid is auto-resized to tightly fit all of its items)
+
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<int>("insertionIndex");
+ QTest::addColumn<int>("insertionCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ QTest::newRow("add one @ start") << 10 << 0 << 1 << ListRange(0, 9);
+ QTest::newRow("add one @ middle") << 10 << 5 << 1 << ListRange(3, 3) + ListRange(5, 9);
+ QTest::newRow("add one @ end") << 10 << 10 << 1 << ListRange(3, 3) + ListRange(7, 7);
+
+ QTest::newRow("add multiple @ start") << 10 << 0 << 3 << ListRange(0, 9);
+ QTest::newRow("add multiple @ middle") << 10 << 5 << 3 << ListRange(1, 3) + ListRange(5, 9);
+ QTest::newRow("add multiple @ end") << 10 << 10 << 3 << ListRange(1, 3) + ListRange(5, 7) + ListRange(9, 9);
+}
+
+void tst_qquickpositioners::addTransitions_flow()
+{
+ addTransitions("flow");
+}
+
+void tst_qquickpositioners::addTransitions_flow_data()
+{
+ addTransitions_data();
+}
+
+void tst_qquickpositioners::moveTransitions_row()
+{
+ moveTransitions("row");
+}
+
+void tst_qquickpositioners::moveTransitions_row_data()
+{
+ moveTransitions_data();
+}
+
+void tst_qquickpositioners::moveTransitions_column()
+{
+ moveTransitions("column");
+}
+
+void tst_qquickpositioners::moveTransitions_column_data()
+{
+ moveTransitions_data();
+}
+
+void tst_qquickpositioners::moveTransitions_grid()
+{
+ moveTransitions("grid");
+}
+
+void tst_qquickpositioners::moveTransitions_grid_data()
+{
+ // don't use moveTransitions_data() because grid displaces items differently
+ // (removing items further down the grid can cause displace transitions at
+ // previous indexes, since grid is auto-resized to tightly fit all of its items)
+
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<ListChange>("change");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ QTest::newRow("remove one @ start") << 10 << ListChange::remove(0, 1) << ListRange(1, 9);
+ QTest::newRow("remove one @ middle") << 10 << ListChange::remove(4, 1) << ListRange(2, 3) + ListRange(5, 9);
+ QTest::newRow("remove one @ end") << 10 << ListChange::remove(9, 1) << ListRange(2, 3) + ListRange(6, 7);
+
+ QTest::newRow("remove multiple @ start") << 10 << ListChange::remove(0, 3) << ListRange(3, 9);
+ QTest::newRow("remove multiple @ middle") << 10 << ListChange::remove(4, 3) << ListRange(1, 3) + ListRange(7, 9);
+ QTest::newRow("remove multiple @ end") << 10 << ListChange::remove(7, 3) << ListRange(1, 3) + ListRange(5, 6);
+}
+
+void tst_qquickpositioners::moveTransitions_flow()
+{
+ moveTransitions("flow");
+}
+
+void tst_qquickpositioners::moveTransitions_flow_data()
+{
+ moveTransitions_data();
+}
+
+tst_qquickpositioners::tst_qquickpositioners()
+{
+}
+
+void tst_qquickpositioners::test_horizontal()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", false);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("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);
+
+ QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
+ QCOMPARE(row->width(), 110.0);
+ QCOMPARE(row->height(), 50.0);
+}
+
+void tst_qquickpositioners::test_horizontal_rtl()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+
+ QCOMPARE(one->x(), 60.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 40.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 0.0);
+ QCOMPARE(three->y(), 0.0);
+
+ QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
+ QCOMPARE(row->width(), 110.0);
+ QCOMPARE(row->height(), 50.0);
+
+ // Change the width of the row and check that items stay to the right
+ row->setWidth(200);
+ QTRY_COMPARE(one->x(), 150.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 130.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 90.0);
+ QCOMPARE(three->y(), 0.0);
+
+}
+
+void tst_qquickpositioners::test_horizontal_spacing()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-spacing.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", false);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("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);
+
+ QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
+ QCOMPARE(row->width(), 130.0);
+ QCOMPARE(row->height(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_horizontal_spacing_rightToLeft()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-spacing.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+
+ QCOMPARE(one->x(), 80.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 50.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 00.0);
+ QCOMPARE(three->y(), 0.0);
+
+ QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
+ QCOMPARE(row->width(), 130.0);
+ QCOMPARE(row->height(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_horizontal_animated()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated.qml"), false));
+
+ window->rootObject()->setProperty("testRightToLeft", false);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+
+ //Note that they animate in
+ QCOMPARE(one->x(), -100.0);
+ QCOMPARE(two->x(), -100.0);
+ QCOMPARE(three->x(), -100.0);
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
+
+ QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
+ QVERIFY(row);
+ QCOMPARE(row->width(), 100.0);
+ QCOMPARE(row->height(), 50.0);
+
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
+
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(two->isVisible(), false);
+ QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet
+ QTRY_COMPARE(two->y(), 0.0);
+ QTRY_COMPARE(three->x(), 50.0);
+ QTRY_COMPARE(three->y(), 0.0);
+
+ //Add 'two'
+ two->setVisible(true);
+ QTRY_COMPARE(two->isVisible(), true);
+ QTRY_COMPARE(row->width(), 150.0);
+ QTRY_COMPARE(row->height(), 50.0);
+
+ QTest::qWait(0);//Let the animation start
+ QVERIFY(two->x() >= -100.0 && two->x() < 50.0);
+ QVERIFY(three->x() >= 50.0 && three->x() < 100.0);
+
+ QTRY_COMPARE(two->x(), 50.0);
+ QTRY_COMPARE(three->x(), 100.0);
+
+}
+
+void tst_qquickpositioners::test_horizontal_animated_rightToLeft()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated.qml"), false));
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+
+ //Note that they animate in
+ QCOMPARE(one->x(), -100.0);
+ QCOMPARE(two->x(), -100.0);
+ QCOMPARE(three->x(), -100.0);
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
+
+ QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
+ QVERIFY(row);
+ QCOMPARE(row->width(), 100.0);
+ QCOMPARE(row->height(), 50.0);
+
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
+
+ QTRY_COMPARE(one->x(), 50.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(two->isVisible(), false);
+ QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet
+ QTRY_COMPARE(two->y(), 0.0);
+ QTRY_COMPARE(three->x(), 0.0);
+ QTRY_COMPARE(three->y(), 0.0);
+
+ //Add 'two'
+ two->setVisible(true);
+ QTRY_COMPARE(two->isVisible(), true);
+
+ // New size should propagate after visible change
+ QTRY_COMPARE(row->width(), 150.0);
+ QTRY_COMPARE(row->height(), 50.0);
+
+ QTest::qWait(0);//Let the animation start
+ QVERIFY(one->x() >= 50.0 && one->x() < 100);
+ QVERIFY(two->x() >= -100.0 && two->x() < 50.0);
+
+ QTRY_COMPARE(one->x(), 100.0);
+ QTRY_COMPARE(two->x(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_horizontal_animated_disabled()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated-disabled.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+
+ QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row");
+ QVERIFY(row);
+
+ qApp->processEvents();
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->isVisible(), false);
+ QCOMPARE(two->x(), -100.0);//Not 'in' yet
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 50.0);
+ QCOMPARE(three->y(), 0.0);
+
+ //Add 'two'
+ two->setVisible(true);
+ QCOMPARE(two->isVisible(), true);
+ QTRY_COMPARE(row->width(), 150.0);
+ QTRY_COMPARE(row->height(), 50.0);
+
+ QTRY_COMPARE(two->x(), 50.0);
+ QTRY_COMPARE(three->x(), 100.0);
+
+}
+
+void tst_qquickpositioners::populateTransitions(const QString &positionerObjectName)
+{
+ QFETCH(bool, dynamicallyPopulate);
+ QFETCH(bool, usePopulateTransition);
+
+ QPointF targetItems_transitionFrom(-50, -50);
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ if (!dynamicallyPopulate) {
+ for (int i = 0; i < 30; i++)
+ model.addItem("Original item" + QString::number(i), "");
+ }
+
+ QaimModel model_targetItems_transitionFrom;
+ QaimModel model_displacedItems_transitionVia;
+
+ QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("usePopulateTransition", usePopulateTransition);
+ ctxt->setContextProperty("enableAddTransition", true);
+ ctxt->setContextProperty("dynamicallyPopulate", dynamicallyPopulate);
+ ctxt->setContextProperty("testModel", &model);
+ ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ ctxt->setContextProperty("testedPositioner", positionerObjectName);
+ window->setSource(testFileUrl("transitions.qml"));
+
+ QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName);
+ QVERIFY(positioner);
+ window->show();
+ QTest::qWaitForWindowExposed(window.data());
+ qApp->processEvents();
+
+ if (!dynamicallyPopulate && usePopulateTransition) {
+ QTRY_COMPARE(window->rootObject()->property("populateTransitionsDone").toInt(), model.count());
+ QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), 0);
+
+ QList<QPair<QString, QString> > targetData;
+ QList<int> targetIndexes;
+ for (int i=0; i<model.count(); i++) {
+ targetData << qMakePair(model.name(i), model.number(i));
+ targetIndexes << i;
+ }
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(positioner, "wrapper", targetIndexes);
+ model_targetItems_transitionFrom.matchAgainst(targetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos");
+ matchItemsAndIndexes(window->rootObject()->property("targetTrans_items").toMap(), model, targetIndexes);
+ matchIndexLists(window->rootObject()->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(window->rootObject()->property("targetTrans_targetItems").toList(), targetItems);
+
+ } else if (dynamicallyPopulate) {
+ QTRY_COMPARE(window->rootObject()->property("populateTransitionsDone").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), model.count());
+ } else {
+ QTRY_COMPARE(QQuickItemPrivate::get(positioner)->polishScheduled, false);
+ QTRY_COMPARE(window->rootObject()->property("populateTransitionsDone").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), 0);
+ }
+
+ checkItemPositions(positioner, &model, window->rootObject()->property("incrementalSize").toInt());
+
+ // add an item and check this is done with add transition, not populate
+ window->rootObject()->setProperty("populateTransitionsDone", 0);
+ window->rootObject()->setProperty("addTransitionsDone", 0);
+ model.insertItem(0, "new item", "");
+ QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), 1);
+ QTRY_COMPARE(window->rootObject()->property("populateTransitionsDone").toInt(), 0);
+}
+
+void tst_qquickpositioners::populateTransitions_data()
+{
+ QTest::addColumn<bool>("dynamicallyPopulate");
+ QTest::addColumn<bool>("usePopulateTransition");
+
+ QTest::newRow("statically populate") << false << true;
+ QTest::newRow("statically populate, no populate transition") << false << false;
+
+ QTest::newRow("dynamically populate") << true << true;
+ QTest::newRow("dynamically populate, no populate transition") << true << false;
+}
+
+void tst_qquickpositioners::addTransitions(const QString &positionerObjectName)
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(int, insertionIndex);
+ QFETCH(int, insertionCount);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ QPointF targetItems_transitionFrom(-50, -50);
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ QaimModel model_targetItems_transitionFrom;
+ QaimModel model_displacedItems_transitionVia;
+
+ QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("usePopulateTransition", QVariant(false));
+ ctxt->setContextProperty("enableAddTransition", QVariant(true));
+ ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ window->setSource(testFileUrl("transitions.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window.data());
+ qApp->processEvents();
+
+ QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName);
+ QVERIFY(positioner);
+ positioner->findChild<QQuickItem*>("repeater")->setProperty("model", QVariant::fromValue(&model));
+ QTRY_COMPARE(QQuickItemPrivate::get(positioner)->polishScheduled, false);
+
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+ QList<QPair<QString, QString> > targetData;
+ QList<int> targetIndexes;
+ for (int i=0; i<model.count(); i++) {
+ targetData << qMakePair(model.name(i), model.number(i));
+ targetIndexes << i;
+ }
+ QList<QQuickItem *> targetItems = findItems<QQuickItem>(positioner, "wrapper", targetIndexes);
+
+ // check add transition was run for first lot of added items
+ QTRY_COMPARE(window->rootObject()->property("populateTransitionsDone").toInt(), 0);
+ QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), initialItemCount);
+ QTRY_COMPARE(window->rootObject()->property("displaceTransitionsDone").toInt(), 0);
+ model_targetItems_transitionFrom.matchAgainst(targetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos");
+ matchItemsAndIndexes(window->rootObject()->property("targetTrans_items").toMap(), model, targetIndexes);
+ matchIndexLists(window->rootObject()->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(window->rootObject()->property("targetTrans_targetItems").toList(), targetItems);
+
+ model_targetItems_transitionFrom.clear();
+ window->rootObject()->setProperty("addTransitionsDone", 0);
+ window->rootObject()->setProperty("targetTrans_items", QVariantMap());
+ window->rootObject()->setProperty("targetTrans_targetIndexes", QVariantList());
+ window->rootObject()->setProperty("targetTrans_targetItems", QVariantList());
+
+ // do insertion
+ targetData.clear();
+ targetIndexes.clear();
+ for (int i=insertionIndex; i<insertionIndex+insertionCount; i++) {
+ targetData << qMakePair(QString("New item %1").arg(i), QString(""));
+ targetIndexes << i;
+ }
+ model.insertItems(insertionIndex, targetData);
+ QTRY_COMPARE(model.count(), positioner->property("count").toInt());
+
+ targetItems = findItems<QQuickItem>(positioner, "wrapper", targetIndexes);
+
+ QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), targetData.count());
+ QTRY_COMPARE(window->rootObject()->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.count());
+
+ // check the target and displaced items were animated
+ model_targetItems_transitionFrom.matchAgainst(targetData, "wasn't animated from target 'from' pos", "shouldn't have been animated from target 'from' pos");
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ matchItemsAndIndexes(window->rootObject()->property("targetTrans_items").toMap(), model, targetIndexes);
+ matchIndexLists(window->rootObject()->property("targetTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(window->rootObject()->property("targetTrans_targetItems").toList(), targetItems);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes = adjustIndexesForAddDisplaced(expectedDisplacedIndexes.indexes, insertionIndex, insertionCount);
+ matchItemsAndIndexes(window->rootObject()->property("displacedTrans_items").toMap(), model, displacedIndexes);
+ matchIndexLists(window->rootObject()->property("displacedTrans_targetIndexes").toList(), targetIndexes);
+ matchItemLists(window->rootObject()->property("displacedTrans_targetItems").toList(), targetItems);
+ }
+
+ checkItemPositions(positioner, &model, window->rootObject()->property("incrementalSize").toInt());
+}
+
+void tst_qquickpositioners::addTransitions_data()
+{
+ // If this data changes, update addTransitions_grid_data() also
+
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<int>("insertionIndex");
+ QTest::addColumn<int>("insertionCount");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ QTest::newRow("add one @ start") << 10 << 0 << 1 << ListRange(0, 9);
+ QTest::newRow("add one @ middle") << 10 << 5 << 1 << ListRange(5, 9);
+ QTest::newRow("add one @ end") << 10 << 10 << 1 << ListRange();
+
+ QTest::newRow("add multiple @ start") << 10 << 0 << 3 << ListRange(0, 9);
+ QTest::newRow("add multiple @ middle") << 10 << 5 << 3 << ListRange(5, 9);
+ QTest::newRow("add multiple @ end") << 10 << 10 << 3 << ListRange();
+}
+
+void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName)
+{
+ QFETCH(int, initialItemCount);
+ QFETCH(ListChange, change);
+ QFETCH(ListRange, expectedDisplacedIndexes);
+
+ QPointF targetItems_transitionFrom(-50, -50);
+ QPointF displacedItems_transitionVia(100, 100);
+
+ QaimModel model;
+ for (int i = 0; i < initialItemCount; i++)
+ model.addItem("Item" + QString::number(i), "");
+ QaimModel model_targetItems_transitionFrom;
+ QaimModel model_displacedItems_transitionVia;
+
+ QScopedPointer<QQuickView> window(QQuickViewTestUtil::createView());
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("usePopulateTransition", QVariant(false));
+ ctxt->setContextProperty("enableAddTransition", QVariant(false));
+ ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
+ ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
+ ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
+ ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
+ window->setSource(testFileUrl("transitions.qml"));
+ window->show();
+ QTest::qWaitForWindowExposed(window.data());
+ qApp->processEvents();
+
+ QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model);
+
+ QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName);
+ QVERIFY(positioner);
+ positioner->findChild<QQuickItem*>("repeater")->setProperty("model", QVariant::fromValue(&model));
+ QTRY_COMPARE(QQuickItemPrivate::get(positioner)->polishScheduled, false);
+
+ switch (change.type) {
+ case ListChange::Removed:
+ model.removeItems(change.index, change.count);
+ QTRY_COMPARE(model.count(), positioner->property("count").toInt());
+ break;
+ case ListChange::Moved:
+ model.moveItems(change.index, change.to, change.count);
+ QTRY_COMPARE(QQuickItemPrivate::get(positioner)->polishScheduled, false);
+ break;
+ case ListChange::Inserted:
+ case ListChange::SetCurrent:
+ case ListChange::SetContentY:
+ QVERIFY(false);
+ break;
+ case ListChange::Polish:
+ break;
+ }
+
+ QTRY_COMPARE(window->rootObject()->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.count());
+ QCOMPARE(window->rootObject()->property("addTransitionsDone").toInt(), 0);
+
+ // check the target and displaced items were animated
+ QCOMPARE(model_targetItems_transitionFrom.count(), 0);
+ model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim");
+
+ // check attached properties
+ QCOMPARE(window->rootObject()->property("targetTrans_items").toMap().count(), 0);
+ QCOMPARE(window->rootObject()->property("targetTrans_targetIndexes").toList().count(), 0);
+ QCOMPARE(window->rootObject()->property("targetTrans_targetItems").toList().count(), 0);
+ if (expectedDisplacedIndexes.isValid()) {
+ // adjust expectedDisplacedIndexes to their final values after the move
+ QList<int> displacedIndexes;
+ if (change.type == ListChange::Inserted)
+ displacedIndexes = adjustIndexesForAddDisplaced(expectedDisplacedIndexes.indexes, change.index, change.count);
+ else if (change.type == ListChange::Moved)
+ displacedIndexes = adjustIndexesForMove(expectedDisplacedIndexes.indexes, change.index, change.to, change.count);
+ else if (change.type == ListChange::Removed)
+ displacedIndexes = adjustIndexesForRemoveDisplaced(expectedDisplacedIndexes.indexes, change.index, change.count);
+ else
+ QVERIFY(false);
+ matchItemsAndIndexes(window->rootObject()->property("displacedTrans_items").toMap(), model, displacedIndexes);
+
+ QVariantList listOfEmptyIntLists;
+ for (int i=0; i<displacedIndexes.count(); i++)
+ listOfEmptyIntLists << QVariant::fromValue(QList<int>());
+ QCOMPARE(window->rootObject()->property("displacedTrans_targetIndexes").toList(), listOfEmptyIntLists);
+ QVariantList listOfEmptyObjectLists;
+ for (int i=0; i<displacedIndexes.count(); i++)
+ listOfEmptyObjectLists.insert(listOfEmptyObjectLists.count(), QVariantList());
+ QCOMPARE(window->rootObject()->property("displacedTrans_targetItems").toList(), listOfEmptyObjectLists);
+ }
+
+ checkItemPositions(positioner, &model, window->rootObject()->property("incrementalSize").toInt());
+}
+
+void tst_qquickpositioners::moveTransitions_data()
+{
+ // If this data changes, update moveTransitions_grid_data() also
+
+ QTest::addColumn<int>("initialItemCount");
+ QTest::addColumn<ListChange>("change");
+ QTest::addColumn<ListRange>("expectedDisplacedIndexes");
+
+ QTest::newRow("remove one @ start") << 10 << ListChange::remove(0, 1) << ListRange(1, 9);
+ QTest::newRow("remove one @ middle") << 10 << ListChange::remove(4, 1) << ListRange(5, 9);
+ QTest::newRow("remove one @ end") << 10 << ListChange::remove(9, 1) << ListRange();
+
+ QTest::newRow("remove multiple @ start") << 10 << ListChange::remove(0, 3) << ListRange(3, 9);
+ QTest::newRow("remove multiple @ middle") << 10 << ListChange::remove(4, 3) << ListRange(7, 9);
+ QTest::newRow("remove multiple @ end") << 10 << ListChange::remove(7, 3) << ListRange();
+}
+
+
+void tst_qquickpositioners::checkItemPositions(QQuickItem *positioner, QaimModel *model, qreal incrementalSize)
+{
+ QVERIFY(model->count() > 0);
+ qreal padding = 0;
+ qreal currentSize = 30;
+ qreal rowX = 0;
+ qreal rowY = 0;
+
+ for (int i=0; i<model->count(); ++i) {
+ QQuickItem *item = findItem<QQuickItem>(positioner, "wrapper", i);
+ QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
+
+ QCOMPARE(item->width(), currentSize);
+ QCOMPARE(item->height(), currentSize);
+
+ if (qobject_cast<QQuickRow*>(positioner)) {
+ QCOMPARE(item->x(), (i * 30.0) + padding);
+ QCOMPARE(item->y(), 0.0);
+ } else if (qobject_cast<QQuickColumn*>(positioner)) {
+ QCOMPARE(item->x(), 0.0);
+ QCOMPARE(item->y(), (i * 30.0) + padding);
+ } else if (qobject_cast<QQuickGrid*>(positioner)) {
+ int columns = 4;
+ int rows = qCeil(model->count() / qreal(columns));
+ int lastMatchingRowIndex = (rows * columns) - (columns - i%columns);
+ if (lastMatchingRowIndex >= model->count())
+ lastMatchingRowIndex -= columns;
+ if (i % columns > 0) {
+ QQuickItem *finalAlignedRowItem = findItem<QQuickItem>(positioner, "wrapper", lastMatchingRowIndex);
+ QVERIFY(finalAlignedRowItem);
+ QCOMPARE(item->x(), finalAlignedRowItem->x());
+ } else {
+ QCOMPARE(item->x(), 0.0);
+ }
+ if (i / columns > 0) {
+ QQuickItem *prevRowLastItem = findItem<QQuickItem>(positioner, "wrapper", (i/columns * columns) - 1);
+ QVERIFY(prevRowLastItem);
+ QCOMPARE(item->y(), prevRowLastItem->y() + prevRowLastItem->height());
+ } else {
+ QCOMPARE(item->y(), 0.0);
+ }
+ } else if (qobject_cast<QQuickFlow*>(positioner)) {
+ if (rowX + item->width() > positioner->width()) {
+ QQuickItem *prevItem = findItem<QQuickItem>(positioner, "wrapper", i-1);
+ QVERIFY(prevItem);
+ rowX = 0;
+ rowY = prevItem->y() + prevItem->height();
+ }
+ QCOMPARE(item->x(), rowX);
+ QCOMPARE(item->y(), rowY);
+ rowX += item->width();
+ } else {
+ QVERIFY2(false, "Unknown positioner type");
+ }
+ QQuickText *name = findItem<QQuickText>(positioner, "name", i);
+ QVERIFY(name != 0);
+ QTRY_COMPARE(name->text(), model->name(i));
+
+ padding += i * incrementalSize;
+ currentSize += incrementalSize;
+ }
+}
+
+void tst_qquickpositioners::test_vertical()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("vertical.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("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);
+
+ QQuickItem *column = window->rootObject()->findChild<QQuickItem*>("column");
+ QVERIFY(column);
+ QCOMPARE(column->height(), 80.0);
+ QCOMPARE(column->width(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_vertical_spacing()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("vertical-spacing.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("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);
+
+ QQuickItem *column = window->rootObject()->findChild<QQuickItem*>("column");
+ QCOMPARE(column->height(), 100.0);
+ QCOMPARE(column->width(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_vertical_animated()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("vertical-animated.qml"), false));
+
+ //Note that they animate in
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QCOMPARE(one->y(), -100.0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QCOMPARE(two->y(), -100.0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QCOMPARE(three->y(), -100.0);
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
+
+ QQuickItem *column = window->rootObject()->findChild<QQuickItem*>("column");
+ QVERIFY(column);
+ QCOMPARE(column->height(), 100.0);
+ QCOMPARE(column->width(), 50.0);
+
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
+
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(two->isVisible(), false);
+ QTRY_COMPARE(two->y(), -100.0);//Not 'in' yet
+ QTRY_COMPARE(two->x(), 0.0);
+ QTRY_COMPARE(three->y(), 50.0);
+ QTRY_COMPARE(three->x(), 0.0);
+
+ //Add 'two'
+ two->setVisible(true);
+ QTRY_COMPARE(two->isVisible(), true);
+ QTRY_COMPARE(column->height(), 150.0);
+ QTRY_COMPARE(column->width(), 50.0);
+ QTest::qWait(0);//Let the animation start
+ QVERIFY(two->y() >= -100.0 && two->y() < 50.0);
+ QVERIFY(three->y() >= 50.0 && three->y() < 100.0);
+
+ QTRY_COMPARE(two->y(), 50.0);
+ QTRY_COMPARE(three->y(), 100.0);
+
+}
+
+void tst_qquickpositioners::test_grid()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("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);
+
+ QQuickGrid *grid = window->rootObject()->findChild<QQuickGrid*>("grid");
+ QCOMPARE(grid->flow(), QQuickGrid::LeftToRight);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+}
+
+void tst_qquickpositioners::test_grid_topToBottom()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("grid-toptobottom.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 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(), 100.0);
+ QCOMPARE(four->x(), 50.0);
+ QCOMPARE(four->y(), 0.0);
+ QCOMPARE(five->x(), 50.0);
+ QCOMPARE(five->y(), 50.0);
+
+ QQuickGrid *grid = window->rootObject()->findChild<QQuickGrid*>("grid");
+ QCOMPARE(grid->flow(), QQuickGrid::TopToBottom);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 120.0);
+
+}
+
+void tst_qquickpositioners::test_grid_rightToLeft()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QCOMPARE(one->x(), 50.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 30.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 0.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 50.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 40.0);
+ QCOMPARE(five->y(), 50.0);
+
+ QQuickGrid *grid = window->rootObject()->findChild<QQuickGrid*>("grid");
+ QCOMPARE(grid->layoutDirection(), Qt::RightToLeft);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ // Change the width of the grid and check that items stay to the right
+ grid->setWidth(200);
+ QTRY_COMPARE(one->x(), 150.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 130.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 100.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 150.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 140.0);
+ QCOMPARE(five->y(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_grid_spacing()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("grid-spacing.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("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);
+
+ QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
+ QCOMPARE(grid->width(), 128.0);
+ QCOMPARE(grid->height(), 104.0);
+
+}
+
+void tst_qquickpositioners::test_grid_row_column_spacing()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("grid-row-column-spacing.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 61.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 92.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 57.0);
+ QCOMPARE(five->x(), 61.0);
+ QCOMPARE(five->y(), 57.0);
+
+ QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
+ QCOMPARE(grid->width(), 142.0);
+ QCOMPARE(grid->height(), 107.0);
+
+}
+
+void tst_qquickpositioners::test_grid_animated()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("grid-animated.qml"), false));
+
+ window->rootObject()->setProperty("testRightToLeft", false);
+
+ //Note that all animate in
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QCOMPARE(one->x(), -100.0);
+ QCOMPARE(one->y(), -100.0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QCOMPARE(two->x(), -100.0);
+ QCOMPARE(two->y(), -100.0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QCOMPARE(three->x(), -100.0);
+ QCOMPARE(three->y(), -100.0);
+
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QCOMPARE(four->x(), -100.0);
+ QCOMPARE(four->y(), -100.0);
+
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+ QCOMPARE(five->x(), -100.0);
+ QCOMPARE(five->y(), -100.0);
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
+
+ QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
+ QVERIFY(grid);
+ QCOMPARE(grid->width(), 150.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
+
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(two->isVisible(), false);
+ QTRY_COMPARE(two->y(), -100.0);
+ QTRY_COMPARE(two->x(), -100.0);
+ QTRY_COMPARE(three->y(), 0.0);
+ QTRY_COMPARE(three->x(), 50.0);
+ QTRY_COMPARE(four->y(), 0.0);
+ QTRY_COMPARE(four->x(), 100.0);
+ QTRY_COMPARE(five->y(), 50.0);
+ QTRY_COMPARE(five->x(), 0.0);
+
+ //Add 'two'
+ two->setVisible(true);
+ QCOMPARE(two->isVisible(), true);
+ QCOMPARE(grid->width(), 150.0);
+ QCOMPARE(grid->height(), 100.0);
+ QTest::qWait(0);//Let the animation start
+ QCOMPARE(two->x(), -100.0);
+ QCOMPARE(two->y(), -100.0);
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(three->x(), 50.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 100.0);
+ QCOMPARE(four->y(), 0.0);
+ QCOMPARE(five->x(), 0.0);
+ QCOMPARE(five->y(), 50.0);
+ //Let the animation complete
+ QTRY_COMPARE(two->x(), 50.0);
+ QTRY_COMPARE(two->y(), 0.0);
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(three->x(), 100.0);
+ QTRY_COMPARE(three->y(), 0.0);
+ QTRY_COMPARE(four->x(), 0.0);
+ QTRY_COMPARE(four->y(), 50.0);
+ QTRY_COMPARE(five->x(), 50.0);
+ QTRY_COMPARE(five->y(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_grid_animated_rightToLeft()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("grid-animated.qml"), false));
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ //Note that all animate in
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QCOMPARE(one->x(), -100.0);
+ QCOMPARE(one->y(), -100.0);
+
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QCOMPARE(two->x(), -100.0);
+ QCOMPARE(two->y(), -100.0);
+
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QCOMPARE(three->x(), -100.0);
+ QCOMPARE(three->y(), -100.0);
+
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QCOMPARE(four->x(), -100.0);
+ QCOMPARE(four->y(), -100.0);
+
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+ QCOMPARE(five->x(), -100.0);
+ QCOMPARE(five->y(), -100.0);
+
+ QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn
+
+ QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
+ QVERIFY(grid);
+ QCOMPARE(grid->width(), 150.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ //QTRY_COMPARE used instead of waiting for the expected time of animation completion
+ //Note that this means the duration of the animation is NOT tested
+
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(one->x(), 100.0);
+ QTRY_COMPARE(two->isVisible(), false);
+ QTRY_COMPARE(two->y(), -100.0);
+ QTRY_COMPARE(two->x(), -100.0);
+ QTRY_COMPARE(three->y(), 0.0);
+ QTRY_COMPARE(three->x(), 50.0);
+ QTRY_COMPARE(four->y(), 0.0);
+ QTRY_COMPARE(four->x(), 0.0);
+ QTRY_COMPARE(five->y(), 50.0);
+ QTRY_COMPARE(five->x(), 100.0);
+
+ //Add 'two'
+ two->setVisible(true);
+ QCOMPARE(two->isVisible(), true);
+ QCOMPARE(grid->width(), 150.0);
+ QCOMPARE(grid->height(), 100.0);
+ QTest::qWait(0);//Let the animation start
+ QCOMPARE(two->x(), -100.0);
+ QCOMPARE(two->y(), -100.0);
+ QCOMPARE(one->x(), 100.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(three->x(), 50.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 0.0);
+ QCOMPARE(five->x(), 100.0);
+ QCOMPARE(five->y(), 50.0);
+ //Let the animation complete
+ QTRY_COMPARE(two->x(), 50.0);
+ QTRY_COMPARE(two->y(), 0.0);
+ QTRY_COMPARE(one->x(), 100.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(three->x(), 0.0);
+ QTRY_COMPARE(three->y(), 0.0);
+ QTRY_COMPARE(four->x(), 100.0);
+ QTRY_COMPARE(four->y(), 50.0);
+ QTRY_COMPARE(five->x(), 50.0);
+ QTRY_COMPARE(five->y(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_grid_zero_columns()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("gridzerocolumns.qml")));
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("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(), 120.0);
+ QCOMPARE(four->y(), 0.0);
+ QCOMPARE(five->x(), 0.0);
+ QCOMPARE(five->y(), 50.0);
+
+ QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
+ QCOMPARE(grid->width(), 170.0);
+ QCOMPARE(grid->height(), 60.0);
+
+}
+
+void tst_qquickpositioners::test_grid_H_alignment()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
+
+ window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("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(), 55.0);
+ QCOMPARE(five->y(), 50.0);
+
+ QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid");
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignRight);
+
+ 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(), 60.0);
+ QCOMPARE(five->y(), 50.0);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QCOMPARE(one->x(), 50.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 30.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 0.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 50.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 30.0);
+ QCOMPARE(five->y(), 50.0);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+ window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter);
+
+ QCOMPARE(one->x(), 50.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 30.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 0.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 50.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 35.0);
+ QCOMPARE(five->y(), 50.0);
+ QCOMPARE(grid->width(), 100.0);
+ QCOMPARE(grid->height(), 100.0);
+
+}
+
+void tst_qquickpositioners::test_grid_V_alignment()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml")));
+
+ window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignVCenter);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("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(), 15.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 50.0);
+ QCOMPARE(five->y(), 70.0);
+
+ window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignBottom);
+
+ 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(), 30.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 50.0);
+ QCOMPARE(five->y(), 90.0);
+
+}
+
+void tst_qquickpositioners::test_propertychanges()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("propertychangestest.qml")));
+
+ QQuickGrid *grid = qobject_cast<QQuickGrid*>(window->rootObject());
+ QVERIFY(grid != 0);
+ QQuickTransition *rowTransition = window->rootObject()->findChild<QQuickTransition*>("rowTransition");
+ QQuickTransition *columnTransition = window->rootObject()->findChild<QQuickTransition*>("columnTransition");
+
+ QSignalSpy addSpy(grid, SIGNAL(addChanged()));
+ QSignalSpy moveSpy(grid, SIGNAL(moveChanged()));
+ QSignalSpy columnsSpy(grid, SIGNAL(columnsChanged()));
+ QSignalSpy rowsSpy(grid, SIGNAL(rowsChanged()));
+
+ QVERIFY(grid);
+ QVERIFY(rowTransition);
+ QVERIFY(columnTransition);
+ QCOMPARE(grid->add(), columnTransition);
+ QCOMPARE(grid->move(), columnTransition);
+ QCOMPARE(grid->columns(), 4);
+ QCOMPARE(grid->rows(), -1);
+
+ grid->setAdd(rowTransition);
+ grid->setMove(rowTransition);
+ QCOMPARE(grid->add(), rowTransition);
+ QCOMPARE(grid->move(), rowTransition);
+ QCOMPARE(addSpy.count(),1);
+ QCOMPARE(moveSpy.count(),1);
+
+ grid->setAdd(rowTransition);
+ grid->setMove(rowTransition);
+ QCOMPARE(addSpy.count(),1);
+ QCOMPARE(moveSpy.count(),1);
+
+ grid->setAdd(0);
+ grid->setMove(0);
+ QCOMPARE(addSpy.count(),2);
+ QCOMPARE(moveSpy.count(),2);
+
+ grid->setColumns(-1);
+ grid->setRows(3);
+ QCOMPARE(grid->columns(), -1);
+ QCOMPARE(grid->rows(), 3);
+ QCOMPARE(columnsSpy.count(),1);
+ QCOMPARE(rowsSpy.count(),1);
+
+ grid->setColumns(-1);
+ grid->setRows(3);
+ QCOMPARE(columnsSpy.count(),1);
+ QCOMPARE(rowsSpy.count(),1);
+
+ grid->setColumns(2);
+ grid->setRows(2);
+ QCOMPARE(columnsSpy.count(),2);
+ QCOMPARE(rowsSpy.count(),2);
+
+}
+
+void tst_qquickpositioners::test_repeater()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("repeatertest.qml")));
+
+ QQuickRectangle *one = findItem<QQuickRectangle>(window->contentItem(), "one");
+ QVERIFY(one != 0);
+
+ QQuickRectangle *two = findItem<QQuickRectangle>(window->contentItem(), "two");
+ QVERIFY(two != 0);
+
+ QQuickRectangle *three = findItem<QQuickRectangle>(window->contentItem(), "three");
+ QVERIFY(three != 0);
+
+ QCOMPARE(one->x(), 0.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 50.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 100.0);
+ QCOMPARE(three->y(), 0.0);
+
+}
+
+void tst_qquickpositioners::test_flow()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", false);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("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(), 0.0);
+ QCOMPARE(three->y(), 50.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 70.0);
+ QCOMPARE(five->x(), 50.0);
+ QCOMPARE(five->y(), 70.0);
+
+ QQuickItem *flow = window->rootObject()->findChild<QQuickItem*>("flow");
+ QVERIFY(flow);
+ QCOMPARE(flow->width(), 90.0);
+ QCOMPARE(flow->height(), 120.0);
+
+}
+
+void tst_qquickpositioners::test_flow_rightToLeft()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QCOMPARE(one->x(), 40.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 20.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 40.0);
+ QCOMPARE(three->y(), 50.0);
+ QCOMPARE(four->x(), 40.0);
+ QCOMPARE(four->y(), 70.0);
+ QCOMPARE(five->x(), 30.0);
+ QCOMPARE(five->y(), 70.0);
+
+ QQuickItem *flow = window->rootObject()->findChild<QQuickItem*>("flow");
+ QVERIFY(flow);
+ QCOMPARE(flow->width(), 90.0);
+ QCOMPARE(flow->height(), 120.0);
+
+}
+
+void tst_qquickpositioners::test_flow_topToBottom()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest-toptobottom.qml")));
+
+ window->rootObject()->setProperty("testRightToLeft", false);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("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(), 50.0);
+ QCOMPARE(three->y(), 50.0);
+ QCOMPARE(four->x(), 100.0);
+ QCOMPARE(four->y(), 00.0);
+ QCOMPARE(five->x(), 100.0);
+ QCOMPARE(five->y(), 50.0);
+
+ QQuickItem *flow = window->rootObject()->findChild<QQuickItem*>("flow");
+ QVERIFY(flow);
+ QCOMPARE(flow->height(), 90.0);
+ QCOMPARE(flow->width(), 150.0);
+
+ window->rootObject()->setProperty("testRightToLeft", true);
+
+ QVERIFY(flow);
+ QCOMPARE(flow->height(), 90.0);
+ QCOMPARE(flow->width(), 150.0);
+
+ QCOMPARE(one->x(), 100.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 80.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 50.0);
+ QCOMPARE(three->y(), 50.0);
+ QCOMPARE(four->x(), 0.0);
+ QCOMPARE(four->y(), 0.0);
+ QCOMPARE(five->x(), 40.0);
+ QCOMPARE(five->y(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_flow_resize()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root);
+ root->setWidth(125);
+ root->setProperty("testRightToLeft", false);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QVERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QTRY_COMPARE(one->x(), 0.0);
+ QTRY_COMPARE(one->y(), 0.0);
+ QTRY_COMPARE(two->x(), 50.0);
+ QTRY_COMPARE(two->y(), 0.0);
+ QTRY_COMPARE(three->x(), 70.0);
+ QTRY_COMPARE(three->y(), 0.0);
+ QTRY_COMPARE(four->x(), 0.0);
+ QTRY_COMPARE(four->y(), 50.0);
+ QTRY_COMPARE(five->x(), 50.0);
+ QTRY_COMPARE(five->y(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_flow_resize_rightToLeft()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("flowtest.qml")));
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root);
+ root->setWidth(125);
+ root->setProperty("testRightToLeft", true);
+
+ QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one");
+ QTRY_VERIFY(one != 0);
+ QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two");
+ QVERIFY(two != 0);
+ QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three");
+ QVERIFY(three != 0);
+ QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four");
+ QVERIFY(four != 0);
+ QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five");
+ QVERIFY(five != 0);
+
+ QCOMPARE(one->x(), 75.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 55.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 5.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 75.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 65.0);
+ QCOMPARE(five->y(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_flow_implicit_resize()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("flow-testimplicitsize.qml")));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow");
+ QVERIFY(flow != 0);
+
+ QCOMPARE(flow->width(), 100.0);
+ QCOMPARE(flow->height(), 120.0);
+
+ window->rootObject()->setProperty("flowLayout", 0);
+ QCOMPARE(flow->flow(), QQuickFlow::LeftToRight);
+ QCOMPARE(flow->width(), 220.0);
+ QCOMPARE(flow->height(), 50.0);
+
+ window->rootObject()->setProperty("flowLayout", 1);
+ QCOMPARE(flow->flow(), QQuickFlow::TopToBottom);
+ QCOMPARE(flow->width(), 100.0);
+ QCOMPARE(flow->height(), 120.0);
+
+ window->rootObject()->setProperty("flowLayout", 2);
+ QCOMPARE(flow->layoutDirection(), Qt::RightToLeft);
+ QCOMPARE(flow->width(), 220.0);
+ QCOMPARE(flow->height(), 50.0);
+
+}
+
+void tst_qquickpositioners::test_conflictinganchors()
+{
+ QQmlTestMessageHandler messageHandler;
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+
+ component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ delete item;
+
+ component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ delete item;
+
+ component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ delete item;
+
+ component.setData("import QtQuick 2.0\nFlow { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ delete item;
+
+ component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.top: parent.top } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
+ messageHandler.clear();
+ delete item;
+
+ component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
+ messageHandler.clear();
+ delete item;
+
+ component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.left: parent.left } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ delete item;
+
+ component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; anchors.left: parent.left } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
+ messageHandler.clear();
+ delete item;
+
+ component.setData("import QtQuick 2.0\nRow { width: 100; height: 100; Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
+ messageHandler.clear();
+ delete item;
+
+ component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; anchors.top: parent.top } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
+ delete item;
+
+ component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
+ messageHandler.clear();
+ delete item;
+
+ component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
+ messageHandler.clear();
+ delete item;
+
+ component.setData("import QtQuick 2.0\nFlow { Item { width: 100; height: 100; anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
+ messageHandler.clear();
+ delete item;
+
+ component.setData("import QtQuick 2.0\nFlow { width: 100; height: 100; Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
+ item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
+ delete item;
+}
+
+void tst_qquickpositioners::test_mirroring()
+{
+ QList<QString> qmlFiles;
+ qmlFiles << "horizontal.qml" << "gridtest.qml" << "flowtest.qml";
+ QList<QString> objectNames;
+ objectNames << "one" << "two" << "three" << "four" << "five";
+
+ foreach (const QString qmlFile, qmlFiles) {
+ QScopedPointer<QQuickView> windowA(createView(testFile(qmlFile)));
+ QQuickItem *rootA = qobject_cast<QQuickItem*>(windowA->rootObject());
+
+ QScopedPointer<QQuickView> windowB(createView(testFile(qmlFile)));
+ QQuickItem *rootB = qobject_cast<QQuickItem*>(windowB->rootObject());
+
+ rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft
+
+ // LTR != RTL
+ foreach (const QString objectName, objectNames) {
+ // horizontal.qml only has three items
+ if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
+ break;
+ QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
+ QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
+ QTRY_VERIFY(itemA->x() != itemB->x());
+ }
+
+ QQmlProperty enabledProp(rootB, "LayoutMirroring.enabled", qmlContext(rootB));
+ enabledProp.write(true);
+ QQmlProperty inheritProp(rootB, "LayoutMirroring.childrenInherit", qmlContext(rootB));
+ inheritProp.write(true);
+
+ // RTL == mirror
+ foreach (const QString objectName, objectNames) {
+ // horizontal.qml only has three items
+ if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
+ break;
+ QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
+ QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
+ QTRY_COMPARE(itemA->x(), itemB->x());
+ }
+
+ rootA->setProperty("testRightToLeft", false); // layoutDirection: Qt.LeftToRight
+ rootB->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft
+
+ // LTR == RTL + mirror
+ foreach (const QString objectName, objectNames) {
+ // horizontal.qml only has three items
+ if (qmlFile == QString("horizontal.qml") && objectName == QString("four"))
+ break;
+ QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
+ QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
+ QTRY_COMPARE(itemA->x(), itemB->x());
+ }
+ }
+}
+
+void tst_qquickpositioners::test_allInvisible()
+{
+ //QTBUG-19361
+ QScopedPointer<QQuickView> window(createView(testFile("allInvisible.qml")));
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(root);
+
+ QQuickRow *row = window->rootObject()->findChild<QQuickRow*>("row");
+ QVERIFY(row != 0);
+ QVERIFY(row->width() == 0);
+ QVERIFY(row->height() == 0);
+ QQuickColumn *column = window->rootObject()->findChild<QQuickColumn*>("column");
+ QVERIFY(column != 0);
+ QVERIFY(column->width() == 0);
+ QVERIFY(column->height() == 0);
+}
+
+void tst_qquickpositioners::test_attachedproperties()
+{
+ QFETCH(QString, filename);
+
+ QScopedPointer<QQuickView> window(createView(filename));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickRectangle *greenRect = window->rootObject()->findChild<QQuickRectangle *>("greenRect");
+ QVERIFY(greenRect != 0);
+
+ int posIndex = greenRect->property("posIndex").toInt();
+ QVERIFY(posIndex == 0);
+ bool isFirst = greenRect->property("isFirstItem").toBool();
+ QVERIFY(isFirst == true);
+ bool isLast = greenRect->property("isLastItem").toBool();
+ QVERIFY(isLast == false);
+
+ QQuickRectangle *yellowRect = window->rootObject()->findChild<QQuickRectangle *>("yellowRect");
+ QVERIFY(yellowRect != 0);
+
+ posIndex = yellowRect->property("posIndex").toInt();
+ QVERIFY(posIndex == -1);
+ isFirst = yellowRect->property("isFirstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = yellowRect->property("isLastItem").toBool();
+ QVERIFY(isLast == false);
+
+ yellowRect->metaObject()->invokeMethod(yellowRect, "onDemandPositioner");
+
+ posIndex = yellowRect->property("posIndex").toInt();
+ QVERIFY(posIndex == 1);
+ isFirst = yellowRect->property("isFirstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = yellowRect->property("isLastItem").toBool();
+ QVERIFY(isLast == true);
+
+}
+
+void tst_qquickpositioners::test_attachedproperties_data()
+{
+ QTest::addColumn<QString>("filename");
+
+ QTest::newRow("column") << testFile("attachedproperties-column.qml");
+ QTest::newRow("row") << testFile("attachedproperties-row.qml");
+ QTest::newRow("grid") << testFile("attachedproperties-grid.qml");
+ QTest::newRow("flow") << testFile("attachedproperties-flow.qml");
+}
+
+void tst_qquickpositioners::test_attachedproperties_dynamic()
+{
+ QScopedPointer<QQuickView> window(createView(testFile("attachedproperties-dynamic.qml")));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickRow *row = window->rootObject()->findChild<QQuickRow *>("pos");
+ QVERIFY(row != 0);
+
+ QQuickRectangle *rect0 = window->rootObject()->findChild<QQuickRectangle *>("rect0");
+ QVERIFY(rect0 != 0);
+
+ int posIndex = rect0->property("index").toInt();
+ QVERIFY(posIndex == 0);
+ bool isFirst = rect0->property("firstItem").toBool();
+ QVERIFY(isFirst == true);
+ bool isLast = rect0->property("lastItem").toBool();
+ QVERIFY(isLast == false);
+
+ QQuickRectangle *rect1 = window->rootObject()->findChild<QQuickRectangle *>("rect1");
+ QVERIFY(rect1 != 0);
+
+ posIndex = rect1->property("index").toInt();
+ QVERIFY(posIndex == 1);
+ isFirst = rect1->property("firstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = rect1->property("lastItem").toBool();
+ QVERIFY(isLast == true);
+
+ row->metaObject()->invokeMethod(row, "createSubRect");
+
+ QTRY_VERIFY(rect1->property("index").toInt() == 1);
+ QTRY_VERIFY(rect1->property("firstItem").toBool() == false);
+ QTRY_VERIFY(rect1->property("lastItem").toBool() == false);
+
+ QQuickRectangle *rect2 = window->rootObject()->findChild<QQuickRectangle *>("rect2");
+ QVERIFY(rect2 != 0);
+
+ posIndex = rect2->property("index").toInt();
+ QVERIFY(posIndex == 2);
+ isFirst = rect2->property("firstItem").toBool();
+ QVERIFY(isFirst == false);
+ isLast = rect2->property("lastItem").toBool();
+ QVERIFY(isLast == true);
+
+ row->metaObject()->invokeMethod(row, "destroySubRect");
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QTRY_VERIFY(rect1->property("index").toInt() == 1);
+ QTRY_VERIFY(rect1->property("firstItem").toBool() == false);
+ QTRY_VERIFY(rect1->property("lastItem").toBool() == true);
+
+}
+
+QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait)
+{
+ QQuickView *window = new QQuickView(0);
+ qDebug() << "1";
+
+ window->setSource(QUrl::fromLocalFile(filename));
+ qDebug() << "2";
+ window->show();
+ qDebug() << "3";
+ if (wait)
+ QTest::qWaitForWindowExposed(window); //It may not relayout until the next frame, so it needs to be drawn
+ qDebug() << "4";
+
+ return window;
+}
+
+void tst_qquickpositioners::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes)
+{
+ for (int i=0; i<indexLists.count(); i++) {
+ QSet<int> current = indexLists[i].value<QList<int> >().toSet();
+ if (current != expectedIndexes.toSet())
+ qDebug() << "Cannot match actual targets" << current << "with expected" << expectedIndexes;
+ QCOMPARE(current, expectedIndexes.toSet());
+ }
+}
+
+void tst_qquickpositioners::matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes)
+{
+ for (QVariantMap::const_iterator it = items.begin(); it != items.end(); ++it) {
+ QVERIFY(it.value().type() == QVariant::Int);
+ QString name = it.key();
+ int itemIndex = it.value().toInt();
+ QVERIFY2(expectedIndexes.contains(itemIndex), QTest::toString(QString("Index %1 not found in expectedIndexes").arg(itemIndex)));
+ if (model.name(itemIndex) != name)
+ qDebug() << itemIndex;
+ QCOMPARE(model.name(itemIndex), name);
+ }
+ QCOMPARE(items.count(), expectedIndexes.count());
+}
+
+void tst_qquickpositioners::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems)
+{
+ for (int i=0; i<itemLists.count(); i++) {
+ QVERIFY(itemLists[i].type() == QVariant::List);
+ QVariantList current = itemLists[i].toList();
+ for (int j=0; j<current.count(); j++) {
+ QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>());
+ QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j)));
+ QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j)));
+ }
+ QCOMPARE(current.count(), expectedItems.count());
+ }
+}
+
+QTEST_MAIN(tst_qquickpositioners)
+
+#include "tst_qquickpositioners.moc"
diff --git a/tests/auto/quick/qquickrectangle/data/gradient.qml b/tests/auto/quick/qquickrectangle/data/gradient.qml
new file mode 100644
index 0000000000..6d2a3c4646
--- /dev/null
+++ b/tests/auto/quick/qquickrectangle/data/gradient.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+
+ function resetGradient() {
+ gradient = undefined
+ }
+
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "gray" }
+ GradientStop { position: 1.0; color: "white" }
+ }
+}
+
diff --git a/tests/auto/quick/qquickrectangle/qquickrectangle.pro b/tests/auto/quick/qquickrectangle/qquickrectangle.pro
new file mode 100644
index 0000000000..e881926c80
--- /dev/null
+++ b/tests/auto/quick/qquickrectangle/qquickrectangle.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+TARGET = tst_qquickrectangle
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickrectangle.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
new file mode 100644
index 0000000000..204a3ff019
--- /dev/null
+++ b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <private/qquickrectangle_p.h>
+
+#include "../../shared/util.h"
+
+class tst_qquickrectangle : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickrectangle();
+
+private slots:
+ void gradient();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qquickrectangle::tst_qquickrectangle()
+{
+}
+
+void tst_qquickrectangle::gradient()
+{
+ QQmlComponent component(&engine, testFileUrl("gradient.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(component.create());
+ QVERIFY(rect);
+
+ QQuickGradient *grad = rect->gradient();
+ QVERIFY(grad);
+
+ QQmlListProperty<QQuickGradientStop> stops = grad->stops();
+ QCOMPARE(stops.count(&stops), 2);
+ QCOMPARE(stops.at(&stops, 0)->position(), 0.0);
+ QCOMPARE(stops.at(&stops, 0)->color(), QColor("gray"));
+ QCOMPARE(stops.at(&stops, 1)->position(), 1.0);
+ QCOMPARE(stops.at(&stops, 1)->color(), QColor("white"));
+
+ QMetaObject::invokeMethod(rect, "resetGradient");
+
+ grad = rect->gradient();
+ QVERIFY(!grad);
+
+ delete rect;
+}
+
+
+QTEST_MAIN(tst_qquickrectangle)
+
+#include "tst_qquickrectangle.moc"
diff --git a/tests/auto/quick/qquickrepeater/data/asyncloader.qml b/tests/auto/quick/qquickrepeater/data/asyncloader.qml
new file mode 100644
index 0000000000..82094e2666
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/asyncloader.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ width: 360
+ height: 480
+
+ Loader {
+ asynchronous: true
+ sourceComponent: viewComponent
+ }
+
+ Component {
+ id: viewComponent
+ Column {
+ objectName: "container"
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+
+ model: 10
+
+ delegate: Rectangle {
+ objectName: "delegate" + index
+ color: "red"
+ width: 360
+ height: 50
+ Text { text: index }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml
new file mode 100644
index 0000000000..0280df0620
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/dynamicmodelcrash.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ ListModel {
+ id: lm;
+ }
+
+ Component.onCompleted: {
+ lm.append({ subModel: [ {d:0} ] });
+ rep.model = lm.get(0).subModel;
+ rep.model;
+ lm.remove(0);
+ rep.model;
+ }
+
+ Repeater {
+ objectName: "rep"
+ id: rep
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/initparent.qml b/tests/auto/quick/qquickrepeater/data/initparent.qml
new file mode 100644
index 0000000000..e6571f09d3
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/initparent.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property Item parentItem: null
+ Repeater {
+ model: 1
+ Item {
+ Component.onCompleted: root.parentItem = parent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/intmodel.qml b/tests/auto/quick/qquickrepeater/data/intmodel.qml
new file mode 100644
index 0000000000..30a650dd52
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/intmodel.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ objectName: "container"
+ width: 240
+ height: 320
+ color: "white"
+
+ function checkProperties() {
+ testObject.error = false;
+ if (repeater.delegate != comp) {
+ console.log("delegate property incorrect");
+ testObject.error = true;
+ }
+ }
+
+ Component {
+ id: comp
+ Item{}
+ }
+
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ model: testData
+ delegate: comp
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/itemlist.qml b/tests/auto/quick/qquickrepeater/data/itemlist.qml
new file mode 100644
index 0000000000..174bfd4d18
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/itemlist.qml
@@ -0,0 +1,68 @@
+// This example demonstrates placing items in a view using
+// a VisualItemModel
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "lightgray"
+ width: 240
+ height: 320
+ property variant itemModel: itemModel1
+
+ function checkProperties() {
+ testObject.error = false;
+ if (testObject.useModel && view.model != root.itemModel) {
+ console.log("model property incorrect");
+ testObject.error = true;
+ }
+ }
+
+ function switchModel() {
+ root.itemModel = itemModel2
+ }
+
+ VisualItemModel {
+ id: itemModel1
+ objectName: "itemModel1"
+ Rectangle {
+ objectName: "item1"
+ height: 50; width: 100; color: "#FFFEF0"
+ Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item2"
+ height: 50; width: 100; color: "#F0FFF7"
+ Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item3"
+ height: 50; width: 100; color: "#F4F0FF"
+ Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ VisualItemModel {
+ id: itemModel2
+ objectName: "itemModel2"
+ Rectangle {
+ objectName: "item4"
+ height: 50; width: 100; color: "#FFFEF0"
+ Text { objectName: "text4"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ Rectangle {
+ objectName: "item5"
+ height: 50; width: 100; color: "#F0FFF7"
+ Text { objectName: "text5"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
+ }
+ }
+
+ Column {
+ objectName: "container"
+ Repeater {
+ id: view
+ objectName: "repeater"
+ model: testObject.useModel ? root.itemModel : 0
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/modelChanged.qml b/tests/auto/quick/qquickrepeater/data/modelChanged.qml
new file mode 100644
index 0000000000..23af127e79
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/modelChanged.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Column {
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+
+ property int itemsCount
+ property variant itemsFound: []
+
+ delegate: Rectangle {
+ color: "red"
+ width: (index+1)*50
+ height: 50
+ }
+
+ onModelChanged: {
+ repeater.itemsCount = repeater.count
+ var items = []
+ for (var i=0; i<repeater.count; i++)
+ items.push(repeater.itemAt(i))
+ repeater.itemsFound = items
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickrepeater/data/objlist.qml b/tests/auto/quick/qquickrepeater/data/objlist.qml
new file mode 100644
index 0000000000..c49d5926e5
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/objlist.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ objectName: "container"
+ width: 240
+ height: 320
+ color: "white"
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ model: testData
+ property int errors: 0
+ property int instantiated: 0
+ Component {
+ Item{
+ Component.onCompleted: {if(index!=modelData.idx) repeater.errors += 1; repeater.instantiated++}
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/properties.qml b/tests/auto/quick/qquickrepeater/data/properties.qml
new file mode 100644
index 0000000000..035431c784
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/properties.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Row {
+ Repeater {
+ objectName: "repeater"
+ model: 5
+ Text {
+ text: "I'm item " + index
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/repeater1.qml b/tests/auto/quick/qquickrepeater/data/repeater1.qml
new file mode 100644
index 0000000000..3e6f4071ff
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/repeater1.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Item {
+ Rectangle {
+ id: container
+ objectName: "container"
+ width: 240
+ height: 320
+ color: "white"
+ Text {
+ text: "Zero"
+ }
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ width: 240
+ height: 320
+ model: testData
+ Component {
+ Text {
+ y: index*20
+ text: modelData
+ }
+ }
+ }
+ Text {
+ text: "Last"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/data/repeater2.qml b/tests/auto/quick/qquickrepeater/data/repeater2.qml
new file mode 100644
index 0000000000..691fbda1e5
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/repeater2.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "white"
+ Component {
+ id: myDelegate
+ Item {
+ objectName: "myDelegate"
+ height: 20
+ width: 240
+ Text {
+ objectName: "myName"
+ text: name
+ }
+ Text {
+ objectName: "myNumber"
+ x: 100
+ text: number
+ }
+ }
+ }
+ Column {
+ id: container
+ objectName: "container"
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ width: 240
+ height: 320
+ delegate: myDelegate
+ model: testData
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/qquickrepeater.pro b/tests/auto/quick/qquickrepeater/qquickrepeater.pro
new file mode 100644
index 0000000000..a27c34c84b
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/qquickrepeater.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickrepeater
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickrepeater.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
new file mode 100644
index 0000000000..582503f938
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
@@ -0,0 +1,737 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtQml/qqmlengine.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlincubator.h>
+#include <private/qquickrepeater_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+
+#include "../../shared/util.h"
+#include "../shared/viewtestutil.h"
+#include "../shared/visualtestutil.h"
+
+using namespace QQuickViewTestUtil;
+using namespace QQuickVisualTestUtil;
+
+
+class tst_QQuickRepeater : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickRepeater();
+
+private slots:
+ void numberModel();
+ void objectList();
+ void stringList();
+ void dataModel_adding();
+ void dataModel_removing();
+ void dataModel_changes();
+ void itemModel();
+ void resetModel();
+ void modelChanged();
+ void modelReset();
+ void properties();
+ void asynchronous();
+ void initParent();
+ void dynamicModelCrash();
+};
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(bool error READ error WRITE setError)
+ Q_PROPERTY(bool useModel READ useModel NOTIFY useModelChanged)
+
+public:
+ TestObject() : QObject(), mError(true), mUseModel(false) {}
+
+ bool error() const { return mError; }
+ void setError(bool err) { mError = err; }
+
+ bool useModel() const { return mUseModel; }
+ void setUseModel(bool use) { mUseModel = use; emit useModelChanged(); }
+
+signals:
+ void useModelChanged();
+
+private:
+ bool mError;
+ bool mUseModel;
+};
+
+tst_QQuickRepeater::tst_QQuickRepeater()
+{
+}
+
+void tst_QQuickRepeater::numberModel()
+{
+ QQuickView *window = createView();
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testData", 5);
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("intmodel.qml"));
+ qApp->processEvents();
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+ QCOMPARE(repeater->parentItem()->childItems().count(), 5+1);
+
+ QVERIFY(!repeater->itemAt(-1));
+ for (int i=0; i<repeater->count(); i++)
+ QCOMPARE(repeater->itemAt(i), repeater->parentItem()->childItems().at(i));
+ QVERIFY(!repeater->itemAt(repeater->count()));
+
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QVERIFY(testObject->error() == false);
+
+ delete testObject;
+ delete window;
+}
+
+class MyObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int idx READ idx CONSTANT)
+public:
+ MyObject(int i) : QObject(), m_idx(i) {}
+
+ int idx() const { return m_idx; }
+
+ int m_idx;
+};
+
+void tst_QQuickRepeater::objectList()
+{
+ QQuickView *window = createView();
+ QObjectList data;
+ for (int i=0; i<100; i++)
+ data << new MyObject(i);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testData", QVariant::fromValue(data));
+
+ window->setSource(testFileUrl("objlist.qml"));
+ qApp->processEvents();
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+ QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data
+ QCOMPARE(repeater->property("instantiated").toInt(), 100);
+
+ QVERIFY(!repeater->itemAt(-1));
+ for (int i=0; i<data.count(); i++)
+ QCOMPARE(repeater->itemAt(i), repeater->parentItem()->childItems().at(i));
+ QVERIFY(!repeater->itemAt(data.count()));
+
+ QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QQuickItem*)));
+ QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*)));
+ ctxt->setContextProperty("testData", QVariant::fromValue(data));
+ QCOMPARE(addedSpy.count(), data.count());
+ QCOMPARE(removedSpy.count(), data.count());
+
+ qDeleteAll(data);
+ delete window;
+}
+
+/*
+The Repeater element creates children at its own position in its parent's
+stacking order. In this test we insert a repeater between two other Text
+elements to test this.
+*/
+void tst_QQuickRepeater::stringList()
+{
+ QQuickView *window = createView();
+
+ QStringList data;
+ data << "One";
+ data << "Two";
+ data << "Three";
+ data << "Four";
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testData", data);
+
+ window->setSource(testFileUrl("repeater1.qml"));
+ qApp->processEvents();
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+
+ QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container");
+ QVERIFY(container != 0);
+
+ QCOMPARE(container->childItems().count(), data.count() + 3);
+
+ bool saw_repeater = false;
+ for (int i = 0; i < container->childItems().count(); ++i) {
+
+ if (i == 0) {
+ QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i));
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), QLatin1String("Zero"));
+ } else if (i == container->childItems().count() - 2) {
+ // The repeater itself
+ QQuickRepeater *rep = qobject_cast<QQuickRepeater*>(container->childItems().at(i));
+ QCOMPARE(rep, repeater);
+ saw_repeater = true;
+ continue;
+ } else if (i == container->childItems().count() - 1) {
+ QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i));
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), QLatin1String("Last"));
+ } else {
+ QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i));
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), data.at(i-1));
+ }
+ }
+ QVERIFY(saw_repeater);
+
+ delete window;
+}
+
+void tst_QQuickRepeater::dataModel_adding()
+{
+ QQuickView *window = createView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ QaimModel testModel;
+ ctxt->setContextProperty("testData", &testModel);
+ window->setSource(testFileUrl("repeater2.qml"));
+ qApp->processEvents();
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+ QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container");
+ QVERIFY(container != 0);
+
+ QVERIFY(!repeater->itemAt(0));
+
+ QSignalSpy countSpy(repeater, SIGNAL(countChanged()));
+ QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QQuickItem*)));
+
+ // add to empty model
+ testModel.addItem("two", "2");
+ QCOMPARE(repeater->itemAt(0), container->childItems().at(0));
+ QCOMPARE(countSpy.count(), 1); countSpy.clear();
+ QCOMPARE(addedSpy.count(), 1);
+ QCOMPARE(addedSpy.at(0).at(0).toInt(), 0);
+ QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(0));
+ addedSpy.clear();
+
+ // insert at start
+ testModel.insertItem(0, "one", "1");
+ QCOMPARE(repeater->itemAt(0), container->childItems().at(0));
+ QCOMPARE(countSpy.count(), 1); countSpy.clear();
+ QCOMPARE(addedSpy.count(), 1);
+ QCOMPARE(addedSpy.at(0).at(0).toInt(), 0);
+ QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(0));
+ addedSpy.clear();
+
+ // insert at end
+ testModel.insertItem(2, "four", "4");
+ QCOMPARE(repeater->itemAt(2), container->childItems().at(2));
+ QCOMPARE(countSpy.count(), 1); countSpy.clear();
+ QCOMPARE(addedSpy.count(), 1);
+ QCOMPARE(addedSpy.at(0).at(0).toInt(), 2);
+ QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(2));
+ addedSpy.clear();
+
+ // insert in middle
+ testModel.insertItem(2, "three", "3");
+ QCOMPARE(repeater->itemAt(2), container->childItems().at(2));
+ QCOMPARE(countSpy.count(), 1); countSpy.clear();
+ QCOMPARE(addedSpy.count(), 1);
+ QCOMPARE(addedSpy.at(0).at(0).toInt(), 2);
+ QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(2));
+ addedSpy.clear();
+
+ delete testObject;
+ addedSpy.clear();
+ countSpy.clear();
+ delete window;
+}
+
+void tst_QQuickRepeater::dataModel_removing()
+{
+ QQuickView *window = createView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ QaimModel testModel;
+ testModel.addItem("one", "1");
+ testModel.addItem("two", "2");
+ testModel.addItem("three", "3");
+ testModel.addItem("four", "4");
+ testModel.addItem("five", "5");
+
+ ctxt->setContextProperty("testData", &testModel);
+ window->setSource(testFileUrl("repeater2.qml"));
+ qApp->processEvents();
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+ QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container");
+ QVERIFY(container != 0);
+ QCOMPARE(container->childItems().count(), repeater->count()+1);
+
+ QSignalSpy countSpy(repeater, SIGNAL(countChanged()));
+ QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*)));
+
+ // remove at start
+ QQuickItem *item = repeater->itemAt(0);
+ QCOMPARE(item, container->childItems().at(0));
+
+ testModel.removeItem(0);
+ QVERIFY(repeater->itemAt(0) != item);
+ QCOMPARE(countSpy.count(), 1); countSpy.clear();
+ QCOMPARE(removedSpy.count(), 1);
+ QCOMPARE(removedSpy.at(0).at(0).toInt(), 0);
+ QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item);
+ removedSpy.clear();
+
+ // remove at end
+ int lastIndex = testModel.count()-1;
+ item = repeater->itemAt(lastIndex);
+ QCOMPARE(item, container->childItems().at(lastIndex));
+
+ testModel.removeItem(lastIndex);
+ QVERIFY(repeater->itemAt(lastIndex) != item);
+ QCOMPARE(countSpy.count(), 1); countSpy.clear();
+ QCOMPARE(removedSpy.count(), 1);
+ QCOMPARE(removedSpy.at(0).at(0).toInt(), lastIndex);
+ QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item);
+ removedSpy.clear();
+
+ // remove from middle
+ item = repeater->itemAt(1);
+ QCOMPARE(item, container->childItems().at(1));
+
+ testModel.removeItem(1);
+ QVERIFY(repeater->itemAt(lastIndex) != item);
+ QCOMPARE(countSpy.count(), 1); countSpy.clear();
+ QCOMPARE(removedSpy.count(), 1);
+ QCOMPARE(removedSpy.at(0).at(0).toInt(), 1);
+ QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item);
+ removedSpy.clear();
+
+ delete testObject;
+ delete window;
+}
+
+void tst_QQuickRepeater::dataModel_changes()
+{
+ QQuickView *window = createView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ QaimModel testModel;
+ testModel.addItem("one", "1");
+ testModel.addItem("two", "2");
+ testModel.addItem("three", "3");
+
+ ctxt->setContextProperty("testData", &testModel);
+ window->setSource(testFileUrl("repeater2.qml"));
+ qApp->processEvents();
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+ QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container");
+ QVERIFY(container != 0);
+ QCOMPARE(container->childItems().count(), repeater->count()+1);
+
+ // Check that model changes are propagated
+ QQuickText *text = findItem<QQuickText>(window->rootObject(), "myName", 1);
+ QVERIFY(text);
+ QCOMPARE(text->text(), QString("two"));
+
+ testModel.modifyItem(1, "Item two", "_2");
+ text = findItem<QQuickText>(window->rootObject(), "myName", 1);
+ QVERIFY(text);
+ QCOMPARE(text->text(), QString("Item two"));
+
+ text = findItem<QQuickText>(window->rootObject(), "myNumber", 1);
+ QVERIFY(text);
+ QCOMPARE(text->text(), QString("_2"));
+
+ delete testObject;
+ delete window;
+}
+
+void tst_QQuickRepeater::itemModel()
+{
+ QQuickView *window = createView();
+ QQmlContext *ctxt = window->rootContext();
+ TestObject *testObject = new TestObject;
+ ctxt->setContextProperty("testObject", testObject);
+
+ window->setSource(testFileUrl("itemlist.qml"));
+ qApp->processEvents();
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+
+ QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container");
+ QVERIFY(container != 0);
+
+ QCOMPARE(container->childItems().count(), 1);
+
+ testObject->setUseModel(true);
+ QMetaObject::invokeMethod(window->rootObject(), "checkProperties");
+ QVERIFY(testObject->error() == false);
+
+ QCOMPARE(container->childItems().count(), 4);
+ QVERIFY(qobject_cast<QObject*>(container->childItems().at(0))->objectName() == "item1");
+ QVERIFY(qobject_cast<QObject*>(container->childItems().at(1))->objectName() == "item2");
+ QVERIFY(qobject_cast<QObject*>(container->childItems().at(2))->objectName() == "item3");
+ QVERIFY(container->childItems().at(3) == repeater);
+
+ QMetaObject::invokeMethod(window->rootObject(), "switchModel");
+ QCOMPARE(container->childItems().count(), 3);
+ QVERIFY(qobject_cast<QObject*>(container->childItems().at(0))->objectName() == "item4");
+ QVERIFY(qobject_cast<QObject*>(container->childItems().at(1))->objectName() == "item5");
+ QVERIFY(container->childItems().at(2) == repeater);
+
+ testObject->setUseModel(false);
+ QCOMPARE(container->childItems().count(), 1);
+
+ delete testObject;
+ delete window;
+}
+
+void tst_QQuickRepeater::resetModel()
+{
+ QQuickView *window = createView();
+
+ QStringList dataA;
+ for (int i=0; i<10; i++)
+ dataA << QString::number(i);
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testData", dataA);
+ window->setSource(testFileUrl("repeater1.qml"));
+ qApp->processEvents();
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater");
+ QVERIFY(repeater != 0);
+ QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container");
+ QVERIFY(container != 0);
+
+ QCOMPARE(repeater->count(), dataA.count());
+ for (int i=0; i<repeater->count(); i++)
+ QCOMPARE(repeater->itemAt(i), container->childItems().at(i+1)); // +1 to skip first Text object
+
+ QSignalSpy modelChangedSpy(repeater, SIGNAL(modelChanged()));
+ QSignalSpy countSpy(repeater, SIGNAL(countChanged()));
+ QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QQuickItem*)));
+ QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*)));
+
+ QStringList dataB;
+ for (int i=0; i<20; i++)
+ dataB << QString::number(i);
+
+ // reset context property
+ ctxt->setContextProperty("testData", dataB);
+ QCOMPARE(repeater->count(), dataB.count());
+
+ QCOMPARE(modelChangedSpy.count(), 1);
+ QCOMPARE(countSpy.count(), 1);
+ QCOMPARE(removedSpy.count(), dataA.count());
+ QCOMPARE(addedSpy.count(), dataB.count());
+ for (int i=0; i<dataB.count(); i++) {
+ QCOMPARE(addedSpy.at(i).at(0).toInt(), i);
+ QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i));
+ }
+ modelChangedSpy.clear();
+ countSpy.clear();
+ removedSpy.clear();
+ addedSpy.clear();
+
+ // reset via setModel()
+ repeater->setModel(dataA);
+ QCOMPARE(repeater->count(), dataA.count());
+
+ QCOMPARE(modelChangedSpy.count(), 1);
+ QCOMPARE(countSpy.count(), 1);
+ QCOMPARE(removedSpy.count(), dataB.count());
+ QCOMPARE(addedSpy.count(), dataA.count());
+ for (int i=0; i<dataA.count(); i++) {
+ QCOMPARE(addedSpy.at(i).at(0).toInt(), i);
+ QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i));
+ }
+
+ modelChangedSpy.clear();
+ countSpy.clear();
+ removedSpy.clear();
+ addedSpy.clear();
+
+ delete window;
+}
+
+// QTBUG-17156
+void tst_QQuickRepeater::modelChanged()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("modelChanged.qml"));
+
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(rootObject);
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(rootObject, "repeater");
+ QVERIFY(repeater);
+
+ repeater->setModel(4);
+ QCOMPARE(repeater->count(), 4);
+ QCOMPARE(repeater->property("itemsCount").toInt(), 4);
+ QCOMPARE(repeater->property("itemsFound").toList().count(), 4);
+
+ repeater->setModel(10);
+ QCOMPARE(repeater->count(), 10);
+ QCOMPARE(repeater->property("itemsCount").toInt(), 10);
+ QCOMPARE(repeater->property("itemsFound").toList().count(), 10);
+
+ delete rootObject;
+}
+
+void tst_QQuickRepeater::modelReset()
+{
+ QaimModel model;
+
+ QQmlEngine engine;
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("testData", &model);
+
+ QQmlComponent component(&engine, testFileUrl("repeater2.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *rootItem = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(rootItem);
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(rootItem, "repeater");
+ QVERIFY(repeater != 0);
+ QQuickItem *container = findItem<QQuickItem>(rootItem, "container");
+ QVERIFY(container != 0);
+
+ QCOMPARE(repeater->count(), 0);
+
+ QSignalSpy countSpy(repeater, SIGNAL(countChanged()));
+ QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QQuickItem*)));
+ QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*)));
+
+
+ QList<QPair<QString, QString> > items = QList<QPair<QString, QString> >()
+ << qMakePair(QString::fromLatin1("one"), QString::fromLatin1("1"))
+ << qMakePair(QString::fromLatin1("two"), QString::fromLatin1("2"))
+ << qMakePair(QString::fromLatin1("three"), QString::fromLatin1("3"));
+
+ model.resetItems(items);
+
+ QCOMPARE(countSpy.count(), 1);
+ QCOMPARE(removedSpy.count(), 0);
+ QCOMPARE(addedSpy.count(), items.count());
+ for (int i = 0; i< items.count(); i++) {
+ QCOMPARE(addedSpy.at(i).at(0).toInt(), i);
+ QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i));
+ }
+
+ countSpy.clear();
+ addedSpy.clear();
+
+ model.reset();
+ QCOMPARE(countSpy.count(), 0);
+ QCOMPARE(removedSpy.count(), 3);
+ QCOMPARE(addedSpy.count(), 3);
+ for (int i = 0; i< items.count(); i++) {
+ QCOMPARE(addedSpy.at(i).at(0).toInt(), i);
+ QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i));
+ }
+
+ addedSpy.clear();
+ removedSpy.clear();
+
+ items.append(qMakePair(QString::fromLatin1("four"), QString::fromLatin1("4")));
+ items.append(qMakePair(QString::fromLatin1("five"), QString::fromLatin1("5")));
+
+ model.resetItems(items);
+ QCOMPARE(countSpy.count(), 1);
+ QCOMPARE(removedSpy.count(), 3);
+ QCOMPARE(addedSpy.count(), 5);
+ for (int i = 0; i< items.count(); i++) {
+ QCOMPARE(addedSpy.at(i).at(0).toInt(), i);
+ QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i));
+ }
+
+ countSpy.clear();
+ addedSpy.clear();
+ removedSpy.clear();
+
+ items.clear();
+ model.resetItems(items);
+ QCOMPARE(countSpy.count(), 1);
+ QCOMPARE(removedSpy.count(), 5);
+ QCOMPARE(addedSpy.count(), 0);
+}
+
+void tst_QQuickRepeater::properties()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("properties.qml"));
+
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(rootObject);
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(rootObject, "repeater");
+ QVERIFY(repeater);
+
+ QSignalSpy modelSpy(repeater, SIGNAL(modelChanged()));
+ repeater->setModel(3);
+ QCOMPARE(modelSpy.count(),1);
+ repeater->setModel(3);
+ QCOMPARE(modelSpy.count(),1);
+
+ QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged()));
+
+ QQmlComponent rectComponent(&engine);
+ rectComponent.setData("import QtQuick 2.0; Rectangle {}", QUrl::fromLocalFile(""));
+
+ repeater->setDelegate(&rectComponent);
+ QCOMPARE(delegateSpy.count(),1);
+ repeater->setDelegate(&rectComponent);
+ QCOMPARE(delegateSpy.count(),1);
+
+ delete rootObject;
+}
+
+void tst_QQuickRepeater::asynchronous()
+{
+ QQuickView *window = createView();
+ window->show();
+ QQmlIncubationController controller;
+ window->engine()->setIncubationController(&controller);
+
+ window->setSource(testFileUrl("asyncloader.qml"));
+
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject());
+ QVERIFY(rootObject);
+
+ QQuickItem *container = findItem<QQuickItem>(rootObject, "container");
+ QVERIFY(!container);
+ while (!container) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ container = findItem<QQuickItem>(rootObject, "container");
+ }
+
+ QQuickRepeater *repeater = 0;
+ while (!repeater) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ repeater = findItem<QQuickRepeater>(rootObject, "repeater");
+ }
+
+ // items will be created one at a time
+ for (int i = 0; i < 10; ++i) {
+ QString name("delegate");
+ name += QString::number(i);
+ QVERIFY(findItem<QQuickItem>(container, name) == 0);
+ QQuickItem *item = 0;
+ while (!item) {
+ bool b = false;
+ controller.incubateWhile(&b);
+ item = findItem<QQuickItem>(container, name);
+ }
+ }
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ // verify positioning
+ for (int i = 0; i < 10; ++i) {
+ QString name("delegate");
+ name += QString::number(i);
+ QQuickItem *item = findItem<QQuickItem>(container, name);
+ QTRY_COMPARE(item->y(), i * 50.0);
+ }
+
+ delete window;
+}
+
+void tst_QQuickRepeater::initParent()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("initparent.qml"));
+
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(rootObject);
+
+ QCOMPARE(qvariant_cast<QQuickItem*>(rootObject->property("parentItem")), rootObject);
+}
+
+void tst_QQuickRepeater::dynamicModelCrash()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("dynamicmodelcrash.qml"));
+
+ // Don't crash
+ QQuickItem *rootObject = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(rootObject);
+
+ QQuickRepeater *repeater = findItem<QQuickRepeater>(rootObject, "rep");
+ QVERIFY(repeater);
+ QVERIFY(qvariant_cast<QObject *>(repeater->model()) == 0);
+}
+
+QTEST_MAIN(tst_QQuickRepeater)
+
+#include "tst_qquickrepeater.moc"
diff --git a/tests/auto/quick/qquickscreen/data/screen.qml b/tests/auto/quick/qquickscreen/data/screen.qml
new file mode 100644
index 0000000000..780b22f23d
--- /dev/null
+++ b/tests/auto/quick/qquickscreen/data/screen.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Item {
+ width: 100
+ height: 100
+ property int w: Window.Screen.width
+ property int h: Window.Screen.height
+ property int curOrientation: Window.Screen.orientation
+ property int priOrientation: Window.Screen.primaryOrientation
+}
diff --git a/tests/auto/quick/qquickscreen/qquickscreen.pro b/tests/auto/quick/qquickscreen/qquickscreen.pro
new file mode 100644
index 0000000000..fa64556a69
--- /dev/null
+++ b/tests/auto/quick/qquickscreen/qquickscreen.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickscreen
+SOURCES += tst_qquickscreen.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private testlib quick-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
new file mode 100644
index 0000000000..77e6c89495
--- /dev/null
+++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QDebug>
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickView>
+#include <QtGui/QScreen>
+#include "../../shared/util.h"
+
+class tst_qquickscreen : public QQmlDataTest
+{
+ Q_OBJECT
+private slots:
+ void basicProperties();
+};
+
+void tst_qquickscreen::basicProperties()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("screen.qml"));
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QQuickItem* root = view.rootObject();
+ QVERIFY(root);
+
+ QScreen* screen = view.screen();
+ QVERIFY(screen);
+
+ QCOMPARE(screen->size().width(), root->property("w").toInt());
+ QCOMPARE(screen->size().height(), root->property("h").toInt());
+ QCOMPARE(int(screen->orientation()), root->property("curOrientation").toInt());
+ QCOMPARE(int(screen->primaryOrientation()), root->property("priOrientation").toInt());
+}
+
+QTEST_MAIN(tst_qquickscreen)
+
+#include "tst_qquickscreen.moc"
diff --git a/tests/auto/quick/qquickshadereffect/data/deleteShaderEffectSource.qml b/tests/auto/quick/qquickshadereffect/data/deleteShaderEffectSource.qml
new file mode 100644
index 0000000000..a5902fb77f
--- /dev/null
+++ b/tests/auto/quick/qquickshadereffect/data/deleteShaderEffectSource.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ShaderEffect {
+ id: sei
+ property variant source
+ }
+
+ ShaderEffectSource {
+ id: doomed
+ hideSource: true
+ sourceItem: Image {
+ source: "star.png"
+ }
+ }
+
+ function setDeletedShaderEffectSource() {
+ sei.source = doomed;
+ doomed.destroy();
+ // now set a fragment shader to trigger source texture detection.
+ sei.fragmentShader = "varying highp vec2 qt_TexCoord0;\
+ uniform sampler2D source;\
+ uniform lowp float qt_Opacity;\
+ void main() {\
+ gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;\
+ }";
+ }
+}
diff --git a/tests/auto/quick/qquickshadereffect/data/deleteSourceItem.qml b/tests/auto/quick/qquickshadereffect/data/deleteSourceItem.qml
new file mode 100644
index 0000000000..a6ae2fac39
--- /dev/null
+++ b/tests/auto/quick/qquickshadereffect/data/deleteSourceItem.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ShaderEffect {
+ id: sei
+ property variant source
+ }
+
+ ShaderEffectSource {
+ id: doomedses
+ hideSource: true
+ sourceItem: Image {
+ id: doomed
+ source: "star.png"
+ }
+ }
+
+ function setDeletedSourceItem() {
+ doomed.destroy();
+ sei.source = doomedses;
+ // now set a fragment shader to trigger source texture detection.
+ sei.fragmentShader = "varying highp vec2 qt_TexCoord0;\
+ uniform sampler2D source;\
+ uniform lowp float qt_Opacity;\
+ void main() {\
+ gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;\
+ }";
+ }
+}
diff --git a/tests/auto/quick/qquickshadereffect/data/star.png b/tests/auto/quick/qquickshadereffect/data/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/tests/auto/quick/qquickshadereffect/data/star.png
Binary files differ
diff --git a/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro
new file mode 100644
index 0000000000..0af54f83f6
--- /dev/null
+++ b/tests/auto/quick/qquickshadereffect/qquickshadereffect.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qquickshadereffect
+SOURCES += tst_qquickshadereffect.cpp
+
+include (../../shared/util.pri)
+macx:CONFIG -= app_bundle
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp
new file mode 100644
index 0000000000..a2dbac9730
--- /dev/null
+++ b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp
@@ -0,0 +1,320 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <QList>
+#include <QByteArray>
+#include <private/qquickshadereffect_p.h>
+
+#include <QtQuick/QQuickView>
+#include "../../shared/util.h"
+
+
+class TestShaderEffect : public QQuickShaderEffect
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant source READ dummyRead NOTIFY dummyChanged)
+ Q_PROPERTY(QVariant _0aA9zZ READ dummyRead NOTIFY dummyChanged)
+ Q_PROPERTY(QVariant x86 READ dummyRead NOTIFY dummyChanged)
+ Q_PROPERTY(QVariant X READ dummyRead NOTIFY dummyChanged)
+ Q_PROPERTY(QMatrix4x4 mat4x4 READ mat4x4Read NOTIFY dummyChanged)
+
+public:
+ QMatrix4x4 mat4x4Read() const { return QMatrix4x4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1); }
+ QVariant dummyRead() const { return QVariant(); }
+ bool isConnected(const QMetaMethod &signal) const { return m_signals.contains(signal); }
+
+protected:
+ void connectNotify(const QMetaMethod &signal) { m_signals.append(signal); }
+ void disconnectNotify(const QMetaMethod &signal) { m_signals.removeOne(signal); }
+
+signals:
+ void dummyChanged();
+
+private:
+ QList<QMetaMethod> m_signals;
+};
+
+class tst_qquickshadereffect : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickshadereffect();
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ void lookThroughShaderCode_data();
+ void lookThroughShaderCode();
+
+ void deleteSourceItem();
+ void deleteShaderEffectSource();
+
+private:
+ enum PresenceFlags {
+ VertexPresent = 0x01,
+ TexCoordPresent = 0x02,
+ MatrixPresent = 0x04,
+ OpacityPresent = 0x08,
+ PropertyPresent = 0x10
+ };
+};
+
+tst_qquickshadereffect::tst_qquickshadereffect()
+{
+}
+
+void tst_qquickshadereffect::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+}
+
+void tst_qquickshadereffect::cleanupTestCase()
+{
+}
+
+void tst_qquickshadereffect::lookThroughShaderCode_data()
+{
+ QTest::addColumn<QByteArray>("vertexShader");
+ QTest::addColumn<QByteArray>("fragmentShader");
+ QTest::addColumn<int>("presenceFlags");
+
+ QTest::newRow("default")
+ << QByteArray("uniform highp mat4 qt_Matrix; \n"
+ "attribute highp vec4 qt_Vertex; \n"
+ "attribute highp vec2 qt_MultiTexCoord0; \n"
+ "varying highp vec2 qt_TexCoord0; \n"
+ "void main() { \n"
+ " qt_TexCoord0 = qt_MultiTexCoord0; \n"
+ " gl_Position = qt_Matrix * qt_Vertex; \n"
+ "}")
+ << QByteArray("varying highp vec2 qt_TexCoord0; \n"
+ "uniform sampler2D source; \n"
+ "uniform lowp float qt_Opacity; \n"
+ "void main() { \n"
+ " gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity; \n"
+ "}")
+ << (VertexPresent | TexCoordPresent | MatrixPresent | OpacityPresent | PropertyPresent);
+
+ QTest::newRow("empty")
+ << QByteArray(" ") // one space -- if completely empty, default will be used instead.
+ << QByteArray(" ")
+ << 0;
+
+
+ QTest::newRow("inside line comments")
+ << QByteArray("//uniform highp mat4 qt_Matrix;\n"
+ "attribute highp vec4 qt_Vertex;\n"
+ "// attribute highp vec2 qt_MultiTexCoord0;")
+ << QByteArray("uniform int source; // uniform lowp float qt_Opacity;")
+ << (VertexPresent | PropertyPresent);
+
+ QTest::newRow("inside block comments")
+ << QByteArray("/*uniform highp mat4 qt_Matrix;\n"
+ "*/attribute highp vec4 qt_Vertex;\n"
+ "/*/attribute highp vec2 qt_MultiTexCoord0;//**/")
+ << QByteArray("/**/uniform int source; /* uniform lowp float qt_Opacity; */")
+ << (VertexPresent | PropertyPresent);
+
+ QTest::newRow("inside preprocessor directive")
+ << QByteArray("#define uniform\nhighp mat4 qt_Matrix;\n"
+ "attribute highp vec4 qt_Vertex;\n"
+ "#if\\\nattribute highp vec2 qt_MultiTexCoord0;")
+ << QByteArray("uniform int source;\n"
+ " # undef uniform lowp float qt_Opacity;")
+ << (VertexPresent | PropertyPresent);
+
+
+ QTest::newRow("line comments between")
+ << QByteArray("uniform//foo\nhighp//bar\nmat4//baz\nqt_Matrix;\n"
+ "attribute//\nhighp//\nvec4//\nqt_Vertex;\n"
+ " //*/ uniform \n attribute //\\ \n highp //// \n vec2 //* \n qt_MultiTexCoord0;")
+ << QByteArray("uniform// lowp float qt_Opacity;\nsampler2D source;")
+ << (VertexPresent | TexCoordPresent | MatrixPresent | PropertyPresent);
+
+ QTest::newRow("block comments between")
+ << QByteArray("uniform/*foo*/highp/*/bar/*/mat4/**//**/qt_Matrix;\n"
+ "attribute/**/highp/**/vec4/**/qt_Vertex;\n"
+ " /* * */ attribute /*///*/ highp /****/ vec2 /**/ qt_MultiTexCoord0;")
+ << QByteArray("uniform/*/ uniform//lowp/*float qt_Opacity;*/sampler2D source;")
+ << (VertexPresent | TexCoordPresent | MatrixPresent | PropertyPresent);
+
+ QTest::newRow("preprocessor directive between")
+ << QByteArray("uniform\n#foo\nhighp\n#bar\nmat4\n#baz\\\nblimey\nqt_Matrix;\n"
+ "attribute\n#\nhighp\n#\nvec4\n#\nqt_Vertex;\n"
+ " #uniform \n attribute \n # foo \n highp \n # bar \n vec2 \n#baz \n qt_MultiTexCoord0;")
+ << QByteArray("uniform\n#if lowp float qt_Opacity;\nsampler2D source;")
+ << (VertexPresent | TexCoordPresent | MatrixPresent | PropertyPresent);
+
+ QTest::newRow("newline between")
+ << QByteArray("uniform\nhighp\nmat4\nqt_Matrix\n;\n"
+ "attribute \t\r\n highp \n vec4 \n\n qt_Vertex ;\n"
+ " \n attribute \n highp \n vec2 \n qt_Multi\nTexCoord0 \n ;")
+ << QByteArray("uniform\nsampler2D\nsource;"
+ "uniform lowp float qt_Opacity;")
+ << (VertexPresent | MatrixPresent | OpacityPresent | PropertyPresent);
+
+
+ QTest::newRow("extra characters #1")
+ << QByteArray("funiform highp mat4 qt_Matrix;\n"
+ "attribute highp vec4 qt_Vertex_;\n"
+ "attribute highp vec2 qqt_MultiTexCoord0;")
+ << QByteArray("uniformm int source;\n"
+ "uniform4 lowp float qt_Opacity;")
+ << 0;
+
+ QTest::newRow("extra characters #2")
+ << QByteArray("attribute phighp vec4 qt_Vertex;\n"
+ "attribute highpi vec2 qt_MultiTexCoord0;"
+ "fattribute highp vec4 qt_Vertex;\n"
+ "attributed highp vec2 qt_MultiTexCoord0;")
+ << QByteArray(" ")
+ << 0;
+
+ QTest::newRow("missing characters #1")
+ << QByteArray("unifor highp mat4 qt_Matrix;\n"
+ "attribute highp vec4 qt_Vert;\n"
+ "attribute highp vec2 MultiTexCoord0;")
+ << QByteArray("niform int source;\n"
+ "uniform qt_Opacity;")
+ << 0;
+
+ QTest::newRow("missing characters #2")
+ << QByteArray("attribute high vec4 qt_Vertex;\n"
+ "attribute ighp vec2 qt_MultiTexCoord0;"
+ "tribute highp vec4 qt_Vertex;\n"
+ "attrib highp vec2 qt_MultiTexCoord0;")
+ << QByteArray(" ")
+ << 0;
+
+ QTest::newRow("precision")
+ << QByteArray("uniform mat4 qt_Matrix;\n"
+ "attribute kindofhighp vec4 qt_Vertex;\n"
+ "attribute highp qt_MultiTexCoord0;\n")
+ << QByteArray("uniform lowp float qt_Opacity;\n"
+ "uniform mediump float source;\n")
+ << (MatrixPresent | OpacityPresent | PropertyPresent);
+
+
+ QTest::newRow("property name #1")
+ << QByteArray("uniform highp vec3 _0aA9zZ;")
+ << QByteArray(" ")
+ << int(PropertyPresent);
+
+ QTest::newRow("property name #2")
+ << QByteArray("uniform mediump vec2 x86;")
+ << QByteArray(" ")
+ << int(PropertyPresent);
+
+ QTest::newRow("property name #3")
+ << QByteArray("uniform lowp float X;")
+ << QByteArray(" ")
+ << int(PropertyPresent);
+
+ QTest::newRow("property name #4")
+ << QByteArray("uniform highp mat4 mat4x4;")
+ << QByteArray(" ")
+ << int(PropertyPresent);
+}
+
+void tst_qquickshadereffect::lookThroughShaderCode()
+{
+ QFETCH(QByteArray, vertexShader);
+ QFETCH(QByteArray, fragmentShader);
+ QFETCH(int, presenceFlags);
+
+ TestShaderEffect item;
+ QMetaMethod dummyChangedSignal = QMetaMethod::fromSignal(&TestShaderEffect::dummyChanged);
+ QVERIFY(!item.isConnected(dummyChangedSignal)); // Nothing connected yet.
+
+ QString expected;
+ if ((presenceFlags & VertexPresent) == 0)
+ expected += "Warning: Missing reference to \'qt_Vertex\'.\n";
+ if ((presenceFlags & TexCoordPresent) == 0)
+ expected += "Warning: Missing reference to \'qt_MultiTexCoord0\'.\n";
+ if ((presenceFlags & MatrixPresent) == 0)
+ expected += "Warning: Vertex shader is missing reference to \'qt_Matrix\'.\n";
+ if ((presenceFlags & OpacityPresent) == 0)
+ expected += "Warning: Shaders are missing reference to \'qt_Opacity\'.\n";
+
+ item.setVertexShader(vertexShader);
+ item.setFragmentShader(fragmentShader);
+ QCOMPARE(item.parseLog(), expected);
+
+ // If the uniform was successfully parsed, the notify signal has been connected to an update slot.
+ QCOMPARE(item.isConnected(dummyChangedSignal), (presenceFlags & PropertyPresent) != 0);
+}
+
+void tst_qquickshadereffect::deleteSourceItem()
+{
+ // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash
+ QQuickView *view = new QQuickView(0);
+ view->setSource(QUrl::fromLocalFile(testFile("deleteSourceItem.qml")));
+ view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view));
+ QVERIFY(view);
+ QObject *obj = view->rootObject();
+ QVERIFY(obj);
+ QMetaObject::invokeMethod(obj, "setDeletedSourceItem");
+ QTest::qWait(50);
+ delete view;
+}
+
+void tst_qquickshadereffect::deleteShaderEffectSource()
+{
+ // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash
+ QQuickView *view = new QQuickView(0);
+ view->setSource(QUrl::fromLocalFile(testFile("deleteShaderEffectSource.qml")));
+ view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view));
+ QVERIFY(view);
+ QObject *obj = view->rootObject();
+ QVERIFY(obj);
+ QMetaObject::invokeMethod(obj, "setDeletedShaderEffectSource");
+ QTest::qWait(50);
+ delete view;
+}
+
+QTEST_MAIN(tst_qquickshadereffect)
+
+#include "tst_qquickshadereffect.moc"
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/deleteOnUpdate.qml b/tests/auto/quick/qquicksmoothedanimation/data/deleteOnUpdate.qml
new file mode 100644
index 0000000000..ff8dfaa846
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/deleteOnUpdate.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300; height: 300;
+
+ Rectangle {
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+
+ property real prevX: 100
+ onXChanged: {
+ if (x - prevX > 10) {
+ anim.to += 5
+ anim.restart(); //this can cause deletion of backend animation classes
+ prevX = x;
+ }
+ }
+
+ SmoothedAnimation on x {
+ id: anim
+ objectName: "anim"
+ velocity: 100
+ to: 150
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/simpleanimation.qml b/tests/auto/quick/qquicksmoothedanimation/data/simpleanimation.qml
new file mode 100644
index 0000000000..b2be63ec94
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/simpleanimation.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300; height: 300;
+ Rectangle {
+ objectName: "rect"
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ }
+ SmoothedAnimation { objectName: "anim"}
+} \ No newline at end of file
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation1.qml b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation1.qml
new file mode 100644
index 0000000000..3631f971f0
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation1.qml
@@ -0,0 +1,3 @@
+import QtQuick 2.0
+
+SmoothedAnimation {}
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation2.qml b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation2.qml
new file mode 100644
index 0000000000..b07120234a
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation2.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+SmoothedAnimation {
+ to: 10; duration: 300; reversingMode: SmoothedAnimation.Immediate
+}
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation3.qml b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation3.qml
new file mode 100644
index 0000000000..8d5dc4a92b
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimation3.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+SmoothedAnimation {
+ to: 10; velocity: 250; reversingMode: SmoothedAnimation.Sync
+ maximumEasingTime: 150
+}
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationBehavior.qml b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationBehavior.qml
new file mode 100644
index 0000000000..81d36bf015
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationBehavior.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400; color: "blue"
+
+ Rectangle {
+ id: rect1
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { to: 200; velocity: 500 }
+ SmoothedAnimation on y { to: 200; velocity: 500 }
+ }
+
+ Rectangle {
+ objectName: "theRect"
+ color: "green"
+ width: 60; height: 60;
+ x: rect1.x; y: rect1.y;
+ // id are needed for SmoothedAnimation in order to avoid deferred creation
+ Behavior on x { SmoothedAnimation { id: anim1; objectName: "easeX"; velocity: 400 } }
+ Behavior on y { SmoothedAnimation { id: anim2; objectName: "easeY"; velocity: 400 } }
+ }
+ }
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationValueSource.qml b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationValueSource.qml
new file mode 100644
index 0000000000..e136df84f6
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationValueSource.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300; height: 300;
+ Rectangle {
+ objectName: "theRect"
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { objectName: "easeX"; to: 200; velocity: 500 }
+ SmoothedAnimation on y { objectName: "easeY"; to: 200; duration: 250; velocity: 500 }
+ }
+}
diff --git a/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationZeroDuration.qml b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationZeroDuration.qml
new file mode 100644
index 0000000000..d0183ad00c
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/data/smoothedanimationZeroDuration.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 300; height: 300;
+ Rectangle {
+ objectName: "theRect"
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { objectName: "easeX"; to: 200; duration: 0 }
+ }
+}
diff --git a/tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro b/tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro
new file mode 100644
index 0000000000..5e3872de83
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/qquicksmoothedanimation.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquicksmoothedanimation
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquicksmoothedanimation.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp
new file mode 100644
index 0000000000..705ee5cf46
--- /dev/null
+++ b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp
@@ -0,0 +1,265 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/private/qquicksmoothedanimation_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <private/qqmlvaluetype_p.h>
+#include "../../shared/util.h"
+
+class tst_qquicksmoothedanimation : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquicksmoothedanimation();
+
+private slots:
+ void defaultValues();
+ void values();
+ void disabled();
+ void simpleAnimation();
+ void valueSource();
+ void behavior();
+ void deleteOnUpdate();
+ void zeroDuration();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qquicksmoothedanimation::tst_qquicksmoothedanimation()
+{
+}
+
+void tst_qquicksmoothedanimation::defaultValues()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("smoothedanimation1.qml"));
+ QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 0.);
+ QCOMPARE(obj->velocity(), 200.);
+ QCOMPARE(obj->duration(), -1);
+ QCOMPARE(obj->maximumEasingTime(), -1);
+ QCOMPARE(obj->reversingMode(), QQuickSmoothedAnimation::Eased);
+
+ delete obj;
+}
+
+void tst_qquicksmoothedanimation::values()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("smoothedanimation2.qml"));
+ QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 10.);
+ QCOMPARE(obj->velocity(), 200.);
+ QCOMPARE(obj->duration(), 300);
+ QCOMPARE(obj->maximumEasingTime(), -1);
+ QCOMPARE(obj->reversingMode(), QQuickSmoothedAnimation::Immediate);
+
+ delete obj;
+}
+
+void tst_qquicksmoothedanimation::disabled()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("smoothedanimation3.qml"));
+ QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 10.);
+ QCOMPARE(obj->velocity(), 250.);
+ QCOMPARE(obj->maximumEasingTime(), 150);
+ QCOMPARE(obj->reversingMode(), QQuickSmoothedAnimation::Sync);
+
+ delete obj;
+}
+
+void tst_qquicksmoothedanimation::simpleAnimation()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("simpleanimation.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj);
+
+ QQuickRectangle *rect = obj->findChild<QQuickRectangle*>("rect");
+ QVERIFY(rect);
+
+ QQuickSmoothedAnimation *animation = obj->findChild<QQuickSmoothedAnimation*>("anim");
+ QVERIFY(animation);
+
+ animation->setTargetObject(rect);
+ animation->setProperty("x");
+ animation->setTo(200);
+ animation->setDuration(250);
+ QVERIFY(animation->target() == rect);
+ QVERIFY(animation->property() == "x");
+ QVERIFY(animation->to() == 200);
+ animation->start();
+ QVERIFY(animation->isRunning());
+ QTest::qWait(animation->duration());
+ QTRY_COMPARE(rect->x(), qreal(200));
+ QTest::qWait(100); //smoothed animation doesn't report stopped until delayed timer fires
+
+ QVERIFY(!animation->isRunning());
+ rect->setX(0);
+ animation->start();
+ QVERIFY(animation->isRunning());
+ animation->pause();
+ QVERIFY(animation->isRunning());
+ QVERIFY(animation->isPaused());
+ animation->setCurrentTime(125);
+ QVERIFY(animation->currentTime() == 125);
+ QCOMPARE(rect->x(), qreal(100));
+}
+
+void tst_qquicksmoothedanimation::valueSource()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("smoothedanimationValueSource.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *theRect = rect->findChild<QQuickRectangle*>("theRect");
+ QVERIFY(theRect);
+
+ QQuickSmoothedAnimation *easeX = rect->findChild<QQuickSmoothedAnimation*>("easeX");
+ QVERIFY(easeX);
+ QVERIFY(easeX->isRunning());
+
+ QQuickSmoothedAnimation *easeY = rect->findChild<QQuickSmoothedAnimation*>("easeY");
+ QVERIFY(easeY);
+ QVERIFY(easeY->isRunning());
+
+ // XXX get the proper duration
+ QTest::qWait(100);
+
+ QTRY_VERIFY(!easeX->isRunning());
+ QTRY_VERIFY(!easeY->isRunning());
+
+ QTRY_COMPARE(theRect->x(), qreal(200));
+ QTRY_COMPARE(theRect->y(), qreal(200));
+
+ delete rect;
+}
+
+void tst_qquicksmoothedanimation::behavior()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("smoothedanimationBehavior.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *theRect = rect->findChild<QQuickRectangle*>("theRect");
+ QVERIFY(theRect);
+
+ QQuickSmoothedAnimation *easeX = rect->findChild<QQuickSmoothedAnimation*>("easeX");
+ QVERIFY(easeX);
+
+ QQuickSmoothedAnimation *easeY = rect->findChild<QQuickSmoothedAnimation*>("easeY");
+ QVERIFY(easeY);
+
+ // XXX get the proper duration
+ QTest::qWait(400);
+
+ QTRY_VERIFY(!easeX->isRunning());
+ QTRY_VERIFY(!easeY->isRunning());
+
+ QTRY_COMPARE(theRect->x(), qreal(200));
+ QTRY_COMPARE(theRect->y(), qreal(200));
+
+ delete rect;
+}
+
+void tst_qquicksmoothedanimation::deleteOnUpdate()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("deleteOnUpdate.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickSmoothedAnimation *anim = rect->findChild<QQuickSmoothedAnimation*>("anim");
+ QVERIFY(anim);
+
+ //don't crash
+ QTest::qWait(500);
+
+ delete rect;
+}
+
+void tst_qquicksmoothedanimation::zeroDuration()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("smoothedanimationZeroDuration.qml"));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QQuickRectangle *theRect = rect->findChild<QQuickRectangle*>("theRect");
+ QVERIFY(theRect);
+
+ QQuickSmoothedAnimation *easeX = rect->findChild<QQuickSmoothedAnimation*>("easeX");
+ QVERIFY(easeX);
+ QVERIFY(easeX->isRunning());
+
+ QTRY_VERIFY(!easeX->isRunning());
+ QTRY_COMPARE(theRect->x(), qreal(200));
+
+ delete rect;
+}
+
+QTEST_MAIN(tst_qquicksmoothedanimation)
+
+#include "tst_qquicksmoothedanimation.moc"
diff --git a/tests/auto/quick/qquickspringanimation/data/springanimation1.qml b/tests/auto/quick/qquickspringanimation/data/springanimation1.qml
new file mode 100644
index 0000000000..9f52aa56c1
--- /dev/null
+++ b/tests/auto/quick/qquickspringanimation/data/springanimation1.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.0
+
+SpringAnimation {
+}
diff --git a/tests/auto/quick/qquickspringanimation/data/springanimation2.qml b/tests/auto/quick/qquickspringanimation/data/springanimation2.qml
new file mode 100644
index 0000000000..9f72e51533
--- /dev/null
+++ b/tests/auto/quick/qquickspringanimation/data/springanimation2.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ Item {
+ id: item
+ }
+
+ SpringAnimation {
+ target: item; property: "x"
+ to: 1.44; velocity: 0.9
+ spring: 1.0; damping: 0.5
+ epsilon: 0.25; modulus: 360.0
+ mass: 2.0;
+ running: true;
+ }
+}
diff --git a/tests/auto/quick/qquickspringanimation/data/springanimation3.qml b/tests/auto/quick/qquickspringanimation/data/springanimation3.qml
new file mode 100644
index 0000000000..f4dc121eb8
--- /dev/null
+++ b/tests/auto/quick/qquickspringanimation/data/springanimation3.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+SpringAnimation {
+ to: 1.44; velocity: 0.9
+ spring: 1.0; damping: 0.5
+ epsilon: 0.25; modulus: 360.0
+ mass: 2.0; running: false
+}
diff --git a/tests/auto/quick/qquickspringanimation/qquickspringanimation.pro b/tests/auto/quick/qquickspringanimation/qquickspringanimation.pro
new file mode 100644
index 0000000000..1254c3b4d7
--- /dev/null
+++ b/tests/auto/quick/qquickspringanimation/qquickspringanimation.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickspringanimation
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickspringanimation.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
new file mode 100644
index 0000000000..78d114c904
--- /dev/null
+++ b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <private/qquickspringanimation_p.h>
+#include <private/qqmlvaluetype_p.h>
+#include "../../shared/util.h"
+
+class tst_qquickspringanimation : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickspringanimation();
+
+private slots:
+ void defaultValues();
+ void values();
+ void disabled();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qquickspringanimation::tst_qquickspringanimation()
+{
+}
+
+void tst_qquickspringanimation::defaultValues()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("springanimation1.qml"));
+ QQuickSpringAnimation *obj = qobject_cast<QQuickSpringAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 0.);
+ QCOMPARE(obj->velocity(), 0.);
+ QCOMPARE(obj->spring(), 0.);
+ QCOMPARE(obj->damping(), 0.);
+ QCOMPARE(obj->epsilon(), 0.01);
+ QCOMPARE(obj->modulus(), 0.);
+ QCOMPARE(obj->mass(), 1.);
+ QCOMPARE(obj->isRunning(), false);
+
+ delete obj;
+}
+
+void tst_qquickspringanimation::values()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("springanimation2.qml"));
+ QObject *root = c.create();
+
+ QQuickSpringAnimation *obj = root->findChild<QQuickSpringAnimation*>();
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 1.44);
+ QCOMPARE(obj->velocity(), 0.9);
+ QCOMPARE(obj->spring(), 1.0);
+ QCOMPARE(obj->damping(), 0.5);
+ QCOMPARE(obj->epsilon(), 0.25);
+ QCOMPARE(obj->modulus(), 360.0);
+ QCOMPARE(obj->mass(), 2.0);
+ QCOMPARE(obj->isRunning(), true);
+
+ QTRY_COMPARE(obj->isRunning(), false);
+
+ delete obj;
+}
+
+void tst_qquickspringanimation::disabled()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("springanimation3.qml"));
+ QQuickSpringAnimation *obj = qobject_cast<QQuickSpringAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 1.44);
+ QCOMPARE(obj->velocity(), 0.9);
+ QCOMPARE(obj->spring(), 1.0);
+ QCOMPARE(obj->damping(), 0.5);
+ QCOMPARE(obj->epsilon(), 0.25);
+ QCOMPARE(obj->modulus(), 360.0);
+ QCOMPARE(obj->mass(), 2.0);
+ QCOMPARE(obj->isRunning(), false);
+
+ delete obj;
+}
+
+QTEST_MAIN(tst_qquickspringanimation)
+
+#include "tst_qquickspringanimation.moc"
diff --git a/tests/auto/quick/qquickspritesequence/data/advance.qml b/tests/auto/quick/qquickspritesequence/data/advance.qml
new file mode 100644
index 0000000000..014c6ee519
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/data/advance.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ SpriteSequence {
+ objectName: "sprite"
+ sprites: [Sprite {
+ name: "firstState"
+ source: "squarefacesprite.png"
+ frameCount: 3
+ frameSync: true
+ to: {"secondState":1}
+ }, Sprite {
+ name: "secondState"
+ source: "squarefacesprite.png"
+ frameCount: 6
+ frameSync: true
+ } ]
+ width: 160
+ height: 160
+ }
+}
diff --git a/tests/auto/quick/qquickspritesequence/data/basic.qml b/tests/auto/quick/qquickspritesequence/data/basic.qml
new file mode 100644
index 0000000000..f77ef209b0
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/data/basic.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ SpriteSequence {
+ objectName: "sprite"
+ sprites: Sprite {
+ name: "happy"
+ source: "squarefacesprite.png"
+ frameCount: 6
+ frameDuration: 120
+ }
+ width: 160
+ height: 160
+ }
+}
diff --git a/tests/auto/quick/qquickspritesequence/data/crashonstart.qml b/tests/auto/quick/qquickspritesequence/data/crashonstart.qml
new file mode 100644
index 0000000000..6e0d8b1f66
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/data/crashonstart.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//QTBUG-24797
+import QtQuick 2.0
+
+Rectangle {
+ width: 800
+ height: 800
+
+ SpriteSequence {
+ id: mysprite
+ sprites: [s1,s2]
+ scale: 2
+ height: 200
+ width: 200
+ anchors.centerIn: parent
+ }
+
+ Component.onCompleted: mysprite.jumpTo("running")
+ Sprite {
+ id: s1
+ name: "standing"
+ frameCount: 12
+ frameDuration: 80
+ source: "squarefacesprite.png"
+ }
+
+ Sprite {
+ id: s2
+ name: "running"
+ frameCount: 6
+ frameDuration: 80
+ source: "squarefacesprite.png"
+ }
+}
diff --git a/tests/auto/quick/qquickspritesequence/data/huge.png b/tests/auto/quick/qquickspritesequence/data/huge.png
new file mode 100644
index 0000000000..1ffcc04395
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/data/huge.png
Binary files differ
diff --git a/tests/auto/quick/qquickspritesequence/data/huge.qml b/tests/auto/quick/qquickspritesequence/data/huge.qml
new file mode 100644
index 0000000000..a935eb71ec
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/data/huge.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 320
+ height: 320
+
+ SpriteSequence {
+ objectName: "sprite"
+ sprites: Sprite {
+ name: "black"
+ source: "huge.png"
+ frameCount: 4096
+ frameSync: true
+ }
+ width: 64
+ height: 64
+ }
+}
diff --git a/tests/auto/quick/qquickspritesequence/data/squarefacesprite.png b/tests/auto/quick/qquickspritesequence/data/squarefacesprite.png
new file mode 100644
index 0000000000..f9a5d5fcce
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/data/squarefacesprite.png
Binary files differ
diff --git a/tests/auto/quick/qquickspritesequence/qquickspritesequence.pro b/tests/auto/quick/qquickspritesequence/qquickspritesequence.pro
new file mode 100644
index 0000000000..ee5cb5d25b
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/qquickspritesequence.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickspritesequence
+SOURCES += tst_qquickspritesequence.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp b/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp
new file mode 100644
index 0000000000..79b80c5cfe
--- /dev/null
+++ b/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include "../../shared/util.h"
+#include <QtQuick/qquickview.h>
+#include <private/qquickspritesequence_p.h>
+
+class tst_qquickspritesequence : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickspritesequence(){}
+
+private slots:
+ void test_properties();
+ void test_framerateAdvance();//Separate codepath for QQuickSpriteEngine
+ void test_huge();//Separate codepath for QQuickSpriteEngine
+ void test_jumpToCrash();
+};
+
+void tst_qquickspritesequence::test_properties()
+{
+ QQuickView *window = new QQuickView(0);
+
+ window->setSource(testFileUrl("basic.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->rootObject());
+ QQuickSpriteSequence* sprite = window->rootObject()->findChild<QQuickSpriteSequence*>("sprite");
+ QVERIFY(sprite);
+
+ QVERIFY(sprite->running());
+ QVERIFY(sprite->interpolate());
+
+ sprite->setRunning(false);
+ QVERIFY(!sprite->running());
+ sprite->setInterpolate(false);
+ QVERIFY(!sprite->interpolate());
+
+ delete window;
+}
+
+void tst_qquickspritesequence::test_huge()
+{
+ /* Merely tests that it doesn't crash, as waiting for it to complete
+ (or even having something to watch) would bloat CI.
+ The large allocations of memory involved and separate codepath does make
+ a doesn't crash test worthwhile.
+ */
+ QQuickView *window = new QQuickView(0);
+
+ window->setSource(testFileUrl("huge.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->rootObject());
+ QQuickSpriteSequence* sprite = window->rootObject()->findChild<QQuickSpriteSequence*>("sprite");
+ QVERIFY(sprite);
+
+ delete window;
+}
+
+void tst_qquickspritesequence::test_framerateAdvance()
+{
+ QQuickView *window = new QQuickView(0);
+
+ window->setSource(testFileUrl("advance.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->rootObject());
+ QQuickSpriteSequence* sprite = window->rootObject()->findChild<QQuickSpriteSequence*>("sprite");
+ QVERIFY(sprite);
+
+ QTRY_COMPARE(sprite->currentSprite(), QLatin1String("secondState"));
+ delete window;
+}
+
+void tst_qquickspritesequence::test_jumpToCrash()
+{
+ QQuickView *window = new QQuickView(0);
+
+ window->setSource(testFileUrl("crashonstart.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ //verify: Don't crash
+
+ delete window;
+}
+
+QTEST_MAIN(tst_qquickspritesequence)
+
+#include "tst_qquickspritesequence.moc"
diff --git a/tests/auto/quick/qquickstates/data/ExtendedRectangle.qml b/tests/auto/quick/qquickstates/data/ExtendedRectangle.qml
new file mode 100644
index 0000000000..1ea346b841
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/ExtendedRectangle.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+Rectangle {
+ id: extendedRect
+ objectName: "extendedRect"
+ property color extendedColor: "orange"
+
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "green"
+ PropertyChanges {
+ target: rect
+ onDidSomething: {
+ extendedRect.color = "green"
+ extendedColor = "green"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/Implementation/MyType.qml b/tests/auto/quick/qquickstates/data/Implementation/MyType.qml
new file mode 100644
index 0000000000..01eb32cd4d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/Implementation/MyType.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ Column {
+ anchors.centerIn: parent
+ Image { id: image1; objectName: "image1" }
+ Image { id: image2; objectName: "image2" }
+ Image { id: image3; objectName: "image3" }
+ }
+
+ states: State {
+ name: "SetImageState"
+ PropertyChanges {
+ target: image1
+ source: "images/qt-logo.png"
+ }
+ PropertyChanges {
+ target: image2
+ source: "images/" + "qt-logo.png"
+ }
+ PropertyChanges {
+ target: image3
+ source: "images/" + (true ? "qt-logo.png" : "")
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "SetImageState"
+ }
+
+}
diff --git a/tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.png b/tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.png
new file mode 100644
index 0000000000..14ddf2a028
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/Implementation/images/qt-logo.png
Binary files differ
diff --git a/tests/auto/quick/qquickstates/data/QTBUG-14830.qml b/tests/auto/quick/qquickstates/data/QTBUG-14830.qml
new file mode 100644
index 0000000000..5ba7c3ad6f
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/QTBUG-14830.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 1024
+ height: 768
+
+ Item {
+ id: area
+ objectName: "area"
+ property int numx: 6
+ property int cellwidth: 1024/numx
+
+ onWidthChanged: {
+ width = width>1024?1024:width;
+ }
+
+ state: 'minimal'
+ states: [
+ State {
+ name: 'minimal'
+ PropertyChanges {
+ target: area
+ width: cellwidth
+ }
+ }
+ ]
+
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges1.qml b/tests/auto/quick/qquickstates/data/anchorChanges1.qml
new file mode 100644
index 0000000000..378f5390f9
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges1.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ width: 50; height: 50
+ color: "green";
+ anchors.left: parent.left
+ anchors.leftMargin: 5
+ }
+ states: State {
+ name: "right"
+ AnchorChanges {
+ id: ancCh
+ target: myRect;
+ anchors.left: undefined
+ anchors.right: container.right
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges2.qml b/tests/auto/quick/qquickstates/data/anchorChanges2.qml
new file mode 100644
index 0000000000..dc7f8ef0d1
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges2.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ width: 50; height: 50
+ color: "green";
+ anchors.left: parent.left
+ anchors.leftMargin: 5
+ }
+ states: State {
+ name: "right"
+ AnchorChanges {
+ target: myRect;
+ anchors.left: undefined
+ anchors.right: parent.right
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges3.qml b/tests/auto/quick/qquickstates/data/anchorChanges3.qml
new file mode 100644
index 0000000000..af49575854
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges3.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "green";
+ anchors.left: parent.left
+ anchors.right: rightGuideline.left
+ anchors.top: topGuideline.top
+ anchors.bottom: container.bottom
+ }
+ Item { objectName: "LeftGuideline"; id: leftGuideline; x: 10 }
+ Item { id: rightGuideline; x: 150 }
+ Item { id: topGuideline; y: 10 }
+ Item { objectName: "BottomGuideline"; id: bottomGuideline; y: 150 }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ anchors.left: leftGuideline.left
+ anchors.right: container.right
+ anchors.top: container.top
+ anchors.bottom: bottomGuideline.bottom
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges4.qml b/tests/auto/quick/qquickstates/data/anchorChanges4.qml
new file mode 100644
index 0000000000..28b55818bd
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges4.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "green";
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Item { objectName: "LeftGuideline"; id: leftGuideline; x: 10 }
+ Item { objectName: "BottomGuideline"; id: bottomGuideline; y: 150 }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ anchors.horizontalCenter: bottomGuideline.horizontalCenter
+ anchors.verticalCenter: leftGuideline.verticalCenter
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChanges5.qml b/tests/auto/quick/qquickstates/data/anchorChanges5.qml
new file mode 100644
index 0000000000..b1ca968fb9
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChanges5.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ color: "green";
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.baseline: parent.baseline
+ }
+ Item { objectName: "LeftGuideline"; id: leftGuideline; x: 10 }
+ Item { objectName: "BottomGuideline"; id: bottomGuideline; y: 150 }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: myRect;
+ anchors.horizontalCenter: bottomGuideline.horizontalCenter
+ anchors.baseline: leftGuideline.baseline
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorChangesCrash.qml b/tests/auto/quick/qquickstates/data/anchorChangesCrash.qml
new file mode 100644
index 0000000000..9af0e4645a
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorChangesCrash.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+ width: 400
+ height: 400
+
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ anchors.top: container.top
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorRewindBug.qml b/tests/auto/quick/qquickstates/data/anchorRewindBug.qml
new file mode 100644
index 0000000000..60c537b1ed
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorRewindBug.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+Rectangle {
+ id: container
+ color: "red"
+ height: 200
+ width: 200
+ Column {
+ id: column
+ objectName: "column"
+ anchors.left: container.right
+ anchors.bottom: container.bottom
+
+ Rectangle {
+ id: rectangle
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ Rectangle {
+ color: "blue"
+ height: 100
+ width: 200
+ }
+ }
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ target: column
+ anchors.left: undefined
+ anchors.right: container.right
+ }
+ PropertyChanges {
+ target: rectangle
+ visible: false
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/anchorRewindBug2.qml b/tests/auto/quick/qquickstates/data/anchorRewindBug2.qml
new file mode 100644
index 0000000000..574ef473ce
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/anchorRewindBug2.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width:200; height:300
+
+ Rectangle {
+ id: rectangle
+ objectName: "mover"
+ color: "green"
+ width:50; height:50
+ }
+
+ states: [
+ State {
+ name: "anchored"
+ AnchorChanges {
+ target: rectangle
+ anchors.left: root.left
+ anchors.right: root.right
+ anchors.bottom: root.bottom
+ }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml b/tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml
new file mode 100644
index 0000000000..413af2ee42
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/attachedPropertyChanges.qml
@@ -0,0 +1,20 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+Item {
+ id: item
+ width: 100; height: 100
+ MyRectangle.foo: 0
+
+ states: State {
+ name: "foo1"
+ PropertyChanges {
+ target: item
+ MyRectangle.foo: 1
+ width: 50
+ }
+ }
+
+ Component.onCompleted: item.state = "foo1"
+}
+
diff --git a/tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml b/tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml
new file mode 100644
index 0000000000..6cbf524ec2
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/autoStateAtStartupRestoreBug.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int input: 1
+ property int test: 9
+
+ states: [
+ State {
+ name: "portrait"
+ when: root.input == 1
+ PropertyChanges {
+ target: root
+ test: 3
+ }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/data/avoidFastForward.qml b/tests/auto/quick/qquickstates/data/avoidFastForward.qml
new file mode 100644
index 0000000000..519befc31e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/avoidFastForward.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: rect
+ width: 200
+ height: 200
+
+ property int updateCount: 0
+ onColorChanged: updateCount++
+
+ property color aColor: "green"
+
+ states: State {
+ name: "a"
+ PropertyChanges { target: rect; color: aColor }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicBinding.qml b/tests/auto/quick/qquickstates/data/basicBinding.qml
new file mode 100644
index 0000000000..59b67d0863
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+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/quick/qquickstates/data/basicBinding2.qml b/tests/auto/quick/qquickstates/data/basicBinding2.qml
new file mode 100644
index 0000000000..55f88120aa
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding2.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ property color sourceColor: "red"
+ width: 100; height: 100
+ color: sourceColor
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicBinding3.qml b/tests/auto/quick/qquickstates/data/basicBinding3.qml
new file mode 100644
index 0000000000..361ab0b091
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding3.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+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 }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicBinding4.qml b/tests/auto/quick/qquickstates/data/basicBinding4.qml
new file mode 100644
index 0000000000..b29f0fcf22
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicBinding4.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+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/quick/qquickstates/data/basicChanges.qml b/tests/auto/quick/qquickstates/data/basicChanges.qml
new file mode 100644
index 0000000000..3e2b73acde
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/basicChanges2.qml b/tests/auto/quick/qquickstates/data/basicChanges2.qml
new file mode 100644
index 0000000000..5ff46cc60c
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges2.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+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" }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/basicChanges3.qml b/tests/auto/quick/qquickstates/data/basicChanges3.qml
new file mode 100644
index 0000000000..e46e98f75e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges3.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+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/quick/qquickstates/data/basicChanges4.qml b/tests/auto/quick/qquickstates/data/basicChanges4.qml
new file mode 100644
index 0000000000..7da1e0fb2e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicChanges4.qml
@@ -0,0 +1,19 @@
+import Qt.test 1.0
+import QtQuick 2.0
+
+MyRectangle {
+ id: rect
+ width: 100; height: 100
+ color: "red"
+
+ states: State {
+ name: "aBlueDay"
+ PropertyChanges {
+ target: rect
+ onPropertyWithNotifyChanged: { rect.color = "blue"; }
+ }
+ }
+
+ Component.onCompleted: rect.state = "aBlueDay"
+}
+
diff --git a/tests/auto/quick/qquickstates/data/basicExtension.qml b/tests/auto/quick/qquickstates/data/basicExtension.qml
new file mode 100644
index 0000000000..00f5fee287
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/basicExtension.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+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 }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/deleting.qml b/tests/auto/quick/qquickstates/data/deleting.qml
new file mode 100644
index 0000000000..b8e8d33c17
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/deleting.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue"; objectName: "pc1" }
+ PropertyChanges { target: myRectangle; radius: 5; objectName: "pc2" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/deletingState.qml b/tests/auto/quick/qquickstates/data/deletingState.qml
new file mode 100644
index 0000000000..68a9c2a24d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/deletingState.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ StateGroup {
+ id: stateGroup
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; color: "blue" }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/editProperties.qml b/tests/auto/quick/qquickstates/data/editProperties.qml
new file mode 100644
index 0000000000..9bff3657ba
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/editProperties.qml
@@ -0,0 +1,34 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ property color sourceColor: "blue"
+ width: 400; height: 400
+ color: "red"
+
+ Rectangle {
+ id: rect2
+ objectName: "rect2"
+ width: parent.width + 2
+ height: 200
+ color: "yellow"
+ }
+
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges {
+ target: rect2
+ width:50
+ height: 40
+ }
+ },
+ State {
+ name: "green"
+ PropertyChanges {
+ target: rect2
+ width: myRectangle.width / 2
+ height: myRectangle.width / 4
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/explicit.qml b/tests/auto/quick/qquickstates/data/explicit.qml
new file mode 100644
index 0000000000..d09893a1db
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/explicit.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ property color sourceColor: "blue"
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges {
+ objectName: "changes"
+ target: myRectangle; explicit: true
+ color: sourceColor
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/extendsBug.qml b/tests/auto/quick/qquickstates/data/extendsBug.qml
new file mode 100644
index 0000000000..573341520d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/extendsBug.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 200
+
+ Rectangle {
+ id: rect
+ objectName: "greenRect"
+ width: 100
+ height: 100
+ color: "green"
+ }
+
+ states:[
+ State {
+ name: "a"
+ PropertyChanges { target: rect; x: 100 }
+ },
+ State {
+ name: "b"
+ extend:"a"
+ PropertyChanges { target: rect; y: 100 }
+ }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/data/fakeExtension.qml b/tests/auto/quick/qquickstates/data/fakeExtension.qml
new file mode 100644
index 0000000000..6a5c7003f6
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/fakeExtension.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+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" }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/illegalObj.qml b/tests/auto/quick/qquickstates/data/illegalObj.qml
new file mode 100644
index 0000000000..a2bbd5d32b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/illegalObj.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: myItem
+
+ states : State {
+ PropertyChanges {
+ target: myItem
+ children: Item { id: newItem }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/illegalTempState.qml b/tests/auto/quick/qquickstates/data/illegalTempState.qml
new file mode 100644
index 0000000000..9cb39c0728
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/illegalTempState.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: card
+ width: 100; height: 100
+
+ states: [
+ State {
+ name: "placed"
+ PropertyChanges { target: card; state: "idle" }
+ },
+ State {
+ name: "idle"
+ }
+ ]
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: card.state = "placed"
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/image.png b/tests/auto/quick/qquickstates/data/image.png
new file mode 100644
index 0000000000..ed1833c95b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/image.png
Binary files differ
diff --git a/tests/auto/quick/qquickstates/data/legalTempState.qml b/tests/auto/quick/qquickstates/data/legalTempState.qml
new file mode 100644
index 0000000000..a93860f5cc
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/legalTempState.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: card
+ width: 100; height: 100
+
+ states: [
+ State {
+ name: "placed"
+ onCompleted: card.state = "idle"
+ StateChangeScript { script: console.log("entering placed") }
+ },
+ State {
+ name: "idle"
+ StateChangeScript { script: console.log("entering idle") }
+ }
+ ]
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: card.state = "placed"
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/nonExistantProp.qml b/tests/auto/quick/qquickstates/data/nonExistantProp.qml
new file mode 100644
index 0000000000..ce502699bb
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/nonExistantProp.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; colr: "blue" }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange1.qml b/tests/auto/quick/qquickstates/data/parentChange1.qml
new file mode 100644
index 0000000000..663ad1a264
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange1.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Item {
+ x: 10; y: 10
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ x: -100; y: -50
+ Item {
+ id: newParent
+ objectName: "NewParent"
+ x: 248; y: 360
+ }
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange2.qml b/tests/auto/quick/qquickstates/data/parentChange2.qml
new file mode 100644
index 0000000000..ae290e961e
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange2.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: newParent
+ width: 400; height: 400
+ Item {
+ scale: .5
+ rotation: 15
+ x: 10; y: 10
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange3.qml b/tests/auto/quick/qquickstates/data/parentChange3.qml
new file mode 100644
index 0000000000..46665cb4c8
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange3.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Item {
+ scale: .5
+ rotation: 15
+ transformOrigin: "Center"
+ x: 10; y: 10
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5
+ width: 100; height: 100
+ transformOrigin: "BottomLeft"
+ color: "red"
+ }
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ x: 200; y: 200
+ rotation: 52;
+ scale: 2
+ Item {
+ id: newParent
+ x: 100; y: 100
+ }
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange4.qml b/tests/auto/quick/qquickstates/data/parentChange4.qml
new file mode 100644
index 0000000000..22de72f8c9
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange4.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5; y: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ id: newParent
+ transform: Scale { xScale: .5; yScale: .7}
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange5.qml b/tests/auto/quick/qquickstates/data/parentChange5.qml
new file mode 100644
index 0000000000..c353d2637f
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange5.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5; y: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ id: newParent
+ transform: Rotation { angle: 30; axis { x: 0; y: 1; z: 0 } }
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/parentChange6.qml b/tests/auto/quick/qquickstates/data/parentChange6.qml
new file mode 100644
index 0000000000..b373dbba20
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/parentChange6.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+ Rectangle {
+ id: myRect
+ objectName: "MyRect"
+ x: 5; y: 5
+ width: 100; height: 100
+ color: "red"
+ }
+ MouseArea {
+ id: clickable
+ anchors.fill: parent
+ }
+
+ Item {
+ id: newParent
+ rotation: 180
+ }
+
+ states: State {
+ name: "reparented"
+ when: clickable.pressed
+ ParentChange {
+ target: myRect
+ parent: newParent
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/propertyErrors.qml b/tests/auto/quick/qquickstates/data/propertyErrors.qml
new file mode 100644
index 0000000000..ddd636493d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/propertyErrors.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: myRectangle; colr: "blue"; activeFocus: true }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/reset.qml b/tests/auto/quick/qquickstates/data/reset.qml
new file mode 100644
index 0000000000..f0ecab0950
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/reset.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 640
+ height: 480
+ Image {
+ id: image
+ width: 40
+ source: "image.png"
+ }
+
+ states: State {
+ name: "state1"
+ PropertyChanges {
+ target: image
+ width: undefined
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/restoreEntryValues.qml b/tests/auto/quick/qquickstates/data/restoreEntryValues.qml
new file mode 100644
index 0000000000..950a522841
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/restoreEntryValues.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges {
+ target: myRectangle
+ restoreEntryValues: false
+ color: "blue"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/returnToBase.qml b/tests/auto/quick/qquickstates/data/returnToBase.qml
new file mode 100644
index 0000000000..9a0ee82397
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/returnToBase.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: theRect
+ property bool triggerState: false
+ property string stateString: ""
+ states: [ State {
+ when: triggerState
+ PropertyChanges {
+ target: theRect
+ stateString: "inState"
+ }
+ },
+ State {
+ name: ""
+ PropertyChanges {
+ target: theRect
+ stateString: "originalState"
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/revertListBug.qml b/tests/auto/quick/qquickstates/data/revertListBug.qml
new file mode 100644
index 0000000000..fbc4bc5ecc
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/revertListBug.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400
+
+ property Item targetItem: rect1
+
+ function switchTargetItem() {
+ if (targetItem === rect1)
+ targetItem = rect2;
+ else
+ targetItem = rect1;
+ }
+
+ states: State {
+ name: "reparented"
+ ParentChange {
+ target: targetItem
+ parent: newParent
+ x: 0; y: 0
+ }
+ }
+
+ Item {
+ objectName: "originalParent1"
+ Rectangle {
+ id: rect1; objectName: "rect1"
+ width: 50; height: 50
+ color: "green"
+ }
+ }
+
+ Item {
+ objectName: "originalParent2"
+ Rectangle {
+ id: rect2; objectName: "rect2"
+ x: 50; y: 50
+ width: 50; height: 50
+ color: "green"
+ }
+ }
+
+ Item {
+ id: newParent; objectName: "newParent"
+ x: 200; y: 100
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/script.qml b/tests/auto/quick/qquickstates/data/script.qml
new file mode 100644
index 0000000000..218f0fae74
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/script.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+Rectangle {
+ id: myRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ StateChangeScript { script: myRectangle.color = "blue"; }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverride.qml b/tests/auto/quick/qquickstates/data/signalOverride.qml
new file mode 100644
index 0000000000..9ab8037e51
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverride.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRectangle {
+ id: rect
+
+ onDidSomething: color = "blue"
+
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "green"
+ PropertyChanges {
+ target: rect
+ onDidSomething: color = "green"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverride2.qml b/tests/auto/quick/qquickstates/data/signalOverride2.qml
new file mode 100644
index 0000000000..4e5e335b8b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverride2.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRectangle {
+ id: rect
+ onDidSomething: color = "blue"
+ width: 100; height: 100
+ ExtendedRectangle {}
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverrideCrash.qml b/tests/auto/quick/qquickstates/data/signalOverrideCrash.qml
new file mode 100644
index 0000000000..3e2ae1e93d
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverrideCrash.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyRectangle {
+ id: rect
+
+ width: 100; height: 100
+ states: State {
+ name: "overridden"
+ PropertyChanges {
+ target: rect
+ onDidSomething: rect.state = ""
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml b/tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml
new file mode 100644
index 0000000000..3937874aa2
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverrideCrash2.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: myRect
+ width: 400
+ height: 400
+
+ states: [
+ State {
+ name: "state1"
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("Hello World")
+ color: "green"
+ }
+ },
+ State {
+ name: "state2"; extend: "state1"
+ PropertyChanges {
+ target: myRect
+ color: "red"
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml b/tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml
new file mode 100644
index 0000000000..98d4c57219
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverrideCrash3.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: myRect
+ width: 400
+ height: 400
+
+ onHeightChanged: console.log("base state")
+
+ states: [
+ State {
+ name: "state1"
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state1")
+ color: "green"
+ }
+ },
+ State {
+ name: "state2";
+ PropertyChanges {
+ target: myRect
+ onHeightChanged: console.log("state2")
+ color: "red"
+ }
+ }]
+}
diff --git a/tests/auto/quick/qquickstates/data/signalOverrideCrash4.qml b/tests/auto/quick/qquickstates/data/signalOverrideCrash4.qml
new file mode 100644
index 0000000000..705ad07715
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/signalOverrideCrash4.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 400; height: 400
+ property int someProp
+
+ states: [
+ State {
+ name: "state1"
+ PropertyChanges { target: root; onSomePropChanged: h1() }
+ },
+ State {
+ name: "state2"
+ PropertyChanges { target: root; onSomePropChanged: h2() }
+ }
+ ]
+
+ // non-default handlers
+ function h1() {}
+ function h2() {}
+}
diff --git a/tests/auto/quick/qquickstates/data/unnamedWhen.qml b/tests/auto/quick/qquickstates/data/unnamedWhen.qml
new file mode 100644
index 0000000000..35eacff07b
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/unnamedWhen.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: theRect
+ property bool triggerState: false
+ property string stateString: ""
+ states: State {
+ when: triggerState
+ PropertyChanges {
+ target: theRect
+ stateString: "inState"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/urlResolution.qml b/tests/auto/quick/qquickstates/data/urlResolution.qml
new file mode 100644
index 0000000000..516ac034d6
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/urlResolution.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+import "Implementation"
+
+Rectangle {
+ width: 100
+ height: 200
+
+ MyType {
+ objectName: "MyType"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquickstates/data/whenOrdering.qml b/tests/auto/quick/qquickstates/data/whenOrdering.qml
new file mode 100644
index 0000000000..92025a2054
--- /dev/null
+++ b/tests/auto/quick/qquickstates/data/whenOrdering.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+Rectangle {
+ property bool condition1: false
+ property bool condition2: false
+
+ states: [
+ State { name: "state1"; when: condition1 },
+ State { name: "state2"; when: condition2 }
+ ]
+}
diff --git a/tests/auto/quick/qquickstates/qquickstates.pro b/tests/auto/quick/qquickstates/qquickstates.pro
new file mode 100644
index 0000000000..753d8d42d4
--- /dev/null
+++ b/tests/auto/quick/qquickstates/qquickstates.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+TARGET = tst_qquickstates
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickstates.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+QT += core-private gui-private v8-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
new file mode 100644
index 0000000000..e165b559f7
--- /dev/null
+++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp
@@ -0,0 +1,1631 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <private/qquickstateoperations_p.h>
+#include <private/qquickanchors_p_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <private/qquickimage_p.h>
+#include <QtQuick/private/qquickpropertychanges_p.h>
+#include <QtQuick/private/qquickstategroup_p.h>
+#include <private/qquickitem_p.h>
+#include <private/qqmlproperty_p.h>
+#include "../../shared/util.h"
+
+class MyAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int foo READ foo WRITE setFoo)
+public:
+ MyAttached(QObject *parent) : QObject(parent), m_foo(13) {}
+
+ int foo() const { return m_foo; }
+ void setFoo(int f) { m_foo = f; }
+
+private:
+ int m_foo;
+};
+
+class MyRect : public QQuickRectangle
+{
+ Q_OBJECT
+ Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal)
+public:
+ MyRect() {}
+
+ void doSomething() { emit didSomething(); }
+
+ int propertyWithNotify() const { return m_prop; }
+ void setPropertyWithNotify(int i) { m_prop = i; emit oddlyNamedNotifySignal(); }
+
+ static MyAttached *qmlAttachedProperties(QObject *o) {
+ return new MyAttached(o);
+ }
+Q_SIGNALS:
+ void didSomething();
+ void oddlyNamedNotifySignal();
+
+private:
+ int m_prop;
+};
+
+QML_DECLARE_TYPE(MyRect)
+QML_DECLARE_TYPEINFO(MyRect, QML_HAS_ATTACHED_PROPERTIES)
+
+class tst_qquickstates : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickstates() {}
+
+private:
+ QByteArray fullDataPath(const QString &path) const;
+
+private slots:
+ void initTestCase();
+
+ void basicChanges();
+ void attachedPropertyChanges();
+ void basicExtension();
+ void basicBinding();
+ void signalOverride();
+ void signalOverrideCrash();
+ void signalOverrideCrash2();
+ void signalOverrideCrash3();
+ void signalOverrideCrash4();
+ void parentChange();
+ void parentChangeErrors();
+ void anchorChanges();
+ void anchorChanges2();
+ void anchorChanges3();
+ void anchorChanges4();
+ void anchorChanges5();
+ void anchorChangesRTL();
+ void anchorChangesRTL2();
+ void anchorChangesRTL3();
+ void anchorChangesCrash();
+ void anchorRewindBug();
+ void anchorRewindBug2();
+ void script();
+ void restoreEntryValues();
+ void explicitChanges();
+ void propertyErrors();
+ void incorrectRestoreBug();
+ void autoStateAtStartupRestoreBug();
+ void deletingChange();
+ void deletingState();
+ void tempState();
+ void illegalTempState();
+ void nonExistantProperty();
+ void reset();
+ void illegalObjectCreation();
+ void whenOrdering();
+ void urlResolution();
+ void unnamedWhen();
+ void returnToBase();
+ void extendsBug();
+ void editProperties();
+ void QTBUG_14830();
+ void avoidFastForward();
+ void revertListBug();
+};
+
+void tst_qquickstates::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<MyRect>("Qt.test", 1, 0, "MyRectangle");
+}
+
+QByteArray tst_qquickstates::fullDataPath(const QString &path) const
+{
+ return testFileUrl(path).toString().toUtf8();
+}
+
+void tst_qquickstates::basicChanges()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicChanges.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicChanges2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("green");
+ QCOMPARE(rect->color(),QColor("green"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("green");
+ QCOMPARE(rect->color(),QColor("green"));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicChanges3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->border()->width(),1.0);
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(rect->border()->width(),1.0);
+
+ rectPrivate->setState("bordered");
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->border()->width(),2.0);
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->border()->width(),1.0);
+ //### we should be checking that this is an implicit rather than explicit 1 (which currently fails)
+
+ rectPrivate->setState("bordered");
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->border()->width(),2.0);
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(rect->border()->width(),1.0);
+
+ }
+
+ {
+ // Test basicChanges4.qml can magically connect to propertyWithNotify's notify
+ // signal using 'onPropertyWithNotifyChanged' even though the signal name is
+ // actually 'oddlyNamedNotifySignal'
+
+ QQmlComponent component(&engine, testFileUrl("basicChanges4.qml"));
+ QVERIFY(component.isReady());
+
+ MyRect *rect = qobject_cast<MyRect*>(component.create());
+ QVERIFY(rect != 0);
+
+ QMetaProperty prop = rect->metaObject()->property(rect->metaObject()->indexOfProperty("propertyWithNotify"));
+ QVERIFY(prop.hasNotifySignal());
+ QString notifySignal = prop.notifySignal().methodSignature();
+ QVERIFY(!notifySignal.startsWith("propertyWithNotifyChanged("));
+
+ QCOMPARE(rect->color(), QColor(Qt::red));
+
+ rect->setPropertyWithNotify(100);
+ QCOMPARE(rect->color(), QColor(Qt::blue));
+ }
+}
+
+void tst_qquickstates::attachedPropertyChanges()
+{
+ QQmlEngine engine;
+
+ QQmlComponent component(&engine, testFileUrl("attachedPropertyChanges.qml"));
+ QVERIFY(component.isReady());
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
+ QVERIFY(item != 0);
+ QCOMPARE(item->width(), 50.0);
+
+ // Ensure attached property has been changed
+ QObject *attObj = qmlAttachedPropertiesObject<MyRect>(item, false);
+ QVERIFY(attObj);
+
+ MyAttached *att = qobject_cast<MyAttached*>(attObj);
+ QVERIFY(att);
+
+ QCOMPARE(att->foo(), 1);
+}
+
+void tst_qquickstates::basicExtension()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicExtension.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->border()->width(),1.0);
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(rect->border()->width(),1.0);
+
+ rectPrivate->setState("bordered");
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(rect->border()->width(),2.0);
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(rect->border()->width(),1.0);
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->border()->width(),1.0);
+
+ rectPrivate->setState("bordered");
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(rect->border()->width(),2.0);
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->border()->width(),1.0);
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("fakeExtension.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("green");
+ QCOMPARE(rect->color(),QColor("green"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("green");
+ QCOMPARE(rect->color(),QColor("green"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("green");
+ QCOMPARE(rect->color(),QColor("green"));
+ }
+}
+
+void tst_qquickstates::basicBinding()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicBinding.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ rect->setProperty("sourceColor", QColor("green"));
+ QCOMPARE(rect->color(),QColor("green"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ rect->setProperty("sourceColor", QColor("yellow"));
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("yellow"));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicBinding2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ rect->setProperty("sourceColor", QColor("green"));
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("green"));
+ rect->setProperty("sourceColor", QColor("yellow"));
+ QCOMPARE(rect->color(),QColor("yellow"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("yellow"));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicBinding3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+ rect->setProperty("sourceColor", QColor("green"));
+ QCOMPARE(rect->color(),QColor("green"));
+
+ rectPrivate->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"));
+
+ rectPrivate->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"));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("basicBinding4.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ rect->setProperty("sourceColor", QColor("yellow"));
+ QCOMPARE(rect->color(),QColor("yellow"));
+
+ rectPrivate->setState("green");
+ QCOMPARE(rect->color(),QColor("green"));
+ rect->setProperty("sourceColor", QColor("purple"));
+ QCOMPARE(rect->color(),QColor("green"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("purple"));
+
+ rectPrivate->setState("green");
+ QCOMPARE(rect->color(),QColor("green"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ }
+}
+
+void tst_qquickstates::signalOverride()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("signalOverride.qml"));
+ MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+ rect->doSomething();
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ QQuickItemPrivate::get(rect)->setState("green");
+ rect->doSomething();
+ QCOMPARE(rect->color(),QColor("green"));
+
+ delete rect;
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("signalOverride2.qml"));
+ MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("white"));
+ rect->doSomething();
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("extendedRect"));
+ QQuickItemPrivate::get(innerRect)->setState("green");
+ rect->doSomething();
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(innerRect->color(),QColor("green"));
+ QCOMPARE(innerRect->property("extendedColor").value<QColor>(),QColor("green"));
+
+ delete rect;
+ }
+}
+
+void tst_qquickstates::signalOverrideCrash()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash.qml"));
+ MyRect *rect = qobject_cast<MyRect*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickItemPrivate::get(rect)->setState("overridden");
+ rect->doSomething();
+}
+
+void tst_qquickstates::signalOverrideCrash2()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickItemPrivate::get(rect)->setState("state1");
+ QQuickItemPrivate::get(rect)->setState("state2");
+ QQuickItemPrivate::get(rect)->setState("state1");
+
+ delete rect;
+}
+
+void tst_qquickstates::signalOverrideCrash3()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickItemPrivate::get(rect)->setState("state1");
+ QQuickItemPrivate::get(rect)->setState("");
+ QQuickItemPrivate::get(rect)->setState("state2");
+ QQuickItemPrivate::get(rect)->setState("");
+
+ delete rect;
+}
+
+void tst_qquickstates::signalOverrideCrash4()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("signalOverrideCrash4.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ rectPrivate->setState("state1");
+ rectPrivate->setState("state2");
+ rectPrivate->setState("state1");
+ rectPrivate->setState("state2");
+ rectPrivate->setState("");
+
+ delete rect;
+}
+
+void tst_qquickstates::parentChange()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("parentChange1.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickParentChange *pChange = qobject_cast<QQuickParentChange*>(state->operationAt(0));
+ QVERIFY(pChange != 0);
+ QQuickItem *nParent = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("NewParent"));
+ QVERIFY(nParent != 0);
+
+ QCOMPARE(pChange->parent(), nParent);
+
+ QQuickItemPrivate::get(rect)->setState("reparented");
+ QCOMPARE(innerRect->rotation(), qreal(0));
+ QCOMPARE(innerRect->scale(), qreal(1));
+ QCOMPARE(innerRect->x(), qreal(-133));
+ QCOMPARE(innerRect->y(), qreal(-300));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("parentChange2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ rectPrivate->setState("reparented");
+ QCOMPARE(innerRect->rotation(), qreal(15));
+ QCOMPARE(innerRect->scale(), qreal(.5));
+ QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-19.9075));
+ QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-8.73433));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("parentChange3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ rectPrivate->setState("reparented");
+ QCOMPARE(innerRect->rotation(), qreal(-37));
+ QCOMPARE(innerRect->scale(), qreal(.25));
+ QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-217.305));
+ QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-164.413));
+
+ rectPrivate->setState("");
+ QCOMPARE(innerRect->rotation(), qreal(0));
+ QCOMPARE(innerRect->scale(), qreal(1));
+ QCOMPARE(innerRect->x(), qreal(5));
+ //do a non-qFuzzyCompare fuzzy compare
+ QVERIFY(innerRect->y() < qreal(0.00001) && innerRect->y() > qreal(-0.00001));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("parentChange6.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QQuickItemPrivate::get(rect)->setState("reparented");
+ QCOMPARE(innerRect->rotation(), qreal(180));
+ QCOMPARE(innerRect->scale(), qreal(1));
+ QCOMPARE(innerRect->x(), qreal(-105));
+ QCOMPARE(innerRect->y(), qreal(-105));
+ }
+}
+
+void tst_qquickstates::parentChangeErrors()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("parentChange4.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale");
+ QQuickItemPrivate::get(rect)->setState("reparented");
+ QCOMPARE(innerRect->rotation(), qreal(0));
+ QCOMPARE(innerRect->scale(), qreal(1));
+ QCOMPARE(innerRect->x(), qreal(5));
+ QCOMPARE(innerRect->y(), qreal(5));
+ }
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("parentChange5.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform");
+ QQuickItemPrivate::get(rect)->setState("reparented");
+ QCOMPARE(innerRect->rotation(), qreal(0));
+ QCOMPARE(innerRect->scale(), qreal(1));
+ QCOMPARE(innerRect->x(), qreal(5));
+ QCOMPARE(innerRect->y(), qreal(5));
+ }
+}
+
+void tst_qquickstates::anchorChanges()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges1.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0));
+ QVERIFY(aChanges != 0);
+
+ QCOMPARE(aChanges->anchors()->left().isUndefinedLiteral(), true);
+ QVERIFY(!aChanges->anchors()->left().isEmpty());
+ QVERIFY(!aChanges->anchors()->right().isEmpty());
+
+ rectPrivate->setState("right");
+ QCOMPARE(innerRect->x(), qreal(150));
+ QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect));
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all)
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
+
+ rectPrivate->setState("");
+ QCOMPARE(innerRect->x(), qreal(5));
+
+ delete rect;
+}
+
+void tst_qquickstates::anchorChanges2()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ rectPrivate->setState("right");
+ QCOMPARE(innerRect->x(), qreal(150));
+
+ rectPrivate->setState("");
+ QCOMPARE(innerRect->x(), qreal(5));
+
+ delete rect;
+}
+
+void tst_qquickstates::anchorChanges3()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline"));
+ QVERIFY(leftGuideline != 0);
+
+ QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline"));
+ QVERIFY(bottomGuideline != 0);
+
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0));
+ QVERIFY(aChanges != 0);
+
+ QVERIFY(!aChanges->anchors()->top().isEmpty());
+ QVERIFY(!aChanges->anchors()->bottom().isEmpty());
+
+ rectPrivate->setState("reanchored");
+ QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect));
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().item, QQuickItemPrivate::get(leftGuideline)->left().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickItemPrivate::get(leftGuideline)->left().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->top().item, rectPrivate->top().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->top().anchorLine, rectPrivate->top().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->bottom().item, QQuickItemPrivate::get(bottomGuideline)->bottom().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->bottom().anchorLine, QQuickItemPrivate::get(bottomGuideline)->bottom().anchorLine);
+
+ QCOMPARE(innerRect->x(), qreal(10));
+ QCOMPARE(innerRect->y(), qreal(0));
+ QCOMPARE(innerRect->width(), qreal(190));
+ QCOMPARE(innerRect->height(), qreal(150));
+
+ rectPrivate->setState("");
+ QCOMPARE(innerRect->x(), qreal(0));
+ QCOMPARE(innerRect->y(), qreal(10));
+ QCOMPARE(innerRect->width(), qreal(150));
+ QCOMPARE(innerRect->height(), qreal(190));
+
+ delete rect;
+}
+
+void tst_qquickstates::anchorChanges4()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges4.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline"));
+ QVERIFY(leftGuideline != 0);
+
+ QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline"));
+ QVERIFY(bottomGuideline != 0);
+
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0));
+ QVERIFY(aChanges != 0);
+
+ QVERIFY(!aChanges->anchors()->horizontalCenter().isEmpty());
+ QVERIFY(!aChanges->anchors()->verticalCenter().isEmpty());
+
+ QQuickItemPrivate::get(rect)->setState("reanchored");
+ QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect));
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().item, QQuickItemPrivate::get(bottomGuideline)->horizontalCenter().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().anchorLine, QQuickItemPrivate::get(bottomGuideline)->horizontalCenter().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->verticalCenter().item, QQuickItemPrivate::get(leftGuideline)->verticalCenter().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->verticalCenter().anchorLine, QQuickItemPrivate::get(leftGuideline)->verticalCenter().anchorLine);
+
+ delete rect;
+}
+
+void tst_qquickstates::anchorChanges5()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges5.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+
+ QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline"));
+ QVERIFY(leftGuideline != 0);
+
+ QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline"));
+ QVERIFY(bottomGuideline != 0);
+
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0));
+ QVERIFY(aChanges != 0);
+
+ QVERIFY(!aChanges->anchors()->baseline().isEmpty());
+
+ QQuickItemPrivate::get(rect)->setState("reanchored");
+ QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect));
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().item, QQuickItemPrivate::get(bottomGuideline)->horizontalCenter().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().anchorLine, QQuickItemPrivate::get(bottomGuideline)->horizontalCenter().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->baseline().item, QQuickItemPrivate::get(leftGuideline)->baseline().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->baseline().anchorLine, QQuickItemPrivate::get(leftGuideline)->baseline().anchorLine);
+
+ delete rect;
+}
+
+void mirrorAnchors(QQuickItem *item) {
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ itemPrivate->setLayoutMirror(true);
+}
+
+qreal offsetRTL(QQuickItem *anchorItem, QQuickItem *item) {
+ return anchorItem->width()+2*anchorItem->x()-item->width();
+}
+
+void tst_qquickstates::anchorChangesRTL()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges1.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+ mirrorAnchors(innerRect);
+
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0));
+ QVERIFY(aChanges != 0);
+
+ rectPrivate->setState("right");
+ QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150));
+ QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect));
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all)
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
+
+ rectPrivate->setState("");
+ QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) -qreal(5));
+
+ delete rect;
+}
+
+void tst_qquickstates::anchorChangesRTL2()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+ mirrorAnchors(innerRect);
+
+ rectPrivate->setState("right");
+ QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150));
+
+ rectPrivate->setState("");
+ QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(5));
+
+ delete rect;
+}
+
+void tst_qquickstates::anchorChangesRTL3()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges3.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect"));
+ QVERIFY(innerRect != 0);
+ mirrorAnchors(innerRect);
+
+ QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline"));
+ QVERIFY(leftGuideline != 0);
+
+ QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline"));
+ QVERIFY(bottomGuideline != 0);
+
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0));
+ QVERIFY(aChanges != 0);
+
+ rectPrivate->setState("reanchored");
+ QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect));
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().item, QQuickItemPrivate::get(leftGuideline)->left().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickItemPrivate::get(leftGuideline)->left().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->top().item, rectPrivate->top().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->top().anchorLine, rectPrivate->top().anchorLine);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->bottom().item, QQuickItemPrivate::get(bottomGuideline)->bottom().item);
+ QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->bottom().anchorLine, QQuickItemPrivate::get(bottomGuideline)->bottom().anchorLine);
+
+ QCOMPARE(innerRect->x(), offsetRTL(leftGuideline, innerRect) - qreal(10));
+ QCOMPARE(innerRect->y(), qreal(0));
+ // between left side of parent and leftGuideline.x: 10, which has width 0
+ QCOMPARE(innerRect->width(), qreal(10));
+ QCOMPARE(innerRect->height(), qreal(150));
+
+ rectPrivate->setState("");
+ QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(0));
+ QCOMPARE(innerRect->y(), qreal(10));
+ // between right side of parent and left side of rightGuideline.x: 150, which has width 0
+ QCOMPARE(innerRect->width(), qreal(50));
+ QCOMPARE(innerRect->height(), qreal(190));
+
+ delete rect;
+}
+
+//QTBUG-9609
+void tst_qquickstates::anchorChangesCrash()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorChangesCrash.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickItemPrivate::get(rect)->setState("reanchored");
+
+ delete rect;
+}
+
+// QTBUG-12273
+void tst_qquickstates::anchorRewindBug()
+{
+ QQuickView *view = new QQuickView;
+ view->setSource(testFileUrl("anchorRewindBug.qml"));
+
+ view->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(view));
+
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(view->rootObject());
+ QVERIFY(rect != 0);
+
+ QQuickItem * column = rect->findChild<QQuickItem*>("column");
+
+ QVERIFY(column != 0);
+ QVERIFY(!QQuickItemPrivate::get(column)->heightValid);
+ QVERIFY(!QQuickItemPrivate::get(column)->widthValid);
+ QCOMPARE(column->height(), 200.0);
+ QQuickItemPrivate::get(rect)->setState("reanchored");
+
+ // column height and width should stay implicit
+ // and column's implicit resizing should still work
+ QVERIFY(!QQuickItemPrivate::get(column)->heightValid);
+ QVERIFY(!QQuickItemPrivate::get(column)->widthValid);
+ QTRY_COMPARE(column->height(), 100.0);
+
+ QQuickItemPrivate::get(rect)->setState("");
+
+ // column height and width should stay implicit
+ // and column's implicit resizing should still work
+ QVERIFY(!QQuickItemPrivate::get(column)->heightValid);
+ QVERIFY(!QQuickItemPrivate::get(column)->widthValid);
+ QTRY_COMPARE(column->height(), 200.0);
+
+ delete view;
+}
+
+// QTBUG-11834
+void tst_qquickstates::anchorRewindBug2()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("anchorRewindBug2.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *mover = rect->findChild<QQuickRectangle*>("mover");
+
+ QVERIFY(mover != 0);
+ QCOMPARE(mover->y(), qreal(0.0));
+ QCOMPARE(mover->width(), qreal(50.0));
+
+ QQuickItemPrivate::get(rect)->setState("anchored");
+ QCOMPARE(mover->y(), qreal(250.0));
+ QCOMPARE(mover->width(), qreal(200.0));
+
+ QQuickItemPrivate::get(rect)->setState("");
+ QCOMPARE(mover->y(), qreal(0.0));
+ QCOMPARE(mover->width(), qreal(50.0));
+
+ delete rect;
+}
+
+void tst_qquickstates::script()
+{
+ QQmlEngine engine;
+
+ {
+ QQmlComponent rectComponent(&engine, testFileUrl("script.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("blue")); // a script isn't reverted
+ }
+}
+
+void tst_qquickstates::restoreEntryValues()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("restoreEntryValues.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("blue"));
+}
+
+void tst_qquickstates::explicitChanges()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("explicit.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QQmlListReference list(rect, "states");
+ QQuickState *state = qobject_cast<QQuickState*>(list.at(0));
+ QVERIFY(state != 0);
+
+ qmlExecuteDeferred(state);
+ QQuickPropertyChanges *changes = qobject_cast<QQuickPropertyChanges*>(rect->findChild<QQuickPropertyChanges*>("changes"));
+ QVERIFY(changes != 0);
+ QVERIFY(changes->isExplicit());
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rect->setProperty("sourceColor", QColor("green"));
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ rect->setProperty("sourceColor", QColor("yellow"));
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("yellow"));
+}
+
+void tst_qquickstates::propertyErrors()
+{
+ QQmlEngine engine;
+ QQmlComponent rectComponent(&engine, testFileUrl("propertyErrors.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->color(),QColor("red"));
+
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"activeFocus\"");
+ QQuickItemPrivate::get(rect)->setState("blue");
+}
+
+void tst_qquickstates::incorrectRestoreBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("basicChanges.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QCOMPARE(rect->color(),QColor("red"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ // make sure if we change the base state value, we then restore to it correctly
+ rect->setColor(QColor("green"));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("green"));
+}
+
+void tst_qquickstates::autoStateAtStartupRestoreBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent component(&engine, testFileUrl("autoStateAtStartupRestoreBug.qml"));
+ QObject *obj = component.create();
+
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("test").toInt(), 3);
+
+ obj->setProperty("input", 2);
+
+ QCOMPARE(obj->property("test").toInt(), 9);
+
+ delete obj;
+}
+
+void tst_qquickstates::deletingChange()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("deleting.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+ QCOMPARE(rect->radius(),qreal(5));
+
+ rectPrivate->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->radius(),qreal(0));
+
+ QQuickPropertyChanges *pc = rect->findChild<QQuickPropertyChanges*>("pc1");
+ QVERIFY(pc != 0);
+ delete pc;
+
+ QQuickState *state = rect->findChild<QQuickState*>();
+ QVERIFY(state != 0);
+ qmlExecuteDeferred(state);
+ QCOMPARE(state->operationCount(), 1);
+
+ rectPrivate->setState("blue");
+ QCOMPARE(rect->color(),QColor("red"));
+ QCOMPARE(rect->radius(),qreal(5));
+
+ delete rect;
+}
+
+void tst_qquickstates::deletingState()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("deletingState.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ QQuickStateGroup *sg = rect->findChild<QQuickStateGroup*>();
+ QVERIFY(sg != 0);
+ QVERIFY(sg->findState("blue") != 0);
+
+ sg->setState("blue");
+ QCOMPARE(rect->color(),QColor("blue"));
+
+ sg->setState("");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ QQuickState *state = rect->findChild<QQuickState*>();
+ QVERIFY(state != 0);
+ delete state;
+
+ QVERIFY(sg->findState("blue") == 0);
+
+ //### should we warn that state doesn't exist
+ sg->setState("blue");
+ QCOMPARE(rect->color(),QColor("red"));
+
+ delete rect;
+}
+
+void tst_qquickstates::tempState()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("legalTempState.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QTest::ignoreMessage(QtDebugMsg, "entering placed");
+ QTest::ignoreMessage(QtDebugMsg, "entering idle");
+ rectPrivate->setState("placed");
+ QCOMPARE(rectPrivate->state(), QLatin1String("idle"));
+}
+
+void tst_qquickstates::illegalTempState()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("illegalTempState.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition.");
+ rectPrivate->setState("placed");
+ QCOMPARE(rectPrivate->state(), QLatin1String("placed"));
+}
+
+void tst_qquickstates::nonExistantProperty()
+{
+ QQmlEngine engine;
+
+ QQmlComponent rectComponent(&engine, testFileUrl("nonExistantProp.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
+ rectPrivate->setState("blue");
+ QCOMPARE(rectPrivate->state(), QLatin1String("blue"));
+}
+
+void tst_qquickstates::reset()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("reset.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickImage *image = rect->findChild<QQuickImage*>();
+ QVERIFY(image != 0);
+ QCOMPARE(image->width(), qreal(40.));
+ QCOMPARE(image->height(), qreal(20.));
+
+ QQuickItemPrivate::get(rect)->setState("state1");
+
+ QCOMPARE(image->width(), 20.0);
+ QCOMPARE(image->height(), qreal(20.));
+
+ delete rect;
+}
+
+void tst_qquickstates::illegalObjectCreation()
+{
+ QQmlEngine engine;
+
+ QQmlComponent component(&engine, testFileUrl("illegalObj.qml"));
+ QList<QQmlError> errors = component.errors();
+ QVERIFY(errors.count() == 1);
+ const QQmlError &error = errors.at(0);
+ QCOMPARE(error.line(), 9);
+ QCOMPARE(error.column(), 23);
+ QCOMPARE(error.description().toUtf8().constData(), "PropertyChanges does not support creating state-specific objects.");
+}
+
+void tst_qquickstates::whenOrdering()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("whenOrdering.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+ rect->setProperty("condition2", true);
+ QCOMPARE(rectPrivate->state(), QLatin1String("state2"));
+ rect->setProperty("condition1", true);
+ QCOMPARE(rectPrivate->state(), QLatin1String("state1"));
+ rect->setProperty("condition2", false);
+ QCOMPARE(rectPrivate->state(), QLatin1String("state1"));
+ rect->setProperty("condition2", true);
+ QCOMPARE(rectPrivate->state(), QLatin1String("state1"));
+ rect->setProperty("condition1", false);
+ rect->setProperty("condition2", false);
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+}
+
+void tst_qquickstates::urlResolution()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("urlResolution.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickItem *myType = rect->findChild<QQuickItem*>("MyType");
+ QQuickImage *image1 = rect->findChild<QQuickImage*>("image1");
+ QQuickImage *image2 = rect->findChild<QQuickImage*>("image2");
+ QQuickImage *image3 = rect->findChild<QQuickImage*>("image3");
+ QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0);
+
+ QQuickItemPrivate::get(myType)->setState("SetImageState");
+ QUrl resolved = testFileUrl("Implementation/images/qt-logo.png");
+ QCOMPARE(image1->source(), resolved);
+ QCOMPARE(image2->source(), resolved);
+ QCOMPARE(image3->source(), resolved);
+
+ delete rect;
+}
+
+void tst_qquickstates::unnamedWhen()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("unnamedWhen.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
+ rect->setProperty("triggerState", true);
+ QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1"));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState"));
+ rect->setProperty("triggerState", false);
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
+}
+
+void tst_qquickstates::returnToBase()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("returnToBase.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
+ rect->setProperty("triggerState", true);
+ QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1"));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState"));
+ rect->setProperty("triggerState", false);
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String("originalState"));
+}
+
+//QTBUG-12559
+void tst_qquickstates::extendsBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("extendsBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ QQuickRectangle *greenRect = rect->findChild<QQuickRectangle*>("greenRect");
+
+ rectPrivate->setState("b");
+ QCOMPARE(greenRect->x(), qreal(100));
+ QCOMPARE(greenRect->y(), qreal(100));
+}
+
+void tst_qquickstates::editProperties()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("editProperties.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+
+ QQuickStateGroup *stateGroup = rectPrivate->_states();
+ QVERIFY(stateGroup != 0);
+ qmlExecuteDeferred(stateGroup);
+
+ QQuickState *blueState = stateGroup->findState("blue");
+ QVERIFY(blueState != 0);
+ qmlExecuteDeferred(blueState);
+
+ QQuickPropertyChanges *propertyChangesBlue = qobject_cast<QQuickPropertyChanges*>(blueState->operationAt(0));
+ QVERIFY(propertyChangesBlue != 0);
+
+ QQuickState *greenState = stateGroup->findState("green");
+ QVERIFY(greenState != 0);
+ qmlExecuteDeferred(greenState);
+
+ QQuickPropertyChanges *propertyChangesGreen = qobject_cast<QQuickPropertyChanges*>(greenState->operationAt(0));
+ QVERIFY(propertyChangesGreen != 0);
+
+ QQuickRectangle *childRect = rect->findChild<QQuickRectangle*>("rect2");
+ QVERIFY(childRect != 0);
+ QCOMPARE(childRect->width(), qreal(402));
+ QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+ QCOMPARE(childRect->height(), qreal(200));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(childRect->width(), qreal(50));
+ QCOMPARE(childRect->height(), qreal(40));
+ QVERIFY(!QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+ QVERIFY(blueState->bindingInRevertList(childRect, "width"));
+
+
+ rectPrivate->setState("green");
+ QCOMPARE(childRect->width(), qreal(200));
+ QCOMPARE(childRect->height(), qreal(100));
+ QVERIFY(greenState->bindingInRevertList(childRect, "width"));
+
+
+ rectPrivate->setState("");
+
+
+ QCOMPARE(propertyChangesBlue->actions().length(), 2);
+ QVERIFY(propertyChangesBlue->containsValue("width"));
+ QVERIFY(!propertyChangesBlue->containsProperty("x"));
+ QCOMPARE(propertyChangesBlue->value("width").toInt(), 50);
+ QVERIFY(!propertyChangesBlue->value("x").isValid());
+
+ propertyChangesBlue->changeValue("width", 60);
+ QCOMPARE(propertyChangesBlue->value("width").toInt(), 60);
+ QCOMPARE(propertyChangesBlue->actions().length(), 2);
+
+
+ propertyChangesBlue->changeExpression("width", "myRectangle.width / 2");
+ QVERIFY(!propertyChangesBlue->containsValue("width"));
+ QVERIFY(propertyChangesBlue->containsExpression("width"));
+ QCOMPARE(propertyChangesBlue->value("width").toInt(), 0);
+ QCOMPARE(propertyChangesBlue->actions().length(), 2);
+
+ propertyChangesBlue->changeValue("width", 50);
+ QVERIFY(propertyChangesBlue->containsValue("width"));
+ QVERIFY(!propertyChangesBlue->containsExpression("width"));
+ QCOMPARE(propertyChangesBlue->value("width").toInt(), 50);
+ QCOMPARE(propertyChangesBlue->actions().length(), 2);
+
+ QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+ rectPrivate->setState("blue");
+ QCOMPARE(childRect->width(), qreal(50));
+ QCOMPARE(childRect->height(), qreal(40));
+
+ propertyChangesBlue->changeValue("width", 60);
+ QCOMPARE(propertyChangesBlue->value("width").toInt(), 60);
+ QCOMPARE(propertyChangesBlue->actions().length(), 2);
+ QCOMPARE(childRect->width(), qreal(60));
+ QVERIFY(!QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+
+ propertyChangesBlue->changeExpression("width", "myRectangle.width / 2");
+ QVERIFY(!propertyChangesBlue->containsValue("width"));
+ QVERIFY(propertyChangesBlue->containsExpression("width"));
+ QCOMPARE(propertyChangesBlue->value("width").toInt(), 0);
+ QCOMPARE(propertyChangesBlue->actions().length(), 2);
+ QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+ QCOMPARE(childRect->width(), qreal(200));
+
+ propertyChangesBlue->changeValue("width", 50);
+ QCOMPARE(childRect->width(), qreal(50));
+
+ rectPrivate->setState("");
+ QCOMPARE(childRect->width(), qreal(402));
+ QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+
+ QCOMPARE(propertyChangesGreen->actions().length(), 2);
+ rectPrivate->setState("green");
+ QCOMPARE(childRect->width(), qreal(200));
+ QCOMPARE(childRect->height(), qreal(100));
+ QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+ QVERIFY(greenState->bindingInRevertList(childRect, "width"));
+ QCOMPARE(propertyChangesGreen->actions().length(), 2);
+
+
+ propertyChangesGreen->removeProperty("height");
+ QVERIFY(!QQmlPropertyPrivate::binding(QQmlProperty(childRect, "height")));
+ QCOMPARE(childRect->height(), qreal(200));
+
+ QVERIFY(greenState->bindingInRevertList(childRect, "width"));
+ QVERIFY(greenState->containsPropertyInRevertList(childRect, "width"));
+ propertyChangesGreen->removeProperty("width");
+ QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width")));
+ QCOMPARE(childRect->width(), qreal(402));
+ QVERIFY(!greenState->bindingInRevertList(childRect, "width"));
+ QVERIFY(!greenState->containsPropertyInRevertList(childRect, "width"));
+
+ propertyChangesBlue->removeProperty("width");
+ QCOMPARE(childRect->width(), qreal(402));
+
+ rectPrivate->setState("blue");
+ QCOMPARE(childRect->width(), qreal(402));
+ QCOMPARE(childRect->height(), qreal(40));
+}
+
+void tst_qquickstates::QTBUG_14830()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("QTBUG-14830.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QQuickItem *item = rect->findChild<QQuickItem*>("area");
+
+ QCOMPARE(item->width(), qreal(171));
+}
+
+void tst_qquickstates::avoidFastForward()
+{
+ QQmlEngine engine;
+
+ //shouldn't fast forward if there isn't a transition
+ QQmlComponent c(&engine, testFileUrl("avoidFastForward.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ rectPrivate->setState("a");
+ QCOMPARE(rect->property("updateCount").toInt(), 1);
+}
+
+//QTBUG-22583
+void tst_qquickstates::revertListBug()
+{
+ QQmlEngine engine;
+
+ QQmlComponent c(&engine, testFileUrl("revertListBug.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QQuickRectangle *rect1 = rect->findChild<QQuickRectangle*>("rect1");
+ QQuickRectangle *rect2 = rect->findChild<QQuickRectangle*>("rect2");
+ QQuickItem *origParent1 = rect->findChild<QQuickItem*>("originalParent1");
+ QQuickItem *origParent2 = rect->findChild<QQuickItem*>("originalParent2");
+ QQuickItem *newParent = rect->findChild<QQuickItem*>("newParent");
+
+ QCOMPARE(rect1->parentItem(), origParent1);
+ QCOMPARE(rect2->parentItem(), origParent2);
+
+ QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
+ rectPrivate->setState("reparented");
+
+ QCOMPARE(rect1->parentItem(), newParent);
+ QCOMPARE(rect2->parentItem(), origParent2);
+
+ rectPrivate->setState("");
+
+ QCOMPARE(rect1->parentItem(), origParent1);
+ QCOMPARE(rect2->parentItem(), origParent2);
+
+ QMetaObject::invokeMethod(rect, "switchTargetItem");
+
+ rectPrivate->setState("reparented");
+
+ QCOMPARE(rect1->parentItem(), origParent1);
+ QCOMPARE(rect2->parentItem(), newParent);
+
+ rectPrivate->setState("");
+
+ QCOMPARE(rect1->parentItem(), origParent1);
+ QCOMPARE(rect2->parentItem(), origParent2); //QTBUG-22583 causes rect2's parent item to be origParent1
+}
+
+QTEST_MAIN(tst_qquickstates)
+
+#include "tst_qquickstates.moc"
diff --git a/tests/auto/quick/qquickstyledtext/qquickstyledtext.pro b/tests/auto/quick/qquickstyledtext/qquickstyledtext.pro
new file mode 100644
index 0000000000..e9a8ffe8ee
--- /dev/null
+++ b/tests/auto/quick/qquickstyledtext/qquickstyledtext.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+TARGET = tst_qquickstyledtext
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickstyledtext.cpp
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp
new file mode 100644
index 0000000000..9351919ee8
--- /dev/null
+++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp
@@ -0,0 +1,253 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtGui/QTextLayout>
+#include <QtCore/QList>
+#include <QtQuick/private/qquickstyledtext_p.h>
+
+class tst_qquickstyledtext : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qquickstyledtext()
+ {
+ }
+
+ struct Format {
+ enum Type {
+ Bold = 0x01,
+ Underline = 0x02,
+ Italic = 0x04,
+ Anchor = 0x08
+ };
+ Format(int t, int s, int l)
+ : type(t), start(s), length(l) {}
+ int type;
+ int start;
+ int length;
+ };
+ typedef QList<Format> FormatList;
+
+ static const QChar bullet;
+ static const QChar disc;
+ static const QChar square;
+
+private slots:
+ void textOutput();
+ void textOutput_data();
+ void anchors();
+ void anchors_data();
+ void longString();
+};
+
+Q_DECLARE_METATYPE(tst_qquickstyledtext::FormatList);
+
+const QChar tst_qquickstyledtext::bullet(0x2022);
+const QChar tst_qquickstyledtext::disc(0x25e6);
+const QChar tst_qquickstyledtext::square(0x25a1);
+
+// For malformed input all we test is that we get the expected text and format out.
+//
+void tst_qquickstyledtext::textOutput_data()
+{
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<QString>("output");
+ QTest::addColumn<FormatList>("formats");
+ QTest::addColumn<bool>("modifiesFontSize");
+
+ QTest::newRow("empty") << "" << "" << FormatList() << false;
+ QTest::newRow("empty tag") << "<>test</>" << "test" << FormatList() << false;
+ QTest::newRow("nest opening") << "<b<b>>test</b>" << ">test" << FormatList() << false;
+ QTest::newRow("nest closing") << "<b>test<</b>/b>" << "test/b>" << (FormatList() << Format(Format::Bold, 0, 7)) << false;
+ QTest::newRow("bold") << "<b>bold</b>" << "bold" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
+ QTest::newRow("bold 2") << "<b>>>>>bold</b>" << ">>>>bold" << (FormatList() << Format(Format::Bold, 0, 8)) << false;
+ QTest::newRow("bold 3") << "<b>bold<>/b>" << "bold/b>" << (FormatList() << Format(Format::Bold, 0, 7)) << false;
+ QTest::newRow("italic") << "<i>italic</i>" << "italic" << (FormatList() << Format(Format::Italic, 0, 6)) << false;
+ QTest::newRow("underline") << "<u>underline</u>" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false;
+ QTest::newRow("strong") << "<strong>strong</strong>" << "strong" << (FormatList() << Format(Format::Bold, 0, 6)) << false;
+ QTest::newRow("underline") << "<u>underline</u>" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false;
+ QTest::newRow("missing >") << "<b>text</b" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
+ QTest::newRow("missing b>") << "<b>text</" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
+ QTest::newRow("missing /b>") << "<b>text<" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
+ QTest::newRow("missing </b>") << "<b>text" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
+ QTest::newRow("nested") << "<b>text <i>italic</i> bold</b>" << "text italic bold" << (FormatList() << Format(Format::Bold, 0, 5) << Format(Format::Bold | Format::Italic, 5, 6) << Format(Format::Bold, 11, 5)) << false;
+ QTest::newRow("bad nest") << "<b>text <i>italic</b></i>" << "text italic" << (FormatList() << Format(Format::Bold, 0, 5) << Format(Format::Bold | Format::Italic, 5, 6)) << false;
+ QTest::newRow("font color") << "<font color=\"red\">red text</font>" << "red text" << (FormatList() << Format(0, 0, 8)) << false;
+ QTest::newRow("font color: single quote") << "<font color='red'>red text</font>" << "red text" << (FormatList() << Format(0, 0, 8)) << false;
+ QTest::newRow("font size") << "<font size=\"1\">text</font>" << "text" << (FormatList() << Format(0, 0, 4)) << true;
+ QTest::newRow("font empty") << "<font>text</font>" << "text" << FormatList() << false;
+ QTest::newRow("font bad 1") << "<font ezis=\"blah\">text</font>" << "text" << FormatList() << false;
+ QTest::newRow("font bad 2") << "<font size=\"1>text</font>" << "" << FormatList() << false;
+ QTest::newRow("extra close") << "<b>text</b></b>" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
+ QTest::newRow("extra space") << "<b >text</b>" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
+ QTest::newRow("entities") << "&lt;b&gt;this &amp; that&lt;/b&gt;" << "<b>this & that</b>" << FormatList() << false;
+ QTest::newRow("newline") << "text<br>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
+ QTest::newRow("self-closing newline") << "text<br/>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
+ QTest::newRow("paragraph") << "text<p>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
+ QTest::newRow("paragraph closed") << "text<p>more text</p>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
+ QTest::newRow("paragraph closed bold") << "<b>text<p>more text</p>more text</b>" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << (FormatList() << Format(Format::Bold, 0, 24)) << false;
+ QTest::newRow("unknown tag") << "<a href='#'><foo>underline</foo></a> not" << "underline not" << (FormatList() << Format(Format::Underline, 0, 9)) << false;
+ QTest::newRow("ordered list") << "<ol><li>one<li>two" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") << FormatList() << false;
+ QTest::newRow("ordered list closed") << "<ol><li>one</li><li>two</li></ol>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("ordered list alpha") << "<ol type=\"a\"><li>one</li><li>two</li></ol>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("a.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("b.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("ordered list upper alpha") << "<ol type=\"A\"><li>one</li><li>two</li></ol>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("A.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("B.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("ordered list roman") << "<ol type=\"i\"><li>one</li><li>two</li></ol>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("i.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("ii.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("ordered list upper roman") << "<ol type=\"I\"><li>one</li><li>two</li></ol>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("I.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("II.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("ordered list bad") << "<ol type=\"z\"><li>one</li><li>two</li></ol>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("1.") + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + QLatin1String("2.") + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("unordered list") << "<ul><li>one<li>two" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") << FormatList() << false;
+ QTest::newRow("unordered list closed") << "<ul><li>one</li><li>two</li></ul>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("unordered list disc") << "<ul type=\"disc\"><li>one</li><li>two</li></ul>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + disc + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + disc + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("unordered list square") << "<ul type=\"square\"><li>one</li><li>two</li></ul>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + square + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + square + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("unordered list bad") << "<ul type=\"bad\"><li>one</li><li>two</li></ul>" << QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("one") + QChar(QChar::LineSeparator) + QString(6, QChar::Nbsp) + bullet + QString(2, QChar::Nbsp) + QLatin1String("two") + QChar(QChar::LineSeparator) << FormatList() << false;
+ QTest::newRow("header close") << "<h1>head</h1>more" << QChar(QChar::LineSeparator) + QLatin1String("head") + QChar(QChar::LineSeparator) + QLatin1String("more") << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("h0") << "<h0>head" << "head" << FormatList() << false;
+ QTest::newRow("h1") << "<h1>head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("h2") << "<h2>head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("h3") << "<h3>head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("h4") << "<h4>head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("h5") << "<h5>head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("h6") << "<h6>head" << QChar(QChar::LineSeparator) + QLatin1String("head") << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("h7") << "<h7>head" << "head" << FormatList() << false;
+ QTest::newRow("pre") << "normal<pre>pre text</pre>normal" << QLatin1String("normal") + QChar(QChar::LineSeparator) + QLatin1String("pre") + QChar(QChar::Nbsp) + QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("normal") << (FormatList() << Format(0, 6, 9)) << false;
+ QTest::newRow("pre lb") << "normal<pre>pre\n text</pre>normal" << QLatin1String("normal") + QChar(QChar::LineSeparator) + QLatin1String("pre") + QChar(QChar::LineSeparator) + QChar(QChar::Nbsp) + QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("normal") << (FormatList() << Format(0, 6, 10)) << false;
+ QTest::newRow("line feed") << "line\nfeed" << "line feed" << FormatList() << false;
+ QTest::newRow("leading whitespace") << " leading whitespace" << "leading whitespace" << FormatList() << false;
+ QTest::newRow("trailing whitespace") << "trailing whitespace " << "trailing whitespace" << FormatList() << false;
+ QTest::newRow("consecutive whitespace") << " consecutive \t \n whitespace" << "consecutive whitespace" << FormatList() << false;
+ QTest::newRow("space after newline") << "text<br/> more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
+ QTest::newRow("space after paragraph") << "text<p> more text</p> more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
+ QTest::newRow("space in header") << "<h1> head</h1> " << QChar(QChar::LineSeparator) + QLatin1String("head") + QChar(QChar::LineSeparator) << (FormatList() << Format(Format::Bold, 0, 5)) << true;
+ QTest::newRow("space before bold") << "this is <b>bold</b>" << "this is bold" << (FormatList() << Format(Format::Bold, 8, 4)) << false;
+ QTest::newRow("space leading bold") << "this is<b> bold</b>" << "this is bold" << (FormatList() << Format(Format::Bold, 7, 5)) << false;
+ QTest::newRow("space trailing bold") << "this is <b>bold </b>" << "this is bold " << (FormatList() << Format(Format::Bold, 8, 5)) << false;
+ QTest::newRow("img") << "a<img src=\"blah.png\"/>b" << "a b" << FormatList() << false;
+ QTest::newRow("tag mix") << "<f6>ds<b></img><pro>gfh</b><w><w>ghj</stron><ql><sl><pl>dfg</j6><img><bol><r><prp>dfg<bkj></b><up><string>ewrq</al><bl>jklhj<zl>" << "dsgfhghjdfgdfgewrqjklhj" << (FormatList() << Format(Format::Bold, 2, 3)) << false;
+}
+
+void tst_qquickstyledtext::textOutput()
+{
+ QFETCH(QString, input);
+ QFETCH(QString, output);
+ QFETCH(FormatList, formats);
+ QFETCH(bool, modifiesFontSize);
+
+ QTextLayout layout;
+ QList<QQuickStyledTextImgTag*> imgTags;
+ bool fontSizeModified = false;
+ QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified);
+
+ QCOMPARE(layout.text(), output);
+
+ QList<QTextLayout::FormatRange> layoutFormats = layout.additionalFormats();
+
+ QCOMPARE(layoutFormats.count(), formats.count());
+ for (int i = 0; i < formats.count(); ++i) {
+ QCOMPARE(layoutFormats.at(i).start, formats.at(i).start);
+ QCOMPARE(layoutFormats.at(i).length, formats.at(i).length);
+ if (formats.at(i).type & Format::Bold)
+ QVERIFY(layoutFormats.at(i).format.fontWeight() == QFont::Bold);
+ else
+ QVERIFY(layoutFormats.at(i).format.fontWeight() == QFont::Normal);
+ QVERIFY(layoutFormats.at(i).format.fontItalic() == bool(formats.at(i).type & Format::Italic));
+ QVERIFY(layoutFormats.at(i).format.fontUnderline() == bool(formats.at(i).type & Format::Underline));
+ }
+ QCOMPARE(fontSizeModified, modifiesFontSize);
+}
+
+void tst_qquickstyledtext::anchors()
+{
+ QFETCH(QString, input);
+ QFETCH(QString, output);
+ QFETCH(FormatList, formats);
+
+ QTextLayout layout;
+ QList<QQuickStyledTextImgTag*> imgTags;
+ bool fontSizeModified = false;
+ QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified);
+
+ QCOMPARE(layout.text(), output);
+
+ QList<QTextLayout::FormatRange> layoutFormats = layout.additionalFormats();
+
+ QCOMPARE(layoutFormats.count(), formats.count());
+ for (int i = 0; i < formats.count(); ++i) {
+ QCOMPARE(layoutFormats.at(i).start, formats.at(i).start);
+ QCOMPARE(layoutFormats.at(i).length, formats.at(i).length);
+ QVERIFY(layoutFormats.at(i).format.isAnchor() == bool(formats.at(i).type & Format::Anchor));
+ }
+}
+
+void tst_qquickstyledtext::anchors_data()
+{
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<QString>("output");
+ QTest::addColumn<FormatList>("formats");
+
+ QTest::newRow("empty 1") << "Test string with <a href=>url</a>." << "Test string with url." << FormatList();
+ QTest::newRow("empty 2") << "Test string with <a href="">url</a>." << "Test string with url." << FormatList();
+ QTest::newRow("unknown attr") << "Test string with <a hfre=\"http://strange<username>@ok-hostname\">url</a>." << "Test string with url." << FormatList();
+ QTest::newRow("close") << "Test string with <a href=\"http://strange<username>@ok-hostname\"/>url." << "Test string with url." << (FormatList() << Format(Format::Anchor, 17, 4));
+ QTest::newRow("username") << "Test string with <a href=\"http://strange<username>@ok-hostname\">url</a>." << "Test string with url." << (FormatList() << Format(Format::Anchor, 17, 3));
+ QTest::newRow("query") << "Test string with <a href=\"http://www.foo.bar?hello=world\">url</a>." << "Test string with url." << (FormatList() << Format(Format::Anchor, 17, 3));
+ QTest::newRow("ipv6") << "Test string with <a href=\"//user:pass@[56::56:56:56:127.0.0.1]:99\">url</a>." << "Test string with url." << (FormatList() << Format(Format::Anchor, 17, 3));
+ QTest::newRow("uni") << "Test string with <a href=\"data:text/javascript,d5%20%3D%20'five\\u0027s'%3B\">url</a>." << "Test string with url." << (FormatList() << Format(Format::Anchor, 17, 3));
+ QTest::newRow("utf8") << "Test string with <a href=\"http://www.räksmörgås.se/pub?a=b&a=dø&a=f#vræl\">url</a>." << "Test string with url." << (FormatList() << Format(Format::Anchor, 17, 3));
+}
+
+void tst_qquickstyledtext::longString()
+{
+ QTextLayout layout;
+ QList<QQuickStyledTextImgTag*> imgTags;
+ bool fontSizeModified = false;
+
+ QString input(9999999, QChar('.'));
+ QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified);
+ QCOMPARE(layout.text(), input);
+
+ input = QString(9999999, QChar('\t')); // whitespace
+ QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified);
+ QCOMPARE(layout.text(), QString(""));
+}
+
+QTEST_MAIN(tst_qquickstyledtext)
+
+#include "tst_qquickstyledtext.moc"
diff --git a/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro b/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro
new file mode 100644
index 0000000000..48fd7e8e9a
--- /dev/null
+++ b/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TARGET = tst_qquicksystempalette
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquicksystempalette.cpp
+
+CONFIG += parallel_test
+QT += core-private gui-private qml-private quick-private testlib
+qtHaveModule(widgets): QT += widgets
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp
new file mode 100644
index 0000000000..623954b1e6
--- /dev/null
+++ b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QDebug>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/private/qquicksystempalette_p.h>
+#include <qpalette.h>
+
+class tst_qquicksystempalette : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qquicksystempalette();
+
+private slots:
+ void activePalette();
+ void inactivePalette();
+ void disabledPalette();
+#ifndef QT_NO_WIDGETS
+ void paletteChanged();
+#endif
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qquicksystempalette::tst_qquicksystempalette()
+{
+}
+
+void tst_qquicksystempalette::activePalette()
+{
+ QString componentStr = "import QtQuick 2.0\nSystemPalette { }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create());
+
+ QVERIFY(object != 0);
+
+ QPalette palette;
+ palette.setCurrentColorGroup(QPalette::Active);
+ QCOMPARE(palette.window().color(), object->window());
+ QCOMPARE(palette.windowText().color(), object->windowText());
+ QCOMPARE(palette.base().color(), object->base());
+ QCOMPARE(palette.text().color(), object->text());
+ QCOMPARE(palette.alternateBase().color(), object->alternateBase());
+ QCOMPARE(palette.button().color(), object->button());
+ QCOMPARE(palette.buttonText().color(), object->buttonText());
+ QCOMPARE(palette.light().color(), object->light());
+ QCOMPARE(palette.midlight().color(), object->midlight());
+ QCOMPARE(palette.dark().color(), object->dark());
+ QCOMPARE(palette.mid().color(), object->mid());
+ QCOMPARE(palette.shadow().color(), object->shadow());
+ QCOMPARE(palette.highlight().color(), object->highlight());
+ QCOMPARE(palette.highlightedText().color(), object->highlightedText());
+
+ delete object;
+}
+
+void tst_qquicksystempalette::inactivePalette()
+{
+ QString componentStr = "import QtQuick 2.0\nSystemPalette { colorGroup: SystemPalette.Inactive }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create());
+
+ QVERIFY(object != 0);
+ QVERIFY(object->colorGroup() == QQuickSystemPalette::Inactive);
+
+ QPalette palette;
+ palette.setCurrentColorGroup(QPalette::Inactive);
+ QCOMPARE(palette.window().color(), object->window());
+ QCOMPARE(palette.windowText().color(), object->windowText());
+ QCOMPARE(palette.base().color(), object->base());
+ QCOMPARE(palette.text().color(), object->text());
+ QCOMPARE(palette.alternateBase().color(), object->alternateBase());
+ QCOMPARE(palette.button().color(), object->button());
+ QCOMPARE(palette.buttonText().color(), object->buttonText());
+ QCOMPARE(palette.light().color(), object->light());
+ QCOMPARE(palette.midlight().color(), object->midlight());
+ QCOMPARE(palette.dark().color(), object->dark());
+ QCOMPARE(palette.mid().color(), object->mid());
+ QCOMPARE(palette.shadow().color(), object->shadow());
+ QCOMPARE(palette.highlight().color(), object->highlight());
+ QCOMPARE(palette.highlightedText().color(), object->highlightedText());
+
+ delete object;
+}
+
+void tst_qquicksystempalette::disabledPalette()
+{
+ QString componentStr = "import QtQuick 2.0\nSystemPalette { colorGroup: SystemPalette.Disabled }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create());
+
+ QVERIFY(object != 0);
+ QVERIFY(object->colorGroup() == QQuickSystemPalette::Disabled);
+
+ QPalette palette;
+ palette.setCurrentColorGroup(QPalette::Disabled);
+ QCOMPARE(palette.window().color(), object->window());
+ QCOMPARE(palette.windowText().color(), object->windowText());
+ QCOMPARE(palette.base().color(), object->base());
+ QCOMPARE(palette.text().color(), object->text());
+ QCOMPARE(palette.alternateBase().color(), object->alternateBase());
+ QCOMPARE(palette.button().color(), object->button());
+ QCOMPARE(palette.buttonText().color(), object->buttonText());
+ QCOMPARE(palette.light().color(), object->light());
+ QCOMPARE(palette.midlight().color(), object->midlight());
+ QCOMPARE(palette.dark().color(), object->dark());
+ QCOMPARE(palette.mid().color(), object->mid());
+ QCOMPARE(palette.shadow().color(), object->shadow());
+ QCOMPARE(palette.highlight().color(), object->highlight());
+ QCOMPARE(palette.highlightedText().color(), object->highlightedText());
+
+ delete object;
+}
+
+#ifndef QT_NO_WIDGETS
+void tst_qquicksystempalette::paletteChanged()
+{
+ QString componentStr = "import QtQuick 2.0\nSystemPalette { }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create());
+
+ QVERIFY(object != 0);
+
+ QPalette p;
+ p.setCurrentColorGroup(QPalette::Active);
+ p.setColor(QPalette::Active, QPalette::Text, QColor("red"));
+ p.setColor(QPalette::Active, QPalette::ButtonText, QColor("green"));
+ p.setColor(QPalette::Active, QPalette::WindowText, QColor("blue"));
+
+ qApp->setPalette(p);
+
+ object->setColorGroup(QQuickSystemPalette::Active);
+ QTRY_COMPARE(QColor("red"), object->text());
+ QTRY_COMPARE(QColor("green"), object->buttonText());
+ QTRY_COMPARE(QColor("blue"), object->windowText());
+
+ delete object;
+}
+#endif
+
+QTEST_MAIN(tst_qquicksystempalette)
+
+#include "tst_qquicksystempalette.moc"
diff --git a/tests/auto/quick/qquicktext/data/embeddedImagesLocal.qml b/tests/auto/quick/qquicktext/data/embeddedImagesLocal.qml
new file mode 100644
index 0000000000..74b2ab817a
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/embeddedImagesLocal.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='http/exists.png'>"
+}
diff --git a/tests/auto/quick/qquicktext/data/embeddedImagesLocalError.qml b/tests/auto/quick/qquicktext/data/embeddedImagesLocalError.qml
new file mode 100644
index 0000000000..a2f7e0c89f
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/embeddedImagesLocalError.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='http/notexists.png'>"
+}
diff --git a/tests/auto/quick/qquicktext/data/embeddedImagesLocalRelative.qml b/tests/auto/quick/qquicktext/data/embeddedImagesLocalRelative.qml
new file mode 100644
index 0000000000..8de7364d08
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/embeddedImagesLocalRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http/"
+}
diff --git a/tests/auto/quick/qquicktext/data/embeddedImagesRemote.qml b/tests/auto/quick/qquicktext/data/embeddedImagesRemote.qml
new file mode 100644
index 0000000000..5d241f9231
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/embeddedImagesRemote.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='http://127.0.0.1:14459/exists.png'>"
+}
diff --git a/tests/auto/quick/qquicktext/data/embeddedImagesRemoteError.qml b/tests/auto/quick/qquicktext/data/embeddedImagesRemoteError.qml
new file mode 100644
index 0000000000..adeed8834d
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/embeddedImagesRemoteError.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='http://127.0.0.1:14459/notexists.png'>"
+}
diff --git a/tests/auto/quick/qquicktext/data/embeddedImagesRemoteRelative.qml b/tests/auto/quick/qquicktext/data/embeddedImagesRemoteRelative.qml
new file mode 100644
index 0000000000..2835d813db
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/embeddedImagesRemoteRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Text {
+ textFormat: Text.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http://127.0.0.1:14459/text.html"
+}
diff --git a/tests/auto/quick/qquicktext/data/fontSizeMode.qml b/tests/auto/quick/qquicktext/data/fontSizeMode.qml
new file mode 100644
index 0000000000..84f7ce8d50
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/fontSizeMode.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ width: 300
+ height: 200
+
+ Rectangle {
+ anchors.fill: myText
+ border.width: 1
+ }
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 250
+ height: 41
+ minimumPointSize: 8
+ minimumPixelSize: 8
+ font.pixelSize: 30
+ font.family: "Helvetica"
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/hAlignImplicitWidth.qml b/tests/auto/quick/qquicktext/data/hAlignImplicitWidth.qml
new file mode 100644
index 0000000000..136e5d21a2
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/hAlignImplicitWidth.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Text {
+ objectName: "textItem"
+ text: "AA\nBBBBB\nCCCCCCCCCCCCCCCC"
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignLeft
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/horizontalAlignment_RightToLeft.qml b/tests/auto/quick/qquicktext/data/horizontalAlignment_RightToLeft.qml
new file mode 100644
index 0000000000..5ba4d35684
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/horizontalAlignment_RightToLeft.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: top
+ width: 200; height: 70;
+
+ property alias horizontalAlignment: text.horizontalAlignment
+ property string text: "اختبا"
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 180
+ height: 20
+ color: "green"
+
+ Text {
+ id: text
+ objectName: "text"
+ anchors.fill: parent
+ text: top.text
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/htmlLists.qml b/tests/auto/quick/qquicktext/data/htmlLists.qml
new file mode 100644
index 0000000000..18693d2bbb
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/htmlLists.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ width: 400
+ height: 400
+
+ Text {
+ id: myText
+ textFormat: Text.RichText
+ objectName: "myText"
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/http/exists.png b/tests/auto/quick/qquicktext/data/http/exists.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/http/exists.png
Binary files differ
diff --git a/tests/auto/quick/qquicktext/data/images/face-sad.png b/tests/auto/quick/qquicktext/data/images/face-sad.png
new file mode 100644
index 0000000000..24188b7985
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/images/face-sad.png
Binary files differ
diff --git a/tests/auto/quick/qquicktext/data/images/heart200.png b/tests/auto/quick/qquicktext/data/images/heart200.png
new file mode 100644
index 0000000000..cedd3ea608
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/images/heart200.png
Binary files differ
diff --git a/tests/auto/quick/qquicktext/data/images/starfish_2.png b/tests/auto/quick/qquicktext/data/images/starfish_2.png
new file mode 100644
index 0000000000..132c20ffd0
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/images/starfish_2.png
Binary files differ
diff --git a/tests/auto/quick/qquicktext/data/imgTagsElide.qml b/tests/auto/quick/qquicktext/data/imgTagsElide.qml
new file mode 100644
index 0000000000..fbd64cc5bf
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/imgTagsElide.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Item {
+ width: 300
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ elide: Text.ElideRight
+ maximumLineCount: 2
+ width: 200
+ wrapMode: Text.WordWrap
+ text: "This is a sad face aligned to the top. Lorem ipsum dolor sit amet. Nulla sed turpis risus. Integer sit amet odio quis mauris varius venenatis<img src=\"images/face-sad.png\" width=\"30\" height=\"30\" align=\"top\">Lorem ipsum dolor sit amet. Nulla sed turpis risus. Integer sit amet odio quis mauris varius venenatis. Lorem ipsum dolor sit amet. Nulla sed turpis risus.Lorem ipsum dolor sit amet. Nulla sed turpis risus. Lorem ipsum dolor sit amet. Nulla sed turpis risus.Lorem ipsum dolor sit amet. Nulla sed turpis risus."
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myText.width = 400
+
+ }
+}
+
+
diff --git a/tests/auto/quick/qquicktext/data/imgTagsUpdates.qml b/tests/auto/quick/qquicktext/data/imgTagsUpdates.qml
new file mode 100644
index 0000000000..baf5113e52
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/imgTagsUpdates.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 300; height: 400
+
+ Text {
+ id: myText
+ objectName: "myText"
+ text: ""
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/lineCount.qml b/tests/auto/quick/qquicktext/data/lineCount.qml
new file mode 100644
index 0000000000..b672863684
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/lineCount.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 200
+ wrapMode: Text.WordWrap
+ maximumLineCount: undefined
+ text: "Testing that maximumLines, visibleLines, and totalLines works properly in the autotests. The quick brown fox jumped over the lazy anything with the letter 'g'."
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/lineHeight.qml b/tests/auto/quick/qquicktext/data/lineHeight.qml
new file mode 100644
index 0000000000..c1f337aa05
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/lineHeight.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 200
+ wrapMode: Text.WordWrap
+ font.pixelSize: 13
+ text: "Lorem ipsum sit amet, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum."
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/lineLayout.qml b/tests/auto/quick/qquicktext/data/lineLayout.qml
new file mode 100644
index 0000000000..cb2474791e
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/lineLayout.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 800; height: 600
+
+ property real off: 0
+
+ Text {
+ id: myText
+ objectName: "myText"
+ wrapMode: Text.WordWrap
+ font.pixelSize: 14
+ textFormat: Text.StyledText
+ focus: true
+
+ text: "<b>Lorem ipsum</b> dolor sit amet, consectetur adipiscing elit. Integer at ante dui. Sed eu egestas est.
+ <br/><p><i>Maecenas nec libero leo. Sed ac leo eget ipsum ultricies viverra sit amet eu orci. Praesent et tortor risus, viverra accumsan sapien. Sed faucibus eleifend lectus, sed euismod urna porta eu. Aenean ultricies lectus ut orci dictum quis convallis nisi ultrices. Nunc elit mi, iaculis a porttitor rutrum, venenatis malesuada nisi. Suspendisse turpis quam, euismod non imperdiet et, rutrum nec ligula. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper tristique metus eu sodales. Integer eget risus ipsum. Quisque ut risus ut nulla tristique volutpat at sit amet nisl. Aliquam pulvinar auctor diam nec bibendum.</i><br/><p>Quisque luctus sapien id arcu volutpat pharetra. Praesent pretium imperdiet euismod. Integer fringilla rhoncus condimentum. Quisque sit amet ornare nulla. Cras sapien augue, sagittis a dictum id, suscipit et nunc. Cras vitae augue in enim elementum venenatis sed nec risus. Sed nisi quam, mollis quis auctor ac, vestibulum in neque. Vivamus eu justo risus. Suspendisse vel mollis est. Vestibulum gravida interdum mi, in molestie neque gravida in. Donec nibh odio, mattis facilisis vulputate et, scelerisque ut felis. Sed ornare eros nec odio aliquam eu varius augue adipiscing. Vivamus sit amet massa dapibus sapien pulvinar consectetur a sit amet felis. Cras non mi id libero dictum iaculis id dignissim eros. Praesent eget enim dui, sed bibendum neque. Ut interdum nisl id leo malesuada ornare. Pellentesque id nisl eu odio volutpat posuere et at massa. Pellentesque nec lorem justo. Integer sem urna, pharetra sed sagittis vitae, condimentum ac felis. Ut vitae sapien ac tortor adipiscing pharetra. Cras tristique urna tempus ante volutpat eleifend non eu ligula. Mauris sodales nisl et lorem tristique sodales. Mauris arcu orci, vehicula semper cursus ac, dapibus ut mi."
+
+ onLineLaidOut: {
+ line.width = line.number * 15
+ if (line.number === 30 || line.number === 60) {
+ main.off = line.y
+ }
+ if (line.number >= 30) {
+ line.x = line.width + 30
+ line.y -= main.off
+ }
+ if (line.number >= 60) {
+ line.x = line.width * 2 + 60
+ line.height = 20
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/lineLayoutRelayout.qml b/tests/auto/quick/qquicktext/data/lineLayoutRelayout.qml
new file mode 100644
index 0000000000..2e1aa6a17d
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/lineLayoutRelayout.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 320
+ height: 418
+
+ property int yOffset: 0
+
+ Component.onCompleted: myText.height = height
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: parent.width
+ height: 0
+ wrapMode: Text.WordWrap
+ font.pointSize: 14
+ focus: true
+
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Integer at ante dui Curabitur ante est, pulvinar quis adipiscing a, iaculis id ipsum. Nunc blandit
+condimentum odio vel egestas. in ipsum lacinia sit amet
+mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis,
+sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac
+mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis,
+sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac
+leo eget ipsum ultricies viverra sit amet eu orci. Praesent et tortor risus,
+viverra accumsan sapien. Sed faucibus eleifend lectus, sed euismod urna porta
+eu. Quisque vitae accumsan lectus."
+
+ onLineLaidOut: {
+ line.width = width / 2
+
+ if (line.y + line.height >= height) {
+ if (main.yOffset === 0)
+ main.yOffset = line.y
+ line.y -= main.yOffset
+ line.x = width / 2
+ } else {
+ main.yOffset = 0
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/multilengthStrings.qml b/tests/auto/quick/qquicktext/data/multilengthStrings.qml
new file mode 100644
index 0000000000..6b9dc71fbc
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/multilengthStrings.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 300
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 60
+ font.pixelSize: 15
+ font.family: "Helvetica"
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/multilengthStringsWrapped.qml b/tests/auto/quick/qquicktext/data/multilengthStringsWrapped.qml
new file mode 100644
index 0000000000..21f1b20619
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/multilengthStringsWrapped.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 300
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 60
+ height: 36
+ font.pixelSize: 15
+ font.family: "Helvetica"
+ wrapMode: Text.Wrap
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/multilineelide.qml b/tests/auto/quick/qquicktext/data/multilineelide.qml
new file mode 100644
index 0000000000..ffca0d638a
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/multilineelide.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Text {
+ width: 200
+ wrapMode: Text.WordWrap
+ elide: Text.ElideRight
+ maximumLineCount: 3
+ text: "the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog"
+}
+
diff --git a/tests/auto/quick/qquicktext/data/overline.qml b/tests/auto/quick/qquicktext/data/overline.qml
new file mode 100644
index 0000000000..c40cac0774
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/overline.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 200
+ wrapMode: Text.WordWrap
+ font.overline: true
+ text: "Testing that maximumLines, visibleLines, and totalLines works properly in the autotests. The quick brown fox jumped over the lazy anything with the letter 'g'."
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/pixelFontSizes.qml b/tests/auto/quick/qquicktext/data/pixelFontSizes.qml
new file mode 100644
index 0000000000..e3d81b682e
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/pixelFontSizes.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 200
+
+ property variant pixelSize: 6
+
+ Text {
+ objectName: "text"
+ font.pixelSize: parent.pixelSize
+ text: "This is<br/>a font<br/> size test."
+ }
+
+ Text {
+ x: 200
+ objectName: "textWithTag"
+ font.pixelSize: parent.pixelSize
+ text: "This is <h4>a font</h4> size test."
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/pointFontSizes.qml b/tests/auto/quick/qquicktext/data/pointFontSizes.qml
new file mode 100644
index 0000000000..6feb8fecf8
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/pointFontSizes.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 200
+
+ property variant pointSize: 6
+
+ Text {
+ objectName: "text"
+ font.pointSize: parent.pointSize
+ text: "This is<br/>a font<br/> size test."
+ }
+
+ Text {
+ x: 200
+ objectName: "textWithTag"
+ font.pointSize: parent.pointSize
+ text: "This is <h4>a font</h4> size test."
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/qtbug_14734.qml b/tests/auto/quick/qquicktext/data/qtbug_14734.qml
new file mode 100644
index 0000000000..e71a798421
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/qtbug_14734.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 640
+ height: 480
+
+ Text {
+ text: "í "
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/rotated.qml b/tests/auto/quick/qquicktext/data/rotated.qml
new file mode 100644
index 0000000000..fecf64b249
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/rotated.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Rectangle {
+ width : 200
+ height : 100
+
+ Text {
+ objectName: "text"
+ x: 20
+ y: 20
+ height : 20
+ width : 80
+ text : "Something"
+ rotation : 30
+ transformOrigin : Item.TopLeft
+ }
+}
+
diff --git a/tests/auto/quick/qquicktext/data/strikeout.qml b/tests/auto/quick/qquicktext/data/strikeout.qml
new file mode 100644
index 0000000000..d926d94f06
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/strikeout.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 200
+ wrapMode: Text.WordWrap
+ font.strikeout: true
+ text: "Testing that maximumLines, visibleLines, and totalLines works properly in the autotests. The quick brown fox jumped over the lazy anything with the letter 'g'."
+ }
+}
diff --git a/tests/auto/quick/qquicktext/data/underline.qml b/tests/auto/quick/qquicktext/data/underline.qml
new file mode 100644
index 0000000000..dff97080d5
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/underline.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: 200
+ wrapMode: Text.WordWrap
+ font.underline: true
+ text: "Testing that maximumLines, visibleLines, and totalLines works properly in the autotests. The quick brown fox jumped over the lazy anything with the letter 'g'."
+ }
+}
diff --git a/tests/auto/quick/qquicktext/qquicktext.pro b/tests/auto/quick/qquicktext/qquicktext.pro
new file mode 100644
index 0000000000..4e3844bc58
--- /dev/null
+++ b/tests/auto/quick/qquicktext/qquicktext.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_qquicktext
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquicktext.cpp
+
+INCLUDEPATH += ../../shared/
+HEADERS += ../../shared/testhttpserver.h
+SOURCES += ../../shared/testhttpserver.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private network testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+mac:CONFIG += insignificant_test # QTBUG-27740
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
new file mode 100644
index 0000000000..b95a646bd6
--- /dev/null
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -0,0 +1,3643 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QTextDocument>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <private/qquicktext_p_p.h>
+#include <private/qquickvaluetypes_p.h>
+#include <QFontMetrics>
+#include <qmath.h>
+#include <QtQuick/QQuickView>
+#include <private/qguiapplication_p.h>
+#include <limits.h>
+#include <QtGui/QMouseEvent>
+#include "../../shared/util.h"
+#include "testhttpserver.h"
+
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+
+#define SERVER_PORT 14459
+#define SERVER_ADDR "http://127.0.0.1:14459"
+
+Q_DECLARE_METATYPE(QQuickText::TextFormat)
+
+QT_BEGIN_NAMESPACE
+extern void qt_setQtEnableTestFont(bool value);
+QT_END_NAMESPACE
+
+class tst_qquicktext : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquicktext();
+
+private slots:
+ void text();
+ void width();
+ void wrap();
+ void elide();
+ void multilineElide_data();
+ void multilineElide();
+ void implicitElide_data();
+ void implicitElide();
+ void textFormat();
+
+ void baseUrl();
+ void embeddedImages_data();
+ void embeddedImages();
+
+ void lineCount();
+ void lineHeight();
+
+ // ### these tests may be trivial
+ void horizontalAlignment();
+ void horizontalAlignment_RightToLeft();
+ void verticalAlignment();
+ void hAlignImplicitWidth();
+ void font();
+ void style();
+ void color();
+ void smooth();
+ void renderType();
+
+ // QQuickFontValueType
+ void weight();
+ void underline();
+ void overline();
+ void strikeout();
+ void capitalization();
+ void letterSpacing();
+ void wordSpacing();
+
+ void clickLink_data();
+ void clickLink();
+
+ void implicitSize_data();
+ void implicitSize();
+ void contentSize();
+ void implicitSizeBinding_data();
+ void implicitSizeBinding();
+ void geometryChanged();
+
+ void boundingRect_data();
+ void boundingRect();
+ void clipRect();
+ void lineLaidOut();
+ void lineLaidOutRelayout();
+
+ void imgTagsBaseUrl_data();
+ void imgTagsBaseUrl();
+ void imgTagsAlign_data();
+ void imgTagsAlign();
+ void imgTagsMultipleImages();
+ void imgTagsElide();
+ void imgTagsUpdates();
+ void imgTagsError();
+ void fontSizeMode_data();
+ void fontSizeMode();
+ void fontSizeModeMultiline_data();
+ void fontSizeModeMultiline();
+ void multilengthStrings_data();
+ void multilengthStrings();
+ void fontFormatSizes_data();
+ void fontFormatSizes();
+
+ void baselineOffset_data();
+ void baselineOffset();
+
+ void htmlLists();
+ void htmlLists_data();
+
+private:
+ QStringList standard;
+ QStringList richText;
+
+ QStringList horizontalAlignmentmentStrings;
+ QStringList verticalAlignmentmentStrings;
+
+ QList<Qt::Alignment> verticalAlignmentments;
+ QList<Qt::Alignment> horizontalAlignmentments;
+
+ QStringList styleStrings;
+ QList<QQuickText::TextStyle> styles;
+
+ QStringList colorStrings;
+
+ QQmlEngine engine;
+
+ QQuickView *createView(const QString &filename);
+ int numberOfNonWhitePixels(int fromX, int toX, const QImage &image);
+};
+
+tst_qquicktext::tst_qquicktext()
+{
+ 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 << QQuickText::Normal
+ << QQuickText::Outline
+ << QQuickText::Raised
+ << QQuickText::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";
+ //
+ qt_setQtEnableTestFont(true);
+}
+
+QQuickView *tst_qquicktext::createView(const QString &filename)
+{
+ QQuickView *window = new QQuickView(0);
+
+ window->setSource(QUrl::fromLocalFile(filename));
+ return window;
+}
+
+void tst_qquicktext::text()
+{
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nText { text: \"\" }", QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->text(), QString(""));
+ QVERIFY(textObject->width() == 0);
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->text(), standard.at(i));
+ QVERIFY(textObject->width() > 0);
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QString expected = richText.at(i);
+ QCOMPARE(textObject->text(), expected.replace("\\\"", "\""));
+ QVERIFY(textObject->width() > 0);
+
+ delete textObject;
+ }
+}
+
+void tst_qquicktext::width()
+{
+ // uses Font metrics to find the width for standard and document to find the width for rich
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nText { text: \"\" }", QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->width(), 0.);
+
+ delete textObject;
+ }
+
+ bool requiresUnhintedMetrics = !qmlDisableDistanceField();
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test
+
+ QFont f;
+ qreal metricWidth = 0.0;
+
+ if (requiresUnhintedMetrics) {
+ QString s = standard.at(i);
+ s.replace(QLatin1Char('\n'), QChar::LineSeparator);
+
+ QTextLayout layout(s);
+ layout.setFlags(Qt::TextExpandTabs | Qt::TextShowMnemonic);
+ {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ forever {
+ QTextLine line = layout.createLine();
+ if (!line.isValid())
+ break;
+ }
+
+ layout.endLayout();
+
+ metricWidth = layout.boundingRect().width();
+ } else {
+ QFontMetricsF fm(f);
+ metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
+ }
+
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->boundingRect().width() > 0);
+ QCOMPARE(textObject->width(), qreal(metricWidth));
+ QVERIFY(textObject->textFormat() == QQuickText::AutoText); // setting text doesn't change format
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QVERIFY(Qt::mightBeRichText(richText.at(i))); // self-test
+
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + richText.at(i) + "\"; textFormat: Text.RichText }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+ QVERIFY(textObject != 0);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->extra.isAllocated());
+
+ QTextDocument *doc = textPrivate->extra->doc;
+ QVERIFY(doc != 0);
+
+ QCOMPARE(int(textObject->width()), int(doc->idealWidth()));
+ QVERIFY(textObject->textFormat() == QQuickText::RichText);
+
+ delete textObject;
+ }
+}
+
+void tst_qquicktext::wrap()
+{
+ int textHeight = 0;
+ // for specified width and wrap set true
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+ textHeight = textObject->height();
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->wrapMode() == QQuickText::WordWrap);
+ QCOMPARE(textObject->width(), 300.);
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->width(), 30.);
+ QVERIFY(textObject->height() > textHeight);
+
+ int oldHeight = textObject->height();
+ textObject->setWidth(100);
+ QVERIFY(textObject->height() < oldHeight);
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->width(), 30.);
+ QVERIFY(textObject->height() > textHeight);
+
+ qreal oldHeight = textObject->height();
+ textObject->setWidth(100);
+ QVERIFY(textObject->height() < oldHeight);
+
+ delete textObject;
+ }
+
+ // richtext again with a fixed height
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { wrapMode: Text.WordWrap; width: 30; height: 50; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->width(), 30.);
+ QVERIFY(textObject->implicitHeight() > textHeight);
+
+ qreal oldHeight = textObject->implicitHeight();
+ textObject->setWidth(100);
+ QVERIFY(textObject->implicitHeight() < oldHeight);
+
+ delete textObject;
+ }
+
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n Text {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickText *textObject = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(textObject);
+
+ QSignalSpy spy(textObject, SIGNAL(wrapModeChanged()));
+
+ QCOMPARE(textObject->wrapMode(), QQuickText::NoWrap);
+
+ textObject->setWrapMode(QQuickText::Wrap);
+ QCOMPARE(textObject->wrapMode(), QQuickText::Wrap);
+ QCOMPARE(spy.count(), 1);
+
+ textObject->setWrapMode(QQuickText::Wrap);
+ QCOMPARE(spy.count(), 1);
+
+ textObject->setWrapMode(QQuickText::NoWrap);
+ QCOMPARE(textObject->wrapMode(), QQuickText::NoWrap);
+ QCOMPARE(spy.count(), 2);
+ }
+}
+
+void tst_qquicktext::elide()
+{
+ for (QQuickText::TextElideMode m = QQuickText::ElideLeft; m<=QQuickText::ElideNone; m=QQuickText::TextElideMode(int(m)+1)) {
+ const char* elidename[]={"ElideLeft", "ElideRight", "ElideMiddle", "ElideNone"};
+ QString elide = "elide: Text." + QString(elidename[int(m)]) + ";";
+
+ // XXX Poor coverage.
+
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(("import QtQuick 2.0\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->elideMode(), m);
+ QCOMPARE(textObject->width(), 100.);
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->elideMode(), m);
+ QCOMPARE(textObject->width(), 100.);
+
+ if (m != QQuickText::ElideNone && !standard.at(i).contains('\n'))
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->elideMode(), m);
+ QCOMPARE(textObject->width(), 100.);
+
+ if (m != QQuickText::ElideNone && standard.at(i).contains("<br>"))
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+
+ delete textObject;
+ }
+ }
+}
+
+void tst_qquicktext::multilineElide_data()
+{
+ QTest::addColumn<QQuickText::TextFormat>("format");
+ QTest::newRow("plain") << QQuickText::PlainText;
+ QTest::newRow("styled") << QQuickText::StyledText;
+}
+
+void tst_qquicktext::multilineElide()
+{
+ QFETCH(QQuickText::TextFormat, format);
+ QQuickView *window = createView(testFile("multilineelide.qml"));
+
+ QQuickText *myText = qobject_cast<QQuickText*>(window->rootObject());
+ QVERIFY(myText != 0);
+ myText->setTextFormat(format);
+
+ QCOMPARE(myText->lineCount(), 3);
+ QCOMPARE(myText->truncated(), true);
+
+ qreal lineHeight = myText->contentHeight() / 3.;
+
+ // Set a valid height greater than the truncated content height and ensure the line count is
+ // unchanged.
+ myText->setHeight(200);
+ QCOMPARE(myText->lineCount(), 3);
+ QCOMPARE(myText->truncated(), true);
+
+ // reduce size and ensure fewer lines are drawn
+ myText->setHeight(lineHeight * 2);
+ QCOMPARE(myText->lineCount(), 2);
+
+ myText->setHeight(lineHeight);
+ QCOMPARE(myText->lineCount(), 1);
+
+ myText->setHeight(5);
+ QCOMPARE(myText->lineCount(), 1);
+
+ myText->setHeight(lineHeight * 3);
+ QCOMPARE(myText->lineCount(), 3);
+
+ // remove max count and show all lines.
+ myText->setHeight(1000);
+ myText->resetMaximumLineCount();
+
+ QCOMPARE(myText->truncated(), false);
+
+ // reduce size again
+ myText->setHeight(lineHeight * 2);
+ QCOMPARE(myText->lineCount(), 2);
+ QCOMPARE(myText->truncated(), true);
+
+ // change line height
+ myText->setLineHeight(1.1);
+ QCOMPARE(myText->lineCount(), 1);
+
+ delete window;
+}
+
+void tst_qquicktext::implicitElide_data()
+{
+ QTest::addColumn<QString>("width");
+ QTest::addColumn<QString>("initialText");
+ QTest::addColumn<QString>("text");
+
+ QTest::newRow("maximum width, empty")
+ << "Math.min(implicitWidth, 100)"
+ << "";
+ QTest::newRow("maximum width, short")
+ << "Math.min(implicitWidth, 100)"
+ << "the";
+ QTest::newRow("maximum width, long")
+ << "Math.min(implicitWidth, 100)"
+ << "the quick brown fox jumped over the lazy dog";
+ QTest::newRow("reset width, empty")
+ << "implicitWidth > 100 ? 100 : undefined"
+ << "";
+ QTest::newRow("reset width, short")
+ << "implicitWidth > 100 ? 100 : undefined"
+ << "the";
+ QTest::newRow("reset width, long")
+ << "implicitWidth > 100 ? 100 : undefined"
+ << "the quick brown fox jumped over the lazy dog";
+}
+
+void tst_qquicktext::implicitElide()
+{
+ QFETCH(QString, width);
+ QFETCH(QString, initialText);
+
+ QString componentStr =
+ "import QtQuick 2.0\n"
+ "Text {\n"
+ "width: " + width + "\n"
+ "text: \"" + initialText + "\"\n"
+ "elide: Text.ElideRight\n"
+ "}";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+
+ textObject->setText("the quick brown fox jumped over");
+
+ QVERIFY(textObject->contentWidth() > 0);
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+}
+
+void tst_qquicktext::textFormat()
+{
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->textFormat() == QQuickText::RichText);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->richText == true);
+
+ delete textObject;
+ }
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nText { text: \"<b>Hello</b>\" }", QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->textFormat() == QQuickText::AutoText);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->styledText == true);
+
+ delete textObject;
+ }
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->textFormat() == QQuickText::PlainText);
+
+ delete textObject;
+ }
+
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n Text {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickText *text = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(text);
+
+ QSignalSpy spy(text, SIGNAL(textFormatChanged(TextFormat)));
+
+ QCOMPARE(text->textFormat(), QQuickText::AutoText);
+
+ text->setTextFormat(QQuickText::StyledText);
+ QCOMPARE(text->textFormat(), QQuickText::StyledText);
+ QCOMPARE(spy.count(), 1);
+
+ text->setTextFormat(QQuickText::StyledText);
+ QCOMPARE(spy.count(), 1);
+
+ text->setTextFormat(QQuickText::AutoText);
+ QCOMPARE(text->textFormat(), QQuickText::AutoText);
+ QCOMPARE(spy.count(), 2);
+ }
+}
+
+//the alignment tests may be trivial o.oa
+void tst_qquicktext::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 QtQuick 2.0\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j));
+
+ delete textObject;
+ }
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ for (int j=0; j < horizontalAlignmentmentStrings.size(); j++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j));
+
+ delete textObject;
+ }
+ }
+
+}
+
+void tst_qquicktext::horizontalAlignment_RightToLeft()
+{
+ QQuickView *window = createView(testFile("horizontalAlignment_RightToLeft.qml"));
+ QQuickText *text = window->rootObject()->findChild<QQuickText*>("text");
+ QVERIFY(text != 0);
+ window->show();
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(text);
+ QVERIFY(textPrivate != 0);
+
+ QTRY_VERIFY(textPrivate->layout.lineCount());
+
+ // implicit alignment should follow the reading direction of RTL text
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+ QCOMPARE(text->effectiveHAlign(), text->hAlign());
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > window->width()/2);
+
+ // explicitly left aligned text
+ text->setHAlign(QQuickText::AlignLeft);
+ QCOMPARE(text->hAlign(), QQuickText::AlignLeft);
+ QCOMPARE(text->effectiveHAlign(), text->hAlign());
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < window->width()/2);
+
+ // explicitly right aligned text
+ text->setHAlign(QQuickText::AlignRight);
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+ QCOMPARE(text->effectiveHAlign(), text->hAlign());
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > window->width()/2);
+
+ // change to rich text
+ QString textString = text->text();
+ text->setText(QString("<i>") + textString + QString("</i>"));
+ text->setTextFormat(QQuickText::RichText);
+ text->resetHAlign();
+
+ // implicitly aligned rich text should follow the reading direction of text
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+ QCOMPARE(text->effectiveHAlign(), text->hAlign());
+ QVERIFY(textPrivate->extra.isAllocated());
+ QVERIFY(textPrivate->extra->doc->defaultTextOption().alignment() & Qt::AlignLeft);
+
+ // explicitly left aligned rich text
+ text->setHAlign(QQuickText::AlignLeft);
+ QCOMPARE(text->hAlign(), QQuickText::AlignLeft);
+ QCOMPARE(text->effectiveHAlign(), text->hAlign());
+ QVERIFY(textPrivate->extra->doc->defaultTextOption().alignment() & Qt::AlignRight);
+
+ // explicitly right aligned rich text
+ text->setHAlign(QQuickText::AlignRight);
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+ QCOMPARE(text->effectiveHAlign(), text->hAlign());
+ QVERIFY(textPrivate->extra->doc->defaultTextOption().alignment() & Qt::AlignLeft);
+
+ text->setText(textString);
+ text->setTextFormat(QQuickText::PlainText);
+
+ // explicitly center aligned
+ text->setHAlign(QQuickText::AlignHCenter);
+ QCOMPARE(text->hAlign(), QQuickText::AlignHCenter);
+ QCOMPARE(text->effectiveHAlign(), text->hAlign());
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < window->width()/2);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().right() > window->width()/2);
+
+ // reseted alignment should go back to following the text reading direction
+ text->resetHAlign();
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > window->width()/2);
+
+ // mirror the text item
+ QQuickItemPrivate::get(text)->setLayoutMirror(true);
+
+ // mirrored implicit alignment should continue to follow the reading direction of the text
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+ QCOMPARE(text->effectiveHAlign(), QQuickText::AlignRight);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > window->width()/2);
+
+ // mirrored explicitly right aligned behaves as left aligned
+ text->setHAlign(QQuickText::AlignRight);
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+ QCOMPARE(text->effectiveHAlign(), QQuickText::AlignLeft);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < window->width()/2);
+
+ // mirrored explicitly left aligned behaves as right aligned
+ text->setHAlign(QQuickText::AlignLeft);
+ QCOMPARE(text->hAlign(), QQuickText::AlignLeft);
+ QCOMPARE(text->effectiveHAlign(), QQuickText::AlignRight);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > window->width()/2);
+
+ // disable mirroring
+ QQuickItemPrivate::get(text)->setLayoutMirror(false);
+ text->resetHAlign();
+
+ // English text should be implicitly left aligned
+ text->setText("Hello world!");
+ QCOMPARE(text->hAlign(), QQuickText::AlignLeft);
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < window->width()/2);
+
+ // empty text with implicit alignment follows the system locale-based
+ // keyboard input direction from QInputMethod::inputDirection()
+ text->setText("");
+ QCOMPARE(text->hAlign(), qApp->inputMethod()->inputDirection() == Qt::LeftToRight ?
+ QQuickText::AlignLeft : QQuickText::AlignRight);
+ text->setHAlign(QQuickText::AlignRight);
+ QCOMPARE(text->hAlign(), QQuickText::AlignRight);
+
+ delete window;
+
+ // alignment of Text with no text set to it
+ QString componentStr = "import QtQuick 2.0\nText {}";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+ QCOMPARE(textObject->hAlign(), qApp->inputMethod()->inputDirection() == Qt::LeftToRight ?
+ QQuickText::AlignLeft : QQuickText::AlignRight);
+ delete textObject;
+}
+
+int tst_qquicktext::numberOfNonWhitePixels(int fromX, int toX, const QImage &image)
+{
+ int pixels = 0;
+ for (int x = fromX; x < toX; ++x) {
+ for (int y = 0; y < image.height(); ++y) {
+ if (image.pixel(x, y) != qRgb(255, 255, 255))
+ pixels++;
+ }
+ }
+ return pixels;
+}
+
+void tst_qquicktext::hAlignImplicitWidth()
+{
+ QQuickView view(testFileUrl("hAlignImplicitWidth.qml"));
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+
+ QQuickText *text = view.rootObject()->findChild<QQuickText*>("textItem");
+ QVERIFY(text != 0);
+
+ {
+ // Left Align
+ QImage image = view.grabWindow();
+ int left = numberOfNonWhitePixels(0, image.width() / 3, image);
+ int mid = numberOfNonWhitePixels(image.width() / 3, 2 * image.width() / 3, image);
+ int right = numberOfNonWhitePixels( 2 * image.width() / 3, image.width(), image);
+ QVERIFY(left > mid);
+ QVERIFY(mid > right);
+ }
+ {
+ // HCenter Align
+ text->setHAlign(QQuickText::AlignHCenter);
+ QImage image = view.grabWindow();
+ int left = numberOfNonWhitePixels(0, image.width() / 3, image);
+ int mid = numberOfNonWhitePixels(image.width() / 3, 2 * image.width() / 3, image);
+ int right = numberOfNonWhitePixels( 2 * image.width() / 3, image.width(), image);
+ QVERIFY(left < mid);
+ QVERIFY(mid > right);
+ }
+ {
+ // Right Align
+ text->setHAlign(QQuickText::AlignRight);
+ QImage image = view.grabWindow();
+ int left = numberOfNonWhitePixels(0, image.width() / 3, image);
+ int mid = numberOfNonWhitePixels(image.width() / 3, 2 * image.width() / 3, image);
+ int right = numberOfNonWhitePixels( 2 * image.width() / 3, image.width(), image);
+ QVERIFY(left < mid);
+ QVERIFY(mid < right);
+ }
+}
+
+void tst_qquicktext::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 QtQuick 2.0\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
+
+ delete textObject;
+ }
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ for (int j=0; j < verticalAlignmentmentStrings.size(); j++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
+
+ delete textObject;
+ }
+ }
+
+}
+
+void tst_qquicktext::font()
+{
+ //test size, then bold, then italic, then family
+ {
+ QString componentStr = "import QtQuick 2.0\nText { font.pointSize: 40; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->font().pointSize(), 40);
+ QCOMPARE(textObject->font().bold(), false);
+ QCOMPARE(textObject->font().italic(), false);
+
+ delete textObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nText { font.pixelSize: 40; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->font().pixelSize(), 40);
+ QCOMPARE(textObject->font().bold(), false);
+ QCOMPARE(textObject->font().italic(), false);
+
+ delete textObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nText { font.bold: true; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->font().bold(), true);
+ QCOMPARE(textObject->font().italic(), false);
+
+ delete textObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nText { font.italic: true; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->font().italic(), true);
+ QCOMPARE(textObject->font().bold(), false);
+
+ delete textObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nText { font.family: \"Helvetica\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->font().family(), QString("Helvetica"));
+ QCOMPARE(textObject->font().bold(), false);
+ QCOMPARE(textObject->font().italic(), false);
+
+ delete textObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nText { font.family: \"\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->font().family(), QString(""));
+
+ delete textObject;
+ }
+}
+
+void tst_qquicktext::style()
+{
+ //test style
+ for (int i = 0; i < styles.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE((int)textObject->style(), (int)styles.at(i));
+ QCOMPARE(textObject->styleColor(), QColor("white"));
+
+ delete textObject;
+ }
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QRectF brPre = textObject->boundingRect();
+ textObject->setStyle(QQuickText::Outline);
+ QRectF brPost = textObject->boundingRect();
+
+ QVERIFY(brPre.width() < brPost.width());
+ QVERIFY(brPre.height() < brPost.height());
+
+ delete textObject;
+}
+
+void tst_qquicktext::color()
+{
+ //test style
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->color(), QColor(colorStrings.at(i)));
+ QCOMPARE(textObject->styleColor(), QColor("black"));
+ QCOMPARE(textObject->linkColor(), QColor("blue"));
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i)));
+ // default color to black?
+ QCOMPARE(textObject->color(), QColor("black"));
+ QCOMPARE(textObject->linkColor(), QColor("blue"));
+
+ QSignalSpy colorSpy(textObject, SIGNAL(colorChanged()));
+ QSignalSpy linkColorSpy(textObject, SIGNAL(linkColorChanged()));
+
+ textObject->setColor(QColor("white"));
+ QCOMPARE(textObject->color(), QColor("white"));
+ QCOMPARE(colorSpy.count(), 1);
+
+ textObject->setLinkColor(QColor("black"));
+ QCOMPARE(textObject->linkColor(), QColor("black"));
+ QCOMPARE(linkColorSpy.count(), 1);
+
+ textObject->setColor(QColor("white"));
+ QCOMPARE(colorSpy.count(), 1);
+
+ textObject->setLinkColor(QColor("black"));
+ QCOMPARE(linkColorSpy.count(), 1);
+
+ textObject->setColor(QColor("black"));
+ QCOMPARE(textObject->color(), QColor("black"));
+ QCOMPARE(colorSpy.count(), 2);
+
+ textObject->setLinkColor(QColor("blue"));
+ QCOMPARE(textObject->linkColor(), QColor("blue"));
+ QCOMPARE(linkColorSpy.count(), 2);
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { linkColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->styleColor(), QColor("black"));
+ QCOMPARE(textObject->color(), QColor("black"));
+ QCOMPARE(textObject->linkColor(), QColor(colorStrings.at(i)));
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ for (int j = 0; j < colorStrings.size(); j++)
+ {
+ QString componentStr = "import QtQuick 2.0\nText { "
+ "color: \"" + colorStrings.at(i) + "\"; "
+ "styleColor: \"" + colorStrings.at(j) + "\"; "
+ "linkColor: \"" + colorStrings.at(j) + "\"; "
+ "text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->color(), QColor(colorStrings.at(i)));
+ QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(j)));
+ QCOMPARE(textObject->linkColor(), QColor(colorStrings.at(j)));
+
+ delete textObject;
+ }
+ }
+ {
+ QString colorStr = "#AA001234";
+ QColor testColor("#001234");
+ testColor.setAlpha(170);
+
+ QString componentStr = "import QtQuick 2.0\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QCOMPARE(textObject->color(), testColor);
+
+ delete textObject;
+ } {
+ QString colorStr = "#001234";
+ QColor testColor(colorStr);
+
+ QString componentStr = "import QtQuick 2.0\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickText *textObject = qobject_cast<QQuickText*>(object.data());
+
+ QSignalSpy spy(textObject, SIGNAL(colorChanged()));
+
+ QCOMPARE(textObject->color(), testColor);
+ textObject->setColor(testColor);
+ QCOMPARE(textObject->color(), testColor);
+ QCOMPARE(spy.count(), 0);
+
+ testColor = QColor("black");
+ textObject->setColor(testColor);
+ QCOMPARE(textObject->color(), testColor);
+ QCOMPARE(spy.count(), 1);
+ } {
+ QString colorStr = "#001234";
+ QColor testColor(colorStr);
+
+ QString componentStr = "import QtQuick 2.0\nText { styleColor: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickText *textObject = qobject_cast<QQuickText*>(object.data());
+
+ QSignalSpy spy(textObject, SIGNAL(styleColorChanged()));
+
+ QCOMPARE(textObject->styleColor(), testColor);
+ textObject->setStyleColor(testColor);
+ QCOMPARE(textObject->styleColor(), testColor);
+ QCOMPARE(spy.count(), 0);
+
+ testColor = QColor("black");
+ textObject->setStyleColor(testColor);
+ QCOMPARE(textObject->styleColor(), testColor);
+ QCOMPARE(spy.count(), 1);
+ } {
+ QString colorStr = "#001234";
+ QColor testColor(colorStr);
+
+ QString componentStr = "import QtQuick 2.0\nText { linkColor: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickText *textObject = qobject_cast<QQuickText*>(object.data());
+
+ QSignalSpy spy(textObject, SIGNAL(linkColorChanged()));
+
+ QCOMPARE(textObject->linkColor(), testColor);
+ textObject->setLinkColor(testColor);
+ QCOMPARE(textObject->linkColor(), testColor);
+ QCOMPARE(spy.count(), 0);
+
+ testColor = QColor("black");
+ textObject->setLinkColor(testColor);
+ QCOMPARE(textObject->linkColor(), testColor);
+ QCOMPARE(spy.count(), 1);
+ }
+}
+
+void tst_qquicktext::smooth()
+{
+ for (int i = 0; i < standard.size(); i++)
+ {
+ {
+ QString componentStr = "import QtQuick 2.0\nText { smooth: false; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+ QCOMPARE(textObject->smooth(), false);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+ QCOMPARE(textObject->smooth(), true);
+
+ delete textObject;
+ }
+ }
+ for (int i = 0; i < richText.size(); i++)
+ {
+ {
+ QString componentStr = "import QtQuick 2.0\nText { smooth: false; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+ QCOMPARE(textObject->smooth(), false);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + richText.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+ QCOMPARE(textObject->smooth(), true);
+
+ delete textObject;
+ }
+ }
+}
+
+void tst_qquicktext::renderType()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n Text {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickText *text = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(text);
+
+ QSignalSpy spy(text, SIGNAL(renderTypeChanged()));
+
+ QCOMPARE(text->renderType(), QQuickText::QtRendering);
+
+ text->setRenderType(QQuickText::NativeRendering);
+ QCOMPARE(text->renderType(), QQuickText::NativeRendering);
+ QCOMPARE(spy.count(), 1);
+
+ text->setRenderType(QQuickText::NativeRendering);
+ QCOMPARE(spy.count(), 1);
+
+ text->setRenderType(QQuickText::QtRendering);
+ QCOMPARE(text->renderType(), QQuickText::QtRendering);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktext::weight()
+{
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().weight(), (int)QQuickFontValueType::Normal);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { font.weight: \"Bold\"; text: \"Hello world!\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().weight(), (int)QQuickFontValueType::Bold);
+
+ delete textObject;
+ }
+}
+
+void tst_qquicktext::underline()
+{
+ QQuickView view(testFileUrl("underline.qml"));
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().overline(), false);
+ QCOMPARE(textObject->font().underline(), true);
+ QCOMPARE(textObject->font().strikeOut(), false);
+}
+
+void tst_qquicktext::overline()
+{
+ QQuickView view(testFileUrl("overline.qml"));
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().overline(), true);
+ QCOMPARE(textObject->font().underline(), false);
+ QCOMPARE(textObject->font().strikeOut(), false);
+}
+
+void tst_qquicktext::strikeout()
+{
+ QQuickView view(testFileUrl("strikeout.qml"));
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().overline(), false);
+ QCOMPARE(textObject->font().underline(), false);
+ QCOMPARE(textObject->font().strikeOut(), true);
+}
+
+void tst_qquicktext::capitalization()
+{
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::MixedCase);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::AllUppercase);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::AllLowercase);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::SmallCaps);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::Capitalize);
+
+ delete textObject;
+ }
+}
+
+void tst_qquicktext::letterSpacing()
+{
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), 0.0);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.letterSpacing: -2 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), -2.);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.letterSpacing: 3 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), 3.);
+
+ delete textObject;
+ }
+}
+
+void tst_qquicktext::wordSpacing()
+{
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), 0.0);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.wordSpacing: -50 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), -50.);
+
+ delete textObject;
+ }
+ {
+ QString componentStr = "import QtQuick 2.0\nText { text: \"Hello world!\"; font.wordSpacing: 200 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), 200.);
+
+ delete textObject;
+ }
+}
+
+class EventSender : public QQuickItem
+{
+public:
+ void sendEvent(QMouseEvent *event) {
+ if (event->type() == QEvent::MouseButtonPress)
+ mousePressEvent(event);
+ else if (event->type() == QEvent::MouseButtonRelease)
+ mouseReleaseEvent(event);
+ else if (event->type() == QEvent::MouseMove)
+ mouseMoveEvent(event);
+ else
+ qWarning() << "Trying to send unsupported event type";
+ }
+};
+
+class LinkTest : public QObject
+{
+ Q_OBJECT
+public:
+ LinkTest() {}
+
+ QString link;
+
+public slots:
+ void linkClicked(QString l) { link = l; }
+};
+
+class TextMetrics
+{
+public:
+ TextMetrics(const QString &text, Qt::TextElideMode elideMode = Qt::ElideNone)
+ {
+ QString adjustedText = text;
+ adjustedText.replace(QLatin1Char('\n'), QChar(QChar::LineSeparator));
+ if (elideMode == Qt::ElideLeft)
+ adjustedText = QChar(0x2026) + adjustedText;
+ else if (elideMode == Qt::ElideRight)
+ adjustedText = adjustedText + QChar(0x2026);
+
+ layout.setText(adjustedText);
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+
+ layout.beginLayout();
+ qreal height = 0;
+ QTextLine line = layout.createLine();
+ while (line.isValid()) {
+ line.setLineWidth(FLT_MAX);
+ line.setPosition(QPointF(0, height));
+ height += line.height();
+ line = layout.createLine();
+ }
+ layout.endLayout();
+ }
+
+ qreal width() const { return layout.maximumWidth(); }
+
+ QRectF characterRectangle(
+ int position,
+ int hAlign = Qt::AlignLeft,
+ int vAlign = Qt::AlignTop,
+ const QSizeF &bounds = QSizeF(240, 320)) const
+ {
+ qreal dy = 0;
+ switch (vAlign) {
+ case Qt::AlignBottom:
+ dy = bounds.height() - layout.boundingRect().height();
+ break;
+ case Qt::AlignVCenter:
+ dy = (bounds.height() - layout.boundingRect().height()) / 2;
+ break;
+ default:
+ break;
+ }
+
+ for (int i = 0; i < layout.lineCount(); ++i) {
+ QTextLine line = layout.lineAt(i);
+ if (position >= line.textStart() + line.textLength())
+ continue;
+ qreal dx = 0;
+ switch (hAlign) {
+ case Qt::AlignRight:
+ dx = bounds.width() - line.naturalTextWidth();
+ break;
+ case Qt::AlignHCenter:
+ dx = (bounds.width() - line.naturalTextWidth()) / 2;
+ break;
+ default:
+ break;
+ }
+
+ QRectF rect;
+ rect.setLeft(dx + line.cursorToX(position, QTextLine::Leading));
+ rect.setRight(dx + line.cursorToX(position, QTextLine::Trailing));
+ rect.setTop(dy + line.y());
+ rect.setBottom(dy + line.y() + line.height());
+
+ return rect;
+ }
+ return QRectF();
+ }
+
+ QTextLayout layout;
+};
+
+
+typedef QVector<QPointF> PointVector;
+Q_DECLARE_METATYPE(PointVector);
+
+void tst_qquicktext::clickLink_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<qreal>("width");
+ QTest::addColumn<QString>("bindings");
+ QTest::addColumn<PointVector>("mousePositions");
+ QTest::addColumn<QString>("link");
+
+ const QString singleLineText = "this text has a <a href=\\\"http://qt-project.org/single\\\">link</a> in it";
+ const QString singleLineLink = "http://qt-project.org/single";
+ const QString multipleLineText = "this text<br/>has <a href=\\\"http://qt-project.org/multiple\\\">multiple<br/>lines</a> in it";
+ const QString multipleLineLink = "http://qt-project.org/multiple";
+ const QString nestedText = "this text has a <a href=\\\"http://qt-project.org/outer\\\">nested <a href=\\\"http://qt-project.org/inner\\\">link</a> in it</a>";
+ const QString outerLink = "http://qt-project.org/outer";
+ const QString innerLink = "http://qt-project.org/inner";
+
+ {
+ const TextMetrics metrics("this text has a link in it");
+
+ QTest::newRow("click on link")
+ << singleLineText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(18).center())
+ << singleLineLink;
+ QTest::newRow("click on text")
+ << singleLineText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(13).center())
+ << QString();
+ QTest::newRow("drag within link")
+ << singleLineText << 240.
+ << ""
+ << (PointVector()
+ << metrics.characterRectangle(17).center()
+ << metrics.characterRectangle(19).center())
+ << singleLineLink;
+ QTest::newRow("drag away from link")
+ << singleLineText << 240.
+ << ""
+ << (PointVector()
+ << metrics.characterRectangle(18).center()
+ << metrics.characterRectangle(13).center())
+ << QString();
+ QTest::newRow("drag on to link")
+ << singleLineText << 240.
+ << ""
+ << (PointVector()
+ << metrics.characterRectangle(13).center()
+ << metrics.characterRectangle(18).center())
+ << QString();
+ QTest::newRow("click on bottom right aligned link")
+ << singleLineText << 240.
+ << "horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignBottom"
+ << (PointVector() << metrics.characterRectangle(18, Qt::AlignRight, Qt::AlignBottom).center())
+ << singleLineLink;
+ QTest::newRow("click on center aligned link")
+ << singleLineText << 240.
+ << "horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter"
+ << (PointVector() << metrics.characterRectangle(18, Qt::AlignHCenter, Qt::AlignVCenter).center())
+ << singleLineLink;
+ QTest::newRow("click on rich text link")
+ << singleLineText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(18).center())
+ << singleLineLink;
+ QTest::newRow("click on rich text")
+ << singleLineText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(13).center())
+ << QString();
+ QTest::newRow("click on bottom right aligned rich text link")
+ << singleLineText << 240.
+ << "textFormat: Text.RichText; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignBottom"
+ << (PointVector() << metrics.characterRectangle(18, Qt::AlignRight, Qt::AlignBottom).center())
+ << singleLineLink;
+ QTest::newRow("click on center aligned rich text link")
+ << singleLineText << 240.
+ << "textFormat: Text.RichText; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter"
+ << (PointVector() << metrics.characterRectangle(18, Qt::AlignHCenter, Qt::AlignVCenter).center())
+ << singleLineLink;
+ } {
+ const TextMetrics metrics("this text has a li", Qt::ElideRight);
+ QTest::newRow("click on right elided link")
+ << singleLineText << metrics.width() + 2
+ << "elide: Text.ElideRight"
+ << (PointVector() << metrics.characterRectangle(17).center())
+ << singleLineLink;
+ } {
+ const TextMetrics metrics("ink in it", Qt::ElideLeft);
+ QTest::newRow("click on left elided link")
+ << singleLineText << metrics.width() + 2
+ << "elide: Text.ElideLeft"
+ << (PointVector() << metrics.characterRectangle(2).center())
+ << singleLineLink;
+ } {
+ const TextMetrics metrics("this text\nhas multiple\nlines in it");
+ QTest::newRow("click on second line")
+ << multipleLineText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(18).center())
+ << multipleLineLink;
+ QTest::newRow("click on third line")
+ << multipleLineText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(25).center())
+ << multipleLineLink;
+ QTest::newRow("drag from second line to third")
+ << multipleLineText << 240.
+ << ""
+ << (PointVector()
+ << metrics.characterRectangle(18).center()
+ << metrics.characterRectangle(25).center())
+ << multipleLineLink;
+ QTest::newRow("click on rich text second line")
+ << multipleLineText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(18).center())
+ << multipleLineLink;
+ QTest::newRow("click on rich text third line")
+ << multipleLineText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(25).center())
+ << multipleLineLink;
+ QTest::newRow("drag rich text from second line to third")
+ << multipleLineText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector()
+ << metrics.characterRectangle(18).center()
+ << metrics.characterRectangle(25).center())
+ << multipleLineLink;
+ } {
+ const TextMetrics metrics("this text has a nested link in it");
+ QTest::newRow("click on left outer link")
+ << nestedText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(22).center())
+ << outerLink;
+ QTest::newRow("click on right outer link")
+ << nestedText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(27).center())
+ << outerLink;
+ QTest::newRow("click on inner link left")
+ << nestedText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(23).center())
+ << innerLink;
+ QTest::newRow("click on inner link right")
+ << nestedText << 240.
+ << ""
+ << (PointVector() << metrics.characterRectangle(26).center())
+ << innerLink;
+ QTest::newRow("drag from inner to outer link")
+ << nestedText << 240.
+ << ""
+ << (PointVector()
+ << metrics.characterRectangle(25).center()
+ << metrics.characterRectangle(30).center())
+ << QString();
+ QTest::newRow("drag from outer to inner link")
+ << nestedText << 240.
+ << ""
+ << (PointVector()
+ << metrics.characterRectangle(30).center()
+ << metrics.characterRectangle(25).center())
+ << QString();
+ QTest::newRow("click on left outer rich text link")
+ << nestedText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(22).center())
+ << outerLink;
+ QTest::newRow("click on right outer rich text link")
+ << nestedText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(27).center())
+ << outerLink;
+ QTest::newRow("click on inner rich text link left")
+ << nestedText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(23).center())
+ << innerLink;
+ QTest::newRow("click on inner rich text link right")
+ << nestedText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector() << metrics.characterRectangle(26).center())
+ << innerLink;
+ QTest::newRow("drag from inner to outer rich text link")
+ << nestedText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector()
+ << metrics.characterRectangle(25).center()
+ << metrics.characterRectangle(30).center())
+ << QString();
+ QTest::newRow("drag from outer to inner rich text link")
+ << nestedText << 240.
+ << "textFormat: Text.RichText"
+ << (PointVector()
+ << metrics.characterRectangle(30).center()
+ << metrics.characterRectangle(25).center())
+ << QString();
+ }
+}
+
+void tst_qquicktext::clickLink()
+{
+ QFETCH(QString, text);
+ QFETCH(qreal, width);
+ QFETCH(QString, bindings);
+ QFETCH(PointVector, mousePositions);
+ QFETCH(QString, link);
+
+ QString componentStr =
+ "import QtQuick 2.0\nText {\n"
+ "width: " + QString::number(width) + "\n"
+ "height: 320\n"
+ "text: \"" + text + "\"\n"
+ "" + bindings + "\n"
+ "}";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+
+ LinkTest test;
+ QObject::connect(textObject, SIGNAL(linkActivated(QString)), &test, SLOT(linkClicked(QString)));
+
+ QVERIFY(mousePositions.count() > 0);
+
+ QPointF mousePosition = mousePositions.first();
+ {
+ QMouseEvent me(QEvent::MouseButtonPress, mousePosition, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+ static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&me);
+ }
+
+ for (int i = 1; i < mousePositions.count(); ++i) {
+ mousePosition = mousePositions.at(i);
+
+ QMouseEvent me(QEvent::MouseMove, mousePosition, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+ static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&me);
+ }
+
+ {
+ QMouseEvent me(QEvent::MouseButtonRelease, mousePosition, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+ static_cast<EventSender*>(static_cast<QQuickItem*>(textObject))->sendEvent(&me);
+ }
+
+ QCOMPARE(test.link, link);
+
+ delete textObject;
+}
+
+void tst_qquicktext::baseUrl()
+{
+ QUrl localUrl("file:///tests/text.qml");
+ QUrl remoteUrl("http://qt.nokia.com/test.qml");
+
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\n Text {}", localUrl);
+ QQuickText *textObject = qobject_cast<QQuickText *>(textComponent.create());
+
+ QCOMPARE(textObject->baseUrl(), localUrl);
+
+ QSignalSpy spy(textObject, SIGNAL(baseUrlChanged()));
+
+ textObject->setBaseUrl(localUrl);
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 0);
+
+ textObject->setBaseUrl(remoteUrl);
+ QCOMPARE(textObject->baseUrl(), remoteUrl);
+ QCOMPARE(spy.count(), 1);
+
+ textObject->resetBaseUrl();
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktext::embeddedImages_data()
+{
+ QTest::addColumn<QUrl>("qmlfile");
+ QTest::addColumn<QString>("error");
+ QTest::newRow("local") << testFileUrl("embeddedImagesLocal.qml") << "";
+ QTest::newRow("local-error") << testFileUrl("embeddedImagesLocalError.qml")
+ << testFileUrl("embeddedImagesLocalError.qml").toString()+":3:1: QML Text: Cannot open: " + testFileUrl("http/notexists.png").toString();
+ QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << "";
+ QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << "";
+ QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml")
+ << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading " SERVER_ADDR "/notexists.png - server replied: Not found";
+ QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << "";
+}
+
+void tst_qquicktext::embeddedImages()
+{
+ // Tests QTBUG-9900
+
+ QFETCH(QUrl, qmlfile);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(SERVER_PORT);
+ server.serveDirectory(testFile("http"));
+
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toLatin1());
+
+ QQuickView *view = new QQuickView(qmlfile);
+ view->show();
+ view->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(view));
+ QQuickText *textObject = qobject_cast<QQuickText*>(view->rootObject());
+
+ QVERIFY(textObject != 0);
+ QTRY_COMPARE(textObject->resourcesLoading(), 0);
+
+ QPixmap pm(testFile("http/exists.png"));
+ if (error.isEmpty()) {
+ QCOMPARE(textObject->width(), double(pm.width()));
+ QCOMPARE(textObject->height(), double(pm.height()));
+ } else {
+ QVERIFY(16 != pm.width()); // check test is effective
+ QCOMPARE(textObject->width(), 16.0); // default size of QTextDocument broken image icon
+ QCOMPARE(textObject->height(), 16.0);
+ }
+
+ delete view;
+}
+
+void tst_qquicktext::lineCount()
+{
+ QQuickView *window = createView(testFile("lineCount.qml"));
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ QVERIFY(myText->lineCount() > 1);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->maximumLineCount(), INT_MAX);
+
+ myText->setMaximumLineCount(2);
+ QCOMPARE(myText->lineCount(), 2);
+ QCOMPARE(myText->truncated(), true);
+ QCOMPARE(myText->maximumLineCount(), 2);
+
+ myText->resetMaximumLineCount();
+ QCOMPARE(myText->maximumLineCount(), INT_MAX);
+ QCOMPARE(myText->truncated(), false);
+
+ myText->setElideMode(QQuickText::ElideRight);
+ myText->setMaximumLineCount(2);
+ QCOMPARE(myText->lineCount(), 2);
+ QCOMPARE(myText->truncated(), true);
+ QCOMPARE(myText->maximumLineCount(), 2);
+
+ delete window;
+}
+
+void tst_qquicktext::lineHeight()
+{
+ QQuickView *window = createView(testFile("lineHeight.qml"));
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ QVERIFY(myText->lineHeight() == 1);
+ QVERIFY(myText->lineHeightMode() == QQuickText::ProportionalHeight);
+
+ qreal h = myText->height();
+ myText->setLineHeight(1.5);
+ QCOMPARE(myText->height(), qreal(qCeil(h)) * 1.5);
+
+ myText->setLineHeightMode(QQuickText::FixedHeight);
+ myText->setLineHeight(20);
+ QCOMPARE(myText->height(), myText->lineCount() * 20.0);
+
+ myText->setText("Lorem ipsum sit <b>amet</b>, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum.");
+ myText->setLineHeightMode(QQuickText::ProportionalHeight);
+ myText->setLineHeight(1.0);
+
+ qreal h2 = myText->height();
+ myText->setLineHeight(2.0);
+ QVERIFY(myText->height() == h2 * 2.0);
+
+ myText->setLineHeightMode(QQuickText::FixedHeight);
+ myText->setLineHeight(10);
+ QCOMPARE(myText->height(), myText->lineCount() * 10.0);
+
+ delete window;
+}
+
+void tst_qquicktext::implicitSize_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("width");
+ QTest::addColumn<QString>("wrap");
+ QTest::addColumn<QString>("elide");
+ QTest::addColumn<QString>("format");
+ QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "50" << "Text.NoWrap" << "Text.ElideNone" << "Text.PlainText";
+ QTest::newRow("richtext") << "<b>The quick red fox jumped over the lazy brown dog</b>" <<" 50" << "Text.NoWrap" << "Text.ElideNone" << "Text.RichText";
+ QTest::newRow("styledtext") << "<b>The quick red fox jumped over the lazy brown dog</b>" <<" 50" << "Text.NoWrap" << "Text.ElideNone" << "Text.StyledText";
+ QTest::newRow("plain, 0 width") << "The quick red fox jumped over the lazy brown dog" << "0" << "Text.NoWrap" << "Text.ElideNone" << "Text.PlainText";
+ QTest::newRow("plain, elide") << "The quick red fox jumped over the lazy brown dog" << "50" << "Text.NoWrap" << "Text.ElideRight" << "Text.PlainText";
+ QTest::newRow("plain, 0 width, elide") << "The quick red fox jumped over the lazy brown dog" << "0" << "Text.NoWrap" << "Text.ElideRight" << "Text.PlainText";
+ QTest::newRow("richtext, 0 width") << "<b>The quick red fox jumped over the lazy brown dog</b>" <<" 0" << "Text.NoWrap" << "Text.ElideNone" << "Text.RichText";
+ QTest::newRow("styledtext, 0 width") << "<b>The quick red fox jumped over the lazy brown dog</b>" <<" 0" << "Text.NoWrap" << "Text.ElideNone" << "Text.StyledText";
+ QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "50" << "Text.Wrap" << "Text.ElideNone" << "Text.PlainText";
+ QTest::newRow("richtext_wrap") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "50" << "Text.Wrap" << "Text.ElideNone" << "Text.RichText";
+ QTest::newRow("styledtext_wrap") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "50" << "Text.Wrap" << "Text.ElideNone" << "Text.StyledText";
+ QTest::newRow("plain_wrap, 0 width") << "The quick red fox jumped over the lazy brown dog" << "0" << "Text.Wrap" << "Text.ElideNone" << "Text.PlainText";
+ QTest::newRow("plain_wrap, elide") << "The quick red fox jumped over the lazy brown dog" << "50" << "Text.Wrap" << "Text.ElideRight" << "Text.PlainText";
+ QTest::newRow("plain_wrap, 0 width, elide") << "The quick red fox jumped over the lazy brown dog" << "0" << "Text.Wrap" << "Text.ElideRight" << "Text.PlainText";
+ QTest::newRow("richtext_wrap, 0 width") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "0" << "Text.Wrap" << "Text.ElideNone" << "Text.RichText";
+ QTest::newRow("styledtext_wrap, 0 width") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "0" << "Text.Wrap" << "Text.ElideNone" << "Text.StyledText";
+}
+
+void tst_qquicktext::implicitSize()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, width);
+ QFETCH(QString, format);
+ QFETCH(QString, wrap);
+ QFETCH(QString, elide);
+ QString componentStr = "import QtQuick 2.0\nText { "
+ "property real iWidth: implicitWidth; "
+ "text: \"" + text + "\"; "
+ "width: " + width + "; "
+ "textFormat: " + format + "; "
+ "wrapMode: " + wrap + "; "
+ "elide: " + elide + "; "
+ "maximumLineCount: 2 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject->width() < textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+ QCOMPARE(textObject->property("iWidth").toReal(), textObject->implicitWidth());
+
+ textObject->resetWidth();
+ QVERIFY(textObject->width() == textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+
+ delete textObject;
+}
+
+void tst_qquicktext::contentSize()
+{
+ QString componentStr = "import QtQuick 2.0\nText { width: 75; height: 16; font.pixelSize: 10 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickText *textObject = qobject_cast<QQuickText *>(object.data());
+
+ QSignalSpy spy(textObject, SIGNAL(contentSizeChanged()));
+
+ textObject->setText("The quick red fox jumped over the lazy brown dog");
+
+ QVERIFY(textObject->contentWidth() > textObject->width());
+ QVERIFY(textObject->contentHeight() < textObject->height());
+ QCOMPARE(spy.count(), 1);
+
+ textObject->setWrapMode(QQuickText::WordWrap);
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+ QVERIFY(textObject->contentHeight() > textObject->height());
+ QCOMPARE(spy.count(), 2);
+
+ textObject->setElideMode(QQuickText::ElideRight);
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+ QVERIFY(textObject->contentHeight() < textObject->height());
+ QCOMPARE(spy.count(), 3);
+ int spyCount = 3;
+ qreal elidedWidth = textObject->contentWidth();
+
+ textObject->setText("The quickredfoxjumpedoverthe lazy brown dog");
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+ QVERIFY(textObject->contentHeight() < textObject->height());
+ // this text probably won't have the same elided width, but it's not guaranteed.
+ if (textObject->contentWidth() != elidedWidth)
+ QCOMPARE(spy.count(), ++spyCount);
+ else
+ QCOMPARE(spy.count(), spyCount);
+
+ textObject->setElideMode(QQuickText::ElideNone);
+ QVERIFY(textObject->contentWidth() > textObject->width());
+ QVERIFY(textObject->contentHeight() > textObject->height());
+ QCOMPARE(spy.count(), ++spyCount);
+}
+
+void tst_qquicktext::geometryChanged()
+{
+ // Test that text is re-laid out when the geometry of the item by verifying changes in content
+ // size. Implicit width is also tested as that in combination with item geometry provides a
+ // reference for expected content sizes.
+
+ QString componentStr = "import QtQuick 2.0\nText { font.family: \"__Qt__Box__Engine__\"; font.pixelSize: 10 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickText *textObject = qobject_cast<QQuickText *>(object.data());
+
+ const qreal implicitHeight = textObject->implicitHeight();
+
+ const qreal widths[] = { 100, 2000, 3000, -100, 100 };
+ const qreal heights[] = { implicitHeight, 2000, 3000, -implicitHeight, implicitHeight };
+
+ QCOMPARE(textObject->implicitWidth(), 0.);
+ QVERIFY(implicitHeight > 0.);
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), textObject->implicitWidth());
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setText("The quick red fox jumped over the lazy brown dog");
+
+ const qreal implicitWidth = textObject->implicitWidth();
+
+ QVERIFY(implicitWidth > 0.);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+ QCOMPARE(textObject->contentWidth(), textObject->implicitWidth());
+ QCOMPARE(textObject->contentHeight(), textObject->implicitHeight());
+
+ // Changing the geometry with no eliding, or wrapping doesn't change the content size.
+ for (int i = 0; i < 5; ++i) {
+ textObject->setWidth(widths[i]);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), widths[i]);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+ }
+
+ // With eliding enabled the content width is bounded to the item width, but is never
+ // larger than the implicit width.
+ textObject->setElideMode(QQuickText::ElideRight);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(2000.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 2000.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(3000.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 3000.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(-100);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), -100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), 0.);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(100.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ // With wrapping enabled the implicit height changes with the width.
+ textObject->setElideMode(QQuickText::ElideNone);
+ textObject->setWrapMode(QQuickText::Wrap);
+ const qreal wrappedImplicitHeight = textObject->implicitHeight();
+
+ QVERIFY(wrappedImplicitHeight > implicitHeight);
+
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), wrappedImplicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), wrappedImplicitHeight);
+
+ textObject->setWidth(2000.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 2000.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(3000.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 3000.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(-100);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), -100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth); // 0 or negative width item won't wrap.
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(100.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), wrappedImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), wrappedImplicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), wrappedImplicitHeight);
+
+ // With no eliding or maximum line count the content height is the same as the implicit height.
+ for (int i = 0; i < 5; ++i) {
+ textObject->setHeight(heights[i]);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), wrappedImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), heights[i]);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), wrappedImplicitHeight);
+ }
+
+ // The implicit height is unaffected by eliding but the content height will change.
+ textObject->setElideMode(QQuickText::ElideRight);
+
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), wrappedImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setHeight(2000);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), wrappedImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), 2000.);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), wrappedImplicitHeight);
+
+ textObject->setHeight(3000);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), wrappedImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), 3000.);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), wrappedImplicitHeight);
+
+ textObject->setHeight(-implicitHeight);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), wrappedImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), -implicitHeight);
+ QVERIFY(textObject->contentWidth() <= 0.);
+ QCOMPARE(textObject->contentHeight(), implicitHeight); // content height is never less than font height. seems a little odd in this instance.
+
+ textObject->setHeight(implicitHeight);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), wrappedImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ // Varying the height with a maximum line count but no eliding won't affect the content height.
+ textObject->setElideMode(QQuickText::ElideNone);
+ textObject->setMaximumLineCount(2);
+ textObject->resetHeight();
+
+ const qreal maxLineCountImplicitHeight = textObject->implicitHeight();
+ QVERIFY(maxLineCountImplicitHeight > implicitHeight);
+ QVERIFY(maxLineCountImplicitHeight < wrappedImplicitHeight);
+
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), maxLineCountImplicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), maxLineCountImplicitHeight);
+
+ for (int i = 0; i < 5; ++i) {
+ textObject->setHeight(heights[i]);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), maxLineCountImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), heights[i]);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), maxLineCountImplicitHeight);
+ }
+
+ // Varying the width with a maximum line count won't increase the implicit height beyond the
+ // height of the maximum number of lines.
+ textObject->setWidth(2000.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 2000.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(3000.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), 3000.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth);
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(-100);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), implicitHeight);
+ QCOMPARE(textObject->width(), -100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QCOMPARE(textObject->contentWidth(), implicitWidth); // 0 or negative width item won't wrap.
+ QCOMPARE(textObject->contentHeight(), implicitHeight);
+
+ textObject->setWidth(50.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), maxLineCountImplicitHeight);
+ QCOMPARE(textObject->width(), 50.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QVERIFY(textObject->contentWidth() <= 50.);
+ QCOMPARE(textObject->contentHeight(), maxLineCountImplicitHeight);
+
+ textObject->setWidth(100.);
+ QCOMPARE(textObject->implicitWidth(), implicitWidth);
+ QCOMPARE(textObject->implicitHeight(), maxLineCountImplicitHeight);
+ QCOMPARE(textObject->width(), 100.);
+ QCOMPARE(textObject->height(), implicitHeight);
+ QVERIFY(textObject->contentWidth() <= 100.);
+ QCOMPARE(textObject->contentHeight(), maxLineCountImplicitHeight);
+}
+
+void tst_qquicktext::implicitSizeBinding_data()
+{
+ implicitSize_data();
+}
+
+void tst_qquicktext::implicitSizeBinding()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, wrap);
+ QFETCH(QString, format);
+ QString componentStr = "import QtQuick 2.0\nText { text: \"" + text + "\"; width: implicitWidth; height: implicitHeight; wrapMode: " + wrap + "; textFormat: " + format + " }";
+
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickText *textObject = qobject_cast<QQuickText *>(object.data());
+
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+
+ textObject->resetWidth();
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+
+ textObject->resetHeight();
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+}
+
+void tst_qquicktext::boundingRect_data()
+{
+ QTest::addColumn<QString>("format");
+ QTest::newRow("PlainText") << "Text.PlainText";
+ QTest::newRow("StyledText") << "Text.StyledText";
+ QTest::newRow("RichText") << "Text.RichText";
+}
+
+void tst_qquicktext::boundingRect()
+{
+ QFETCH(QString, format);
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n Text { textFormat:" + format.toUtf8() + "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickText *text = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(text);
+
+ QCOMPARE(text->boundingRect().x(), qreal(0));
+ QCOMPARE(text->boundingRect().y(), qreal(0));
+ QCOMPARE(text->boundingRect().width(), qreal(0));
+ QCOMPARE(text->boundingRect().height(), qreal(qCeil(QFontMetricsF(text->font()).height())));
+
+ text->setText("Hello World");
+
+ QTextLayout layout(text->text());
+ layout.setFont(text->font());
+
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ QCOMPARE(text->boundingRect().x(), qreal(0));
+ QCOMPARE(text->boundingRect().y(), qreal(0));
+ QCOMPARE(text->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(text->boundingRect().height(), line.height());
+
+ // the size of the bounding rect shouldn't be bounded by the size of item.
+ text->setWidth(text->width() / 2);
+ QCOMPARE(text->boundingRect().x(), qreal(0));
+ QCOMPARE(text->boundingRect().y(), qreal(0));
+ QCOMPARE(text->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(text->boundingRect().height(), line.height());
+
+ text->setHeight(text->height() * 2);
+ QCOMPARE(text->boundingRect().x(), qreal(0));
+ QCOMPARE(text->boundingRect().y(), qreal(0));
+ QCOMPARE(text->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(text->boundingRect().height(), line.height());
+
+ text->setHAlign(QQuickText::AlignRight);
+ QCOMPARE(text->boundingRect().x(), text->width() - line.naturalTextWidth());
+ QCOMPARE(text->boundingRect().y(), qreal(0));
+ QCOMPARE(text->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(text->boundingRect().height(), line.height());
+
+ text->setWrapMode(QQuickText::Wrap);
+ QCOMPARE(text->boundingRect().right(), text->width());
+ QCOMPARE(text->boundingRect().y(), qreal(0));
+ QVERIFY(text->boundingRect().width() < line.naturalTextWidth());
+ QVERIFY(text->boundingRect().height() > line.height());
+
+ text->setVAlign(QQuickText::AlignBottom);
+ QCOMPARE(text->boundingRect().right(), text->width());
+ QCOMPARE(text->boundingRect().bottom(), text->height());
+ QVERIFY(text->boundingRect().width() < line.naturalTextWidth());
+ QVERIFY(text->boundingRect().height() > line.height());
+}
+
+void tst_qquicktext::clipRect()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n Text {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickText *text = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(text);
+
+ QTextLayout layout;
+ layout.setFont(text->font());
+
+ QCOMPARE(text->clipRect().x(), qreal(0));
+ QCOMPARE(text->clipRect().y(), qreal(0));
+ QCOMPARE(text->clipRect().width(), text->width());
+ QCOMPARE(text->clipRect().height(), text->height());
+
+ text->setText("Hello World");
+
+ QCOMPARE(text->clipRect().x(), qreal(0));
+ QCOMPARE(text->clipRect().y(), qreal(0));
+ QCOMPARE(text->clipRect().width(), text->width());
+ QCOMPARE(text->clipRect().height(), text->height());
+
+ // Clip rect follows the item not content dimensions.
+ text->setWidth(text->width() / 2);
+ QCOMPARE(text->clipRect().x(), qreal(0));
+ QCOMPARE(text->clipRect().y(), qreal(0));
+ QCOMPARE(text->clipRect().width(), text->width());
+ QCOMPARE(text->clipRect().height(), text->height());
+
+ text->setHeight(text->height() * 2);
+ QCOMPARE(text->clipRect().x(), qreal(0));
+ QCOMPARE(text->clipRect().y(), qreal(0));
+ QCOMPARE(text->clipRect().width(), text->width());
+ QCOMPARE(text->clipRect().height(), text->height());
+
+ // Setting a style adds a small amount of padding to the clip rect.
+ text->setStyle(QQuickText::Outline);
+ QCOMPARE(text->clipRect().x(), qreal(-1));
+ QCOMPARE(text->clipRect().y(), qreal(0));
+ QCOMPARE(text->clipRect().width(), text->width() + 2);
+ QCOMPARE(text->clipRect().height(), text->height() + 2);
+}
+
+void tst_qquicktext::lineLaidOut()
+{
+ QQuickView *window = createView(testFile("lineLayout.qml"));
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText);
+ QVERIFY(textPrivate != 0);
+
+ QVERIFY(!textPrivate->extra.isAllocated());
+
+ for (int i = 0; i < textPrivate->layout.lineCount(); ++i) {
+ QRectF r = textPrivate->layout.lineAt(i).rect();
+ QVERIFY(r.width() == i * 15);
+ if (i >= 30)
+ QVERIFY(r.x() == r.width() + 30);
+ if (i >= 60) {
+ QVERIFY(r.x() == r.width() * 2 + 60);
+ QVERIFY(r.height() == 20);
+ }
+ }
+
+ delete window;
+}
+
+void tst_qquicktext::lineLaidOutRelayout()
+{
+ QQuickView *window = createView(testFile("lineLayoutRelayout.qml"));
+
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText);
+ QVERIFY(textPrivate != 0);
+
+ QVERIFY(!textPrivate->extra.isAllocated());
+
+ qreal maxH = 0;
+ for (int i = 0; i < textPrivate->layout.lineCount(); ++i) {
+ QRectF r = textPrivate->layout.lineAt(i).rect();
+
+ if (r.x() == 0) {
+ QCOMPARE(r.y(), i * r.height());
+ maxH = qMax(maxH, r.y() + r.height());
+ } else {
+ QCOMPARE(r.x(), myText->width() / 2);
+ QCOMPARE(r.y(), (i * r.height()) - maxH);
+ }
+ }
+
+ delete window;
+}
+
+void tst_qquicktext::imgTagsBaseUrl_data()
+{
+ QTest::addColumn<QUrl>("src");
+ QTest::addColumn<QUrl>("baseUrl");
+ QTest::addColumn<QUrl>("contextUrl");
+ QTest::addColumn<qreal>("imgHeight");
+
+ QTest::newRow("absolute local")
+ << testFileUrl("images/heart200.png")
+ << QUrl()
+ << QUrl()
+ << 181.;
+ QTest::newRow("relative local context 1")
+ << QUrl("images/heart200.png")
+ << QUrl()
+ << testFileUrl("/app.qml")
+ << 181.;
+ QTest::newRow("relative local context 2")
+ << QUrl("heart200.png")
+ << QUrl()
+ << testFileUrl("images/app.qml")
+ << 181.;
+ QTest::newRow("relative local base 1")
+ << QUrl("images/heart200.png")
+ << testFileUrl("")
+ << testFileUrl("nonexistant/app.qml")
+ << 181.;
+ QTest::newRow("relative local base 2")
+ << QUrl("heart200.png")
+ << testFileUrl("images/")
+ << testFileUrl("nonexistant/app.qml")
+ << 181.;
+ QTest::newRow("base relative to local context")
+ << QUrl("heart200.png")
+ << testFileUrl("images/")
+ << testFileUrl("/app.qml")
+ << 181.;
+
+ QTest::newRow("absolute remote")
+ << QUrl(SERVER_ADDR "/images/heart200.png")
+ << QUrl()
+ << QUrl()
+ << 181.;
+ QTest::newRow("relative remote base 1")
+ << QUrl("images/heart200.png")
+ << QUrl(SERVER_ADDR "/")
+ << testFileUrl("nonexistant/app.qml")
+ << 181.;
+ QTest::newRow("relative remote base 2")
+ << QUrl("heart200.png")
+ << QUrl(SERVER_ADDR "/images/")
+ << testFileUrl("nonexistant/app.qml")
+ << 181.;
+}
+
+void tst_qquicktext::imgTagsBaseUrl()
+{
+ QFETCH(QUrl, src);
+ QFETCH(QUrl, baseUrl);
+ QFETCH(QUrl, contextUrl);
+ QFETCH(qreal, imgHeight);
+
+ TestHTTPServer server(SERVER_PORT);
+ server.serveDirectory(testFile(""));
+
+ QByteArray baseUrlFragment;
+ if (!baseUrl.isEmpty())
+ baseUrlFragment = "; baseUrl: \"" + baseUrl.toEncoded() + "\"";
+ QByteArray componentStr = "import QtQuick 2.0\nText { text: \"This is a test <img src=\\\"" + src.toEncoded() + "\\\">\"" + baseUrlFragment + " }";
+
+ QQmlComponent component(&engine);
+ component.setData(componentStr, contextUrl);
+ QScopedPointer<QObject> object(component.create());
+ QQuickText *textObject = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(textObject);
+
+ QCoreApplication::processEvents();
+
+ QTRY_COMPARE(textObject->height(), imgHeight);
+}
+
+void tst_qquicktext::imgTagsAlign_data()
+{
+ QTest::addColumn<QString>("src");
+ QTest::addColumn<int>("imgHeight");
+ QTest::addColumn<QString>("align");
+ QTest::newRow("heart-bottom") << "data/images/heart200.png" << 181 << "bottom";
+ QTest::newRow("heart-middle") << "data/images/heart200.png" << 181 << "middle";
+ QTest::newRow("heart-top") << "data/images/heart200.png" << 181 << "top";
+ QTest::newRow("starfish-bottom") << "data/images/starfish_2.png" << 217 << "bottom";
+ QTest::newRow("starfish-middle") << "data/images/starfish_2.png" << 217 << "middle";
+ QTest::newRow("starfish-top") << "data/images/starfish_2.png" << 217 << "top";
+}
+
+void tst_qquicktext::imgTagsAlign()
+{
+ QFETCH(QString, src);
+ QFETCH(int, imgHeight);
+ QFETCH(QString, align);
+ QString componentStr = "import QtQuick 2.0\nText { text: \"This is a test <img src=\\\"" + src + "\\\" align=\\\"" + align + "\\\"> of image.\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->height() == imgHeight);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+
+ QRectF br = textPrivate->layout.boundingRect();
+ if (align == "bottom")
+ QVERIFY(br.y() == imgHeight - br.height());
+ else if (align == "middle")
+ QVERIFY(br.y() == imgHeight / 2.0 - br.height() / 2.0);
+ else if (align == "top")
+ QVERIFY(br.y() == 0);
+
+ delete textObject;
+}
+
+void tst_qquicktext::imgTagsMultipleImages()
+{
+ QString componentStr = "import QtQuick 2.0\nText { text: \"This is a starfish<img src=\\\"data/images/starfish_2.png\\\" width=\\\"60\\\" height=\\\"60\\\" > and another one<img src=\\\"data/images/heart200.png\\\" width=\\\"85\\\" height=\\\"85\\\">.\" }";
+
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->height() == 85);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->visibleImgTags.count() == 2);
+
+ delete textObject;
+}
+
+void tst_qquicktext::imgTagsElide()
+{
+ QQuickView *window = createView(testFile("imgTagsElide.qml"));
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->visibleImgTags.count() == 0);
+ myText->setMaximumLineCount(20);
+ QTRY_VERIFY(textPrivate->visibleImgTags.count() == 1);
+
+ delete myText;
+ delete window;
+}
+
+void tst_qquicktext::imgTagsUpdates()
+{
+ QQuickView *window = createView(testFile("imgTagsUpdates.qml"));
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ QSignalSpy spy(myText, SIGNAL(contentSizeChanged()));
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText);
+ QVERIFY(textPrivate != 0);
+
+ myText->setText("This is a heart<img src=\"images/heart200.png\">.");
+ QVERIFY(textPrivate->visibleImgTags.count() == 1);
+ QVERIFY(spy.count() == 1);
+
+ myText->setMaximumLineCount(2);
+ myText->setText("This is another heart<img src=\"images/heart200.png\">.");
+ QTRY_VERIFY(textPrivate->visibleImgTags.count() == 1);
+
+ // if maximumLineCount is set and the img tag doesn't have an explicit size
+ // we relayout twice.
+ QVERIFY(spy.count() == 3);
+
+ delete myText;
+ delete window;
+}
+
+void tst_qquicktext::imgTagsError()
+{
+ QString componentStr = "import QtQuick 2.0\nText { text: \"This is a starfish<img src=\\\"data/images/starfish_2.pn\\\" width=\\\"60\\\" height=\\\"60\\\">.\" }";
+
+ QQmlComponent textComponent(&engine);
+ QTest::ignoreMessage(QtWarningMsg, "file::2:1: QML Text: Cannot open: file:data/images/starfish_2.pn");
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ delete textObject;
+}
+
+void tst_qquicktext::fontSizeMode_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog";
+ QTest::newRow("styled") << "<b>The quick red fox jumped over the lazy brown dog</b>";
+}
+
+void tst_qquicktext::fontSizeMode()
+{
+ QFETCH(QString, text);
+
+ QScopedPointer<QQuickView> window(createView(testFile("fontSizeMode.qml")));
+ window->show();
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ myText->setText(text);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ qreal originalWidth = myText->contentWidth();
+ qreal originalHeight = myText->contentHeight();
+
+ // The original text unwrapped should exceed the width of the item.
+ QVERIFY(originalWidth > myText->width());
+ QVERIFY(originalHeight < myText->height());
+
+ QFont font = myText->font();
+ font.setPixelSize(64);
+
+ myText->setFont(font);
+ myText->setFontSizeMode(QQuickText::HorizontalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Font size reduced to fit within the width of the item.
+ qreal horizontalFitWidth = myText->contentWidth();
+ qreal horizontalFitHeight = myText->contentHeight();
+ QVERIFY(horizontalFitWidth <= myText->width() + 2); // rounding
+ QVERIFY(horizontalFitHeight <= myText->height() + 2);
+
+ // Elide won't affect the size with HorizontalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideLeft);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideMiddle);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::VerticalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Font size increased to fill the height of the item.
+ qreal verticalFitHeight = myText->contentHeight();
+ QVERIFY(myText->contentWidth() > myText->width());
+ QVERIFY(verticalFitHeight <= myText->height() + 2);
+ QVERIFY(verticalFitHeight > originalHeight);
+
+ // Elide won't affect the height of a single line with VerticalFit but will crop the width.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(myText->truncated());
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideLeft);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(myText->truncated());
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideMiddle);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(myText->truncated());
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::Fit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Should be the same as HorizontalFit with no wrapping.
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ // Elide won't affect the size with Fit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideLeft);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideMiddle);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::FixedSize);
+ myText->setWrapMode(QQuickText::Wrap);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ originalWidth = myText->contentWidth();
+ originalHeight = myText->contentHeight();
+
+ // The original text wrapped should exceed the height of the item.
+ QVERIFY(originalWidth <= myText->width() + 2);
+ QVERIFY(originalHeight > myText->height());
+
+ myText->setFontSizeMode(QQuickText::HorizontalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the
+ // same size as without text wrapping.
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ // Elide won't affect the size with HorizontalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::VerticalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // VerticalFit should reduce the size to the wrapped text within the vertical height.
+ verticalFitHeight = myText->contentHeight();
+ qreal verticalFitWidth = myText->contentWidth();
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QVERIFY(verticalFitHeight <= myText->height() + 2);
+ QVERIFY(verticalFitHeight < originalHeight);
+
+ // Elide won't affect the height or width of a wrapped text with VerticalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::Fit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Should be the same as VerticalFit with wrapping.
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ // Elide won't affect the size with Fit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::FixedSize);
+ myText->setMaximumLineCount(2);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ // The original text wrapped should exceed the height of the item.
+ QVERIFY(originalWidth <= myText->width() + 2);
+ QVERIFY(originalHeight > myText->height());
+
+ myText->setFontSizeMode(QQuickText::HorizontalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the
+ // same size as without text wrapping.
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ // Elide won't affect the size with HorizontalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::VerticalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // VerticalFit should reduce the size to the wrapped text within the vertical height.
+ verticalFitHeight = myText->contentHeight();
+ verticalFitWidth = myText->contentWidth();
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QVERIFY(verticalFitHeight <= myText->height() + 2);
+ QVERIFY(verticalFitHeight < originalHeight);
+
+ // Elide won't affect the height or width of a wrapped text with VerticalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::Fit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Should be the same as VerticalFit with wrapping.
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ // Elide won't affect the size with Fit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+}
+
+void tst_qquicktext::fontSizeModeMultiline_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::newRow("plain") << "The quick red fox jumped\n over the lazy brown dog";
+ QTest::newRow("styledtext") << "<b>The quick red fox jumped<br/> over the lazy brown dog</b>";
+}
+
+void tst_qquicktext::fontSizeModeMultiline()
+{
+ QFETCH(QString, text);
+
+ QScopedPointer<QQuickView> window(createView(testFile("fontSizeMode.qml")));
+ window->show();
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ myText->setText(text);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ qreal originalWidth = myText->contentWidth();
+ qreal originalHeight = myText->contentHeight();
+ QCOMPARE(myText->lineCount(), 2);
+
+ // The original text unwrapped should exceed the width and height of the item.
+ QVERIFY(originalWidth > myText->width());
+ QVERIFY(originalHeight > myText->height());
+
+ QFont font = myText->font();
+ font.setPixelSize(64);
+
+ myText->setFont(font);
+ myText->setFontSizeMode(QQuickText::HorizontalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Font size reduced to fit within the width of the item.
+ QCOMPARE(myText->lineCount(), 2);
+ qreal horizontalFitWidth = myText->contentWidth();
+ qreal horizontalFitHeight = myText->contentHeight();
+ QVERIFY(horizontalFitWidth <= myText->width() + 2); // rounding
+ QVERIFY(horizontalFitHeight > myText->height());
+
+ // Right eliding will remove the last line
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(myText->truncated());
+ QCOMPARE(myText->lineCount(), 1);
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QVERIFY(myText->contentHeight() <= myText->height() + 2);
+
+ // Left or middle eliding wont have any effect.
+ myText->setElideMode(QQuickText::ElideLeft);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideMiddle);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::VerticalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Font size reduced to fit within the height of the item.
+ qreal verticalFitWidth = myText->contentWidth();
+ qreal verticalFitHeight = myText->contentHeight();
+ QVERIFY(verticalFitWidth <= myText->width() + 2);
+ QVERIFY(verticalFitHeight <= myText->height() + 2);
+
+ // Elide will have no effect.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideLeft);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideMiddle);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::Fit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Should be the same as VerticalFit with no wrapping.
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ // Elide won't affect the size with Fit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideLeft);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideMiddle);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::FixedSize);
+ myText->setWrapMode(QQuickText::Wrap);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ originalWidth = myText->contentWidth();
+ originalHeight = myText->contentHeight();
+
+ // The original text wrapped should exceed the height of the item.
+ QVERIFY(originalWidth <= myText->width() + 2);
+ QVERIFY(originalHeight > myText->height());
+
+ myText->setFontSizeMode(QQuickText::HorizontalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the
+ // same size as without text wrapping.
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ // Text will be elided vertically with HorizontalFit
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(myText->truncated());
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QVERIFY(myText->contentHeight() <= myText->height() + 2);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::VerticalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // VerticalFit should reduce the size to the wrapped text within the vertical height.
+ verticalFitHeight = myText->contentHeight();
+ verticalFitWidth = myText->contentWidth();
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QVERIFY(verticalFitHeight <= myText->height() + 2);
+ QVERIFY(verticalFitHeight < originalHeight);
+
+ // Elide won't affect the height or width of a wrapped text with VerticalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::Fit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Should be the same as VerticalFit with wrapping.
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ // Elide won't affect the size with Fit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::FixedSize);
+ myText->setMaximumLineCount(2);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ // The original text wrapped should exceed the height of the item.
+ QVERIFY(originalWidth <= myText->width() + 2);
+ QVERIFY(originalHeight > myText->height());
+
+ myText->setFontSizeMode(QQuickText::HorizontalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // HorizontalFit should reduce the font size to minimize wrapping, which brings it back to the
+ // same size as without text wrapping.
+ QCOMPARE(myText->contentWidth(), horizontalFitWidth);
+ QCOMPARE(myText->contentHeight(), horizontalFitHeight);
+
+ // Elide won't affect the size with HorizontalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(myText->truncated());
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QVERIFY(myText->contentHeight() <= myText->height() + 2);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::VerticalFit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // VerticalFit should reduce the size to the wrapped text within the vertical height.
+ verticalFitHeight = myText->contentHeight();
+ verticalFitWidth = myText->contentWidth();
+ QVERIFY(myText->contentWidth() <= myText->width() + 2);
+ QVERIFY(verticalFitHeight <= myText->height() + 2);
+ QVERIFY(verticalFitHeight < originalHeight);
+
+ // Elide won't affect the height or width of a wrapped text with VerticalFit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ myText->setFontSizeMode(QQuickText::Fit);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ // Should be the same as VerticalFit with wrapping.
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ // Elide won't affect the size with Fit.
+ myText->setElideMode(QQuickText::ElideRight);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ QVERIFY(!myText->truncated());
+ QCOMPARE(myText->contentWidth(), verticalFitWidth);
+ QCOMPARE(myText->contentHeight(), verticalFitHeight);
+
+ myText->setElideMode(QQuickText::ElideNone);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+}
+
+void tst_qquicktext::multilengthStrings_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::newRow("No Wrap") << testFile("multilengthStrings.qml");
+ QTest::newRow("Wrap") << testFile("multilengthStringsWrapped.qml");
+}
+
+void tst_qquicktext::multilengthStrings()
+{
+ QFETCH(QString, source);
+
+ QScopedPointer<QQuickView> window(createView(source));
+ window->show();
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ const QString longText = "the quick brown fox jumped over the lazy dog";
+ const QString mediumText = "the brown fox jumped over the dog";
+ const QString shortText = "fox jumped dog";
+
+ myText->setText(longText);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ const qreal longWidth = myText->contentWidth();
+ const qreal longHeight = myText->contentHeight();
+
+ myText->setText(mediumText);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ const qreal mediumWidth = myText->contentWidth();
+ const qreal mediumHeight = myText->contentHeight();
+
+ myText->setText(shortText);
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+ const qreal shortWidth = myText->contentWidth();
+ const qreal shortHeight = myText->contentHeight();
+
+ myText->setElideMode(QQuickText::ElideRight);
+ myText->setText(longText + QLatin1Char('\x9c') + mediumText + QLatin1Char('\x9c') + shortText);
+
+ myText->setSize(QSizeF(longWidth, longHeight));
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ QCOMPARE(myText->contentWidth(), longWidth);
+ QCOMPARE(myText->contentHeight(), longHeight);
+ QCOMPARE(myText->truncated(), false);
+
+ myText->setSize(QSizeF(mediumWidth, mediumHeight));
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ QCOMPARE(myText->contentWidth(), mediumWidth);
+ QCOMPARE(myText->contentHeight(), mediumHeight);
+ QCOMPARE(myText->truncated(), true);
+
+ myText->setSize(QSizeF(shortWidth, shortHeight));
+ QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false);
+
+ QCOMPARE(myText->contentWidth(), shortWidth);
+ QCOMPARE(myText->contentHeight(), shortHeight);
+ QCOMPARE(myText->truncated(), true);
+}
+
+void tst_qquicktext::fontFormatSizes_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("textWithTag");
+ QTest::addColumn<bool>("fontIsBigger");
+
+ QTest::newRow("fs1") << "Hello world!" << "Hello <font size=\"1\">world</font>!" << false;
+ QTest::newRow("fs2") << "Hello world!" << "Hello <font size=\"2\">world</font>!" << false;
+ QTest::newRow("fs3") << "Hello world!" << "Hello <font size=\"3\">world</font>!" << false;
+ QTest::newRow("fs4") << "Hello world!" << "Hello <font size=\"4\">world</font>!" << true;
+ QTest::newRow("fs5") << "Hello world!" << "Hello <font size=\"5\">world</font>!" << true;
+ QTest::newRow("fs6") << "Hello world!" << "Hello <font size=\"6\">world</font>!" << true;
+ QTest::newRow("fs7") << "Hello world!" << "Hello <font size=\"7\">world</font>!" << true;
+ QTest::newRow("h1") << "This is<br/>a font<br/> size test." << "This is <h1>a font</h1> size test." << true;
+ QTest::newRow("h2") << "This is<br/>a font<br/> size test." << "This is <h2>a font</h2> size test." << true;
+ QTest::newRow("h3") << "This is<br/>a font<br/> size test." << "This is <h3>a font</h3> size test." << true;
+ QTest::newRow("h4") << "This is<br/>a font<br/> size test." << "This is <h4>a font</h4> size test." << true;
+ QTest::newRow("h5") << "This is<br/>a font<br/> size test." << "This is <h5>a font</h5> size test." << false;
+ QTest::newRow("h6") << "This is<br/>a font<br/> size test." << "This is <h6>a font</h6> size test." << false;
+}
+
+void tst_qquicktext::fontFormatSizes()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, textWithTag);
+ QFETCH(bool, fontIsBigger);
+
+ QQuickView *view = new QQuickView;
+ {
+ view->setSource(testFileUrl("pointFontSizes.qml"));
+ view->show();
+
+ QQuickText *qtext = view->rootObject()->findChild<QQuickText*>("text");
+ QQuickText *qtextWithTag = view->rootObject()->findChild<QQuickText*>("textWithTag");
+ QVERIFY(qtext != 0);
+ QVERIFY(qtextWithTag != 0);
+
+ qtext->setText(text);
+ qtextWithTag->setText(textWithTag);
+
+ for (int size = 6; size < 100; size += 4) {
+ view->rootObject()->setProperty("pointSize", size);
+ if (fontIsBigger)
+ QVERIFY(qtext->height() <= qtextWithTag->height());
+ else
+ QVERIFY(qtext->height() >= qtextWithTag->height());
+ }
+ }
+
+ {
+ view->setSource(testFileUrl("pixelFontSizes.qml"));
+ QQuickText *qtext = view->rootObject()->findChild<QQuickText*>("text");
+ QQuickText *qtextWithTag = view->rootObject()->findChild<QQuickText*>("textWithTag");
+ QVERIFY(qtext != 0);
+ QVERIFY(qtextWithTag != 0);
+
+ qtext->setText(text);
+ qtextWithTag->setText(textWithTag);
+
+ for (int size = 6; size < 100; size += 4) {
+ view->rootObject()->setProperty("pixelSize", size);
+ if (fontIsBigger)
+ QVERIFY(qtext->height() <= qtextWithTag->height());
+ else
+ QVERIFY(qtext->height() >= qtextWithTag->height());
+ }
+ }
+ delete view;
+}
+
+typedef qreal (*ExpectedBaseline)(QQuickText *item);
+Q_DECLARE_METATYPE(ExpectedBaseline)
+
+static qreal expectedBaselineTop(QQuickText *item)
+{
+ QFontMetricsF fm(item->font());
+ return fm.ascent();
+}
+
+static qreal expectedBaselineBottom(QQuickText *item)
+{
+ QFontMetricsF fm(item->font());
+ return item->height() - item->contentHeight() + fm.ascent();
+}
+
+static qreal expectedBaselineCenter(QQuickText *item)
+{
+ QFontMetricsF fm(item->font());
+ return ((item->height() - item->contentHeight()) / 2) + fm.ascent();
+}
+
+static qreal expectedBaselineBold(QQuickText *item)
+{
+ QFont font = item->font();
+ font.setBold(true);
+ QFontMetricsF fm(font);
+ return fm.ascent();
+}
+
+static qreal expectedBaselineImage(QQuickText *item)
+{
+ QFontMetricsF fm(item->font());
+ // The line is positioned so the bottom of the line is aligned with the bottom of the image,
+ // or image height - line height and the baseline is line position + ascent. Because
+ // QTextLine's height is rounded up this can give slightly different results to image height
+ // - descent.
+ return 181 - qCeil(fm.height()) + fm.ascent();
+}
+
+static qreal expectedBaselineCustom(QQuickText *item)
+{
+ QFontMetricsF fm(item->font());
+ return 16 + fm.ascent();
+}
+
+static qreal expectedBaselineScaled(QQuickText *item)
+{
+ QFont font = item->font();
+ QTextLayout layout(item->text().replace(QLatin1Char('\n'), QChar::LineSeparator));
+ do {
+ layout.setFont(font);
+ qreal width = 0;
+ layout.beginLayout();
+ for (QTextLine line = layout.createLine(); line.isValid(); line = layout.createLine()) {
+ line.setLineWidth(FLT_MAX);
+ width = qMax(line.naturalTextWidth(), width);
+ }
+ layout.endLayout();
+
+ if (width < item->width()) {
+ QFontMetricsF fm(layout.font());
+ return fm.ascent();
+ }
+ font.setPointSize(font.pointSize() - 1);
+ } while (font.pointSize() > 0);
+ return 0;
+}
+
+static qreal expectedBaselineFixedBottom(QQuickText *item)
+{
+ QFontMetricsF fm(item->font());
+ qreal dy = item->text().contains(QLatin1Char('\n'))
+ ? 160
+ : 180;
+ return dy + fm.ascent();
+}
+
+static qreal expectedBaselineProportionalBottom(QQuickText *item)
+{
+ QFontMetricsF fm(item->font());
+ qreal dy = item->text().contains(QLatin1Char('\n'))
+ ? 200 - (qCeil(fm.height()) * 3)
+ : 200 - (qCeil(fm.height()) * 1.5);
+ return dy + fm.ascent();
+}
+
+void tst_qquicktext::baselineOffset_data()
+{
+ qRegisterMetaType<ExpectedBaseline>();
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("wrappedText");
+ QTest::addColumn<QByteArray>("bindings");
+ QTest::addColumn<ExpectedBaseline>("expectedBaseline");
+ QTest::addColumn<ExpectedBaseline>("expectedBaselineEmpty");
+
+ QTest::newRow("top align")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; verticalAlignment: Text.AlignTop")
+ << &expectedBaselineTop
+ << &expectedBaselineTop;
+ QTest::newRow("bottom align")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; verticalAlignment: Text.AlignBottom")
+ << &expectedBaselineBottom
+ << &expectedBaselineBottom;
+ QTest::newRow("center align")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; verticalAlignment: Text.AlignVCenter")
+ << &expectedBaselineCenter
+ << &expectedBaselineCenter;
+
+ QTest::newRow("bold")
+ << "<b>hello world</b>"
+ << "<b>hello<br/>world</b>"
+ << QByteArray("height: 200")
+ << &expectedBaselineTop
+ << &expectedBaselineBold;
+
+ QTest::newRow("richText")
+ << "<b>hello world</b>"
+ << "<b>hello<br/>world</b>"
+ << QByteArray("height: 200; textFormat: Text.RichText")
+ << &expectedBaselineTop
+ << &expectedBaselineTop;
+
+ QTest::newRow("elided")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("width: 20; height: 8; elide: Text.ElideRight")
+ << &expectedBaselineTop
+ << &expectedBaselineTop;
+
+ QTest::newRow("elided bottom align")
+ << "hello world"
+ << "hello\nworld!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
+ << QByteArray("width: 200; height: 200; elide: Text.ElideRight; verticalAlignment: Text.AlignBottom")
+ << &expectedBaselineBottom
+ << &expectedBaselineBottom;
+
+ QTest::newRow("image")
+ << "hello <img src=\"images/heart200.png\" /> world"
+ << "hello <img src=\"images/heart200.png\" /><br/>world"
+ << QByteArray("height: 200\n; baseUrl: \"") + testFileUrl("reference").toEncoded() + QByteArray("\"")
+ << &expectedBaselineImage
+ << &expectedBaselineTop;
+
+ QTest::newRow("customLine")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; onLineLaidOut: line.y += 16")
+ << &expectedBaselineCustom
+ << &expectedBaselineCustom;
+
+ QTest::newRow("scaled font")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("width: 200; minimumPointSize: 1; font.pointSize: 64; fontSizeMode: Text.HorizontalFit")
+ << &expectedBaselineScaled
+ << &expectedBaselineTop;
+
+ QTest::newRow("fixed line height top align")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; lineHeightMode: Text.FixedHeight; lineHeight: 20; verticalAlignment: Text.AlignTop")
+ << &expectedBaselineTop
+ << &expectedBaselineTop;
+
+ QTest::newRow("fixed line height bottom align")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; lineHeightMode: Text.FixedHeight; lineHeight: 20; verticalAlignment: Text.AlignBottom")
+ << &expectedBaselineFixedBottom
+ << &expectedBaselineFixedBottom;
+
+ QTest::newRow("proportional line height top align")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; lineHeightMode: Text.ProportionalHeight; lineHeight: 1.5; verticalAlignment: Text.AlignTop")
+ << &expectedBaselineTop
+ << &expectedBaselineTop;
+
+ QTest::newRow("proportional line height bottom align")
+ << "hello world"
+ << "hello\nworld"
+ << QByteArray("height: 200; lineHeightMode: Text.ProportionalHeight; lineHeight: 1.5; verticalAlignment: Text.AlignBottom")
+ << &expectedBaselineProportionalBottom
+ << &expectedBaselineProportionalBottom;
+}
+
+void tst_qquicktext::baselineOffset()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, wrappedText);
+ QFETCH(QByteArray, bindings);
+ QFETCH(ExpectedBaseline, expectedBaseline);
+ QFETCH(ExpectedBaseline, expectedBaselineEmpty);
+
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Text {\n"
+ + bindings + "\n"
+ "}", QUrl());
+
+ QScopedPointer<QObject> object(component.create());
+
+ QQuickText *item = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(item);
+
+ {
+ qreal baseline = expectedBaselineEmpty(item);
+
+ QCOMPARE(item->baselineOffset(), baseline);
+
+ item->setText(text);
+ if (expectedBaseline != expectedBaselineEmpty)
+ baseline = expectedBaseline(item);
+
+ QCOMPARE(item->baselineOffset(), baseline);
+
+ item->setText(wrappedText);
+ QCOMPARE(item->baselineOffset(), expectedBaseline(item));
+ }
+
+ QFont font = item->font();
+ font.setPointSize(font.pointSize() + 8);
+
+ {
+ QCOMPARE(item->baselineOffset(), expectedBaseline(item));
+
+ item->setText(text);
+ qreal baseline = expectedBaseline(item);
+ QCOMPARE(item->baselineOffset(), baseline);
+
+ item->setText(QString());
+ if (expectedBaselineEmpty != expectedBaseline)
+ baseline = expectedBaselineEmpty(item);
+
+ QCOMPARE(item->baselineOffset(), baseline);
+ }
+}
+
+void tst_qquicktext::htmlLists()
+{
+ QFETCH(QString, text);
+ QFETCH(int, nbLines);
+
+ QQuickView *view = createView(testFile("htmlLists.qml"));
+ QQuickText *textObject = view->rootObject()->findChild<QQuickText*>("myText");
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject);
+ QVERIFY(textPrivate != 0);
+ QVERIFY(textPrivate->extra.isAllocated());
+
+ QVERIFY(textObject != 0);
+ textObject->setText(text);
+
+ view->show();
+ view->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(view));
+
+ QCOMPARE(textPrivate->extra->doc->lineCount(), nbLines);
+
+ delete view;
+}
+
+void tst_qquicktext::htmlLists_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<int>("nbLines");
+
+ QTest::newRow("ordered list") << "<ol><li>one<li>two<li>three" << 3;
+ QTest::newRow("ordered list closed") << "<ol><li>one</li></ol>" << 1;
+ QTest::newRow("ordered list alpha") << "<ol type=\"a\"><li>one</li><li>two</li></ol>" << 2;
+ QTest::newRow("ordered list upper alpha") << "<ol type=\"A\"><li>one</li><li>two</li></ol>" << 2;
+ QTest::newRow("ordered list roman") << "<ol type=\"i\"><li>one</li><li>two</li></ol>" << 2;
+ QTest::newRow("ordered list upper roman") << "<ol type=\"I\"><li>one</li><li>two</li></ol>" << 2;
+ QTest::newRow("ordered list bad") << "<ol type=\"z\"><li>one</li><li>two</li></ol>" << 2;
+ QTest::newRow("unordered list") << "<ul><li>one<li>two" << 2;
+ QTest::newRow("unordered list closed") << "<ul><li>one</li><li>two</li></ul>" << 2;
+ QTest::newRow("unordered list disc") << "<ul type=\"disc\"><li>one</li><li>two</li></ul>" << 2;
+ QTest::newRow("unordered list square") << "<ul type=\"square\"><li>one</li><li>two</li></ul>" << 2;
+ QTest::newRow("unordered list bad") << "<ul type=\"bad\"><li>one</li><li>two</li></ul>" << 2;
+}
+
+QTEST_MAIN(tst_qquicktext)
+
+#include "tst_qquicktext.moc"
diff --git a/tests/auto/quick/qquicktextdocument/data/text.qml b/tests/auto/quick/qquicktextdocument/data/text.qml
new file mode 100644
index 0000000000..43a8c6bb82
--- /dev/null
+++ b/tests/auto/quick/qquicktextdocument/data/text.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.1
+
+TextEdit {
+ text: ""
+}
+
diff --git a/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro b/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro
new file mode 100644
index 0000000000..e6bfdbd099
--- /dev/null
+++ b/tests/auto/quick/qquicktextdocument/qquicktextdocument.pro
@@ -0,0 +1,15 @@
+CONFIG += testcase
+TARGET = tst_qquicktextdocument
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquicktextdocument.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
diff --git a/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp
new file mode 100644
index 0000000000..717496cf0e
--- /dev/null
+++ b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtQuick/QQuickTextDocument>
+#include <QtQuick/QQuickItem>
+#include <QtQuick/private/qquicktextedit_p.h>
+#include <QtGui/QTextDocument>
+#include <QtGui/QTextDocumentWriter>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlComponent>
+#include "../../shared/util.h"
+
+class tst_qquicktextdocument : public QQmlDataTest
+{
+ Q_OBJECT
+private slots:
+ void textDocumentWriter();
+};
+
+QString text = QStringLiteral("foo bar");
+
+void tst_qquicktextdocument::textDocumentWriter()
+{
+ QQmlEngine e;
+ QQmlComponent c(&e, testFileUrl("text.qml"));
+ QObject* o = c.create();
+ QVERIFY(o);
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit*>(o);
+ QVERIFY(edit);
+
+ QQuickTextDocument* quickDocument = qobject_cast<QQuickTextDocument*>(edit->property("textDocument").value<QObject*>());
+ QVERIFY(quickDocument->textDocument() != 0);
+
+ QBuffer output;
+ output.open(QBuffer::ReadWrite);
+ QVERIFY(output.buffer().isEmpty());
+
+ edit->setProperty("text", QVariant(text));
+ QTextDocumentWriter writer(&output, "plaintext");
+ QVERIFY(writer.write(quickDocument->textDocument()));
+ QCOMPARE(output.buffer(), text.toLatin1());
+ delete o;
+}
+
+QTEST_MAIN(tst_qquicktextdocument)
+
+#include "tst_qquicktextdocument.moc"
diff --git a/tests/auto/quick/qquicktextedit/data/Cursor.qml b/tests/auto/quick/qquicktextedit/data/Cursor.qml
new file mode 100644
index 0000000000..e5c1853fc5
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/Cursor.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Rectangle {
+ property string localProperty
+}
diff --git a/tests/auto/quick/qquicktextedit/data/CursorRect.qml b/tests/auto/quick/qquicktextedit/data/CursorRect.qml
new file mode 100644
index 0000000000..cae3e63b72
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/CursorRect.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ objectName: "myEdit"
+ width: 50
+ text: "This is a long piece of text"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/RemoteCursor.qml b/tests/auto/quick/qquicktextedit/data/RemoteCursor.qml
new file mode 100644
index 0000000000..7f459f5cc4
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/RemoteCursor.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "cursorInstance"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/cursorTest.qml b/tests/auto/quick/qquicktextedit/data/cursorTest.qml
new file mode 100644
index 0000000000..afccc68aed
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/cursorTest.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextEdit { text: "Hello world!"; id: textEditObject; objectName: "textEditObject"
+ width: 300; height: 300;
+ resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance"; property string localProperty: contextualProperty } } ]
+ cursorDelegate: cursor
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/cursorTestExternal.qml b/tests/auto/quick/qquicktextedit/data/cursorTestExternal.qml
new file mode 100644
index 0000000000..0c9679bade
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/cursorTestExternal.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextEdit {
+ text: "Hello world!"
+ id: textEditObject;
+ objectName: "textEditObject"
+ width: 300; height: 300
+ wrapMode: TextEdit.WordWrap
+ cursorDelegate: Cursor {
+ id:cursorInstance;
+ objectName: "cursorInstance";
+ localProperty: contextualProperty;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/cursorTestInline.qml b/tests/auto/quick/qquicktextedit/data/cursorTestInline.qml
new file mode 100644
index 0000000000..6e2ed8c7a8
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/cursorTestInline.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextEdit {
+ text: "Hello world!"
+ id: textEditObject
+ wrapMode: TextEdit.Wrap
+ objectName: "textEditObject"
+ width: 300; height: 300
+ cursorDelegate: Item {
+ id:cursorInstance
+ objectName: "cursorInstance"
+ property string localProperty: contextualProperty
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/cursorTestRemote.qml b/tests/auto/quick/qquicktextedit/data/cursorTestRemote.qml
new file mode 100644
index 0000000000..77e070d151
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/cursorTestRemote.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextEdit {
+ text: "Hello world!"
+ id: textEditObject;
+ objectName: "textEditObject"
+ width: 300; height: 300
+ wrapMode: TextEdit.WordWrap
+ cursorDelegate: contextDelegate
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/cursorVisible.qml b/tests/auto/quick/qquicktextedit/data/cursorVisible.qml
new file mode 100644
index 0000000000..49e9386947
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/cursorVisible.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ width: 100
+ height: 20
+}
diff --git a/tests/auto/quick/qquicktextedit/data/embeddedImagesLocal.qml b/tests/auto/quick/qquicktextedit/data/embeddedImagesLocal.qml
new file mode 100644
index 0000000000..150f7bd898
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/embeddedImagesLocal.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http/exists.png'>"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/embeddedImagesLocalError.qml b/tests/auto/quick/qquicktextedit/data/embeddedImagesLocalError.qml
new file mode 100644
index 0000000000..067b6d72da
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/embeddedImagesLocalError.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http/notexists.png'>"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/embeddedImagesLocalRelative.qml b/tests/auto/quick/qquicktextedit/data/embeddedImagesLocalRelative.qml
new file mode 100644
index 0000000000..200ded196d
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/embeddedImagesLocalRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http/"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/embeddedImagesRemote.qml b/tests/auto/quick/qquicktextedit/data/embeddedImagesRemote.qml
new file mode 100644
index 0000000000..a823882692
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/embeddedImagesRemote.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http://127.0.0.1:42332/exists.png'>"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteError.qml b/tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteError.qml
new file mode 100644
index 0000000000..c6172b68dc
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteError.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='http://127.0.0.1:42332/notexists.png'>"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteRelative.qml b/tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteRelative.qml
new file mode 100644
index 0000000000..ee39e089ea
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/embeddedImagesRemoteRelative.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "<img src='exists.png'>"
+ baseUrl: "http://127.0.0.1:42332/text.html"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/focusOutSelection.qml b/tests/auto/quick/qquicktextedit/data/focusOutSelection.qml
new file mode 100644
index 0000000000..91a6ac900d
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/focusOutSelection.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: focusoutwindow
+
+ width: 100
+ height: 150
+
+ property alias text1: text1
+ property alias text2: text2
+
+ TextEdit {
+ x: 20
+ y: 30
+ id: text1
+ text: "text 1"
+ height: 20
+ width: 50
+ selectByMouse: true
+ activeFocusOnPress: true
+ objectName: "text1"
+ }
+
+ TextEdit {
+ x: 20
+ y: 80
+ id: text2
+ text: "text 2"
+ height: 20
+ width: 50
+ selectByMouse: true
+ activeFocusOnPress: true
+ objectName: "text2"
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/geometrySignals.qml b/tests/auto/quick/qquicktextedit/data/geometrySignals.qml
new file mode 100644
index 0000000000..3dbe61c74b
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/geometrySignals.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ width: 400; height: 500;
+ property int bindingWidth: text.width
+ property int bindingHeight: text.height
+
+ TextInput {
+ id: text
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/hAlignVisual.qml b/tests/auto/quick/qquicktextedit/data/hAlignVisual.qml
new file mode 100644
index 0000000000..136e5d21a2
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/hAlignVisual.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 200
+ height: 100
+
+ Text {
+ objectName: "textItem"
+ text: "AA\nBBBBB\nCCCCCCCCCCCCCCCC"
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignLeft
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/horizontalAlignment_RightToLeft.qml b/tests/auto/quick/qquicktextedit/data/horizontalAlignment_RightToLeft.qml
new file mode 100644
index 0000000000..8231e3f42b
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/horizontalAlignment_RightToLeft.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: top
+ width: 200; height: 70;
+
+ property alias horizontalAlignment: text.horizontalAlignment
+ property string text: "اختبا"
+
+ Rectangle {
+ id: arabicContainer
+ anchors.centerIn: parent
+ width: 200
+ height: 20
+ color: "green"
+
+ TextEdit {
+ id: text
+ objectName: "text"
+ anchors.fill: parent
+ text: top.text
+ focus: true
+ textFormat: TextEdit.AutoText
+ }
+ }
+
+ Rectangle {
+ anchors.top: arabicContainer.bottom
+ anchors.left: arabicContainer.left
+ width: 200
+ height: 20
+ color: "green"
+
+ TextEdit {
+ id: emptyTextEdit
+ objectName: "emptyTextEdit"
+ anchors.fill: parent
+ textFormat: TextEdit.AutoText
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/http/ErrItem.qml b/tests/auto/quick/qquicktextedit/data/http/ErrItem.qml
new file mode 100644
index 0000000000..68c0e0c093
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/ErrItem.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+Item{
+ Fungus{
+ palatable: false;
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/http/NormItem.qml b/tests/auto/quick/qquicktextedit/data/http/NormItem.qml
new file mode 100644
index 0000000000..2e4c1ed440
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/NormItem.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ objectName: "delegateOkay"
+ Rectangle { }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml
new file mode 100644
index 0000000000..043304d027
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTest.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ resources: [
+ Component { id:cursorFail; FailItem { objectName: "delegateFail" } },
+ Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } },
+ Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } },
+ Component { id:cursorErr; ErrItem { objectName: "delegateErrorA" } }
+ ]
+ TextEdit {
+ cursorDelegate: cursorFail
+ cursorVisible: true
+ }
+ TextEdit {
+ cursorDelegate: cursorWait
+ cursorVisible: true
+ }
+ TextEdit {
+ cursorDelegate: cursorNorm
+ cursorVisible: true
+ }
+ TextEdit {
+ cursorDelegate: cursorErr
+ cursorVisible: true
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml
new file mode 100644
index 0000000000..a6556454fe
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail1.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ resources: [
+ Component { id:cursorFail; FailItem { objectName: "delegateFail" } },
+ Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } },
+ Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } }
+ ]
+ TextEdit {
+ cursorDelegate: cursorFail
+ cursorVisible: true
+ }
+ TextEdit {
+ cursorDelegate: cursorWait
+ cursorVisible: true
+ }
+ TextEdit {
+ cursorDelegate: cursorNorm
+ cursorVisible: true
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml
new file mode 100644
index 0000000000..9429779a87
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestFail2.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ resources: [
+ Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } },
+ Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } },
+ Component { id:cursorErr; ErrItem { objectName: "delegateErrorA" } }
+ ]
+ TextEdit {
+ cursorDelegate: cursorWait
+ cursorVisible: true
+ }
+ TextEdit {
+ cursorDelegate: cursorNorm
+ cursorVisible: true
+ }
+ TextEdit {
+ cursorDelegate: cursorErr
+ cursorVisible: true
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml
new file mode 100644
index 0000000000..69e498ef8d
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/cursorHttpTestPass.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ resources: [
+ Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } },
+ Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } }
+ ]
+ TextEdit {
+ cursorDelegate: cursorWait
+ text: "Hello"
+ cursorVisible: true
+ }
+ TextEdit {
+ objectName: "textEditObject"
+ cursorDelegate: cursorNorm
+ cursorVisible: true
+ focus: true;
+ text: "Hello"
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/http/exists.png b/tests/auto/quick/qquicktextedit/data/http/exists.png
new file mode 100644
index 0000000000..399bd0b1d9
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/exists.png
Binary files differ
diff --git a/tests/auto/quick/qquicktextedit/data/http/qmldir b/tests/auto/quick/qquicktextedit/data/http/qmldir
new file mode 100644
index 0000000000..886e6ffec0
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/http/qmldir
@@ -0,0 +1,4 @@
+ErrItem ErrItem.qml
+NormItem NormItem.qml
+FailItem FailItem.qml
+WaitItem WaitItem.qml
diff --git a/tests/auto/quick/qquicktextedit/data/httpfail/FailItem.qml b/tests/auto/quick/qquicktextedit/data/httpfail/FailItem.qml
new file mode 100644
index 0000000000..8161843479
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/httpfail/FailItem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ Rectangle { }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/httpslow/WaitItem.qml b/tests/auto/quick/qquicktextedit/data/httpslow/WaitItem.qml
new file mode 100644
index 0000000000..8161843479
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/httpslow/WaitItem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ Rectangle { }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/inputContext.qml b/tests/auto/quick/qquicktextedit/data/inputContext.qml
new file mode 100644
index 0000000000..a37c77e3bf
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/inputContext.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ width: 200
+ text: "supercalifra"
+ focus: true
+}
diff --git a/tests/auto/quick/qquicktextedit/data/inputMethodEvent.qml b/tests/auto/quick/qquicktextedit/data/inputMethodEvent.qml
new file mode 100644
index 0000000000..7df7a558f9
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/inputMethodEvent.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+TextEdit {
+ width: 300
+ focus: true
+
+ cursorDelegate: Item {
+ objectName: "cursor"
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/inputmethodhints.qml b/tests/auto/quick/qquicktextedit/data/inputmethodhints.qml
new file mode 100644
index 0000000000..dec3b978e7
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/inputmethodhints.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ text: "Hello world!"
+ inputMethodHints: Qt.ImhNoPredictiveText
+}
diff --git a/tests/auto/quick/qquicktextedit/data/linkActivated.qml b/tests/auto/quick/qquicktextedit/data/linkActivated.qml
new file mode 100644
index 0000000000..d3bba82b59
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/linkActivated.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+TextEdit {
+ textFormat: TextEdit.RichText
+ text: "Test <a href='http://example.com/'>link</a>"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_align_bl.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_align_bl.qml
new file mode 100644
index 0000000000..4387cbcfc6
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_align_bl.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text:
+"0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ
+9876543210
+
+ZXYWVUTSRQPON MLKJIHGFEDCBA"
+ width: implicitWidth - 10
+ selectByMouse: true
+ horizontalAlignment: TextEdit.AlignLeft
+ verticalAlignment: TextEdit.AlignBottom
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_align_center.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_align_center.qml
new file mode 100644
index 0000000000..e8ee14cdf0
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_align_center.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text:
+"0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ
+9876543210
+
+ZXYWVUTSRQPON MLKJIHGFEDCBA"
+ width: implicitWidth - 10
+ selectByMouse: true
+ horizontalAlignment: TextEdit.AlignHCenter
+ verticalAlignment: TextEdit.AlignVCenter
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_align_tr.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_align_tr.qml
new file mode 100644
index 0000000000..a69bd8d9b9
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_align_tr.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text:
+"0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ
+9876543210
+
+ZXYWVUTSRQPON MLKJIHGFEDCBA"
+ width: implicitWidth - 10
+ selectByMouse: true
+ horizontalAlignment: TextEdit.AlignRight
+ verticalAlignment: TextEdit.AlignTop
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_default.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_default.qml
new file mode 100644
index 0000000000..ac32f4ced7
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_default.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_false.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_false.qml
new file mode 100644
index 0000000000..ac32f4ced7
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_false.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_false_words.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_false_words.qml
new file mode 100644
index 0000000000..86aea46a85
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_false_words.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text: "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+ mouseSelectionMode: TextEdit.SelectWords
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_true.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_true.qml
new file mode 100644
index 0000000000..0aa6f07035
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_true.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text:
+"0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ
+9876543210
+
+ZXYWVUTSRQPON MLKJIHGFEDCBA"
+ selectByMouse: true
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselection_true_words.qml b/tests/auto/quick/qquicktextedit/data/mouseselection_true_words.qml
new file mode 100644
index 0000000000..c356999220
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselection_true_words.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text: "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+ mouseSelectionMode: TextEdit.SelectWords
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselectionmode_characters.qml b/tests/auto/quick/qquicktextedit/data/mouseselectionmode_characters.qml
new file mode 100644
index 0000000000..c1fe42fd57
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselectionmode_characters.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+ mouseSelectionMode: TextEdit.SelectCharacters
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselectionmode_default.qml b/tests/auto/quick/qquicktextedit/data/mouseselectionmode_default.qml
new file mode 100644
index 0000000000..7c7cb0b6fc
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselectionmode_default.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+}
diff --git a/tests/auto/quick/qquicktextedit/data/mouseselectionmode_words.qml b/tests/auto/quick/qquicktextedit/data/mouseselectionmode_words.qml
new file mode 100644
index 0000000000..0a372bbf83
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/mouseselectionmode_words.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+ mouseSelectionMode: TextEdit.SelectWords
+}
diff --git a/tests/auto/quick/qquicktextedit/data/navigation.qml b/tests/auto/quick/qquicktextedit/data/navigation.qml
new file mode 100644
index 0000000000..0201c62b3c
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/navigation.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ property variant myInput: input
+
+ width: 800; height: 600; color: "blue"
+
+ Item {
+ id: firstItem;
+ KeyNavigation.right: input
+ }
+
+ TextEdit { id: input; focus: true
+ KeyNavigation.left: firstItem
+ KeyNavigation.right: lastItem
+ KeyNavigation.up: firstItem
+ KeyNavigation.down: lastItem
+ text: "a"
+ }
+ Item {
+ id: lastItem
+ KeyNavigation.left: input
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/openInputPanel.qml b/tests/auto/quick/qquicktextedit/data/openInputPanel.qml
new file mode 100644
index 0000000000..d3aecf21be
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/openInputPanel.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextEdit {
+ width: 100; height: 100
+ text: "Hello world"
+ focus: false
+}
diff --git a/tests/auto/quick/qquicktextedit/data/persistentSelection.qml b/tests/auto/quick/qquicktextedit/data/persistentSelection.qml
new file mode 100644
index 0000000000..fb2fe0cd6c
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/persistentSelection.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextEdit {
+ property string selected: selectedText
+
+ text: "Hello World!"
+ focus: true
+}
diff --git a/tests/auto/quick/qquicktextedit/data/positionAt.qml b/tests/auto/quick/qquicktextedit/data/positionAt.qml
new file mode 100644
index 0000000000..af0950c9ba
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/positionAt.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+TextEdit {
+ focus: true
+ objectName: "myInput"
+ width: 50
+ height: 25
+ font.pixelSize: 12
+ text: "This is\n a long piece of text"
+}
diff --git a/tests/auto/quick/qquicktextedit/data/qtbug-22058.qml b/tests/auto/quick/qquicktextedit/data/qtbug-22058.qml
new file mode 100644
index 0000000000..8ad1514fbf
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/qtbug-22058.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+
+Rectangle {
+ property variant inputField: textedit
+ height: 200
+ width: 200
+
+ Rectangle {
+ height: parent.height /2
+ width: parent.width
+ color: "transparent"
+ border.color: "black"
+ border.width: 4
+ Text {
+ anchors.centerIn: parent
+ height: parent.height * .95
+ width: parent.width * .95
+ text: textedit.text
+ }
+ }
+
+ Rectangle {
+ height: parent.height /2
+ width: parent.width
+ color: "transparent"
+ border.color: "black"
+ border.width: 4
+ anchors.bottom: parent.bottom
+ TextEdit {
+ id: textedit
+ anchors.centerIn: parent
+ height: parent.height * .95
+ width: parent.width * .95
+ focus: true
+ wrapMode: TextEdit.WordWrap
+ text: ""
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/data/readOnly.qml b/tests/auto/quick/qquicktextedit/data/readOnly.qml
new file mode 100644
index 0000000000..085adba5fb
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/data/readOnly.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ property variant myInput: input
+
+ width: 800; height: 600; color: "blue"
+
+ TextEdit { id: input; focus: true
+ readOnly: true
+ text: "I am the very model of a modern major general.\n"
+ }
+}
diff --git a/tests/auto/quick/qquicktextedit/qquicktextedit.pro b/tests/auto/quick/qquicktextedit/qquicktextedit.pro
new file mode 100644
index 0000000000..44def7f0f9
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/qquicktextedit.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_qquicktextedit
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquicktextedit.cpp \
+ ../../shared/testhttpserver.cpp
+
+HEADERS += ../../shared/testhttpserver.h
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private network-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+mac:CONFIG += insignificant_test # QTBUG-27740
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
new file mode 100644
index 0000000000..bce1f9e4a2
--- /dev/null
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -0,0 +1,5010 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include "../../shared/testhttpserver.h"
+#include <math.h>
+#include <QFile>
+#include <QTextDocument>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtGui/qguiapplication.h>
+#include <private/qquicktextedit_p.h>
+#include <private/qquicktextedit_p_p.h>
+#include <private/qquicktext_p_p.h>
+#include <QFontMetrics>
+#include <QtQuick/QQuickView>
+#include <QDir>
+#include <QInputMethod>
+#include <QClipboard>
+#include <QMimeData>
+#include <private/qquicktextcontrol_p.h>
+#include "../../shared/util.h"
+#include "../../shared/platformquirks.h"
+#include "../../shared/platforminputcontext.h"
+#include <private/qinputmethod_p.h>
+#include <QtGui/qstylehints.h>
+
+#ifdef Q_OS_MAC
+#include <Carbon/Carbon.h>
+#endif
+
+#define SERVER_PORT 42332
+#define SERVER_ADDR "http://localhost:42332"
+
+Q_DECLARE_METATYPE(QQuickTextEdit::SelectionMode)
+Q_DECLARE_METATYPE(Qt::Key)
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+
+QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
+{
+ // XXX This will be replaced by some clever persistent platform image store.
+ QString persistent_dir = QQmlDataTest::instance()->dataDirectory();
+ QString arch = "unknown-architecture"; // QTest needs to help with this.
+
+ QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png";
+
+ if (!QFile::exists(expectfile)) {
+ actual.save(expectfile);
+ qWarning() << "created" << expectfile;
+ }
+
+ return expectfile;
+}
+
+typedef QPair<int, QChar> Key;
+
+class tst_qquicktextedit : public QQmlDataTest
+
+{
+ Q_OBJECT
+public:
+ tst_qquicktextedit();
+
+private slots:
+ void cleanup();
+ void text();
+ void width();
+ void wrap();
+ void textFormat();
+
+ // ### these tests may be trivial
+ void hAlign();
+ void hAlign_RightToLeft();
+ void hAlignVisual();
+ void vAlign();
+ void font();
+ void color();
+ void textMargin();
+ void persistentSelection();
+ void selectionOnFocusOut();
+ void focusOnPress();
+ void selection();
+ void isRightToLeft_data();
+ void isRightToLeft();
+ void keySelection();
+ void moveCursorSelection_data();
+ void moveCursorSelection();
+ void moveCursorSelectionSequence_data();
+ void moveCursorSelectionSequence();
+ void mouseSelection_data();
+ void mouseSelection();
+ void mouseSelectionMode_data();
+ void mouseSelectionMode();
+ void dragMouseSelection();
+ void mouseSelectionMode_accessors();
+ void selectByMouse();
+ void selectByKeyboard();
+ void keyboardSelection_data();
+ void keyboardSelection();
+ void renderType();
+ void inputMethodHints();
+
+ void positionAt_data();
+ void positionAt();
+
+ void linkActivated();
+
+ void cursorDelegate_data();
+ void cursorDelegate();
+ void remoteCursorDelegate();
+ void cursorVisible();
+ void delegateLoading_data();
+ void delegateLoading();
+ void navigation();
+ void readOnly();
+#ifndef QT_NO_CLIPBOARD
+ void copyAndPaste();
+ void canPaste();
+ void canPasteEmpty();
+ void middleClickPaste();
+#endif
+ void textInput();
+ void inputMethodUpdate();
+ void openInputPanel();
+ void geometrySignals();
+#ifndef QT_NO_CLIPBOARD
+ void pastingRichText_QTBUG_14003();
+#endif
+ void implicitSize_data();
+ void implicitSize();
+ void contentSize();
+ void boundingRect();
+ void clipRect();
+ void implicitSizeBinding_data();
+ void implicitSizeBinding();
+
+ void preeditCursorRectangle();
+ void inputMethodComposing();
+ void cursorRectangleSize();
+
+ void getText_data();
+ void getText();
+ void getFormattedText_data();
+ void getFormattedText();
+ void insert_data();
+ void insert();
+ void remove_data();
+ void remove();
+
+ void keySequence_data();
+ void keySequence();
+
+ void undo_data();
+ void undo();
+ void redo_data();
+ void redo();
+ void undo_keypressevents_data();
+ void undo_keypressevents();
+
+ void baseUrl();
+ void embeddedImages();
+ void embeddedImages_data();
+
+ void emptytags_QTBUG_22058();
+
+private:
+ void simulateKeys(QWindow *window, const QList<Key> &keys);
+ void simulateKeys(QWindow *window, const QKeySequence &sequence);
+
+ void simulateKey(QWindow *, int key, Qt::KeyboardModifiers modifiers = 0);
+
+ QStringList standard;
+ QStringList richText;
+
+ QStringList hAlignmentStrings;
+ QStringList vAlignmentStrings;
+
+ QList<Qt::Alignment> vAlignments;
+ QList<Qt::Alignment> hAlignments;
+
+ QStringList colorStrings;
+
+ QQmlEngine engine;
+};
+
+typedef QList<int> IntList;
+Q_DECLARE_METATYPE(IntList)
+
+typedef QList<Key> KeyList;
+Q_DECLARE_METATYPE(KeyList)
+
+Q_DECLARE_METATYPE(QQuickTextEdit::HAlignment)
+Q_DECLARE_METATYPE(QQuickTextEdit::VAlignment)
+Q_DECLARE_METATYPE(QQuickTextEdit::TextFormat)
+
+void tst_qquicktextedit::simulateKeys(QWindow *window, const QList<Key> &keys)
+{
+ for (int i = 0; i < keys.count(); ++i) {
+ const int key = keys.at(i).first;
+ const int modifiers = key & Qt::KeyboardModifierMask;
+ const QString text = !keys.at(i).second.isNull() ? QString(keys.at(i).second) : QString();
+
+ QKeyEvent press(QEvent::KeyPress, Qt::Key(key), Qt::KeyboardModifiers(modifiers), text);
+ QKeyEvent release(QEvent::KeyRelease, Qt::Key(key), Qt::KeyboardModifiers(modifiers), text);
+
+ QGuiApplication::sendEvent(window, &press);
+ QGuiApplication::sendEvent(window, &release);
+ }
+}
+
+void tst_qquicktextedit::simulateKeys(QWindow *window, const QKeySequence &sequence)
+{
+ for (int i = 0; i < sequence.count(); ++i) {
+ const int key = sequence[i];
+ const int modifiers = key & Qt::KeyboardModifierMask;
+
+ QTest::keyClick(window, Qt::Key(key & ~modifiers), Qt::KeyboardModifiers(modifiers));
+ }
+}
+
+QList<Key> &operator <<(QList<Key> &keys, const QKeySequence &sequence)
+{
+ for (int i = 0; i < sequence.count(); ++i)
+ keys << Key(sequence[i], QChar());
+ return keys;
+}
+
+template <int N> QList<Key> &operator <<(QList<Key> &keys, const char (&characters)[N])
+{
+ for (int i = 0; i < N - 1; ++i) {
+ int key = QTest::asciiToKey(characters[i]);
+ QChar character = QLatin1Char(characters[i]);
+ keys << Key(key, character);
+ }
+ return keys;
+}
+
+QList<Key> &operator <<(QList<Key> &keys, Qt::Key key)
+{
+ keys << Key(key, QChar());
+ return keys;
+}
+
+tst_qquicktextedit::tst_qquicktextedit()
+{
+ standard << "the quick brown fox jumped over the lazy dog"
+ << "the quick brown fox\n jumped over the lazy dog"
+ << "Hello, world!"
+ << "!dlrow ,olleH";
+
+ 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_qquicktextedit::cleanup()
+{
+ // ensure not even skipped tests with custom input context leave it dangling
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
+}
+
+void tst_qquicktextedit::text()
+{
+ {
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\" }", QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->text(), QString(""));
+ QCOMPARE(textEditObject->length(), 0);
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + standard.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->text(), standard.at(i));
+ QCOMPARE(textEditObject->length(), standard.at(i).length());
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + richText.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+
+ QString expected = richText.at(i);
+ expected.replace(QRegExp("\\\\(.)"),"\\1");
+ QCOMPARE(textEditObject->text(), expected);
+ QCOMPARE(textEditObject->length(), expected.length());
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.RichText; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+
+ QString actual = textEditObject->text();
+ QString expected = standard.at(i);
+ actual.remove(QRegExp(".*<body[^>]*>"));
+ actual.remove(QRegExp("(<[^>]*>)+"));
+ expected.remove("\n");
+ QCOMPARE(actual.simplified(), expected);
+ QCOMPARE(textEditObject->length(), expected.length());
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.RichText; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(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());
+
+ expected.replace("<>", " ");
+ QCOMPARE(textEditObject->length(), expected.simplified().length());
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.AutoText; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->text(), standard.at(i));
+ QCOMPARE(textEditObject->length(), standard.at(i).length());
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.AutoText; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(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());
+
+ expected.replace("<>", " ");
+ QCOMPARE(textEditObject->length(), expected.simplified().length());
+ }
+}
+
+void tst_qquicktextedit::width()
+{
+ // uses Font metrics to find the width for standard and document to find the width for rich
+ {
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\" }", QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), 0.0);
+ }
+
+ bool requiresUnhintedMetrics = !qmlDisableDistanceField();
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + standard.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QString s = standard.at(i);
+ s.replace(QLatin1Char('\n'), QChar::LineSeparator);
+
+ QTextLayout layout(s);
+ layout.setFont(textEditObject->font());
+ layout.setFlags(Qt::TextExpandTabs | Qt::TextShowMnemonic);
+ if (requiresUnhintedMetrics) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ forever {
+ QTextLine line = layout.createLine();
+ if (!line.isValid())
+ break;
+ }
+
+ layout.endLayout();
+
+ qreal metricWidth = layout.boundingRect().width();
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), metricWidth);
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QTextDocument document;
+ document.setHtml(richText.at(i));
+ document.setDocumentMargin(0);
+ if (requiresUnhintedMetrics)
+ document.setUseDesignMetrics(true);
+
+ qreal documentWidth = document.idealWidth();
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.RichText; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), documentWidth);
+ }
+}
+
+void tst_qquicktextedit::wrap()
+{
+ // for specified width and wrap set true
+ {
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), 300.);
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), 300.);
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), 300.);
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextEdit {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QSignalSpy spy(edit, SIGNAL(wrapModeChanged()));
+
+ QCOMPARE(edit->wrapMode(), QQuickTextEdit::NoWrap);
+
+ edit->setWrapMode(QQuickTextEdit::Wrap);
+ QCOMPARE(edit->wrapMode(), QQuickTextEdit::Wrap);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setWrapMode(QQuickTextEdit::Wrap);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setWrapMode(QQuickTextEdit::NoWrap);
+ QCOMPARE(edit->wrapMode(), QQuickTextEdit::NoWrap);
+ QCOMPARE(spy.count(), 2);
+ }
+
+}
+
+void tst_qquicktextedit::textFormat()
+{
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile(""));
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->textFormat() == QQuickTextEdit::RichText);
+ }
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile(""));
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->textFormat() == QQuickTextEdit::PlainText);
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextEdit {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QSignalSpy spy(edit, SIGNAL(textFormatChanged(TextFormat)));
+
+ QCOMPARE(edit->textFormat(), QQuickTextEdit::PlainText);
+
+ edit->setTextFormat(QQuickTextEdit::RichText);
+ QCOMPARE(edit->textFormat(), QQuickTextEdit::RichText);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setTextFormat(QQuickTextEdit::RichText);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setTextFormat(QQuickTextEdit::PlainText);
+ QCOMPARE(edit->textFormat(), QQuickTextEdit::PlainText);
+ QCOMPARE(spy.count(), 2);
+ }
+}
+
+//the alignment tests may be trivial o.oa
+void tst_qquicktextedit::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 QtQuick 2.0\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(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 QtQuick 2.0\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j));
+ }
+ }
+
+}
+
+void tst_qquicktextedit::hAlign_RightToLeft()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QQuickView window(testFileUrl("horizontalAlignment_RightToLeft.qml"));
+ QQuickTextEdit *textEdit = window.rootObject()->findChild<QQuickTextEdit*>("text");
+ QVERIFY(textEdit != 0);
+ window.show();
+
+ const QString rtlText = textEdit->text();
+
+ // implicit alignment should follow the reading direction of text
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // explicitly left aligned
+ textEdit->setHAlign(QQuickTextEdit::AlignLeft);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
+ QVERIFY(textEdit->positionToRectangle(0).x() < window.width()/2);
+
+ // explicitly right aligned
+ textEdit->setHAlign(QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ QString textString = textEdit->text();
+ textEdit->setText(QString("<i>") + textString + QString("</i>"));
+ textEdit->resetHAlign();
+
+ // implicitly aligned rich text should follow the reading direction of RTL text
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->effectiveHAlign(), textEdit->hAlign());
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // explicitly left aligned rich text
+ textEdit->setHAlign(QQuickTextEdit::AlignLeft);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
+ QCOMPARE(textEdit->effectiveHAlign(), textEdit->hAlign());
+ QVERIFY(textEdit->positionToRectangle(0).x() < window.width()/2);
+
+ // explicitly right aligned rich text
+ textEdit->setHAlign(QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->effectiveHAlign(), textEdit->hAlign());
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ textEdit->setText(textString);
+
+ // explicitly center aligned
+ textEdit->setHAlign(QQuickTextEdit::AlignHCenter);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignHCenter);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // reseted alignment should go back to following the text reading direction
+ textEdit->resetHAlign();
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // mirror the text item
+ QQuickItemPrivate::get(textEdit)->setLayoutMirror(true);
+
+ // mirrored implicit alignment should continue to follow the reading direction of the text
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->effectiveHAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // mirrored explicitly right aligned behaves as left aligned
+ textEdit->setHAlign(QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->effectiveHAlign(), QQuickTextEdit::AlignLeft);
+ QVERIFY(textEdit->positionToRectangle(0).x() < window.width()/2);
+
+ // mirrored explicitly left aligned behaves as right aligned
+ textEdit->setHAlign(QQuickTextEdit::AlignLeft);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
+ QCOMPARE(textEdit->effectiveHAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // disable mirroring
+ QQuickItemPrivate::get(textEdit)->setLayoutMirror(false);
+ textEdit->resetHAlign();
+
+ // English text should be implicitly left aligned
+ textEdit->setText("Hello world!");
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
+ QVERIFY(textEdit->positionToRectangle(0).x() < window.width()/2);
+
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textEdit->hasActiveFocus());
+
+ textEdit->setText(QString());
+ { QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(textEdit, &ev); }
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ { QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(textEdit, &ev); }
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
+
+ // Clear pre-edit text. TextEdit should maybe do this itself on setText, but that may be
+ // redundant as an actual input method may take care of it.
+ { QInputMethodEvent ev; QGuiApplication::sendEvent(textEdit, &ev); }
+
+ // empty text with implicit alignment follows the system locale-based
+ // keyboard input direction from qApp->inputMethod()->inputDirection
+ textEdit->setText("");
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::LeftToRight);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignLeft);
+ QVERIFY(textEdit->positionToRectangle(0).x() < window.width()/2);
+
+ QSignalSpy cursorRectangleSpy(textEdit, SIGNAL(cursorRectangleChanged()));
+
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QCOMPARE(cursorRectangleSpy.count(), 1);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::RightToLeft);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // neutral text follows also input method direction
+ textEdit->resetHAlign();
+ textEdit->setText(" ()((=<>");
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ QCOMPARE(textEdit->effectiveHAlign(), QQuickTextEdit::AlignLeft);
+ QVERIFY(textEdit->cursorRectangle().left() < window.width()/2);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QCOMPARE(textEdit->effectiveHAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->cursorRectangle().left() > window.width()/2);
+
+ // set input direction while having content
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textEdit->setText("a");
+ textEdit->setCursorPosition(1);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QTest::keyClick(&window, Qt::Key_Backspace);
+ QVERIFY(textEdit->text().isEmpty());
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->cursorRectangle().left() > window.width()/2);
+
+ // input direction changed while not having focus
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textEdit->setFocus(false);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ textEdit->setFocus(true);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->cursorRectangle().left() > window.width()/2);
+
+ textEdit->setHAlign(QQuickTextEdit::AlignRight);
+ QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2);
+
+ // make sure editor doesn't rely on input for updating size
+ QQuickTextEdit *emptyEdit = window.rootObject()->findChild<QQuickTextEdit*>("emptyTextEdit");
+ QVERIFY(emptyEdit != 0);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ emptyEdit->setFocus(true);
+ QCOMPARE(emptyEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(emptyEdit->cursorRectangle().left() > window.width()/2);
+}
+
+
+static int numberOfNonWhitePixels(int fromX, int toX, const QImage &image)
+{
+ int pixels = 0;
+ for (int x = fromX; x < toX; ++x) {
+ for (int y = 0; y < image.height(); ++y) {
+ if (image.pixel(x, y) != qRgb(255, 255, 255))
+ pixels++;
+ }
+ }
+ return pixels;
+}
+
+void tst_qquicktextedit::hAlignVisual()
+{
+ QQuickView view(testFileUrl("hAlignVisual.qml"));
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QQuickText *text = view.rootObject()->findChild<QQuickText*>("textItem");
+ QVERIFY(text != 0);
+ {
+ // Left Align
+ QImage image = view.grabWindow();
+ int left = numberOfNonWhitePixels(0, image.width() / 3, image);
+ int mid = numberOfNonWhitePixels(image.width() / 3, 2 * image.width() / 3, image);
+ int right = numberOfNonWhitePixels( 2 * image.width() / 3, image.width(), image);
+ QVERIFY(left > mid);
+ QVERIFY(mid > right);
+ }
+ {
+ // HCenter Align
+ text->setHAlign(QQuickText::AlignHCenter);
+ QImage image = view.grabWindow();
+ int left = numberOfNonWhitePixels(0, image.width() / 3, image);
+ int mid = numberOfNonWhitePixels(image.width() / 3, 2 * image.width() / 3, image);
+ int right = numberOfNonWhitePixels( 2 * image.width() / 3, image.width(), image);
+ QVERIFY(left < mid);
+ QVERIFY(mid > right);
+ }
+ {
+ // Right Align
+ text->setHAlign(QQuickText::AlignRight);
+ QImage image = view.grabWindow();
+ int left = numberOfNonWhitePixels(0, image.width() / 3, image);
+ int mid = numberOfNonWhitePixels(image.width() / 3, 2 * image.width() / 3, image);
+ int right = numberOfNonWhitePixels( 2 * image.width() / 3, image.width(), image);
+ QVERIFY(left < mid);
+ QVERIFY(mid < right);
+ }
+
+ text->setWidth(200);
+
+ {
+ // Left Align
+ QImage image = view.grabWindow();
+ int x = qCeil(text->implicitWidth());
+ int left = numberOfNonWhitePixels(0, x, image);
+ int right = numberOfNonWhitePixels(x, image.width() - x, image);
+ QVERIFY(left > 0);
+ QVERIFY(right == 0);
+ }
+ {
+ // HCenter Align
+ text->setHAlign(QQuickText::AlignHCenter);
+ QImage image = view.grabWindow();
+ int x1 = qFloor(image.width() - text->implicitWidth()) / 2;
+ int x2 = image.width() - x1;
+ int left = numberOfNonWhitePixels(0, x1, image);
+ int mid = numberOfNonWhitePixels(x1, x2 - x1, image);
+ int right = numberOfNonWhitePixels(x2, image.width() - x2, image);
+ QVERIFY(left == 0);
+ QVERIFY(mid > 0);
+ QVERIFY(right == 0);
+ }
+ {
+ // Right Align
+ text->setHAlign(QQuickText::AlignRight);
+ QImage image = view.grabWindow();
+ int x = image.width() - qCeil(text->implicitWidth());
+ int left = numberOfNonWhitePixels(0, x, image);
+ int right = numberOfNonWhitePixels(x, image.width() - x, image);
+ QVERIFY(left == 0);
+ QVERIFY(right > 0);
+ }
+}
+
+void tst_qquicktextedit::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 QtQuick 2.0\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(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 QtQuick 2.0\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j));
+ }
+ }
+
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(
+ "import QtQuick 2.0\n"
+ "TextEdit { width: 100; height: 100; text: \"Hello World\" }", QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+
+ QCOMPARE(textEditObject->vAlign(), QQuickTextEdit::AlignTop);
+ QVERIFY(textEditObject->cursorRectangle().bottom() < 50);
+ QVERIFY(textEditObject->positionToRectangle(0).bottom() < 50);
+
+ // bottom aligned
+ textEditObject->setVAlign(QQuickTextEdit::AlignBottom);
+ QCOMPARE(textEditObject->vAlign(), QQuickTextEdit::AlignBottom);
+ QVERIFY(textEditObject->cursorRectangle().top() > 50);
+ QVERIFY(textEditObject->positionToRectangle(0).top() > 50);
+
+ // explicitly center aligned
+ textEditObject->setVAlign(QQuickTextEdit::AlignVCenter);
+ QCOMPARE(textEditObject->vAlign(), QQuickTextEdit::AlignVCenter);
+ QVERIFY(textEditObject->cursorRectangle().top() < 50);
+ QVERIFY(textEditObject->cursorRectangle().bottom() > 50);
+ QVERIFY(textEditObject->positionToRectangle(0).top() < 50);
+ QVERIFY(textEditObject->positionToRectangle(0).bottom() > 50);
+}
+
+void tst_qquicktextedit::font()
+{
+ //test size, then bold, then italic, then family
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { font.pointSize: 40; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->font().pointSize(), 40);
+ QCOMPARE(textEditObject->font().bold(), false);
+ QCOMPARE(textEditObject->font().italic(), false);
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { font.bold: true; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->font().bold(), true);
+ QCOMPARE(textEditObject->font().italic(), false);
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { font.italic: true; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->font().italic(), true);
+ QCOMPARE(textEditObject->font().bold(), false);
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->font().family(), QString("Helvetica"));
+ QCOMPARE(textEditObject->font().bold(), false);
+ QCOMPARE(textEditObject->font().italic(), false);
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { font.family: \"\"; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->font().family(), QString(""));
+ }
+}
+
+void tst_qquicktextedit::color()
+{
+ //test initial color
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject);
+ QCOMPARE(textEditObject->color(), QColor("black"));
+ QCOMPARE(textEditObject->selectionColor(), QColor::fromRgba(0xFF000080));
+ QCOMPARE(textEditObject->selectedTextColor(), QColor("white"));
+
+ QSignalSpy colorSpy(textEditObject, SIGNAL(colorChanged(QColor)));
+ QSignalSpy selectionColorSpy(textEditObject, SIGNAL(selectionColorChanged(QColor)));
+ QSignalSpy selectedTextColorSpy(textEditObject, SIGNAL(selectedTextColorChanged(QColor)));
+
+ textEditObject->setColor(QColor("white"));
+ QCOMPARE(textEditObject->color(), QColor("white"));
+ QCOMPARE(colorSpy.count(), 1);
+
+ textEditObject->setSelectionColor(QColor("black"));
+ QCOMPARE(textEditObject->selectionColor(), QColor("black"));
+ QCOMPARE(selectionColorSpy.count(), 1);
+
+ textEditObject->setSelectedTextColor(QColor("blue"));
+ QCOMPARE(textEditObject->selectedTextColor(), QColor("blue"));
+ QCOMPARE(selectedTextColorSpy.count(), 1);
+
+ textEditObject->setColor(QColor("white"));
+ QCOMPARE(colorSpy.count(), 1);
+
+ textEditObject->setSelectionColor(QColor("black"));
+ QCOMPARE(selectionColorSpy.count(), 1);
+
+ textEditObject->setSelectedTextColor(QColor("blue"));
+ QCOMPARE(selectedTextColorSpy.count(), 1);
+
+ textEditObject->setColor(QColor("black"));
+ QCOMPARE(textEditObject->color(), QColor("black"));
+ QCOMPARE(colorSpy.count(), 2);
+
+ textEditObject->setSelectionColor(QColor("blue"));
+ QCOMPARE(textEditObject->selectionColor(), QColor("blue"));
+ QCOMPARE(selectionColorSpy.count(), 2);
+
+ textEditObject->setSelectedTextColor(QColor("white"));
+ QCOMPARE(textEditObject->selectedTextColor(), QColor("white"));
+ QCOMPARE(selectedTextColorSpy.count(), 2);
+ }
+
+ //test normal
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+ //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i));
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->color(), QColor(colorStrings.at(i)));
+ }
+
+ //test selection
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->selectionColor(), QColor(colorStrings.at(i)));
+ }
+
+ //test selected text
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->selectedTextColor(), QColor(colorStrings.at(i)));
+ }
+
+ {
+ QString colorStr = "#AA001234";
+ QColor testColor("#001234");
+ testColor.setAlpha(170);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->color(), testColor);
+ }
+}
+
+void tst_qquicktextedit::textMargin()
+{
+ for (qreal i=0; i<=10; i+=0.3) {
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->textMargin(), i);
+ }
+}
+
+void tst_qquicktextedit::persistentSelection()
+{
+ QQuickView window(testFileUrl("persistentSelection.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(edit);
+ QVERIFY(edit->hasActiveFocus());
+
+ QSignalSpy spy(edit, SIGNAL(persistentSelectionChanged(bool)));
+
+ QCOMPARE(edit->persistentSelection(), false);
+
+ edit->setPersistentSelection(false);
+ QCOMPARE(edit->persistentSelection(), false);
+ QCOMPARE(spy.count(), 0);
+
+ edit->select(1, 4);
+ QCOMPARE(edit->property("selected").toString(), QLatin1String("ell"));
+
+ edit->setFocus(false);
+ QCOMPARE(edit->property("selected").toString(), QString());
+
+ edit->setFocus(true);
+ QCOMPARE(edit->property("selected").toString(), QString());
+
+ edit->setPersistentSelection(true);
+ QCOMPARE(edit->persistentSelection(), true);
+ QCOMPARE(spy.count(), 1);
+
+ edit->select(1, 4);
+ QCOMPARE(edit->property("selected").toString(), QLatin1String("ell"));
+
+ edit->setFocus(false);
+ QCOMPARE(edit->property("selected").toString(), QLatin1String("ell"));
+
+ edit->setFocus(true);
+ QCOMPARE(edit->property("selected").toString(), QLatin1String("ell"));
+
+}
+
+void tst_qquicktextedit::selectionOnFocusOut()
+{
+ QQuickView window(testFileUrl("focusOutSelection.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QPoint p1(25, 35);
+ QPoint p2(25, 85);
+
+ QQuickTextEdit *edit1 = window.rootObject()->findChild<QQuickTextEdit*>("text1");
+ QQuickTextEdit *edit2 = window.rootObject()->findChild<QQuickTextEdit*>("text2");
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, p1);
+ QVERIFY(edit1->hasActiveFocus());
+ QVERIFY(!edit2->hasActiveFocus());
+
+ edit1->selectAll();
+ QCOMPARE(edit1->selectedText(), QLatin1String("text 1"));
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, p2);
+
+ QCOMPARE(edit1->selectedText(), QLatin1String(""));
+ QVERIFY(!edit1->hasActiveFocus());
+ QVERIFY(edit2->hasActiveFocus());
+
+ edit2->selectAll();
+ QCOMPARE(edit2->selectedText(), QLatin1String("text 2"));
+
+
+ edit2->setFocus(false, Qt::ActiveWindowFocusReason);
+ QVERIFY(!edit2->hasActiveFocus());
+ QCOMPARE(edit2->selectedText(), QLatin1String("text 2"));
+
+ edit2->setFocus(true);
+ QVERIFY(edit2->hasActiveFocus());
+
+ edit2->setFocus(false, Qt::PopupFocusReason);
+ QVERIFY(!edit2->hasActiveFocus());
+ QCOMPARE(edit2->selectedText(), QLatin1String("text 2"));
+}
+
+void tst_qquicktextedit::focusOnPress()
+{
+ QString componentStr =
+ "import QtQuick 2.0\n"
+ "TextEdit {\n"
+ "property bool selectOnFocus: false\n"
+ "width: 100; height: 50\n"
+ "activeFocusOnPress: true\n"
+ "text: \"Hello World\"\n"
+ "onFocusChanged: { if (focus && selectOnFocus) selectAll() }"
+ " }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->focusOnPress(), true);
+ QCOMPARE(textEditObject->hasFocus(), false);
+
+ QSignalSpy focusSpy(textEditObject, SIGNAL(focusChanged(bool)));
+ QSignalSpy activeFocusSpy(textEditObject, SIGNAL(focusChanged(bool)));
+ QSignalSpy activeFocusOnPressSpy(textEditObject, SIGNAL(activeFocusOnPressChanged(bool)));
+
+ textEditObject->setFocusOnPress(true);
+ QCOMPARE(textEditObject->focusOnPress(), true);
+ QCOMPARE(activeFocusOnPressSpy.count(), 0);
+
+ QQuickWindow window;
+ window.resize(100, 50);
+ textEditObject->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QCOMPARE(textEditObject->hasFocus(), false);
+ QCOMPARE(textEditObject->hasActiveFocus(), false);
+
+ QPoint centerPoint(window.width()/2, window.height()/2);
+ Qt::KeyboardModifiers noModifiers = 0;
+ QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(textEditObject->hasFocus(), true);
+ QCOMPARE(textEditObject->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(textEditObject->selectedText(), QString());
+ QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint);
+
+ textEditObject->setFocusOnPress(false);
+ QCOMPARE(textEditObject->focusOnPress(), false);
+ QCOMPARE(activeFocusOnPressSpy.count(), 1);
+
+ textEditObject->setFocus(false);
+ QCOMPARE(textEditObject->hasFocus(), false);
+ QCOMPARE(textEditObject->hasActiveFocus(), false);
+ QCOMPARE(focusSpy.count(), 2);
+ QCOMPARE(activeFocusSpy.count(), 2);
+
+ // Wait for double click timeout to expire before clicking again.
+ QTest::qWait(400);
+ QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(textEditObject->hasFocus(), false);
+ QCOMPARE(textEditObject->hasActiveFocus(), false);
+ QCOMPARE(focusSpy.count(), 2);
+ QCOMPARE(activeFocusSpy.count(), 2);
+ QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint);
+
+ textEditObject->setFocusOnPress(true);
+ QCOMPARE(textEditObject->focusOnPress(), true);
+ QCOMPARE(activeFocusOnPressSpy.count(), 2);
+
+ // Test a selection made in the on(Active)FocusChanged handler isn't overwritten.
+ textEditObject->setProperty("selectOnFocus", true);
+
+ QTest::qWait(400);
+ QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(textEditObject->hasFocus(), true);
+ QCOMPARE(textEditObject->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(), 3);
+ QCOMPARE(activeFocusSpy.count(), 3);
+ QCOMPARE(textEditObject->selectedText(), textEditObject->text());
+ QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint);
+}
+
+void tst_qquicktextedit::selection()
+{
+ QString testStr = standard[0];//TODO: What should happen for multiline/rich text?
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \""+ testStr +"\"; }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(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());
+
+ // Verify invalid positions are ignored.
+ textEditObject->setCursorPosition(-1);
+ QVERIFY(textEditObject->cursorPosition() == 0);
+ QVERIFY(textEditObject->selectionStart() == 0);
+ QVERIFY(textEditObject->selectionEnd() == 0);
+ QVERIFY(textEditObject->selectedText().isNull());
+
+ textEditObject->setCursorPosition(textEditObject->text().count()+1);
+ 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->select(0,i);
+ QCOMPARE(testStr.mid(0,i), textEditObject->selectedText());
+ }
+ for (int i=0; i<= testStr.size(); i++) {
+ textEditObject->select(i,testStr.size());
+ 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());
+
+ //Test Error Ignoring behaviour
+ textEditObject->setCursorPosition(0);
+ QVERIFY(textEditObject->selectedText().isNull());
+ textEditObject->select(-10,0);
+ QVERIFY(textEditObject->selectedText().isNull());
+ textEditObject->select(100,101);
+ QVERIFY(textEditObject->selectedText().isNull());
+ textEditObject->select(0,-10);
+ QVERIFY(textEditObject->selectedText().isNull());
+ textEditObject->select(0,100);
+ QVERIFY(textEditObject->selectedText().isNull());
+ textEditObject->select(0,10);
+ QVERIFY(textEditObject->selectedText().size() == 10);
+ textEditObject->select(-10,0);
+ QVERIFY(textEditObject->selectedText().size() == 10);
+ textEditObject->select(100,101);
+ QVERIFY(textEditObject->selectedText().size() == 10);
+ textEditObject->select(0,-10);
+ QVERIFY(textEditObject->selectedText().size() == 10);
+ textEditObject->select(0,100);
+ QVERIFY(textEditObject->selectedText().size() == 10);
+
+ textEditObject->deselect();
+ QVERIFY(textEditObject->selectedText().isNull());
+ textEditObject->select(0,10);
+ QVERIFY(textEditObject->selectedText().size() == 10);
+ textEditObject->deselect();
+ QVERIFY(textEditObject->selectedText().isNull());
+}
+
+void tst_qquicktextedit::isRightToLeft_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<bool>("emptyString");
+ QTest::addColumn<bool>("firstCharacter");
+ QTest::addColumn<bool>("lastCharacter");
+ QTest::addColumn<bool>("middleCharacter");
+ QTest::addColumn<bool>("startString");
+ QTest::addColumn<bool>("midString");
+ QTest::addColumn<bool>("endString");
+
+ const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647};
+ QTest::newRow("Empty") << "" << false << false << false << false << false << false << false;
+ QTest::newRow("Neutral") << "23244242" << false << false << false << false << false << false << false;
+ QTest::newRow("LTR") << "Hello world" << false << false << false << false << false << false << false;
+ QTest::newRow("RTL") << QString::fromUtf16(arabic_str, 11) << false << true << true << true << true << true << true;
+ QTest::newRow("Bidi RTL + LTR + RTL") << QString::fromUtf16(arabic_str, 11) + QString("Hello world") + QString::fromUtf16(arabic_str, 11) << false << true << true << false << true << true << true;
+ QTest::newRow("Bidi LTR + RTL + LTR") << QString("Hello world") + QString::fromUtf16(arabic_str, 11) + QString("Hello world") << false << false << false << true << false << false << false;
+}
+
+void tst_qquicktextedit::isRightToLeft()
+{
+ QFETCH(QString, text);
+ QFETCH(bool, emptyString);
+ QFETCH(bool, firstCharacter);
+ QFETCH(bool, lastCharacter);
+ QFETCH(bool, middleCharacter);
+ QFETCH(bool, startString);
+ QFETCH(bool, midString);
+ QFETCH(bool, endString);
+
+ QQuickTextEdit textEdit;
+ textEdit.setText(text);
+
+ // first test that the right string is delivered to the QString::isRightToLeft()
+ QCOMPARE(textEdit.isRightToLeft(0,0), text.mid(0,0).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(0,1), text.mid(0,1).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(text.count()-2, text.count()-1), text.mid(text.count()-2, text.count()-1).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(text.count()/2, text.count()/2 + 1), text.mid(text.count()/2, text.count()/2 + 1).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(0,text.count()/4), text.mid(0,text.count()/4).isRightToLeft());
+ QCOMPARE(textEdit.isRightToLeft(text.count()/4,3*text.count()/4), text.mid(text.count()/4,3*text.count()/4).isRightToLeft());
+ if (text.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start.");
+ QCOMPARE(textEdit.isRightToLeft(3*text.count()/4,text.count()-1), text.mid(3*text.count()/4,text.count()-1).isRightToLeft());
+
+ // then test that the feature actually works
+ QCOMPARE(textEdit.isRightToLeft(0,0), emptyString);
+ QCOMPARE(textEdit.isRightToLeft(0,1), firstCharacter);
+ QCOMPARE(textEdit.isRightToLeft(text.count()-2, text.count()-1), lastCharacter);
+ QCOMPARE(textEdit.isRightToLeft(text.count()/2, text.count()/2 + 1), middleCharacter);
+ QCOMPARE(textEdit.isRightToLeft(0,text.count()/4), startString);
+ QCOMPARE(textEdit.isRightToLeft(text.count()/4,3*text.count()/4), midString);
+ if (text.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start.");
+ QCOMPARE(textEdit.isRightToLeft(3*text.count()/4,text.count()-1), endString);
+}
+
+void tst_qquicktextedit::keySelection()
+{
+ QQuickView window(testFileUrl("navigation.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+
+ QVERIFY(input != 0);
+ QVERIFY(input->hasActiveFocus());
+
+ QSignalSpy spy(input, SIGNAL(selectedTextChanged()));
+
+ simulateKey(&window, Qt::Key_Right, Qt::ShiftModifier);
+ QVERIFY(input->hasActiveFocus() == true);
+ QCOMPARE(input->selectedText(), QString("a"));
+ QCOMPARE(spy.count(), 1);
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == true);
+ QCOMPARE(input->selectedText(), QString());
+ QCOMPARE(spy.count(), 2);
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == false);
+ QCOMPARE(input->selectedText(), QString());
+ QCOMPARE(spy.count(), 2);
+
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == true);
+ QCOMPARE(spy.count(), 2);
+ simulateKey(&window, Qt::Key_Left, Qt::ShiftModifier);
+ QVERIFY(input->hasActiveFocus() == true);
+ QCOMPARE(input->selectedText(), QString("a"));
+ QCOMPARE(spy.count(), 3);
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == true);
+ QCOMPARE(input->selectedText(), QString());
+ QCOMPARE(spy.count(), 4);
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == false);
+ QCOMPARE(input->selectedText(), QString());
+ QCOMPARE(spy.count(), 4);
+}
+
+void tst_qquicktextedit::moveCursorSelection_data()
+{
+ QTest::addColumn<QString>("testStr");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<int>("movePosition");
+ QTest::addColumn<QQuickTextEdit::SelectionMode>("mode");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<bool>("reversible");
+
+ QTest::newRow("(t)he|characters")
+ << standard[0] << 0 << 1 << QQuickTextEdit::SelectCharacters << 0 << 1 << true;
+ QTest::newRow("do(g)|characters")
+ << standard[0] << 43 << 44 << QQuickTextEdit::SelectCharacters << 43 << 44 << true;
+ QTest::newRow("jum(p)ed|characters")
+ << standard[0] << 23 << 24 << QQuickTextEdit::SelectCharacters << 23 << 24 << true;
+ QTest::newRow("jumped( )over|characters")
+ << standard[0] << 26 << 27 << QQuickTextEdit::SelectCharacters << 26 << 27 << true;
+ QTest::newRow("(the )|characters")
+ << standard[0] << 0 << 4 << QQuickTextEdit::SelectCharacters << 0 << 4 << true;
+ QTest::newRow("( dog)|characters")
+ << standard[0] << 40 << 44 << QQuickTextEdit::SelectCharacters << 40 << 44 << true;
+ QTest::newRow("( jumped )|characters")
+ << standard[0] << 19 << 27 << QQuickTextEdit::SelectCharacters << 19 << 27 << true;
+ QTest::newRow("th(e qu)ick|characters")
+ << standard[0] << 2 << 6 << QQuickTextEdit::SelectCharacters << 2 << 6 << true;
+ QTest::newRow("la(zy d)og|characters")
+ << standard[0] << 38 << 42 << QQuickTextEdit::SelectCharacters << 38 << 42 << true;
+ QTest::newRow("jum(ped ov)er|characters")
+ << standard[0] << 23 << 29 << QQuickTextEdit::SelectCharacters << 23 << 29 << true;
+ QTest::newRow("()the|characters")
+ << standard[0] << 0 << 0 << QQuickTextEdit::SelectCharacters << 0 << 0 << true;
+ QTest::newRow("dog()|characters")
+ << standard[0] << 44 << 44 << QQuickTextEdit::SelectCharacters << 44 << 44 << true;
+ QTest::newRow("jum()ped|characters")
+ << standard[0] << 23 << 23 << QQuickTextEdit::SelectCharacters << 23 << 23 << true;
+
+ QTest::newRow("<(t)he>|words")
+ << standard[0] << 0 << 1 << QQuickTextEdit::SelectWords << 0 << 3 << true;
+ QTest::newRow("<do(g)>|words")
+ << standard[0] << 43 << 44 << QQuickTextEdit::SelectWords << 41 << 44 << true;
+ QTest::newRow("<jum(p)ed>|words")
+ << standard[0] << 23 << 24 << QQuickTextEdit::SelectWords << 20 << 26 << true;
+ QTest::newRow("<jumped( )>over|words")
+ << standard[0] << 26 << 27 << QQuickTextEdit::SelectWords << 20 << 27 << false;
+ QTest::newRow("jumped<( )over>|words,reversed")
+ << standard[0] << 27 << 26 << QQuickTextEdit::SelectWords << 26 << 31 << false;
+ QTest::newRow("<(the )>quick|words")
+ << standard[0] << 0 << 4 << QQuickTextEdit::SelectWords << 0 << 4 << false;
+ QTest::newRow("<(the )quick>|words,reversed")
+ << standard[0] << 4 << 0 << QQuickTextEdit::SelectWords << 0 << 9 << false;
+ QTest::newRow("<lazy( dog)>|words")
+ << standard[0] << 40 << 44 << QQuickTextEdit::SelectWords << 36 << 44 << false;
+ QTest::newRow("lazy<( dog)>|words,reversed")
+ << standard[0] << 44 << 40 << QQuickTextEdit::SelectWords << 40 << 44 << false;
+ QTest::newRow("<fox( jumped )>over|words")
+ << standard[0] << 19 << 27 << QQuickTextEdit::SelectWords << 16 << 27 << false;
+ QTest::newRow("fox<( jumped )over>|words,reversed")
+ << standard[0] << 27 << 19 << QQuickTextEdit::SelectWords << 19 << 31 << false;
+ QTest::newRow("<th(e qu)ick>|words")
+ << standard[0] << 2 << 6 << QQuickTextEdit::SelectWords << 0 << 9 << true;
+ QTest::newRow("<la(zy d)og|words>")
+ << standard[0] << 38 << 42 << QQuickTextEdit::SelectWords << 36 << 44 << true;
+ QTest::newRow("<jum(ped ov)er>|words")
+ << standard[0] << 23 << 29 << QQuickTextEdit::SelectWords << 20 << 31 << true;
+ QTest::newRow("<()>the|words")
+ << standard[0] << 0 << 0 << QQuickTextEdit::SelectWords << 0 << 0 << true;
+ QTest::newRow("dog<()>|words")
+ << standard[0] << 44 << 44 << QQuickTextEdit::SelectWords << 44 << 44 << true;
+ QTest::newRow("jum<()>ped|words")
+ << standard[0] << 23 << 23 << QQuickTextEdit::SelectWords << 23 << 23 << true;
+
+ QTest::newRow("Hello<(,)> |words")
+ << standard[2] << 5 << 6 << QQuickTextEdit::SelectWords << 5 << 6 << true;
+ QTest::newRow("Hello<(, )>world|words")
+ << standard[2] << 5 << 7 << QQuickTextEdit::SelectWords << 5 << 7 << false;
+ QTest::newRow("Hello<(, )world>|words,reversed")
+ << standard[2] << 7 << 5 << QQuickTextEdit::SelectWords << 5 << 12 << false;
+ QTest::newRow("<Hel(lo, )>world|words")
+ << standard[2] << 3 << 7 << QQuickTextEdit::SelectWords << 0 << 7 << false;
+ QTest::newRow("<Hel(lo, )world>|words,reversed")
+ << standard[2] << 7 << 3 << QQuickTextEdit::SelectWords << 0 << 12 << false;
+ QTest::newRow("<Hel(lo)>,|words")
+ << standard[2] << 3 << 5 << QQuickTextEdit::SelectWords << 0 << 5 << true;
+ QTest::newRow("Hello<()>,|words")
+ << standard[2] << 5 << 5 << QQuickTextEdit::SelectWords << 5 << 5 << true;
+ QTest::newRow("Hello,<()>|words")
+ << standard[2] << 6 << 6 << QQuickTextEdit::SelectWords << 6 << 6 << true;
+ QTest::newRow("Hello<,( )>world|words")
+ << standard[2] << 6 << 7 << QQuickTextEdit::SelectWords << 5 << 7 << false;
+ QTest::newRow("Hello,<( )world>|words,reversed")
+ << standard[2] << 7 << 6 << QQuickTextEdit::SelectWords << 6 << 12 << false;
+ QTest::newRow("Hello<,( world)>|words")
+ << standard[2] << 6 << 12 << QQuickTextEdit::SelectWords << 5 << 12 << false;
+ QTest::newRow("Hello,<( world)>|words,reversed")
+ << standard[2] << 12 << 6 << QQuickTextEdit::SelectWords << 6 << 12 << false;
+ QTest::newRow("Hello<,( world!)>|words")
+ << standard[2] << 6 << 13 << QQuickTextEdit::SelectWords << 5 << 13 << false;
+ QTest::newRow("Hello,<( world!)>|words,reversed")
+ << standard[2] << 13 << 6 << QQuickTextEdit::SelectWords << 6 << 13 << false;
+ QTest::newRow("Hello<(, world!)>|words")
+ << standard[2] << 5 << 13 << QQuickTextEdit::SelectWords << 5 << 13 << true;
+ QTest::newRow("world<(!)>|words")
+ << standard[2] << 12 << 13 << QQuickTextEdit::SelectWords << 12 << 13 << true;
+ QTest::newRow("world!<()>)|words")
+ << standard[2] << 13 << 13 << QQuickTextEdit::SelectWords << 13 << 13 << true;
+ QTest::newRow("world<()>!)|words")
+ << standard[2] << 12 << 12 << QQuickTextEdit::SelectWords << 12 << 12 << true;
+
+ QTest::newRow("<(,)>olleH |words")
+ << standard[3] << 7 << 8 << QQuickTextEdit::SelectWords << 7 << 8 << true;
+ QTest::newRow("<dlrow( ,)>olleH|words")
+ << standard[3] << 6 << 8 << QQuickTextEdit::SelectWords << 1 << 8 << false;
+ QTest::newRow("dlrow<( ,)>olleH|words,reversed")
+ << standard[3] << 8 << 6 << QQuickTextEdit::SelectWords << 6 << 8 << false;
+ QTest::newRow("<dlrow( ,ol)leH>|words")
+ << standard[3] << 6 << 10 << QQuickTextEdit::SelectWords << 1 << 13 << false;
+ QTest::newRow("dlrow<( ,ol)leH>|words,reversed")
+ << standard[3] << 10 << 6 << QQuickTextEdit::SelectWords << 6 << 13 << false;
+ QTest::newRow(",<(ol)leH>,|words")
+ << standard[3] << 8 << 10 << QQuickTextEdit::SelectWords << 8 << 13 << true;
+ QTest::newRow(",<()>olleH|words")
+ << standard[3] << 8 << 8 << QQuickTextEdit::SelectWords << 8 << 8 << true;
+ QTest::newRow("<()>,olleH|words")
+ << standard[3] << 7 << 7 << QQuickTextEdit::SelectWords << 7 << 7 << true;
+ QTest::newRow("<dlrow( )>,olleH|words")
+ << standard[3] << 6 << 7 << QQuickTextEdit::SelectWords << 1 << 7 << false;
+ QTest::newRow("dlrow<( ),>olleH|words,reversed")
+ << standard[3] << 7 << 6 << QQuickTextEdit::SelectWords << 6 << 8 << false;
+ QTest::newRow("<(dlrow )>,olleH|words")
+ << standard[3] << 1 << 7 << QQuickTextEdit::SelectWords << 1 << 7 << false;
+ QTest::newRow("<(dlrow ),>olleH|words,reversed")
+ << standard[3] << 7 << 1 << QQuickTextEdit::SelectWords << 1 << 8 << false;
+ QTest::newRow("<(!dlrow )>,olleH|words")
+ << standard[3] << 0 << 7 << QQuickTextEdit::SelectWords << 0 << 7 << false;
+ QTest::newRow("<(!dlrow ),>olleH|words,reversed")
+ << standard[3] << 7 << 0 << QQuickTextEdit::SelectWords << 0 << 8 << false;
+ QTest::newRow("(!dlrow ,)olleH|words")
+ << standard[3] << 0 << 8 << QQuickTextEdit::SelectWords << 0 << 8 << true;
+ QTest::newRow("<(!)>dlrow|words")
+ << standard[3] << 0 << 1 << QQuickTextEdit::SelectWords << 0 << 1 << true;
+ QTest::newRow("<()>!dlrow|words")
+ << standard[3] << 0 << 0 << QQuickTextEdit::SelectWords << 0 << 0 << true;
+ QTest::newRow("!<()>dlrow|words")
+ << standard[3] << 1 << 1 << QQuickTextEdit::SelectWords << 1 << 1 << true;
+}
+
+void tst_qquicktextedit::moveCursorSelection()
+{
+ QFETCH(QString, testStr);
+ QFETCH(int, cursorPosition);
+ QFETCH(int, movePosition);
+ QFETCH(QQuickTextEdit::SelectionMode, mode);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(bool, reversible);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \""+ testStr +"\"; }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit*>(textinputComponent.create());
+ QVERIFY(texteditObject != 0);
+
+ texteditObject->setCursorPosition(cursorPosition);
+ texteditObject->moveCursorSelection(movePosition, mode);
+
+ QCOMPARE(texteditObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
+ QCOMPARE(texteditObject->selectionStart(), selectionStart);
+ QCOMPARE(texteditObject->selectionEnd(), selectionEnd);
+
+ if (reversible) {
+ texteditObject->setCursorPosition(movePosition);
+ texteditObject->moveCursorSelection(cursorPosition, mode);
+
+ QCOMPARE(texteditObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
+ QCOMPARE(texteditObject->selectionStart(), selectionStart);
+ QCOMPARE(texteditObject->selectionEnd(), selectionEnd);
+ }
+}
+
+void tst_qquicktextedit::moveCursorSelectionSequence_data()
+{
+ QTest::addColumn<QString>("testStr");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<int>("movePosition1");
+ QTest::addColumn<int>("movePosition2");
+ QTest::addColumn<int>("selection1Start");
+ QTest::addColumn<int>("selection1End");
+ QTest::addColumn<int>("selection2Start");
+ QTest::addColumn<int>("selection2End");
+
+ QTest::newRow("the {<quick( bro)wn> f^ox} jumped|ltr")
+ << standard[0]
+ << 9 << 13 << 17
+ << 4 << 15
+ << 4 << 19;
+ QTest::newRow("the quick<( {bro)wn> f^ox} jumped|rtl")
+ << standard[0]
+ << 13 << 9 << 17
+ << 9 << 15
+ << 10 << 19;
+ QTest::newRow("the {<quick( bro)wn> ^}fox jumped|ltr")
+ << standard[0]
+ << 9 << 13 << 16
+ << 4 << 15
+ << 4 << 16;
+ QTest::newRow("the quick<( {bro)wn> ^}fox jumped|rtl")
+ << standard[0]
+ << 13 << 9 << 16
+ << 9 << 15
+ << 10 << 16;
+ QTest::newRow("the {<quick( bro)wn^>} fox jumped|ltr")
+ << standard[0]
+ << 9 << 13 << 15
+ << 4 << 15
+ << 4 << 15;
+ QTest::newRow("the quick<( {bro)wn^>} f^ox jumped|rtl")
+ << standard[0]
+ << 13 << 9 << 15
+ << 9 << 15
+ << 10 << 15;
+ QTest::newRow("the {<quick() ^}bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 10
+ << 4 << 15
+ << 4 << 10;
+ QTest::newRow("the quick<(^ {^bro)wn>} fox|rtl")
+ << standard[0]
+ << 13 << 9 << 10
+ << 9 << 15
+ << 10 << 15;
+ QTest::newRow("the {<quick^}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 9
+ << 4 << 15
+ << 4 << 9;
+ QTest::newRow("the quick{<(^ bro)wn>} fox|rtl")
+ << standard[0]
+ << 13 << 9 << 9
+ << 9 << 15
+ << 9 << 15;
+ QTest::newRow("the {<qui^ck}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 7
+ << 4 << 15
+ << 4 << 9;
+ QTest::newRow("the {<qui^ck}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 7
+ << 9 << 15
+ << 4 << 15;
+ QTest::newRow("the {<^quick}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 4
+ << 4 << 15
+ << 4 << 9;
+ QTest::newRow("the {<^quick}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 4
+ << 9 << 15
+ << 4 << 15;
+ QTest::newRow("the{^ <quick}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 3
+ << 4 << 15
+ << 3 << 9;
+ QTest::newRow("the{^ <quick}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 3
+ << 9 << 15
+ << 3 << 15;
+ QTest::newRow("{t^he <quick}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 1
+ << 4 << 15
+ << 0 << 9;
+ QTest::newRow("{t^he <quick}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 1
+ << 9 << 15
+ << 0 << 15;
+
+ QTest::newRow("{<He(ll)o>, w^orld}!|ltr")
+ << standard[2]
+ << 2 << 4 << 8
+ << 0 << 5
+ << 0 << 12;
+ QTest::newRow("{<He(ll)o>, w^orld}!|rtl")
+ << standard[2]
+ << 4 << 2 << 8
+ << 0 << 5
+ << 0 << 12;
+
+ QTest::newRow("!{dlro^w ,<o(ll)eH>}|ltr")
+ << standard[3]
+ << 9 << 11 << 5
+ << 8 << 13
+ << 1 << 13;
+ QTest::newRow("!{dlro^w ,<o(ll)eH>}|rtl")
+ << standard[3]
+ << 11 << 9 << 5
+ << 8 << 13
+ << 1 << 13;
+}
+
+void tst_qquicktextedit::moveCursorSelectionSequence()
+{
+ QFETCH(QString, testStr);
+ QFETCH(int, cursorPosition);
+ QFETCH(int, movePosition1);
+ QFETCH(int, movePosition2);
+ QFETCH(int, selection1Start);
+ QFETCH(int, selection1End);
+ QFETCH(int, selection2Start);
+ QFETCH(int, selection2End);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \""+ testStr +"\"; }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create());
+ QVERIFY(texteditObject != 0);
+
+ texteditObject->setCursorPosition(cursorPosition);
+
+ texteditObject->moveCursorSelection(movePosition1, QQuickTextEdit::SelectWords);
+ QCOMPARE(texteditObject->selectedText(), testStr.mid(selection1Start, selection1End - selection1Start));
+ QCOMPARE(texteditObject->selectionStart(), selection1Start);
+ QCOMPARE(texteditObject->selectionEnd(), selection1End);
+
+ texteditObject->moveCursorSelection(movePosition2, QQuickTextEdit::SelectWords);
+ QCOMPARE(texteditObject->selectedText(), testStr.mid(selection2Start, selection2End - selection2Start));
+ QCOMPARE(texteditObject->selectionStart(), selection2Start);
+ QCOMPARE(texteditObject->selectionEnd(), selection2End);
+}
+
+
+void tst_qquicktextedit::mouseSelection_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<int>("to");
+ QTest::addColumn<QString>("selectedText");
+ QTest::addColumn<bool>("focus");
+ QTest::addColumn<bool>("focusOnPress");
+ QTest::addColumn<int>("clicks");
+
+ // import installed
+ QTest::newRow("on") << testFile("mouseselection_true.qml") << 4 << 9 << "45678" << true << true << 1;
+ QTest::newRow("off") << testFile("mouseselection_false.qml") << 4 << 9 << QString() << true << true << 1;
+ QTest::newRow("default") << testFile("mouseselection_default.qml") << 4 << 9 << QString() << true << true << 1;
+ QTest::newRow("off word selection") << testFile("mouseselection_false_words.qml") << 4 << 9 << QString() << true << true << 1;
+ QTest::newRow("on word selection (4,9)") << testFile("mouseselection_true_words.qml") << 4 << 9 << "0123456789" << true << true << 1;
+
+ QTest::newRow("on unfocused") << testFile("mouseselection_true.qml") << 4 << 9 << "45678" << false << false << 1;
+ QTest::newRow("on word selection (4,9) unfocused") << testFile("mouseselection_true_words.qml") << 4 << 9 << "0123456789" << false << false << 1;
+
+ QTest::newRow("on focus on press") << testFile("mouseselection_true.qml") << 4 << 9 << "45678" << false << true << 1;
+ QTest::newRow("on word selection (4,9) focus on press") << testFile("mouseselection_true_words.qml") << 4 << 9 << "0123456789" << false << true << 1;
+
+ QTest::newRow("on word selection (2,13)") << testFile("mouseselection_true_words.qml") << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+ QTest::newRow("on word selection (2,30)") << testFile("mouseselection_true_words.qml") << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+ QTest::newRow("on word selection (9,13)") << testFile("mouseselection_true_words.qml") << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+ QTest::newRow("on word selection (9,30)") << testFile("mouseselection_true_words.qml") << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+ QTest::newRow("on word selection (13,2)") << testFile("mouseselection_true_words.qml") << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+ QTest::newRow("on word selection (20,2)") << testFile("mouseselection_true_words.qml") << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+ QTest::newRow("on word selection (12,9)") << testFile("mouseselection_true_words.qml") << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+ QTest::newRow("on word selection (30,9)") << testFile("mouseselection_true_words.qml") << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 1;
+
+ QTest::newRow("on double click (4,9)") << testFile("mouseselection_true.qml") << 4 << 9 << "0123456789" << true << true << 2;
+ QTest::newRow("on double click (2,13)") << testFile("mouseselection_true.qml") << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+ QTest::newRow("on double click (2,30)") << testFile("mouseselection_true.qml") << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+ QTest::newRow("on double click (9,13)") << testFile("mouseselection_true.qml") << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+ QTest::newRow("on double click (9,30)") << testFile("mouseselection_true.qml") << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+ QTest::newRow("on double click (13,2)") << testFile("mouseselection_true.qml") << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+ QTest::newRow("on double click (20,2)") << testFile("mouseselection_true.qml") << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+ QTest::newRow("on double click (12,9)") << testFile("mouseselection_true.qml") << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+ QTest::newRow("on double click (30,9)") << testFile("mouseselection_true.qml") << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ" << true << true << 2;
+
+ QTest::newRow("on triple click (4,9)") << testFile("mouseselection_true.qml") << 4 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (2,13)") << testFile("mouseselection_true.qml") << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (2,30)") << testFile("mouseselection_true.qml") << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (9,13)") << testFile("mouseselection_true.qml") << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (9,30)") << testFile("mouseselection_true.qml") << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (13,2)") << testFile("mouseselection_true.qml") << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (20,2)") << testFile("mouseselection_true.qml") << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (12,9)") << testFile("mouseselection_true.qml") << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+ QTest::newRow("on triple click (30,9)") << testFile("mouseselection_true.qml") << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" << true << true << 3;
+
+ QTest::newRow("on triple click (2,40)") << testFile("mouseselection_true.qml") << 2 << 40 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n9876543210\n" << true << true << 3;
+ QTest::newRow("on triple click (2,50)") << testFile("mouseselection_true.qml") << 2 << 50 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n9876543210\n\nZXYWVUTSRQPON MLKJIHGFEDCBA" << true << true << 3;
+ QTest::newRow("on triple click (25,40)") << testFile("mouseselection_true.qml") << 25 << 40 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n9876543210\n" << true << true << 3;
+ QTest::newRow("on triple click (25,50)") << testFile("mouseselection_true.qml") << 25 << 50 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n9876543210\n\nZXYWVUTSRQPON MLKJIHGFEDCBA" << true << true << 3;
+ QTest::newRow("on triple click (40,25)") << testFile("mouseselection_true.qml") << 40 << 25 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n9876543210\n" << true << true << 3;
+ QTest::newRow("on triple click (40,50)") << testFile("mouseselection_true.qml") << 40 << 50 << "9876543210\n\nZXYWVUTSRQPON MLKJIHGFEDCBA" << true << true << 3;
+ QTest::newRow("on triple click (50,25)") << testFile("mouseselection_true.qml") << 50 << 25 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ\n9876543210\n\nZXYWVUTSRQPON MLKJIHGFEDCBA" << true << true << 3;
+ QTest::newRow("on triple click (50,40)") << testFile("mouseselection_true.qml") << 50 << 40 << "9876543210\n\nZXYWVUTSRQPON MLKJIHGFEDCBA" << true << true << 3;
+
+ QTest::newRow("on tr align") << testFile("mouseselection_align_tr.qml") << 4 << 9 << "45678" << true << true << 1;
+ QTest::newRow("on center align") << testFile("mouseselection_align_center.qml") << 4 << 9 << "45678" << true << true << 1;
+ QTest::newRow("on bl align") << testFile("mouseselection_align_bl.qml") << 4 << 9 << "45678" << true << true << 1;
+}
+
+void tst_qquicktextedit::mouseSelection()
+{
+ QFETCH(QString, qmlfile);
+ QFETCH(int, from);
+ QFETCH(int, to);
+ QFETCH(QString, selectedText);
+ QFETCH(bool, focus);
+ QFETCH(bool, focusOnPress);
+ QFETCH(int, clicks);
+
+ QQuickView window(QUrl::fromLocalFile(qmlfile));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(textEditObject != 0);
+
+ textEditObject->setFocus(focus);
+ textEditObject->setFocusOnPress(focusOnPress);
+
+ // press-and-drag-and-release from x1 to x2
+ QPoint p1 = textEditObject->positionToRectangle(from).center().toPoint();
+ QPoint p2 = textEditObject->positionToRectangle(to).center().toPoint();
+ if (clicks == 2)
+ QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ else if (clicks == 3)
+ QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTest::mouseMove(&window, p2);
+ QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2);
+ QTRY_COMPARE(textEditObject->selectedText(), selectedText);
+
+ QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10);
+
+ // Clicking and shift to clicking between the same points should select the same text.
+ textEditObject->setCursorPosition(0);
+ if (clicks > 1)
+ QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ if (clicks != 2)
+ QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTest::mouseClick(&window, Qt::LeftButton, Qt::ShiftModifier, p2);
+ QTRY_COMPARE(textEditObject->selectedText(), selectedText);
+
+ // ### This is to prevent double click detection from carrying over to the next test.
+ QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10);
+}
+
+void tst_qquicktextedit::dragMouseSelection()
+{
+ QString qmlfile = testFile("mouseselection_true.qml");
+
+ QQuickView window(QUrl::fromLocalFile(qmlfile));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(textEditObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = QFontMetrics(textEditObject->font()).height() / 2;
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y));
+ QTest::mouseMove(&window, QPoint(x2, y));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y));
+ QTest::qWait(300);
+ QString str1;
+ QTRY_VERIFY((str1 = textEditObject->selectedText()).length() > 3);
+
+ // press and drag the current selection.
+ x1 = 40;
+ x2 = 100;
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y));
+ QTest::mouseMove(&window, QPoint(x2, y));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y));
+ QTest::qWait(300);
+ QString str2;
+ QTRY_VERIFY((str2 = textEditObject->selectedText()).length() > 3);
+
+ QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and not the first moved.
+
+}
+
+void tst_qquicktextedit::mouseSelectionMode_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<bool>("selectWords");
+
+ // import installed
+ QTest::newRow("SelectWords") << testFile("mouseselectionmode_words.qml") << true;
+ QTest::newRow("SelectCharacters") << testFile("mouseselectionmode_characters.qml") << false;
+ QTest::newRow("default") << testFile("mouseselectionmode_default.qml") << false;
+}
+
+void tst_qquicktextedit::mouseSelectionMode()
+{
+ QFETCH(QString, qmlfile);
+ QFETCH(bool, selectWords);
+
+ QString text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ QQuickView window(QUrl::fromLocalFile(qmlfile));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(textEditObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textEditObject->height()/2;
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y));
+ QTest::mouseMove(&window, QPoint(x2, y));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y));
+ QString str = textEditObject->selectedText();
+ if (selectWords) {
+ QTRY_COMPARE(textEditObject->selectedText(), text);
+ } else {
+ QTRY_VERIFY(textEditObject->selectedText().length() > 3);
+ QVERIFY(str != text);
+ }
+}
+
+void tst_qquicktextedit::mouseSelectionMode_accessors()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextEdit {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QSignalSpy spy(edit, SIGNAL(mouseSelectionModeChanged(SelectionMode)));
+
+ QCOMPARE(edit->mouseSelectionMode(), QQuickTextEdit::SelectCharacters);
+
+ edit->setMouseSelectionMode(QQuickTextEdit::SelectWords);
+ QCOMPARE(edit->mouseSelectionMode(), QQuickTextEdit::SelectWords);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setMouseSelectionMode(QQuickTextEdit::SelectWords);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setMouseSelectionMode(QQuickTextEdit::SelectCharacters);
+ QCOMPARE(edit->mouseSelectionMode(), QQuickTextEdit::SelectCharacters);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextedit::selectByMouse()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextEdit {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QSignalSpy spy(edit, SIGNAL(selectByMouseChanged(bool)));
+
+ QCOMPARE(edit->selectByMouse(), false);
+
+ edit->setSelectByMouse(true);
+ QCOMPARE(edit->selectByMouse(), true);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), true);
+
+ edit->setSelectByMouse(true);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setSelectByMouse(false);
+ QCOMPARE(edit->selectByMouse(), false);
+ QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.at(1).at(0).toBool(), false);
+}
+
+void tst_qquicktextedit::selectByKeyboard()
+{
+ QQmlComponent oldComponent(&engine);
+ oldComponent.setData("import QtQuick 2.0\n TextEdit { selectByKeyboard: true }", QUrl());
+ QVERIFY(!oldComponent.create());
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.1\n TextEdit { }", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QSignalSpy spy(edit, SIGNAL(selectByKeyboardChanged(bool)));
+
+ QCOMPARE(edit->isReadOnly(), false);
+ QCOMPARE(edit->selectByKeyboard(), true);
+
+ edit->setReadOnly(true);
+ QCOMPARE(edit->selectByKeyboard(), false);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), false);
+
+ edit->setSelectByKeyboard(true);
+ QCOMPARE(edit->selectByKeyboard(), true);
+ QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.at(1).at(0).toBool(), true);
+
+ edit->setReadOnly(false);
+ QCOMPARE(edit->selectByKeyboard(), true);
+ QCOMPARE(spy.count(), 2);
+
+ edit->setSelectByKeyboard(false);
+ QCOMPARE(edit->selectByKeyboard(), false);
+ QCOMPARE(spy.count(), 3);
+ QCOMPARE(spy.at(2).at(0).toBool(), false);
+}
+
+Q_DECLARE_METATYPE(QKeySequence::StandardKey)
+
+void tst_qquicktextedit::keyboardSelection_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<bool>("readOnly");
+ QTest::addColumn<bool>("selectByKeyboard");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<QKeySequence::StandardKey>("standardKey");
+ QTest::addColumn<QString>("selectedText");
+
+ QTest::newRow("editable - select first char")
+ << QStringLiteral("editable - select first char") << false << true << 0 << QKeySequence::SelectNextChar << QStringLiteral("e");
+ QTest::newRow("editable - select first word")
+ << QStringLiteral("editable - select first char") << false << true << 0 << QKeySequence::SelectNextWord << QStringLiteral("editable ");
+
+ QTest::newRow("editable - cannot select first char")
+ << QStringLiteral("editable - cannot select first char") << false << false << 0 << QKeySequence::SelectNextChar << QStringLiteral("");
+ QTest::newRow("editable - cannot select first word")
+ << QStringLiteral("editable - cannot select first word") << false << false << 0 << QKeySequence::SelectNextWord << QStringLiteral("");
+
+ QTest::newRow("editable - select last char")
+ << QStringLiteral("editable - select last char") << false << true << 27 << QKeySequence::SelectPreviousChar << QStringLiteral("r");
+ QTest::newRow("editable - select last word")
+ << QStringLiteral("editable - select last word") << false << true << 27 << QKeySequence::SelectPreviousWord << QStringLiteral("word");
+
+ QTest::newRow("editable - cannot select last char")
+ << QStringLiteral("editable - cannot select last char") << false << false << 35 << QKeySequence::SelectPreviousChar << QStringLiteral("");
+ QTest::newRow("editable - cannot select last word")
+ << QStringLiteral("editable - cannot select last word") << false << false << 35 << QKeySequence::SelectPreviousWord << QStringLiteral("");
+
+ QTest::newRow("read-only - cannot select first char")
+ << QStringLiteral("read-only - cannot select first char") << true << false << 0 << QKeySequence::SelectNextChar << QStringLiteral("");
+ QTest::newRow("read-only - cannot select first word")
+ << QStringLiteral("read-only - cannot select first word") << true << false << 0 << QKeySequence::SelectNextWord << QStringLiteral("");
+
+ QTest::newRow("read-only - cannot select last char")
+ << QStringLiteral("read-only - cannot select last char") << true << false << 35 << QKeySequence::SelectPreviousChar << QStringLiteral("");
+ QTest::newRow("read-only - cannot select last word")
+ << QStringLiteral("read-only - cannot select last word") << true << false << 35 << QKeySequence::SelectPreviousWord << QStringLiteral("");
+
+ QTest::newRow("read-only - select first char")
+ << QStringLiteral("read-only - select first char") << true << true << 0 << QKeySequence::SelectNextChar << QStringLiteral("r");
+ QTest::newRow("read-only - select first word")
+ << QStringLiteral("read-only - select first word") << true << true << 0 << QKeySequence::SelectNextWord << QStringLiteral("read");
+
+ QTest::newRow("read-only - select last char")
+ << QStringLiteral("read-only - select last char") << true << true << 28 << QKeySequence::SelectPreviousChar << QStringLiteral("r");
+ QTest::newRow("read-only - select last word")
+ << QStringLiteral("read-only - select last word") << true << true << 28 << QKeySequence::SelectPreviousWord << QStringLiteral("word");
+}
+
+void tst_qquicktextedit::keyboardSelection()
+{
+ QFETCH(QString, text);
+ QFETCH(bool, readOnly);
+ QFETCH(bool, selectByKeyboard);
+ QFETCH(int, cursorPosition);
+ QFETCH(QKeySequence::StandardKey, standardKey);
+ QFETCH(QString, selectedText);
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.1\n TextEdit { focus: true }", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ edit->setText(text);
+ edit->setSelectByKeyboard(selectByKeyboard);
+ edit->setReadOnly(readOnly);
+ edit->setCursorPosition(cursorPosition);
+
+ QQuickWindow window;
+ edit->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(edit->hasActiveFocus());
+
+ simulateKeys(&window, standardKey);
+
+ QCOMPARE(edit->selectedText(), selectedText);
+}
+
+void tst_qquicktextedit::renderType()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextEdit {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QSignalSpy spy(edit, SIGNAL(renderTypeChanged()));
+
+ QCOMPARE(edit->renderType(), QQuickTextEdit::QtRendering);
+
+ edit->setRenderType(QQuickTextEdit::NativeRendering);
+ QCOMPARE(edit->renderType(), QQuickTextEdit::NativeRendering);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setRenderType(QQuickTextEdit::NativeRendering);
+ QCOMPARE(spy.count(), 1);
+
+ edit->setRenderType(QQuickTextEdit::QtRendering);
+ QCOMPARE(edit->renderType(), QQuickTextEdit::QtRendering);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextedit::inputMethodHints()
+{
+ QQuickView window(testFileUrl("inputmethodhints.qml"));
+ window.show();
+ window.requestActivate();
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(textEditObject != 0);
+ QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText);
+ QSignalSpy inputMethodHintSpy(textEditObject, SIGNAL(inputMethodHintsChanged()));
+ textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly);
+ QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly);
+ QCOMPARE(inputMethodHintSpy.count(), 1);
+ textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly);
+ QCOMPARE(inputMethodHintSpy.count(), 1);
+
+ QQuickTextEdit plainTextEdit;
+ QCOMPARE(plainTextEdit.inputMethodHints(), Qt::ImhNone);
+}
+
+void tst_qquicktextedit::positionAt_data()
+{
+ QTest::addColumn<QQuickTextEdit::HAlignment>("horizontalAlignment");
+ QTest::addColumn<QQuickTextEdit::VAlignment>("verticalAlignment");
+
+ QTest::newRow("top-left") << QQuickTextEdit::AlignLeft << QQuickTextEdit::AlignTop;
+ QTest::newRow("bottom-left") << QQuickTextEdit::AlignLeft << QQuickTextEdit::AlignBottom;
+ QTest::newRow("center-left") << QQuickTextEdit::AlignLeft << QQuickTextEdit::AlignVCenter;
+
+ QTest::newRow("top-right") << QQuickTextEdit::AlignRight << QQuickTextEdit::AlignTop;
+ QTest::newRow("top-center") << QQuickTextEdit::AlignHCenter << QQuickTextEdit::AlignTop;
+
+ QTest::newRow("center") << QQuickTextEdit::AlignHCenter << QQuickTextEdit::AlignVCenter;
+}
+
+void tst_qquicktextedit::positionAt()
+{
+ QFETCH(QQuickTextEdit::HAlignment, horizontalAlignment);
+ QFETCH(QQuickTextEdit::VAlignment, verticalAlignment);
+
+ QQuickView window(testFileUrl("positionAt.qml"));
+ QVERIFY(window.rootObject() != 0);
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(texteditObject != 0);
+ texteditObject->setHAlign(horizontalAlignment);
+ texteditObject->setVAlign(verticalAlignment);
+
+ QTextLayout layout(texteditObject->text().replace(QLatin1Char('\n'), QChar::LineSeparator));
+ layout.setFont(texteditObject->font());
+
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ line.setLineWidth(texteditObject->width());
+ QTextLine secondLine = layout.createLine();
+ secondLine.setLineWidth(texteditObject->width());
+ layout.endLayout();
+
+ qreal y0;
+ qreal y1;
+
+ switch (verticalAlignment) {
+ case QQuickTextEdit::AlignTop:
+ y0 = line.height() / 2;
+ y1 = line.height() * 3 / 2;
+ break;
+ case QQuickTextEdit::AlignVCenter:
+ y0 = (texteditObject->height() - line.height()) / 2;
+ y1 = (texteditObject->height() + line.height()) / 2;
+ break;
+ case QQuickTextEdit::AlignBottom:
+ y0 = texteditObject->height() - line.height() * 3 / 2;
+ y1 = texteditObject->height() - line.height() / 2;
+ break;
+ }
+
+ qreal xoff;
+ switch (horizontalAlignment) {
+ case QQuickTextEdit::AlignLeft:
+ xoff = 0;
+ break;
+ case QQuickTextEdit::AlignHCenter:
+ xoff = (texteditObject->width() - secondLine.naturalTextWidth()) / 2;
+ break;
+ case QQuickTextEdit::AlignRight:
+ xoff = texteditObject->width() - secondLine.naturalTextWidth();
+ break;
+ case QQuickTextEdit::AlignJustify:
+ break;
+ }
+ int pos = texteditObject->positionAt(texteditObject->width()/2, y0);
+
+ int widthBegin = floor(xoff + line.cursorToX(pos - 1));
+ int widthEnd = ceil(xoff + line.cursorToX(pos + 1));
+
+ QVERIFY(widthBegin <= texteditObject->width() / 2);
+ QVERIFY(widthEnd >= texteditObject->width() / 2);
+
+ const qreal x0 = texteditObject->positionToRectangle(pos).x();
+ const qreal x1 = texteditObject->positionToRectangle(pos + 1).x();
+
+ QString preeditText = texteditObject->text().mid(0, pos);
+ texteditObject->setText(texteditObject->text().mid(pos));
+ texteditObject->setCursorPosition(0);
+
+ QInputMethodEvent inputEvent(preeditText, QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(texteditObject, &inputEvent);
+
+ // Check all points within the preedit text return the same position.
+ QCOMPARE(texteditObject->positionAt(0, y0), 0);
+ QCOMPARE(texteditObject->positionAt(x0 / 2, y0), 0);
+ QCOMPARE(texteditObject->positionAt(x0, y0), 0);
+
+ // Verify positioning returns to normal after the preedit text.
+ QCOMPARE(texteditObject->positionAt(x1, y0), 1);
+ QCOMPARE(texteditObject->positionToRectangle(1).x(), x1);
+
+ QVERIFY(texteditObject->positionAt(x0 / 2, y1) > 0);
+}
+
+void tst_qquicktextedit::linkActivated()
+{
+ QQuickView window(testFileUrl("linkActivated.qml"));
+ QVERIFY(window.rootObject() != 0);
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(texteditObject != 0);
+
+ QSignalSpy spy(texteditObject, SIGNAL(linkActivated(QString)));
+
+ const QString link("http://example.com/");
+
+ const QPointF linkPos = texteditObject->positionToRectangle(7).center();
+ const QPointF textPos = texteditObject->positionToRectangle(2).center();
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint());
+ QTRY_COMPARE(spy.count(), 1);
+ QCOMPARE(spy.last()[0].toString(), link);
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint());
+ QTest::qWait(50);
+ QCOMPARE(spy.count(), 1);
+
+ texteditObject->setReadOnly(true);
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint());
+ QTRY_COMPARE(spy.count(), 2);
+ QCOMPARE(spy.last()[0].toString(), link);
+
+ QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint());
+ QTest::qWait(50);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextedit::cursorDelegate_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::newRow("out of line") << testFileUrl("cursorTest.qml");
+ QTest::newRow("in line") << testFileUrl("cursorTestInline.qml");
+ QTest::newRow("external") << testFileUrl("cursorTestExternal.qml");
+}
+
+void tst_qquicktextedit::cursorDelegate()
+{
+ QFETCH(QUrl, source);
+ QQuickView view(source);
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
+ QVERIFY(textEditObject != 0);
+ // Delegate creation is deferred until focus in or cursor visibility is forced.
+ QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance"));
+ QVERIFY(!textEditObject->isCursorVisible());
+ //Test Delegate gets created
+ textEditObject->setFocus(true);
+ QVERIFY(textEditObject->isCursorVisible());
+ QQuickItem* delegateObject = textEditObject->findChild<QQuickItem*>("cursorInstance");
+ QVERIFY(delegateObject);
+ QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello"));
+ //Test Delegate gets moved
+ for (int i=0; i<= textEditObject->text().length(); i++) {
+ textEditObject->setCursorPosition(i);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+ }
+
+ // Test delegate gets moved on mouse press.
+ textEditObject->setSelectByMouse(true);
+ textEditObject->setCursorPosition(0);
+ const QPoint point1 = textEditObject->positionToRectangle(5).center().toPoint();
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mouseClick(&view, Qt::LeftButton, 0, point1);
+ QTest::qWait(50);
+ QTRY_VERIFY(textEditObject->cursorPosition() != 0);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+
+ // Test delegate gets moved on mouse drag
+ textEditObject->setCursorPosition(0);
+ const QPoint point2 = textEditObject->positionToRectangle(10).center().toPoint();
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mousePress(&view, Qt::LeftButton, 0, point1);
+ QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QGuiApplication::sendEvent(&view, &mv);
+ QTest::mouseRelease(&view, Qt::LeftButton, 0, point2);
+ QTest::qWait(50);
+ QTRY_COMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+
+ textEditObject->setReadOnly(true);
+ textEditObject->setCursorPosition(0);
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint());
+ QTest::qWait(50);
+ QTRY_VERIFY(textEditObject->cursorPosition() != 0);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+
+ textEditObject->setCursorPosition(0);
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint());
+ QTest::qWait(50);
+ QTRY_VERIFY(textEditObject->cursorPosition() != 0);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+
+ textEditObject->setCursorPosition(0);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+
+ textEditObject->setReadOnly(false);
+
+ // Delegate moved when text is entered
+ textEditObject->setText(QString());
+ for (int i = 0; i < 20; ++i) {
+ QTest::keyClick(&view, Qt::Key_A);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+ }
+
+ // Delegate moved when text is entered by im.
+ textEditObject->setText(QString());
+ for (int i = 0; i < 20; ++i) {
+ QInputMethodEvent event;
+ event.setCommitString("a");
+ QGuiApplication::sendEvent(textEditObject, &event);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+ }
+ // Delegate moved when text is removed by im.
+ for (int i = 19; i > 1; --i) {
+ QInputMethodEvent event;
+ event.setCommitString(QString(), -1, 1);
+ QGuiApplication::sendEvent(textEditObject, &event);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+ }
+ { // Delegate moved the text is changed in place by im.
+ QInputMethodEvent event;
+ event.setCommitString("i", -1, 1);
+ QGuiApplication::sendEvent(textEditObject, &event);
+ QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y());
+ }
+
+ //Test Delegate gets deleted
+ textEditObject->setCursorDelegate(0);
+ QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance"));
+}
+
+void tst_qquicktextedit::remoteCursorDelegate()
+{
+ TestHTTPServer server(SERVER_PORT);
+ server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
+
+ QQuickView view;
+
+ QQmlComponent component(view.engine(), QUrl(SERVER_ADDR "/RemoteCursor.qml"));
+
+ view.rootContext()->setContextProperty("contextDelegate", &component);
+ view.setSource(testFileUrl("cursorTestRemote.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
+ QVERIFY(textEditObject != 0);
+
+ // Delegate is created on demand, and so won't be available immediately. Focus in or
+ // setCursorVisible(true) will trigger creation.
+ QTRY_VERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance"));
+ QVERIFY(!textEditObject->isCursorVisible());
+
+ textEditObject->setFocus(true);
+ QVERIFY(textEditObject->isCursorVisible());
+
+ QCOMPARE(component.status(), QQmlComponent::Loading);
+ QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance"));
+ server.sendDelayedItem();
+
+ // Wait for component to load.
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
+ QVERIFY(textEditObject->findChild<QQuickItem*>("cursorInstance"));
+}
+
+void tst_qquicktextedit::cursorVisible()
+{
+ QQuickTextEdit edit;
+ edit.componentComplete();
+ QSignalSpy spy(&edit, SIGNAL(cursorVisibleChanged(bool)));
+
+ QQuickView view(testFileUrl("cursorVisible.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QCOMPARE(&view, qGuiApp->focusWindow());
+
+ QCOMPARE(edit.isCursorVisible(), false);
+
+ edit.setCursorVisible(true);
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 1);
+
+ edit.setCursorVisible(false);
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ edit.setFocus(true);
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ edit.setParentItem(view.rootObject());
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 3);
+
+ edit.setFocus(false);
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 4);
+
+ edit.setFocus(true);
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 5);
+
+ QWindow alternateView;
+ alternateView.show();
+ alternateView.requestActivate();
+ QTest::qWaitForWindowActive(&alternateView);
+
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 6);
+
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 7);
+
+ { // Cursor attribute with 0 length hides cursor.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QCoreApplication::sendEvent(&edit, &ev);
+ }
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 8);
+
+ { // Cursor attribute with non zero length shows cursor.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 1, QVariant()));
+ QCoreApplication::sendEvent(&edit, &ev);
+ }
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 9);
+
+
+ { // If the cursor is hidden by the input method and the text is changed it should be visible again.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QCoreApplication::sendEvent(&edit, &ev);
+ }
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 10);
+
+ edit.setText("something");
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 11);
+
+ { // If the cursor is hidden by the input method and the cursor position is changed it should be visible again.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QCoreApplication::sendEvent(&edit, &ev);
+ }
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 12);
+
+ edit.setCursorPosition(5);
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 13);
+}
+
+void tst_qquicktextedit::delegateLoading_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<QString>("error");
+
+ // import installed
+ QTest::newRow("pass") << "cursorHttpTestPass.qml" << "";
+ QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection ";
+ QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type ";
+}
+
+void tst_qquicktextedit::delegateLoading()
+{
+ QFETCH(QString, qmlfile);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(SERVER_PORT);
+ server.serveDirectory(testFile("httpfail"), TestHTTPServer::Disconnect);
+ server.serveDirectory(testFile("httpslow"), TestHTTPServer::Delay);
+ server.serveDirectory(testFile("http"));
+
+ QQuickView view(QUrl(QLatin1String(SERVER_ADDR "/") + qmlfile));
+ view.show();
+ view.requestActivate();
+
+ if (!error.isEmpty()) {
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+ QTRY_VERIFY(view.status()==QQuickView::Error);
+ QTRY_VERIFY(!view.rootObject()); // there is fail item inside this test
+ } else {
+ QTRY_VERIFY(view.rootObject());//Wait for loading to finish.
+ QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
+ // view.rootObject()->dumpObjectTree();
+ QVERIFY(textEditObject != 0);
+ textEditObject->setFocus(true);
+ QQuickItem *delegate;
+ delegate = view.rootObject()->findChild<QQuickItem*>("delegateOkay");
+ QVERIFY(delegate);
+ delegate = view.rootObject()->findChild<QQuickItem*>("delegateSlow");
+ QVERIFY(delegate);
+
+ delete delegate;
+ }
+
+
+ //A test should be added here with a component which is ready but component.create() returns null
+ //Not sure how to accomplish this with QQuickTextEdits cursor delegate
+ //###This was only needed for code coverage, and could be a case of overzealous defensive programming
+ //delegate = view.rootObject()->findChild<QQuickItem*>("delegateErrorB");
+ //QVERIFY(!delegate);
+}
+
+/*
+TextEdit element should only handle left/right keys until the cursor reaches
+the extent of the text, then they should ignore the keys.
+*/
+void tst_qquicktextedit::navigation()
+{
+ QQuickView window(testFileUrl("navigation.qml"));
+ window.show();
+ window.requestActivate();
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+
+ QVERIFY(input != 0);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == false);
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == true);
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == true);
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == false);
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == true);
+
+ // Test left and right navigation works if the TextEdit is empty (QTBUG-25447).
+ input->setText(QString());
+ QCOMPARE(input->cursorPosition(), 0);
+ simulateKey(&window, Qt::Key_Right);
+ QCOMPARE(input->hasActiveFocus(), false);
+ simulateKey(&window, Qt::Key_Left);
+ QCOMPARE(input->hasActiveFocus(), true);
+ simulateKey(&window, Qt::Key_Left);
+ QCOMPARE(input->hasActiveFocus(), false);
+}
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextedit::copyAndPaste()
+{
+ if (!PlatformQuirks::isClipboardAvailable())
+ QSKIP("This machine doesn't support the clipboard");
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"Hello world!\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ // copy and paste
+ QCOMPARE(textEdit->text().length(), 12);
+ textEdit->select(0, textEdit->text().length());;
+ textEdit->copy();
+ QCOMPARE(textEdit->selectedText(), QString("Hello world!"));
+ QCOMPARE(textEdit->selectedText().length(), 12);
+ textEdit->setCursorPosition(0);
+ QVERIFY(textEdit->canPaste());
+ textEdit->paste();
+ QCOMPARE(textEdit->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textEdit->text().length(), 24);
+
+ // canPaste
+ QVERIFY(textEdit->canPaste());
+ textEdit->setReadOnly(true);
+ QVERIFY(!textEdit->canPaste());
+ textEdit->paste();
+ QCOMPARE(textEdit->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textEdit->text().length(), 24);
+ textEdit->setReadOnly(false);
+ QVERIFY(textEdit->canPaste());
+
+ // QTBUG-12339
+ // test that document and internal text attribute are in sync
+ QQuickItemPrivate* pri = QQuickItemPrivate::get(textEdit);
+ QQuickTextEditPrivate *editPrivate = static_cast<QQuickTextEditPrivate*>(pri);
+ QCOMPARE(textEdit->text(), editPrivate->text);
+
+ // cut: no selection
+ textEdit->cut();
+ QCOMPARE(textEdit->text(), QString("Hello world!Hello world!"));
+
+ // select word
+ textEdit->setCursorPosition(0);
+ textEdit->selectWord();
+ QCOMPARE(textEdit->selectedText(), QString("Hello"));
+
+ // cut: read only.
+ textEdit->setReadOnly(true);
+ textEdit->cut();
+ QCOMPARE(textEdit->text(), QString("Hello world!Hello world!"));
+ textEdit->setReadOnly(false);
+
+ // select all and cut
+ textEdit->selectAll();
+ textEdit->cut();
+ QCOMPARE(textEdit->text().length(), 0);
+ textEdit->paste();
+ QCOMPARE(textEdit->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textEdit->text().length(), 24);
+
+ // Copy first word.
+ textEdit->setCursorPosition(0);
+ textEdit->selectWord();
+ textEdit->copy();
+ // copy: no selection, previous copy retained;
+ textEdit->setCursorPosition(0);
+ QCOMPARE(textEdit->selectedText(), QString());
+ textEdit->copy();
+ textEdit->setText(QString());
+ textEdit->paste();
+ QCOMPARE(textEdit->text(), QString("Hello"));
+}
+#endif
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextedit::canPaste()
+{
+ QGuiApplication::clipboard()->setText("Some text");
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"Hello world!\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ // check initial value - QTBUG-17765
+ QTextDocument document;
+ QQuickTextControl tc(&document);
+ QCOMPARE(textEdit->canPaste(), tc.canPaste());
+}
+#endif
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextedit::canPasteEmpty()
+{
+ QGuiApplication::clipboard()->clear();
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"Hello world!\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ // check initial value - QTBUG-17765
+ QTextDocument document;
+ QQuickTextControl tc(&document);
+ QCOMPARE(textEdit->canPaste(), tc.canPaste());
+}
+#endif
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextedit::middleClickPaste()
+{
+ if (!PlatformQuirks::isClipboardAvailable())
+ QSKIP("This machine doesn't support the clipboard");
+
+ QQuickView window(testFileUrl("mouseselection_true.qml"));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(textEditObject != 0);
+
+ textEditObject->setFocus(true);
+
+ QString originalText = textEditObject->text();
+ QString selectedText = "234567";
+
+ // press-and-drag-and-release from x1 to x2
+ const QPoint p1 = textEditObject->positionToRectangle(2).center().toPoint();
+ const QPoint p2 = textEditObject->positionToRectangle(8).center().toPoint();
+ const QPoint p3 = textEditObject->positionToRectangle(1).center().toPoint();
+ QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTest::mouseMove(&window, p2);
+ QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2);
+ QTRY_COMPARE(textEditObject->selectedText(), selectedText);
+
+ // Middle click pastes the selected text, assuming the platform supports it.
+ QTest::mouseClick(&window, Qt::MiddleButton, Qt::NoModifier, p3);
+
+ // ### This is to prevent double click detection from carrying over to the next test.
+ QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10);
+
+ if (QGuiApplication::clipboard()->supportsSelection())
+ QCOMPARE(textEditObject->text().mid(1, selectedText.length()), selectedText);
+ else
+ QCOMPARE(textEditObject->text(), originalText);
+}
+#endif
+
+void tst_qquicktextedit::readOnly()
+{
+ QQuickView window(testFileUrl("readOnly.qml"));
+ window.show();
+ window.requestActivate();
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+
+ QVERIFY(edit != 0);
+ QTRY_VERIFY(edit->hasActiveFocus() == true);
+ QVERIFY(edit->isReadOnly() == true);
+ QString initial = edit->text();
+ for (int k=Qt::Key_0; k<=Qt::Key_Z; k++)
+ simulateKey(&window, k);
+ simulateKey(&window, Qt::Key_Return);
+ simulateKey(&window, Qt::Key_Space);
+ simulateKey(&window, Qt::Key_Escape);
+ QCOMPARE(edit->text(), initial);
+
+ edit->setCursorPosition(3);
+ edit->setReadOnly(false);
+ QCOMPARE(edit->isReadOnly(), false);
+ QCOMPARE(edit->cursorPosition(), edit->text().length());
+}
+
+void tst_qquicktextedit::simulateKey(QWindow *view, int key, Qt::KeyboardModifiers modifiers)
+{
+ QKeyEvent press(QKeyEvent::KeyPress, key, modifiers);
+ QKeyEvent release(QKeyEvent::KeyRelease, key, modifiers);
+
+ QGuiApplication::sendEvent(view, &press);
+ QGuiApplication::sendEvent(view, &release);
+}
+
+void tst_qquicktextedit::textInput()
+{
+ QQuickView view(testFileUrl("inputMethodEvent.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject());
+ QVERIFY(edit);
+ QVERIFY(edit->hasActiveFocus() == true);
+
+ // test that input method event is committed and change signal is emitted
+ QSignalSpy spy(edit, SIGNAL(textChanged()));
+ QInputMethodEvent event;
+ event.setCommitString( "Hello world!", 0, 0);
+ QGuiApplication::sendEvent(edit, &event);
+ QCOMPARE(edit->text(), QString("Hello world!"));
+ QCOMPARE(spy.count(), 1);
+
+ // QTBUG-12339
+ // test that document and internal text attribute are in sync
+ QQuickTextEditPrivate *editPrivate = static_cast<QQuickTextEditPrivate*>(QQuickItemPrivate::get(edit));
+ QCOMPARE(editPrivate->text, QString("Hello world!"));
+
+ QInputMethodQueryEvent queryEvent(Qt::ImEnabled);
+ QGuiApplication::sendEvent(edit, &queryEvent);
+ QCOMPARE(queryEvent.value(Qt::ImEnabled).toBool(), true);
+
+ edit->setReadOnly(true);
+ QGuiApplication::sendEvent(edit, &queryEvent);
+ QCOMPARE(queryEvent.value(Qt::ImEnabled).toBool(), false);
+}
+
+void tst_qquicktextedit::inputMethodUpdate()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QQuickView view(testFileUrl("inputMethodEvent.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject());
+ QVERIFY(edit);
+ QVERIFY(edit->hasActiveFocus() == true);
+
+ // text change even without cursor position change needs to trigger update
+ edit->setText("test");
+ platformInputContext.clear();
+ edit->setText("xxxx");
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // input method event replacing text
+ platformInputContext.clear();
+ {
+ QInputMethodEvent inputMethodEvent;
+ inputMethodEvent.setCommitString("y", -1, 1);
+ QGuiApplication::sendEvent(edit, &inputMethodEvent);
+ }
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // input method changing selection
+ platformInputContext.clear();
+ {
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 2, QVariant());
+ QInputMethodEvent inputMethodEvent("", attributes);
+ QGuiApplication::sendEvent(edit, &inputMethodEvent);
+ }
+ QVERIFY(edit->selectionStart() != edit->selectionEnd());
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // programmatical selections trigger update
+ platformInputContext.clear();
+ edit->selectAll();
+ QCOMPARE(platformInputContext.m_updateCallCount, 1);
+
+ // font changes
+ platformInputContext.clear();
+ QFont font = edit->font();
+ font.setBold(!font.bold());
+ edit->setFont(font);
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // normal input
+ platformInputContext.clear();
+ {
+ QInputMethodEvent inputMethodEvent;
+ inputMethodEvent.setCommitString("y");
+ QGuiApplication::sendEvent(edit, &inputMethodEvent);
+ }
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // changing cursor position
+ platformInputContext.clear();
+ edit->setCursorPosition(0);
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // continuing with selection
+ platformInputContext.clear();
+ edit->moveCursorSelection(1);
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // read only disabled input method
+ platformInputContext.clear();
+ edit->setReadOnly(true);
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+ edit->setReadOnly(false);
+
+ // no updates while no focus
+ edit->setFocus(false);
+ platformInputContext.clear();
+ edit->setText("Foo");
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+ edit->setCursorPosition(1);
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+ edit->selectAll();
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+ edit->setReadOnly(true);
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+}
+
+void tst_qquicktextedit::openInputPanel()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QQuickView view(testFileUrl("openInputPanel.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject());
+ QVERIFY(edit);
+
+ // check default values
+ QVERIFY(edit->focusOnPress());
+ QVERIFY(!edit->hasActiveFocus());
+ QVERIFY(qApp->focusObject() != edit);
+
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+
+ // input panel should open on focus
+ QPoint centerPoint(view.width()/2, view.height()/2);
+ Qt::KeyboardModifiers noModifiers = 0;
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QVERIFY(edit->hasActiveFocus());
+ QCOMPARE(qApp->focusObject(), edit);
+ QCOMPARE(qApp->inputMethod()->isVisible(), true);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+
+ // input panel should be re-opened when pressing already focused TextEdit
+ qApp->inputMethod()->hide();
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+ QVERIFY(edit->hasActiveFocus());
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(qApp->inputMethod()->isVisible(), true);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+
+ // input panel should stay visible if focus is lost to another text editor
+ QSignalSpy inputPanelVisibilitySpy(qApp->inputMethod(), SIGNAL(visibleChanged()));
+ QQuickTextEdit anotherEdit;
+ anotherEdit.setParentItem(view.rootObject());
+ anotherEdit.setFocus(true);
+ QCOMPARE(qApp->inputMethod()->isVisible(), true);
+ QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherEdit));
+ QCOMPARE(inputPanelVisibilitySpy.count(), 0);
+
+ anotherEdit.setFocus(false);
+ QVERIFY(qApp->focusObject() != &anotherEdit);
+ QCOMPARE(view.activeFocusItem(), view.contentItem());
+ anotherEdit.setFocus(true);
+
+ qApp->inputMethod()->hide();
+
+ // input panel should not be opened if TextEdit is read only
+ edit->setReadOnly(true);
+ edit->setFocus(true);
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+
+ // input panel should not be opened if focusOnPress is set to false
+ edit->setFocusOnPress(false);
+ edit->setFocus(false);
+ edit->setFocus(true);
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+
+ inputMethodPrivate->testContext = 0;
+}
+
+void tst_qquicktextedit::geometrySignals()
+{
+ QQmlComponent component(&engine, testFileUrl("geometrySignals.qml"));
+ QObject *o = component.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("bindingWidth").toInt(), 400);
+ QCOMPARE(o->property("bindingHeight").toInt(), 500);
+ delete o;
+}
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextedit::pastingRichText_QTBUG_14003()
+{
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.PlainText }";
+ QQmlComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickTextEdit *obj = qobject_cast<QQuickTextEdit*>(component.create());
+
+ QTRY_VERIFY(obj != 0);
+ QTRY_VERIFY(obj->textFormat() == QQuickTextEdit::PlainText);
+
+ QMimeData *mData = new QMimeData;
+ mData->setHtml("<font color=\"red\">Hello</font>");
+ QGuiApplication::clipboard()->setMimeData(mData);
+
+ obj->paste();
+ QTRY_VERIFY(obj->text() == "");
+ QTRY_VERIFY(obj->textFormat() == QQuickTextEdit::PlainText);
+}
+#endif
+
+void tst_qquicktextedit::implicitSize_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("wrap");
+ QTest::addColumn<QString>("format");
+ QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.NoWrap" << "TextEdit.PlainText";
+ QTest::newRow("richtext") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "TextEdit.NoWrap" << "TextEdit.RichText";
+ QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.Wrap" << "TextEdit.PlainText";
+ QTest::newRow("richtext_wrap") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "TextEdit.Wrap" << "TextEdit.RichText";
+}
+
+void tst_qquicktextedit::implicitSize()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, wrap);
+ QFETCH(QString, format);
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + text + "\"; width: 50; wrapMode: " + wrap + "; textFormat: " + format + " }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create());
+
+ QVERIFY(textObject->width() < textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+
+ textObject->resetWidth();
+ QVERIFY(textObject->width() == textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+}
+
+void tst_qquicktextedit::contentSize()
+{
+ QString componentStr = "import QtQuick 2.0\nTextEdit { width: 75; height: 16; font.pixelSize: 10 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit *>(object.data());
+
+ QSignalSpy spy(textObject, SIGNAL(contentSizeChanged()));
+
+ textObject->setText("The quick red fox jumped over the lazy brown dog");
+
+ QVERIFY(textObject->contentWidth() > textObject->width());
+ QVERIFY(textObject->contentHeight() < textObject->height());
+ QCOMPARE(spy.count(), 1);
+
+ textObject->setWrapMode(QQuickTextEdit::WordWrap);
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+ QVERIFY(textObject->contentHeight() > textObject->height());
+ QCOMPARE(spy.count(), 2);
+
+ textObject->setText("The quickredfoxjumpedoverthe lazy brown dog");
+
+ QVERIFY(textObject->contentWidth() > textObject->width());
+ QVERIFY(textObject->contentHeight() > textObject->height());
+ QCOMPARE(spy.count(), 3);
+}
+
+void tst_qquicktextedit::implicitSizeBinding_data()
+{
+ implicitSize_data();
+}
+
+void tst_qquicktextedit::implicitSizeBinding()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, wrap);
+ QFETCH(QString, format);
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + text + "\"; width: implicitWidth; height: implicitHeight; wrapMode: " + wrap + "; textFormat: " + format + " }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit *>(object.data());
+
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+
+ textObject->resetWidth();
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+
+ textObject->resetHeight();
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+}
+
+void tst_qquicktextedit::clipRect()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextEdit {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+
+ QCOMPARE(edit->clipRect().width(), edit->width() + edit->cursorRectangle().width());
+ QCOMPARE(edit->clipRect().height(), edit->height());
+
+ edit->setText("Hello World");
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+ // XXX: TextEdit allows an extra 3 pixels boundary for the cursor beyond it's width for non
+ // empty text. TextInput doesn't.
+ QCOMPARE(edit->clipRect().width(), edit->width() + edit->cursorRectangle().width() + 3);
+ QCOMPARE(edit->clipRect().height(), edit->height());
+
+ // clip rect shouldn't exceed the size of the item, expect for the cursor width;
+ edit->setWidth(edit->width() / 2);
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+ QCOMPARE(edit->clipRect().width(), edit->width() + edit->cursorRectangle().width() + 3);
+ QCOMPARE(edit->clipRect().height(), edit->height());
+
+ edit->setHeight(edit->height() * 2);
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+ QCOMPARE(edit->clipRect().width(), edit->width() + edit->cursorRectangle().width() + 3);
+ QCOMPARE(edit->clipRect().height(), edit->height());
+
+ QQmlComponent cursorComponent(&engine);
+ cursorComponent.setData("import QtQuick 2.0\nRectangle { height: 20; width: 8 }", QUrl());
+
+ edit->setCursorDelegate(&cursorComponent);
+ edit->setCursorVisible(true);
+
+ // If a cursor delegate is used it's size should determine the excess width.
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+ QCOMPARE(edit->clipRect().width(), edit->width() + 8 + 3);
+ QCOMPARE(edit->clipRect().height(), edit->height());
+
+ // Alignment and wrapping don't affect the clip rect.
+ edit->setHAlign(QQuickTextEdit::AlignRight);
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+ QCOMPARE(edit->clipRect().width(), edit->width() + 8 + 3);
+ QCOMPARE(edit->clipRect().height(), edit->height());
+
+ edit->setWrapMode(QQuickTextEdit::Wrap);
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+ QCOMPARE(edit->clipRect().width(), edit->width() + 8 + 3);
+ QCOMPARE(edit->clipRect().height(), edit->height());
+
+ edit->setVAlign(QQuickTextEdit::AlignBottom);
+ QCOMPARE(edit->clipRect().x(), qreal(0));
+ QCOMPARE(edit->clipRect().y(), qreal(0));
+ QCOMPARE(edit->clipRect().width(), edit->width() + 8 + 3);
+ QCOMPARE(edit->clipRect().height(), edit->height());
+}
+
+void tst_qquicktextedit::boundingRect()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextEdit {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(object.data());
+ QVERIFY(edit);
+
+ QTextLayout layout;
+ layout.setFont(edit->font());
+
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ QCOMPARE(edit->boundingRect().x(), qreal(0));
+ QCOMPARE(edit->boundingRect().y(), qreal(0));
+ QCOMPARE(edit->boundingRect().width(), edit->cursorRectangle().width());
+ QCOMPARE(edit->boundingRect().height(), line.height());
+
+ edit->setText("Hello World");
+
+ layout.setText(edit->text());
+ layout.beginLayout();
+ line = layout.createLine();
+ layout.endLayout();
+
+ QCOMPARE(edit->boundingRect().x(), qreal(0));
+ QCOMPARE(edit->boundingRect().y(), qreal(0));
+ QCOMPARE(edit->boundingRect().width(), line.naturalTextWidth() + edit->cursorRectangle().width() + 3);
+ QCOMPARE(edit->boundingRect().height(), line.height());
+
+ // the size of the bounding rect shouldn't be bounded by the size of item.
+ edit->setWidth(edit->width() / 2);
+ QCOMPARE(edit->boundingRect().x(), qreal(0));
+ QCOMPARE(edit->boundingRect().y(), qreal(0));
+ QCOMPARE(edit->boundingRect().width(), line.naturalTextWidth() + edit->cursorRectangle().width() + 3);
+ QCOMPARE(edit->boundingRect().height(), line.height());
+
+ edit->setHeight(edit->height() * 2);
+ QCOMPARE(edit->boundingRect().x(), qreal(0));
+ QCOMPARE(edit->boundingRect().y(), qreal(0));
+ QCOMPARE(edit->boundingRect().width(), line.naturalTextWidth() + edit->cursorRectangle().width() + 3);
+ QCOMPARE(edit->boundingRect().height(), line.height());
+
+ QQmlComponent cursorComponent(&engine);
+ cursorComponent.setData("import QtQuick 2.0\nRectangle { height: 20; width: 8 }", QUrl());
+
+ edit->setCursorDelegate(&cursorComponent);
+ edit->setCursorVisible(true);
+
+ // Don't include the size of a cursor delegate as it has its own bounding rect.
+ QCOMPARE(edit->boundingRect().x(), qreal(0));
+ QCOMPARE(edit->boundingRect().y(), qreal(0));
+ QCOMPARE(edit->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(edit->boundingRect().height(), line.height());
+
+ edit->setHAlign(QQuickTextEdit::AlignRight);
+ QCOMPARE(edit->boundingRect().x(), edit->width() - line.naturalTextWidth());
+ QCOMPARE(edit->boundingRect().y(), qreal(0));
+ QCOMPARE(edit->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(edit->boundingRect().height(), line.height());
+
+ edit->setWrapMode(QQuickTextEdit::Wrap);
+ QCOMPARE(edit->boundingRect().right(), edit->width());
+ QCOMPARE(edit->boundingRect().y(), qreal(0));
+ QVERIFY(edit->boundingRect().width() < line.naturalTextWidth());
+ QVERIFY(edit->boundingRect().height() > line.height());
+
+ edit->setVAlign(QQuickTextEdit::AlignBottom);
+ QCOMPARE(edit->boundingRect().right(), edit->width());
+ QCOMPARE(edit->boundingRect().bottom(), edit->height());
+ QVERIFY(edit->boundingRect().width() < line.naturalTextWidth());
+ QVERIFY(edit->boundingRect().height() > line.height());
+}
+
+void tst_qquicktextedit::preeditCursorRectangle()
+{
+ QString preeditText = "super";
+
+ QQuickView view(testFileUrl("inputMethodEvent.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject());
+ QVERIFY(edit);
+
+ QQuickItem *cursor = edit->findChild<QQuickItem *>("cursor");
+ QVERIFY(cursor);
+
+ QSignalSpy editSpy(edit, SIGNAL(cursorRectangleChanged()));
+ QSignalSpy panelSpy(qGuiApp->inputMethod(), SIGNAL(cursorRectangleChanged()));
+
+ QRectF currentRect;
+
+ QCOMPARE(QGuiApplication::focusObject(), static_cast<QObject *>(edit));
+ QInputMethodQueryEvent query(Qt::ImCursorRectangle);
+ QCoreApplication::sendEvent(edit, &query);
+ QRectF previousRect = query.value(Qt::ImCursorRectangle).toRectF();
+
+ // Verify that the micro focus rect is positioned the same for position 0 as
+ // it would be if there was no preedit text.
+ QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, preeditText.length(), QVariant()));
+ QCoreApplication::sendEvent(edit, &imEvent);
+ QCoreApplication::sendEvent(edit, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QCOMPARE(edit->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+ QCOMPARE(currentRect, previousRect);
+
+ // Verify that the micro focus rect moves to the left as the cursor position
+ // is incremented.
+ editSpy.clear();
+ panelSpy.clear();
+ for (int i = 1; i <= 5; ++i) {
+ QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, i, preeditText.length(), QVariant()));
+ QCoreApplication::sendEvent(edit, &imEvent);
+ QCoreApplication::sendEvent(edit, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QCOMPARE(edit->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+ QVERIFY(previousRect.left() < currentRect.left());
+ QCOMPARE(editSpy.count(), 1); editSpy.clear();
+ QCOMPARE(panelSpy.count(), 1); panelSpy.clear();
+ previousRect = currentRect;
+ }
+
+ // Verify that if the cursor rectangle is updated if the pre-edit text changes
+ // but the (non-zero) cursor position is the same.
+ editSpy.clear();
+ panelSpy.clear();
+ { QInputMethodEvent imEvent("wwwww", QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 5, 1, QVariant()));
+ QCoreApplication::sendEvent(edit, &imEvent); }
+ QCoreApplication::sendEvent(edit, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QCOMPARE(edit->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+ QCOMPARE(editSpy.count(), 1);
+ QCOMPARE(panelSpy.count(), 1);
+
+ // Verify that if there is no preedit cursor then the micro focus rect is the
+ // same as it would be if it were positioned at the end of the preedit text.
+ editSpy.clear();
+ panelSpy.clear();
+ { QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>());
+ QCoreApplication::sendEvent(edit, &imEvent); }
+ QCoreApplication::sendEvent(edit, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QCOMPARE(edit->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+ QCOMPARE(currentRect, previousRect);
+ QCOMPARE(editSpy.count(), 1);
+ QCOMPARE(panelSpy.count(), 1);
+}
+
+void tst_qquicktextedit::inputMethodComposing()
+{
+ QString text = "supercalifragisiticexpialidocious!";
+
+ QQuickView view(testFileUrl("inputContext.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject());
+ QVERIFY(edit);
+ QCOMPARE(QGuiApplication::focusObject(), static_cast<QObject *>(edit));
+
+ QSignalSpy spy(edit, SIGNAL(inputMethodComposingChanged()));
+ edit->setCursorPosition(12);
+
+ QCOMPARE(edit->isInputMethodComposing(), false);
+
+ {
+ QInputMethodEvent event(text.mid(3), QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(edit, &event);
+ }
+
+ QCOMPARE(edit->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 1);
+
+ {
+ QInputMethodEvent event(text.mid(12), QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(spy.count(), 1);
+
+ {
+ QInputMethodEvent event;
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 2);
+
+ // Changing the text while not composing doesn't alter the composing state.
+ edit->setText(text.mid(0, 16));
+ QCOMPARE(edit->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 2);
+
+ {
+ QInputMethodEvent event(text.mid(16), QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 3);
+
+ // Changing the text while composing cancels composition.
+ edit->setText(text.mid(0, 12));
+ QCOMPARE(edit->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 4);
+
+ { // Preedit cursor positioned outside (empty) preedit; composing.
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, -2, 1, QVariant()));
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 5);
+
+ { // Cursor hidden; composing
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 5);
+
+ { // Default cursor attributes; composing.
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 1, QVariant()));
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 5);
+
+ { // Selections are persisted: not composing
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 2, 4, QVariant()));
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 6);
+
+ edit->setCursorPosition(0);
+
+ { // Formatting applied; composing.
+ QTextCharFormat format;
+ format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 2, 4, format));
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 7);
+
+ {
+ QInputMethodEvent event;
+ QGuiApplication::sendEvent(edit, &event);
+ }
+ QCOMPARE(edit->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 8);
+}
+
+void tst_qquicktextedit::cursorRectangleSize()
+{
+ QQuickView *window = new QQuickView(testFileUrl("positionAt.qml"));
+ QVERIFY(window->rootObject() != 0);
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit *>(window->rootObject());
+
+ // make sure cursor rectangle is not at (0,0)
+ textEdit->setX(10);
+ textEdit->setY(10);
+ textEdit->setCursorPosition(3);
+ QVERIFY(textEdit != 0);
+ textEdit->setFocus(true);
+ window->show();
+ window->requestActivate();
+ QTest::qWaitForWindowActive(window);
+
+ QInputMethodQueryEvent event(Qt::ImCursorRectangle);
+ qApp->sendEvent(textEdit, &event);
+ QRectF cursorRectFromQuery = event.value(Qt::ImCursorRectangle).toRectF();
+
+ QRectF cursorRectFromItem = textEdit->cursorRectangle();
+ QRectF cursorRectFromPositionToRectangle = textEdit->positionToRectangle(textEdit->cursorPosition());
+
+ // item and input query cursor rectangles match
+ QCOMPARE(cursorRectFromItem, cursorRectFromQuery);
+
+ // item cursor rectangle and positionToRectangle calculations match
+ QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle);
+
+ // item-window transform and input item transform match
+ QCOMPARE(QQuickItemPrivate::get(textEdit)->itemToWindowTransform(), qApp->inputMethod()->inputItemTransform());
+
+ // input panel cursorRectangle property and tranformed item cursor rectangle match
+ QRectF sceneCursorRect = QQuickItemPrivate::get(textEdit)->itemToWindowTransform().mapRect(cursorRectFromItem);
+ QCOMPARE(sceneCursorRect, qApp->inputMethod()->cursorRectangle());
+
+ delete window;
+}
+
+void tst_qquicktextedit::getText_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<int>("start");
+ QTest::addColumn<int>("end");
+ QTest::addColumn<QString>("expectedText");
+
+ const QString richBoldText = QStringLiteral("This is some <b>bold</b> text");
+ const QString plainBoldText = QStringLiteral("This is some bold text");
+ const QString richBoldTextLB = QStringLiteral("This is some<br/><b>bold</b> text");
+ const QString plainBoldTextLB = QString(QStringLiteral("This is some\nbold text")).replace(QLatin1Char('\n'), QChar(QChar::LineSeparator));
+
+ QTest::newRow("all plain text")
+ << standard.at(0)
+ << 0 << standard.at(0).length()
+ << standard.at(0);
+
+ QTest::newRow("plain text sub string")
+ << standard.at(0)
+ << 0 << 12
+ << standard.at(0).mid(0, 12);
+
+ QTest::newRow("plain text sub string reversed")
+ << standard.at(0)
+ << 12 << 0
+ << standard.at(0).mid(0, 12);
+
+ QTest::newRow("plain text cropped beginning")
+ << standard.at(0)
+ << -3 << 4
+ << standard.at(0).mid(0, 4);
+
+ QTest::newRow("plain text cropped end")
+ << standard.at(0)
+ << 23 << standard.at(0).length() + 8
+ << standard.at(0).mid(23);
+
+ QTest::newRow("plain text cropped beginning and end")
+ << standard.at(0)
+ << -9 << standard.at(0).length() + 4
+ << standard.at(0);
+
+ QTest::newRow("all rich text")
+ << richBoldText
+ << 0 << plainBoldText.length()
+ << plainBoldText;
+
+ QTest::newRow("rich text sub string")
+ << richBoldText
+ << 14 << 21
+ << plainBoldText.mid(14, 7);
+
+ // Line break.
+ QTest::newRow("all plain text (line break)")
+ << standard.at(1)
+ << 0 << standard.at(1).length()
+ << standard.at(1);
+
+ QTest::newRow("plain text sub string (line break)")
+ << standard.at(1)
+ << 0 << 12
+ << standard.at(1).mid(0, 12);
+
+ QTest::newRow("plain text sub string reversed (line break)")
+ << standard.at(1)
+ << 12 << 0
+ << standard.at(1).mid(0, 12);
+
+ QTest::newRow("plain text cropped beginning (line break)")
+ << standard.at(1)
+ << -3 << 4
+ << standard.at(1).mid(0, 4);
+
+ QTest::newRow("plain text cropped end (line break)")
+ << standard.at(1)
+ << 23 << standard.at(1).length() + 8
+ << standard.at(1).mid(23);
+
+ QTest::newRow("plain text cropped beginning and end (line break)")
+ << standard.at(1)
+ << -9 << standard.at(1).length() + 4
+ << standard.at(1);
+
+ QTest::newRow("all rich text (line break)")
+ << richBoldTextLB
+ << 0 << plainBoldTextLB.length()
+ << plainBoldTextLB;
+
+ QTest::newRow("rich text sub string (line break)")
+ << richBoldTextLB
+ << 14 << 21
+ << plainBoldTextLB.mid(14, 7);
+}
+
+void tst_qquicktextedit::getText()
+{
+ QFETCH(QString, text);
+ QFETCH(int, start);
+ QFETCH(int, end);
+ QFETCH(QString, expectedText);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { textFormat: TextEdit.AutoText; text: \"" + text + "\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ QCOMPARE(textEdit->getText(start, end), expectedText);
+}
+
+void tst_qquicktextedit::getFormattedText_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QQuickTextEdit::TextFormat>("textFormat");
+ QTest::addColumn<int>("start");
+ QTest::addColumn<int>("end");
+ QTest::addColumn<QString>("expectedText");
+
+ const QString richBoldText = QStringLiteral("This is some <b>bold</b> text");
+ const QString plainBoldText = QStringLiteral("This is some bold text");
+
+ QTest::newRow("all plain text")
+ << standard.at(0)
+ << QQuickTextEdit::PlainText
+ << 0 << standard.at(0).length()
+ << standard.at(0);
+
+ QTest::newRow("plain text sub string")
+ << standard.at(0)
+ << QQuickTextEdit::PlainText
+ << 0 << 12
+ << standard.at(0).mid(0, 12);
+
+ QTest::newRow("plain text sub string reversed")
+ << standard.at(0)
+ << QQuickTextEdit::PlainText
+ << 12 << 0
+ << standard.at(0).mid(0, 12);
+
+ QTest::newRow("plain text cropped beginning")
+ << standard.at(0)
+ << QQuickTextEdit::PlainText
+ << -3 << 4
+ << standard.at(0).mid(0, 4);
+
+ QTest::newRow("plain text cropped end")
+ << standard.at(0)
+ << QQuickTextEdit::PlainText
+ << 23 << standard.at(0).length() + 8
+ << standard.at(0).mid(23);
+
+ QTest::newRow("plain text cropped beginning and end")
+ << standard.at(0)
+ << QQuickTextEdit::PlainText
+ << -9 << standard.at(0).length() + 4
+ << standard.at(0);
+
+ QTest::newRow("all rich (Auto) text")
+ << richBoldText
+ << QQuickTextEdit::AutoText
+ << 0 << plainBoldText.length()
+ << QString("This is some \\<.*\\>bold\\</.*\\> text");
+
+ QTest::newRow("all rich (Rich) text")
+ << richBoldText
+ << QQuickTextEdit::RichText
+ << 0 << plainBoldText.length()
+ << QString("This is some \\<.*\\>bold\\</.*\\> text");
+
+ QTest::newRow("all rich (Plain) text")
+ << richBoldText
+ << QQuickTextEdit::PlainText
+ << 0 << richBoldText.length()
+ << richBoldText;
+
+ QTest::newRow("rich (Auto) text sub string")
+ << richBoldText
+ << QQuickTextEdit::AutoText
+ << 14 << 21
+ << QString("\\<.*\\>old\\</.*\\> tex");
+
+ QTest::newRow("rich (Rich) text sub string")
+ << richBoldText
+ << QQuickTextEdit::RichText
+ << 14 << 21
+ << QString("\\<.*\\>old\\</.*\\> tex");
+
+ QTest::newRow("rich (Plain) text sub string")
+ << richBoldText
+ << QQuickTextEdit::PlainText
+ << 17 << 27
+ << richBoldText.mid(17, 10);
+}
+
+void tst_qquicktextedit::getFormattedText()
+{
+ QFETCH(QString, text);
+ QFETCH(QQuickTextEdit::TextFormat, textFormat);
+ QFETCH(int, start);
+ QFETCH(int, end);
+ QFETCH(QString, expectedText);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit {}";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ textEdit->setTextFormat(textFormat);
+ textEdit->setText(text);
+
+ if (textFormat == QQuickTextEdit::RichText
+ || (textFormat == QQuickTextEdit::AutoText && Qt::mightBeRichText(text))) {
+ QVERIFY(textEdit->getFormattedText(start, end).contains(QRegExp(expectedText)));
+ } else {
+ QCOMPARE(textEdit->getFormattedText(start, end), expectedText);
+ }
+}
+
+void tst_qquicktextedit::insert_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QQuickTextEdit::TextFormat>("textFormat");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<int>("insertPosition");
+ QTest::addColumn<QString>("insertText");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<int>("expectedSelectionStart");
+ QTest::addColumn<int>("expectedSelectionEnd");
+ QTest::addColumn<int>("expectedCursorPosition");
+ QTest::addColumn<bool>("selectionChanged");
+ QTest::addColumn<bool>("cursorPositionChanged");
+
+ QTest::newRow("at cursor position (beginning)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 5 << 5 << 5
+ << false << true;
+
+ QTest::newRow("at cursor position (end)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << standard.at(0).length() << standard.at(0).length() << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5
+ << false << true;
+
+ QTest::newRow("at cursor position (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << 18 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 23 << 23 << 23
+ << false << true;
+
+ QTest::newRow("after cursor position (beginning)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("before cursor position (end)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << standard.at(0).length() << standard.at(0).length() << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5
+ << false << true;
+
+ QTest::newRow("before cursor position (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << 18 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 23 << 23 << 23
+ << false << true;
+
+ QTest::newRow("after cursor position (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << 18 << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << 18 << 18 << 18
+ << false << false;
+
+ QTest::newRow("before selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 14 << 19 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 19 << 24 << 24
+ << false << true;
+
+ QTest::newRow("before reversed selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 19 << 14 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 19 << 24 << 19
+ << false << true;
+
+ QTest::newRow("after selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 14 << 19 << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << 14 << 19 << 19
+ << false << false;
+
+ QTest::newRow("after reversed selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 19 << 14 << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << 14 << 19 << 14
+ << false << false;
+
+ QTest::newRow("into selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 14 << 19 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 14 << 24 << 24
+ << true << true;
+
+ QTest::newRow("into reversed selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 19 << 14 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 14 << 24 << 14
+ << true << false;
+
+ QTest::newRow("rich text into plain text")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0 << 0
+ << QString("<b>Hello</b>")
+ << QString("<b>Hello</b>") + standard.at(0)
+ << 12 << 12 << 12
+ << false << true;
+
+ QTest::newRow("rich text into rich text")
+ << standard.at(0) << QQuickTextEdit::RichText
+ << 0 << 0 << 0
+ << QString("<b>Hello</b>")
+ << QString("Hello") + standard.at(0)
+ << 5 << 5 << 5
+ << false << true;
+
+ QTest::newRow("rich text into auto text")
+ << standard.at(0) << QQuickTextEdit::AutoText
+ << 0 << 0 << 0
+ << QString("<b>Hello</b>")
+ << QString("Hello") + standard.at(0)
+ << 5 << 5 << 5
+ << false << true;
+
+ QTest::newRow("before start")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0 << -3
+ << QString("Hello")
+ << standard.at(0)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("past end")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0 << standard.at(0).length() + 3
+ << QString("Hello")
+ << standard.at(0)
+ << 0 << 0 << 0
+ << false << false;
+}
+
+void tst_qquicktextedit::insert()
+{
+ QFETCH(QString, text);
+ QFETCH(QQuickTextEdit::TextFormat, textFormat);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(int, insertPosition);
+ QFETCH(QString, insertText);
+ QFETCH(QString, expectedText);
+ QFETCH(int, expectedSelectionStart);
+ QFETCH(int, expectedSelectionEnd);
+ QFETCH(int, expectedCursorPosition);
+ QFETCH(bool, selectionChanged);
+ QFETCH(bool, cursorPositionChanged);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + text + "\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ textEdit->setTextFormat(textFormat);
+ textEdit->select(selectionStart, selectionEnd);
+
+ QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged()));
+ QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged()));
+ QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged()));
+ QSignalSpy textSpy(textEdit, SIGNAL(textChanged()));
+ QSignalSpy cursorPositionSpy(textEdit, SIGNAL(cursorPositionChanged()));
+
+ textEdit->insert(insertPosition, insertText);
+
+ if (textFormat == QQuickTextEdit::RichText || (textFormat == QQuickTextEdit::AutoText && (
+ Qt::mightBeRichText(text) || Qt::mightBeRichText(insertText)))) {
+ QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText);
+ } else {
+ QCOMPARE(textEdit->text(), expectedText);
+
+ }
+ QCOMPARE(textEdit->length(), expectedText.length());
+
+ QCOMPARE(textEdit->selectionStart(), expectedSelectionStart);
+ QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd);
+ QCOMPARE(textEdit->cursorPosition(), expectedCursorPosition);
+
+ if (selectionStart > selectionEnd)
+ qSwap(selectionStart, selectionEnd);
+
+ QEXPECT_FAIL("into selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue);
+ QEXPECT_FAIL("into reversed selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue);
+ QCOMPARE(selectionSpy.count() > 0, selectionChanged);
+ QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart);
+ QEXPECT_FAIL("into reversed selection", "selectionEndChanged signal not emitted", Continue);
+ QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd);
+ QCOMPARE(textSpy.count() > 0, text != expectedText);
+ QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged);
+}
+
+void tst_qquicktextedit::remove_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QQuickTextEdit::TextFormat>("textFormat");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<int>("removeStart");
+ QTest::addColumn<int>("removeEnd");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<int>("expectedSelectionStart");
+ QTest::addColumn<int>("expectedSelectionEnd");
+ QTest::addColumn<int>("expectedCursorPosition");
+ QTest::addColumn<bool>("selectionChanged");
+ QTest::addColumn<bool>("cursorPositionChanged");
+
+ const QString richBoldText = QStringLiteral("This is some <b>bold</b> text");
+ const QString plainBoldText = QStringLiteral("This is some bold text");
+
+ QTest::newRow("from cursor position (beginning)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("to cursor position (beginning)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << 5 << 0
+ << standard.at(0).mid(5)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("to cursor position (end)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << standard.at(0).length() << standard.at(0).length()
+ << standard.at(0).length() << standard.at(0).length() - 5
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5
+ << false << true;
+
+ QTest::newRow("to cursor position (end)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << standard.at(0).length() << standard.at(0).length()
+ << standard.at(0).length() - 5 << standard.at(0).length()
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5
+ << false << true;
+
+ QTest::newRow("from cursor position (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << 18
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 18 << 18 << 18
+ << false << false;
+
+ QTest::newRow("to cursor position (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 23 << 23
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 18 << 18 << 18
+ << false << true;
+
+ QTest::newRow("after cursor position (beginning)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("before cursor position (end)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << standard.at(0).length() << standard.at(0).length()
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5
+ << false << true;
+
+ QTest::newRow("before cursor position (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 23 << 23
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 18 << 18 << 18
+ << false << true;
+
+ QTest::newRow("after cursor position (middle)")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 18 << 18
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 18 << 18 << 18
+ << false << false;
+
+ QTest::newRow("before selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 14 << 19
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 9 << 14 << 14
+ << false << true;
+
+ QTest::newRow("before reversed selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 19 << 14
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 9 << 14 << 9
+ << false << true;
+
+ QTest::newRow("after selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 14 << 19
+ << standard.at(0).length() - 5 << standard.at(0).length()
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << 14 << 19 << 19
+ << false << false;
+
+ QTest::newRow("after reversed selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 19 << 14
+ << standard.at(0).length() - 5 << standard.at(0).length()
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << 14 << 19 << 14
+ << false << false;
+
+ QTest::newRow("from selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 14 << 24
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 14 << 19 << 19
+ << true << true;
+
+ QTest::newRow("from reversed selection")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 24 << 14
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 14 << 19 << 14
+ << true << false;
+
+ QTest::newRow("plain text cropped beginning")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << -3 << 4
+ << standard.at(0).mid(4)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("plain text cropped end")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << 23 << standard.at(0).length() + 8
+ << standard.at(0).mid(0, 23)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("plain text cropped beginning and end")
+ << standard.at(0) << QQuickTextEdit::PlainText
+ << 0 << 0
+ << -9 << standard.at(0).length() + 4
+ << QString()
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("all rich text")
+ << richBoldText << QQuickTextEdit::RichText
+ << 0 << 0
+ << 0 << plainBoldText.length()
+ << QString()
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("rick text sub string")
+ << richBoldText << QQuickTextEdit::RichText
+ << 0 << 0
+ << 14 << 21
+ << plainBoldText.mid(0, 14) + plainBoldText.mid(21)
+ << 0 << 0 << 0
+ << false << false;
+}
+
+void tst_qquicktextedit::remove()
+{
+ QFETCH(QString, text);
+ QFETCH(QQuickTextEdit::TextFormat, textFormat);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(int, removeStart);
+ QFETCH(int, removeEnd);
+ QFETCH(QString, expectedText);
+ QFETCH(int, expectedSelectionStart);
+ QFETCH(int, expectedSelectionEnd);
+ QFETCH(int, expectedCursorPosition);
+ QFETCH(bool, selectionChanged);
+ QFETCH(bool, cursorPositionChanged);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { text: \"" + text + "\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ textEdit->setTextFormat(textFormat);
+ textEdit->select(selectionStart, selectionEnd);
+
+ QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged()));
+ QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged()));
+ QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged()));
+ QSignalSpy textSpy(textEdit, SIGNAL(textChanged()));
+ QSignalSpy cursorPositionSpy(textEdit, SIGNAL(cursorPositionChanged()));
+
+ textEdit->remove(removeStart, removeEnd);
+
+ if (textFormat == QQuickTextEdit::RichText
+ || (textFormat == QQuickTextEdit::AutoText && Qt::mightBeRichText(text))) {
+ QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText);
+ } else {
+ QCOMPARE(textEdit->text(), expectedText);
+ }
+ QCOMPARE(textEdit->length(), expectedText.length());
+
+ if (selectionStart > selectionEnd) //
+ qSwap(selectionStart, selectionEnd);
+
+ QCOMPARE(textEdit->selectionStart(), expectedSelectionStart);
+ QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd);
+ QCOMPARE(textEdit->cursorPosition(), expectedCursorPosition);
+
+ QEXPECT_FAIL("from selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue);
+ QEXPECT_FAIL("from reversed selection", "selectedTextChanged signal isn't emitted on edits within selection", Continue);
+ QCOMPARE(selectionSpy.count() > 0, selectionChanged);
+ QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart);
+ QEXPECT_FAIL("from reversed selection", "selectionEndChanged signal not emitted", Continue);
+ QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd);
+ QCOMPARE(textSpy.count() > 0, text != expectedText);
+
+
+ if (cursorPositionChanged) //
+ QVERIFY(cursorPositionSpy.count() > 0);
+}
+
+
+void tst_qquicktextedit::keySequence_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QKeySequence>("sequence");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<QString>("selectedText");
+ QTest::addColumn<Qt::Key>("layoutDirection");
+
+ // standard[0] == "the [4]quick [10]brown [16]fox [20]jumped [27]over [32]the [36]lazy [41]dog"
+
+ QTest::newRow("select all")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectAll) << 0 << 0
+ << 44 << standard.at(0) << standard.at(0)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select start of line")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectStartOfLine) << 5 << 5
+ << 0 << standard.at(0) << standard.at(0).mid(0, 5)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select start of block")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectStartOfBlock) << 5 << 5
+ << 0 << standard.at(0) << standard.at(0).mid(0, 5)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select end of line")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectEndOfLine) << 5 << 5
+ << 44 << standard.at(0) << standard.at(0).mid(5)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select end of document")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectEndOfDocument) << 3 << 3
+ << 44 << standard.at(0) << standard.at(0).mid(3)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select end of block")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectEndOfBlock) << 18 << 18
+ << 44 << standard.at(0) << standard.at(0).mid(18)
+ << Qt::Key_Direction_L;
+ QTest::newRow("delete end of line")
+ << standard.at(0) << QKeySequence(QKeySequence::DeleteEndOfLine) << 24 << 24
+ << 24 << standard.at(0).mid(0, 24) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("move to start of line")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToStartOfLine) << 31 << 31
+ << 0 << standard.at(0) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("move to start of block")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToStartOfBlock) << 25 << 25
+ << 0 << standard.at(0) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("move to next char")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextChar) << 12 << 12
+ << 13 << standard.at(0) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("move to previous char (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousChar) << 3 << 3
+ << 2 << standard.at(0) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("move to previous char (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousChar) << 3 << 3
+ << 4 << standard.at(0) << QString()
+ << Qt::Key_Direction_R;
+ QTest::newRow("move to previous char with selection")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousChar) << 3 << 7
+ << 3 << standard.at(0) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("select next char (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectNextChar) << 23 << 23
+ << 24 << standard.at(0) << standard.at(0).mid(23, 1)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select next char (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectNextChar) << 23 << 23
+ << 22 << standard.at(0) << standard.at(0).mid(22, 1)
+ << Qt::Key_Direction_R;
+ QTest::newRow("select previous char (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectPreviousChar) << 19 << 19
+ << 18 << standard.at(0) << standard.at(0).mid(18, 1)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select previous char (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectPreviousChar) << 19 << 19
+ << 20 << standard.at(0) << standard.at(0).mid(19, 1)
+ << Qt::Key_Direction_R;
+ QTest::newRow("move to next word (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextWord) << 7 << 7
+ << 10 << standard.at(0) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("move to next word (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextWord) << 7 << 7
+ << 4 << standard.at(0) << QString()
+ << Qt::Key_Direction_R;
+ QTest::newRow("move to previous word (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousWord) << 7 << 7
+ << 4 << standard.at(0) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("move to previous word (rlt)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousWord) << 7 << 7
+ << 10 << standard.at(0) << QString()
+ << Qt::Key_Direction_R;
+ QTest::newRow("select next word")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectNextWord) << 11 << 11
+ << 16 << standard.at(0) << standard.at(0).mid(11, 5)
+ << Qt::Key_Direction_L;
+ QTest::newRow("select previous word")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectPreviousWord) << 11 << 11
+ << 10 << standard.at(0) << standard.at(0).mid(10, 1)
+ << Qt::Key_Direction_L;
+ QTest::newRow("delete (selection)")
+ << standard.at(0) << QKeySequence(QKeySequence::Delete) << 12 << 15
+ << 12 << (standard.at(0).mid(0, 12) + standard.at(0).mid(15)) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("delete (no selection)")
+ << standard.at(0) << QKeySequence(QKeySequence::Delete) << 15 << 15
+ << 15 << (standard.at(0).mid(0, 15) + standard.at(0).mid(16)) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("delete end of word")
+ << standard.at(0) << QKeySequence(QKeySequence::DeleteEndOfWord) << 24 << 24
+ << 24 << (standard.at(0).mid(0, 24) + standard.at(0).mid(27)) << QString()
+ << Qt::Key_Direction_L;
+ QTest::newRow("delete start of word")
+ << standard.at(0) << QKeySequence(QKeySequence::DeleteStartOfWord) << 7 << 7
+ << 4 << (standard.at(0).mid(0, 4) + standard.at(0).mid(7)) << QString()
+ << Qt::Key_Direction_L;
+}
+
+void tst_qquicktextedit::keySequence()
+{
+ QFETCH(QString, text);
+ QFETCH(QKeySequence, sequence);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(int, cursorPosition);
+ QFETCH(QString, expectedText);
+ QFETCH(QString, selectedText);
+ QFETCH(Qt::Key, layoutDirection);
+
+ if (sequence.isEmpty()) {
+ QSKIP("Key sequence is undefined");
+ }
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { focus: true; text: \"" + text + "\" }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ QQuickWindow window;
+ textEdit->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(textEdit->hasActiveFocus());
+
+ simulateKey(&window, layoutDirection);
+
+ textEdit->select(selectionStart, selectionEnd);
+
+ simulateKeys(&window, sequence);
+
+ QCOMPARE(textEdit->cursorPosition(), cursorPosition);
+ QCOMPARE(textEdit->text(), expectedText);
+ QCOMPARE(textEdit->selectedText(), selectedText);
+}
+
+#define NORMAL 0
+#define REPLACE_UNTIL_END 1
+
+void tst_qquicktextedit::undo_data()
+{
+ QTest::addColumn<QStringList>("insertString");
+ QTest::addColumn<IntList>("insertIndex");
+ QTest::addColumn<IntList>("insertMode");
+ QTest::addColumn<QStringList>("expectedString");
+ QTest::addColumn<bool>("use_keys");
+
+ for (int i=0; i<2; i++) {
+ QString keys_str = "keyboard";
+ bool use_keys = true;
+ if (i==0) {
+ keys_str = "insert";
+ use_keys = false;
+ }
+
+ {
+ IntList insertIndex;
+ IntList insertMode;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "1";
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "5";
+
+ insertIndex << 1;
+ insertMode << NORMAL;
+ insertString << "3";
+
+ insertIndex << 1;
+ insertMode << NORMAL;
+ insertString << "2";
+
+ insertIndex << 3;
+ insertMode << NORMAL;
+ insertString << "4";
+
+ expectedString << "12345";
+ expectedString << "1235";
+ expectedString << "135";
+ expectedString << "15";
+ expectedString << "";
+
+ QTest::newRow(QString(keys_str + "_numbers").toLatin1()) <<
+ insertString <<
+ insertIndex <<
+ insertMode <<
+ expectedString <<
+ bool(use_keys);
+ }
+ {
+ IntList insertIndex;
+ IntList insertMode;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "World"; // World
+
+ insertIndex << 0;
+ insertMode << NORMAL;
+ insertString << "Hello"; // HelloWorld
+
+ insertIndex << 0;
+ insertMode << NORMAL;
+ insertString << "Well"; // WellHelloWorld
+
+ insertIndex << 9;
+ insertMode << NORMAL;
+ insertString << "There"; // WellHelloThereWorld;
+
+ expectedString << "WellHelloThereWorld";
+ expectedString << "WellHelloWorld";
+ expectedString << "HelloWorld";
+ expectedString << "World";
+ expectedString << "";
+
+ QTest::newRow(QString(keys_str + "_helloworld").toLatin1()) <<
+ insertString <<
+ insertIndex <<
+ insertMode <<
+ expectedString <<
+ bool(use_keys);
+ }
+ {
+ IntList insertIndex;
+ IntList insertMode;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "Ensuring";
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << " instan";
+
+ insertIndex << 9;
+ insertMode << NORMAL;
+ insertString << "an ";
+
+ insertIndex << 10;
+ insertMode << REPLACE_UNTIL_END;
+ insertString << " unique instance.";
+
+ expectedString << "Ensuring a unique instance.";
+ expectedString << "Ensuring a "; // ### Not present in TextEdit.
+ expectedString << "Ensuring an instan";
+ expectedString << "Ensuring instan";
+ expectedString << "";
+
+ QTest::newRow(QString(keys_str + "_patterns").toLatin1()) <<
+ insertString <<
+ insertIndex <<
+ insertMode <<
+ expectedString <<
+ bool(use_keys);
+ }
+ }
+}
+
+void tst_qquicktextedit::undo()
+{
+ QFETCH(QStringList, insertString);
+ QFETCH(IntList, insertIndex);
+ QFETCH(IntList, insertMode);
+ QFETCH(QStringList, expectedString);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { focus: true }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ QQuickWindow window;
+ textEdit->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(textEdit->hasActiveFocus());
+ QVERIFY(!textEdit->canUndo());
+
+ QSignalSpy spy(textEdit, SIGNAL(canUndoChanged()));
+
+ int i;
+
+// STEP 1: First build up an undo history by inserting or typing some strings...
+ for (i = 0; i < insertString.size(); ++i) {
+ if (insertIndex[i] > -1)
+ textEdit->setCursorPosition(insertIndex[i]);
+
+ // experimental stuff
+ if (insertMode[i] == REPLACE_UNTIL_END) {
+ textEdit->select(insertIndex[i], insertIndex[i] + 8);
+
+ // This is what I actually want...
+ // QTest::keyClick(testWidget, Qt::Key_End, Qt::ShiftModifier);
+ }
+
+ for (int j = 0; j < insertString.at(i).length(); j++)
+ QTest::keyClick(&window, insertString.at(i).at(j).toLatin1());
+ }
+
+ QCOMPARE(spy.count(), 1);
+
+// STEP 2: Next call undo several times and see if we can restore to the previous state
+ for (i = 0; i < expectedString.size() - 1; ++i) {
+ QCOMPARE(textEdit->text(), expectedString[i]);
+ QVERIFY(textEdit->canUndo());
+ textEdit->undo();
+ }
+
+// STEP 3: Verify that we have undone everything
+ QVERIFY(textEdit->text().isEmpty());
+ QVERIFY(!textEdit->canUndo());
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextedit::redo_data()
+{
+ QTest::addColumn<QStringList>("insertString");
+ QTest::addColumn<IntList>("insertIndex");
+ QTest::addColumn<QStringList>("expectedString");
+
+ {
+ IntList insertIndex;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertString << "World"; // World
+ insertIndex << 0;
+ insertString << "Hello"; // HelloWorld
+ insertIndex << 0;
+ insertString << "Well"; // WellHelloWorld
+ insertIndex << 9;
+ insertString << "There"; // WellHelloThereWorld;
+
+ expectedString << "World";
+ expectedString << "HelloWorld";
+ expectedString << "WellHelloWorld";
+ expectedString << "WellHelloThereWorld";
+
+ QTest::newRow("Inserts and setting cursor") << insertString << insertIndex << expectedString;
+ }
+}
+
+void tst_qquicktextedit::redo()
+{
+ QFETCH(QStringList, insertString);
+ QFETCH(IntList, insertIndex);
+ QFETCH(QStringList, expectedString);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { focus: true }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ QQuickWindow window;
+ textEdit->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textEdit->hasActiveFocus());
+
+ QVERIFY(!textEdit->canUndo());
+ QVERIFY(!textEdit->canRedo());
+
+ QSignalSpy spy(textEdit, SIGNAL(canRedoChanged()));
+
+ int i;
+ // inserts the diff strings at diff positions
+ for (i = 0; i < insertString.size(); ++i) {
+ if (insertIndex[i] > -1)
+ textEdit->setCursorPosition(insertIndex[i]);
+ for (int j = 0; j < insertString.at(i).length(); j++)
+ QTest::keyClick(&window, insertString.at(i).at(j).toLatin1());
+ QVERIFY(textEdit->canUndo());
+ QVERIFY(!textEdit->canRedo());
+ }
+
+ QCOMPARE(spy.count(), 0);
+
+ // undo everything
+ while (!textEdit->text().isEmpty()) {
+ QVERIFY(textEdit->canUndo());
+ textEdit->undo();
+ QVERIFY(textEdit->canRedo());
+ }
+
+ QCOMPARE(spy.count(), 1);
+
+ for (i = 0; i < expectedString.size(); ++i) {
+ QVERIFY(textEdit->canRedo());
+ textEdit->redo();
+ QCOMPARE(textEdit->text() , expectedString[i]);
+ QVERIFY(textEdit->canUndo());
+ }
+ QVERIFY(!textEdit->canRedo());
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextedit::undo_keypressevents_data()
+{
+ QTest::addColumn<KeyList>("keys");
+ QTest::addColumn<QStringList>("expectedString");
+
+ {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "AFRAID"
+ << Qt::Key_Home
+ << "VERY"
+ << Qt::Key_Left
+ << Qt::Key_Left
+ << Qt::Key_Left
+ << Qt::Key_Left
+ << "BE"
+ << Qt::Key_End
+ << "!";
+
+ expectedString << "BEVERYAFRAID!";
+ expectedString << "BEVERYAFRAID";
+ expectedString << "VERYAFRAID";
+ expectedString << "AFRAID";
+
+ QTest::newRow("Inserts and moving cursor") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting '1234'
+ keys << "1234" << Qt::Key_Home
+ // skipping '12'
+ << Qt::Key_Right << Qt::Key_Right
+ // selecting '34'
+ << (Qt::Key_Right | Qt::ShiftModifier) << (Qt::Key_Right | Qt::ShiftModifier)
+ // deleting '34'
+ << Qt::Key_Delete;
+
+ expectedString << "12";
+ expectedString << "1234";
+
+ QTest::newRow("Inserts,moving,selection and delete") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting 'AB12'
+ keys << "AB12"
+ << Qt::Key_Home
+ // selecting 'AB'
+ << (Qt::Key_Right | Qt::ShiftModifier) << (Qt::Key_Right | Qt::ShiftModifier)
+ << Qt::Key_Delete
+ << QKeySequence::Undo
+ // ### Text is selected in text input
+// << Qt::Key_Right
+ << (Qt::Key_Right | Qt::ShiftModifier) << (Qt::Key_Right | Qt::ShiftModifier)
+ << Qt::Key_Delete;
+
+ expectedString << "AB";
+ expectedString << "AB12";
+
+ QTest::newRow("Inserts,moving,selection, delete and undo") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting 'ABCD'
+ keys << "abcd"
+ //move left two
+ << Qt::Key_Left << Qt::Key_Left
+ // inserting '1234'
+ << "1234"
+ // selecting '1234'
+ << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier)
+ // overwriting '1234' with '5'
+ << "5"
+ // undoing deletion of 'AB'
+ << QKeySequence::Undo
+ // ### Text is selected in text input
+ << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier)
+ // overwriting '1234' with '6'
+ << "6";
+
+ expectedString << "ab6cd";
+ // for versions previous to 3.2 we overwrite needed two undo operations
+ expectedString << "ab1234cd";
+ expectedString << "abcd";
+
+ QTest::newRow("Inserts,moving,selection and undo, removing selection") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting 'ABC'
+ keys << "ABC"
+ // removes 'C'
+ << Qt::Key_Backspace;
+
+ expectedString << "AB";
+ expectedString << "ABC";
+
+ QTest::newRow("Inserts,backspace") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "ABC"
+ // removes 'C'
+ << Qt::Key_Backspace
+ // inserting 'Z'
+ << "Z";
+
+ expectedString << "ABZ";
+ expectedString << "AB";
+ expectedString << "ABC";
+
+ QTest::newRow("Inserts,backspace,inserts") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting '123'
+ keys << "123" << Qt::Key_Home
+ // selecting '123'
+ << (Qt::Key_End | Qt::ShiftModifier)
+ // overwriting '123' with 'ABC'
+ << "ABC";
+
+ expectedString << "ABC";
+ // ### One operation in TextEdit.
+ expectedString << "A";
+ expectedString << "123";
+
+ QTest::newRow("Inserts,moving,selection and overwriting") << keys << expectedString;
+ }
+
+ bool canCopyPaste = PlatformQuirks::isClipboardAvailable();
+
+ if (canCopyPaste) {
+ KeyList keys;
+ keys << "123"
+ << QKeySequence(QKeySequence::SelectStartOfLine)
+ << QKeySequence(QKeySequence::Cut)
+ << "ABC"
+ << QKeySequence(QKeySequence::Paste);
+ QStringList expectedString = QStringList()
+ << "ABC123"
+ << "ABC"
+ << ""
+ << "123";
+ QTest::newRow("Cut,paste") << keys << expectedString;
+ }
+ if (canCopyPaste) {
+ KeyList keys;
+ keys << "123"
+ << QKeySequence(QKeySequence::SelectStartOfLine)
+ << QKeySequence(QKeySequence::Copy)
+ << "ABC"
+ << QKeySequence(QKeySequence::Paste);
+ QStringList expectedString = QStringList()
+ << "ABC123"
+ << "ABC"
+ << "A"
+ << "123";
+ QTest::newRow("Copy,paste") << keys << expectedString;
+ }
+}
+
+void tst_qquicktextedit::undo_keypressevents()
+{
+ QFETCH(KeyList, keys);
+ QFETCH(QStringList, expectedString);
+
+ QString componentStr = "import QtQuick 2.0\nTextEdit { focus: true }";
+ QQmlComponent textEditComponent(&engine);
+ textEditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create());
+ QVERIFY(textEdit != 0);
+
+ QQuickWindow window;
+ textEdit->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textEdit->hasActiveFocus());
+
+ simulateKeys(&window, keys);
+
+ for (int i = 0; i < expectedString.size(); ++i) {
+ QCOMPARE(textEdit->text() , expectedString[i]);
+ textEdit->undo();
+ }
+ QVERIFY(textEdit->text().isEmpty());
+}
+
+void tst_qquicktextedit::baseUrl()
+{
+ QUrl localUrl("file:///tests/text.qml");
+ QUrl remoteUrl("http://qt.nokia.com/test.qml");
+
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\n TextEdit {}", localUrl);
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit *>(textComponent.create());
+
+ QCOMPARE(textObject->baseUrl(), localUrl);
+
+ QSignalSpy spy(textObject, SIGNAL(baseUrlChanged()));
+
+ textObject->setBaseUrl(localUrl);
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 0);
+
+ textObject->setBaseUrl(remoteUrl);
+ QCOMPARE(textObject->baseUrl(), remoteUrl);
+ QCOMPARE(spy.count(), 1);
+
+ textObject->resetBaseUrl();
+ QCOMPARE(textObject->baseUrl(), localUrl);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextedit::embeddedImages_data()
+{
+ QTest::addColumn<QUrl>("qmlfile");
+ QTest::addColumn<QString>("error");
+ QTest::newRow("local") << testFileUrl("embeddedImagesLocal.qml") << "";
+ QTest::newRow("local-error") << testFileUrl("embeddedImagesLocalError.qml")
+ << testFileUrl("embeddedImagesLocalError.qml").toString()+":3:1: QML TextEdit: Cannot open: " + testFileUrl("http/notexists.png").toString();
+ QTest::newRow("local") << testFileUrl("embeddedImagesLocalRelative.qml") << "";
+ QTest::newRow("remote") << testFileUrl("embeddedImagesRemote.qml") << "";
+ QTest::newRow("remote-error") << testFileUrl("embeddedImagesRemoteError.qml")
+ << testFileUrl("embeddedImagesRemoteError.qml").toString()+":3:1: QML TextEdit: Error downloading http://127.0.0.1:42332/notexists.png - server replied: Not found";
+ QTest::newRow("remote") << testFileUrl("embeddedImagesRemoteRelative.qml") << "";
+}
+
+void tst_qquicktextedit::embeddedImages()
+{
+ QFETCH(QUrl, qmlfile);
+ QFETCH(QString, error);
+
+ TestHTTPServer server(SERVER_PORT);
+ server.serveDirectory(testFile("http"));
+
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toLatin1());
+
+ QQmlComponent textComponent(&engine, qmlfile);
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QTRY_COMPARE(QQuickTextEditPrivate::get(textObject)->document->resourcesLoading(), 0);
+
+ QPixmap pm(testFile("http/exists.png"));
+ if (error.isEmpty()) {
+ QCOMPARE(textObject->width(), double(pm.width()));
+ QCOMPARE(textObject->height(), double(pm.height()));
+ } else {
+ QVERIFY(16 != pm.width()); // check test is effective
+ QCOMPARE(textObject->width(), 16.0); // default size of QTextDocument broken image icon
+ QCOMPARE(textObject->height(), 16.0);
+ }
+
+ delete textObject;
+}
+
+void tst_qquicktextedit::emptytags_QTBUG_22058()
+{
+ QQuickView window(testFileUrl("qtbug-22058.qml"));
+ QVERIFY(window.rootObject() != 0);
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("inputField")));
+ QVERIFY(input->hasActiveFocus());
+
+ QInputMethodEvent event("", QList<QInputMethodEvent::Attribute>());
+ event.setCommitString("<b>Bold<");
+ QGuiApplication::sendEvent(input, &event);
+ QCOMPARE(input->text(), QString("<b>Bold<"));
+ event.setCommitString(">");
+ QGuiApplication::sendEvent(input, &event);
+ QCOMPARE(input->text(), QString("<b>Bold<>"));
+}
+
+QTEST_MAIN(tst_qquicktextedit)
+
+#include "tst_qquicktextedit.moc"
diff --git a/tests/auto/quick/qquicktextinput/data/Cursor.qml b/tests/auto/quick/qquicktextinput/data/Cursor.qml
new file mode 100644
index 0000000000..e5c1853fc5
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/Cursor.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Rectangle {
+ property string localProperty
+}
diff --git a/tests/auto/quick/qquicktextinput/data/RemoteCursor.qml b/tests/auto/quick/qquicktextinput/data/RemoteCursor.qml
new file mode 100644
index 0000000000..7f459f5cc4
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/RemoteCursor.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "cursorInstance"
+}
diff --git a/tests/auto/quick/qquicktextinput/data/cursorTest.qml b/tests/auto/quick/qquicktextinput/data/cursorTest.qml
new file mode 100644
index 0000000000..363d37174b
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/cursorTest.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+Rectangle { id:rect; width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextInput { text: "Hello world!"; id: textInputObject; objectName: "textInputObject"
+ width: 300; height: 300
+ resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance"; property string localProperty: contextualProperty } } ]
+ cursorDelegate: cursor
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml b/tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml
new file mode 100644
index 0000000000..31ee01db99
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextInput {
+ text: "Hello world!"
+ id: textInputObject;
+ objectName: "textInputObject"
+ width: 300; height: 300
+ wrapMode: TextInput.Wrap
+ cursorDelegate: Cursor {
+ id:cursorInstance;
+ objectName: "cursorInstance";
+ localProperty: contextualProperty;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/cursorTestInline.qml b/tests/auto/quick/qquicktextinput/data/cursorTestInline.qml
new file mode 100644
index 0000000000..b699ed2752
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/cursorTestInline.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextInput {
+ text: "Hello world!"
+ id: textInputObject
+ objectName: "textInputObject"
+ width: 300; height: 300
+ wrapMode: TextInput.WordWrap
+ cursorDelegate: Item {
+ id:cursorInstance
+ objectName: "cursorInstance"
+ property string localProperty: contextualProperty
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/cursorTestRemote.qml b/tests/auto/quick/qquicktextinput/data/cursorTestRemote.qml
new file mode 100644
index 0000000000..8ae872a714
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/cursorTestRemote.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ TextInput {
+ text: "Hello world!"
+ id: textInputObject;
+ objectName: "textInputObject"
+ width: 300; height: 300
+ wrapMode: TextInput.Wrap
+ cursorDelegate: contextDelegate
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/cursorVisible.qml b/tests/auto/quick/qquicktextinput/data/cursorVisible.qml
new file mode 100644
index 0000000000..49e9386947
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/cursorVisible.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.0
+
+Item {
+ width: 100
+ height: 20
+}
diff --git a/tests/auto/quick/qquicktextinput/data/echoMode.qml b/tests/auto/quick/qquicktextinput/data/echoMode.qml
new file mode 100644
index 0000000000..94e0a0e3a7
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/echoMode.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ property QtObject myInput: input
+
+ width: 400; height: 200; color: "green"
+
+ TextInput { id: input; focus: true
+ width: 400; height: 200
+ text: "ABCDefgh"
+ cursorDelegate: Rectangle {
+ objectName: "cursor"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/geometrySignals.qml b/tests/auto/quick/qquicktextinput/data/geometrySignals.qml
new file mode 100644
index 0000000000..90855a61cf
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/geometrySignals.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ width: 400; height: 500;
+ property int bindingWidth: text.width
+ property int bindingHeight: text.height
+
+ TextEdit {
+ id: text
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/horizontalAlignment.qml b/tests/auto/quick/qquicktextinput/data/horizontalAlignment.qml
new file mode 100644
index 0000000000..89934532e3
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/horizontalAlignment.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: top
+ width: 70; height: 70;
+
+ property alias horizontalAlignment: text.horizontalAlignment
+ property string text: "Test"
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 60
+ height: 60
+ color: "green"
+
+ TextInput {
+ objectName: "text"
+ id: text
+ anchors.fill: parent
+ text: top.text
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/horizontalAlignment_RightToLeft.qml b/tests/auto/quick/qquicktextinput/data/horizontalAlignment_RightToLeft.qml
new file mode 100644
index 0000000000..cf092509b4
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/horizontalAlignment_RightToLeft.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: top
+ width: 200; height: 70;
+
+ property alias horizontalAlignment: text.horizontalAlignment
+ property string text: "اختبا"
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 180
+ height: 20
+ color: "green"
+
+ TextInput {
+ id: text
+ objectName: "text"
+ anchors.left: parent.left
+ anchors.top: parent.top
+ width: 180
+ text: top.text
+ focus: true
+
+ cursorDelegate: Rectangle { }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/inputContext.qml b/tests/auto/quick/qquicktextinput/data/inputContext.qml
new file mode 100644
index 0000000000..dfc80990c6
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/inputContext.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextInput {
+ width: 200
+ text: "supercalifra"
+ focus: true
+ cursorPosition: 12
+}
diff --git a/tests/auto/quick/qquicktextinput/data/inputMethodEvent.qml b/tests/auto/quick/qquicktextinput/data/inputMethodEvent.qml
new file mode 100644
index 0000000000..9e04620d8f
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/inputMethodEvent.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+TextInput {
+ width: 300
+ focus: true
+ autoScroll: false
+
+ cursorDelegate: Item { objectName: "cursor" }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/inputmethods.qml b/tests/auto/quick/qquicktextinput/data/inputmethods.qml
new file mode 100644
index 0000000000..711e89144c
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/inputmethods.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextInput {
+ text: "Hello world!"
+ inputMethodHints: Qt.ImhNoPredictiveText
+ Keys.onLeftPressed: {}
+}
diff --git a/tests/auto/quick/qquicktextinput/data/masks.qml b/tests/auto/quick/qquicktextinput/data/masks.qml
new file mode 100644
index 0000000000..589b6a3c15
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/masks.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextInput{
+ focus: true
+ objectName: "myInput"
+ inputMask: "HHHHhhhh; "
+}
diff --git a/tests/auto/quick/qquicktextinput/data/maxLength.qml b/tests/auto/quick/qquicktextinput/data/maxLength.qml
new file mode 100644
index 0000000000..cca537ed6b
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/maxLength.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextInput{
+ focus: true
+ objectName: "myInput"
+ maximumLength: 10
+}
diff --git a/tests/auto/quick/qquicktextinput/data/mouseselection_true.qml b/tests/auto/quick/qquicktextinput/data/mouseselection_true.qml
new file mode 100644
index 0000000000..974041b04a
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/mouseselection_true.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+}
diff --git a/tests/auto/quick/qquicktextinput/data/mouseselectionmode_characters.qml b/tests/auto/quick/qquicktextinput/data/mouseselectionmode_characters.qml
new file mode 100644
index 0000000000..f7c658b618
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/mouseselectionmode_characters.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+ mouseSelectionMode: TextInput.SelectCharacters
+}
diff --git a/tests/auto/quick/qquicktextinput/data/mouseselectionmode_default.qml b/tests/auto/quick/qquicktextinput/data/mouseselectionmode_default.qml
new file mode 100644
index 0000000000..974041b04a
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/mouseselectionmode_default.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+}
diff --git a/tests/auto/quick/qquicktextinput/data/mouseselectionmode_words.qml b/tests/auto/quick/qquicktextinput/data/mouseselectionmode_words.qml
new file mode 100644
index 0000000000..20e777e470
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/mouseselectionmode_words.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextInput {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+ mouseSelectionMode: TextInput.SelectWords
+}
diff --git a/tests/auto/quick/qquicktextinput/data/navigation.qml b/tests/auto/quick/qquicktextinput/data/navigation.qml
new file mode 100644
index 0000000000..3a7d07b3c7
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/navigation.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ property variant myInput: input
+
+ width: 800; height: 600; color: "blue"
+
+ Item {
+ id: firstItem;
+ KeyNavigation.right: input
+ }
+
+ TextInput { id: input; focus: true
+ text: "Needs some text"
+ KeyNavigation.left: firstItem
+ KeyNavigation.right: lastItem
+ KeyNavigation.up: firstItem
+ KeyNavigation.down: lastItem
+ }
+ Item {
+ id: lastItem
+ KeyNavigation.left: input
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/negativeDimensions.qml b/tests/auto/quick/qquicktextinput/data/negativeDimensions.qml
new file mode 100644
index 0000000000..7a58c85b1d
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/negativeDimensions.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ TextInput {
+ objectName: "input"
+
+ focus: true
+ width: -1
+ height: -1
+ text: "sushi"
+
+ anchors {
+ left: parent.left;
+ leftMargin: 5
+ top: parent.top
+ topMargin: font.pixelSize
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/openInputPanel.qml b/tests/auto/quick/qquicktextinput/data/openInputPanel.qml
new file mode 100644
index 0000000000..ca5cb263aa
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/openInputPanel.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextInput {
+ width: 100; height: 100
+ text: "Hello world"
+ focus: false
+}
diff --git a/tests/auto/quick/qquicktextinput/data/persistentSelection.qml b/tests/auto/quick/qquicktextinput/data/persistentSelection.qml
new file mode 100644
index 0000000000..dea6e48b08
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/persistentSelection.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+TextInput {
+ property string selected: selectedText
+
+ text: "Hello World!"
+ focus: true
+}
diff --git a/tests/auto/quick/qquicktextinput/data/positionAt.qml b/tests/auto/quick/qquicktextinput/data/positionAt.qml
new file mode 100644
index 0000000000..edb4744107
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/positionAt.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+TextInput{
+ focus: true
+ objectName: "myInput"
+ width: 50
+ height: 100
+ text: "AAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+}
diff --git a/tests/auto/quick/qquicktextinput/data/preeditAutoScroll.qml b/tests/auto/quick/qquicktextinput/data/preeditAutoScroll.qml
new file mode 100644
index 0000000000..9d98a2e220
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/preeditAutoScroll.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.0
+
+TextInput {
+ focus: true
+ text: "super"
+ autoScroll: true
+}
diff --git a/tests/auto/quick/qquicktextinput/data/qtbug-19956double.qml b/tests/auto/quick/qquicktextinput/data/qtbug-19956double.qml
new file mode 100644
index 0000000000..e9b80fceb2
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/qtbug-19956double.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+TextInput {
+ id: textinput
+ property real topvalue: 30
+ property real bottomvalue: 10
+ height: 50
+ width: 200
+ text: "20"
+ validator: DoubleValidator {
+ id: doublevalidator
+ bottom: bottomvalue
+ top: topvalue
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/qtbug-19956int.qml b/tests/auto/quick/qquicktextinput/data/qtbug-19956int.qml
new file mode 100644
index 0000000000..0d70eedb80
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/qtbug-19956int.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+TextInput {
+ id: textinput
+ property real topvalue: 30
+ property real bottomvalue: 10
+ height: 50
+ width: 200
+ text: "20"
+ validator: IntValidator {
+ id: intvalidator
+ bottom: bottomvalue
+ top: topvalue
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/qtbug-19956regexp.qml b/tests/auto/quick/qquicktextinput/data/qtbug-19956regexp.qml
new file mode 100644
index 0000000000..b5af13cc4c
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/qtbug-19956regexp.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+TextInput {
+ id: textinput
+ property variant regexvalue
+ height: 50
+ width: 200
+ text: "abc"
+ validator: RegExpValidator {
+ id: regexpvalidator
+ regExp: regexvalue
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/readOnly.qml b/tests/auto/quick/qquicktextinput/data/readOnly.qml
new file mode 100644
index 0000000000..9cda7fbd1d
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/readOnly.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ property variant myInput: input
+
+ width: 800; height: 600; color: "blue"
+
+ TextInput { id: input; focus: true
+ readOnly: true
+ text: "I am the very model of a modern major general.\n"
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/data/validators.qml b/tests/auto/quick/qquicktextinput/data/validators.qml
new file mode 100644
index 0000000000..0ba87e0592
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/validators.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ property variant intInput: intInput
+ property variant dblInput: dblInput
+ property variant strInput: strInput
+ property variant unvalidatedInput: unvalidatedInput
+
+ width: 800; height: 600;
+
+ Column{
+ TextInput { id: intInput;
+ property bool acceptable: acceptableInput
+ validator: IntValidator{top: 11; bottom: 2}
+ }
+ TextInput { id: dblInput;
+ property bool acceptable: acceptableInput
+ validator: DoubleValidator{top: 12.12; bottom: 2.93; decimals: 2; notation: DoubleValidator.StandardNotation}
+ }
+ TextInput { id: strInput;
+ property bool acceptable: acceptableInput
+ validator: RegExpValidator { regExp: /[a-zA-z]{2,4}/ }
+ }
+ TextInput { id: unvalidatedInput
+ property bool acceptable: acceptableInput
+ }
+ }
+
+}
diff --git a/tests/auto/quick/qquicktextinput/qquicktextinput.pro b/tests/auto/quick/qquicktextinput/qquicktextinput.pro
new file mode 100644
index 0000000000..3240d99e90
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/qquicktextinput.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qquicktextinput
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquicktextinput.cpp \
+ ../../shared/testhttpserver.cpp
+
+HEADERS += ../../shared/testhttpserver.h
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
new file mode 100644
index 0000000000..d1ed6dd05a
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -0,0 +1,6253 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include "../../shared/util.h"
+#include "../../shared/testhttpserver.h"
+#include <private/qinputmethod_p.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlexpression.h>
+#include <QFile>
+#include <QtQuick/qquickview.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qstylehints.h>
+#include <QInputMethod>
+#include <private/qquicktextinput_p.h>
+#include <private/qquicktextinput_p_p.h>
+#include <QDebug>
+#include <QDir>
+#include <math.h>
+
+#ifdef Q_OS_MAC
+#include <Carbon/Carbon.h>
+#endif
+
+#include "qplatformdefs.h"
+#include "../../shared/platformquirks.h"
+#include "../../shared/platforminputcontext.h"
+
+#define SERVER_PORT 14460
+#define SERVER_ADDR "http://localhost:14460"
+
+Q_DECLARE_METATYPE(QQuickTextInput::SelectionMode)
+Q_DECLARE_METATYPE(QQuickTextInput::EchoMode)
+Q_DECLARE_METATYPE(Qt::Key)
+
+DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
+
+QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
+{
+ // XXX This will be replaced by some clever persistent platform image store.
+ QString persistent_dir = QQmlDataTest::instance()->dataDirectory();
+ QString arch = "unknown-architecture"; // QTest needs to help with this.
+
+ QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png";
+
+ if (!QFile::exists(expectfile)) {
+ actual.save(expectfile);
+ qWarning() << "created" << expectfile;
+ }
+
+ return expectfile;
+}
+
+template <typename T> static T evaluate(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ T result = expr.evaluate().value<T>();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+ return result;
+}
+
+template<typename T, int N> int lengthOf(const T (&)[N]) { return N; }
+
+typedef QPair<int, QChar> Key;
+
+class tst_qquicktextinput : public QQmlDataTest
+
+{
+ Q_OBJECT
+public:
+ tst_qquicktextinput();
+
+private slots:
+ void cleanup();
+ void text();
+ void width();
+ void font();
+ void color();
+ void wrap();
+ void selection();
+ void persistentSelection();
+ void isRightToLeft_data();
+ void isRightToLeft();
+ void moveCursorSelection_data();
+ void moveCursorSelection();
+ void moveCursorSelectionSequence_data();
+ void moveCursorSelectionSequence();
+ void dragMouseSelection();
+ void mouseSelectionMode_data();
+ void mouseSelectionMode();
+ void mouseSelectionMode_accessors();
+ void selectByMouse();
+ void renderType();
+ void tripleClickSelectsAll();
+
+ void horizontalAlignment_RightToLeft();
+ void verticalAlignment();
+
+ void clipRect();
+ void boundingRect();
+
+ void positionAt();
+
+ void maxLength();
+ void masks();
+ void validators();
+ void inputMethods();
+
+ void passwordCharacter();
+ void cursorDelegate_data();
+ void cursorDelegate();
+ void remoteCursorDelegate();
+ void cursorVisible();
+ void cursorRectangle_data();
+ void cursorRectangle();
+ void navigation();
+ void navigation_RTL();
+#ifndef QT_NO_CLIPBOARD
+ void copyAndPaste();
+ void copyAndPasteKeySequence();
+ void canPasteEmpty();
+ void canPaste();
+ void middleClickPaste();
+#endif
+ void readOnly();
+ void focusOnPress();
+
+ void openInputPanel();
+ void setHAlignClearCache();
+ void focusOutClearSelection();
+ void focusOutNotClearSelection();
+
+ void echoMode();
+ void passwordEchoDelay();
+ void geometrySignals();
+ void contentSize();
+
+ void preeditAutoScroll();
+ void preeditCursorRectangle();
+ void inputContextMouseHandler();
+ void inputMethodComposing();
+ void inputMethodUpdate();
+ void cursorRectangleSize();
+
+ void getText_data();
+ void getText();
+ void insert_data();
+ void insert();
+ void remove_data();
+ void remove();
+
+ void keySequence_data();
+ void keySequence();
+
+ void undo_data();
+ void undo();
+ void redo_data();
+ void redo();
+ void undo_keypressevents_data();
+ void undo_keypressevents();
+
+ void backspaceSurrogatePairs();
+
+ void QTBUG_19956();
+ void QTBUG_19956_data();
+ void QTBUG_19956_regexp();
+
+ void implicitSize_data();
+ void implicitSize();
+ void implicitSizeBinding_data();
+ void implicitSizeBinding();
+
+ void negativeDimensions();
+
+
+ void setInputMask_data();
+ void setInputMask();
+ void inputMask_data();
+ void inputMask();
+ void clearInputMask();
+ void keypress_inputMask_data();
+ void keypress_inputMask();
+ void hasAcceptableInputMask_data();
+ void hasAcceptableInputMask();
+ void maskCharacter_data();
+ void maskCharacter();
+
+private:
+ void simulateKey(QWindow *, int key);
+
+ void simulateKeys(QWindow *window, const QList<Key> &keys);
+ void simulateKeys(QWindow *window, const QKeySequence &sequence);
+
+ QQmlEngine engine;
+ QStringList standard;
+ QStringList colorStrings;
+};
+
+typedef QList<int> IntList;
+Q_DECLARE_METATYPE(IntList)
+
+typedef QList<Key> KeyList;
+Q_DECLARE_METATYPE(KeyList)
+
+void tst_qquicktextinput::simulateKeys(QWindow *window, const QList<Key> &keys)
+{
+ for (int i = 0; i < keys.count(); ++i) {
+ const int key = keys.at(i).first & ~Qt::KeyboardModifierMask;
+ const int modifiers = keys.at(i).first & Qt::KeyboardModifierMask;
+ const QString text = !keys.at(i).second.isNull() ? QString(keys.at(i).second) : QString();
+
+ QKeyEvent press(QEvent::KeyPress, Qt::Key(key), Qt::KeyboardModifiers(modifiers), text);
+ QKeyEvent release(QEvent::KeyRelease, Qt::Key(key), Qt::KeyboardModifiers(modifiers), text);
+
+ QGuiApplication::sendEvent(window, &press);
+ QGuiApplication::sendEvent(window, &release);
+ }
+}
+
+void tst_qquicktextinput::simulateKeys(QWindow *window, const QKeySequence &sequence)
+{
+ for (int i = 0; i < sequence.count(); ++i) {
+ const int key = sequence[i];
+ const int modifiers = key & Qt::KeyboardModifierMask;
+
+ QTest::keyClick(window, Qt::Key(key & ~modifiers), Qt::KeyboardModifiers(modifiers));
+ }
+}
+
+QList<Key> &operator <<(QList<Key> &keys, const QKeySequence &sequence)
+{
+ for (int i = 0; i < sequence.count(); ++i)
+ keys << Key(sequence[i], QChar());
+ return keys;
+}
+
+template <int N> QList<Key> &operator <<(QList<Key> &keys, const char (&characters)[N])
+{
+ for (int i = 0; i < N - 1; ++i) {
+ int key = QTest::asciiToKey(characters[i]);
+ QChar character = QLatin1Char(characters[i]);
+ keys << Key(key, character);
+ }
+ return keys;
+}
+
+QList<Key> &operator <<(QList<Key> &keys, Qt::Key key)
+{
+ keys << Key(key, QChar());
+ return keys;
+}
+
+void tst_qquicktextinput::cleanup()
+{
+ // ensure not even skipped tests with custom input context leave it dangling
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
+}
+
+tst_qquicktextinput::tst_qquicktextinput()
+{
+ standard << "the quick brown fox jumped over the lazy dog"
+ << "It's supercalifragisiticexpialidocious!"
+ << "Hello, world!"
+ << "!dlrow ,olleH"
+ << " spacey text ";
+
+ colorStrings << "aliceblue"
+ << "antiquewhite"
+ << "aqua"
+ << "darkkhaki"
+ << "darkolivegreen"
+ << "dimgray"
+ << "palevioletred"
+ << "lightsteelblue"
+ << "#000000"
+ << "#AAAAAA"
+ << "#FFFFFF"
+ << "#2AC05F";
+}
+
+void tst_qquicktextinput::text()
+{
+ {
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData("import QtQuick 2.0\nTextInput { text: \"\" }", QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->text(), QString(""));
+ QCOMPARE(textinputObject->length(), 0);
+
+ delete textinputObject;
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->text(), standard.at(i));
+ QCOMPARE(textinputObject->length(), standard.at(i).length());
+
+ delete textinputObject;
+ }
+
+}
+
+void tst_qquicktextinput::width()
+{
+ // uses Font metrics to find the width for standard
+ {
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData("import QtQuick 2.0\nTextInput { text: \"\" }", QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->width(), 0.0);
+
+ delete textinputObject;
+ }
+
+ bool requiresUnhintedMetrics = !qmlDisableDistanceField();
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QString s = standard.at(i);
+ s.replace(QLatin1Char('\n'), QChar::LineSeparator);
+
+ QTextLayout layout(s);
+ layout.setFont(textinputObject->font());
+ layout.setFlags(Qt::TextExpandTabs | Qt::TextShowMnemonic);
+ if (requiresUnhintedMetrics) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+
+ layout.beginLayout();
+ forever {
+ QTextLine line = layout.createLine();
+ if (!line.isValid())
+ break;
+ }
+
+ layout.endLayout();
+
+ qreal metricWidth = ceil(layout.boundingRect().width());
+
+ QVERIFY(textinputObject != 0);
+ int delta = abs(int(int(textinputObject->width()) - metricWidth));
+ QVERIFY(delta <= 3.0); // As best as we can hope for cross-platform.
+
+ delete textinputObject;
+ }
+}
+
+void tst_qquicktextinput::font()
+{
+ //test size, then bold, then italic, then family
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { font.pointSize: 40; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->font().pointSize(), 40);
+ QCOMPARE(textinputObject->font().bold(), false);
+ QCOMPARE(textinputObject->font().italic(), false);
+
+ delete textinputObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { font.bold: true; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->font().bold(), true);
+ QCOMPARE(textinputObject->font().italic(), false);
+
+ delete textinputObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { font.italic: true; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->font().italic(), true);
+ QCOMPARE(textinputObject->font().bold(), false);
+
+ delete textinputObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->font().family(), QString("Helvetica"));
+ QCOMPARE(textinputObject->font().bold(), false);
+ QCOMPARE(textinputObject->font().italic(), false);
+
+ delete textinputObject;
+ }
+
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { font.family: \"\"; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->font().family(), QString(""));
+
+ delete textinputObject;
+ }
+}
+
+void tst_qquicktextinput::color()
+{
+ //test initial color
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"Hello World\" }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QScopedPointer<QObject> object(texteditComponent.create());
+ QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput*>(object.data());
+
+ QVERIFY(textInputObject);
+ QCOMPARE(textInputObject->color(), QColor("black"));
+ QCOMPARE(textInputObject->selectionColor(), QColor::fromRgba(0xFF000080));
+ QCOMPARE(textInputObject->selectedTextColor(), QColor("white"));
+
+ QSignalSpy colorSpy(textInputObject, SIGNAL(colorChanged()));
+ QSignalSpy selectionColorSpy(textInputObject, SIGNAL(selectionColorChanged()));
+ QSignalSpy selectedTextColorSpy(textInputObject, SIGNAL(selectedTextColorChanged()));
+
+ textInputObject->setColor(QColor("white"));
+ QCOMPARE(textInputObject->color(), QColor("white"));
+ QCOMPARE(colorSpy.count(), 1);
+
+ textInputObject->setSelectionColor(QColor("black"));
+ QCOMPARE(textInputObject->selectionColor(), QColor("black"));
+ QCOMPARE(selectionColorSpy.count(), 1);
+
+ textInputObject->setSelectedTextColor(QColor("blue"));
+ QCOMPARE(textInputObject->selectedTextColor(), QColor("blue"));
+ QCOMPARE(selectedTextColorSpy.count(), 1);
+
+ textInputObject->setColor(QColor("white"));
+ QCOMPARE(colorSpy.count(), 1);
+
+ textInputObject->setSelectionColor(QColor("black"));
+ QCOMPARE(selectionColorSpy.count(), 1);
+
+ textInputObject->setSelectedTextColor(QColor("blue"));
+ QCOMPARE(selectedTextColorSpy.count(), 1);
+
+ textInputObject->setColor(QColor("black"));
+ QCOMPARE(textInputObject->color(), QColor("black"));
+ QCOMPARE(colorSpy.count(), 2);
+
+ textInputObject->setSelectionColor(QColor("blue"));
+ QCOMPARE(textInputObject->selectionColor(), QColor("blue"));
+ QCOMPARE(selectionColorSpy.count(), 2);
+
+ textInputObject->setSelectedTextColor(QColor("white"));
+ QCOMPARE(textInputObject->selectedTextColor(), QColor("white"));
+ QCOMPARE(selectedTextColorSpy.count(), 2);
+ }
+
+ //test color
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i)));
+
+ delete textinputObject;
+ }
+
+ //test selection color
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->selectionColor(), QColor(colorStrings.at(i)));
+
+ delete textinputObject;
+ }
+
+ //test selected text color
+ for (int i = 0; i < colorStrings.size(); i++)
+ {
+ QString componentStr = "import QtQuick 2.0\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->selectedTextColor(), QColor(colorStrings.at(i)));
+
+ delete textinputObject;
+ }
+
+ {
+ QString colorStr = "#AA001234";
+ QColor testColor("#001234");
+ testColor.setAlpha(170);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->color(), testColor);
+
+ delete textinputObject;
+ }
+}
+
+void tst_qquicktextinput::wrap()
+{
+ int textHeight = 0;
+ // for specified width and wrap set true
+ {
+ QQmlComponent textComponent(&engine);
+ textComponent.setData("import QtQuick 2.0\nTextInput { text: \"Hello\"; wrapMode: Text.WrapAnywhere; width: 300 }", QUrl::fromLocalFile(""));
+ QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create());
+ textHeight = textObject->height();
+
+ QVERIFY(textObject != 0);
+ QVERIFY(textObject->wrapMode() == QQuickTextInput::WrapAnywhere);
+ QCOMPARE(textObject->width(), 300.);
+
+ delete textObject;
+ }
+
+ for (int i = 0; i < standard.count(); i++) {
+ QString componentStr = "import QtQuick 2.0\nTextInput { wrapMode: Text.WrapAnywhere; width: 30; text: \"" + standard.at(i) + "\" }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->width(), 30.);
+ QVERIFY(textObject->height() > textHeight);
+
+ int oldHeight = textObject->height();
+ textObject->setWidth(100);
+ QVERIFY(textObject->height() < oldHeight);
+
+ delete textObject;
+ }
+
+ {
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextInput {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(object.data());
+ QVERIFY(input);
+
+ QSignalSpy spy(input, SIGNAL(wrapModeChanged()));
+
+ QCOMPARE(input->wrapMode(), QQuickTextInput::NoWrap);
+
+ input->setWrapMode(QQuickTextInput::Wrap);
+ QCOMPARE(input->wrapMode(), QQuickTextInput::Wrap);
+ QCOMPARE(spy.count(), 1);
+
+ input->setWrapMode(QQuickTextInput::Wrap);
+ QCOMPARE(spy.count(), 1);
+
+ input->setWrapMode(QQuickTextInput::NoWrap);
+ QCOMPARE(input->wrapMode(), QQuickTextInput::NoWrap);
+ QCOMPARE(spy.count(), 2);
+ }
+}
+
+void tst_qquicktextinput::selection()
+{
+ QString testStr = standard[0];
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \""+ testStr +"\"; }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(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());
+
+ // Verify invalid positions are ignored.
+ textinputObject->setCursorPosition(-1);
+ QVERIFY(textinputObject->cursorPosition() == 0);
+ QVERIFY(textinputObject->selectionStart() == 0);
+ QVERIFY(textinputObject->selectionEnd() == 0);
+ QVERIFY(textinputObject->selectedText().isNull());
+
+ textinputObject->setCursorPosition(textinputObject->text().count()+1);
+ 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->select(0,i);
+ QCOMPARE(testStr.mid(0,i), textinputObject->selectedText());
+ }
+ for (int i=0; i<= testStr.size(); i++) {
+ textinputObject->select(i,testStr.size());
+ 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());
+
+ //Test Error Ignoring behaviour
+ textinputObject->setCursorPosition(0);
+ QVERIFY(textinputObject->selectedText().isNull());
+ textinputObject->select(-10,0);
+ QVERIFY(textinputObject->selectedText().isNull());
+ textinputObject->select(100,110);
+ QVERIFY(textinputObject->selectedText().isNull());
+ textinputObject->select(0,-10);
+ QVERIFY(textinputObject->selectedText().isNull());
+ textinputObject->select(0,100);
+ QVERIFY(textinputObject->selectedText().isNull());
+ textinputObject->select(0,10);
+ QVERIFY(textinputObject->selectedText().size() == 10);
+ textinputObject->select(-10,10);
+ QVERIFY(textinputObject->selectedText().size() == 10);
+ textinputObject->select(100,101);
+ QVERIFY(textinputObject->selectedText().size() == 10);
+ textinputObject->select(0,-10);
+ QVERIFY(textinputObject->selectedText().size() == 10);
+ textinputObject->select(0,100);
+ QVERIFY(textinputObject->selectedText().size() == 10);
+
+ textinputObject->deselect();
+ QVERIFY(textinputObject->selectedText().isNull());
+ textinputObject->select(0,10);
+ QVERIFY(textinputObject->selectedText().size() == 10);
+ textinputObject->deselect();
+ QVERIFY(textinputObject->selectedText().isNull());
+
+ // test input method selection
+ QSignalSpy selectionSpy(textinputObject, SIGNAL(selectedTextChanged()));
+ textinputObject->setFocus(true);
+ {
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
+ QInputMethodEvent event("", attributes);
+ QGuiApplication::sendEvent(textinputObject, &event);
+ }
+ QCOMPARE(selectionSpy.count(), 1);
+ QCOMPARE(textinputObject->selectionStart(), 12);
+ QCOMPARE(textinputObject->selectionEnd(), 17);
+
+ delete textinputObject;
+}
+
+void tst_qquicktextinput::persistentSelection()
+{
+ QQuickView window(testFileUrl("persistentSelection.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(input);
+ QVERIFY(input->hasActiveFocus());
+
+ QSignalSpy spy(input, SIGNAL(persistentSelectionChanged()));
+
+ QCOMPARE(input->persistentSelection(), false);
+
+ input->setPersistentSelection(false);
+ QCOMPARE(input->persistentSelection(), false);
+ QCOMPARE(spy.count(), 0);
+
+ input->select(1, 4);
+ QCOMPARE(input->property("selected").toString(), QLatin1String("ell"));
+
+ input->setFocus(false);
+ QCOMPARE(input->property("selected").toString(), QString());
+
+ input->setFocus(true);
+ QCOMPARE(input->property("selected").toString(), QString());
+
+ input->setPersistentSelection(true);
+ QCOMPARE(input->persistentSelection(), true);
+ QCOMPARE(spy.count(), 1);
+
+ input->select(1, 4);
+ QCOMPARE(input->property("selected").toString(), QLatin1String("ell"));
+
+ input->setFocus(false);
+ QCOMPARE(input->property("selected").toString(), QLatin1String("ell"));
+
+ input->setFocus(true);
+ QCOMPARE(input->property("selected").toString(), QLatin1String("ell"));
+}
+
+void tst_qquicktextinput::isRightToLeft_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<bool>("emptyString");
+ QTest::addColumn<bool>("firstCharacter");
+ QTest::addColumn<bool>("lastCharacter");
+ QTest::addColumn<bool>("middleCharacter");
+ QTest::addColumn<bool>("startString");
+ QTest::addColumn<bool>("midString");
+ QTest::addColumn<bool>("endString");
+
+ const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647};
+ QTest::newRow("Empty") << "" << false << false << false << false << false << false << false;
+ QTest::newRow("Neutral") << "23244242" << false << false << false << false << false << false << false;
+ QTest::newRow("LTR") << "Hello world" << false << false << false << false << false << false << false;
+ QTest::newRow("RTL") << QString::fromUtf16(arabic_str, 11) << false << true << true << true << true << true << true;
+ QTest::newRow("Bidi RTL + LTR + RTL") << QString::fromUtf16(arabic_str, 11) + QString("Hello world") + QString::fromUtf16(arabic_str, 11) << false << true << true << false << true << true << true;
+ QTest::newRow("Bidi LTR + RTL + LTR") << QString("Hello world") + QString::fromUtf16(arabic_str, 11) + QString("Hello world") << false << false << false << true << false << false << false;
+}
+
+void tst_qquicktextinput::isRightToLeft()
+{
+ QFETCH(QString, text);
+ QFETCH(bool, emptyString);
+ QFETCH(bool, firstCharacter);
+ QFETCH(bool, lastCharacter);
+ QFETCH(bool, middleCharacter);
+ QFETCH(bool, startString);
+ QFETCH(bool, midString);
+ QFETCH(bool, endString);
+
+ QQuickTextInput textInput;
+ textInput.setText(text);
+
+ // first test that the right string is delivered to the QString::isRightToLeft()
+ QCOMPARE(textInput.isRightToLeft(0,0), text.mid(0,0).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(0,1), text.mid(0,1).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(text.count()-2, text.count()-1), text.mid(text.count()-2, text.count()-1).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(text.count()/2, text.count()/2 + 1), text.mid(text.count()/2, text.count()/2 + 1).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(0,text.count()/4), text.mid(0,text.count()/4).isRightToLeft());
+ QCOMPARE(textInput.isRightToLeft(text.count()/4,3*text.count()/4), text.mid(text.count()/4,3*text.count()/4).isRightToLeft());
+ if (text.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start.");
+ QCOMPARE(textInput.isRightToLeft(3*text.count()/4,text.count()-1), text.mid(3*text.count()/4,text.count()-1).isRightToLeft());
+
+ // then test that the feature actually works
+ QCOMPARE(textInput.isRightToLeft(0,0), emptyString);
+ QCOMPARE(textInput.isRightToLeft(0,1), firstCharacter);
+ QCOMPARE(textInput.isRightToLeft(text.count()-2, text.count()-1), lastCharacter);
+ QCOMPARE(textInput.isRightToLeft(text.count()/2, text.count()/2 + 1), middleCharacter);
+ QCOMPARE(textInput.isRightToLeft(0,text.count()/4), startString);
+ QCOMPARE(textInput.isRightToLeft(text.count()/4,3*text.count()/4), midString);
+ if (text.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start.");
+ QCOMPARE(textInput.isRightToLeft(3*text.count()/4,text.count()-1), endString);
+}
+
+void tst_qquicktextinput::moveCursorSelection_data()
+{
+ QTest::addColumn<QString>("testStr");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<int>("movePosition");
+ QTest::addColumn<QQuickTextInput::SelectionMode>("mode");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<bool>("reversible");
+
+ // () contains the text selected by the cursor.
+ // <> contains the actual selection.
+
+ QTest::newRow("(t)he|characters")
+ << standard[0] << 0 << 1 << QQuickTextInput::SelectCharacters << 0 << 1 << true;
+ QTest::newRow("do(g)|characters")
+ << standard[0] << 43 << 44 << QQuickTextInput::SelectCharacters << 43 << 44 << true;
+ QTest::newRow("jum(p)ed|characters")
+ << standard[0] << 23 << 24 << QQuickTextInput::SelectCharacters << 23 << 24 << true;
+ QTest::newRow("jumped( )over|characters")
+ << standard[0] << 26 << 27 << QQuickTextInput::SelectCharacters << 26 << 27 << true;
+ QTest::newRow("(the )|characters")
+ << standard[0] << 0 << 4 << QQuickTextInput::SelectCharacters << 0 << 4 << true;
+ QTest::newRow("( dog)|characters")
+ << standard[0] << 40 << 44 << QQuickTextInput::SelectCharacters << 40 << 44 << true;
+ QTest::newRow("( jumped )|characters")
+ << standard[0] << 19 << 27 << QQuickTextInput::SelectCharacters << 19 << 27 << true;
+ QTest::newRow("th(e qu)ick|characters")
+ << standard[0] << 2 << 6 << QQuickTextInput::SelectCharacters << 2 << 6 << true;
+ QTest::newRow("la(zy d)og|characters")
+ << standard[0] << 38 << 42 << QQuickTextInput::SelectCharacters << 38 << 42 << true;
+ QTest::newRow("jum(ped ov)er|characters")
+ << standard[0] << 23 << 29 << QQuickTextInput::SelectCharacters << 23 << 29 << true;
+ QTest::newRow("()the|characters")
+ << standard[0] << 0 << 0 << QQuickTextInput::SelectCharacters << 0 << 0 << true;
+ QTest::newRow("dog()|characters")
+ << standard[0] << 44 << 44 << QQuickTextInput::SelectCharacters << 44 << 44 << true;
+ QTest::newRow("jum()ped|characters")
+ << standard[0] << 23 << 23 << QQuickTextInput::SelectCharacters << 23 << 23 << true;
+
+ QTest::newRow("<(t)he>|words")
+ << standard[0] << 0 << 1 << QQuickTextInput::SelectWords << 0 << 3 << true;
+ QTest::newRow("<do(g)>|words")
+ << standard[0] << 43 << 44 << QQuickTextInput::SelectWords << 41 << 44 << true;
+ QTest::newRow("<jum(p)ed>|words")
+ << standard[0] << 23 << 24 << QQuickTextInput::SelectWords << 20 << 26 << true;
+ QTest::newRow("<jumped( )>over|words,ltr")
+ << standard[0] << 26 << 27 << QQuickTextInput::SelectWords << 20 << 27 << false;
+ QTest::newRow("jumped<( )over>|words,rtl")
+ << standard[0] << 27 << 26 << QQuickTextInput::SelectWords << 26 << 31 << false;
+ QTest::newRow("<(the )>quick|words,ltr")
+ << standard[0] << 0 << 4 << QQuickTextInput::SelectWords << 0 << 4 << false;
+ QTest::newRow("<(the )quick>|words,rtl")
+ << standard[0] << 4 << 0 << QQuickTextInput::SelectWords << 0 << 9 << false;
+ QTest::newRow("<lazy( dog)>|words,ltr")
+ << standard[0] << 40 << 44 << QQuickTextInput::SelectWords << 36 << 44 << false;
+ QTest::newRow("lazy<( dog)>|words,rtl")
+ << standard[0] << 44 << 40 << QQuickTextInput::SelectWords << 40 << 44 << false;
+ QTest::newRow("<fox( jumped )>over|words,ltr")
+ << standard[0] << 19 << 27 << QQuickTextInput::SelectWords << 16 << 27 << false;
+ QTest::newRow("fox<( jumped )over>|words,rtl")
+ << standard[0] << 27 << 19 << QQuickTextInput::SelectWords << 19 << 31 << false;
+ QTest::newRow("<th(e qu)ick>|words")
+ << standard[0] << 2 << 6 << QQuickTextInput::SelectWords << 0 << 9 << true;
+ QTest::newRow("<la(zy d)og|words>")
+ << standard[0] << 38 << 42 << QQuickTextInput::SelectWords << 36 << 44 << true;
+ QTest::newRow("<jum(ped ov)er>|words")
+ << standard[0] << 23 << 29 << QQuickTextInput::SelectWords << 20 << 31 << true;
+ QTest::newRow("<()>the|words")
+ << standard[0] << 0 << 0 << QQuickTextInput::SelectWords << 0 << 0 << true;
+ QTest::newRow("dog<()>|words")
+ << standard[0] << 44 << 44 << QQuickTextInput::SelectWords << 44 << 44 << true;
+ QTest::newRow("jum<()>ped|words")
+ << standard[0] << 23 << 23 << QQuickTextInput::SelectWords << 23 << 23 << true;
+
+ QTest::newRow("<Hello(,)> |words,ltr")
+ << standard[2] << 5 << 6 << QQuickTextInput::SelectWords << 0 << 6 << false;
+ QTest::newRow("Hello<(,)> |words,rtl")
+ << standard[2] << 6 << 5 << QQuickTextInput::SelectWords << 5 << 6 << false;
+ QTest::newRow("<Hello(, )>world|words,ltr")
+ << standard[2] << 5 << 7 << QQuickTextInput::SelectWords << 0 << 7 << false;
+ QTest::newRow("Hello<(, )world>|words,rtl")
+ << standard[2] << 7 << 5 << QQuickTextInput::SelectWords << 5 << 12 << false;
+ QTest::newRow("<Hel(lo, )>world|words,ltr")
+ << standard[2] << 3 << 7 << QQuickTextInput::SelectWords << 0 << 7 << false;
+ QTest::newRow("<Hel(lo, )world>|words,rtl")
+ << standard[2] << 7 << 3 << QQuickTextInput::SelectWords << 0 << 12 << false;
+ QTest::newRow("<Hel(lo)>,|words")
+ << standard[2] << 3 << 5 << QQuickTextInput::SelectWords << 0 << 5 << true;
+ QTest::newRow("Hello<()>,|words")
+ << standard[2] << 5 << 5 << QQuickTextInput::SelectWords << 5 << 5 << true;
+ QTest::newRow("Hello,<()>|words")
+ << standard[2] << 6 << 6 << QQuickTextInput::SelectWords << 6 << 6 << true;
+ QTest::newRow("Hello,<( )>world|words,ltr")
+ << standard[2] << 6 << 7 << QQuickTextInput::SelectWords << 6 << 7 << false;
+ QTest::newRow("Hello,<( )world>|words,rtl")
+ << standard[2] << 7 << 6 << QQuickTextInput::SelectWords << 6 << 12 << false;
+ QTest::newRow("Hello,<( world)>|words")
+ << standard[2] << 6 << 12 << QQuickTextInput::SelectWords << 6 << 12 << true;
+ QTest::newRow("Hello,<( world!)>|words")
+ << standard[2] << 6 << 13 << QQuickTextInput::SelectWords << 6 << 13 << true;
+ QTest::newRow("<Hello(, world!)>|words,ltr")
+ << standard[2] << 5 << 13 << QQuickTextInput::SelectWords << 0 << 13 << false;
+ QTest::newRow("Hello<(, world!)>|words,rtl")
+ << standard[2] << 13 << 5 << QQuickTextInput::SelectWords << 5 << 13 << false;
+ QTest::newRow("<world(!)>|words,ltr")
+ << standard[2] << 12 << 13 << QQuickTextInput::SelectWords << 7 << 13 << false;
+ QTest::newRow("world<(!)>|words,rtl")
+ << standard[2] << 13 << 12 << QQuickTextInput::SelectWords << 12 << 13 << false;
+ QTest::newRow("world!<()>)|words")
+ << standard[2] << 13 << 13 << QQuickTextInput::SelectWords << 13 << 13 << true;
+ QTest::newRow("world<()>!)|words")
+ << standard[2] << 12 << 12 << QQuickTextInput::SelectWords << 12 << 12 << true;
+
+ QTest::newRow("<(,)>olleH |words,ltr")
+ << standard[3] << 7 << 8 << QQuickTextInput::SelectWords << 7 << 8 << false;
+ QTest::newRow("<(,)olleH> |words,rtl")
+ << standard[3] << 8 << 7 << QQuickTextInput::SelectWords << 7 << 13 << false;
+ QTest::newRow("<dlrow( ,)>olleH|words,ltr")
+ << standard[3] << 6 << 8 << QQuickTextInput::SelectWords << 1 << 8 << false;
+ QTest::newRow("dlrow<( ,)olleH>|words,rtl")
+ << standard[3] << 8 << 6 << QQuickTextInput::SelectWords << 6 << 13 << false;
+ QTest::newRow("<dlrow( ,ol)leH>|words,ltr")
+ << standard[3] << 6 << 10 << QQuickTextInput::SelectWords << 1 << 13 << false;
+ QTest::newRow("dlrow<( ,ol)leH>|words,rtl")
+ << standard[3] << 10 << 6 << QQuickTextInput::SelectWords << 6 << 13 << false;
+ QTest::newRow(",<(ol)leH>,|words")
+ << standard[3] << 8 << 10 << QQuickTextInput::SelectWords << 8 << 13 << true;
+ QTest::newRow(",<()>olleH|words")
+ << standard[3] << 8 << 8 << QQuickTextInput::SelectWords << 8 << 8 << true;
+ QTest::newRow("<()>,olleH|words")
+ << standard[3] << 7 << 7 << QQuickTextInput::SelectWords << 7 << 7 << true;
+ QTest::newRow("<dlrow( )>,olleH|words,ltr")
+ << standard[3] << 6 << 7 << QQuickTextInput::SelectWords << 1 << 7 << false;
+ QTest::newRow("dlrow<( )>,olleH|words,rtl")
+ << standard[3] << 7 << 6 << QQuickTextInput::SelectWords << 6 << 7 << false;
+ QTest::newRow("<(dlrow )>,olleH|words")
+ << standard[3] << 1 << 7 << QQuickTextInput::SelectWords << 1 << 7 << true;
+ QTest::newRow("<(!dlrow )>,olleH|words")
+ << standard[3] << 0 << 7 << QQuickTextInput::SelectWords << 0 << 7 << true;
+ QTest::newRow("<(!dlrow ,)>olleH|words,ltr")
+ << standard[3] << 0 << 8 << QQuickTextInput::SelectWords << 0 << 8 << false;
+ QTest::newRow("<(!dlrow ,)olleH>|words,rtl")
+ << standard[3] << 8 << 0 << QQuickTextInput::SelectWords << 0 << 13 << false;
+ QTest::newRow("<(!)>dlrow|words,ltr")
+ << standard[3] << 0 << 1 << QQuickTextInput::SelectWords << 0 << 1 << false;
+ QTest::newRow("<(!)dlrow|words,rtl")
+ << standard[3] << 1 << 0 << QQuickTextInput::SelectWords << 0 << 6 << false;
+ QTest::newRow("<()>!dlrow|words")
+ << standard[3] << 0 << 0 << QQuickTextInput::SelectWords << 0 << 0 << true;
+ QTest::newRow("!<()>dlrow|words")
+ << standard[3] << 1 << 1 << QQuickTextInput::SelectWords << 1 << 1 << true;
+
+ QTest::newRow(" <s(pac)ey> text |words")
+ << standard[4] << 1 << 4 << QQuickTextInput::SelectWords << 1 << 7 << true;
+ QTest::newRow(" spacey <t(ex)t> |words")
+ << standard[4] << 11 << 13 << QQuickTextInput::SelectWords << 10 << 14 << true;
+ QTest::newRow("<( )>spacey text |words|ltr")
+ << standard[4] << 0 << 1 << QQuickTextInput::SelectWords << 0 << 1 << false;
+ QTest::newRow("<( )spacey> text |words|rtl")
+ << standard[4] << 1 << 0 << QQuickTextInput::SelectWords << 0 << 7 << false;
+ QTest::newRow("spacey <text( )>|words|ltr")
+ << standard[4] << 14 << 15 << QQuickTextInput::SelectWords << 10 << 15 << false;
+ QTest::newRow("spacey text<( )>|words|rtl")
+ << standard[4] << 15 << 14 << QQuickTextInput::SelectWords << 14 << 15 << false;
+ QTest::newRow("<()> spacey text |words")
+ << standard[4] << 0 << 0 << QQuickTextInput::SelectWords << 0 << 0 << false;
+ QTest::newRow(" spacey text <()>|words")
+ << standard[4] << 15 << 15 << QQuickTextInput::SelectWords << 15 << 15 << false;
+}
+
+void tst_qquicktextinput::moveCursorSelection()
+{
+ QFETCH(QString, testStr);
+ QFETCH(int, cursorPosition);
+ QFETCH(int, movePosition);
+ QFETCH(QQuickTextInput::SelectionMode, mode);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(bool, reversible);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \""+ testStr +"\"; }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+ QVERIFY(textinputObject != 0);
+
+ textinputObject->setCursorPosition(cursorPosition);
+ textinputObject->moveCursorSelection(movePosition, mode);
+
+ QCOMPARE(textinputObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
+ QCOMPARE(textinputObject->selectionStart(), selectionStart);
+ QCOMPARE(textinputObject->selectionEnd(), selectionEnd);
+
+ if (reversible) {
+ textinputObject->setCursorPosition(movePosition);
+ textinputObject->moveCursorSelection(cursorPosition, mode);
+
+ QCOMPARE(textinputObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
+ QCOMPARE(textinputObject->selectionStart(), selectionStart);
+ QCOMPARE(textinputObject->selectionEnd(), selectionEnd);
+ }
+
+ delete textinputObject;
+}
+
+void tst_qquicktextinput::moveCursorSelectionSequence_data()
+{
+ QTest::addColumn<QString>("testStr");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<int>("movePosition1");
+ QTest::addColumn<int>("movePosition2");
+ QTest::addColumn<int>("selection1Start");
+ QTest::addColumn<int>("selection1End");
+ QTest::addColumn<int>("selection2Start");
+ QTest::addColumn<int>("selection2End");
+
+ // () contains the text selected by the cursor.
+ // <> contains the actual selection.
+ // ^ is the revised cursor position.
+ // {} contains the revised selection.
+
+ QTest::newRow("the {<quick( bro)wn> f^ox} jumped|ltr")
+ << standard[0]
+ << 9 << 13 << 17
+ << 4 << 15
+ << 4 << 19;
+ QTest::newRow("the quick<( {bro)wn> f^ox} jumped|rtl")
+ << standard[0]
+ << 13 << 9 << 17
+ << 9 << 15
+ << 10 << 19;
+ QTest::newRow("the {<quick( bro)wn> ^}fox jumped|ltr")
+ << standard[0]
+ << 9 << 13 << 16
+ << 4 << 15
+ << 4 << 16;
+ QTest::newRow("the quick<( {bro)wn> ^}fox jumped|rtl")
+ << standard[0]
+ << 13 << 9 << 16
+ << 9 << 15
+ << 10 << 16;
+ QTest::newRow("the {<quick( bro)wn^>} fox jumped|ltr")
+ << standard[0]
+ << 9 << 13 << 15
+ << 4 << 15
+ << 4 << 15;
+ QTest::newRow("the quick<( {bro)wn^>} f^ox jumped|rtl")
+ << standard[0]
+ << 13 << 9 << 15
+ << 9 << 15
+ << 10 << 15;
+ QTest::newRow("the {<quick() ^}bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 10
+ << 4 << 15
+ << 4 << 10;
+ QTest::newRow("the quick<( {^bro)wn>} fox|rtl")
+ << standard[0]
+ << 13 << 9 << 10
+ << 9 << 15
+ << 10 << 15;
+ QTest::newRow("the {<quick^}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 9
+ << 4 << 15
+ << 4 << 9;
+ QTest::newRow("the quick{<(^ bro)wn>} fox|rtl")
+ << standard[0]
+ << 13 << 9 << 9
+ << 9 << 15
+ << 9 << 15;
+ QTest::newRow("the {<qui^ck}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 7
+ << 4 << 15
+ << 4 << 9;
+ QTest::newRow("the {<qui^ck}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 7
+ << 9 << 15
+ << 4 << 15;
+ QTest::newRow("the {<^quick}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 4
+ << 4 << 15
+ << 4 << 9;
+ QTest::newRow("the {<^quick}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 4
+ << 9 << 15
+ << 4 << 15;
+ QTest::newRow("the{^ <quick}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 3
+ << 4 << 15
+ << 3 << 9;
+ QTest::newRow("the{^ <quick}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 3
+ << 9 << 15
+ << 3 << 15;
+ QTest::newRow("{t^he <quick}( bro)wn> fox|ltr")
+ << standard[0]
+ << 9 << 13 << 1
+ << 4 << 15
+ << 0 << 9;
+ QTest::newRow("{t^he <quick}( bro)wn> fox|rtl")
+ << standard[0]
+ << 13 << 9 << 1
+ << 9 << 15
+ << 0 << 15;
+
+ QTest::newRow("{<He(ll)o>, w^orld}!|ltr")
+ << standard[2]
+ << 2 << 4 << 8
+ << 0 << 5
+ << 0 << 12;
+ QTest::newRow("{<He(ll)o>, w^orld}!|rtl")
+ << standard[2]
+ << 4 << 2 << 8
+ << 0 << 5
+ << 0 << 12;
+
+ QTest::newRow("!{dlro^w ,<o(ll)eH>}|ltr")
+ << standard[3]
+ << 9 << 11 << 5
+ << 8 << 13
+ << 1 << 13;
+ QTest::newRow("!{dlro^w ,<o(ll)eH>}|rtl")
+ << standard[3]
+ << 11 << 9 << 5
+ << 8 << 13
+ << 1 << 13;
+
+ QTest::newRow("{<(^} sp)acey> text |ltr")
+ << standard[4]
+ << 0 << 3 << 0
+ << 0 << 7
+ << 0 << 0;
+ QTest::newRow("{<( ^}sp)acey> text |ltr")
+ << standard[4]
+ << 0 << 3 << 1
+ << 0 << 7
+ << 0 << 1;
+ QTest::newRow("<( {s^p)acey>} text |rtl")
+ << standard[4]
+ << 3 << 0 << 2
+ << 0 << 7
+ << 1 << 7;
+ QTest::newRow("<( {^sp)acey>} text |rtl")
+ << standard[4]
+ << 3 << 0 << 1
+ << 0 << 7
+ << 1 << 7;
+
+ QTest::newRow(" spacey <te(xt {^)>}|rtl")
+ << standard[4]
+ << 15 << 12 << 15
+ << 10 << 15
+ << 15 << 15;
+ QTest::newRow(" spacey <te(xt{^ )>}|rtl")
+ << standard[4]
+ << 15 << 12 << 14
+ << 10 << 15
+ << 14 << 15;
+ QTest::newRow(" spacey {<te(x^t} )>|ltr")
+ << standard[4]
+ << 12 << 15 << 13
+ << 10 << 15
+ << 10 << 14;
+ QTest::newRow(" spacey {<te(xt^} )>|ltr")
+ << standard[4]
+ << 12 << 15 << 14
+ << 10 << 15
+ << 10 << 14;
+}
+
+void tst_qquicktextinput::moveCursorSelectionSequence()
+{
+ QFETCH(QString, testStr);
+ QFETCH(int, cursorPosition);
+ QFETCH(int, movePosition1);
+ QFETCH(int, movePosition2);
+ QFETCH(int, selection1Start);
+ QFETCH(int, selection1End);
+ QFETCH(int, selection2Start);
+ QFETCH(int, selection2End);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \""+ testStr +"\"; }";
+ QQmlComponent textinputComponent(&engine);
+ textinputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create());
+ QVERIFY(textinputObject != 0);
+
+ textinputObject->setCursorPosition(cursorPosition);
+
+ textinputObject->moveCursorSelection(movePosition1, QQuickTextInput::SelectWords);
+ QCOMPARE(textinputObject->selectedText(), testStr.mid(selection1Start, selection1End - selection1Start));
+ QCOMPARE(textinputObject->selectionStart(), selection1Start);
+ QCOMPARE(textinputObject->selectionEnd(), selection1End);
+
+ textinputObject->moveCursorSelection(movePosition2, QQuickTextInput::SelectWords);
+ QCOMPARE(textinputObject->selectedText(), testStr.mid(selection2Start, selection2End - selection2Start));
+ QCOMPARE(textinputObject->selectionStart(), selection2Start);
+ QCOMPARE(textinputObject->selectionEnd(), selection2End);
+
+ delete textinputObject;
+}
+
+void tst_qquicktextinput::dragMouseSelection()
+{
+ QString qmlfile = testFile("mouseselection_true.qml");
+
+ QQuickView window(QUrl::fromLocalFile(qmlfile));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(textInputObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textInputObject->height()/2;
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y));
+ QTest::mouseMove(&window, QPoint(x2, y));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y));
+ QTest::qWait(100);
+ QString str1;
+ QVERIFY((str1 = textInputObject->selectedText()).length() > 3);
+ QVERIFY(str1.length() > 3);
+
+ // press and drag the current selection.
+ x1 = 40;
+ x2 = 100;
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y));
+ QTest::mouseMove(&window, QPoint(x2, y));
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y));
+ QTest::qWait(300);
+ QString str2 = textInputObject->selectedText();
+ QVERIFY(str2.length() > 3);
+
+ QVERIFY(str1 != str2);
+}
+
+void tst_qquicktextinput::mouseSelectionMode_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<bool>("selectWords");
+ QTest::addColumn<bool>("focus");
+ QTest::addColumn<bool>("focusOnPress");
+
+ // import installed
+ QTest::newRow("SelectWords focused") << testFile("mouseselectionmode_words.qml") << true << true << true;
+ QTest::newRow("SelectCharacters focused") << testFile("mouseselectionmode_characters.qml") << false << true << true;
+ QTest::newRow("default focused") << testFile("mouseselectionmode_default.qml") << false << true << true;
+ QTest::newRow("SelectWords unfocused") << testFile("mouseselectionmode_words.qml") << true << false << false;
+ QTest::newRow("SelectCharacters unfocused") << testFile("mouseselectionmode_characters.qml") << false << false << false;
+ QTest::newRow("default unfocused") << testFile("mouseselectionmode_default.qml") << false << true << false;
+ QTest::newRow("SelectWords focuss on press") << testFile("mouseselectionmode_words.qml") << true << false << true;
+ QTest::newRow("SelectCharacters focus on press") << testFile("mouseselectionmode_characters.qml") << false << false << true;
+ QTest::newRow("default focus on press") << testFile("mouseselectionmode_default.qml") << false << false << true;
+}
+
+void tst_qquicktextinput::mouseSelectionMode()
+{
+ QFETCH(QString, qmlfile);
+ QFETCH(bool, selectWords);
+ QFETCH(bool, focus);
+ QFETCH(bool, focusOnPress);
+
+ QString text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ QQuickView window(QUrl::fromLocalFile(qmlfile));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(textInputObject != 0);
+
+ textInputObject->setFocus(focus);
+ textInputObject->setFocusOnPress(focusOnPress);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textInputObject->height()/2;
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y));
+ QTest::mouseMove(&window, QPoint(x2,y)); // doesn't work
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y));
+ QTest::qWait(300);
+ if (selectWords) {
+ QTRY_COMPARE(textInputObject->selectedText(), text);
+ } else {
+ QTRY_VERIFY(textInputObject->selectedText().length() > 3);
+ QVERIFY(textInputObject->selectedText() != text);
+ }
+}
+
+void tst_qquicktextinput::mouseSelectionMode_accessors()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextInput {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(object.data());
+ QVERIFY(input);
+
+ QSignalSpy spy(input, SIGNAL(mouseSelectionModeChanged(SelectionMode)));
+
+ QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectCharacters);
+
+ input->setMouseSelectionMode(QQuickTextInput::SelectWords);
+ QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectWords);
+ QCOMPARE(spy.count(), 1);
+
+ input->setMouseSelectionMode(QQuickTextInput::SelectWords);
+ QCOMPARE(spy.count(), 1);
+
+ input->setMouseSelectionMode(QQuickTextInput::SelectCharacters);
+ QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectCharacters);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextinput::selectByMouse()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextInput {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(object.data());
+ QVERIFY(input);
+
+ QSignalSpy spy(input, SIGNAL(selectByMouseChanged(bool)));
+
+ QCOMPARE(input->selectByMouse(), false);
+
+ input->setSelectByMouse(true);
+ QCOMPARE(input->selectByMouse(), true);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), true);
+
+ input->setSelectByMouse(true);
+ QCOMPARE(spy.count(), 1);
+
+ input->setSelectByMouse(false);
+ QCOMPARE(input->selectByMouse(), false);
+ QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.at(1).at(0).toBool(), false);
+}
+
+void tst_qquicktextinput::renderType()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextInput {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(object.data());
+ QVERIFY(input);
+
+ QSignalSpy spy(input, SIGNAL(renderTypeChanged()));
+
+ QCOMPARE(input->renderType(), QQuickTextInput::QtRendering);
+
+ input->setRenderType(QQuickTextInput::NativeRendering);
+ QCOMPARE(input->renderType(), QQuickTextInput::NativeRendering);
+ QCOMPARE(spy.count(), 1);
+
+ input->setRenderType(QQuickTextInput::NativeRendering);
+ QCOMPARE(spy.count(), 1);
+
+ input->setRenderType(QQuickTextInput::QtRendering);
+ QCOMPARE(input->renderType(), QQuickTextInput::QtRendering);
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextinput::horizontalAlignment_RightToLeft()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QQuickView window(testFileUrl("horizontalAlignment_RightToLeft.qml"));
+ QQuickTextInput *textInput = window.rootObject()->findChild<QQuickTextInput*>("text");
+ QVERIFY(textInput != 0);
+ window.show();
+
+ const QString rtlText = textInput->text();
+
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // implicit alignment should follow the reading direction of RTL text
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign());
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // explicitly left aligned
+ textInput->setHAlign(QQuickTextInput::AlignLeft);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft);
+ QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign());
+ QCOMPARE(textInput->boundingRect().left(), qreal(0));
+
+ // explicitly right aligned
+ textInput->setHAlign(QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign());
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // explicitly center aligned
+ textInput->setHAlign(QQuickTextInput::AlignHCenter);
+ QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign());
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignHCenter);
+ QVERIFY(textInput->boundingRect().left() > 0);
+ QVERIFY(textInput->boundingRect().right() < textInput->width());
+
+ // reseted alignment should go back to following the text reading direction
+ textInput->resetHAlign();
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign());
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // mirror the text item
+ QQuickItemPrivate::get(textInput)->setLayoutMirror(true);
+
+ // mirrored implicit alignment should continue to follow the reading direction of the text
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign());
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // explicitly right aligned behaves as left aligned
+ textInput->setHAlign(QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->effectiveHAlign(), QQuickTextInput::AlignLeft);
+ QCOMPARE(textInput->boundingRect().left(), qreal(0));
+
+ // mirrored explicitly left aligned behaves as right aligned
+ textInput->setHAlign(QQuickTextInput::AlignLeft);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft);
+ QCOMPARE(textInput->effectiveHAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // disable mirroring
+ QQuickItemPrivate::get(textInput)->setLayoutMirror(false);
+ QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign());
+ textInput->resetHAlign();
+
+ // English text should be implicitly left aligned
+ textInput->setText("Hello world!");
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft);
+ QCOMPARE(textInput->boundingRect().left(), qreal(0));
+
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ // If there is no committed text, the preedit text should determine the alignment.
+ textInput->setText(QString());
+ { QInputMethodEvent ev(rtlText, QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(textInput, &ev); }
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ { QInputMethodEvent ev("Hello world!", QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(textInput, &ev); }
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft);
+
+ // Clear pre-edit text. TextInput should maybe do this itself on setText, but that may be
+ // redundant as an actual input method may take care of it.
+ { QInputMethodEvent ev; QGuiApplication::sendEvent(textInput, &ev); }
+
+ // empty text with implicit alignment follows the system locale-based
+ // keyboard input direction from QInputMethod::inputDirection()
+ textInput->setText("");
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::LeftToRight);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignLeft);
+ QCOMPARE(textInput->boundingRect().left(), qreal(0));
+
+ QSignalSpy cursorRectangleSpy(textInput, SIGNAL(cursorRectangleChanged()));
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QVERIFY(qApp->inputMethod()->inputDirection() == Qt::RightToLeft);
+ QCOMPARE(cursorRectangleSpy.count(), 1);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // set input direction while having content
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textInput->setText("a");
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QTest::keyClick(&window, Qt::Key_Backspace);
+ QVERIFY(textInput->text().isEmpty());
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // input direction changed while not having focus
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ textInput->setFocus(false);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ textInput->setFocus(true);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ textInput->setHAlign(QQuickTextInput::AlignRight);
+ QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight);
+ QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1);
+ QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1);
+
+ // neutral text should fall back to input direction
+ textInput->setFocus(true);
+ textInput->resetHAlign();
+ textInput->setText(" ()((=<>");
+ platformInputContext.setInputDirection(Qt::LeftToRight);
+ QCOMPARE(textInput->effectiveHAlign(), QQuickTextInput::AlignLeft);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ QCOMPARE(textInput->effectiveHAlign(), QQuickTextInput::AlignRight);
+
+ // changing width keeps right aligned cursor on proper position
+ textInput->setText("");
+ textInput->setWidth(500);
+ QVERIFY(textInput->positionToRectangle(0).x() > textInput->width() / 2);
+}
+
+void tst_qquicktextinput::verticalAlignment()
+{
+ QQuickView window(testFileUrl("horizontalAlignment.qml"));
+ QQuickTextInput *textInput = window.rootObject()->findChild<QQuickTextInput*>("text");
+ QVERIFY(textInput != 0);
+ window.show();
+
+ QCOMPARE(textInput->vAlign(), QQuickTextInput::AlignTop);
+ QVERIFY(textInput->boundingRect().bottom() < window.height() / 2);
+ QVERIFY(textInput->cursorRectangle().bottom() < window.height() / 2);
+ QVERIFY(textInput->positionToRectangle(0).bottom() < window.height() / 2);
+
+ // bottom aligned
+ textInput->setVAlign(QQuickTextInput::AlignBottom);
+ QCOMPARE(textInput->vAlign(), QQuickTextInput::AlignBottom);
+ QVERIFY(textInput->boundingRect().top() > window.height() / 2);
+ QVERIFY(textInput->cursorRectangle().top() > window.height() / 2);
+ QVERIFY(textInput->positionToRectangle(0).top() > window.height() / 2);
+
+ // explicitly center aligned
+ textInput->setVAlign(QQuickTextInput::AlignVCenter);
+ QCOMPARE(textInput->vAlign(), QQuickTextInput::AlignVCenter);
+ QVERIFY(textInput->boundingRect().top() < window.height() / 2);
+ QVERIFY(textInput->boundingRect().bottom() > window.height() / 2);
+ QVERIFY(textInput->cursorRectangle().top() < window.height() / 2);
+ QVERIFY(textInput->cursorRectangle().bottom() > window.height() / 2);
+ QVERIFY(textInput->positionToRectangle(0).top() < window.height() / 2);
+ QVERIFY(textInput->positionToRectangle(0).bottom() > window.height() / 2);
+}
+
+void tst_qquicktextinput::clipRect()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextInput {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(object.data());
+ QVERIFY(input);
+
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + input->cursorRectangle().width());
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ input->setText("Hello World");
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + input->cursorRectangle().width());
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ // clip rect shouldn't exceed the size of the item, expect for the cursor width;
+ input->setWidth(input->width() / 2);
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + input->cursorRectangle().width());
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ input->setHeight(input->height() * 2);
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + input->cursorRectangle().width());
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ QQmlComponent cursorComponent(&engine);
+ cursorComponent.setData("import QtQuick 2.0\nRectangle { height: 20; width: 8 }", QUrl());
+
+ input->setCursorDelegate(&cursorComponent);
+ input->setCursorVisible(true);
+
+ // If a cursor delegate is used it's size should determine the excess width.
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + 8);
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ // Alignment, auto scroll, wrapping all don't affect the clip rect.
+ input->setAutoScroll(false);
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + 8);
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ input->setHAlign(QQuickTextInput::AlignRight);
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + 8);
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ input->setWrapMode(QQuickTextInput::Wrap);
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + 8);
+ QCOMPARE(input->clipRect().height(), input->height());
+
+ input->setVAlign(QQuickTextInput::AlignBottom);
+ QCOMPARE(input->clipRect().x(), qreal(0));
+ QCOMPARE(input->clipRect().y(), qreal(0));
+ QCOMPARE(input->clipRect().width(), input->width() + 8);
+ QCOMPARE(input->clipRect().height(), input->height());
+}
+
+void tst_qquicktextinput::boundingRect()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n TextInput {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(object.data());
+ QVERIFY(input);
+
+ QTextLayout layout;
+ layout.setFont(input->font());
+
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ QCOMPARE(input->boundingRect().x(), qreal(0));
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QCOMPARE(input->boundingRect().width(), input->cursorRectangle().width());
+ QCOMPARE(input->boundingRect().height(), line.height());
+
+ input->setText("Hello World");
+
+ layout.setText(input->text());
+ layout.beginLayout();
+ line = layout.createLine();
+ layout.endLayout();
+
+ QCOMPARE(input->boundingRect().x(), qreal(0));
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QCOMPARE(input->boundingRect().width(), line.naturalTextWidth() + input->cursorRectangle().width());
+ QCOMPARE(input->boundingRect().height(), line.height());
+
+ // the size of the bounding rect shouldn't be bounded by the size of item.
+ input->setWidth(input->width() / 2);
+ QCOMPARE(input->boundingRect().x(), input->width() - line.naturalTextWidth());
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QCOMPARE(input->boundingRect().width(), line.naturalTextWidth() + input->cursorRectangle().width());
+ QCOMPARE(input->boundingRect().height(), line.height());
+
+ input->setHeight(input->height() * 2);
+ QCOMPARE(input->boundingRect().x(), input->width() - line.naturalTextWidth());
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QCOMPARE(input->boundingRect().width(), line.naturalTextWidth() + input->cursorRectangle().width());
+ QCOMPARE(input->boundingRect().height(), line.height());
+
+ QQmlComponent cursorComponent(&engine);
+ cursorComponent.setData("import QtQuick 2.0\nRectangle { height: 20; width: 8 }", QUrl());
+
+ input->setCursorDelegate(&cursorComponent);
+ input->setCursorVisible(true);
+
+ // Don't include the size of a cursor delegate as it has its own bounding rect.
+ QCOMPARE(input->boundingRect().x(), input->width() - line.naturalTextWidth());
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QCOMPARE(input->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(input->boundingRect().height(), line.height());
+
+ // Bounding rect left aligned when auto scroll is disabled;
+ input->setAutoScroll(false);
+ QCOMPARE(input->boundingRect().x(), qreal(0));
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QCOMPARE(input->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(input->boundingRect().height(), line.height());
+
+ input->setHAlign(QQuickTextInput::AlignRight);
+ QCOMPARE(input->boundingRect().x(), input->width() - line.naturalTextWidth());
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QCOMPARE(input->boundingRect().width(), line.naturalTextWidth());
+ QCOMPARE(input->boundingRect().height(), line.height());
+
+ input->setWrapMode(QQuickTextInput::Wrap);
+ QCOMPARE(input->boundingRect().right(), input->width());
+ QCOMPARE(input->boundingRect().y(), qreal(0));
+ QVERIFY(input->boundingRect().width() < line.naturalTextWidth());
+ QVERIFY(input->boundingRect().height() > line.height());
+
+ input->setVAlign(QQuickTextInput::AlignBottom);
+ QCOMPARE(input->boundingRect().right(), input->width());
+ QCOMPARE(input->boundingRect().bottom(), input->height());
+ QVERIFY(input->boundingRect().width() < line.naturalTextWidth());
+ QVERIFY(input->boundingRect().height() > line.height());
+}
+
+void tst_qquicktextinput::positionAt()
+{
+ QQuickView window(testFileUrl("positionAt.qml"));
+ QVERIFY(window.rootObject() != 0);
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(textinputObject != 0);
+
+ // Check autoscrolled...
+
+ int pos = evaluate<int>(textinputObject, QString("positionAt(%1)").arg(textinputObject->width()/2));
+
+ QTextLayout layout(textinputObject->text());
+ layout.setFont(textinputObject->font());
+
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ int textLeftWidthBegin = floor(line.cursorToX(pos - 1));
+ int textLeftWidthEnd = ceil(line.cursorToX(pos + 1));
+ int textWidth = floor(line.horizontalAdvance());
+
+ QVERIFY(textLeftWidthBegin <= textWidth - textinputObject->width() / 2);
+ QVERIFY(textLeftWidthEnd >= textWidth - textinputObject->width() / 2);
+
+ int x = textinputObject->positionToRectangle(pos + 1).x() - 1;
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1, 0, TextInput.CursorBetweenCharacters)").arg(x)), pos + 1);
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1, 0, TextInput.CursorOnCharacter)").arg(x)), pos);
+
+ // Check without autoscroll...
+ textinputObject->setAutoScroll(false);
+ pos = evaluate<int>(textinputObject, QString("positionAt(%1)").arg(textinputObject->width() / 2));
+
+ textLeftWidthBegin = floor(line.cursorToX(pos - 1));
+ textLeftWidthEnd = ceil(line.cursorToX(pos + 1));
+
+ QVERIFY(textLeftWidthBegin <= textinputObject->width() / 2);
+ QVERIFY(textLeftWidthEnd >= textinputObject->width() / 2);
+
+ x = textinputObject->positionToRectangle(pos + 1).x() - 1;
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1, 0, TextInput.CursorBetweenCharacters)").arg(x)), pos + 1);
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1, 0, TextInput.CursorOnCharacter)").arg(x)), pos);
+
+ const qreal x0 = textinputObject->positionToRectangle(pos).x();
+ const qreal x1 = textinputObject->positionToRectangle(pos + 1).x();
+
+ QString preeditText = textinputObject->text().mid(0, pos);
+ textinputObject->setText(textinputObject->text().mid(pos));
+ textinputObject->setCursorPosition(0);
+
+ { QInputMethodEvent inputEvent(preeditText, QList<QInputMethodEvent::Attribute>());
+ QVERIFY(qGuiApp->focusObject());
+ QGuiApplication::sendEvent(textinputObject, &inputEvent); }
+
+ // Check all points within the preedit text return the same position.
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1)").arg(0)), 0);
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1)").arg(x0 / 2)), 0);
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1)").arg(x0)), 0);
+
+ // Verify positioning returns to normal after the preedit text.
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1)").arg(x1)), 1);
+ QCOMPARE(textinputObject->positionToRectangle(1).x(), x1);
+
+ { QInputMethodEvent inputEvent;
+ QVERIFY(qGuiApp->focusObject());
+ QGuiApplication::sendEvent(textinputObject, &inputEvent); }
+
+ // With wrapping.
+ textinputObject->setWrapMode(QQuickTextInput::WrapAnywhere);
+
+ const qreal y0 = line.height() / 2;
+ const qreal y1 = line.height() * 3 / 2;
+
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1, %2)").arg(x0).arg(y0)), pos);
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1, %2)").arg(x1).arg(y0)), pos + 1);
+
+ int newLinePos = evaluate<int>(textinputObject, QString("positionAt(%1, %2)").arg(x0).arg(y1));
+ QVERIFY(newLinePos > pos);
+ QCOMPARE(evaluate<int>(textinputObject, QString("positionAt(%1, %2)").arg(x1).arg(y1)), newLinePos + 1);
+}
+
+void tst_qquicktextinput::maxLength()
+{
+ QQuickView window(testFileUrl("maxLength.qml"));
+ QVERIFY(window.rootObject() != 0);
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(textinputObject != 0);
+ QVERIFY(textinputObject->text().isEmpty());
+ QVERIFY(textinputObject->maxLength() == 10);
+ foreach (const QString &str, standard) {
+ QVERIFY(textinputObject->text().length() <= 10);
+ textinputObject->setText(str);
+ QVERIFY(textinputObject->text().length() <= 10);
+ }
+
+ textinputObject->setText("");
+ QTRY_VERIFY(textinputObject->hasActiveFocus() == true);
+ for (int i=0; i<20; i++) {
+ QTRY_COMPARE(textinputObject->text().length(), qMin(i,10));
+ //simulateKey(&window, Qt::Key_A);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ }
+}
+
+void tst_qquicktextinput::masks()
+{
+ //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit)
+ //QString componentStr = "import QtQuick 2.0\nTextInput { inputMask: 'HHHHhhhh'; }";
+ QQuickView window(testFileUrl("masks.qml"));
+ window.show();
+ window.requestActivate();
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(textinputObject != 0);
+ QTRY_VERIFY(textinputObject->hasActiveFocus() == true);
+ QVERIFY(textinputObject->text().length() == 0);
+ QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; "));
+ QCOMPARE(textinputObject->length(), 8);
+ for (int i=0; i<10; i++) {
+ QTRY_COMPARE(qMin(i,8), textinputObject->text().length());
+ QCOMPARE(textinputObject->length(), 8);
+ QCOMPARE(textinputObject->getText(0, qMin(i, 8)), QString(qMin(i, 8), 'a'));
+ QCOMPARE(textinputObject->getText(qMin(i, 8), 8), QString(8 - qMin(i, 8), ' '));
+ QCOMPARE(i>=4, textinputObject->hasAcceptableInput());
+ //simulateKey(&window, Qt::Key_A);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ }
+}
+
+void tst_qquicktextinput::validators()
+{
+ // Note that this test assumes that the validators are working properly
+ // so you may need to run their tests first. All validators are checked
+ // here to ensure that their exposure to QML is working.
+
+ QLocale::setDefault(QLocale(QStringLiteral("C")));
+
+ QQuickView window(testFileUrl("validators.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+
+ QLocale defaultLocale;
+ QLocale enLocale("en");
+ QLocale deLocale("de_DE");
+
+ QQuickTextInput *intInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("intInput")));
+ QVERIFY(intInput);
+ QSignalSpy intSpy(intInput, SIGNAL(acceptableInputChanged()));
+
+ QQuickIntValidator *intValidator = qobject_cast<QQuickIntValidator *>(intInput->validator());
+ QVERIFY(intValidator);
+ QCOMPARE(intValidator->localeName(), defaultLocale.name());
+ QCOMPARE(intInput->validator()->locale(), defaultLocale);
+ intValidator->setLocaleName(enLocale.name());
+ QCOMPARE(intValidator->localeName(), enLocale.name());
+ QCOMPARE(intInput->validator()->locale(), enLocale);
+ intValidator->resetLocaleName();
+ QCOMPARE(intValidator->localeName(), defaultLocale.name());
+ QCOMPARE(intInput->validator()->locale(), defaultLocale);
+
+ intInput->setFocus(true);
+ QTRY_VERIFY(intInput->hasActiveFocus());
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ QCOMPARE(intInput->property("acceptable").toBool(), false);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(intInput->text(), QLatin1String("1"));
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ QCOMPARE(intInput->property("acceptable").toBool(), false);
+ QCOMPARE(intSpy.count(), 0);
+ QTest::keyPress(&window, Qt::Key_2);
+ QTest::keyRelease(&window, Qt::Key_2, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(intInput->text(), QLatin1String("1"));
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ QCOMPARE(intInput->property("acceptable").toBool(), false);
+ QCOMPARE(intSpy.count(), 0);
+ QTest::keyPress(&window, Qt::Key_Period);
+ QTest::keyRelease(&window, Qt::Key_Period, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(intInput->text(), QLatin1String("1"));
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ QTest::keyPress(&window, Qt::Key_Comma);
+ QTest::keyRelease(&window, Qt::Key_Comma, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(intInput->text(), QLatin1String("1,"));
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(intInput->text(), QLatin1String("1"));
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ intValidator->setLocaleName(deLocale.name());
+ QTest::keyPress(&window, Qt::Key_Period);
+ QTest::keyRelease(&window, Qt::Key_Period, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(intInput->text(), QLatin1String("1."));
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(intInput->text(), QLatin1String("1"));
+ QCOMPARE(intInput->hasAcceptableInput(), false);
+ intValidator->resetLocaleName();
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QCOMPARE(intInput->text(), QLatin1String("11"));
+ QCOMPARE(intInput->hasAcceptableInput(), true);
+ QCOMPARE(intInput->property("acceptable").toBool(), true);
+ QCOMPARE(intSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_0);
+ QTest::keyRelease(&window, Qt::Key_0, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QCOMPARE(intInput->text(), QLatin1String("11"));
+ QCOMPARE(intInput->hasAcceptableInput(), true);
+ QCOMPARE(intInput->property("acceptable").toBool(), true);
+ QCOMPARE(intSpy.count(), 1);
+
+ QQuickTextInput *dblInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("dblInput")));
+ QVERIFY(dblInput);
+ QSignalSpy dblSpy(dblInput, SIGNAL(acceptableInputChanged()));
+
+ QQuickDoubleValidator *dblValidator = qobject_cast<QQuickDoubleValidator *>(dblInput->validator());
+ QVERIFY(dblValidator);
+ QCOMPARE(dblValidator->localeName(), defaultLocale.name());
+ QCOMPARE(dblInput->validator()->locale(), defaultLocale);
+ dblValidator->setLocaleName(enLocale.name());
+ QCOMPARE(dblValidator->localeName(), enLocale.name());
+ QCOMPARE(dblInput->validator()->locale(), enLocale);
+ dblValidator->resetLocaleName();
+ QCOMPARE(dblValidator->localeName(), defaultLocale.name());
+ QCOMPARE(dblInput->validator()->locale(), defaultLocale);
+
+ dblInput->setFocus(true);
+ QVERIFY(dblInput->hasActiveFocus() == true);
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("1"));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 0);
+ QTest::keyPress(&window, Qt::Key_2);
+ QTest::keyRelease(&window, Qt::Key_2, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_Comma);
+ QTest::keyRelease(&window, Qt::Key_Comma, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12,"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12,"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ dblValidator->setLocaleName(deLocale.name());
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12,1"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12,11"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12,1"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12,"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ dblValidator->resetLocaleName();
+ QTest::keyPress(&window, Qt::Key_Period);
+ QTest::keyRelease(&window, Qt::Key_Period, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12."));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12.1"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12.11"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12.11"));
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblSpy.count(), 1);
+
+ // Ensure the validator doesn't prevent characters being removed.
+ dblInput->setValidator(intInput->validator());
+ QCOMPARE(dblInput->text(), QLatin1String("12.11"));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12.1"));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
+ // Once unacceptable input is in anything goes until it reaches an acceptable state again.
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12.11"));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblSpy.count(), 2);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12.1"));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12."));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("12"));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(dblInput->text(), QLatin1String("1"));
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblSpy.count(), 2);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QCOMPARE(dblInput->text(), QLatin1String("11"));
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblSpy.count(), 3);
+
+ // Changing the validator properties will re-evaluate whether the input is acceptable.
+ intValidator->setTop(10);
+ QCOMPARE(dblInput->property("acceptable").toBool(), false);
+ QCOMPARE(dblInput->hasAcceptableInput(), false);
+ QCOMPARE(dblSpy.count(), 4);
+ intValidator->setTop(12);
+ QCOMPARE(dblInput->property("acceptable").toBool(), true);
+ QCOMPARE(dblInput->hasAcceptableInput(), true);
+ QCOMPARE(dblSpy.count(), 5);
+
+ QQuickTextInput *strInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("strInput")));
+ QVERIFY(strInput);
+ QSignalSpy strSpy(strInput, SIGNAL(acceptableInputChanged()));
+ strInput->setFocus(true);
+ QVERIFY(strInput->hasActiveFocus() == true);
+ QCOMPARE(strInput->hasAcceptableInput(), false);
+ QCOMPARE(strInput->property("acceptable").toBool(), false);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(strInput->text(), QLatin1String(""));
+ QCOMPARE(strInput->hasAcceptableInput(), false);
+ QCOMPARE(strInput->property("acceptable").toBool(), false);
+ QCOMPARE(strSpy.count(), 0);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(strInput->text(), QLatin1String("a"));
+ QCOMPARE(strInput->hasAcceptableInput(), false);
+ QCOMPARE(strInput->property("acceptable").toBool(), false);
+ QCOMPARE(strSpy.count(), 0);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(strInput->text(), QLatin1String("aa"));
+ QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(strInput->text(), QLatin1String("aaa"));
+ QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(strInput->text(), QLatin1String("aaaa"));
+ QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(strInput->text(), QLatin1String("aaaa"));
+ QCOMPARE(strInput->hasAcceptableInput(), true);
+ QCOMPARE(strInput->property("acceptable").toBool(), true);
+ QCOMPARE(strSpy.count(), 1);
+
+ QQuickTextInput *unvalidatedInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("unvalidatedInput")));
+ QVERIFY(unvalidatedInput);
+ QSignalSpy unvalidatedSpy(unvalidatedInput, SIGNAL(acceptableInputChanged()));
+ unvalidatedInput->setFocus(true);
+ QVERIFY(unvalidatedInput->hasActiveFocus() == true);
+ QCOMPARE(unvalidatedInput->hasAcceptableInput(), true);
+ QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true);
+ QTest::keyPress(&window, Qt::Key_1);
+ QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1"));
+ QCOMPARE(unvalidatedInput->hasAcceptableInput(), true);
+ QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true);
+ QCOMPARE(unvalidatedSpy.count(), 0);
+ QTest::keyPress(&window, Qt::Key_A);
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QTest::qWait(50);
+ QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1a"));
+ QCOMPARE(unvalidatedInput->hasAcceptableInput(), true);
+ QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true);
+ QCOMPARE(unvalidatedSpy.count(), 0);
+}
+
+void tst_qquicktextinput::inputMethods()
+{
+ QQuickView window(testFileUrl("inputmethods.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ // test input method hints
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(input != 0);
+ QVERIFY(input->inputMethodHints() & Qt::ImhNoPredictiveText);
+ QSignalSpy inputMethodHintSpy(input, SIGNAL(inputMethodHintsChanged()));
+ input->setInputMethodHints(Qt::ImhUppercaseOnly);
+ QVERIFY(input->inputMethodHints() & Qt::ImhUppercaseOnly);
+ QCOMPARE(inputMethodHintSpy.count(), 1);
+ input->setInputMethodHints(Qt::ImhUppercaseOnly);
+ QCOMPARE(inputMethodHintSpy.count(), 1);
+
+ // default value
+ QQuickTextInput plainInput;
+ QCOMPARE(plainInput.inputMethodHints(), Qt::ImhNone);
+
+ input->setFocus(true);
+ QVERIFY(input->hasActiveFocus() == true);
+ // test that input method event is committed
+ QInputMethodEvent event;
+ event.setCommitString( "My ", -12, 0);
+ QTRY_COMPARE(qGuiApp->focusObject(), input);
+ QGuiApplication::sendEvent(input, &event);
+ QCOMPARE(input->text(), QString("My Hello world!"));
+
+ input->setCursorPosition(2);
+ event.setCommitString("Your", -2, 2);
+ QGuiApplication::sendEvent(input, &event);
+ QCOMPARE(input->text(), QString("Your Hello world!"));
+ QCOMPARE(input->cursorPosition(), 4);
+
+ input->setCursorPosition(7);
+ event.setCommitString("Goodbye", -2, 5);
+ QGuiApplication::sendEvent(input, &event);
+ QCOMPARE(input->text(), QString("Your Goodbye world!"));
+ QCOMPARE(input->cursorPosition(), 12);
+
+ input->setCursorPosition(8);
+ event.setCommitString("Our", -8, 4);
+ QGuiApplication::sendEvent(input, &event);
+ QCOMPARE(input->text(), QString("Our Goodbye world!"));
+ QCOMPARE(input->cursorPosition(), 7);
+
+ // input should reset selection even if replacement parameters are out of bounds
+ input->setText("text");
+ input->setCursorPosition(0);
+ input->moveCursorSelection(input->text().length());
+ event.setCommitString("replacement", -input->text().length(), input->text().length());
+ QGuiApplication::sendEvent(input, &event);
+ QCOMPARE(input->selectionStart(), input->selectionEnd());
+
+ QInputMethodQueryEvent enabledQueryEvent(Qt::ImEnabled);
+ QGuiApplication::sendEvent(input, &enabledQueryEvent);
+ QCOMPARE(enabledQueryEvent.value(Qt::ImEnabled).toBool(), true);
+
+ input->setReadOnly(true);
+ QGuiApplication::sendEvent(input, &enabledQueryEvent);
+ QCOMPARE(enabledQueryEvent.value(Qt::ImEnabled).toBool(), false);
+}
+
+/*
+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_qquicktextinput::navigation()
+{
+ QQuickView window(testFileUrl("navigation.qml"));
+ window.show();
+ window.requestActivate();
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+
+ QVERIFY(input != 0);
+ input->setCursorPosition(0);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == false);
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == true);
+ //QT-2944: If text is selected, ensure we deselect upon cursor motion
+ input->setCursorPosition(input->text().length());
+ input->select(0,input->text().length());
+ QVERIFY(input->selectionStart() != input->selectionEnd());
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->selectionStart() == input->selectionEnd());
+ QVERIFY(input->selectionStart() == input->text().length());
+ QVERIFY(input->hasActiveFocus() == true);
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == false);
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == true);
+
+ // Up and Down should NOT do Home/End, even on Mac OS X (QTBUG-10438).
+ input->setCursorPosition(2);
+ QCOMPARE(input->cursorPosition(),2);
+ simulateKey(&window, Qt::Key_Up);
+ QCOMPARE(input->cursorPosition(),2);
+ simulateKey(&window, Qt::Key_Down);
+ QCOMPARE(input->cursorPosition(),2);
+
+ // Test left and right navigation works if the TextInput is empty (QTBUG-25447).
+ input->setText(QString());
+ QCOMPARE(input->cursorPosition(), 0);
+ simulateKey(&window, Qt::Key_Right);
+ QCOMPARE(input->hasActiveFocus(), false);
+ simulateKey(&window, Qt::Key_Left);
+ QCOMPARE(input->hasActiveFocus(), true);
+ simulateKey(&window, Qt::Key_Left);
+ QCOMPARE(input->hasActiveFocus(), false);
+}
+
+void tst_qquicktextinput::navigation_RTL()
+{
+ QQuickView window(testFileUrl("navigation.qml"));
+ window.show();
+ window.requestActivate();
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+
+ QVERIFY(input != 0);
+ const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647};
+ input->setText(QString::fromUtf16(arabic_str, 11));
+
+ input->setCursorPosition(0);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
+
+ // move off
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == false);
+
+ // move back
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == true);
+
+ input->setCursorPosition(input->text().length());
+ QVERIFY(input->hasActiveFocus() == true);
+
+ // move off
+ simulateKey(&window, Qt::Key_Left);
+ QVERIFY(input->hasActiveFocus() == false);
+
+ // move back
+ simulateKey(&window, Qt::Key_Right);
+ QVERIFY(input->hasActiveFocus() == true);
+}
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextinput::copyAndPaste()
+{
+ if (!PlatformQuirks::isClipboardAvailable())
+ QSKIP("This machine doesn't support the clipboard");
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"Hello world!\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ // copy and paste
+ QCOMPARE(textInput->text().length(), 12);
+ textInput->select(0, textInput->text().length());
+ textInput->copy();
+ QCOMPARE(textInput->selectedText(), QString("Hello world!"));
+ QCOMPARE(textInput->selectedText().length(), 12);
+ textInput->setCursorPosition(0);
+ QVERIFY(textInput->canPaste());
+ textInput->paste();
+ QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textInput->text().length(), 24);
+
+ // can paste
+ QVERIFY(textInput->canPaste());
+ textInput->setReadOnly(true);
+ QVERIFY(!textInput->canPaste());
+ textInput->paste();
+ QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textInput->text().length(), 24);
+ textInput->setReadOnly(false);
+ QVERIFY(textInput->canPaste());
+
+ // cut: no selection
+ textInput->cut();
+ QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
+
+ // select word
+ textInput->setCursorPosition(0);
+ textInput->selectWord();
+ QCOMPARE(textInput->selectedText(), QString("Hello"));
+
+ // cut: read only.
+ textInput->setReadOnly(true);
+ textInput->cut();
+ QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
+ textInput->setReadOnly(false);
+
+ // select all and cut
+ textInput->selectAll();
+ textInput->cut();
+ QCOMPARE(textInput->text().length(), 0);
+ textInput->paste();
+ QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textInput->text().length(), 24);
+
+ // Copy first word.
+ textInput->setCursorPosition(0);
+ textInput->selectWord();
+ textInput->copy();
+ // copy: no selection, previous copy retained;
+ textInput->setCursorPosition(0);
+ QCOMPARE(textInput->selectedText(), QString());
+ textInput->copy();
+ textInput->setText(QString());
+ textInput->paste();
+ QCOMPARE(textInput->text(), QString("Hello"));
+
+ // clear copy buffer
+ QClipboard *clipboard = QGuiApplication::clipboard();
+ QVERIFY(clipboard);
+ clipboard->clear();
+ QVERIFY(!textInput->canPaste());
+
+ // test that copy functionality is disabled
+ // when echo mode is set to hide text/password mode
+ int index = 0;
+ while (index < 4) {
+ QQuickTextInput::EchoMode echoMode = QQuickTextInput::EchoMode(index);
+ textInput->setEchoMode(echoMode);
+ textInput->setText("My password");
+ textInput->select(0, textInput->text().length());
+ textInput->copy();
+ if (echoMode == QQuickTextInput::Normal) {
+ QVERIFY(!clipboard->text().isEmpty());
+ QCOMPARE(clipboard->text(), QString("My password"));
+ clipboard->clear();
+ } else {
+ QVERIFY(clipboard->text().isEmpty());
+ }
+ index++;
+ }
+
+ delete textInput;
+}
+#endif
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextinput::copyAndPasteKeySequence()
+{
+ if (!PlatformQuirks::isClipboardAvailable())
+ QSKIP("This machine doesn't support the clipboard");
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"Hello world!\"; focus: true }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ // copy and paste
+ QVERIFY(textInput->hasActiveFocus());
+ QCOMPARE(textInput->text().length(), 12);
+ textInput->select(0, textInput->text().length());
+ simulateKeys(&window, QKeySequence::Copy);
+ QCOMPARE(textInput->selectedText(), QString("Hello world!"));
+ QCOMPARE(textInput->selectedText().length(), 12);
+ textInput->setCursorPosition(0);
+ QVERIFY(textInput->canPaste());
+ simulateKeys(&window, QKeySequence::Paste);
+ QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textInput->text().length(), 24);
+
+ // select all and cut
+ simulateKeys(&window, QKeySequence::SelectAll);
+ simulateKeys(&window, QKeySequence::Cut);
+ QCOMPARE(textInput->text().length(), 0);
+ simulateKeys(&window, QKeySequence::Paste);
+ QCOMPARE(textInput->text(), QString("Hello world!Hello world!"));
+ QCOMPARE(textInput->text().length(), 24);
+
+ // clear copy buffer
+ QClipboard *clipboard = QGuiApplication::clipboard();
+ QVERIFY(clipboard);
+ clipboard->clear();
+ QVERIFY(!textInput->canPaste());
+
+ // test that copy functionality is disabled
+ // when echo mode is set to hide text/password mode
+ int index = 0;
+ while (index < 4) {
+ QQuickTextInput::EchoMode echoMode = QQuickTextInput::EchoMode(index);
+ textInput->setEchoMode(echoMode);
+ textInput->setText("My password");
+ textInput->select(0, textInput->text().length());
+ simulateKeys(&window, QKeySequence::Copy);
+ if (echoMode == QQuickTextInput::Normal) {
+ QVERIFY(!clipboard->text().isEmpty());
+ QCOMPARE(clipboard->text(), QString("My password"));
+ clipboard->clear();
+ } else {
+ QVERIFY(clipboard->text().isEmpty());
+ }
+ index++;
+ }
+
+ delete textInput;
+}
+#endif
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextinput::canPasteEmpty()
+{
+ QGuiApplication::clipboard()->clear();
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"Hello world!\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0;
+ QCOMPARE(textInput->canPaste(), cp);
+}
+#endif
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextinput::canPaste()
+{
+ QGuiApplication::clipboard()->setText("Some text");
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"Hello world!\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0;
+ QCOMPARE(textInput->canPaste(), cp);
+}
+#endif
+
+#ifndef QT_NO_CLIPBOARD
+void tst_qquicktextinput::middleClickPaste()
+{
+ if (!PlatformQuirks::isClipboardAvailable())
+ QSKIP("This machine doesn't support the clipboard");
+
+ QQuickView window(testFileUrl("mouseselection_true.qml"));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject());
+ QVERIFY(textInputObject != 0);
+
+ textInputObject->setFocus(true);
+
+ QString originalText = textInputObject->text();
+ QString selectedText = "234567";
+
+ // press-and-drag-and-release from x1 to x2
+ const QPoint p1 = textInputObject->positionToRectangle(2).center().toPoint();
+ const QPoint p2 = textInputObject->positionToRectangle(8).center().toPoint();
+ const QPoint p3 = textInputObject->positionToRectangle(1).center().toPoint();
+ QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTest::mouseMove(&window, p2);
+ QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2);
+ QTRY_COMPARE(textInputObject->selectedText(), selectedText);
+
+ // Middle click pastes the selected text, assuming the platform supports it.
+ QTest::mouseClick(&window, Qt::MiddleButton, Qt::NoModifier, p3);
+
+ // ### This is to prevent double click detection from carrying over to the next test.
+ QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10);
+
+ if (QGuiApplication::clipboard()->supportsSelection())
+ QCOMPARE(textInputObject->text().mid(1, selectedText.length()), selectedText);
+ else
+ QCOMPARE(textInputObject->text(), originalText);
+}
+#endif
+
+void tst_qquicktextinput::passwordCharacter()
+{
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"Hello world!\"; font.family: \"Helvetica\"; echoMode: TextInput.Password }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ textInput->setPasswordCharacter("X");
+ qreal implicitWidth = textInput->implicitWidth();
+ textInput->setPasswordCharacter(".");
+
+ // QTBUG-12383 content is updated and redrawn
+ QVERIFY(textInput->implicitWidth() < implicitWidth);
+
+ delete textInput;
+}
+
+void tst_qquicktextinput::cursorDelegate_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::newRow("out of line") << testFileUrl("cursorTest.qml");
+ QTest::newRow("in line") << testFileUrl("cursorTestInline.qml");
+ QTest::newRow("external") << testFileUrl("cursorTestExternal.qml");
+}
+
+void tst_qquicktextinput::cursorDelegate()
+{
+ QFETCH(QUrl, source);
+ QQuickView view(source);
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject");
+ QVERIFY(textInputObject != 0);
+ // Delegate is created on demand, and so won't be available immediately. Focus in or
+ // setCursorVisible(true) will trigger creation.
+ QTRY_VERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance"));
+ QVERIFY(!textInputObject->isCursorVisible());
+ //Test Delegate gets created
+ textInputObject->setFocus(true);
+ QVERIFY(textInputObject->isCursorVisible());
+ QQuickItem* delegateObject = textInputObject->findChild<QQuickItem*>("cursorInstance");
+ QVERIFY(delegateObject);
+ QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello"));
+ //Test Delegate gets moved
+ for (int i=0; i<= textInputObject->text().length(); i++) {
+ textInputObject->setCursorPosition(i);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+ }
+ textInputObject->setCursorPosition(0);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+
+ // Test delegate gets moved on mouse press.
+ textInputObject->setSelectByMouse(true);
+ textInputObject->setCursorPosition(0);
+ const QPoint point1 = textInputObject->positionToRectangle(5).center().toPoint();
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mouseClick(&view, Qt::LeftButton, 0, point1);
+ QTest::qWait(50);
+ QTRY_VERIFY(textInputObject->cursorPosition() != 0);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+
+ // Test delegate gets moved on mouse drag
+ textInputObject->setCursorPosition(0);
+ const QPoint point2 = textInputObject->positionToRectangle(10).center().toPoint();
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mousePress(&view, Qt::LeftButton, 0, point1);
+ QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QGuiApplication::sendEvent(&view, &mv);
+ QTest::mouseRelease(&view, Qt::LeftButton, 0, point2);
+ QTest::qWait(50);
+ QTRY_COMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+
+ textInputObject->setReadOnly(true);
+ textInputObject->setCursorPosition(0);
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mouseClick(&view, Qt::LeftButton, 0, textInputObject->positionToRectangle(5).center().toPoint());
+ QTest::qWait(50);
+ QTRY_VERIFY(textInputObject->cursorPosition() != 0);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+
+ textInputObject->setCursorPosition(0);
+ QTest::qWait(400); //ensure this isn't treated as a double-click
+ QTest::mouseClick(&view, Qt::LeftButton, 0, textInputObject->positionToRectangle(5).center().toPoint());
+ QTest::qWait(50);
+ QTRY_VERIFY(textInputObject->cursorPosition() != 0);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+
+ textInputObject->setCursorPosition(0);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+
+ textInputObject->setReadOnly(false);
+
+ // Delegate moved when text is entered
+ textInputObject->setText(QString());
+ for (int i = 0; i < 20; ++i) {
+ QTest::keyClick(&view, Qt::Key_A);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+ }
+
+ // Delegate moved when text is entered by im.
+ textInputObject->setText(QString());
+ for (int i = 0; i < 20; ++i) {
+ QInputMethodEvent event;
+ event.setCommitString("w");
+ QGuiApplication::sendEvent(textInputObject, &event);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+ }
+ // Delegate moved when text is removed by im.
+ for (int i = 19; i > 1; --i) {
+ QInputMethodEvent event;
+ event.setCommitString(QString(), -1, 1);
+ QGuiApplication::sendEvent(textInputObject, &event);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+ }
+ { // Delegate moved the text is changed in place by im.
+ QInputMethodEvent event;
+ event.setCommitString("i", -1, 1);
+ QGuiApplication::sendEvent(textInputObject, &event);
+ QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
+ QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y());
+ }
+
+ //Test Delegate gets deleted
+ textInputObject->setCursorDelegate(0);
+ QVERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance"));
+}
+
+void tst_qquicktextinput::remoteCursorDelegate()
+{
+ QSKIP("This test is unstable");
+ TestHTTPServer server(SERVER_PORT);
+ server.serveDirectory(dataDirectory(), TestHTTPServer::Delay);
+
+ QQuickView view;
+
+ QQmlComponent component(view.engine(), QUrl(SERVER_ADDR "/RemoteCursor.qml"));
+
+ view.rootContext()->setContextProperty("contextDelegate", &component);
+ view.setSource(testFileUrl("cursorTestRemote.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject");
+ QVERIFY(textInputObject != 0);
+
+ // Delegate is created on demand, and so won't be available immediately. Focus in or
+ // setCursorVisible(true) will trigger creation.
+ QTRY_VERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance"));
+ QVERIFY(!textInputObject->isCursorVisible());
+
+ textInputObject->setFocus(true);
+ QVERIFY(textInputObject->isCursorVisible());
+
+ QCOMPARE(component.status(), QQmlComponent::Loading);
+ QVERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance"));
+ server.sendDelayedItem();
+
+ // Wait for component to load.
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
+ QVERIFY(textInputObject->findChild<QQuickItem*>("cursorInstance"));
+}
+
+void tst_qquicktextinput::cursorVisible()
+{
+ QSKIP("This test is unstable");
+ QQuickTextInput input;
+ input.componentComplete();
+ QSignalSpy spy(&input, SIGNAL(cursorVisibleChanged(bool)));
+
+ QQuickView view(testFileUrl("cursorVisible.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QCOMPARE(input.isCursorVisible(), false);
+
+ input.setCursorVisible(true);
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 1);
+
+ input.setCursorVisible(false);
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ input.setFocus(true);
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ input.setParentItem(view.rootObject());
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 3);
+
+ input.setFocus(false);
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 4);
+
+ input.setFocus(true);
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 5);
+
+ QQuickView alternateView;
+ alternateView.show();
+ alternateView.requestActivate();
+ QTest::qWaitForWindowActive(&alternateView);
+
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 6);
+
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 7);
+
+ { // Cursor attribute with 0 length hides cursor.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QCoreApplication::sendEvent(&input, &ev);
+ }
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 8);
+
+ { // Cursor attribute with non zero length shows cursor.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 1, QVariant()));
+ QCoreApplication::sendEvent(&input, &ev);
+ }
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 9);
+
+ { // If the cursor is hidden by the input method and the text is changed it should be visible again.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QCoreApplication::sendEvent(&input, &ev);
+ }
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 10);
+
+ input.setText("something");
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 11);
+
+ { // If the cursor is hidden by the input method and the cursor position is changed it should be visible again.
+ QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QCoreApplication::sendEvent(&input, &ev);
+ }
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 12);
+
+ input.setCursorPosition(5);
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 13);
+}
+
+void tst_qquicktextinput::cursorRectangle_data()
+{
+ const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647};
+
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<int>("positionAtWidth");
+ QTest::addColumn<int>("wrapPosition");
+ QTest::addColumn<QString>("shortText");
+ QTest::addColumn<bool>("leftToRight");
+
+ QTest::newRow("left to right")
+ << "Hello World!" << 5 << 11
+ << "Hi"
+ << true;
+ QTest::newRow("right to left")
+ << QString::fromUtf16(arabic_str, lengthOf(arabic_str)) << 5 << 11
+ << QString::fromUtf16(arabic_str, 3)
+ << false;
+}
+
+void tst_qquicktextinput::cursorRectangle()
+{
+ QFETCH(QString, text);
+ QFETCH(int, positionAtWidth);
+ QFETCH(int, wrapPosition);
+ QFETCH(QString, shortText);
+ QFETCH(bool, leftToRight);
+
+ QQuickTextInput input;
+ input.setText(text);
+ input.componentComplete();
+
+ QTextLayout layout(text);
+ layout.setFont(input.font());
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ qreal offset = 0;
+ if (leftToRight) {
+ input.setWidth(line.cursorToX(positionAtWidth, QTextLine::Leading));
+ } else {
+ input.setWidth(line.horizontalAdvance() - line.cursorToX(positionAtWidth, QTextLine::Leading));
+ offset = line.horizontalAdvance() - input.width();
+ }
+ input.setHeight(qCeil(line.height() * 3 / 2));
+
+ QRectF r;
+
+ for (int i = 0; i <= positionAtWidth; ++i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+
+ QCOMPARE(r.left(), line.cursorToX(i, QTextLine::Leading) - offset);
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ // Check the cursor rectangle remains within the input bounding rect when auto scrolling.
+ QCOMPARE(r.left(), leftToRight ? input.width() : 0);
+
+ for (int i = positionAtWidth + 1; i < text.length(); ++i) {
+ input.setCursorPosition(i);
+ QCOMPARE(r, input.cursorRectangle());
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ for (int i = text.length() - 2; i >= 0; --i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+ QCOMPARE(r.top(), 0.);
+ if (leftToRight) {
+ QVERIFY(r.right() >= 0);
+ } else {
+ QVERIFY(r.left() <= input.width());
+ }
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ // Check position with word wrap.
+ input.setWrapMode(QQuickTextInput::WordWrap);
+ input.setAutoScroll(false);
+ for (int i = 0; i < wrapPosition; ++i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+
+ QCOMPARE(r.left(), line.cursorToX(i, QTextLine::Leading) - offset);
+ QCOMPARE(r.top(), 0.);
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ input.setCursorPosition(wrapPosition);
+ r = input.cursorRectangle();
+ if (leftToRight) {
+ QCOMPARE(r.left(), 0.);
+ } else {
+ QCOMPARE(r.left(), input.width());
+ }
+ QVERIFY(r.top() >= line.height() - 1);
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(11), r);
+
+ for (int i = wrapPosition + 1; i < text.length(); ++i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+ QVERIFY(r.top() >= line.height() - 1);
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ // Check vertical scrolling with word wrap.
+ input.setAutoScroll(true);
+ for (int i = 0; i <= positionAtWidth; ++i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+
+ QCOMPARE(r.left(), line.cursorToX(i, QTextLine::Leading) - offset);
+ QCOMPARE(r.top(), 0.);
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ // Whitespace doesn't wrap, so scroll horizontally until the until the cursor
+ // reaches the next non-whitespace character.
+ QCOMPARE(r.left(), leftToRight ? input.width() : 0);
+ for (int i = positionAtWidth + 1; i < wrapPosition && leftToRight; ++i) {
+ input.setCursorPosition(i);
+ QCOMPARE(r, input.cursorRectangle());
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ input.setCursorPosition(wrapPosition);
+ r = input.cursorRectangle();
+ if (leftToRight) {
+ QCOMPARE(r.left(), 0.);
+ } else {
+ QCOMPARE(r.left(), input.width());
+ }
+ QVERIFY(r.bottom() >= input.height());
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(11), r);
+
+ for (int i = wrapPosition + 1; i < text.length(); ++i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+ QVERIFY(r.bottom() >= input.height());
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ for (int i = text.length() - 2; i >= wrapPosition; --i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+ QVERIFY(r.bottom() >= input.height());
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ input.setCursorPosition(wrapPosition - 1);
+ r = input.cursorRectangle();
+ QCOMPARE(r.top(), 0.);
+ QCOMPARE(r.left(), leftToRight ? input.width() : 0);
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(10), r);
+
+ for (int i = wrapPosition - 2; i >= positionAtWidth + 1; --i) {
+ input.setCursorPosition(i);
+ QCOMPARE(r, input.cursorRectangle());
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ for (int i = positionAtWidth; i >= 0; --i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+ QCOMPARE(r.top(), 0.);
+ QCOMPARE(input.inputMethodQuery(Qt::ImCursorRectangle).toRectF(), r);
+ QCOMPARE(input.positionToRectangle(i), r);
+ }
+
+ input.setText(shortText);
+ input.setHAlign(leftToRight ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft);
+ r = input.cursorRectangle();
+ QCOMPARE(r.left(), leftToRight ? input.width() : 0);
+
+ QSignalSpy cursorRectangleSpy(&input, SIGNAL(cursorRectangleChanged()));
+
+ QString widerText = shortText;
+ widerText[1] = 'W'; // Assumes shortText is at least two characters long.
+ input.setText(widerText);
+
+ QCOMPARE(cursorRectangleSpy.count(), 1);
+}
+
+void tst_qquicktextinput::readOnly()
+{
+ QQuickView window(testFileUrl("readOnly.qml"));
+ window.show();
+ window.requestActivate();
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+
+ QVERIFY(input != 0);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
+ QVERIFY(input->isReadOnly() == true);
+ QString initial = input->text();
+ for (int k=Qt::Key_0; k<=Qt::Key_Z; k++)
+ simulateKey(&window, k);
+ simulateKey(&window, Qt::Key_Return);
+ simulateKey(&window, Qt::Key_Space);
+ simulateKey(&window, Qt::Key_Escape);
+ QCOMPARE(input->text(), initial);
+
+ input->setCursorPosition(3);
+ input->setReadOnly(false);
+ QCOMPARE(input->isReadOnly(), false);
+ QCOMPARE(input->cursorPosition(), input->text().length());
+}
+
+void tst_qquicktextinput::echoMode()
+{
+ QQuickView window(testFileUrl("echoMode.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+
+ QVERIFY(input != 0);
+ QTRY_VERIFY(input->hasActiveFocus() == true);
+ QString initial = input->text();
+ Qt::InputMethodHints ref;
+ QCOMPARE(initial, QLatin1String("ABCDefgh"));
+ QCOMPARE(input->echoMode(), QQuickTextInput::Normal);
+ QCOMPARE(input->displayText(), input->text());
+ //Normal
+ ref &= ~Qt::ImhHiddenText;
+ ref &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
+ QCOMPARE((Qt::InputMethodHints) input->inputMethodQuery(Qt::ImHints).toInt(), ref);
+ input->setEchoMode(QQuickTextInput::NoEcho);
+ QCOMPARE(input->text(), initial);
+ QCOMPARE(input->displayText(), QLatin1String(""));
+ QCOMPARE(input->passwordCharacter(), QLatin1String("*"));
+ //NoEcho
+ ref |= Qt::ImhHiddenText;
+ ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
+ QCOMPARE((Qt::InputMethodHints) input->inputMethodQuery(Qt::ImHints).toInt(), ref);
+ input->setEchoMode(QQuickTextInput::Password);
+ //Password
+ ref |= Qt::ImhHiddenText;
+ ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
+ QCOMPARE(input->text(), initial);
+ QCOMPARE(input->displayText(), QLatin1String("********"));
+ QCOMPARE((Qt::InputMethodHints) input->inputMethodQuery(Qt::ImHints).toInt(), ref);
+ // clearing input hints do not clear bits set by echo mode
+ input->setInputMethodHints(Qt::ImhNone);
+ QCOMPARE((Qt::InputMethodHints) input->inputMethodQuery(Qt::ImHints).toInt(), ref);
+ input->setPasswordCharacter(QChar('Q'));
+ QCOMPARE(input->passwordCharacter(), QLatin1String("Q"));
+ QCOMPARE(input->text(), initial);
+ QCOMPARE(input->displayText(), QLatin1String("QQQQQQQQ"));
+ input->setEchoMode(QQuickTextInput::PasswordEchoOnEdit);
+ //PasswordEchoOnEdit
+ ref &= ~Qt::ImhHiddenText;
+ ref |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText | Qt::ImhSensitiveData);
+ QCOMPARE((Qt::InputMethodHints) input->inputMethodQuery(Qt::ImHints).toInt(), ref);
+ QCOMPARE(input->text(), initial);
+ QCOMPARE(input->displayText(), QLatin1String("QQQQQQQQ"));
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("QQQQQQQQ"));
+ QTest::keyPress(&window, Qt::Key_A);//Clearing previous entry is part of PasswordEchoOnEdit
+ QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier ,10);
+ QCOMPARE(input->text(), QLatin1String("a"));
+ QCOMPARE(input->displayText(), QLatin1String("a"));
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("a"));
+ input->setFocus(false);
+ QVERIFY(input->hasActiveFocus() == false);
+ QCOMPARE(input->displayText(), QLatin1String("Q"));
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("Q"));
+ input->setFocus(true);
+ QVERIFY(input->hasActiveFocus());
+ QInputMethodEvent inputEvent;
+ inputEvent.setCommitString(initial);
+ QGuiApplication::sendEvent(input, &inputEvent);
+ QCOMPARE(input->text(), initial);
+ QCOMPARE(input->displayText(), initial);
+ QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), initial);
+}
+
+void tst_qquicktextinput::passwordEchoDelay()
+{
+ int maskDelay = qGuiApp->styleHints()->passwordMaskDelay();
+ if (maskDelay <= 0)
+ QSKIP("No mask delay in use");
+ QQuickView window(testFileUrl("echoMode.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(window.rootObject() != 0);
+
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput")));
+ QVERIFY(input);
+ QVERIFY(input->hasActiveFocus());
+
+ QQuickItem *cursor = input->findChild<QQuickItem *>("cursor");
+ QVERIFY(cursor);
+
+ QChar fillChar = QLatin1Char('*');
+
+ input->setEchoMode(QQuickTextInput::Password);
+ QCOMPARE(input->displayText(), QString(8, fillChar));
+ input->setText(QString());
+ QCOMPARE(input->displayText(), QString());
+
+ QTest::keyPress(&window, '0');
+ QTest::keyPress(&window, '1');
+ QTest::keyPress(&window, '2');
+ QCOMPARE(input->displayText(), QString(2, fillChar) + QLatin1Char('2'));
+ QTest::keyPress(&window, '3');
+ QTest::keyPress(&window, '4');
+ QCOMPARE(input->displayText(), QString(4, fillChar) + QLatin1Char('4'));
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QCOMPARE(input->displayText(), QString(4, fillChar));
+ QTest::keyPress(&window, '4');
+ QCOMPARE(input->displayText(), QString(4, fillChar) + QLatin1Char('4'));
+ QCOMPARE(input->cursorRectangle().topLeft(), cursor->position());
+
+ // Verify the last character entered is replaced by the fill character after a delay.
+ // Also check the cursor position is updated to accomdate a size difference between
+ // the fill character and the replaced character.
+ QSignalSpy cursorSpy(input, SIGNAL(cursorRectangleChanged()));
+ QTest::qWait(maskDelay);
+ QTRY_COMPARE(input->displayText(), QString(5, fillChar));
+ QCOMPARE(cursorSpy.count(), 1);
+ QCOMPARE(input->cursorRectangle().topLeft(), cursor->position());
+
+ QTest::keyPress(&window, '5');
+ QCOMPARE(input->displayText(), QString(5, fillChar) + QLatin1Char('5'));
+ input->setFocus(false);
+ QVERIFY(!input->hasFocus());
+ QCOMPARE(input->displayText(), QString(6, fillChar));
+ input->setFocus(true);
+ QTRY_VERIFY(input->hasFocus());
+ QCOMPARE(input->displayText(), QString(6, fillChar));
+ QTest::keyPress(&window, '6');
+ QCOMPARE(input->displayText(), QString(6, fillChar) + QLatin1Char('6'));
+
+ QInputMethodEvent ev;
+ ev.setCommitString(QLatin1String("7"));
+ QGuiApplication::sendEvent(input, &ev);
+ QCOMPARE(input->displayText(), QString(7, fillChar) + QLatin1Char('7'));
+
+ input->setCursorPosition(3);
+ QCOMPARE(input->displayText(), QString(7, fillChar) + QLatin1Char('7'));
+ QTest::keyPress(&window, 'a');
+ QCOMPARE(input->displayText(), QString(3, fillChar) + QLatin1Char('a') + QString(5, fillChar));
+ QTest::keyPress(&window, Qt::Key_Backspace);
+ QCOMPARE(input->displayText(), QString(8, fillChar));
+}
+
+
+void tst_qquicktextinput::simulateKey(QWindow *view, int key)
+{
+ QKeyEvent press(QKeyEvent::KeyPress, key, 0);
+ QKeyEvent release(QKeyEvent::KeyRelease, key, 0);
+
+ QGuiApplication::sendEvent(view, &press);
+ QGuiApplication::sendEvent(view, &release);
+}
+
+
+void tst_qquicktextinput::focusOnPress()
+{
+ QString componentStr =
+ "import QtQuick 2.0\n"
+ "TextInput {\n"
+ "property bool selectOnFocus: false\n"
+ "width: 100; height: 50\n"
+ "activeFocusOnPress: true\n"
+ "text: \"Hello World\"\n"
+ "onFocusChanged: { if (focus && selectOnFocus) selectAll() }"
+ " }";
+ QQmlComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput*>(texteditComponent.create());
+ QVERIFY(textInputObject != 0);
+ QCOMPARE(textInputObject->focusOnPress(), true);
+ QCOMPARE(textInputObject->hasFocus(), false);
+
+ QSignalSpy focusSpy(textInputObject, SIGNAL(focusChanged(bool)));
+ QSignalSpy activeFocusSpy(textInputObject, SIGNAL(focusChanged(bool)));
+ QSignalSpy activeFocusOnPressSpy(textInputObject, SIGNAL(activeFocusOnPressChanged(bool)));
+
+ textInputObject->setFocusOnPress(true);
+ QCOMPARE(textInputObject->focusOnPress(), true);
+ QCOMPARE(activeFocusOnPressSpy.count(), 0);
+
+ QQuickWindow window;
+ window.resize(100, 50);
+ textInputObject->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QCOMPARE(textInputObject->hasFocus(), false);
+ QCOMPARE(textInputObject->hasActiveFocus(), false);
+
+ QPoint centerPoint(window.width()/2, window.height()/2);
+ Qt::KeyboardModifiers noModifiers = 0;
+ QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(textInputObject->hasFocus(), true);
+ QCOMPARE(textInputObject->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(textInputObject->selectedText(), QString());
+ QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint);
+
+ textInputObject->setFocusOnPress(false);
+ QCOMPARE(textInputObject->focusOnPress(), false);
+ QCOMPARE(activeFocusOnPressSpy.count(), 1);
+
+ textInputObject->setFocus(false);
+ QCOMPARE(textInputObject->hasFocus(), false);
+ QCOMPARE(textInputObject->hasActiveFocus(), false);
+ QCOMPARE(focusSpy.count(), 2);
+ QCOMPARE(activeFocusSpy.count(), 2);
+
+ // Wait for double click timeout to expire before clicking again.
+ QTest::qWait(400);
+ QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(textInputObject->hasFocus(), false);
+ QCOMPARE(textInputObject->hasActiveFocus(), false);
+ QCOMPARE(focusSpy.count(), 2);
+ QCOMPARE(activeFocusSpy.count(), 2);
+ QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint);
+
+ textInputObject->setFocusOnPress(true);
+ QCOMPARE(textInputObject->focusOnPress(), true);
+ QCOMPARE(activeFocusOnPressSpy.count(), 2);
+
+ // Test a selection made in the on(Active)FocusChanged handler isn't overwritten.
+ textInputObject->setProperty("selectOnFocus", true);
+
+ QTest::qWait(400);
+ QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(textInputObject->hasFocus(), true);
+ QCOMPARE(textInputObject->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(), 3);
+ QCOMPARE(activeFocusSpy.count(), 3);
+ QCOMPARE(textInputObject->selectedText(), textInputObject->text());
+ QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint);
+}
+
+void tst_qquicktextinput::openInputPanel()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QQuickView view(testFileUrl("openInputPanel.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject());
+ QVERIFY(input);
+
+ // check default values
+ QVERIFY(input->focusOnPress());
+ QVERIFY(!input->hasActiveFocus());
+ QVERIFY(qApp->focusObject() != input);
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+
+ // input panel should open on focus
+ QPoint centerPoint(view.width()/2, view.height()/2);
+ Qt::KeyboardModifiers noModifiers = 0;
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QVERIFY(input->hasActiveFocus());
+ QCOMPARE(qApp->focusObject(), input);
+ QCOMPARE(qApp->inputMethod()->isVisible(), true);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+
+ // input panel should be re-opened when pressing already focused TextInput
+ qApp->inputMethod()->hide();
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+ QVERIFY(input->hasActiveFocus());
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(qApp->inputMethod()->isVisible(), true);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+
+ // input panel should stay visible if focus is lost to another text inputor
+ QSignalSpy inputPanelVisibilitySpy(qApp->inputMethod(), SIGNAL(visibleChanged()));
+ QQuickTextInput anotherInput;
+ anotherInput.componentComplete();
+ anotherInput.setParentItem(view.rootObject());
+ anotherInput.setFocus(true);
+ QCOMPARE(qApp->inputMethod()->isVisible(), true);
+ QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherInput));
+ QCOMPARE(inputPanelVisibilitySpy.count(), 0);
+
+ anotherInput.setFocus(false);
+ QVERIFY(qApp->focusObject() != &anotherInput);
+ QCOMPARE(view.activeFocusItem(), view.contentItem());
+ anotherInput.setFocus(true);
+
+ qApp->inputMethod()->hide();
+
+ // input panel should not be opened if TextInput is read only
+ input->setReadOnly(true);
+ input->setFocus(true);
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QGuiApplication::processEvents();
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+
+ // input panel should not be opened if focusOnPress is set to false
+ input->setFocusOnPress(false);
+ input->setFocus(false);
+ input->setFocus(true);
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+ QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
+ QCOMPARE(qApp->inputMethod()->isVisible(), false);
+}
+
+class MyTextInput : public QQuickTextInput
+{
+public:
+ MyTextInput(QQuickItem *parent = 0) : QQuickTextInput(parent)
+ {
+ nbPaint = 0;
+ }
+ virtual QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *data)
+ {
+ nbPaint++;
+ return QQuickTextInput::updatePaintNode(node, data);
+ }
+ int nbPaint;
+};
+
+void tst_qquicktextinput::setHAlignClearCache()
+{
+ QQuickView view;
+ view.resize(200, 200);
+ MyTextInput input;
+ input.setText("Hello world");
+ input.setParentItem(view.contentItem());
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QTRY_COMPARE(input.nbPaint, 1);
+ input.setHAlign(QQuickTextInput::AlignRight);
+ //Changing the alignment should trigger a repaint
+ QTRY_COMPARE(input.nbPaint, 2);
+}
+
+void tst_qquicktextinput::focusOutClearSelection()
+{
+ QQuickView view;
+ QQuickTextInput input;
+ QQuickTextInput input2;
+ input.setText(QLatin1String("Hello world"));
+ input.setFocus(true);
+ input2.setParentItem(view.contentItem());
+ input.setParentItem(view.contentItem());
+ input.componentComplete();
+ input2.componentComplete();
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QVERIFY(input.hasActiveFocus());
+ input.select(2,5);
+ //The selection should work
+ QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
+ input2.setFocus(true);
+ QGuiApplication::processEvents();
+ //The input lost the focus selection should be cleared
+ QTRY_COMPARE(input.selectedText(), QLatin1String(""));
+}
+
+void tst_qquicktextinput::focusOutNotClearSelection()
+{
+ QQuickView view;
+ QQuickTextInput input;
+ input.setText(QLatin1String("Hello world"));
+ input.setFocus(true);
+ input.setParentItem(view.contentItem());
+ input.componentComplete();
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QVERIFY(input.hasActiveFocus());
+ input.select(2,5);
+ QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
+
+ // The selection should not be cleared when the focus
+ // out event has one of the following reason:
+ // Qt::ActiveWindowFocusReason
+ // Qt::PopupFocusReason
+
+ input.setFocus(false, Qt::ActiveWindowFocusReason);
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
+ QTRY_COMPARE(input.hasActiveFocus(), false);
+
+ input.setFocus(true);
+ QTRY_COMPARE(input.hasActiveFocus(), true);
+
+ input.setFocus(false, Qt::PopupFocusReason);
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(input.selectedText(), QLatin1String("llo"));
+ QTRY_COMPARE(input.hasActiveFocus(), false);
+
+ input.setFocus(true);
+ QTRY_COMPARE(input.hasActiveFocus(), true);
+
+ input.setFocus(false, Qt::OtherFocusReason);
+ QGuiApplication::processEvents();
+ QTRY_COMPARE(input.selectedText(), QLatin1String(""));
+ QTRY_COMPARE(input.hasActiveFocus(), false);
+}
+
+void tst_qquicktextinput::geometrySignals()
+{
+ QQmlComponent component(&engine, testFileUrl("geometrySignals.qml"));
+ QObject *o = component.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("bindingWidth").toInt(), 400);
+ QCOMPARE(o->property("bindingHeight").toInt(), 500);
+ delete o;
+}
+
+void tst_qquicktextinput::contentSize()
+{
+ QString componentStr = "import QtQuick 2.0\nTextInput { width: 75; height: 16; font.pixelSize: 10 }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickTextInput *textObject = qobject_cast<QQuickTextInput *>(object.data());
+
+ QSignalSpy spy(textObject, SIGNAL(contentSizeChanged()));
+
+ textObject->setText("The quick red fox jumped over the lazy brown dog");
+
+ QVERIFY(textObject->contentWidth() > textObject->width());
+ QVERIFY(textObject->contentHeight() < textObject->height());
+ QCOMPARE(spy.count(), 1);
+
+ textObject->setWrapMode(QQuickTextInput::WordWrap);
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+ QVERIFY(textObject->contentHeight() > textObject->height());
+ QCOMPARE(spy.count(), 2);
+
+ textObject->setText("The quickredfoxjumpedoverthe lazy brown dog");
+
+ QVERIFY(textObject->contentWidth() > textObject->width());
+ QVERIFY(textObject->contentHeight() > textObject->height());
+ QCOMPARE(spy.count(), 3);
+
+ textObject->setText("The quick red fox jumped over the lazy brown dog");
+ for (int w = 60; w < 120; ++w) {
+ textObject->setWidth(w);
+ QVERIFY(textObject->contentWidth() <= textObject->width());
+ QVERIFY(textObject->contentHeight() > textObject->height());
+ }
+}
+
+static void sendPreeditText(QQuickItem *item, const QString &text, int cursor)
+{
+ QInputMethodEvent event(text, QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, text.length(), QVariant()));
+ QCoreApplication::sendEvent(item, &event);
+}
+
+void tst_qquicktextinput::preeditAutoScroll()
+{
+ QString preeditText = "califragisiticexpialidocious!";
+
+ QQuickView view(testFileUrl("preeditAutoScroll.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject());
+ QVERIFY(input);
+ QVERIFY(input->hasActiveFocus());
+
+ input->setWidth(input->implicitWidth());
+
+ QSignalSpy cursorRectangleSpy(input, SIGNAL(cursorRectangleChanged()));
+ int cursorRectangleChanges = 0;
+
+ // test the text is scrolled so the preedit is visible.
+ sendPreeditText(input, preeditText.mid(0, 3), 1);
+ QVERIFY(evaluate<int>(input, QString("positionAt(0)")) != 0);
+ QVERIFY(input->cursorRectangle().left() < input->boundingRect().width());
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
+
+ // test the text is scrolled back when the preedit is removed.
+ QInputMethodEvent imEvent;
+ QCoreApplication::sendEvent(input, &imEvent);
+ QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(0)), 0);
+ QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(input->width())), 5);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
+
+ QTextLayout layout(preeditText);
+ layout.setFont(input->font());
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ // test if the preedit is larger than the text input that the
+ // character preceding the cursor is still visible.
+ qreal x = input->positionToRectangle(0).x();
+ for (int i = 0; i < 3; ++i) {
+ sendPreeditText(input, preeditText, i + 1);
+ int width = ceil(line.cursorToX(i, QTextLine::Trailing)) - floor(line.cursorToX(i));
+ QVERIFY(input->cursorRectangle().right() >= width - 3);
+ QVERIFY(input->positionToRectangle(0).x() < x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
+ x = input->positionToRectangle(0).x();
+ }
+ for (int i = 1; i >= 0; --i) {
+ sendPreeditText(input, preeditText, i + 1);
+ int width = ceil(line.cursorToX(i, QTextLine::Trailing)) - floor(line.cursorToX(i));
+ QVERIFY(input->cursorRectangle().right() >= width - 3);
+ QVERIFY(input->positionToRectangle(0).x() > x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
+ x = input->positionToRectangle(0).x();
+ }
+
+ // Test incrementing the preedit cursor doesn't cause further
+ // scrolling when right most text is visible.
+ sendPreeditText(input, preeditText, preeditText.length() - 3);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
+ x = input->positionToRectangle(0).x();
+ for (int i = 2; i >= 0; --i) {
+ sendPreeditText(input, preeditText, preeditText.length() - i);
+ QCOMPARE(input->positionToRectangle(0).x(), x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
+ }
+ for (int i = 1; i < 3; ++i) {
+ sendPreeditText(input, preeditText, preeditText.length() - i);
+ QCOMPARE(input->positionToRectangle(0).x(), x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
+ }
+
+ // Test disabling auto scroll.
+ QCoreApplication::sendEvent(input, &imEvent);
+
+ input->setAutoScroll(false);
+ sendPreeditText(input, preeditText.mid(0, 3), 1);
+ QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(0)), 0);
+ QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(input->width())), 5);
+}
+
+void tst_qquicktextinput::preeditCursorRectangle()
+{
+ QString preeditText = "super";
+
+ QQuickView view(testFileUrl("inputMethodEvent.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject());
+ QVERIFY(input);
+ QVERIFY(input->hasActiveFocus());
+
+ QQuickItem *cursor = input->findChild<QQuickItem *>("cursor");
+ QVERIFY(cursor);
+
+ QRectF currentRect;
+
+ QInputMethodQueryEvent query(Qt::ImCursorRectangle);
+ QCoreApplication::sendEvent(input, &query);
+ QRectF previousRect = query.value(Qt::ImCursorRectangle).toRectF();
+
+ // Verify that the micro focus rect is positioned the same for position 0 as
+ // it would be if there was no preedit text.
+ sendPreeditText(input, preeditText, 0);
+ QCoreApplication::sendEvent(input, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QCOMPARE(currentRect, previousRect);
+ QCOMPARE(input->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+
+ QSignalSpy inputSpy(input, SIGNAL(cursorRectangleChanged()));
+ QSignalSpy panelSpy(qGuiApp->inputMethod(), SIGNAL(cursorRectangleChanged()));
+
+ // Verify that the micro focus rect moves to the left as the cursor position
+ // is incremented.
+ for (int i = 1; i <= 5; ++i) {
+ sendPreeditText(input, preeditText, i);
+ QCoreApplication::sendEvent(input, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QVERIFY(previousRect.left() < currentRect.left());
+ QCOMPARE(input->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+ QVERIFY(inputSpy.count() > 0); inputSpy.clear();
+ QVERIFY(panelSpy.count() > 0); panelSpy.clear();
+ previousRect = currentRect;
+ }
+
+ // Verify that if the cursor rectangle is updated if the pre-edit text changes
+ // but the (non-zero) cursor position is the same.
+ inputSpy.clear();
+ panelSpy.clear();
+ sendPreeditText(input, "wwwww", 5);
+ QCoreApplication::sendEvent(input, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QCOMPARE(input->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+ QCOMPARE(inputSpy.count(), 1);
+ QCOMPARE(panelSpy.count(), 1);
+
+ // Verify that if there is no preedit cursor then the micro focus rect is the
+ // same as it would be if it were positioned at the end of the preedit text.
+ inputSpy.clear();
+ panelSpy.clear();
+ { QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>());
+ QCoreApplication::sendEvent(input, &imEvent); }
+ QCoreApplication::sendEvent(input, &query);
+ currentRect = query.value(Qt::ImCursorRectangle).toRectF();
+ QCOMPARE(currentRect, previousRect);
+ QCOMPARE(input->cursorRectangle(), currentRect);
+ QCOMPARE(cursor->position(), currentRect.topLeft());
+ QCOMPARE(inputSpy.count(), 1);
+ QCOMPARE(panelSpy.count(), 1);
+}
+
+void tst_qquicktextinput::inputContextMouseHandler()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QString text = "supercalifragisiticexpialidocious!";
+ QQuickView view(testFileUrl("inputContext.qml"));
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject());
+ QVERIFY(input);
+
+ input->setFocus(true);
+ input->setText("");
+
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QTextLayout layout(text);
+ layout.setFont(input->font());
+ if (!qmlDisableDistanceField()) {
+ QTextOption option;
+ option.setUseDesignMetrics(true);
+ layout.setTextOption(option);
+ }
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ const qreal x = line.cursorToX(2, QTextLine::Leading);
+ const qreal y = line.height() / 2;
+ QPoint position = QPointF(x, y).toPoint();
+
+ QInputMethodEvent inputEvent(text.mid(0, 5), QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(input, &inputEvent);
+
+ QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position);
+ QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position);
+ QGuiApplication::processEvents();
+
+ QCOMPARE(platformInputContext.m_action, QInputMethod::Click);
+ QCOMPARE(platformInputContext.m_invokeActionCallCount, 1);
+ QCOMPARE(platformInputContext.m_cursorPosition, 2);
+}
+
+void tst_qquicktextinput::inputMethodComposing()
+{
+ QString text = "supercalifragisiticexpialidocious!";
+
+ QQuickView view(testFileUrl("inputContext.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject());
+ QVERIFY(input);
+ QVERIFY(input->hasActiveFocus());
+ QSignalSpy spy(input, SIGNAL(inputMethodComposingChanged()));
+
+ QCOMPARE(input->isInputMethodComposing(), false);
+ {
+ QInputMethodEvent event(text.mid(3), QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 1);
+
+ {
+ QInputMethodEvent event(text.mid(12), QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(spy.count(), 1);
+
+ {
+ QInputMethodEvent event;
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 2);
+
+ // Changing the text while not composing doesn't alter the composing state.
+ input->setText(text.mid(0, 16));
+ QCOMPARE(input->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 2);
+
+ {
+ QInputMethodEvent event(text.mid(16), QList<QInputMethodEvent::Attribute>());
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 3);
+
+ // Changing the text while composing cancels composition.
+ input->setText(text.mid(0, 12));
+ QCOMPARE(input->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 4);
+
+ { // Preedit cursor positioned outside (empty) preedit; composing.
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, -2, 1, QVariant()));
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 5);
+
+
+ { // Cursor hidden; composing
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 5);
+
+ { // Default cursor attributes; composing.
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 1, QVariant()));
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 5);
+
+ { // Selections are persisted: not composing
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, -5, 4, QVariant()));
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 6);
+
+ input->setCursorPosition(12);
+
+ { // Formatting applied; composing.
+ QTextCharFormat format;
+ format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>()
+ << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, -5, 4, format));
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 7);
+
+ {
+ QInputMethodEvent event;
+ QGuiApplication::sendEvent(input, &event);
+ }
+ QCOMPARE(input->isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 8);
+}
+
+void tst_qquicktextinput::inputMethodUpdate()
+{
+ PlatformInputContext platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &platformInputContext;
+
+ QQuickView view(testFileUrl("inputContext.qml"));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+ QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject());
+ QVERIFY(input);
+ QVERIFY(input->hasActiveFocus());
+
+ // text change even without cursor position change needs to trigger update
+ input->setText("test");
+ platformInputContext.clear();
+ input->setText("xxxx");
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // input method event replacing text
+ platformInputContext.clear();
+ {
+ QInputMethodEvent inputMethodEvent;
+ inputMethodEvent.setCommitString("y", -1, 1);
+ QGuiApplication::sendEvent(input, &inputMethodEvent);
+ }
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // input method changing selection
+ platformInputContext.clear();
+ {
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 2, QVariant());
+ QInputMethodEvent inputMethodEvent("", attributes);
+ QGuiApplication::sendEvent(input, &inputMethodEvent);
+ }
+ QVERIFY(input->selectionStart() != input->selectionEnd());
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // programmatical selections trigger update
+ platformInputContext.clear();
+ input->selectAll();
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // font changes
+ platformInputContext.clear();
+ QFont font = input->font();
+ font.setBold(!font.bold());
+ input->setFont(font);
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // normal input
+ platformInputContext.clear();
+ {
+ QInputMethodEvent inputMethodEvent;
+ inputMethodEvent.setCommitString("y");
+ QGuiApplication::sendEvent(input, &inputMethodEvent);
+ }
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // changing cursor position
+ platformInputContext.clear();
+ input->setCursorPosition(0);
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+
+ // read only disabled input method
+ platformInputContext.clear();
+ input->setReadOnly(true);
+ QVERIFY(platformInputContext.m_updateCallCount > 0);
+ input->setReadOnly(false);
+
+ // no updates while no focus
+ input->setFocus(false);
+ platformInputContext.clear();
+ input->setText("Foo");
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+ input->setCursorPosition(1);
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+ input->selectAll();
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+ input->setReadOnly(true);
+ QCOMPARE(platformInputContext.m_updateCallCount, 0);
+}
+
+void tst_qquicktextinput::cursorRectangleSize()
+{
+ QQuickView *window = new QQuickView(testFileUrl("positionAt.qml"));
+ QVERIFY(window->rootObject() != 0);
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput *>(window->rootObject());
+
+ // make sure cursor rectangle is not at (0,0)
+ textInput->setX(10);
+ textInput->setY(10);
+ textInput->setCursorPosition(3);
+ QVERIFY(textInput != 0);
+ textInput->setFocus(true);
+ window->show();
+ window->requestActivate();
+ QTest::qWaitForWindowActive(window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ QInputMethodQueryEvent event(Qt::ImCursorRectangle);
+ qApp->sendEvent(textInput, &event);
+ QRectF cursorRectFromQuery = event.value(Qt::ImCursorRectangle).toRectF();
+
+ QRectF cursorRectFromItem = textInput->cursorRectangle();
+ QRectF cursorRectFromPositionToRectangle = textInput->positionToRectangle(textInput->cursorPosition());
+
+ // item and input query cursor rectangles match
+ QCOMPARE(cursorRectFromItem, cursorRectFromQuery);
+
+ // item cursor rectangle and positionToRectangle calculations match
+ QCOMPARE(cursorRectFromItem, cursorRectFromPositionToRectangle);
+
+ // item-window transform and input item transform match
+ QCOMPARE(QQuickItemPrivate::get(textInput)->itemToWindowTransform(), qApp->inputMethod()->inputItemTransform());
+
+ // input panel cursorRectangle property and tranformed item cursor rectangle match
+ QRectF sceneCursorRect = QQuickItemPrivate::get(textInput)->itemToWindowTransform().mapRect(cursorRectFromItem);
+ QCOMPARE(sceneCursorRect, qApp->inputMethod()->cursorRectangle());
+
+ delete window;
+}
+
+void tst_qquicktextinput::tripleClickSelectsAll()
+{
+ QString qmlfile = testFile("positionAt.qml");
+ QQuickView view(QUrl::fromLocalFile(qmlfile));
+ view.show();
+ view.requestActivate();
+ QTest::qWaitForWindowActive(&view);
+
+ QQuickTextInput* input = qobject_cast<QQuickTextInput*>(view.rootObject());
+ QVERIFY(input);
+
+ QLatin1String hello("Hello world!");
+ input->setSelectByMouse(true);
+ input->setText(hello);
+
+ // Clicking on the same point inside TextInput three times in a row
+ // should trigger a triple click, thus selecting all the text.
+ QPoint pointInside = input->position().toPoint() + QPoint(2,2);
+ QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside);
+ QTest::mouseClick(&view, Qt::LeftButton, 0, pointInside);
+ QGuiApplication::processEvents();
+ QCOMPARE(input->selectedText(), hello);
+
+ // Now it simulates user moving the mouse between the second and the third click.
+ // In this situation, we don't expect a triple click.
+ QPoint pointInsideButFar = QPoint(input->width(),input->height()) - QPoint(2,2);
+ QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside);
+ QTest::mouseClick(&view, Qt::LeftButton, 0, pointInsideButFar);
+ QGuiApplication::processEvents();
+ QVERIFY(input->selectedText().isEmpty());
+
+ // And now we press the third click too late, so no triple click event is triggered.
+ QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside);
+ QGuiApplication::processEvents();
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 1);
+ QTest::mouseClick(&view, Qt::LeftButton, 0, pointInside);
+ QGuiApplication::processEvents();
+ QVERIFY(input->selectedText().isEmpty());
+}
+
+void tst_qquicktextinput::QTBUG_19956_data()
+{
+ QTest::addColumn<QString>("url");
+ QTest::newRow("intvalidator") << "qtbug-19956int.qml";
+ QTest::newRow("doublevalidator") << "qtbug-19956double.qml";
+}
+
+
+void tst_qquicktextinput::getText_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("inputMask");
+ QTest::addColumn<int>("start");
+ QTest::addColumn<int>("end");
+ QTest::addColumn<QString>("expectedText");
+
+ QTest::newRow("all plain text")
+ << standard.at(0)
+ << QString()
+ << 0 << standard.at(0).length()
+ << standard.at(0);
+
+ QTest::newRow("plain text sub string")
+ << standard.at(0)
+ << QString()
+ << 0 << 12
+ << standard.at(0).mid(0, 12);
+
+ QTest::newRow("plain text sub string reversed")
+ << standard.at(0)
+ << QString()
+ << 12 << 0
+ << standard.at(0).mid(0, 12);
+
+ QTest::newRow("plain text cropped beginning")
+ << standard.at(0)
+ << QString()
+ << -3 << 4
+ << standard.at(0).mid(0, 4);
+
+ QTest::newRow("plain text cropped end")
+ << standard.at(0)
+ << QString()
+ << 23 << standard.at(0).length() + 8
+ << standard.at(0).mid(23);
+
+ QTest::newRow("plain text cropped beginning and end")
+ << standard.at(0)
+ << QString()
+ << -9 << standard.at(0).length() + 4
+ << standard.at(0);
+}
+
+void tst_qquicktextinput::getText()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, inputMask);
+ QFETCH(int, start);
+ QFETCH(int, end);
+ QFETCH(QString, expectedText);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + text + "\"; inputMask: \"" + inputMask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QCOMPARE(textInput->getText(start, end), expectedText);
+}
+
+void tst_qquicktextinput::insert_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("inputMask");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<int>("insertPosition");
+ QTest::addColumn<QString>("insertText");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<int>("expectedSelectionStart");
+ QTest::addColumn<int>("expectedSelectionEnd");
+ QTest::addColumn<int>("expectedCursorPosition");
+ QTest::addColumn<bool>("selectionChanged");
+ QTest::addColumn<bool>("cursorPositionChanged");
+
+ QTest::newRow("at cursor position (beginning)")
+ << standard.at(0)
+ << QString()
+ << 0 << 0 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 5 << 5 << 5
+ << false << true;
+
+ QTest::newRow("at cursor position (end)")
+ << standard.at(0)
+ << QString()
+ << standard.at(0).length() << standard.at(0).length() << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5
+ << false << true;
+
+ QTest::newRow("at cursor position (middle)")
+ << standard.at(0)
+ << QString()
+ << 18 << 18 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 23 << 23 << 23
+ << false << true;
+
+ QTest::newRow("after cursor position (beginning)")
+ << standard.at(0)
+ << QString()
+ << 0 << 0 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("before cursor position (end)")
+ << standard.at(0)
+ << QString()
+ << standard.at(0).length() << standard.at(0).length() << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5
+ << false << true;
+
+ QTest::newRow("before cursor position (middle)")
+ << standard.at(0)
+ << QString()
+ << 18 << 18 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 23 << 23 << 23
+ << false << true;
+
+ QTest::newRow("after cursor position (middle)")
+ << standard.at(0)
+ << QString()
+ << 18 << 18 << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << 18 << 18 << 18
+ << false << false;
+
+ QTest::newRow("before selection")
+ << standard.at(0)
+ << QString()
+ << 14 << 19 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 19 << 24 << 24
+ << false << true;
+
+ QTest::newRow("before reversed selection")
+ << standard.at(0)
+ << QString()
+ << 19 << 14 << 0
+ << QString("Hello")
+ << QString("Hello") + standard.at(0)
+ << 19 << 24 << 19
+ << false << true;
+
+ QTest::newRow("after selection")
+ << standard.at(0)
+ << QString()
+ << 14 << 19 << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << 14 << 19 << 19
+ << false << false;
+
+ QTest::newRow("after reversed selection")
+ << standard.at(0)
+ << QString()
+ << 19 << 14 << standard.at(0).length()
+ << QString("Hello")
+ << standard.at(0) + QString("Hello")
+ << 14 << 19 << 14
+ << false << false;
+
+ QTest::newRow("into selection")
+ << standard.at(0)
+ << QString()
+ << 14 << 19 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 14 << 24 << 24
+ << true << true;
+
+ QTest::newRow("into reversed selection")
+ << standard.at(0)
+ << QString()
+ << 19 << 14 << 18
+ << QString("Hello")
+ << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18)
+ << 14 << 24 << 14
+ << true << false;
+
+ QTest::newRow("rich text into plain text")
+ << standard.at(0)
+ << QString()
+ << 0 << 0 << 0
+ << QString("<b>Hello</b>")
+ << QString("<b>Hello</b>") + standard.at(0)
+ << 12 << 12 << 12
+ << false << true;
+
+ QTest::newRow("before start")
+ << standard.at(0)
+ << QString()
+ << 0 << 0 << -3
+ << QString("Hello")
+ << standard.at(0)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("past end")
+ << standard.at(0)
+ << QString()
+ << 0 << 0 << standard.at(0).length() + 3
+ << QString("Hello")
+ << standard.at(0)
+ << 0 << 0 << 0
+ << false << false;
+
+ const QString inputMask = "009.009.009.009";
+ const QString ip = "192.168.2.14";
+
+ QTest::newRow("mask: at cursor position (beginning)")
+ << ip
+ << inputMask
+ << 0 << 0 << 0
+ << QString("125")
+ << QString("125.168.2.14")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("mask: at cursor position (end)")
+ << ip
+ << inputMask
+ << inputMask.length() << inputMask.length() << inputMask.length()
+ << QString("8")
+ << ip
+ << inputMask.length() << inputMask.length() << inputMask.length()
+ << false << false;
+
+ QTest::newRow("mask: at cursor position (middle)")
+ << ip
+ << inputMask
+ << 6 << 6 << 6
+ << QString("75.2")
+ << QString("192.167.5.24")
+ << 6 << 6 << 6
+ << false << false;
+
+ QTest::newRow("mask: after cursor position (beginning)")
+ << ip
+ << inputMask
+ << 0 << 0 << 6
+ << QString("75.2")
+ << QString("192.167.5.24")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("mask: before cursor position (end)")
+ << ip
+ << inputMask
+ << inputMask.length() << inputMask.length() << 6
+ << QString("75.2")
+ << QString("192.167.5.24")
+ << inputMask.length() << inputMask.length() << inputMask.length()
+ << false << false;
+
+ QTest::newRow("mask: before cursor position (middle)")
+ << ip
+ << inputMask
+ << 6 << 6 << 0
+ << QString("125")
+ << QString("125.168.2.14")
+ << 6 << 6 << 6
+ << false << false;
+
+ QTest::newRow("mask: after cursor position (middle)")
+ << ip
+ << inputMask
+ << 6 << 6 << 13
+ << QString("8")
+ << "192.168.2.18"
+ << 6 << 6 << 6
+ << false << false;
+
+ QTest::newRow("mask: before selection")
+ << ip
+ << inputMask
+ << 6 << 8 << 0
+ << QString("125")
+ << QString("125.168.2.14")
+ << 6 << 8 << 8
+ << false << false;
+
+ QTest::newRow("mask: before reversed selection")
+ << ip
+ << inputMask
+ << 8 << 6 << 0
+ << QString("125")
+ << QString("125.168.2.14")
+ << 6 << 8 << 6
+ << false << false;
+
+ QTest::newRow("mask: after selection")
+ << ip
+ << inputMask
+ << 6 << 8 << 13
+ << QString("8")
+ << "192.168.2.18"
+ << 6 << 8 << 8
+ << false << false;
+
+ QTest::newRow("mask: after reversed selection")
+ << ip
+ << inputMask
+ << 8 << 6 << 13
+ << QString("8")
+ << "192.168.2.18"
+ << 6 << 8 << 6
+ << false << false;
+
+ QTest::newRow("mask: into selection")
+ << ip
+ << inputMask
+ << 5 << 8 << 6
+ << QString("75.2")
+ << QString("192.167.5.24")
+ << 5 << 8 << 8
+ << true << false;
+
+ QTest::newRow("mask: into reversed selection")
+ << ip
+ << inputMask
+ << 8 << 5 << 6
+ << QString("75.2")
+ << QString("192.167.5.24")
+ << 5 << 8 << 5
+ << true << false;
+
+ QTest::newRow("mask: before start")
+ << ip
+ << inputMask
+ << 0 << 0 << -3
+ << QString("4")
+ << ip
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("mask: past end")
+ << ip
+ << inputMask
+ << 0 << 0 << ip.length() + 3
+ << QString("4")
+ << ip
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("mask: invalid characters")
+ << ip
+ << inputMask
+ << 0 << 0 << 0
+ << QString("abc")
+ << QString("192.168.2.14")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("mask: mixed validity")
+ << ip
+ << inputMask
+ << 0 << 0 << 0
+ << QString("a1b2c5")
+ << QString("125.168.2.14")
+ << 0 << 0 << 0
+ << false << false;
+}
+
+void tst_qquicktextinput::insert()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, inputMask);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(int, insertPosition);
+ QFETCH(QString, insertText);
+ QFETCH(QString, expectedText);
+ QFETCH(int, expectedSelectionStart);
+ QFETCH(int, expectedSelectionEnd);
+ QFETCH(int, expectedCursorPosition);
+ QFETCH(bool, selectionChanged);
+ QFETCH(bool, cursorPositionChanged);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + text + "\"; inputMask: \"" + inputMask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ textInput->select(selectionStart, selectionEnd);
+
+ QSignalSpy selectionSpy(textInput, SIGNAL(selectedTextChanged()));
+ QSignalSpy selectionStartSpy(textInput, SIGNAL(selectionStartChanged()));
+ QSignalSpy selectionEndSpy(textInput, SIGNAL(selectionEndChanged()));
+ QSignalSpy textSpy(textInput, SIGNAL(textChanged()));
+ QSignalSpy cursorPositionSpy(textInput, SIGNAL(cursorPositionChanged()));
+
+ textInput->insert(insertPosition, insertText);
+
+ QCOMPARE(textInput->text(), expectedText);
+ QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.length() : inputMask.length());
+
+ QCOMPARE(textInput->selectionStart(), expectedSelectionStart);
+ QCOMPARE(textInput->selectionEnd(), expectedSelectionEnd);
+ QCOMPARE(textInput->cursorPosition(), expectedCursorPosition);
+
+ if (selectionStart > selectionEnd)
+ qSwap(selectionStart, selectionEnd);
+
+ QCOMPARE(selectionSpy.count() > 0, selectionChanged);
+ QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart);
+ QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd);
+ QCOMPARE(textSpy.count() > 0, text != expectedText);
+ QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged);
+}
+
+void tst_qquicktextinput::remove_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("inputMask");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<int>("removeStart");
+ QTest::addColumn<int>("removeEnd");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<int>("expectedSelectionStart");
+ QTest::addColumn<int>("expectedSelectionEnd");
+ QTest::addColumn<int>("expectedCursorPosition");
+ QTest::addColumn<bool>("selectionChanged");
+ QTest::addColumn<bool>("cursorPositionChanged");
+
+ QTest::newRow("from cursor position (beginning)")
+ << standard.at(0)
+ << QString()
+ << 0 << 0
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("to cursor position (beginning)")
+ << standard.at(0)
+ << QString()
+ << 0 << 0
+ << 5 << 0
+ << standard.at(0).mid(5)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("to cursor position (end)")
+ << standard.at(0)
+ << QString()
+ << standard.at(0).length() << standard.at(0).length()
+ << standard.at(0).length() << standard.at(0).length() - 5
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5
+ << false << true;
+
+ QTest::newRow("to cursor position (end)")
+ << standard.at(0)
+ << QString()
+ << standard.at(0).length() << standard.at(0).length()
+ << standard.at(0).length() - 5 << standard.at(0).length()
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5
+ << false << true;
+
+ QTest::newRow("from cursor position (middle)")
+ << standard.at(0)
+ << QString()
+ << 18 << 18
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 18 << 18 << 18
+ << false << false;
+
+ QTest::newRow("to cursor position (middle)")
+ << standard.at(0)
+ << QString()
+ << 23 << 23
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 18 << 18 << 18
+ << false << true;
+
+ QTest::newRow("after cursor position (beginning)")
+ << standard.at(0)
+ << QString()
+ << 0 << 0
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("before cursor position (end)")
+ << standard.at(0)
+ << QString()
+ << standard.at(0).length() << standard.at(0).length()
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5
+ << false << true;
+
+ QTest::newRow("before cursor position (middle)")
+ << standard.at(0)
+ << QString()
+ << 23 << 23
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 18 << 18 << 18
+ << false << true;
+
+ QTest::newRow("after cursor position (middle)")
+ << standard.at(0)
+ << QString()
+ << 18 << 18
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 18 << 18 << 18
+ << false << false;
+
+ QTest::newRow("before selection")
+ << standard.at(0)
+ << QString()
+ << 14 << 19
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 9 << 14 << 14
+ << false << true;
+
+ QTest::newRow("before reversed selection")
+ << standard.at(0)
+ << QString()
+ << 19 << 14
+ << 0 << 5
+ << standard.at(0).mid(5)
+ << 9 << 14 << 9
+ << false << true;
+
+ QTest::newRow("after selection")
+ << standard.at(0)
+ << QString()
+ << 14 << 19
+ << standard.at(0).length() - 5 << standard.at(0).length()
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << 14 << 19 << 19
+ << false << false;
+
+ QTest::newRow("after reversed selection")
+ << standard.at(0)
+ << QString()
+ << 19 << 14
+ << standard.at(0).length() - 5 << standard.at(0).length()
+ << standard.at(0).mid(0, standard.at(0).length() - 5)
+ << 14 << 19 << 14
+ << false << false;
+
+ QTest::newRow("from selection")
+ << standard.at(0)
+ << QString()
+ << 14 << 24
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 14 << 19 << 19
+ << true << true;
+
+ QTest::newRow("from reversed selection")
+ << standard.at(0)
+ << QString()
+ << 24 << 14
+ << 18 << 23
+ << standard.at(0).mid(0, 18) + standard.at(0).mid(23)
+ << 14 << 19 << 14
+ << true << false;
+
+ QTest::newRow("cropped beginning")
+ << standard.at(0)
+ << QString()
+ << 0 << 0
+ << -3 << 4
+ << standard.at(0).mid(4)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("cropped end")
+ << standard.at(0)
+ << QString()
+ << 0 << 0
+ << 23 << standard.at(0).length() + 8
+ << standard.at(0).mid(0, 23)
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("cropped beginning and end")
+ << standard.at(0)
+ << QString()
+ << 0 << 0
+ << -9 << standard.at(0).length() + 4
+ << QString()
+ << 0 << 0 << 0
+ << false << false;
+
+ const QString inputMask = "009.009.009.009";
+ const QString ip = "192.168.2.14";
+
+ QTest::newRow("mask: from cursor position")
+ << ip
+ << inputMask
+ << 6 << 6
+ << 6 << 9
+ << QString("192.16..14")
+ << 6 << 6 << 6
+ << false << false;
+
+ QTest::newRow("mask: to cursor position")
+ << ip
+ << inputMask
+ << 6 << 6
+ << 2 << 6
+ << QString("19.8.2.14")
+ << 6 << 6 << 6
+ << false << false;
+
+ QTest::newRow("mask: before cursor position")
+ << ip
+ << inputMask
+ << 6 << 6
+ << 0 << 2
+ << QString("2.168.2.14")
+ << 6 << 6 << 6
+ << false << false;
+
+ QTest::newRow("mask: after cursor position")
+ << ip
+ << inputMask
+ << 6 << 6
+ << 12 << 16
+ << QString("192.168.2.")
+ << 6 << 6 << 6
+ << false << false;
+
+ QTest::newRow("mask: before selection")
+ << ip
+ << inputMask
+ << 6 << 8
+ << 0 << 2
+ << QString("2.168.2.14")
+ << 6 << 8 << 8
+ << false << false;
+
+ QTest::newRow("mask: before reversed selection")
+ << ip
+ << inputMask
+ << 8 << 6
+ << 0 << 2
+ << QString("2.168.2.14")
+ << 6 << 8 << 6
+ << false << false;
+
+ QTest::newRow("mask: after selection")
+ << ip
+ << inputMask
+ << 6 << 8
+ << 12 << 16
+ << QString("192.168.2.")
+ << 6 << 8 << 8
+ << false << false;
+
+ QTest::newRow("mask: after reversed selection")
+ << ip
+ << inputMask
+ << 8 << 6
+ << 12 << 16
+ << QString("192.168.2.")
+ << 6 << 8 << 6
+ << false << false;
+
+ QTest::newRow("mask: from selection")
+ << ip
+ << inputMask
+ << 6 << 13
+ << 8 << 10
+ << QString("192.168..14")
+ << 6 << 13 << 13
+ << true << false;
+
+ QTest::newRow("mask: from reversed selection")
+ << ip
+ << inputMask
+ << 13 << 6
+ << 8 << 10
+ << QString("192.168..14")
+ << 6 << 13 << 6
+ << true << false;
+
+ QTest::newRow("mask: cropped beginning")
+ << ip
+ << inputMask
+ << 0 << 0
+ << -3 << 4
+ << QString(".168.2.14")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("mask: cropped end")
+ << ip
+ << inputMask
+ << 0 << 0
+ << 13 << 28
+ << QString("192.168.2.1")
+ << 0 << 0 << 0
+ << false << false;
+
+ QTest::newRow("mask: cropped beginning and end")
+ << ip
+ << inputMask
+ << 0 << 0
+ << -9 << 28
+ << QString("...")
+ << 0 << 0 << 0
+ << false << false;
+}
+
+void tst_qquicktextinput::remove()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, inputMask);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(int, removeStart);
+ QFETCH(int, removeEnd);
+ QFETCH(QString, expectedText);
+ QFETCH(int, expectedSelectionStart);
+ QFETCH(int, expectedSelectionEnd);
+ QFETCH(int, expectedCursorPosition);
+ QFETCH(bool, selectionChanged);
+ QFETCH(bool, cursorPositionChanged);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + text + "\"; inputMask: \"" + inputMask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ textInput->select(selectionStart, selectionEnd);
+
+ QSignalSpy selectionSpy(textInput, SIGNAL(selectedTextChanged()));
+ QSignalSpy selectionStartSpy(textInput, SIGNAL(selectionStartChanged()));
+ QSignalSpy selectionEndSpy(textInput, SIGNAL(selectionEndChanged()));
+ QSignalSpy textSpy(textInput, SIGNAL(textChanged()));
+ QSignalSpy cursorPositionSpy(textInput, SIGNAL(cursorPositionChanged()));
+
+ textInput->remove(removeStart, removeEnd);
+
+ QCOMPARE(textInput->text(), expectedText);
+ QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.length() : inputMask.length());
+
+ if (selectionStart > selectionEnd) //
+ qSwap(selectionStart, selectionEnd);
+
+ QCOMPARE(textInput->selectionStart(), expectedSelectionStart);
+ QCOMPARE(textInput->selectionEnd(), expectedSelectionEnd);
+ QCOMPARE(textInput->cursorPosition(), expectedCursorPosition);
+
+ QCOMPARE(selectionSpy.count() > 0, selectionChanged);
+ QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart);
+ QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd);
+ QCOMPARE(textSpy.count() > 0, text != expectedText);
+
+ if (cursorPositionChanged) //
+ QVERIFY(cursorPositionSpy.count() > 0);
+}
+
+void tst_qquicktextinput::keySequence_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QKeySequence>("sequence");
+ QTest::addColumn<int>("selectionStart");
+ QTest::addColumn<int>("selectionEnd");
+ QTest::addColumn<int>("cursorPosition");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<QString>("selectedText");
+ QTest::addColumn<QQuickTextInput::EchoMode>("echoMode");
+ QTest::addColumn<Qt::Key>("layoutDirection");
+
+ // standard[0] == "the [4]quick [10]brown [16]fox [20]jumped [27]over [32]the [36]lazy [41]dog"
+
+ QTest::newRow("select all")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectAll) << 0 << 0
+ << 44 << standard.at(0) << standard.at(0)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select start of line")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectStartOfLine) << 5 << 5
+ << 0 << standard.at(0) << standard.at(0).mid(0, 5)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select start of block")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectStartOfBlock) << 5 << 5
+ << 0 << standard.at(0) << standard.at(0).mid(0, 5)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select end of line")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectEndOfLine) << 5 << 5
+ << 44 << standard.at(0) << standard.at(0).mid(5)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select end of document") // ### Not handled.
+ << standard.at(0) << QKeySequence(QKeySequence::SelectEndOfDocument) << 3 << 3
+ << 3 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select end of block")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectEndOfBlock) << 18 << 18
+ << 44 << standard.at(0) << standard.at(0).mid(18)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("delete end of line")
+ << standard.at(0) << QKeySequence(QKeySequence::DeleteEndOfLine) << 24 << 24
+ << 24 << standard.at(0).mid(0, 24) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("move to start of line")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToStartOfLine) << 31 << 31
+ << 0 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("move to start of block")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToStartOfBlock) << 25 << 25
+ << 0 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("move to next char")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextChar) << 12 << 12
+ << 13 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("move to previous char (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousChar) << 3 << 3
+ << 2 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("move to previous char (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousChar) << 3 << 3
+ << 4 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_R;
+ QTest::newRow("move to previous char with selection")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousChar) << 3 << 7
+ << 3 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select next char (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectNextChar) << 23 << 23
+ << 24 << standard.at(0) << standard.at(0).mid(23, 1)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select next char (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectNextChar) << 23 << 23
+ << 22 << standard.at(0) << standard.at(0).mid(22, 1)
+ << QQuickTextInput::Normal << Qt::Key_Direction_R;
+ QTest::newRow("select previous char (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectPreviousChar) << 19 << 19
+ << 18 << standard.at(0) << standard.at(0).mid(18, 1)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select previous char (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectPreviousChar) << 19 << 19
+ << 20 << standard.at(0) << standard.at(0).mid(19, 1)
+ << QQuickTextInput::Normal << Qt::Key_Direction_R;
+ QTest::newRow("move to next word (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextWord) << 7 << 7
+ << 10 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("move to next word (rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextWord) << 7 << 7
+ << 4 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_R;
+ QTest::newRow("move to next word (password,ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextWord) << 7 << 7
+ << 44 << standard.at(0) << QString()
+ << QQuickTextInput::Password << Qt::Key_Direction_L;
+ QTest::newRow("move to next word (password,rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToNextWord) << 7 << 7
+ << 0 << standard.at(0) << QString()
+ << QQuickTextInput::Password << Qt::Key_Direction_R;
+ QTest::newRow("move to previous word (ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousWord) << 7 << 7
+ << 4 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("move to previous word (rlt)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousWord) << 7 << 7
+ << 10 << standard.at(0) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_R;
+ QTest::newRow("move to previous word (password,ltr)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousWord) << 7 << 7
+ << 0 << standard.at(0) << QString()
+ << QQuickTextInput::Password << Qt::Key_Direction_L;
+ QTest::newRow("move to previous word (password,rtl)")
+ << standard.at(0) << QKeySequence(QKeySequence::MoveToPreviousWord) << 7 << 7
+ << 44 << standard.at(0) << QString()
+ << QQuickTextInput::Password << Qt::Key_Direction_R;
+ QTest::newRow("select next word")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectNextWord) << 11 << 11
+ << 16 << standard.at(0) << standard.at(0).mid(11, 5)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("select previous word")
+ << standard.at(0) << QKeySequence(QKeySequence::SelectPreviousWord) << 11 << 11
+ << 10 << standard.at(0) << standard.at(0).mid(10, 1)
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("delete (selection)")
+ << standard.at(0) << QKeySequence(QKeySequence::Delete) << 12 << 15
+ << 12 << (standard.at(0).mid(0, 12) + standard.at(0).mid(15)) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("delete (no selection)")
+ << standard.at(0) << QKeySequence(QKeySequence::Delete) << 15 << 15
+ << 15 << (standard.at(0).mid(0, 15) + standard.at(0).mid(16)) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("delete end of word")
+ << standard.at(0) << QKeySequence(QKeySequence::DeleteEndOfWord) << 24 << 24
+ << 24 << (standard.at(0).mid(0, 24) + standard.at(0).mid(27)) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+ QTest::newRow("delete start of word")
+ << standard.at(0) << QKeySequence(QKeySequence::DeleteStartOfWord) << 7 << 7
+ << 4 << (standard.at(0).mid(0, 4) + standard.at(0).mid(7)) << QString()
+ << QQuickTextInput::Normal << Qt::Key_Direction_L;
+}
+
+void tst_qquicktextinput::keySequence()
+{
+ QFETCH(QString, text);
+ QFETCH(QKeySequence, sequence);
+ QFETCH(int, selectionStart);
+ QFETCH(int, selectionEnd);
+ QFETCH(int, cursorPosition);
+ QFETCH(QString, expectedText);
+ QFETCH(QString, selectedText);
+ QFETCH(QQuickTextInput::EchoMode, echoMode);
+ QFETCH(Qt::Key, layoutDirection);
+
+ if (sequence.isEmpty()) {
+ QSKIP("Key sequence is undefined");
+ }
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true; text: \"" + text + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+ textInput->setEchoMode(echoMode);
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ simulateKey(&window, layoutDirection);
+
+ textInput->select(selectionStart, selectionEnd);
+
+ simulateKeys(&window, sequence);
+
+ QCOMPARE(textInput->cursorPosition(), cursorPosition);
+ QCOMPARE(textInput->text(), expectedText);
+ QCOMPARE(textInput->selectedText(), selectedText);
+}
+
+#define NORMAL 0
+#define REPLACE_UNTIL_END 1
+
+void tst_qquicktextinput::undo_data()
+{
+ QTest::addColumn<QStringList>("insertString");
+ QTest::addColumn<IntList>("insertIndex");
+ QTest::addColumn<IntList>("insertMode");
+ QTest::addColumn<QStringList>("expectedString");
+ QTest::addColumn<bool>("use_keys");
+
+ for (int i=0; i<2; i++) {
+ QString keys_str = "keyboard";
+ bool use_keys = true;
+ if (i==0) {
+ keys_str = "insert";
+ use_keys = false;
+ }
+
+ {
+ IntList insertIndex;
+ IntList insertMode;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "1";
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "5";
+
+ insertIndex << 1;
+ insertMode << NORMAL;
+ insertString << "3";
+
+ insertIndex << 1;
+ insertMode << NORMAL;
+ insertString << "2";
+
+ insertIndex << 3;
+ insertMode << NORMAL;
+ insertString << "4";
+
+ expectedString << "12345";
+ expectedString << "1235";
+ expectedString << "135";
+ expectedString << "15";
+ expectedString << "";
+
+ QTest::newRow(QString(keys_str + "_numbers").toLatin1()) <<
+ insertString <<
+ insertIndex <<
+ insertMode <<
+ expectedString <<
+ bool(use_keys);
+ }
+ {
+ IntList insertIndex;
+ IntList insertMode;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "World"; // World
+
+ insertIndex << 0;
+ insertMode << NORMAL;
+ insertString << "Hello"; // HelloWorld
+
+ insertIndex << 0;
+ insertMode << NORMAL;
+ insertString << "Well"; // WellHelloWorld
+
+ insertIndex << 9;
+ insertMode << NORMAL;
+ insertString << "There"; // WellHelloThereWorld;
+
+ expectedString << "WellHelloThereWorld";
+ expectedString << "WellHelloWorld";
+ expectedString << "HelloWorld";
+ expectedString << "World";
+ expectedString << "";
+
+ QTest::newRow(QString(keys_str + "_helloworld").toLatin1()) <<
+ insertString <<
+ insertIndex <<
+ insertMode <<
+ expectedString <<
+ bool(use_keys);
+ }
+ {
+ IntList insertIndex;
+ IntList insertMode;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << "Ensuring";
+
+ insertIndex << -1;
+ insertMode << NORMAL;
+ insertString << " instan";
+
+ insertIndex << 9;
+ insertMode << NORMAL;
+ insertString << "an ";
+
+ insertIndex << 10;
+ insertMode << REPLACE_UNTIL_END;
+ insertString << " unique instance.";
+
+ expectedString << "Ensuring a unique instance.";
+ expectedString << "Ensuring an instan";
+ expectedString << "Ensuring instan";
+ expectedString << "";
+
+ QTest::newRow(QString(keys_str + "_patterns").toLatin1()) <<
+ insertString <<
+ insertIndex <<
+ insertMode <<
+ expectedString <<
+ bool(use_keys);
+ }
+ }
+}
+
+void tst_qquicktextinput::undo()
+{
+ QFETCH(QStringList, insertString);
+ QFETCH(IntList, insertIndex);
+ QFETCH(IntList, insertMode);
+ QFETCH(QStringList, expectedString);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ QVERIFY(!textInput->canUndo());
+
+ QSignalSpy spy(textInput, SIGNAL(canUndoChanged()));
+
+ int i;
+
+// STEP 1: First build up an undo history by inserting or typing some strings...
+ for (i = 0; i < insertString.size(); ++i) {
+ if (insertIndex[i] > -1)
+ textInput->setCursorPosition(insertIndex[i]);
+
+ // experimental stuff
+ if (insertMode[i] == REPLACE_UNTIL_END) {
+ textInput->select(insertIndex[i], insertIndex[i] + 8);
+
+ // This is what I actually want...
+ // QTest::keyClick(testWidget, Qt::Key_End, Qt::ShiftModifier);
+ }
+
+ for (int j = 0; j < insertString.at(i).length(); j++)
+ QTest::keyClick(&window, insertString.at(i).at(j).toLatin1());
+ }
+
+ QCOMPARE(spy.count(), 1);
+
+// STEP 2: Next call undo several times and see if we can restore to the previous state
+ for (i = 0; i < expectedString.size() - 1; ++i) {
+ QCOMPARE(textInput->text(), expectedString[i]);
+ QVERIFY(textInput->canUndo());
+ textInput->undo();
+ }
+
+// STEP 3: Verify that we have undone everything
+ QVERIFY(textInput->text().isEmpty());
+ QVERIFY(!textInput->canUndo());
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextinput::redo_data()
+{
+ QTest::addColumn<QStringList>("insertString");
+ QTest::addColumn<IntList>("insertIndex");
+ QTest::addColumn<QStringList>("expectedString");
+
+ {
+ IntList insertIndex;
+ QStringList insertString;
+ QStringList expectedString;
+
+ insertIndex << -1;
+ insertString << "World"; // World
+ insertIndex << 0;
+ insertString << "Hello"; // HelloWorld
+ insertIndex << 0;
+ insertString << "Well"; // WellHelloWorld
+ insertIndex << 9;
+ insertString << "There"; // WellHelloThereWorld;
+
+ expectedString << "World";
+ expectedString << "HelloWorld";
+ expectedString << "WellHelloWorld";
+ expectedString << "WellHelloThereWorld";
+
+ QTest::newRow("Inserts and setting cursor") << insertString << insertIndex << expectedString;
+ }
+}
+
+void tst_qquicktextinput::redo()
+{
+ QFETCH(QStringList, insertString);
+ QFETCH(IntList, insertIndex);
+ QFETCH(QStringList, expectedString);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QVERIFY(textInput->hasActiveFocus());
+ QVERIFY(!textInput->canUndo());
+ QVERIFY(!textInput->canRedo());
+
+ QSignalSpy spy(textInput, SIGNAL(canRedoChanged()));
+
+ int i;
+ // inserts the diff strings at diff positions
+ for (i = 0; i < insertString.size(); ++i) {
+ if (insertIndex[i] > -1)
+ textInput->setCursorPosition(insertIndex[i]);
+ for (int j = 0; j < insertString.at(i).length(); j++)
+ QTest::keyClick(&window, insertString.at(i).at(j).toLatin1());
+ QVERIFY(textInput->canUndo());
+ QVERIFY(!textInput->canRedo());
+ }
+
+ QCOMPARE(spy.count(), 0);
+
+ // undo everything
+ while (!textInput->text().isEmpty()) {
+ QVERIFY(textInput->canUndo());
+ textInput->undo();
+ QVERIFY(textInput->canRedo());
+ }
+
+ QCOMPARE(spy.count(), 1);
+
+ for (i = 0; i < expectedString.size(); ++i) {
+ QVERIFY(textInput->canRedo());
+ textInput->redo();
+ QCOMPARE(textInput->text() , expectedString[i]);
+ QVERIFY(textInput->canUndo());
+ }
+ QVERIFY(!textInput->canRedo());
+ QCOMPARE(spy.count(), 2);
+}
+
+void tst_qquicktextinput::undo_keypressevents_data()
+{
+ QTest::addColumn<KeyList>("keys");
+ QTest::addColumn<QStringList>("expectedString");
+
+ {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "AFRAID"
+ << QKeySequence::MoveToStartOfLine
+ << "VERY"
+ << Qt::Key_Left
+ << Qt::Key_Left
+ << Qt::Key_Left
+ << Qt::Key_Left
+ << "BE"
+ << QKeySequence::MoveToEndOfLine
+ << "!";
+
+ expectedString << "BEVERYAFRAID!";
+ expectedString << "BEVERYAFRAID";
+ expectedString << "VERYAFRAID";
+ expectedString << "AFRAID";
+
+ QTest::newRow("Inserts and moving cursor") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting '1234'
+ keys << "1234" << QKeySequence::MoveToStartOfLine
+ // skipping '12'
+ << Qt::Key_Right << Qt::Key_Right
+ // selecting '34'
+ << (Qt::Key_Right | Qt::ShiftModifier) << (Qt::Key_Right | Qt::ShiftModifier)
+ // deleting '34'
+ << Qt::Key_Delete;
+
+ expectedString << "12";
+ expectedString << "1234";
+
+ QTest::newRow("Inserts,moving,selection and delete") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting 'AB12'
+ keys << "AB12"
+ << QKeySequence::MoveToStartOfLine
+ // selecting 'AB'
+ << (Qt::Key_Right | Qt::ShiftModifier) << (Qt::Key_Right | Qt::ShiftModifier)
+ << Qt::Key_Backspace
+ << QKeySequence::Undo
+ << Qt::Key_Right
+ << (Qt::Key_Right | Qt::ShiftModifier) << (Qt::Key_Right | Qt::ShiftModifier)
+ << Qt::Key_Delete;
+
+ expectedString << "AB";
+ expectedString << "AB12";
+
+ QTest::newRow("Inserts,moving,selection, delete and undo") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting 'ABCD'
+ keys << "abcd"
+ //move left two
+ << Qt::Key_Left << Qt::Key_Left
+ // inserting '1234'
+ << "1234"
+ // selecting '1234'
+ << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier) << (Qt::Key_Left | Qt::ShiftModifier)
+ // overwriting '1234' with '5'
+ << "5"
+ // undoing deletion of 'AB'
+ << QKeySequence::Undo
+ // overwriting '1234' with '6'
+ << "6";
+
+ expectedString << "ab6cd";
+ // for versions previous to 3.2 we overwrite needed two undo operations
+ expectedString << "ab1234cd";
+ expectedString << "abcd";
+
+ QTest::newRow("Inserts,moving,selection and undo, removing selection") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting 'ABC'
+ keys << "ABC"
+ // removes 'C'
+ << Qt::Key_Backspace;
+
+ expectedString << "AB";
+ expectedString << "ABC";
+
+ QTest::newRow("Inserts,backspace") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "ABC"
+ // removes 'C'
+ << Qt::Key_Backspace
+ // inserting 'Z'
+ << "Z";
+
+ expectedString << "ABZ";
+ expectedString << "AB";
+ expectedString << "ABC";
+
+ QTest::newRow("Inserts,backspace,inserts") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting '123'
+ keys << "123" << QKeySequence::MoveToStartOfLine
+ // selecting '123'
+ << QKeySequence::SelectEndOfLine
+ // overwriting '123' with 'ABC'
+ << "ABC";
+
+ expectedString << "ABC";
+ expectedString << "123";
+
+ QTest::newRow("Inserts,moving,selection and overwriting") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ // inserting '123'
+ keys << "123"
+ << QKeySequence::Undo
+ << QKeySequence::Redo;
+
+ expectedString << "123";
+ expectedString << QString();
+
+ QTest::newRow("Insert,undo,redo") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "hello world"
+ << (Qt::Key_Backspace | Qt::ControlModifier)
+ << QKeySequence::Undo
+ << QKeySequence::Redo
+ << "hello";
+
+ expectedString
+ << "hello hello"
+ << "hello "
+ << "hello world"
+ << QString();
+
+ QTest::newRow("Insert,delete previous word,undo,redo,insert") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "hello world"
+ << QKeySequence::SelectPreviousWord
+ << (Qt::Key_Backspace)
+ << QKeySequence::Undo
+ << "hello";
+
+ expectedString
+ << "hello hello"
+ << "hello world"
+ << QString();
+
+ QTest::newRow("Insert,select previous word,remove,undo,insert") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "hello world"
+ << QKeySequence::DeleteStartOfWord
+ << QKeySequence::Undo
+ << "hello";
+
+ expectedString
+ << "hello worldhello"
+ << "hello world"
+ << QString();
+
+ QTest::newRow("Insert,delete previous word,undo,insert") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "hello world"
+ << QKeySequence::MoveToPreviousWord
+ << QKeySequence::DeleteEndOfWord
+ << QKeySequence::Undo
+ << "hello";
+
+ expectedString
+ << "hello helloworld"
+ << "hello world"
+ << QString();
+
+ QTest::newRow("Insert,move,delete next word,undo,insert") << keys << expectedString;
+ }
+ if (!QKeySequence(QKeySequence::DeleteEndOfLine).isEmpty()) { // X11 only.
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "hello world"
+ << QKeySequence::MoveToStartOfLine
+ << Qt::Key_Right
+ << QKeySequence::DeleteEndOfLine
+ << QKeySequence::Undo
+ << "hello";
+
+ expectedString
+ << "hhelloello world"
+ << "hello world"
+ << QString();
+
+ QTest::newRow("Insert,move,delete end of line,undo,insert") << keys << expectedString;
+ } {
+ KeyList keys;
+ QStringList expectedString;
+
+ keys << "hello world"
+ << QKeySequence::MoveToPreviousWord
+ << (Qt::Key_Left | Qt::ShiftModifier)
+ << (Qt::Key_Left | Qt::ShiftModifier)
+ << QKeySequence::DeleteEndOfWord
+ << QKeySequence::Undo
+ << "hello";
+
+ expectedString
+ << "hellhelloworld"
+ << "hello world"
+ << QString();
+
+ QTest::newRow("Insert,move,select,delete next word,undo,insert") << keys << expectedString;
+ }
+
+ bool canCopyPaste = PlatformQuirks::isClipboardAvailable();
+
+ if (canCopyPaste) {
+ KeyList keys;
+ keys << "123"
+ << QKeySequence(QKeySequence::SelectStartOfLine)
+ << QKeySequence(QKeySequence::Cut)
+ << "ABC"
+ << QKeySequence(QKeySequence::Paste);
+ QStringList expectedString = QStringList()
+ << "ABC123"
+ << "ABC"
+ // TextEdit: ""
+ << "123";
+ QTest::newRow("Cut,paste") << keys << expectedString;
+ }
+ if (canCopyPaste) {
+ KeyList keys;
+ keys << "123"
+ << QKeySequence(QKeySequence::SelectStartOfLine)
+ << QKeySequence(QKeySequence::Copy)
+ << "ABC"
+ << QKeySequence(QKeySequence::Paste);
+ QStringList expectedString = QStringList()
+ << "ABC123"
+ << "ABC"
+ // TextEdit: "A"
+ << "123";
+ QTest::newRow("Copy,paste") << keys << expectedString;
+ }
+}
+
+void tst_qquicktextinput::undo_keypressevents()
+{
+ QFETCH(KeyList, keys);
+ QFETCH(QStringList, expectedString);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ simulateKeys(&window, keys);
+
+ for (int i = 0; i < expectedString.size(); ++i) {
+ QCOMPARE(textInput->text() , expectedString[i]);
+ textInput->undo();
+ }
+ QVERIFY(textInput->text().isEmpty());
+}
+
+void tst_qquicktextinput::backspaceSurrogatePairs()
+{
+ // Test backspace, and delete remove both characters in a surrogate pair.
+ static const quint16 textData[] = { 0xd800, 0xdf00, 0xd800, 0xdf01, 0xd800, 0xdf02, 0xd800, 0xdf03, 0xd800, 0xdf04 };
+ const QString text = QString::fromUtf16(textData, lengthOf(textData));
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+ textInput->setText(text);
+ textInput->setCursorPosition(text.length());
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&window));
+ QCOMPARE(QGuiApplication::focusWindow(), &window);
+
+ for (int i = text.length(); i >= 0; i -= 2) {
+ QCOMPARE(textInput->text(), text.mid(0, i));
+ QTest::keyClick(&window, Qt::Key_Backspace, Qt::NoModifier);
+ }
+ QCOMPARE(textInput->text(), QString());
+
+ textInput->setText(text);
+ textInput->setCursorPosition(0);
+
+ for (int i = 0; i < text.length(); i += 2) {
+ QCOMPARE(textInput->text(), text.mid(i));
+ QTest::keyClick(&window, Qt::Key_Delete, Qt::NoModifier);
+ }
+ QCOMPARE(textInput->text(), QString());
+}
+
+void tst_qquicktextinput::QTBUG_19956()
+{
+ QFETCH(QString, url);
+
+ QQuickView window(testFileUrl(url));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject());
+ QVERIFY(input);
+ input->setFocus(true);
+ QVERIFY(input->hasActiveFocus());
+
+ QCOMPARE(window.rootObject()->property("topvalue").toInt(), 30);
+ QCOMPARE(window.rootObject()->property("bottomvalue").toInt(), 10);
+ QCOMPARE(window.rootObject()->property("text").toString(), QString("20"));
+ QVERIFY(window.rootObject()->property("acceptableInput").toBool());
+
+ window.rootObject()->setProperty("topvalue", 15);
+ QCOMPARE(window.rootObject()->property("topvalue").toInt(), 15);
+ QVERIFY(!window.rootObject()->property("acceptableInput").toBool());
+
+ window.rootObject()->setProperty("topvalue", 25);
+ QCOMPARE(window.rootObject()->property("topvalue").toInt(), 25);
+ QVERIFY(window.rootObject()->property("acceptableInput").toBool());
+
+ window.rootObject()->setProperty("bottomvalue", 21);
+ QCOMPARE(window.rootObject()->property("bottomvalue").toInt(), 21);
+ QVERIFY(!window.rootObject()->property("acceptableInput").toBool());
+
+ window.rootObject()->setProperty("bottomvalue", 10);
+ QCOMPARE(window.rootObject()->property("bottomvalue").toInt(), 10);
+ QVERIFY(window.rootObject()->property("acceptableInput").toBool());
+}
+
+void tst_qquicktextinput::QTBUG_19956_regexp()
+{
+ QUrl url = testFileUrl("qtbug-19956regexp.qml");
+
+ QString warning = url.toString() + ":11: Unable to assign [undefined] to QRegExp";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QQuickView window(url);
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(window.rootObject() != 0);
+ QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject());
+ QVERIFY(input);
+ input->setFocus(true);
+ QVERIFY(input->hasActiveFocus());
+
+ window.rootObject()->setProperty("regexvalue", QRegExp("abc"));
+ QCOMPARE(window.rootObject()->property("regexvalue").toRegExp(), QRegExp("abc"));
+ QCOMPARE(window.rootObject()->property("text").toString(), QString("abc"));
+ QVERIFY(window.rootObject()->property("acceptableInput").toBool());
+
+ window.rootObject()->setProperty("regexvalue", QRegExp("abcd"));
+ QCOMPARE(window.rootObject()->property("regexvalue").toRegExp(), QRegExp("abcd"));
+ QVERIFY(!window.rootObject()->property("acceptableInput").toBool());
+
+ window.rootObject()->setProperty("regexvalue", QRegExp("abc"));
+ QCOMPARE(window.rootObject()->property("regexvalue").toRegExp(), QRegExp("abc"));
+ QVERIFY(window.rootObject()->property("acceptableInput").toBool());
+}
+
+void tst_qquicktextinput::implicitSize_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("wrap");
+ QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "TextInput.NoWrap";
+ QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "TextInput.Wrap";
+}
+
+void tst_qquicktextinput::implicitSize()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, wrap);
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + text + "\"; width: 50; wrapMode: " + wrap + " }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create());
+
+ QVERIFY(textObject->width() < textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+
+ textObject->resetWidth();
+ QVERIFY(textObject->width() == textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+}
+
+void tst_qquicktextinput::implicitSizeBinding_data()
+{
+ implicitSize_data();
+}
+
+void tst_qquicktextinput::implicitSizeBinding()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, wrap);
+ QString componentStr = "import QtQuick 2.0\nTextInput { text: \"" + text + "\"; width: implicitWidth; height: implicitHeight; wrapMode: " + wrap + " }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QScopedPointer<QObject> object(textComponent.create());
+ QQuickTextInput *textObject = qobject_cast<QQuickTextInput *>(object.data());
+
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+
+ textObject->resetWidth();
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+
+ textObject->resetHeight();
+ QCOMPARE(textObject->width(), textObject->implicitWidth());
+ QCOMPARE(textObject->height(), textObject->implicitHeight());
+}
+
+
+void tst_qquicktextinput::negativeDimensions()
+{
+ // Verify this doesn't assert during initialization.
+ QQmlComponent component(&engine, testFileUrl("negativeDimensions.qml"));
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(o);
+ QQuickTextInput *input = o->findChild<QQuickTextInput *>("input");
+ QVERIFY(input);
+ QCOMPARE(input->width(), qreal(-1));
+ QCOMPARE(input->height(), qreal(-1));
+}
+
+
+void tst_qquicktextinput::setInputMask_data()
+{
+ QTest::addColumn<QString>("mask");
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<QString>("expectedDisplay");
+ QTest::addColumn<bool>("insert_text");
+
+ // both keyboard and insert()
+ for (int i=0; i<2; i++) {
+ bool insert_text = i==0 ? false : true;
+ QString insert_mode = "keys ";
+ if (insert_text)
+ insert_mode = "insert ";
+
+ QTest::newRow(QString(insert_mode + "ip_localhost").toLatin1())
+ << QString("000.000.000.000")
+ << QString("127.0.0.1")
+ << QString("127.0.0.1")
+ << QString("127.0 .0 .1 ")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "mac").toLatin1())
+ << QString("HH:HH:HH:HH:HH:HH;#")
+ << QString("00:E0:81:21:9E:8E")
+ << QString("00:E0:81:21:9E:8E")
+ << QString("00:E0:81:21:9E:8E")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "mac2").toLatin1())
+ << QString("<HH:>HH:!HH:HH:HH:HH;#")
+ << QString("AAe081219E8E")
+ << QString("aa:E0:81:21:9E:8E")
+ << QString("aa:E0:81:21:9E:8E")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "byte").toLatin1())
+ << QString("BBBBBBBB;0")
+ << QString("11011001")
+ << QString("11111")
+ << QString("11011001")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "halfbytes").toLatin1())
+ << QString("bbbb.bbbb;-")
+ << QString("110. 0001")
+ << QString("110.0001")
+ << QString("110-.0001")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "blank char same type as content").toLatin1())
+ << QString("000.000.000.000;0")
+ << QString("127.0.0.1")
+ << QString("127...1")
+ << QString("127.000.000.100")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "parts of ip_localhost").toLatin1())
+ << QString("000.000.000.000")
+ << QString(".0.0.1")
+ << QString(".0.0.1")
+ << QString(" .0 .0 .1 ")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "ip_null").toLatin1())
+ << QString("000.000.000.000")
+ << QString()
+ << QString("...")
+ << QString(" . . . ")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "ip_null_hash").toLatin1())
+ << QString("000.000.000.000;#")
+ << QString()
+ << QString("...")
+ << QString("###.###.###.###")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "ip_overflow").toLatin1())
+ << QString("000.000.000.000")
+ << QString("1234123412341234")
+ << QString("123.412.341.234")
+ << QString("123.412.341.234")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "uppercase").toLatin1())
+ << QString(">AAAA")
+ << QString("AbCd")
+ << QString("ABCD")
+ << QString("ABCD")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "lowercase").toLatin1())
+ << QString("<AAAA")
+ << QString("AbCd")
+ << QString("abcd")
+ << QString("abcd")
+ << bool(insert_text);
+
+ QTest::newRow(QString(insert_mode + "nocase").toLatin1())
+ << QString("!AAAA")
+ << QString("AbCd")
+ << QString("AbCd")
+ << QString("AbCd")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "nocase1").toLatin1())
+ << QString("!A!A!A!A")
+ << QString("AbCd")
+ << QString("AbCd")
+ << QString("AbCd")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "nocase2").toLatin1())
+ << QString("AAAA")
+ << QString("AbCd")
+ << QString("AbCd")
+ << QString("AbCd")
+ << bool(insert_text);
+
+ QTest::newRow(QString(insert_mode + "reserved").toLatin1())
+ << QString("{n}[0]")
+ << QString("A9")
+ << QString("A9")
+ << QString("A9")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "escape01").toLatin1())
+ << QString("\\\\N\\\\n00")
+ << QString("9")
+ << QString("Nn9")
+ << QString("Nn9 ")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "escape02").toLatin1())
+ << QString("\\\\\\\\00")
+ << QString("0")
+ << QString("\\0")
+ << QString("\\0 ")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "escape03").toLatin1())
+ << QString("\\\\(00\\\\)")
+ << QString("0")
+ << QString("(0)")
+ << QString("(0 )")
+ << bool(insert_text);
+
+ QTest::newRow(QString(insert_mode + "upper_lower_nocase1").toLatin1())
+ << QString(">AAAA<AAAA!AAAA")
+ << QString("AbCdEfGhIjKl")
+ << QString("ABCDefghIjKl")
+ << QString("ABCDefghIjKl")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "upper_lower_nocase2").toLatin1())
+ << QString(">aaaa<aaaa!aaaa")
+ << QString("AbCdEfGhIjKl")
+ << QString("ABCDefghIjKl")
+ << QString("ABCDefghIjKl")
+ << bool(insert_text);
+
+ QTest::newRow(QString(insert_mode + "exact_case1").toLatin1())
+ << QString(">A<A<A>A>A<A!A!A")
+ << QString("AbCdEFGH")
+ << QString("AbcDEfGH")
+ << QString("AbcDEfGH")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "exact_case2").toLatin1())
+ << QString(">A<A<A>A>A<A!A!A")
+ << QString("aBcDefgh")
+ << QString("AbcDEfgh")
+ << QString("AbcDEfgh")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "exact_case3").toLatin1())
+ << QString(">a<a<a>a>a<a!a!a")
+ << QString("AbCdEFGH")
+ << QString("AbcDEfGH")
+ << QString("AbcDEfGH")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "exact_case4").toLatin1())
+ << QString(">a<a<a>a>a<a!a!a")
+ << QString("aBcDefgh")
+ << QString("AbcDEfgh")
+ << QString("AbcDEfgh")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "exact_case5").toLatin1())
+ << QString(">H<H<H>H>H<H!H!H")
+ << QString("aBcDef01")
+ << QString("AbcDEf01")
+ << QString("AbcDEf01")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "exact_case6").toLatin1())
+ << QString(">h<h<h>h>h<h!h!h")
+ << QString("aBcDef92")
+ << QString("AbcDEf92")
+ << QString("AbcDEf92")
+ << bool(insert_text);
+
+ QTest::newRow(QString(insert_mode + "illegal_keys1").toLatin1())
+ << QString("AAAAAAAA")
+ << QString("A2#a;.0!")
+ << QString("Aa")
+ << QString("Aa ")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "illegal_keys2").toLatin1())
+ << QString("AAAA")
+ << QString("f4f4f4f4")
+ << QString("ffff")
+ << QString("ffff")
+ << bool(insert_text);
+ QTest::newRow(QString(insert_mode + "blank=input").toLatin1())
+ << QString("9999;0")
+ << QString("2004")
+ << QString("2004")
+ << QString("2004")
+ << bool(insert_text);
+ }
+}
+
+void tst_qquicktextinput::setInputMask()
+{
+ QFETCH(QString, mask);
+ QFETCH(QString, input);
+ QFETCH(QString, expectedText);
+ QFETCH(QString, expectedDisplay);
+ QFETCH(bool, insert_text);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true; inputMask: \"" + mask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ // then either insert using insert() or keyboard
+ if (insert_text) {
+ textInput->insert(0, input);
+ } else {
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ simulateKey(&window, Qt::Key_Home);
+ for (int i = 0; i < input.length(); i++)
+ QTest::keyClick(&window, input.at(i).toLatin1());
+ }
+
+ QEXPECT_FAIL( "keys blank=input", "To eat blanks or not? Known issue. Task 43172", Abort);
+ QEXPECT_FAIL( "insert blank=input", "To eat blanks or not? Known issue. Task 43172", Abort);
+
+ QCOMPARE(textInput->text(), expectedText);
+ QCOMPARE(textInput->displayText(), expectedDisplay);
+}
+
+void tst_qquicktextinput::inputMask_data()
+{
+ QTest::addColumn<QString>("mask");
+ QTest::addColumn<QString>("expectedMask");
+
+ // if no mask is set a nul string should be returned
+ QTest::newRow("nul 1") << QString("") << QString();
+ QTest::newRow("nul 2") << QString() << QString();
+
+ // try different masks
+ QTest::newRow("mask 1") << QString("000.000.000.000") << QString("000.000.000.000; ");
+ QTest::newRow("mask 2") << QString("000.000.000.000;#") << QString("000.000.000.000;#");
+ QTest::newRow("mask 3") << QString("AAA.aa.999.###;") << QString("AAA.aa.999.###; ");
+ QTest::newRow("mask 4") << QString(">abcdef<GHIJK") << QString(">abcdef<GHIJK; ");
+
+ // set an invalid input mask...
+ // the current behaviour is that this exact (faulty) string is returned.
+ QTest::newRow("invalid") << QString("ABCDEFGHIKLMNOP;") << QString("ABCDEFGHIKLMNOP; ");
+
+ // verify that we can unset the mask again
+ QTest::newRow("unset") << QString("") << QString();
+}
+
+void tst_qquicktextinput::inputMask()
+{
+ QFETCH(QString, mask);
+ QFETCH(QString, expectedMask);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true; inputMask: \"" + mask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QCOMPARE(textInput->inputMask(), expectedMask);
+}
+
+void tst_qquicktextinput::clearInputMask()
+{
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true; inputMask: \"000.000.000.000\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QVERIFY(!textInput->inputMask().isEmpty());
+ textInput->setInputMask(QString());
+ QCOMPARE(textInput->inputMask(), QString());
+}
+
+void tst_qquicktextinput::keypress_inputMask_data()
+{
+ QTest::addColumn<QString>("mask");
+ QTest::addColumn<KeyList>("keys");
+ QTest::addColumn<QString>("expectedText");
+ QTest::addColumn<QString>("expectedDisplayText");
+
+ {
+ KeyList keys;
+ // inserting 'A1.2B'
+ keys << Qt::Key_Home << "A1.2B";
+ QTest::newRow("jumping on period(separator)") << QString("000.000;_") << keys << QString("1.2") << QString("1__.2__");
+ }
+ {
+ KeyList keys;
+ // inserting '0!P3'
+ keys << Qt::Key_Home << "0!P3";
+ QTest::newRow("jumping on input") << QString("D0.AA.XX.AA.00;_") << keys << QString("0..!P..3") << QString("_0.__.!P.__.3_");
+ }
+ {
+ KeyList keys;
+ // pressing delete
+ keys << Qt::Key_Home
+ << Qt::Key_Delete;
+ QTest::newRow("delete") << QString("000.000;_") << keys << QString(".") << QString("___.___");
+ }
+ {
+ KeyList keys;
+ // selecting all and delete
+ keys << Qt::Key_Home
+ << Key(Qt::ShiftModifier, Qt::Key_End)
+ << Qt::Key_Delete;
+ QTest::newRow("deleting all") << QString("000.000;_") << keys << QString(".") << QString("___.___");
+ }
+ {
+ KeyList keys;
+ // inserting '12.12' then two backspaces
+ keys << Qt::Key_Home << "12.12" << Qt::Key_Backspace << Qt::Key_Backspace;
+ QTest::newRow("backspace") << QString("000.000;_") << keys << QString("12.") << QString("12_.___");
+ }
+ {
+ KeyList keys;
+ // inserting '12ab'
+ keys << Qt::Key_Home << "12ab";
+ QTest::newRow("uppercase") << QString("9999 >AA;_") << keys << QString("12 AB") << QString("12__ AB");
+ }
+}
+
+void tst_qquicktextinput::keypress_inputMask()
+{
+ QFETCH(QString, mask);
+ QFETCH(KeyList, keys);
+ QFETCH(QString, expectedText);
+ QFETCH(QString, expectedDisplayText);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { focus: true; inputMask: \"" + mask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ QQuickWindow window;
+ textInput->setParentItem(window.contentItem());
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+ QVERIFY(textInput->hasActiveFocus());
+
+ simulateKeys(&window, keys);
+
+ QCOMPARE(textInput->text(), expectedText);
+ QCOMPARE(textInput->displayText(), expectedDisplayText);
+}
+
+
+void tst_qquicktextinput::hasAcceptableInputMask_data()
+{
+ QTest::addColumn<QString>("optionalMask");
+ QTest::addColumn<QString>("requiredMask");
+ QTest::addColumn<QString>("invalid");
+ QTest::addColumn<QString>("valid");
+
+ QTest::newRow("Alphabetic optional and required")
+ << QString("aaaa") << QString("AAAA") << QString("ab") << QString("abcd");
+ QTest::newRow("Alphanumeric optional and require")
+ << QString("nnnn") << QString("NNNN") << QString("R2") << QString("R2D2");
+ QTest::newRow("Any optional and required")
+ << QString("xxxx") << QString("XXXX") << QString("+-") << QString("+-*/");
+ QTest::newRow("Numeric (0-9) required")
+ << QString("0000") << QString("9999") << QString("11") << QString("1138");
+ QTest::newRow("Numeric (1-9) optional and required")
+ << QString("dddd") << QString("DDDD") << QString("12") << QString("1234");
+}
+
+void tst_qquicktextinput::hasAcceptableInputMask()
+{
+ QFETCH(QString, optionalMask);
+ QFETCH(QString, requiredMask);
+ QFETCH(QString, invalid);
+ QFETCH(QString, valid);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { inputMask: \"" + optionalMask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ // test that invalid input (for required) work for optionalMask
+ textInput->setText(invalid);
+ QVERIFY(textInput->hasAcceptableInput());
+
+ // at the moment we don't strip the blank character if it is valid input, this makes the test between x vs X useless
+ QEXPECT_FAIL( "Any optional and required", "To eat blanks or not? Known issue. Task 43172", Abort);
+
+ // test requiredMask
+ textInput->setInputMask(requiredMask);
+ textInput->setText(invalid);
+ QVERIFY(!textInput->hasAcceptableInput());
+
+ textInput->setText(valid);
+ QVERIFY(textInput->hasAcceptableInput());
+}
+
+void tst_qquicktextinput::maskCharacter_data()
+{
+ QTest::addColumn<QString>("mask");
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<bool>("expectedValid");
+
+ QTest::newRow("Hex") << QString("H")
+ << QString("0123456789abcdefABCDEF") << true;
+ QTest::newRow("hex") << QString("h")
+ << QString("0123456789abcdefABCDEF") << true;
+ QTest::newRow("HexInvalid") << QString("H")
+ << QString("ghijklmnopqrstuvwxyzGHIJKLMNOPQRSTUVWXYZ")
+ << false;
+ QTest::newRow("hexInvalid") << QString("h")
+ << QString("ghijklmnopqrstuvwxyzGHIJKLMNOPQRSTUVWXYZ")
+ << false;
+ QTest::newRow("Bin") << QString("B")
+ << QString("01") << true;
+ QTest::newRow("bin") << QString("b")
+ << QString("01") << true;
+ QTest::newRow("BinInvalid") << QString("B")
+ << QString("23456789qwertyuiopasdfghjklzxcvbnm")
+ << false;
+ QTest::newRow("binInvalid") << QString("b")
+ << QString("23456789qwertyuiopasdfghjklzxcvbnm")
+ << false;
+}
+
+void tst_qquicktextinput::maskCharacter()
+{
+ QFETCH(QString, mask);
+ QFETCH(QString, input);
+ QFETCH(bool, expectedValid);
+
+ QString componentStr = "import QtQuick 2.0\nTextInput { inputMask: \"" + mask + "\" }";
+ QQmlComponent textInputComponent(&engine);
+ textInputComponent.setData(componentStr.toLatin1(), QUrl());
+ QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create());
+ QVERIFY(textInput != 0);
+
+ for (int i = 0; i < input.size(); ++i) {
+ QString in = QString(input.at(i));
+ QString expected = expectedValid ? in : QString();
+ textInput->setText(QString(input.at(i)));
+ QCOMPARE(textInput->text(), expected);
+ }
+}
+
+QTEST_MAIN(tst_qquicktextinput)
+
+#include "tst_qquicktextinput.moc"
diff --git a/tests/auto/quick/qquickview/data/error1.qml b/tests/auto/quick/qquickview/data/error1.qml
new file mode 100644
index 0000000000..09df679555
--- /dev/null
+++ b/tests/auto/quick/qquickview/data/error1.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Rectangle {
+ nonExistentProperty: 5
+}
diff --git a/tests/auto/quick/qquickview/data/resizemodeitem.qml b/tests/auto/quick/qquickview/data/resizemodeitem.qml
new file mode 100644
index 0000000000..ed73009b26
--- /dev/null
+++ b/tests/auto/quick/qquickview/data/resizemodeitem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+Item {
+ width: 200
+ height: 200
+}
diff --git a/tests/auto/quick/qquickview/qquickview.pro b/tests/auto/quick/qquickview/qquickview.pro
new file mode 100644
index 0000000000..3e9c39e2ce
--- /dev/null
+++ b/tests/auto/quick/qquickview/qquickview.pro
@@ -0,0 +1,13 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qquickview
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickview.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp
new file mode 100644
index 0000000000..e2e20a6516
--- /dev/null
+++ b/tests/auto/quick/qquickview/tst_qquickview.cpp
@@ -0,0 +1,243 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickitem.h>
+#include "../../shared/util.h"
+#include <QtGui/QWindow>
+#include <QtCore/QDebug>
+#include <QtQml/qqmlengine.h>
+
+class tst_QQuickView : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickView();
+
+private slots:
+ void resizemodeitem();
+ void errors();
+ void engine();
+};
+
+
+tst_QQuickView::tst_QQuickView()
+{
+}
+
+void tst_QQuickView::resizemodeitem()
+{
+ QWindow window;
+ window.setGeometry(0, 0, 400, 400);
+
+ QQuickView *view = new QQuickView(&window);
+ QVERIFY(view);
+ view->setResizeMode(QQuickView::SizeRootObjectToView);
+ QCOMPARE(QSize(0,0), view->initialSize());
+ view->setSource(testFileUrl("resizemodeitem.qml"));
+ QQuickItem* item = qobject_cast<QQuickItem*>(view->rootObject());
+ QVERIFY(item);
+ window.show();
+
+ view->show();
+
+ // initial size from root object
+ QCOMPARE(item->width(), 200.0);
+ QCOMPARE(item->height(), 200.0);
+ QCOMPARE(view->size(), QSize(200, 200));
+ QCOMPARE(view->size(), view->sizeHint());
+ QCOMPARE(view->size(), view->initialSize());
+
+ // size update from view
+ view->resize(QSize(80,100));
+
+ QTRY_COMPARE(item->width(), 80.0);
+ QCOMPARE(item->height(), 100.0);
+ QCOMPARE(view->size(), QSize(80, 100));
+ QCOMPARE(view->size(), view->sizeHint());
+
+ view->setResizeMode(QQuickView::SizeViewToRootObject);
+
+ // size update from view disabled
+ view->resize(QSize(60,80));
+ QCOMPARE(item->width(), 80.0);
+ QCOMPARE(item->height(), 100.0);
+ QTest::qWait(50);
+ QCOMPARE(view->size(), QSize(60, 80));
+
+ // size update from root object
+ item->setWidth(250);
+ item->setHeight(350);
+ QCOMPARE(item->width(), 250.0);
+ QCOMPARE(item->height(), 350.0);
+ QTRY_COMPARE(view->size(), QSize(250, 350));
+ QCOMPARE(view->size(), QSize(250, 350));
+ QCOMPARE(view->size(), view->sizeHint());
+
+ // reset window
+ window.hide();
+ delete view;
+ view = new QQuickView(&window);
+ QVERIFY(view);
+ view->setResizeMode(QQuickView::SizeViewToRootObject);
+ view->setSource(testFileUrl("resizemodeitem.qml"));
+ item = qobject_cast<QQuickItem*>(view->rootObject());
+ QVERIFY(item);
+ window.show();
+
+ view->show();
+
+ // initial size for root object
+ QCOMPARE(item->width(), 200.0);
+ QCOMPARE(item->height(), 200.0);
+ QCOMPARE(view->size(), view->sizeHint());
+ QCOMPARE(view->size(), view->initialSize());
+
+ // size update from root object
+ item->setWidth(80);
+ item->setHeight(100);
+ QCOMPARE(item->width(), 80.0);
+ QCOMPARE(item->height(), 100.0);
+ QTRY_COMPARE(view->size(), QSize(80, 100));
+ QCOMPARE(view->size(), QSize(80, 100));
+ QCOMPARE(view->size(), view->sizeHint());
+
+ // size update from root object disabled
+ view->setResizeMode(QQuickView::SizeRootObjectToView);
+ item->setWidth(60);
+ item->setHeight(80);
+ QCOMPARE(view->width(), 80);
+ QCOMPARE(view->height(), 100);
+ QCOMPARE(QSize(item->width(), item->height()), view->sizeHint());
+
+ // size update from view
+ view->resize(QSize(200,300));
+ QTRY_COMPARE(item->width(), 200.0);
+ QCOMPARE(item->height(), 300.0);
+ QCOMPARE(view->size(), QSize(200, 300));
+ QCOMPARE(view->size(), view->sizeHint());
+
+ window.hide();
+ delete view;
+
+ // if we set a specific size for the view then it should keep that size
+ // for SizeRootObjectToView mode.
+ view = new QQuickView(&window);
+ view->resize(300, 300);
+ view->setResizeMode(QQuickView::SizeRootObjectToView);
+ QCOMPARE(QSize(0,0), view->initialSize());
+ view->setSource(testFileUrl("resizemodeitem.qml"));
+ view->resize(300, 300);
+ item = qobject_cast<QQuickItem*>(view->rootObject());
+ QVERIFY(item);
+ window.show();
+
+ view->show();
+ QTest::qWait(50);
+
+ // initial size from root object
+ QCOMPARE(item->width(), 300.0);
+ QCOMPARE(item->height(), 300.0);
+ QCOMPARE(view->size(), QSize(300, 300));
+ QCOMPARE(view->size(), view->sizeHint());
+ QCOMPARE(view->initialSize(), QSize(200, 200)); // initial object size
+
+ delete view;
+}
+
+static void silentErrorsMsgHandler(QtMsgType, const QMessageLogContext &, const QString &)
+{
+}
+
+void tst_QQuickView::errors()
+{
+ QQuickView *view = new QQuickView;
+ QVERIFY(view);
+ QQmlTestMessageHandler messageHandler;
+ view->setSource(testFileUrl("error1.qml"));
+ QVERIFY(view->status() == QQuickView::Error);
+ QVERIFY(view->errors().count() == 1);
+ delete view;
+}
+
+void tst_QQuickView::engine()
+{
+ QQmlEngine *engine = new QQmlEngine;
+ QVERIFY(!engine->incubationController());
+
+ QQuickView *view = new QQuickView(engine, 0);
+ QVERIFY(view);
+ QVERIFY(engine->incubationController() == view->incubationController());
+
+ QQuickView *view2 = new QQuickView(engine, 0);
+ QVERIFY(view);
+ QVERIFY(engine->incubationController() == view->incubationController());
+ delete view;
+ QVERIFY(!engine->incubationController());
+
+ engine->setIncubationController(view2->incubationController());
+ QVERIFY(engine->incubationController() == view2->incubationController());
+ delete view2;
+ QVERIFY(!engine->incubationController());
+
+ QQuickView *view3 = new QQuickView;
+ QQuickView *view4 = new QQuickView(view3->engine(), 0);
+
+ QVERIFY(view3->engine());
+ QVERIFY(view4->engine());
+ QCOMPARE(view3->engine(), view4->engine());
+ delete view3;
+ QVERIFY(!view4->engine());
+ QTest::ignoreMessage(QtWarningMsg, "QQuickView: invalid qml engine. ");
+ view4->setSource(QUrl());
+
+ QCOMPARE(view4->status(), QQuickView::Error);
+ QVERIFY(!view4->errors().isEmpty());
+ QCOMPARE(view4->errors().back().description(), QLatin1String("QQuickView: invalid qml engine."));
+ delete view4;
+}
+
+QTEST_MAIN(tst_QQuickView)
+
+#include "tst_qquickview.moc"
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/create.qml b/tests/auto/quick/qquickvisualdatamodel/data/create.qml
new file mode 100644
index 0000000000..9f4b754552
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/create.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+ListView {
+ width: 200
+ height: 200
+
+ property var persistentHandle
+
+ model: VisualDataModel {
+ id: visualModel
+
+ persistedItems.includeByDefault: true
+
+ model: myModel
+ delegate: Item {
+ id: delegate
+ objectName: "delegate"
+ width: 200
+ height: 20
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml
new file mode 100644
index 0000000000..ae3bd81d91
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/datalist-package.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: visualModel.parts.package
+ VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+ model: myModel
+ delegate: Package {
+ Rectangle {
+ height: 25
+ width: 100
+ Package.name: "package"
+ Text { objectName: "display"; text: display }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/datalist.qml b/tests/auto/quick/qquickvisualdatamodel/data/datalist.qml
new file mode 100644
index 0000000000..8ce59caddc
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/datalist.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+ model: myModel
+ delegate: Component {
+ Rectangle {
+ height: 25
+ width: 100
+ Text { objectName: "display"; text: display }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml b/tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml
new file mode 100644
index 0000000000..70c6f9f995
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/groups-invalid.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+VisualDataModel {
+ id: visualModel
+
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" },
+ VisualDataGroup { id: unnamed; objectName: "unnamed" },
+ VisualDataGroup { id: capitalised; objectName: "capitalised"; name: "Capitalised" }
+ ]
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml
new file mode 100644
index 0000000000..ea5ad5d3bd
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/groups-package.qml
@@ -0,0 +1,52 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+
+ function contains(array, value) {
+ for (var i = 0; i < array.length; ++i)
+ if (array[i] == value)
+ return true
+ return false
+ }
+ model: visualModel.parts.package
+
+ VisualDataModel {
+ id: visualModel
+
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: myModel
+ delegate: Package {
+ id: delegate
+
+ property variant test1: name
+ property variant test2: index
+ property variant test3: VisualDataModel.itemsIndex
+ property variant test4: VisualDataModel.inItems
+ property variant test5: VisualDataModel.visibleIndex
+ property variant test6: VisualDataModel.inVisible
+ property variant test7: VisualDataModel.selectedIndex
+ property variant test8: VisualDataModel.inSelected
+ property variant test9: VisualDataModel.groups
+
+ function hide() { VisualDataModel.inVisible = false }
+ function select() { VisualDataModel.inSelected = true }
+
+ Item {
+ Package.name: "package"
+
+ objectName: "delegate"
+ width: 100
+ height: 2
+ }
+ }
+ }
+
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/groups.qml b/tests/auto/quick/qquickvisualdatamodel/data/groups.qml
new file mode 100644
index 0000000000..7502dd2502
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/groups.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+
+ function contains(array, value) {
+ for (var i = 0; i < array.length; ++i)
+ if (array[i] == value)
+ return true
+ return false
+ }
+
+ model: visualModel
+ VisualDataModel {
+ id: visualModel
+
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: myModel
+ delegate: Item {
+ id: delegate
+
+ objectName: "delegate"
+ width: 100
+ height: 2
+ property variant test1: name
+ property variant test2: index
+ property variant test3: VisualDataModel.itemsIndex
+ property variant test4: VisualDataModel.inItems
+ property variant test5: VisualDataModel.visibleIndex
+ property variant test6: VisualDataModel.inVisible
+ property variant test7: VisualDataModel.selectedIndex
+ property variant test8: VisualDataModel.inSelected
+ property variant test9: VisualDataModel.groups
+
+ function hide() { VisualDataModel.inVisible = false }
+ function select() { VisualDataModel.inSelected = true }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml b/tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml
new file mode 100644
index 0000000000..2758f56d0f
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/invalidAttachment.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ property VisualDataModel invalidVdm: VisualDataModel.model
+ Repeater {
+ model: 1
+ delegate: Item {
+ id: outer
+ objectName: "delegate"
+
+ property VisualDataModel validVdm: outer.VisualDataModel.model
+ property VisualDataModel invalidVdm: inner.VisualDataModel.model
+
+ Item {
+ id: inner
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_listView.qml b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_listView.qml
new file mode 100644
index 0000000000..103c4d2eb6
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_listView.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+
+ model: myModel
+ delegate: Item {
+ objectName: "delegate"
+ width: 100
+ height: 20
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml
new file mode 100644
index 0000000000..b47f22dc34
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_package.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ width: 100
+ height: 100
+
+ ListView {
+ anchors.fill: parent
+
+ model: visualModel.parts.list
+ }
+ VisualDataModel {
+ id: visualModel
+
+ model: myModel
+ delegate: Package {
+ Item {
+ Package.name: "list"
+ width: 100
+ height: 20
+ }
+
+ Item {
+ id: gridItem
+ Package.name: "grid"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "delegate"
+ parent: gridItem
+ width: 20
+ height: 20
+ }
+ }
+ }
+ GridView {
+ anchors.fill: parent
+
+ model: visualModel.parts.grid
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_pathView.qml b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_pathView.qml
new file mode 100644
index 0000000000..bc619124fd
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_pathView.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+PathView {
+ width: 100
+ height: 100
+
+ model: myModel
+ delegate: Item {
+ objectName: "delegate"
+ width: 100
+ height: 20
+ }
+
+ path: Path {
+ startX: 50; startY: 0
+ PathLine { x: 50; y: 100 }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_repeater.qml b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_repeater.qml
new file mode 100644
index 0000000000..e97e0dad2e
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/itemsDestroyed_repeater.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Grid {
+ Repeater {
+ width: 100
+ height: 100
+
+ model: myModel
+ delegate: Item {
+ objectName: "delegate"
+ width: 50
+ height: 50
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml
new file mode 100644
index 0000000000..b6b56727e8
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties-package.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: visualModel.parts.package
+
+ VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: ListModel {
+ id: listModel
+
+ ListElement { number: "one" }
+ ListElement { number: "two" }
+ ListElement { number: "three" }
+ ListElement { number: "four" }
+ }
+
+ delegate: Package {
+ id: delegate
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: number
+ property variant test4: model.number
+ property variant test5: modelData
+ property variant test6: model.modelData
+
+ function setTest3(arg) { number = arg }
+ function setTest4(arg) { model.number = arg }
+ function setTest5(arg) { modelData = arg }
+ function setTest6(arg) { model.modelData = arg }
+
+ Item {
+ objectName: "delegate"
+
+ Package.name: "package"
+
+ width: 100
+ height: 2
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml
new file mode 100644
index 0000000000..d2dfc37e07
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/listmodelproperties.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: ListModel {
+ id: listModel
+
+ ListElement { number: "one" }
+ ListElement { number: "two" }
+ ListElement { number: "three" }
+ ListElement { number: "four" }
+ }
+
+ delegate: Item {
+ id: delegate
+
+ objectName: "delegate"
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: number
+ property variant test4: model.number
+ property variant test5: modelData
+ property variant test6: model.modelData
+
+ function setTest3(arg) { number = arg }
+ function setTest4(arg) { model.number = arg }
+ function setTest5(arg) { modelData = arg }
+ function setTest6(arg) { model.modelData = arg }
+
+ width: 100
+ height: 2
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/modelproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/modelproperties.qml
new file mode 100644
index 0000000000..73b766f1af
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/modelproperties.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: myModel
+ delegate: Item {
+ objectName: "delegate"
+ width: 100
+ height: 2
+ property variant test1: name
+ property variant test2: model.name
+ property variant test3: modelData
+ property variant test4: model.modelData
+ property variant test5: modelData.name
+ property variant test6: model
+ property variant test7: index
+ property variant test8: model.index
+ property variant test9: model.modelData.name
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/modelproperties2.qml b/tests/auto/quick/qquickvisualdatamodel/data/modelproperties2.qml
new file mode 100644
index 0000000000..ea5c240b29
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/modelproperties2.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: myModel
+ delegate: Item {
+ objectName: "delegate"
+ property variant test1: display
+ property variant test2: model.display
+ property variant test3: modelData
+ property variant test4: model.modelData
+ property variant test5: modelData.display
+ property variant test6: model
+ property variant test7: index
+ property variant test8: model.index
+ property variant test9: model.modelData.display
+ width: 100
+ height: 2
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml
new file mode 100644
index 0000000000..964ac426f8
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties-package.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: visualModel.parts.package
+ VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: StandardItemModel {
+ StandardItem { text: "Row 1 Item" }
+ StandardItem { text: "Row 2 Item" }
+ StandardItem { text: "Row 3 Item" }
+ StandardItem { text: "Row 4 Item" }
+ }
+
+ delegate: Package {
+ id: delegate
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: display
+ property variant test4: model.display
+
+ function setTest3(arg) { display = arg }
+ function setTest4(arg) { model.display = arg }
+
+ Item {
+ objectName: "delegate"
+
+ width: 100
+ height: 2
+
+ Package.name: "package"
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml
new file mode 100644
index 0000000000..77e30b69b9
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/multipleroleproperties.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: StandardItemModel {
+ StandardItem { text: "Row 1 Item" }
+ StandardItem { text: "Row 2 Item" }
+ StandardItem { text: "Row 3 Item" }
+ StandardItem { text: "Row 4 Item" }
+ }
+
+ delegate: Item {
+ id: delegate
+
+ objectName: "delegate"
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: display
+ property variant test4: model.display
+
+ function setTest3(arg) { display = arg }
+ function setTest4(arg) { model.display = arg }
+
+ width: 100
+ height: 2
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/objectlist.qml b/tests/auto/quick/qquickvisualdatamodel/data/objectlist.qml
new file mode 100644
index 0000000000..b0d5bd8032
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/objectlist.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ anchors.fill: parent
+ model: myModel
+ delegate: Component {
+ Rectangle {
+ height: 25
+ width: 100
+ color: model.modelData.color
+ Text { objectName: "name"; text: name; property string modelName: model.name; function getText() { return name } }
+ Text { objectName: "section"; text: parent.ListView.section }
+ }
+ }
+
+ function changeSectionProperty() {
+ section.property = "object.subName"
+ }
+ section.property: "name"
+ section.criteria: ViewSection.FullString
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml
new file mode 100644
index 0000000000..c69e54c2f8
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties-package.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: visualModel.parts.package
+
+ VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ property list<DataObject> objects: [
+ DataObject { name: "Item 1"; color: "red" },
+ DataObject { name: "Item 2"; color: "green" },
+ DataObject { name: "Item 3"; color: "blue"},
+ DataObject { name: "Item 4"; color: "yellow" }
+ ]
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: objects
+
+ delegate: Package {
+ id: delegate
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: name
+ property variant test4: model.name
+
+ function setTest3(arg) { name = arg }
+ function setTest4(arg) { model.name = arg }
+
+ Item {
+ objectName: "delegate"
+
+ width: 100
+ height: 2
+ Package.name: "package"
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml
new file mode 100644
index 0000000000..0dbe2f5459
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/objectlistproperties.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ property list<DataObject> objects: [
+ DataObject { name: "Item 1"; color: "red" },
+ DataObject { name: "Item 2"; color: "green" },
+ DataObject { name: "Item 3"; color: "blue"},
+ DataObject { name: "Item 4"; color: "yellow" }
+ ]
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: objects
+
+ delegate: Item {
+ id: delegate
+
+ objectName: "delegate"
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: name
+ property variant test4: model.name
+
+ function setTest3(arg) { name = arg }
+ function setTest4(arg) { model.name = arg }
+
+ width: 100
+ height: 2
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml b/tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml
new file mode 100644
index 0000000000..71dc7d72d7
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/onChanged.qml
@@ -0,0 +1,87 @@
+import QtQuick 2.0
+
+VisualDataModel {
+ id: vm
+
+ property var inserted
+ property var removed
+
+ Component.onCompleted: {
+ vm.inserted = []
+ vm.removed = []
+ vi.inserted = []
+ vi.removed = []
+ si.inserted = []
+ si.removed = []
+ }
+
+ function verify(changes, indexes, counts, moveIds) {
+ if (changes.length != indexes.length
+ || changes.length != counts.length
+ || changes.length != moveIds.length) {
+ console.log("invalid length", changes.length, indexes.length, counts.length, moveIds.length)
+ return false
+ }
+
+ var valid = true;
+ for (var i = 0; i < changes.length; ++i) {
+ if (changes[i].index != indexes[i]) {
+ console.log(i, "incorrect index. actual:", changes[i].index, "expected:", indexes[i])
+ valid = false;
+ }
+ if (changes[i].count != counts[i]) {
+ console.log(i, "incorrect count. actual:", changes[i].count, "expected:", counts[i])
+ valid = false;
+ }
+ if (changes[i].moveId != moveIds[i]) {
+ console.log(i, "incorrect moveId. actual:", changes[i].moveId, "expected:", moveIds[i])
+ valid = false;
+ }
+ }
+ return valid
+ }
+
+ groups: [
+ VisualDataGroup {
+ id: vi;
+
+ property var inserted
+ property var removed
+
+ name: "visible"
+ includeByDefault: true
+
+ onChanged: {
+ vi.inserted = inserted
+ vi.removed = removed
+ }
+ },
+ VisualDataGroup {
+ id: si;
+
+ property var inserted
+ property var removed
+
+ name: "selected"
+ onChanged: {
+ si.inserted = inserted
+ si.removed = removed
+ }
+ }
+ ]
+
+ model: ListModel {
+ id: listModel
+ ListElement { number: "one" }
+ ListElement { number: "two" }
+ ListElement { number: "three" }
+ ListElement { number: "four" }
+ }
+
+ delegate: Item {}
+
+ items.onChanged: {
+ vm.inserted = inserted
+ vm.removed = removed
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/packageView.qml b/tests/auto/quick/qquickvisualdatamodel/data/packageView.qml
new file mode 100644
index 0000000000..e3719a8be0
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/packageView.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+
+Item {
+ width: 240
+ height: 320
+
+ Component {
+ id: myDelegate
+
+ Package {
+ Rectangle {
+ id: leftWrapper
+ objectName: "wrapper"
+ Package.name: "left"
+ height: 20
+ width: 120
+ Text {
+ text: index
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ Rectangle {
+ id: rightWrapper
+ objectName: "wrapper"
+ Package.name: "right"
+ height: 20
+ width: 120
+ Text {
+ text: index
+ }
+ color: ListView.isCurrentItem ? "lightsteelblue" : "white"
+ }
+ }
+
+ }
+
+ VisualDataModel {
+ id: visualModel
+
+ delegate: myDelegate
+ model: testModel
+ }
+
+ ListView {
+ id: leftList
+ objectName: "leftList"
+ cacheBuffer: 0
+ anchors {
+ left: parent.left; top: parent.top;
+ right: parent.horizontalCenter; bottom: parent.bottom
+ }
+ model: visualModel.parts.left
+ }
+
+ ListView {
+ id: rightList
+ objectName: "rightList"
+ cacheBuffer: 0
+ anchors {
+ left: parent.horizontalCenter; top: parent.top;
+ right: parent.right; bottom: parent.bottom
+ }
+ model: visualModel.parts.right
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/singlerole1.qml b/tests/auto/quick/qquickvisualdatamodel/data/singlerole1.qml
new file mode 100644
index 0000000000..c471893e1d
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/singlerole1.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: myModel
+ delegate: Component {
+ Text { objectName: "name"; text: name; function getText() { return name; } }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/singlerole2.qml b/tests/auto/quick/qquickvisualdatamodel/data/singlerole2.qml
new file mode 100644
index 0000000000..ab1798999d
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/singlerole2.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+
+ListView {
+ width: 100
+ height: 100
+ model: myModel
+ delegate: Component {
+ Text { objectName: "name"; text: modelData; function getText() { return modelData } }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml
new file mode 100644
index 0000000000..1af1b3858d
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties-package.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: visualModel.parts.package
+
+ VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: SingleRoleModel {
+ values: [ "one", "two", "three", "four" ]
+ }
+
+ delegate: Package {
+ id: delegate
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: name
+ property variant test4: model.name
+ property variant test5: modelData
+ property variant test6: model.modelData
+
+
+ function setTest3(arg) { name = arg }
+ function setTest4(arg) { model.name = arg }
+ function setTest5(arg) { modelData = arg }
+ function setTest6(arg) { model.modelData = arg }
+
+ Item {
+ objectName: "delegate"
+ width: 100
+ height: 2
+ Package.name: "package"
+ }
+ }
+
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml
new file mode 100644
index 0000000000..50a5ded6ff
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/singleroleproperties.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: SingleRoleModel {
+ values: [ "one", "two", "three", "four" ]
+ }
+
+ delegate: Item {
+ id: delegate
+
+ objectName: "delegate"
+ width: 100
+ height: 2
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: name
+ property variant test4: model.name
+ property variant test5: modelData
+ property variant test6: model.modelData
+
+
+ function setTest3(arg) { name = arg }
+ function setTest4(arg) { model.name = arg }
+ function setTest5(arg) { modelData = arg }
+ function setTest6(arg) { model.modelData = arg }
+ }
+
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml
new file mode 100644
index 0000000000..d1a4604b77
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties-package.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: visualModel.parts.package
+ VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: [
+ "one",
+ "two",
+ "three",
+ "four"
+ ]
+
+ delegate: Package {
+ id: delegate
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: modelData
+ property variant test4: model.modelData
+
+ function setTest3(arg) { modelData = arg }
+ function setTest4(arg) { model.modelData = arg }
+
+ Item {
+ objectName: "delegate"
+
+ width: 100
+ height: 2
+
+ Package.name: "package"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml
new file mode 100644
index 0000000000..a075ccb4d9
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/stringlistproperties.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+import tst_qquickvisualdatamodel 1.0
+
+ListView {
+ width: 100
+ height: 100
+ model: VisualDataModel {
+ id: visualModel
+ objectName: "visualModel"
+
+ groups: [
+ VisualDataGroup { id: visibleItems; objectName: "visibleItems"; name: "visible"; includeByDefault: true },
+ VisualDataGroup { id: selectedItems; objectName: "selectedItems"; name: "selected" }
+ ]
+
+ model: [
+ "one",
+ "two",
+ "three",
+ "four"
+ ]
+
+ delegate: Item {
+ id: delegate
+
+ objectName: "delegate"
+
+ property variant test1: index
+ property variant test2: model.index
+ property variant test3: modelData
+ property variant test4: model.modelData
+
+ function setTest3(arg) { modelData = arg }
+ function setTest4(arg) { model.modelData = arg }
+
+ width: 100
+ height: 2
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml b/tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml
new file mode 100644
index 0000000000..e3ae1d1772
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/data/visualdatamodel.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+VisualDataModel {
+ function setRoot() {
+ rootIndex = modelIndex(0);
+ }
+ function setRootToParent() {
+ rootIndex = parentModelIndex();
+ }
+ model: myModel
+ delegate: Item { property bool modelChildren: hasModelChildren }
+}
diff --git a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro
new file mode 100644
index 0000000000..60ae065910
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro
@@ -0,0 +1,16 @@
+CONFIG += testcase
+TARGET = tst_qquickvisualdatamodel
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickvisualdatamodel.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+qtHaveModule(widgets): QT += widgets
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
new file mode 100644
index 0000000000..d16bf81d88
--- /dev/null
+++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
@@ -0,0 +1,4241 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/util.h"
+#include "../shared/visualtestutil.h"
+#include "../shared/viewtestutil.h"
+
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtQml/qqmlincubator.h>
+#include <QtQuick/qquickview.h>
+#include <private/qquicklistview_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <private/qqmlvaluetype_p.h>
+#include <private/qqmlchangeset_p.h>
+#include <private/qqmlengine_p.h>
+#include <math.h>
+#include <QtGui/qstandarditemmodel.h>
+
+using namespace QQuickVisualTestUtil;
+using namespace QQuickViewTestUtil;
+
+template <typename T, int N> int lengthOf(const T (&)[N]) { return N; }
+
+static void initStandardTreeModel(QStandardItemModel *model)
+{
+ QStandardItem *item;
+ item = new QStandardItem(QLatin1String("Row 1 Item"));
+ model->insertRow(0, item);
+
+ item = new QStandardItem(QLatin1String("Row 2 Item"));
+ item->setCheckable(true);
+ model->insertRow(1, item);
+
+ QStandardItem *childItem = new QStandardItem(QLatin1String("Row 2 Child Item"));
+ item->setChild(0, childItem);
+
+ item = new QStandardItem(QLatin1String("Row 3 Item"));
+ item->setIcon(QIcon());
+ model->insertRow(2, item);
+}
+
+class SingleRoleModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList values READ getList WRITE setList)
+public:
+ struct Branch;
+ struct Node {
+ Node(const QString &display = QString()) : branch(0), display(display) {}
+ Branch *branch;
+ QString display;
+ };
+
+ struct Branch {
+ Branch(Branch *parent = 0) : parent(parent) {}
+ ~Branch() { foreach (const Node &child, children) delete child.branch; }
+ int indexOf(Branch *branch) const {
+ for (int i = 0; i < children.count(); ++i) {
+ if (children.at(i).branch == branch)
+ return i;
+ }
+ return -1;
+ }
+ Branch *parent;
+ QVector<Node> children;
+
+ };
+
+ SingleRoleModel(const QStringList &list = QStringList(), const QByteArray &role = "name", QObject *parent = 0)
+ : QAbstractItemModel(parent) {
+ QHash<int, QByteArray> roles;
+ roles.insert(Qt::DisplayRole , role);
+ setRoleNames(roles);
+ foreach (const QString &string, list)
+ trunk.children.append(Node(string));
+ }
+ ~SingleRoleModel() {}
+
+ Branch *branchForIndex(const QModelIndex &index) const {
+ return index.isValid()
+ ? static_cast<Branch *>(index.internalPointer())->children.at(index.row()).branch
+ : const_cast<Branch *>(&trunk);
+ }
+
+ Branch *createBranchForIndex(const QModelIndex &index) const {
+ if (index.isValid()) {
+ Branch * const parentBranch = static_cast<Branch *>(index.internalPointer());
+ Node &node = parentBranch->children[index.row()];
+ if (!node.branch)
+ node.branch = new Branch(parentBranch);
+ return node.branch;
+ } else {
+ return const_cast<Branch *>(&trunk);
+ }
+ }
+
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const {
+ if (row < 0 || column != 0)
+ return QModelIndex();
+ Branch * const branch = branchForIndex(parent);
+ return branch && row < branch->children.count()
+ ? createIndex(row, column, branch)
+ : QModelIndex();
+ }
+
+ QModelIndex parent(const QModelIndex &child) const {
+ Branch * const branch = static_cast<Branch *>(child.internalPointer());
+ return branch->parent
+ ? createIndex(branch->parent->indexOf(branch), 0, branch->parent)
+ : QModelIndex();
+ }
+
+ int rowCount(const QModelIndex &parent) const {
+ Branch * const branch = branchForIndex(parent);
+ return branch ? branch->children.count() : 0;
+ }
+
+ int columnCount(const QModelIndex &parent) const {
+ Branch * const branch = branchForIndex(parent);
+ return branch ? 1 : 0;
+ }
+
+ QVariant data(const QModelIndex &index, int role) const {
+ return index.isValid() && role == Qt::DisplayRole
+ ? static_cast<Branch *>(index.internalPointer())->children.at(index.row()).display
+ : QVariant();
+ }
+
+ void insert(const QModelIndex &parent, int index, const QStringList &data) {
+ beginInsertRows(parent, index, index + data.count() - 1);
+ Branch * const branch = createBranchForIndex(parent);
+ for (int i = 0; i < data.count(); ++i)
+ branch->children.insert(index + i, Node(data.at(i)));
+ endInsertRows();
+ }
+
+ void remove(const QModelIndex &parent, int index, int count) {
+ beginRemoveRows(parent, index, index + count - 1);
+ Branch * const branch = branchForIndex(parent);
+ for (int i = 0; i < count; ++i) {
+ delete branch->children.at(index).branch;
+ branch->children.remove(index);
+ }
+ endRemoveRows();
+ }
+
+ void move(const QModelIndex &fromParent, int from, const QModelIndex &toParent, int to, int count) {
+ beginMoveRows(fromParent, from, from + count - 1, toParent, to);
+ Branch * const fromBranch = branchForIndex(fromParent);
+ Branch * const toBranch = createBranchForIndex(toParent);
+
+ if (fromBranch == toBranch) {
+ qquickmodelviewstestutil_move(from, to, count, &fromBranch->children);
+ } else {
+ for (int i = 0; i < count; ++i) {
+ Node node = fromBranch->children.at(from);
+ fromBranch->children.remove(from);
+ if (node.branch)
+ node.branch->parent = toBranch;
+ toBranch->children.insert(to + i, node);
+
+ }
+ }
+ endMoveRows();
+ }
+
+ void emitMove(int sourceFirst, int sourceLast, int destinationChild) {
+ emit beginMoveRows(QModelIndex(), sourceFirst, sourceLast, QModelIndex(), destinationChild);
+ emit endMoveRows();
+ }
+
+ QStringList getList() const {
+ QStringList list;
+ foreach (const Node &node, trunk.children)
+ list.append(node.display);
+ return list;
+ }
+
+ void setList(const QStringList &l) {
+ if (trunk.children.count() > 0) {
+ beginRemoveRows(QModelIndex(), 0, trunk.children.count() - 1);
+ foreach (const Node &child, trunk.children) delete child.branch;
+ trunk.children.clear();
+ endRemoveRows();
+ }
+ if (l.count() > 0) {
+ beginInsertRows(QModelIndex(), 0, l.count() -1);
+ foreach (const QString &string, l)
+ trunk.children.append(Node(string));
+ endInsertRows();
+ }
+ }
+
+ QString at(int index) const { return trunk.children.at(index).display; }
+
+public slots:
+ void set(int idx, QString string) {
+ trunk.children[idx].display = string;
+ emit dataChanged(createIndex(idx, 0, &trunk), createIndex(idx, 0, &trunk));
+ }
+
+private:
+ Branch trunk;
+};
+
+class StandardItem : public QObject, public QStandardItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ readText WRITE setText)
+
+public:
+ QString readText() const { return text(); }
+ void writeText(const QString &text) { setText(text); }
+};
+
+class StandardItemModel : public QStandardItemModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<StandardItem> items READ items CONSTANT)
+ Q_CLASSINFO("DefaultProperty", "items")
+public:
+ QQmlListProperty<StandardItem> items() { return QQmlListProperty<StandardItem>(this, 0, append, 0, 0, 0); }
+
+ static void append(QQmlListProperty<StandardItem> *property, StandardItem *item)
+ {
+ static_cast<QStandardItemModel *>(property->object)->appendRow(item);
+ }
+};
+
+class DataSubObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString subName READ subName WRITE setSubName NOTIFY subNameChanged)
+
+public:
+ DataSubObject(QObject *parent=0) : QObject(parent) {}
+
+ QString subName() const { return m_subName; }
+ void setSubName(const QString &name) {
+ if (name != m_subName) {
+ m_subName = name;
+ emit subNameChanged();
+ }
+ }
+
+signals:
+ void subNameChanged();
+
+private:
+ QString m_subName;
+};
+
+class DataObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QObject *object READ object)
+
+public:
+ DataObject(QObject *parent=0) : QObject(parent) {}
+ DataObject(const QString &name, const QString &color, QObject *parent=0)
+ : QObject(parent), m_name(name), m_color(color), m_object(new DataSubObject(this)) { }
+
+
+ QString name() const { return m_name; }
+ void setName(const QString &name) {
+ if (name != m_name) {
+ m_name = name;
+ emit nameChanged();
+ }
+ }
+
+ QString color() const { return m_color; }
+ void setColor(const QString &color) {
+ if (color != m_color) {
+ m_color = color;
+ emit colorChanged();
+ }
+ }
+
+ QObject *object() const { return m_object; }
+ void setSubName(const QString &sn) {
+ m_object->setSubName(sn);
+ }
+
+signals:
+ void nameChanged();
+ void colorChanged();
+
+private:
+ QString m_name;
+ QString m_color;
+ DataSubObject *m_object;
+};
+
+class ItemRequester : public QObject
+{
+ Q_OBJECT
+public:
+ ItemRequester(QObject *parent = 0)
+ : QObject(parent)
+ , itemInitialized(0)
+ , itemCreated(0)
+ , itemDestroyed(0)
+ , indexInitialized(-1)
+ , indexCreated(-1)
+ {
+ }
+
+ QQuickItem *itemInitialized;
+ QQuickItem *itemCreated;
+ QQuickItem *itemDestroyed;
+ int indexInitialized;
+ int indexCreated;
+
+public Q_SLOTS:
+ void initItem(int index, QObject *item)
+ {
+ itemInitialized = qobject_cast<QQuickItem*>(item);
+ indexInitialized = index;
+ }
+
+ void createdItem(int index, QObject *item)
+ {
+ itemCreated = qobject_cast<QQuickItem*>(item);
+ indexCreated = index;
+ }
+
+ void destroyingItem(QObject *item)
+ {
+ itemDestroyed = qobject_cast<QQuickItem*>(item);
+ }
+};
+
+QML_DECLARE_TYPE(SingleRoleModel)
+QML_DECLARE_TYPE(DataObject)
+QML_DECLARE_TYPE(StandardItem)
+QML_DECLARE_TYPE(StandardItemModel)
+
+class tst_qquickvisualdatamodel : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickvisualdatamodel();
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void rootIndex();
+ void updateLayout_data();
+ void updateLayout();
+ void childChanged_data();
+ void childChanged();
+ void noDelegate_data();
+ void noDelegate();
+ void itemsDestroyed_data();
+ void itemsDestroyed();
+ void objectListModel();
+ void singleRole();
+ void modelProperties();
+ void packagesDestroyed();
+ void qaimRowsMoved();
+ void qaimRowsMoved_data();
+ void subtreeRowsMoved();
+ void watchedRoles();
+ void hasModelChildren();
+ void setValue();
+ void remove_data();
+ void remove();
+ void move_data();
+ void move();
+ void groups_data();
+ void groups();
+ void invalidGroups();
+ void get();
+ void onChanged_data();
+ void onChanged();
+ void create();
+ void incompleteModel();
+ void insert_data();
+ void insert();
+ void resolve_data();
+ void resolve();
+ void warnings_data();
+ void warnings();
+ void invalidAttachment();
+ void asynchronousInsert_data();
+ void asynchronousInsert();
+ void asynchronousRemove_data();
+ void asynchronousRemove();
+ void asynchronousMove();
+ void asynchronousMove_data();
+ void asynchronousCancel();
+ void invalidContext();
+
+private:
+ template <int N> void groups_verify(
+ const SingleRoleModel &model,
+ QQuickItem *contentItem,
+ const int (&mIndex)[N],
+ const int (&iIndex)[N],
+ const int (&vIndex)[N],
+ const int (&sIndex)[N],
+ const bool (&vMember)[N],
+ const bool (&sMember)[N]);
+
+ template <int N> void get_verify(
+ const SingleRoleModel &model,
+ QQmlDelegateModel *visualModel,
+ QQmlDelegateModelGroup *visibleItems,
+ QQmlDelegateModelGroup *selectedItems,
+ const int (&mIndex)[N],
+ const int (&iIndex)[N],
+ const int (&vIndex)[N],
+ const int (&sIndex)[N],
+ const bool (&vMember)[N],
+ const bool (&sMember)[N]);
+
+ bool failed;
+ QQmlIncubationController controller;
+ QQmlEngine engine;
+};
+
+Q_DECLARE_METATYPE(QQmlChangeSet)
+
+template <typename T> static T evaluate(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ T result = expr.evaluate().value<T>();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+ return result;
+}
+
+template <> void evaluate<void>(QObject *scope, const QString &expression)
+{
+ QQmlExpression expr(qmlContext(scope), scope, expression);
+ expr.evaluate();
+ if (expr.hasError())
+ qWarning() << expr.error().toString();
+}
+
+void tst_qquickvisualdatamodel::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qRegisterMetaType<QQmlChangeSet>();
+
+ qmlRegisterType<SingleRoleModel>("tst_qquickvisualdatamodel", 1, 0, "SingleRoleModel");
+ qmlRegisterType<DataObject>("tst_qquickvisualdatamodel", 1, 0, "DataObject");
+ qmlRegisterType<StandardItem>("tst_qquickvisualdatamodel", 1, 0, "StandardItem");
+ qmlRegisterType<StandardItemModel>("tst_qquickvisualdatamodel", 1, 0, "StandardItemModel");
+
+ engine.setIncubationController(&controller);
+}
+
+void tst_qquickvisualdatamodel::cleanupTestCase()
+{
+}
+
+tst_qquickvisualdatamodel::tst_qquickvisualdatamodel()
+{
+}
+
+void tst_qquickvisualdatamodel::rootIndex()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create());
+ QVERIFY(obj != 0);
+
+ QMetaObject::invokeMethod(obj, "setRoot");
+ QVERIFY(qvariant_cast<QModelIndex>(obj->rootIndex()) == model.index(0,0));
+
+ QMetaObject::invokeMethod(obj, "setRootToParent");
+ QVERIFY(qvariant_cast<QModelIndex>(obj->rootIndex()) == QModelIndex());
+
+ QMetaObject::invokeMethod(obj, "setRoot");
+ QVERIFY(qvariant_cast<QModelIndex>(obj->rootIndex()) == model.index(0,0));
+ model.clear(); // will emit modelReset()
+ QVERIFY(qvariant_cast<QModelIndex>(obj->rootIndex()) == QModelIndex());
+
+ delete obj;
+}
+
+void tst_qquickvisualdatamodel::updateLayout_data()
+{
+ QTest::addColumn<QUrl>("source");
+
+ QTest::newRow("item delegate") << testFileUrl("datalist.qml");
+ QTest::newRow("package delegate") << testFileUrl("datalist-package.qml");
+}
+
+void tst_qquickvisualdatamodel::updateLayout()
+{
+ QFETCH(QUrl, source);
+
+ QQuickView view;
+
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+
+ view.rootContext()->setContextProperty("myModel", &model);
+
+ view.setSource(source);
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "display", 0);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 1 Item"));
+ name = findItem<QQuickText>(contentItem, "display", 1);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 2 Item"));
+ name = findItem<QQuickText>(contentItem, "display", 2);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 3 Item"));
+
+ model.invisibleRootItem()->sortChildren(0, Qt::DescendingOrder);
+
+ name = findItem<QQuickText>(contentItem, "display", 0);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 3 Item"));
+ name = findItem<QQuickText>(contentItem, "display", 1);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 2 Item"));
+ name = findItem<QQuickText>(contentItem, "display", 2);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 1 Item"));
+}
+
+void tst_qquickvisualdatamodel::childChanged_data()
+{
+ QTest::addColumn<QUrl>("source");
+
+ QTest::newRow("item delegate") << testFileUrl("datalist.qml");
+ QTest::newRow("package delegate") << testFileUrl("datalist-package.qml");
+}
+
+void tst_qquickvisualdatamodel::childChanged()
+{
+ QFETCH(QUrl, source);
+
+ QQuickView view;
+
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+
+ view.rootContext()->setContextProperty("myModel", &model);
+
+ view.setSource(source);
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel");
+ vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0))));
+ QCOMPARE(listview->count(), 1);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "display", 0);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 2 Child Item"));
+
+ model.item(1,0)->child(0,0)->setText("Row 2 updated child");
+
+ name = findItem<QQuickText>(contentItem, "display", 0);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 2 updated child"));
+
+ model.item(1,0)->appendRow(new QStandardItem(QLatin1String("Row 2 Child Item 2")));
+ QCOMPARE(listview->count(), 2);
+
+ name = findItem<QQuickText>(contentItem, "display", 1);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), QString("Row 2 Child Item 2"));
+
+ model.item(1,0)->takeRow(1);
+ name = findItem<QQuickText>(contentItem, "display", 1);
+ QVERIFY(name == 0);
+
+ vdm->setRootIndex(QVariant::fromValue(QModelIndex()));
+ QCOMPARE(listview->count(), 3);
+ name = findItem<QQuickText>(contentItem, "display", 0);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 1 Item"));
+ name = findItem<QQuickText>(contentItem, "display", 1);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 2 Item"));
+ name = findItem<QQuickText>(contentItem, "display", 2);
+ QVERIFY(name);
+ QCOMPARE(name->text(), QString("Row 3 Item"));
+}
+
+void tst_qquickvisualdatamodel::objectListModel()
+{
+ QQuickView view;
+
+ QList<QObject*> dataList;
+ dataList.append(new DataObject("Item 1", "red"));
+ dataList.append(new DataObject("Item 2", "green"));
+ dataList.append(new DataObject("Item 3", "blue"));
+ dataList.append(new DataObject("Item 4", "yellow"));
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+
+ view.setSource(testFileUrl("objectlist.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "name", 0);
+ QCOMPARE(name->text(), QString("Item 1"));
+ QCOMPARE(name->property("modelName").toString(), QString("Item 1"));
+
+ QQuickText *section = findItem<QQuickText>(contentItem, "section", 0);
+ QCOMPARE(section->text(), QString("Item 1"));
+
+ dataList[0]->setProperty("name", QLatin1String("Changed"));
+ QCOMPARE(name->text(), QString("Changed"));
+ QCOMPARE(name->property("modelName").toString(), QString("Changed"));
+
+ // Test resolving nested section property
+ DataObject *obj = static_cast<DataObject*>(dataList[0]);
+ obj->setSubName("SubItem 1");
+
+ QMetaObject::invokeMethod(listview, "changeSectionProperty");
+ section = findItem<QQuickText>(contentItem, "section", 0);
+ QCOMPARE(section->text(), QString("SubItem 1"));
+}
+
+void tst_qquickvisualdatamodel::singleRole()
+{
+ QStringList list = QStringList() << "one" << "two" << "three" << "four";
+ {
+ QQuickView view;
+
+ SingleRoleModel model(list);
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("singlerole1.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "name", 1);
+ QCOMPARE(name->text(), QString("two"));
+
+ model.set(1, "Changed");
+ QCOMPARE(name->text(), QString("Changed"));
+ }
+ {
+ QQuickView view;
+
+ SingleRoleModel model(list);
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("singlerole2.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "name", 1);
+ QCOMPARE(name->text(), QString("two"));
+
+ model.set(1, "Changed");
+ QCOMPARE(name->text(), QString("Changed"));
+ }
+ {
+ QQuickView view;
+
+ SingleRoleModel model(list, "modelData");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("singlerole2.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickText *name = findItem<QQuickText>(contentItem, "name", 1);
+ QCOMPARE(name->text(), QString("two"));
+
+ model.set(1, "Changed");
+ QCOMPARE(name->text(), QString("Changed"));
+ }
+}
+
+void tst_qquickvisualdatamodel::modelProperties()
+{
+ {
+ QQuickView view;
+
+ SingleRoleModel model(QStringList() << "one" << "two" << "three" << "four");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("modelproperties.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(),QString("two"));
+ QCOMPARE(delegate->property("test2").toString(),QString("two"));
+ QCOMPARE(delegate->property("test3").toString(),QString("two"));
+ QCOMPARE(delegate->property("test4").toString(),QString("two"));
+ QVERIFY(!delegate->property("test9").isValid());
+ QCOMPARE(delegate->property("test5").toString(),QString(""));
+ QVERIFY(delegate->property("test6").value<QObject*>() != 0);
+ QCOMPARE(delegate->property("test7").toInt(),1);
+ QCOMPARE(delegate->property("test8").toInt(),1);
+ }
+
+ {
+ QQuickView view;
+
+ QList<QObject*> dataList;
+ dataList.append(new DataObject("Item 1", "red"));
+ dataList.append(new DataObject("Item 2", "green"));
+ dataList.append(new DataObject("Item 3", "blue"));
+ dataList.append(new DataObject("Item 4", "yellow"));
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+
+ view.setSource(testFileUrl("modelproperties.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(),QString("Item 2"));
+ QCOMPARE(delegate->property("test2").toString(),QString("Item 2"));
+ QVERIFY(qobject_cast<DataObject*>(delegate->property("test3").value<QObject*>()) != 0);
+ QVERIFY(qobject_cast<DataObject*>(delegate->property("test4").value<QObject*>()) != 0);
+ QCOMPARE(delegate->property("test5").toString(),QString("Item 2"));
+ QCOMPARE(delegate->property("test9").toString(),QString("Item 2"));
+ QVERIFY(delegate->property("test6").value<QObject*>() != 0);
+ QCOMPARE(delegate->property("test7").toInt(),1);
+ QCOMPARE(delegate->property("test8").toInt(),1);
+ }
+
+ {
+ QQuickView view;
+
+ DataObject object("Item 1", "red");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &object);
+
+ view.setSource(testFileUrl("modelproperties.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 0);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(),QString("Item 1"));
+ QCOMPARE(delegate->property("test2").toString(),QString("Item 1"));
+ QVERIFY(qobject_cast<DataObject*>(delegate->property("test3").value<QObject*>()) != 0);
+ QVERIFY(qobject_cast<DataObject*>(delegate->property("test4").value<QObject*>()) != 0);
+ QCOMPARE(delegate->property("test5").toString(),QString("Item 1"));
+ QCOMPARE(delegate->property("test9").toString(),QString("Item 1"));
+ QVERIFY(delegate->property("test6").value<QObject*>() != 0);
+ QCOMPARE(delegate->property("test7").toInt(), 0);
+ QCOMPARE(delegate->property("test8").toInt(), 0);
+ }
+
+ {
+ QQuickView view;
+
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+
+ view.rootContext()->setContextProperty("myModel", &model);
+
+ QUrl source(testFileUrl("modelproperties2.qml"));
+
+ //3 items, 3 i each
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: modelData is not defined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
+ QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":17: TypeError: Cannot read property 'display' of undefined");
+
+ view.setSource(source);
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(),QString("Row 2 Item"));
+ QCOMPARE(delegate->property("test2").toString(),QString("Row 2 Item"));
+ QVERIFY(!delegate->property("test3").isValid());
+ QVERIFY(!delegate->property("test4").isValid());
+ QVERIFY(!delegate->property("test5").isValid());
+ QVERIFY(!delegate->property("test9").isValid());
+ QVERIFY(delegate->property("test6").value<QObject*>() != 0);
+ QCOMPARE(delegate->property("test7").toInt(),1);
+ QCOMPARE(delegate->property("test8").toInt(),1);
+ }
+ //### should also test QStringList and QVariantList
+}
+
+void tst_qquickvisualdatamodel::noDelegate_data()
+{
+ QTest::addColumn<QUrl>("source");
+
+ QTest::newRow("item delegate") << testFileUrl("datalist.qml");
+ QTest::newRow("package delegate") << testFileUrl("datalist-package.qml");
+}
+
+void tst_qquickvisualdatamodel::noDelegate()
+{
+ QFETCH(QUrl, source);
+
+ QQuickView view;
+
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+
+ view.rootContext()->setContextProperty("myModel", &model);
+
+ view.setSource(source);
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel");
+ QVERIFY(vdm != 0);
+ QCOMPARE(vdm->count(), 3);
+
+ vdm->setDelegate(0);
+ QCOMPARE(vdm->count(), 0);
+}
+
+void tst_qquickvisualdatamodel::itemsDestroyed_data()
+{
+ QTest::addColumn<QUrl>("source");
+
+ QTest::newRow("listView") << testFileUrl("itemsDestroyed_listView.qml");
+ QTest::newRow("package") << testFileUrl("itemsDestroyed_package.qml");
+ QTest::newRow("pathView") << testFileUrl("itemsDestroyed_pathView.qml");
+ QTest::newRow("repeater") << testFileUrl("itemsDestroyed_repeater.qml");
+}
+
+void tst_qquickvisualdatamodel::itemsDestroyed()
+{
+ QFETCH(QUrl, source);
+
+ QQmlGuard<QQuickItem> delegate;
+
+ {
+ QQuickView view;
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+ view.rootContext()->setContextProperty("myModel", &model);
+ view.setSource(source);
+
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QVERIFY(delegate = findItem<QQuickItem>(view.contentItem(), "delegate", 1));
+ }
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QVERIFY(!delegate);
+}
+
+void tst_qquickvisualdatamodel::packagesDestroyed()
+{
+ QStringList list;
+ for (int i=0; i<30; i++)
+ list << (QLatin1String("item ") + i);
+ SingleRoleModel model(list);
+
+ QQuickView view;
+ view.rootContext()->setContextProperty("testModel", &model);
+
+ QString filename(testFile("packageView.qml"));
+ view.setSource(QUrl::fromLocalFile(filename));
+
+ qApp->processEvents();
+
+ QQuickListView *leftview = findItem<QQuickListView>(view.rootObject(), "leftList");
+ QTRY_VERIFY(leftview != 0);
+
+ QQuickListView *rightview = findItem<QQuickListView>(view.rootObject(), "rightList");
+ QTRY_VERIFY(rightview != 0);
+
+ QQuickItem *leftContent = leftview->contentItem();
+ QTRY_VERIFY(leftContent != 0);
+
+ QQuickItem *rightContent = rightview->contentItem();
+ QTRY_VERIFY(rightContent != 0);
+
+ QCOMPARE(leftview->currentIndex(), 0);
+ QCOMPARE(rightview->currentIndex(), 0);
+
+ rightview->setCurrentIndex(20);
+ QTRY_COMPARE(rightview->contentY(), 100.0);
+
+ QQmlGuard<QQuickItem> left;
+ QQmlGuard<QQuickItem> right;
+
+ QVERIFY(findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QVERIFY(findItem<QQuickItem>(rightContent, "wrapper", 1));
+
+ QVERIFY(left = findItem<QQuickItem>(leftContent, "wrapper", 19));
+ QVERIFY(right = findItem<QQuickItem>(rightContent, "wrapper", 19));
+
+ rightview->setCurrentIndex(0);
+ QCOMPARE(rightview->currentIndex(), 0);
+
+ QTRY_COMPARE(rightview->contentY(), 0.0);
+ QCoreApplication::sendPostedEvents();
+
+ QVERIFY(!left);
+ QVERIFY(!right);
+
+ QVERIFY(left = findItem<QQuickItem>(leftContent, "wrapper", 1));
+ QVERIFY(right = findItem<QQuickItem>(rightContent, "wrapper", 1));
+
+ rightview->setCurrentIndex(20);
+ QTRY_COMPARE(rightview->contentY(), 100.0);
+
+ QVERIFY(left);
+ QVERIFY(right);
+
+ QVERIFY(findItem<QQuickItem>(leftContent, "wrapper", 19));
+ QVERIFY(findItem<QQuickItem>(rightContent, "wrapper", 19));
+
+ leftview->setCurrentIndex(20);
+ QTRY_COMPARE(leftview->contentY(), 100.0);
+
+ QVERIFY(!left);
+ QVERIFY(!right);
+}
+
+void tst_qquickvisualdatamodel::qaimRowsMoved()
+{
+ // Test parameters passed in QAIM::rowsMoved() signal are converted correctly
+ // when translated to (from, to count) semantics.
+ QFETCH(int, sourceFirst);
+ QFETCH(int, sourceLast);
+ QFETCH(int, destinationChild);
+ QFETCH(int, expectFrom);
+ QFETCH(int, expectTo);
+ QFETCH(int, expectCount);
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QStringList list;
+ for (int i=0; i<30; i++)
+ list << (QLatin1String("item ") + i);
+ SingleRoleModel model(list);
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create());
+ QVERIFY(obj != 0);
+
+ QSignalSpy spy(obj, SIGNAL(modelUpdated(QQmlChangeSet,bool)));
+ model.emitMove(sourceFirst, sourceLast, destinationChild);
+ QCOMPARE(spy.count(), 1);
+
+ QCOMPARE(spy[0].count(), 2);
+ QQmlChangeSet changeSet = spy[0][0].value<QQmlChangeSet>();
+ QCOMPARE(changeSet.removes().count(), 1);
+ QCOMPARE(changeSet.removes().at(0).index, expectFrom);
+ QCOMPARE(changeSet.removes().at(0).count, expectCount);
+ QCOMPARE(changeSet.inserts().count(), 1);
+ QCOMPARE(changeSet.inserts().at(0).index, expectTo);
+ QCOMPARE(changeSet.inserts().at(0).count, expectCount);
+ QCOMPARE(changeSet.removes().at(0).moveId, changeSet.inserts().at(0).moveId);
+ QCOMPARE(spy[0][1].toBool(), false);
+
+ delete obj;
+}
+
+void tst_qquickvisualdatamodel::qaimRowsMoved_data()
+{
+ QTest::addColumn<int>("sourceFirst");
+ QTest::addColumn<int>("sourceLast");
+ QTest::addColumn<int>("destinationChild");
+ QTest::addColumn<int>("expectFrom");
+ QTest::addColumn<int>("expectTo");
+ QTest::addColumn<int>("expectCount");
+
+ QTest::newRow("move 1 forward")
+ << 1 << 1 << 6
+ << 1 << 5 << 1;
+
+ QTest::newRow("move 1 backwards")
+ << 4 << 4 << 1
+ << 4 << 1 << 1;
+
+ QTest::newRow("move multiple forwards")
+ << 0 << 2 << 13
+ << 0 << 10 << 3;
+
+ QTest::newRow("move multiple forwards, with same to")
+ << 0 << 1 << 3
+ << 0 << 1 << 2;
+
+ QTest::newRow("move multiple backwards")
+ << 10 << 14 << 1
+ << 10 << 1 << 5;
+}
+
+void tst_qquickvisualdatamodel::subtreeRowsMoved()
+{
+ SingleRoleModel model(QStringList() << "one" << "two" << "three" << "four");
+ model.insert(model.index(0, 0), 0, QStringList() << "a" << "b" << "c" << "d" << "e");
+ model.insert(model.index(2, 0), 0, QStringList() << "A" << "B" << "C");
+
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
+ QVERIFY(vdm);
+
+ QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQmlChangeSet,bool)));
+ QQmlChangeSet changeSet;
+
+ QCOMPARE(vdm->count(), 4);
+
+ // Move items from the current root index to a sub tree.
+ model.move(QModelIndex(), 1, model.index(0, 0), 3, 2);
+ QCOMPARE(vdm->count(), 2);
+ QCOMPARE(spy.count(), 1);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.removes().count(), 1);
+ QCOMPARE(changeSet.removes().at(0).index, 1);
+ QCOMPARE(changeSet.removes().at(0).count, 2);
+ QCOMPARE(changeSet.inserts().count(), 0);
+
+ // Move items from a sub tree to the current root index.
+ model.move(model.index(0, 0), 4, QModelIndex(), 2, 1);
+ QCOMPARE(vdm->count(), 3);
+ QCOMPARE(spy.count(), 2);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.removes().count(), 0);
+ QCOMPARE(changeSet.inserts().count(), 1);
+ QCOMPARE(changeSet.inserts().at(0).index, 2);
+ QCOMPARE(changeSet.inserts().at(0).count, 1);
+
+ vdm->setRootIndex(QVariant::fromValue(model.index(2, 0)));
+ QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(2, 0));
+ QCOMPARE(vdm->count(), 3);
+ QCOMPARE(spy.count(), 4);
+ changeSet = spy.at(2).at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.removes().count(), 1);
+ QCOMPARE(changeSet.removes().at(0).index, 0);
+ QCOMPARE(changeSet.removes().at(0).count, 3);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.inserts().count(), 1);
+ QCOMPARE(changeSet.inserts().at(0).index, 0);
+ QCOMPARE(changeSet.inserts().at(0).count, 3);
+
+ // Move the current root index without changing its parent.
+ model.move(QModelIndex(), 2, QModelIndex(), 0, 1);
+ QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(0, 0));
+ QCOMPARE(vdm->count(), 3);
+ QCOMPARE(spy.count(), 4);
+
+ // Move the current root index, changing its parent.
+ model.move(QModelIndex(), 0, model.index(1, 0), 0, 1);
+ QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(0, 0, model.index(0, 0)));
+ QCOMPARE(vdm->count(), 3);
+ QCOMPARE(spy.count(), 4);
+
+ model.insert(model.index(0, 0), 0, QStringList() << "new1" << "new2");
+ QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(2, 0, model.index(0, 0)));
+ QCOMPARE(vdm->count(), 3);
+ QCOMPARE(spy.count(), 4);
+
+ model.remove(model.index(0, 0), 1, 1);
+ QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(1, 0, model.index(0, 0)));
+ QCOMPARE(vdm->count(), 3);
+ QCOMPARE(spy.count(), 4);
+
+ model.remove(model.index(0, 0), 1, 1);
+ QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex());
+ QCOMPARE(vdm->count(), 0);
+ QCOMPARE(spy.count(), 5);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.removes().count(), 1);
+ QCOMPARE(changeSet.removes().at(0).index, 0);
+ QCOMPARE(changeSet.removes().at(0).count, 3);
+ QCOMPARE(changeSet.inserts().count(), 0);
+
+ vdm->setRootIndex(QVariant::fromValue(QModelIndex()));
+ QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex());
+ QCOMPARE(vdm->count(), 2);
+ QCOMPARE(spy.count(), 6);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.removes().count(), 0);
+ QCOMPARE(changeSet.inserts().count(), 1);
+ QCOMPARE(changeSet.inserts().at(0).index, 0);
+ QCOMPARE(changeSet.inserts().at(0).count, 2);
+}
+
+void tst_qquickvisualdatamodel::watchedRoles()
+{
+ QaimModel model;
+ for (int i = 0; i < 30; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
+ QVERIFY(vdm);
+
+ // VisualDataModel doesn't initialize model data until the first item is requested.
+ QQuickItem *item = qobject_cast<QQuickItem*>(vdm->object(0));
+ QVERIFY(item);
+ vdm->release(item);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits.
+
+ QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQmlChangeSet,bool)));
+ QQmlChangeSet changeSet;
+
+ QCOMPARE(vdm->count(), 30);
+
+ emit model.dataChanged(model.index(0), model.index(4));
+ QCOMPARE(spy.count(), 0);
+
+ emit model.dataChanged(model.index(0), model.index(4), QVector<int>() << QaimModel::Name);
+ QCOMPARE(spy.count(), 0);
+
+ emit model.dataChanged(model.index(0), model.index(4), QVector<int>() << QaimModel::Number);
+ QCOMPARE(spy.count(), 0);
+
+ vdm->setWatchedRoles(QList<QByteArray>() << "name" << "dummy");
+
+ emit model.dataChanged(model.index(0), model.index(4));
+ QCOMPARE(spy.count(), 1);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.changes().at(0).index, 0);
+ QCOMPARE(changeSet.changes().at(0).count, 5);
+
+ emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name);
+ QCOMPARE(spy.count(), 2);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.changes().at(0).index, 1);
+ QCOMPARE(changeSet.changes().at(0).count, 6);
+
+ emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number);
+ QCOMPARE(spy.count(), 2);
+
+ vdm->setWatchedRoles(QList<QByteArray>() << "number" << "dummy");
+
+ emit model.dataChanged(model.index(0), model.index(4));
+ QCOMPARE(spy.count(), 3);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.changes().at(0).index, 0);
+ QCOMPARE(changeSet.changes().at(0).count, 5);
+
+ emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name);
+ QCOMPARE(spy.count(), 3);
+
+ emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number);
+ QCOMPARE(spy.count(), 4);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.changes().at(0).index, 8);
+ QCOMPARE(changeSet.changes().at(0).count, 1);
+
+ vdm->setWatchedRoles(QList<QByteArray>() << "number" << "name");
+
+ emit model.dataChanged(model.index(0), model.index(4));
+ QCOMPARE(spy.count(), 5);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.changes().at(0).index, 0);
+ QCOMPARE(changeSet.changes().at(0).count, 5);
+
+ emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name);
+ QCOMPARE(spy.count(), 6);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.changes().at(0).index, 1);
+ QCOMPARE(changeSet.changes().at(0).count, 6);
+
+ emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number);
+ QCOMPARE(spy.count(), 7);
+ changeSet = spy.last().at(0).value<QQmlChangeSet>();
+ QCOMPARE(changeSet.changes().at(0).index, 8);
+ QCOMPARE(changeSet.changes().at(0).count, 1);
+}
+
+void tst_qquickvisualdatamodel::hasModelChildren()
+{
+ SingleRoleModel model(QStringList() << "one" << "two" << "three" << "four");
+ model.insert(model.index(0, 0), 0, QStringList() << "a" << "b" << "c" << "d" << "e");
+ model.insert(model.index(2, 0), 0, QStringList() << "A" << "B" << "C");
+
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
+ QVERIFY(vdm);
+
+ QCOMPARE(vdm->count(), 4);
+
+ QQuickItem *item = 0;
+
+ item = qobject_cast<QQuickItem*>(vdm->object(0));
+ QVERIFY(item);
+ QCOMPARE(item->property("modelChildren").toBool(), true);
+ vdm->release(item);
+
+ item = qobject_cast<QQuickItem*>(vdm->object(1));
+ QVERIFY(item);
+ QCOMPARE(item->property("modelChildren").toBool(), false);
+ vdm->release(item);
+
+ item = qobject_cast<QQuickItem*>(vdm->object(2));
+ QVERIFY(item);
+ QCOMPARE(item->property("modelChildren").toBool(), true);
+ vdm->release(item);
+
+ item = qobject_cast<QQuickItem*>(vdm->object(3));
+ QVERIFY(item);
+ QCOMPARE(item->property("modelChildren").toBool(), false);
+ vdm->release(item);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits.
+
+ QCOMPARE(vdm->stringValue(0, QLatin1String("hasModelChildren")), QVariant(true).toString());
+ QCOMPARE(vdm->stringValue(1, QLatin1String("hasModelChildren")), QVariant(false).toString());
+ QCOMPARE(vdm->stringValue(2, QLatin1String("hasModelChildren")), QVariant(true).toString());
+ QCOMPARE(vdm->stringValue(3, QLatin1String("hasModelChildren")), QVariant(false).toString());
+
+ QCOMPARE(evaluate<bool>(vdm, "items.get(0).model.hasModelChildren"), true);
+ QCOMPARE(evaluate<bool>(vdm, "items.get(1).model.hasModelChildren"), false);
+ QCOMPARE(evaluate<bool>(vdm, "items.get(2).model.hasModelChildren"), true);
+ QCOMPARE(evaluate<bool>(vdm, "items.get(3).model.hasModelChildren"), false);
+}
+
+void tst_qquickvisualdatamodel::setValue()
+{
+ QStandardItemModel model;
+ initStandardTreeModel(&model);
+
+ QQmlEngine engine;
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlComponent component(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+ QQmlDelegateModel *vdm = qobject_cast<QQmlDelegateModel*>(object.data());
+ QVERIFY(vdm);
+
+ QCOMPARE(vdm->count(), 3);
+
+ QQuickItem *item = 0;
+
+ item = qobject_cast<QQuickItem*>(vdm->object(0));
+ QVERIFY(item);
+ QCOMPARE(evaluate<QString>(item, "display"), QString("Row 1 Item"));
+ evaluate<void>(item, "display = 'Changed Item 1'");
+ QCOMPARE(evaluate<QString>(item, "display"), QString("Changed Item 1"));
+ QCOMPARE(model.item(0)->text(), QString("Changed Item 1"));
+
+ vdm->release(item);
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits.
+}
+
+void tst_qquickvisualdatamodel::remove_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<QString>("package delegate");
+
+ QTest::newRow("item delegate")
+ << testFileUrl("groups.qml")
+ << QString();
+ QTest::newRow("package")
+ << testFileUrl("groups-package.qml")
+ << QString("package.");
+}
+
+void tst_qquickvisualdatamodel::remove()
+{
+ QQuickView view;
+
+ SingleRoleModel model(QStringList()
+ << "one"
+ << "two"
+ << "three"
+ << "four"
+ << "five"
+ << "six"
+ << "seven"
+ << "eight"
+ << "nine"
+ << "ten"
+ << "eleven"
+ << "twelve");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("groups.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
+ QVERIFY(visualModel);
+
+ {
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ static const int mIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ evaluate<void>(visualModel, "items.remove(2)");
+ QCOMPARE(listview->count(), 11);
+ QCOMPARE(visualModel->items()->count(), 11);
+ static const int mIndex[] = { 0, 1, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ evaluate<void>(visualModel, "items.remove(1, 4)");
+ QCOMPARE(listview->count(), 7);
+ QCOMPARE(visualModel->items()->count(), 7);
+ static const int mIndex[] = { 0, 6, 7, 8, 9,10,11 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: index out of range");
+ evaluate<void>(visualModel, "items.remove(-8, 4)");
+ QCOMPARE(listview->count(), 7);
+ QCOMPARE(visualModel->items()->count(), 7);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: index out of range");
+ evaluate<void>(visualModel, "items.remove(12, 2)");
+ QCOMPARE(listview->count(), 7);
+ QCOMPARE(visualModel->items()->count(), 7);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: invalid count");
+ evaluate<void>(visualModel, "items.remove(5, 3)");
+ QCOMPARE(listview->count(), 7);
+ QCOMPARE(visualModel->items()->count(), 7);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: remove: invalid count");
+ evaluate<void>(visualModel, "items.remove(5, -2)");
+ QCOMPARE(listview->count(), 7);
+ QCOMPARE(visualModel->items()->count(), 7);
+ }
+}
+
+void tst_qquickvisualdatamodel::move_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<QString>("package delegate");
+
+ QTest::newRow("item delegate")
+ << testFileUrl("groups.qml")
+ << QString();
+ QTest::newRow("package")
+ << testFileUrl("groups-package.qml")
+ << QString("package.");
+}
+
+void tst_qquickvisualdatamodel::move()
+{
+ QQuickView view;
+
+ SingleRoleModel model(QStringList()
+ << "one"
+ << "two"
+ << "three"
+ << "four"
+ << "five"
+ << "six"
+ << "seven"
+ << "eight"
+ << "nine"
+ << "ten"
+ << "eleven"
+ << "twelve");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("groups.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
+ QVERIFY(visualModel);
+
+ {
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ static const int mIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ evaluate<void>(visualModel, "items.move(2, 4)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ static const int mIndex[] = { 0, 1, 3, 4, 2, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ evaluate<void>(visualModel, "items.move(4, 2)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ static const int mIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ evaluate<void>(visualModel, "items.move(8, 0, 4)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ static const int mIndex[] = { 8, 9,10,11, 0, 1, 2, 3, 4, 5, 6, 7 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ evaluate<void>(visualModel, "items.move(3, 4, 5)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ static const int mIndex[] = { 8, 9,10,4, 11, 0, 1, 2, 3, 5, 6, 7 };
+ static const int iIndex[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+
+ for (int i = 0; i < lengthOf(mIndex); ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(delegate->property("test1").toString(), model.at(mIndex[i]));
+ QCOMPARE(delegate->property("test2").toInt(), mIndex[i]);
+ QCOMPARE(delegate->property("test3").toInt(), iIndex[i]);
+ }
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: invalid count");
+ evaluate<void>(visualModel, "items.move(5, 2, -2)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
+ evaluate<void>(visualModel, "items.move(-6, 2, 1)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
+ evaluate<void>(visualModel, "items.move(15, 2, 1)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: from index out of range");
+ evaluate<void>(visualModel, "items.move(11, 1, 3)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
+ evaluate<void>(visualModel, "items.move(2, -5, 1)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
+ evaluate<void>(visualModel, "items.move(2, 14, 1)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: move: to index out of range");
+ evaluate<void>(visualModel, "items.move(2, 11, 4)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ }
+}
+
+void tst_qquickvisualdatamodel::groups_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<QString>("part");
+
+ QTest::newRow("item delegate")
+ << testFileUrl("groups.qml")
+ << QString();
+ QTest::newRow("package")
+ << testFileUrl("groups-package.qml")
+ << QString("visualModel.parts.package.");
+}
+
+template <int N> void tst_qquickvisualdatamodel::groups_verify(
+ const SingleRoleModel &model,
+ QQuickItem *contentItem,
+ const int (&mIndex)[N],
+ const int (&iIndex)[N],
+ const int (&vIndex)[N],
+ const int (&sIndex)[N],
+ const bool (&vMember)[N],
+ const bool (&sMember)[N])
+{
+ failed = true;
+ for (int i = 0; i < N; ++i) {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", mIndex[i]);
+ QVERIFY(delegate);
+ QCOMPARE(evaluate<QString>(delegate, "test1"), model.at(mIndex[i]));
+ QCOMPARE(evaluate<int>(delegate, "test2") , mIndex[i]);
+ QCOMPARE(evaluate<int>(delegate, "test3") , iIndex[i]);
+ QCOMPARE(evaluate<bool>(delegate, "test4"), true);
+ QCOMPARE(evaluate<int>(delegate, "test5") , vIndex[i]);
+ QCOMPARE(evaluate<bool>(delegate, "test6"), vMember[i]);
+ QCOMPARE(evaluate<int>(delegate, "test7") , sIndex[i]);
+ QCOMPARE(evaluate<bool>(delegate, "test8"), sMember[i]);
+ QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("items") , bool(true));
+ QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("visible") , bool(vMember[i]));
+ QCOMPARE(evaluate<QStringList>(delegate, "test9").contains("selected"), bool(sMember[i]));
+ }
+ failed = false;
+}
+
+#define VERIFY_GROUPS \
+ groups_verify(model, contentItem, mIndex, iIndex, vIndex, sIndex, vMember, sMember); \
+ QVERIFY(!failed)
+
+
+void tst_qquickvisualdatamodel::groups()
+{
+ QFETCH(QUrl, source);
+ QFETCH(QString, part);
+
+ QQuickView view;
+
+ SingleRoleModel model(QStringList()
+ << "one"
+ << "two"
+ << "three"
+ << "four"
+ << "five"
+ << "six"
+ << "seven"
+ << "eight"
+ << "nine"
+ << "ten"
+ << "eleven"
+ << "twelve");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(source);
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQmlDelegateModel *visualModel = listview->findChild<QQmlDelegateModel *>("visualModel");
+ QVERIFY(visualModel);
+
+ QQmlDelegateModelGroup *visibleItems = listview->findChild<QQmlDelegateModelGroup *>("visibleItems");
+ QVERIFY(visibleItems);
+
+ QQmlDelegateModelGroup *selectedItems = listview->findChild<QQmlDelegateModelGroup *>("selectedItems");
+ QVERIFY(selectedItems);
+
+ const bool f = false;
+ const bool t = true;
+
+ {
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 12);
+ QCOMPARE(selectedItems->count(), 0);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const bool vMember[] = { t, t, t, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, f, f, f, f };
+ VERIFY_GROUPS;
+ } {
+ evaluate<void>(visualModel, "items.addGroups(8, \"selected\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 12);
+ QCOMPARE(selectedItems->count(), 1);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const bool vMember[] = { t, t, t, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, t, f, f, f };
+ VERIFY_GROUPS;
+ } {
+ evaluate<void>(visualModel, "items.addGroups(6, 4, [\"visible\", \"selected\"])");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 12);
+ QCOMPARE(selectedItems->count(), 4);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const bool vMember[] = { t, t, t, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4 };
+ static const bool sMember[] = { f, f, f, f, f, f, t, t, t, t, f, f };
+ VERIFY_GROUPS;
+ } {
+ evaluate<void>(visualModel, "items.setGroups(2, [\"items\", \"selected\"])");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 11);
+ QCOMPARE(selectedItems->count(), 5);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9,10 };
+ static const bool vMember[] = { t, t, f, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 1, 1, 1, 1, 2, 3, 4, 5, 5 };
+ static const bool sMember[] = { f, f, t, f, f, f, t, t, t, t, f, f };
+ VERIFY_GROUPS;
+ } {
+ evaluate<void>(selectedItems, "setGroups(0, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8 };
+ static const bool vMember[] = { t, t, f, t, t, t, f, f, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, t, t, f, f };
+ VERIFY_GROUPS;
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: invalid count");
+ evaluate<void>(visualModel, "items.addGroups(11, -4, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: index out of range");
+ evaluate<void>(visualModel, "items.addGroups(-1, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: index out of range");
+ evaluate<void>(visualModel, "items.addGroups(14, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: addGroups: invalid count");
+ evaluate<void>(visualModel, "items.addGroups(11, 5, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: invalid count");
+ evaluate<void>(visualModel, "items.setGroups(11, -4, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: index out of range");
+ evaluate<void>(visualModel, "items.setGroups(-1, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: index out of range");
+ evaluate<void>(visualModel, "items.setGroups(14, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: setGroups: invalid count");
+ evaluate<void>(visualModel, "items.setGroups(11, 5, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: invalid count");
+ evaluate<void>(visualModel, "items.removeGroups(11, -4, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: index out of range");
+ evaluate<void>(visualModel, "items.removeGroups(-1, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: index out of range");
+ evaluate<void>(visualModel, "items.removeGroups(14, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: removeGroups: invalid count");
+ evaluate<void>(visualModel, "items.removeGroups(11, 5, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ } {
+ evaluate<void>(visualModel, part + "filterOnGroup = \"visible\"");
+ QCOMPARE(listview->count(), 9);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ QCOMPARE(evaluate<QString>(visualModel, part + "filterOnGroup"), QString("visible"));
+ } {
+ evaluate<void>(visualModel, part + "filterOnGroup = \"selected\"");
+ QCOMPARE(listview->count(), 2);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ QCOMPARE(evaluate<QString>(visualModel, part + "filterOnGroup"), QString("selected"));
+ } {
+ evaluate<void>(visualModel, part + "filterOnGroup = undefined");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ QCOMPARE(evaluate<QString>(visualModel, part + "filterOnGroup"), QString("items"));
+ } {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 5);
+ QVERIFY(delegate);
+
+ evaluate<void>(delegate, "hide()");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 8);
+ QCOMPARE(selectedItems->count(), 2);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 7 };
+ static const bool vMember[] = { t, t, f, t, t, f, f, f, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, t, t, f, f };
+ VERIFY_GROUPS;
+ } {
+ QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 5);
+ QVERIFY(delegate);
+
+ evaluate<void>(delegate, "select()");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 8);
+ QCOMPARE(selectedItems->count(), 3);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 7 };
+ static const bool vMember[] = { t, t, f, t, t, f, f, f, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 3, 3 };
+ static const bool sMember[] = { f, f, f, f, f, t, f, f, t, t, f, f };
+ VERIFY_GROUPS;
+ } {
+ evaluate<void>(visualModel, "items.move(2, 6, 3)");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 8);
+ QCOMPARE(selectedItems->count(), 3);
+ static const int mIndex [] = { 0, 1, 5, 6, 7, 8, 2, 3, 4, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 2, 2, 3, 3, 4, 5, 6, 7 };
+ static const bool vMember[] = { t, t, f, f, f, t, f, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3 };
+ static const bool sMember[] = { f, f, t, f, f, t, f, f, f, t, f, f };
+ VERIFY_GROUPS;
+ }
+}
+
+template <int N> void tst_qquickvisualdatamodel::get_verify(
+ const SingleRoleModel &model,
+ QQmlDelegateModel *visualModel,
+ QQmlDelegateModelGroup *visibleItems,
+ QQmlDelegateModelGroup *selectedItems,
+ const int (&mIndex)[N],
+ const int (&iIndex)[N],
+ const int (&vIndex)[N],
+ const int (&sIndex)[N],
+ const bool (&vMember)[N],
+ const bool (&sMember)[N])
+{
+ failed = true;
+ for (int i = 0; i < N; ++i) {
+ QCOMPARE(evaluate<QString>(visualModel, QString("items.get(%1).model.name").arg(i)), model.at(mIndex[i]));
+ QCOMPARE(evaluate<QString>(visualModel, QString("items.get(%1).model.modelData").arg(i)), model.at(mIndex[i]));
+ QCOMPARE(evaluate<int>(visualModel, QString("items.get(%1).model.index").arg(i)), mIndex[i]);
+ QCOMPARE(evaluate<int>(visualModel, QString("items.get(%1).itemsIndex").arg(i)), iIndex[i]);
+ QCOMPARE(evaluate<bool>(visualModel, QString("items.get(%1).inItems").arg(i)), true);
+ QCOMPARE(evaluate<int>(visualModel, QString("items.get(%1).visibleIndex").arg(i)), vIndex[i]);
+ QCOMPARE(evaluate<bool>(visualModel, QString("items.get(%1).inVisible").arg(i)), vMember[i]);
+ QCOMPARE(evaluate<int>(visualModel, QString("items.get(%1).selectedIndex").arg(i)), sIndex[i]);
+ QCOMPARE(evaluate<bool>(visualModel, QString("items.get(%1).inSelected").arg(i)), sMember[i]);
+ QCOMPARE(evaluate<bool>(visualModel, QString("contains(items.get(%1).groups, \"items\")").arg(i)), true);
+ QCOMPARE(evaluate<bool>(visualModel, QString("contains(items.get(%1).groups, \"visible\")").arg(i)), vMember[i]);
+ QCOMPARE(evaluate<bool>(visualModel, QString("contains(items.get(%1).groups, \"selected\")").arg(i)), sMember[i]);
+
+ if (vMember[i]) {
+ QCOMPARE(evaluate<QString>(visibleItems, QString("get(%1).model.name").arg(vIndex[i])), model.at(mIndex[i]));
+ QCOMPARE(evaluate<QString>(visibleItems, QString("get(%1).model.modelData").arg(vIndex[i])), model.at(mIndex[i]));
+ QCOMPARE(evaluate<int>(visibleItems, QString("get(%1).model.index").arg(vIndex[i])), mIndex[i]);
+ QCOMPARE(evaluate<int>(visibleItems, QString("get(%1).itemsIndex").arg(vIndex[i])), iIndex[i]);
+ QCOMPARE(evaluate<bool>(visibleItems, QString("get(%1).inItems").arg(vIndex[i])), true);
+ QCOMPARE(evaluate<int>(visibleItems, QString("get(%1).visibleIndex").arg(vIndex[i])), vIndex[i]);
+ QCOMPARE(evaluate<bool>(visibleItems, QString("get(%1).inVisible").arg(vIndex[i])), vMember[i]);
+ QCOMPARE(evaluate<int>(visibleItems, QString("get(%1).selectedIndex").arg(vIndex[i])), sIndex[i]);
+ QCOMPARE(evaluate<bool>(visibleItems, QString("get(%1).inSelected").arg(vIndex[i])), sMember[i]);
+
+ QCOMPARE(evaluate<bool>(visibleItems, QString("contains(get(%1).groups, \"items\")").arg(vIndex[i])), true);
+ QCOMPARE(evaluate<bool>(visibleItems, QString("contains(get(%1).groups, \"visible\")").arg(vIndex[i])), vMember[i]);
+ QCOMPARE(evaluate<bool>(visibleItems, QString("contains(get(%1).groups, \"selected\")").arg(vIndex[i])), sMember[i]);
+ }
+ if (sMember[i]) {
+ QCOMPARE(evaluate<QString>(selectedItems, QString("get(%1).model.name").arg(sIndex[i])), model.at(mIndex[i]));
+ QCOMPARE(evaluate<QString>(selectedItems, QString("get(%1).model.modelData").arg(sIndex[i])), model.at(mIndex[i]));
+ QCOMPARE(evaluate<int>(selectedItems, QString("get(%1).model.index").arg(sIndex[i])), mIndex[i]);
+ QCOMPARE(evaluate<int>(selectedItems, QString("get(%1).itemsIndex").arg(sIndex[i])), iIndex[i]);
+ QCOMPARE(evaluate<bool>(selectedItems, QString("get(%1).inItems").arg(sIndex[i])), true);
+ QCOMPARE(evaluate<int>(selectedItems, QString("get(%1).visibleIndex").arg(sIndex[i])), vIndex[i]);
+ QCOMPARE(evaluate<bool>(selectedItems, QString("get(%1).inVisible").arg(sIndex[i])), vMember[i]);
+ QCOMPARE(evaluate<int>(selectedItems, QString("get(%1).selectedIndex").arg(sIndex[i])), sIndex[i]);
+ QCOMPARE(evaluate<bool>(selectedItems, QString("get(%1).inSelected").arg(sIndex[i])), sMember[i]);
+ QCOMPARE(evaluate<bool>(selectedItems, QString("contains(get(%1).groups, \"items\")").arg(sIndex[i])), true);
+ QCOMPARE(evaluate<bool>(selectedItems, QString("contains(get(%1).groups, \"visible\")").arg(sIndex[i])), vMember[i]);
+ QCOMPARE(evaluate<bool>(selectedItems, QString("contains(get(%1).groups, \"selected\")").arg(sIndex[i])), sMember[i]);
+ }
+ }
+ failed = false;
+}
+
+#define VERIFY_GET \
+ get_verify(model, visualModel, visibleItems, selectedItems, mIndex, iIndex, vIndex, sIndex, vMember, sMember); \
+ QVERIFY(!failed)
+
+void tst_qquickvisualdatamodel::get()
+{
+ QQuickView view;
+
+ SingleRoleModel model(QStringList()
+ << "one"
+ << "two"
+ << "three"
+ << "four"
+ << "five"
+ << "six"
+ << "seven"
+ << "eight"
+ << "nine"
+ << "ten"
+ << "eleven"
+ << "twelve");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("groups.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
+ QVERIFY(visualModel);
+
+ QQmlDelegateModelGroup *visibleItems = visualModel->findChild<QQmlDelegateModelGroup *>("visibleItems");
+ QVERIFY(visibleItems);
+
+ QQmlDelegateModelGroup *selectedItems = visualModel->findChild<QQmlDelegateModelGroup *>("selectedItems");
+ QVERIFY(selectedItems);
+
+ QV8Engine *v8Engine = QQmlEnginePrivate::getV8Engine(ctxt->engine());
+ QVERIFY(v8Engine);
+
+ const bool f = false;
+ const bool t = true;
+
+ {
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 12);
+ QCOMPARE(selectedItems->count(), 0);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const bool vMember[] = { t, t, t, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, f, f, f, f };
+ VERIFY_GET;
+ } {
+ evaluate<void>(visualModel, "items.addGroups(8, \"selected\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 12);
+ QCOMPARE(selectedItems->count(), 1);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const bool vMember[] = { t, t, t, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, t, f, f, f };
+ VERIFY_GET;
+ } {
+ evaluate<void>(visualModel, "items.addGroups(6, 4, [\"visible\", \"selected\"])");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 12);
+ QCOMPARE(selectedItems->count(), 4);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const bool vMember[] = { t, t, t, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4 };
+ static const bool sMember[] = { f, f, f, f, f, f, t, t, t, t, f, f };
+ VERIFY_GET;
+ } {
+ evaluate<void>(visualModel, "items.setGroups(2, [\"items\", \"selected\"])");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 11);
+ QCOMPARE(selectedItems->count(), 5);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9,10 };
+ static const bool vMember[] = { t, t, f, t, t, t, t, t, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 1, 1, 1, 1, 2, 3, 4, 5, 5 };
+ static const bool sMember[] = { f, f, t, f, f, f, t, t, t, t, f, f };
+ VERIFY_GET;
+ } {
+ evaluate<void>(selectedItems, "setGroups(0, 3, \"items\")");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8 };
+ static const bool vMember[] = { t, t, f, t, t, t, f, f, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, t, t, f, f };
+ VERIFY_GET;
+ } {
+ evaluate<void>(visualModel, "items.get(5).inVisible = false");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 8);
+ QCOMPARE(selectedItems->count(), 2);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 7 };
+ static const bool vMember[] = { t, t, f, t, t, f, f, f, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, t, t, f, f };
+ VERIFY_GET;
+ } {
+ evaluate<void>(visualModel, "items.get(5).inSelected = true");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 8);
+ QCOMPARE(selectedItems->count(), 3);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 7 };
+ static const bool vMember[] = { t, t, f, t, t, f, f, f, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 3, 3 };
+ static const bool sMember[] = { f, f, f, f, f, t, f, f, t, t, f, f };
+ VERIFY_GET;
+ } {
+ evaluate<void>(visualModel, "items.get(5).groups = [\"visible\", \"items\"]");
+ QCOMPARE(listview->count(), 12);
+ QCOMPARE(visualModel->items()->count(), 12);
+ QCOMPARE(visibleItems->count(), 9);
+ QCOMPARE(selectedItems->count(), 2);
+ static const int mIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int iIndex [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11 };
+ static const int vIndex [] = { 0, 1, 2, 2, 3, 4, 5, 5, 5, 6, 7, 8 };
+ static const bool vMember[] = { t, t, f, t, t, t, f, f, t, t, t, t };
+ static const int sIndex [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2 };
+ static const bool sMember[] = { f, f, f, f, f, f, f, f, t, t, f, f };
+ VERIFY_GET;
+ }
+}
+
+void tst_qquickvisualdatamodel::invalidGroups()
+{
+ QUrl source = testFileUrl("groups-invalid.qml");
+ QTest::ignoreMessage(QtWarningMsg, (source.toString() + ":12:9: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("Group names must start with a lower case letter")).toUtf8());
+
+ QQmlComponent component(&engine, source);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object);
+
+ QCOMPARE(evaluate<int>(object.data(), "groups.length"), 4);
+ QCOMPARE(evaluate<QString>(object.data(), "groups[0].name"), QString("items"));
+ QCOMPARE(evaluate<QString>(object.data(), "groups[1].name"), QString("persistedItems"));
+ QCOMPARE(evaluate<QString>(object.data(), "groups[2].name"), QString("visible"));
+ QCOMPARE(evaluate<QString>(object.data(), "groups[3].name"), QString("selected"));
+}
+
+void tst_qquickvisualdatamodel::onChanged_data()
+{
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<QStringList>("tests");
+
+ QTest::newRow("item appended")
+ << QString("listModel.append({\"number\": \"five\"})")
+ << (QStringList()
+ << "verify(vm.removed, [], [], [])"
+ << "verify(vm.inserted, [4], [1], [undefined])"
+ << "verify(vi.removed, [], [], [])"
+ << "verify(vi.inserted, [4], [1], [undefined])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+ QTest::newRow("item prepended")
+ << QString("listModel.insert(0, {\"number\": \"five\"})")
+ << (QStringList()
+ << "verify(vm.removed, [], [], [])"
+ << "verify(vm.inserted, [0], [1], [undefined])"
+ << "verify(vi.removed, [], [], [])"
+ << "verify(vi.inserted, [0], [1], [undefined])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+ QTest::newRow("item inserted")
+ << QString("listModel.insert(2, {\"number\": \"five\"})")
+ << (QStringList()
+ << "verify(vm.removed, [], [], [])"
+ << "verify(vm.inserted, [2], [1], [undefined])"
+ << "verify(vi.removed, [], [], [])"
+ << "verify(vi.inserted, [2], [1], [undefined])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+
+ QTest::newRow("item removed tail")
+ << QString("listModel.remove(3)")
+ << (QStringList()
+ << "verify(vm.removed, [3], [1], [undefined])"
+ << "verify(vm.inserted, [], [], [])"
+ << "verify(vi.removed, [3], [1], [undefined])"
+ << "verify(vi.inserted, [], [], [])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+ QTest::newRow("item removed head")
+ << QString("listModel.remove(0)")
+ << (QStringList()
+ << "verify(vm.removed, [0], [1], [undefined])"
+ << "verify(vm.inserted, [], [], [])"
+ << "verify(vi.removed, [0], [1], [undefined])"
+ << "verify(vi.inserted, [], [], [])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+ QTest::newRow("item removed middle")
+ << QString("listModel.remove(1)")
+ << (QStringList()
+ << "verify(vm.removed, [1], [1], [undefined])"
+ << "verify(vm.inserted, [], [], [])"
+ << "verify(vi.removed, [1], [1], [undefined])"
+ << "verify(vi.inserted, [], [], [])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+
+
+ QTest::newRow("item moved from tail")
+ << QString("listModel.move(3, 0, 1)")
+ << (QStringList()
+ << "verify(vm.removed, [3], [1], [vm.inserted[0].moveId])"
+ << "verify(vm.inserted, [0], [1], [vm.removed[0].moveId])"
+ << "verify(vi.removed, [3], [1], [vi.inserted[0].moveId])"
+ << "verify(vi.inserted, [0], [1], [vi.removed[0].moveId])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+ QTest::newRow("item moved from head")
+ << QString("listModel.move(0, 2, 2)")
+ << (QStringList()
+ << "verify(vm.removed, [0], [2], [vm.inserted[0].moveId])"
+ << "verify(vm.inserted, [2], [2], [vm.removed[0].moveId])"
+ << "verify(vi.removed, [0], [2], [vi.inserted[0].moveId])"
+ << "verify(vi.inserted, [2], [2], [vi.removed[0].moveId])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+
+ QTest::newRow("groups changed")
+ << QString("items.setGroups(1, 2, [\"items\", \"selected\"])")
+ << (QStringList()
+ << "verify(vm.inserted, [], [], [])"
+ << "verify(vm.removed, [], [], [])"
+ << "verify(vi.removed, [1], [2], [undefined])"
+ << "verify(vi.inserted, [], [], [])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [0], [2], [undefined])");
+
+ QTest::newRow("multiple removes")
+ << QString("{ vi.remove(1, 1); "
+ "vi.removeGroups(0, 2, \"items\") }")
+ << (QStringList()
+ << "verify(vm.removed, [0, 1], [1, 1], [undefined, undefined])"
+ << "verify(vm.inserted, [], [], [])"
+ << "verify(vi.removed, [1], [1], [undefined])"
+ << "verify(vi.inserted, [], [], [])"
+ << "verify(si.removed, [], [], [])"
+ << "verify(si.inserted, [], [], [])");
+}
+
+void tst_qquickvisualdatamodel::onChanged()
+{
+ QFETCH(QString, expression);
+ QFETCH(QStringList, tests);
+
+ QQmlComponent component(&engine, testFileUrl("onChanged.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object);
+
+ evaluate<void>(object.data(), expression);
+
+ foreach (const QString &test, tests) {
+ bool passed = evaluate<bool>(object.data(), test);
+ if (!passed)
+ qWarning() << test;
+ QVERIFY(passed);
+ }
+}
+
+void tst_qquickvisualdatamodel::create()
+{
+ QQuickView view;
+
+ SingleRoleModel model(QStringList()
+ << "one"
+ << "two"
+ << "three"
+ << "four"
+ << "five"
+ << "six"
+ << "seven"
+ << "eight"
+ << "nine"
+ << "ten"
+ << "eleven"
+ << "twelve"
+ << "thirteen"
+ << "fourteen"
+ << "fifteen"
+ << "sixteen"
+ << "seventeen"
+ << "eighteen"
+ << "nineteen"
+ << "twenty");
+
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+
+ view.setSource(testFileUrl("create.qml"));
+
+ QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject());
+ QVERIFY(listview != 0);
+
+ QQuickItem *contentItem = listview->contentItem();
+ QVERIFY(contentItem != 0);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model()));
+ QVERIFY(visualModel);
+
+ QCOMPARE(listview->count(), 20);
+
+ QQmlGuard<QQuickItem> delegate;
+
+ // persistedItems.includeByDefault is true, so all items belong to persistedItems initially.
+ QVERIFY(delegate = findItem<QQuickItem>(contentItem, "delegate", 1));
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+
+ // changing include by default doesn't remove persistance.
+ evaluate<void>(visualModel, "persistedItems.includeByDefault = false");
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+
+ // removing from persistedItems does.
+ evaluate<void>(visualModel, "persistedItems.remove(0, 20)");
+ QCOMPARE(listview->count(), 20);
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+
+ // Request an item instantiated by the view.
+ QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(1)")));
+ QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 1));
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
+
+ evaluate<void>(delegate, "VisualDataModel.inPersistedItems = false");
+ QCOMPARE(listview->count(), 20);
+ QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
+ QVERIFY(delegate);
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
+
+ // Request an item not instantiated by the view.
+ QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 15));
+ QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(15)")));
+ QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 15));
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
+
+ evaluate<void>(visualModel, "persistedItems.remove(0)");
+ QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
+ QVERIFY(!delegate);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
+
+ // Request an item not instantiated by the view, then scroll the view so it will request it.
+ QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 16));
+ QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(16)")));
+ QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 16));
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
+
+ evaluate<void>(listview, "positionViewAtIndex(19, ListView.End)");
+ QCOMPARE(listview->count(), 20);
+ evaluate<void>(delegate, "VisualDataModel.groups = [\"items\"]");
+ QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
+ QVERIFY(delegate);
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
+
+ // Request and release an item instantiated by the view, then scroll the view so it releases it.
+ QVERIFY(findItem<QQuickItem>(contentItem, "delegate", 17));
+ QVERIFY(delegate = qobject_cast<QQuickItem *>(evaluate<QObject *>(visualModel, "items.create(17)")));
+ QCOMPARE(delegate.data(), findItem<QQuickItem>(contentItem, "delegate", 17));
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
+
+ evaluate<void>(visualModel, "items.removeGroups(17, \"persistedItems\")");
+ QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
+ QVERIFY(delegate);
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 0);
+ evaluate<void>(listview, "positionViewAtIndex(1, ListView.Beginning)");
+ QCOMPARE(listview->count(), 20);
+ QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
+ QVERIFY(!delegate);
+
+ // Adding an item to the persistedItems group won't instantiate it, but if later requested by
+ // the view it will be persisted.
+ evaluate<void>(visualModel, "items.addGroups(18, \"persistedItems\")");
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 1);
+ QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 18));
+ evaluate<void>(listview, "positionViewAtIndex(19, ListView.End)");
+ QCOMPARE(listview->count(), 20);
+ QVERIFY(delegate = findItem<QQuickItem>(contentItem, "delegate", 18));
+ QCOMPARE(evaluate<bool>(delegate, "VisualDataModel.inPersistedItems"), true);
+ QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
+ QVERIFY(delegate);
+ evaluate<void>(listview, "positionViewAtIndex(1, ListView.Beginning)");
+ QCOMPARE(listview->count(), 20);
+ QCoreApplication::sendPostedEvents(delegate, QEvent::DeferredDelete);
+ QVERIFY(delegate);
+
+ // Remove an uninstantiated but cached item from the persistedItems group.
+ evaluate<void>(visualModel, "items.addGroups(19, \"persistedItems\")");
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), 2);
+ QVERIFY(!findItem<QQuickItem>(contentItem, "delegate", 19));
+ // Store a reference to the item so it is retained in the cache.
+ evaluate<void>(visualModel, "persistentHandle = items.get(19)");
+ QCOMPARE(evaluate<bool>(visualModel, "persistentHandle.inPersistedItems"), true);
+ evaluate<void>(visualModel, "items.removeGroups(19, \"persistedItems\")");
+ QCOMPARE(evaluate<bool>(visualModel, "persistentHandle.inPersistedItems"), false);
+}
+
+void tst_qquickvisualdatamodel::incompleteModel()
+{
+ // VisualDataModel is first populated in componentComplete. Verify various functions are
+ // harmlessly ignored until then.
+
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n VisualDataModel {}", testFileUrl(""));
+
+ QScopedPointer<QObject> object(component.beginCreate(engine.rootContext()));
+
+ QQmlDelegateModel *model = qobject_cast<QQmlDelegateModel *>(object.data());
+ QVERIFY(model);
+
+ QSignalSpy itemsSpy(model->items(), SIGNAL(countChanged()));
+ QSignalSpy persistedItemsSpy(model->items(), SIGNAL(countChanged()));
+
+ evaluate<void>(model, "items.removeGroups(0, items.count, \"items\")");
+ QCOMPARE(itemsSpy.count(), 0);
+ QCOMPARE(persistedItemsSpy.count(), 0);
+
+ evaluate<void>(model, "items.setGroups(0, items.count, \"persistedItems\")");
+ QCOMPARE(itemsSpy.count(), 0);
+ QCOMPARE(persistedItemsSpy.count(), 0);
+
+ evaluate<void>(model, "items.addGroups(0, items.count, \"persistedItems\")");
+ QCOMPARE(itemsSpy.count(), 0);
+ QCOMPARE(persistedItemsSpy.count(), 0);
+
+ evaluate<void>(model, "items.remove(0, items.count)");
+ QCOMPARE(itemsSpy.count(), 0);
+ QCOMPARE(persistedItemsSpy.count(), 0);
+
+ evaluate<void>(model, "items.insert([ \"color\": \"blue\" ])");
+ QCOMPARE(itemsSpy.count(), 0);
+ QCOMPARE(persistedItemsSpy.count(), 0);
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML VisualDataGroup: get: index out of range");
+ QVERIFY(evaluate<bool>(model, "items.get(0) === undefined"));
+
+ component.completeCreate();
+}
+
+void tst_qquickvisualdatamodel::insert_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<int>("modelCount");
+ QTest::addColumn<int>("visualCount");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<bool>("inItems");
+ QTest::addColumn<bool>("persisted");
+ QTest::addColumn<bool>("visible");
+ QTest::addColumn<bool>("selected");
+ QTest::addColumn<bool>("modelData");
+ QTest::addColumn<QString>("property");
+ QTest::addColumn<QStringList>("propertyData");
+
+ const QUrl listModelSource[] = {
+ testFileUrl("listmodelproperties.qml"),
+ testFileUrl("listmodelproperties-package.qml") };
+ const QUrl singleRoleSource[] = {
+ testFileUrl("singleroleproperties.qml"),
+ testFileUrl("singleroleproperties-package.qml") };
+ const QUrl multipleRoleSource[] = {
+ testFileUrl("multipleroleproperties.qml"),
+ testFileUrl("multipleroleproperties-package.qml") };
+ const QUrl stringListSource[] = {
+ testFileUrl("stringlistproperties.qml"),
+ testFileUrl("stringlistproperties-package.qml") };
+ const QUrl objectListSource[] = {
+ testFileUrl("objectlistproperties.qml"),
+ testFileUrl("objectlistproperties-package.qml") };
+
+ for (int i = 0; i < 2; ++i) {
+ // List Model.
+ QTest::newRow("ListModel.items prepend")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"number\": \"eight\"})")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items append")
+ << listModelSource[i]
+ << QString("items.insert({\"number\": \"eight\"})")
+ << 4 << 5 << 4 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("ListModel.items insert at 2")
+ << listModelSource[i]
+ << QString("items.insert(2, {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items insert at items.get(2)")
+ << listModelSource[i]
+ << QString("items.insert(items.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items insert at visibleItems.get(2)")
+ << listModelSource[i]
+ << QString("items.insert(visibleItems.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems insert at items.get(2)")
+ << listModelSource[i]
+ << QString("selectedItems.insert(items.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << false << false << false << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems insert at visibleItems.get(2)")
+ << listModelSource[i]
+ << QString("selectedItems.insert(visibleItems.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << false << false << false << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend modelData")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"modelData\": \"eight\"})")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend, edit number")
+ << listModelSource[i]
+ << QString("{ "
+ "items.insert(0, {\"number\": \"eight\"}); "
+ "items.get(0).model.number = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend, edit modelData")
+ << listModelSource[i]
+ << QString("{ "
+ "items.insert(0, {\"number\": \"eight\"}); "
+ "items.get(0).model.modelData = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend, edit resolved")
+ << listModelSource[i]
+ << QString("{ "
+ "items.insert(0, {\"number\": \"eight\"}); "
+ "items.get(2).model.number = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend with groups")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"number\": \"eight\"}, [\"visible\", \"truncheon\"])")
+ << 4 << 5 << 0 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items append with groups")
+ << listModelSource[i]
+ << QString("items.insert({\"number\": \"eight\"}, [\"visible\", \"selected\"])")
+ << 4 << 5 << 4 << true << false << true << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("ListModel.items insert at 2 with groups")
+ << listModelSource[i]
+ << QString("items.insert(2, {\"number\": \"eight\"}, \"visible\")")
+ << 4 << 5 << 2 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ // create ListModel
+ QTest::newRow("ListModel.items prepend")
+ << listModelSource[i]
+ << QString("items.create(0, {\"number\": \"eight\"})")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items append")
+ << listModelSource[i]
+ << QString("items.create({\"number\": \"eight\"})")
+ << 4 << 5 << 4 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("ListModel.items create at 2")
+ << listModelSource[i]
+ << QString("items.create(2, {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items create at items.get(2)")
+ << listModelSource[i]
+ << QString("items.create(items.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items create at visibleItems.get(2)")
+ << listModelSource[i]
+ << QString("items.create(visibleItems.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems create at items.get(2)")
+ << listModelSource[i]
+ << QString("selectedItems.create(items.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << false << true << false << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems create at visibleItems.get(2)")
+ << listModelSource[i]
+ << QString("selectedItems.create(visibleItems.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << false << true << false << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items create prepended")
+ << listModelSource[i]
+ << QString("items.create(0, {\"number\": \"eight\"})")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create appended")
+ << listModelSource[i]
+ << QString("items.create({\"number\": \"eight\"})")
+ << 4 << 5 << 4 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("ListModel.items create at 2")
+ << listModelSource[i]
+ << QString("items.create(2, {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items create at items.get(2)")
+ << listModelSource[i]
+ << QString("items.create(items.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items create at visibleItems.get(2)")
+ << listModelSource[i]
+ << QString("items.create(visibleItems.get(2), {\"number\": \"eight\"})")
+ << 4 << 5 << 2 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.create prepend modelData")
+ << listModelSource[i]
+ << QString("items.create(0, {\"modelData\": \"eight\"})")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create prepended, edit number")
+ << listModelSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"number\": \"eight\"}); "
+ "item.setTest3(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create prepended, edit model.number")
+ << listModelSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"number\": \"eight\"}); "
+ "item.setTest4(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create prepended, edit modelData")
+ << listModelSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"number\": \"eight\"}); "
+ "item.setTest5(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create prepended, edit model.modelData")
+ << listModelSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"number\": \"eight\"}); "
+ "item.setTest6(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create prepended with groups")
+ << listModelSource[i]
+ << QString("items.create(0, {\"number\": \"eight\"}, [\"visible\", \"truncheon\"])")
+ << 4 << 5 << 0 << true << true << true << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create appended with groups")
+ << listModelSource[i]
+ << QString("items.create({\"number\": \"eight\"}, [\"visible\", \"selected\"])")
+ << 4 << 5 << 4 << true << true << true << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("ListModel.items create inserted with groups")
+ << listModelSource[i]
+ << QString("items.create(2, {\"number\": \"eight\"}, \"visible\")")
+ << 4 << 5 << 2 << true << true << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("ListModel.items create prepended clear persistence")
+ << listModelSource[i]
+ << QString("{ items.create(0, {\"number\": \"eight\"}); "
+ "items.get(0).inPersistedItems = false }")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items create appended clear persistence")
+ << listModelSource[i]
+ << QString("{ items.create({\"number\": \"eight\"}); "
+ "items.get(4).inPersistedItems = false }")
+ << 4 << 5 << 4 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("ListModel.items create inserted clear persistence")
+ << listModelSource[i]
+ << QString("{ items.create(2, {\"number\": \"eight\"}); "
+ "items.get(2).inPersistedItems = false }")
+ << 4 << 5 << 2 << true << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ // AbstractItemModel (Single Role).
+ QTest::newRow("AbstractItemModel.items prepend")
+ << singleRoleSource[i]
+ << QString("items.insert(0, {\"name\": \"eight\"})")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("name")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items append")
+ << singleRoleSource[i]
+ << QString("items.insert({\"name\": \"eight\"})")
+ << 4 << 5 << 4 << true << false << false << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("AbstractItemModel.items insert at 2")
+ << singleRoleSource[i]
+ << QString("items.insert(2, {\"name\": \"eight\"})")
+ << 4 << 5 << 2 << true << false << false << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items prepend modelData")
+ << singleRoleSource[i]
+ << QString("items.insert(0, {\"modelData\": \"eight\"})")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("name")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items prepend, edit name")
+ << singleRoleSource[i]
+ << QString("{ "
+ "items.insert(0, {\"name\": \"eight\"}); "
+ "items.get(0).model.name = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("name")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items prepend, edit modelData")
+ << singleRoleSource[i]
+ << QString("{ "
+ "items.insert(0, {\"name\": \"eight\"}); "
+ "items.get(0).model.modelData = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("name")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items prepend, edit resolved")
+ << singleRoleSource[i]
+ << QString("{ "
+ "items.insert(0, {\"name\": \"eight\"}); "
+ "items.get(2).model.name = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << true
+ << QString("name")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.create prepend modelData")
+ << singleRoleSource[i]
+ << QString("items.create(0, {\"modelData\": \"eight\"})")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("name")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items create prepended, edit name")
+ << singleRoleSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"name\": \"eight\"}); "
+ "item.setTest3(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("name")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items create prepended, edit model.name")
+ << singleRoleSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"name\": \"eight\"}); "
+ "item.setTest4(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("name")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items create prepended, edit modelData")
+ << singleRoleSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"name\": \"eight\"}); "
+ "item.setTest5(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("name")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items create prepended, edit model.modelData")
+ << singleRoleSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"name\": \"eight\"}); "
+ "item.setTest6(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << true
+ << QString("name")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ // AbstractItemModel (Multiple Roles).
+ QTest::newRow("StandardItemModel.items prepend")
+ << multipleRoleSource[i]
+ << QString("items.insert(0, {\"display\": \"Row 8 Item\"})")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 8 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items append")
+ << multipleRoleSource[i]
+ << QString("items.insert({\"display\": \"Row 8 Item\"})")
+ << 4 << 5 << 4 << true << false << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item" << "Row 8 Item");
+
+ QTest::newRow("StandardItemModel.items insert at 2")
+ << multipleRoleSource[i]
+ << QString("items.insert(2, {\"display\": \"Row 8 Item\"})")
+ << 4 << 5 << 2 << true << false << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 1 Item" << "Row 2 Item" << "Row 8 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items prepend modelData")
+ << multipleRoleSource[i]
+ << QString("items.insert(0, {\"modelData\": \"Row 8 Item\"})")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("display")
+ << (QStringList() << QString() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items prepend, edit display")
+ << multipleRoleSource[i]
+ << QString("{ "
+ "items.insert(0, {\"display\": \"Row 8 Item\"}); "
+ "items.get(0).model.display = \"Row 7 Item\"; }")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 7 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items prepend, edit modelData")
+ << multipleRoleSource[i]
+ << QString("{ "
+ "items.insert(0, {\"display\": \"Row 8 Item\"}); "
+ "items.get(0).model.modelData = \"Row 7 Item\"; }")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 8 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items prepend, edit resolved")
+ << multipleRoleSource[i]
+ << QString("{ "
+ "items.insert(0, {\"display\": \"Row 8 Item\"}); "
+ "items.get(2).model.display = \"Row 7 Item\"; }")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 8 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.create prepend modelData")
+ << multipleRoleSource[i]
+ << QString("items.create(0, {\"modelData\": \"Row 8 Item\"})")
+ << 4 << 5 << 0 << true << true << false << false << false
+ << QString("display")
+ << (QStringList() << QString() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items create prepended, edit display")
+ << multipleRoleSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"display\": \"Row 8 Item\"}); "
+ "item.setTest3(\"Row 7 Item\"); }")
+ << 4 << 5 << 0 << true << true << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 7 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items create prepended, edit model.display")
+ << multipleRoleSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"display\": \"Row 8 Item\"}); "
+ "item.setTest4(\"Row 7 Item\"); }")
+ << 4 << 5 << 0 << true << true << false << false << false
+ << QString("display")
+ << (QStringList() << "Row 7 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ // StringList.
+ QTest::newRow("StringList.items prepend")
+ << stringListSource[i]
+ << QString("items.insert(0, {\"modelData\": \"eight\"})")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("modelData")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("StringList.items append")
+ << stringListSource[i]
+ << QString("items.insert({\"modelData\": \"eight\"})")
+ << 4 << 5 << 4 << true << false << false << false << false
+ << QString("modelData")
+ << (QStringList() << "one" << "two" << "three" << "four" << "eight");
+
+ QTest::newRow("StringList.items insert at 2")
+ << stringListSource[i]
+ << QString("items.insert(2, {\"modelData\": \"eight\"})")
+ << 4 << 5 << 2 << true << false << false << false << false
+ << QString("modelData")
+ << (QStringList() << "one" << "two" << "eight" << "three" << "four");
+
+ QTest::newRow("StringList.items prepend, edit modelData")
+ << stringListSource[i]
+ << QString("{ "
+ "items.insert(0, {\"modelData\": \"eight\"}); "
+ "items.get(0).model.modelData = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("modelData")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("StringList.items prepend, edit resolved")
+ << stringListSource[i]
+ << QString("{ "
+ "items.insert(0, {\"modelData\": \"eight\"}); "
+ "items.get(2).model.modelData = \"seven\"; }")
+ << 4 << 5 << 0 << true << false << false << false << false
+ << QString("modelData")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("StringList.create prepend modelData")
+ << stringListSource[i]
+ << QString("items.create(0, {\"modelData\": \"eight\"})")
+ << 4 << 5 << 0 << true << true << false << false << false
+ << QString("modelData")
+ << (QStringList() << "eight" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("StringList.items create prepended, edit modelData")
+ << stringListSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"modelData\": \"eight\"}); "
+ "item.setTest3(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << false
+ << QString("modelData")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("StringList.items create prepended, edit model.modelData")
+ << stringListSource[i]
+ << QString("{ "
+ "var item = items.create(0, {\"modelData\": \"eight\"}); "
+ "item.setTest4(\"seven\"); }")
+ << 4 << 5 << 0 << true << true << false << false << false
+ << QString("modelData")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ // ObjectList
+ QTest::newRow("ObjectList.items prepend")
+ << objectListSource[i]
+ << QString("items.insert(0, {\"name\": \"Item 8\"})")
+ << 4 << 4 << 4 << false << false << false << false << false
+ << QString("name")
+ << (QStringList() << "Item 1" << "Item 2" << "Item 3" << "Item 4");
+
+ QTest::newRow("ObjectList.items append")
+ << objectListSource[i]
+ << QString("items.insert({\"name\": \"Item 8\"})")
+ << 4 << 4 << 4 << false << false << false << false << false
+ << QString("name")
+ << (QStringList() << "Item 1" << "Item 2" << "Item 3" << "Item 4");
+
+ QTest::newRow("ObjectList.items insert at 2")
+ << objectListSource[i]
+ << QString("items.insert(2, {\"name\": \"Item 8\"})")
+ << 4 << 4 << 4 << false << false << false << false << false
+ << QString("name")
+ << (QStringList() << "Item 1" << "Item 2" << "Item 3" << "Item 4");
+ }
+}
+
+void tst_qquickvisualdatamodel::insert()
+{
+ QFETCH(QUrl, source);
+ QFETCH(QString, expression);
+ QFETCH(int, modelCount);
+ QFETCH(int, visualCount);
+ QFETCH(int, index);
+ QFETCH(bool, inItems);
+ QFETCH(bool, persisted);
+ QFETCH(bool, visible);
+ QFETCH(bool, selected);
+ QFETCH(bool, modelData);
+ QFETCH(QString, property);
+ QFETCH(QStringList, propertyData);
+
+ QQuickWindow window;
+
+ QQmlComponent component(&engine);
+ component.loadUrl(source);
+ QScopedPointer<QObject> object(component.create());
+ QQuickListView *listView = qobject_cast<QQuickListView *>(object.data());
+ QVERIFY(listView);
+ listView->setParentItem(window.contentItem());
+
+ QQuickItem *contentItem = listView->contentItem();
+ QVERIFY(contentItem);
+
+ QObject *visualModel = listView->findChild<QObject *>("visualModel");
+ QVERIFY(visualModel);
+
+ evaluate<void>(visualModel, expression);
+
+ QCOMPARE(evaluate<int>(listView, "count"), inItems ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "count"), inItems ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "items.count"), inItems ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), persisted ? 1 : 0);
+ QCOMPARE(evaluate<int>(visualModel, "visibleItems.count"), visible ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "selectedItems.count"), selected ? 1 : 0);
+
+ QCOMPARE(propertyData.count(), visualCount);
+ for (int i = 0; i < visualCount; ++i) {
+ int modelIndex = i;
+ if (modelIndex > index)
+ modelIndex -= 1;
+ else if (modelIndex == index)
+ modelIndex = -1;
+
+ const int itemsIndex = inItems || i <= index ? i : i - 1;
+ QString get;
+
+ if (i != index) {
+ get = QString("items.get(%1)").arg(itemsIndex);
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "delegate", modelIndex);
+ QVERIFY(item);
+
+ QCOMPARE(evaluate<int>(item, "test1"), modelIndex);
+ QCOMPARE(evaluate<int>(item, "test2"), modelIndex);
+ QCOMPARE(evaluate<QString>(item, "test3"), propertyData.at(i));
+ QCOMPARE(evaluate<QString>(item, "test4"), propertyData.at(i));
+
+ if (modelData) {
+ QCOMPARE(evaluate<QString>(item, "test5"), propertyData.at(i));
+ QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(i));
+ }
+
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
+
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), itemsIndex);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), visible || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), selected && i > index ? 1 : 0);
+ } else if (inItems) {
+ get = QString("items.get(%1)").arg(index);
+ } else if (persisted) {
+ get = "persistedItems.get(0)";
+ } else if (visible) {
+ get = QString("visibleItems.get(%1)").arg(index);
+ } else if (selected) {
+ get = "selectedItems.get(0)";
+ } else {
+ continue;
+ }
+
+ QCOMPARE(evaluate<int>(visualModel, get + ".model.index"), modelIndex);
+
+ QCOMPARE(evaluate<QString>(visualModel, get + ".model." + property), propertyData.at(i));
+
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inItems"), inItems || i != index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inPersistedItems"), persisted && i == index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inVisible"), visible || i != index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inSelected"), selected && i == index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".isUnresolved"), i == index);
+
+ QCOMPARE(evaluate<int>(visualModel, get + ".itemsIndex"), inItems || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(visualModel, get + ".persistedItemsIndex"), persisted && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(visualModel, get + ".visibleIndex"), visible || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(visualModel, get + ".selectedIndex"), selected && i > index ? 1 : 0);
+ }
+
+ QObject *item = 0;
+
+ if (inItems)
+ item = evaluate<QObject *>(visualModel, QString("items.create(%1)").arg(index));
+ else if (persisted)
+ item = evaluate<QObject *>(visualModel, QString("persistedItems.create(%1)").arg(0));
+ else if (visible)
+ item = evaluate<QObject *>(visualModel, QString("visibleItems.create(%1)").arg(index));
+ else if (selected)
+ item = evaluate<QObject *>(visualModel, QString("selectedItems.create(%1)").arg(0));
+ else
+ return;
+
+ QVERIFY(item);
+
+ QCOMPARE(evaluate<int>(item, "test1"), -1);
+ QCOMPARE(evaluate<int>(item, "test2"), -1);
+ QCOMPARE(evaluate<QString>(item, "test3"), propertyData.at(index));
+ QCOMPARE(evaluate<QString>(item, "test4"), propertyData.at(index));
+
+ if (modelData) {
+ QCOMPARE(evaluate<QString>(item, "test5"), propertyData.at(index));
+ QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(index));
+ }
+
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), inItems);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), visible);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), selected);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), true);
+
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), 0);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), 0);
+}
+
+void tst_qquickvisualdatamodel::resolve_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<QString>("setupExpression");
+ QTest::addColumn<QString>("resolveExpression");
+ QTest::addColumn<int>("unresolvedCount");
+ QTest::addColumn<int>("modelCount");
+ QTest::addColumn<int>("visualCount");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<bool>("inItems");
+ QTest::addColumn<bool>("persisted");
+ QTest::addColumn<bool>("visible");
+ QTest::addColumn<bool>("selected");
+ QTest::addColumn<bool>("modelData");
+ QTest::addColumn<QString>("property");
+ QTest::addColumn<QStringList>("propertyData");
+
+ const QUrl listModelSource[] = {
+ testFileUrl("listmodelproperties.qml"),
+ testFileUrl("listmodelproperties-package.qml") };
+ const QUrl singleRoleSource[] = {
+ testFileUrl("singleroleproperties.qml"),
+ testFileUrl("singleroleproperties-package.qml") };
+ const QUrl multipleRoleSource[] = {
+ testFileUrl("multipleroleproperties.qml"),
+ testFileUrl("multipleroleproperties-package.qml") };
+ const QUrl stringListSource[] = {
+ testFileUrl("stringlistproperties.qml"),
+ testFileUrl("stringlistproperties-package.qml") };
+
+ for (int i = 0; i < 2; ++i) {
+ // List Model.
+ QTest::newRow("ListModel.items prepend, resolve prepended")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(0, {\"number\": \"seven\"}); items.resolve(0, 1) }")
+ << 5 << 5 << 5 << 0 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend, resolve appended")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.append({\"number\": \"seven\"}); items.resolve(0, 5) }")
+ << 5 << 5 << 5 << 4 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "seven");
+
+ QTest::newRow("ListModel.items prepend, resolve inserted")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(2, {\"number\": \"seven\"}); items.resolve(0, 3) }")
+ << 5 << 5 << 5 << 2 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "seven" << "three" << "four");
+
+ QTest::newRow("ListModel.items append, resolve prepended")
+ << listModelSource[i]
+ << QString("items.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.insert(0, {\"number\": \"seven\"}); items.resolve(5, 0) }")
+ << 5 << 5 << 5 << 0 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items append, resolve appended")
+ << listModelSource[i]
+ << QString("items.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.append({\"number\": \"seven\"}); items.resolve(5, 4) }")
+ << 5 << 5 << 5 << 4 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "seven");
+
+ QTest::newRow("ListModel.items append, resolve inserted")
+ << listModelSource[i]
+ << QString("items.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.insert(2, {\"number\": \"seven\"}); items.resolve(5, 2) }")
+ << 5 << 5 << 5 << 2 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "seven" << "three" << "four");
+
+ QTest::newRow("ListModel.items insert, resolve prepended")
+ << listModelSource[i]
+ << QString("items.insert(2, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(0, {\"number\": \"seven\"}); items.resolve(3, 0) }")
+ << 5 << 5 << 5 << 0 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items insert, resolve appended")
+ << listModelSource[i]
+ << QString("items.insert(2, {\"number\": \"eight\"})")
+ << QString("{ listModel.append({\"number\": \"seven\"}); items.resolve(2, 5) }")
+ << 5 << 5 << 5 << 4 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "seven");
+
+ QTest::newRow("ListModel.items insert, resolve inserted")
+ << listModelSource[i]
+ << QString("items.insert(2, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(2, {\"number\": \"seven\"}); items.resolve(2, 3) }")
+ << 5 << 5 << 5 << 2 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "seven" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend, move resolved")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(0, {\"number\": \"seven\"}); "
+ "items.resolve(0, 1); "
+ "listModel.move(0, 2, 1) }")
+ << 5 << 5 << 5 << 2 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "seven" << "three" << "four");
+
+ QTest::newRow("ListModel.items append, move resolved")
+ << listModelSource[i]
+ << QString("items.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.append({\"number\": \"seven\"}); "
+ "items.resolve(5, 4); "
+ "listModel.move(4, 2, 1) }")
+ << 5 << 5 << 5 << 2 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "seven" << "three" << "four");
+
+ QTest::newRow("ListModel.items insert, move resolved")
+ << listModelSource[i]
+ << QString("items.insert(2, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(2, {\"number\": \"seven\"}); "
+ "items.resolve(2, 3);"
+ "listModel.move(2, 0, 1) }")
+ << 5 << 5 << 5 << 0 << true << false << true << false << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items prepend, remove resolved")
+ << listModelSource[i]
+ << QString("items.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(0, {\"number\": \"seven\"}); "
+ "items.resolve(0, 1); "
+ "listModel.remove(0, 1) }")
+ << 5 << 4 << 4 << 4 << false << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items append, remove resolved")
+ << listModelSource[i]
+ << QString("items.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.append({\"number\": \"seven\"}); "
+ "items.resolve(5, 4); "
+ "listModel.remove(4, 1) }")
+ << 5 << 4 << 4 << 4 << false << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items insert, remove resolved")
+ << listModelSource[i]
+ << QString("items.insert(2, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(2, {\"number\": \"seven\"}); "
+ "items.resolve(2, 3);"
+ "listModel.remove(2, 1) }")
+ << 5 << 4 << 4 << 4 << false << false << false << false << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems prepend, resolve prepended")
+ << listModelSource[i]
+ << QString("selectedItems.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(0, {\"number\": \"seven\"}); "
+ "selectedItems.resolve(selectedItems.get(0), items.get(0)) }")
+ << 4 << 5 << 5 << 0 << true << false << true << true << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems prepend, resolve appended")
+ << listModelSource[i]
+ << QString("selectedItems.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.append({\"number\": \"seven\"}); "
+ "selectedItems.resolve(selectedItems.get(0), items.get(4)) }")
+ << 4 << 5 << 5 << 4 << true << false << true << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "seven");
+
+ QTest::newRow("ListModel.selectedItems prepend, resolve inserted")
+ << listModelSource[i]
+ << QString("selectedItems.insert(0, {\"number\": \"eight\"})")
+ << QString("{ listModel.insert(2, {\"number\": \"seven\"}); "
+ "selectedItems.resolve(selectedItems.get(0), items.get(2)) }")
+ << 4 << 5 << 5 << 2 << true << false << true << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "seven" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems append, resolve prepended")
+ << listModelSource[i]
+ << QString("selectedItems.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.insert(0, {\"number\": \"seven\"}); "
+ "selectedItems.resolve(selectedItems.get(0), items.get(0)) }")
+ << 4 << 5 << 5 << 0 << true << false << true << true << true
+ << QString("number")
+ << (QStringList() << "seven" << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.selectedItems append, resolve appended")
+ << listModelSource[i]
+ << QString("selectedItems.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.append({\"number\": \"seven\"}); "
+ "selectedItems.resolve(selectedItems.get(0), items.get(4)) }")
+ << 4 << 5 << 5 << 4 << true << false << true << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "three" << "four" << "seven");
+
+ QTest::newRow("ListModel.selectedItems append, resolve inserted")
+ << listModelSource[i]
+ << QString("selectedItems.insert({\"number\": \"eight\"})")
+ << QString("{ listModel.insert(2, {\"number\": \"seven\"}); "
+ "selectedItems.resolve(selectedItems.get(0), items.get(2)) }")
+ << 4 << 5 << 5 << 2 << true << false << true << true << true
+ << QString("number")
+ << (QStringList() << "one" << "two" << "seven" << "three" << "four");
+
+ // AbstractItemModel (Single Role)
+ QTest::newRow("ListModel.items prepend, resolve prepended")
+ << singleRoleSource[i]
+ << QString("items.insert(0, {\"name\": \"eight\"})")
+ << QString("{ items.resolve(0, 1) }")
+ << 5 << 4 << 4 << 0 << true << false << true << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+
+ QTest::newRow("ListModel.items append, resolve appended")
+ << singleRoleSource[i]
+ << QString("items.insert({\"name\": \"eight\"})")
+ << QString("{ items.resolve(4, 3) }")
+ << 5 << 4 << 4 << 3 << true << false << true << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("ListModel.items insert, resolve inserted")
+ << singleRoleSource[i]
+ << QString("items.insert(2, {\"name\": \"eight\"})")
+ << QString("{ items.resolve(2, 3) }")
+ << 5 << 4 << 4 << 2 << true << false << true << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ // AbstractItemModel (Single Role)
+ QTest::newRow("AbstractItemModel.items prepend, resolve prepended")
+ << singleRoleSource[i]
+ << QString("items.insert(0, {\"name\": \"eight\"})")
+ << QString("{ items.resolve(0, 1) }")
+ << 5 << 4 << 4 << 0 << true << false << true << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items append, resolve appended")
+ << singleRoleSource[i]
+ << QString("items.insert({\"name\": \"eight\"})")
+ << QString("{ items.resolve(4, 3) }")
+ << 5 << 4 << 4 << 3 << true << false << true << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("AbstractItemModel.items insert, resolve inserted")
+ << singleRoleSource[i]
+ << QString("items.insert(2, {\"name\": \"eight\"})")
+ << QString("{ items.resolve(2, 3) }")
+ << 5 << 4 << 4 << 2 << true << false << true << false << true
+ << QString("name")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ // AbstractItemModel (Multiple Roles)
+ QTest::newRow("StandardItemModel.items prepend, resolve prepended")
+ << multipleRoleSource[i]
+ << QString("items.insert(0, {\"display\": \"Row 8 Item\"})")
+ << QString("{ items.resolve(0, 1) }")
+ << 5 << 4 << 4 << 0 << true << false << true << false << false
+ << QString("display")
+ << (QStringList() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items append, resolve appended")
+ << multipleRoleSource[i]
+ << QString("items.insert({\"display\": \"Row 8 Item\"})")
+ << QString("{ items.resolve(4, 3) }")
+ << 5 << 4 << 4 << 3 << true << false << true << false << false
+ << QString("display")
+ << (QStringList() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ QTest::newRow("StandardItemModel.items insert, resolve inserted")
+ << multipleRoleSource[i]
+ << QString("items.insert(2, {\"display\": \"Row 8 Item\"})")
+ << QString("{ items.resolve(2, 3) }")
+ << 5 << 4 << 4 << 2 << true << false << true << false << false
+ << QString("display")
+ << (QStringList() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
+
+ // StringList
+ QTest::newRow("StringList.items prepend, resolve prepended")
+ << stringListSource[i]
+ << QString("items.insert(0, {\"modelData\": \"eight\"})")
+ << QString("{ items.resolve(0, 1) }")
+ << 5 << 4 << 4 << 0 << true << false << true << false << false
+ << QString("modelData")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("StringList.items append, resolve appended")
+ << stringListSource[i]
+ << QString("items.insert({\"modelData\": \"eight\"})")
+ << QString("{ items.resolve(4, 3) }")
+ << 5 << 4 << 4 << 3 << true << false << true << false << false
+ << QString("modelData")
+ << (QStringList() << "one" << "two" << "three" << "four");
+
+ QTest::newRow("StringList.items insert, resolve inserted")
+ << stringListSource[i]
+ << QString("items.insert(2, {\"modelData\": \"eight\"})")
+ << QString("{ items.resolve(2, 3) }")
+ << 5 << 4 << 4 << 2 << true << false << true << false << false
+ << QString("modelData")
+ << (QStringList() << "one" << "two" << "three" << "four");
+ }
+}
+
+void tst_qquickvisualdatamodel::resolve()
+{
+ QFETCH(QUrl, source);
+ QFETCH(QString, setupExpression);
+ QFETCH(QString, resolveExpression);
+ QFETCH(int, unresolvedCount);
+ QFETCH(int, modelCount);
+ QFETCH(int, visualCount);
+ QFETCH(int, index);
+ QFETCH(bool, inItems);
+ QFETCH(bool, persisted);
+ QFETCH(bool, visible);
+ QFETCH(bool, selected);
+ QFETCH(bool, modelData);
+ QFETCH(QString, property);
+ QFETCH(QStringList, propertyData);
+
+ QQuickWindow window;
+
+ QQmlComponent component(&engine);
+ component.loadUrl(source);
+ QScopedPointer<QObject> object(component.create());
+ QQuickListView *listView = qobject_cast<QQuickListView *>(object.data());
+ QVERIFY(listView);
+ listView->setParentItem(window.contentItem());
+
+ QQuickItem *contentItem = listView->contentItem();
+ QVERIFY(contentItem);
+
+ QObject *visualModel = listView->findChild<QObject *>("visualModel");
+ QVERIFY(visualModel);
+
+ evaluate<void>(visualModel, setupExpression);
+ QCOMPARE(evaluate<int>(listView, "count"), unresolvedCount);
+
+ evaluate<void>(visualModel, resolveExpression);
+
+ QCOMPARE(evaluate<int>(listView, "count"), inItems ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "count"), inItems ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "items.count"), inItems ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "persistedItems.count"), persisted ? 1 : 0);
+ QCOMPARE(evaluate<int>(visualModel, "visibleItems.count"), visible ? visualCount : modelCount);
+ QCOMPARE(evaluate<int>(visualModel, "selectedItems.count"), selected ? 1 : 0);
+
+ QCOMPARE(propertyData.count(), visualCount);
+ for (int i = 0; i < visualCount; ++i) {
+ int modelIndex = i;
+
+ const int itemsIndex = inItems || i <= index ? i : i - 1;
+ QString get;
+
+ if (i != index) {
+ get = QString("items.get(%1)").arg(itemsIndex);
+
+ QQuickItem *item = findItem<QQuickItem>(contentItem, "delegate", modelIndex);
+ QVERIFY(item);
+
+ QCOMPARE(evaluate<int>(item, "test1"), modelIndex);
+ QCOMPARE(evaluate<int>(item, "test2"), modelIndex);
+ QCOMPARE(evaluate<QString>(item, "test3"), propertyData.at(i));
+ QCOMPARE(evaluate<QString>(item, "test4"), propertyData.at(i));
+
+ if (modelData) {
+ QCOMPARE(evaluate<QString>(item, "test5"), propertyData.at(i));
+ QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(i));
+ }
+
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), false);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
+
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), itemsIndex);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), persisted && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), visible || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), selected && i > index ? 1 : 0);
+ } else if (inItems) {
+ get = QString("items.get(%1)").arg(index);
+ } else if (persisted) {
+ get = "persistedItems.get(0)";
+ } else if (visible) {
+ get = QString("visibleItems.get(%1)").arg(index);
+ } else if (selected) {
+ get = "selectedItems.get(0)";
+ } else {
+ continue;
+ }
+
+ QCOMPARE(evaluate<int>(visualModel, get + ".model.index"), modelIndex);
+
+ QCOMPARE(evaluate<QString>(visualModel, get + ".model." + property), propertyData.at(i));
+
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inItems"), inItems || i != index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inPersistedItems"), persisted && i == index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inVisible"), visible || i != index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".inSelected"), selected && i == index);
+ QCOMPARE(evaluate<bool>(visualModel, get + ".isUnresolved"), false);
+
+ QCOMPARE(evaluate<int>(visualModel, get + ".itemsIndex"), inItems || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(visualModel, get + ".persistedItemsIndex"), persisted && i > index ? 1 : 0);
+ QCOMPARE(evaluate<int>(visualModel, get + ".visibleIndex"), visible || i <= index ? i : i - 1);
+ QCOMPARE(evaluate<int>(visualModel, get + ".selectedIndex"), selected && i > index ? 1 : 0);
+ }
+
+ QObject *item = 0;
+
+ if (inItems)
+ item = evaluate<QObject *>(visualModel, QString("items.create(%1)").arg(index));
+ else if (persisted)
+ item = evaluate<QObject *>(visualModel, QString("persistedItems.create(%1)").arg(0));
+ else if (visible)
+ item = evaluate<QObject *>(visualModel, QString("visibleItems.create(%1)").arg(index));
+ else if (selected)
+ item = evaluate<QObject *>(visualModel, QString("selectedItems.create(%1)").arg(0));
+ else
+ return;
+
+ QVERIFY(item);
+
+ QCOMPARE(evaluate<int>(item, "test1"), index);
+ QCOMPARE(evaluate<int>(item, "test2"), index);
+ QCOMPARE(evaluate<QString>(item, "test3"), propertyData.at(index));
+ QCOMPARE(evaluate<QString>(item, "test4"), propertyData.at(index));
+
+ if (modelData) {
+ QCOMPARE(evaluate<QString>(item, "test5"), propertyData.at(index));
+ QCOMPARE(evaluate<QString>(item, "test6"), propertyData.at(index));
+ }
+
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inItems"), inItems);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inPersistedItems"), true);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inVisible"), visible);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.inSelected"), selected);
+ QCOMPARE(evaluate<bool>(item, "delegate.VisualDataModel.isUnresolved"), false);
+
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.itemsIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.persistedItemsIndex"), 0);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.visibleIndex"), index);
+ QCOMPARE(evaluate<int>(item, "delegate.VisualDataModel.selectedIndex"), 0);
+}
+
+void tst_qquickvisualdatamodel::warnings_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<QString>("warning");
+ QTest::addColumn<int>("count");
+
+ QTest::newRow("insert < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.insert(-2, {\"number\": \"eight\"})")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
+ << 4;
+
+ QTest::newRow("insert > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.insert(8, {\"number\": \"eight\"})")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("insert: index out of range"))
+ << 4;
+
+ QTest::newRow("create < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.create(-2, {\"number\": \"eight\"})")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
+ << 4;
+
+ QTest::newRow("create > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.create(8, {\"number\": \"eight\"})")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("create: index out of range"))
+ << 4;
+
+ QTest::newRow("resolve from < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.resolve(-2, 3)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
+ << 4;
+
+ QTest::newRow("resolve from > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.resolve(8, 3)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index out of range"))
+ << 4;
+
+ QTest::newRow("resolve to < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.resolve(3, -2)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
+ << 4;
+
+ QTest::newRow("resolve to > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.resolve(3, 8)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index out of range"))
+ << 4;
+
+ QTest::newRow("resolve from invalid index")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.resolve(\"two\", 3)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from index invalid"))
+ << 4;
+
+ QTest::newRow("resolve to invalid index")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.resolve(3, \"two\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to index invalid"))
+ << 4;
+
+ QTest::newRow("resolve already resolved item")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.resolve(3, 2)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: from is not an unresolved item"))
+ << 4;
+
+ QTest::newRow("resolve already resolved item")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("{ items.insert(0, {\"number\": \"eight\"});"
+ "items.insert(1, {\"number\": \"seven\"});"
+ "items.resolve(0, 1)}")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("resolve: to is not a model item"))
+ << 6;
+
+ QTest::newRow("remove index < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.remove(-2, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
+ << 4;
+
+ QTest::newRow("remove index == length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.remove(4, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
+ << 4;
+
+ QTest::newRow("remove index > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.remove(9, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: index out of range"))
+ << 4;
+
+ QTest::newRow("remove invalid index")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.remove(\"nine\", 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid index"))
+ << 4;
+
+ QTest::newRow("remove count < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.remove(1, -2)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
+ << 4;
+
+ QTest::newRow("remove index + count > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.remove(2, 4, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("remove: invalid count"))
+ << 4;
+
+ QTest::newRow("addGroups index < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.addGroups(-2, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("addGroups index == length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.addGroups(4, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("addGroups index > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.addGroups(9, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("addGroups count < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.addGroups(1, -2, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
+ << 4;
+
+ QTest::newRow("addGroups index + count > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.addGroups(2, 4, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("addGroups: invalid count"))
+ << 4;
+
+ QTest::newRow("removeGroups index < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.removeGroups(-2, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("removeGroups index == length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.removeGroups(4, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("removeGroups index > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.removeGroups(9, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("removeGroups count < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.removeGroups(1, -2, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
+ << 4;
+
+ QTest::newRow("removeGroups index + count > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.removeGroups(2, 4, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("removeGroups: invalid count"))
+ << 4;
+
+ QTest::newRow("setGroups index < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.setGroups(-2, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("setGroups index == length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.setGroups(4, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("setGroups index > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.setGroups(9, 1, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: index out of range"))
+ << 4;
+
+ QTest::newRow("setGroups count < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.setGroups(1, -2, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
+ << 4;
+
+ QTest::newRow("setGroups index + count > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.setGroups(2, 4, \"selected\")")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("setGroups: invalid count"))
+ << 4;
+
+ QTest::newRow("move from < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(-2, 1, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << 4;
+
+ QTest::newRow("move from == length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(4, 1, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << 4;
+
+ QTest::newRow("move from > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(9, 1, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << 4;
+
+ QTest::newRow("move invalid from")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(\"nine\", 1, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid from index"))
+ << 4;
+
+ QTest::newRow("move to < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(1, -2, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
+ << 4;
+
+ QTest::newRow("move to == length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(1, 4, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
+ << 4;
+
+ QTest::newRow("move to > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(1, 9, 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: to index out of range"))
+ << 4;
+
+ QTest::newRow("move invalid to")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(1, \"nine\", 1)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid to index"))
+ << 4;
+
+ QTest::newRow("move count < 0")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(1, 1, -2)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: invalid count"))
+ << 4;
+
+ QTest::newRow("move from + count > length")
+ << testFileUrl("listmodelproperties.qml")
+ << QString("items.move(2, 1, 4)")
+ << ("<Unknown File>: QML VisualDataGroup: " + QQmlDelegateModelGroup::tr("move: from index out of range"))
+ << 4;
+}
+
+void tst_qquickvisualdatamodel::warnings()
+{
+ QFETCH(QUrl, source);
+ QFETCH(QString, expression);
+ QFETCH(QString, warning);
+ QFETCH(int, count);
+
+ QQuickWindow window;
+
+ QQmlComponent component(&engine);
+ component.loadUrl(source);
+ QScopedPointer<QObject> object(component.create());
+ QQuickListView *listView = qobject_cast<QQuickListView *>(object.data());
+ QVERIFY(listView);
+ listView->setParentItem(window.contentItem());
+
+ QQuickItem *contentItem = listView->contentItem();
+ QVERIFY(contentItem);
+
+ QObject *visualModel = evaluate<QObject *>(listView, "model");
+ QVERIFY(visualModel);
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
+
+ evaluate<void>(visualModel, expression);
+ QCOMPARE(evaluate<int>(listView, "count"), count);
+}
+
+void tst_qquickvisualdatamodel::invalidAttachment()
+{
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("invalidAttachment.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object);
+ QCOMPARE(component.errors().count(), 0);
+
+ QVariant property = object->property("invalidVdm");
+ QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>());
+ QVERIFY(!property.value<QQmlDelegateModel *>());
+
+ QQuickItem *item = findItem<QQuickItem>(static_cast<QQuickItem *>(object.data()), "delegate");
+ QVERIFY(item);
+
+ property = item->property("validVdm");
+ QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>());
+ QVERIFY(property.value<QQmlDelegateModel *>());
+
+ property = item->property("invalidVdm");
+ QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>());
+ QVERIFY(!property.value<QQmlDelegateModel *>());
+}
+
+void tst_qquickvisualdatamodel::asynchronousInsert_data()
+{
+ QTest::addColumn<int>("requestIndex");
+ QTest::addColumn<int>("insertIndex");
+ QTest::addColumn<int>("insertCount");
+ QTest::addColumn<int>("completeIndex");
+
+ QTest::newRow("insert before") << 4 << 1 << 3 << 7;
+ QTest::newRow("insert after") << 4 << 6 << 3 << 4;
+ QTest::newRow("insert at") << 4 << 4 << 3 << 7;
+}
+
+void tst_qquickvisualdatamodel::asynchronousInsert()
+{
+ QFETCH(int, requestIndex);
+ QFETCH(int, insertIndex);
+ QFETCH(int, insertCount);
+ QFETCH(int, completeIndex);
+
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+
+ QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QaimModel model;
+ for (int i = 0; i < 8; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
+ QVERIFY(visualModel);
+
+ ItemRequester requester;
+ connect(visualModel, SIGNAL(initItem(int,QObject*)), &requester, SLOT(initItem(int,QObject*)));
+ connect(visualModel, SIGNAL(createdItem(int,QObject*)), &requester, SLOT(createdItem(int,QObject*)));
+ connect(visualModel, SIGNAL(destroyingItem(QObject*)), &requester, SLOT(destroyingItem(QObject*)));
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
+ QVERIFY(!item);
+
+ QVERIFY(!requester.itemInitialized);
+ QVERIFY(!requester.itemCreated);
+ QVERIFY(!requester.itemDestroyed);
+
+ QList<QPair<QString, QString> > newItems;
+ for (int i = 0; i < insertCount; i++)
+ newItems.append(qMakePair(QLatin1String("New item") + QString::number(i), QString(QLatin1String(""))));
+ model.insertItems(insertIndex, newItems);
+
+ item = qobject_cast<QQuickItem*>(visualModel->object(completeIndex, false));
+ QVERIFY(item);
+
+ QCOMPARE(requester.itemInitialized, item);
+ QCOMPARE(requester.indexInitialized, completeIndex);
+ QCOMPARE(requester.itemCreated, item);
+ QCOMPARE(requester.indexCreated, completeIndex);
+ QVERIFY(!requester.itemDestroyed);
+
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+
+ visualModel->release(item);
+
+ QCOMPARE(requester.itemDestroyed, item);
+}
+
+void tst_qquickvisualdatamodel::asynchronousRemove_data()
+{
+ QTest::addColumn<int>("requestIndex");
+ QTest::addColumn<int>("removeIndex");
+ QTest::addColumn<int>("removeCount");
+ QTest::addColumn<int>("completeIndex");
+
+ QTest::newRow("remove before") << 4 << 1 << 3 << 1;
+ QTest::newRow("remove after") << 4 << 6 << 2 << 4;
+ QTest::newRow("remove requested") << 4 << 4 << 3 << -1;
+}
+
+void tst_qquickvisualdatamodel::asynchronousRemove()
+{
+ QFETCH(int, requestIndex);
+ QFETCH(int, removeIndex);
+ QFETCH(int, removeCount);
+ QFETCH(int, completeIndex);
+
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+
+ QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QaimModel model;
+ for (int i = 0; i < 8; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
+ QVERIFY(visualModel);
+
+ ItemRequester requester;
+ connect(visualModel, SIGNAL(initItem(int,QObject*)), &requester, SLOT(initItem(int,QObject*)));
+ connect(visualModel, SIGNAL(createdItem(int,QObject*)), &requester, SLOT(createdItem(int,QObject*)));
+ connect(visualModel, SIGNAL(destroyingItem(QObject*)), &requester, SLOT(destroyingItem(QObject*)));
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
+ QVERIFY(!item);
+
+ QVERIFY(!requester.itemInitialized);
+ QVERIFY(!requester.itemCreated);
+ QVERIFY(!requester.itemDestroyed);
+
+ model.removeItems(removeIndex, removeCount);
+
+ if (completeIndex == -1) {
+ QElapsedTimer timer;
+ timer.start();
+ do {
+ controller.incubateFor(50);
+ } while (timer.elapsed() < 1000 && controller.incubatingObjectCount() > 0);
+
+ QVERIFY(requester.itemInitialized);
+ QCOMPARE(requester.itemCreated, requester.itemInitialized);
+ QCOMPARE(requester.itemDestroyed, requester.itemInitialized);
+ } else {
+ item = qobject_cast<QQuickItem*>(visualModel->object(completeIndex, false));
+ QVERIFY(item);
+
+ QCOMPARE(requester.itemInitialized, item);
+ QCOMPARE(requester.indexInitialized, completeIndex);
+ QCOMPARE(requester.itemCreated, item);
+ QCOMPARE(requester.indexCreated, completeIndex);
+ QVERIFY(!requester.itemDestroyed);
+
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+
+ visualModel->release(item);
+
+ QCOMPARE(requester.itemDestroyed, item);
+ }
+}
+
+void tst_qquickvisualdatamodel::asynchronousMove_data()
+{
+ QTest::addColumn<int>("requestIndex");
+ QTest::addColumn<int>("from");
+ QTest::addColumn<int>("to");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<int>("completeIndex");
+
+ QTest::newRow("move before") << 4 << 1 << 0 << 3 << 4;
+ QTest::newRow("move after") << 4 << 6 << 5 << 2 << 4;
+ QTest::newRow("move requested") << 4 << 4 << 3 << 2 << 3;
+ QTest::newRow("move before to after") << 4 << 1 << 4 << 3 << 1;
+ QTest::newRow("move after to before") << 4 << 6 << 2 << 2 << 6;
+}
+
+void tst_qquickvisualdatamodel::asynchronousMove()
+{
+ QFETCH(int, requestIndex);
+ QFETCH(int, from);
+ QFETCH(int, to);
+ QFETCH(int, count);
+ QFETCH(int, completeIndex);
+
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+
+ QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QaimModel model;
+ for (int i = 0; i < 8; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
+ QVERIFY(visualModel);
+
+ ItemRequester requester;
+ connect(visualModel, SIGNAL(initItem(int,QObject*)), &requester, SLOT(initItem(int,QObject*)));
+ connect(visualModel, SIGNAL(createdItem(int,QObject*)), &requester, SLOT(createdItem(int,QObject*)));
+ connect(visualModel, SIGNAL(destroyingItem(QObject*)), &requester, SLOT(destroyingItem(QObject*)));
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
+ QVERIFY(!item);
+
+ QVERIFY(!requester.itemInitialized);
+ QVERIFY(!requester.itemCreated);
+ QVERIFY(!requester.itemDestroyed);
+
+ model.moveItems(from, to, count);
+
+ item = qobject_cast<QQuickItem*>(visualModel->object(completeIndex, false));
+ QVERIFY(item);
+
+
+ QCOMPARE(requester.itemInitialized, item);
+ QCOMPARE(requester.indexInitialized, completeIndex);
+ QCOMPARE(requester.itemCreated, item);
+ QCOMPARE(requester.indexCreated, completeIndex);
+ QVERIFY(!requester.itemDestroyed);
+
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+
+ visualModel->release(item);
+
+ QCOMPARE(requester.itemDestroyed, item);
+}
+
+void tst_qquickvisualdatamodel::asynchronousCancel()
+{
+ const int requestIndex = 4;
+
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+
+ QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
+
+ QaimModel model;
+ for (int i = 0; i < 8; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create());
+ QVERIFY(visualModel);
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(requestIndex, true));
+ QVERIFY(!item);
+ QCOMPARE(controller.incubatingObjectCount(), 1);
+
+ visualModel->cancel(requestIndex);
+ QCOMPARE(controller.incubatingObjectCount(), 0);
+}
+
+void tst_qquickvisualdatamodel::invalidContext()
+{
+ QQmlEngine engine;
+ QaimModel model;
+ for (int i = 0; i < 8; i++)
+ model.addItem("Original item" + QString::number(i), "");
+
+ engine.rootContext()->setContextProperty("myModel", &model);
+
+ QScopedPointer<QQmlContext> context(new QQmlContext(engine.rootContext()));
+
+ QQmlComponent c(&engine, testFileUrl("visualdatamodel.qml"));
+
+
+ QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel*>(c.create(context.data()));
+ QVERIFY(visualModel);
+
+ QQuickItem *item = qobject_cast<QQuickItem*>(visualModel->object(4, false));
+ QVERIFY(item);
+ visualModel->release(item);
+
+ delete context.take();
+
+ model.insertItem(4, "new item", "");
+
+ item = qobject_cast<QQuickItem*>(visualModel->object(4, false));
+ QVERIFY(!item);
+}
+
+QTEST_MAIN(tst_qquickvisualdatamodel)
+
+#include "tst_qquickvisualdatamodel.moc"
diff --git a/tests/auto/quick/qquickwindow/data/AnimationsWhileHidden.qml b/tests/auto/quick/qquickwindow/data/AnimationsWhileHidden.qml
new file mode 100644
index 0000000000..e95b029210
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/AnimationsWhileHidden.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Window.Window
+{
+ id: win
+ visible: true
+ width: 250
+ height: 250
+
+ SequentialAnimation {
+ PauseAnimation { duration: 500 }
+ PropertyAction { target: win; property: "visible"; value: true }
+ loops: Animation.Infinite
+ running: true
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/data/Headless.qml b/tests/auto/quick/qquickwindow/data/Headless.qml
new file mode 100644
index 0000000000..f4cc572cc6
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/Headless.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Windows
+
+Windows.Window {
+
+ width: 300
+ height: 200
+
+ Text {
+ anchors.left: parent.left
+ anchors.top: parent.top
+ text: "Testing headless mode"
+ }
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 100
+ height: 50
+ rotation: -30
+ gradient: Gradient {
+ GradientStop { position: 0; color: "lightsteelblue" }
+ GradientStop { position: 1; color: "black" }
+ }
+ }
+
+ Image {
+ source: "colors.png"
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ }
+
+}
diff --git a/tests/auto/quick/qquickwindow/data/colors.png b/tests/auto/quick/qquickwindow/data/colors.png
new file mode 100644
index 0000000000..dfb62f3d64
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/colors.png
Binary files differ
diff --git a/tests/auto/quick/qquickwindow/data/focus.qml b/tests/auto/quick/qquickwindow/data/focus.qml
new file mode 100644
index 0000000000..899b999cdc
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/focus.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Window.Window {
+
+ width: 400
+ height: 300
+
+ Item {
+ objectName: "item1"
+ }
+ Item {
+ objectName: "item2"
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/data/ownershipRootItem.qml b/tests/auto/quick/qquickwindow/data/ownershipRootItem.qml
new file mode 100644
index 0000000000..03400ba673
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/ownershipRootItem.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+import Test 1.0
+
+Window.Window {
+
+ width: 100
+ height: 100
+
+ RootItemAccessor {
+ id:accessor
+ objectName:"accessor"
+ Component.onCompleted:accessor.contentItem();
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/data/showHideAnimate.qml b/tests/auto/quick/qquickwindow/data/showHideAnimate.qml
new file mode 100644
index 0000000000..e83910c5a5
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/showHideAnimate.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ NumberAnimation on opacity { from: 0; to: 1; duration: 100; loops: Animation.Infinite }
+}
diff --git a/tests/auto/quick/qquickwindow/data/window.qml b/tests/auto/quick/qquickwindow/data/window.qml
new file mode 100644
index 0000000000..d79d5161b5
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/window.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Window.Window {
+ color: "#00FF00"
+ Item {
+ objectName: "item"
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/qquickwindow.pro b/tests/auto/quick/qquickwindow/qquickwindow.pro
new file mode 100644
index 0000000000..b1fc5cd4f2
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/qquickwindow.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_qquickwindow
+SOURCES += tst_qquickwindow.cpp
+
+include (../../shared/util.pri)
+
+macx:CONFIG -= app_bundle
+
+QT += core-private gui-private qml-private quick-private v8-private testlib
+
+TESTDATA = data/*
+
+OTHER_FILES += \
+ data/AnimationsWhileHidden.qml \
+ data/Headless.qml \
+ data/showHideAnimate.qml
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
new file mode 100644
index 0000000000..2d3c8f7ca7
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -0,0 +1,1405 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QDebug>
+#include <QTouchEvent>
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickWindow>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlComponent>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include "../../shared/util.h"
+#include <QSignalSpy>
+#include <qpa/qwindowsysteminterface.h>
+#include <private/qquickwindow_p.h>
+#include <private/qguiapplication_p.h>
+
+struct TouchEventData {
+ QEvent::Type type;
+ QWidget *widget;
+ QWindow *window;
+ Qt::TouchPointStates states;
+ QList<QTouchEvent::TouchPoint> touchPoints;
+};
+
+static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p, const QPointF &lastPoint = QPointF())
+{
+ QPointF last = lastPoint.isNull() ? p : lastPoint;
+
+ QTouchEvent::TouchPoint tp;
+
+ tp.setPos(p);
+ tp.setLastPos(last);
+ tp.setScenePos(item->mapToScene(p));
+ tp.setLastScenePos(item->mapToScene(last));
+ tp.setScreenPos(item->window()->mapToGlobal(tp.scenePos().toPoint()));
+ tp.setLastScreenPos(item->window()->mapToGlobal(tp.lastScenePos().toPoint()));
+ return tp;
+}
+
+static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states = 0,
+ const QList<QTouchEvent::TouchPoint>& touchPoints = QList<QTouchEvent::TouchPoint>())
+{
+ TouchEventData d = { type, 0, w, states, touchPoints };
+ return d;
+}
+static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states, const QTouchEvent::TouchPoint &touchPoint)
+{
+ QList<QTouchEvent::TouchPoint> points;
+ points << touchPoint;
+ return makeTouchData(type, w, states, points);
+}
+
+#define COMPARE_TOUCH_POINTS(tp1, tp2) \
+{ \
+ QCOMPARE(tp1.pos(), tp2.pos()); \
+ QCOMPARE(tp1.lastPos(), tp2.lastPos()); \
+ QCOMPARE(tp1.scenePos(), tp2.scenePos()); \
+ QCOMPARE(tp1.lastScenePos(), tp2.lastScenePos()); \
+ QCOMPARE(tp1.screenPos(), tp2.screenPos()); \
+ QCOMPARE(tp1.lastScreenPos(), tp2.lastScreenPos()); \
+}
+
+#define COMPARE_TOUCH_DATA(d1, d2) \
+{ \
+ QCOMPARE((int)d1.type, (int)d2.type); \
+ QCOMPARE(d1.widget, d2.widget); \
+ QCOMPARE((int)d1.states, (int)d2.states); \
+ QCOMPARE(d1.touchPoints.count(), d2.touchPoints.count()); \
+ for (int i=0; i<d1.touchPoints.count(); i++) { \
+ COMPARE_TOUCH_POINTS(d1.touchPoints[i], d2.touchPoints[i]); \
+ } \
+}
+
+
+class RootItemAccessor : public QQuickItem
+{
+ Q_OBJECT
+public:
+ RootItemAccessor()
+ : m_rootItemDestroyed(false)
+ , m_rootItem(0)
+ {
+ }
+ Q_INVOKABLE QQuickItem *contentItem()
+ {
+ if (!m_rootItem) {
+ QQuickWindowPrivate *c = QQuickWindowPrivate::get(window());
+ m_rootItem = c->contentItem;
+ QObject::connect(m_rootItem, SIGNAL(destroyed()), this, SLOT(rootItemDestroyed()));
+ }
+ return m_rootItem;
+ }
+ bool isRootItemDestroyed() {return m_rootItemDestroyed;}
+public slots:
+ void rootItemDestroyed() {
+ m_rootItemDestroyed = true;
+ }
+
+private:
+ bool m_rootItemDestroyed;
+ QQuickItem *m_rootItem;
+};
+
+class TestTouchItem : public QQuickRectangle
+{
+ Q_OBJECT
+public:
+ TestTouchItem(QQuickItem *parent = 0)
+ : QQuickRectangle(parent), acceptTouchEvents(true), acceptMouseEvents(true),
+ mousePressId(0),
+ spinLoopWhenPressed(false), touchEventCount(0)
+ {
+ border()->setWidth(1);
+ setAcceptedMouseButtons(Qt::LeftButton);
+ setFiltersChildMouseEvents(true);
+ }
+
+ void reset() {
+ acceptTouchEvents = acceptMouseEvents = true;
+ setEnabled(true);
+ setVisible(true);
+
+ lastEvent = makeTouchData(QEvent::None, window(), 0, QList<QTouchEvent::TouchPoint>());//CHECK_VALID
+
+ lastVelocity = lastVelocityFromMouseMove = QVector2D();
+ lastMousePos = QPointF();
+ lastMouseCapabilityFlags = 0;
+ }
+
+ static void clearMousePressCounter()
+ {
+ mousePressNum = mouseMoveNum = mouseReleaseNum = 0;
+ }
+
+ void clearTouchEventCounter()
+ {
+ touchEventCount = 0;
+ }
+
+ bool acceptTouchEvents;
+ bool acceptMouseEvents;
+ TouchEventData lastEvent;
+ int mousePressId;
+ bool spinLoopWhenPressed;
+ int touchEventCount;
+ QVector2D lastVelocity;
+ QVector2D lastVelocityFromMouseMove;
+ QPointF lastMousePos;
+ int lastMouseCapabilityFlags;
+
+ void touchEvent(QTouchEvent *event) {
+ if (!acceptTouchEvents) {
+ event->ignore();
+ return;
+ }
+ ++touchEventCount;
+ lastEvent = makeTouchData(event->type(), event->window(), event->touchPointStates(), event->touchPoints());
+ if (event->device()->capabilities().testFlag(QTouchDevice::Velocity) && !event->touchPoints().isEmpty()) {
+ lastVelocity = event->touchPoints().first().velocity();
+ } else {
+ lastVelocity = QVector2D();
+ }
+ if (spinLoopWhenPressed && event->touchPointStates().testFlag(Qt::TouchPointPressed)) {
+ QCoreApplication::processEvents();
+ }
+ }
+
+ void mousePressEvent(QMouseEvent *e) {
+ if (!acceptMouseEvents) {
+ e->ignore();
+ return;
+ }
+ mousePressId = ++mousePressNum;
+ lastMousePos = e->pos();
+ lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
+ }
+
+ void mouseMoveEvent(QMouseEvent *e) {
+ if (!acceptMouseEvents) {
+ e->ignore();
+ return;
+ }
+ ++mouseMoveNum;
+ lastVelocityFromMouseMove = QGuiApplicationPrivate::mouseEventVelocity(e);
+ lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
+ lastMousePos = e->pos();
+ }
+
+ void mouseReleaseEvent(QMouseEvent *e) {
+ if (!acceptMouseEvents) {
+ e->ignore();
+ return;
+ }
+ ++mouseReleaseNum;
+ lastMousePos = e->pos();
+ lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
+ }
+
+ bool childMouseEventFilter(QQuickItem *, QEvent *event) {
+ // TODO Is it a bug if a QTouchEvent comes here?
+ if (event->type() == QEvent::MouseButtonPress)
+ mousePressId = ++mousePressNum;
+ return false;
+ }
+
+ static int mousePressNum, mouseMoveNum, mouseReleaseNum;
+};
+
+int TestTouchItem::mousePressNum = 0;
+int TestTouchItem::mouseMoveNum = 0;
+int TestTouchItem::mouseReleaseNum = 0;
+
+class ConstantUpdateItem : public QQuickItem
+{
+Q_OBJECT
+public:
+ ConstantUpdateItem(QQuickItem *parent = 0) : QQuickItem(parent), iterations(0) {setFlag(ItemHasContents);}
+
+ int iterations;
+protected:
+ QSGNode* updatePaintNode(QSGNode *, UpdatePaintNodeData *){
+ iterations++;
+ update();
+ return 0;
+ }
+};
+
+class tst_qquickwindow : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void initTestCase()
+ {
+ QQmlDataTest::initTestCase();
+ touchDevice = new QTouchDevice;
+ touchDevice->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(touchDevice);
+ touchDeviceWithVelocity = new QTouchDevice;
+ touchDeviceWithVelocity->setType(QTouchDevice::TouchScreen);
+ touchDeviceWithVelocity->setCapabilities(QTouchDevice::Position | QTouchDevice::Velocity);
+ QWindowSystemInterface::registerTouchDevice(touchDeviceWithVelocity);
+ }
+
+
+ void constantUpdates();
+ void constantUpdatesOnWindow_data();
+ void constantUpdatesOnWindow();
+ void mouseFiltering();
+ void headless();
+ void noUpdateWhenNothingChanges();
+
+ void touchEvent_basic();
+ void touchEvent_propagation();
+ void touchEvent_propagation_data();
+ void touchEvent_cancel();
+ void touchEvent_reentrant();
+ void touchEvent_velocity();
+
+ void mouseFromTouch_basic();
+
+ void clearWindow();
+
+ void qmlCreation();
+ void clearColor();
+
+ void grab();
+ void multipleWindows();
+
+ void animationsWhileHidden();
+
+ void focusObject();
+
+ void ignoreUnhandledMouseEvents();
+
+ void ownershipRootItem();
+
+ void hideThenDelete_data();
+ void hideThenDelete();
+
+ void showHideAnimate();
+
+ void testExpose();
+
+#ifndef QT_NO_CURSOR
+ void cursor();
+#endif
+
+private:
+ QTouchDevice *touchDevice;
+ QTouchDevice *touchDeviceWithVelocity;
+};
+
+//If the item calls update inside updatePaintNode, it should schedule another update
+void tst_qquickwindow::constantUpdates()
+{
+ QQuickWindow window;
+ window.resize(250, 250);
+ ConstantUpdateItem item(window.contentItem());
+ window.show();
+ QTRY_VERIFY(item.iterations > 60);
+}
+
+void tst_qquickwindow::constantUpdatesOnWindow_data()
+{
+ QTest::addColumn<bool>("blockedGui");
+ QTest::addColumn<QByteArray>("signal");
+
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+ window.show();
+ QTest::qWaitForWindowExposed(&window);
+ bool threaded = window.openglContext()->thread() != QGuiApplication::instance()->thread();
+
+ if (threaded) {
+ QTest::newRow("blocked, beforeSync") << true << QByteArray(SIGNAL(beforeSynchronizing()));
+ QTest::newRow("blocked, beforeRender") << true << QByteArray(SIGNAL(beforeRendering()));
+ QTest::newRow("blocked, afterRender") << true << QByteArray(SIGNAL(afterRendering()));
+ QTest::newRow("blocked, swapped") << true << QByteArray(SIGNAL(frameSwapped()));
+ }
+ QTest::newRow("unblocked, beforeSync") << false << QByteArray(SIGNAL(beforeSynchronizing()));
+ QTest::newRow("unblocked, beforeRender") << false << QByteArray(SIGNAL(beforeRendering()));
+ QTest::newRow("unblocked, afterRender") << false << QByteArray(SIGNAL(afterRendering()));
+ QTest::newRow("unblocked, swapped") << false << QByteArray(SIGNAL(frameSwapped()));
+}
+
+void tst_qquickwindow::constantUpdatesOnWindow()
+{
+ QSKIP("This test fails frequently on the present overworked CI mac machines");
+ QFETCH(bool, blockedGui);
+ QFETCH(QByteArray, signal);
+
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+
+ connect(&window, signal.constData(), &window, SLOT(update()), Qt::DirectConnection);
+ window.show();
+ QTRY_VERIFY(window.isExposed());
+
+ QSignalSpy catcher(&window, SIGNAL(frameSwapped()));
+ if (blockedGui)
+ QTest::qSleep(1000);
+ else {
+ window.update();
+ QTest::qWait(1000);
+ }
+ window.hide();
+
+ // We should expect 60, but under loaded conditions we could be skipping
+ // frames, so don't expect too much.
+ QVERIFY(catcher.size() > 10);
+}
+
+void tst_qquickwindow::touchEvent_basic()
+{
+ TestTouchItem::clearMousePressCounter();
+
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ TestTouchItem *bottomItem = new TestTouchItem(window->contentItem());
+ bottomItem->setObjectName("Bottom Item");
+ bottomItem->setSize(QSizeF(150, 150));
+
+ TestTouchItem *middleItem = new TestTouchItem(bottomItem);
+ middleItem->setObjectName("Middle Item");
+ middleItem->setPosition(QPointF(50, 50));
+ middleItem->setSize(QSizeF(150, 150));
+
+ TestTouchItem *topItem = new TestTouchItem(middleItem);
+ topItem->setObjectName("Top Item");
+ topItem->setPosition(QPointF(50, 50));
+ topItem->setSize(QSizeF(150, 150));
+
+ QPointF pos(10, 10);
+
+ // press single point
+ QTest::touchEvent(window, touchDevice).press(0, topItem->mapToScene(pos).toPoint(),window);
+ QTest::qWait(50);
+
+ QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
+
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty());
+ // At one point this was failing with kwin (KDE window manager) because window->setPosition(100, 100)
+ // would put the decorated window at that position rather than the window itself.
+ COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos)));
+ topItem->reset();
+
+ // press multiple points
+ QTest::touchEvent(window, touchDevice).press(0, topItem->mapToScene(pos).toPoint(),window)
+ .press(1, bottomItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1);
+ COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos)));
+ COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos)));
+ topItem->reset();
+ bottomItem->reset();
+
+ // touch point on top item moves to bottom item, but top item should still receive the event
+ QTest::touchEvent(window, touchDevice).press(0, topItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QTest::touchEvent(window, touchDevice).move(0, bottomItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
+ COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, Qt::TouchPointMoved,
+ makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos)));
+ topItem->reset();
+
+ // touch point on bottom item moves to top item, but bottom item should still receive the event
+ QTest::touchEvent(window, touchDevice).press(0, bottomItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QTest::touchEvent(window, touchDevice).move(0, topItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1);
+ COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, Qt::TouchPointMoved,
+ makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos), pos)));
+ bottomItem->reset();
+
+ // a single stationary press on an item shouldn't cause an event
+ QTest::touchEvent(window, touchDevice).press(0, topItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QTest::touchEvent(window, touchDevice).stationary(0)
+ .press(1, bottomItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); // received press only, not stationary
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1);
+ COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos)));
+ COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos)));
+ topItem->reset();
+ bottomItem->reset();
+ // cleanup: what is pressed must be released
+ // Otherwise you will get an assertion failure:
+ // ASSERT: "itemForTouchPointId.isEmpty()" in file items/qquickwindow.cpp
+ QTest::touchEvent(window, touchDevice).release(0, pos.toPoint(), window).release(1, pos.toPoint(), window);
+
+ // move touch point from top item to bottom, and release
+ QTest::touchEvent(window, touchDevice).press(0, topItem->mapToScene(pos).toPoint(),window);
+ QTest::qWait(50);
+ QTest::touchEvent(window, touchDevice).release(0, bottomItem->mapToScene(pos).toPoint(),window);
+ QTest::qWait(50);
+ QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
+ COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, Qt::TouchPointReleased,
+ makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos)));
+ topItem->reset();
+
+ // release while another point is pressed
+ QTest::touchEvent(window, touchDevice).press(0, topItem->mapToScene(pos).toPoint(),window)
+ .press(1, bottomItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QTest::touchEvent(window, touchDevice).move(0, bottomItem->mapToScene(pos).toPoint(), window);
+ QTest::qWait(50);
+ QTest::touchEvent(window, touchDevice).release(0, bottomItem->mapToScene(pos).toPoint(), window)
+ .stationary(1);
+ QTest::qWait(50);
+ QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1);
+ COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, Qt::TouchPointReleased,
+ makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos))));
+ COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos)));
+ topItem->reset();
+ bottomItem->reset();
+
+ delete topItem;
+ delete middleItem;
+ delete bottomItem;
+}
+
+void tst_qquickwindow::touchEvent_propagation()
+{
+ TestTouchItem::clearMousePressCounter();
+
+ QFETCH(bool, acceptTouchEvents);
+ QFETCH(bool, acceptMouseEvents);
+ QFETCH(bool, enableItem);
+ QFETCH(bool, showItem);
+
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ TestTouchItem *bottomItem = new TestTouchItem(window->contentItem());
+ bottomItem->setObjectName("Bottom Item");
+ bottomItem->setSize(QSizeF(150, 150));
+
+ TestTouchItem *middleItem = new TestTouchItem(bottomItem);
+ middleItem->setObjectName("Middle Item");
+ middleItem->setPosition(QPointF(50, 50));
+ middleItem->setSize(QSizeF(150, 150));
+
+ TestTouchItem *topItem = new TestTouchItem(middleItem);
+ topItem->setObjectName("Top Item");
+ topItem->setPosition(QPointF(50, 50));
+ topItem->setSize(QSizeF(150, 150));
+
+ QPointF pos(10, 10);
+ QPoint pointInBottomItem = bottomItem->mapToScene(pos).toPoint(); // (10, 10)
+ QPoint pointInMiddleItem = middleItem->mapToScene(pos).toPoint(); // (60, 60) overlaps with bottomItem
+ QPoint pointInTopItem = topItem->mapToScene(pos).toPoint(); // (110, 110) overlaps with bottom & top items
+
+ // disable topItem
+ topItem->acceptTouchEvents = acceptTouchEvents;
+ topItem->acceptMouseEvents = acceptMouseEvents;
+ topItem->setEnabled(enableItem);
+ topItem->setVisible(showItem);
+
+ // single touch to top item, should be received by middle item
+ QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window);
+ QTest::qWait(50);
+ QVERIFY(topItem->lastEvent.touchPoints.isEmpty());
+ QCOMPARE(middleItem->lastEvent.touchPoints.count(), 1);
+ QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty());
+ COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed,
+ makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos))));
+
+ // touch top and middle items, middle item should get both events
+ QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window)
+ .press(1, pointInMiddleItem, window);
+ QTest::qWait(50);
+ QVERIFY(topItem->lastEvent.touchPoints.isEmpty());
+ QCOMPARE(middleItem->lastEvent.touchPoints.count(), 2);
+ QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty());
+ COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed,
+ (QList<QTouchEvent::TouchPoint>() << makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos))
+ << makeTouchPoint(middleItem, pos) )));
+ middleItem->reset();
+
+ // disable middleItem as well
+ middleItem->acceptTouchEvents = acceptTouchEvents;
+ middleItem->acceptMouseEvents = acceptMouseEvents;
+ middleItem->setEnabled(enableItem);
+ middleItem->setVisible(showItem);
+
+ // touch top and middle items, bottom item should get all events
+ QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window)
+ .press(1, pointInMiddleItem, window);
+ QTest::qWait(50);
+ QVERIFY(topItem->lastEvent.touchPoints.isEmpty());
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 2);
+ COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed,
+ (QList<QTouchEvent::TouchPoint>() << makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos))
+ << makeTouchPoint(bottomItem, bottomItem->mapFromItem(middleItem, pos)) )));
+ bottomItem->reset();
+
+ // disable bottom item as well
+ bottomItem->acceptTouchEvents = acceptTouchEvents;
+ bottomItem->setEnabled(enableItem);
+ bottomItem->setVisible(showItem);
+
+ // no events should be received
+ QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window)
+ .press(1, pointInMiddleItem, window)
+ .press(2, pointInBottomItem, window);
+ QTest::qWait(50);
+ QVERIFY(topItem->lastEvent.touchPoints.isEmpty());
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty());
+
+ topItem->reset();
+ middleItem->reset();
+ bottomItem->reset();
+
+ // disable middle item, touch on top item
+ middleItem->acceptTouchEvents = acceptTouchEvents;
+ middleItem->setEnabled(enableItem);
+ middleItem->setVisible(showItem);
+ QTest::touchEvent(window, touchDevice).press(0, pointInTopItem, window);
+ QTest::qWait(50);
+ if (!enableItem || !showItem) {
+ // middle item is disabled or has 0 opacity, bottom item receives the event
+ QVERIFY(topItem->lastEvent.touchPoints.isEmpty());
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1);
+ COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed,
+ makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos))));
+ } else {
+ // middle item ignores event, sends it to the top item (top-most child)
+ QCOMPARE(topItem->lastEvent.touchPoints.count(), 1);
+ QVERIFY(middleItem->lastEvent.touchPoints.isEmpty());
+ QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty());
+ COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed,
+ makeTouchPoint(topItem, pos)));
+ }
+
+ delete topItem;
+ delete middleItem;
+ delete bottomItem;
+}
+
+void tst_qquickwindow::touchEvent_propagation_data()
+{
+ QTest::addColumn<bool>("acceptTouchEvents");
+ QTest::addColumn<bool>("acceptMouseEvents");
+ QTest::addColumn<bool>("enableItem");
+ QTest::addColumn<bool>("showItem");
+
+ QTest::newRow("disable events") << false << false << true << true;
+ QTest::newRow("disable item") << true << true << false << true;
+ QTest::newRow("hide item") << true << true << true << false;
+}
+
+void tst_qquickwindow::touchEvent_cancel()
+{
+ TestTouchItem::clearMousePressCounter();
+
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ TestTouchItem *item = new TestTouchItem(window->contentItem());
+ item->setPosition(QPointF(50, 50));
+ item->setSize(QSizeF(150, 150));
+
+ QPointF pos(10, 10);
+ QTest::touchEvent(window, touchDevice).press(0, item->mapToScene(pos).toPoint(),window);
+ QCoreApplication::processEvents();
+
+ QTRY_COMPARE(item->lastEvent.touchPoints.count(), 1);
+ TouchEventData d = makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(item,pos));
+ COMPARE_TOUCH_DATA(item->lastEvent, d);
+ item->reset();
+
+ QWindowSystemInterface::handleTouchCancelEvent(0, touchDevice);
+ QCoreApplication::processEvents();
+ d = makeTouchData(QEvent::TouchCancel, window);
+ COMPARE_TOUCH_DATA(item->lastEvent, d);
+
+ delete item;
+}
+
+void tst_qquickwindow::touchEvent_reentrant()
+{
+ TestTouchItem::clearMousePressCounter();
+
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ TestTouchItem *item = new TestTouchItem(window->contentItem());
+
+ item->spinLoopWhenPressed = true; // will call processEvents() from the touch handler
+
+ item->setPosition(QPointF(50, 50));
+ item->setSize(QSizeF(150, 150));
+ QPointF pos(60, 60);
+
+ // None of these should commit from the dtor.
+ QTest::QTouchEventSequence press = QTest::touchEvent(window, touchDevice, false).press(0, pos.toPoint(), window);
+ pos += QPointF(2, 2);
+ QTest::QTouchEventSequence move = QTest::touchEvent(window, touchDevice, false).move(0, pos.toPoint(), window);
+ QTest::QTouchEventSequence release = QTest::touchEvent(window, touchDevice, false).release(0, pos.toPoint(), window);
+
+ // Now commit (i.e. call QWindowSystemInterface::handleTouchEvent), but do not process the events yet.
+ press.commit(false);
+ move.commit(false);
+ release.commit(false);
+
+ QCoreApplication::processEvents();
+
+ QTRY_COMPARE(item->touchEventCount, 3);
+
+ delete item;
+}
+
+void tst_qquickwindow::touchEvent_velocity()
+{
+ TestTouchItem::clearMousePressCounter();
+
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QTest::qWait(10);
+
+ TestTouchItem *item = new TestTouchItem(window->contentItem());
+ item->setPosition(QPointF(50, 50));
+ item->setSize(QSizeF(150, 150));
+
+ QList<QWindowSystemInterface::TouchPoint> points;
+ QWindowSystemInterface::TouchPoint tp;
+ tp.id = 1;
+ tp.state = Qt::TouchPointPressed;
+ QPoint pos = window->mapToGlobal(item->mapToScene(QPointF(10, 10)).toPoint());
+ tp.area = QRectF(pos, QSizeF(4, 4));
+ points << tp;
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].state = Qt::TouchPointMoved;
+ points[0].area.adjust(5, 5, 5, 5);
+ QVector2D velocity(1.5, 2.5);
+ points[0].velocity = velocity;
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QCoreApplication::processEvents();
+ QCOMPARE(item->touchEventCount, 2);
+ QCOMPARE(item->lastEvent.touchPoints.count(), 1);
+ QCOMPARE(item->lastVelocity, velocity);
+
+ // Now have a transformation on the item and check if velocity and position are transformed accordingly.
+ item->setRotation(90); // clockwise
+ QMatrix4x4 transformMatrix;
+ transformMatrix.rotate(-90, 0, 0, 1); // counterclockwise
+ QVector2D transformedVelocity = transformMatrix.mapVector(velocity).toVector2D();
+ points[0].area.adjust(5, 5, 5, 5);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QCoreApplication::processEvents();
+ QCOMPARE(item->lastVelocity, transformedVelocity);
+ QPoint itemLocalPos = item->mapFromScene(window->mapFromGlobal(points[0].area.center().toPoint())).toPoint();
+ QPoint itemLocalPosFromEvent = item->lastEvent.touchPoints[0].pos().toPoint();
+ QCOMPARE(itemLocalPos, itemLocalPosFromEvent);
+
+ points[0].state = Qt::TouchPointReleased;
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QCoreApplication::processEvents();
+ delete item;
+}
+
+void tst_qquickwindow::mouseFromTouch_basic()
+{
+ // Turn off accepting touch events with acceptTouchEvents. This
+ // should result in sending mouse events generated from the touch
+ // with the new event propagation system.
+
+ TestTouchItem::clearMousePressCounter();
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QTest::qWait(10);
+
+ TestTouchItem *item = new TestTouchItem(window->contentItem());
+ item->setPosition(QPointF(50, 50));
+ item->setSize(QSizeF(150, 150));
+ item->acceptTouchEvents = false;
+
+ QList<QWindowSystemInterface::TouchPoint> points;
+ QWindowSystemInterface::TouchPoint tp;
+ tp.id = 1;
+ tp.state = Qt::TouchPointPressed;
+ QPoint pos = window->mapToGlobal(item->mapToScene(QPointF(10, 10)).toPoint());
+ tp.area = QRectF(pos, QSizeF(4, 4));
+ points << tp;
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].state = Qt::TouchPointMoved;
+ points[0].area.adjust(5, 5, 5, 5);
+ QVector2D velocity(1.5, 2.5);
+ points[0].velocity = velocity;
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].state = Qt::TouchPointReleased;
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QCoreApplication::processEvents();
+
+ // The item should have received a mouse press, move, and release.
+ QCOMPARE(item->mousePressNum, 1);
+ QCOMPARE(item->mouseMoveNum, 1);
+ QCOMPARE(item->mouseReleaseNum, 1);
+ QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(window->mapFromGlobal(points[0].area.center().toPoint())).toPoint());
+ QCOMPARE(item->lastVelocityFromMouseMove, velocity);
+ QVERIFY((item->lastMouseCapabilityFlags & QTouchDevice::Velocity) != 0);
+
+ // Now the same with a transformation.
+ item->setRotation(90); // clockwise
+ QMatrix4x4 transformMatrix;
+ transformMatrix.rotate(-90, 0, 0, 1); // counterclockwise
+ QVector2D transformedVelocity = transformMatrix.mapVector(velocity).toVector2D();
+ points[0].state = Qt::TouchPointPressed;
+ points[0].velocity = velocity;
+ points[0].area = QRectF(pos, QSizeF(4, 4));
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ points[0].state = Qt::TouchPointMoved;
+ points[0].area.adjust(5, 5, 5, 5);
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QCoreApplication::processEvents();
+ QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(window->mapFromGlobal(points[0].area.center().toPoint())).toPoint());
+ QCOMPARE(item->lastVelocityFromMouseMove, transformedVelocity);
+
+ points[0].state = Qt::TouchPointReleased;
+ QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
+ QCoreApplication::processEvents();
+ delete item;
+}
+
+void tst_qquickwindow::clearWindow()
+{
+ QQuickWindow *window = new QQuickWindow;
+ QQuickItem *item = new QQuickItem;
+ item->setParentItem(window->contentItem());
+
+ QVERIFY(item->window() == window);
+
+ delete window;
+
+ QVERIFY(item->window() == 0);
+
+ delete item;
+}
+
+void tst_qquickwindow::mouseFiltering()
+{
+ TestTouchItem::clearMousePressCounter();
+
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ TestTouchItem *bottomItem = new TestTouchItem(window->contentItem());
+ bottomItem->setObjectName("Bottom Item");
+ bottomItem->setSize(QSizeF(150, 150));
+
+ TestTouchItem *middleItem = new TestTouchItem(bottomItem);
+ middleItem->setObjectName("Middle Item");
+ middleItem->setPosition(QPointF(50, 50));
+ middleItem->setSize(QSizeF(150, 150));
+
+ TestTouchItem *topItem = new TestTouchItem(middleItem);
+ topItem->setObjectName("Top Item");
+ topItem->setPosition(QPointF(50, 50));
+ topItem->setSize(QSizeF(150, 150));
+
+ QPoint pos(100, 100);
+
+ QTest::mousePress(window, Qt::LeftButton, 0, pos);
+
+ // Mouse filtering propagates down the stack, so the
+ // correct order is
+ // 1. middleItem filters event
+ // 2. bottomItem filters event
+ // 3. topItem receives event
+ QTRY_COMPARE(middleItem->mousePressId, 1);
+ QTRY_COMPARE(bottomItem->mousePressId, 2);
+ QTRY_COMPARE(topItem->mousePressId, 3);
+}
+
+void tst_qquickwindow::qmlCreation()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("window.qml"));
+ QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+ QVERIFY(created);
+
+ QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
+ QVERIFY(window);
+ QCOMPARE(window->color(), QColor(Qt::green));
+
+ QQuickItem* item = window->findChild<QQuickItem*>("item");
+ QVERIFY(item);
+ QCOMPARE(item->window(), window);
+}
+
+void tst_qquickwindow::clearColor()
+{
+ //::grab examines rendering to make sure it works visually
+ QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+ window->resize(250, 250);
+ window->setPosition(100, 100);
+ window->setColor(Qt::blue);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QCOMPARE(window->color(), QColor(Qt::blue));
+}
+
+void tst_qquickwindow::grab()
+{
+ QQuickWindow window;
+ window.setColor(Qt::red);
+
+ window.resize(250, 250);
+ window.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ QImage content = window.grabWindow();
+ QCOMPARE(content.width(), window.width());
+ QCOMPARE(content.height(), window.height());
+ QCOMPARE((uint) content.convertToFormat(QImage::Format_RGB32).pixel(0, 0), (uint) 0xffff0000);
+}
+
+void tst_qquickwindow::multipleWindows()
+{
+ QList<QQuickWindow *> windows;
+ QScopedPointer<QQuickWindow> cleanup[6];
+
+ for (int i=0; i<6; ++i) {
+ QQuickWindow *c = new QQuickWindow();
+ c->setColor(Qt::GlobalColor(Qt::red + i));
+ c->resize(300, 200);
+ c->setPosition(100 + i * 30, 100 + i * 20);
+ c->show();
+ windows << c;
+ cleanup[i].reset(c);
+ QVERIFY(QTest::qWaitForWindowExposed(c));
+ }
+
+ // move them
+ for (int i=0; i<windows.size(); ++i) {
+ QQuickWindow *c = windows.at(i);
+ c->setPosition(100 + i * 30, 100 + i * 20 + 100);
+ }
+
+ // resize them
+ for (int i=0; i<windows.size(); ++i) {
+ QQuickWindow *c = windows.at(i);
+ c->resize(200, 150);
+ }
+}
+
+void tst_qquickwindow::animationsWhileHidden()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("AnimationsWhileHidden.qml"));
+ QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+
+ QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
+ QVERIFY(window);
+ QVERIFY(window->isVisible());
+
+ // Now hide the window and verify that it went off screen
+ window->hide();
+ QTest::qWait(10);
+ QVERIFY(!window->isVisible());
+
+ // Running animaiton should cause it to become visible again shortly.
+ QTRY_VERIFY(window->isVisible());
+}
+
+
+void tst_qquickwindow::headless()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("Headless.qml"));
+ QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+
+ QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
+ window->setPersistentOpenGLContext(false);
+ window->setPersistentSceneGraph(false);
+ QVERIFY(window);
+ window->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->isVisible());
+
+ QSignalSpy initialized(window, SIGNAL(sceneGraphInitialized()));
+ QSignalSpy invalidated(window, SIGNAL(sceneGraphInvalidated()));
+
+ // Verify that the window is alive and kicking
+ QVERIFY(window->openglContext() != 0);
+
+ // Store the visual result
+ QImage originalContent = window->grabWindow();
+
+ // Hide the window and verify signal emittion and GL context deletion
+ window->hide();
+ window->releaseResources();
+
+ QTRY_COMPARE(invalidated.size(), 1);
+ QVERIFY(window->openglContext() == 0);
+
+ // Destroy the native windowing system buffers
+ window->destroy();
+ QVERIFY(window->handle() == 0);
+
+ // Show and verify that we are back and running
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QTRY_COMPARE(initialized.size(), 1);
+ QVERIFY(window->openglContext() != 0);
+
+ // Verify that the visual output is the same
+ QImage newContent = window->grabWindow();
+
+ QCOMPARE(originalContent, newContent);
+}
+
+void tst_qquickwindow::noUpdateWhenNothingChanges()
+{
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+
+ QQuickRectangle rect(window.contentItem());
+
+ window.show();
+ QTRY_VERIFY(window.isExposed());
+
+ if (window.openglContext()->thread() == QGuiApplication::instance()->thread()) {
+ QSKIP("Only threaded renderloop implements this feature");
+ return;
+ }
+
+ QSignalSpy spy(&window, SIGNAL(frameSwapped()));
+ rect.update();
+ QTest::qWait(500);
+
+ QCOMPARE(spy.size(), 0);
+}
+
+void tst_qquickwindow::focusObject()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("focus.qml"));
+ QObject *created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+
+ QVERIFY(created);
+
+ QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
+ QVERIFY(window);
+
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickItem *item1 = window->findChild<QQuickItem*>("item1");
+ QVERIFY(item1);
+ item1->setFocus(true);
+ QCOMPARE(item1, window->focusObject());
+
+ QQuickItem *item2 = window->findChild<QQuickItem*>("item2");
+ QVERIFY(item2);
+ item2->setFocus(true);
+ QCOMPARE(item2, window->focusObject());
+}
+
+void tst_qquickwindow::ignoreUnhandledMouseEvents()
+{
+ QQuickWindow* window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+ window->resize(100, 100);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickItem* item = new QQuickItem;
+ item->setSize(QSizeF(100, 100));
+ item->setParentItem(window->contentItem());
+
+ {
+ QMouseEvent me(QEvent::MouseButtonPress, QPointF(50, 50), Qt::LeftButton, Qt::LeftButton,
+ Qt::NoModifier);
+ me.setAccepted(true);
+ QVERIFY(QCoreApplication::sendEvent(window, &me));
+ QVERIFY(!me.isAccepted());
+ }
+
+ {
+ QMouseEvent me(QEvent::MouseMove, QPointF(51, 51), Qt::LeftButton, Qt::LeftButton,
+ Qt::NoModifier);
+ me.setAccepted(true);
+ QVERIFY(QCoreApplication::sendEvent(window, &me));
+ QVERIFY(!me.isAccepted());
+ }
+
+ {
+ QMouseEvent me(QEvent::MouseButtonRelease, QPointF(51, 51), Qt::LeftButton, Qt::LeftButton,
+ Qt::NoModifier);
+ me.setAccepted(true);
+ QVERIFY(QCoreApplication::sendEvent(window, &me));
+ QVERIFY(!me.isAccepted());
+ }
+}
+
+
+void tst_qquickwindow::ownershipRootItem()
+{
+ qmlRegisterType<RootItemAccessor>("Test", 1, 0, "RootItemAccessor");
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("ownershipRootItem.qml"));
+ QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+
+ QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
+ QVERIFY(window);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ RootItemAccessor* accessor = window->findChild<RootItemAccessor*>("accessor");
+ QVERIFY(accessor);
+ engine.collectGarbage();
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ QVERIFY(!accessor->isRootItemDestroyed());
+}
+
+#ifndef QT_NO_CURSOR
+void tst_qquickwindow::cursor()
+{
+ QQuickWindow window;
+ window.resize(320, 240);
+
+ QQuickItem parentItem;
+ parentItem.setPosition(QPointF(0, 0));
+ parentItem.setSize(QSizeF(180, 180));
+ parentItem.setParentItem(window.contentItem());
+
+ QQuickItem childItem;
+ childItem.setPosition(QPointF(60, 90));
+ childItem.setSize(QSizeF(120, 120));
+ childItem.setParentItem(&parentItem);
+
+ QQuickItem clippingItem;
+ clippingItem.setPosition(QPointF(120, 120));
+ clippingItem.setSize(QSizeF(180, 180));
+ clippingItem.setClip(true);
+ clippingItem.setParentItem(window.contentItem());
+
+ QQuickItem clippedItem;
+ clippedItem.setPosition(QPointF(-30, -30));
+ clippedItem.setSize(QSizeF(120, 120));
+ clippedItem.setParentItem(&clippingItem);
+
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ // Position the cursor over the parent and child item and the clipped section of clippedItem.
+ QTest::mouseMove(&window, QPoint(100, 100));
+
+ // No items cursors, window cursor is the default arrow.
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
+
+ // The section of clippedItem under the cursor is clipped, and so doesn't affect the window cursor.
+ clippedItem.setCursor(Qt::ForbiddenCursor);
+ QCOMPARE(clippedItem.cursor().shape(), Qt::ForbiddenCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
+
+ // parentItem is under the cursor, so the window cursor is changed.
+ parentItem.setCursor(Qt::IBeamCursor);
+ QCOMPARE(parentItem.cursor().shape(), Qt::IBeamCursor);
+ QCOMPARE(window.cursor().shape(), Qt::IBeamCursor);
+
+ // childItem is under the cursor and is in front of its parent, so the window cursor is changed.
+ childItem.setCursor(Qt::WaitCursor);
+ QCOMPARE(childItem.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+
+ childItem.setCursor(Qt::PointingHandCursor);
+ QCOMPARE(childItem.cursor().shape(), Qt::PointingHandCursor);
+ QCOMPARE(window.cursor().shape(), Qt::PointingHandCursor);
+
+ // childItem is the current cursor item, so this has no effect on the window cursor.
+ parentItem.unsetCursor();
+ QCOMPARE(parentItem.cursor().shape(), Qt::ArrowCursor);
+ QCOMPARE(window.cursor().shape(), Qt::PointingHandCursor);
+
+ parentItem.setCursor(Qt::IBeamCursor);
+ QCOMPARE(parentItem.cursor().shape(), Qt::IBeamCursor);
+ QCOMPARE(window.cursor().shape(), Qt::PointingHandCursor);
+
+ // With the childItem cursor cleared, parentItem is now foremost.
+ childItem.unsetCursor();
+ QCOMPARE(childItem.cursor().shape(), Qt::ArrowCursor);
+ QCOMPARE(window.cursor().shape(), Qt::IBeamCursor);
+
+ // Setting the childItem cursor to the default still takes precedence over parentItem.
+ childItem.setCursor(Qt::ArrowCursor);
+ QCOMPARE(childItem.cursor().shape(), Qt::ArrowCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
+
+ childItem.setCursor(Qt::WaitCursor);
+ QCOMPARE(childItem.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+
+ // Move the cursor so it is over just parentItem.
+ QTest::mouseMove(&window, QPoint(20, 20));
+ QCOMPARE(window.cursor().shape(), Qt::IBeamCursor);
+
+ // Move the cursor so that is over all items, clippedItem wins because its a child of
+ // clippingItem which is in from of parentItem in painting order.
+ QTest::mouseMove(&window, QPoint(125, 125));
+ QCOMPARE(window.cursor().shape(), Qt::ForbiddenCursor);
+
+ // Over clippingItem only, so no cursor.
+ QTest::mouseMove(&window, QPoint(200, 280));
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
+
+ // Over no item, so no cursor.
+ QTest::mouseMove(&window, QPoint(10, 280));
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
+
+ // back to the start.
+ QTest::mouseMove(&window, QPoint(100, 100));
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+
+ // Try with the mouse pressed.
+ QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100, 100));
+ QTest::mouseMove(&window, QPoint(20, 20));
+ QCOMPARE(window.cursor().shape(), Qt::IBeamCursor);
+ QTest::mouseMove(&window, QPoint(125, 125));
+ QCOMPARE(window.cursor().shape(), Qt::ForbiddenCursor);
+ QTest::mouseMove(&window, QPoint(200, 280));
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
+ QTest::mouseMove(&window, QPoint(10, 280));
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
+ QTest::mouseMove(&window, QPoint(100, 100));
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 100));
+
+ // Remove the cursor item from the scene. Theoretically this should make parentItem the
+ // cursorItem, but given the situation will correct itself after the next mouse move it's
+ // probably better left as is to avoid unnecessary work during tear down.
+ childItem.setParentItem(0);
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+
+ parentItem.setCursor(Qt::SizeAllCursor);
+ QCOMPARE(parentItem.cursor().shape(), Qt::SizeAllCursor);
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+
+ // Changing the cursor of an un-parented item doesn't affect the window's cursor.
+ childItem.setCursor(Qt::ClosedHandCursor);
+ QCOMPARE(childItem.cursor().shape(), Qt::ClosedHandCursor);
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+
+ childItem.unsetCursor();
+ QCOMPARE(childItem.cursor().shape(), Qt::ArrowCursor);
+ QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+
+ QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 101));
+ QCOMPARE(window.cursor().shape(), Qt::SizeAllCursor);
+}
+#endif
+
+void tst_qquickwindow::hideThenDelete_data()
+{
+ QTest::addColumn<bool>("persistentSG");
+ QTest::addColumn<bool>("persistentGL");
+
+ QTest::newRow("persistent:SG=false,GL=false") << false << false;
+ QTest::newRow("persistent:SG=true,GL=false") << true << false;
+ QTest::newRow("persistent:SG=false,GL=true") << false << true;
+ QTest::newRow("persistent:SG=true,GL=true") << true << true;
+}
+
+void tst_qquickwindow::hideThenDelete()
+{
+ if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
+ QSKIP("For some obscure reason this test fails in CI only");
+ return;
+ }
+
+ QFETCH(bool, persistentSG);
+ QFETCH(bool, persistentGL);
+
+ QSignalSpy *openglDestroyed = 0;
+ QSignalSpy *sgInvalidated = 0;
+
+ {
+ QQuickWindow window;
+ window.setColor(Qt::red);
+
+ window.setPersistentSceneGraph(persistentSG);
+ window.setPersistentOpenGLContext(persistentGL);
+
+ window.resize(400, 300);
+ window.show();
+
+ QTest::qWaitForWindowExposed(&window);
+
+ openglDestroyed = new QSignalSpy(window.openglContext(), SIGNAL(aboutToBeDestroyed()));
+ sgInvalidated = new QSignalSpy(&window, SIGNAL(sceneGraphInvalidated()));
+
+ window.hide();
+
+ QTRY_VERIFY(!window.isExposed());
+
+ if (!persistentSG) {
+ QVERIFY(sgInvalidated->size() > 0);
+ if (!persistentGL)
+ QVERIFY(openglDestroyed->size() > 0);
+ else
+ QVERIFY(openglDestroyed->size() == 0);
+ } else {
+ QVERIFY(sgInvalidated->size() == 0);
+ QVERIFY(openglDestroyed->size() == 0);
+ }
+ }
+
+ QVERIFY(sgInvalidated->size() > 0);
+ QVERIFY(openglDestroyed->size() > 0);
+}
+
+void tst_qquickwindow::showHideAnimate()
+{
+ // This test tries to mimick a bug triggered in the qquickanimatedimage test
+ // A window is shown, then removed again before it is exposed. This left
+ // traces in the render loop which prevent other animations from running
+ // later on.
+ {
+ QQuickWindow window;
+ window.resize(400, 300);
+ window.show();
+ }
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("showHideAnimate.qml"));
+ QQuickItem* created = qobject_cast<QQuickItem *>(component.create());
+
+ QVERIFY(created);
+
+ QTRY_VERIFY(created->opacity() > 0.5);
+ QTRY_VERIFY(created->opacity() < 0.5);
+}
+
+void tst_qquickwindow::testExpose()
+{
+ QQuickWindow window;
+ window.setGeometry(100, 100, 300, 200);
+
+ window.show();
+ QTRY_VERIFY(window.isExposed());
+
+ QSignalSpy swapSpy(&window, SIGNAL(frameSwapped()));
+
+ // exhaust pending exposes, as some platforms send us plenty
+ // while showing the first time
+ QTest::qWait(1000);
+ while (swapSpy.size() != 0) {
+ swapSpy.clear();
+ QTest::qWait(100);
+ }
+
+ QWindowSystemInterface::handleExposeEvent(&window, QRegion(10, 10, 20, 20));
+ QTRY_COMPARE(swapSpy.size(), 1);
+}
+
+QTEST_MAIN(tst_qquickwindow)
+
+#include "tst_qquickwindow.moc"
diff --git a/tests/auto/quick/qquickxmllistmodel/data/empty.xml b/tests/auto/quick/qquickxmllistmodel/data/empty.xml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/empty.xml
diff --git a/tests/auto/quick/qquickxmllistmodel/data/get.qml b/tests/auto/quick/qquickxmllistmodel/data/get.qml
new file mode 100644
index 0000000000..509da7174b
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/get.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "type"; query: "type/string()" }
+ XmlRole { name: "age"; query: "age/number()" }
+ XmlRole { name: "size"; query: "size/string()" }
+
+ id: root
+
+ property bool preTest: false
+ property bool postTest: false
+
+ function runPreTest() {
+ if (root.get(0) != undefined)
+ return;
+
+ preTest = true;
+ }
+
+ function runPostTest() {
+ if (root.get(-1) != undefined)
+ return;
+
+ var row = root.get(0);
+ if (row.name != "Polly" ||
+ row.type != "Parrot" ||
+ row.age != 12 ||
+ row.size != "Small")
+ return;
+
+ row = root.get(1);
+ if (row.name != "Penny" ||
+ row.type != "Turtle" ||
+ row.age != 4 ||
+ row.size != "Small")
+ return;
+
+ row = root.get(7);
+ if (row.name != "Rover" ||
+ row.type != "Dog" ||
+ row.age != 0 ||
+ row.size != "Large")
+ return;
+
+ row = root.get(8);
+ if (row.name != "Tiny" ||
+ row.type != "Elephant" ||
+ row.age != 15 ||
+ row.size != "Large")
+ return;
+
+ if (root.get(9) != undefined)
+ return;
+
+ postTest = true;
+ }
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/model.qml b/tests/auto/quick/qquickxmllistmodel/data/model.qml
new file mode 100644
index 0000000000..2df3927479
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/model.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "type"; query: "type/string()" }
+ XmlRole { name: "age"; query: "age/number()" }
+ XmlRole { name: "size"; query: "size/string()" }
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/model.xml b/tests/auto/quick/qquickxmllistmodel/data/model.xml
new file mode 100644
index 0000000000..40cd6d0432
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/model.xml
@@ -0,0 +1,54 @@
+<Pets>
+ <Pet>
+ <name>Polly</name>
+ <type>Parrot</type>
+ <age>12</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Penny</name>
+ <type>Turtle</type>
+ <age>4</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Warren</name>
+ <type>Rabbit</type>
+ <age>2</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Spot</name>
+ <type>Dog</type>
+ <age>9</age>
+ <size>Medium</size>
+ </Pet>
+ <Pet>
+ <name>Whiskers</name>
+ <type>Cat</type>
+ <age>2</age>
+ <size>Medium</size>
+ </Pet>
+ <Pet>
+ <name>Joey</name>
+ <type>Kangaroo</type>
+ <age>1</age>
+ </Pet>
+ <Pet>
+ <name>Kimba</name>
+ <type>Bunny</type>
+ <age>65</age>
+ <size>Large</size>
+ </Pet>
+ <Pet>
+ <name>Rover</name>
+ <type>Dog</type>
+ <size>Large</size>
+ </Pet>
+ <Pet>
+ <name>Tiny</name>
+ <type>Elephant</type>
+ <age>15</age>
+ <size>Large</size>
+ </Pet>
+</Pets>
diff --git a/tests/auto/quick/qquickxmllistmodel/data/model2.xml b/tests/auto/quick/qquickxmllistmodel/data/model2.xml
new file mode 100644
index 0000000000..dab2ec6dc0
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/model2.xml
@@ -0,0 +1,14 @@
+<Pets>
+ <Pet>
+ <name>Polly</name>
+ <type>Parrot</type>
+ <age>12</age>
+ <size>Small</size>
+ </Pet>
+ <Pet>
+ <name>Penny</name>
+ <type>Turtle</type>
+ <age>4</age>
+ <size>Small</size>
+ </Pet>
+</Pets>
diff --git a/tests/auto/quick/qquickxmllistmodel/data/propertychanges.qml b/tests/auto/quick/qquickxmllistmodel/data/propertychanges.qml
new file mode 100644
index 0000000000..f8a97bffc3
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/propertychanges.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { objectName: "role"; name: "name"; query: "name/string()" }
+ XmlRole { name: "type"; query: "type/string()" }
+ XmlRole { name: "age"; query: "age/number()" }
+ XmlRole { name: "size"; query: "size/string()" }
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/recipes.qml b/tests/auto/quick/qquickxmllistmodel/data/recipes.qml
new file mode 100644
index 0000000000..dc609e95e3
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/recipes.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ source: "recipes.xml"
+ query: "/recipes/recipe"
+ XmlRole { name: "title"; query: "@title/string()" }
+ XmlRole { name: "picture"; query: "picture/string()" }
+ XmlRole { name: "ingredients"; query: "ingredients/string()" }
+ XmlRole { name: "preparation"; query: "method/string()" }
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/recipes.xml b/tests/auto/quick/qquickxmllistmodel/data/recipes.xml
new file mode 100644
index 0000000000..d71de60710
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/recipes.xml
@@ -0,0 +1,90 @@
+<recipes>
+ <recipe title="Pancakes">
+ <picture>content/pics/pancakes.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 1 cup (150g) self-raising flour
+ <li> 1 tbs caster sugar
+ <li> 3/4 cup (185ml) milk
+ <li> 1 egg
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Sift flour and sugar together into a bowl. Add a pinch of salt.
+ <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth.
+ <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface.
+ <li> Turn over and cook other side until golden.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+ <recipe title="Fruit Salad">
+ <picture>content/pics/fruit-salad.jpg</picture>
+ <ingredients><![CDATA[* Seasonal Fruit]]></ingredients>
+ <method><![CDATA[* Chop fruit and place in a bowl.]]></method>
+ </recipe>
+ <recipe title="Vegetable Soup">
+ <picture>content/pics/vegetable-soup.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 1 onion
+ <li> 1 turnip
+ <li> 1 potato
+ <li> 1 carrot
+ <li> 1 head of celery
+ <li> 1 1/2 litres of water
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Chop vegetables.
+ <li> Boil in water until vegetables soften.
+ <li> Season with salt and pepper to taste.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+ <recipe title="Hamburger">
+ <picture>content/pics/hamburger.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 500g minced beef
+ <li> Seasoning
+ <li> lettuce, tomato, onion, cheese
+ <li> 1 hamburger bun for each burger
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Mix the beef, together with seasoning, in a food processor.
+ <li> Shape the beef into burgers.
+ <li> Grill the burgers for about 5 mins on each side (until cooked through)
+ <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+ <recipe title="Lemonade">
+ <picture>content/pics/lemonade.jpg</picture>
+ <ingredients><![CDATA[<html>
+ <ul>
+ <li> 1 cup Lemon Juice
+ <li> 1 cup Sugar
+ <li> 6 Cups of Water (2 cups warm water, 4 cups cold water)
+ </ul>
+ </html>
+ ]]></ingredients>
+ <method><![CDATA[<html>
+ <ol>
+ <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves.
+ <li> Pour in lemon juice, stir again, and add 4 cups of cold water.
+ <li> Chill or serve over ice cubes.
+ </ol>
+ </html>
+ ]]></method>
+ </recipe>
+</recipes>
diff --git a/tests/auto/quick/qquickxmllistmodel/data/roleCrash.qml b/tests/auto/quick/qquickxmllistmodel/data/roleCrash.qml
new file mode 100644
index 0000000000..6a7059bb45
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/roleCrash.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ id: model
+ XmlRole {}
+ Component.onCompleted: model.roles = 0
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/roleErrors.qml b/tests/auto/quick/qquickxmllistmodel/data/roleErrors.qml
new file mode 100644
index 0000000000..91664b6d4a
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/roleErrors.qml
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "/name/string()" } //starts with '/'
+ XmlRole { name: "type"; query: "type" } //no type
+ XmlRole { name: "age"; query: "age/" } //ends with '/'
+ XmlRole { name: "size"; query: "size/number()" } //wrong type
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/roleKeys.qml b/tests/auto/quick/qquickxmllistmodel/data/roleKeys.qml
new file mode 100644
index 0000000000..9f667d86e5
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/roleKeys.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ query: "/data/item"
+ XmlRole { id: nameRole; name: "name"; query: "name/string()"; isKey: true }
+ XmlRole { name: "age"; query: "age/number()"; isKey: true }
+ XmlRole { name: "sport"; query: "sport/string()" }
+
+ function disableNameKey() {
+ nameRole.isKey = false;
+ }
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/testtypes.qml b/tests/auto/quick/qquickxmllistmodel/data/testtypes.qml
new file mode 100644
index 0000000000..5ec1ffa35f
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/testtypes.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ query: "/data"
+ XmlRole { name: "stringValue"; query: "a-string/string()" }
+ XmlRole { name: "numberValue"; query: "a-number/number()" }
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/data/unique.qml b/tests/auto/quick/qquickxmllistmodel/data/unique.qml
new file mode 100644
index 0000000000..322a2e4e5c
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/data/unique.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ source: "model.xml"
+ query: "/Pets/Pet"
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "name"; query: "type/string()" }
+}
diff --git a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
new file mode 100644
index 0000000000..047d8ca560
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickxmllistmodel
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickxmllistmodel.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+CONFIG += parallel_test
+
+QT += core-private gui-private v8-private qml-private network testlib xmlpatterns
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp b/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp
new file mode 100644
index 0000000000..847cc5078d
--- /dev/null
+++ b/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp
@@ -0,0 +1,978 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtGlobal>
+#include <math.h>
+#include <QMetaObject>
+#include <qtest.h>
+#include <QtTest/qsignalspy.h>
+#include <QtQml/qqmlnetworkaccessmanagerfactory.h>
+#include <QtNetwork/qnetworkaccessmanager.h>
+#include <QtNetwork/qnetworkrequest.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qtemporaryfile.h>
+#include "../../shared/util.h"
+#include <private/qqmlengine_p.h>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include "../../../../src/imports/xmllistmodel/qqmlxmllistmodel_p.h"
+
+typedef QPair<int, int> QQuickXmlListRange;
+typedef QList<QVariantList> QQmlXmlModelData;
+
+Q_DECLARE_METATYPE(QList<QQuickXmlListRange>)
+Q_DECLARE_METATYPE(QQmlXmlModelData)
+Q_DECLARE_METATYPE(QQuickXmlListModel::Status)
+
+class tst_qquickxmllistmodel : public QQmlDataTest
+
+{
+ Q_OBJECT
+public:
+ tst_qquickxmllistmodel() {}
+
+private slots:
+ void initTestCase() {
+ QQmlDataTest::initTestCase();
+ qRegisterMetaType<QQuickXmlListModel::Status>();
+ }
+
+ void buildModel();
+ void testTypes();
+ void testTypes_data();
+ void cdata();
+ void attributes();
+ void roles();
+ void roleErrors();
+ void uniqueRoleNames();
+ void headers();
+ void xml();
+ void xml_data();
+ void source();
+ void source_data();
+ void data();
+ void get();
+ void reload();
+ void useKeys();
+ void useKeys_data();
+ void noKeysValueChanges();
+ void keysChanged();
+ void threading();
+ void threading_data();
+ void propertyChanges();
+
+ void roleCrash();
+
+private:
+ QString errorString(QAbstractItemModel *model) {
+ QString ret;
+ QMetaObject::invokeMethod(model, "errorString", Q_RETURN_ARG(QString, ret));
+ return ret;
+ }
+
+ QString makeItemXmlAndData(const QString &data, QQmlXmlModelData *modelData = 0) const
+ {
+ if (modelData)
+ modelData->clear();
+ QString xml;
+
+ if (!data.isEmpty()) {
+ QStringList items = data.split(";");
+ foreach(const QString &item, items) {
+ if (item.isEmpty())
+ continue;
+ QVariantList variants;
+ xml += QLatin1String("<item>");
+ QStringList fields = item.split(",");
+ foreach(const QString &field, fields) {
+ QStringList values = field.split("=");
+ if (values.count() != 2) {
+ qWarning() << "makeItemXmlAndData: invalid field:" << field;
+ continue;
+ }
+ xml += QString("<%1>%2</%1>").arg(values[0], values[1]);
+ if (!modelData)
+ continue;
+ bool isNum = false;
+ int number = values[1].toInt(&isNum);
+ if (isNum)
+ variants << number;
+ else
+ variants << values[1];
+ }
+ xml += QLatin1String("</item>");
+ if (modelData)
+ modelData->append(variants);
+ }
+ }
+
+ QString decl = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>";
+ return decl + QLatin1String("<data>") + xml + QLatin1String("</data>");
+ }
+
+ QQmlEngine engine;
+};
+
+class CustomNetworkAccessManagerFactory : public QObject, public QQmlNetworkAccessManagerFactory
+{
+ Q_OBJECT
+public:
+ QVariantMap lastSentHeaders;
+
+protected:
+ QNetworkAccessManager *create(QObject *parent);
+};
+
+class CustomNetworkAccessManager : public QNetworkAccessManager
+{
+ Q_OBJECT
+public:
+ CustomNetworkAccessManager(CustomNetworkAccessManagerFactory *factory, QObject *parent)
+ : QNetworkAccessManager(parent), m_factory(factory) {}
+
+protected:
+ QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice * outgoingData = 0)
+ {
+ if (m_factory) {
+ QVariantMap map;
+ foreach (const QString &header, req.rawHeaderList())
+ map[header] = req.rawHeader(header.toUtf8());
+ m_factory->lastSentHeaders = map;
+ }
+ return QNetworkAccessManager::createRequest(op, req, outgoingData);
+ }
+
+ QPointer<CustomNetworkAccessManagerFactory> m_factory;
+};
+
+QNetworkAccessManager *CustomNetworkAccessManagerFactory::create(QObject *parent)
+{
+ return new CustomNetworkAccessManager(this, parent);
+}
+
+
+void tst_qquickxmllistmodel::buildModel()
+{
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ QModelIndex index = model->index(3, 0);
+ QCOMPARE(model->data(index, Qt::UserRole).toString(), QLatin1String("Spot"));
+ QCOMPARE(model->data(index, Qt::UserRole+1).toString(), QLatin1String("Dog"));
+ QCOMPARE(model->data(index, Qt::UserRole+2).toInt(), 9);
+ QCOMPARE(model->data(index, Qt::UserRole+3).toString(), QLatin1String("Medium"));
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::testTypes()
+{
+ QFETCH(QString, xml);
+ QFETCH(QString, roleName);
+ QFETCH(QVariant, expectedValue);
+
+ QQmlComponent component(&engine, testFileUrl("testtypes.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ model->setProperty("xml",xml.toUtf8());
+ QMetaObject::invokeMethod(model, "reload");
+ QTRY_COMPARE(model->rowCount(), 1);
+
+ int role = model->roleNames().key(roleName.toUtf8(), -1);
+ QVERIFY(role >= 0);
+
+ QModelIndex index = model->index(0, 0);
+ if (expectedValue.toString() == "nan")
+ QVERIFY(qIsNaN(model->data(index, role).toDouble()));
+ else
+ QCOMPARE(model->data(index, role), expectedValue);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::testTypes_data()
+{
+ QTest::addColumn<QString>("xml");
+ QTest::addColumn<QString>("roleName");
+ QTest::addColumn<QVariant>("expectedValue");
+
+ QTest::newRow("missing string field") << "<data></data>"
+ << "stringValue" << QVariant("");
+ QTest::newRow("empty string") << "<data><a-string></a-string></data>"
+ << "stringValue" << QVariant("");
+ QTest::newRow("1-char string") << "<data><a-string>5</a-string></data>"
+ << "stringValue" << QVariant("5");
+ QTest::newRow("string ok") << "<data><a-string>abc def g</a-string></data>"
+ << "stringValue" << QVariant("abc def g");
+
+ QTest::newRow("missing number field") << "<data></data>"
+ << "numberValue" << QVariant("");
+ double nan = qQNaN();
+ QTest::newRow("empty number field") << "<data><a-number></a-number></data>"
+ << "numberValue" << QVariant(nan);
+ QTest::newRow("number field with string") << "<data><a-number>a string</a-number></data>"
+ << "numberValue" << QVariant(nan);
+ QTest::newRow("-1") << "<data><a-number>-1</a-number></data>"
+ << "numberValue" << QVariant("-1");
+ QTest::newRow("-1.5") << "<data><a-number>-1.5</a-number></data>"
+ << "numberValue" << QVariant("-1.5");
+ QTest::newRow("0") << "<data><a-number>0</a-number></data>"
+ << "numberValue" << QVariant("0");
+ QTest::newRow("+1") << "<data><a-number>1</a-number></data>"
+ << "numberValue" << QVariant("1");
+ QTest::newRow("+1.5") << "<data><a-number>1.5</a-number></data>"
+ << "numberValue" << QVariant("1.5");
+}
+
+void tst_qquickxmllistmodel::cdata()
+{
+ QQmlComponent component(&engine, testFileUrl("recipes.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 5);
+
+ QVERIFY(model->data(model->index(2, 0), Qt::UserRole+2).toString().startsWith(QLatin1String("<html>")));
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::attributes()
+{
+ QQmlComponent component(&engine, testFileUrl("recipes.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 5);
+ QCOMPARE(model->data(model->index(2, 0), Qt::UserRole).toString(), QLatin1String("Vegetable Soup"));
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::roles()
+{
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ QHash<int, QByteArray> roleNames = model->roleNames();
+ QCOMPARE(roleNames.count(), 4);
+ QVERIFY(roleNames.key("name", -1) >= 0);
+ QVERIFY(roleNames.key("type", -1) >= 0);
+ QVERIFY(roleNames.key("age", -1) >= 0);
+ QVERIFY(roleNames.key("size", -1) >= 0);
+
+ QSet<int> roles;
+ roles.insert(roleNames.key("name"));
+ roles.insert(roleNames.key("type"));
+ roles.insert(roleNames.key("age"));
+ roles.insert(roleNames.key("size"));
+ QCOMPARE(roles.count(), 4);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::roleErrors()
+{
+ QQmlComponent component(&engine, testFileUrl("roleErrors.qml"));
+ QTest::ignoreMessage(QtWarningMsg, (testFileUrl("roleErrors.qml").toString() + ":7:5: QML XmlRole: An XmlRole query must not start with '/'").toUtf8().constData());
+ QTest::ignoreMessage(QtWarningMsg, (testFileUrl("roleErrors.qml").toString() + ":10:5: QML XmlRole: invalid query: \"age/\"").toUtf8().constData());
+
+ //### make sure we receive all expected warning messages.
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ QModelIndex index = model->index(3, 0);
+ //### should any of these return valid values?
+ QCOMPARE(model->data(index, Qt::UserRole), QVariant());
+ QCOMPARE(model->data(index, Qt::UserRole+1), QVariant());
+ QCOMPARE(model->data(index, Qt::UserRole+2), QVariant());
+
+ QEXPECT_FAIL("", "QTBUG-10797", Continue);
+ QCOMPARE(model->data(index, Qt::UserRole+3), QVariant());
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::uniqueRoleNames()
+{
+ QQmlComponent component(&engine, testFileUrl("unique.qml"));
+ QTest::ignoreMessage(QtWarningMsg, (testFileUrl("unique.qml").toString() + ":8:5: QML XmlRole: \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData());
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ QHash<int, QByteArray> roleNames = model->roleNames();
+ QCOMPARE(roleNames.count(), 1);
+
+ delete model;
+}
+
+
+void tst_qquickxmllistmodel::xml()
+{
+ QFETCH(QString, xml);
+ QFETCH(int, count);
+
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+
+ QSignalSpy spy(model, SIGNAL(statusChanged(QQuickXmlListModel::Status)));
+ QVERIFY(errorString(model).isEmpty());
+ QCOMPARE(model->property("progress").toDouble(), qreal(0.0));
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Loading);
+ QTRY_COMPARE(spy.count(), 1); spy.clear();
+ QTest::qWait(50);
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Ready);
+ QVERIFY(errorString(model).isEmpty());
+ QCOMPARE(model->property("progress").toDouble(), qreal(1.0));
+ QCOMPARE(model->rowCount(), 9);
+
+ // if xml is empty (i.e. clearing) it won't have any effect if a source is set
+ if (xml.isEmpty())
+ model->setProperty("source",QUrl());
+ model->setProperty("xml",xml);
+ QCOMPARE(model->property("progress").toDouble(), qreal(1.0)); // immediately goes to 1.0 if using setXml()
+ QTRY_COMPARE(spy.count(), 1); spy.clear();
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Loading);
+ QTRY_COMPARE(spy.count(), 1); spy.clear();
+ if (xml.isEmpty())
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Null);
+ else
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Ready);
+ QVERIFY(errorString(model).isEmpty());
+ QCOMPARE(model->rowCount(), count);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::xml_data()
+{
+ QTest::addColumn<QString>("xml");
+ QTest::addColumn<int>("count");
+
+ QTest::newRow("xml with no items") << "<Pets></Pets>" << 0;
+ QTest::newRow("empty xml") << "" << 0;
+ QTest::newRow("one item") << "<Pets><Pet><name>Hobbes</name><type>Tiger</type><age>7</age><size>Large</size></Pet></Pets>" << 1;
+}
+
+void tst_qquickxmllistmodel::headers()
+{
+ // ensure the QNetworkAccessManagers created for this test are immediately deleted
+ QQmlEngine qmlEng;
+
+ CustomNetworkAccessManagerFactory factory;
+ qmlEng.setNetworkAccessManagerFactory(&factory);
+
+ QQmlComponent component(&qmlEng, testFileUrl("model.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Ready);
+
+ QVariantMap expectedHeaders;
+ expectedHeaders["Accept"] = "application/xml,*/*";
+
+ QCOMPARE(factory.lastSentHeaders.count(), expectedHeaders.count());
+ foreach (const QString &header, expectedHeaders.keys()) {
+ QVERIFY(factory.lastSentHeaders.contains(header));
+ QCOMPARE(factory.lastSentHeaders[header].toString(), expectedHeaders[header].toString());
+ }
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::source()
+{
+ QFETCH(QUrl, source);
+ QFETCH(int, count);
+ QFETCH(QQuickXmlListModel::Status, status);
+
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QSignalSpy spy(model, SIGNAL(statusChanged(QQuickXmlListModel::Status)));
+
+ QVERIFY(errorString(model).isEmpty());
+ QCOMPARE(model->property("progress").toDouble(), qreal(0.0));
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Loading);
+ QTRY_COMPARE(spy.count(), 1); spy.clear();
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Ready);
+ QVERIFY(errorString(model).isEmpty());
+ QCOMPARE(model->property("progress").toDouble(), qreal(1.0));
+ QCOMPARE(model->rowCount(), 9);
+
+ model->setProperty("source",source);
+ if (model->property("source").toString().isEmpty())
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Null);
+ QCOMPARE(model->property("progress").toDouble(), qreal(0.0));
+ QTRY_COMPARE(spy.count(), 1); spy.clear();
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")),
+ QQuickXmlListModel::Loading);
+ QVERIFY(errorString(model).isEmpty());
+
+ QEventLoop loop;
+ QTimer timer;
+ timer.setSingleShot(true);
+ connect(model, SIGNAL(statusChanged(QQuickXmlListModel::Status)), &loop, SLOT(quit()));
+ connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.start(20000);
+ loop.exec();
+
+ if (spy.count() == 0 && status != QQuickXmlListModel::Ready) {
+ qWarning("QQuickXmlListModel invalid source test timed out");
+ } else {
+ QCOMPARE(spy.count(), 1); spy.clear();
+ }
+
+ QCOMPARE(qvariant_cast<QQuickXmlListModel::Status>(model->property("status")), status);
+ QCOMPARE(model->rowCount(), count);
+
+ if (status == QQuickXmlListModel::Ready)
+ QCOMPARE(model->property("progress").toDouble(), qreal(1.0));
+
+ QCOMPARE(errorString(model).isEmpty(), status == QQuickXmlListModel::Ready);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::source_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<QQuickXmlListModel::Status>("status");
+
+ QTest::newRow("valid") << testFileUrl("model2.xml") << 2
+ << QQuickXmlListModel::Ready;
+ QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0
+ << QQuickXmlListModel::Error;
+
+ // empty file
+ QTemporaryFile *temp = new QTemporaryFile(this);
+ if (temp->open())
+ QTest::newRow("empty file") << QUrl::fromLocalFile(temp->fileName()) << 0
+ << QQuickXmlListModel::Ready;
+ temp->close();
+}
+
+void tst_qquickxmllistmodel::data()
+{
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+
+ for (int i=0; i<9; i++) {
+ QModelIndex index = model->index(i, 0);
+ for (int j=0; j<model->roleNames().count(); j++) {
+ QCOMPARE(model->data(index, j), QVariant());
+ }
+ }
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::get()
+{
+ QQmlComponent component(&engine, testFileUrl("get.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+
+ QVERIFY(model != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(model, "runPreTest"));
+ QCOMPARE(model->property("preTest").toBool(), true);
+
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ QVERIFY(QMetaObject::invokeMethod(model, "runPostTest"));
+ QCOMPARE(model->property("postTest").toBool(), true);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::reload()
+{
+ // If no keys are used, the model should be rebuilt from scratch when
+ // reload() is called.
+
+ QQmlComponent component(&engine, testFileUrl("model.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ QSignalSpy spyInsert(model, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy spyRemove(model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+ QSignalSpy spyCount(model, SIGNAL(countChanged()));
+ //reload multiple times to test the xml query aborting
+ QMetaObject::invokeMethod(model, "reload");
+ QMetaObject::invokeMethod(model, "reload");
+ QCoreApplication::processEvents();
+ QMetaObject::invokeMethod(model, "reload");
+ QMetaObject::invokeMethod(model, "reload");
+ QTRY_COMPARE(spyCount.count(), 0);
+ QTRY_COMPARE(spyInsert.count(), 1);
+ QTRY_COMPARE(spyRemove.count(), 1);
+
+ QCOMPARE(spyInsert[0][1].toInt(), 0);
+ QCOMPARE(spyInsert[0][2].toInt(), 8);
+
+ QCOMPARE(spyRemove[0][1].toInt(), 0);
+ QCOMPARE(spyRemove[0][2].toInt(), 8);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::useKeys()
+{
+ // If using incremental updates through keys, the model should only
+ // insert & remove some of the items, instead of throwing everything
+ // away and causing the view to repaint the whole view.
+
+ QFETCH(QString, oldXml);
+ QFETCH(int, oldCount);
+ QFETCH(QString, newXml);
+ QFETCH(QQmlXmlModelData, newData);
+ QFETCH(QList<QQuickXmlListRange>, insertRanges);
+ QFETCH(QList<QQuickXmlListRange>, removeRanges);
+
+ QQmlComponent component(&engine, testFileUrl("roleKeys.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+
+ model->setProperty("xml",oldXml);
+ QTRY_COMPARE(model->rowCount(), oldCount);
+
+ QSignalSpy spyInsert(model, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy spyRemove(model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+ QSignalSpy spyCount(model, SIGNAL(countChanged()));
+
+ model->setProperty("xml",newXml);
+
+ if (oldCount != newData.count()) {
+ QTRY_COMPARE(model->rowCount(), newData.count());
+ QCOMPARE(spyCount.count(), 1);
+ } else {
+ QTRY_VERIFY(spyInsert.count() > 0 || spyRemove.count() > 0);
+ QCOMPARE(spyCount.count(), 0);
+ }
+
+ QList<int> roles = model->roleNames().keys();
+ qSort(roles);
+ for (int i=0; i<model->rowCount(); i++) {
+ QModelIndex index = model->index(i, 0);
+ for (int j=0; j<roles.count(); j++)
+ QCOMPARE(model->data(index, roles.at(j)), newData[i][j]);
+ }
+
+ QCOMPARE(spyInsert.count(), insertRanges.count());
+ for (int i=0; i<spyInsert.count(); i++) {
+ QCOMPARE(spyInsert[i][1].toInt(), insertRanges[i].first);
+ QCOMPARE(spyInsert[i][2].toInt(), insertRanges[i].first + insertRanges[i].second - 1);
+ }
+
+ QCOMPARE(spyRemove.count(), removeRanges.count());
+ for (int i=0; i<spyRemove.count(); i++) {
+ QCOMPARE(spyRemove[i][1].toInt(), removeRanges[i].first);
+ QCOMPARE(spyRemove[i][2].toInt(), removeRanges[i].first + removeRanges[i].second - 1);
+ }
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::useKeys_data()
+{
+ QTest::addColumn<QString>("oldXml");
+ QTest::addColumn<int>("oldCount");
+ QTest::addColumn<QString>("newXml");
+ QTest::addColumn<QQmlXmlModelData>("newData");
+ QTest::addColumn<QList<QQuickXmlListRange> >("insertRanges");
+ QTest::addColumn<QList<QQuickXmlListRange> >("removeRanges");
+
+ QQmlXmlModelData modelData;
+
+ QTest::newRow("append 1")
+ << makeItemXmlAndData("name=A,age=25,sport=Football") << 1
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 1))
+ << QList<QQuickXmlListRange>();
+
+ QTest::newRow("append multiple")
+ << makeItemXmlAndData("name=A,age=25,sport=Football") << 1
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 2))
+ << QList<QQuickXmlListRange>();
+
+ QTest::newRow("insert in different spots")
+ << makeItemXmlAndData("name=B,age=35,sport=Athletics") << 1
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 1) << qMakePair(2,2))
+ << QList<QQuickXmlListRange>();
+
+ QTest::newRow("insert in middle")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=D,age=55,sport=Golf") << 2
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 2))
+ << QList<QQuickXmlListRange>();
+
+ QTest::newRow("remove first")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics") << 2
+ << makeItemXmlAndData("name=B,age=35,sport=Athletics", &modelData)
+ << modelData
+ << QList<QQuickXmlListRange>()
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 1));
+
+ QTest::newRow("remove last")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics") << 2
+ << makeItemXmlAndData("name=A,age=25,sport=Football", &modelData)
+ << modelData
+ << QList<QQuickXmlListRange>()
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 1));
+
+ QTest::newRow("remove from multiple spots")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 5
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=C,age=45,sport=Curling", &modelData)
+ << modelData
+ << QList<QQuickXmlListRange>()
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 1) << qMakePair(3,2));
+
+ QTest::newRow("remove all")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling") << 3
+ << makeItemXmlAndData("", &modelData)
+ << modelData
+ << QList<QQuickXmlListRange>()
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 3));
+
+ QTest::newRow("replace item")
+ << makeItemXmlAndData("name=A,age=25,sport=Football") << 1
+ << makeItemXmlAndData("name=ZZZ,age=25,sport=Football", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 1))
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 1));
+
+ QTest::newRow("add and remove simultaneously, in different spots")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4
+ << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 1))
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 1) << qMakePair(2,2));
+
+ QTest::newRow("insert at start, remove at end i.e. rss feed")
+ << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 3
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 2))
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 2));
+
+ QTest::newRow("remove at start, insert at end")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling") << 3
+ << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(1, 2))
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 2));
+
+ QTest::newRow("all data has changed")
+ << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35") << 2
+ << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData)
+ << modelData
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 2))
+ << (QList<QQuickXmlListRange>() << qMakePair(0, 2));
+}
+
+void tst_qquickxmllistmodel::noKeysValueChanges()
+{
+ // The 'key' roles are 'name' and 'age', as defined in roleKeys.qml.
+ // If a 'sport' value is changed, the model should not be reloaded,
+ // since 'sport' is not marked as a key.
+
+ QQmlComponent component(&engine, testFileUrl("roleKeys.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+
+ QString xml;
+
+ xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics");
+ model->setProperty("xml",xml);
+ QTRY_COMPARE(model->rowCount(), 2);
+
+ model->setProperty("xml","");
+
+ QSignalSpy spyInsert(model, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy spyRemove(model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+ QSignalSpy spyCount(model, SIGNAL(countChanged()));
+
+ xml = makeItemXmlAndData("name=A,age=25,sport=AussieRules;name=B,age=35,sport=Athletics");
+ model->setProperty("xml",xml);
+
+ QList<int> roles = model->roleNames().keys();
+ qSort(roles);
+ // wait for the new xml data to be set, and verify no signals were emitted
+ QTRY_VERIFY(model->data(model->index(0, 0), roles.at(2)).toString() != QLatin1String("Football"));
+ QCOMPARE(model->data(model->index(0, 0), roles.at(2)).toString(), QLatin1String("AussieRules"));
+
+ QVERIFY(spyInsert.count() == 0);
+ QVERIFY(spyRemove.count() == 0);
+ QVERIFY(spyCount.count() == 0);
+
+ QCOMPARE(model->rowCount(), 2);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::keysChanged()
+{
+ // If the key roles change, the next time the data is reloaded, it should
+ // delete all its data and build a clean model (i.e. same behaviour as
+ // if no keys are set).
+
+ QQmlComponent component(&engine, testFileUrl("roleKeys.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+
+ QString xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics");
+ model->setProperty("xml",xml);
+ QTRY_COMPARE(model->rowCount(), 2);
+
+ model->setProperty("xml","");
+
+ QSignalSpy spyInsert(model, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy spyRemove(model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+ QSignalSpy spyCount(model, SIGNAL(countChanged()));
+
+ QVERIFY(QMetaObject::invokeMethod(model, "disableNameKey"));
+ model->setProperty("xml",xml);
+
+ QTRY_VERIFY(spyInsert.count() > 0 && spyRemove.count() > 0);
+
+ QCOMPARE(spyInsert.count(), 1);
+ QCOMPARE(spyInsert[0][1].toInt(), 0);
+ QCOMPARE(spyInsert[0][2].toInt(), 1);
+
+ QCOMPARE(spyRemove.count(), 1);
+ QCOMPARE(spyRemove[0][1].toInt(), 0);
+ QCOMPARE(spyRemove[0][2].toInt(), 1);
+
+ QCOMPARE(spyCount.count(), 0);
+
+ delete model;
+}
+
+void tst_qquickxmllistmodel::threading()
+{
+ QFETCH(int, xmlDataCount);
+
+ QQmlComponent component(&engine, testFileUrl("roleKeys.qml"));
+
+ QAbstractItemModel *m1 = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(m1 != 0);
+ QAbstractItemModel *m2 = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(m2 != 0);
+ QAbstractItemModel *m3 = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(m3 != 0);
+
+ for (int dataCount=0; dataCount<xmlDataCount; dataCount++) {
+
+ QString data1, data2, data3;
+ for (int i=0; i<dataCount; i++) {
+ data1 += "name=A" + QString::number(i) + ",age=1" + QString::number(i) + ",sport=Football;";
+ data2 += "name=B" + QString::number(i) + ",age=2" + QString::number(i) + ",sport=Athletics;";
+ data3 += "name=C" + QString::number(i) + ",age=3" + QString::number(i) + ",sport=Curling;";
+ }
+
+ //Set the xml data multiple times with randomized order and mixed with multiple event loops
+ //to test the xml query reloading/aborting, the result should be stable.
+ m1->setProperty("xml",makeItemXmlAndData(data1));
+ m2->setProperty("xml",makeItemXmlAndData(data2));
+ m3->setProperty("xml",makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
+ m2->setProperty("xml",makeItemXmlAndData(data2));
+ m1->setProperty("xml",makeItemXmlAndData(data1));
+ m2->setProperty("xml",makeItemXmlAndData(data2));
+ QCoreApplication::processEvents();
+ m3->setProperty("xml",makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
+ m2->setProperty("xml",makeItemXmlAndData(data2));
+ m1->setProperty("xml",makeItemXmlAndData(data1));
+ m2->setProperty("xml",makeItemXmlAndData(data2));
+ m3->setProperty("xml",makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
+ m2->setProperty("xml",makeItemXmlAndData(data2));
+ m3->setProperty("xml",makeItemXmlAndData(data3));
+ m3->setProperty("xml",makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
+
+ QTRY_VERIFY(m1->rowCount() == dataCount && m2->rowCount() == dataCount && m3->rowCount() == dataCount);
+
+ for (int i=0; i<dataCount; i++) {
+ QModelIndex index = m1->index(i, 0);
+ QList<int> roles = m1->roleNames().keys();
+ qSort(roles);
+ QCOMPARE(m1->data(index, roles.at(0)).toString(), QString("A" + QString::number(i)));
+ QCOMPARE(m1->data(index, roles.at(1)).toString(), QString("1" + QString::number(i)));
+ QCOMPARE(m1->data(index, roles.at(2)).toString(), QString("Football"));
+
+ index = m2->index(i, 0);
+ roles = m2->roleNames().keys();
+ qSort(roles);
+ QCOMPARE(m2->data(index, roles.at(0)).toString(), QString("B" + QString::number(i)));
+ QCOMPARE(m2->data(index, roles.at(1)).toString(), QString("2" + QString::number(i)));
+ QCOMPARE(m2->data(index, roles.at(2)).toString(), QString("Athletics"));
+
+ index = m3->index(i, 0);
+ roles = m3->roleNames().keys();
+ qSort(roles);
+ QCOMPARE(m3->data(index, roles.at(0)).toString(), QString("C" + QString::number(i)));
+ QCOMPARE(m3->data(index, roles.at(1)).toString(), QString("3" + QString::number(i)));
+ QCOMPARE(m3->data(index, roles.at(2)).toString(), QString("Curling"));
+ }
+ }
+
+ delete m1;
+ delete m2;
+ delete m3;
+}
+
+void tst_qquickxmllistmodel::threading_data()
+{
+ QTest::addColumn<int>("xmlDataCount");
+
+ QTest::newRow("1") << 1;
+ QTest::newRow("2") << 2;
+ QTest::newRow("10") << 10;
+}
+
+void tst_qquickxmllistmodel::propertyChanges()
+{
+ QQmlComponent component(&engine, testFileUrl("propertychanges.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel*>(component.create());
+ QVERIFY(model != 0);
+ QTRY_COMPARE(model->rowCount(), 9);
+
+ QObject *role = model->findChild<QObject*>("role");
+ QVERIFY(role);
+
+ QSignalSpy nameSpy(role, SIGNAL(nameChanged()));
+ QSignalSpy querySpy(role, SIGNAL(queryChanged()));
+ QSignalSpy isKeySpy(role, SIGNAL(isKeyChanged()));
+
+ role->setProperty("name","size");
+ role->setProperty("query","size/string()");
+ role->setProperty("isKey",true);
+
+ QCOMPARE(role->property("name").toString(), QString("size"));
+ QCOMPARE(role->property("query").toString(), QString("size/string()"));
+ QVERIFY(role->property("isKey").toBool());
+
+ QCOMPARE(nameSpy.count(),1);
+ QCOMPARE(querySpy.count(),1);
+ QCOMPARE(isKeySpy.count(),1);
+
+ role->setProperty("name","size");
+ role->setProperty("query","size/string()");
+ role->setProperty("isKey",true);
+
+ QCOMPARE(nameSpy.count(),1);
+ QCOMPARE(querySpy.count(),1);
+ QCOMPARE(isKeySpy.count(),1);
+
+ QSignalSpy sourceSpy(model, SIGNAL(sourceChanged()));
+ QSignalSpy xmlSpy(model, SIGNAL(xmlChanged()));
+ QSignalSpy modelQuerySpy(model, SIGNAL(queryChanged()));
+ QSignalSpy namespaceDeclarationsSpy(model, SIGNAL(namespaceDeclarationsChanged()));
+
+ model->setProperty("source",QUrl(""));
+ model->setProperty("xml","<Pets><Pet><name>Polly</name><type>Parrot</type><age>12</age><size>Small</size></Pet></Pets>");
+ model->setProperty("query","/Pets");
+ model->setProperty("namespaceDeclarations","declare namespace media=\"http://search.yahoo.com/mrss/\";");
+
+ QCOMPARE(model->property("source").toUrl(), QUrl(""));
+ QCOMPARE(model->property("xml").toString(), QString("<Pets><Pet><name>Polly</name><type>Parrot</type><age>12</age><size>Small</size></Pet></Pets>"));
+ QCOMPARE(model->property("query").toString(), QString("/Pets"));
+ QCOMPARE(model->property("namespaceDeclarations").toString(), QString("declare namespace media=\"http://search.yahoo.com/mrss/\";"));
+
+ QTRY_VERIFY(model->rowCount() == 1);
+
+ QCOMPARE(sourceSpy.count(),1);
+ QCOMPARE(xmlSpy.count(),1);
+ QCOMPARE(modelQuerySpy.count(),1);
+ QCOMPARE(namespaceDeclarationsSpy.count(),1);
+
+ model->setProperty("source",QUrl(""));
+ model->setProperty("xml","<Pets><Pet><name>Polly</name><type>Parrot</type><age>12</age><size>Small</size></Pet></Pets>");
+ model->setProperty("query","/Pets");
+ model->setProperty("namespaceDeclarations","declare namespace media=\"http://search.yahoo.com/mrss/\";");
+
+ QCOMPARE(sourceSpy.count(),1);
+ QCOMPARE(xmlSpy.count(),1);
+ QCOMPARE(modelQuerySpy.count(),1);
+ QCOMPARE(namespaceDeclarationsSpy.count(),1);
+
+ QTRY_VERIFY(model->rowCount() == 1);
+ delete model;
+}
+
+void tst_qquickxmllistmodel::roleCrash()
+{
+ // don't crash
+ QQmlComponent component(&engine, testFileUrl("roleCrash.qml"));
+ QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
+ QVERIFY(model != 0);
+ delete model;
+}
+
+QTEST_MAIN(tst_qquickxmllistmodel)
+
+#include "tst_qquickxmllistmodel.moc"
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
new file mode 100644
index 0000000000..81d4fd3348
--- /dev/null
+++ b/tests/auto/quick/quick.pro
@@ -0,0 +1,82 @@
+TEMPLATE = subdirs
+
+PUBLICTESTS += \
+ geometry \
+ rendernode \
+ qquickpixmapcache
+
+qtHaveModule(widgets): PUBLICTESTS += nodes
+
+!cross_compile: PRIVATETESTS += examples
+
+# This test requires the qtconcurrent module
+!qtHaveModule(concurrent): PUBLICTESTS -= qquickpixmapcache
+
+PRIVATETESTS += \
+ qquickanimations \
+ qquickapplication \
+ qquickbehaviors \
+ qquickfontloader \
+ qquickimageprovider \
+ qquickpath \
+ qquicksmoothedanimation \
+ qquickspringanimation \
+ qquickanimationcontroller \
+ qquickstyledtext \
+ qquickstates \
+ qquicksystempalette \
+ qquickxmllistmodel
+
+# This test requires the xmlpatterns module
+!qtHaveModule(xmlpatterns): PRIVATETESTS -= qquickxmllistmodel
+
+QUICKTESTS = \
+ qquickaccessible \
+ qquickanchors \
+ qquickanimatedimage \
+ qquickanimatedsprite \
+ qquickdynamicpropertyanimation \
+ qquickborderimage \
+ qquickwindow \
+ qquickdrag \
+ qquickdroparea \
+ qquickflickable \
+ qquickflipable \
+ qquickfocusscope \
+ qquickgridview \
+ qquickimage \
+ qquickitem \
+ qquickitem2 \
+ qquickitemlayer \
+ qquicklistview \
+ qquickloader \
+ qquickmousearea \
+ qquickmultipointtoucharea \
+ qquickpainteditem \
+ qquickpathview \
+ qquickpincharea \
+ qquickpositioners \
+ qquickrectangle \
+ qquickrepeater \
+ qquickshadereffect \
+ qquickspritesequence \
+ qquicktext \
+ qquicktextdocument \
+ qquicktextedit \
+ qquicktextinput \
+ qquickvisualdatamodel \
+ qquickview \
+ qquickcanvasitem \
+ qquickscreen \
+ touchmouse \
+ dialogs \
+
+
+SUBDIRS += $$PUBLICTESTS
+
+!contains(QT_CONFIG, accessibility):QUICKTESTS -= qquickaccessible
+
+contains(QT_CONFIG, private_tests) {
+ SUBDIRS += $$PRIVATETESTS
+ SUBDIRS += $$QUICKTESTS
+}
diff --git a/tests/auto/quick/rendernode/data/MessUpState.qml b/tests/auto/quick/rendernode/data/MessUpState.qml
new file mode 100644
index 0000000000..84f32b7692
--- /dev/null
+++ b/tests/auto/quick/rendernode/data/MessUpState.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+import Test 1.0
+
+Rectangle {
+ id: root
+ width: 160
+ height: 240
+ color: "black"
+ Rectangle {
+ width: root.width
+ height: root.height / 2;
+ anchors.centerIn: parent
+ clip: true
+ color: "white"
+ Rectangle {
+ width: root.width / 2;
+ height: root.height / 2
+ anchors.centerIn: parent
+ rotation: 45
+ color: "blue"
+ clip: true
+ MessUpItem {
+ anchors.fill: parent
+ }
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: -100
+ color: "red"
+ opacity: 0.5
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/rendernode/data/RenderOrder.qml b/tests/auto/quick/rendernode/data/RenderOrder.qml
new file mode 100644
index 0000000000..739aa9cc06
--- /dev/null
+++ b/tests/auto/quick/rendernode/data/RenderOrder.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+import Test 1.0
+
+Rectangle {
+ id: root
+
+ width: 160
+ height: 240
+ color: "black"
+
+ Rectangle {
+ width: root.width / 2
+ height: root.height / 2
+ anchors.top: parent.top
+ anchors.left: parent.left
+ color: "red"
+ opacity: 0.5
+ }
+
+ Rectangle {
+ width: root.width / 2
+ height: root.height / 2
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ color: "red"
+ }
+
+ ClearItem {
+ width: root.width / 2
+ height: root.height / 2
+ anchors.centerIn: parent
+ color: "white"
+ clip: true
+ }
+
+ Rectangle {
+ width: root.width / 2
+ height: root.height / 2
+ anchors.top: parent.top
+ anchors.right: parent.right
+ color: "blue"
+ }
+
+ Rectangle {
+ width: root.width / 2
+ height: root.height / 2
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ color: "blue"
+ opacity: 0.5
+ }
+
+}
diff --git a/tests/auto/quick/rendernode/rendernode.pro b/tests/auto/quick/rendernode/rendernode.pro
new file mode 100644
index 0000000000..1e2c50a6d1
--- /dev/null
+++ b/tests/auto/quick/rendernode/rendernode.pro
@@ -0,0 +1,18 @@
+CONFIG += testcase
+TARGET = tst_rendernode
+SOURCES += tst_rendernode.cpp
+
+macx:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+include(../../shared/util.pri)
+
+CONFIG += parallel_test
+QT += core-private gui-private v8-private qml-private quick-private testlib
+
+OTHER_FILES += \
+ data/RenderOrder.qml \
+ data/MessUpState.qml \
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+CONFIG+=insignificant_test
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
new file mode 100644
index 0000000000..509b209654
--- /dev/null
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -0,0 +1,242 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+#include <QtGui/qopenglcontext.h>
+#include <private/qsgrendernode_p.h>
+
+#include "../../shared/util.h"
+
+class tst_rendernode: public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_rendernode();
+
+ QImage runTest(const QString &fileName)
+ {
+ QQuickView view;
+ view.setSource(testFileUrl(fileName));
+
+ view.show();
+ QTest::qWaitForWindowExposed(&view);
+
+ return view.grabWindow();
+ }
+
+private slots:
+ void renderOrder();
+ void messUpState();
+};
+
+class ClearNode : public QSGRenderNode
+{
+public:
+ virtual StateFlags changedStates()
+ {
+ return ColorState;
+ }
+
+ virtual void render(const RenderState &)
+ {
+ // If clip has been set, scissoring will make sure the right area is cleared.
+ glClearColor(color.redF(), color.greenF(), color.blueF(), 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
+ QColor color;
+};
+
+class ClearItem : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+public:
+ ClearItem() : m_color(Qt::black)
+ {
+ setFlag(ItemHasContents, true);
+ }
+
+ QColor color() const { return m_color; }
+ void setColor(const QColor &color)
+ {
+ if (color == m_color)
+ return;
+ m_color = color;
+ emit colorChanged();
+ }
+
+protected:
+ virtual QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+ {
+ ClearNode *node = static_cast<ClearNode *>(oldNode);
+ if (!node)
+ node = new ClearNode;
+ node->color = m_color;
+ return node;
+ }
+
+Q_SIGNALS:
+ void colorChanged();
+
+private:
+ QColor m_color;
+};
+
+class MessUpNode : public QSGRenderNode
+{
+public:
+ virtual StateFlags changedStates()
+ {
+ return StateFlags(DepthState) | StencilState | ScissorState | ColorState | BlendState
+ | CullState | ViewportState;
+ }
+
+ virtual void render(const RenderState &)
+ {
+ // Don't draw anything, just mess up the state
+ glViewport(10, 10, 10, 10);
+ glDisable(GL_SCISSOR_TEST);
+ glDepthMask(true);
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_EQUAL);
+#if defined(QT_OPENGL_ES)
+ glClearDepthf(1);
+#else
+ glClearDepth(1);
+#endif
+ glClearStencil(42);
+ glClearColor(1.0f, 0.5f, 1.0f, 0.0f);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(190, 190, 10, 10);
+ glStencilFunc(GL_EQUAL, 28, 0xff);
+ glBlendFunc(GL_ZERO, GL_ZERO);
+ GLint frontFace;
+ glGetIntegerv(GL_FRONT_FACE, &frontFace);
+ glFrontFace(frontFace == GL_CW ? GL_CCW : GL_CW);
+ glEnable(GL_CULL_FACE);
+ }
+};
+
+class MessUpItem : public QQuickItem
+{
+ Q_OBJECT
+public:
+ MessUpItem()
+ {
+ setFlag(ItemHasContents, true);
+ }
+
+protected:
+ virtual QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+ {
+ MessUpNode *node = static_cast<MessUpNode *>(oldNode);
+ if (!node)
+ node = new MessUpNode;
+ return node;
+ }
+};
+
+tst_rendernode::tst_rendernode()
+{
+ qmlRegisterType<ClearItem>("Test", 1, 0, "ClearItem");
+ qmlRegisterType<MessUpItem>("Test", 1, 0, "MessUpItem");
+}
+
+static void fuzzyCompareColor(QRgb x, QRgb y)
+{
+ QVERIFY(qAbs(qRed(x) - qRed(y)) < 4);
+ QVERIFY(qAbs(qGreen(x) - qGreen(y)) < 4);
+ QVERIFY(qAbs(qBlue(x) - qBlue(y)) < 4);
+}
+
+void tst_rendernode::renderOrder()
+{
+ QImage fb = runTest("RenderOrder.qml");
+ int x1 = fb.width() / 8;
+ int x2 = fb.width() * 3 / 8;
+ int x3 = fb.width() * 5 / 8;
+ int x4 = fb.width() * 7 / 8;
+ int y1 = fb.height() / 8;
+ int y2 = fb.height() * 3 / 8;
+ int y3 = fb.height() * 5 / 8;
+ int y4 = fb.height() * 7 / 8;
+
+ fuzzyCompareColor(fb.pixel(x1, y1), qRgb(0x7f, 0x00, 0x00));
+ QCOMPARE(fb.pixel(x2, y2), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(x3, y2), qRgb(0x00, 0x00, 0xff));
+ QCOMPARE(fb.pixel(x4, y1), qRgb(0x00, 0x00, 0xff));
+ QCOMPARE(fb.pixel(x1, y4), qRgb(0xff, 0x00, 0x00));
+ QCOMPARE(fb.pixel(x2, y3), qRgb(0xff, 0xff, 0xff));
+ fuzzyCompareColor(fb.pixel(x3, y3), qRgb(0x7f, 0x7f, 0xff));
+ fuzzyCompareColor(fb.pixel(x4, y4), qRgb(0x00, 0x00, 0x7f));
+}
+
+void tst_rendernode::messUpState()
+{
+ QImage fb = runTest("MessUpState.qml");
+ int x1 = 0;
+ int x2 = fb.width() / 2;
+ int x3 = fb.width() - 1;
+ int y1 = 0;
+ int y2 = fb.height() * 3 / 16;
+ int y3 = fb.height() / 2;
+ int y4 = fb.height() * 13 / 16;
+ int y5 = fb.height() - 1;
+
+ QCOMPARE(fb.pixel(x1, y3), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(fb.pixel(x3, y3), qRgb(0xff, 0xff, 0xff));
+
+ QCOMPARE(fb.pixel(x2, y1), qRgb(0x00, 0x00, 0x00));
+ QCOMPARE(fb.pixel(x2, y2), qRgb(0x00, 0x00, 0x00));
+ fuzzyCompareColor(fb.pixel(x2, y3), qRgb(0x7f, 0x00, 0x7f));
+ QCOMPARE(fb.pixel(x2, y4), qRgb(0x00, 0x00, 0x00));
+ QCOMPARE(fb.pixel(x2, y5), qRgb(0x00, 0x00, 0x00));
+}
+
+
+QTEST_MAIN(tst_rendernode)
+
+#include "tst_rendernode.moc"
diff --git a/tests/auto/quick/shared/util.pri b/tests/auto/quick/shared/util.pri
new file mode 100644
index 0000000000..28036f109c
--- /dev/null
+++ b/tests/auto/quick/shared/util.pri
@@ -0,0 +1,9 @@
+
+QT += core-private gui-private v8-private qml-private quick-private
+
+HEADERS += $$PWD/visualtestutil.h \
+ $$PWD/viewtestutil.h
+SOURCES += $$PWD/visualtestutil.cpp \
+ $$PWD/viewtestutil.cpp
+
+DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\"
diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp
new file mode 100644
index 0000000000..29b82072c9
--- /dev/null
+++ b/tests/auto/quick/shared/viewtestutil.cpp
@@ -0,0 +1,319 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "viewtestutil.h"
+
+#include <QtQuick/QQuickView>
+
+#include <QtTest/QTest>
+
+QQuickView *QQuickViewTestUtil::createView()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ return window;
+}
+
+void QQuickViewTestUtil::flick(QQuickView *window, const QPoint &from, const QPoint &to, int duration)
+{
+ const int pointCount = 5;
+ QPoint diff = to - from;
+
+ // send press, five equally spaced moves, and release.
+ QTest::mousePress(window, Qt::LeftButton, 0, from);
+
+ for (int i = 0; i < pointCount; ++i)
+ QTest::mouseMove(window, from + (i+1)*diff/pointCount, duration / pointCount);
+
+ QTest::mouseRelease(window, Qt::LeftButton, 0, to);
+ QTest::qWait(50);
+}
+
+QList<int> QQuickViewTestUtil::adjustIndexesForAddDisplaced(const QList<int> &indexes, int index, int count)
+{
+ QList<int> result;
+ for (int i=0; i<indexes.count(); i++) {
+ int num = indexes[i];
+ if (num >= index) {
+ num += count;
+ }
+ result << num;
+ }
+ return result;
+}
+
+QList<int> QQuickViewTestUtil::adjustIndexesForMove(const QList<int> &indexes, int from, int to, int count)
+{
+ QList<int> result;
+ for (int i=0; i<indexes.count(); i++) {
+ int num = indexes[i];
+ if (from < to) {
+ if (num >= from && num < from + count)
+ num += (to - from); // target
+ else if (num >= from && num < to + count)
+ num -= count; // displaced
+ } else if (from > to) {
+ if (num >= from && num < from + count)
+ num -= (from - to); // target
+ else if (num >= to && num < from + count)
+ num += count; // displaced
+ }
+ result << num;
+ }
+ return result;
+}
+
+QList<int> QQuickViewTestUtil::adjustIndexesForRemoveDisplaced(const QList<int> &indexes, int index, int count)
+{
+ QList<int> result;
+ for (int i=0; i<indexes.count(); i++) {
+ int num = indexes[i];
+ if (num >= index)
+ num -= count;
+ result << num;
+ }
+ return result;
+}
+
+QQuickViewTestUtil::QaimModel::QaimModel(QObject *parent)
+ : QAbstractListModel(parent)
+{
+ QHash<int, QByteArray> roles;
+ roles[Name] = "name";
+ roles[Number] = "number";
+ setRoleNames(roles);
+}
+
+int QQuickViewTestUtil::QaimModel::rowCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+ return list.count();
+}
+
+QVariant QQuickViewTestUtil::QaimModel::data(const QModelIndex &index, int role) 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 QQuickViewTestUtil::QaimModel::count() const
+{
+ return rowCount();
+}
+
+QString QQuickViewTestUtil::QaimModel::name(int index) const
+{
+ return list.at(index).first;
+}
+
+QString QQuickViewTestUtil::QaimModel::number(int index) const
+{
+ return list.at(index).second;
+}
+
+void QQuickViewTestUtil::QaimModel::addItem(const QString &name, const QString &number)
+{
+ emit beginInsertRows(QModelIndex(), list.count(), list.count());
+ list.append(QPair<QString,QString>(name, number));
+ emit endInsertRows();
+}
+
+void QQuickViewTestUtil::QaimModel::addItems(const QList<QPair<QString, QString> > &items)
+{
+ emit beginInsertRows(QModelIndex(), list.count(), list.count()+items.count()-1);
+ for (int i=0; i<items.count(); i++)
+ list.append(QPair<QString,QString>(items[i].first, items[i].second));
+ emit endInsertRows();
+}
+
+void QQuickViewTestUtil::QaimModel::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 QQuickViewTestUtil::QaimModel::insertItems(int index, const QList<QPair<QString, QString> > &items)
+{
+ emit beginInsertRows(QModelIndex(), index, index+items.count()-1);
+ for (int i=0; i<items.count(); i++)
+ list.insert(index + i, QPair<QString,QString>(items[i].first, items[i].second));
+ emit endInsertRows();
+}
+
+void QQuickViewTestUtil::QaimModel::removeItem(int index)
+{
+ emit beginRemoveRows(QModelIndex(), index, index);
+ list.removeAt(index);
+ emit endRemoveRows();
+}
+
+void QQuickViewTestUtil::QaimModel::removeItems(int index, int count)
+{
+ emit beginRemoveRows(QModelIndex(), index, index+count-1);
+ while (count--)
+ list.removeAt(index);
+ emit endRemoveRows();
+}
+
+void QQuickViewTestUtil::QaimModel::moveItem(int from, int to)
+{
+ emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to);
+ list.move(from, to);
+ emit endMoveRows();
+}
+
+void QQuickViewTestUtil::QaimModel::moveItems(int from, int to, int count)
+{
+ emit beginMoveRows(QModelIndex(), from, from+count-1, QModelIndex(), to > from ? to+count : to);
+ qquickmodelviewstestutil_move(from, to, count, &list);
+ emit endMoveRows();
+}
+
+void QQuickViewTestUtil::QaimModel::modifyItem(int idx, const QString &name, const QString &number)
+{
+ list[idx] = QPair<QString,QString>(name, number);
+ emit dataChanged(index(idx,0), index(idx,0));
+}
+
+void QQuickViewTestUtil::QaimModel::clear()
+{
+ int count = list.count();
+ if (count > 0) {
+ beginRemoveRows(QModelIndex(), 0, count-1);
+ list.clear();
+ endRemoveRows();
+ }
+}
+
+void QQuickViewTestUtil::QaimModel::reset()
+{
+ emit beginResetModel();
+ emit endResetModel();
+}
+
+void QQuickViewTestUtil::QaimModel::resetItems(const QList<QPair<QString, QString> > &items)
+{
+ beginResetModel();
+ list = items;
+ endResetModel();
+}
+
+void QQuickViewTestUtil::QaimModel::matchAgainst(const QList<QPair<QString, QString> > &other, const QString &error1, const QString &error2) {
+ for (int i=0; i<other.count(); i++) {
+ QVERIFY2(list.contains(other[i]),
+ QTest::toString(other[i].first + " " + other[i].second + " " + error1));
+ }
+ for (int i=0; i<list.count(); i++) {
+ QVERIFY2(other.contains(list[i]),
+ QTest::toString(list[i].first + " " + list[i].second + " " + error2));
+ }
+}
+
+
+
+QQuickViewTestUtil::ListRange::ListRange()
+ : valid(false)
+{
+}
+
+QQuickViewTestUtil::ListRange::ListRange(const ListRange &other)
+ : valid(other.valid)
+{
+ indexes = other.indexes;
+}
+
+QQuickViewTestUtil::ListRange::ListRange(int start, int end)
+ : valid(true)
+{
+ for (int i=start; i<=end; i++)
+ indexes << i;
+}
+
+QQuickViewTestUtil::ListRange::~ListRange()
+{
+}
+
+QQuickViewTestUtil::ListRange QQuickViewTestUtil::ListRange::operator+(const ListRange &other) const
+{
+ if (other == *this)
+ return *this;
+ ListRange a(*this);
+ a.indexes.append(other.indexes);
+ return a;
+}
+
+bool QQuickViewTestUtil::ListRange::operator==(const ListRange &other) const
+{
+ return indexes.toSet() == other.indexes.toSet();
+}
+
+bool QQuickViewTestUtil::ListRange::operator!=(const ListRange &other) const
+{
+ return !(*this == other);
+}
+
+bool QQuickViewTestUtil::ListRange::isValid() const
+{
+ return valid;
+}
+
+int QQuickViewTestUtil::ListRange::count() const
+{
+ return indexes.count();
+}
+
+QList<QPair<QString,QString> > QQuickViewTestUtil::ListRange::getModelDataValues(const QaimModel &model)
+{
+ QList<QPair<QString,QString> > data;
+ if (!valid)
+ return data;
+ for (int i=0; i<indexes.count(); i++)
+ data.append(qMakePair(model.name(indexes[i]), model.number(indexes[i])));
+ return data;
+}
+
diff --git a/tests/auto/quick/shared/viewtestutil.h b/tests/auto/quick/shared/viewtestutil.h
new file mode 100644
index 0000000000..67906114f6
--- /dev/null
+++ b/tests/auto/quick/shared/viewtestutil.h
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKVIEWTESTUTIL_H
+#define QQUICKVIEWTESTUTIL_H
+
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlExpression>
+#include <QtCore/QAbstractListModel>
+
+QT_FORWARD_DECLARE_CLASS(QQuickView)
+
+namespace QQuickViewTestUtil
+{
+ QQuickView *createView();
+
+ void flick(QQuickView *window, const QPoint &from, const QPoint &to, int duration);
+
+ QList<int> adjustIndexesForAddDisplaced(const QList<int> &indexes, int index, int count);
+ QList<int> adjustIndexesForMove(const QList<int> &indexes, int from, int to, int count);
+ QList<int> adjustIndexesForRemoveDisplaced(const QList<int> &indexes, int index, int count);
+
+ struct ListChange {
+ enum { Inserted, Removed, Moved, SetCurrent, SetContentY, Polish } type;
+ int index;
+ int count;
+ int to; // Move
+ qreal pos; // setContentY
+
+ static ListChange insert(int index, int count = 1) { ListChange c = { Inserted, index, count, -1, 0.0 }; return c; }
+ static ListChange remove(int index, int count = 1) { ListChange c = { Removed, index, count, -1, 0.0 }; return c; }
+ static ListChange move(int index, int to, int count) { ListChange c = { Moved, index, count, to, 0.0 }; return c; }
+ static ListChange setCurrent(int index) { ListChange c = { SetCurrent, index, -1, -1, 0.0 }; return c; }
+ static ListChange setContentY(qreal pos) { ListChange c = { SetContentY, -1, -1, -1, pos }; return c; }
+ static ListChange polish() { ListChange c = { Polish, -1, -1, -1, 0.0 }; return c; }
+ };
+
+ class QaimModel : public QAbstractListModel
+ {
+ Q_OBJECT
+ public:
+ enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 };
+
+ QaimModel(QObject *parent=0);
+
+ int rowCount(const QModelIndex &parent=QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
+
+ int count() const;
+ QString name(int index) const;
+ QString number(int index) const;
+
+ Q_INVOKABLE void addItem(const QString &name, const QString &number);
+ void addItems(const QList<QPair<QString, QString> > &items);
+ void insertItem(int index, const QString &name, const QString &number);
+ void insertItems(int index, const QList<QPair<QString, QString> > &items);
+
+ Q_INVOKABLE void removeItem(int index);
+ void removeItems(int index, int count);
+
+ void moveItem(int from, int to);
+ void moveItems(int from, int to, int count);
+
+ void modifyItem(int idx, const QString &name, const QString &number);
+
+ void clear();
+ void reset();
+ void resetItems(const QList<QPair<QString, QString> > &items);
+
+ void matchAgainst(const QList<QPair<QString, QString> > &other, const QString &error1, const QString &error2);
+
+ using QAbstractListModel::dataChanged;
+
+ private:
+ QList<QPair<QString,QString> > list;
+ };
+
+ class ListRange
+ {
+ public:
+ ListRange();
+ ListRange(const ListRange &other);
+ ListRange(int start, int end);
+
+ ~ListRange();
+
+ ListRange operator+(const ListRange &other) const;
+ bool operator==(const ListRange &other) const;
+ bool operator!=(const ListRange &other) const;
+
+ bool isValid() const;
+ int count() const;
+
+ QList<QPair<QString,QString> > getModelDataValues(const QaimModel &model);
+
+ QList<int> indexes;
+ bool valid;
+ };
+
+ template<typename T>
+ static void qquickmodelviewstestutil_move(int from, int to, int n, T *items)
+ {
+ if (from > to) {
+ // Only move forwards - flip if backwards moving
+ int tfrom = from;
+ int tto = to;
+ from = tto;
+ to = tto+n;
+ n = tfrom-tto;
+ }
+
+ T replaced;
+ int i=0;
+ typename T::ConstIterator it=items->begin(); it += from+n;
+ for (; i<to-from; ++i,++it)
+ replaced.append(*it);
+ i=0;
+ it=items->begin(); it += from;
+ for (; i<n; ++i,++it)
+ replaced.append(*it);
+ typename T::ConstIterator f=replaced.begin();
+ typename T::Iterator t=items->begin(); t += from;
+ for (; f != replaced.end(); ++f, ++t)
+ *t = *f;
+ }
+}
+
+Q_DECLARE_METATYPE(QQuickViewTestUtil::QaimModel*)
+Q_DECLARE_METATYPE(QQuickViewTestUtil::ListChange)
+Q_DECLARE_METATYPE(QList<QQuickViewTestUtil::ListChange>)
+Q_DECLARE_METATYPE(QQuickViewTestUtil::ListRange)
+
+
+#endif // QQUICKVIEWTESTUTIL_H
diff --git a/tests/auto/quick/shared/visualtestutil.cpp b/tests/auto/quick/shared/visualtestutil.cpp
new file mode 100644
index 0000000000..4b5c201a34
--- /dev/null
+++ b/tests/auto/quick/shared/visualtestutil.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "visualtestutil.h"
+
+#include <QtQuick/QQuickItem>
+#include <QtCore/QDebug>
+
+bool QQuickVisualTestUtil::delegateVisible(QQuickItem *item)
+{
+ return item->isVisible() && !QQuickItemPrivate::get(item)->culled;
+}
+
+QQuickItem *QQuickVisualTestUtil::findVisibleChild(QQuickItem *parent, const QString &objectName)
+{
+ QQuickItem *item = 0;
+ QList<QQuickItem*> items = parent->findChildren<QQuickItem*>(objectName);
+ for (int i = 0; i < items.count(); ++i) {
+ if (items.at(i)->isVisible() && !QQuickItemPrivate::get(items.at(i))->culled) {
+ item = items.at(i);
+ break;
+ }
+ }
+ return item;
+}
+
+void QQuickVisualTestUtil::dumpTree(QQuickItem *parent, int depth)
+{
+ static QString padding(" ");
+ for (int i = 0; i < parent->childItems().count(); ++i) {
+ QQuickItem *item = qobject_cast<QQuickItem*>(parent->childItems().at(i));
+ if (!item)
+ continue;
+ qDebug() << padding.left(depth*2) << item;
+ dumpTree(item, depth+1);
+ }
+}
+
diff --git a/tests/auto/quick/shared/visualtestutil.h b/tests/auto/quick/shared/visualtestutil.h
new file mode 100644
index 0000000000..5edb5d08c9
--- /dev/null
+++ b/tests/auto/quick/shared/visualtestutil.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKVISUALTESTUTIL_H
+#define QQUICKVISUALTESTUTIL_H
+
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlExpression>
+
+#include <QtQuick/private/qquickitem_p.h>
+
+namespace QQuickVisualTestUtil
+{
+ QQuickItem *findVisibleChild(QQuickItem *parent, const QString &objectName);
+
+ void dumpTree(QQuickItem *parent, int depth = 0);
+
+ bool delegateVisible(QQuickItem *item);
+
+ /*
+ 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 *findItem(QQuickItem *parent, const QString &objectName, int index = -1)
+ {
+ const QMetaObject &mo = T::staticMetaObject;
+ for (int i = 0; i < parent->childItems().count(); ++i) {
+ QQuickItem *item = qobject_cast<QQuickItem*>(parent->childItems().at(i));
+ if (!item)
+ continue;
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
+ if (index != -1) {
+ QQmlExpression e(qmlContext(item), item, "index");
+ if (e.evaluate().toInt() == index)
+ return static_cast<T*>(item);
+ } else {
+ return static_cast<T*>(item);
+ }
+ }
+ item = findItem<T>(item, objectName, index);
+ if (item)
+ return static_cast<T*>(item);
+ }
+
+ return 0;
+ }
+
+ template<typename T>
+ QList<T*> findItems(QQuickItem *parent, const QString &objectName, bool visibleOnly = true)
+ {
+ QList<T*> items;
+ const QMetaObject &mo = T::staticMetaObject;
+ for (int i = 0; i < parent->childItems().count(); ++i) {
+ QQuickItem *item = qobject_cast<QQuickItem*>(parent->childItems().at(i));
+ if (!item || (visibleOnly && (!item->isVisible() || QQuickItemPrivate::get(item)->culled)))
+ continue;
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName))
+ items.append(static_cast<T*>(item));
+ items += findItems<T>(item, objectName);
+ }
+
+ return items;
+ }
+
+ template<typename T>
+ QList<T*> findItems(QQuickItem *parent, const QString &objectName, const QList<int> &indexes)
+ {
+ QList<T*> items;
+ for (int i=0; i<indexes.count(); i++)
+ items << qobject_cast<QQuickItem*>(findItem<T>(parent, objectName, indexes[i]));
+ return items;
+ }
+}
+
+#define QQUICK_VERIFY_POLISH(item) \
+ QTRY_COMPARE(QQuickItemPrivate::get(item)->polishScheduled, false)
+
+#endif // QQUICKVISUALTESTUTIL_H
diff --git a/tests/auto/quick/touchmouse/data/buttononflickable.qml b/tests/auto/quick/touchmouse/data/buttononflickable.qml
new file mode 100644
index 0000000000..95a993f806
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/buttononflickable.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Rectangle {
+ id: root
+ width: 300
+ height: 500
+ color: "green"
+
+ Flickable {
+ objectName: "flickable"
+ anchors.fill: parent
+ contentHeight: 1000
+
+ Rectangle {
+ objectName: "button"
+ y: 100
+ height: 100
+ width: parent.width
+
+ EventItem {
+ objectName: "eventItem1"
+ height: 100
+ width: 300
+ }
+ }
+
+ Rectangle {
+ objectName: "button2"
+ y: 300
+ height: 100
+ width: parent.width
+
+ EventItem {
+ objectName: "eventItem2"
+ height: 100
+ width: 300
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/quick/touchmouse/data/buttonontouch.qml b/tests/auto/quick/touchmouse/data/buttonontouch.qml
new file mode 100644
index 0000000000..dcd2573f2e
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/buttonontouch.qml
@@ -0,0 +1,100 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Rectangle {
+ id: root
+ width: 300
+ height: 800
+ color: "green"
+
+ Rectangle {
+ color: "blue"
+ height: 400
+ width: parent.width
+
+
+ PinchArea {
+ pinch.target: button1
+ objectName: "pincharea"
+ anchors.fill: parent
+
+ pinch.minimumScale: 0.1
+ pinch.maximumScale: 10.0
+ }
+
+ Rectangle {
+
+ id: button1
+ objectName: "button1"
+ y: 100
+ height: 100
+ width: parent.width
+ Text { text: "Button 1" }
+
+ EventItem {
+ objectName: "eventItem1"
+ height: 100
+ width: 300
+ }
+ }
+
+ Rectangle {
+ objectName: "button2"
+ y: 300
+ height: 100
+ width: parent.width
+ Text { text: "Button 2" }
+
+ EventItem {
+ objectName: "eventItem2"
+ height: 100
+ width: 300
+ }
+ }
+ }
+
+ Rectangle {
+ y: 400
+ width: parent.width
+ height: parent.height
+ color: "red"
+
+ MultiPointTouchArea {
+ objectName: "toucharea"
+ anchors.fill: parent
+
+ y: 400
+ height: 400
+
+ Rectangle {
+ objectName: "button3"
+ y: 100
+ height: 100
+ width: parent.width
+ Text { text: "Button 3" }
+
+ EventItem {
+ objectName: "eventItem3"
+ height: 100
+ width: 300
+ }
+ }
+
+ Rectangle {
+ objectName: "button4"
+ y: 300
+ height: 100
+ width: parent.width
+ Text { text: "Button 4" }
+
+ EventItem {
+ objectName: "eventItem4"
+ height: 100
+ width: 300
+ }
+ }
+
+ }
+ }
+}
+
diff --git a/tests/auto/quick/touchmouse/data/flickableonpinch.qml b/tests/auto/quick/touchmouse/data/flickableonpinch.qml
new file mode 100644
index 0000000000..9c9a197d66
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/flickableonpinch.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Rectangle {
+ id: root
+ width: 600
+ height: 600
+ color: "green"
+
+ PinchArea {
+ objectName: "pincharea"
+ pinch.target: rect
+ anchors.fill: parent
+
+ pinch.minimumScale: 1.0
+ pinch.maximumScale: 10.0
+
+ Flickable {
+ objectName: "flickable"
+ anchors.fill: parent
+ contentHeight: 1000
+ contentWidth: 1000
+
+ Rectangle {
+ objectName: "rect"
+ id: rect
+ color: "blue"
+ x: 200
+ y: 200
+ width: 400
+ height: 400
+ }
+ }
+ }
+
+}
+
diff --git a/tests/auto/quick/touchmouse/data/mouseonflickableonpinch.qml b/tests/auto/quick/touchmouse/data/mouseonflickableonpinch.qml
new file mode 100644
index 0000000000..015391f291
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/mouseonflickableonpinch.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Rectangle {
+ id: root
+ width: 600
+ height: 600
+ color: "green"
+
+ PinchArea {
+ objectName: "pincharea"
+ pinch.target: rect
+ anchors.fill: parent
+
+ pinch.minimumScale: 1.0
+ pinch.maximumScale: 10.0
+
+ Flickable {
+ objectName: "flickable"
+ anchors.fill: parent
+ contentHeight: 1000
+ contentWidth: 1000
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (rect.color == "#000000")
+ rect.color = "#00ff00"
+ else
+ rect.color = "#000000"
+ }
+ }
+
+ Rectangle {
+ objectName: "rect"
+ id: rect
+ color: "blue"
+ x: 200
+ y: 200
+ width: 400
+ height: 400
+ }
+ }
+ }
+
+}
+
diff --git a/tests/auto/quick/touchmouse/data/pinchonflickable.qml b/tests/auto/quick/touchmouse/data/pinchonflickable.qml
new file mode 100644
index 0000000000..2a7a91006e
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/pinchonflickable.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+//import Qt.test 1.0
+
+Rectangle {
+ id: root
+ width: 600
+ height: 600
+ color: "green"
+
+ Flickable {
+ objectName: "flickable"
+ anchors.fill: parent
+ contentHeight: 1000
+ contentWidth: 1000
+
+ Rectangle {
+ objectName: "rect"
+ id: rect
+ color: "blue"
+ x: 200
+ y: 200
+ width: 400
+ height: 400
+ }
+ PinchArea {
+ objectName: "pincharea"
+ pinch.target: rect
+ anchors.fill: parent
+
+ pinch.minimumScale: 1.0
+ pinch.maximumScale: 10.0
+ }
+ }
+}
+
diff --git a/tests/auto/quick/touchmouse/data/singleitem.qml b/tests/auto/quick/touchmouse/data/singleitem.qml
new file mode 100644
index 0000000000..76d3a51da9
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/singleitem.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Rectangle {
+ id: root
+ width: 320
+ height: 480
+ color: "green"
+
+ EventItem {
+ objectName: "eventItem1"
+ x: 5
+ y: 5
+ height: 30
+ width: 30
+ }
+}
+
diff --git a/tests/auto/quick/touchmouse/data/twoMouseAreas.qml b/tests/auto/quick/touchmouse/data/twoMouseAreas.qml
new file mode 100644
index 0000000000..a02a6a4444
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/twoMouseAreas.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "#0c6d49"
+ objectName: "top rect"
+
+ Rectangle {
+ id: greyRectangle
+ objectName: "grey rect"
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: parent.top
+ }
+ height: parent.height / 2
+ color: "grey"
+ }
+
+ MouseArea {
+ objectName: "rear mouseArea"
+ anchors.fill: parent
+ }
+
+ MouseArea {
+ objectName: "front mouseArea"
+ anchors.fill: greyRectangle
+ onPressed: {
+ mouse.accepted = false;
+ }
+ }
+}
diff --git a/tests/auto/quick/touchmouse/data/twoitems.qml b/tests/auto/quick/touchmouse/data/twoitems.qml
new file mode 100644
index 0000000000..afbf35fe1a
--- /dev/null
+++ b/tests/auto/quick/touchmouse/data/twoitems.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+import Qt.test 1.0
+
+Rectangle {
+ id: root
+ width: 320
+ height: 480
+ color: "green"
+
+ EventItem {
+ objectName: "eventItem1"
+ height: 200
+ width: 100
+
+ EventItem {
+ objectName: "eventItem2"
+ height: 100
+ width: 100
+ }
+ }
+}
+
diff --git a/tests/auto/quick/touchmouse/touchmouse.pro b/tests/auto/quick/touchmouse/touchmouse.pro
new file mode 100644
index 0000000000..bba0abdc17
--- /dev/null
+++ b/tests/auto/quick/touchmouse/touchmouse.pro
@@ -0,0 +1,20 @@
+CONFIG += testcase
+
+TARGET = tst_touchmouse
+QT += core-private gui-private qml-private quick-private v8-private testlib
+
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_touchmouse.cpp
+
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+# OTHER_FILES += data/foo.qml
+
+CONFIG += parallel_test
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+mac:CONFIG+=insignificant_test # QTBUG-27890
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
new file mode 100644
index 0000000000..15a4f0cc27
--- /dev/null
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -0,0 +1,972 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QtGui/qstylehints.h>
+
+#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquickmousearea_p.h>
+#include <QtQuick/private/qquickmultipointtoucharea_p.h>
+#include <QtQuick/private/qquickpincharea_p.h>
+#include <QtQuick/private/qquickflickable_p.h>
+#include <qpa/qwindowsysteminterface.h>
+
+#include <private/qquickwindow_p.h>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlproperty.h>
+
+#include "../../shared/util.h"
+
+struct Event
+{
+ Event(QEvent::Type t, QPoint mouse, QPoint global)
+ :type(t), mousePos(mouse), mousePosGlobal(global)
+ {}
+
+ Event(QEvent::Type t, QList<QTouchEvent::TouchPoint> touch)
+ :type(t), points(touch)
+ {}
+
+ QEvent::Type type;
+ QPoint mousePos;
+ QPoint mousePosGlobal;
+ QList<QTouchEvent::TouchPoint> points;
+};
+
+class EventItem : public QQuickItem
+{
+ Q_OBJECT
+public:
+ EventItem(QQuickItem *parent = 0)
+ : QQuickItem(parent), acceptMouse(false), acceptTouch(false), filterTouch(false)
+ {}
+
+ void touchEvent(QTouchEvent *event)
+ {
+ eventList.append(Event(event->type(), event->touchPoints()));
+ event->setAccepted(acceptTouch);
+ }
+ void mousePressEvent(QMouseEvent *event)
+ {
+ eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ event->setAccepted(acceptMouse);
+ }
+ void mouseMoveEvent(QMouseEvent *event)
+ {
+ eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ event->setAccepted(acceptMouse);
+ }
+ void mouseReleaseEvent(QMouseEvent *event)
+ {
+ eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ event->setAccepted(acceptMouse);
+ }
+ void mouseDoubleClickEvent(QMouseEvent *event)
+ {
+ eventList.append(Event(event->type(), event->pos(), event->globalPos()));
+ event->setAccepted(acceptMouse);
+ }
+ bool event(QEvent *event) {
+ if (event->type() == QEvent::UngrabMouse) {
+ eventList.append(Event(event->type(), QPoint(0,0), QPoint(0,0)));
+ }
+ return QQuickItem::event(event);
+ }
+
+ QList<Event> eventList;
+ bool acceptMouse;
+ bool acceptTouch;
+ bool filterTouch; // when used as event filter
+
+ bool eventFilter(QObject *, QEvent *event)
+ {
+ if (event->type() == QEvent::TouchBegin ||
+ event->type() == QEvent::TouchUpdate ||
+ event->type() == QEvent::TouchCancel ||
+ event->type() == QEvent::TouchEnd) {
+ QTouchEvent *touch = static_cast<QTouchEvent*>(event);
+ eventList.append(Event(event->type(), touch->touchPoints()));
+ if (filterTouch)
+ event->accept();
+ return true;
+ }
+ return false;
+ }
+};
+
+class tst_TouchMouse : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_TouchMouse()
+ :device(0)
+ {}
+
+private slots:
+ void initTestCase();
+
+ void simpleTouchEvent();
+ void testEventFilter();
+ void mouse();
+ void touchOverMouse();
+ void mouseOverTouch();
+
+ void buttonOnFlickable();
+ void buttonOnTouch();
+
+ void pinchOnFlickable();
+ void flickableOnPinch();
+ void mouseOnFlickableOnPinch();
+
+ void tapOnDismissiveTopMouseAreaClicksBottomOne();
+
+private:
+ QQuickView *createView();
+ QTouchDevice *device;
+};
+
+QQuickView *tst_TouchMouse::createView()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setGeometry(0,0,240,320);
+
+ return window;
+}
+
+void tst_TouchMouse::initTestCase()
+{
+ // This test assumes that we don't get synthesized mouse events from QGuiApplication
+ qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false);
+
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<EventItem>("Qt.test", 1, 0, "EventItem");
+ if (!device) {
+ device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+ }
+}
+
+void tst_TouchMouse::simpleTouchEvent()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("singleitem.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject() != 0);
+
+ EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
+ QVERIFY(eventItem1);
+
+ // Do not accept touch or mouse
+ QPoint p1;
+ p1 = QPoint(20, 20);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 1);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ p1 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 1);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 1);
+ eventItem1->eventList.clear();
+
+ // Accept touch
+ eventItem1->acceptTouch = true;
+ p1 = QPoint(20, 20);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 1);
+ p1 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 3);
+ eventItem1->eventList.clear();
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // Accept mouse
+ eventItem1->acceptTouch = false;
+ eventItem1->acceptMouse = true;
+ eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
+ p1 = QPoint(20, 20);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ QCOMPARE(windowPriv->mouseGrabberItem, eventItem1);
+
+ QPoint localPos = eventItem1->mapFromScene(p1).toPoint();
+ QPoint globalPos = window->mapToGlobal(p1);
+ QPoint scenePos = p1; // item is at 0,0
+ QCOMPARE(eventItem1->eventList.at(0).points.at(0).pos().toPoint(), localPos);
+ QCOMPARE(eventItem1->eventList.at(0).points.at(0).scenePos().toPoint(), scenePos);
+ QCOMPARE(eventItem1->eventList.at(0).points.at(0).screenPos().toPoint(), globalPos);
+ QCOMPARE(eventItem1->eventList.at(1).mousePos, localPos);
+ QCOMPARE(eventItem1->eventList.at(1).mousePosGlobal, globalPos);
+
+ p1 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 4);
+ QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchUpdate);
+ QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseMove);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 6);
+ QCOMPARE(eventItem1->eventList.at(4).type, QEvent::TouchEnd);
+ QCOMPARE(eventItem1->eventList.at(5).type, QEvent::MouseButtonRelease);
+ eventItem1->eventList.clear();
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // Accept mouse buttons but not the event
+ eventItem1->acceptTouch = false;
+ eventItem1->acceptMouse = false;
+ eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
+ p1 = QPoint(20, 20);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
+ p1 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ eventItem1->eventList.clear();
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // Accept touch and mouse
+ eventItem1->acceptTouch = true;
+ eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
+ p1 = QPoint(20, 20);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 1);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ p1 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::TouchUpdate);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 3);
+ QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd);
+ eventItem1->eventList.clear();
+
+ delete window;
+}
+
+void tst_TouchMouse::testEventFilter()
+{
+// // install event filter on item and see that it can grab events
+// QQuickView *window = createView();
+
+// window->setSource(testFileUrl("singleitem.qml"));
+// window->show();
+// window->requestActivate();
+// QVERIFY(window->rootObject() != 0);
+
+// EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
+// QVERIFY(eventItem1);
+// eventItem1->acceptTouch = true;
+
+// EventItem *filter = new EventItem;
+// filter->filterTouch = true;
+// eventItem1->installEventFilter(filter);
+
+// QPoint p1 = QPoint(20, 20);
+// QTest::touchEvent(window, device).press(0, p1, window);
+// // QEXPECT_FAIL("", "We do not implement event filters correctly", Abort);
+// QCOMPARE(eventItem1->eventList.size(), 0);
+// QCOMPARE(filter->eventList.size(), 1);
+// QTest::touchEvent(window, device).release(0, p1, window);
+// QCOMPARE(eventItem1->eventList.size(), 0);
+// QCOMPARE(filter->eventList.size(), 2);
+
+// delete filter;
+// delete window;
+}
+
+void tst_TouchMouse::mouse()
+{
+ // eventItem1
+ // - eventItem2
+
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("twoitems.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(window->rootObject() != 0);
+
+ EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
+ QVERIFY(eventItem1);
+ EventItem *eventItem2 = window->rootObject()->findChild<EventItem*>("eventItem2");
+ QVERIFY(eventItem2);
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ // bottom item likes mouse, top likes touch
+ eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
+ eventItem1->acceptMouse = true;
+ // item 2 doesn't accept anything, thus it sees a touch pass by
+ QPoint p1 = QPoint(30, 30);
+ QTest::touchEvent(window, device).press(0, p1, window);
+
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
+
+ delete window;
+}
+
+void tst_TouchMouse::touchOverMouse()
+{
+ // eventItem1
+ // - eventItem2
+
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("twoitems.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(window->rootObject() != 0);
+
+ EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
+ QVERIFY(eventItem1);
+ EventItem *eventItem2 = window->rootObject()->findChild<EventItem*>("eventItem2");
+ QVERIFY(eventItem2);
+
+ // bottom item likes mouse, top likes touch
+ eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
+ eventItem2->acceptTouch = true;
+
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ QPoint p1 = QPoint(20, 20);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ QCOMPARE(eventItem2->eventList.size(), 1);
+ QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
+ p1 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window);
+ QCOMPARE(eventItem2->eventList.size(), 2);
+ QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchUpdate);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem2->eventList.size(), 3);
+ QCOMPARE(eventItem2->eventList.at(2).type, QEvent::TouchEnd);
+ eventItem2->eventList.clear();
+
+ delete window;
+}
+
+void tst_TouchMouse::mouseOverTouch()
+{
+ // eventItem1
+ // - eventItem2
+
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("twoitems.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(window->rootObject() != 0);
+
+ EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
+ QVERIFY(eventItem1);
+ EventItem *eventItem2 = window->rootObject()->findChild<EventItem*>("eventItem2");
+ QVERIFY(eventItem2);
+
+ // bottom item likes mouse, top likes touch
+ eventItem1->acceptTouch = true;
+ eventItem2->setAcceptedMouseButtons(Qt::LeftButton);
+ eventItem2->acceptMouse = true;
+
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QPoint p1 = QPoint(20, 20);
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ QCOMPARE(eventItem2->eventList.size(), 2);
+ QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem2->eventList.at(1).type, QEvent::MouseButtonPress);
+
+
+// p1 += QPoint(10, 0);
+// QTest::touchEvent(window, device).move(0, p1, window);
+// QCOMPARE(eventItem2->eventList.size(), 1);
+// QTest::touchEvent(window, device).release(0, p1, window);
+// QCOMPARE(eventItem2->eventList.size(), 1);
+// eventItem2->eventList.clear();
+
+ delete window;
+}
+
+void tst_TouchMouse::buttonOnFlickable()
+{
+ // flickable - height 500 / 1000
+ // - eventItem1 y: 100, height 100
+ // - eventItem2 y: 300, height 100
+
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("buttononflickable.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flickable);
+
+ // should a mouse area button be clickable on top of flickable? yes :)
+ EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
+ QVERIFY(eventItem1);
+ eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
+ eventItem1->acceptMouse = true;
+
+ // should a touch button be touchable on top of flickable? yes :)
+ EventItem *eventItem2 = window->rootObject()->findChild<EventItem*>("eventItem2");
+ QVERIFY(eventItem2);
+ QCOMPARE(eventItem2->eventList.size(), 0);
+ eventItem2->acceptTouch = true;
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // check that buttons are clickable
+ // mouse button
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ QPoint p1 = QPoint(20, 130);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 4);
+ QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd);
+ QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseButtonRelease);
+ eventItem1->eventList.clear();
+
+ // touch button
+ p1 = QPoint(10, 310);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem2->eventList.size(), 1);
+ QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem2->eventList.size(), 2);
+ QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchEnd);
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ eventItem2->eventList.clear();
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // click above button, no events please
+ p1 = QPoint(10, 90);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ eventItem1->eventList.clear();
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // check that flickable moves - mouse button
+ QCOMPARE(eventItem1->eventList.size(), 0);
+ p1 = QPoint(10, 110);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
+
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ QCOMPARE(windowPriv->touchMouseId, 0);
+ QCOMPARE(windowPriv->itemForTouchPointId[0], eventItem1);
+ QCOMPARE(windowPriv->mouseGrabberItem, eventItem1);
+
+ p1 += QPoint(0, -10);
+ QPoint p2 = p1 + QPoint(0, -10);
+ QPoint p3 = p2 + QPoint(0, -10);
+ QTest::qWait(10);
+ QTest::touchEvent(window, device).move(0, p1, window);
+ QTest::qWait(10);
+ QTest::touchEvent(window, device).move(0, p2, window);
+ QTest::qWait(10);
+ QTest::touchEvent(window, device).move(0, p3, window);
+
+ // we cannot really know when the events get grabbed away
+ QVERIFY(eventItem1->eventList.size() >= 4);
+ QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchUpdate);
+ QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseMove);
+
+ QCOMPARE(windowPriv->mouseGrabberItem, flickable);
+ QVERIFY(flickable->isMovingVertically());
+
+ QTest::touchEvent(window, device).release(0, p3, window);
+ delete window;
+}
+
+void tst_TouchMouse::buttonOnTouch()
+{
+ // 400x800
+ // PinchArea - height 400
+ // - eventItem1 y: 100, height 100
+ // - eventItem2 y: 300, height 100
+ // MultiPointTouchArea - height 400
+ // - eventItem1 y: 100, height 100
+ // - eventItem2 y: 300, height 100
+
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("buttonontouch.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QVERIFY(pinchArea);
+ QQuickItem *button1 = window->rootObject()->findChild<QQuickItem*>("button1");
+ QVERIFY(button1);
+ EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1");
+ QVERIFY(eventItem1);
+ EventItem *eventItem2 = window->rootObject()->findChild<EventItem*>("eventItem2");
+ QVERIFY(eventItem2);
+
+ QQuickMultiPointTouchArea *touchArea = window->rootObject()->findChild<QQuickMultiPointTouchArea*>("toucharea");
+ QVERIFY(touchArea);
+ EventItem *eventItem3 = window->rootObject()->findChild<EventItem*>("eventItem3");
+ QVERIFY(eventItem3);
+ EventItem *eventItem4 = window->rootObject()->findChild<EventItem*>("eventItem4");
+ QVERIFY(eventItem4);
+
+
+ // Test the common case of a mouse area on top of pinch
+ eventItem1->setAcceptedMouseButtons(Qt::LeftButton);
+ eventItem1->acceptMouse = true;
+
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // Normal touch click
+ QPoint p1 = QPoint(10, 110);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::touchEvent(window, device).release(0, p1, window);
+ QCOMPARE(eventItem1->eventList.size(), 4);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
+ QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd);
+ QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseButtonRelease);
+ eventItem1->eventList.clear();
+
+ // Normal mouse click
+ QTest::mouseClick(window, Qt::LeftButton, 0, p1);
+ QCOMPARE(eventItem1->eventList.size(), 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease);
+ eventItem1->eventList.clear();
+
+ // Pinch starting on the PinchArea should work
+ p1 = QPoint(40, 10);
+ QPoint p2 = QPoint(60, 10);
+
+ // Start the events after each other
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::touchEvent(window, device).stationary(0).press(1, p2, window);
+
+ QCOMPARE(button1->scale(), 1.0);
+
+ // This event seems to be discarded, let's ignore it for now until someone digs into pincharea
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
+
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
+// QCOMPARE(button1->scale(), 1.5);
+ qDebug() << "Button scale: " << button1->scale();
+
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
+// QCOMPARE(button1->scale(), 2.0);
+ qDebug() << "Button scale: " << button1->scale();
+
+ QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
+// QVERIFY(eventItem1->eventList.isEmpty());
+// QCOMPARE(button1->scale(), 2.0);
+ qDebug() << "Button scale: " << button1->scale();
+
+
+ // wait to avoid getting a double click event
+ QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
+
+ // Start pinching while on the button
+ button1->setScale(1.0);
+ p1 = QPoint(40, 110);
+ p2 = QPoint(60, 110);
+ QTest::touchEvent(window, device).press(0, p1, window).press(1, p2, window);
+ QCOMPARE(button1->scale(), 1.0);
+ QCOMPARE(eventItem1->eventList.count(), 2);
+ QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin);
+ QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress);
+
+ // This event seems to be discarded, let's ignore it for now until someone digs into pincharea
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
+
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
+ //QCOMPARE(button1->scale(), 1.5);
+ qDebug() << button1->scale();
+
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window);
+ qDebug() << button1->scale();
+ //QCOMPARE(button1->scale(), 2.0);
+
+ QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
+// QCOMPARE(eventItem1->eventList.size(), 99);
+ qDebug() << button1->scale();
+ //QCOMPARE(button1->scale(), 2.0);
+
+ delete window;
+}
+
+void tst_TouchMouse::pinchOnFlickable()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("pinchonflickable.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QVERIFY(pinchArea);
+ QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flickable);
+ QQuickItem *rect = window->rootObject()->findChild<QQuickItem*>("rect");
+ QVERIFY(rect);
+
+ // flickable - single touch point
+ QVERIFY(flickable->contentX() == 0.0);
+ QPoint p = QPoint(100, 100);
+ QTest::touchEvent(window, device).press(0, p, window);
+ QCOMPARE(rect->position(), QPointF(200.0, 200.0));
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ QTest::qWait(10);
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ QTest::qWait(10);
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ QTest::touchEvent(window, device).release(0, p, window);
+
+ QGuiApplication::processEvents();
+ QTest::qWait(10);
+ QVERIFY(!flickable->isAtXBeginning());
+ // wait until flicking is done
+ QTRY_VERIFY(!flickable->isFlicking());
+
+ // pinch
+ QPoint p1 = QPoint(40, 20);
+ QPoint p2 = QPoint(60, 20);
+
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
+ pinchSequence.press(0, p1, window).commit();
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object. Otherwise if we let it
+ // be destroyed and then start a new sequence, point 0 will default to being
+ // stationary at 0, 0, and PinchArea will filter out that touchpoint because
+ // it is outside its bounds.
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ QCOMPARE(rect->scale(), 1.0);
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ pinchSequence.release(0, p1, window).release(1, p2, window).commit();
+ QVERIFY(rect->scale() > 1.0);
+}
+
+void tst_TouchMouse::flickableOnPinch()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("flickableonpinch.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QVERIFY(pinchArea);
+ QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flickable);
+ QQuickItem *rect = window->rootObject()->findChild<QQuickItem*>("rect");
+ QVERIFY(rect);
+
+ // flickable - single touch point
+ QVERIFY(flickable->contentX() == 0.0);
+ QPoint p = QPoint(100, 100);
+ QTest::touchEvent(window, device).press(0, p, window);
+ QCOMPARE(rect->position(), QPointF(200.0, 200.0));
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+
+ QTest::qWait(1000);
+
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ QTest::touchEvent(window, device).release(0, p, window);
+
+ QTest::qWait(1000);
+
+ //QVERIFY(flickable->isMovingHorizontally());
+ qDebug() << "Pos: " << rect->position();
+ // wait until flicking is done
+ QTRY_VERIFY(!flickable->isFlicking());
+
+ // pinch
+ QPoint p1 = QPoint(40, 20);
+ QPoint p2 = QPoint(60, 20);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
+ pinchSequence.press(0, p1, window).commit();
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object. Otherwise if we let it
+ // be destroyed and then start a new sequence, point 0 will default to being
+ // stationary at 0, 0, and PinchArea will filter out that touchpoint because
+ // it is outside its bounds.
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ QCOMPARE(rect->scale(), 1.0);
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ pinchSequence.release(0, p1, window).release(1, p2, window).commit();
+ QVERIFY(rect->scale() > 1.0);
+}
+
+void tst_TouchMouse::mouseOnFlickableOnPinch()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("mouseonflickableonpinch.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject() != 0);
+ QRect windowRect = QRect(window->position(), window->size());
+ QCursor::setPos(windowRect.center());
+
+ QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
+ QVERIFY(pinchArea);
+ QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flickable);
+ QQuickItem *rect = window->rootObject()->findChild<QQuickItem*>("rect");
+ QVERIFY(rect);
+
+ // flickable - single touch point
+ QVERIFY(flickable->contentX() == 0.0);
+ QPoint p = QPoint(100, 100);
+ QTest::touchEvent(window, device).press(0, p, window);
+ QCOMPARE(rect->position(), QPointF(200.0, 200.0));
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ QGuiApplication::processEvents();
+ p -= QPoint(10, 0);
+ QTest::touchEvent(window, device).move(0, p, window);
+ QTest::touchEvent(window, device).release(0, p, window);
+ QGuiApplication::processEvents();
+
+ //QVERIFY(flickable->isMovingHorizontally());
+ qDebug() << "Pos: " << rect->position();
+
+ // pinch
+ QPoint p1 = QPoint(40, 20);
+ QPoint p2 = QPoint(60, 20);
+ QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device);
+ pinchSequence.press(0, p1, window).commit();
+ // In order for the stationary point to remember its previous position,
+ // we have to reuse the same pinchSequence object. Otherwise if we let it
+ // be destroyed and then start a new sequence, point 0 will default to being
+ // stationary at 0, 0, and PinchArea will filter out that touchpoint because
+ // it is outside its bounds.
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ QCOMPARE(rect->scale(), 1.0);
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(10, 0);
+ p2 += QPoint(10, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ pinchSequence.release(0, p1, window).release(1, p2, window).commit();
+ QVERIFY(rect->scale() > 1.0);
+
+ // PinchArea should steal the event after flicking started
+ rect->setScale(1.0);
+ flickable->setContentX(0.0);
+ p = QPoint(100, 100);
+ pinchSequence.press(0, p, window).commit();
+ QCOMPARE(rect->position(), QPointF(200.0, 200.0));
+ p -= QPoint(10, 0);
+ pinchSequence.move(0, p, window).commit();
+ p -= QPoint(10, 0);
+ pinchSequence.move(0, p, window).commit();
+ QGuiApplication::processEvents();
+ p -= QPoint(10, 0);
+ pinchSequence.move(0, p, window).commit();
+
+ QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
+ qDebug() << "Mouse Grabber: " << windowPriv->mouseGrabberItem << " itemForTouchPointId: " << windowPriv->itemForTouchPointId;
+ QCOMPARE(windowPriv->mouseGrabberItem, flickable);
+
+ // Add a second finger, this should lead to stealing
+ p1 = QPoint(40, 100);
+ p2 = QPoint(60, 100);
+ pinchSequence.stationary(0).press(1, p2, window).commit();
+ QCOMPARE(rect->scale(), 1.0);
+
+ p1 -= QPoint(5, 0);
+ p2 += QPoint(5, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(5, 0);
+ p2 += QPoint(5, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ p1 -= QPoint(5, 0);
+ p2 += QPoint(5, 0);
+ pinchSequence.move(0, p1, window).move(1, p2, window).commit();
+ pinchSequence.release(0, p1, window).release(1, p2, window).commit();
+ QVERIFY(rect->scale() > 1.0);
+ pinchSequence.release(0, p, window).commit();
+}
+
+/*
+ Regression test for the following use case:
+ You have two mouse areas, on on top of the other.
+ 1 - You tap the top one.
+ 2 - That top mouse area receives a mouse press event but doesn't accept it
+ Expected outcome:
+ 3 - the bottom mouse area gets clicked (besides press and release mouse events)
+ Bogus outcome:
+ 3 - the bottom mouse area gets double clicked.
+ */
+void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne()
+{
+ QQuickView *window = createView();
+
+ window->setSource(testFileUrl("twoMouseAreas.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickMouseArea *bottomMouseArea =
+ window->rootObject()->findChild<QQuickMouseArea*>("rear mouseArea");
+
+ QSignalSpy bottomClickedSpy(bottomMouseArea, SIGNAL(clicked(QQuickMouseEvent*)));
+ QSignalSpy bottomDoubleClickedSpy(bottomMouseArea,
+ SIGNAL(doubleClicked(QQuickMouseEvent*)));
+
+ // tap the front mouse area (see qml file)
+ QPoint p1(20, 20);
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, device).release(0, p1, window);
+
+ QCOMPARE(bottomClickedSpy.count(), 1);
+ QCOMPARE(bottomDoubleClickedSpy.count(), 0);
+ QTest::qWait(15);
+
+ QTest::touchEvent(window, device).press(0, p1, window);
+ QTest::qWait(1);
+ QTest::touchEvent(window, device).release(0, p1, window);
+
+ QCOMPARE(bottomClickedSpy.count(), 1);
+ QCOMPARE(bottomDoubleClickedSpy.count(), 1);
+
+ delete window;
+}
+
+QTEST_MAIN(tst_TouchMouse)
+
+#include "tst_touchmouse.moc"
+
diff --git a/tests/auto/shared/imports.pri b/tests/auto/shared/imports.pri
new file mode 100644
index 0000000000..20e9bcb371
--- /dev/null
+++ b/tests/auto/shared/imports.pri
@@ -0,0 +1,7 @@
+
+copyimportfiles.input = IMPORT_FILES
+copyimportfiles.output = $$DESTDIR/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
+copyimportfiles.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+copyimportfiles.CONFIG += no_link_no_clean
+copyimportfiles.variable_out = PRE_TARGETDEPS
+QMAKE_EXTRA_COMPILERS += copyimportfiles
diff --git a/tests/auto/shared/platforminputcontext.h b/tests/auto/shared/platforminputcontext.h
new file mode 100644
index 0000000000..76f3b704de
--- /dev/null
+++ b/tests/auto/shared/platforminputcontext.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qpa/qplatforminputcontext.h>
+#include <QtGui/QInputMethod>
+
+class PlatformInputContext : public QPlatformInputContext
+{
+public:
+ PlatformInputContext()
+ : m_visible(false), m_action(QInputMethod::Click), m_cursorPosition(0),
+ m_invokeActionCallCount(0), m_showInputPanelCallCount(0), m_hideInputPanelCallCount(0),
+ m_updateCallCount(0), m_direction(Qt::LeftToRight)
+ {
+ }
+
+ virtual void showInputPanel()
+ {
+ m_visible = true;
+ m_showInputPanelCallCount++;
+ }
+ virtual void hideInputPanel()
+ {
+ m_visible = false;
+ m_hideInputPanelCallCount++;
+ }
+ virtual bool isInputPanelVisible() const
+ {
+ return m_visible;
+ }
+ virtual void invokeAction(QInputMethod::Action action, int cursorPosition)
+ {
+ m_invokeActionCallCount++;
+ m_action = action;
+ m_cursorPosition = cursorPosition;
+ }
+ virtual void update(Qt::InputMethodQueries)
+ {
+ m_updateCallCount++;
+ }
+
+ virtual QLocale locale() const
+ {
+ if (m_direction == Qt::RightToLeft)
+ return QLocale(QLocale::Arabic);
+ else
+ return QLocale(QLocale::English);
+ }
+
+ virtual Qt::LayoutDirection inputDirection() const
+ {
+ return m_direction;
+ }
+
+ void setInputDirection(Qt::LayoutDirection direction) {
+ m_direction = direction;
+ emitLocaleChanged();
+ emitInputDirectionChanged(inputDirection());
+ }
+
+ void clear() {
+ m_cursorPosition = 0;
+ m_invokeActionCallCount = 0;
+ m_visible = false;
+ m_showInputPanelCallCount = 0;
+ m_hideInputPanelCallCount = 0;
+ m_updateCallCount = 0;
+ }
+
+ bool m_visible;
+ QInputMethod::Action m_action;
+ int m_cursorPosition;
+ int m_invokeActionCallCount;
+ int m_showInputPanelCallCount;
+ int m_hideInputPanelCallCount;
+ int m_updateCallCount;
+ Qt::LayoutDirection m_direction;
+};
diff --git a/tests/auto/shared/platformquirks.h b/tests/auto/shared/platformquirks.h
new file mode 100644
index 0000000000..b03e4d63f6
--- /dev/null
+++ b/tests/auto/shared/platformquirks.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLATFORMQUIRKS_H
+#define PLATFORMQUIRKS_H
+
+#include <qglobal.h>
+
+#ifdef Q_OS_MAC
+#include <Carbon/Carbon.h>
+#endif
+
+struct PlatformQuirks
+{
+ static inline bool isClipboardAvailable()
+ {
+#if defined(QT_NO_CLIPBOARD)
+ return false;
+#elif defined(Q_OS_MAC)
+ PasteboardRef pasteboard;
+ OSStatus status = PasteboardCreate(0, &pasteboard);
+ if (status == noErr)
+ CFRelease(pasteboard);
+ return status == noErr;
+#else
+ return true;
+#endif
+ }
+};
+
+#endif
diff --git a/tests/auto/shared/testhttpserver.cpp b/tests/auto/shared/testhttpserver.cpp
new file mode 100644
index 0000000000..205d5cec5d
--- /dev/null
+++ b/tests/auto/shared/testhttpserver.cpp
@@ -0,0 +1,329 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhttpserver.h"
+#include <QTcpSocket>
+#include <QDebug>
+#include <QFile>
+#include <QTimer>
+
+/*!
+\internal
+\class TestHTTPServer
+\brief provides a very, very basic HTTP server for testing.
+
+Inside the test case, an instance of TestHTTPServer should be created, with the
+appropriate port to listen on. The server will listen on the localhost interface.
+
+Directories to serve can then be added to server, which will be added as "roots".
+Each root can be added as a Normal, Delay or Disconnect root. Requests for files
+within a Normal root are returned immediately. Request for files within a Delay
+root are delayed for 500ms, and then served. Requests for files within a Disconnect
+directory cause the server to disconnect immediately. A request for a file that isn't
+found in any root will return a 404 error.
+
+If you have the following directory structure:
+
+\code
+disconnect/disconnectTest.qml
+files/main.qml
+files/Button.qml
+files/content/WebView.qml
+slowFiles/slowMain.qml
+\endcode
+it can be added like this:
+\code
+TestHTTPServer server(14445);
+server.serveDirectory("disconnect", TestHTTPServer::Disconnect);
+server.serveDirectory("files");
+server.serveDirectory("slowFiles", TestHTTPServer::Delay);
+\endcode
+
+The following request urls will then result in the appropriate action:
+\table
+\header \li URL \li Action
+\row \li http://localhost:14445/disconnectTest.qml \li Disconnection
+\row \li http://localhost:14445/main.qml \li main.qml returned immediately
+\row \li http://localhost:14445/Button.qml \li Button.qml returned immediately
+\row \li http://localhost:14445/content/WebView.qml \li content/WebView.qml returned immediately
+\row \li http://localhost:14445/slowMain.qml \li slowMain.qml returned after 500ms
+\endtable
+*/
+TestHTTPServer::TestHTTPServer(quint16 port)
+: m_hasFailed(false)
+{
+ QObject::connect(&server, SIGNAL(newConnection()), this, SLOT(newConnection()));
+
+ server.listen(QHostAddress::LocalHost, port);
+}
+
+bool TestHTTPServer::isValid() const
+{
+ return server.isListening();
+}
+
+bool TestHTTPServer::serveDirectory(const QString &dir, Mode mode)
+{
+ dirs.append(qMakePair(dir, mode));
+ return true;
+}
+
+/*
+ Add an alias, so that if filename is requested and does not exist,
+ alias may be returned.
+*/
+void TestHTTPServer::addAlias(const QString &filename, const QString &alias)
+{
+ aliases.insert(filename, alias);
+}
+
+void TestHTTPServer::addRedirect(const QString &filename, const QString &redirectName)
+{
+ redirects.insert(filename, redirectName);
+}
+
+bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &body)
+{
+ m_hasFailed = false;
+
+ QFile expectFile(expect.toLocalFile());
+ if (!expectFile.open(QIODevice::ReadOnly)) return false;
+
+ QFile replyFile(reply.toLocalFile());
+ if (!replyFile.open(QIODevice::ReadOnly)) return false;
+
+ bodyData = QByteArray();
+ if (body.isValid()) {
+ QFile bodyFile(body.toLocalFile());
+ if (!bodyFile.open(QIODevice::ReadOnly)) return false;
+ bodyData = bodyFile.readAll();
+ }
+
+ waitData = expectFile.readAll();
+ /*
+ while (waitData.endsWith('\n'))
+ waitData = waitData.left(waitData.count() - 1);
+ */
+
+ replyData = replyFile.readAll();
+
+ if (!replyData.endsWith('\n'))
+ replyData.append("\n");
+ replyData.append("Content-length: " + QByteArray::number(bodyData.length()));
+ replyData .append("\n\n");
+
+ for (int ii = 0; ii < replyData.count(); ++ii) {
+ if (replyData.at(ii) == '\n' && (!ii || replyData.at(ii - 1) != '\r')) {
+ replyData.insert(ii, '\r');
+ ++ii;
+ }
+ }
+ replyData.append(bodyData);
+
+ return true;
+}
+
+bool TestHTTPServer::hasFailed() const
+{
+ return m_hasFailed;
+}
+
+void TestHTTPServer::newConnection()
+{
+ QTcpSocket *socket = server.nextPendingConnection();
+ if (!socket) return;
+
+ if (!dirs.isEmpty())
+ dataCache.insert(socket, QByteArray());
+
+ QObject::connect(socket, SIGNAL(disconnected()), this, SLOT(disconnected()));
+ QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
+}
+
+void TestHTTPServer::disconnected()
+{
+ QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
+ if (!socket) return;
+
+ dataCache.remove(socket);
+ for (int ii = 0; ii < toSend.count(); ++ii) {
+ if (toSend.at(ii).first == socket) {
+ toSend.removeAt(ii);
+ --ii;
+ }
+ }
+ socket->disconnect();
+ socket->deleteLater();
+}
+
+void TestHTTPServer::readyRead()
+{
+ QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
+ if (!socket || socket->state() == QTcpSocket::ClosingState) return;
+
+ QByteArray ba = socket->readAll();
+
+ if (!dirs.isEmpty()) {
+ serveGET(socket, ba);
+ return;
+ }
+
+ if (m_hasFailed || waitData.isEmpty()) {
+ qWarning() << "TestHTTPServer: Unexpected data" << ba;
+ return;
+ }
+
+ for (int ii = 0; ii < ba.count(); ++ii) {
+ const char c = ba.at(ii);
+ if (c == '\r' && waitData.isEmpty())
+ continue;
+ else if (!waitData.isEmpty() && c == waitData.at(0))
+ waitData = waitData.mid(1);
+ else if (c == '\r')
+ continue;
+ else {
+ QByteArray data = ba.mid(ii);
+ qWarning() << "TestHTTPServer: Unexpected data" << data << "\nExpected: " << waitData;
+ m_hasFailed = true;
+ socket->disconnectFromHost();
+ return;
+ }
+ }
+
+ if (waitData.isEmpty()) {
+ socket->write(replyData);
+ socket->disconnectFromHost();
+ }
+}
+
+bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileName)
+{
+ if (redirects.contains(fileName)) {
+ QByteArray response = "HTTP/1.1 302 Found\r\nContent-length: 0\r\nContent-type: text/html; charset=UTF-8\r\nLocation: " + redirects[fileName].toUtf8() + "\r\n\r\n";
+ socket->write(response);
+ return true;
+ }
+
+ for (int ii = 0; ii < dirs.count(); ++ii) {
+ QString dir = dirs.at(ii).first;
+ Mode mode = dirs.at(ii).second;
+
+ QString dirFile = dir + QLatin1String("/") + QLatin1String(fileName);
+
+ if (!QFile::exists(dirFile)) {
+ if (aliases.contains(fileName))
+ dirFile = dir + QLatin1String("/") + aliases.value(fileName);
+ }
+
+ QFile file(dirFile);
+ if (file.open(QIODevice::ReadOnly)) {
+
+ if (mode == Disconnect)
+ return true;
+
+ QByteArray data = file.readAll();
+
+ QByteArray response = "HTTP/1.0 200 OK\r\nContent-type: text/html; charset=UTF-8\r\nContent-length: ";
+ response += QByteArray::number(data.count());
+ response += "\r\n\r\n";
+ response += data;
+
+ if (mode == Delay) {
+ toSend.append(qMakePair(socket, response));
+ QTimer::singleShot(500, this, SLOT(sendOne()));
+ return false;
+ } else {
+ socket->write(response);
+ return true;
+ }
+ }
+ }
+
+
+ QByteArray response = "HTTP/1.0 404 Not found\r\nContent-type: text/html; charset=UTF-8\r\n\r\n";
+ socket->write(response);
+
+ return true;
+}
+
+void TestHTTPServer::sendDelayedItem()
+{
+ sendOne();
+}
+
+void TestHTTPServer::sendOne()
+{
+ if (!toSend.isEmpty()) {
+ toSend.first().first->write(toSend.first().second);
+ toSend.first().first->close();
+ toSend.removeFirst();
+ }
+}
+
+void TestHTTPServer::serveGET(QTcpSocket *socket, const QByteArray &data)
+{
+ if (!dataCache.contains(socket))
+ return;
+
+ QByteArray total = dataCache[socket] + data;
+ dataCache[socket] = total;
+
+ if (total.contains("\n\r\n")) {
+
+ bool close = true;
+
+ if (total.startsWith("GET /")) {
+
+ int space = total.indexOf(' ', 4);
+ if (space != -1) {
+
+ QByteArray req = total.mid(5, space - 5);
+ close = reply(socket, req);
+
+ }
+ }
+ dataCache.remove(socket);
+
+ if (close)
+ socket->disconnectFromHost();
+ }
+}
+
diff --git a/tests/auto/shared/testhttpserver.h b/tests/auto/shared/testhttpserver.h
new file mode 100644
index 0000000000..15e08afd0c
--- /dev/null
+++ b/tests/auto/shared/testhttpserver.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHTTPSERVER_H
+#define TESTHTTPSERVER_H
+
+#include <QObject>
+#include <QTcpServer>
+#include <QUrl>
+#include <QPair>
+
+class TestHTTPServer : public QObject
+{
+ Q_OBJECT
+public:
+ TestHTTPServer(quint16 port);
+
+ bool isValid() const;
+
+ enum Mode { Normal, Delay, Disconnect };
+ bool serveDirectory(const QString &, Mode = Normal);
+
+ bool wait(const QUrl &expect, const QUrl &reply, const QUrl &body);
+ bool hasFailed() const;
+
+ void addAlias(const QString &filename, const QString &aliasName);
+ void addRedirect(const QString &filename, const QString &redirectName);
+
+ // In Delay mode, each item needs one call to this function to be sent
+ void sendDelayedItem();
+
+private slots:
+ void newConnection();
+ void disconnected();
+ void readyRead();
+ void sendOne();
+
+private:
+ void serveGET(QTcpSocket *, const QByteArray &);
+ bool reply(QTcpSocket *, const QByteArray &);
+
+ QList<QPair<QString, Mode> > dirs;
+ QHash<QTcpSocket *, QByteArray> dataCache;
+ QList<QPair<QTcpSocket *, QByteArray> > toSend;
+
+ QByteArray waitData;
+ QByteArray replyData;
+ QByteArray bodyData;
+ bool m_hasFailed;
+
+ QHash<QString,QString> aliases;
+ QHash<QString,QString> redirects;
+
+ QTcpServer server;
+};
+
+#endif // TESTHTTPSERVER_H
+
diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp
new file mode 100644
index 0000000000..e0b14d60e1
--- /dev/null
+++ b/tests/auto/shared/util.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "util.h"
+
+#include <QtQml/QQmlComponent>
+#include <QtQml/QQmlError>
+#include <QtQml/QQmlContext>
+#include <QtQml/QQmlEngine>
+#include <QtCore/QTextStream>
+#include <QtCore/QDebug>
+#include <QtCore/QMutexLocker>
+
+QQmlDataTest *QQmlDataTest::m_instance = 0;
+
+QQmlDataTest::QQmlDataTest() :
+#ifdef QT_TESTCASE_BUILDDIR
+ m_dataDirectory(QTest::qFindTestData("data", QT_QMLTEST_DATADIR, 0, QT_TESTCASE_BUILDDIR)),
+#else
+ m_dataDirectory(QTest::qFindTestData("data", QT_QMLTEST_DATADIR, 0)),
+#endif
+
+ m_dataDirectoryUrl(QUrl::fromLocalFile(m_dataDirectory + QLatin1Char('/')))
+{
+ m_instance = this;
+}
+
+QQmlDataTest::~QQmlDataTest()
+{
+ m_instance = 0;
+}
+
+void QQmlDataTest::initTestCase()
+{
+ QVERIFY2(!m_dataDirectory.isEmpty(), "'data' directory not found");
+ m_directory = QFileInfo(m_dataDirectory).absolutePath();
+ QVERIFY2(QDir::setCurrent(m_directory), qPrintable(QLatin1String("Could not chdir to ") + m_directory));
+}
+
+QString QQmlDataTest::testFile(const QString &fileName) const
+{
+ if (m_directory.isEmpty())
+ qFatal("QQmlDataTest::initTestCase() not called.");
+ QString result = m_dataDirectory;
+ result += QLatin1Char('/');
+ result += fileName;
+ return result;
+}
+
+QByteArray QQmlDataTest::msgComponentError(const QQmlComponent &c,
+ const QQmlEngine *engine /* = 0 */)
+{
+ QString result;
+ const QList<QQmlError> errors = c.errors();
+ QTextStream str(&result);
+ str << "Component '" << c.url().toString() << "' has " << errors.size()
+ << " errors: '";
+ for (int i = 0; i < errors.size(); ++i) {
+ if (i)
+ str << ", '";
+ str << errors.at(i).toString() << '\'';
+
+ }
+ if (!engine)
+ if (QQmlContext *context = c.creationContext())
+ engine = context->engine();
+ if (engine) {
+ str << " Import paths: (" << engine->importPathList().join(QStringLiteral(", "))
+ << ") Plugin paths: (" << engine->pluginPathList().join(QStringLiteral(", "))
+ << ')';
+ }
+ return result.toLocal8Bit();
+}
+
+Q_GLOBAL_STATIC(QMutex, qQmlTestMessageHandlerMutex)
+
+QQmlTestMessageHandler *QQmlTestMessageHandler::m_instance = 0;
+
+void QQmlTestMessageHandler::messageHandler(QtMsgType, const QMessageLogContext &, const QString &message)
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ if (QQmlTestMessageHandler::m_instance)
+ QQmlTestMessageHandler::m_instance->m_messages.push_back(message);
+}
+
+QQmlTestMessageHandler::QQmlTestMessageHandler()
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ Q_ASSERT(!QQmlTestMessageHandler::m_instance);
+ QQmlTestMessageHandler::m_instance = this;
+ m_oldHandler = qInstallMessageHandler(messageHandler);
+}
+
+QQmlTestMessageHandler::~QQmlTestMessageHandler()
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ Q_ASSERT(QQmlTestMessageHandler::m_instance);
+ qInstallMessageHandler(m_oldHandler);
+ QQmlTestMessageHandler::m_instance = 0;
+}
diff --git a/tests/auto/shared/util.h b/tests/auto/shared/util.h
new file mode 100644
index 0000000000..dc93038251
--- /dev/null
+++ b/tests/auto/shared/util.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLTESTUTILS_H
+#define QQMLTESTUTILS_H
+
+#include <QtCore/QDir>
+#include <QtCore/QUrl>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QStringList>
+#include <QtTest/QTest>
+
+QT_FORWARD_DECLARE_CLASS(QQmlComponent)
+QT_FORWARD_DECLARE_CLASS(QQmlEngine)
+
+/* Base class for tests with data that are located in a "data" subfolder. */
+
+class QQmlDataTest : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDataTest();
+ virtual ~QQmlDataTest();
+
+ QString testFile(const QString &fileName) const;
+ inline QString testFile(const char *fileName) const
+ { return testFile(QLatin1String(fileName)); }
+ inline QUrl testFileUrl(const QString &fileName) const
+ { return QUrl::fromLocalFile(testFile(fileName)); }
+ inline QUrl testFileUrl(const char *fileName) const
+ { return testFileUrl(QLatin1String(fileName)); }
+
+ inline QString dataDirectory() const { return m_dataDirectory; }
+ inline QUrl dataDirectoryUrl() const { return m_dataDirectoryUrl; }
+ inline QString directory() const { return m_directory; }
+
+ static inline QQmlDataTest *instance() { return m_instance; }
+
+ static QByteArray msgComponentError(const QQmlComponent &,
+ const QQmlEngine *engine = 0);
+
+public slots:
+ virtual void initTestCase();
+
+private:
+ static QQmlDataTest *m_instance;
+
+ const QString m_dataDirectory;
+ const QUrl m_dataDirectoryUrl;
+ QString m_directory;
+};
+
+class QQmlTestMessageHandler
+{
+ Q_DISABLE_COPY(QQmlTestMessageHandler)
+public:
+ QQmlTestMessageHandler();
+ ~QQmlTestMessageHandler();
+
+ const QStringList &messages() const { return m_messages; }
+ const QString messageString() const { return m_messages.join(QLatin1Char('\n')); }
+
+ void clear() { m_messages.clear(); }
+
+private:
+ static void messageHandler(QtMsgType, const QMessageLogContext &, const QString &message);
+
+ static QQmlTestMessageHandler *m_instance;
+ QStringList m_messages;
+ QtMessageHandler m_oldHandler;
+};
+
+#endif // QQMLTESTUTILS_H
diff --git a/tests/auto/shared/util.pri b/tests/auto/shared/util.pri
new file mode 100644
index 0000000000..8e82dcb33b
--- /dev/null
+++ b/tests/auto/shared/util.pri
@@ -0,0 +1,5 @@
+
+HEADERS += $$PWD/util.h
+SOURCES += $$PWD/util.cpp
+
+DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\"
diff --git a/tests/benchmarks/particles/affectors/affectors.pro b/tests/benchmarks/particles/affectors/affectors.pro
new file mode 100644
index 0000000000..687422c7ec
--- /dev/null
+++ b/tests/benchmarks/particles/affectors/affectors.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_affectors
+SOURCES += tst_affectors.cpp
+macx:CONFIG -= app_bundle
+
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
+
+QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/particles/affectors/data/basic.qml b/tests/benchmarks/particles/affectors/data/basic.qml
new file mode 100644
index 0000000000..b09bf948ea
--- /dev/null
+++ b/tests/benchmarks/particles/affectors/data/basic.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+ running: false //Benchmark will manage it
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ id: emitter
+ enabled: false
+ size: 32
+ emitRate: 1000
+ lifeSpan: Emitter.InfiniteLife
+ maximumEmitted: 1000
+ Component.onCompleted: emitter.burst(1000);
+ }
+
+ Affector{
+ }
+ }
+}
diff --git a/tests/benchmarks/particles/affectors/data/filtered.qml b/tests/benchmarks/particles/affectors/data/filtered.qml
new file mode 100644
index 0000000000..05dda9ded8
--- /dev/null
+++ b/tests/benchmarks/particles/affectors/data/filtered.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+ running: false //Benchmark will manage it
+
+ ImageParticle {
+ groups: ["A"]
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //central position
+ id: emitter
+ x: 160
+ y: 160
+ group: "A"
+ size: 32
+ emitRate: 1000
+ lifeSpan: Emitter.InfiniteLife
+ maximumEmitted: 1000
+ enabled: false
+ Component.onCompleted: emitter.burst(1000);
+ }
+
+ Affector{
+ groups: ["A"]
+ anchors.fill: parent
+ //whenCollidingWith: ["A"] //Test separately?
+ }
+ }
+}
diff --git a/tests/benchmarks/particles/affectors/tst_affectors.cpp b/tests/benchmarks/particles/affectors/tst_affectors.cpp
new file mode 100644
index 0000000000..a28561ab0b
--- /dev/null
+++ b/tests/benchmarks/particles/affectors/tst_affectors.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include "../../../auto/particles/shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+
+class tst_affectors : public QObject
+{
+ Q_OBJECT
+public:
+ tst_affectors();
+
+private slots:
+ void test_basic();
+ void test_basic_data();
+ void test_filtered();
+ void test_filtered_data();
+};
+
+tst_affectors::tst_affectors()
+{
+}
+
+void tst_affectors::test_basic_data()
+{
+ QTest::addColumn<int> ("dt");
+ QTest::newRow("16ms") << 16;
+ QTest::newRow("32ms") << 32;
+ QTest::newRow("100ms") << 100;
+ QTest::newRow("500ms") << 500;
+}
+
+void tst_affectors::test_filtered_data()
+{
+ QTest::addColumn<int> ("dt");
+ QTest::newRow("16ms") << 16;
+ QTest::newRow("32ms") << 32;
+ QTest::newRow("100ms") << 100;
+ QTest::newRow("500ms") << 500;
+}
+
+void tst_affectors::test_basic()
+{
+ QFETCH(int, dt);
+ QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ //Pretend we're running, but we manually advance the simulation
+ system->m_running = true;
+ system->m_animation = 0;
+ system->reset();
+
+ int curTime = 1;
+ system->updateCurrentTime(curTime);//Fixed point and get init out of the way - including emission
+
+ QBENCHMARK {
+ curTime += dt;
+ system->updateCurrentTime(curTime);
+ }
+
+ int stillAlive = 0;
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 1000, 10));//Small simulation variance is permissible.
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ if (d->stillAlive())
+ stillAlive++;
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ QVERIFY(extremelyFuzzyCompare(stillAlive, 1000, 10));//Small simulation variance is permissible.
+ delete view;
+}
+
+void tst_affectors::test_filtered()
+{
+ QFETCH(int, dt);
+ QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/filtered.qml");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ //Pretend we're running, but we manually advance the simulation
+ system->m_running = true;
+ system->m_animation = 0;
+ system->reset();
+
+ int curTime = 1;
+ system->updateCurrentTime(curTime);//Fixed point and get init out of the way - including emission
+
+ QBENCHMARK {
+ curTime += dt;
+ system->updateCurrentTime(curTime);
+ }
+
+ int stillAlive = 0;
+ QVERIFY(extremelyFuzzyCompare(system->groupData[1]->size(), 1000, 10));//Small simulation variance is permissible.
+ foreach (QQuickParticleData *d, system->groupData[1]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ if (d->stillAlive())
+ stillAlive++;
+ QCOMPARE(d->x, 160.f);
+ QCOMPARE(d->y, 160.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ QVERIFY(extremelyFuzzyCompare(stillAlive, 1000, 10));//Small simulation variance is permissible.
+ delete view;
+}
+
+QTEST_MAIN(tst_affectors);
+
+#include "tst_affectors.moc"
diff --git a/tests/benchmarks/particles/emission/data/basic.qml b/tests/benchmarks/particles/emission/data/basic.qml
new file mode 100644
index 0000000000..409983db6d
--- /dev/null
+++ b/tests/benchmarks/particles/emission/data/basic.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 320
+ height: 320
+
+ ParticleSystem {
+ id: sys
+ objectName: "system"
+ anchors.fill: parent
+ running: false //Benchmark will manage it
+
+ ImageParticle {
+ source: "../../shared/star.png"
+ }
+
+ Emitter{
+ //0,0 position
+ size: 32
+ emitRate: 2000
+ lifeSpan: 500
+ }
+ }
+}
diff --git a/tests/benchmarks/particles/emission/emission.pro b/tests/benchmarks/particles/emission/emission.pro
new file mode 100644
index 0000000000..7ffded64b3
--- /dev/null
+++ b/tests/benchmarks/particles/emission/emission.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_emission
+SOURCES += tst_emission.cpp
+macx:CONFIG -= app_bundle
+
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
+
+QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/particles/emission/tst_emission.cpp b/tests/benchmarks/particles/emission/tst_emission.cpp
new file mode 100644
index 0000000000..fe6e4a8265
--- /dev/null
+++ b/tests/benchmarks/particles/emission/tst_emission.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include "../../../auto/particles/shared/particlestestsshared.h"
+#include <private/qquickparticlesystem_p.h>
+
+class tst_emission : public QObject
+{
+ Q_OBJECT
+public:
+ tst_emission();
+
+private slots:
+ void test_basic();
+ void test_basic_data();
+};
+
+tst_emission::tst_emission()
+{
+}
+
+void tst_emission::test_basic_data()
+{
+ QTest::addColumn<int> ("dt");
+ QTest::newRow("16ms") << 16;
+ QTest::newRow("32ms") << 32;
+ QTest::newRow("100ms") << 100;
+ QTest::newRow("500ms") << 500;
+ QTest::newRow("1000ms") << 1000;
+ QTest::newRow("10000ms") << 10000;
+}
+
+void tst_emission::test_basic()
+{
+ QFETCH(int, dt);
+ QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml");
+ QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
+ //Pretend we're running, but we manually advance the simulation
+ system->m_running = true;
+ system->m_animation = 0;
+ system->reset();
+
+ int curTime = 1;
+ system->updateCurrentTime(curTime);//Fixed point and get init out of the way.
+
+ while (curTime < 500){//Minimum time needed to get enough alive
+ QBENCHMARK {
+ curTime += dt;
+ system->updateCurrentTime(curTime);
+ }
+ }
+
+ int stillAlive = 0;
+ QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 1000, 10));//Small simulation variance is permissible.
+ foreach (QQuickParticleData *d, system->groupData[0]->data) {
+ if (d->t == -1)
+ continue; //Particle data unused
+
+ if (d->stillAlive())
+ stillAlive++;
+ QCOMPARE(d->x, 0.f);
+ QCOMPARE(d->y, 0.f);
+ QCOMPARE(d->vx, 0.f);
+ QCOMPARE(d->vy, 0.f);
+ QCOMPARE(d->ax, 0.f);
+ QCOMPARE(d->ay, 0.f);
+ QCOMPARE(d->lifeSpan, 0.5f);
+ QCOMPARE(d->size, 32.f);
+ QCOMPARE(d->endSize, 32.f);
+ QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
+ }
+ QVERIFY(extremelyFuzzyCompare(stillAlive, 1000, 10));//Small simulation variance is permissible.
+ delete view;
+}
+
+QTEST_MAIN(tst_emission);
+
+#include "tst_emission.moc"
diff --git a/tests/benchmarks/particles/particles.pro b/tests/benchmarks/particles/particles.pro
new file mode 100644
index 0000000000..535bedd1f9
--- /dev/null
+++ b/tests/benchmarks/particles/particles.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ emission \
+ affectors
diff --git a/tests/benchmarks/qml/animation/animation.pro b/tests/benchmarks/qml/animation/animation.pro
new file mode 100644
index 0000000000..7490c5fe39
--- /dev/null
+++ b/tests/benchmarks/qml/animation/animation.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+TARGET = tst_animation
+QT += qml
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_animation.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+QT += testlib core-private gui-private qml-private quick-private v8-private
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/animation/data/animation.qml b/tests/benchmarks/qml/animation/data/animation.qml
new file mode 100644
index 0000000000..cb6d3034d1
--- /dev/null
+++ b/tests/benchmarks/qml/animation/data/animation.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ParallelAnimation {
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+ NumberAnimation {}
+}
diff --git a/tests/benchmarks/qml/animation/tst_animation.cpp b/tests/benchmarks/qml/animation/tst_animation.cpp
new file mode 100644
index 0000000000..3b9d795a05
--- /dev/null
+++ b/tests/benchmarks/qml/animation/tst_animation.cpp
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <private/qqmlmetatype_p.h>
+#include <private/qquickanimation_p_p.h>
+#include <QQmlContext>
+
+class tst_animation : public QObject
+{
+ Q_OBJECT
+public:
+ tst_animation();
+
+private slots:
+ void abstractAnimation();
+ void bulkValueAnimator();
+ void propertyUpdater();
+
+ void animationtree_qml();
+
+ void animationelements_data();
+ void animationelements();
+
+ void numberAnimation();
+ void numberAnimationStarted();
+ void numberAnimationMultipleTargets();
+ void numberAnimationEmpty();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_animation::tst_animation()
+{
+}
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+void tst_animation::abstractAnimation()
+{
+ QBENCHMARK {
+ QAbstractAnimationJob *animation = new QAbstractAnimationJob;
+ delete animation;
+ }
+}
+
+void tst_animation::bulkValueAnimator()
+{
+ QBENCHMARK {
+ QQuickBulkValueAnimator *animator = new QQuickBulkValueAnimator;
+ delete animator;
+ }
+}
+
+void tst_animation::propertyUpdater()
+{
+ QBENCHMARK {
+ QQuickAnimationPropertyUpdater *updater = new QQuickAnimationPropertyUpdater;
+ delete updater;
+ }
+}
+
+void tst_animation::animationtree_qml()
+{
+ QQmlComponent component(&engine, TEST_FILE("animation.qml"));
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_animation::animationelements_data()
+{
+ QTest::addColumn<QString>("type");
+
+ QSet<QString> types = QQmlMetaType::qmlTypeNames().toSet();
+ foreach (const QString &type, types) {
+ if (type.contains(QLatin1String("Animation")))
+ QTest::newRow(type.toLatin1()) << type;
+ }
+
+ QTest::newRow("QtQuick/Behavior") << "QtQuick/Behavior";
+ QTest::newRow("QtQuick/Transition") << "QtQuick/Transition";
+}
+
+void tst_animation::animationelements()
+{
+ QFETCH(QString, type);
+ QQmlType *t = QQmlMetaType::qmlType(type, 2, 0);
+ if (!t || !t->isCreatable())
+ QSKIP("Non-creatable type");
+
+ QBENCHMARK {
+ QObject *obj = t->create();
+ delete obj;
+ }
+}
+
+void tst_animation::numberAnimation()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem { Rectangle { id: rect; NumberAnimation { target: rect; property: \"x\"; to: 100; duration: 500; easing.type: Easing.InOutQuad } } }", QUrl());
+
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_animation::numberAnimationStarted()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem { Rectangle { id: rect; NumberAnimation { target: rect; property: \"x\"; to: 100; duration: 500; easing.type: Easing.InOutQuad; running: true; paused: true } } }", QUrl());
+
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_animation::numberAnimationMultipleTargets()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nItem { Rectangle { id: rect; NumberAnimation { target: rect; properties: \"x,y,z,width,height,implicitWidth,implicitHeight\"; to: 100; duration: 500; easing.type: Easing.InOutQuad; running: true; paused: true } } }", QUrl());
+
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_animation::numberAnimationEmpty()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nNumberAnimation { }", QUrl());
+
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+QTEST_MAIN(tst_animation)
+
+#include "tst_animation.moc"
diff --git a/tests/benchmarks/qml/binding/binding.pro b/tests/benchmarks/qml/binding/binding.pro
new file mode 100644
index 0000000000..fc0f731da6
--- /dev/null
+++ b/tests/benchmarks/qml/binding/binding.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_binding
+QT += qml testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_binding.cpp testtypes.cpp
+HEADERS += testtypes.h
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/binding/data/creation.txt b/tests/benchmarks/qml/binding/data/creation.txt
new file mode 100644
index 0000000000..05704fa341
--- /dev/null
+++ b/tests/benchmarks/qml/binding/data/creation.txt
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyQmlObject {
+ id: myObject
+ property int myValue: 1
+ object: myObject
+
+ result: ###
+}
diff --git a/tests/benchmarks/qml/binding/data/idproperty.txt b/tests/benchmarks/qml/binding/data/idproperty.txt
new file mode 100644
index 0000000000..4e474ba49a
--- /dev/null
+++ b/tests/benchmarks/qml/binding/data/idproperty.txt
@@ -0,0 +1,9 @@
+import Test 1.0
+
+MyQmlObject {
+ id: myObject
+
+ MyQmlObject {
+ result: ###
+ }
+}
diff --git a/tests/benchmarks/qml/binding/data/localproperty.txt b/tests/benchmarks/qml/binding/data/localproperty.txt
new file mode 100644
index 0000000000..c7ca0efdb4
--- /dev/null
+++ b/tests/benchmarks/qml/binding/data/localproperty.txt
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyQmlObject {
+ result: ###
+}
diff --git a/tests/benchmarks/qml/binding/data/objectproperty.txt b/tests/benchmarks/qml/binding/data/objectproperty.txt
new file mode 100644
index 0000000000..06409f2dd1
--- /dev/null
+++ b/tests/benchmarks/qml/binding/data/objectproperty.txt
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyQmlObject {
+ id: myObject
+ object: myObject
+
+ result: ###
+}
diff --git a/tests/benchmarks/qml/binding/testtypes.cpp b/tests/benchmarks/qml/binding/testtypes.cpp
new file mode 100644
index 0000000000..7aa8cd9d55
--- /dev/null
+++ b/tests/benchmarks/qml/binding/testtypes.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+
+void registerTypes()
+{
+ qmlRegisterType<MyQmlObject>("Test", 1, 0, "MyQmlObject");
+}
diff --git a/tests/benchmarks/qml/binding/testtypes.h b/tests/benchmarks/qml/binding/testtypes.h
new file mode 100644
index 0000000000..f692ed03ff
--- /dev/null
+++ b/tests/benchmarks/qml/binding/testtypes.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QtQml/qqml.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(QQmlListProperty<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(); }
+
+ QQmlListProperty<QObject> data() { return QQmlListProperty<QObject>(this, m_data); }
+
+ MyQmlObject *object() const { return m_object; }
+ void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); }
+
+signals:
+ void valueChanged();
+ void objectChanged();
+
+private:
+ QList<QObject *> m_data;
+ int m_result;
+ int m_value;
+ MyQmlObject *m_object;
+};
+QML_DECLARE_TYPE(MyQmlObject);
+
+void registerTypes();
+
+#endif // TESTTYPES_H
diff --git a/tests/benchmarks/qml/binding/tst_binding.cpp b/tests/benchmarks/qml/binding/tst_binding.cpp
new file mode 100644
index 0000000000..6e59187215
--- /dev/null
+++ b/tests/benchmarks/qml/binding/tst_binding.cpp
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QQmlComponent>
+#include <QFile>
+#include <QDebug>
+#include "testtypes.h"
+
+class tst_binding : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_binding();
+ virtual ~tst_binding();
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+private slots:
+ void objectproperty_data();
+ void objectproperty();
+ void basicproperty_data();
+ void basicproperty();
+ void creation_data();
+ void creation();
+
+private:
+ QQmlEngine engine;
+ MyQmlObject tstObject;
+};
+
+tst_binding::tst_binding()
+{
+}
+
+tst_binding::~tst_binding()
+{
+}
+
+void tst_binding::initTestCase()
+{
+ registerTypes();
+ engine.rootContext()->setContextProperty("tstObject", &tstObject);
+}
+
+void tst_binding::cleanupTestCase()
+{
+}
+
+#define COMPONENT(filename, binding) \
+ QQmlComponent 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") << SRCDIR "/data/objectproperty.txt" << "object.value";
+ QTest::newRow("object.value + 10") << SRCDIR "/data/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") << SRCDIR "/data/localproperty.txt" << "value";
+ QTest::newRow("value + 10") << SRCDIR "/data/localproperty.txt" << "value + 10";
+ QTest::newRow("value + value + 10") << SRCDIR "/data/localproperty.txt" << "value + value + 10";
+
+ QTest::newRow("myObject.value") << SRCDIR "/data/idproperty.txt" << "myObject.value";
+ QTest::newRow("myObject.value + 10") << SRCDIR "/data/idproperty.txt" << "myObject.value + 10";
+ QTest::newRow("myObject.value + myObject.value + 10") << SRCDIR "/data/idproperty.txt" << "myObject.value + myObject.value + 10";
+}
+
+void tst_binding::basicproperty()
+{
+ 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);
+ }
+}
+
+void tst_binding::creation_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("binding");
+
+ QTest::newRow("constant") << SRCDIR "/data/creation.txt" << "10";
+ QTest::newRow("ownProperty") << SRCDIR "/data/creation.txt" << "myObject.value";
+ QTest::newRow("declaredProperty") << SRCDIR "/data/creation.txt" << "myObject.myValue";
+ QTest::newRow("contextProperty") << SRCDIR "/data/creation.txt" << "tstObject.value";
+}
+
+void tst_binding::creation()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, binding);
+
+ COMPONENT(file, binding);
+
+ QBENCHMARK {
+ QObject *o = c.create();
+ delete o;
+ }
+}
+
+QTEST_MAIN(tst_binding)
+#include "tst_binding.moc"
diff --git a/tests/benchmarks/qml/compilation/compilation.pro b/tests/benchmarks/qml/compilation/compilation.pro
new file mode 100644
index 0000000000..63c3da694f
--- /dev/null
+++ b/tests/benchmarks/qml/compilation/compilation.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_compilation
+QT += qml qml-private testlib core-private v8-private
+macx:CONFIG -= app_bundle
+
+CONFIG += release
+
+SOURCES += tst_compilation.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/compilation/data/BoomBlock.qml b/tests/benchmarks/qml/compilation/data/BoomBlock.qml
new file mode 100644
index 0000000000..6b262f7d9d
--- /dev/null
+++ b/tests/benchmarks/qml/compilation/data/BoomBlock.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.particles 1.0
+
+Item {
+ id: block
+ property bool dying: false
+ property bool spawned: false
+ property int type: 0
+ property int targetX: 0
+ property int targetY: 0
+
+ SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 }
+ SpringFollow on y { to: 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
+ Behavior on opacity { NumberAnimation { duration: 200 } }
+ anchors.fill: parent
+ }
+
+ Particles {
+ id: particles
+
+ width: 1; height: 1
+ anchors.centerIn: parent
+
+ emissionRate: 0
+ lifeSpan: 700; lifeSpanDeviation: 600
+ 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
+ StateChangeScript { script: particles.burst(50); }
+ PropertyChanges { target: img; opacity: 0 }
+ StateChangeScript { script: block.destroy(1000); }
+ }
+ ]
+}
diff --git a/tests/benchmarks/qml/compilation/tst_compilation.cpp b/tests/benchmarks/qml/compilation/tst_compilation.cpp
new file mode 100644
index 0000000000..148396622b
--- /dev/null
+++ b/tests/benchmarks/qml/compilation/tst_compilation.cpp
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/private/qqmljsengine_p.h>
+#include <QtQml/private/qqmljsmemorypool_p.h>
+#include <QtQml/private/qqmljsparser_p.h>
+#include <QtQml/private/qqmljslexer_p.h>
+#include <QtQml/private/qqmlscript_p.h>
+
+#include <QFile>
+#include <QDebug>
+#include <QTextStream>
+
+class tst_compilation : public QObject
+{
+ Q_OBJECT
+public:
+ tst_compilation();
+
+private slots:
+ void boomblock();
+
+ void jsparser_data();
+ void jsparser();
+
+ void scriptparser_data();
+ void scriptparser();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_compilation::tst_compilation()
+{
+}
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+void tst_compilation::boomblock()
+{
+ QFile f(SRCDIR + QLatin1String("/data/BoomBlock.qml"));
+ QVERIFY(f.open(QIODevice::ReadOnly));
+ QByteArray data = f.readAll();
+
+ //get rid of initialization effects
+ {
+ QQmlComponent c(&engine);
+ c.setData(data, QUrl());
+ }
+
+ QBENCHMARK {
+ QQmlComponent c(&engine);
+ c.setData(data, QUrl());
+// QVERIFY(c.isReady());
+ }
+}
+
+void tst_compilation::jsparser_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QTest::newRow("boomblock") << QString(SRCDIR + QLatin1String("/data/BoomBlock.qml"));
+}
+
+void tst_compilation::jsparser()
+{
+ QFETCH(QString, file);
+
+ QFile f(file);
+ QVERIFY(f.open(QIODevice::ReadOnly));
+ QByteArray data = f.readAll();
+
+ QTextStream stream(data, QIODevice::ReadOnly);
+ const QString code = stream.readAll();
+
+ QBENCHMARK {
+ QQmlJS::Engine engine;
+ QQmlJS::NodePool nodePool(file, &engine);
+
+ QQmlJS::Lexer lexer(&engine);
+ lexer.setCode(code, -1);
+
+ QQmlJS::Parser parser(&engine);
+ parser.parse();
+ parser.ast();
+ }
+}
+
+void tst_compilation::scriptparser_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QTest::newRow("boomblock") << QString(SRCDIR + QLatin1String("/data/BoomBlock.qml"));
+}
+
+void tst_compilation::scriptparser()
+{
+ QFETCH(QString, file);
+
+ QFile f(file);
+ QVERIFY(f.open(QIODevice::ReadOnly));
+ QByteArray data = f.readAll();
+
+ QUrl url = QUrl::fromLocalFile(file);
+
+ QBENCHMARK {
+ QQmlScript::Parser parser;
+ parser.parse(data, url);
+ parser.tree();
+ }
+}
+
+QTEST_MAIN(tst_compilation)
+
+#include "tst_compilation.moc"
diff --git a/tests/benchmarks/qml/creation/creation.pro b/tests/benchmarks/qml/creation/creation.pro
new file mode 100644
index 0000000000..8d26ef88df
--- /dev/null
+++ b/tests/benchmarks/qml/creation/creation.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_creation
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_creation.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+QT += core-private gui-private qml-private qtquick1-private widgets testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/creation/data/CustomItem.qml b/tests/benchmarks/qml/creation/data/CustomItem.qml
new file mode 100644
index 0000000000..dc2db9958f
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/CustomItem.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/tests/benchmarks/qml/creation/data/emptyCustomItem.qml b/tests/benchmarks/qml/creation/data/emptyCustomItem.qml
new file mode 100644
index 0000000000..ffef6f58fe
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/emptyCustomItem.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+CustomItem {
+
+}
diff --git a/tests/benchmarks/qml/creation/data/emptyItem.qml b/tests/benchmarks/qml/creation/data/emptyItem.qml
new file mode 100644
index 0000000000..dc2db9958f
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/emptyItem.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+
+}
diff --git a/tests/benchmarks/qml/creation/data/item.qml b/tests/benchmarks/qml/creation/data/item.qml
new file mode 100644
index 0000000000..3bb77f2dce
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/item.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+ Item {}
+}
diff --git a/tests/benchmarks/qml/creation/data/itemUsingOnComponentCompleted.qml b/tests/benchmarks/qml/creation/data/itemUsingOnComponentCompleted.qml
new file mode 100644
index 0000000000..4b899f2d89
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemUsingOnComponentCompleted.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ Component.onCompleted: {}
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithAnchoredChild.qml b/tests/benchmarks/qml/creation/data/itemWithAnchoredChild.qml
new file mode 100644
index 0000000000..18e2be65bd
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithAnchoredChild.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 10
+ height: 10
+
+ Item {
+ anchors.fill: parent
+ }
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithChildBindedToSize.qml b/tests/benchmarks/qml/creation/data/itemWithChildBindedToSize.qml
new file mode 100644
index 0000000000..e7890832b2
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithChildBindedToSize.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 10
+ height: 10
+
+ Item {
+ width: parent.width
+ height: parent.height
+ }
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithProperties.qml b/tests/benchmarks/qml/creation/data/itemWithProperties.qml
new file mode 100644
index 0000000000..d3c5ba216a
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithProperties.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property int p1: 1
+ property real p2: 1
+ property bool p3: true
+ property string p4: "foo"
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest1.qml b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest1.qml
new file mode 100644
index 0000000000..723aae4ed1
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest1.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property int p1: obj.p1
+ property real p2: obj.p2
+ property bool p3: obj.p3
+ property string p4: obj.p4
+
+ property QtObject obj: QtObject {
+ property int p1: 1
+ property real p2: 1
+ property bool p3: true
+ property string p4: "foo"
+ }
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest2.qml b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest2.qml
new file mode 100644
index 0000000000..b4b7553f46
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest2.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property int p1: obj ? obj.p1 : 0
+ property real p2: obj ? obj.p2 : 0
+ property bool p3: obj ? obj.p3 : false
+ property string p4: obj ? obj.p4 : "bar"
+
+ property QtObject obj: QtObject {
+ property int p1: 1
+ property real p2: 1
+ property bool p3: true
+ property string p4: "foo"
+ }
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest3.qml b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest3.qml
new file mode 100644
index 0000000000..757498ec96
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest3.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property int p1: obj.p1
+ property real p2: obj.p2
+ property bool p3: obj.p3
+ property string p4: obj.p4
+
+ QtObject {
+ id: obj
+ property int p1: 1
+ property real p2: 1
+ property bool p3: true
+ property string p4: "foo"
+ }
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest4.qml b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest4.qml
new file mode 100644
index 0000000000..3e1dcd4bb0
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest4.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property int p1: foo.p1
+ property real p2: foo.p2
+ property bool p3: foo.p3
+ property string p4: foo.p4
+
+ property alias foo: obj
+
+ QtObject {
+ id: obj
+ property int p1: 1
+ property real p2: 1
+ property bool p3: true
+ property string p4: "foo"
+ }
+}
diff --git a/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest5.qml b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest5.qml
new file mode 100644
index 0000000000..3c6ea66016
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/itemWithPropertyBindingsTest5.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property alias p1: obj.p1
+ property alias p2: obj.p2
+ property alias p3: obj.p3
+ property alias p4: obj.p4
+
+ QtObject {
+ id: obj
+ property int p1: 1
+ property real p2: 1
+ property bool p3: true
+ property string p4: "foo"
+ }
+}
diff --git a/tests/benchmarks/qml/creation/data/qobject.qml b/tests/benchmarks/qml/creation/data/qobject.qml
new file mode 100644
index 0000000000..ea5a5e2b1e
--- /dev/null
+++ b/tests/benchmarks/qml/creation/data/qobject.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+}
diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp
new file mode 100644
index 0000000000..4b5c1d1950
--- /dev/null
+++ b/tests/benchmarks/qml/creation/tst_creation.cpp
@@ -0,0 +1,397 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <private/qqmlmetatype_p.h>
+#include <QDebug>
+#include <QGraphicsScene>
+#include <QGraphicsItem>
+#include <QQuickItem>
+#include <QQmlContext>
+#include <QtQuick1/private/qdeclarativetextinput_p.h>
+#include <private/qobject_p.h>
+
+class tst_creation : public QObject
+{
+ Q_OBJECT
+public:
+ tst_creation();
+
+private slots:
+ void qobject_cpp();
+ void qobject_qml();
+ void qobject_qmltype();
+ void qobject_alloc();
+
+ void qobject_10flat_qml();
+ void qobject_10flat_cpp();
+
+ void qobject_10tree_qml();
+ void qobject_10tree_cpp();
+
+ void itemtree_notree_cpp();
+ void itemtree_objtree_cpp();
+ void itemtree_cpp();
+ void itemtree_data_cpp();
+ void itemtree_qml();
+ void itemtree_scene_cpp();
+
+ void elements_data();
+ void elements();
+
+ void itemtests_qml_data();
+ void itemtests_qml();
+
+private:
+ QQmlEngine engine;
+};
+
+class TestType : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(QQmlListProperty<QObject> resources READ resources)
+Q_CLASSINFO("DefaultProperty", "resources")
+public:
+ TestType(QObject *parent = 0)
+ : QObject(parent) {}
+
+ QQmlListProperty<QObject> resources() {
+ return QQmlListProperty<QObject>(this, 0, resources_append);
+ }
+
+ static void resources_append(QQmlListProperty<QObject> *p, QObject *o) {
+ o->setParent(p->object);
+ }
+};
+
+tst_creation::tst_creation()
+{
+ qmlRegisterType<TestType>("Qt.test", 1, 0, "TestType");
+
+ //get rid of initialization effects
+ QDeclarative1TextInput te;
+}
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+void tst_creation::qobject_cpp()
+{
+ QBENCHMARK {
+ QObject *obj = new QObject;
+ delete obj;
+ }
+}
+
+void tst_creation::qobject_qml()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nQtObject {}", QUrl());
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_creation::qobject_10flat_qml()
+{
+ QQmlComponent component(&engine);
+ component.setData("import Qt.test 1.0\nTestType { resources: [ TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{} ] }", QUrl());
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_creation::qobject_10flat_cpp()
+{
+ QBENCHMARK {
+ QObject *item = new TestType;
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ delete item;
+ }
+}
+
+void tst_creation::qobject_10tree_qml()
+{
+ QQmlComponent component(&engine);
+ component.setData("import Qt.test 1.0\nTestType { TestType{ TestType { TestType{ TestType{ TestType{ TestType{ TestType{ TestType{ TestType{ TestType{ } } } } } } } } } } }", QUrl());
+
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_creation::qobject_10tree_cpp()
+{
+ QBENCHMARK {
+ QObject *item = new TestType;
+ QObject *root = item;
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ delete root;
+ }
+}
+
+void tst_creation::qobject_qmltype()
+{
+ QQmlType *t = QQmlMetaType::qmlType("QtQuick/QtObject", 2, 0);
+
+ QBENCHMARK {
+ QObject *obj = t->create();
+ delete obj;
+ }
+}
+
+struct QObjectFakeData {
+ char data[sizeof(QObjectPrivate)];
+};
+
+struct QObjectFake {
+ QObjectFake();
+ virtual ~QObjectFake();
+private:
+ QObjectFakeData *d;
+};
+
+QObjectFake::QObjectFake()
+{
+ d = new QObjectFakeData;
+}
+
+QObjectFake::~QObjectFake()
+{
+ delete d;
+}
+
+void tst_creation::qobject_alloc()
+{
+ QBENCHMARK {
+ QObjectFake *obj = new QObjectFake;
+ delete obj;
+ }
+}
+
+struct QQmlGraphics_Derived : public QObject
+{
+ void setParent_noEvent(QObject *parent) {
+ bool sce = d_ptr->sendChildEvents;
+ d_ptr->sendChildEvents = false;
+ setParent(parent);
+ d_ptr->sendChildEvents = sce;
+ }
+};
+
+inline void QQmlGraphics_setParent_noEvent(QObject *object, QObject *parent)
+{
+ static_cast<QQmlGraphics_Derived *>(object)->setParent_noEvent(parent);
+}
+
+void tst_creation::itemtree_notree_cpp()
+{
+ QBENCHMARK {
+ QQuickItem *item = new QQuickItem;
+ for (int i = 0; i < 30; ++i) {
+ QQuickItem *child = new QQuickItem;
+ Q_UNUSED(child);
+ }
+ delete item;
+ }
+}
+
+void tst_creation::itemtree_objtree_cpp()
+{
+ QBENCHMARK {
+ QQuickItem *item = new QQuickItem;
+ for (int i = 0; i < 30; ++i) {
+ QQuickItem *child = new QQuickItem;
+ QQmlGraphics_setParent_noEvent(child,item);
+ }
+ delete item;
+ }
+}
+
+void tst_creation::itemtree_cpp()
+{
+ QBENCHMARK {
+ QQuickItem *item = new QQuickItem;
+ for (int i = 0; i < 30; ++i) {
+ QQuickItem *child = new QQuickItem;
+ QQmlGraphics_setParent_noEvent(child,item);
+ child->setParentItem(item);
+ }
+ delete item;
+ }
+}
+
+void tst_creation::itemtree_data_cpp()
+{
+ QBENCHMARK {
+ QQuickItem *item = new QQuickItem;
+ for (int i = 0; i < 30; ++i) {
+ QQuickItem *child = new QQuickItem;
+ QQmlGraphics_setParent_noEvent(child,item);
+ QQmlListReference ref(item, "data");
+ ref.append(child);
+ }
+ delete item;
+ }
+}
+
+void tst_creation::itemtree_qml()
+{
+ QQmlComponent component(&engine, TEST_FILE("item.qml"));
+ QObject *obj = component.create();
+ delete obj;
+
+ QBENCHMARK {
+ QObject *obj = component.create();
+ delete obj;
+ }
+}
+
+void tst_creation::itemtree_scene_cpp()
+{
+ QGraphicsScene scene;
+ QQuickItem *root = new QQuickItem;
+ scene.addItem(root);
+ QBENCHMARK {
+ QQuickItem *item = new QQuickItem;
+ for (int i = 0; i < 30; ++i) {
+ QQuickItem *child = new QQuickItem;
+ QQmlGraphics_setParent_noEvent(child,item);
+ child->setParentItem(item);
+ }
+ item->setParentItem(root);
+ delete item;
+ }
+ delete root;
+}
+
+void tst_creation::elements_data()
+{
+ QTest::addColumn<QString>("type");
+
+ QList<QString> types = QQmlMetaType::qmlTypeNames();
+ foreach (QString type, types)
+ QTest::newRow(type.toLatin1()) << type;
+}
+
+void tst_creation::elements()
+{
+ QFETCH(QString, type);
+ QQmlType *t = QQmlMetaType::qmlType(type, 2, 0);
+ if (!t || !t->isCreatable())
+ QSKIP("Non-creatable type");
+
+ QBENCHMARK {
+ QObject *obj = t->create();
+ delete obj;
+ }
+}
+
+void tst_creation::itemtests_qml_data()
+{
+ QTest::addColumn<QString>("filepath");
+
+ QTest::newRow("emptyItem") << "emptyItem.qml";
+ QTest::newRow("emptyCustomItem") << "emptyCustomItem.qml";
+ QTest::newRow("itemWithProperties") << "itemWithProperties.qml";
+ QTest::newRow("itemUsingOnComponentCompleted") << "itemUsingOnComponentCompleted.qml";
+ QTest::newRow("itemWithAnchoredChild") << "itemWithAnchoredChild.qml";
+ QTest::newRow("itemWithChildBindedToSize") << "itemWithChildBindedToSize.qml";
+ QTest::newRow("itemWithPropertyBindingsTest1") << "itemWithPropertyBindingsTest1.qml";
+ QTest::newRow("itemWithPropertyBindingsTest2") << "itemWithPropertyBindingsTest2.qml";
+ QTest::newRow("itemWithPropertyBindingsTest3") << "itemWithPropertyBindingsTest3.qml";
+ QTest::newRow("itemWithPropertyBindingsTest4") << "itemWithPropertyBindingsTest4.qml";
+ QTest::newRow("itemWithPropertyBindingsTest5") << "itemWithPropertyBindingsTest5.qml";
+}
+
+void tst_creation::itemtests_qml()
+{
+ QFETCH(QString, filepath);
+
+ QUrl url = TEST_FILE(filepath);
+ QQmlComponent component(&engine, url);
+
+ if (!component.isReady()) {
+ qWarning() << "Unable to create component: " << url;
+ return;
+ }
+
+ delete component.create();
+ QBENCHMARK { delete component.create(); }
+}
+
+QTEST_MAIN(tst_creation)
+
+#include "tst_creation.moc"
diff --git a/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicFour.qml b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicFour.qml
new file mode 100644
index 0000000000..908bde0fd2
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicFour.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int dynamicWidth: 100
+ property int dynamicHeight: rect1.height + rect2.height
+ property int widthSignaledProperty: 10
+ property int heightSignaledProperty: 10
+
+ Rectangle {
+ id: rect1
+ width: root.dynamicWidth + 20
+ height: width + (5*3) - 8 + (width/9)
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+
+ Rectangle {
+ id: rect2
+ width: rect1.width - 50
+ height: width + (5*4) - 6 + (width/3)
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+
+ onDynamicWidthChanged: {
+ widthSignaledProperty = widthSignaledProperty + (6*5) - 2;
+ }
+
+ onDynamicHeightChanged: {
+ heightSignaledProperty = widthSignaledProperty + heightSignaledProperty + (5*3) - 7;
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicOne.qml b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicOne.qml
new file mode 100644
index 0000000000..fb90017849
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicOne.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int dynamicWidth: 10
+
+ Rectangle {
+ width: 100
+ height: root.dynamicWidth + (5*3) - 8 + (root.dynamicWidth/10)
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicThree.qml b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicThree.qml
new file mode 100644
index 0000000000..72e495e189
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicThree.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int dynamicWidth: 10
+ property int widthSignaledProperty: 20
+
+ Rectangle {
+ width: 100
+ height: root.dynamicWidth + (5*3) - 8 + (root.dynamicWidth/10)
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+
+ onDynamicWidthChanged: {
+ widthSignaledProperty = dynamicWidth + (20/4) + 7 - 1;
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicTwo.qml b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicTwo.qml
new file mode 100644
index 0000000000..d55e399ba8
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/dynamicTargets/DynamicTwo.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int dynamicWidth: 100
+ property int dynamicHeight: rect1.height + rect2.height
+
+ Rectangle {
+ id: rect1
+ width: root.dynamicWidth + 20
+ height: width + (5*3) - 8 + (width/9)
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+
+ Rectangle {
+ id: rect2
+ width: rect1.width - 50
+ height: width + (5*4) - 6 + (width/3)
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Mlbsi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Mlbsi.qml
new file mode 100644
index 0000000000..917f97c0a1
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Mlbsi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "mlbsi.js" as MlbsiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: MlbsiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Mldsi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Mldsi.qml
new file mode 100644
index 0000000000..64fdb88376
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Mldsi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "mldsi.js" as MldsiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: MldsiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Mlsi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Mlsi.qml
new file mode 100644
index 0000000000..07a9ea1a6b
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Mlsi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "mlsi.js" as MlsiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: MlsiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/ModuleBm.qml b/tests/benchmarks/qml/holistic/data/jsImports/ModuleBm.qml
new file mode 100644
index 0000000000..e69a8fe0a1
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/ModuleBm.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "moduleBm.js" as ModuleBmJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: ModuleBmJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Msbsi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Msbsi.qml
new file mode 100644
index 0000000000..33a3631361
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Msbsi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "msbsi.js" as MsbsiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: MsbsiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Msdsi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Msdsi.qml
new file mode 100644
index 0000000000..058ddb8802
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Msdsi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "msdsi.js" as MsdsiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: MsdsiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Mssi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Mssi.qml
new file mode 100644
index 0000000000..b763f8c1cb
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Mssi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "mssi.js" as MssiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: MssiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/PragmaBm.qml b/tests/benchmarks/qml/holistic/data/jsImports/PragmaBm.qml
new file mode 100644
index 0000000000..1465e33c0c
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/PragmaBm.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "pragmaBmOne.js" as PragmaBmOneJs
+import "pragmaBmTwo.js" as PragmaBmTwoJs
+
+Item {
+ id: testQtObject
+
+ // value = 20 + 2 + 9 + (nbr times shared testFunc has been called previously == 0)
+ property int importedScriptFunctionValueOne: PragmaBmOneJs.testFuncOne(20)
+
+ // value = 20 + 3 + 9 + (nbr times shared testFunc has been called previously == 1)
+ property int importedScriptFunctionValueTwo: PragmaBmTwoJs.testFuncTwo(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/PragmaModuleBm.qml b/tests/benchmarks/qml/holistic/data/jsImports/PragmaModuleBm.qml
new file mode 100644
index 0000000000..607d6a66c8
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/PragmaModuleBm.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "pragmaModuleBm.js" as PragmaModuleBmJs
+
+Item {
+ id: testQtObject
+
+ // value = 20 + (Qt.test.Enum3 == 2) + 9 + (nbr times shared testFunc has been called previously = 0) + 9 + (nbr times shared testFunc has been called previously = 1)
+ property int importedScriptFunctionValue: PragmaModuleBmJs.testFuncThree(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Slsi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Slsi.qml
new file mode 100644
index 0000000000..8ff870db96
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Slsi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "slsi.js" as SlsiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: SlsiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/Sssi.qml b/tests/benchmarks/qml/holistic/data/jsImports/Sssi.qml
new file mode 100644
index 0000000000..2be57fc7c0
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/Sssi.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+import "sssi.js" as SssiJs
+
+Item {
+ id: testQtObject
+ property int importedScriptFunctionValue: SssiJs.testFunc(20)
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi.js
new file mode 100644
index 0000000000..38feb94f40
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi.js
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports many other (non-nested) single, small, scripts.
+
+.import "mlbsi1.js" as Mlbsi1
+.import "mlbsi2.js" as Mlbsi2
+.import "mlbsi3.js" as Mlbsi3
+.import "mlbsi4.js" as Mlbsi4
+.import "mlbsi5.js" as Mlbsi5
+.import "mlbsi6.js" as Mlbsi6
+.import "mlbsi7.js" as Mlbsi7
+.import "mlbsi8.js" as Mlbsi8
+.import "mlbsi9.js" as Mlbsi9
+.import "mlbsi10.js" as Mlbsi10
+.import "mlbsi11.js" as Mlbsi11
+.import "mlbsi12.js" as Mlbsi12
+.import "mlbsi13.js" as Mlbsi13
+.import "mlbsi14.js" as Mlbsi14
+.import "mlbsi15.js" as Mlbsi15
+
+function testFunc(seedValue) {
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ var retn = cumulativeTotal * 0.53;
+ retn += Mlbsi1.testFunc(seedValue);
+ retn += Mlbsi2.testFunc(seedValue);
+ retn += Mlbsi3.testFunc(seedValue);
+ retn += Mlbsi4.testFunc(seedValue);
+ retn += Mlbsi5.testFunc(seedValue);
+ retn += Mlbsi6.testFunc(retn);
+ retn += Mlbsi7.testFunc(seedValue);
+ retn += Mlbsi8.testFunc(seedValue);
+ retn += Mlbsi9.testFunc(retn);
+ retn += Mlbsi10.testFunc(seedValue);
+ retn += Mlbsi11.testFunc(seedValue);
+ retn += Mlbsi12.testFunc(seedValue);
+ retn += Mlbsi13.testFunc(seedValue);
+ retn += Mlbsi14.testFunc(seedValue);
+ retn += Mlbsi15.testFunc(seedValue);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000017 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000017 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi1.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi1.js
new file mode 100644
index 0000000000..97ffde4b4f
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi1.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.145);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00001 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00001 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi10.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi10.js
new file mode 100644
index 0000000000..c0f0c0fdc0
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi10.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1045);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000010 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000010 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi11.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi11.js
new file mode 100644
index 0000000000..6939e2feb4
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi11.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1145);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000011 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000011 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi12.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi12.js
new file mode 100644
index 0000000000..1d0bc154ae
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi12.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1245);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000012 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000012 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi13.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi13.js
new file mode 100644
index 0000000000..8cc823196a
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi13.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1345);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000013 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000013 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi14.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi14.js
new file mode 100644
index 0000000000..c9cbd1aca1
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi14.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1445);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000014 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000014 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi15.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi15.js
new file mode 100644
index 0000000000..0370ee536c
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi15.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1545);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000015 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000015 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi2.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi2.js
new file mode 100644
index 0000000000..c0212ce74c
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi2.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.245);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00002 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00002 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi3.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi3.js
new file mode 100644
index 0000000000..38c342daeb
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi3.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.345);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00003 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00003 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi4.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi4.js
new file mode 100644
index 0000000000..16927efe11
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi4.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.445);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00004 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00004 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi5.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi5.js
new file mode 100644
index 0000000000..9bac9e70dc
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi5.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.545);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00005 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00005 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi6.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi6.js
new file mode 100644
index 0000000000..fab024dfa0
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi6.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.645);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00006 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00006 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi7.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi7.js
new file mode 100644
index 0000000000..09e23a5c03
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi7.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.745);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00007 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00007 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi8.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi8.js
new file mode 100644
index 0000000000..e28c608b75
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi8.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.845);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00008 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00008 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlbsi9.js b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi9.js
new file mode 100644
index 0000000000..c07c9528c3
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlbsi9.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.945);
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00009 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00009 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi.js
new file mode 100644
index 0000000000..5bd21cb7aa
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi.js
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+
+.import "mldsi1.js" as Mldsi1
+
+function testFunc(seedValue) {
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ var retn = cumulativeTotal * 0.5;
+ retn *= Mldsi1.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000017 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000017 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi1.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi1.js
new file mode 100644
index 0000000000..ef9670592e
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi1.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi2.js" as Msdsi2
+
+function testFunc(seedValue) {
+ var retn = 0.15;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi2.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00001 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00001 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi10.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi10.js
new file mode 100644
index 0000000000..70e63fdd32
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi10.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi11.js" as Msdsi11
+
+function testFunc(seedValue) {
+ var retn = 0.105;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi11.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000010 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000010 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi11.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi11.js
new file mode 100644
index 0000000000..8439cb30c7
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi11.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi12.js" as Msdsi12
+
+function testFunc(seedValue) {
+ var retn = 0.115;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi12.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000011 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000011 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi12.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi12.js
new file mode 100644
index 0000000000..3e573227ee
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi12.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi13.js" as Msdsi13
+
+function testFunc(seedValue) {
+ var retn = 0.125;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi13.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000012 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000012 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi13.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi13.js
new file mode 100644
index 0000000000..68f574f86e
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi13.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi14.js" as Msdsi14
+
+function testFunc(seedValue) {
+ var retn = 0.135;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi14.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000013 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000013 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi14.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi14.js
new file mode 100644
index 0000000000..5f83b5c397
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi14.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi15.js" as Msdsi15
+
+function testFunc(seedValue) {
+ var retn = 0.145;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi15.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000014 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000014 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi15.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi15.js
new file mode 100644
index 0000000000..f7b44c655d
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi15.js
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It is imported by another script.
+
+function testFunc(seedValue) {
+ var retn = 0.155;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= (seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.000015 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.000015 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi2.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi2.js
new file mode 100644
index 0000000000..bc4eb950d8
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi2.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi3.js" as Msdsi3
+
+function testFunc(seedValue) {
+ var retn = 0.25;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi3.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00002 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00002 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi3.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi3.js
new file mode 100644
index 0000000000..5bb49a3db8
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi3.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi4.js" as Msdsi4
+
+function testFunc(seedValue) {
+ var retn = 0.35;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi4.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00003 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00003 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi4.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi4.js
new file mode 100644
index 0000000000..d74dbfe893
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi4.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi5.js" as Msdsi5
+
+function testFunc(seedValue) {
+ var retn = 0.45;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi5.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00004 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00004 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi5.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi5.js
new file mode 100644
index 0000000000..4587b4eb5f
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi5.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi6.js" as Msdsi6
+
+function testFunc(seedValue) {
+ var retn = 0.55;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi6.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00005 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00005 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi6.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi6.js
new file mode 100644
index 0000000000..5d67300521
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi6.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi7.js" as Msdsi7
+
+function testFunc(seedValue) {
+ var retn = 0.65;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi7.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00006 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00006 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi7.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi7.js
new file mode 100644
index 0000000000..d319d79d1b
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi7.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi8.js" as Msdsi8
+
+function testFunc(seedValue) {
+ var retn = 0.75;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi8.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00007 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00007 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi8.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi8.js
new file mode 100644
index 0000000000..2fb36c08c1
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi8.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi9.js" as Msdsi9
+
+function testFunc(seedValue) {
+ var retn = 0.85;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi9.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00008 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00008 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mldsi9.js b/tests/benchmarks/qml/holistic/data/jsImports/mldsi9.js
new file mode 100644
index 0000000000..dbd4b5ef6e
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mldsi9.js
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports other large scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi10.js" as Msdsi10
+
+function testFunc(seedValue) {
+ var retn = 0.95;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn *= (1 + (cumulativeTotal * 0.001));
+ retn *= Msdsi10.testFunc(seedValue + retn);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00009 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00009 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mlsi.js b/tests/benchmarks/qml/holistic/data/jsImports/mlsi.js
new file mode 100644
index 0000000000..03ca68d44c
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mlsi.js
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports many other (non-nested) single, large, scripts,
+// and also imports many other nested, large scripts.
+
+.import "mldsi4.js" as Mldsi4
+.import "mldsi9.js" as Mldsi9
+.import "mlbsi1.js" as Mlbsi1
+.import "mlbsi2.js" as Mlbsi2
+.import "mlbsi3.js" as Mlbsi3
+.import "mlbsi4.js" as Mlbsi4
+.import "mlbsi5.js" as Mlbsi5
+.import "mlbsi6.js" as Mlbsi6
+.import "mlbsi7.js" as Mlbsi7
+.import "mlbsi8.js" as Mlbsi8
+.import "mlbsi9.js" as Mlbsi9
+.import "mlbsi10.js" as Mlbsi10
+.import "mlbsi11.js" as Mlbsi11
+.import "mlbsi12.js" as Mlbsi12
+.import "mlbsi13.js" as Mlbsi13
+.import "mlbsi14.js" as Mlbsi14
+.import "mlbsi15.js" as Mlbsi15
+
+function testFunc(seedValue) {
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ var retn = cumulativeTotal;
+ retn += Mlbsi1.testFunc(seedValue);
+ retn += Mlbsi2.testFunc(seedValue);
+ retn += Mlbsi3.testFunc(retn);
+ retn += Mlbsi4.testFunc(seedValue);
+ retn += Mlbsi5.testFunc(seedValue);
+ retn += Mlbsi6.testFunc(seedValue);
+ retn *= Mldsi9.testFunc(retn);
+ retn += Mlbsi7.testFunc(seedValue);
+ retn += Mlbsi8.testFunc(retn);
+ retn += Mlbsi9.testFunc(seedValue);
+ retn += Mlbsi10.testFunc(seedValue);
+ retn += Mlbsi11.testFunc(seedValue);
+ retn *= Mldsi4.testFunc(retn);
+ retn += Mlbsi12.testFunc(seedValue);
+ retn += Mlbsi13.testFunc(retn);
+ retn += Mlbsi14.testFunc(seedValue);
+ retn += Mlbsi15.testFunc(seedValue);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00001 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00001 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/moduleBm.js b/tests/benchmarks/qml/holistic/data/jsImports/moduleBm.js
new file mode 100644
index 0000000000..c02fd735e5
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/moduleBm.js
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+.import Qt.test 1.0 as QtTest
+
+function testFunc(seedValue) {
+ var retn = QtTest.EnumValue3;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn += (cumulativeTotal * 0.45);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00001 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00001 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
+
+
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi.js
new file mode 100644
index 0000000000..99f81a24bf
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi.js
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports many other (non-nested) single, small, scripts.
+
+.import "msbsi1.js" as Msbsi1
+.import "msbsi2.js" as Msbsi2
+.import "msbsi3.js" as Msbsi3
+.import "msbsi4.js" as Msbsi4
+.import "msbsi5.js" as Msbsi5
+.import "msbsi6.js" as Msbsi6
+.import "msbsi7.js" as Msbsi7
+.import "msbsi8.js" as Msbsi8
+.import "msbsi9.js" as Msbsi9
+.import "msbsi10.js" as Msbsi10
+.import "msbsi11.js" as Msbsi11
+.import "msbsi12.js" as Msbsi12
+.import "msbsi13.js" as Msbsi13
+.import "msbsi14.js" as Msbsi14
+.import "msbsi15.js" as Msbsi15
+
+function testFunc(seedValue) {
+ var retn = 10 * (seedValue * 0.45);
+ retn += Msbsi1.testFunc(seedValue);
+ retn += Msbsi2.testFunc(seedValue);
+ retn += Msbsi3.testFunc(seedValue);
+ retn += Msbsi4.testFunc(seedValue);
+ retn += Msbsi5.testFunc(seedValue);
+ retn += Msbsi6.testFunc(seedValue);
+ retn += Msbsi7.testFunc(seedValue);
+ retn += Msbsi8.testFunc(seedValue);
+ retn += Msbsi9.testFunc(seedValue);
+ retn += Msbsi10.testFunc(seedValue);
+ retn += Msbsi11.testFunc(seedValue);
+ retn += Msbsi12.testFunc(seedValue);
+ retn += Msbsi13.testFunc(seedValue);
+ retn += Msbsi14.testFunc(seedValue);
+ retn += Msbsi15.testFunc(seedValue);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi1.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi1.js
new file mode 100644
index 0000000000..24709219b3
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi1.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.145);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi10.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi10.js
new file mode 100644
index 0000000000..7ab631e4a1
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi10.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1045);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi11.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi11.js
new file mode 100644
index 0000000000..ec5f516f9f
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi11.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1145);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi12.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi12.js
new file mode 100644
index 0000000000..5e9acb7ea6
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi12.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1245);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi13.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi13.js
new file mode 100644
index 0000000000..0eb7fe32d1
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi13.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1345);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi14.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi14.js
new file mode 100644
index 0000000000..96239ba4ef
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi14.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1445);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi15.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi15.js
new file mode 100644
index 0000000000..d7d2b506f8
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi15.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.1545);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi2.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi2.js
new file mode 100644
index 0000000000..bcaf8c4113
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi2.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.245);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi3.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi3.js
new file mode 100644
index 0000000000..1bbaf60a3d
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi3.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.345);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi4.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi4.js
new file mode 100644
index 0000000000..4245cc55f1
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi4.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.445);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi5.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi5.js
new file mode 100644
index 0000000000..761e1f7839
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi5.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.545);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi6.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi6.js
new file mode 100644
index 0000000000..85d2d333de
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi6.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.645);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi7.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi7.js
new file mode 100644
index 0000000000..0e72957b16
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi7.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.745);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi8.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi8.js
new file mode 100644
index 0000000000..9c2be9d305
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi8.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.845);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msbsi9.js b/tests/benchmarks/qml/holistic/data/jsImports/msbsi9.js
new file mode 100644
index 0000000000..9c2fe6deb7
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msbsi9.js
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+// It is imported from another script.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.945);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi.js
new file mode 100644
index 0000000000..80f6d210d0
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi.js
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+
+.import "msdsi1.js" as Msdsi1
+
+function testFunc(seedValue) {
+ var retn = 0.5;
+ retn *= Msdsi1.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi1.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi1.js
new file mode 100644
index 0000000000..8726180e5e
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi1.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi2.js" as Msdsi2
+
+function testFunc(seedValue) {
+ var retn = 0.15;
+ retn *= Msdsi2.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi10.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi10.js
new file mode 100644
index 0000000000..8141c2f376
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi10.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi11.js" as Msdsi11
+
+function testFunc(seedValue) {
+ var retn = 0.105;
+ retn *= Msdsi11.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi11.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi11.js
new file mode 100644
index 0000000000..f33fc43afd
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi11.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi12.js" as Msdsi12
+
+function testFunc(seedValue) {
+ var retn = 0.115;
+ retn *= Msdsi12.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi12.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi12.js
new file mode 100644
index 0000000000..5f6f435f31
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi12.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi13.js" as Msdsi13
+
+function testFunc(seedValue) {
+ var retn = 0.125;
+ retn *= Msdsi13.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi13.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi13.js
new file mode 100644
index 0000000000..46a2ed483e
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi13.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi14.js" as Msdsi14
+
+function testFunc(seedValue) {
+ var retn = 0.135;
+ retn *= Msdsi14.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi14.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi14.js
new file mode 100644
index 0000000000..bab10bd979
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi14.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi15.js" as Msdsi15
+
+function testFunc(seedValue) {
+ var retn = 0.145;
+ retn *= Msdsi15.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi15.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi15.js
new file mode 100644
index 0000000000..419f42a577
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi15.js
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It is imported by another script.
+
+function testFunc(seedValue) {
+ var retn = 0.155;
+ retn *= (seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi2.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi2.js
new file mode 100644
index 0000000000..79de7af2f0
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi2.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi3.js" as Msdsi3
+
+function testFunc(seedValue) {
+ var retn = 0.25;
+ retn *= Msdsi3.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi3.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi3.js
new file mode 100644
index 0000000000..7ef650dda8
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi3.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi4.js" as Msdsi4
+
+function testFunc(seedValue) {
+ var retn = 0.35;
+ retn *= Msdsi4.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi4.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi4.js
new file mode 100644
index 0000000000..8dc8b4c876
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi4.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi5.js" as Msdsi5
+
+function testFunc(seedValue) {
+ var retn = 0.45;
+ retn *= Msdsi5.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi5.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi5.js
new file mode 100644
index 0000000000..ad35425677
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi5.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi6.js" as Msdsi6
+
+function testFunc(seedValue) {
+ var retn = 0.55;
+ retn *= Msdsi6.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi6.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi6.js
new file mode 100644
index 0000000000..f504669dfe
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi6.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi7.js" as Msdsi7
+
+function testFunc(seedValue) {
+ var retn = 0.65;
+ retn *= Msdsi7.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi7.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi7.js
new file mode 100644
index 0000000000..3ed6e223ec
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi7.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi8.js" as Msdsi8
+
+function testFunc(seedValue) {
+ var retn = 0.75;
+ retn *= Msdsi8.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi8.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi8.js
new file mode 100644
index 0000000000..fefa813ec6
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi8.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi9.js" as Msdsi9
+
+function testFunc(seedValue) {
+ var retn = 0.85;
+ retn *= Msdsi9.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/msdsi9.js b/tests/benchmarks/qml/holistic/data/jsImports/msdsi9.js
new file mode 100644
index 0000000000..9734a31fcf
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/msdsi9.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports other small scripts which are deeply nested.
+// It is imported by another script.
+
+.import "msdsi10.js" as Msdsi10
+
+function testFunc(seedValue) {
+ var retn = 0.95;
+ retn *= Msdsi10.testFunc(seedValue + retn);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/mssi.js b/tests/benchmarks/qml/holistic/data/jsImports/mssi.js
new file mode 100644
index 0000000000..278c56f677
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/mssi.js
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It imports many other (non-nested) single, small, scripts,
+// and also imports many other nested, small scripts.
+
+.import "msdsi4.js" as Msdsi4
+.import "msdsi9.js" as Msdsi9
+.import "msbsi1.js" as Msbsi1
+.import "msbsi2.js" as Msbsi2
+.import "msbsi3.js" as Msbsi3
+.import "msbsi4.js" as Msbsi4
+.import "msbsi5.js" as Msbsi5
+.import "msbsi6.js" as Msbsi6
+.import "msbsi7.js" as Msbsi7
+.import "msbsi8.js" as Msbsi8
+.import "msbsi9.js" as Msbsi9
+.import "msbsi10.js" as Msbsi10
+.import "msbsi11.js" as Msbsi11
+.import "msbsi12.js" as Msbsi12
+.import "msbsi13.js" as Msbsi13
+.import "msbsi14.js" as Msbsi14
+.import "msbsi15.js" as Msbsi15
+
+function testFunc(seedValue) {
+ var retn = 10 * (seedValue * 0.85);
+ retn += Msbsi1.testFunc(seedValue);
+ retn += Msbsi2.testFunc(seedValue);
+ retn += Msbsi3.testFunc(retn);
+ retn += Msbsi4.testFunc(seedValue);
+ retn += Msbsi5.testFunc(seedValue);
+ retn += Msbsi6.testFunc(seedValue);
+ retn *= Msdsi9.testFunc(retn);
+ retn += Msbsi7.testFunc(seedValue);
+ retn += Msbsi8.testFunc(retn);
+ retn += Msbsi9.testFunc(seedValue);
+ retn += Msbsi10.testFunc(seedValue);
+ retn += Msbsi11.testFunc(seedValue);
+ retn *= Msdsi4.testFunc(retn);
+ retn += Msbsi12.testFunc(seedValue);
+ retn += Msbsi13.testFunc(retn);
+ retn += Msbsi14.testFunc(seedValue);
+ retn += Msbsi15.testFunc(seedValue);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/pragmaBmOne.js b/tests/benchmarks/qml/holistic/data/jsImports/pragmaBmOne.js
new file mode 100644
index 0000000000..2824693140
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/pragmaBmOne.js
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports a shared library script.
+.import "pragmaLib.js" as PragmaLibJs
+
+function testFuncOne(seedValue) {
+ var retn = seedValue + 2;
+ retn += PragmaLibJs.testFunc();
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/pragmaBmTwo.js b/tests/benchmarks/qml/holistic/data/jsImports/pragmaBmTwo.js
new file mode 100644
index 0000000000..6141f3e086
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/pragmaBmTwo.js
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports a shared library script.
+.import "pragmaLib.js" as PragmaLibJs
+
+function testFuncTwo(seedValue) {
+ var retn = seedValue + 3;
+ retn += PragmaLibJs.testFunc();
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/pragmaLib.js b/tests/benchmarks/qml/holistic/data/jsImports/pragmaLib.js
new file mode 100644
index 0000000000..11f5e7d856
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/pragmaLib.js
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+// It is a shared script, with data which should be shared.
+.pragma library
+
+var sharedValue = 9;
+
+function testFunc() {
+ var retn = sharedValue;
+ sharedValue += 1; // increment the shared value
+ return retn;
+}
+
+function testFuncBig(seedValue) {
+ var retn = sharedValue;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn += (cumulativeTotal * 0.45);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ sharedValue += 1; // increment the shared value
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00001 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00001 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
+
+
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/pragmaModuleBm.js b/tests/benchmarks/qml/holistic/data/jsImports/pragmaModuleBm.js
new file mode 100644
index 0000000000..9675584ff3
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/pragmaModuleBm.js
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It imports a QML module and two other scripts.
+// Each of those two other scripts imports a single script,
+// which is a .pragma library script (shared between the two).
+
+.import Qt.test 1.0 as QtTest
+.import "pragmaBmOne.js" as PragmaBmOneJs
+.import "pragmaBmTwo.js" as PragmaBmTwoJs
+
+function testFuncThree(seedValue) {
+ var retn = seedValue + QtTest.EnumValue3;
+ retn += PragmaBmOneJs.testFuncOne(seedValue);
+ retn += PragmaBmTwoJs.testFuncTwo(seedValue);
+ return retn;
+}
+
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/slsi.js b/tests/benchmarks/qml/holistic/data/jsImports/slsi.js
new file mode 100644
index 0000000000..8619dd1dfc
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/slsi.js
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, large, imported script.
+// It doesn't import any other scripts.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ var firstFactor = calculateFirstFactor(seedValue);
+ var secondFactor = calculateSecondFactor(seedValue);
+ var modificationTerm = calculateModificationTerm(seedValue);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (seedValue * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (seedValue * 50)) {
+ break;
+ }
+ }
+ }
+ retn += (cumulativeTotal * 0.45);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
+
+function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00001 / seedValue));
+ return firstFactor;
+}
+
+function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00001 / seedValue));
+ return secondFactor;
+}
+
+function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((calculateFirstFactor(seedValue) * seedValue) / 3) + (4*calculateSecondFactor(seedValue) * seedValue * 1.33)) + (calculateSecondFactor(seedValue) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+}
+
+
diff --git a/tests/benchmarks/qml/holistic/data/jsImports/sssi.js b/tests/benchmarks/qml/holistic/data/jsImports/sssi.js
new file mode 100644
index 0000000000..5ba34ff090
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsImports/sssi.js
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This JavaScript file is a single, small, imported script.
+// It doesn't import any other scripts.
+
+function testFunc(seedValue) {
+ var retn = 5;
+ retn += (seedValue * 0.45);
+ retn *= (1 + (3.1415962 / seedValue));
+ retn /= 2.41497;
+ retn -= (seedValue * -1);
+ return retn;
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsTargets/JsOne.qml b/tests/benchmarks/qml/holistic/data/jsTargets/JsOne.qml
new file mode 100644
index 0000000000..bfdead30b6
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsTargets/JsOne.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int dynamicWidth: 10
+ property int widthSignaledProperty: 20
+
+ Rectangle {
+ width: 100
+ height: 50
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+
+ onDynamicWidthChanged: {
+ widthSignaledProperty = dynamicWidth + (20/4) + 7 - 1;
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/jsTargets/JsTwo.qml b/tests/benchmarks/qml/holistic/data/jsTargets/JsTwo.qml
new file mode 100644
index 0000000000..19a864e102
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/jsTargets/JsTwo.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int dynamicWidth: 10
+ property int widthSignaledProperty: 20
+
+ Rectangle {
+ width: 100
+ height: 50
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+
+ function calculateFirstFactor(seedValue) {
+ var firstFactor = (0.45 * (9.3 / 3.1) - 0.90);
+ firstFactor *= (1 + (0.00001 / seedValue));
+ return firstFactor;
+ }
+
+ function calculateSecondFactor(seedValue) {
+ var secondFactor = 0.78 * (6.3 / 2.1) - (0.39 * 4);
+ secondFactor *= (1 + (0.00001 / seedValue));
+ return secondFactor;
+ }
+
+ function calculateModificationTerm(seedValue) {
+ var modificationTerm = (12 + (9*7) - 54 + 16 - ((root.calculateFirstFactor(seedValue + 0.3) * seedValue) / 3) + (4*root.calculateSecondFactor(seedValue+2) * seedValue * 1.33)) + (root.calculateSecondFactor(seedValue+1) * seedValue);
+ modificationTerm = modificationTerm + (33/2) + 19 - (9*2) - (61*3) + 177;
+ return modificationTerm;
+ }
+
+ onDynamicWidthChanged: {
+ // do a bit of maths
+ var firstFactor = root.calculateFirstFactor(8);
+ var secondFactor = root.calculateSecondFactor(dynamicWidth / firstFactor);
+ var modificationTerm = root.calculateModificationTerm(dynamicWidth / secondFactor);
+
+ // do some regexp matching
+ var someString = "This is a random string which we'll perform regular expression matching on to reduce considerably. This is meant to be part of a complex javascript expression whose evaluation takes considerably longer than the creation cost of QScriptValue.";
+ var regexpPattern = new RegExp("is", "i");
+ var regexpOutputLength = 0;
+ var temp = regexpPattern.exec(someString);
+ while (temp == "is") {
+ regexpOutputLength += 4;
+ regexpOutputLength *= 2;
+ temp = regexpPattern.exec(someString);
+ if (regexpOutputLength > (dynamicWidth * 3)) {
+ temp = "break";
+ }
+ }
+
+ // spin in a for loop for a while
+ var i = 0;
+ var j = 0;
+ var cumulativeTotal = 3;
+ for (i = 20; i > 1; i--) {
+ for (j = 31; j > 5; j--) {
+ var branchVariable = i + j;
+ if (branchVariable % 3 == 0) {
+ cumulativeTotal -= secondFactor;
+ } else {
+ cumulativeTotal += firstFactor;
+ }
+
+ if (cumulativeTotal > (dynamicWidth * 50)) {
+ break;
+ }
+ }
+ }
+
+ // and update the property
+ widthSignaledProperty = (dynamicWidth + (20/4) + 7 - 1) * modificationTerm + regexpOutputLength - (cumulativeTotal / 73);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/largeTargets/gridview-example.qml b/tests/benchmarks/qml/holistic/data/largeTargets/gridview-example.qml
new file mode 100644
index 0000000000..4724a8c8b5
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/largeTargets/gridview-example.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 300; height: 400
+ color: "white"
+
+ ListModel {
+ id: appModel
+ ListElement { name: "Music"; shade: "blue" }
+ ListElement { name: "Movies"; shade: "red" }
+ ListElement { name: "Camera"; shade: "green" }
+ ListElement { name: "Calendar"; shade: "yellow" }
+ ListElement { name: "Messaging"; shade: "cyan" }
+ ListElement { name: "Todo List"; shade: "magenta" }
+ ListElement { name: "Contacts"; shade: "black" }
+ }
+
+ Component {
+ id: appDelegate
+
+ Item {
+ width: 100; height: 100
+
+ Rectangle {
+ id: myColoredIcon
+ width: 20
+ height: 20
+ y: 20; anchors.horizontalCenter: parent.horizontalCenter
+ color: shade
+ }
+ Text {
+ anchors { top: myColoredIcon.bottom; horizontalCenter: parent.horizontalCenter }
+ text: name
+ }
+ }
+ }
+
+ Component {
+ id: appHighlight
+ Rectangle { width: 80; height: 80; color: "lightsteelblue" }
+ }
+
+ GridView {
+ anchors.fill: parent
+ cellWidth: 100; cellHeight: 100
+ highlight: appHighlight
+ focus: true
+ model: appModel
+ delegate: appDelegate
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/largeTargets/layoutdirection.qml b/tests/benchmarks/qml/holistic/data/largeTargets/layoutdirection.qml
new file mode 100644
index 0000000000..996d33efb3
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/largeTargets/layoutdirection.qml
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+
+ width: column.width + 100
+ height: column.height + 100
+ property int direction: Qt.application.layoutDirection
+
+ Column {
+ id: column
+ spacing: 10
+ anchors.centerIn: parent
+ width: 230
+
+ Text {
+ text: "Row"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Row {
+ layoutDirection: direction
+ spacing: 10
+ move: Transition {
+ NumberAnimation {
+ properties: "x"
+ }
+ }
+ Repeater {
+ model: 4
+ Loader {
+ property int value: index
+ sourceComponent: delegate
+ }
+ }
+ }
+ Text {
+ text: "Grid"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Grid {
+ layoutDirection: direction
+ spacing: 10; columns: 4
+ move: Transition {
+ NumberAnimation {
+ properties: "x"
+ }
+ }
+ Repeater {
+ model: 11
+ Loader {
+ property int value: index
+ sourceComponent: delegate
+ }
+ }
+ }
+ Text {
+ text: "Flow"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Flow {
+ layoutDirection: direction
+ spacing: 10; width: parent.width
+ move: Transition {
+ NumberAnimation {
+ properties: "x"
+ }
+ }
+ Repeater {
+ model: 10
+ Loader {
+ property int value: index
+ sourceComponent: delegate
+ }
+ }
+ }
+ Rectangle {
+ height: 50; width: parent.width
+ color: mouseArea.pressed ? "black" : "gray"
+ Text {
+ text: direction ? "Right to left" : "Left to right"
+ color: "white"
+ font.pixelSize: 16
+ anchors.centerIn: parent
+ }
+ MouseArea {
+ id: mouseArea
+ onClicked: {
+ if (direction == Qt.LeftToRight) {
+ direction = Qt.RightToLeft;
+ } else {
+ direction = Qt.LeftToRight;
+ }
+ }
+ anchors.fill: parent
+ }
+ }
+ }
+
+ Component {
+ id: delegate
+ Rectangle {
+ width: 50; height: 50
+ color: Qt.rgba(0.8/(parent.value+1),0.8/(parent.value+1),0.8/(parent.value+1),1.0)
+ Text {
+ text: parent.parent.value+1
+ color: "white"
+ font.pixelSize: 20
+ anchors.centerIn: parent
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/largeTargets/mousearea-example.qml b/tests/benchmarks/qml/holistic/data/largeTargets/mousearea-example.qml
new file mode 100644
index 0000000000..4f086c7a3f
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/largeTargets/mousearea-example.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: box
+ width: 350; height: 250
+
+ Rectangle {
+ id: redSquare
+ width: 80; height: 80
+ anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 10
+ color: "red"
+
+ Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent }
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+
+ onEntered: info.text = 'Entered'
+ onExited: info.text = 'Exited (pressed=' + pressed + ')'
+
+ onPressed: {
+ info.text = 'Pressed (button=' + (mouse.button == Qt.RightButton ? 'right' : 'left')
+ + ' shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')'
+ var posInBox = redSquare.mapToItem(box, mouse.x, mouse.y)
+ posInfo.text = + mouse.x + ',' + mouse.y + ' in square'
+ + ' (' + posInBox.x + ',' + posInBox.y + ' in window)'
+ }
+
+ onReleased: {
+ info.text = 'Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')'
+ posInfo.text = ''
+ }
+
+ onPressAndHold: info.text = 'Press and hold'
+ onClicked: info.text = 'Clicked (wasHeld=' + mouse.wasHeld + ')'
+ onDoubleClicked: info.text = 'Double clicked'
+ }
+ }
+
+ Rectangle {
+ id: blueSquare
+ width: 80; height: 80
+ x: box.width - width - 10; y: 10 // making this item draggable, so don't use anchors
+ color: "blue"
+
+ Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent }
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: blueSquare
+ drag.axis: Drag.XAndYAxis
+ drag.minimumX: 0
+ drag.maximumX: box.width - parent.width
+ drag.minimumY: 0
+ drag.maximumY: box.height - parent.width
+ }
+ }
+
+ Text {
+ id: info
+ anchors.bottom: posInfo.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30
+
+ onTextChanged: console.log(text)
+ }
+
+ Text {
+ id: posInfo
+ anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/resolutionTargets/ResolveOne.qml b/tests/benchmarks/qml/holistic/data/resolutionTargets/ResolveOne.qml
new file mode 100644
index 0000000000..10a6668df3
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/resolutionTargets/ResolveOne.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This file has some nested items and does a lot of id resolution.
+// This will allow us to benchmark the cost of resolving names in
+// bindings.
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int baseWidth: 500
+ property int baseHeight: 600
+ property string baseColor: "red"
+
+ Item {
+ id: childOne
+ property int baseWidth: root.baseWidth - 1
+ property int baseHeight: root.baseHeight - 1
+ property string baseColor: root.baseColor
+
+ Item {
+ id: childTwo
+ property int baseWidth: root.baseWidth - 2
+ property int baseHeight: childOne.baseHeight - 1
+ property string baseColor: childOne.baseColor
+
+ Item {
+ id: childThree
+ property int baseWidth: childOne.baseWidth - 2
+ property int baseHeight: root.baseHeight - 3
+ property string baseColor: "blue"
+
+ Item {
+ id: childFour
+ property int baseWidth: childTwo.baseWidth - 2
+ property int baseHeight: childThree.baseHeight - 1
+ property string baseColor: "earthy " + root.baseColor
+
+ Item {
+ id: childFive
+ property int baseWidth: root.baseWidth - 5
+ property int baseHeight: childFour.baseHeight - 1
+ property string baseColor: "carnelian " + childTwo.baseColor
+ }
+ }
+
+ Item {
+ id: childSix
+ property int baseWidth: parent.baseWidth - 3
+ property int baseHeight: root.baseHeight - 6
+ property string baseColor: "rust " + root.baseColor
+
+ Item {
+ id: childSeven
+ property int baseWidth: childOne.baseWidth - 6
+ property int baseHeight: childTwo.baseHeight - 5
+ property string baseColor: "sky " + childThree.baseColor
+ }
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ width: childOne.baseWidth
+ height: childOne.baseHeight
+ color: parent.baseColor
+ border.color: "black"
+ border.width: 5
+ radius: 10
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/CppToJs.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/CppToJs.qml
new file mode 100644
index 0000000000..f033065e59
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/CppToJs.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "cppToJs.js" as CppToJs
+
+Item {
+ id: jsConsumer
+ property int sideEffect: 10
+
+ function callJsFunction() {
+ jsConsumer.sideEffect = jsConsumer.sideEffect + CppToJs.nextValue;
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/CppToQml.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/CppToQml.qml
new file mode 100644
index 0000000000..7a58dd7b7c
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/CppToQml.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property int arbitrary: 10
+ property int dependent: arbitrary + 5
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEight.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEight.qml
new file mode 100644
index 0000000000..64e61858fb
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEight.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a nonconst CPP function with an integer return value and an integer argument.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + arbitraryVariantProvider.modifyVariantChangeCount(arbitraryVariantConsumer.sideEffect);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEleven.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEleven.qml
new file mode 100644
index 0000000000..61bc17a19d
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppEleven.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property variant someVariant;
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a nonconst CPP function with variant return value and variant + integer arguments.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + 3;
+ var tempVariant = arbitraryVariantProvider.setVariantToFilledPixmap(sideEffect + 183, sideEffect + 134, sideEffect + 38, sideEffect + 77, sideEffect + 21);
+ someVariant = arbitraryVariantProvider.setVariantAddCount(sideEffect, tempVariant);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFive.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFive.qml
new file mode 100644
index 0000000000..8e3f50f621
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFive.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a const CPP function with an integer return value and no arguments.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + arbitraryVariantProvider.variantChangeCount();
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFour.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFour.qml
new file mode 100644
index 0000000000..80bea5feac
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppFour.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a nonconst CPP function with no return value and an integer argument.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + 2;
+ arbitraryVariantProvider.setVariantChangeCount(arbitraryVariantConsumer.sideEffect);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppNine.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppNine.qml
new file mode 100644
index 0000000000..17fb24bdfe
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppNine.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property variant someVariant;
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a const CPP function with variant return value and integer arguments.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + 3;
+ someVariant = arbitraryVariantProvider.possibleVariant(sideEffect, sideEffect * 2, sideEffect * 5);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppOne.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppOne.qml
new file mode 100644
index 0000000000..aa68d77a61
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppOne.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a const CPP function with no return value and no arguments.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + 2;
+ arbitraryVariantProvider.doNothing();
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSeven.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSeven.qml
new file mode 100644
index 0000000000..3db4b4c5ef
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSeven.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a const CPP function with an integer return value and an integer argument.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + arbitraryVariantProvider.countPlus(arbitraryVariantConsumer.sideEffect);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSix.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSix.qml
new file mode 100644
index 0000000000..100ac6e706
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppSix.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a nonconst CPP function with an integer return value and no arguments.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + arbitraryVariantProvider.modifyVariantChangeCount();
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTen.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTen.qml
new file mode 100644
index 0000000000..22f70017de
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTen.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property variant someVariant;
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a nonconst CPP function with variant return value and integer arguments.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + 3;
+ someVariant = arbitraryVariantProvider.setVariantToFilledPixmap(sideEffect + 183, sideEffect + 134, sideEffect + 38, sideEffect + 77, sideEffect + 21);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppThree.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppThree.qml
new file mode 100644
index 0000000000..e8e6a85618
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppThree.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a const CPP function with no return value and an integer argument.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + 2;
+ arbitraryVariantProvider.doNothing(arbitraryVariantConsumer.sideEffect);
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTwo.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTwo.qml
new file mode 100644
index 0000000000..66e67f5838
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/JsToCppTwo.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: arbitraryVariantConsumer
+ property MyArbitraryVariantProvider a: MyArbitraryVariantProvider { id: arbitraryVariantProvider }
+ property int sideEffect: 10
+
+ function callCppFunction() {
+ // in this case, we call a nonconst CPP function with no return value and no arguments.
+ arbitraryVariantConsumer.sideEffect = arbitraryVariantConsumer.sideEffect + 2;
+ arbitraryVariantProvider.incrementVariantChangeCount();
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceOne.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceOne.qml
new file mode 100644
index 0000000000..4eff4f3dcf
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceOne.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: scarceResourceConsumer
+
+ property MyScarceResourceProvider a: MyScarceResourceProvider { id: scarceResourceProvider }
+
+ property variant ssr;
+ property variant lsr;
+
+ function copyScarceResources() {
+ ssr = scarceResourceProvider.smallScarceResource;
+ lsr = scarceResourceProvider.largeScarceResource;
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceTwo.qml b/tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceTwo.qml
new file mode 100644
index 0000000000..52dd768c80
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/ScarceTwo.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.test 1.0
+
+Item {
+ id: scarceResourceConsumer
+
+ property MyScarceResourceProvider a: MyScarceResourceProvider { id: scarceResourceProvider }
+
+ property variant ssr: scarceResourceProvider.smallScarceResource
+ property variant lsr: scarceResourceProvider.largeScarceResource
+}
diff --git a/tests/benchmarks/qml/holistic/data/scopeSwitching/cppToJs.js b/tests/benchmarks/qml/holistic/data/scopeSwitching/cppToJs.js
new file mode 100644
index 0000000000..2862cfceb7
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/scopeSwitching/cppToJs.js
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.pragma library
+
+var generatedValue = 5;
+
+function generateNextValue() {
+ generatedValue += 1;
+ return generatedValue;
+}
diff --git a/tests/benchmarks/qml/holistic/data/smallTargets/SmallFour.qml b/tests/benchmarks/qml/holistic/data/smallTargets/SmallFour.qml
new file mode 100644
index 0000000000..5fc917b9c5
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/smallTargets/SmallFour.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Text {
+ text: "Hello World!"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ color: "red"
+}
diff --git a/tests/benchmarks/qml/holistic/data/smallTargets/SmallOne.qml b/tests/benchmarks/qml/holistic/data/smallTargets/SmallOne.qml
new file mode 100644
index 0000000000..1d3b20e1ff
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/smallTargets/SmallOne.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 100
+ height: 100
+ color: "red"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+}
diff --git a/tests/benchmarks/qml/holistic/data/smallTargets/SmallThree.qml b/tests/benchmarks/qml/holistic/data/smallTargets/SmallThree.qml
new file mode 100644
index 0000000000..29cc9ab15a
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/smallTargets/SmallThree.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 100; height: 100
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "red" }
+ GradientStop { position: 0.33; color: "yellow" }
+ GradientStop { position: 1.0; color: "green" }
+ }
+}
diff --git a/tests/benchmarks/qml/holistic/data/smallTargets/SmallTwo.qml b/tests/benchmarks/qml/holistic/data/smallTargets/SmallTwo.qml
new file mode 100644
index 0000000000..9def0ab04b
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/data/smallTargets/SmallTwo.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 100
+ height: 100
+ color: "blue"
+ border.color: "black"
+ border.width: 5
+ radius: 10
+}
diff --git a/tests/benchmarks/qml/holistic/holistic.pro b/tests/benchmarks/qml/holistic/holistic.pro
new file mode 100644
index 0000000000..8fd87c88bd
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/holistic.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_holistic
+QT += qml network testlib
+macx:CONFIG -= app_bundle
+
+CONFIG += release
+
+SOURCES += tst_holistic.cpp \
+ testtypes.cpp
+HEADERS += testtypes.h
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/holistic/testtypes.cpp b/tests/benchmarks/qml/holistic/testtypes.cpp
new file mode 100644
index 0000000000..0a9e36dc3a
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/testtypes.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+#include <QQmlEngine>
+
+static QJSValue script_api(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ static int testProperty = 13;
+ QJSValue v = scriptEngine->newObject();
+ v.setProperty("scriptTestProperty", testProperty++);
+ return v;
+}
+
+static QObject *qobject_api(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine)
+ Q_UNUSED(scriptEngine)
+
+ testQObjectApi *o = new testQObjectApi;
+ o->setQObjectTestProperty(20);
+ return o;
+}
+
+static QObject *qobject_api_engine_parent(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(scriptEngine)
+
+ static int testProperty = 26;
+ testQObjectApi *o = new testQObjectApi(engine);
+ o->setQObjectTestProperty(testProperty++);
+ return o;
+}
+
+void registerTypes()
+{
+ qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObjectAlias");
+ qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObject");
+
+ qRegisterMetaType<MyQmlObject::MyType>("MyQmlObject::MyType");
+
+ qmlRegisterType<ScarceResourceProvider>("Qt.test", 1,0, "MyScarceResourceProvider");
+ qmlRegisterType<ArbitraryVariantProvider>("Qt.test", 1,0, "MyArbitraryVariantProvider");
+
+ qmlRegisterSingletonType("Qt.test",1,0,script_api); // register (script) singleton Type for an existing uri which contains elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test",1,0,qobject_api); // register (qobject) for an existing uri for which another singleton Type was previously regd. Should replace!
+ qmlRegisterSingletonType("Qt.test.scriptApi",1,0,script_api); // register (script) singleton Type for a uri which doesn't contain elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,0,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,3,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, minor version set
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",2,0,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, major version set
+ qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApiParented",1,0,qobject_api_engine_parent); // register (parented qobject) singleton Type for a uri which doesn't contain elements
+}
+
+//#include "testtypes.moc"
diff --git a/tests/benchmarks/qml/holistic/testtypes.h b/tests/benchmarks/qml/holistic/testtypes.h
new file mode 100644
index 0000000000..ba65caaa11
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/testtypes.h
@@ -0,0 +1,355 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlexpression.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qsize.h>
+#include <QtQml/qqmllist.h>
+#include <QtCore/qrect.h>
+#include <QtGui/qmatrix.h>
+#include <QtGui/qcolor.h>
+#include <QtGui/qpixmap.h>
+#include <QtGui/qvector3d.h>
+#include <QtCore/qdatetime.h>
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qqmlscriptstring.h>
+#include <QtQml/qqmlcomponent.h>
+
+class MyQmlAttachedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value CONSTANT)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2)
+public:
+ MyQmlAttachedObject(QObject *parent) : QObject(parent), m_value2(0) {}
+
+ int value() const { return 19; }
+ int value2() const { return m_value2; }
+ void setValue2(int v) { m_value2 = v; }
+
+ void emitMySignal() { emit mySignal(); }
+
+signals:
+ void mySignal();
+
+private:
+ int m_value2;
+};
+
+class MyQmlObject : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(MyEnum)
+ Q_ENUMS(MyEnum2)
+ Q_PROPERTY(int deleteOnSet READ deleteOnSet WRITE setDeleteOnSet)
+ Q_PROPERTY(bool trueProperty READ trueProperty CONSTANT)
+ Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT)
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int console READ console CONSTANT)
+ Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged)
+ Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged)
+ Q_PROPERTY(QQmlListProperty<QObject> objectListProperty READ objectListProperty CONSTANT)
+ Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty)
+ Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp)
+ Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false)
+
+public:
+ MyQmlObject(): myinvokableObject(0), m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {}
+
+ enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 };
+ enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3 };
+
+ bool trueProperty() const { return true; }
+ bool falseProperty() const { return false; }
+
+ QString stringProperty() const { return m_string; }
+ void setStringProperty(const QString &s)
+ {
+ if (s == m_string)
+ return;
+ m_string = s;
+ emit stringChanged();
+ }
+
+ QObject *objectProperty() const { return m_object; }
+ void setObjectProperty(QObject *obj) {
+ if (obj == m_object)
+ return;
+ m_object = obj;
+ emit objectChanged();
+ }
+
+ QQmlListProperty<QObject> objectListProperty() { return QQmlListProperty<QObject>(this, m_objectQList); }
+
+ bool methodCalled() const { return m_methodCalled; }
+ bool methodIntCalled() const { return m_methodIntCalled; }
+
+ QString string() const { return m_string; }
+
+ static MyQmlAttachedObject *qmlAttachedProperties(QObject *o) {
+ return new MyQmlAttachedObject(o);
+ }
+
+ int deleteOnSet() const { return 1; }
+ void setDeleteOnSet(int v) { if(v) delete this; }
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; }
+
+ int resettableProperty() const { return m_resetProperty; }
+ void setResettableProperty(int v) { m_resetProperty = v; }
+ void resetProperty() { m_resetProperty = 13; }
+
+ QRegExp regExp() { return m_regExp; }
+ void setRegExp(const QRegExp &regExp) { m_regExp = regExp; }
+
+ int console() const { return 11; }
+
+ int nonscriptable() const { return 0; }
+ void setNonscriptable(int) {}
+
+ MyQmlObject *myinvokableObject;
+ Q_INVOKABLE MyQmlObject *returnme() { return this; }
+
+ struct MyType {
+ int value;
+ };
+ QVariant variant() const { return m_variant; }
+
+signals:
+ void basicSignal();
+ void argumentSignal(int a, QString b, qreal c);
+ void stringChanged();
+ void objectChanged();
+ void anotherBasicSignal();
+ void thirdBasicSignal();
+ void signalWithUnknownType(const MyQmlObject::MyType &arg);
+
+public slots:
+ void deleteMe() { delete this; }
+ void methodNoArgs() { m_methodCalled = true; }
+ void method(int a) { if(a == 163) m_methodIntCalled = true; }
+ void setString(const QString &s) { m_string = s; }
+ void myinvokable(MyQmlObject *o) { myinvokableObject = o; }
+ void variantMethod(const QVariant &v) { m_variant = v; }
+
+private:
+ friend class tst_qdeclarativeecmascript;
+ bool m_methodCalled;
+ bool m_methodIntCalled;
+
+ QObject *m_object;
+ QString m_string;
+ QList<QObject *> m_objectQList;
+ int m_value;
+ int m_resetProperty;
+ QRegExp m_regExp;
+ QVariant m_variant;
+};
+
+QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
+Q_DECLARE_METATYPE(MyQmlObject::MyType)
+
+class testQObjectApi : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY (int qobjectTestProperty READ qobjectTestProperty NOTIFY qobjectTestPropertyChanged)
+
+public:
+ testQObjectApi(QObject* parent = 0)
+ : QObject(parent), m_testProperty(0)
+ {
+ }
+
+ ~testQObjectApi() {}
+
+ int qobjectTestProperty() const { return m_testProperty; }
+ void setQObjectTestProperty(int tp) { m_testProperty = tp; emit qobjectTestPropertyChanged(tp); }
+
+signals:
+ void qobjectTestPropertyChanged(int testProperty);
+
+private:
+ int m_testProperty;
+};
+
+class ArbitraryVariantProvider : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant arbitraryVariant READ arbitraryVariant WRITE setArbitraryVariant NOTIFY arbitraryVariantChanged)
+
+public:
+ ArbitraryVariantProvider(QObject *parent = 0)
+ : QObject(parent), m_value(QVariant(QString(QLatin1String("random string value")))), m_count(1)
+ {
+ }
+
+ ~ArbitraryVariantProvider() {}
+
+ // the variant provided by the provider
+ QVariant arbitraryVariant() const { return m_value; }
+ void setArbitraryVariant(const QVariant& value) { m_value = value; emit arbitraryVariantChanged(); }
+ Q_INVOKABLE int changeVariant()
+ {
+ QPixmap pv(150, 150);
+ pv.fill(Qt::green);
+ int choice = qrand() % 4;
+ switch (choice) {
+ case 0: setArbitraryVariant(QVariant(QString(QLatin1String("string variant value")))); break;
+ case 1: setArbitraryVariant(QVariant(QColor(110, 120, 130))); break;
+ case 2: setArbitraryVariant(QVariant(55)); break;
+ default: setArbitraryVariant(QVariant(pv)); break;
+ }
+
+ m_count += 1;
+ return m_count;
+ }
+ Q_INVOKABLE QVariant setVariantToFilledPixmap(int width, int height, int r, int g, int b)
+ {
+ QPixmap pv(width % 300, height % 300);
+ pv.fill(QColor(r % 256, g % 256, b % 256));
+ m_value = pv;
+ m_count += 1;
+ return m_value;
+ }
+ Q_INVOKABLE QVariant setVariantAddCount(int addToCount, const QVariant& newValue)
+ {
+ m_value = newValue;
+ m_count += addToCount;
+ return m_value;
+ }
+ Q_INVOKABLE QVariant possibleVariant(int randomFactorOne, int randomFactorTwo, int randomFactorThree) const
+ {
+ QVariant retn;
+ QPixmap pv(randomFactorOne % 300, randomFactorTwo % 300);
+ pv.fill(QColor(randomFactorOne % 256, randomFactorTwo % 256, randomFactorThree % 256));
+ int choice = qrand() % 4;
+ switch (choice) {
+ case 0: retn = QVariant(QString(QLatin1String("string variant value"))); break;
+ case 1: retn = QVariant(QColor(randomFactorThree % 256, randomFactorTwo % 256, randomFactorOne % 256)); break;
+ case 2: retn = QVariant((55 + randomFactorThree)); break;
+ default: retn = QVariant(pv); break;
+ }
+ return retn;
+ }
+
+ // the following functions cover permutations of return value and arguments.
+ // functions with no return value:
+ Q_INVOKABLE void doNothing() const { /* does nothing */ } // no args, const
+ Q_INVOKABLE void incrementVariantChangeCount() { m_count = m_count + 1; } // no args, nonconst
+ Q_INVOKABLE void doNothing(int) const { /* does nothing. */ } // arg, const
+ Q_INVOKABLE void setVariantChangeCount(int newCount) { m_count = newCount; } // arg, nonconst
+ // functions with return value:
+ Q_INVOKABLE int variantChangeCount() const { return m_count; } // no args, const
+ Q_INVOKABLE int modifyVariantChangeCount() { m_count += 3; return m_count; } // no args, nonconst
+ Q_INVOKABLE int countPlus(int value) const { return m_count + value; } // arg, const
+ Q_INVOKABLE int modifyVariantChangeCount(int modifier) { m_count += modifier; return m_count; } // arg, nonconst.
+
+signals:
+ void arbitraryVariantChanged();
+
+private:
+ QVariant m_value;
+ int m_count;
+};
+
+class ScarceResourceProvider : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QPixmap smallScarceResource READ smallScarceResource WRITE setSmallScarceResource NOTIFY smallScarceResourceChanged)
+ Q_PROPERTY(QPixmap largeScarceResource READ largeScarceResource WRITE setLargeScarceResource NOTIFY largeScarceResourceChanged)
+
+public:
+ ScarceResourceProvider(QObject *parent = 0)
+ : QObject(parent), m_small(100, 100), m_large(1000, 1000), m_colour(1)
+ {
+ m_small.fill(Qt::blue);
+ m_large.fill(Qt::blue);
+ }
+
+ ~ScarceResourceProvider() {}
+
+ QPixmap smallScarceResource() const { return m_small; }
+ void setSmallScarceResource(QPixmap v) { m_small = v; emit smallScarceResourceChanged(); }
+ bool smallScarceResourceIsDetached() const { return m_small.isDetached(); }
+
+ QPixmap largeScarceResource() const { return m_large; }
+ void setLargeScarceResource(QPixmap v) { m_large = v; emit largeScarceResourceChanged(); }
+ bool largeScarceResourceIsDetached() const { return m_large.isDetached(); }
+
+ Q_INVOKABLE void changeResources()
+ {
+ QPixmap newSmall(100, 100);
+ QPixmap newLarge(1000, 1000);
+
+ if (m_colour == 1) {
+ m_colour = 2;
+ newSmall.fill(Qt::red);
+ newLarge.fill(Qt::red);
+ } else {
+ m_colour = 1;
+ newSmall.fill(Qt::blue);
+ newLarge.fill(Qt::blue);
+ }
+
+ setSmallScarceResource(newSmall);
+ setLargeScarceResource(newLarge);
+ }
+
+signals:
+ void smallScarceResourceChanged();
+ void largeScarceResourceChanged();
+
+private:
+ QPixmap m_small;
+ QPixmap m_large;
+
+ int m_colour;
+};
+
+void registerTypes();
+
+#endif // TESTTYPES_H
+
diff --git a/tests/benchmarks/qml/holistic/tst_holistic.cpp b/tests/benchmarks/qml/holistic/tst_holistic.cpp
new file mode 100644
index 0000000000..9684b31c0e
--- /dev/null
+++ b/tests/benchmarks/qml/holistic/tst_holistic.cpp
@@ -0,0 +1,607 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtypes.h"
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QQmlContext>
+#include <QQmlProperty>
+#include <QFile>
+#include <QDebug>
+
+// Conceptually, there are several different "holistic" areas to benchmark:
+// 1) Loading
+// - read file from disk
+// - parse/lex file
+// - handle nested imports
+// 2) Compilation
+// - create meta object templates etc
+// - compile to bytecode and cache it
+// 3) Instantiation
+// - running the bytecode to create an object tree, assign properties, etc
+// - and, importantly, to evaluate bindings for the first time (incl. js expressions)
+// 4) Dynamicism
+// - bindings evaluation
+// - signal handlers
+//
+// Aside from this, we also need to determine:
+// 1) JavaScript Metrics
+// - simple expressions
+// - complex expressions
+// - instantiation vs evaluation time
+// - imports and nested imports
+// 2) Context-switch costs
+// - how expensive is it to call a cpp function from QML
+// - how expensive is it to call a js function from cpp via QML
+// - how expensive is it to pass around objects between them
+// 3) Complete creation time.
+// - loading + compilation + instantiation (for "application startup time" metric)
+//
+// In some cases, we want to include "initialization costs";
+// i.e., we need to tell the engine not to cache type data resulting
+// in compilation between rounds, and we need to tell the engine not
+// to cache whatever it caches between instantiations of components.
+// The reason for this is that it is often the "first start of application"
+// performance which we're attempting to benchmark.
+
+// define some custom types we use in test data functions.
+typedef QList<QString> PropertyNameList;
+Q_DECLARE_METATYPE(PropertyNameList);
+typedef QList<QVariant> PropertyValueList;
+Q_DECLARE_METATYPE(PropertyValueList);
+
+class tst_holistic : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_holistic();
+
+private slots:
+ void initTestCase()
+ {
+ registerTypes();
+ qRegisterMetaType<PropertyNameList>("PropertyNameList");
+ qRegisterMetaType<PropertyValueList>("PropertyValueList");
+ }
+
+ void compilation_data();
+ void compilation();
+ void instantiation_data() { compilation_data(); }
+ void instantiation();
+ void creation_data() { compilation_data(); }
+ void creation();
+ void dynamicity_data();
+ void dynamicity();
+
+ void cppToJsDirect_data();
+ void cppToJsDirect();
+ void cppToJsIndirect();
+
+ void typeResolution_data();
+ void typeResolution();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_holistic::tst_holistic()
+{
+}
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+
+void tst_holistic::compilation_data()
+{
+ QTest::addColumn<QStringList>("files");
+ QTest::addColumn<int>("repetitions");
+
+ QStringList f;
+
+ // Benchmarks: a single, small component once with no caching.
+ f << QString(SRCDIR + QLatin1String("/data/smallTargets/SmallOne.qml"));
+ QTest::newRow("single small component") << f << 1;
+
+ // Benchmarks: a single, small component ten times with caching.
+ QTest::newRow("single small component cached") << f << 10; f.clear();
+
+ // Benchmarks: a single, large component once with no caching.
+ f << QString(SRCDIR + QLatin1String("/data/largeTargets/mousearea-example.qml"));
+ QTest::newRow("single large component") << f << 1;
+
+ // Benchmarks: a single, large component ten times with caching.
+ QTest::newRow("single large component cached") << f << 10; f.clear();
+
+ // Benchmarks: 4 small components once each with no caching
+ f << QString(SRCDIR + QLatin1String("/data/smallTargets/SmallOne.qml"));
+ f << QString(SRCDIR + QLatin1String("/data/smallTargets/SmallTwo.qml"));
+ f << QString(SRCDIR + QLatin1String("/data/smallTargets/SmallThree.qml"));
+ f << QString(SRCDIR + QLatin1String("/data/smallTargets/SmallFour.qml"));
+ QTest::newRow("multiple small components") << f << 1;
+
+ // Benchmarks: 4 small components ten times each with caching
+ QTest::newRow("multiple small components cached") << f << 10; f.clear();
+
+ // Benchmarks: 3 large components once each with no caching.
+ f << QString(SRCDIR + QLatin1String("/data/largeTargets/mousearea-example.qml"));
+ f << QString(SRCDIR + QLatin1String("/data/largeTargets/gridview-example.qml"));
+ f << QString(SRCDIR + QLatin1String("/data/largeTargets/layoutdirection.qml"));
+ QTest::newRow("multiple large components") << f << 1;
+
+ // Benchmarks: 3 large components ten times each with caching.
+ QTest::newRow("multiple large components cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports a single small js file, no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Sssi.qml"));
+ QTest::newRow("single small js import") << f << 1;
+
+ // Benchmarks: single small component which imports a single small js file, 10 reps, with caching
+ QTest::newRow("single small js import, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple small js files (no deep nesting), no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Msbsi.qml"));
+ QTest::newRow("multiple small js imports, shallow") << f << 1;
+
+ // Benchmarks: single small component which imports multiple small js files (no deep nesting), 10 reps, with caching
+ QTest::newRow("multiple small js imports, shallow, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple small js files (with deep nesting), no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Msdsi.qml"));
+ QTest::newRow("multiple small js imports, deeply nested") << f << 1;
+
+ // Benchmarks: single small component which imports multiple small js files (with deep nesting), 10 reps, with caching
+ QTest::newRow("multiple small js imports, deeply nested, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple small js files (nested and unnested), no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Mssi.qml"));
+ QTest::newRow("muliple small js imports, both") << f << 1;
+
+ // Benchmarks: single small component which imports multiple small js files (nested and unnested), 10 reps, with caching
+ QTest::newRow("muliple small js imports, both, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports a single large js file, no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Slsi.qml"));
+ QTest::newRow("single large js import") << f << 1;
+
+ // Benchmarks: single small component which imports a single large js file, 10 reps, with caching
+ QTest::newRow("single large js import, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple large js files (no deep nesting), no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Mlbsi.qml"));
+ QTest::newRow("multiple large js imports, shallow") << f << 1;
+
+ // Benchmarks: single small component which imports multiple large js files (no deep nesting), 10 reps, with caching
+ QTest::newRow("multiple large js imports, shallow, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple large js files (with deep nesting), no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Mldsi.qml"));
+ QTest::newRow("multiple large js imports, deeply nested") << f << 1;
+
+ // Benchmarks: single small component which imports multiple large js files (with deep nesting), 10 reps, with caching
+ QTest::newRow("multiple large js imports, deeply nested, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple large js files (nested and unnested), no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/Mlsi.qml"));
+ QTest::newRow("multiple large js imports, both") << f << 1;
+
+ // Benchmarks: single small component which imports multiple large js files (nested and unnested), 10 reps, with caching
+ QTest::newRow("multiple large js imports, both, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple js files which all import a .pragma library js file, no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/PragmaBm.qml"));
+ QTest::newRow(".pragma library js import") << f << 1;
+
+ // Benchmarks: single small component which imports multiple js files which all import a .pragma library js file, 10 reps, with caching
+ QTest::newRow(".pragma library js import, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports a js file which imports a QML module, no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/ModuleBm.qml"));
+ QTest::newRow("import js with QML import") << f << 1;
+
+ // Benchmarks: single small component which imports a js file which imports a QML module, 10 reps, with caching
+ QTest::newRow("import js with QML import, cached") << f << 10; f.clear();
+
+ // Benchmarks: single small component which imports multiple js files which all import a .pragma library js file and a QML module, no caching
+ f << QString(SRCDIR + QLatin1String("/data/jsImports/PragmaModuleBm.qml"));
+ QTest::newRow("import js with QML import and .pragma library") << f << 1;
+
+ // Benchmarks: single small component which imports multiple js files which all import a .pragma library js file and a QML module, 10 reps, with caching
+ QTest::newRow("import js with QML import and .pragma library, cached") << f << 10; f.clear();
+}
+
+void tst_holistic::compilation()
+{
+ // This function benchmarks the cost of loading and compiling specified QML files.
+ // If "repetitions" is non-zero, each file from "files" will be compiled "repetitions"
+ // times, without clearing the engine's component cache between compilations.
+
+ QFETCH(QStringList, files);
+ QFETCH(int, repetitions);
+ Q_ASSERT(files.size() > 0);
+ Q_ASSERT(repetitions > 0);
+
+ QBENCHMARK {
+ engine.clearComponentCache();
+ for (int i = 0; i < repetitions; ++i) {
+ for (int j = 0; j < files.size(); ++j) {
+ QQmlComponent c(&engine, QUrl::fromLocalFile(files.at(j)));
+ }
+ }
+ }
+}
+
+void tst_holistic::instantiation()
+{
+ // This function benchmarks the cost of instantiating components compiled from specified QML files.
+ // If "repetitions" is non-zero, each component compiled from "files" will be instantiated "repetitions"
+ // times, without clearing the component's instantiation cache between instantiations.
+
+ QFETCH(QStringList, files);
+ QFETCH(int, repetitions);
+ Q_ASSERT(files.size() > 0);
+ Q_ASSERT(repetitions > 0);
+
+ QList<QQmlComponent*> components;
+ for (int i = 0; i < files.size(); ++i) {
+ QQmlComponent *c = new QQmlComponent(&engine, QUrl::fromLocalFile(files.at(i)));
+ components.append(c);
+ }
+
+ QBENCHMARK {
+ // XXX TODO: clear each component's instantiation cache
+
+ for (int i = 0; i < repetitions; ++i) {
+ for (int j = 0; j < components.size(); ++j) {
+ QObject *obj = components.at(j)->create();
+ delete obj;
+ }
+ }
+ }
+
+ // cleanup
+ for (int i = 0; i < components.size(); ++i) {
+ delete components.at(i);
+ }
+}
+
+void tst_holistic::creation()
+{
+ // This function benchmarks the cost of loading, compiling and instantiating specified QML files.
+ // If "repetitions" is non-zero, each file from "files" will be created "repetitions"
+ // times, without clearing the engine's component cache between component creation.
+
+ QFETCH(QStringList, files);
+ QFETCH(int, repetitions);
+ Q_ASSERT(files.size() > 0);
+ Q_ASSERT(repetitions > 0);
+
+ QBENCHMARK {
+ engine.clearComponentCache();
+ for (int i = 0; i < repetitions; ++i) {
+ for (int j = 0; j < files.size(); ++j) {
+ QQmlComponent c(&engine, QUrl::fromLocalFile(files.at(j)));
+ QObject *obj = c.create();
+ delete obj;
+ }
+ }
+ }
+}
+
+void tst_holistic::dynamicity_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("writeProperty");
+ QTest::addColumn<QVariant>("writeValueOne");
+ QTest::addColumn<QVariant>("writeValueTwo");
+ QTest::addColumn<QString>("readProperty");
+
+ QString f;
+
+ // Benchmarks: single simple property binding
+ f = QString(SRCDIR + QLatin1String("/data/dynamicTargets/DynamicOne.qml"));
+ QTest::newRow("single simple property binding") << f << QString(QLatin1String("dynamicWidth")) << QVariant(300) << QVariant(500) << QString(QLatin1String("height"));
+
+ // Benchmarks: multiple simple property bindings in one component
+ f = QString(SRCDIR + QLatin1String("/data/dynamicTargets/DynamicTwo.qml"));
+ QTest::newRow("multiple simple property bindings") << f << QString(QLatin1String("dynamicWidth")) << QVariant(300) << QVariant(500) << QString(QLatin1String("dynamicWidth"));
+
+ // Benchmarks: single simple property binding plus onPropertyChanged slot
+ f = QString(SRCDIR + QLatin1String("/data/dynamicTargets/DynamicThree.qml"));
+ QTest::newRow("single simple plus slot") << f << QString(QLatin1String("dynamicWidth")) << QVariant(300) << QVariant(500) << QString(QLatin1String("dynamicWidth"));
+
+ // Benchmarks: multiple simple property bindings plus multiple onPropertyChanged slots in one component
+ f = QString(SRCDIR + QLatin1String("/data/dynamicTargets/DynamicFour.qml"));
+ QTest::newRow("multiple simple plus slots") << f << QString(QLatin1String("dynamicWidth")) << QVariant(300) << QVariant(500) << QString(QLatin1String("dynamicHeight"));
+
+ // Benchmarks: single simple js expression in a slot
+ f = QString(SRCDIR + QLatin1String("/data/jsTargets/JsOne.qml"));
+ QTest::newRow("single simple js expression slot") << f << QString(QLatin1String("dynamicWidth")) << QVariant(300) << QVariant(500) << QString(QLatin1String("dynamicWidth"));
+
+ // Benchmarks: single complex js expression in a slot
+ f = QString(SRCDIR + QLatin1String("/data/jsTargets/JsTwo.qml"));
+ QTest::newRow("single complex js expression slot") << f << QString(QLatin1String("dynamicWidth")) << QVariant(300) << QVariant(500) << QString(QLatin1String("dynamicWidth"));
+
+ // Benchmarks: simple property assignment and bindings update
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/CppToQml.qml"));
+ QTest::newRow("single simple property binding") << f << QString(QLatin1String("arbitrary")) << QVariant(36) << QVariant(35) << QString(QLatin1String("arbitrary"));
+}
+
+void tst_holistic::dynamicity()
+{
+ // This function benchmarks the cost of "continued operation" - signal invocation,
+ // updating bindings, etc. Note that we take two different writeValues in order
+ // to force updates to occur, and we read to force lazy evaluation to occur.
+
+ QFETCH(QString, file);
+ QFETCH(QString, writeProperty);
+ QFETCH(QVariant, writeValueOne);
+ QFETCH(QVariant, writeValueTwo);
+ QFETCH(QString, readProperty);
+
+ QQmlComponent c(&engine, file);
+ QObject *obj = c.create();
+
+ QVariant readValue;
+ QVariant writeValue;
+ bool usedFirst = false;
+
+ QBENCHMARK {
+ if (usedFirst) {
+ writeValue = writeValueTwo;
+ usedFirst = false;
+ } else {
+ writeValue = writeValueOne;
+ usedFirst = true;
+ }
+
+ obj->setProperty(writeProperty.toLatin1().constData(), writeValue);
+ readValue = obj->property(readProperty.toLatin1().constData());
+ }
+
+ delete obj;
+}
+
+
+
+
+
+
+
+void tst_holistic::cppToJsDirect_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("methodName");
+
+ QString f;
+
+ // Benchmarks: cost of calling a js function from cpp directly
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/CppToJs.qml"));
+ QTest::newRow("cpp-to-js") << f << QString(QLatin1String("callJsFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // const CPP function with no return value and no arguments.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppOne.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: no retn, no args") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // nonconst CPP function with no return value and no arguments.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppTwo.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: nonconst, no retn, no args") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // const CPP function with no return value and a single integer argument.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppThree.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: const, no retn, int arg") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // nonconst CPP function with no return value and a single integer argument.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppFour.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: nonconst, no retn, int arg") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // const CPP function with an integer return value and no arguments.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppFive.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: const, int retn, no args") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // nonconst CPP function with an integer return value and no arguments.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppSix.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: nonconst, int retn, no args") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // const CPP function with an integer return value and a single integer argument.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppSeven.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: const, int retn, int arg") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // nonconst CPP function with an integer return value and a single integer argument.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppEight.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: nonconst, int retn, int arg") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // const CPP function with a variant return value and multiple integer arguments.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppNine.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: const, variant retn, int args") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // nonconst CPP function with a variant return value and multiple integer arguments.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppTen.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: nonconst, variant retn, int args") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: cost of calling js function which calls cpp function:
+ // nonconst CPP function with a variant return value and multiple integer arguments.
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/JsToCppEleven.qml"));
+ QTest::newRow("cpp-to-js-to-cpp: nonconst, variant retn, variant + int args") << f << QString(QLatin1String("callCppFunction"));
+
+ // Benchmarks: calling js function which copies scarce resources by calling back into cpp scope
+ f = QString(SRCDIR + QLatin1String("/data/scopeSwitching/ScarceOne.qml"));
+ QTest::newRow("cpp-to-js-to-coo: copy scarce resources") << f << QString(QLatin1String("copyScarceResources"));
+}
+
+
+void tst_holistic::cppToJsDirect()
+{
+ // This function benchmarks the cost of calling from CPP scope to JS scope
+ // (and possibly vice versa, if the invoked js method then calls to cpp).
+
+ QFETCH(QString, file);
+ QFETCH(QString, methodName);
+
+ QQmlComponent c(&engine, file);
+ QObject *obj = c.create();
+
+ QBENCHMARK {
+ QMetaObject::invokeMethod(obj, methodName.toLatin1().constData());
+ }
+
+ delete obj;
+}
+
+
+void tst_holistic::cppToJsIndirect()
+{
+ // This function benchmarks the cost of binding scarce resources
+ // to properties of a QML component. The engine should automatically release such
+ // resources when they are no longer used.
+ // The benchmark deliberately causes change signals to be emitted (and
+ // modifies the scarce resources) so that the properties are updated.
+
+ QQmlComponent c(&engine, QString(SRCDIR + QLatin1String("/data/scopeSwitching/ScarceTwo.qml")));
+ QObject *obj = c.create();
+
+ ScarceResourceProvider *srp = 0;
+ srp = qobject_cast<ScarceResourceProvider*>(QQmlProperty::read(obj, "a").value<QObject*>());
+
+ QBENCHMARK {
+ srp->changeResources(); // will cause small+large scarce resources changed signals to be emitted.
+ }
+
+ delete obj;
+}
+
+
+
+
+
+void tst_holistic::typeResolution_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<PropertyNameList>("propertyNameOne");
+ QTest::addColumn<PropertyValueList>("propertyValueOne");
+ QTest::addColumn<PropertyNameList>("propertyNameTwo");
+ QTest::addColumn<PropertyValueList>("propertyValueTwo");
+ QTest::addColumn<int>("repetitions");
+
+ QString f;
+ PropertyNameList pn1;
+ PropertyValueList pv1;
+ PropertyNameList pn2;
+ PropertyValueList pv2;
+
+ // Benchmarks: resolving nested ids and types, no caching
+ f = QString(SRCDIR + QLatin1String("/data/resolutionTargets/ResolveOne.qml"));
+ pn1 << QString(QLatin1String("baseWidth")) << QString(QLatin1String("baseHeight")) << QString(QLatin1String("baseColor"));
+ pv1 << QVariant(401) << QVariant(402) << QVariant(QString(QLatin1String("brown")));
+ pn2 << QString(QLatin1String("baseWidth")) << QString(QLatin1String("baseHeight")) << QString(QLatin1String("baseColor"));
+ pv2 << QVariant(403) << QVariant(404) << QVariant(QString(QLatin1String("orange")));
+ QTest::newRow("nested id resolution") << f << pn1 << pv1 << pn2 << pv2 << 1;
+
+ // Benchmarks: resolving nested ids and types, 10 reps with caching
+ QTest::newRow("nested id resolution, cached") << f << pn1 << pv1 << pn2 << pv2 << 10;
+ pn1.clear(); pn2.clear(); pv1.clear(); pv2.clear();
+}
+
+void tst_holistic::typeResolution()
+{
+ // This function benchmarks the cost of "continued operation" (signal invocation,
+ // updating bindings, etc) where the component has lots of nested items with
+ // lots of resolving required. Note that we take two different writeValues in order
+ // to force updates to occur.
+
+ QFETCH(QString, file);
+ QFETCH(PropertyNameList, propertyNameOne);
+ QFETCH(PropertyValueList, propertyValueOne);
+ QFETCH(PropertyNameList, propertyNameTwo);
+ QFETCH(PropertyValueList, propertyValueTwo);
+ QFETCH(int, repetitions);
+
+ Q_ASSERT(propertyNameOne.size() == propertyValueOne.size());
+ Q_ASSERT(propertyNameTwo.size() == propertyValueTwo.size());
+ Q_ASSERT(repetitions > 0);
+
+ QQmlComponent c(&engine, file);
+ QObject *obj = c.create();
+
+ PropertyNameList writeProperty;
+ PropertyValueList writeValue;
+ bool usedFirst = false;
+
+ QBENCHMARK {
+ for (int i = 0; i < repetitions; ++i) {
+ if (usedFirst) {
+ writeProperty = propertyNameOne;
+ writeValue = propertyValueOne;
+ usedFirst = false;
+ } else {
+ writeProperty = propertyNameTwo;
+ writeValue = propertyValueTwo;
+ usedFirst = true;
+ }
+
+ for (int j = 0; j < writeProperty.size(); ++j) {
+ obj->setProperty(writeProperty.at(j).toLatin1().constData(), writeValue.at(j));
+ }
+ }
+ }
+
+ delete obj;
+}
+
+
+QTEST_MAIN(tst_holistic)
+
+#include "tst_holistic.moc"
diff --git a/tests/benchmarks/qml/javascript/data/NestedIdObject.qml b/tests/benchmarks/qml/javascript/data/NestedIdObject.qml
new file mode 100644
index 0000000000..753d547ace
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/data/NestedIdObject.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+QtObject {
+ function runtest() {
+ for (var ii = 0; ii < 5000000; ++ii) {
+ root
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/javascript/data/intQObjectProperty.qml b/tests/benchmarks/qml/javascript/data/intQObjectProperty.qml
new file mode 100644
index 0000000000..c3e6ebc16a
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/data/intQObjectProperty.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+TestObject {
+ id: root
+
+ function runtest() {
+ var r = root;
+
+ for (var ii = 0; ii < 5000000; ++ii) {
+ r.intValue
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/javascript/data/localId.qml b/tests/benchmarks/qml/javascript/data/localId.qml
new file mode 100644
index 0000000000..d42b891092
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/data/localId.qml
@@ -0,0 +1,13 @@
+// Benchmarks the cost of accessing an id in the same file as the script.
+
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ function runtest() {
+ for (var ii = 0; ii < 5000000; ++ii) {
+ root
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/javascript/data/nestedId.qml b/tests/benchmarks/qml/javascript/data/nestedId.qml
new file mode 100644
index 0000000000..538699d452
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/data/nestedId.qml
@@ -0,0 +1,13 @@
+// Benchmarks the cost of accessing an id in a parent context of the script.
+
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property variant object: NestedIdObject {}
+ function runtest() {
+ object.runtest();
+ }
+}
+
diff --git a/tests/benchmarks/qml/javascript/data/stringQObjectProperty.qml b/tests/benchmarks/qml/javascript/data/stringQObjectProperty.qml
new file mode 100644
index 0000000000..ccd8a791b6
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/data/stringQObjectProperty.qml
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+
+TestObject {
+ id: root
+
+ function runtest() {
+ var r = root;
+
+ for (var ii = 0; ii < 5000000; ++ii) {
+ r.stringValue
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/javascript/javascript.pro b/tests/benchmarks/qml/javascript/javascript.pro
new file mode 100644
index 0000000000..b8f23f47d5
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/javascript.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_javascript
+QT += qml testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_javascript.cpp testtypes.cpp
+HEADERS += testtypes.h
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/javascript/testtypes.cpp b/tests/benchmarks/qml/javascript/testtypes.cpp
new file mode 100644
index 0000000000..1d6920d9a5
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/testtypes.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtypes.h"
+#include <QtQml/qqml.h>
+
+void registerTypes()
+{
+ qmlRegisterType<TestObject>("Qt.test", 1,0, "TestObject");
+}
diff --git a/tests/benchmarks/qml/javascript/testtypes.h b/tests/benchmarks/qml/javascript/testtypes.h
new file mode 100644
index 0000000000..99781fc797
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/testtypes.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int intValue READ intValue);
+ Q_PROPERTY(QString stringValue READ stringValue);
+
+public:
+ TestObject() : m_string("Hello world!") {}
+
+ int intValue() const { return 13; }
+ QString stringValue() const { return m_string; }
+
+private:
+ QString m_string;
+};
+
+void registerTypes();
+
+#endif // TESTTYPES_H
diff --git a/tests/benchmarks/qml/javascript/tst_javascript.cpp b/tests/benchmarks/qml/javascript/tst_javascript.cpp
new file mode 100644
index 0000000000..052ca70e0d
--- /dev/null
+++ b/tests/benchmarks/qml/javascript/tst_javascript.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDir>
+#include <QDebug>
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+
+#include "testtypes.h"
+
+class tst_javascript : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_javascript();
+ virtual ~tst_javascript();
+
+private slots:
+ void run_data();
+ void run();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_javascript::tst_javascript()
+{
+ registerTypes();
+}
+
+tst_javascript::~tst_javascript()
+{
+}
+
+void tst_javascript::run_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QDir dir(SRCDIR "/data");
+
+ QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
+
+ for (int ii = 0; ii < files.count(); ++ii) {
+ QString file = files.at(ii);
+ if (file.endsWith(".qml") && file.at(0).isLower()) {
+
+ QString testName = file.left(file.length() - 4 /* strlen(".qml") */);
+ QString fileName = QLatin1String(SRCDIR) + QLatin1String("/data/") + file;
+
+
+ QTest::newRow(qPrintable(testName)) << fileName;
+
+ }
+ }
+}
+
+void tst_javascript::run()
+{
+ QFETCH(QString, file);
+
+ QQmlComponent c(&engine, file);
+
+ if (c.isError()) {
+ qWarning() << c.errors();
+ }
+
+ QVERIFY(!c.isError());
+
+ QObject *o = c.create();
+ QVERIFY(o != 0);
+
+ QMetaMethod method = o->metaObject()->method(o->metaObject()->indexOfMethod("runtest()"));
+
+ QBENCHMARK {
+ method.invoke(o);
+ }
+
+ delete o;
+}
+
+QTEST_MAIN(tst_javascript)
+
+#include "tst_javascript.moc"
diff --git a/tests/benchmarks/qml/js/js.pro b/tests/benchmarks/qml/js/js.pro
new file mode 100644
index 0000000000..b1448d8eb8
--- /dev/null
+++ b/tests/benchmarks/qml/js/js.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ qjsengine \
+ qjsvalue \
+ qjsvalueiterator \
+
+TRUSTED_BENCHMARKS += \
+ qjsvalue \
+ qjsengine \
+
diff --git a/tests/benchmarks/qml/js/qjsengine/qjsengine.pro b/tests/benchmarks/qml/js/qjsengine/qjsengine.pro
new file mode 100644
index 0000000000..f736e59222
--- /dev/null
+++ b/tests/benchmarks/qml/js/qjsengine/qjsengine.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_bench_qjsengine
+
+SOURCES += tst_qjsengine.cpp
+
+QT += qml testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp b/tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp
new file mode 100644
index 0000000000..6f6ad4e5d9
--- /dev/null
+++ b/tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp
@@ -0,0 +1,588 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qjsengine.h>
+
+class tst_QJSEngine : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSEngine();
+ virtual ~tst_QJSEngine();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void constructor();
+#if 0 // No defaultPrototype for now
+ void defaultPrototype();
+ void setDefaultPrototype();
+#endif
+ void evaluate_data();
+ void evaluate();
+#if 0 // No program
+ void evaluateProgram_data();
+ void evaluateProgram();
+#endif
+#if 0 // no connections for now
+ void connectAndDisconnect();
+#endif
+ void globalObject();
+#if 0 // no is Evaluating for now
+ void isEvaluating();
+#endif
+ void newArray_data();
+ void newArray();
+ void newDate();
+ void newObject();
+#if 0 // No ScriptClass
+ void newObjectWithScriptClass();
+#endif
+#if 0 // no qmetaobject
+ void newQMetaObject();
+#endif
+ void newQObject();
+#if 0 // no native functions for now
+ void newFunction();
+#endif
+ void newRegExp();
+ void newVariant();
+ void undefinedValue();
+ void collectGarbage();
+#if 0 // No extensions
+ void availableExtensions();
+ void importedExtensions();
+#endif
+#if 0 // no context
+ void currentContext();
+ void pushAndPopContext();
+#endif
+#if 0 // no stringhandle
+ void toStringHandle();
+#endif
+ void castValueToQreal();
+#if 0 // no native functions for now
+ void nativeCall();
+#endif
+#if 0 // no translations
+ void installTranslatorFunctions();
+ void translation_data();
+ void translation();
+#endif
+#if 0 // no declarative class
+ void readScopeProperty_data();
+ void readScopeProperty();
+#endif
+#if 0 // no context
+ void evaluateInNewContext();
+ void evaluateInNewContextWithScope();
+#endif
+#if 0 // no pushScope
+ void evaluateBindingExpression();
+#endif
+
+private:
+ void defineStandardTestValues();
+ void newEngine()
+ {
+ delete m_engine;
+ m_engine = new QJSEngine;
+ }
+
+ QJSEngine *m_engine;
+};
+
+tst_QJSEngine::tst_QJSEngine()
+ : m_engine(0)
+{
+}
+
+tst_QJSEngine::~tst_QJSEngine()
+{
+ delete m_engine;
+}
+
+void tst_QJSEngine::init()
+{
+}
+
+void tst_QJSEngine::cleanup()
+{
+}
+
+void tst_QJSEngine::constructor()
+{
+ QBENCHMARK {
+ QJSEngine engine;
+ (void)engine.parent();
+ }
+}
+
+#if 0 // No defaultPrototype for now
+void tst_QJSEngine::defaultPrototype()
+{
+ newEngine();
+ int type = qMetaTypeId<int>();
+ m_engine->setDefaultPrototype(type, m_engine->newObject());
+ QBENCHMARK {
+ m_engine->defaultPrototype(type);
+ }
+}
+
+void tst_QJSEngine::setDefaultPrototype()
+{
+ newEngine();
+ int type = qMetaTypeId<int>();
+ QJSValue proto = m_engine->newObject();
+ QBENCHMARK {
+ m_engine->setDefaultPrototype(type, proto);
+ }
+}
+
+#endif
+
+void tst_QJSEngine::evaluate_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty script") << QString::fromLatin1("");
+ QTest::newRow("number literal") << QString::fromLatin1("123");
+ QTest::newRow("string literal") << QString::fromLatin1("'ciao'");
+ QTest::newRow("regexp literal") << QString::fromLatin1("/foo/gim");
+ QTest::newRow("null literal") << QString::fromLatin1("null");
+ QTest::newRow("undefined literal") << QString::fromLatin1("undefined");
+ QTest::newRow("null literal") << QString::fromLatin1("null");
+ QTest::newRow("empty object literal") << QString::fromLatin1("{}");
+ QTest::newRow("this") << QString::fromLatin1("this");
+ QTest::newRow("object literal with one property") << QString::fromLatin1("{ foo: 123 }");
+ QTest::newRow("object literal with two properties") << QString::fromLatin1("{ foo: 123, bar: 456 }");
+ QTest::newRow("object literal with many properties") << QString::fromLatin1("{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10 }");
+ QTest::newRow("empty array literal") << QString::fromLatin1("[]");
+ QTest::newRow("array literal with one element") << QString::fromLatin1("[1]");
+ QTest::newRow("array literal with two elements") << QString::fromLatin1("[1,2]");
+ QTest::newRow("array literal with many elements") << QString::fromLatin1("[1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]");
+ QTest::newRow("empty function definition") << QString::fromLatin1("function foo() { }");
+ QTest::newRow("function definition") << QString::fromLatin1("function foo() { return 123; }");
+ QTest::newRow("for loop with empty body (1000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000; ++i) {}");
+ QTest::newRow("for loop with empty body (10000 iterations)") << QString::fromLatin1("for (i = 0; i < 10000; ++i) {}");
+ QTest::newRow("for loop with empty body (100000 iterations)") << QString::fromLatin1("for (i = 0; i < 100000; ++i) {}");
+ QTest::newRow("for loop with empty body (1000000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000000; ++i) {}");
+ QTest::newRow("for loop (1000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (10000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 10000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (100000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 100000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (1000000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000000; ++i) { j += i; }; j");
+ QTest::newRow("assignments") << QString::fromLatin1("a = 1; b = 2; c = 3; d = 4");
+ QTest::newRow("while loop (1000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000) { ++i; }; i");
+ QTest::newRow("while loop (10000 iterations)") << QString::fromLatin1("i = 0; while (i < 10000) { ++i; }; i");
+ QTest::newRow("while loop (100000 iterations)") << QString::fromLatin1("i = 0; while (i < 100000) { ++i; }; i");
+ QTest::newRow("while loop (1000000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000000) { ++i; }; i");
+ QTest::newRow("function expression") << QString::fromLatin1("(function(a, b, c){ return a + b + c; })(1, 2, 3)");
+}
+
+void tst_QJSEngine::evaluate()
+{
+ QFETCH(QString, code);
+ newEngine();
+
+ QBENCHMARK {
+ (void)m_engine->evaluate(code);
+ }
+}
+
+#if 0
+void tst_QJSEngine::connectAndDisconnect()
+{
+ newEngine();
+ QJSValue fun = m_engine->evaluate("(function() { })");
+ QBENCHMARK {
+ qScriptConnect(m_engine, SIGNAL(destroyed()), QJSValue(), fun);
+ qScriptDisconnect(m_engine, SIGNAL(destroyed()), QJSValue(), fun);
+ }
+}
+
+void tst_QJSEngine::evaluateProgram_data()
+{
+ evaluate_data();
+}
+
+void tst_QJSEngine::evaluateProgram()
+{
+ QFETCH(QString, code);
+ QScriptProgram program(code);
+ newEngine();
+
+ QBENCHMARK {
+ (void)m_engine->evaluate(program);
+ }
+}
+#endif
+
+void tst_QJSEngine::globalObject()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->globalObject();
+ }
+}
+
+#if 0
+void tst_QJSEngine::isEvaluating()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->isEvaluating();
+ }
+}
+#endif
+
+void tst_QJSEngine::newArray_data()
+{
+ QTest::addColumn<int>("size");
+ QTest::newRow("size=0") << 0;
+ QTest::newRow("size=10") << 10;
+ QTest::newRow("size=100") << 0;
+ QTest::newRow("size=1000") << 0;
+ QTest::newRow("size=10000") << 0;
+ QTest::newRow("size=50000") << 0;
+}
+
+void tst_QJSEngine::newArray()
+{
+ QFETCH(int, size);
+ newEngine();
+ QBENCHMARK {
+ m_engine->newArray(size);
+ }
+}
+
+void tst_QJSEngine::newDate()
+{
+ newEngine();
+ QDateTime dt = QDateTime::currentDateTime();
+ QBENCHMARK {
+ m_engine->toScriptValue(dt);
+ }
+}
+
+void tst_QJSEngine::newObject()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->newObject();
+ }
+}
+
+#if 0
+void tst_QJSEngine::newObjectWithScriptClass()
+{
+ newEngine();
+ QScriptClass cls(m_engine);
+ QBENCHMARK {
+ m_engine->newObject(&cls);
+ }
+}
+
+void tst_QJSEngine::newQMetaObject()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->newQMetaObject(&QJSEngine::staticMetaObject);
+ }
+}
+#endif
+
+void tst_QJSEngine::newQObject()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->newQObject(QCoreApplication::instance());
+ }
+}
+
+#if 0
+static QJSValue testFunction(QScriptContext *, QJSEngine *)
+{
+ return 0;
+}
+
+void tst_QJSEngine::newFunction()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->newFunction(testFunction);
+ }
+}
+#endif
+
+void tst_QJSEngine::newRegExp()
+{
+ newEngine();
+ QRegExp re = QRegExp("foo");
+ QBENCHMARK {
+ m_engine->toScriptValue(re);
+ }
+}
+
+void tst_QJSEngine::newVariant()
+{
+ newEngine();
+ QVariant var(QPoint(10, 20));
+ QBENCHMARK {
+ (void)m_engine->toScriptValue(var);
+ }
+}
+
+void tst_QJSEngine::undefinedValue()
+{
+ newEngine();
+ QVariant var;
+ QBENCHMARK {
+ m_engine->toScriptValue(var);
+ }
+}
+
+void tst_QJSEngine::collectGarbage()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->collectGarbage();
+ }
+}
+
+#if 0
+void tst_QJSEngine::availableExtensions()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->availableExtensions();
+ }
+}
+
+void tst_QJSEngine::importedExtensions()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->importedExtensions();
+ }
+}
+
+void tst_QJSEngine::currentContext()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->currentContext();
+ }
+}
+
+void tst_QJSEngine::pushAndPopContext()
+{
+ newEngine();
+ QBENCHMARK {
+ (void)m_engine->pushContext();
+ m_engine->popContext();
+ }
+}
+#endif
+
+#if 0
+void tst_QJSEngine::toStringHandle()
+{
+ newEngine();
+ QString str = QString::fromLatin1("foobarbaz");
+ QBENCHMARK {
+ (void)m_engine->toStringHandle(str);
+ }
+}
+#endif
+
+void tst_QJSEngine::castValueToQreal()
+{
+ QJSValue val(123);
+ QBENCHMARK {
+ (void)qjsvalue_cast<qreal>(val);
+ }
+}
+
+#if 0
+static QJSValue native_function(QScriptContext *, QJSEngine *)
+{
+ return 42;
+}
+
+void tst_QJSEngine::nativeCall()
+{
+ newEngine();
+ m_engine->globalObject().setProperty("fun", m_engine->newFunction(native_function));
+ QBENCHMARK{
+ m_engine->evaluate("var w = 0; for (i = 0; i < 100000; ++i) {\n"
+ " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }");
+ }
+}
+
+void tst_QJSEngine::installTranslatorFunctions()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->installTranslatorFunctions();
+ }
+}
+
+void tst_QJSEngine::translation_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow("no translation") << "\"hello world\"" << "";
+ QTest::newRow("qsTr") << "qsTr(\"hello world\")" << "";
+ QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")" << "";
+ QTest::newRow("qsTr:script.js") << "qsTr(\"hello world\")" << "script.js";
+}
+
+void tst_QJSEngine::translation()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, fileName);
+ newEngine();
+ m_engine->installTranslatorFunctions();
+
+ QBENCHMARK {
+ (void)m_engine->evaluate(text, fileName);
+ }
+}
+#endif
+
+#if 0
+void tst_QJSEngine::readScopeProperty_data()
+{
+ QTest::addColumn<bool>("staticScope");
+ QTest::addColumn<bool>("nestedScope");
+ QTest::newRow("single dynamic scope") << false << false;
+ QTest::newRow("single static scope") << true << false;
+ QTest::newRow("double dynamic scope") << false << true;
+ QTest::newRow("double static scope") << true << true;
+}
+
+void tst_QJSEngine::readScopeProperty()
+{
+ QFETCH(bool, staticScope);
+ QFETCH(bool, nestedScope);
+
+ newEngine();
+ QScriptContext *ctx = m_engine->pushContext();
+
+ QJSValue scope;
+ if (staticScope)
+ scope = QScriptDeclarativeClass::newStaticScopeObject(m_engine);
+ else
+ scope = m_engine->newObject();
+ scope.setProperty("foo", 123);
+ ctx->pushScope(scope);
+
+ if (nestedScope) {
+ QJSValue scope2;
+ if (staticScope)
+ scope2 = QScriptDeclarativeClass::newStaticScopeObject(m_engine);
+ else
+ scope2 = m_engine->newObject();
+ scope2.setProperty("bar", 456); // ensure a miss in inner scope
+ ctx->pushScope(scope2);
+ }
+
+ QJSValue fun = m_engine->evaluate("(function() {\n"
+ " for (var i = 0; i < 10000; ++i) {\n"
+ " foo; foo; foo; foo; foo; foo; foo; foo;\n"
+ " }\n"
+ "})");
+ m_engine->popContext();
+ QVERIFY(fun.isFunction());
+ QBENCHMARK {
+ fun.call();
+ }
+}
+
+void tst_QJSEngine::evaluateInNewContext()
+{
+ QJSEngine engine;
+ QBENCHMARK {
+ engine.pushContext();
+ engine.evaluate("var a = 10");
+ engine.popContext();
+ }
+}
+
+void tst_QJSEngine::evaluateInNewContextWithScope()
+{
+ QJSEngine engine;
+ QJSValue scope = engine.newObject();
+ scope.setProperty("foo", 123);
+ QBENCHMARK {
+ QScriptContext *ctx = engine.pushContext();
+ ctx->pushScope(scope);
+ engine.evaluate("foo");
+ engine.popContext();
+ }
+}
+
+// Binding expressions in QML are implemented as anonymous functions
+// with custom scopes.
+void tst_QJSEngine::evaluateBindingExpression()
+{
+ QJSEngine engine;
+ QScriptContext *ctx = engine.pushContext();
+ QJSValue scope = engine.newObject();
+ scope.setProperty("foo", 123);
+ ctx->pushScope(scope);
+ QJSValue fun = engine.evaluate("(function() { return foo; })");
+ QVERIFY(fun.isFunction());
+ engine.popContext();
+ QVERIFY(fun.call().equals(scope.property("foo")));
+ QJSValue receiver = engine.globalObject();
+ QBENCHMARK {
+ fun.call(receiver);
+ }
+}
+#endif
+
+QTEST_MAIN(tst_QJSEngine)
+#include "tst_qjsengine.moc"
diff --git a/tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro b/tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro
new file mode 100644
index 0000000000..7b8363b6c4
--- /dev/null
+++ b/tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_bench_qjsvalue
+
+SOURCES += tst_qjsvalue.cpp
+
+QT += qml testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp b/tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp
new file mode 100644
index 0000000000..c486bf8bf8
--- /dev/null
+++ b/tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp
@@ -0,0 +1,977 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qjsengine.h>
+
+class tst_QJSValue : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSValue();
+ virtual ~tst_QJSValue();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void boolConstructor();
+ void floatConstructor();
+ void numberConstructor();
+ void stringConstructor();
+ void nullConstructor();
+ void undefinedConstructor();
+ void boolConstructorWithEngine();
+ void floatConstructorWithEngine();
+ void intConstructorWithEngine();
+ void stringConstructorWithEngine();
+ void undefinedConstructorWithEngine();
+ void copyConstructor_data();
+ void copyConstructor();
+ void call_data();
+ void call();
+ void construct_data();
+ void construct();
+#if 0 // no data
+ void data();
+ void setData();
+ void data_noData_data();
+ void data_noData();
+#endif
+ void equalsSelf_data();
+ void equalsSelf();
+#if 0 // no less then
+ void lessThanSelf_data();
+ void lessThanSelf();
+#endif
+ void strictlyEqualsSelf_data();
+ void strictlyEqualsSelf();
+ void isArray_data();
+ void isArray();
+ void isBool_data();
+ void isBool();
+ void isDate_data();
+ void isDate();
+ void isError_data();
+ void isError();
+ void isCallable_data();
+ void isCallable();
+ void isNull_data();
+ void isNull();
+ void isNumber_data();
+ void isNumber();
+ void isObject_data();
+ void isObject();
+#if 0 // no qmetaobject
+ void isQMetaObject_data();
+ void isQMetaObject();
+#endif
+ void isQObject_data();
+ void isQObject();
+ void isRegExp_data();
+ void isRegExp();
+ void isString_data();
+ void isString();
+ void isUndefined_data();
+ void isUndefined();
+ void isVariant_data();
+ void isVariant();
+ void toBool_data();
+ void toBool();
+ void toDateTime_data();
+ void toDateTime();
+ void toInt_data();
+ void toInt();
+ void toNumber_data();
+ void toNumber();
+ void toRegExp_data();
+ void toRegExp();
+ void toString_data();
+ void toString();
+ void toUInt_data();
+ void toUInt();
+#if 0 // no qmetaobject
+ void toQMetaObject_data();
+ void toQMetaObject();
+#endif
+ void toQObject_data();
+ void toQObject();
+ void toVariant_data();
+ void toVariant();
+ void property_data();
+ void property();
+#if 0 // no string handle
+ void propertyById_data();
+ void propertyById();
+#endif
+ void propertyByIndex();
+ void setProperty_data();
+ void setProperty();
+#if 0 // no string handle
+ void setPropertyById_data();
+ void setPropertyById();
+#endif
+ void setPropertyByIndex();
+#if 0 // no propertyFlags for now
+ void propertyFlags_data();
+ void propertyFlags();
+ void propertyFlagsById_data();
+ void propertyFlagsById();
+#endif
+ void prototype_data();
+ void prototype();
+ void setPrototype();
+#if 0 // no script class
+ void scriptClass_data();
+ void scriptClass();
+ void setScriptClass();
+#endif
+#if 0 // no string handle
+ void readMetaProperty();
+ void writeMetaProperty();
+#endif
+
+private:
+ void defineStandardTestValues();
+ void newEngine()
+ {
+ delete m_engine;
+ m_engine = new QJSEngine;
+ }
+
+ QJSEngine *m_engine;
+};
+
+tst_QJSValue::tst_QJSValue()
+ : m_engine(0)
+{
+}
+
+tst_QJSValue::~tst_QJSValue()
+{
+ delete m_engine;
+}
+
+void tst_QJSValue::init()
+{
+}
+
+void tst_QJSValue::cleanup()
+{
+}
+
+void tst_QJSValue::boolConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(true);
+ }
+}
+
+void tst_QJSValue::floatConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(123.0);
+ }
+}
+
+void tst_QJSValue::numberConstructor()
+{
+ QBENCHMARK {
+ (void)QJSValue(123);
+ }
+}
+
+void tst_QJSValue::stringConstructor()
+{
+ QString str = QString::fromLatin1("ciao");
+ QBENCHMARK {
+ (void)QJSValue(str);
+ }
+}
+
+void tst_QJSValue::nullConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(QJSValue::NullValue);
+ }
+}
+
+void tst_QJSValue::undefinedConstructor()
+{
+ QBENCHMARK {
+ QJSValue val(QJSValue::UndefinedValue);
+ }
+}
+
+void tst_QJSValue::boolConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->toScriptValue(true);
+ }
+}
+
+void tst_QJSValue::floatConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->toScriptValue(123.0);
+ }
+}
+
+void tst_QJSValue::intConstructorWithEngine()
+{
+ newEngine();
+ QBENCHMARK {
+ m_engine->toScriptValue(123);
+ }
+}
+
+void tst_QJSValue::stringConstructorWithEngine()
+{
+ newEngine();
+ QString str = QString::fromLatin1("ciao");
+ QBENCHMARK {
+ m_engine->toScriptValue(str);
+ }
+}
+
+void tst_QJSValue::undefinedConstructorWithEngine()
+{
+ newEngine();
+ QVariant var;
+ QBENCHMARK {
+ m_engine->toScriptValue(var);
+ }
+}
+
+void tst_QJSValue::copyConstructor_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::copyConstructor()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ QJSValue copy(val);
+ }
+}
+
+void tst_QJSValue::call_data()
+{
+ newEngine();
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
+ QTest::newRow("function returning number") << QString::fromLatin1("(function(){ return 123; })");
+ QTest::newRow("closure") << QString::fromLatin1("(function(a, b){ return function() { return a + b; }; })(1, 2)");
+}
+
+void tst_QJSValue::call()
+{
+ QFETCH(QString, code);
+ QJSValue fun = m_engine->evaluate(code);
+ QVERIFY(fun.isCallable());
+ QBENCHMARK {
+ (void)fun.call();
+ }
+}
+
+void tst_QJSValue::construct_data()
+{
+ newEngine();
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
+ QTest::newRow("simple constructor") << QString::fromLatin1("(function(){ this.x = 10; this.y = 20; })");
+}
+
+void tst_QJSValue::construct()
+{
+ QFETCH(QString, code);
+ QJSValue fun = m_engine->evaluate(code);
+ QVERIFY(fun.isCallable());
+ QBENCHMARK {
+ (void)fun.callAsConstructor();
+ }
+}
+
+#if 0
+void tst_QJSValue::data()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ obj.setData(QJSValue(m_engine, 123));
+ QBENCHMARK {
+ obj.data();
+ }
+}
+
+void tst_QJSValue::setData()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSValue val(m_engine, 123);
+ QBENCHMARK {
+ obj.setData(val);
+ }
+}
+
+void tst_QJSValue::data_noData_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::data_noData()
+{
+ QFETCH(QJSValue, val);
+ QVERIFY(!val.data().isValid());
+ QBENCHMARK {
+ val.data();
+ }
+}
+#endif
+
+void tst_QJSValue::equalsSelf_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::equalsSelf()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.equals(val);
+ }
+}
+
+#if 0
+void tst_QJSValue::lessThanSelf_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::lessThanSelf()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.lessThan(val);
+ }
+}
+#endif
+
+void tst_QJSValue::strictlyEqualsSelf_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::strictlyEqualsSelf()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.strictlyEquals(val);
+ }
+}
+
+void tst_QJSValue::isArray_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isArray()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isArray();
+ }
+}
+
+void tst_QJSValue::isBool_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isBool()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isBool();
+ }
+}
+
+void tst_QJSValue::isDate_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isDate()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isDate();
+ }
+}
+
+void tst_QJSValue::isError_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isError()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isError();
+ }
+}
+
+void tst_QJSValue::isCallable_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isCallable()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isCallable();
+ }
+}
+
+void tst_QJSValue::isNull_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isNull()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isNull();
+ }
+}
+
+void tst_QJSValue::isNumber_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isNumber()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isNumber();
+ }
+}
+
+void tst_QJSValue::isObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isObject();
+ }
+}
+
+#if 0
+void tst_QJSValue::isQMetaObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isQMetaObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isQMetaObject();
+ }
+}
+#endif
+
+void tst_QJSValue::isQObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isQObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isQObject();
+ }
+}
+
+void tst_QJSValue::isRegExp_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isRegExp()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isRegExp();
+ }
+}
+
+void tst_QJSValue::isString_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isString()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isString();
+ }
+}
+
+void tst_QJSValue::isUndefined_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isUndefined()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isUndefined();
+ }
+}
+
+void tst_QJSValue::isVariant_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::isVariant()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.isVariant();
+ }
+}
+
+void tst_QJSValue::toBool_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toBool()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toBool();
+ }
+}
+
+void tst_QJSValue::toDateTime_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toDateTime()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toDateTime();
+ }
+}
+
+void tst_QJSValue::toInt_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toInt()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toInt();
+ }
+}
+
+void tst_QJSValue::toNumber_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toNumber()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toNumber();
+ }
+}
+
+void tst_QJSValue::toRegExp_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toRegExp()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ qjsvalue_cast<QRegExp>(val);
+ }
+}
+
+void tst_QJSValue::toString_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toString()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ (void)val.toString();
+ }
+}
+
+#if 0
+void tst_QJSValue::toQMetaObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toQMetaObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toQMetaObject();
+ }
+}
+#endif
+
+void tst_QJSValue::toQObject_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toQObject()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ (void)val.toQObject();
+ }
+}
+
+void tst_QJSValue::toUInt_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toUInt()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toUInt();
+ }
+}
+
+void tst_QJSValue::toVariant_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::toVariant()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.toVariant();
+ }
+}
+void tst_QJSValue::property_data()
+{
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<bool>("create");
+ QTest::newRow("foo") << QString::fromLatin1("foo") << true;
+ QTest::newRow("hasOwnProperty") << QString::fromLatin1("hasOwnProperty") << false; // From Object.prototype.
+ QTest::newRow("noSuchProperty") << QString::fromLatin1("noSuchProperty") << false;
+}
+
+void tst_QJSValue::property()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ if (create)
+ obj.setProperty(propertyName, 123);
+ QBENCHMARK {
+ (void)obj.property(propertyName);
+ }
+}
+
+#if 0
+void tst_QJSValue::propertyById_data()
+{
+ property_data();
+}
+
+void tst_QJSValue::propertyById()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSString id = m_engine->toStringHandle(propertyName);
+ if (create)
+ obj.setProperty(id, 123);
+ QBENCHMARK {
+ obj.property(id);
+ }
+}
+#endif
+
+void tst_QJSValue::propertyByIndex()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ obj.setProperty(123, 456);
+ QBENCHMARK {
+ obj.property(123);
+ }
+}
+
+void tst_QJSValue::setProperty_data()
+{
+ newEngine();
+ QTest::addColumn<QString>("propertyName");
+ QTest::addColumn<QJSValue>("val");
+ QTest::newRow("foo") << QString::fromLatin1("foo") << QJSValue(123);
+ QTest::newRow("bar") << QString::fromLatin1("bar") << m_engine->toScriptValue(123);
+ QTest::newRow("baz") << QString::fromLatin1("baz") << QJSValue();
+ QTest::newRow("toString") << QString::fromLatin1("toString") << m_engine->toScriptValue(true);
+}
+
+void tst_QJSValue::setProperty()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QJSValue, val);
+ QJSValue obj = m_engine->newObject();
+ QBENCHMARK {
+ obj.setProperty(propertyName, val);
+ }
+}
+
+#if 0
+void tst_QJSValue::setPropertyById_data()
+{
+ setProperty_data();
+}
+
+void tst_QJSValue::setPropertyById()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(QJSValue, val);
+ QJSValue obj = m_engine->newObject();
+ QJSString id = m_engine->toStringHandle(propertyName);
+ QBENCHMARK {
+ obj.setProperty(id, val);
+ }
+}
+#endif
+
+void tst_QJSValue::setPropertyByIndex()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSValue val(456);
+ QBENCHMARK {
+ obj.setProperty(123, 456);
+ }
+}
+
+#if 0
+void tst_QJSValue::propertyFlags_data()
+{
+ property_data();
+}
+
+void tst_QJSValue::propertyFlags()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ if (create)
+ obj.setProperty(propertyName, 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly);
+ QBENCHMARK {
+ (void)obj.propertyFlags(propertyName);
+ }
+}
+
+void tst_QJSValue::propertyFlagsById_data()
+{
+ propertyFlags_data();
+}
+
+void tst_QJSValue::propertyFlagsById()
+{
+ QFETCH(QString, propertyName);
+ QFETCH(bool, create);
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSString id = m_engine->toStringHandle(propertyName);
+ if (create)
+ obj.setProperty(id, 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly);
+ QBENCHMARK {
+ obj.propertyFlags(id);
+ }
+}
+#endif
+
+void tst_QJSValue::prototype_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::prototype()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.prototype();
+ }
+}
+
+void tst_QJSValue::setPrototype()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSValue proto = m_engine->newObject();
+ QBENCHMARK {
+ obj.setPrototype(proto);
+ }
+}
+
+#if 0
+void tst_QJSValue::scriptClass_data()
+{
+ defineStandardTestValues();
+}
+
+void tst_QJSValue::scriptClass()
+{
+ QFETCH(QJSValue, val);
+ QBENCHMARK {
+ val.scriptClass();
+ }
+}
+
+void tst_QJSValue::setScriptClass()
+{
+ newEngine();
+ QJSValue obj = m_engine->newObject();
+ QJSClass cls(m_engine);
+ QBENCHMARK {
+ obj.setScriptClass(&cls);
+ }
+}
+
+void tst_QJSValue::readMetaProperty()
+{
+ newEngine();
+ QJSValue object = m_engine->newQObject(QCoreApplication::instance());
+ QJSString propertyName = m_engine->toStringHandle("objectName");
+ QBENCHMARK {
+ for (int i = 0; i < 10000; ++i)
+ object.property(propertyName);
+ }
+}
+
+void tst_QJSValue::writeMetaProperty()
+{
+ newEngine();
+ QJSValue object = m_engine->newQObject(QCoreApplication::instance());
+ QJSString propertyName = m_engine->toStringHandle("objectName");
+ QJSValue value(m_engine, "foo");
+ QBENCHMARK {
+ for (int i = 0; i < 10000; ++i)
+ object.setProperty(propertyName, value);
+ }
+}
+#endif
+
+void tst_QJSValue::defineStandardTestValues()
+{
+ newEngine();
+ QTest::addColumn<QJSValue>("val");
+ QTest::newRow("bool") << m_engine->evaluate("true");
+ QTest::newRow("number") << m_engine->evaluate("123");
+ QTest::newRow("string") << m_engine->evaluate("'ciao'");
+ QTest::newRow("null") << m_engine->evaluate("null");
+ QTest::newRow("undefined") << m_engine->evaluate("undefined");
+ QTest::newRow("object") << m_engine->evaluate("({foo:123})");
+ QTest::newRow("array") << m_engine->evaluate("[10,20,30]");
+ QTest::newRow("function") << m_engine->evaluate("(function foo(a, b, c) { return a + b + c; })");
+ QTest::newRow("date") << m_engine->evaluate("new Date");
+ QTest::newRow("regexp") << m_engine->evaluate("new RegExp('foo')");
+ QTest::newRow("error") << m_engine->evaluate("new Error");
+
+ QTest::newRow("qobject") << m_engine->newQObject(this);
+#if 0 // no qmetaobject
+ QTest::newRow("qmetaobject") << m_engine->newQMetaObject(&QJSEngine::staticMetaObject);
+#endif
+ QTest::newRow("variant") << m_engine->toScriptValue(QPoint(10, 20));
+#if 0 // no classes
+ QTest::newRow("qscriptclassobject") << m_engine->newObject(new QJSClass(m_engine));
+#endif
+
+ QTest::newRow("invalid") << QJSValue();
+ QTest::newRow("bool-no-engine") << QJSValue(true);
+ QTest::newRow("number-no-engine") << QJSValue(123.0);
+ QTest::newRow("string-no-engine") << QJSValue(QString::fromLatin1("hello"));
+ QTest::newRow("null-no-engine") << QJSValue(QJSValue::NullValue);
+ QTest::newRow("undefined-no-engine") << QJSValue(QJSValue::UndefinedValue);
+}
+
+QTEST_MAIN(tst_QJSValue)
+#include "tst_qjsvalue.moc"
diff --git a/tests/benchmarks/qml/js/qjsvalueiterator/qjsvalueiterator.pro b/tests/benchmarks/qml/js/qjsvalueiterator/qjsvalueiterator.pro
new file mode 100644
index 0000000000..34ed9caa15
--- /dev/null
+++ b/tests/benchmarks/qml/js/qjsvalueiterator/qjsvalueiterator.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_bench_qjsvalueiterator
+
+SOURCES += tst_qjsvalueiterator.cpp
+
+QT = core qml testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/js/qjsvalueiterator/tst_qjsvalueiterator.cpp b/tests/benchmarks/qml/js/qjsvalueiterator/tst_qjsvalueiterator.cpp
new file mode 100644
index 0000000000..87a4cbe045
--- /dev/null
+++ b/tests/benchmarks/qml/js/qjsvalueiterator/tst_qjsvalueiterator.cpp
@@ -0,0 +1,309 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtQml/qjsengine.h>
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qjsvalueiterator.h>
+
+class tst_QJSValueIterator : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJSValueIterator();
+ virtual ~tst_QJSValueIterator();
+
+ void dataHelper();
+
+private slots:
+ void init();
+ void cleanup();
+
+ void hasNextAndNext();
+
+ void constructAndNext_data();
+ void constructAndNext();
+
+ void name_data();
+ void name();
+#if 0 // No string handle
+ void scriptName_data();
+ void scriptName();
+#endif
+
+ void value_data();
+ void value();
+#if 0 // no setValue
+ void setValue_data();
+ void setValue();
+#endif
+#if 0 // no flags
+ void flags();
+#endif
+
+#if 0 // no array index
+ void iterateArrayAndConvertNameToIndex();
+#endif
+#if 0 // no setValue
+ void iterateArrayAndDoubleElements();
+#endif
+#if 0 // no remove
+ void iterateArrayAndRemoveAllElements();
+#endif
+};
+
+tst_QJSValueIterator::tst_QJSValueIterator()
+{
+}
+
+tst_QJSValueIterator::~tst_QJSValueIterator()
+{
+}
+
+void tst_QJSValueIterator::init()
+{
+}
+
+void tst_QJSValueIterator::cleanup()
+{
+}
+
+void tst_QJSValueIterator::dataHelper()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("{ foo: 123 }") << QString::fromLatin1("({ foo: 123 })");
+ QTest::newRow("Math") << QString::fromLatin1("Math");
+ QTest::newRow("Array.prototype") << QString::fromLatin1("Array.prototype");
+ QTest::newRow("Global Object") << QString::fromLatin1("this");
+ QTest::newRow("['foo']") << QString::fromLatin1("['foo']");
+ QTest::newRow("array with 1000 elements")
+ << QString::fromLatin1("(function() {"
+ " var a = new Array;"
+ " for (i = 0; i < 1000; ++i)"
+ " a[i] = i;"
+ " return a;"
+ "})()");
+}
+
+void tst_QJSValueIterator::hasNextAndNext()
+{
+ QJSEngine engine;
+ QJSValue object = engine.newObject();
+ for (int i = 0; i < 2000; ++i)
+ object.setProperty(i, i);
+ QBENCHMARK {
+ for (int i = 0; i < 1000; ++i) {
+ QJSValueIterator it(object);
+ while (it.hasNext())
+ it.next();
+ }
+ }
+}
+
+void tst_QJSValueIterator::constructAndNext_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::constructAndNext()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QBENCHMARK {
+ for (int i = 0; i < 100; ++i) {
+ QJSValueIterator it(object);
+ it.next();
+ }
+ }
+}
+
+void tst_QJSValueIterator::name_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::name()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 200000; ++i)
+ it.name();
+ }
+}
+
+#if 0
+void tst_QJSValueIterator::scriptName_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::scriptName()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.scriptName();
+ }
+}
+#endif
+
+void tst_QJSValueIterator::value_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::value()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.value();
+ }
+}
+
+#if 0
+void tst_QJSValueIterator::setValue_data()
+{
+ dataHelper();
+}
+
+void tst_QJSValueIterator::setValue()
+{
+ QFETCH(QString, code);
+ QJSEngine engine;
+ QJSValue object = engine.evaluate(code);
+ Q_ASSERT(object.isObject());
+
+ QJSValueIterator it(object);
+ it.next();
+ QJSValue newValue(&engine, 456);
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.setValue(newValue);
+ }
+}
+
+void tst_QJSValueIterator::flags()
+{
+ QJSEngine engine;
+ QJSValue object = engine.newObject();
+ QJSValue::PropertyFlags flags = flags;
+ object.setProperty("foo", 123, QJSValue::SkipInEnumeration | QJSValue::ReadOnly | QJSValue::Undeletable);
+ QJSValueIterator it(object);
+ it.next();
+ QBENCHMARK {
+ for (int i = 0; i < 50000; ++i)
+ it.flags();
+ }
+}
+#endif
+
+#if 0
+void tst_QJSValueIterator::iterateArrayAndConvertNameToIndex()
+{
+ QJSEngine engine;
+ QJSValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QJSValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.scriptName().toArrayIndex();
+ }
+ }
+}
+
+void tst_QJSValueIterator::iterateArrayAndDoubleElements()
+{
+ QJSEngine engine;
+ QJSValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QJSValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.setValue(QJSValue(&engine, it.value().toNumber() * 2));
+ }
+ }
+}
+
+void tst_QJSValueIterator::iterateArrayAndRemoveAllElements()
+{
+ QJSEngine engine;
+ QJSValue array = engine.newArray();
+ for (int i = 0; i < 20000; ++i)
+ array.setProperty(i, i);
+ QBENCHMARK {
+ QJSValueIterator it(array);
+ while (it.hasNext()) {
+ it.next();
+ it.remove();
+ }
+ }
+}
+#endif
+
+QTEST_MAIN(tst_QJSValueIterator)
+#include "tst_qjsvalueiterator.moc"
diff --git a/tests/benchmarks/qml/painting/data/63x63.png b/tests/benchmarks/qml/painting/data/63x63.png
new file mode 100644
index 0000000000..d9efda8a7a
--- /dev/null
+++ b/tests/benchmarks/qml/painting/data/63x63.png
Binary files differ
diff --git a/tests/benchmarks/qml/painting/data/63x63_opaque.png b/tests/benchmarks/qml/painting/data/63x63_opaque.png
new file mode 100644
index 0000000000..d1429080db
--- /dev/null
+++ b/tests/benchmarks/qml/painting/data/63x63_opaque.png
Binary files differ
diff --git a/tests/benchmarks/qml/painting/data/64x64.png b/tests/benchmarks/qml/painting/data/64x64.png
new file mode 100644
index 0000000000..b149f33c3d
--- /dev/null
+++ b/tests/benchmarks/qml/painting/data/64x64.png
Binary files differ
diff --git a/tests/benchmarks/qml/painting/data/64x64_opaque.png b/tests/benchmarks/qml/painting/data/64x64_opaque.png
new file mode 100644
index 0000000000..94c07f3b3e
--- /dev/null
+++ b/tests/benchmarks/qml/painting/data/64x64_opaque.png
Binary files differ
diff --git a/tests/benchmarks/qml/painting/paintbenchmark.cpp b/tests/benchmarks/qml/painting/paintbenchmark.cpp
new file mode 100644
index 0000000000..b99161749d
--- /dev/null
+++ b/tests/benchmarks/qml/painting/paintbenchmark.cpp
@@ -0,0 +1,417 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QPixmap>
+#include <QImage>
+#include <QPainter>
+#include <QPainterPath>
+#include <QGLWidget>
+#include <QTextLayout>
+#include <QVBoxLayout>
+#include <QTime>
+#include <QDebug>
+#include <QStaticText>
+
+int iterations = 20;
+const int count = 600;
+const int lines = 12;
+const int spacing = 36;
+QSizeF size(1000, 800);
+const qreal lineWidth = 1000;
+QString strings[lines];
+QGLWidget *testWidget = 0;
+
+void paint_QTextLayout(QPainter &p, bool useCache)
+{
+ static bool first = true;
+ static QTextLayout *textLayout[lines];
+ if (first) {
+ for (int i = 0; i < lines; ++i) {
+ textLayout[i] = new QTextLayout(strings[i]);
+ int leading = p.fontMetrics().leading();
+ qreal height = 0;
+ qreal widthUsed = 0;
+ textLayout[i]->setCacheEnabled(useCache);
+ textLayout[i]->beginLayout();
+ while (1) {
+ QTextLine line = textLayout[i]->createLine();
+ if (!line.isValid())
+ break;
+
+ line.setLineWidth(lineWidth);
+ height += leading;
+ line.setPosition(QPointF(0, height));
+ height += line.height();
+ widthUsed = qMax(widthUsed, line.naturalTextWidth());
+ }
+ textLayout[i]->endLayout();
+ }
+ first = false;
+ }
+ for (int i = 0; i < count; ++i) {
+ for (int j = 0; j < lines; ++j) {
+ textLayout[j]->draw(&p, QPoint(0, j*spacing));
+ }
+ }
+}
+
+void paint_QTextLayout_noCache(QPainter &p)
+{
+ paint_QTextLayout(p, false);
+}
+
+void paint_QTextLayout_cache(QPainter &p)
+{
+ paint_QTextLayout(p, true);
+}
+
+void paint_QStaticText(QPainter &p, bool useOptimizations)
+{
+ static QStaticText *staticText[lines];
+ static bool first = true;
+ if (first) {
+ for (int i = 0; i < lines; ++i) {
+ staticText[i] = new QStaticText(strings[i]);
+ if (useOptimizations)
+ staticText[i]->setPerformanceHint(QStaticText::AggressiveCaching);
+ else
+ staticText[i]->setPerformanceHint(QStaticText::ModerateCaching);
+ }
+ first = false;
+ }
+ for (int i = 0; i < count; ++i) {
+ for (int j = 0; j < lines; ++j) {
+ p.drawStaticText(QPointF(0, 30 + j*spacing), *staticText[j]);
+ }
+ }
+}
+
+void paint_QStaticText_noOptimizations(QPainter &p)
+{
+ paint_QStaticText(p, false);
+}
+
+void paint_QStaticText_optimizations(QPainter &p)
+{
+ paint_QStaticText(p, true);
+}
+
+void paint_QPixmapCachedText(QPainter &p)
+{
+ static bool first = true;
+ static QPixmap cacheText[lines];
+ if (first) {
+ for (int i = 0; i < lines; ++i) {
+ QRectF trueSize;
+ trueSize = p.boundingRect(QRectF(QPointF(0,0), size), 0, strings[i]);
+ cacheText[i] = QPixmap(trueSize.size().toSize());
+ cacheText[i].fill(Qt::transparent);
+ QPainter paint(&cacheText[i]);
+ paint.setPen(Qt::black);
+ paint.drawText(QRectF(QPointF(0,0), trueSize.size().toSize()), strings[i]);
+ }
+ first = false;
+ }
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ p.drawPixmap(0,j*spacing,cacheText[j]);
+ }
+ }
+}
+
+void paint_RoundedRect(QPainter &p)
+{
+ static bool first = true;
+ if (first) {
+ if (testWidget) {
+ QGLFormat format = testWidget->format();
+ if (!format.sampleBuffers())
+ qWarning() << "Cannot paint antialiased rounded rect without sampleBuffers";
+ }
+ first = false;
+ }
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.setPen(Qt::black);
+ p.setBrush(Qt::red);
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ QSize size((j+1)*50, spacing-1);
+ p.drawRoundedRect(QRectF(QPointF(0,j*spacing), size), 8, 8);
+ }
+ }
+}
+
+void paint_QPixmapCachedRoundedRect(QPainter &p)
+{
+ static bool first = true;
+ static QPixmap cacheRect;
+ if (first) {
+ const int pw = 0;
+ const int radius = 8;
+ cacheRect = QPixmap(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2);
+ cacheRect.fill(Qt::transparent);
+ QPainter paint(&cacheRect);
+ paint.setRenderHint(QPainter::Antialiasing);
+ paint.setPen(Qt::black);
+ paint.setBrush(Qt::red);
+ if (pw%2)
+ paint.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, cacheRect.width()-(pw+1), cacheRect.height()-(pw+1)), radius, radius);
+ else
+ paint.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, cacheRect.width()-pw, cacheRect.height()-pw), radius, radius);
+
+ first = false;
+ }
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ QSize size((j+1)*50, spacing-1);
+
+ p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, true);
+
+ const int pw = 0;
+
+ int xOffset = (cacheRect.width()-1)/2;
+ int yOffset = (cacheRect.height()-1)/2;
+
+ QMargins margins(xOffset, yOffset, xOffset, yOffset);
+ QTileRules rules(Qt::StretchTile, Qt::StretchTile);
+ //NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects
+ qDrawBorderPixmap(&p, QRect(-pw/2, j*spacing-pw/2, size.width()+pw, size.height()+pw), margins, cacheRect, cacheRect.rect(), margins, rules);
+ }
+ }
+}
+
+void paint_pathCacheRoundedRect(QPainter &p)
+{
+ static bool first = true;
+ static QPainterPath path[lines];
+ if (first) {
+ for (int j = 0; j < lines; ++j) {
+ path[j].addRoundedRect(QRectF(0,0,(j+1)*50, spacing-1), 8, 8);
+ }
+ first = false;
+ }
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.setPen(Qt::black);
+ p.setBrush(Qt::red);
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ p.translate(0,j*spacing);
+ p.drawPath(path[j]);
+ p.translate(0,-j*spacing);
+ }
+ }
+}
+
+void paint_QPixmap63x63_opaque(QPainter &p)
+{
+ static bool first = true;
+ static QPixmap pm;
+ if (first) {
+ pm.load("data/63x63_opaque.png");
+ first = false;
+ }
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ p.drawPixmap((i%10) * 64,j*spacing, pm);
+ }
+ }
+}
+
+void paint_QPixmap64x64_opaque(QPainter &p)
+{
+ static bool first = true;
+ static QPixmap pm;
+ if (first) {
+ pm.load("data/64x64_opaque.png");
+ first = false;
+ }
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ p.drawPixmap((i%10) * 64,j*spacing, pm);
+ }
+ }
+}
+
+void paint_QPixmap63x63(QPainter &p)
+{
+ static bool first = true;
+ static QPixmap pm;
+ if (first) {
+ pm.load("data/63x63.png");
+ first = false;
+ }
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ p.drawPixmap((i%10) * 64,j*spacing, pm);
+ }
+ }
+}
+
+void paint_QPixmap64x64(QPainter &p)
+{
+ static bool first = true;
+ static QPixmap pm;
+ if (first) {
+ pm.load("data/64x64.png");
+ first = false;
+ }
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ p.drawPixmap((i%10) * 64,j*spacing, pm);
+ }
+ }
+}
+typedef void(*PaintFunc)(QPainter &);
+
+struct {
+ const char *name;
+ PaintFunc func;
+} funcs[] = {
+ { "QTextLayoutNoCache", &paint_QTextLayout_noCache },
+ { "QTextLayoutWithCache", &paint_QTextLayout_cache },
+ { "QStaticTextNoBackendOptimizations", &paint_QStaticText_noOptimizations },
+ { "QStaticTextWithBackendOptimizations", &paint_QStaticText_optimizations },
+ { "CachedText", &paint_QPixmapCachedText },
+ { "RoundedRect", &paint_RoundedRect },
+ { "CachedRoundedRect", &paint_QPixmapCachedRoundedRect },
+ { "PathCacheRoundedRect", &paint_pathCacheRoundedRect },
+ { "QPixmap63x63_opaque", &paint_QPixmap63x63_opaque },
+ { "QPixmap64x64_opaque", &paint_QPixmap64x64_opaque },
+ { "QPixmap63x63", &paint_QPixmap63x63 },
+ { "QPixmap64x64", &paint_QPixmap64x64 },
+ { 0, 0 }
+};
+
+PaintFunc testFunc = 0;
+
+class MyGLWidget : public QGLWidget
+{
+public:
+ MyGLWidget(const QGLFormat &format) : QGLWidget(format), frames(0) {
+ const char chars[] = "abcd efgh ijkl mnop qrst uvwx yz!$. ABCD 1234";
+ int len = strlen(chars);
+ for (int i = 0; i < lines; ++i) {
+ for (int j = 0; j < 60; j++) {
+ strings[i] += QChar(chars[rand() % len]);
+ }
+ }
+ }
+
+ void paintEvent(QPaintEvent *) {
+ static int last = 0;
+ static bool firstRun = true;
+ if (firstRun) {
+ timer.start();
+ firstRun = false;
+ } else {
+ int elapsed = timer.elapsed();
+ qDebug() << "frame elapsed:" << elapsed - last;
+ last = elapsed;
+ }
+ QPainter p(this);
+ p.fillRect(rect(), Qt::white);
+ p.setPen(Qt::black);
+ QTime drawTimer;
+ drawTimer.start();
+ testFunc(p);
+ qDebug() << "draw time" << drawTimer.elapsed();
+ if (iterations--)
+ update();
+ else
+ qApp->quit();
+ }
+
+ QTime timer;
+ int frames;
+};
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ bool sampleBuffers = false;
+
+ for (int i = 1; i < argc; ++i) {
+ QString arg = argv[i];
+ if (arg == "-test") {
+ arg = argv[++i];
+ int j = 0;
+ while (funcs[j].name) {
+ if (arg == funcs[j].name) {
+ testFunc = funcs[j].func;
+ qDebug() << "Running test" << arg;
+ break;
+ }
+ ++j;
+ }
+ } else if (arg == "-iterations") {
+ arg = argv[++i];
+ iterations = arg.toInt();
+ } else if (arg == "-sampleBuffers") {
+ sampleBuffers = true;
+ }
+ }
+
+ if (testFunc == 0) {
+ qDebug() << "Usage: textspeed -test <test> [-sampleBuffers] [-iterations n]";
+ qDebug() << "where <test> can be:";
+ int j = 0;
+ while (funcs[j].name) {
+ qDebug() << " " << funcs[j].name;
+ ++j;
+ }
+ exit(1);
+ }
+
+ QWidget w;
+ QGLFormat format = QGLFormat::defaultFormat();
+ format.setSampleBuffers(sampleBuffers);
+ testWidget = new MyGLWidget(format);
+ testWidget->setAutoFillBackground(false);
+ QVBoxLayout *layout = new QVBoxLayout(&w);
+ w.setLayout(layout);
+ layout->addWidget(testWidget);
+ w.showFullScreen();
+ app.exec();
+
+ return 0;
+}
diff --git a/tests/benchmarks/qml/painting/painting.pro b/tests/benchmarks/qml/painting/painting.pro
new file mode 100644
index 0000000000..bde891e12d
--- /dev/null
+++ b/tests/benchmarks/qml/painting/painting.pro
@@ -0,0 +1,8 @@
+requires(qtHaveModule(opengl))
+
+QT += opengl
+CONFIG += console
+macx:CONFIG -= app_bundle
+
+SOURCES += paintbenchmark.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/pointers/pointers.pro b/tests/benchmarks/qml/pointers/pointers.pro
new file mode 100644
index 0000000000..1db474428d
--- /dev/null
+++ b/tests/benchmarks/qml/pointers/pointers.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+QT += qml testlib
+TEMPLATE = app
+TARGET = tst_pointers
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_pointers.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/pointers/tst_pointers.cpp b/tests/benchmarks/qml/pointers/tst_pointers.cpp
new file mode 100644
index 0000000000..65dda28fe7
--- /dev/null
+++ b/tests/benchmarks/qml/pointers/tst_pointers.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include "private/qqmlguard_p.h"
+#include <QWeakPointer>
+
+class tst_pointers : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_pointers() {}
+
+private slots:
+ void qmlguard();
+ void weakPointer();
+};
+
+void tst_pointers::qmlguard()
+{
+ QObject *obj = new QObject;
+ QBENCHMARK {
+ QQmlGuard<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/qml/qml.pro b/tests/benchmarks/qml/qml.pro
new file mode 100644
index 0000000000..c50f57b655
--- /dev/null
+++ b/tests/benchmarks/qml/qml.pro
@@ -0,0 +1,19 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ binding \
+ creation \
+ javascript \
+ holistic \
+ pointers \
+ qqmlcomponent \
+ qqmlimage \
+ qqmlmetaproperty \
+ script \
+ qmltime \
+ js \
+ qquickwindow
+
+qtHaveModule(opengl): SUBDIRS += painting
+
+include(../trusted-benchmarks.pri)
diff --git a/tests/benchmarks/qml/qmltime/example.qml b/tests/benchmarks/qml/qmltime/example.qml
new file mode 100644
index 0000000000..02ceeec072
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/example.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ property string name: "Bob Smith"
+
+ QmlTime.Timer {
+ component: Item {
+ Text { text: name }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/linelaidout.qml b/tests/benchmarks/qml/qmltime/linelaidout.qml
new file mode 100644
index 0000000000..f0aca7a20a
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/linelaidout.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Text {
+ width: 480
+ height: width
+ text: "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42"
+ color: "blue"
+ font.pixelSize: 15
+ font.bold: true
+
+ onLineLaidOut: {
+ line.x = (line.number % 7) * 70
+ line.y = Math.floor(line.number / 7.0) * 70
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/qmltime/qmltime.cpp b/tests/benchmarks/qml/qmltime/qmltime.cpp
new file mode 100644
index 0000000000..bae0b51824
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/qmltime.cpp
@@ -0,0 +1,283 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QDebug>
+#include <QApplication>
+#include <QTime>
+#include <QQmlContext>
+#include <QGraphicsScene>
+#include <QGraphicsRectItem>
+
+class Timer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlComponent *component READ component WRITE setComponent)
+
+public:
+ Timer();
+
+ QQmlComponent *component() const;
+ void setComponent(QQmlComponent *);
+
+ static Timer *timerInstance();
+
+ void run(uint);
+
+ bool willParent() const;
+ void setWillParent(bool p);
+
+private:
+ void runTest(QQmlContext *, uint);
+
+ QQmlComponent *m_component;
+ static Timer *m_timer;
+
+ bool m_willparent;
+ QGraphicsScene m_scene;
+ QGraphicsRectItem m_item;
+};
+QML_DECLARE_TYPE(Timer);
+
+Timer *Timer::m_timer = 0;
+
+Timer::Timer()
+: m_component(0), m_willparent(false)
+{
+ if (m_timer)
+ qWarning("Timer: Timer already registered");
+ m_timer = this;
+
+ m_scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+ m_scene.addItem(&m_item);
+}
+
+QQmlComponent *Timer::component() const
+{
+ return m_component;
+}
+
+void Timer::setComponent(QQmlComponent *c)
+{
+ m_component = c;
+}
+
+Timer *Timer::timerInstance()
+{
+ return m_timer;
+}
+
+void Timer::run(uint iterations)
+{
+ QQmlContext context(qmlContext(this));
+
+ QObject *o = m_component->create(&context);
+ QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o);
+ if (m_willparent && go)
+ go->setParentItem(&m_item);
+ delete o;
+
+ runTest(&context, iterations);
+}
+
+bool Timer::willParent() const
+{
+ return m_willparent;
+}
+
+void Timer::setWillParent(bool p)
+{
+ m_willparent = p;
+}
+
+void Timer::runTest(QQmlContext *context, uint iterations)
+{
+ QTime t;
+ t.start();
+ for (uint ii = 0; ii < iterations; ++ii) {
+ QObject *o = m_component->create(context);
+ QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o);
+ if (m_willparent && go)
+ go->setParentItem(&m_item);
+ delete o;
+ }
+
+ int e = t.elapsed();
+
+ qWarning() << "Total:" << e << "ms, Per iteration:" << qreal(e) / qreal(iterations) << "ms";
+
+}
+
+void usage(const char *name)
+{
+ qWarning("Usage: %s [-iterations <count>] [-parent] <qml file>\n", name);
+
+ qWarning("qmltime is a tool for benchmarking the runtime cost of instantiating\n"
+ "a QML component. It is typically run as follows:\n"
+ "\n"
+ "%s path/to/benchmark.qml\n"
+ "\n"
+ "If the -parent option is specified, the component being measured will also\n"
+ "be parented to an item already in the scene.\n"
+ "\n"
+ "If the -iterations option is specified, the benchmark will run the specified\n"
+ "number of iterations. If -iterations is not specified, 1024 iterations\n"
+ "are performed.\n"
+ "\n"
+ "qmltime expects the file to be benchmarked to contain a certain structure.\n"
+ "Specifically, it requires the presence of a QmlTime.Timer element. For example,\n"
+ "say we wanted to benchmark the following list delegate:\n"
+ "\n"
+ "Rectangle {\n"
+ " color: \"green\"\n"
+ " width: 400; height: 100\n"
+ " Text {\n"
+ " anchors.centerIn: parent\n"
+ " text: name\n"
+ " }\n"
+ "}\n"
+ "\n"
+ "we would create a benchmark file that looks like this:\n"
+ "\n"
+ "import QtQuick 2.0\n"
+ "import QmlTime 1.0 as QmlTime\n"
+ "\n"
+ "Item {\n"
+ "\n"
+ " property string name: \"Bob Smith\"\n"
+ "\n"
+ " QmlTime.Timer {\n"
+ " component: Rectangle {\n"
+ " color: \"green\"\n"
+ " width: 400; height: 100\n"
+ " Text {\n"
+ " anchors.centerIn: parent\n"
+ " text: name\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ "}\n"
+ "\n"
+ "The outer Item functions as a dummy data provider for any additional\n"
+ "data required by the bindings in the component being benchmarked (in the\n"
+ "example above we provide a \"name\" property).\n"
+ "\n"
+ "When started, the component is instantiated once before running\n"
+ "the benchmark, which means that the reported time does not include\n"
+ "compile time (as the results of compilation are cached internally).\n"
+ "In this sense the times reported by qmltime best correspond to the\n"
+ "costs associated with delegate creation in the view classes, where the\n"
+ "same delegate is instantiated over and over. Conversely, it is not a\n"
+ "good approximation for e.g. Loader, which typically only instantiates\n"
+ "an element once (and so for Loader the compile time is very relevant\n"
+ "to the overall cost).", name);
+
+ exit(-1);
+}
+
+int main(int argc, char ** argv)
+{
+ QApplication app(argc, argv);
+
+ qmlRegisterType<Timer>("QmlTime", 1, 0, "Timer");
+
+ uint iterations = 1024;
+ QString filename;
+ bool willParent = false;
+
+ for (int ii = 1; ii < argc; ++ii) {
+ QByteArray arg(argv[ii]);
+
+ if (arg == "-iterations") {
+ if (ii + 1 < argc) {
+ ++ii;
+ QByteArray its(argv[ii]);
+ bool ok = false;
+ iterations = its.toUInt(&ok);
+ if (!ok)
+ usage(argv[0]);
+ } else {
+ usage(argv[0]);
+ }
+ } else if (arg == "-parent") {
+ willParent = true;
+ } else if (arg == "-help") {
+ usage(argv[0]);
+ } else {
+ filename = QLatin1String(argv[ii]);
+ }
+ }
+
+ if (filename.isEmpty())
+ usage(argv[0]);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine, filename);
+ if (component.isError()) {
+ qWarning() << component.errors();
+ return -1;
+ }
+
+ QObject *obj = component.create();
+ if (!obj) {
+ qWarning() << component.errors();
+ return -1;
+ }
+
+ Timer *timer = Timer::timerInstance();
+ if (!timer) {
+ qWarning() << "A Tester.Timer instance is required.";
+ return -1;
+ }
+
+ timer->setWillParent(willParent);
+
+ if (!timer->component()) {
+ qWarning() << "The timer has no component";
+ return -1;
+ }
+
+ timer->run(iterations);
+
+ return 0;
+}
+
+#include "qmltime.moc"
diff --git a/tests/benchmarks/qml/qmltime/qmltime.pro b/tests/benchmarks/qml/qmltime/qmltime.pro
new file mode 100644
index 0000000000..c151b8d10f
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/qmltime.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = qmltime
+QT += qml widgets testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += qmltime.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/qmltime/tests/anchors/empty.qml b/tests/benchmarks/qml/qmltime/tests/anchors/empty.qml
new file mode 100644
index 0000000000..80a7c37176
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/anchors/empty.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.leftMargin: 0
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/tests/anchors/fill.qml b/tests/benchmarks/qml/qmltime/tests/anchors/fill.qml
new file mode 100644
index 0000000000..bd9f837f28
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/anchors/fill.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ Item {
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/tests/anchors/null.qml b/tests/benchmarks/qml/qmltime/tests/anchors/null.qml
new file mode 100644
index 0000000000..c307c7ad17
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/anchors/null.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ Item {
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/tests/animation/large.qml b/tests/benchmarks/qml/qmltime/tests/animation/large.qml
new file mode 100644
index 0000000000..673b1eb5d3
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/animation/large.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ ParallelAnimation {
+ NumberAnimation { duration: 500 }
+ NumberAnimation { duration: 4000; }
+ NumberAnimation { duration: 2000; easing.type: "OutBack"}
+ ColorAnimation { duration: 3000}
+ SequentialAnimation {
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: doSomething(); }
+ PauseAnimation { duration: 800 }
+ ScriptAction { script: doSomethingElse(); }
+ PauseAnimation { duration: 800 }
+ ParallelAnimation {
+ NumberAnimation { duration: 200;}
+ SequentialAnimation {
+ PauseAnimation { duration: 200}
+ ParallelAnimation {
+ NumberAnimation { duration: 300;}
+ NumberAnimation { duration: 300;}
+ }
+ NumberAnimation { from: 0; to: 1; duration: 500 }
+ PauseAnimation { duration: 200 }
+ NumberAnimation { from: 1; to: 0; duration: 500 }
+ }
+ SequentialAnimation {
+ PauseAnimation { duration: 150}
+ NumberAnimation { duration: 300; easing.type: "OutBounce" }
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/animation/largeNoProps.qml b/tests/benchmarks/qml/qmltime/tests/animation/largeNoProps.qml
new file mode 100644
index 0000000000..e026995527
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/animation/largeNoProps.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ ParallelAnimation {
+ NumberAnimation { }
+ NumberAnimation { }
+ NumberAnimation { }
+ ColorAnimation { }
+ SequentialAnimation {
+ PauseAnimation { }
+ ScriptAction { }
+ PauseAnimation { }
+ ScriptAction { }
+ PauseAnimation { }
+ ParallelAnimation {
+ NumberAnimation { }
+ SequentialAnimation {
+ PauseAnimation { }
+ ParallelAnimation {
+ NumberAnimation { }
+ NumberAnimation { }
+ }
+ NumberAnimation { }
+ PauseAnimation { }
+ NumberAnimation { }
+ }
+ SequentialAnimation {
+ PauseAnimation { }
+ NumberAnimation { }
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/item_creation/children.qml b/tests/benchmarks/qml/qmltime/tests/item_creation/children.qml
new file mode 100644
index 0000000000..2a29c13979
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/item_creation/children.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ children: [
+ Rectangle { },
+ Rectangle { },
+ Item { },
+ Image { },
+ Text { },
+ Item { },
+ Item { },
+ Image { },
+ Image { },
+ Row { },
+ Image { },
+ Image { },
+ Column { },
+ Row { },
+ Text { },
+ Text { },
+ Text { },
+ MouseArea { }
+ ]
+
+ }
+ }
+ }
+
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/item_creation/data.qml b/tests/benchmarks/qml/qmltime/tests/item_creation/data.qml
new file mode 100644
index 0000000000..c2d554bfcd
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/item_creation/data.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ data: [
+ Rectangle { },
+ Rectangle { },
+ Item { },
+ Image { },
+ Text { },
+ Item { },
+ Item { },
+ Image { },
+ Image { },
+ Row { },
+ Image { },
+ Image { },
+ Column { },
+ Row { },
+ Text { },
+ Text { },
+ Text { },
+ MouseArea { }
+ ]
+
+ }
+ }
+ }
+
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/item_creation/no_creation.qml b/tests/benchmarks/qml/qmltime/tests/item_creation/no_creation.qml
new file mode 100644
index 0000000000..cbe5025b00
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/item_creation/no_creation.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/item_creation/resources.qml b/tests/benchmarks/qml/qmltime/tests/item_creation/resources.qml
new file mode 100644
index 0000000000..adfb0cfca3
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/item_creation/resources.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ resources: [
+ Rectangle { },
+ Rectangle { },
+ Item { },
+ Image { },
+ Text { },
+ Item { },
+ Item { },
+ Image { },
+ Image { },
+ Row { },
+ Image { },
+ Image { },
+ Column { },
+ Row { },
+ Text { },
+ Text { },
+ Text { },
+ MouseArea { }
+ ]
+
+ }
+ }
+ }
+
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/loader/Loaded.qml b/tests/benchmarks/qml/qmltime/tests/loader/Loaded.qml
new file mode 100644
index 0000000000..e4a814d743
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/loader/Loaded.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ Rectangle {}
+ Text {}
+ Image {}
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/loader/component_loader.qml b/tests/benchmarks/qml/qmltime/tests/loader/component_loader.qml
new file mode 100644
index 0000000000..d7258d064f
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/loader/component_loader.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Loader {
+ sourceComponent: Loaded {}
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/tests/loader/empty_loader.qml b/tests/benchmarks/qml/qmltime/tests/loader/empty_loader.qml
new file mode 100644
index 0000000000..696e5f484b
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/loader/empty_loader.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Loader {}
+ Loaded {}
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/tests/loader/no_loader.qml b/tests/benchmarks/qml/qmltime/tests/loader/no_loader.qml
new file mode 100644
index 0000000000..a0da2404f1
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/loader/no_loader.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Loaded {}
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/tests/loader/source_loader.qml b/tests/benchmarks/qml/qmltime/tests/loader/source_loader.qml
new file mode 100644
index 0000000000..eeb03bd452
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/loader/source_loader.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Loader {
+ source: "Loaded.qml"
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qmltime/tests/positioner_creation/no_positioner.qml b/tests/benchmarks/qml/qmltime/tests/positioner_creation/no_positioner.qml
new file mode 100644
index 0000000000..243955339d
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/positioner_creation/no_positioner.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Rectangle { }
+ Rectangle { }
+ Item {
+ Image { }
+ Text { }
+ }
+
+ Item {
+ Item {
+ Image { }
+ Image { }
+ Item {
+ Image { }
+ Image { }
+ }
+ }
+
+ Item {
+ Item {
+ Text { }
+ Text { }
+ }
+ Text { }
+ }
+ }
+ MouseArea { }
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/positioner_creation/null_positioner.qml b/tests/benchmarks/qml/qmltime/tests/positioner_creation/null_positioner.qml
new file mode 100644
index 0000000000..0d4c8e089e
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/positioner_creation/null_positioner.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Rectangle { }
+ Rectangle { }
+ Item {
+ Image { }
+ Text { }
+ }
+
+ Item {
+ Item {
+ Image { }
+ Image { }
+ Row { }
+ Image { }
+ Image { }
+ }
+
+ Column { }
+ Row { }
+ Text { }
+ Text { }
+ Text { }
+ }
+ MouseArea { }
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/positioner_creation/positioner.qml b/tests/benchmarks/qml/qmltime/tests/positioner_creation/positioner.qml
new file mode 100644
index 0000000000..607a658a77
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/positioner_creation/positioner.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+ QmlTime.Timer {
+ component: Component {
+ Item {
+ Rectangle { }
+ Rectangle { }
+ Item {
+ Image { }
+ Text { }
+ }
+
+ Item {
+ Item {
+ Image { }
+ Image { }
+ Row {
+ Image { }
+ Image { }
+ }
+ }
+
+ Column {
+ Row {
+ Text { }
+ Text { }
+ }
+ Text { }
+ }
+ }
+ MouseArea { }
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/vmemetaobject/null.qml b/tests/benchmarks/qml/qmltime/tests/vmemetaobject/null.qml
new file mode 100644
index 0000000000..61ad3f6873
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/vmemetaobject/null.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ QtObject {
+ }
+ }
+ }
+
+}
diff --git a/tests/benchmarks/qml/qmltime/tests/vmemetaobject/property.qml b/tests/benchmarks/qml/qmltime/tests/vmemetaobject/property.qml
new file mode 100644
index 0000000000..7e54a2c573
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/tests/vmemetaobject/property.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Component {
+ QtObject {
+ property string s
+ property string s2
+ property string s3
+ property string s4
+ }
+ }
+ }
+
+}
+
diff --git a/tests/benchmarks/qml/qmltime/textingrid.qml b/tests/benchmarks/qml/qmltime/textingrid.qml
new file mode 100644
index 0000000000..f4dde2c7ea
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/textingrid.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Grid {
+ width: 480
+ height: width
+
+ id: grid
+ columns: 7
+ rows: 6
+
+ Repeater {
+ model: 42
+ Text {
+ width: grid.width / grid.columns; height: width
+ color: "blue"
+ text: index
+ font.pixelSize: 15
+ font.bold: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ }
+ }
+
+ }
+ }
+}
+
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/myqmlobject.qml b/tests/benchmarks/qml/qqmlcomponent/data/myqmlobject.qml
new file mode 100644
index 0000000000..79e87d4fcf
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/myqmlobject.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 4.6
+
+MyQmlObject {}
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/myqmlobject_binding.qml b/tests/benchmarks/qml/qqmlcomponent/data/myqmlobject_binding.qml
new file mode 100644
index 0000000000..87444354a9
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/myqmlobject_binding.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 4.6
+
+MyQmlObject {
+ result: value
+}
+
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/object.qml b/tests/benchmarks/qml/qqmlcomponent/data/object.qml
new file mode 100644
index 0000000000..01523fcc5b
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/object.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {}
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/object_id.qml b/tests/benchmarks/qml/qqmlcomponent/data/object_id.qml
new file mode 100644
index 0000000000..a85d417da9
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/object_id.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ id: blah
+}
+
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/qml/qqmlcomponent/data/samegame/BoomBlock.qml
new file mode 100644
index 0000000000..0982f943cd
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/samegame/BoomBlock.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: block
+ property bool dying: false
+ property bool spawned: false
+ property int type: 0
+ property ParticleSystem particleSystem
+
+ Behavior on x {
+ enabled: spawned;
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ Behavior on y {
+ SpringAnimation{ 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
+ Behavior on opacity { NumberAnimation { duration: 200 } }
+ anchors.fill: parent
+ }
+ Emitter {
+ id: particles
+ system: particleSystem
+ group: {
+ if(type == 0){
+ "red";
+ } else if (type == 1) {
+ "blue";
+ } else {
+ "green";
+ }
+ }
+ anchors.fill: parent
+
+ velocity: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60}
+ shape: EllipseShape{fill:true}
+ enabled: false;
+ lifeSpan: 700; lifeSpanVariation: 100
+ emitRate: 1000
+ maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number)
+ size: 28
+ endSize: 14
+ }
+
+ states: [
+ State {
+ name: "AliveState"; when: spawned == true && dying == false
+ PropertyChanges { target: img; opacity: 1 }
+ },
+
+ State {
+ name: "DeathState"; when: dying == true
+ StateChangeScript { script: particles.pulse(0.1); }
+ PropertyChanges { target: img; opacity: 0 }
+ StateChangeScript { script: block.destroy(1000); }
+ }
+ ]
+}
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/blueStone.png b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/blueStone.png
new file mode 100644
index 0000000000..20e43c75b6
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/blueStone.png
Binary files differ
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/greenStone.png b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/greenStone.png
new file mode 100644
index 0000000000..b568a1900c
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/greenStone.png
Binary files differ
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/redStone.png b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/redStone.png
new file mode 100644
index 0000000000..36b09a2686
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/redStone.png
Binary files differ
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/yellowStone.png b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/yellowStone.png
new file mode 100644
index 0000000000..b1ce76212c
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/samegame/pics/yellowStone.png
Binary files differ
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.2.qml b/tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.2.qml
new file mode 100644
index 0000000000..da345e82a9
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.2.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ 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 variant i
+ property variant j
+}
+
diff --git a/tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.qml b/tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.qml
new file mode 100644
index 0000000000..0dfe651573
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/data/synthesized_properties.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ property int a
+}
diff --git a/tests/benchmarks/qml/qqmlcomponent/qqmlcomponent.pro b/tests/benchmarks/qml/qqmlcomponent/qqmlcomponent.pro
new file mode 100644
index 0000000000..12a53f5e20
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/qqmlcomponent.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_qqmlcomponent
+QT += qml testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlcomponent.cpp testtypes.cpp
+HEADERS += testtypes.h
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/qqmlcomponent/testtypes.cpp b/tests/benchmarks/qml/qqmlcomponent/testtypes.cpp
new file mode 100644
index 0000000000..8d3badab46
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/testtypes.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "testtypes.h"
+
+void registerTypes()
+{
+ qmlRegisterType<MyQmlObject>("Qt.test", 4, 6, "MyQmlObject");
+}
diff --git a/tests/benchmarks/qml/qqmlcomponent/testtypes.h b/tests/benchmarks/qml/qqmlcomponent/testtypes.h
new file mode 100644
index 0000000000..f692ed03ff
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/testtypes.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QtQml/qqml.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(QQmlListProperty<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(); }
+
+ QQmlListProperty<QObject> data() { return QQmlListProperty<QObject>(this, m_data); }
+
+ MyQmlObject *object() const { return m_object; }
+ void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); }
+
+signals:
+ void valueChanged();
+ void objectChanged();
+
+private:
+ QList<QObject *> m_data;
+ int m_result;
+ int m_value;
+ MyQmlObject *m_object;
+};
+QML_DECLARE_TYPE(MyQmlObject);
+
+void registerTypes();
+
+#endif // TESTTYPES_H
diff --git a/tests/benchmarks/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/benchmarks/qml/qqmlcomponent/tst_qqmlcomponent.cpp
new file mode 100644
index 0000000000..13b6168d73
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QFile>
+#include <QDebug>
+#include "testtypes.h"
+
+class tst_qmlcomponent : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_qmlcomponent();
+ virtual ~tst_qmlcomponent();
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+private slots:
+ void creation_data();
+ void creation();
+
+private:
+ QQmlEngine engine;
+};
+
+tst_qmlcomponent::tst_qmlcomponent()
+{
+}
+
+tst_qmlcomponent::~tst_qmlcomponent()
+{
+}
+
+void tst_qmlcomponent::initTestCase()
+{
+ registerTypes();
+}
+
+void tst_qmlcomponent::cleanupTestCase()
+{
+}
+
+void tst_qmlcomponent::creation_data()
+{
+ QTest::addColumn<QString>("file");
+
+ QTest::newRow("Object") << SRCDIR "/data/object.qml";
+ QTest::newRow("Object - Id") << SRCDIR "/data/object_id.qml";
+ QTest::newRow("MyQmlObject") << SRCDIR "/data/myqmlobject.qml";
+ QTest::newRow("MyQmlObject: basic binding") << SRCDIR "/data/myqmlobject_binding.qml";
+ QTest::newRow("Synthesized properties") << SRCDIR "/data/synthesized_properties.qml";
+ QTest::newRow("Synthesized properties.2") << SRCDIR "/data/synthesized_properties.2.qml";
+ QTest::newRow("SameGame - BoomBlock") << SRCDIR "/data/samegame/BoomBlock.qml";
+}
+
+void tst_qmlcomponent::creation()
+{
+ QFETCH(QString, file);
+
+ QQmlComponent 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_qqmlcomponent.moc"
diff --git a/tests/benchmarks/qml/qqmldebugtrace/qqmldebugtrace.pro b/tests/benchmarks/qml/qqmldebugtrace/qqmldebugtrace.pro
new file mode 100644
index 0000000000..4cf6bbe4bc
--- /dev/null
+++ b/tests/benchmarks/qml/qqmldebugtrace/qqmldebugtrace.pro
@@ -0,0 +1,9 @@
+CONFIG += testcase
+QT += qml testlib
+TEMPLATE = app
+TARGET = tst_qqmldebugtrace
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmldebugtrace.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/qqmldebugtrace/tst_qqmldebugtrace.cpp b/tests/benchmarks/qml/qqmldebugtrace/tst_qqmldebugtrace.cpp
new file mode 100644
index 0000000000..6a8e766f2e
--- /dev/null
+++ b/tests/benchmarks/qml/qqmldebugtrace/tst_qqmldebugtrace.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QElapsedTimer>
+#include <QObject>
+#include <qtest.h>
+
+class tst_qqmldebugtrace : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_qqmldebugtrace() {}
+
+private slots:
+ void all();
+ void startElapsed();
+ void doubleElapsed();
+ void trace();
+};
+
+void tst_qqmldebugtrace::all()
+{
+ QBENCHMARK {
+ QElapsedTimer t;
+ t.start();
+ t.nsecsElapsed();
+ }
+}
+
+void tst_qqmldebugtrace::startElapsed()
+{
+ QElapsedTimer t;
+ QBENCHMARK {
+ t.start();
+ t.nsecsElapsed();
+ }
+}
+
+void tst_qqmldebugtrace::doubleElapsed()
+{
+ QElapsedTimer t;
+ t.start();
+ QBENCHMARK {
+ t.nsecsElapsed();
+ t.nsecsElapsed();
+ }
+}
+
+void tst_qqmldebugtrace::trace()
+{
+ QString s("A decent sized string of text here.");
+ QBENCHMARK {
+ QByteArray data;
+ QDataStream ds(&data, QIODevice::WriteOnly);
+ ds << (qint64)100 << (int)5 << (int)5 << s;
+ }
+}
+
+QTEST_MAIN(tst_qqmldebugtrace)
+
+#include "tst_qqmldebugtrace.moc"
diff --git a/tests/benchmarks/qml/qqmlimage/image.png b/tests/benchmarks/qml/qqmlimage/image.png
new file mode 100644
index 0000000000..623d36233d
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlimage/image.png
Binary files differ
diff --git a/tests/benchmarks/qml/qqmlimage/qqmlimage.pro b/tests/benchmarks/qml/qqmlimage/qqmlimage.pro
new file mode 100644
index 0000000000..6a94052898
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlimage/qqmlimage.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_qqmlimage
+QT += qml quick-private testlib
+macx:CONFIG -= app_bundle
+CONFIG += release
+
+SOURCES += tst_qqmlimage.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp b/tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp
new file mode 100644
index 0000000000..b953bbf703
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <private/qquickimage_p.h>
+
+class tst_qmlgraphicsimage : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlgraphicsimage() {}
+
+private slots:
+ void qmlgraphicsimage();
+ void qmlgraphicsimage_file();
+ void qmlgraphicsimage_url();
+
+private:
+ QQmlEngine engine;
+};
+
+void tst_qmlgraphicsimage::qmlgraphicsimage()
+{
+ int x = 0;
+ QUrl url(SRCDIR "/image.png");
+ QBENCHMARK {
+ QUrl url2("http://localhost/image" + QString::number(x++) + ".png");
+ QQuickImage *image = new QQuickImage;
+ QQmlEngine::setContextForObject(image, engine.rootContext());
+ delete image;
+ }
+}
+
+void tst_qmlgraphicsimage::qmlgraphicsimage_file()
+{
+ int x = 0;
+ QUrl url(SRCDIR "/image.png");
+ //get rid of initialization effects
+ {
+ QQuickImage *image = new QQuickImage;
+ QQmlEngine::setContextForObject(image, engine.rootContext());
+ image->setSource(url);
+ }
+ QBENCHMARK {
+ QUrl url2("http://localhost/image" + QString::number(x++) + ".png");
+ QQuickImage *image = new QQuickImage;
+ QQmlEngine::setContextForObject(image, engine.rootContext());
+ image->setSource(url);
+ delete image;
+ }
+}
+
+void tst_qmlgraphicsimage::qmlgraphicsimage_url()
+{
+ int x = 0;
+ QUrl url(SRCDIR "/image.png");
+ QBENCHMARK {
+ QUrl url2("http://localhost/image" + QString::number(x++) + ".png");
+ QQuickImage *image = new QQuickImage;
+ QQmlEngine::setContextForObject(image, engine.rootContext());
+ image->setSource(url2);
+ delete image;
+ }
+}
+
+QTEST_MAIN(tst_qmlgraphicsimage)
+
+#include "tst_qqmlimage.moc"
diff --git a/tests/benchmarks/qml/qqmlmetaproperty/data/object.qml b/tests/benchmarks/qml/qqmlmetaproperty/data/object.qml
new file mode 100644
index 0000000000..26931a7450
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlmetaproperty/data/object.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {}
diff --git a/tests/benchmarks/qml/qqmlmetaproperty/data/synthesized_object.qml b/tests/benchmarks/qml/qqmlmetaproperty/data/synthesized_object.qml
new file mode 100644
index 0000000000..9b73d316cf
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlmetaproperty/data/synthesized_object.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property int blah
+}
+
diff --git a/tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro b/tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro
new file mode 100644
index 0000000000..e71f16aecb
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlmetaproperty/qqmlmetaproperty.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_qqmlmetaproperty
+QT += qml testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmlmetaproperty.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/qqmlmetaproperty/tst_qqmlmetaproperty.cpp b/tests/benchmarks/qml/qqmlmetaproperty/tst_qqmlmetaproperty.cpp
new file mode 100644
index 0000000000..9ad8671ef0
--- /dev/null
+++ b/tests/benchmarks/qml/qqmlmetaproperty/tst_qqmlmetaproperty.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QQmlProperty>
+#include <QFile>
+#include <QDebug>
+
+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:
+ QQmlEngine 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") << SRCDIR "/data/object.qml";
+ QTest::newRow("Synthesized Object") << SRCDIR "/data/synthesized_object.qml";
+}
+
+void tst_qmlmetaproperty::lookup()
+{
+ QFETCH(QString, file);
+
+ QQmlComponent c(&engine, file);
+ QVERIFY(c.isReady());
+
+ QObject *obj = c.create();
+
+ QBENCHMARK {
+ QQmlProperty p(obj, "x");
+ }
+
+ delete obj;
+}
+
+QTEST_MAIN(tst_qmlmetaproperty)
+#include "tst_qqmlmetaproperty.moc"
diff --git a/tests/benchmarks/qml/qquickwindow/qquickwindow.pro b/tests/benchmarks/qml/qquickwindow/qquickwindow.pro
new file mode 100644
index 0000000000..76aecf9d13
--- /dev/null
+++ b/tests/benchmarks/qml/qquickwindow/qquickwindow.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qquickwindow
+SOURCES += tst_qquickwindow.cpp
+macx:CONFIG -= app_bundle
+
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
+
+QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 \ No newline at end of file
diff --git a/tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp b/tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp
new file mode 100644
index 0000000000..01ddd70838
--- /dev/null
+++ b/tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp
@@ -0,0 +1,91 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQuick/QQuickWindow>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquickwindow_p.h>
+
+#include <qtest.h>
+#include <QtTest/QtTest>
+
+class tst_qquickwindow : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qquickwindow();
+
+private slots:
+ void tst_updateCursor();
+ void cleanupTestCase();
+private:
+ QQuickWindow* window;
+};
+
+tst_qquickwindow::tst_qquickwindow()
+{
+ window = new QQuickWindow;
+ window->resize(250, 250);
+ window->setPos(100, 100);
+ for ( int i=0; i<8000; i++ ) {
+ QQuickRectangle *r =new QQuickRectangle(window->rootItem());
+ for ( int j=0; j<10; ++j ) {
+ new QQuickRectangle(r);
+ }
+ }
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+}
+
+void tst_qquickwindow::cleanupTestCase()
+{
+ delete window;
+}
+
+void tst_qquickwindow::tst_updateCursor()
+{
+ QBENCHMARK {
+ QQuickWindowPrivate::get(window)->updateCursor(QPoint(100,100));
+ }
+}
+
+QTEST_MAIN(tst_qquickwindow);
+
+#include "tst_qquickwindow.moc"
diff --git a/tests/benchmarks/qml/script/data/CustomObject.qml b/tests/benchmarks/qml/script/data/CustomObject.qml
new file mode 100644
index 0000000000..95c0abbd76
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/CustomObject.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+QtObject {
+ property real prop1: 0
+ property real prop2: 1
+ property real prop3: 0
+}
diff --git a/tests/benchmarks/qml/script/data/block.qml b/tests/benchmarks/qml/script/data/block.qml
new file mode 100644
index 0000000000..e718106738
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/block.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 200; height: 200
+ CustomObject { id: theObject }
+ function doSomethingDirect() {
+ theObject.prop1 = 0;
+
+ for (var i = 0; i < 1000; ++i)
+ theObject.prop1 += theObject.prop2;
+
+ theObject.prop3 = theObject.prop1;
+ }
+
+ function doSomethingLocalObj() {
+ theObject.prop1 = 0;
+
+ var incrementObj = theObject;
+ for (var i = 0; i < 1000; ++i)
+ incrementObj.prop1 += incrementObj.prop2;
+
+ incrementObj.prop3 = incrementObj.prop1;
+ }
+
+ function doSomethingLocal() {
+ theObject.prop1 = 0;
+
+ var increment = theObject.prop2;
+ for (var i = 0; i < 1000; ++i)
+ theObject.prop1 += increment;
+
+ theObject.prop3 = theObject.prop1;
+ }
+}
diff --git a/tests/benchmarks/qml/script/data/enums.qml b/tests/benchmarks/qml/script/data/enums.qml
new file mode 100644
index 0000000000..c25f8726bb
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/enums.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ function runtest() {
+ var a = 0;
+ for (var ii = 0; ii < 100000; ++ii)
+ a += Text.RichText;
+ return a;
+ }
+}
diff --git a/tests/benchmarks/qml/script/data/global.js b/tests/benchmarks/qml/script/data/global.js
new file mode 100644
index 0000000000..ce313445c7
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/global.js
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var incVar = 1;
+var total;
+
+function doSomething() {
+ for (var i = 0; i < 10000; ++i)
+ Math.sin(90);
+}
+
+function doIncrement() {
+ total = 0;
+ for (var i = 0; i < 100000; ++i)
+ total += incVar;
+}
diff --git a/tests/benchmarks/qml/script/data/global_prop.qml b/tests/benchmarks/qml/script/data/global_prop.qml
new file mode 100644
index 0000000000..8782384daf
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/global_prop.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "global.js" as Program
+
+Rectangle {
+ width: 200; height: 200
+
+ signal triggered
+ signal incrementTriggered
+
+ onTriggered: Program.doSomething();
+ onIncrementTriggered: Program.doIncrement();
+}
diff --git a/tests/benchmarks/qml/script/data/namespacedEnums.qml b/tests/benchmarks/qml/script/data/namespacedEnums.qml
new file mode 100644
index 0000000000..0af7450fe1
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/namespacedEnums.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0 as QtQuick
+
+QtQuick.Item {
+ function runtest() {
+ var a = 0;
+ for (var ii = 0; ii < 100000; ++ii)
+ a += QtQuick.Text.RichText;
+ return a;
+ }
+}
+
diff --git a/tests/benchmarks/qml/script/data/script.js b/tests/benchmarks/qml/script/data/script.js
new file mode 100644
index 0000000000..9f46570004
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/script.js
@@ -0,0 +1 @@
+function func() { return 1; }
diff --git a/tests/benchmarks/qml/script/data/script2.js b/tests/benchmarks/qml/script/data/script2.js
new file mode 100644
index 0000000000..102f081140
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/script2.js
@@ -0,0 +1,2 @@
+function func() { return 2; }
+
diff --git a/tests/benchmarks/qml/script/data/scriptCall.qml b/tests/benchmarks/qml/script/data/scriptCall.qml
new file mode 100644
index 0000000000..8da1ebbfee
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/scriptCall.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "script.js" as Script
+import "script2.js" as OtherScript
+
+Item {
+ function runtest() {
+ var a = 0;
+ for (var ii = 0; ii < 1000000; ++ii)
+ a += Script.func();
+ return a;
+ }
+}
+
diff --git a/tests/benchmarks/qml/script/data/signal_args.qml b/tests/benchmarks/qml/script/data/signal_args.qml
new file mode 100644
index 0000000000..7fc33b1508
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/signal_args.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+ onMySignalWithArgs: { var a = n; return a; }
+}
+
diff --git a/tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml b/tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml
new file mode 100644
index 0000000000..b50725f66b
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+ onMySignalWithArgs: {
+ var a = 0;
+ for (var i = 0; i < 10000; ++i)
+ a += n;
+ return a;
+ }
+}
diff --git a/tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml b/tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml
new file mode 100644
index 0000000000..5f9459d9b2
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+ id: obj
+ property real inc: 3
+
+ onMySignalWithArgs: {
+ var a = 0;
+ for (var i = 0; i < 10000; ++i)
+ a += obj.inc;
+ return a;
+ }
+}
diff --git a/tests/benchmarks/qml/script/data/signal_qml.qml b/tests/benchmarks/qml/script/data/signal_qml.qml
new file mode 100644
index 0000000000..7364a19d7e
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/signal_qml.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+ onMySignal: { var a = 1; return a; }
+}
+
diff --git a/tests/benchmarks/qml/script/data/signal_unconnected.qml b/tests/benchmarks/qml/script/data/signal_unconnected.qml
new file mode 100644
index 0000000000..27dee8d014
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/signal_unconnected.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+}
diff --git a/tests/benchmarks/qml/script/data/signal_unusedArgs.qml b/tests/benchmarks/qml/script/data/signal_unusedArgs.qml
new file mode 100644
index 0000000000..a331beb0fb
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/signal_unusedArgs.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+ onMySignalWithArgs: { var a = 1; return a; }
+}
+
diff --git a/tests/benchmarks/qml/script/data/slot_complex.qml b/tests/benchmarks/qml/script/data/slot_complex.qml
new file mode 100644
index 0000000000..4e467da901
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/slot_complex.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+ function myCustomFunction(b) {
+ var n = b;
+ var a = 1;
+ while (n > 0) {
+ a = a * n;
+ n--;
+ }
+ return a;
+ }
+
+ onMySignal: { for (var ii = 0; ii < 10000; ++ii) { myCustomFunction(10); } }
+}
+
diff --git a/tests/benchmarks/qml/script/data/slot_complex_js.js b/tests/benchmarks/qml/script/data/slot_complex_js.js
new file mode 100644
index 0000000000..64a1f65daa
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/slot_complex_js.js
@@ -0,0 +1,8 @@
+function myCustomFunction(n) {
+ var a = 1;
+ while (n > 0) {
+ a = a * n;
+ n--;
+ }
+ return a;
+}
diff --git a/tests/benchmarks/qml/script/data/slot_complex_js.qml b/tests/benchmarks/qml/script/data/slot_complex_js.qml
new file mode 100644
index 0000000000..dc61197471
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/slot_complex_js.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+import "slot_complex_js.js" as Logic
+
+TestObject {
+ onMySignal: { for (var ii = 0; ii < 10000; ++ii) { Logic.myCustomFunction(10); } }
+}
+
+
diff --git a/tests/benchmarks/qml/script/data/slot_simple.qml b/tests/benchmarks/qml/script/data/slot_simple.qml
new file mode 100644
index 0000000000..c45392082f
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/slot_simple.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+
+TestObject {
+ function myCustomFunction() {
+ return 0;
+ }
+
+ onMySignal: { for (var ii = 0; ii < 10000; ++ii) { myCustomFunction(); } }
+}
diff --git a/tests/benchmarks/qml/script/data/slot_simple_js.js b/tests/benchmarks/qml/script/data/slot_simple_js.js
new file mode 100644
index 0000000000..d6e60608da
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/slot_simple_js.js
@@ -0,0 +1,3 @@
+function myCustomFunction() {
+ return 0;
+}
diff --git a/tests/benchmarks/qml/script/data/slot_simple_js.qml b/tests/benchmarks/qml/script/data/slot_simple_js.qml
new file mode 100644
index 0000000000..8af21f458e
--- /dev/null
+++ b/tests/benchmarks/qml/script/data/slot_simple_js.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 1.0
+import "slot_simple_js.js" as Logic
+
+TestObject {
+ onMySignal: { for (var ii = 0; ii < 10000; ++ii) { Logic.myCustomFunction(); } }
+}
+
diff --git a/tests/benchmarks/qml/script/script.pro b/tests/benchmarks/qml/script/script.pro
new file mode 100644
index 0000000000..7beb3f81c1
--- /dev/null
+++ b/tests/benchmarks/qml/script/script.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_script
+macx:CONFIG -= app_bundle
+CONFIG += release
+
+SOURCES += tst_script.cpp
+
+QT += core-private gui-private v8-private qml-private quick-private testlib
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/qml/script/tst_script.cpp b/tests/benchmarks/qml/script/tst_script.cpp
new file mode 100644
index 0000000000..2b409a5ee2
--- /dev/null
+++ b/tests/benchmarks/qml/script/tst_script.cpp
@@ -0,0 +1,852 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <private/qqmlengine_p.h>
+#include <private/qquickrectangle_p.h>
+#include <QJSEngine>
+#include <QJSValue>
+
+class tst_script : public QObject
+{
+ Q_OBJECT
+public:
+ tst_script() {}
+
+private slots:
+ void initTestCase();
+
+ void property_js();
+ void property_getter_js();
+#if 0
+ //no native functions for now
+ void property_getter();
+ void property_getter_qobject();
+ void property_getter_qmetaproperty();
+#endif
+ void property_qobject();
+ void property_qmlobject();
+
+ void setproperty_js();
+ void setproperty_qmlobject();
+
+ void function_js();
+#if 0
+ //no native functions for now
+ void function_cpp();
+#endif
+ void function_qobject();
+ void function_qmlobject();
+
+ void function_args_js();
+#if 0
+ //no native functions for now
+ void function_args_cpp();
+#endif
+ void function_args_qobject();
+ void function_args_qmlobject();
+
+ void signal_unconnected();
+ void signal_qml();
+ void signal_args();
+ void signal_unusedArgs();
+ void signal_heavyArgsAccess();
+ void signal_heavyIdAccess();
+
+ void slot_simple();
+ void slot_simple_js();
+ void slot_complex();
+ void slot_complex_js();
+
+ void block_data();
+ void block();
+
+ void global_property_js();
+ void global_property_qml();
+ void global_property_qml_js();
+
+ void scriptfile_property();
+
+ void enums();
+ void namespacedEnums();
+ void scriptCall();
+};
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+class TestObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int x READ x WRITE setX)
+
+public:
+ TestObject(QObject *parent = 0);
+
+ int x();
+ void setX(int x) { m_x = x; }
+
+ void emitMySignal() { emit mySignal(); }
+ void emitMySignalWithArgs(int n) { emit mySignalWithArgs(n); }
+
+signals:
+ void mySignal();
+ void mySignalWithArgs(int n);
+
+public slots:
+ int method() {
+ return x();
+ }
+
+ int methodArgs(int val) {
+ return val + x();
+ }
+
+private:
+ int m_x;
+};
+QML_DECLARE_TYPE(TestObject);
+
+TestObject::TestObject(QObject *parent)
+: QObject(parent), m_x(0)
+{
+}
+
+int TestObject::x()
+{
+ return m_x++;
+}
+
+void tst_script::initTestCase()
+{
+ qmlRegisterType<TestObject>("Qt.test", 1, 0, "TestObject");
+}
+
+
+#define PROPERTY_PROGRAM \
+ "(function(testObject) { return (function() { " \
+ " var test = 0; " \
+ " for (var ii = 0; ii < 10000; ++ii) { " \
+ " test += testObject.x; " \
+ " } " \
+ " return test; " \
+ "}); })"
+
+void tst_script::property_js()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.newObject();
+ v.setProperty(QLatin1String("x"), 10);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call().toNumber();
+ }
+}
+
+#if 0
+static QJSValue property_getter_method(QScriptContext *, QJSEngine *engine)
+{
+ static int x = 0;
+ return QJSValue(engine,x++);
+}
+
+void tst_script::property_getter()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.newObject();
+ v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_method),
+ QJSValue::PropertyGetter);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+static TestObject *property_getter_qobject_object = 0;
+static QJSValue property_getter_qobject_method(QScriptContext *, QJSEngine *)
+{
+ static int idx = -1;
+ if (idx == -1)
+ idx = TestObject::staticMetaObject.indexOfProperty("x");
+
+ int value = 0;
+ void *args[] = { &value, 0 };
+ QMetaObject::metacall(property_getter_qobject_object, QMetaObject::ReadProperty, idx, args);
+
+ return QJSValue(value);
+}
+
+static QJSValue property_getter_qmetaproperty_method(QScriptContext *, QJSEngine *)
+{
+ static int idx = -1;
+ if (idx == -1)
+ idx = TestObject::staticMetaObject.indexOfProperty("x");
+
+ int value = 0;
+ value = property_getter_qobject_object->metaObject()->property(idx).read(property_getter_qobject_object).toInt();
+
+ return QJSValue(value);
+}
+
+void tst_script::property_getter_qobject()
+{
+ QJSEngine engine;
+
+ TestObject to;
+ property_getter_qobject_object = &to;
+ QJSValue v = engine.newObject();
+ v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qobject_method),
+ QJSValue::PropertyGetter);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+ property_getter_qobject_object = 0;
+}
+
+void tst_script::property_getter_qmetaproperty()
+{
+ QJSEngine engine;
+
+ TestObject to;
+ property_getter_qobject_object = &to;
+ QJSValue v = engine.newObject();
+ v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qmetaproperty_method),
+ QJSValue::PropertyGetter);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+ property_getter_qobject_object = 0;
+}
+#endif
+
+void tst_script::property_getter_js()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.__defineGetter__(\"x\", function() { return this._x++; }); return o; })").call();
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::property_qobject()
+{
+ QJSEngine engine;
+
+ TestObject to;
+ QJSValue v = engine.newQObject(&to);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::property_qmlobject()
+{
+ QQmlEngine qmlengine;
+
+ TestObject to;
+ QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine);
+ v8::HandleScope handle_scope;
+ v8::Context::Scope scope(engine->context());
+ QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = qmlengine.evaluate(PROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+#define SETPROPERTY_PROGRAM \
+ "(function(testObject) { return (function() { " \
+ " for (var ii = 0; ii < 10000; ++ii) { " \
+ " testObject.x = ii; " \
+ " } " \
+ "}); })"
+
+void tst_script::setproperty_js()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.newObject();
+ v.setProperty(QLatin1String("x"), 0);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(SETPROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::setproperty_qmlobject()
+{
+ QQmlEngine qmlengine;
+
+ TestObject to;
+
+ QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine);
+ v8::HandleScope handle_scope;
+ v8::Context::Scope scope(engine->context());
+ QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = qmlengine.evaluate(SETPROPERTY_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+#define FUNCTION_PROGRAM \
+ "(function(testObject) { return (function() { " \
+ " var test = 0; " \
+ " for (var ii = 0; ii < 10000; ++ii) { " \
+ " test += testObject.method(); " \
+ " } " \
+ " return test; " \
+ "}); })"
+
+void tst_script::function_js()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.method = (function() { return this._x++; }); return o; })").call();
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+#if 0
+static QJSValue function_method(QScriptContext *, QJSEngine *)
+{
+ static int x = 0;
+ return QJSValue(x++);
+}
+
+void tst_script::function_cpp()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.newObject();
+ v.setProperty(QLatin1String("method"), engine.newFunction(function_method));
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+#endif
+
+void tst_script::function_qobject()
+{
+ QJSEngine engine;
+
+ TestObject to;
+ QJSValue v = engine.newQObject(&to);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::function_qmlobject()
+{
+ QQmlEngine qmlengine;
+
+ TestObject to;
+
+ QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine);
+ v8::HandleScope handle_scope;
+ v8::Context::Scope scope(engine->context());
+ QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = qmlengine.evaluate(FUNCTION_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+#define FUNCTION_ARGS_PROGRAM \
+ "(function(testObject) { return (function() { " \
+ " var test = 0; " \
+ " for (var ii = 0; ii < 10000; ++ii) { " \
+ " test += testObject.methodArgs(ii); " \
+ " } " \
+ " return test; " \
+ "}); })"
+
+void tst_script::function_args_js()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.methodArgs = (function(a) { return a + this._x++; }); return o; })").call();
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+#if 0
+static QJSValue function_args_method(QScriptContext *ctxt, QJSEngine *)
+{
+ static int x = 0;
+ return QJSValue(ctxt->argument(0).toNumber() + x++);
+}
+
+void tst_script::function_args_cpp()
+{
+ QJSEngine engine;
+
+ QJSValue v = engine.newObject();
+ v.setProperty(QLatin1String("methodArgs"), engine.newFunction(function_args_method));
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+#endif
+
+void tst_script::function_args_qobject()
+{
+ QJSEngine engine;
+
+ TestObject to;
+ QJSValue v = engine.newQObject(&to);
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::function_args_qmlobject()
+{
+ QQmlEngine qmlengine;
+
+ TestObject to;
+
+ QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine);
+ v8::HandleScope handle_scope;
+ v8::Context::Scope scope(engine->context());
+ QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
+
+ QJSValueList args;
+ args << v;
+ QJSValue prog = qmlengine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::signal_unconnected()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("signal_unconnected.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignal();
+ }
+
+ delete object;
+}
+
+void tst_script::signal_qml()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("signal_qml.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignal();
+ }
+
+ delete object;
+}
+
+void tst_script::signal_args()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("signal_args.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignalWithArgs(11);
+ }
+
+ delete object;
+}
+
+void tst_script::signal_unusedArgs()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("signal_unusedArgs.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignalWithArgs(11);
+ }
+
+ delete object;
+}
+
+void tst_script::signal_heavyArgsAccess()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("signal_heavyArgsAccess.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignalWithArgs(11);
+ }
+
+ delete object;
+}
+
+void tst_script::signal_heavyIdAccess()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("signal_heavyIdAccess.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignalWithArgs(11);
+ }
+
+ delete object;
+}
+
+void tst_script::slot_simple()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("slot_simple.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignal();
+ }
+
+ delete object;
+}
+
+void tst_script::slot_simple_js()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("slot_simple_js.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignal();
+ }
+
+ delete object;
+}
+
+void tst_script::slot_complex()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("slot_complex.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignal();
+ }
+
+ delete object;
+}
+
+void tst_script::slot_complex_js()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("slot_complex_js.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignal();
+ }
+
+ delete object;
+}
+
+void tst_script::block_data()
+{
+ QTest::addColumn<QString>("methodName");
+ QTest::newRow("direct") << "doSomethingDirect()";
+ QTest::newRow("localObj") << "doSomethingLocalObj()";
+ QTest::newRow("local") << "doSomethingLocal()";
+}
+
+void tst_script::block()
+{
+ QFETCH(QString, methodName);
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("block.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(component.create());
+ QVERIFY(rect != 0);
+
+ int index = rect->metaObject()->indexOfMethod(methodName.toUtf8());
+ QVERIFY(index != -1);
+ QMetaMethod method = rect->metaObject()->method(index);
+
+ QBENCHMARK {
+ method.invoke(rect, Qt::DirectConnection);
+ }
+
+ delete rect;
+}
+
+#define GLOBALPROPERTY_PROGRAM \
+ "(function() { " \
+ " for (var ii = 0; ii < 10000; ++ii) { " \
+ " Math.sin(90); " \
+ " } " \
+ "})"
+
+void tst_script::global_property_js()
+{
+ QJSEngine engine;
+
+ QJSValue prog = engine.evaluate(GLOBALPROPERTY_PROGRAM);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::global_property_qml()
+{
+ QQmlEngine qmlengine;
+
+ QJSValue prog = qmlengine.evaluate(GLOBALPROPERTY_PROGRAM);
+ prog.call();
+
+ QBENCHMARK {
+ prog.call();
+ }
+}
+
+void tst_script::global_property_qml_js()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("global_prop.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(component.create());
+ QVERIFY(rect != 0);
+
+ int index = rect->metaObject()->indexOfMethod("triggered()");
+ QVERIFY(index != -1);
+ QMetaMethod method = rect->metaObject()->method(index);
+
+ QBENCHMARK {
+ method.invoke(rect, Qt::DirectConnection);
+ }
+
+ delete rect;
+}
+
+void tst_script::scriptfile_property()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("global_prop.qml"));
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(component.create());
+ QVERIFY(rect != 0);
+
+ int index = rect->metaObject()->indexOfMethod("incrementTriggered()");
+ QVERIFY(index != -1);
+ QMetaMethod method = rect->metaObject()->method(index);
+
+ QBENCHMARK {
+ method.invoke(rect, Qt::DirectConnection);
+ }
+
+ delete rect;
+}
+
+void tst_script::enums()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("enums.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ int index = o->metaObject()->indexOfMethod("runtest()");
+ QVERIFY(index != -1);
+ QMetaMethod method = o->metaObject()->method(index);
+
+ QBENCHMARK {
+ method.invoke(o, Qt::DirectConnection);
+ }
+
+ delete o;
+}
+
+void tst_script::namespacedEnums()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("namespacedEnums.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ int index = o->metaObject()->indexOfMethod("runtest()");
+ QVERIFY(index != -1);
+ QMetaMethod method = o->metaObject()->method(index);
+
+ QBENCHMARK {
+ method.invoke(o, Qt::DirectConnection);
+ }
+
+ delete o;
+}
+
+void tst_script::scriptCall()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, TEST_FILE("scriptCall.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ int index = o->metaObject()->indexOfMethod("runtest()");
+ QVERIFY(index != -1);
+ QMetaMethod method = o->metaObject()->method(index);
+
+ QBENCHMARK {
+ method.invoke(o, Qt::DirectConnection);
+ }
+
+ delete o;
+}
+
+QTEST_MAIN(tst_script)
+
+#include "tst_script.moc"
diff --git a/tests/benchmarks/qml/typeimports/data/QmlTestType1.qml b/tests/benchmarks/qml/typeimports/data/QmlTestType1.qml
new file mode 100644
index 0000000000..397e42ba20
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/data/QmlTestType1.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 2.0
+TestType1 { }
diff --git a/tests/benchmarks/qml/typeimports/data/QmlTestType2.qml b/tests/benchmarks/qml/typeimports/data/QmlTestType2.qml
new file mode 100644
index 0000000000..18667859e2
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/data/QmlTestType2.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 2.0
+TestType2 { }
diff --git a/tests/benchmarks/qml/typeimports/data/QmlTestType3.qml b/tests/benchmarks/qml/typeimports/data/QmlTestType3.qml
new file mode 100644
index 0000000000..aac90b93e6
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/data/QmlTestType3.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 2.0
+TestType3 { }
diff --git a/tests/benchmarks/qml/typeimports/data/QmlTestType4.qml b/tests/benchmarks/qml/typeimports/data/QmlTestType4.qml
new file mode 100644
index 0000000000..b194194a0a
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/data/QmlTestType4.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 2.0
+TestType4 { }
diff --git a/tests/benchmarks/qml/typeimports/data/cpp.qml b/tests/benchmarks/qml/typeimports/data/cpp.qml
new file mode 100644
index 0000000000..0ea77072ac
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/data/cpp.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt.test 2.0
+
+TestType1 {
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+ TestType1 { } TestType2 { } TestType3 { } TestType4 { }
+}
diff --git a/tests/benchmarks/qml/typeimports/data/qml.qml b/tests/benchmarks/qml/typeimports/data/qml.qml
new file mode 100644
index 0000000000..7d6fef9d59
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/data/qml.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+QmlTestType1 {
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+ QmlTestType1 { } QmlTestType2 { } QmlTestType3 { } QmlTestType4 { }
+}
diff --git a/tests/benchmarks/qml/typeimports/tst_typeimports.cpp b/tests/benchmarks/qml/typeimports/tst_typeimports.cpp
new file mode 100644
index 0000000000..c24e344a6b
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/tst_typeimports.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+#include <QDebug>
+
+class tst_typeimports : public QObject
+{
+ Q_OBJECT
+public:
+ tst_typeimports();
+
+private slots:
+ void cpp();
+ void qml();
+
+private:
+ QQmlEngine engine;
+};
+
+class TestType1 : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<QObject> resources READ resources);
+ Q_CLASSINFO("DefaultProperty", "resources");
+public:
+ TestType1(QObject *parent = 0) : QObject(parent) {}
+
+ QQmlListProperty<QObject> resources() {
+ return QQmlListProperty<QObject>(this, 0, resources_append);
+ }
+
+ static void resources_append(QQmlListProperty<QObject> *p, QObject *o) {
+ o->setParent(p->object);
+ }
+};
+
+class TestType2 : public TestType1
+{
+ Q_OBJECT
+public:
+ TestType2(QObject *parent = 0) : TestType1(parent) {}
+};
+
+
+class TestType3 : public TestType1
+{
+ Q_OBJECT
+public:
+ TestType3(QObject *parent = 0) : TestType1(parent) {}
+};
+
+class TestType4 : public TestType1
+{
+ Q_OBJECT
+public:
+ TestType4(QObject *parent = 0) : TestType1(parent) {}
+};
+
+
+tst_typeimports::tst_typeimports()
+{
+ qmlRegisterType<TestType1>("Qt.test", 1, 0, "TestType1");
+ qmlRegisterType<TestType2>("Qt.test", 1, 0, "TestType2");
+ qmlRegisterType<TestType3>("Qt.test", 2, 0, "TestType3");
+ qmlRegisterType<TestType4>("Qt.test", 2, 0, "TestType4");
+}
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+void tst_typeimports::cpp()
+{
+ QBENCHMARK {
+ QQmlComponent component(&engine, TEST_FILE("cpp.qml"));
+ QVERIFY(component.isReady());
+ }
+}
+
+void tst_typeimports::qml()
+{
+ //get rid of initialization effects
+ { QQmlComponent component(&engine, TEST_FILE("qml.qml")); }
+
+ QBENCHMARK {
+ QQmlComponent component(&engine, TEST_FILE("qml.qml"));
+ QVERIFY(component.isReady());
+ }
+}
+
+QTEST_MAIN(tst_typeimports)
+
+#include "tst_typeimports.moc"
diff --git a/tests/benchmarks/qml/typeimports/typeimports.pro b/tests/benchmarks/qml/typeimports/typeimports.pro
new file mode 100644
index 0000000000..b8db7bd134
--- /dev/null
+++ b/tests/benchmarks/qml/typeimports/typeimports.pro
@@ -0,0 +1,10 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_typeimports
+QT += qml testlib
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_typeimports.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/script/qjsvalue/qjsvalue.pro b/tests/benchmarks/script/qjsvalue/qjsvalue.pro
new file mode 100644
index 0000000000..7aa864c12f
--- /dev/null
+++ b/tests/benchmarks/script/qjsvalue/qjsvalue.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TEMPLATE = app
+TARGET = tst_bench_qjsvalue
+INCLUDEPATH += .
+macx:CONFIG -= app_bundle
+CONFIG += release
+
+SOURCES += tst_qjsvalue.cpp
+
+QT += core-private v8-private qml-private testlib
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp b/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp
new file mode 100644
index 0000000000..53570d8073
--- /dev/null
+++ b/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QJSEngine>
+#include <QJSValue>
+#include <private/v8.h>
+
+QT_BEGIN_NAMESPACE
+extern Q_QML_EXPORT v8::Local<v8::Context> qt_QJSEngineV8Context(QJSEngine *);
+extern Q_QML_EXPORT v8::Local<v8::Value> qt_QJSValueV8Value(const QJSValue &);
+QT_END_NAMESPACE
+
+class tst_QJSValue : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QJSValue() {}
+
+private slots:
+ void fillArray();
+ void fillArray_V8();
+
+ void property();
+ void property_V8();
+
+ void setProperty();
+ void setProperty_V8();
+
+ void call();
+ void call_V8();
+};
+
+void tst_QJSValue::fillArray()
+{
+ QJSEngine eng;
+ static const int ArrayLength = 10000;
+ QJSValue array = eng.newArray(ArrayLength);
+ QBENCHMARK {
+ for (int i = 0; i < ArrayLength; ++i)
+ array.setProperty(i, i);
+ }
+}
+
+void tst_QJSValue::fillArray_V8()
+{
+ QJSEngine eng;
+ static const int ArrayLength = 10000;
+ QJSValue array = eng.newArray(ArrayLength);
+
+ v8::HandleScope handleScope;
+ v8::Local<v8::Array> v8array = qt_QJSValueV8Value(array).As<v8::Array>();
+ QBENCHMARK {
+ for (int i = 0; i < ArrayLength; ++i)
+ v8array->Set(i, v8::Number::New(i));
+ }
+}
+
+void tst_QJSValue::property()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ QString propertyName = QString::fromLatin1("foo");
+ object.setProperty(propertyName, 123);
+ QVERIFY(object.property(propertyName).isNumber());
+ QBENCHMARK {
+ object.property(propertyName);
+ }
+}
+
+void tst_QJSValue::property_V8()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ QString propertyName = QString::fromLatin1("foo");
+ object.setProperty(propertyName, 123);
+ QVERIFY(object.property(propertyName).isNumber());
+
+ v8::HandleScope handleScope;
+ v8::Local<v8::Object> v8object = qt_QJSValueV8Value(object).As<v8::Object>();
+ v8::Local<v8::String> v8propertyName = v8::String::New("foo");
+ QVERIFY(v8object->Get(v8propertyName)->IsNumber());
+ QBENCHMARK {
+ v8object->Get(v8propertyName);
+ }
+}
+
+void tst_QJSValue::setProperty()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+ QString propertyName = QString::fromLatin1("foo");
+ QJSValue value(123);
+ QBENCHMARK {
+ object.setProperty(propertyName, value);
+ }
+}
+
+void tst_QJSValue::setProperty_V8()
+{
+ QJSEngine eng;
+ QJSValue object = eng.newObject();
+
+ v8::HandleScope handleScope;
+ // A context scope is needed for v8::Object::Set(), otherwise we crash.
+ v8::Local<v8::Context> context = qt_QJSEngineV8Context(&eng);
+ v8::Context::Scope contextScope(context);
+
+ v8::Local<v8::Object> v8object = qt_QJSValueV8Value(object).As<v8::Object>();
+ v8::Local<v8::String> v8propertyName = v8::String::New("foo");
+ v8::Local<v8::Value> v8value = v8::Number::New(123);
+ QBENCHMARK {
+ v8object->Set(v8propertyName, v8value);
+ }
+}
+
+#define TEST_FUNCTION_SOURCE "(function() { return 123; })"
+
+void tst_QJSValue::call()
+{
+ QJSEngine eng;
+ QJSValue fun = eng.evaluate(TEST_FUNCTION_SOURCE);
+ QVERIFY(fun.isCallable());
+ QJSValueList args;
+ QVERIFY(fun.call(args).isNumber());
+ QBENCHMARK {
+ fun.call(args);
+ }
+}
+
+void tst_QJSValue::call_V8()
+{
+ QJSEngine eng;
+ QJSValue fun = eng.evaluate(TEST_FUNCTION_SOURCE);
+ QVERIFY(fun.isCallable());
+
+ v8::HandleScope handleScope;
+ v8::Local<v8::Context> context = qt_QJSEngineV8Context(&eng);
+ v8::Context::Scope contextScope(context);
+
+ v8::Local<v8::Function> v8fun = qt_QJSValueV8Value(fun).As<v8::Function>();
+ v8::Local<v8::Object> v8thisObject = v8::Object::New();
+ QVERIFY(v8fun->Call(v8thisObject, /*argc=*/0, /*argv=*/0)->IsNumber());
+ QBENCHMARK {
+ v8fun->Call(v8thisObject, /*argc=*/0, /*argv=*/0);
+ }
+}
+
+QTEST_MAIN(tst_QJSValue)
+
+#include "tst_qjsvalue.moc"
diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro
new file mode 100644
index 0000000000..37dc03801d
--- /dev/null
+++ b/tests/benchmarks/script/script.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ qjsvalue
diff --git a/tests/global/.gitignore b/tests/global/.gitignore
new file mode 100644
index 0000000000..1e49c6005c
--- /dev/null
+++ b/tests/global/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+global.pro
diff --git a/tests/global/global.cfg b/tests/global/global.cfg
new file mode 100644
index 0000000000..28c9378699
--- /dev/null
+++ b/tests/global/global.cfg
@@ -0,0 +1,5 @@
+<config>
+<modules>
+<module name="QtQml" qtname="qml"/>
+</modules>
+</config>
diff --git a/tests/manual/accessibility/animation.qml b/tests/manual/accessibility/animation.qml
new file mode 100644
index 0000000000..7011acc757
--- /dev/null
+++ b/tests/manual/accessibility/animation.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: scene
+ width: 800; height: 600
+
+ Rectangle {
+ id: behavior
+ x : 50
+ y : 100
+ width: 100; height: 100
+ color: "red"
+
+ Text {
+ text : "Behavior"
+ }
+
+ Behavior on x {
+ NumberAnimation { duration: 1000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: behavior.x += 50
+ }
+ }
+
+ Rectangle {
+ id: transition
+ x : 400
+ y : 100
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ Text {
+ text : "Transition"
+ }
+
+ states: State {
+ name: "moved"; when: mouseArea.pressed
+ PropertyChanges { target: transition; x: 500; y: 200 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad; duration: 1000 }
+ }
+ }
+
+ Rectangle {
+ id : animatee
+ width: 100; height: 100
+ x : 50
+ y : 300
+ color: "blue"
+ opacity: 0.5
+ Text {
+ anchors.centerIn: parent
+ text : "NumberAnimation"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ animatePosition.start()
+ }
+ }
+
+ NumberAnimation {
+ id: animatePosition
+ target: animatee
+ properties: "x"
+ from: animatee.x
+ to: animatee.x + 50
+ loops: 1
+ easing {type: Easing.Linear;}
+ }
+ }
+
+ ListView {
+ id : content
+ x : 400
+ y : 300
+ width: 300
+ height: 200
+
+ model : 200
+ delegate : Text { text : "Flickable" + index; height : 50 }
+ }
+}
diff --git a/tests/manual/accessibility/behavior.qml b/tests/manual/accessibility/behavior.qml
new file mode 100644
index 0000000000..ae6420c14c
--- /dev/null
+++ b/tests/manual/accessibility/behavior.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: scene
+ width: 400; height: 400
+
+ Rectangle {
+ id: rect
+ y : 100
+ width: 100; height: 100
+ color: "red"
+
+ Text {
+ text : "Behavior animation"
+ }
+
+ Behavior on x {
+ NumberAnimation { duration: 1000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: rect.x += 50
+ }
+ }
+ }
diff --git a/tests/manual/accessibility/flickable.qml b/tests/manual/accessibility/flickable.qml
new file mode 100644
index 0000000000..5863b82f3f
--- /dev/null
+++ b/tests/manual/accessibility/flickable.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+
+ ListView {
+ id : content
+ width: 300
+ height: 200
+// KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2
+
+ model : 200
+ delegate : Text { text : "foo" + index; height : 50 }
+ }
diff --git a/tests/manual/accessibility/hittest.qml b/tests/manual/accessibility/hittest.qml
new file mode 100644
index 0000000000..a1a337ccbe
--- /dev/null
+++ b/tests/manual/accessibility/hittest.qml
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import QtQuick 2.0
+Rectangle {
+ id: page
+ width: 640
+ height: 480
+ color: "white"
+ Rectangle {
+ id: header
+ color: "#c0c0c0"
+ height: usage.height + chkClip.height
+ anchors.left: parent.left
+ anchors.right: parent.right
+ Text {
+ id: usage
+ text: "Use an a11y inspect tool to see if all visible rectangles can be found with hit testing."
+ }
+ Rectangle {
+ id: chkClip
+ property bool checked: true
+
+ color: (checked ? "#f0f0f0" : "#c0c0c0")
+ height: label.height
+ width: label.width
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: chkClip.checked = !chkClip.checked
+ }
+ Text {
+ id: label
+ text: "Click here to toggle clipping"
+ }
+ }
+ }
+ Rectangle {
+ clip: chkClip.checked
+ z: 2
+ id: rect1
+ width: 100
+ height: 100
+ color: "#ffc0c0"
+ anchors.top: header.bottom
+ Rectangle {
+ id: rect2
+ width: 100
+ height: 100
+ x: 50
+ y: 50
+ color: "#ffa0a0"
+ Rectangle {
+ id: rect31
+ width: 100
+ height: 100
+ x: 80
+ y: 80
+ color: "#ff8080"
+ }
+ Rectangle {
+ id: rect32
+ x: 100
+ y: 70
+ z: 3
+ width: 100
+ height: 100
+ color: "#e06060"
+ }
+ Rectangle {
+ id: rect33
+ width: 100
+ height: 100
+ x: 150
+ y: 60
+ color: "#c04040"
+ }
+ }
+ }
+
+ Rectangle {
+ x: 0
+ y: 50
+ id: recta1
+ width: 100
+ height: 100
+ color: "#c0c0ff"
+ Rectangle {
+ id: recta2
+ width: 100
+ height: 100
+ x: 50
+ y: 50
+ color: "#a0a0ff"
+ Rectangle {
+ id: recta31
+ width: 100
+ height: 100
+ x: 80
+ y: 80
+ color: "#8080ff"
+ }
+ Rectangle {
+ id: recta32
+ x: 100
+ y: 70
+ z: 100
+ width: 100
+ height: 100
+ color: "#6060e0"
+ }
+ Rectangle {
+ id: recta33
+ width: 100
+ height: 100
+ x: 150
+ y: 60
+ color: "#4040c0"
+ }
+ }
+ }
+
+}
diff --git a/tests/manual/accessibility/numberanimation.qml b/tests/manual/accessibility/numberanimation.qml
new file mode 100644
index 0000000000..2574edd106
--- /dev/null
+++ b/tests/manual/accessibility/numberanimation.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: flashingblob
+ width: 300; height: 300
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ animatePosition.start()
+ }
+ }
+
+ Rectangle {
+ id : animatee
+ width: 100; height: 100
+ y : 100
+ color: "blue"
+ opacity: 0.5
+ Text {
+ anchors.centerIn: parent
+ text : "Be Well"
+ }
+ }
+
+ NumberAnimation {
+ id: animatePosition
+ target: animatee
+ properties: "x"
+ from: animatee.x
+ to: animatee.x + 50
+ loops: 1
+ easing {type: Easing.Linear;}
+ }
+}
diff --git a/tests/manual/accessibility/qmltestfiles.qmlproject b/tests/manual/accessibility/qmltestfiles.qmlproject
new file mode 100644
index 0000000000..9062c6a412
--- /dev/null
+++ b/tests/manual/accessibility/qmltestfiles.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ "../exampleplugin" ]
+}
diff --git a/tests/manual/accessibility/textandbuttons.qml b/tests/manual/accessibility/textandbuttons.qml
new file mode 100644
index 0000000000..2869b95e5a
--- /dev/null
+++ b/tests/manual/accessibility/textandbuttons.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id : rect
+ width: 300
+ height: 200
+
+ Rectangle {
+ width : 200
+ height : 20
+
+ id: button
+ anchors.top : rect.top
+ anchors.topMargin: 30
+ property string text : "Click to activate"
+ property int counter : 0
+
+ Accessible.role : Accessible.Button
+
+ function accessibleAction(action) {
+ if (action == Qt.Press)
+ buttonAction()
+ }
+
+ function buttonAction() {
+ ++counter
+ text = "clicked " + counter
+
+ text2.x += 20
+ }
+
+ Text {
+ id : text1
+ anchors.fill: parent
+ text : parent.text
+ }
+
+ MouseArea {
+ id : mouseArea
+ anchors.fill: parent
+ onClicked: parent.buttonAction()
+ }
+ }
+
+ Text {
+ id : text2
+ anchors.top: button.bottom
+ anchors.topMargin: 50
+ text : "Hello World " + x
+
+ Behavior on x { PropertyAnimation { duration: 500 } }
+ }
+}
diff --git a/tests/manual/accessibility/transition.qml b/tests/manual/accessibility/transition.qml
new file mode 100644
index 0000000000..a8d06b38c6
--- /dev/null
+++ b/tests/manual/accessibility/transition.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: scene
+ width: 300; height: 300
+
+ Rectangle {
+ id: rect
+ x : 100
+ y : 100
+ width: 100; height: 100
+ color: "red"
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+
+ Text {
+ text : "Transition"
+ }
+
+ states: State {
+ name: "moved"; when: mouseArea.pressed
+ PropertyChanges { target: rect; x: 150; y: 150 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad; duration: 1000 }
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/Ignore b/tests/manual/scenegraph_lancelot/data/Ignore
new file mode 100644
index 0000000000..3b28750552
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/Ignore
@@ -0,0 +1,8 @@
+# List of .qml files that should NOT be rendered
+
+# These are items to be used in other scenes; lack size
+borderimages/SimpleBorderImage.qml
+borderimages/SimpleNoBorder.qml
+
+# This will not stabilize before the timeout
+text/text_2500_chinese_characters.qml
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/SimpleBorderImage.qml b/tests/manual/scenegraph_lancelot/data/borderimages/SimpleBorderImage.qml
new file mode 100644
index 0000000000..9a1822515a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/SimpleBorderImage.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+
+Rectangle{
+ id: tr
+ property alias lbl: txt.text
+ property alias hTileMode: img.horizontalTileMode
+ property alias vTileMode: img.verticalTileMode
+ property alias xPos: tr.x
+ property int yPos: tr.y
+ property alias smoothing: img.smooth
+
+ BorderImage{ id: img; source: "../shared/world.png"; width: 70; height: 70; border { top: 6; bottom: 6; left: 6; right: 6} }
+ Text{
+ id: txt
+ text: "default"
+ anchors.top: img.bottom
+ anchors.horizontalCenter: img.horizontalCenter
+ font.family: "Arial"
+ font.pointSize: 8
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/SimpleNoBorder.qml b/tests/manual/scenegraph_lancelot/data/borderimages/SimpleNoBorder.qml
new file mode 100644
index 0000000000..12d54c7cfd
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/SimpleNoBorder.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+
+Rectangle{
+ id: tr
+ property alias lbl: txt.text
+ property alias hTileMode: img.horizontalTileMode
+ property alias vTileMode: img.verticalTileMode
+ property alias xPos: tr.x
+ property int yPos: tr.y
+ property alias smoothing: img.smooth
+
+ BorderImage{ id: img; source: "../shared/world.png"; width: 70; height: 70; }
+ Text{
+ id: txt
+ text: "default"
+ anchors.top: img.bottom
+ anchors.horizontalCenter: img.horizontalCenter
+ font.family: "Arial"
+ font.pointSize: 8
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/borderimage.qml b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage.qml
new file mode 100644
index 0000000000..ed91c9f9e4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage.qml
@@ -0,0 +1,182 @@
+import QtQuick 2.0
+
+
+Flickable {
+
+ id: f1
+ width: 320
+ height: 480
+
+ contentWidth: 360
+ contentHeight: 1000
+
+ property int cumulativeX;
+ property int cumulativeY;
+
+ function changeLabel(obj,txt){
+ obj.item.lbl = txt
+ }
+ function changeTileMode(obj,val,mode){
+ if (mode == "h")
+ obj.item.hTileMode = val;
+ else
+ obj.item.vTileMode = val;
+ }
+
+ Component{
+ id: borderImageComponent
+ SimpleBorderImage{
+ }
+ }
+ Column {
+ x: 20
+ y: 20
+ spacing: 30
+ Row {
+ spacing: 20
+ Item{
+ id: image_0001
+ width: 70
+ height: 70
+ Loader{ id: ldr1; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr1,"H: Stretch")
+ changeTileMode(ldr1,BorderImage.Stretch,"h")
+ ldr1.item.hTileMode = BorderImage.Stretch
+ }
+ }
+ Item{
+ id: image_0002
+ width: 70
+ height: 70
+ Loader{ id: ldr2; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr2,"H: Repeat")
+ changeTileMode(ldr2,BorderImage.Repeat,"h")
+ }
+ }
+ Item{
+
+ id: image_0003
+ width: 70
+ height: 70
+ Loader{ id: ldr3; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr3,"H: Round")
+ changeTileMode(ldr1,BorderImage.Round,"h")
+ }
+ }
+ }
+ Row {
+ spacing: 20
+ Item{
+
+ id: image_0004
+ width: 70
+ height: 70
+ Loader{ id: ldr4; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr4,"V: Stretch")
+ changeTileMode(ldr4,BorderImage.Stretch,"v")
+ }
+ }
+ Item{
+ id: image_0005
+ width: 70
+ height: 70
+ Loader{ id: ldr5; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr5,"V: Repeat")
+ changeTileMode(ldr5,BorderImage.Repeat,"v")
+ }
+ }
+ Item{
+ id: image_0006
+ width: 70
+ height: 70
+ Loader{ id: ldr6; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr6,"H: Round")
+ changeTileMode(ldr6,BorderImage.Round,"v")
+ }
+ }
+ }
+ Row {
+ spacing: 20
+
+ Item{
+ id: image_0007
+ width: 70
+ height: 70
+ Loader{ id: ldr7; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr7,"H/V: Stretch")
+ changeTileMode(ldr7,BorderImage.Stretch,"v")
+ changeTileMode(ldr7,BorderImage.Stretch,"h")
+ }
+ }
+ Item{
+ id: image_0008
+ width: 70
+ height: 70
+ Loader{ id: ldr8; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr8,"H/V: Repeat")
+ changeTileMode(ldr8,BorderImage.Repeat,"v")
+ changeTileMode(ldr8,BorderImage.Repeat,"h")
+ }
+ }
+ Item{
+ id: image_0009
+ width: 70
+ height: 70
+ Loader{ id: ldr9; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr9,"H/V: Round")
+ changeTileMode(ldr9,BorderImage.Round,"v")
+ changeTileMode(ldr9,BorderImage.Round,"h")
+ }
+ }
+ }
+ Row {
+ spacing: 20
+
+ Item{
+ id: image_0010
+ width: 70
+ height: 70
+ Loader{ id: ldr10; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr10,"H/V: Stretch\nsmooth")
+ changeTileMode(ldr10,BorderImage.Stretch,"v")
+ changeTileMode(ldr10,BorderImage.Stretch,"h")
+ ldr10.item.smoothing = true
+ }
+ }
+ Item{
+ id: image_0011
+ width: 70
+ height: 70
+ Loader{ id: ldr11; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr11,"H/V: Repeat\nsmooth")
+ changeTileMode(ldr11,BorderImage.Repeat,"v")
+ changeTileMode(ldr11,BorderImage.Repeat,"h")
+ ldr11.item.smoothing = true
+ }
+ }
+ Item{
+ id: image_0012
+ width: 70
+ height: 70
+ Loader{ id: ldr12; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr12,"H/V: Round\nsmooth")
+ changeTileMode(ldr12,BorderImage.Round,"v")
+ changeTileMode(ldr12,BorderImage.Round,"h")
+ ldr10.item.smoothing = true
+ }
+ }
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_no_border.qml b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_no_border.qml
new file mode 100644
index 0000000000..5856870dfa
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_no_border.qml
@@ -0,0 +1,191 @@
+import QtQuick 2.0
+
+
+Flickable {
+
+ id: f1
+ width: 320
+ height: 480
+
+ contentWidth: 360
+ contentHeight: 1000
+
+ property int cumulativeX;
+ property int cumulativeY;
+
+ function changeLabel(obj,txt){
+ obj.item.lbl = txt
+ }
+ function changeTileMode(obj,val,mode){
+ if (mode == "h")
+ obj.item.hTileMode = val;
+ else
+ obj.item.vTileMode = val;
+ }
+
+ Component{
+ id: borderImageComponent
+ SimpleNoBorder{
+ }
+ }
+ Column {
+ x: 20
+ y: 20
+ spacing: 30
+ Row {
+ Text{
+ id: topLabel
+ text: "Border Images with no borders set"
+ font.family: "Arial"
+ font.pointSize: 12
+ }
+ }
+
+ Row {
+ spacing: 20
+ Item{
+ id: image_0001
+ width: 70
+ height: 70
+ Loader{ id: ldr1; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr1,"H: Stretch")
+ changeTileMode(ldr1,BorderImage.Stretch,"h")
+ ldr1.item.hTileMode = BorderImage.Stretch
+ }
+ }
+ Item{
+ id: image_0002
+ width: 70
+ height: 70
+ Loader{ id: ldr2; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr2,"H: Repeat")
+ changeTileMode(ldr2,BorderImage.Repeat,"h")
+ }
+ }
+ Item{
+
+ id: image_0003
+ width: 70
+ height: 70
+ Loader{ id: ldr3; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr3,"H: Round")
+ changeTileMode(ldr1,BorderImage.Round,"h")
+ }
+ }
+ }
+ Row {
+ spacing: 20
+ Item{
+
+ id: image_0004
+ width: 70
+ height: 70
+ Loader{ id: ldr4; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr4,"V: Stretch")
+ changeTileMode(ldr4,BorderImage.Stretch,"v")
+ }
+ }
+ Item{
+ id: image_0005
+ width: 70
+ height: 70
+ Loader{ id: ldr5; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr5,"V: Repeat")
+ changeTileMode(ldr5,BorderImage.Repeat,"v")
+ }
+ }
+ Item{
+ id: image_0006
+ width: 70
+ height: 70
+ Loader{ id: ldr6; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr6,"H: Round")
+ changeTileMode(ldr6,BorderImage.Round,"v")
+ }
+ }
+ }
+ Row {
+ spacing: 20
+
+ Item{
+ id: image_0007
+ width: 70
+ height: 70
+ Loader{ id: ldr7; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr7,"H/V: Stretch")
+ changeTileMode(ldr7,BorderImage.Stretch,"v")
+ changeTileMode(ldr7,BorderImage.Stretch,"h")
+ }
+ }
+ Item{
+ id: image_0008
+ width: 70
+ height: 70
+ Loader{ id: ldr8; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr8,"H/V: Repeat")
+ changeTileMode(ldr8,BorderImage.Repeat,"v")
+ changeTileMode(ldr8,BorderImage.Repeat,"h")
+ }
+ }
+ Item{
+ id: image_0009
+ width: 70
+ height: 70
+ Loader{ id: ldr9; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr9,"H/V: Round")
+ changeTileMode(ldr9,BorderImage.Round,"v")
+ changeTileMode(ldr9,BorderImage.Round,"h")
+ }
+ }
+ }
+ Row {
+ spacing: 20
+
+ Item{
+ id: image_0010
+ width: 70
+ height: 70
+ Loader{ id: ldr10; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr10,"H/V: Stretch\nsmooth")
+ changeTileMode(ldr10,BorderImage.Stretch,"v")
+ changeTileMode(ldr10,BorderImage.Stretch,"h")
+ ldr10.item.smoothing = true
+ }
+ }
+ Item{
+ id: image_0011
+ width: 70
+ height: 70
+ Loader{ id: ldr11; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr11,"H/V: Repeat\nsmooth")
+ changeTileMode(ldr11,BorderImage.Repeat,"v")
+ changeTileMode(ldr11,BorderImage.Repeat,"h")
+ ldr11.item.smoothing = true
+ }
+ }
+ Item{
+ id: image_0012
+ width: 70
+ height: 70
+ Loader{ id: ldr12; sourceComponent: borderImageComponent }
+ Component.onCompleted: {
+ changeLabel(ldr12,"H/V: Round\nsmooth")
+ changeTileMode(ldr12,BorderImage.Round,"v")
+ changeTileMode(ldr12,BorderImage.Round,"h")
+ ldr10.item.smoothing = true
+ }
+ }
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_smoothed.qml b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_smoothed.qml
new file mode 100644
index 0000000000..9906586fc9
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_smoothed.qml
@@ -0,0 +1,175 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ property bool smoothing: true
+ Rectangle{
+ id: rect_0_0
+ width: 160
+ height: 160
+ x: 0
+ y: 0
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 1"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_1
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 1; border.top: 1
+ border.right: 1; border.bottom: 1
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_0_1
+ width: 160
+ height: 160
+ x: 160
+ y: 0
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 2"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_2
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 2; border.top: 2
+ border.right: 2; border.bottom: 2
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_1_0
+ width: 160
+ height: 160
+ x: 0
+ y: 160
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 3"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_3
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 3; border.top: 3
+ border.right: 3; border.bottom: 3
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_1_1
+ width: 160
+ height: 160
+ x: 160
+ y: 160
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 4"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_4
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 4; border.top: 4
+ border.right: 4; border.bottom: 4
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_2_0
+ width: 160
+ height: 160
+ x: 0
+ y: 320
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 5"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_5
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 5; border.top: 5
+ border.right: 5; border.bottom: 5
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_2_1
+ width: 160
+ height: 160
+ x: 160
+ y: 320
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 6"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_6
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 6; border.top: 6
+ border.right: 6; border.bottom: 6
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_3_0
+ width: 160
+ height: 160
+ x: 0
+ y: 480
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 7"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_7
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 7; border.top: 7
+ border.right: 7; border.bottom: 7
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_3_1
+ width: 160
+ height: 160
+ x: 160
+ y: 480
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 8"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_8
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 8; border.top: 8
+ border.right: 8; border.bottom: 8
+ anchors.centerIn: parent
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_horizontal.qml b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_horizontal.qml
new file mode 100644
index 0000000000..7151f3a958
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_horizontal.qml
@@ -0,0 +1,76 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ property bool smoothing: true
+ Rectangle{
+ id: rect_0_0
+ width: 160
+ height: 160
+ x: 0
+ y: 0
+
+ BorderImage {
+ id: borderImage_0
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 10; border.top: 10
+ border.right: 10; border.bottom: 10
+ horizontalTileMode: BorderImage.Stretch
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.top: borderImage_0.bottom
+ text: "mode: stretch"
+ z: 1
+ }
+ }
+ Rectangle{
+ id: rect_0_1
+ width: 160
+ height: 160
+ x: 160
+ y: 0
+
+ BorderImage {
+ id: borderImage_1
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 10; border.top: 10
+ border.right: 10; border.bottom: 10
+ horizontalTileMode: BorderImage.Repeat
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.top: borderImage_1.bottom
+ text: "mode: repeat"
+ z: 1
+ }
+ }
+ Rectangle{
+ id: rect_1_0
+ width: 160
+ height: 160
+ x: 0
+ y: 160
+
+ BorderImage {
+ id: borderImage_2
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 10; border.top: 10
+ border.right: 10; border.bottom: 10
+ horizontalTileMode: BorderImage.Round
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.top: borderImage_2.bottom
+ text: "mode: round"
+ z: 1
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_vertical.qml b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_vertical.qml
new file mode 100644
index 0000000000..02ec66cdf7
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_tiling_vertical.qml
@@ -0,0 +1,76 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ property bool smoothing: true
+ Rectangle{
+ id: rect_0_0
+ width: 160
+ height: 160
+ x: 0
+ y: 0
+
+ BorderImage {
+ id: borderImage_0
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 10; border.top: 10
+ border.right: 10; border.bottom: 10
+ verticalTileMode: BorderImage.Stretch
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.top: borderImage_0.bottom
+ text: "mode: stretch"
+ z: 1
+ }
+ }
+ Rectangle{
+ id: rect_0_1
+ width: 160
+ height: 160
+ x: 160
+ y: 0
+
+ BorderImage {
+ id: borderImage_1
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 10; border.top: 10
+ border.right: 10; border.bottom: 10
+ verticalTileMode: BorderImage.Repeat
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.top: borderImage_1.bottom
+ text: "mode: repeat"
+ z: 1
+ }
+ }
+ Rectangle{
+ id: rect_1_0
+ width: 160
+ height: 160
+ x: 0
+ y: 160
+
+ BorderImage {
+ id: borderImage_2
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 10; border.top: 10
+ border.right: 10; border.bottom: 10
+ verticalTileMode: BorderImage.Round
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.top: borderImage_2.bottom
+ text: "mode: round"
+ z: 1
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_unsmoothed.qml b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_unsmoothed.qml
new file mode 100644
index 0000000000..a19c203278
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/borderimages/borderimage_unsmoothed.qml
@@ -0,0 +1,178 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ property bool smoothing: false
+
+ Rectangle{
+ id: rect_0_0
+ width: 160
+ height: 160
+ x: 0
+ y: 0
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 1"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_1
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 1; border.top: 1
+ border.right: 1; border.bottom: 1
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_0_1
+ width: 160
+ height: 160
+ x: 160
+ y: 0
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 2"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_2
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 2; border.top: 2
+ border.right: 2; border.bottom: 2
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_1_0
+ width: 160
+ height: 160
+ x: 0
+ y: 160
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 3"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_3
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 3; border.top: 3
+ border.right: 3; border.bottom: 3
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_1_1
+ width: 160
+ height: 160
+ x: 160
+ y: 160
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 4"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_4
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 4; border.top: 4
+ border.right: 4; border.bottom: 4
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_2_0
+ width: 160
+ height: 160
+ x: 0
+ y: 320
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 5"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_5
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 5; border.top: 5
+ border.right: 5; border.bottom: 5
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_2_1
+ width: 160
+ height: 160
+ x: 160
+ y: 320
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 6"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_6
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 6; border.top: 6
+ border.right: 6; border.bottom: 6
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_3_0
+ width: 160
+ height: 160
+ x: 0
+ y: 480
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 7"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_7
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 7; border.top: 7
+ border.right: 7; border.bottom: 7
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle{
+ id: rect_3_1
+ width: 160
+ height: 160
+ x: 160
+ y: 480
+ Text {
+ anchors.verticalCenter: parent.TopLeft
+ text: "border size 8"
+ z: 1
+ }
+ BorderImage {
+ id: borderImage_8
+ smooth: smoothing
+ source: "../shared/sample_1.png"
+ width: 120; height: 120
+ border.left: 8; border.top: 8
+ border.right: 8; border.bottom: 8
+ anchors.centerIn: parent
+ }
+ }
+
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/gradients/gradients.qml b/tests/manual/scenegraph_lancelot/data/gradients/gradients.qml
new file mode 100644
index 0000000000..0b459423f1
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/gradients/gradients.qml
@@ -0,0 +1,219 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: r_0000
+ width: 320
+ height: 480
+ color: "white"
+
+ property int standardRectWidth: 48
+ property int standardRectHeight: 48
+
+ Text{
+ z: 1
+ text: "simple gradients"
+ font.family: "Arial"
+ font.pointSize: 20
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter: parent.Center
+ anchors.horizontalCenter : parent.horizontalCenter
+ }
+
+ Rectangle{
+ id: r_0001
+ x: 0
+ y: 0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "red"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0001.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0002
+ x: r_0001.x + standardRectWidth
+ y: 0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0002.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0003
+ x: r_0002.x + standardRectWidth
+ y: 0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0003.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0004
+ x: r_0003.x + standardRectWidth
+ y: 0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0004.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0005
+ x: r_0004.x + standardRectWidth
+ y: 0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0005.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0006
+ x: r_0005.x + standardRectWidth
+ y: 0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0006.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0007
+ x: r_0001.x
+ y: standardRectHeight
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0007.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0008
+ x: r_0002.x
+ y: standardRectHeight
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0008.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0009
+ x: r_0003.x
+ y: standardRectHeight
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0009.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0010
+ x: r_0004.x
+ y: standardRectHeight
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0010.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0011
+ x: r_0005.x
+ y: standardRectHeight
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "pink"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0011.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+ Rectangle{
+ id: r_0012
+ x: r_0006.x
+ y: standardRectHeight
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "gold"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0012.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ }
+
+ Rectangle{
+ id: r_0013
+ x: 0
+ y: (standardRectHeight * 2)
+ color: "green"
+ width: 3 * standardRectWidth
+ height: 3 * standardRectHeight
+ gradient: Gradient{
+ GradientStop{ position: 0.0; color: "yellow"}
+ GradientStop{ position: 0.25; color: "orange"}
+ GradientStop{ position: 0.75; color: "purple"}
+ GradientStop{ position: 1.0; color: "blue"}
+ }
+ }
+ Rectangle{
+ id: r_0014
+ x: 3 * standardRectWidth
+ y: (standardRectHeight * 2)
+ color: "red"
+ width: 3 * standardRectWidth
+ height: 3 * standardRectHeight
+ gradient: Gradient{
+ GradientStop{ position: 0.0; color: "blue"}
+ GradientStop{ position: 0.25; color: "purple"}
+ GradientStop{ position: 0.75; color: "red"}
+ GradientStop{ position: 1.0; color: "violet"}
+ }
+ }
+ Rectangle{
+ id: r_00015
+ x: 0
+ y: 5 * standardRectHeight
+ width: 6 * standardRectWidth
+ height: 6 * standardRectHeight
+ color: "black"
+ gradient: Gradient{
+ GradientStop{ position: 0.0; color: "cyan"}
+ GradientStop{ position: 0.1; color: "purple"}
+ GradientStop{ position: 0.2; color: "red"}
+ GradientStop{ position: 0.3; color: "yellow"}
+ GradientStop{ position: 0.4; color: "blue"}
+ GradientStop{ position: 0.5; color: "white"}
+ GradientStop{ position: 0.55; color: "red"}
+ GradientStop{ position: 0.6; color: "violet"}
+ GradientStop{ position: 0.7; color: "blue"}
+ GradientStop{ position: 0.8; color: "green"}
+ GradientStop{ position: 0.9; color: "red"}
+ GradientStop{ position: 1.0; color: "violet"}
+ }
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/images/fill_mode.qml b/tests/manual/scenegraph_lancelot/data/images/fill_mode.qml
new file mode 100644
index 0000000000..d391cd73f9
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/fill_mode.qml
@@ -0,0 +1,165 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Rectangle{
+ id: rect0_0
+ width: 160
+ height: 160
+ x: 0
+ y: 0
+ Text{
+ text: "Stretch"
+ x: 20
+ y: 20
+ color: "red"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ z: 1
+ }
+ Image{
+ id: bwLinear1
+ width: 160
+ height: 160
+ source: "../shared/bw_1535x2244.jpg"
+ sourceSize.width: 1535
+ sourceSize.height: 2244
+ }
+ }
+ Rectangle{
+ id: rect0_1
+ width: 160
+ height: 160
+ x: 180
+ y: 0
+ Text{
+ text: "Preserve\naspect\nfit"
+ x: 20
+ y: 20
+ color: "red"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ z: 1
+ }
+ Image{
+ id: bwLinear2
+ width: 160
+ height: 160
+ source: "../shared/bw_1535x2244.jpg"
+ fillMode: Image.PreserveAspectFit
+ sourceSize.width: 1535
+ sourceSize.height: 2244
+ }
+ }
+ Rectangle{
+ id: rect1_0
+ width: 160
+ height: 160
+ x: 0
+ y: 160
+ Text{
+ text: "Preserve\naspect\ncrop"
+ x: 20
+ y: 20
+ color: "red"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ z: 1
+ }
+ Image{
+ id: bwLinear3
+ width: 160
+ height: 160
+ source: "../shared/bw_1535x2244.jpg"
+ fillMode: Image.PreserveAspectCrop
+ sourceSize.width: 1535
+ sourceSize.height: 2244
+ }
+
+ }
+ Rectangle{
+ id: rect1_1
+ width: 160
+ height: 160
+ x: 180
+ y: 160
+ Text{
+ text: "Tile"
+ x: 20
+ y: 20
+ color: "red"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ z: 1
+ }
+ Image{
+ id: bwLinear4
+ width: 160
+ height: 160
+ source: "../shared/bw_1535x2244.jpg"
+ fillMode: Image.Tile
+ sourceSize.width: 1535
+ sourceSize.height: 2244
+ }
+ }
+
+ Rectangle{
+ id: rect2_0
+ width: 160
+ height: 160
+ x: 0
+ y: 320
+ Text{
+ text: "Tile\nvertically"
+ x: 20
+ y: 20
+ color: "red"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ z: 1
+ }
+ Image{
+ id: bwLinear5
+ width: 160
+ height: 160
+ source: "../shared/bw_1535x2244.jpg"
+ fillMode: Image.TileVertically
+ sourceSize.width: 1535
+ sourceSize.height: 2244
+ }
+ }
+ Rectangle{
+ id: rect2_1
+ width: 160
+ height: 160
+ x: 180
+ y: 320
+ Text{
+ text: "Tile horizontally"
+ x: 20
+ y: 20
+ color: "red"
+ font.family: "Helvetica"
+ font.pointSize: 24
+ z: 1
+ }
+ Image{
+ id: bwLinear6
+ width: 160
+ height: 160
+ source: "../shared/bw_1535x2244.jpg"
+ fillMode: Image.TileHorizontally
+ sourceSize.width: 1535
+ sourceSize.height: 2244
+ }
+ }
+
+
+
+
+
+
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/images/images_1.qml b/tests/manual/scenegraph_lancelot/data/images/images_1.qml
new file mode 100644
index 0000000000..80a416f08d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/images_1.qml
@@ -0,0 +1,124 @@
+import QtQuick 2.0
+
+Rectangle{
+ id: topLevelItem
+ height: 480
+ width: 320
+
+ property string imageSize: "72x96"
+
+ ListModel{
+ id: imageModel1
+ ListElement{
+ name: "red"
+ size: "72x96"
+ hex: "ff0000"
+ }
+ ListElement{
+ name: "green"
+ size: "72x96"
+ hex: "00ff00"
+ }
+ ListElement{
+ name: "blue"
+ size: "72x96"
+ hex: "0000ff"
+ }
+ ListElement{
+ name: "cyan"
+ size: "72x96"
+ hex: "00ffff"
+ }
+ ListElement{
+ name: "orange"
+ size: "72x96"
+ hex: "ffa500"
+ }
+ ListElement{
+ name: "violet"
+ size: "72x96"
+ hex: "ee82ee"
+ }
+ ListElement{
+ name: "yellow"
+ size: "72x96"
+ hex: "ffff00"
+ }
+ }
+ ListModel{
+ id: imageModel2
+ ListElement{
+ name: "blue"
+ size: "72x96"
+ hex: "0000ff"
+ }
+ ListElement{
+ name: "cyan"
+ size: "72x96"
+ hex: "00ffff"
+ }
+ ListElement{
+ name: "violet"
+ size: "72x96"
+ hex: "ee82ee"
+ }
+ ListElement{
+ name: "orange"
+ size: "72x96"
+ hex: "ffa500"
+ }
+ ListElement{
+ name: "yellow"
+ size: "72x96"
+ hex: "ffff00"
+ }ListElement{
+ name: "green"
+ size: "72x96"
+ hex: "00ff00"
+ }
+ ListElement{
+ name: "red"
+ size: "72x96"
+ hex: "ff0000"
+ }
+ }
+ Component{
+ id: colorImageDelegate
+ Column{
+ Text{ font.family: "Arial"; font.pointSize: 8; text: name +" "+size+" Hex: "+hex }
+ Image{
+ source: "../shared/"+name+"_"+imageSize+".png"
+ }
+ }
+ }
+ Rectangle{
+ id: rect1
+ x: 0
+ y: 0
+ width: 180
+ height: 800
+ }
+ Rectangle{
+ id: rect2
+ x: 181
+ y: 0
+ width: 180
+ height: 800
+ }
+ ListView{
+ id: lv1
+ x: 0
+ y: 0
+ property string image_size: imageSize
+ model: imageModel1
+ delegate: colorImageDelegate
+ anchors.fill: rect1
+ }
+ ListView{
+ id: lv2
+ property string image_size: imageSize
+ model: imageModel2
+ delegate: colorImageDelegate
+ anchors.fill: rect2
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/images_2.qml b/tests/manual/scenegraph_lancelot/data/images/images_2.qml
new file mode 100644
index 0000000000..680135a5ec
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/images_2.qml
@@ -0,0 +1,124 @@
+import QtQuick 2.0
+
+Rectangle{
+ id: topLevelItem
+ height: 480
+ width: 320
+
+ property string imageSize: "72x96"
+
+ ListModel{
+ id: imageModel1
+ ListElement{
+ name: "red"
+ size: "72x96"
+ hex: "ff0000"
+ }
+ ListElement{
+ name: "green"
+ size: "72x96"
+ hex: "00ff00"
+ }
+ ListElement{
+ name: "blue"
+ size: "72x96"
+ hex: "0000ff"
+ }
+ ListElement{
+ name: "cyan"
+ size: "72x96"
+ hex: "00ffff"
+ }
+ ListElement{
+ name: "orange"
+ size: "72x96"
+ hex: "ffa500"
+ }
+ ListElement{
+ name: "violet"
+ size: "72x96"
+ hex: "ee82ee"
+ }
+ ListElement{
+ name: "yellow"
+ size: "72x96"
+ hex: "ffff00"
+ }
+ }
+ ListModel{
+ id: imageModel2
+ ListElement{
+ name: "blue"
+ size: "72x96"
+ hex: "0000ff"
+ }
+ ListElement{
+ name: "cyan"
+ size: "72x96"
+ hex: "00ffff"
+ }
+ ListElement{
+ name: "violet"
+ size: "72x96"
+ hex: "ee82ee"
+ }
+ ListElement{
+ name: "orange"
+ size: "72x96"
+ hex: "ffa500"
+ }
+ ListElement{
+ name: "yellow"
+ size: "72x96"
+ hex: "ffff00"
+ }ListElement{
+ name: "green"
+ size: "72x96"
+ hex: "00ff00"
+ }
+ ListElement{
+ name: "red"
+ size: "72x96"
+ hex: "ff0000"
+ }
+ }
+ Component{
+ id: colorImageDelegate
+ Column{
+ Text{ font.family: "Arial"; font.pointSize: 8; text: name +" "+size+" Hex: "+hex }
+ Image{
+ source: "../shared/"+name+"_"+imageSize+".png"
+ }
+ }
+ }
+ Rectangle{
+ id: rect1
+ x: 0
+ y: 0
+ width: 180
+ height: 800
+ }
+ Rectangle{
+ id: rect2
+ x: 181
+ y: 0
+ width: 180
+ height: 800
+ }
+ ListView{
+ id: lv1
+ x: 0
+ y: 0
+ property string image_size: imageSize
+ model: imageModel1
+ delegate: colorImageDelegate
+ anchors.fill: rect1
+ }
+ ListView{
+ id: lv2
+ property string image_size: imageSize
+ model: imageModel2
+ delegate: colorImageDelegate
+ anchors.fill: rect2
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/jpeg_full.qml b/tests/manual/scenegraph_lancelot/data/images/jpeg_full.qml
new file mode 100644
index 0000000000..49a6507b4b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/jpeg_full.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ Image{
+ width: 320
+ height: 480
+ source: "../shared/col320x480.jpg"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/jpeg_scaled.qml b/tests/manual/scenegraph_lancelot/data/images/jpeg_scaled.qml
new file mode 100644
index 0000000000..26b54b0b0a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/jpeg_scaled.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ Image{
+ x: 0
+ y: 0
+ width: 160
+ height: 240
+ source: "../shared/col320x480.jpg"
+ }
+
+ Image{
+ x: 180
+ y: 20
+ width: 113
+ height: 199
+ source: "../shared/col320x480.jpg"
+ }
+
+ Image{
+ x: 160
+ y: 240
+ sourceSize.width: 160
+ sourceSize.height: 240
+ source: "../shared/col320x480.jpg"
+ }
+
+ Image{
+ x: 20
+ y: 260
+ sourceSize.width: 113
+ sourceSize.height: 199
+ source: "../shared/col320x480.jpg"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_1.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_1.qml
new file mode 100644
index 0000000000..4a215fb384
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_1.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.1"
+ z: 1
+ }
+
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.1
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_2.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_2.qml
new file mode 100644
index 0000000000..458b1f84e4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_2.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.2"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.2
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_3.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_3.qml
new file mode 100644
index 0000000000..98d5c8089b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_3.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.3"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.3
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_4.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_4.qml
new file mode 100644
index 0000000000..b6987cc3a4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_4.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.4"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.4
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_5.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_5.qml
new file mode 100644
index 0000000000..b4433cd2f9
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_5.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.5"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.5
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_6.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_6.qml
new file mode 100644
index 0000000000..3deeccd579
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_6.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.6"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.6
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_7.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_7.qml
new file mode 100644
index 0000000000..e7ae7ea95b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_7.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.7"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.7
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_8.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_8.qml
new file mode 100644
index 0000000000..bce6d49d70
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_8.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.8"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.8
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_9.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_9.qml
new file mode 100644
index 0000000000..fd8b947b55
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_0_9.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 0.9"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 0.9
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/linear_smooth_1_0.qml b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_1_0.qml
new file mode 100644
index 0000000000..ea542bbb5d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/linear_smooth_1_0.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: true
+ Text{
+ text: "scale 1.0"
+ z: 1
+ }
+ Image{
+ width: 320
+ height: 480
+ id: bwLinear
+ source: "../shared/bw_1535x2244.jpg"
+ anchors.fill: parent
+ sourceSize.height: 2244
+ sourceSize.width: 1535
+ scale: 1.0
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/overlap.qml b/tests/manual/scenegraph_lancelot/data/images/overlap.qml
new file mode 100644
index 0000000000..e45e5f96df
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/overlap.qml
@@ -0,0 +1,58 @@
+import QtQuick 2.0
+
+Image {
+ width: 320
+ height: 480
+ source: "../shared/winter.png"
+ Grid {
+ columns: 2
+ Item { width: 35; height: 50 }
+ Row {
+ id: row_0000
+ Repeater {
+ model: 7
+ Rectangle {
+ width: 35
+ height: 50
+ color: Qt.rgba(index & 1 ? 0.75 : 0.85, 1, 1, 0.75)
+ Text { font.pointSize: 8; anchors.centerIn: parent; text: "Col " + (index + 1) }
+ }
+ }
+ }
+ Column {
+ Repeater {
+ model: 8
+ Rectangle {
+ width: 35
+ height: 50
+ color: Qt.rgba(1, 1, index & 1 ? 0.75 : 0.85, 0.75)
+ Text { font.pointSize: 8; anchors.centerIn: parent; text: "Row " + (index + 1) }
+ }
+ }
+ }
+ Grid {
+ id: grid_0001
+ columns: 7
+ rows: 8
+ opacity: 0.5
+ Repeater {
+ id: repeater_0001
+ model: 7 * 8
+ onActiveFocusChanged: console.debug("changed")
+
+ Rectangle {
+ id: rect_0001
+ width: 35
+ height: 50
+ radius: 10
+ gradient: Gradient {
+ GradientStop { position: 0; color: "white" }
+ GradientStop { position: 1; color: "blue" }
+ }
+ border.width: 2
+ border.color: "black"
+ }
+ }
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/tiling.qml b/tests/manual/scenegraph_lancelot/data/images/tiling.qml
new file mode 100644
index 0000000000..785186221d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/tiling.qml
@@ -0,0 +1,102 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 320
+ height: 480
+
+ property bool useSmooth: false
+
+ property variant fillModes: [
+ Image.Stretch,
+ Image.PreserveAspectFit,
+ Image.PreserveAspectCrop,
+ Image.Tile,
+ Image.TileVertically,
+ Image.TileHorizontally
+ ]
+
+ Grid {
+ columns: 2
+ rows: 2
+
+ Grid {
+ width: 160
+ height: 240
+ columns: 2
+ rows: 3
+ Repeater {
+ model: 6
+ Image {
+ width: 80
+ height: 80
+ source: "../shared/tile.png"
+ fillMode: fillModes[index]
+ }
+ }
+ }
+
+ Grid {
+ width: 160
+ height: 240
+ columns: 2
+ rows: 3
+ Repeater {
+ model: 6
+ Image {
+ width: 80
+ height: 80
+ source: "../shared/tile.png"
+ fillMode: fillModes[index]
+ smooth: true
+ }
+ }
+ }
+
+ Grid {
+ width: 160
+ height: 240
+ columns: 2
+ rows: 3
+ Repeater {
+ model: 6
+ Item {
+ width: 80
+ height: 80
+ clip: true
+ Image {
+ width: 80
+ height: 80
+ source: "../shared/tile.png"
+ fillMode: fillModes[index]
+ scale: 1.5
+ }
+ }
+ }
+ }
+
+ Grid {
+ width: 160
+ height: 240
+ columns: 2
+ rows: 3
+ Repeater {
+ model: 6
+ Item {
+ width: 80
+ height: 80
+ clip: true
+ Image {
+ width: 80
+ height: 80
+ source: "../shared/tile.png"
+ fillMode: fillModes[index]
+ smooth: true
+ scale: 1.5
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/images/transform.qml b/tests/manual/scenegraph_lancelot/data/images/transform.qml
new file mode 100644
index 0000000000..5a02724585
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/images/transform.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "white"
+ Image {
+ id: wooohooo
+ x: 50
+ y: 120
+ width: 256
+ height: 240
+ source: "../shared/winter.png"
+ rotation: 30
+ scale: 1.25
+ transform: [
+ Rotation { origin { x: 128; y: 120 } axis { x: 0; y: 1; z: 0 } angle: 60 }
+ , Translate { x: 10; y: 0 }
+ ]
+ Rectangle {
+ width: 50
+ height: 50
+ color: "steelBlue"
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent
+ drag.axis: Drag.XAndYAxis
+ drag.minimumX: 0
+ drag.maximumX: wooohooo.width - parent.width
+ drag.minimumY: 0
+ drag.maximumY: wooohooo.height - parent.height
+ }
+ }
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/opacity/opacity.qml b/tests/manual/scenegraph_lancelot/data/opacity/opacity.qml
new file mode 100644
index 0000000000..05adf2cbd9
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/opacity/opacity.qml
@@ -0,0 +1,191 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: topRect
+ width: 320
+ height: 480
+
+ Row{
+ id: row_0000
+ anchors.top: parent.top
+ Row{
+ Rectangle{
+ id: rect_0001
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "red"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0002
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "blue"
+ anchors.top: rect_0001.Center
+ opacity: 0.1
+ Text{
+ width: parent.width
+ text: "opac. 0.1"
+ anchors.top: parent.top
+ }
+ }
+ }
+ Row{
+ Rectangle{
+ id: rect_0003
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "yellow"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0004
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "green"
+ anchors.top: rect_0003.Center
+ opacity: 0.2
+ Text{
+ width: parent.width
+ text: "opac. 0.2"
+ anchors.top: parent.top
+ }
+ }
+ }
+ }
+ Row{
+ id: row_0001
+ anchors.top: row_0000.bottom
+ Row{
+ Rectangle{
+ id: rect_0005
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "black"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0006
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "white"
+ anchors.top: rect_0005.Center
+ opacity: 0.3
+ Text{
+ width: parent.width
+ text: "opac. 0.3"
+ anchors.top: parent.top
+ }
+ }
+ }
+ Row{
+ Rectangle{
+ id: rect_0007
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "violet"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0008
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "indigo"
+ anchors.top: rect_0007.Center
+ opacity: 0.4
+ Text{
+ text: "opac. 0.4"
+ anchors.top: parent.top
+ }
+ }
+ }
+ }
+ Row{
+ id: row_0002
+ anchors.top: row_0001.bottom
+ Row{
+ Rectangle{
+ id: rect_0009
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "light grey"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0010
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "cyan"
+ anchors.top: rect_0009.Center
+ opacity: 0.5
+ Text{
+ text: "opac. 0.5"
+ anchors.top: parent.top
+ }
+ }
+ }
+ Row{
+ Rectangle{
+ id: rect_0011
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "orange"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0012
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "pink"
+ anchors.top: rect_0011.Center
+ opacity: 0.6
+ Text{
+ text: "opac. 0.6"
+ anchors.top: parent.top
+ }
+ }
+ }
+ }
+ Row{
+ id: row_0003
+ anchors.top: row_0002.bottom
+ Rectangle{
+ id: rect_0013
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "brown"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0014
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "light green"
+ anchors.top: rect_0013.Center
+ opacity: 0.7
+ Text{
+ text: "opac. 0.7"
+ anchors.top: parent.top
+ }
+ }
+ Rectangle{
+ id: rect_0015
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "dark blue"
+ anchors.top: parent.top
+ }
+ Rectangle{
+ id: rect_0016
+ width: topRect.width / 4
+ height: topRect.height / 4
+ color: "light blue"
+ anchors.top: rect_0015.Center
+ opacity: 0.8
+ Text{
+ text: "opac. 0.8"
+ anchors.top: parent.top
+ }
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/rectangles/rectangles.qml b/tests/manual/scenegraph_lancelot/data/rectangles/rectangles.qml
new file mode 100644
index 0000000000..e610e281c5
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/rectangles/rectangles.qml
@@ -0,0 +1,490 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: r_0000
+ width: 320
+ height: 480
+ color: "white"
+
+ property int standardRectWidth: 32
+ property int standardRectHeight: 48
+ property int textAnnotationXOffset: 32
+ property int textAnnotationYOffset: 10
+ property int borderSize: 2
+ property int yPlacementRow_0: 0
+ property int yPlacementRow_1: 48
+ property int yPlacementRow_2: 96
+ property int yPlacementRow_3: 144
+ property int yPlacementRow_4: 192
+ property int yPlacementRow_5: 240
+ property int yPlacementRow_6: 288
+ property int yPlacementRow_7: 336
+ property int yPlacementRow_8: 384
+ property int yPlacementRow_9: 432
+ property int xPlacementCol_0: 0
+ property int xPlacementCol_1: standardRectWidth
+ property int xPlacementCol_2: standardRectWidth*2
+ property int xPlacementCol_3: standardRectWidth*3
+ property int xPlacementCol_4: standardRectWidth*4
+ property int xPlacementCol_5: standardRectWidth*5
+ property int xPlacementCol_6: standardRectWidth*6
+ property int xPlacementCol_7: standardRectWidth*7
+ property int xPlacementCol_8: standardRectWidth*8
+ property int xPlacementCol_9: standardRectWidth*9
+
+ Component{
+ id: annotation
+ Text{
+ width: 160
+ height: 240
+ x: textAnnotationXOffset
+ y: textAnnotationYOffset
+ z: 1
+ text: annotationTextLabel
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "white"
+ font.bold: true
+ }
+ }
+ //Test basic color
+ Rectangle{ smooth: false
+ id: r_0001
+ x: 0
+ y: yPlacementRow_0
+ width: r_0000.standardRectWidth
+ height: r_0000.standardRectHeight
+ color: "red"
+ }
+ Rectangle{ smooth: false
+ id: r_0002
+ x: r_0001.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ }
+ Rectangle{ smooth: false
+ id: r_0003
+ x: r_0002.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ }
+ Rectangle{ smooth: false
+ id: r_0004
+ x: r_0003.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ }
+ Rectangle {
+ id: r_0005
+ x: r_0004.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ }
+ Rectangle{ smooth: false
+ id: r_0006
+ x: r_0005.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ }
+ Rectangle{ smooth: false
+ id: r_0007
+ x: r_0006.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ }
+ Rectangle{ smooth: false
+ id: r_0008
+ x: r_0007.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ }
+ Rectangle{ smooth: false
+ id: r_0009
+ x: r_0008.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ }
+ Rectangle{ smooth: false
+ id: r_0010
+ x: r_0009.x + standardRectWidth
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ }
+ Loader{
+ sourceComponent: annotation;
+ property string annotationTextLabel: "BASIC COLOR RECTANGLES";
+ property int textAnnotationXOffset: 4;
+ property int textAnnotationYOffset: 10;
+ }
+ //Test borders
+ Rectangle{ smooth: false
+ id: r_0011
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "red"
+ border.width: borderSize
+ border.color: "orange"
+ anchors.horizontalCenter: r_0001.horizontalCenter
+ anchors.top: r_0001.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0012
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ border.width: borderSize
+ border.color: "yellow"
+ anchors.horizontalCenter: r_0002.horizontalCenter
+ anchors.top: r_0002.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0013
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ border.width: borderSize
+ border.color: "green"
+ anchors.horizontalCenter: r_0003.horizontalCenter
+ anchors.top: r_0003.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0014
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ border.width: borderSize
+ border.color: "blue"
+ anchors.horizontalCenter: r_0004.horizontalCenter
+ anchors.top: r_0004.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0015
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ border.width: borderSize
+ border.color: "indigo"
+ anchors.horizontalCenter: r_0005.horizontalCenter
+ anchors.top: r_0005.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0016
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ border.width: borderSize
+ border.color: "violet"
+ anchors.horizontalCenter: r_0006.horizontalCenter
+ anchors.top: r_0006.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0017
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ border.width: borderSize
+ border.color: "black"
+ anchors.horizontalCenter: r_0007.horizontalCenter
+ anchors.top: r_0007.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0018
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ border.width: borderSize
+ border.color: "dark grey"
+ anchors.horizontalCenter: r_0008.horizontalCenter
+ anchors.top: r_0008.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0019
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ border.width: borderSize
+ border.color: "light grey"
+ anchors.horizontalCenter: r_0009.horizontalCenter
+ anchors.top: r_0009.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0020
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ border.width: borderSize
+ border.color: "red"
+ anchors.horizontalCenter: r_0010.horizontalCenter
+ anchors.top: r_0010.bottom
+ }
+ Loader{
+ sourceComponent: annotation;
+ property string annotationTextLabel: "BASIC COLOR BORDER";
+ property int textAnnotationXOffset: 4;
+ property int textAnnotationYOffset: 10 + standardRectHeight;
+ }
+ //Test Gradients
+ Rectangle{ smooth: false
+ id: r_0021
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "red"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0021.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0001.horizontalCenter
+ anchors.top: r_0011.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0022
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0022.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0002.horizontalCenter
+ anchors.top: r_0012.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0023
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0023.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0003.horizontalCenter
+ anchors.top: r_0013.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0024
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0024.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0004.horizontalCenter
+ anchors.top: r_0014.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0025
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0025.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0005.horizontalCenter
+ anchors.top: r_0015.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0026
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0026.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0006.horizontalCenter
+ anchors.top: r_0016.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0027
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0027.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0007.horizontalCenter
+ anchors.top: r_0017.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0028
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0028.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0008.horizontalCenter
+ anchors.top: r_0018.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0029
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0029.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0009.horizontalCenter
+ anchors.top: r_0019.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0030
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0030.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+ anchors.horizontalCenter: r_0010.horizontalCenter
+ anchors.top: r_0020.bottom
+ }
+ Loader{
+ sourceComponent: annotation;
+ property string annotationTextLabel: "BASIC COLOR GRADIENT";
+ property int textAnnotationXOffset: 4;
+ property int textAnnotationYOffset: 10 + (2*standardRectHeight);
+ }
+ //Test radius
+ Rectangle{ smooth: false
+ id: r_0031
+ x: 0
+ y: 97
+ width: r_0000.standardRectWidth
+ height: r_0000.standardRectHeight
+ color: "red"
+ radius: 1
+ anchors.horizontalCenter: r_0001.horizontalCenter
+ anchors.top: r_0021.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0032
+ x: r_0031.x + standardRectWidth
+ y: r_0031.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ radius: 2
+ anchors.horizontalCenter: r_0002.horizontalCenter
+ anchors.top: r_0022.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0033
+ x: r_0032.x + standardRectWidth
+ y: r_0032.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ radius: 3
+ anchors.horizontalCenter: r_0003.horizontalCenter
+ anchors.top: r_0023.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0034
+ x: r_0033.x + standardRectWidth
+ y: r_0033.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ radius: 4
+ anchors.horizontalCenter: r_0004.horizontalCenter
+ anchors.top: r_0024.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0035
+ x: r_0034.x + standardRectWidth
+ y: r_0034.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ radius: 5
+ anchors.horizontalCenter: r_0005.horizontalCenter
+ anchors.top: r_0025.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0036
+ x: r_0035.x + standardRectWidth
+ y: r_0035.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ radius: 6
+ anchors.horizontalCenter: r_0006.horizontalCenter
+ anchors.top: r_0026.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0037
+ x: r_0036.x + standardRectWidth
+ y: r_0036.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ radius: 7
+ anchors.horizontalCenter: r_0007.horizontalCenter
+ anchors.top: r_0027.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0038
+ x: r_0037.x + standardRectWidth
+ y: r_0037.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ radius: 8
+ anchors.horizontalCenter: r_0008.horizontalCenter
+ anchors.top: r_0028.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0039
+ x: r_0038.x + standardRectWidth
+ y: r_0038.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ radius: 9
+ anchors.horizontalCenter: r_0009.horizontalCenter
+ anchors.top: r_0029.bottom
+ }
+ Rectangle{ smooth: false
+ id: r_0040
+ x: r_0039.x + standardRectWidth
+ y: r_0039.y
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ radius: 10
+ anchors.horizontalCenter: r_0010.horizontalCenter
+ anchors.top: r_0030.bottom
+ }
+ Loader{
+ sourceComponent: annotation;
+ property string annotationTextLabel: "BASIC RADIUS";
+ property int textAnnotationXOffset: 4;
+ property int textAnnotationYOffset: 10 + (3*standardRectHeight);
+ }
+
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/rectangles/rectangles_smoothed.qml b/tests/manual/scenegraph_lancelot/data/rectangles/rectangles_smoothed.qml
new file mode 100644
index 0000000000..06791a1b51
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/rectangles/rectangles_smoothed.qml
@@ -0,0 +1,586 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: r_0000
+ width: 320
+ height: 480
+ color: "white"
+
+ property int standardRectWidth: 22
+ property int standardRectHeight: 40
+ property int xOffsetPlacement: 10
+ property int yOffsetPlacement: 18
+ property int borderSize: 2
+ property int yPlacementRow_0: 0
+ property int yPlacementRow_1: (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_2: yPlacementRow_1 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_3: yPlacementRow_2 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_4: yPlacementRow_3 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_5: yPlacementRow_4 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_6: yPlacementRow_5 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_7: yPlacementRow_6 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_8: yPlacementRow_7 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_9: yPlacementRow_8 + (standardRectHeight+yOffsetPlacement)
+ property int xPlacementCol_0: 0
+ property int xPlacementCol_1: xPlacementCol_0 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_2: xPlacementCol_1 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_3: xPlacementCol_2 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_4: xPlacementCol_3 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_5: xPlacementCol_4 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_6: xPlacementCol_5 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_7: xPlacementCol_6 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_8: xPlacementCol_7 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_9: xPlacementCol_8 + (standardRectWidth+xOffsetPlacement)
+ property bool smoothingOn: true
+ property real scaleFactor: 1.2
+
+
+ //Test basic color
+ Rectangle{
+ id: r_0001
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_0
+ y: yPlacementRow_0
+ width: r_0000.standardRectWidth
+ height: r_0000.standardRectHeight
+ color: "red"
+ }
+ Rectangle{
+ id: r_0002
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_1
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ }
+ Rectangle{
+ id: r_0003
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_2
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ }
+ Rectangle{
+ id: r_0004
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_3
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ }
+ Rectangle {
+ id: r_0005
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_4
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ }
+ Rectangle{
+ id: r_0006
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_5
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ }
+ Rectangle{
+ id: r_0007
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_6
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ }
+ Rectangle{
+ id: r_0008
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_7
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ }
+ Rectangle{
+ id: r_0009
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_8
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ }
+ Rectangle{
+ id: r_0010
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_9
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ }
+ Text{
+ id: annotation_row0
+ z: 1
+ text: "SMOOTHED SCALED RECTANGLES"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0001.verticalCenter
+ }
+
+ //Test borders
+ Rectangle{
+ id: r_0011
+ x: xPlacementCol_0
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "red"
+ border.width: borderSize
+ border.color: "orange"
+
+ }
+ Rectangle{
+ id: r_0012
+ x: xPlacementCol_1
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ border.width: borderSize
+ border.color: "yellow"
+
+ }
+ Rectangle{
+ id: r_0013
+ x: xPlacementCol_2
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ border.width: borderSize
+ border.color: "green"
+
+ }
+ Rectangle{
+ id: r_0014
+ x: xPlacementCol_3
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ border.width: borderSize
+ border.color: "blue"
+
+ }
+ Rectangle{
+ id: r_0015
+ x: xPlacementCol_4
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ border.width: borderSize
+ border.color: "indigo"
+
+ }
+ Rectangle{
+ id: r_0016
+ x: xPlacementCol_5
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ border.width: borderSize
+ border.color: "violet"
+
+ }
+ Rectangle{
+ id: r_0017
+ x: xPlacementCol_6
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ border.width: borderSize
+ border.color: "black"
+
+ }
+ Rectangle{
+ id: r_0018
+ x: xPlacementCol_7
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ border.width: borderSize
+ border.color: "dark grey"
+
+ }
+ Rectangle{
+ id: r_0019
+ x: xPlacementCol_8
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ border.width: borderSize
+ border.color: "light grey"
+
+ }
+ Rectangle{
+ id: r_0020
+ x: xPlacementCol_9
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ border.width: borderSize
+ border.color: "red"
+
+ }
+ Text{
+ id: annotation_row1
+ z: 1
+ text: "SMOOTHED SCALED BORDERS"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0011.verticalCenter
+ }
+
+ //Test Gradients
+ Rectangle{
+ id: r_0021
+ x: xPlacementCol_0
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "red"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0021.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0022
+ x: xPlacementCol_1
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0022.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0023
+ x: xPlacementCol_2
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0023.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0024
+ x: xPlacementCol_3
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0024.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0025
+ x: xPlacementCol_4
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0025.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0026
+ x: xPlacementCol_5
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0026.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0027
+ x: xPlacementCol_6
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0027.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0028
+ x: xPlacementCol_7
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0028.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0029
+ x: xPlacementCol_8
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0029.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0030
+ x: xPlacementCol_9
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0030.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Text{
+ id: annotation_row2
+ z: 1
+ text: "SMOOTHED SCALED GRADIENTS"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0021.verticalCenter
+ }
+
+ //Test radius
+ Rectangle{
+ id: r_0031
+ x: xPlacementCol_0
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: r_0000.standardRectWidth
+ height: r_0000.standardRectHeight
+ color: "red"
+ radius: 1
+
+ }
+ Rectangle{
+ id: r_0032
+ x: xPlacementCol_1
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ radius: 2
+
+ }
+ Rectangle{
+ id: r_0033
+ x: xPlacementCol_2
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ radius: 3
+
+ }
+ Rectangle{
+ id: r_0034
+ x: xPlacementCol_3
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ radius: 4
+
+ }
+ Rectangle{
+ id: r_0035
+ x: xPlacementCol_4
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ radius: 5
+
+ }
+ Rectangle{
+ id: r_0036
+ x: xPlacementCol_5
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ radius: 6
+
+ }
+ Rectangle{
+ x: xPlacementCol_6
+ y: yPlacementRow_3
+ id: r_0037
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ radius: 7
+
+ }
+ Rectangle{
+ x: xPlacementCol_7
+ y: yPlacementRow_3
+ id: r_0038
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ radius: 8
+
+ }
+ Rectangle{
+ x: xPlacementCol_8
+ y: yPlacementRow_3
+ id: r_0039
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ radius: 9
+
+ }
+ Rectangle{
+ x: xPlacementCol_9
+ y: yPlacementRow_3
+ id: r_0040
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ radius: 10
+
+ }
+ Text{
+ id: annotation_row3
+ z: 1
+ text: "SMOOTHED SCALED RADIUS"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0031.verticalCenter
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/rectangles/rectangles_unsmoothed.qml b/tests/manual/scenegraph_lancelot/data/rectangles/rectangles_unsmoothed.qml
new file mode 100644
index 0000000000..950ab37454
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/rectangles/rectangles_unsmoothed.qml
@@ -0,0 +1,586 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: r_0000
+ width: 320
+ height: 480
+ color: "white"
+
+ property int standardRectWidth: 22
+ property int standardRectHeight: 40
+ property int xOffsetPlacement: 10
+ property int yOffsetPlacement: 18
+ property int borderSize: 2
+ property int yPlacementRow_0: 0
+ property int yPlacementRow_1: (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_2: yPlacementRow_1 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_3: yPlacementRow_2 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_4: yPlacementRow_3 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_5: yPlacementRow_4 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_6: yPlacementRow_5 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_7: yPlacementRow_6 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_8: yPlacementRow_7 + (standardRectHeight+yOffsetPlacement)
+ property int yPlacementRow_9: yPlacementRow_8 + (standardRectHeight+yOffsetPlacement)
+ property int xPlacementCol_0: 0
+ property int xPlacementCol_1: xPlacementCol_0 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_2: xPlacementCol_1 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_3: xPlacementCol_2 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_4: xPlacementCol_3 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_5: xPlacementCol_4 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_6: xPlacementCol_5 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_7: xPlacementCol_6 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_8: xPlacementCol_7 + (standardRectWidth+xOffsetPlacement)
+ property int xPlacementCol_9: xPlacementCol_8 + (standardRectWidth+xOffsetPlacement)
+ property bool smoothingOn: false
+ property real scaleFactor: 1.2
+
+
+ //Test basic color
+ Rectangle{
+ id: r_0001
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_0
+ y: yPlacementRow_0
+ width: r_0000.standardRectWidth
+ height: r_0000.standardRectHeight
+ color: "red"
+ }
+ Rectangle{
+ id: r_0002
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_1
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ }
+ Rectangle{
+ id: r_0003
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_2
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ }
+ Rectangle{
+ id: r_0004
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_3
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ }
+ Rectangle {
+ id: r_0005
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_4
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ }
+ Rectangle{
+ id: r_0006
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_5
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ }
+ Rectangle{
+ id: r_0007
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_6
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ }
+ Rectangle{
+ id: r_0008
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_7
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ }
+ Rectangle{
+ id: r_0009
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_8
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ }
+ Rectangle{
+ id: r_0010
+ smooth: smoothingOn
+ scale: scaleFactor
+ x: xPlacementCol_9
+ y: yPlacementRow_0
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ }
+ Text{
+ id: annotation_row0
+ z: 1
+ text: "UNSMOOTHED SCALED RECTANGLES"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0001.verticalCenter
+ }
+
+ //Test borders
+ Rectangle{
+ id: r_0011
+ x: xPlacementCol_0
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "red"
+ border.width: borderSize
+ border.color: "orange"
+
+ }
+ Rectangle{
+ id: r_0012
+ x: xPlacementCol_1
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ border.width: borderSize
+ border.color: "yellow"
+
+ }
+ Rectangle{
+ id: r_0013
+ x: xPlacementCol_2
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ border.width: borderSize
+ border.color: "green"
+
+ }
+ Rectangle{
+ id: r_0014
+ x: xPlacementCol_3
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ border.width: borderSize
+ border.color: "blue"
+
+ }
+ Rectangle{
+ id: r_0015
+ x: xPlacementCol_4
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ border.width: borderSize
+ border.color: "indigo"
+
+ }
+ Rectangle{
+ id: r_0016
+ x: xPlacementCol_5
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ border.width: borderSize
+ border.color: "violet"
+
+ }
+ Rectangle{
+ id: r_0017
+ x: xPlacementCol_6
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ border.width: borderSize
+ border.color: "black"
+
+ }
+ Rectangle{
+ id: r_0018
+ x: xPlacementCol_7
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ border.width: borderSize
+ border.color: "dark grey"
+
+ }
+ Rectangle{
+ id: r_0019
+ x: xPlacementCol_8
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ border.width: borderSize
+ border.color: "light grey"
+
+ }
+ Rectangle{
+ id: r_0020
+ x: xPlacementCol_9
+ y: yPlacementRow_1
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ border.width: borderSize
+ border.color: "red"
+
+ }
+ Text{
+ id: annotation_row1
+ z: 1
+ text: "UNSMOOTHED SCALED BORDERS"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0011.verticalCenter
+ }
+
+ //Test Gradients
+ Rectangle{
+ id: r_0021
+ x: xPlacementCol_0
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "red"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0021.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0022
+ x: xPlacementCol_1
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0022.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0023
+ x: xPlacementCol_2
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0023.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0024
+ x: xPlacementCol_3
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0024.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0025
+ x: xPlacementCol_4
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0025.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0026
+ x: xPlacementCol_5
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0026.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0027
+ x: xPlacementCol_6
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0027.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0028
+ x: xPlacementCol_7
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0028.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0029
+ x: xPlacementCol_8
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0029.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Rectangle{
+ id: r_0030
+ x: xPlacementCol_9
+ y: yPlacementRow_2
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ gradient: Gradient{
+ GradientStop{ position: 1.0; color: r_0030.color }
+ GradientStop{ position: 0.0; color: "white" }
+ }
+
+ }
+ Text{
+ id: annotation_row2
+ z: 1
+ text: "UNSMOOTHED SCALED GRADIENTS"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0021.verticalCenter
+ }
+
+ //Test radius
+ Rectangle{
+ id: r_0031
+ x: xPlacementCol_0
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: r_0000.standardRectWidth
+ height: r_0000.standardRectHeight
+ color: "red"
+ radius: 1
+
+ }
+ Rectangle{
+ id: r_0032
+ x: xPlacementCol_1
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "orange"
+ radius: 2
+
+ }
+ Rectangle{
+ id: r_0033
+ x: xPlacementCol_2
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "yellow"
+ radius: 3
+
+ }
+ Rectangle{
+ id: r_0034
+ x: xPlacementCol_3
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "green"
+ radius: 4
+
+ }
+ Rectangle{
+ id: r_0035
+ x: xPlacementCol_4
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "blue"
+ radius: 5
+
+ }
+ Rectangle{
+ id: r_0036
+ x: xPlacementCol_5
+ y: yPlacementRow_3
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "indigo"
+ radius: 6
+
+ }
+ Rectangle{
+ x: xPlacementCol_6
+ y: yPlacementRow_3
+ id: r_0037
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "violet"
+ radius: 7
+
+ }
+ Rectangle{
+ x: xPlacementCol_7
+ y: yPlacementRow_3
+ id: r_0038
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "black"
+ radius: 8
+
+ }
+ Rectangle{
+ x: xPlacementCol_8
+ y: yPlacementRow_3
+ id: r_0039
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "dark grey"
+ radius: 9
+
+ }
+ Rectangle{
+ x: xPlacementCol_9
+ y: yPlacementRow_3
+ id: r_0040
+ smooth: smoothingOn
+ scale: scaleFactor
+ width: standardRectWidth
+ height: standardRectHeight
+ color: "light grey"
+ radius: 10
+
+ }
+ Text{
+ id: annotation_row3
+ z: 1
+ text: "UNSMOOTHED SCALED RADIUS"
+ font.family: "Arial"
+ font.pointSize: 15
+ color: "black"
+ font.bold: true
+ anchors.verticalCenter : r_0031.verticalCenter
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/rectangles/test-rectangles.qml b/tests/manual/scenegraph_lancelot/data/rectangles/test-rectangles.qml
new file mode 100644
index 0000000000..0eb0a37de8
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/rectangles/test-rectangles.qml
@@ -0,0 +1,81 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ Column {
+ id: foo
+ x: -width * (scale - 1) * (10/9) * (mouseArea.mouseX / width - 0.5)
+ y: -height * (scale - 1) * (10/9) * (mouseArea.mouseY / height - 0.5)
+ states: [
+ State {
+ name: ""
+ PropertyChanges {
+ target: foo
+ scale: 1
+ }
+ },
+ State {
+ name: "zoomed"
+ when: mouseArea.pressed
+ PropertyChanges {
+ target: foo
+ scale: 10
+ }
+ }
+ ]
+ Behavior on scale {
+ NumberAnimation { duration: 300; easing.type: Easing.InOutSine }
+ }
+
+ Repeater {
+ model: 3
+ Row {
+ id: local
+ property int _index: index
+ Repeater {
+ model: 2
+ Item {
+ width: 80
+ height: 160
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ radius: index * 20
+ border.pixelAligned: local._index == 1
+ border.width: local._index == 0 ? 0 : 0.5
+ opacity: 0.5
+ color: "steelBlue"
+ }
+ }
+ }
+ Repeater {
+ model: 2
+ Item {
+ width: 80
+ height: 160
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 10
+ radius: index * 20
+ border.pixelAligned: local._index == 1
+ border.width: local._index == 0 ? 0 : 0.5
+ opacity: 0.5
+ gradient: Gradient {
+ GradientStop { position: 0.05; color: "lightsteelblue" }
+ GradientStop { position: 0.1; color: "lightskyblue" }
+ GradientStop { position: 0.5; color: "skyblue" }
+ GradientStop { position: 0.9; color: "deepskyblue" }
+ GradientStop { position: 0.95; color: "dodgerblue" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/rotation/rotation.qml b/tests/manual/scenegraph_lancelot/data/rotation/rotation.qml
new file mode 100644
index 0000000000..68d22468f6
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/rotation/rotation.qml
@@ -0,0 +1,172 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ smooth: smoothing
+ property bool smoothing: true
+ property int standardWidth: 30
+ property int standardHeight: 30
+ property int standardSpacing: 10
+ Grid{
+ id: grid_0000
+ anchors.top: parent.baseline
+ anchors.left: parent.left
+ columns: 8
+ spacing: standardSpacing
+ Rectangle{ color: "red"; width: standardWidth; height: standardHeight; rotation: 0; smooth: smoothing}
+ Rectangle{ color: "orange"; width: standardWidth; height: standardHeight; rotation: 10; smooth: smoothing}
+ Rectangle{ color: "yellow"; width: standardWidth; height: standardHeight; rotation: 20; smooth: smoothing}
+ Rectangle{ color: "blue"; width: standardWidth; height: standardHeight; rotation: 30; smooth: smoothing}
+ Rectangle{ color: "green"; width: standardWidth; height: standardHeight; rotation: 40; smooth: smoothing}
+ Rectangle{ color: "indigo"; width: standardWidth; height: standardHeight; rotation: 50; smooth: smoothing}
+ Rectangle{ color: "violet"; width: standardWidth; height: standardHeight; rotation: 60; smooth: smoothing}
+ Rectangle{ color: "light green"; width: standardWidth; height: standardHeight; rotation: 70; smooth: smoothing}
+ Rectangle{ color: "light blue"; width: standardWidth; height: standardHeight; rotation: 80; smooth: smoothing}
+ Rectangle{ color: "light grey"; width: standardWidth; height: standardHeight; rotation: 5; smooth: smoothing}
+ Rectangle{ color: "black"; width: standardWidth; height: standardHeight; rotation: 15; smooth: smoothing}
+ Rectangle{ color: "dark grey"; width: standardWidth; height: standardHeight; rotation: 25; smooth: smoothing}
+ Rectangle{ color: "purple"; width: standardWidth; height: standardHeight; rotation: 35; smooth: smoothing}
+ Rectangle{ color: "pink"; width: standardWidth; height: standardHeight; rotation: 45; smooth: smoothing}
+ Rectangle{ color: "cyan"; width: standardWidth; height: standardHeight; rotation: 55; smooth: smoothing}
+ Rectangle{ color: "brown"; width: standardWidth; height: standardHeight; rotation: 65; smooth: smoothing}
+ }
+ Grid{
+ id: grid_0001
+ anchors.top: grid_0000.bottom
+ anchors.left: grid_0000.left
+ columns: 8
+ spacing: standardSpacing
+ Rectangle{ color: "#ff0000"; width: standardWidth; height: standardHeight; rotation: 0; smooth: smoothing}
+ Rectangle{ color: "#ff3333"; width: standardWidth; height: standardHeight; rotation: 10; smooth: smoothing}
+ Rectangle{ color: "#ff6666"; width: standardWidth; height: standardHeight; rotation: 20; smooth: smoothing}
+ Rectangle{ color: "#ff9999"; width: standardWidth; height: standardHeight; rotation: 30; smooth: smoothing}
+ Rectangle{ color: "#ffcccc"; width: standardWidth; height: standardHeight; rotation: 40; smooth: smoothing}
+ Rectangle{ color: "#ffeeff"; width: standardWidth; height: standardHeight; rotation: 50; smooth: smoothing}
+ Rectangle{ color: "#ccffff"; width: standardWidth; height: standardHeight; rotation: 60; smooth: smoothing}
+ Rectangle{ color: "#99ffff"; width: standardWidth; height: standardHeight; rotation: 70; smooth: smoothing}
+ Rectangle{ color: "#66ffff"; width: standardWidth; height: standardHeight; rotation: 80; smooth: smoothing}
+ Rectangle{ color: "#33ffff"; width: standardWidth; height: standardHeight; rotation: 5; smooth: smoothing}
+ Rectangle{ color: "#00ffff"; width: standardWidth; height: standardHeight; rotation: 15; smooth: smoothing}
+ Rectangle{ color: "#ff00cc"; width: standardWidth; height: standardHeight; rotation: 25; smooth: smoothing}
+ Rectangle{ color: "#ff33ff"; width: standardWidth; height: standardHeight; rotation: 35; smooth: smoothing}
+ Rectangle{ color: "#ff66ff"; width: standardWidth; height: standardHeight; rotation: 45; smooth: smoothing}
+ Rectangle{ color: "#cc66ff"; width: standardWidth; height: standardHeight; rotation: 55; smooth: smoothing}
+ Rectangle{ color: "#9966ff"; width: standardWidth; height: standardHeight; rotation: 65; smooth: smoothing}
+ }
+ Grid{
+ id: grid_0002
+ anchors.top: grid_0001.bottom
+ anchors.left: grid_0001.left
+ columns: 8
+ spacing: standardSpacing
+ Rectangle{ color: "#ff0010"; width: standardWidth; height: standardHeight; rotation: 80; smooth: smoothing}
+ Rectangle{ color: "#ff3323"; width: standardWidth; height: standardHeight; rotation: 70; smooth: smoothing}
+ Rectangle{ color: "#ff6636"; width: standardWidth; height: standardHeight; rotation: 60; smooth: smoothing}
+ Rectangle{ color: "#ff9949"; width: standardWidth; height: standardHeight; rotation: 50; smooth: smoothing}
+ Rectangle{ color: "#ffcc5c"; width: standardWidth; height: standardHeight; rotation: 40; smooth: smoothing}
+ Rectangle{ color: "#ffee6f"; width: standardWidth; height: standardHeight; rotation: 30; smooth: smoothing}
+ Rectangle{ color: "#ccff7f"; width: standardWidth; height: standardHeight; rotation: 20; smooth: smoothing}
+ Rectangle{ color: "#99ff8f"; width: standardWidth; height: standardHeight; rotation: 10; smooth: smoothing}
+ Rectangle{ color: "#66ff9f"; width: standardWidth; height: standardHeight; rotation: -10; smooth: smoothing}
+ Rectangle{ color: "#33ffaf"; width: standardWidth; height: standardHeight; rotation: -20; smooth: smoothing}
+ Rectangle{ color: "#00ffbf"; width: standardWidth; height: standardHeight; rotation: -30; smooth: smoothing}
+ Rectangle{ color: "#ff00cc"; width: standardWidth; height: standardHeight; rotation: -40; smooth: smoothing}
+ Rectangle{ color: "#ff33df"; width: standardWidth; height: standardHeight; rotation: -50; smooth: smoothing}
+ Rectangle{ color: "#ff66ef"; width: standardWidth; height: standardHeight; rotation: -60; smooth: smoothing}
+ Rectangle{ color: "#cc661f"; width: standardWidth; height: standardHeight; rotation: -70; smooth: smoothing}
+ Rectangle{ color: "#99662f"; width: standardWidth; height: standardHeight; rotation: -80; smooth: smoothing}
+ }
+ Grid{
+ id: grid_0003
+ anchors.top: grid_0002.bottom
+ anchors.left: grid_0002.left
+ columns: 8
+ spacing: standardSpacing
+ Rectangle{ color: "#ffcc00"; width: standardWidth; height: standardHeight; rotation: 80; smooth: smoothing}
+ Rectangle{ color: "#ffff33"; width: standardWidth; height: standardHeight; rotation: 70; smooth: smoothing}
+ Rectangle{ color: "#ccff33"; width: standardWidth; height: standardHeight; rotation: 60; smooth: smoothing}
+ Rectangle{ color: "#99ff33"; width: standardWidth; height: standardHeight; rotation: 50; smooth: smoothing}
+ Rectangle{ color: "#66ff33"; width: standardWidth; height: standardHeight; rotation: 40; smooth: smoothing}
+ Rectangle{ color: "#33ff33"; width: standardWidth; height: standardHeight; rotation: 30; smooth: smoothing}
+ Rectangle{ color: "#00ff33"; width: standardWidth; height: standardHeight; rotation: 20; smooth: smoothing}
+ Rectangle{ color: "#ff00ff"; width: standardWidth; height: standardHeight; rotation: 10; smooth: smoothing}
+ Rectangle{ color: "#cc00ff"; width: standardWidth; height: standardHeight; rotation: -10; smooth: smoothing}
+ Rectangle{ color: "#9900ff"; width: standardWidth; height: standardHeight; rotation: -15; smooth: smoothing}
+ Rectangle{ color: "#6600ff"; width: standardWidth; height: standardHeight; rotation: -20; smooth: smoothing}
+ Rectangle{ color: "#3300ff"; width: standardWidth; height: standardHeight; rotation: -25; smooth: smoothing}
+ Rectangle{ color: "#0000ff"; width: standardWidth; height: standardHeight; rotation: -30; smooth: smoothing}
+ Rectangle{ color: "#ff00cc"; width: standardWidth; height: standardHeight; rotation: -35; smooth: smoothing}
+ Rectangle{ color: "#ff33cc"; width: standardWidth; height: standardHeight; rotation: -40; smooth: smoothing}
+ Rectangle{ color: "#cc66ff"; width: standardWidth; height: standardHeight; rotation: -45; smooth: smoothing}
+ }
+ Grid{
+ id: grid_0004
+ anchors.top: grid_0003.bottom
+ anchors.left: grid_0003.left
+ columns: 8
+ spacing: standardSpacing
+ Rectangle{ color: "#eecc00"; width: standardWidth; height: standardHeight; rotation: 80; smooth: smoothing}
+ Rectangle{ color: "#eeff33"; width: standardWidth; height: standardHeight; rotation: 70; smooth: smoothing}
+ Rectangle{ color: "#ccff33"; width: standardWidth; height: standardHeight; rotation: 60; smooth: smoothing}
+ Rectangle{ color: "#99ff33"; width: standardWidth; height: standardHeight; rotation: 50; smooth: smoothing}
+ Rectangle{ color: "#66ff33"; width: standardWidth; height: standardHeight; rotation: 40; smooth: smoothing}
+ Rectangle{ color: "#44ff33"; width: standardWidth; height: standardHeight; rotation: 30; smooth: smoothing}
+ Rectangle{ color: "#00ff33"; width: standardWidth; height: standardHeight; rotation: 20; smooth: smoothing}
+ Rectangle{ color: "#ee00ff"; width: standardWidth; height: standardHeight; rotation: 10; smooth: smoothing}
+ Rectangle{ color: "#cc00ff"; width: standardWidth; height: standardHeight; rotation: -10; smooth: smoothing}
+ Rectangle{ color: "#9900ff"; width: standardWidth; height: standardHeight; rotation: -15; smooth: smoothing}
+ Rectangle{ color: "#6600ff"; width: standardWidth; height: standardHeight; rotation: -20; smooth: smoothing}
+ Rectangle{ color: "#4400ff"; width: standardWidth; height: standardHeight; rotation: -25; smooth: smoothing}
+ Rectangle{ color: "#0000ff"; width: standardWidth; height: standardHeight; rotation: -30; smooth: smoothing}
+ Rectangle{ color: "#ee00cc"; width: standardWidth; height: standardHeight; rotation: -35; smooth: smoothing}
+ Rectangle{ color: "#ee33cc"; width: standardWidth; height: standardHeight; rotation: -40; smooth: smoothing}
+ Rectangle{ color: "#cc66ff"; width: standardWidth; height: standardHeight; rotation: -45; smooth: smoothing}
+ }
+ Grid{
+ id: grid_0005
+ anchors.top: grid_0004.bottom
+ anchors.left: grid_0004.left
+ columns: 8
+ spacing: standardSpacing
+ Rectangle{ color: "red"; width: standardWidth; height: standardHeight; rotation: 0; smooth: smoothing}
+ Rectangle{ color: "orange"; width: standardWidth; height: standardHeight; rotation: 10; smooth: smoothing}
+ Rectangle{ color: "yellow"; width: standardWidth; height: standardHeight; rotation: 20; smooth: smoothing}
+ Rectangle{ color: "blue"; width: standardWidth; height: standardHeight; rotation: 30; smooth: smoothing}
+ Rectangle{ color: "green"; width: standardWidth; height: standardHeight; rotation: 40; smooth: smoothing}
+ Rectangle{ color: "indigo"; width: standardWidth; height: standardHeight; rotation: 50; smooth: smoothing}
+ Rectangle{ color: "violet"; width: standardWidth; height: standardHeight; rotation: 60; smooth: smoothing}
+ Rectangle{ color: "light green"; width: standardWidth; height: standardHeight; rotation: 70; smooth: smoothing}
+ Rectangle{ color: "light blue"; width: standardWidth; height: standardHeight; rotation: 80; smooth: smoothing}
+ Rectangle{ color: "light grey"; width: standardWidth; height: standardHeight; rotation: 5; smooth: smoothing}
+ Rectangle{ color: "black"; width: standardWidth; height: standardHeight; rotation: 15; smooth: smoothing}
+ Rectangle{ color: "dark grey"; width: standardWidth; height: standardHeight; rotation: 25; smooth: smoothing}
+ Rectangle{ color: "purple"; width: standardWidth; height: standardHeight; rotation: 35; smooth: smoothing}
+ Rectangle{ color: "pink"; width: standardWidth; height: standardHeight; rotation: 45; smooth: smoothing}
+ Rectangle{ color: "cyan"; width: standardWidth; height: standardHeight; rotation: 55; smooth: smoothing}
+ Rectangle{ color: "brown"; width: standardWidth; height: standardHeight; rotation: 65; smooth: smoothing}
+ }
+ Grid{
+ id: grid_0006
+ anchors.top: grid_0005.bottom
+ anchors.left: grid_0005.left
+ columns: 8
+ spacing: standardSpacing
+ Rectangle{ color: "#ff6600"; width: standardWidth; height: standardHeight; rotation: 0; smooth: smoothing}
+ Rectangle{ color: "#cc6600"; width: standardWidth; height: standardHeight; rotation: 10; smooth: smoothing}
+ Rectangle{ color: "#996600"; width: standardWidth; height: standardHeight; rotation: 20; smooth: smoothing}
+ Rectangle{ color: "#666600"; width: standardWidth; height: standardHeight; rotation: 30; smooth: smoothing}
+ Rectangle{ color: "#336600"; width: standardWidth; height: standardHeight; rotation: 40; smooth: smoothing}
+ Rectangle{ color: "#006600"; width: standardWidth; height: standardHeight; rotation: 50; smooth: smoothing}
+ Rectangle{ color: "#009933"; width: standardWidth; height: standardHeight; rotation: 60; smooth: smoothing}
+ Rectangle{ color: "#00cc66"; width: standardWidth; height: standardHeight; rotation: 70; smooth: smoothing}
+ Rectangle{ color: "#ff0066"; width: standardWidth; height: standardHeight; rotation: 80; smooth: smoothing}
+ Rectangle{ color: "#cc0066"; width: standardWidth; height: standardHeight; rotation: 5; smooth: smoothing}
+ Rectangle{ color: "#990066"; width: standardWidth; height: standardHeight; rotation: 15; smooth: smoothing}
+ Rectangle{ color: "#660066"; width: standardWidth; height: standardHeight; rotation: 25; smooth: smoothing}
+ Rectangle{ color: "#330066"; width: standardWidth; height: standardHeight; rotation: 35; smooth: smoothing}
+ Rectangle{ color: "#000066"; width: standardWidth; height: standardHeight; rotation: 45; smooth: smoothing}
+ Rectangle{ color: "#003399"; width: standardWidth; height: standardHeight; rotation: 55; smooth: smoothing}
+ Rectangle{ color: "#0066cc"; width: standardWidth; height: standardHeight; rotation: 65; smooth: smoothing}
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/rotation/rotation_2.qml b/tests/manual/scenegraph_lancelot/data/rotation/rotation_2.qml
new file mode 100644
index 0000000000..89dd6b7b22
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/rotation/rotation_2.qml
@@ -0,0 +1,69 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ property int standardWidth: 60
+ property int standardHeight: 60
+ property int standardSpacing: 20
+ property bool smoothing: true
+ Grid{
+ id: grid_0000
+ anchors.top: parent.baseline
+ anchors.left: parent.left
+ columns: 4
+ spacing: standardSpacing
+ Rectangle{ color: "red"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: standardWidth/2; origin.y: standardHeight/2 ; axis{x: 0; y: 0; z:1} angle: 5; } smooth: smoothing}
+ Rectangle{ color: "orange"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: 0; origin.y: 0 ; axis{x: 0; y: 0; z:1} angle: 10; } smooth: smoothing }
+ Rectangle{ color: "yellow"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: 0; origin.y: 0 ; axis{x: 0; y: 0; z:1} angle: 15; } smooth: smoothing }
+ Rectangle{ color: "blue"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: 0; origin.y: 0 ; axis{x: 0; y: 0; z:1} angle: 20; } smooth: smoothing }
+ Rectangle{ color: "green"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: standardWidth/2; origin.y: standardWidth/2 ; axis{x: 0; y: 0; z:1} angle: 15; } smooth: smoothing}
+ Rectangle{ color: "indigo"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: 0; origin.y: 0 ; axis{x: 0; y: 0; z:1} angle: 30; } smooth: smoothing}
+ Rectangle{ color: "violet"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: 0; origin.y: 0 ; axis{x: 0; y: 0; z:1} angle: 35; } smooth: smoothing }
+ Rectangle{ color: "light green"; width: standardWidth; height: standardHeight; transform: Rotation { origin.x: 0; origin.y: 0 ; axis{x: 0; y: 0; z:1} angle: 40; } smooth: smoothing }
+ }
+ Item{
+ id: spacer_0000
+ width: standardWidth
+ height: standardHeight
+ anchors.top: grid_0000.bottom
+ anchors.left: grid_0000.left
+ }
+ Grid{
+ id: grid_0001
+ anchors.top: spacer_0000.bottom
+ anchors.left: spacer_0000.left
+ columns: 4
+ spacing: standardSpacing
+ Rectangle{ color: "#ff0000"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 5; } smooth: smoothing}
+ Rectangle{ color: "#ff3333"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 20; } smooth: smoothing }
+ Rectangle{ color: "#ff6666"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 30; } smooth: smoothing }
+ Rectangle{ color: "#ff9999"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 40; } smooth: smoothing }
+ Rectangle{ color: "#ffcccc"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 50; } smooth: smoothing }
+ Rectangle{ color: "#ffeeff"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 60; } smooth: smoothing }
+ Rectangle{ color: "#ccffff"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 70; } smooth: smoothing }
+ Rectangle{ color: "#99ffff"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 1; y: 0; z:0} angle: 80; } smooth: smoothing }
+ }
+ Item{
+ id: spacer_0001
+ width: standardWidth
+ height: standardHeight
+ anchors.top: grid_0001.bottom
+ anchors.left: grid_0001.left
+ }
+ Grid{
+ id: grid_0002
+ anchors.top: spacer_0001.bottom
+ anchors.left: spacer_0001.left
+ columns: 4
+ spacing: standardSpacing
+ Rectangle{ color: "#ff0000"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 10; } smooth: smoothing}
+ Rectangle{ color: "#ff3333"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 20; } smooth: smoothing}
+ Rectangle{ color: "#ff6666"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 30; } smooth: smoothing}
+ Rectangle{ color: "#ff9999"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 40; } smooth: smoothing}
+ Rectangle{ color: "#ffcccc"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 50; } smooth: smoothing}
+ Rectangle{ color: "#ffeeff"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 60; } smooth: smoothing}
+ Rectangle{ color: "#ccffff"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 70; } smooth: smoothing}
+ Rectangle{ color: "#99ffff"; width: standardWidth; height: standardHeight; transform: Rotation { origin.z: 0; origin.y: 0 ; axis{x: 0; y: 1; z:0} angle: 80; } smooth: smoothing}
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml b/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml
new file mode 100644
index 0000000000..d4ae526b5d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ hideSource: effect.visible
+ }
+
+ ShaderEffect {
+ id: effect
+ anchors.fill: text
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml b/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml
new file mode 100644
index 0000000000..f1bb03a4a9
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ ShaderEffect {
+ anchors.fill: parent;
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1);
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
new file mode 100644
index 0000000000..76ce60fd7d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: topLevel
+ width: 320
+ height: 480
+ ShaderEffectSource {
+ id: front
+ visible: false
+ smooth: true
+ sourceItem: Rectangle {
+ width: 256
+ height: 64
+ color: "cornflowerblue"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ text: "Front"
+ font.pixelSize: 48
+ color: "white"
+ }
+ }
+ }
+ ShaderEffectSource {
+ id: back
+ visible: false
+ smooth: true
+ sourceItem: Rectangle {
+ width: 256
+ height: 64
+ color: "firebrick"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ text: "Back"
+ font.pixelSize: 48
+ color: "white"
+ }
+ }
+ }
+ Column {
+ anchors.fill: parent
+ Repeater {
+ model: ListModel {
+ ListElement {
+ foo: "No culling"
+ bar: ShaderEffect.NoCulling
+ turned: false
+ }
+ ListElement {
+ foo: "Back-face culling"
+ bar: ShaderEffect.BackFaceCulling
+ turned: false
+ }
+ ListElement {
+ foo: "Front-face culling"
+ bar: ShaderEffect.FrontFaceCulling
+ turned: false
+ }
+ }
+
+ Item{
+ id: item_0000
+ width: 320
+ height: 120
+ ShaderEffect {
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: 10
+ width: 200
+ height: 100
+ cullMode: model.bar
+ property variant frontSource: front
+ property variant backSource: back
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform sampler2D frontSource;
+ uniform sampler2D backSource;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = gl_FrontFacing
+ ? texture2D(frontSource, qt_TexCoord0)
+ : texture2D(backSource, qt_TexCoord0);
+ }"
+ transform: Rotation {
+ origin.x: 200
+ origin.y: 180 - 120 * index
+ axis { x: 0; y: 1; z: 0 }
+ angle: (turned == true) ? 180 : 0
+
+ }
+ }
+ Text {
+ font.pointSize: 10
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.margins: 5
+ text: foo
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml
new file mode 100644
index 0000000000..45f20dd5a4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml
@@ -0,0 +1,103 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: topLevel
+ width: 320
+ height: 480
+ ShaderEffectSource {
+ id: front
+ visible: false
+ smooth: true
+ sourceItem: Rectangle {
+ width: 256
+ height: 64
+ color: "cornflowerblue"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ text: "Front"
+ font.pixelSize: 48
+ color: "white"
+ }
+ }
+ }
+ ShaderEffectSource {
+ id: back
+ visible: false
+ smooth: true
+ sourceItem: Rectangle {
+ width: 256
+ height: 64
+ color: "firebrick"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ text: "Back"
+ font.pixelSize: 48
+ color: "white"
+ }
+ }
+ }
+ Column {
+ anchors.fill: parent
+ Repeater {
+ model: ListModel {
+ ListElement {
+ foo: "No culling"
+ bar: ShaderEffect.NoCulling
+ turned: true
+ }
+ ListElement {
+ foo: "Back-face culling"
+ bar: ShaderEffect.BackFaceCulling
+ turned: true
+ }
+ ListElement {
+ foo: "Front-face culling"
+ bar: ShaderEffect.FrontFaceCulling
+ turned: true
+ }
+ }
+
+ Item{
+ id: item_0000
+ width: 320
+ height: 120
+ ShaderEffect{
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: 10
+ width: 200
+ height: 100
+ cullMode: model.bar
+ property variant frontSource: front
+ property variant backSource: back
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform sampler2D frontSource;
+ uniform sampler2D backSource;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = gl_FrontFacing
+ ? texture2D(frontSource, qt_TexCoord0)
+ : texture2D(backSource, qt_TexCoord0);
+ }"
+ transform: Rotation {
+ origin.x: 100
+ origin.y: 180 - 120 * index
+ axis { x: 0; y: 1; z: 0 }
+ angle: (turned == true) ? 180 : 0
+
+ }
+ }
+ Text {
+ font.pointSize: 10
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.margins: 5
+ text: foo
+ }
+ }
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml
new file mode 100644
index 0000000000..17d9aadf95
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/attributes.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ font.pixelSize: 80
+ text: "Shaderz!"
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ hideSource: true
+ smooth: true
+ }
+ Column {
+ ShaderEffect {
+ width: 320
+ height: 160
+ property variant source: source
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_Position = qt_Matrix * qt_Vertex;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ }
+ ShaderEffect {
+ width: 320
+ height: 160
+ property variant source: source
+ vertexShader: "
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_Position = qt_Matrix * qt_Vertex;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ }
+ ShaderEffect {
+ width: 320
+ height: 160
+ property variant source: source
+ vertexShader: "
+ attribute highp vec2 qt_MultiTexCoord0;
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float width;
+ uniform highp float height;
+ void main() {
+ gl_Position = qt_Matrix * qt_Vertex;
+ qt_TexCoord0 = qt_Vertex.xy / vec2(width, height);
+ }"
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml
new file mode 100644
index 0000000000..ddea979124
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "skyblue"
+ ShaderEffect {
+ anchors.centerIn: parent
+ width: 16 * 16
+ height: 24 * 16
+ property variant source: ShaderEffectSource {
+ sourceItem: Rectangle {
+ width: 22 * 20
+ height: 16 * 20
+ color: "#EF2B2D"
+ Rectangle {
+ y: 6 * 20
+ height: 4 * 20
+ width: 22 * 20
+ color: "white"
+ }
+ Rectangle {
+ x: 6 * 20
+ width: 4 * 20
+ height: 16 * 20
+ color: "white"
+ }
+ Rectangle {
+ y: 7 * 20
+ height: 2 * 20
+ width: 22 * 20
+ color: "#002868"
+ }
+ Rectangle {
+ x: 7 * 20
+ width: 2 * 20
+ height: 16 * 20
+ color: "#002868"
+ }
+ }
+ smooth: true
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ highp vec4 pos = qt_Vertex;
+ pos.x += sin(qt_Vertex.y * 0.02) * 20.;
+ pos.y += sin(qt_Vertex.x * 0.02) * 20.;
+ gl_Position = qt_Matrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ mesh: GridMesh {
+ property int r: 1
+ resolution: Qt.size(r, r)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml
new file mode 100644
index 0000000000..971cda4f55
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "skyblue"
+ ShaderEffect {
+ anchors.centerIn: parent
+ width: 16 * 16
+ height: 24 * 16
+ property variant source: ShaderEffectSource {
+ sourceItem: Rectangle {
+ width: 22 * 20
+ height: 16 * 20
+ color: "#EF2B2D"
+ Rectangle {
+ y: 6 * 20
+ height: 4 * 20
+ width: 22 * 20
+ color: "white"
+ }
+ Rectangle {
+ x: 6 * 20
+ width: 4 * 20
+ height: 16 * 20
+ color: "white"
+ }
+ Rectangle {
+ y: 7 * 20
+ height: 2 * 20
+ width: 22 * 20
+ color: "#002868"
+ }
+ Rectangle {
+ x: 7 * 20
+ width: 2 * 20
+ height: 16 * 20
+ color: "#002868"
+ }
+ }
+ smooth: true
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ highp vec4 pos = qt_Vertex;
+ pos.x += sin(qt_Vertex.y * 0.02) * 20.;
+ pos.y += sin(qt_Vertex.x * 0.02) * 20.;
+ gl_Position = qt_Matrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ mesh: GridMesh {
+ property int r: 16
+ resolution: Qt.size(r, r)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml
new file mode 100644
index 0000000000..d301ef089c
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "skyblue"
+ ShaderEffect{
+ anchors.centerIn: parent
+ width: 16 * 16
+ height: 24 * 16
+ property variant source: ShaderEffectSource {
+ sourceItem: Rectangle {
+ width: 22 * 20
+ height: 16 * 20
+ color: "#EF2B2D"
+ Rectangle {
+ y: 6 * 20
+ height: 4 * 20
+ width: 22 * 20
+ color: "white"
+ }
+ Rectangle {
+ x: 6 * 20
+ width: 4 * 20
+ height: 16 * 20
+ color: "white"
+ }
+ Rectangle {
+ y: 7 * 20
+ height: 2 * 20
+ width: 22 * 20
+ color: "#002868"
+ }
+ Rectangle {
+ x: 7 * 20
+ width: 2 * 20
+ height: 16 * 20
+ color: "#002868"
+ }
+ }
+ smooth: true
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ highp vec4 pos = qt_Vertex;
+ pos.x += sin(qt_Vertex.y * 0.02) * 20.;
+ pos.y += sin(qt_Vertex.x * 0.02) * 20.;
+ gl_Position = qt_Matrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ mesh: GridMesh {
+ property int r: 2
+ resolution: Qt.size(r, r)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml
new file mode 100644
index 0000000000..0043282efd
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "skyblue"
+ ShaderEffect {
+ anchors.centerIn: parent
+ width: 16 * 16
+ height: 24 * 16
+ property variant source: ShaderEffectSource {
+ sourceItem: Rectangle {
+ width: 22 * 20
+ height: 16 * 20
+ color: "#EF2B2D"
+ Rectangle {
+ y: 6 * 20
+ height: 4 * 20
+ width: 22 * 20
+ color: "white"
+ }
+ Rectangle {
+ x: 6 * 20
+ width: 4 * 20
+ height: 16 * 20
+ color: "white"
+ }
+ Rectangle {
+ y: 7 * 20
+ height: 2 * 20
+ width: 22 * 20
+ color: "#002868"
+ }
+ Rectangle {
+ x: 7 * 20
+ width: 2 * 20
+ height: 16 * 20
+ color: "#002868"
+ }
+ }
+ smooth: true
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ highp vec4 pos = qt_Vertex;
+ pos.x += sin(qt_Vertex.y * 0.02) * 20.;
+ pos.y += sin(qt_Vertex.x * 0.02) * 20.;
+ gl_Position = qt_Matrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ mesh: GridMesh {
+ property int r: 4
+ resolution: Qt.size(r, r)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml
new file mode 100644
index 0000000000..f9427a1f16
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "skyblue"
+ ShaderEffect {
+ anchors.centerIn: parent
+ width: 16 * 16
+ height: 24 * 16
+ property variant source: ShaderEffectSource {
+ sourceItem: Rectangle {
+ width: 22 * 20
+ height: 16 * 20
+ color: "#EF2B2D"
+ Rectangle {
+ y: 6 * 20
+ height: 4 * 20
+ width: 22 * 20
+ color: "white"
+ }
+ Rectangle {
+ x: 6 * 20
+ width: 4 * 20
+ height: 16 * 20
+ color: "white"
+ }
+ Rectangle {
+ y: 7 * 20
+ height: 2 * 20
+ width: 22 * 20
+ color: "#002868"
+ }
+ Rectangle {
+ x: 7 * 20
+ width: 2 * 20
+ height: 16 * 20
+ color: "#002868"
+ }
+ }
+ smooth: true
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ highp vec4 pos = qt_Vertex;
+ pos.x += sin(qt_Vertex.y * 0.02) * 20.;
+ pos.y += sin(qt_Vertex.x * 0.02) * 20.;
+ gl_Position = qt_Matrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ mesh: GridMesh {
+ property int r: 8
+ resolution: Qt.size(r, r)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml
new file mode 100644
index 0000000000..83469531b1
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml
@@ -0,0 +1,64 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: draggee
+ width: 200
+ height: 80
+ x: 20
+ y: 15
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "steelBlue" }
+ GradientStop { position: 0.49; color: "white" }
+ GradientStop { position: 0.5; color: "gray" }
+ GradientStop { position: 1.0; color: "darkGray" }
+ }
+ radius: 20
+ border.width: 2
+ border.color: "black"
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 40
+ text: "Position 1"
+ }
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: draggee
+ hideSource: true
+ property real margins: 6
+ sourceRect: Qt.rect(-margins, -margins, sourceItem.width + 2 * margins, sourceItem.height + 2 * margins)
+ smooth: true
+ }
+
+ ShaderEffect{
+ id: effect
+ anchors.fill: source.sourceItem
+ anchors.margins: -source.margins
+ property variant source: source
+ property variant offset: Qt.size(4 / width, 4 / height)
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform highp vec2 offset;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ highp vec2 delta2 = vec2(delta.x, -delta.y);
+ lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a
+ + texture2D(source, qt_TexCoord0 - offset - delta).a
+ + texture2D(source, qt_TexCoord0 - offset + delta2).a
+ + texture2D(source, qt_TexCoord0 - offset - delta2).a);
+ lowp vec4 color = texture2D(source, qt_TexCoord0);
+ gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a);
+ }
+ "
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml
new file mode 100644
index 0000000000..160b89168e
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: draggee
+ width: 200
+ height: 80
+ x: 100
+ y: 360
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "steelBlue" }
+ GradientStop { position: 0.49; color: "white" }
+ GradientStop { position: 0.5; color: "gray" }
+ GradientStop { position: 1.0; color: "darkGray" }
+ }
+ radius: 20
+ border.width: 2
+ border.color: "black"
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 40
+ text: "Position 2"
+ }
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: draggee
+ hideSource: true
+ property real margins: 6
+ sourceRect: Qt.rect(-margins, -margins, sourceItem.width + 2 * margins, sourceItem.height + 2 * margins)
+ smooth: true
+ }
+
+ ShaderEffect{
+ id: effect
+ anchors.fill: source.sourceItem
+ anchors.margins: -source.margins
+ property variant source: source
+ property variant offset: Qt.size(4 / width, 4 / height)
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform highp vec2 offset;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ highp vec2 delta2 = vec2(delta.x, -delta.y);
+ lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a
+ + texture2D(source, qt_TexCoord0 - offset - delta).a
+ + texture2D(source, qt_TexCoord0 - offset + delta2).a
+ + texture2D(source, qt_TexCoord0 - offset - delta2).a);
+ lowp vec4 color = texture2D(source, qt_TexCoord0);
+ gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a);
+ }
+ "
+ }
+}
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml
new file mode 100644
index 0000000000..566edddedb
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml
@@ -0,0 +1,64 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: draggee
+ width: 200
+ height: 80
+ x: 20
+ y: 15
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "steelBlue" }
+ GradientStop { position: 0.49; color: "white" }
+ GradientStop { position: 0.5; color: "gray" }
+ GradientStop { position: 1.0; color: "darkGray" }
+ }
+ radius: 20
+ border.width: 2
+ border.color: "black"
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 40
+ text: "Position 1"
+ }
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: draggee
+ hideSource: false
+ property real margins: 6
+ sourceRect: Qt.rect(-margins, -margins, sourceItem.width + 2 * margins, sourceItem.height + 2 * margins)
+ smooth: true
+ }
+
+ ShaderEffect{
+ id: effect
+ anchors.fill: source.sourceItem
+ anchors.margins: -source.margins
+ property variant source: source
+ property variant offset: Qt.size(4 / width, 4 / height)
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform highp vec2 offset;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ highp vec2 delta2 = vec2(delta.x, -delta.y);
+ lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a
+ + texture2D(source, qt_TexCoord0 - offset - delta).a
+ + texture2D(source, qt_TexCoord0 - offset + delta2).a
+ + texture2D(source, qt_TexCoord0 - offset - delta2).a);
+ lowp vec4 color = texture2D(source, qt_TexCoord0);
+ gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a);
+ }
+ "
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml
new file mode 100644
index 0000000000..0b8038e9ee
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml
@@ -0,0 +1,66 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: draggee
+ width: 200
+ height: 80
+ x: 100
+ y: 360
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "steelBlue" }
+ GradientStop { position: 0.49; color: "white" }
+ GradientStop { position: 0.5; color: "gray" }
+ GradientStop { position: 1.0; color: "darkGray" }
+ }
+ radius: 20
+ border.width: 2
+ border.color: "black"
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 40
+ text: "Position 2"
+ }
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: draggee
+ hideSource: false
+ property real margins: 6
+ sourceRect: Qt.rect(-margins, -margins, sourceItem.width + 2 * margins, sourceItem.height + 2 * margins)
+ smooth: true
+ }
+
+ ShaderEffect{
+ id: effect
+ anchors.fill: source.sourceItem
+ anchors.margins: -source.margins
+ property variant source: source
+ property variant offset: Qt.size(4 / width, 4 / height)
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ uniform highp vec2 offset;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ highp vec2 delta2 = vec2(delta.x, -delta.y);
+ lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a
+ + texture2D(source, qt_TexCoord0 - offset - delta).a
+ + texture2D(source, qt_TexCoord0 - offset + delta2).a
+ + texture2D(source, qt_TexCoord0 - offset - delta2).a);
+ lowp vec4 color = texture2D(source, qt_TexCoord0);
+ gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a);
+ }
+ "
+ }
+}
+
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml b/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml
new file mode 100644
index 0000000000..132f160a26
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Image {
+ id: image;
+ source: "./face-smile.png"
+ visible: false
+ asynchronous: true
+ }
+
+ ShaderEffect {
+ anchors.fill: image
+ property variant source: image
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0);
+ }
+ "
+ visible: image.status == Image.Ready
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/image/face-smile.png b/tests/manual/scenegraph_lancelot/data/shaders/image/face-smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/image/face-smile.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml b/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml
new file mode 100644
index 0000000000..878eddeda5
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Image {
+ id: image;
+ source: "face-smile.png"
+ visible: false
+ }
+
+ ShaderEffect {
+ anchors.fill: image
+ property variant source: image
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0);
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml
new file mode 100644
index 0000000000..0383feaf91
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ anchors.centerIn: parent
+ transform: Rotation { angle: 45 }
+ }
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffect {
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml
new file mode 100644
index 0000000000..2e7074c65d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ anchors.centerIn: parent
+ transform: Rotation { angle: 90 }
+ }
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffect {
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml
new file mode 100644
index 0000000000..3793e655c7
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml
@@ -0,0 +1,68 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ anchors.centerIn: parent
+ transform: Rotation{ angle: 45}
+ }
+ }
+
+ ShaderEffectSource {
+ id: source1
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: source2
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffect{
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source1
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+ ShaderEffect {
+ y: parent.height / 2
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source2
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml
new file mode 100644
index 0000000000..2d8a4b6c09
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml
@@ -0,0 +1,68 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ anchors.centerIn: parent
+ transform: Rotation{ angle: 90}
+ }
+ }
+
+ ShaderEffectSource {
+ id: source1
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: source2
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffect{
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source1
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+ ShaderEffect {
+ y: parent.height / 2
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source2
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml
new file mode 100644
index 0000000000..67e0cc36ad
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml
@@ -0,0 +1,53 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffect {
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+ ShaderEffect {
+ width: parent.width
+ y: parent.height / 2
+ height: parent.height / 2
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_1.qml
new file mode 100644
index 0000000000..82d288ef9b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_1.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "black"
+
+ Text {
+ id: text
+ anchors.fill: parent
+ font.pixelSize: 16
+ text: "In the field of computer graphics, a shader is a set of software instructions which"
+ + " is used primarily to calculate rendering effects on graphics hardware with a high "
+ + "degree of flexibility. Shaders are used to program the graphics processing unit (GP"
+ + "U) programmable rendering pipeline, which has mostly superseded the fixed-function "
+ + "pipeline that allowed only common geometry transformation and pixel-shading functio"
+ + "ns; with shaders, customized effects can be used."
+ wrapMode: Text.Wrap
+ color: "yellow"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ anchors.fill: parent
+ sourceItem: text
+ smooth: true
+ mipmap: false
+ scale: 1.0
+
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_2.qml
new file mode 100644
index 0000000000..d234eb3ef2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_2.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "black"
+
+ Text {
+ id: text
+ anchors.fill: parent
+ font.pixelSize: 16
+ text: "In the field of computer graphics, a shader is a set of software instructions which"
+ + " is used primarily to calculate rendering effects on graphics hardware with a high "
+ + "degree of flexibility. Shaders are used to program the graphics processing unit (GP"
+ + "U) programmable rendering pipeline, which has mostly superseded the fixed-function "
+ + "pipeline that allowed only common geometry transformation and pixel-shading functio"
+ + "ns; with shaders, customized effects can be used."
+ wrapMode: Text.Wrap
+ color: "yellow"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ anchors.fill: parent
+ sourceItem: text
+ smooth: true
+ mipmap: true
+ scale: 1.0
+
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_3.qml b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_3.qml
new file mode 100644
index 0000000000..229d61088d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_3.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "black"
+
+ Text {
+ id: text
+ anchors.fill: parent
+ font.pixelSize: 16
+ text: "In the field of computer graphics, a shader is a set of software instructions which"
+ + " is used primarily to calculate rendering effects on graphics hardware with a high "
+ + "degree of flexibility. Shaders are used to program the graphics processing unit (GP"
+ + "U) programmable rendering pipeline, which has mostly superseded the fixed-function "
+ + "pipeline that allowed only common geometry transformation and pixel-shading functio"
+ + "ns; with shaders, customized effects can be used."
+ wrapMode: Text.Wrap
+ color: "yellow"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ anchors.fill: parent
+ sourceItem: text
+ smooth: true
+ mipmap: false
+ scale: 0.6
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_4.qml b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_4.qml
new file mode 100644
index 0000000000..01bca9616e
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/mimap/mimap_4.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "black"
+
+ Text {
+ id: text
+ anchors.fill: parent
+ font.pixelSize: 16
+ text: "In the field of computer graphics, a shader is a set of software instructions which"
+ + " is used primarily to calculate rendering effects on graphics hardware with a high "
+ + "degree of flexibility. Shaders are used to program the graphics processing unit (GP"
+ + "U) programmable rendering pipeline, which has mostly superseded the fixed-function "
+ + "pipeline that allowed only common geometry transformation and pixel-shading functio"
+ + "ns; with shaders, customized effects can be used."
+ wrapMode: Text.Wrap
+ color: "yellow"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ anchors.fill: parent
+ sourceItem: text
+ smooth: true
+ mipmap: true
+ scale: 0.6
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/nesting/nesting.qml b/tests/manual/scenegraph_lancelot/data/shaders/nesting/nesting.qml
new file mode 100644
index 0000000000..a1461aa0df
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/nesting/nesting.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 320
+ height: 480
+
+ Text {
+ id: textItem
+ text: "Text Item"
+ visible: false
+ }
+
+ ShaderEffect {
+ width: root.width / 2
+ height: root.height / 2
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ property variant source: ShaderEffectSource {
+ sourceItem: ShaderEffect {
+ width: root.width / 2
+ height: root.height /2
+ property variant source: ShaderEffectSource { sourceItem: textItem }
+ }
+ }
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_1.qml
new file mode 100644
index 0000000000..43843c677b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_1.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: foo
+ width: 200
+ height: 200
+ radius: 100
+ anchors.centerIn: parent
+ gradient: Gradient {
+ GradientStop { position: 0; color: "red" }
+ GradientStop { position: 0.5; color: "white" }
+ GradientStop { position: 1; color: "blue" }
+ }
+ ShaderEffectSource {
+ id: buffer
+ anchors.fill: parent
+ sourceItem: foo
+ live: false
+ smooth: true
+ rotation: 45
+ recursive: true
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_2.qml
new file mode 100644
index 0000000000..957131b4b7
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/recursive/recursive_2.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: foo
+ width: 200
+ height: 200
+ radius: 100
+ anchors.centerIn: parent
+ gradient: Gradient {
+ GradientStop { position: 0; color: "red" }
+ GradientStop { position: 0.5; color: "white" }
+ GradientStop { position: 1; color: "blue" }
+ }
+ ShaderEffectSource {
+ id: buffer
+ anchors.fill: parent
+ sourceItem: foo
+ live: false
+ smooth: true
+ rotation: 90
+ recursive: true
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml
new file mode 100644
index 0000000000..d57f7c5dfb
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffect {
+ anchors.fill: text;
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml
new file mode 100644
index 0000000000..e2a3ca7a0c
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ sourceRect: Qt.rect(rect.x - text.x, rect.y - text.y, rect.width, rect.height)
+ }
+
+ ShaderEffect {
+ anchors.fill: rect
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+ Rectangle {
+ id: rect
+ x: 100
+ y: 100
+ width: 100
+ height: 100
+ color: "transparent"
+ border.width: 2
+ border.color: "red"
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent
+ drag.axis: Drag.XAndYAxis
+ drag.minimumX: 0
+ drag.maximumX: parent.parent.width - width
+ drag.minimumY: 0
+ drag.maximumY: parent.parent.height - height
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml
new file mode 100644
index 0000000000..9df6b13c1e
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: rect1
+ x: 10
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ Rectangle {
+ id: rect2
+ x: 100
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ Rectangle {
+ id: rect3
+ x: 190
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ ShaderEffectSource {
+ id: source
+ property int counter
+ sourceItem: rect1
+ hideSource: true
+ }
+
+ ShaderEffect {
+ id: effect
+ anchors.fill: source.sourceItem
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml
new file mode 100644
index 0000000000..f997630d30
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: rect1
+ x: 10
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ Rectangle {
+ id: rect2
+ x: 100
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ Rectangle {
+ id: rect3
+ x: 190
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ ShaderEffectSource {
+ id: source
+ property int counter
+ sourceItem: rect2
+ hideSource: true
+ }
+
+ ShaderEffect {
+ id: effect
+ anchors.fill: source.sourceItem
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml
new file mode 100644
index 0000000000..0d3c1fc4ee
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_3.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: rect1
+ x: 10
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ Rectangle {
+ id: rect2
+ x: 100
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ Rectangle {
+ id: rect3
+ x: 190
+ y: 10
+ width: 80
+ height: 80
+ radius: 20
+ color: "black"
+ }
+
+ ShaderEffectSource {
+ id: source
+ property int counter
+ sourceItem: rect3
+ hideSource: true
+ }
+
+ ShaderEffect {
+ id: effect
+ anchors.fill: source.sourceItem
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml
new file mode 100644
index 0000000000..1fadabe5b6
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml
@@ -0,0 +1,57 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ id: rect;
+ anchors.centerIn: parent
+ width: 1
+ height: 10
+ visible: false
+
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#ff0000" }
+ GradientStop { position: 0.5; color: "#00ff00" }
+ GradientStop { position: 1; color: "#0000ff" }
+ }
+ }
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: maskSource
+ sourceItem: text
+ smooth: true
+ }
+
+ ShaderEffectSource {
+ id: colorSource
+ sourceItem: rect;
+ smooth: true
+ }
+
+ ShaderEffect {
+ anchors.fill: text;
+
+ property variant colorSource: colorSource
+ property variant maskSource: maskSource;
+
+ fragmentShader: "
+ uniform lowp sampler2D maskSource;
+ uniform lowp sampler2D colorSource;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = texture2D(maskSource, qt_TexCoord0).a * texture2D(colorSource, qt_TexCoord0.yx);
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml
new file mode 100644
index 0000000000..7a3bf9fd36
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ font.pixelSize: 80
+ text: "Shaderz!"
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ hideSource: true
+ }
+
+ ShaderEffect {
+ id: effect
+ anchors.top: text.bottom
+ anchors.left: text.left
+ width: text.width
+ height: text.height
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml
new file mode 100644
index 0000000000..d60dbaee3d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml
@@ -0,0 +1,40 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ font.pixelSize: 80
+ text: "Shaderz!"
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ hideSource: false
+ }
+
+ ShaderEffect {
+ id: effect
+ anchors.top: text.bottom
+ anchors.left: text.left
+ width: text.width
+ height: text.height
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml b/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml
new file mode 100644
index 0000000000..ab8db47009
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml
@@ -0,0 +1,46 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ textureSize: Qt.size(text.width / 2, text.height / 2)
+ smooth: true
+ }
+
+ ShaderEffect {
+ anchors.fill: text
+
+ property variant source: source
+ property variant textureSize: source.textureSize
+ property color color: "black"
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ uniform highp vec2 textureSize;
+ uniform lowp vec4 color;
+ uniform lowp float qt_Opacity;
+ void main() {
+ highp vec2 dx = vec2(0.5 / textureSize.x, 0.);
+ highp vec2 dy = vec2(0., 0.5 / textureSize.y);
+ gl_FragColor = color * 0.25
+ * (texture2D(source, qt_TexCoord0 + dx + dy).a
+ + texture2D(source, qt_TexCoord0 + dx - dy).a
+ + texture2D(source, qt_TexCoord0 - dx + dy).a
+ + texture2D(source, qt_TexCoord0 - dx - dy).a);
+ }
+ "
+ }
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ color: "white"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_1.qml
new file mode 100644
index 0000000000..ad4cce9546
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_1.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ visible: false
+ Item {
+ Text {
+ id: text
+ font.pixelSize: 80
+ text: "Shaderz!"
+ color: "black"
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ anchors.centerIn: parent
+ transform: Rotation { angle: 45 }
+ }
+ }
+ }
+ }
+
+ ShaderEffectSource {
+ width: text.width
+ height: text.height
+ anchors.centerIn: parent
+ sourceItem: text
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_2.qml
new file mode 100644
index 0000000000..834c69f93a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/tree/hiddentree_2.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Rectangle {
+ visible: false
+ Item {
+ Text {
+ id: text
+ font.pixelSize: 80
+ text: "Shaderz!"
+ color: "black"
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ anchors.centerIn: parent
+ transform: Rotation { angle: 90 }
+ }
+ }
+ }
+ }
+
+ ShaderEffectSource {
+ width: text.width
+ height: text.height
+ anchors.centerIn: parent
+ sourceItem: text
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml b/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml
new file mode 100644
index 0000000000..c008114810
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml
@@ -0,0 +1,68 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: clamp
+ sourceItem: text
+ smooth: true
+ wrapMode: ShaderEffectSource.ClampToEdge
+ }
+
+ ShaderEffectSource {
+ id: hRepeat
+ sourceItem: text
+ smooth: true
+ wrapMode: ShaderEffectSource.RepeatHorizontally
+ }
+
+ ShaderEffectSource {
+ id: vRepeat
+ sourceItem: text
+ smooth: true
+ wrapMode: ShaderEffectSource.RepeatVertically
+ }
+
+ ShaderEffectSource {
+ id: repeat
+ sourceItem: text
+ smooth: true
+ wrapMode: ShaderEffectSource.Repeat
+ }
+
+ ShaderEffect {
+ anchors.fill: parent
+
+ property variant cyan: hRepeat
+ property variant magenta: vRepeat
+ property variant yellow: repeat
+ property variant black: clamp
+
+ fragmentShader: "
+ uniform lowp sampler2D cyan;
+ uniform lowp sampler2D magenta;
+ uniform lowp sampler2D yellow;
+ uniform lowp sampler2D black;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ highp vec2 t = qt_TexCoord0 * 3. - 1.;
+ lowp float c = texture2D(cyan, t + vec2(.05, .09)).a;
+ lowp float m = texture2D(magenta, t + vec2(.04, -.10)).a;
+ lowp float y = texture2D(yellow, t + vec2(-.10, .01)).a;
+ lowp float k = texture2D(black, t).a;
+ gl_FragColor = 1. - vec4(c + k, m + k, y + k, 0.);
+ }
+ "
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/shared/blue_72x96.png b/tests/manual/scenegraph_lancelot/data/shared/blue_72x96.png
new file mode 100644
index 0000000000..b9e584d8bd
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/blue_72x96.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/bw_1535x2244.jpg b/tests/manual/scenegraph_lancelot/data/shared/bw_1535x2244.jpg
new file mode 100644
index 0000000000..0fcf12edc3
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/bw_1535x2244.jpg
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/col320x480.jpg b/tests/manual/scenegraph_lancelot/data/shared/col320x480.jpg
new file mode 100644
index 0000000000..c1b54caea8
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/col320x480.jpg
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/cyan_72x96.png b/tests/manual/scenegraph_lancelot/data/shared/cyan_72x96.png
new file mode 100644
index 0000000000..c1ae9f3eee
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/cyan_72x96.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/green_72x96.png b/tests/manual/scenegraph_lancelot/data/shared/green_72x96.png
new file mode 100644
index 0000000000..2ddadde72c
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/green_72x96.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/orange_72x96.png b/tests/manual/scenegraph_lancelot/data/shared/orange_72x96.png
new file mode 100644
index 0000000000..2b0f0c961c
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/orange_72x96.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/red_72x96.png b/tests/manual/scenegraph_lancelot/data/shared/red_72x96.png
new file mode 100644
index 0000000000..db015768d7
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/red_72x96.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/sample_1.png b/tests/manual/scenegraph_lancelot/data/shared/sample_1.png
new file mode 100644
index 0000000000..24d02f4c22
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/sample_1.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/tile.png b/tests/manual/scenegraph_lancelot/data/shared/tile.png
new file mode 100644
index 0000000000..1c54278442
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/tile.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/violet_72x96.png b/tests/manual/scenegraph_lancelot/data/shared/violet_72x96.png
new file mode 100644
index 0000000000..d8ecf51756
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/violet_72x96.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/winter.png b/tests/manual/scenegraph_lancelot/data/shared/winter.png
new file mode 100644
index 0000000000..6a8a7a7981
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/winter.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/world.png b/tests/manual/scenegraph_lancelot/data/shared/world.png
new file mode 100644
index 0000000000..ddbe3fe368
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/world.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/shared/yellow_72x96.png b/tests/manual/scenegraph_lancelot/data/shared/yellow_72x96.png
new file mode 100644
index 0000000000..569b6c1dd7
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shared/yellow_72x96.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/text/data/logo.png b/tests/manual/scenegraph_lancelot/data/text/data/logo.png
new file mode 100644
index 0000000000..d75936b007
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/data/logo.png
Binary files differ
diff --git a/tests/manual/scenegraph_lancelot/data/text/element_sizes.qml b/tests/manual/scenegraph_lancelot/data/text/element_sizes.qml
new file mode 100644
index 0000000000..d570caba9d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/element_sizes.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+//compare default font sizes
+Item {
+ width: 320
+ height: 480
+ Text {
+ id: text_0000
+ anchors.top: parent.top
+ anchors.left: parent.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.family: "Arial"
+ font.pixelSize: 14
+ }
+ TextEdit {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: parent.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.family: "Arial"
+ font.pixelSize: 14
+ }
+ TextInput {
+ id: text_0002
+ anchors.top: text_0001.bottom
+ anchors.left: parent.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.family: "Arial"
+ font.pixelSize: 14
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/scale_smoothed.qml b/tests/manual/scenegraph_lancelot/data/text/scale_smoothed.qml
new file mode 100644
index 0000000000..72bdf9274a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/scale_smoothed.qml
@@ -0,0 +1,79 @@
+import QtQuick 2.0
+
+//vary font scale with smoothing
+
+Item {
+ width: 320
+ height: 480
+ property bool smoothing: true
+ Text {
+ id: text_0000
+ x: 0
+ y: 0
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.3}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: text_0000.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.4}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0002
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.5}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0003
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.6}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0004
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.8; }
+ smooth: smoothing
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_1000_chinese_characters.qml b/tests/manual/scenegraph_lancelot/data/text/text_1000_chinese_characters.qml
new file mode 100644
index 0000000000..9545e6242f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_1000_chinese_characters.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 320
+ height: 480
+
+ property int fontSize: 10
+
+ Column {
+ spacing: 2
+ width: parent.width
+ Text {
+ font.pixelSize: root.fontSize
+ width: parent.width
+ wrapMode: Text.Wrap
+ text:"天地玄黄,宇宙洪è’。日月盈昃,辰宿列张。寒æ¥æš‘往,秋收冬è—。闰余æˆå²ï¼Œå¾‹å•è°ƒé˜³ã€‚云腾致雨,露结为霜。金生丽水,玉出崑冈。剑å·å·¨é˜™ï¼Œç ç§°å¤œå…‰ã€‚æžœçæŽæŸ°ï¼Œèœé‡èŠ¥å§œã€‚海咸河淡,鳞潜羽翔。龙师ç«å¸ï¼Œé¸Ÿå®˜äººçš‡ã€‚始制文字,乃æœè¡£è£³ã€‚推ä½è®©å›½ï¼Œæœ‰è™žé™¶å”。弔民ä¼ç½ªï¼Œå‘¨å‘商汤。åæœé—®é“,垂拱平章。爱育黎首,臣ä¼æˆŽç¾Œã€‚é迩壹体,率宾归王。鸣凤在竹,白驹食场。化被è‰æœ¨ï¼Œèµ–åŠä¸‡æ–¹ã€‚盖此身å‘,四大五常。æ­æƒŸéž å…»ï¼Œå²‚æ•¢æ¯ä¼¤ã€‚女慕贞æ´ï¼Œç”·æ•ˆæ‰è‰¯ã€‚知过必改,得能莫忘。罔谈彼短,é¡æƒå·±é•¿ã€‚信使å¯è¦†ï¼Œå™¨æ¬²éš¾é‡ã€‚墨悲ä¸æŸ“,诗讚羔羊。景行维贤,克念作圣。德建å立,形端表正。空谷传声,虚堂习å¬ã€‚祸因æ¶ç§¯ï¼Œç¦ç¼˜å–„庆。尺璧éžå®ï¼Œå¯¸é˜´æ˜¯ç«žã€‚资父事å›ï¼Œæ›°ä¸¥ä¸Žæ•¬ã€‚å­å½“竭力,忠则尽命。临深履薄,夙兴温清。似兰斯馨,如æ¾ä¹‹ç››ã€‚å·æµä¸æ¯ï¼Œæ¸Šæ¾„å–映。容止若æ€ï¼Œè¨€è¾žå®‰å®šã€‚笃åˆè¯šç¾Žï¼Œæ…Žç»ˆå®œä»¤ã€‚è£ä¸šæ‰€åŸºï¼Œç±ç”šæ— ç«Ÿã€‚学优登仕,摄èŒä»Žæ”¿ã€‚存以甘棠,去而益å’。ä¹æ®Šè´µè´±ï¼Œç¤¼åˆ«å°Šå‘。上和下ç¦ï¼Œå¤«å”±å¦‡éšã€‚外å—傅训,入奉æ¯ä»ªã€‚诸姑伯å”,犹å­æ¯”儿。孔怀兄弟,åŒæ°”è¿žæžã€‚交å‹æŠ•åˆ†ï¼Œåˆ‡ç£¨ç®´è§„。ä»æ…ˆéšæ»ï¼Œé€ æ¬¡å¼—离。节义廉退,颠沛匪äºã€‚性é™æƒ…逸,心动神疲。守真志满,é€ç‰©æ„移。åšæŒé›…æ“,好爵自縻。都邑åŽå¤ï¼Œä¸œè¥¿äºŒäº¬ã€‚背邙é¢æ´›ï¼Œæµ®æ¸­æ®æ³¾ã€‚宫殿盘éƒï¼Œæ¥¼è§‚飞惊。图写禽兽,画彩仙çµã€‚丙èˆå‚å¯ï¼Œç”²å¸å¯¹æ¥¹ã€‚肆筵设席,鼓瑟å¹ç¬™ã€‚å‡é˜¶çº³é™›ï¼Œå¼è½¬ç–‘星。å³é€šå¹¿å†…,左达承明。既集åŸå…¸ï¼Œäº¦èšç¾¤è‹±ã€‚æœç¨¿é’Ÿéš¶ï¼Œæ¼†ä¹¦å£ç»ã€‚府罗将相,路侠æ§å¿ã€‚户å°å…«åŽ¿ï¼Œå®¶ç»™åƒå…µã€‚高冠陪辇,驱毂振缨。世禄侈富,车驾肥轻。策功茂实,勒碑刻铭。磻溪伊尹,ä½æ—¶é˜¿è¡¡ã€‚奄宅曲阜,微旦孰è¥ã€‚桓公匡åˆï¼ŒæµŽå¼±æ‰¶å€¾ã€‚绮迥汉惠,说感武ä¸ã€‚俊乂密勿,多士寔å®ã€‚晋楚更霸,赵é­å›°æ¨ªã€‚å‡é€”ç­è™¢ï¼Œè·µåœŸä¼šç›Ÿã€‚何éµçº¦æ³•ï¼ŒéŸ©å¼Šçƒ¦åˆ‘。起翦颇牧,用军最精。宣å¨æ²™æ¼ ï¼Œé©°èª‰ä¸¹é’。ä¹å·žç¦¹è¿¹ï¼Œç™¾éƒ¡ç§¦å¹¶ã€‚嶽宗泰岱,禅主云亭。é›é—¨ç´«å¡žï¼Œé¸¡ç”°èµ¤åŸŽã€‚昆池碣石,钜野洞庭。旷远绵邈,巖岫æ³å†¥ã€‚治本于农,务兹稼穑。俶载å—亩,我蓺é»ç¨·ã€‚税熟贡新,åŠèµé»œé™Ÿã€‚孟轲敦素,å²é±¼ç§‰ç›´ã€‚庶几中庸,劳谦谨敕。è†éŸ³å¯Ÿç†ï¼Œé‰´è²Œè¾¨è‰²ã€‚贻厥嘉猷,勉其祇æ¤ã€‚çœèº¬è®¥è¯«ï¼Œå® å¢žæŠ—æžã€‚殆辱近耻,林皋幸å³ã€‚两ç–è§æœºï¼Œè§£ç»„è°é€¼ã€‚索居閒处,沉默寂寥。求å¤å¯»è®ºï¼Œæ•£è™‘é€é¥ã€‚欣å¥ç´¯é£ï¼Œæˆšè°¢æ¬¢æ‹›ã€‚渠è·çš„历,园莽抽æ¡ã€‚枇æ·æ™šç¿ ï¼Œæ¢§æ¡æ—©å‡‹ã€‚陈根委翳,è½å¶é£˜é£–。游鲲独è¿ï¼Œå‡Œæ‘©ç»›éœ„。耽读翫市,寓目囊箱。易輶攸ç•ï¼Œå±žè€³åž£å¢™ã€‚具膳é¤é¥­ï¼Œé€‚å£å……肠。饱饫烹宰,饥厌糟糠。亲戚故旧,è€å°‘异粮。妾御织纺,ä¾å·¾å¸·æˆ¿ã€‚纨扇圆絜,银烛炜煌。昼眠夕å¯ï¼Œè“笋象床。弦歌酒䜩,接æ¯ä¸¾è§žã€‚矫手顿足,悦豫且康。嫡åŽå—£ç»­ï¼Œç¥­ç¥€è’¸å°ã€‚稽颡å†æ‹œï¼Œæ‚šæƒ§æ惶。笺牒简è¦ï¼Œé¡¾ç­”审详。骸垢想浴,执热愿凉。驴骡犊特,骇跃超骧。诛斩贼盗,æ•èŽ·å›äº¡ã€‚布射辽丸,嵇ç´é˜®å•¸ã€‚æ¬ç¬”伦纸,钧巧任钓。释纷利俗,并皆佳妙。毛施淑姿,工颦å¦ç¬‘。年矢æ¯å‚¬ï¼Œæ›¦æ™–朗曜。璇玑悬斡,晦魄环照。指薪修祜,永绥å‰åŠ­ã€‚矩步引领,俯仰廊庙。æŸå¸¦çŸœåº„,徘徊瞻眺。孤陋寡闻,愚蒙等诮。谓语助者,焉哉乎也。"
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_2500_chinese_characters.qml b/tests/manual/scenegraph_lancelot/data/text/text_2500_chinese_characters.qml
new file mode 100644
index 0000000000..3d2ea8be58
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_2500_chinese_characters.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 320
+ height: 480
+
+ property string chars: "一乙二åä¸åŽ‚七åœäººå…¥å…«ä¹å‡ å„¿äº†åŠ›ä¹ƒåˆ€åˆä¸‰äºŽå¹²äºå£«å·¥åœŸæ‰å¯¸ä¸‹å¤§ä¸ˆä¸Žä¸‡ä¸Šå°å£å·¾å±±åƒä¹žå·äº¿ä¸ªå‹ºä¹…凡åŠå¤•ä¸¸ä¹ˆå¹¿äº¡é—¨ä¹‰ä¹‹å°¸å¼“己已å­å«ä¹Ÿå¥³é£žåˆƒä¹ å‰é©¬ä¹¡ä¸°çŽ‹äº•å¼€å¤«å¤©æ— å…ƒä¸“云扎艺木五支厅ä¸å¤ªçŠ¬åŒºåŽ†å°¤å‹åŒ¹è½¦å·¨ç‰™å±¯æ¯”互切瓦止少日中冈è´å†…æ°´è§åˆç‰›æ‰‹æ¯›æ°”å‡é•¿ä»ä»€ç‰‡ä»†åŒ–仇å¸ä»ä»…斤爪å介父从今凶分ä¹å…¬ä»“月æ°å‹¿æ¬ é£Žä¸¹åŒ€ä¹Œå‡¤å‹¾æ–‡å…­æ–¹ç«ä¸ºæ–—忆订计户认心尺引丑巴孔队办以å…予åŠåŒä¹¦å¹»çŽ‰åˆŠç¤ºæœ«æœªå‡»æ‰“巧正扑扒功扔去甘世å¤èŠ‚本术å¯ä¸™å·¦åŽ‰å³çŸ³å¸ƒé¾™å¹³ç­è½§ä¸œå¡åŒ—å ä¸šæ—§å¸…归且旦目å¶ç”²ç”³å®ç”µå·ç”°ç”±å²åªå¤®å…„å¼å«å¦å¨å¹å››ç”Ÿå¤±ç¦¾ä¸˜ä»˜ä»—代仙们仪白仔他斥瓜乎丛令用甩å°ä¹å¥åŒ†å†ŒçŠ¯å¤–处冬鸟务包饥主市立闪兰åŠæ±æ±‡å¤´æ±‰å®ç©´å®ƒè®¨å†™è®©ç¤¼è®­å¿…议讯记永å¸å°¼æ°‘出辽奶奴加å¬çš®è¾¹å‘孕圣对å°çŸ›çº æ¯å¹¼ä¸å¼åˆ‘动扛寺å‰æ‰£è€ƒæ‰˜è€æ‰§å·©åœ¾æ‰©æ‰«åœ°æ‰¬åœºè€³å…±èŠ’亚èŠæœ½æœ´æœºæƒè¿‡è‡£å†å西压厌在有百存而页匠夸夺ç°è¾¾åˆ—æ­»æˆå¤¹è½¨é‚ªåˆ’迈毕至此贞师尘尖劣光当早åå“虫曲团åŒåŠåƒå› å¸å—屿帆å²å›žå²‚刚则肉网年朱先丢舌竹è¿ä¹”伟传乒乓休ä¼ä¼ä¼˜ä¼å»¶ä»¶ä»»ä¼¤ä»·ä»½åŽä»°ä»¿ä¼™ä¼ªè‡ªè¡€å‘ä¼¼åŽè¡ŒèˆŸå…¨ä¼šæ€åˆå…†ä¼ä¼—爷伞创肌朵æ‚å±æ—¬æ—¨è´Ÿå„å多争色壮冲冰庄庆亦刘é½äº¤æ¬¡è¡£äº§å†³å……妄闭问闯羊并关米ç¯å·žæ±—污江池汤忙兴宇守宅字安讲军许论农讽设访寻那迅尽导异孙阵阳收阶阴防奸如妇好她妈æˆç¾½è§‚欢买红纤级约纪驰巡寿弄麦形进戒åžè¿œè¿è¿æ‰¶æŠšå›æŠ€å扰拒找批扯å€èµ°æŠ„å贡攻赤折抓扮抢å­å‡æŠ›æŠ•åŸæŠ—å‘åŠæŠ–护壳志扭å—声把报å´åŠ«èŠ½èŠ±èŠ¹èŠ¬è‹èŠ³ä¸¥èŠ¦åŠ³å…‹è‹æ†æ æœææ‘ææžæŽæ¨æ±‚æ›´æŸè±†ä¸¤ä¸½åŒ»è¾°åŠ±å¦è¿˜æ­¼æ¥è¿žæ­¥åšæ—±ç›¯å‘ˆæ—¶å´åŠ©åŽ¿é‡Œå‘†å›­æ—·å›´å‘€å¨è¶³é‚®ç”·å›°åµä¸²å‘˜å¬å©å¹å‘œå§å¼åˆ«å²—å¸è´¢é’ˆé’‰å‘Šæˆ‘乱利秃秀ç§æ¯å…µä¼°ä½“何但伸作伯伶佣低你ä½ä½ä¼´èº«çš‚佛近彻役返余希å谷妥å«é‚»å²”è‚肚肠龟å…狂犹角删æ¡åµå²›è¿Žé¥­é¥®ç³»è¨€å†»çŠ¶äº©å†µåºŠåº“疗应冷这åºè¾›å¼ƒå†¶å¿˜é—²é—´é—·åˆ¤ç¶ç¿å¼Ÿæ±ªæ²™æ±½æ²ƒæ³›æ²Ÿæ²¡æ²ˆæ²‰æ€€å¿§å¿«å®Œå®‹å®ç‰¢ç©¶ç©·ç¾è‰¯è¯å¯è¯„è¡¥åˆç¤¾è¯†è¯‰è¯Šè¯è¯‘å›çµå³å±‚尿尾迟局改张忌际陆阿陈阻附妙妖妨努å¿åŠ²é¸¡é©±çº¯çº±çº³çº²é©³çºµçº·çº¸çº¹çººé©´çº½å¥‰çŽ©çŽ¯æ­¦é’责现表规抹拢拔拣担å¦æŠ¼æŠ½æ‹æ‹–æ‹è€…顶拆拥抵拘势抱垃拉拦拌幸招å¡æŠ«æ‹¨æ‹©æŠ¬å…¶å–苦若茂苹苗英范直茄茎茅林æžæ¯æŸœæžæ¿æ¾æžªæž„æ°è¿°æž•ä¸§æˆ–ç”»å§äº‹åˆºæž£é›¨å–矿ç åŽ•å¥”奇奋æ€æ¬§åž„妻轰顷转斩轮软到éžå”肯齿些虎è™è‚¾è´¤å°šæ—ºå…·æžœå‘³æ˜†å›½æ˜Œç•…明易昂典固忠å’呼鸣å’呢岸岩帖罗帜岭凯败贩购图钓制知垂牧物乖刮秆和季委佳ä¾ä¾›ä½¿ä¾‹ç‰ˆä¾„侦侧凭侨佩货ä¾çš„迫质欣å¾å¾€çˆ¬å½¼å¾„所èˆé‡‘命斧爸采å—乳贪念贫肤肺肢肿胀朋股肥æœèƒå‘¨æ˜é±¼å…”ç‹å¿½ç‹—备饰饱饲å˜äº¬äº«åº—夜庙府底剂郊废净盲放刻育闸闹郑券å·å•ç‚’炊炕炎炉沫浅法泄河沾泪油泊沿泡注泻泳泥沸波泼泽治怖性怕怜怪学å®å®—定宜审宙官空帘实试郎诗肩房诚衬衫视è¯è¯žè¯¢è¯¥è¯¦å»ºè‚ƒå½•éš¶å±…届刷屈弦承孟孤陕é™é™å¦¹å§‘å§å§“始驾å‚艰线练组细驶织终驻驼ç»ç»è´¯å¥æ˜¥å¸®ç玻毒型挂å°æŒé¡¹åž®æŒŽåŸŽæŒ æ”¿èµ´èµµæŒ¡æŒºæ‹¬æ‹´æ‹¾æŒ‘指垫挣挤拼挖按挥挪æŸç”šé©è巷带è‰èŒ§èŒ¶è’茫è¡è£æ•…胡å—è¯æ ‡æž¯æŸ„栋相查æŸæŸ³æŸ±æŸ¿æ æ ‘è¦å’¸å¨æ­ªç ”砖厘厚砌ç é¢è€è€ç‰µæ®‹æ®ƒè½»é¸¦çš†èƒŒæˆ˜ç‚¹ä¸´è§ˆç«–çœå‰Šå°æ˜¯ç›¼çœ¨å“„显哑冒映星昨ç•è¶´èƒƒè´µç•Œè™¹è™¾èšæ€èš‚虽å“咽骂哗咱å“哈咬咳哪炭峡罚贱贴骨钞钟钢钥钩å¸ç¼¸æ‹œçœ‹çŸ©æ€Žç‰²é€‰é€‚秒香ç§ç§‹ç§‘é‡å¤ç«¿æ®µä¾¿ä¿©è´·é¡ºä¿®ä¿ä¿ƒä¾®ä¿­ä¿—俘信皇泉鬼侵追俊盾待律很须å™å‰‘逃食盆胆胜胞胖脉勉狭狮独狡狱狠贸怨急饶蚀饺饼弯将奖哀亭亮度迹庭疮疯疫疤姿亲音å¸æ–½é—»é˜€é˜å·®å…»ç¾Žå§œå›é€ç±»è¿·å‰é¦–逆总炼炸炮烂剃æ´æ´ªæ´’浇浊洞测洗活派洽染济洋洲浑浓津æ’æ¢æ°æ¼æ¨ä¸¾è§‰å®£å®¤å®«å®ªçªç©¿çªƒå®¢å† è¯­æ‰è¢„祖神ç¥è¯¯è¯±è¯´è¯µåž¦é€€æ—¢å±‹æ˜¼è´¹é™¡çœ‰å­©é™¤é™©é™¢å¨ƒå§¥å§¨å§»å¨‡æ€’架贺盈勇怠柔垒绑绒结绕骄绘给络骆ç»ç»žç»Ÿè€•è€—艳泰ç ç­ç´ èš•é¡½ç›åŒªæžæ ½æ•æŒ¯è½½èµ¶èµ·ç›æŽæ埋æ‰æ†ææŸéƒ½å“²é€æ¡æ¢æŒ½çƒ­æ壶挨耻耽æ­èŽ²èŽ«è·èŽ·æ™‹æ¶çœŸæ¡†æ¡‚æ¡£æ¡æ ªæ¡¥æ¡ƒæ ¼æ ¡æ ¸æ ·æ ¹ç´¢å“¥é€Ÿé€—æ —é…翅辱唇å¤ç¡€ç ´åŽŸå¥—é€çƒˆæ®Šé¡¾è½¿è¾ƒé¡¿æ¯™è‡´æŸ´æ¡Œè™‘监紧党晒眠晓鸭晃晌晕蚊哨哭æ©å”¤å•Šå”‰ç½¢å³°åœ†è´¼è´¿é’±é’³é’»é“铃铅缺氧特牺造乘敌秤租积秧秩称秘é€ç¬”笑笋债借值倚倾倒倘俱倡候俯å€å€¦å¥è‡­å°„躬æ¯å¾’å¾èˆ°èˆ±èˆ¬èˆªé€”拿爹爱颂ç¿è„†è„‚胸胳è„胶脑狸狼逢留皱饿æ‹æ¡¨æµ†è¡°é«˜å¸­å‡†åº§è„Šç—‡ç—…疾疼疲效离å”资凉站剖竞部æ—旅畜阅羞瓶拳粉料益兼烤烘烦烧烛烟递涛浙æ¶é…’涉消浩海涂浴浮æµæ¶¦æµªæµ¸æ¶¨çƒ«æ¶Œæ‚Ÿæ‚„悔悦害宽家宵宴宾窄容宰案请朗诸读扇袜袖è¢è¢«ç¥¥è¯¾è°è°ƒå†¤è°…谈谊剥æ³å±•å‰§å±‘弱陵陶陷陪娱娘通能难预桑绢绣验继çƒç†æ§å µæ域掩æ·æŽ’掉堆推掀授教æŽæŽ åŸ¹æŽ¥æŽ§æŽ¢æ®æŽ˜èŒåŸºè‘—勒黄èŒèèŒèœè„èŠèè è¥æ¢°æ¢¦æ¢¢æ¢…检梳梯桶救副票戚爽è‹è¢­ç››é›ªè¾…辆虚雀堂常匙晨ç眯眼悬野啦晚啄è·è·ƒç•¥è›‡ç´¯å”±æ‚£å”¯å´–崭崇圈铜铲银甜梨çŠç§»ç¬¨ç¬¼ç¬›ç¬¦ç¬¬æ•åšè¢‹æ‚ å¿å¶å·æ‚¨å”®åœåå‡å¾—衔盘船斜盒鸽悉欲彩领脚脖脸脱象够猜猪猎猫猛馅馆凑å‡æ¯«éº»ç—’痕廊康庸鹿盗章竟商æ—旋望率ç€ç›–粘粗粒断剪兽清添淋淹渠æ¸æ··æ¸”淘液淡深婆æ¢æ¸—情惜惭悼惧惕惊惨惯寇寄宿窑密谋谎祸谜逮敢屠弹éšè›‹éš†éšå©šå©¶é¢ˆç»©ç»ªç»­éª‘绳维绵绸绿ç´æ–‘替款堪æ­å¡”越è¶è¶‹è¶…æå ¤åšæ­å–œæ’æªæœç…®æ´è£ææ‚æ…æ¡æ‰æ–¯æœŸæ¬ºè”散惹葬葛董葡敬葱è½æœè¾œè‘µæ£’棋æ¤æ£®æ¤…椒棵æ£æ£‰æ£šæ£•æƒ æƒ‘逼厨厦硬确é›æ®–裂雄暂雅辈悲紫辉敞èµæŽŒæ™´æš‘最é‡å–·æ™¶å–‡é‡å–Šæ™¯è·µè·Œè·‘é—蛙蛛蜓å–喂喘喉幅帽赌赔黑铸铺链销é”锄锅锈锋é”短智毯鹅剩ç¨ç¨‹ç¨€ç¨Žç­ç­‰ç­‘策筛筒答筋ç­å‚²å‚…牌堡集焦å‚储奥街惩御循艇舒番释禽腊脾腔é²çŒ¾çŒ´ç„¶é¦‹è£…蛮就痛童阔善羡普粪尊é“曾焰港湖渣湿温渴滑湾渡游滋溉愤慌惰愧愉慨割寒富窜çªçª—é裕裤裙谢谣谦属屡强粥ç–隔隙絮嫂登缎缓编骗缘瑞魂肆摄摸填æ塌鼓摆æºæ¬æ‘‡æžå¡˜æ‘Šè’œå‹¤é¹Šè“墓幕蓬蓄蒙蒸献ç¦æ¥šæƒ³æ§æ¦†æ¥¼æ¦‚赖酬感ç¢ç¢‘碎碰碗碌雷零雾雹输ç£é¾„鉴ç›ç¡ç¬é„™æ„šæš–盟歇暗照跨跳跪路跟é£è›¾èœ‚嗓置罪罩错锡锣锤锦键锯矮辞稠æ„筹签简æ¯èˆ…鼠催傻åƒèº²å¾®æ„ˆé¥è…°è…¥è…¹è…¾è…¿è§¦è§£é…±ç—°å»‰æ–°éŸµæ„粮数煎塑慈煤煌满漠æºæ»¤æ»¥æ»”溪溜滚滨粱滩慎誉塞谨ç¦ç¾¤æ®¿è¾Ÿéšœå«Œå«å ç¼ç¼ é™ç¢§ç’ƒå¢™æ’‡å˜‰æ‘§æˆªèª“境摘摔èšè”½æ…•æš®è”‘模榴榜榨歌é­é…·é…¿é…¸ç£æ„¿éœ€å¼Šè£³é¢—嗽蜻蜡è‡èœ˜èµšé”¹é”»èˆžç¨³ç®—箩管僚鼻魄貌膜膊膀鲜疑馒裹敲豪è†é®è…瘦辣竭端旗精歉熄熔漆漂漫滴演æ¼æ…¢å¯¨èµ›å¯Ÿèœœè°±å«©ç¿ ç†Šå‡³éª¡ç¼©æ…§æ’•æ’’趣趟撑播撞撤增èªéž‹è•‰è”¬æ¨ªæ§½æ¨±æ©¡é£˜é†‹é†‰éœ‡éœ‰çž’题暴瞎影踢è¸è¸©è¸ªè¶è´å˜±å¢¨é•‡é ç¨»é»Žç¨¿ç¨¼ç®±ç®­ç¯‡åƒµèººåƒ»å¾·è‰˜è†è†›ç†Ÿæ‘©é¢œæ¯…糊éµæ½œæ½®æ‡‚é¢æ…°åŠˆæ“燕薯薪薄颠橘整èžé†’é¤å˜´è¹„器赠默镜赞篮邀衡膨雕磨å‡è¾¨è¾©ç³–糕燃澡激懒å£é¿ç¼´æˆ´æ“¦éž è—霜霞瞧蹈螺穗ç¹è¾«èµ¢ç³Ÿç³ ç‡¥è‡‚翼骤鞭覆蹦镰翻鹰警攀蹲颤瓣爆疆壤耀èºåš¼åš·ç±é­”çŒè ¢éœ¸éœ²å›Šç½"
+ property int fontSize: 40
+
+ Text {
+ id: textElement
+ property int characterIndex: 0
+
+ font.pixelSize: root.fontSize
+ anchors.centerIn: root
+ text: ""
+
+ Timer {
+ id: timer
+ interval: 100
+ running: true
+ repeat: true
+ onTriggered: {
+ textElement.text = root.chars.charAt(textElement.characterIndex)
+ textElement.characterIndex = (textElement.characterIndex + 1) % root.chars.length
+ if (textElement.characterIndex == 0) {
+ console.debug("Finished with " + root.chars.length + " chars!")
+ timer.stop()
+ }
+ }
+ }
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_arabic.qml b/tests/manual/scenegraph_lancelot/data/text/text_arabic.qml
new file mode 100644
index 0000000000..8c68a1730a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_arabic.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "هو أمّا حكومة القاذÙات مكن, ÙˆÙÙŠ تنÙّس الشرقي لهيمنة أن. هو قام هزيمة وأزيز اندلاع, ومن أي وبداية الواقعة. Ùˆ إخضاع الكونجرس الموسوعة حول, جÙÙ„ Ùˆ سابق للغزو،, به، الحرب كنقطة المارق تم. شدّت الشطر وحلÙاؤها بـ أسر, هذه بمعارضة والديون باستخدام تم, بـ معاملة الجنوبي لها. وسÙÙ† لهذه الحزب قام ٣٠, من الحرة عشوائية Ùعل, غير ٣٠ أوسع علاقة إستمات."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_background_color.qml b/tests/manual/scenegraph_lancelot/data/text/text_background_color.qml
new file mode 100644
index 0000000000..4c6fa16bc2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_background_color.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ color: "green"
+ textFormat: Text.RichText
+ text: "<body bgcolor=lightblue>Some text<br />Some more text</body>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_background_color_styledtext.qml b/tests/manual/scenegraph_lancelot/data/text/text_background_color_styledtext.qml
new file mode 100644
index 0000000000..ebf3adc035
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_background_color_styledtext.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ color: "green"
+ textFormat: Text.StyledText
+ text: "<body bgcolor=lightblue>Some text<br />Some more text</body>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bengali.qml b/tests/manual/scenegraph_lancelot/data/text/text_bengali.qml
new file mode 100644
index 0000000000..ff04c23743
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bengali.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial" // Should use Lohit Bengali
+ font.pixelSize: 20
+ text: "ধারা ১: সমসà§à¦¤ মানà§à¦· সà§à¦¬à¦¾à¦§à§€à¦¨à¦­à¦¾à¦¬à§‡ সমান মরà§à¦¯à¦¾à¦¦à¦¾ à¦à¦¬à¦‚ অধিকার নিয়ে জনà§à¦®à¦—à§à¦°à¦¹à¦£ করে। তাà¦à¦¦à§‡à¦° বিবেক à¦à¦¬à¦‚ বà§à¦¦à§à¦§à¦¿ আছে; সà§à¦¤à¦°à¦¾à¦‚ সকলেরই à¦à¦•à§‡ অপরের পà§à¦°à¦¤à¦¿ ভà§à¦°à¦¾à¦¤à§ƒà¦¤à§à¦¬à¦¸à§à¦²à¦­ মনোভাব নিয়ে আচরণ করা উচিৎ।"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bidi.qml b/tests/manual/scenegraph_lancelot/data/text/text_bidi.qml
new file mode 100644
index 0000000000..25e7f51803
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bidi.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "Lorem ipsum dolor sit amet, agam sonet vitae. "
+ + "جÙÙ„ أم تشرشل والنازي. عل وقد كنقطة الهجوم. "
+ + "Dolorum assueverit vis ex. Zril graeci eirmod sed."
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_left_elide.qml b/tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_left_elide.qml
new file mode 100644
index 0000000000..e8bf2e6d44
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_left_elide.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "\u202e This is RTL \u202c"
+ elide: Text.ElideLeft
+ width: 100
+ wrapMode: Text.NoWrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_right_elide.qml b/tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_right_elide.qml
new file mode 100644
index 0000000000..aedf34d9fb
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bidi_control_character_right_elide.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "\u202e This is RTL \u202c"
+ elide: Text.ElideRight
+ width: 100
+ wrapMode: Text.NoWrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bidi_left_elide.qml b/tests/manual/scenegraph_lancelot/data/text/text_bidi_left_elide.qml
new file mode 100644
index 0000000000..03dac8a460
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bidi_left_elide.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "هو أمّا حكومة القاذÙات مكن"
+ elide: Text.ElideLeft
+ width: 100
+ wrapMode: Text.NoWrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bidi_right_elide.qml b/tests/manual/scenegraph_lancelot/data/text/text_bidi_right_elide.qml
new file mode 100644
index 0000000000..2d7e4347db
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bidi_right_elide.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "هو أمّا حكومة القاذÙات مكن"
+ elide: Text.ElideRight
+ width: 100
+ wrapMode: Text.NoWrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_bidi_underline.qml b/tests/manual/scenegraph_lancelot/data/text/text_bidi_underline.qml
new file mode 100644
index 0000000000..244cf7c22a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_bidi_underline.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ font.underline: true
+ text: "Lorem ipsum dolor sit amet, agam sonet vitae. "
+ + "جÙÙ„ أم تشرشل والنازي. عل وقد كنقطة الهجوم. "
+ + "Dolorum assueverit vis ex. Zril graeci eirmod sed."
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_capitalization.qml b/tests/manual/scenegraph_lancelot/data/text/text_capitalization.qml
new file mode 100644
index 0000000000..e01e855f89
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_capitalization.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: upperCaseText
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.AllUppercase
+ text: "This text is all uppercase"
+ }
+
+ Text {
+ id: lowerCaseText
+ anchors.top: upperCaseText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.AllLowercase
+ text: "This text is all lowercase"
+ }
+
+ Text {
+ id: smallCapsText
+ anchors.top: lowerCaseText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.SmallCaps
+ text: "This text is smallcaps"
+ }
+
+ Text {
+ id: capitalizedText
+ anchors.top: smallCapsText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.Capitalize
+ text: "This text is capitalized"
+ }
+
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_chinese.qml b/tests/manual/scenegraph_lancelot/data/text/text_chinese.qml
new file mode 100644
index 0000000000..509dd183c4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_chinese.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.pixelSize: 20
+ text: "禖 犿玒 鋑鋡髬 蘹蠮躘 飹勫嫢, ç· è»µé€¯ çƒçƒšçœ 訬軗郲 箖緌翢 毹 肒芅 瀿犨皫 迡俶倗 觛è©è², åºŒå¼ è¨°è²¥éƒª 蹢鎒鎛 çƒºç„†ç€ æ§, è’› 犆犅 燲ç¯ç’¯ è€èƒ è‡¿ èž’èžèžœ ç¶ç¸ çµ¼ 蛃袚觙 簻臗藱, éžé¬¿ è·¿ 堔埧娾 幨懅憴 榯 雈é®å‚¿ 裺觨誖 糋罶羬 é®å‚¿, 氀濆 犵艿邔 è°¾è¸˜é³ ç·±ç¿¬è†ž æš• 踙 毼毹 樛槷殦 忀瀸蘌"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_colored_text.qml b/tests/manual/scenegraph_lancelot/data/text/text_colored_text.qml
new file mode 100644
index 0000000000..1b31ab6117
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_colored_text.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ color: "blue"
+ textFormat: Text.RichText
+ text: "<font color=\"red\">Lorem ipsum</font> <font color=\"green\">dolor sit amet<font>, consectetur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_cyrillic.qml b/tests/manual/scenegraph_lancelot/data/text/text_cyrillic.qml
new file mode 100644
index 0000000000..00e10dddb9
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_cyrillic.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "Ðу миров называть опа, назад вÑегда Ð¿Ñ€ÐµÐ´Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ð°Ñ Ð´Ð»Ñ Ð¾Ñ‚, работали гринÑпана обеÑпечении как ну. Себе делаете напиÑано те длÑ, том дейÑÑ‚Ð²Ð¸Ñ Ð¿Ñ€Ð¾ÐµÐºÑ‚Ð¾Ð¼ по, хватит комнату предÑтавим он как. Другие работал медицинÑкое Ð²Ð°Ñ Ñ‚Ñ‹. Том такие Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð½Ñƒ."
+ }
+}
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_devanagari.qml b/tests/manual/scenegraph_lancelot/data/text/text_devanagari.qml
new file mode 100644
index 0000000000..ea5830d991
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_devanagari.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "सारà¥à¤µà¤œà¤¨à¤¿à¤• विकेनà¥à¤¦à¥à¤°à¤¿à¤¤ वरà¥à¤£à¤¨ कोहम विषय वेबजाल दिनांक माहितीवानीजà¥à¤¯ औषधिक लकà¥à¤·à¤£ हैं। दà¥à¤µà¤¾à¤°à¤¾ विभाजन पà¥à¤°à¥‹à¤¤à¥à¤¸à¤¾à¤¹à¤¿à¤¤ मà¥à¤–à¥à¤¯ विनिमय जानकारी पहोच गयेगया विसà¥à¤¤à¤°à¤£à¤•à¥à¤·à¤®à¤¤à¤¾ होगा जिसकी मà¥à¤–à¥à¤¯ रखते बिनà¥à¤¦à¥à¤“ शारिरिक बीसबतेबोध कीने नवंबर सभिसमज संसà¥à¤¥à¤¾à¤¨"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_floating_image_left.qml b/tests/manual/scenegraph_lancelot/data/text/text_floating_image_left.qml
new file mode 100644
index 0000000000..27bd29c4e3
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_floating_image_left.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ width: parent.width
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ textFormat: Text.RichText
+ text: "This image is to the<img align=left src=\"data/logo.png\" /> left of the text <br />More text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_floating_image_right.qml b/tests/manual/scenegraph_lancelot/data/text/text_floating_image_right.qml
new file mode 100644
index 0000000000..65949d7bf7
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_floating_image_right.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: parent.width
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ textFormat: Text.RichText
+ text: "This image is to the<img align=right src=\"data/logo.png\" /> right of the text <br />More text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_fonts.qml b/tests/manual/scenegraph_lancelot/data/text/text_fonts.qml
new file mode 100644
index 0000000000..bc1f411159
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_fonts.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+//test different fonts
+Item {
+ width: 320
+ height: 480
+ Text {
+ id: text_0000
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Light
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Helvetica"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0002
+ width: 150
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.DemiBold
+ color: "black"
+ font.family: "Courier"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0003
+ width: 150
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Bold
+ color: "black"
+ font.family: "Calibri"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0004
+ width: 150
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Black
+ color: "black"
+ font.family: "Loma"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0005
+ width: 150
+ anchors.top: text_0004.bottom
+ anchors.left: text_0004.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Bitstream Charter"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0006
+ width: 150
+ anchors.top: text_0005.bottom
+ anchors.left: text_0005.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "FreeSans"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0007
+ width: 150
+ anchors.top: text_0006.bottom
+ anchors.left: text_0006.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Garuda"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_georgian.qml b/tests/manual/scenegraph_lancelot/data/text/text_georgian.qml
new file mode 100644
index 0000000000..f63dcf1c13
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_georgian.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "„ყáƒáƒ•áƒ”ლი სáƒáƒ˜áƒ“უმლáƒáƒ² áƒáƒ›áƒáƒ¡ ენáƒáƒ¡áƒ შინრდáƒáƒ›áƒáƒ áƒ®áƒ£áƒš áƒáƒ áƒ¡â€œ – იáƒáƒáƒœáƒ”-ზáƒáƒ¡áƒ˜áƒ›áƒ” (X ს.)"
+
+ }
+}
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_hebrew.qml b/tests/manual/scenegraph_lancelot/data/text/text_hebrew.qml
new file mode 100644
index 0000000000..105c4e27b3
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_hebrew.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "שמו ×ל קהילה ×גרונומיה. שדרות בהשחתה בהתייחסות ×× ×¢×•×“, ×ת ×¢×–×” ×™×•×¦×¨×™× ×ירועי×. בה ×× × ×›× ×™×¡×” ××—×¨×•× ×™× ×•×¤×™×ª×•×—×”, ×ו כימיה ×”×’×¨×¤×™× ×חד. של שער הב××™× ×§×•×“×ž×•×ª טבל×ות. בקרבת שימושי סוציולוגיה שער מה, מתן כלכלה ×ž×©×—×§×™× ×ו, בדף ×œ×™×•× ×¢×¨×‘×™×ª למחיקה בה. מ×מר המלצת פיסיקה שער בה."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml b/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml
new file mode 100644
index 0000000000..86b528f0a4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml
@@ -0,0 +1,35 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ id: implicitSizedText
+ textFormat: Text.RichText
+ text: "<center>Implicit size<br>----- Second line -----</center>"
+ anchors.centerIn: parent
+ color: "white"
+
+ Rectangle {
+ anchors.fill: parent
+ z: -1
+ color: "blue"
+ }
+ }
+ Text {
+ textFormat: Text.RichText
+ text: "<center>Explicit size<br>----- Second line -----</center>"
+ anchors.top: implicitSizedText.bottom
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 300
+ color: "white"
+
+ Rectangle {
+ anchors.fill: parent
+ z: -1
+ color: "blue"
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_inline_image.qml b/tests/manual/scenegraph_lancelot/data/text/text_inline_image.qml
new file mode 100644
index 0000000000..b401c578f2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_inline_image.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "This image is <img width=16 height=16 src=\"data/logo.png\" /> in the middle of the text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_italic_bold.qml b/tests/manual/scenegraph_lancelot/data/text/text_italic_bold.qml
new file mode 100644
index 0000000000..256e8ee8ba
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_italic_bold.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ width: parent.width
+ anchors.centerIn: parent
+ font.pixelSize: 20
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ text: "<i>Lorem ipsum dolor sit amet</i>, consectetur <b>adipiscing</b> elit. Maecenas nibh."
+ font.family: "Arial"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_italic_bold_chinese.qml b/tests/manual/scenegraph_lancelot/data/text/text_italic_bold_chinese.qml
new file mode 100644
index 0000000000..be93b869c8
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_italic_bold_chinese.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ width: parent.width
+ anchors.centerIn: parent
+ font.pixelSize: 20
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ text: "<i>æ»Šç… ç½žè€–èŒ­ é†™é† é– ç®¯</i>, 彃 榾毄 <b>èžèž‰è¤©</b> 籿ç´ç¾‘"
+ font.family: "Arial"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_khmer.qml b/tests/manual/scenegraph_lancelot/data/text/text_khmer.qml
new file mode 100644
index 0000000000..e4bbe46c0f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_khmer.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "អក្សរច្រៀង"
+ }
+}
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_circle.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_circle.qml
new file mode 100644
index 0000000000..52c12be682
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_circle.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "<html><body>Here's a list: <ul style=\"list-style-type: circle\"><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul> And some more text</body></html>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_inline_image.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_inline_image.qml
new file mode 100644
index 0000000000..6557cbf027
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_inline_image.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Here's a list: <ul><li>List item 1</li><li>List <img height=16 width=16 src=\"data/logo.png\" />item 2</li><li>List item 3</li></ul> And some more text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_ordered.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered.qml
new file mode 100644
index 0000000000..6a74436512
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Here's a list: <ol><li>List item 1</li><li>List item 2</li><li>List item 3</li></ol> And some more text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_alpha.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_alpha.qml
new file mode 100644
index 0000000000..48cae8f16b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_alpha.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Here's a list: <ol style=\"list-style-type: lower-alpha\"><li>List item 1</li><li>List item 2</li><li>List item 3</li></ol> And some more text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_roman.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_roman.qml
new file mode 100644
index 0000000000..e6a25c3eca
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_lower_roman.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Here's a list: <ol style=\"list-style-type: lower-roman\"><li>List item 1</li><li>List item 2</li><li>List item 3</li></ol> And some more text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_alpha.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_alpha.qml
new file mode 100644
index 0000000000..079b92c097
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_alpha.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Here's a list: <ol style=\"list-style-type: upper-alpha\"><li>List item 1</li><li>List item 2</li><li>List item 3</li></ol> And some more text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_roman.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_roman.qml
new file mode 100644
index 0000000000..27d60a5374
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_ordered_upper_roman.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Here's a list: <ol style=\"list-style-type: upper-roman\"><li>List item 1</li><li>List item 2</li><li>List item 3</li></ol> And some more text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_list_square.qml b/tests/manual/scenegraph_lancelot/data/text/text_list_square.qml
new file mode 100644
index 0000000000..36227eb754
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_list_square.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "<html><body>Here's a list: <ul style=\"list-style-type: square\"><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul> And some more text</body></html>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_multiline.qml b/tests/manual/scenegraph_lancelot/data/text/text_multiline.qml
new file mode 100644
index 0000000000..d2eaa0ad5e
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_multiline.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Qt.RichText
+ text: "First line<br />Second line<br />Third line"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_multiline_overline.qml b/tests/manual/scenegraph_lancelot/data/text/text_multiline_overline.qml
new file mode 100644
index 0000000000..3df75f6924
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_multiline_overline.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ clip: true
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ font.overline: true
+ text: "First line\nSecond line\nThird line"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_multiline_partial_underline.qml b/tests/manual/scenegraph_lancelot/data/text/text_multiline_partial_underline.qml
new file mode 100644
index 0000000000..75cc37d185
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_multiline_partial_underline.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ clip: true
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ text: "First line<br />Second <u>line<br />Third</u> line"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_multiline_strikeout.qml b/tests/manual/scenegraph_lancelot/data/text/text_multiline_strikeout.qml
new file mode 100644
index 0000000000..6216cc415a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_multiline_strikeout.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ clip: true
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.strikeout: true
+ text: "First line\nSecond line\nThird line"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_multiline_underline.qml b/tests/manual/scenegraph_lancelot/data/text/text_multiline_underline.qml
new file mode 100644
index 0000000000..0d0d935461
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_multiline_underline.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.underline: true
+ text: "First line\nSecond line\nThird line"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_multiparagraph.qml b/tests/manual/scenegraph_lancelot/data/text/text_multiparagraph.qml
new file mode 100644
index 0000000000..ae25f04712
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_multiparagraph.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Qt.RichText
+ text: "<p>First paragraph</p><p>Second paragraph</p><p>Third paragraph</p>"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_overline_multisize.qml b/tests/manual/scenegraph_lancelot/data/text/text_overline_multisize.qml
new file mode 100644
index 0000000000..4b12ef781f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_overline_multisize.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 10
+ font.overline: true
+ textFormat: Text.RichText
+ text: "Lorem ipsum <font size=16>dolor sit amet</font>, consectetur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_partially_colored_ligature.qml b/tests/manual/scenegraph_lancelot/data/text/text_partially_colored_ligature.qml
new file mode 100644
index 0000000000..c4dfad8bf9
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_partially_colored_ligature.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ clip: true
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 20
+ textFormat: Text.StyledText
+ text: "Are grif<font color=\"#00ff00\">f</font>ins birds or mammals?"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_resize_glyph_cache.qml b/tests/manual/scenegraph_lancelot/data/text/text_resize_glyph_cache.qml
new file mode 100644
index 0000000000..8b09b5f680
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_resize_glyph_cache.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ text: "abcdefghijklmnopqrstuvwxyzABCDEFG"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_rotation_smoothed.qml b/tests/manual/scenegraph_lancelot/data/text/text_rotation_smoothed.qml
new file mode 100644
index 0000000000..040cf0f50d
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_rotation_smoothed.qml
@@ -0,0 +1,144 @@
+import QtQuick 2.0
+
+//vary font rotation with smoothing
+
+Item {
+ width: 320
+ height: 480
+ property bool smoothing: true
+ Text {
+ id: text_0000
+ x: 0
+ y: 0
+ width: 150
+ height: 50
+ text: "10 degrees. The quick brown fox jumps over the lazy dog. 0123456789."
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 25 ; origin.y: 25; angle: 10}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: text_0000.left
+ width: 150
+ height: 50
+ text: "20 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 30 ; origin.y: 25; angle: 20}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0002
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ width: 150
+ height: 50
+ text: "30 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 35 ; origin.y: 25; angle: 30}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0003
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ width: 150
+ height: 50
+ text: "40 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 40 ; origin.y: 25; angle: 40}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0004
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ width: 150
+ height: 50
+ text: "50 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 45 ; origin.y: 25; angle: 50}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0005
+ anchors.top: text_0004.bottom
+ anchors.left: text_0004.left
+ width: 150
+ height: 50
+ text: "60 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 50 ; origin.y: 25; angle: 60}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0006
+ anchors.top: text_0005.bottom
+ anchors.left: text_0005.left
+ width: 150
+ height: 50
+ text: "70 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 30 ; origin.y: 25; angle: 70}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0007
+ anchors.top: text_0006.bottom
+ anchors.left: text_0006.left
+ width: 150
+ height: 50
+ text: "80 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 20 ; origin.y: 25; angle: 80}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0008
+ anchors.top: text_0007.bottom
+ anchors.left: text_0007.left
+ width: 150
+ height: 50
+ text: "90 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 10 ; origin.y: 25; angle: 90}
+ smooth: smoothing
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_rotation_unsmoothed.qml b/tests/manual/scenegraph_lancelot/data/text/text_rotation_unsmoothed.qml
new file mode 100644
index 0000000000..a094995c9e
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_rotation_unsmoothed.qml
@@ -0,0 +1,144 @@
+import QtQuick 2.0
+
+//vary font rotation without smoothing
+
+Item {
+ width: 320
+ height: 480
+ property bool smoothing: false
+ Text {
+ id: text_0000
+ x: 0
+ y: 0
+ width: 150
+ height: 50
+ text: "10 degrees. The quick brown fox jumps over the lazy dog. 0123456789."
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 25 ; origin.y: 25; angle: 10}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: text_0000.left
+ width: 150
+ height: 50
+ text: "20 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 30 ; origin.y: 25; angle: 20}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0002
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ width: 150
+ height: 50
+ text: "30 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 35 ; origin.y: 25; angle: 30}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0003
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ width: 150
+ height: 50
+ text: "40 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 40 ; origin.y: 25; angle: 40}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0004
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ width: 150
+ height: 50
+ text: "50 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 45 ; origin.y: 25; angle: 50}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0005
+ anchors.top: text_0004.bottom
+ anchors.left: text_0004.left
+ width: 150
+ height: 50
+ text: "60 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 50 ; origin.y: 25; angle: 60}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0006
+ anchors.top: text_0005.bottom
+ anchors.left: text_0005.left
+ width: 150
+ height: 50
+ text: "70 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 30 ; origin.y: 25; angle: 70}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0007
+ anchors.top: text_0006.bottom
+ anchors.left: text_0006.left
+ width: 150
+ height: 50
+ text: "80 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 20 ; origin.y: 25; angle: 80}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0008
+ anchors.top: text_0007.bottom
+ anchors.left: text_0007.left
+ width: 150
+ height: 50
+ text: "90 degrees. The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.NoWrap
+ transform: Rotation{origin.x: 10 ; origin.y: 25; angle: 90}
+ smooth: smoothing
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_scale_unsmoothed.qml b/tests/manual/scenegraph_lancelot/data/text/text_scale_unsmoothed.qml
new file mode 100644
index 0000000000..fe7c4c96de
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_scale_unsmoothed.qml
@@ -0,0 +1,79 @@
+import QtQuick 2.0
+
+//vary font scale without smoothing
+
+Item {
+ width: 320
+ height: 480
+ property bool smoothing: false
+ Text {
+ id: text_0000
+ x: 0
+ y: 0
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.3}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: text_0000.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.4}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0002
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.5}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0003
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.6}
+ smooth: smoothing
+ }
+ Text {
+ id: text_0004
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ transform: Scale{origin.x: 0 ; origin.y: 0; xScale: 0.8; }
+ smooth: smoothing
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_strikeout_multisize.qml b/tests/manual/scenegraph_lancelot/data/text/text_strikeout_multisize.qml
new file mode 100644
index 0000000000..7a5964cb3f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_strikeout_multisize.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 10
+ font.strikeout: true
+ textFormat: Text.RichText
+ text: "Lorem ipsum <font size=14>dolor sit amet</font>, consectetur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_style.qml b/tests/manual/scenegraph_lancelot/data/text/text_style.qml
new file mode 100644
index 0000000000..4155709835
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_style.qml
@@ -0,0 +1,56 @@
+import QtQuick 2.0
+
+//vary font style
+
+Item {
+ width: 320
+ height: 480
+ Text {
+ id: text_0000
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 14
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Outline (looks a bit shit)"
+ style: Text.Outline
+ color: "black"
+ font.family: "Helvetica"
+ font.pointSize: 14
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0002
+ width: 150
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Raised"
+ style: Text.Raised
+ color: "black"
+ font.family: "Courier"
+ font.pointSize: 14
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0003
+ width: 150
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Sunken"
+ style: Text.Sunken
+ color: "black"
+ font.family: "Calibri"
+ font.pointSize: 14
+ wrapMode: Text.Wrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_style_color.qml b/tests/manual/scenegraph_lancelot/data/text/text_style_color.qml
new file mode 100644
index 0000000000..4986312bf2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_style_color.qml
@@ -0,0 +1,60 @@
+import QtQuick 2.0
+
+//vary font style and style color
+
+Item {
+ width: 320
+ height: 480
+ Text {
+ id: text_0000
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Normal"
+ style: Text.Normal
+ styleColor: "red"
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Outline (looks a bit shit)"
+ style: Text.Outline
+ styleColor: "blue"
+ color: "black"
+ font.family: "Helvetica"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0002
+ width: 150
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Raised"
+ style: Text.Raised
+ styleColor: "red"
+ color: "black"
+ font.family: "Courier"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0003
+ width: 150
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789. style: Sunken"
+ style: Text.Sunken
+ styleColor: "yellow"
+ color: "black"
+ font.family: "Calibri"
+ font.pointSize: 12
+ wrapMode: Text.Wrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_table.qml b/tests/manual/scenegraph_lancelot/data/text/text_table.qml
new file mode 100644
index 0000000000..1f7d49c595
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_table.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "A table: <table border=2>"
+ + "<tr><th>Header 1</th><th>Header 2</th></tr>"
+ + "<tr><td>Cell 1</td><td>Cell 2</td></tr>"
+ + "<tr><td>Cell 3</td><td>Cell 4</td></tr>"
+ + "<tr><td colspan=2>Cell 5</td></tr>"
+ + "<tr><td rowspan=2>Cell 6</td><td>Cell 7</tr>"
+ + "<tr><td>Cell 8</td></tr>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_table_inline_image.qml b/tests/manual/scenegraph_lancelot/data/text/text_table_inline_image.qml
new file mode 100644
index 0000000000..028c1a3fb4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_table_inline_image.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "A table: <table border=2>"
+ + "<tr><th>Header 1</th><th>Header 2</th></tr>"
+ + "<tr><td>Cell 1</td><td>Cell 2 <img height=16 width=16 src=\"data/logo.png\" /></td></tr>"
+ + "<tr><td>Cell <img height=16 width=16 src=\"data/logo.png\" /> 3</td><td>Cell 4</td></tr>"
+ + "<tr><td colspan=2>Ce<img height=16 width=16 src=\"data/logo.png\" />ll 5</td></tr>"
+ + "<tr><td rowspan=2> <img height=16 width=16 src=\"data/logo.png\" />Cell 6</td><td>Cell 7</tr>"
+ + "<tr><td>Cell 8 <img height=16 width=16 src=\"data/logo.png\" /></td></tr>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_table_selected.qml b/tests/manual/scenegraph_lancelot/data/text/text_table_selected.qml
new file mode 100644
index 0000000000..51ff20b409
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_table_selected.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "A table: <table border=2>"
+ + "<tr><th>Header 1</th><th>Header 2</th></tr>"
+ + "<tr><td>Cell 1</td><td>Cell 2</td></tr>"
+ + "<tr><td>Cell 3</td><td>Cell 4</td></tr>"
+ + "<tr><td colspan=2>Cell 5</td></tr>"
+ + "<tr><td rowspan=2>Cell 6</td><td>Cell 7</tr>"
+ + "<tr><td>Cell 8</td></tr>"
+
+ Component.onCompleted: {
+ textEdit.select(10, 30)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_tamil.qml b/tests/manual/scenegraph_lancelot/data/text/text_tamil.qml
new file mode 100644
index 0000000000..31fccbcd54
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_tamil.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "லடà¯à®šà¯à®®à®¿à®¨à®¾à®°à®¾à®¯à®£à®©à¯"
+ }
+}
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_thai.qml b/tests/manual/scenegraph_lancelot/data/text/text_thai.qml
new file mode 100644
index 0000000000..b001e92f98
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_thai.qml
@@ -0,0 +1,18 @@
+// test Thai font rendering and line breaking
+
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.fill: parent
+ wrapMode: Text.Wrap
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "ภาษาไทย เป็นภาษาราชà¸à¸²à¸£à¸‚องประเทศไทย à¹à¸¥à¸°à¸ à¸²à¸©à¸²à¹à¸¡à¹ˆà¸‚องชาวไทย à¹à¸¥à¸°à¸Šà¸™à¹€à¸Šà¸·à¹‰à¸­à¸ªà¸²à¸¢à¸­à¸·à¹ˆà¸™à¹ƒà¸™à¸›à¸£à¸°à¹€à¸—ศไทย ภาษาไทยเป็นภาษาในà¸à¸¥à¸¸à¹ˆà¸¡à¸ à¸²à¸©à¸²à¹„ท"
+ }
+}
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_underline_merged.qml b/tests/manual/scenegraph_lancelot/data/text/text_underline_merged.qml
new file mode 100644
index 0000000000..9a5996603a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_underline_merged.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ width: parent.width
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ text: "<u>Lorem</u> ipsum <u><font size=20>dolor sit amet</font>, consect</u>etur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_underline_merged_colored.qml b/tests/manual/scenegraph_lancelot/data/text/text_underline_merged_colored.qml
new file mode 100644
index 0000000000..7725131d5f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_underline_merged_colored.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ width: parent.width
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ text: "<u>Lorem</u> ipsum <u><font size=20 style=\"color: red\">dolor sit amet</font>, consect</u>etur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_underline_multisize.qml b/tests/manual/scenegraph_lancelot/data/text/text_underline_multisize.qml
new file mode 100644
index 0000000000..4ee54487d8
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_underline_multisize.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 10
+ font.underline: true
+ textFormat: Text.RichText
+ text: "Lorem ipsum <font size=14>dolor sit amet</font>, consectetur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_weight.qml b/tests/manual/scenegraph_lancelot/data/text/text_weight.qml
new file mode 100644
index 0000000000..a72894b76f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_weight.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+//vary font.weight
+
+Item {
+ width: 320
+ height: 480
+ Text {
+ id: text_0000
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Light
+ color: "black"
+ font.family: "Meera"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Mallige"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0002
+ width: 150
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.DemiBold
+ color: "black"
+ font.family: "Norasi"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0003
+ width: 150
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Bold
+ color: "black"
+ font.family: "Purisa"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0004
+ width: 150
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Black
+ color: "black"
+ font.family: "Saab"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0005
+ width: 150
+ anchors.top: text_0004.bottom
+ anchors.left: text_0004.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Sawasdee"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0006
+ width: 150
+ anchors.top: text_0005.bottom
+ anchors.left: text_0005.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Symbol"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ Text {
+ id: text_0007
+ width: 150
+ anchors.top: text_0006.bottom
+ anchors.left: text_0006.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "UnBatang"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/text_wrap_elide.qml b/tests/manual/scenegraph_lancelot/data/text/text_wrap_elide.qml
new file mode 100644
index 0000000000..9dcacd78bb
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/text_wrap_elide.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+//test single font with different elide and wrap modes
+
+Item {
+ width: 320
+ height: 480
+ Text {
+ id: text_0000
+ x: 0
+ y: 0
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. Elide left"
+ font.bold: false
+ elide: Text.ElideLeft
+ color: "red"
+ font.family: "Arial"
+ font.pointSize: 24
+ }
+ Text {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: text_0000.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. Elide middle"
+ font.bold: false
+ elide: Text.ElideMiddle
+ color: "blue"
+ font.family: "Arial"
+ font.pointSize: 24
+ }
+ Text {
+ id: text_0002
+ width: 150
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ text: "The quick brown fox jumps over the lazy dog. Elide right"
+ font.bold: false
+ elide: Text.ElideRight
+ color: "yellow"
+ font.family: "Arial"
+ font.pointSize: 24
+ }
+ Text {
+ id: text_0003
+ width: 150
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ text: "The quick brown fox jumps over the lazy dog. Elide none"
+ font.bold: false
+ elide: Text.ElideNone
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 24
+ }
+ Text {
+ id: text_0004
+ width: 150
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ text: "The quick brown fox jumps over the lazy dog. wrapMode: NoWrap"
+ font.bold: false
+ wrapMode: Text.NoWrap
+ color: "green"
+ font.family: "Arial"
+ font.pointSize: 24
+ }
+ Text {
+ id: text_0005
+ width: 150
+ anchors.top: text_0004.bottom
+ anchors.left: text_0004.left
+ text: "The quick brown fox jumps over the lazy dog. wrapMode: WordWrap "
+ font.bold: false
+ wrapMode: Text.WordWrap
+ color: "light grey"
+ font.family: "Arial"
+ font.pointSize: 12
+ }
+ Text {
+ id: text_0006
+ width: 150
+ anchors.top: text_0005.bottom
+ anchors.left: text_0005.left
+ text: "The quick brown fox jumps over the lazy dog. wrapMode: wrapAnywhere "
+ font.bold: false
+ wrapMode: Text.WrapAnywhere
+ color: "black"
+ font.family: "Arial"
+ font.pointSize: 12
+ }
+ Text {
+ id: text_0007
+ width: 150
+ anchors.top: text_0006.bottom
+ anchors.left: text_0006.left
+ text: "The quick brown fox jumps over the lazy dog. wrapMode: wrap "
+ font.bold: false
+ wrapMode: Text.Wrap
+ color: "light green"
+ font.family: "Arial"
+ font.pointSize: 12
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_arabic.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_arabic.qml
new file mode 100644
index 0000000000..5622adc117
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_arabic.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "هو أمّا حكومة القاذÙات مكن, ÙˆÙÙŠ تنÙّس الشرقي لهيمنة أن. هو قام هزيمة وأزيز اندلاع, ومن أي وبداية الواقعة. Ùˆ إخضاع الكونجرس الموسوعة حول, جÙÙ„ Ùˆ سابق للغزو،, به، الحرب كنقطة المارق تم. شدّت الشطر وحلÙاؤها بـ أسر, هذه بمعارضة والديون باستخدام تم, بـ معاملة الجنوبي لها. وسÙÙ† لهذه الحزب قام ٣٠, من الحرة عشوائية Ùعل, غير ٣٠ أوسع علاقة إستمات."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_background_color.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_background_color.qml
new file mode 100644
index 0000000000..c8ca62f7e8
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_background_color.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ color: "green"
+ textFormat: Text.RichText
+ text: "<body bgcolor=lightblue>Some text<br />Some more text</body>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_bidi.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_bidi.qml
new file mode 100644
index 0000000000..9804568435
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_bidi.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "Lorem ipsum dolor sit amet, agam sonet vitae. "
+ + "جÙÙ„ أم تشرشل والنازي. عل وقد كنقطة الهجوم. "
+ + "Dolorum assueverit vis ex. Zril graeci eirmod sed."
+ }
+}
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_bidi_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_bidi_selected.qml
new file mode 100644
index 0000000000..4f5b27a8d8
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_bidi_selected.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ TextEdit {
+ anchors.centerIn: parent
+ id: textEdit
+ font.family: "Arial"
+ font.pixelSize: 14
+ text: "Lorem ipsum لمّ استبدال dolor sit."
+
+ Component.onCompleted: {
+ textEdit.select(10, 18)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_capitalization.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_capitalization.qml
new file mode 100644
index 0000000000..312966f649
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_capitalization.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: upperCaseText
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.AllUppercase
+ text: "This text is all uppercase"
+ }
+
+ TextEdit {
+ id: lowerCaseText
+ anchors.top: upperCaseText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.AllLowercase
+ text: "This text is all lowercase"
+ }
+
+ TextEdit {
+ id: smallCapsText
+ anchors.top: lowerCaseText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.SmallCaps
+ text: "This text is smallcaps"
+ }
+
+ TextEdit {
+ id: capitalizedText
+ anchors.top: smallCapsText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.Capitalize
+ text: "This text is capitalized"
+ }
+
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_chinese.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_chinese.qml
new file mode 100644
index 0000000000..1c2229a5ff
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_chinese.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.pixelSize: 20
+ text: "禖 犿玒 鋑鋡髬 蘹蠮躘 飹勫嫢, ç· è»µé€¯ çƒçƒšçœ 訬軗郲 箖緌翢 毹 肒芅 瀿犨皫 迡俶倗 觛è©è², åºŒå¼ è¨°è²¥éƒª 蹢鎒鎛 çƒºç„†ç€ æ§, è’› 犆犅 燲ç¯ç’¯ è€èƒ è‡¿ èž’èžèžœ ç¶ç¸ çµ¼ 蛃袚觙 簻臗藱, éžé¬¿ è·¿ 堔埧娾 幨懅憴 榯 雈é®å‚¿ 裺觨誖 糋罶羬 é®å‚¿, 氀濆 犵艿邔 è°¾è¸˜é³ ç·±ç¿¬è†ž æš• 踙 毼毹 樛槷殦 忀瀸蘌"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic.qml
new file mode 100644
index 0000000000..4943a82a92
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "Ðу миров называть опа, назад вÑегда Ð¿Ñ€ÐµÐ´Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ð°Ñ Ð´Ð»Ñ Ð¾Ñ‚, работали гринÑпана обеÑпечении как ну. Себе делаете напиÑано те длÑ, том дейÑÑ‚Ð²Ð¸Ñ Ð¿Ñ€Ð¾ÐµÐºÑ‚Ð¾Ð¼ по, хватит комнату предÑтавим он как. Другие работал медицинÑкое Ð²Ð°Ñ Ñ‚Ñ‹. Том такие Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð½Ñƒ."
+ }
+}
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_devanagari.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_devanagari.qml
new file mode 100644
index 0000000000..1f56bfcf93
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_devanagari.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "सारà¥à¤µà¤œà¤¨à¤¿à¤• विकेनà¥à¤¦à¥à¤°à¤¿à¤¤ वरà¥à¤£à¤¨ कोहम विषय वेबजाल दिनांक माहितीवानीजà¥à¤¯ औषधिक लकà¥à¤·à¤£ हैं। दà¥à¤µà¤¾à¤°à¤¾ विभाजन पà¥à¤°à¥‹à¤¤à¥à¤¸à¤¾à¤¹à¤¿à¤¤ मà¥à¤–à¥à¤¯ विनिमय जानकारी पहोच गयेगया विसà¥à¤¤à¤°à¤£à¤•à¥à¤·à¤®à¤¤à¤¾ होगा जिसकी मà¥à¤–à¥à¤¯ रखते बिनà¥à¤¦à¥à¤“ शारिरिक बीसबतेबोध कीने नवंबर सभिसमज संसà¥à¤¥à¤¾à¤¨"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_left.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_left.qml
new file mode 100644
index 0000000000..a180dcc39b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_left.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: parent.width
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ textFormat: Text.RichText
+ text: "This image is to the<img align=left src=\"data/logo.png\" /> left of the text <br />More text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_right.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_right.qml
new file mode 100644
index 0000000000..1f8c1d5514
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_floating_image_right.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: parent.width
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ textFormat: Text.RichText
+ text: "This image is to the<img align=right src=\"data/logo.png\" /> right of the text <br />More text"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_hebrew.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_hebrew.qml
new file mode 100644
index 0000000000..42ec48cd1b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_hebrew.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.fill: parent
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ font.family: "Arial"
+ font.pixelSize: 20
+ text: "שמו ×ל קהילה ×גרונומיה. שדרות בהשחתה בהתייחסות ×× ×¢×•×“, ×ת ×¢×–×” ×™×•×¦×¨×™× ×ירועי×. בה ×× × ×›× ×™×¡×” ××—×¨×•× ×™× ×•×¤×™×ª×•×—×”, ×ו כימיה ×”×’×¨×¤×™× ×חד. של שער הב××™× ×§×•×“×ž×•×ª טבל×ות. בקרבת שימושי סוציולוגיה שער מה, מתן כלכלה ×ž×©×—×§×™× ×ו, בדף ×œ×™×•× ×¢×¨×‘×™×ª למחיקה בה. מ×מר המלצת פיסיקה שער בה."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_list_circle.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_list_circle.qml
new file mode 100644
index 0000000000..e314fcc256
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_list_circle.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "<html><body>Here's a list: <ul style=\"list-style-type: circle\"><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul> And some more text</body></html>"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_list_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_list_selected.qml
new file mode 100644
index 0000000000..cadb2a0fe5
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_list_selected.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Here's a list: <ul><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul> And some more text"
+
+ Component.onCompleted: {
+ textEdit.select(18, 30)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned.qml
new file mode 100644
index 0000000000..340b096ab3
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ horizontalAlignment: TextEdit.AlignHCenter
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected.qml
new file mode 100644
index 0000000000..f15de61a63
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ horizontalAlignment: TextEdit.AlignHCenter
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+
+ Component.onCompleted: {
+ textEdit.select(50, 80)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected_eol.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected_eol.qml
new file mode 100644
index 0000000000..e9540059d2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_selected_eol.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ horizontalAlignment: TextEdit.AlignHCenter
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+
+ Component.onCompleted: {
+ textEdit.select(63, 67)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline.qml
new file mode 100644
index 0000000000..4570d1fa3b
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.underline: true
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ horizontalAlignment: TextEdit.AlignHCenter
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline_selected.qml
new file mode 100644
index 0000000000..6d9d0da2de
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_center_aligned_underline_selected.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.underline: true
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ horizontalAlignment: TextEdit.AlignRight
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+
+ Component.onCompleted: {
+ textEdit.select(50, 80)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_hebrew_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_hebrew_selected.qml
new file mode 100644
index 0000000000..f72a173ae6
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_hebrew_selected.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ text: "הבהרה ×œ×¢×¨×›×™× ×חד ×ל, ×ל הספרות ××™×¨×•×¢×™× ×•×ª×©×•×‘×•×ª שתי, סדר בה ×¢×¡×§×™× ×”×¢×–×¨×” ×גרונומיה. ×ת ×•×”×•× ×ž×•×¡×™×§×” סטטיסטיקה זכר. בקר העמוד לחיבור של, ויש ×ת הקהילה ממונרכיה פסיכולוגיה. שער המזנון לויקיפדיה ×ת, ×תה סרבול ×¢×¨×›×™× ×‘×œ×©× ×•×ª ×ו, ריקוד ×”×נציקלופדיה כדי דת. ×ל ×œ×ª×¨×•× ×ž×©×—×§×™× ×•×¡×¤×¦×™×¤×™×™× ×חד, ×ו מיזמי המקובל כלל. ×× ×”×§×”×™×œ×” משופרות ×חד, בקר רפו××” ×ž×“×•×™×§×™× ×©×œ, פנ××™ ×•×¡×¤×¦×™×¤×™×™× ×›×œ×œ מה. ×œ×¢×ª×™× ×•×¡×¤×¦×™×¤×™×™× ×¡×•×¦×™×•×œ×•×’×™×” ×¢×–×” ×ל, לשון ×קר××™ דת ×חד, רקטות ×œ×•×™×§×™×¤×“×™× ×חד ×ת."
+
+ Component.onCompleted: {
+ textEdit.select(50, 80)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_partial_underline.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_partial_underline.qml
new file mode 100644
index 0000000000..a32baae412
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_partial_underline.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ clip: true
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "First line<br />Second <u>line<br />Third</u> line"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned.qml
new file mode 100644
index 0000000000..c90e565ba2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ clip: true
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ horizontalAlignment: TextEdit.AlignRight
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned_selected.qml
new file mode 100644
index 0000000000..7afd9ce1e2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_right_aligned_selected.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ horizontalAlignment: TextEdit.AlignRight
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+
+ Component.onCompleted: {
+ textEdit.select(50, 80)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_eol.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_eol.qml
new file mode 100644
index 0000000000..38dd31c484
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_eol.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+
+ Component.onCompleted: {
+ textEdit.select(63, 67)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_long.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_long.qml
new file mode 100644
index 0000000000..6cab2c4e79
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_long.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ width: 200
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id diam vitae enim fringilla vestibulum. Pellentesque non leo justo, quis vestibulum augue"
+
+ Component.onCompleted: {
+ textEdit.select(50, 80)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_overline.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_overline.qml
new file mode 100644
index 0000000000..4476249253
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_overline.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Qt.RichText
+ font.overline: true
+ text: "<p>First line</p><p>Second line</p><p>Third line</p>"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_partial_underline.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_partial_underline.qml
new file mode 100644
index 0000000000..664270c059
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_partial_underline.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "<p>First line</p><p>Second <u>line</u></p><p><u>Third</u> line</p>"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_selected.qml
new file mode 100644
index 0000000000..5bd327453e
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_selected.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 20
+ textFormat: Text.RichText
+ text: "<p>First line</p><p>Second line</p><p>Third line</p><p>Fourth line</p>"
+
+ Component.onCompleted: {
+ textEdit.select(18, 26)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_strikeout.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_strikeout.qml
new file mode 100644
index 0000000000..3520961e0f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_strikeout.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Qt.RichText
+ font.strikeout: true
+ text: "<p>First line</p><p>Second line</p><p>Third line</p>"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_underline.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_underline.qml
new file mode 100644
index 0000000000..d84c9f2bac
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiparagraph_underline.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Text {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Qt.RichText
+ font.underline: true
+ text: "<p>First line</p><p>Second line</p><p>Third line</p>"
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_overline_multisize.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_overline_multisize.qml
new file mode 100644
index 0000000000..6a827b561f
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_overline_multisize.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 10
+ font.overline: true
+ textFormat: Text.RichText
+ text: "Lorem ipsum <font size=14>dolor sit amet</font>, consectetur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_resize_glyph_cache.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_resize_glyph_cache.qml
new file mode 100644
index 0000000000..b305755489
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_resize_glyph_cache.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ text: "abcdefghijklmnopqrstuvwxyzABCDEFG"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_selected_inline_image.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_inline_image.qml
new file mode 100644
index 0000000000..e159d45a81
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_inline_image.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.pixelSize: 16
+ width: parent.width
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ textFormat: Text.RichText
+ text: "This is selected from here and <img width=16 height=16 src=\"data/logo.png\" /> to here but not further"
+
+ Component.onCompleted: {
+ textEdit.select(22, 40)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_selected_ligature.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_ligature.qml
new file mode 100644
index 0000000000..1380222e25
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_ligature.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ id: textEdit
+ font.pixelSize: 16
+ font.family: "Arial"
+ text: "Are griffins birds or mammals?"
+
+ Component.onCompleted: {
+ textEdit.select(3, 8)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_selected_space.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_space.qml
new file mode 100644
index 0000000000..9fe74e0b83
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_space.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ text: "Lorem Ipsum (space should be selected)"
+
+ Component.onCompleted: {
+ textEdit.select(5, 6)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_selected_space_at_eol.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_space_at_eol.qml
new file mode 100644
index 0000000000..a07b8da625
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_selected_space_at_eol.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ textFormat: Text.RichText
+ text: "Lorem <br />Ipsum (space should be selected)"
+
+ Component.onCompleted: {
+ textEdit.select(5, 6)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_selection_color.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_selection_color.qml
new file mode 100644
index 0000000000..5143ed5315
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_selection_color.qml
@@ -0,0 +1,22 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ id: textEdit
+ anchors.centerIn: parent
+ width: parent.width
+ font.pixelSize: 14
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas nibh"
+ wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+
+ selectionColor: "red"
+ selectedTextColor: "blue"
+
+ Component.onCompleted: {
+ textEdit.select(6, 17)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_strikeout_multisize.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_strikeout_multisize.qml
new file mode 100644
index 0000000000..f3c22ea9fc
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_strikeout_multisize.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 10
+ font.strikeout: true
+ textFormat: Text.RichText
+ text: "Lorem ipsum <font size=14>dolor sit amet</font>, consectetur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_underline_multisize.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_underline_multisize.qml
new file mode 100644
index 0000000000..a7a99e96dd
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_underline_multisize.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextEdit {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 10
+ font.underline: true
+ textFormat: Text.RichText
+ text: "Lorem ipsum <font size=14>dolor sit amet</font>, consectetur."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_weight.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_weight.qml
new file mode 100644
index 0000000000..0ad0c8cc26
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textedit_weight.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+//vary font.weight
+
+Item {
+ width: 320
+ height: 480
+ TextEdit {
+ id: text_0000
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Light
+ color: "black"
+ font.family: "Meera"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextEdit {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Mallige"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextEdit {
+ id: text_0002
+ width: 150
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.DemiBold
+ color: "black"
+ font.family: "Norasi"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextEdit {
+ id: text_0003
+ width: 150
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Bold
+ color: "black"
+ font.family: "Purisa"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextEdit {
+ id: text_0004
+ width: 150
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Black
+ color: "black"
+ font.family: "Saab"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextEdit {
+ id: text_0005
+ width: 150
+ anchors.top: text_0004.bottom
+ anchors.left: text_0004.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Sawasdee"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextEdit {
+ id: text_0006
+ width: 150
+ anchors.top: text_0005.bottom
+ anchors.left: text_0005.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Symbol"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextEdit {
+ id: text_0007
+ width: 150
+ anchors.top: text_0006.bottom
+ anchors.left: text_0006.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "UnBatang"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_arabic.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_arabic.qml
new file mode 100644
index 0000000000..eaa5daaee2
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_arabic.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 12
+ text: "جÙÙ„ أم تشرشل والنازي. عل وقد كنقطة الهجوم."
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_bidi_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_bidi_selected.qml
new file mode 100644
index 0000000000..cba63885e6
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_bidi_selected.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ TextInput {
+ anchors.centerIn: parent
+ id: textInput
+ font.family: "Arial"
+ font.pixelSize: 14
+ text: "Lorem ipsum لمّ استبدال dolor sit."
+
+ Component.onCompleted: {
+ textInput.select(10, 18)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_capitalization.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_capitalization.qml
new file mode 100644
index 0000000000..6dd8061ff4
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_capitalization.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ id: upperCaseText
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.AllUppercase
+ text: "This text is all uppercase"
+ }
+
+ TextInput {
+ id: lowerCaseText
+ anchors.top: upperCaseText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.AllLowercase
+ text: "This text is all lowercase"
+ }
+
+ TextInput {
+ id: smallCapsText
+ anchors.top: lowerCaseText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.SmallCaps
+ text: "This text is smallcaps"
+ }
+
+ TextInput {
+ id: capitalizedText
+ anchors.top: smallCapsText.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.family: "Arial"
+ font.pixelSize: 16
+ font.capitalization: Font.Capitalize
+ text: "This text is capitalized"
+ }
+
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_chinese.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_chinese.qml
new file mode 100644
index 0000000000..de170e422a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_chinese.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ anchors.centerIn: parent
+ font.pixelSize: 12
+ text: "æ»Šç… ç½žè€–èŒ­ é†™é† é– ç®¯, 彃 榾毄 èžèž‰è¤© 籿ç´ç¾‘"
+ }
+}
+
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_cyrillic.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_cyrillic.qml
new file mode 100644
index 0000000000..9057af8ea5
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_cyrillic.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 12
+ text: "Мы проходÑÑ‚ ÑоÑтоÑние фактичеÑки его, две бы быÑтрее."
+ }
+}
+
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_devanagari.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_devanagari.qml
new file mode 100644
index 0000000000..6b45e4cb14
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_devanagari.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 12
+ text: "जिमà¥à¤®à¥‡ तरहथा। विसà¥à¤¤à¤°à¤£à¤•à¥à¤·à¤®à¤¤à¤¾ ७हल विभाग कà¥à¤·à¤®à¤¤à¤¾ ढांचामातà¥à¤°à¥à¤­à¤¾à¤·à¤¾ जाने"
+ }
+}
+
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_echomodes.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_echomodes.qml
new file mode 100644
index 0000000000..27f9ff0d17
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_echomodes.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ Column {
+ anchors.centerIn: parent
+
+ TextInput {
+ font.pixelSize: 16
+ font.family: "Arial"
+ echoMode: TextInput.Normal
+ text: "Lorem ipsum"
+ }
+ TextInput {
+ font.pixelSize: 16
+ font.family: "Arial"
+ echoMode: TextInput.NoEcho
+ text: "Lorem ipsum"
+ }
+ TextInput {
+ font.pixelSize: 16
+ font.family: "Arial"
+ echoMode: TextInput.Password
+ text: "Lorem ipsum"
+ }
+ TextInput {
+ font.pixelSize: 16
+ font.family: "Arial"
+ echoMode: TextInput.PasswordEchoOnEdit
+ text: "Lorem ipsum"
+ }
+ TextInput {
+ font.pixelSize: 16
+ font.family: "Arial"
+ echoMode: TextInput.Password
+ passwordCharacter: "o"
+ text: "Lorem ipsum"
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_hebrew.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_hebrew.qml
new file mode 100644
index 0000000000..b591940e31
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_hebrew.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 12
+ text: "צעד ×’× ×œ×™×ž×•×“×™× ×ž×™×ª×•×œ×•×’×™×” ×נתרופולוגיה, לכ×ן ××—×¨×™× ×‘×¢×‘×¨×™×ª."
+ }
+}
+
+
+
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_resize_glyph_cache.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_resize_glyph_cache.qml
new file mode 100644
index 0000000000..1ab7640742
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_resize_glyph_cache.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ text: "abcdefghijklmnopqrstuvwxyzABCDEFG"
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_selected_ligature.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_selected_ligature.qml
new file mode 100644
index 0000000000..9c8b30f743
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_selected_ligature.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ anchors.centerIn: parent
+ id: textInput
+ font.pixelSize: 12
+ font.family: "Arial"
+ text: "Are griffins birds or mammals?"
+
+ Component.onCompleted: {
+ textInput.select(3, 8)
+ }
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_selected_space.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_selected_space.qml
new file mode 100644
index 0000000000..f1a4ce2099
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_selected_space.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+
+ TextInput {
+ id: textInput
+ anchors.centerIn: parent
+ font.family: "Arial"
+ font.pixelSize: 16
+ text: "Lorem Ipsum (space should be selected)"
+
+ Component.onCompleted: {
+ textInput.select(5, 6)
+ }
+ }
+
+}
diff --git a/tests/manual/scenegraph_lancelot/data/text/textinput_weight.qml b/tests/manual/scenegraph_lancelot/data/text/textinput_weight.qml
new file mode 100644
index 0000000000..3e4a4f2669
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/text/textinput_weight.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+//vary font.weight
+
+Item {
+ width: 320
+ height: 480
+ TextInput {
+ id: text_0000
+ anchors.top: parent.top
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Light
+ color: "black"
+ font.family: "Meera"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextInput {
+ id: text_0001
+ anchors.top: text_0000.bottom
+ anchors.left: parent.left
+ width: 150
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Mallige"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextInput {
+ id: text_0002
+ width: 150
+ anchors.top: text_0001.bottom
+ anchors.left: text_0001.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.DemiBold
+ color: "black"
+ font.family: "Norasi"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextInput {
+ id: text_0003
+ width: 150
+ anchors.top: text_0002.bottom
+ anchors.left: text_0002.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Bold
+ color: "black"
+ font.family: "Purisa"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextInput {
+ id: text_0004
+ width: 150
+ anchors.top: text_0003.bottom
+ anchors.left: text_0003.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Black
+ color: "black"
+ font.family: "Saab"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextInput {
+ id: text_0005
+ width: 150
+ anchors.top: text_0004.bottom
+ anchors.left: text_0004.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Sawasdee"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextInput {
+ id: text_0006
+ width: 150
+ anchors.top: text_0005.bottom
+ anchors.left: text_0005.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "Symbol"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+ TextInput {
+ id: text_0007
+ width: 150
+ anchors.top: text_0006.bottom
+ anchors.left: text_0006.left
+ text: "The quick brown fox jumps over the lazy dog. 0123456789"
+ font.weight: Font.Normal
+ color: "black"
+ font.family: "UnBatang"
+ font.pointSize: 10
+ wrapMode: Text.Wrap
+ }
+}
diff --git a/tests/manual/scenegraph_lancelot/hostinfo.sh b/tests/manual/scenegraph_lancelot/hostinfo.sh
new file mode 100644
index 0000000000..c5d112445a
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/hostinfo.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of the QtQml module of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## 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, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, 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.
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+# printProperty(): prints a key-value pair from given key and cmd list.
+# If running cmd fails, or does not produce any stdout, nothing is printed.
+# Arguments: $1: key, $2: cmd, $3: optional, field specification as to cut(1) -f
+printProperty ()
+{
+ key=$1
+ val=`{ eval $2 ; } 2>/dev/null`
+ [ -n "$3" ] && val=`echo $val | tr -s '[:blank:]' '\t' | cut -f$3`
+ [ -n "$val" ] && echo $key: $val
+}
+
+# printEnvVar(): prints a key-value pair from given environment variable name.
+# key is printed as "Env_<varname>".
+# If the variable is undefined, value is printed as UNDEFINED.
+# Arguments: $1: varname
+
+printEnvVar ()
+{
+ key=Env_$1
+ val=`eval 'echo $'$1`
+ [ -z "$val" ] && val='[undefined]'
+ echo $key: $val
+}
+
+
+# printOnOff(): prints a key-value pair from given environment variable name.
+# If variable is defined, value is printed as "<key>-On"; otherwise "<key>-Off".
+# Arguments: $1: key $2: varname
+
+printOnOff ()
+{
+ key=$1
+ val=`eval 'echo $'$2`
+ if [ -z "$val" ] ; then
+ val=Off
+ else
+ val=On
+ fi
+ echo $key: $key-$val
+}
+
+# ------------
+
+printProperty Uname "uname -a"
+
+printProperty WlanMAC "ifconfig wlan0 | grep HWaddr" 5
+
+printEnvVar QMLSCENE_DEVICE
diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
new file mode 100644
index 0000000000..bb2ce0d4e3
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QTimer>
+#include <QtCore/QDebug>
+#include <QtCore/QFileInfo>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QImage>
+
+#include <QtQuick/QQuickView>
+#include <QtQuick/QQuickItem>
+
+// Timeout values:
+
+// A valid screen grab requires the scene to not change
+// for SCENE_STABLE_TIME ms (default 500)
+#define SCENE_STABLE_TIME 500
+
+// Give up after SCENE_TIMEOUT ms
+#define SCENE_TIMEOUT 16000
+
+
+//#define GRABBERDEBUG
+
+class GrabbingView : public QQuickView
+{
+ Q_OBJECT
+
+public:
+ GrabbingView(const QString &outputFile)
+ : ofile(outputFile), frames(0), isGrabbing(false)
+ {
+ connect(this, SIGNAL(afterRendering()), SLOT(renderingDone()));
+ QTimer::singleShot(SCENE_TIMEOUT, this, SLOT(timedOut()));
+ stableSceneTimer.setSingleShot(true);
+ connect(&stableSceneTimer, SIGNAL(timeout()), SLOT(sceneStabilized()));
+ }
+
+private slots:
+ void renderingDone()
+ {
+ if (isGrabbing)
+ return;
+ isGrabbing = true;
+ frames++;
+#ifdef GRABBERDEBUG
+ printf("...frame %i\n", frames);
+#endif
+ QImage img = grabWindow();
+ //qDebug() << "Rendering done, grab is" << !img.isNull() << "timer valid:" << stableSceneTimer.isActive() << "same as last:" << (img == lastGrab);
+ if (!img.isNull() && img != lastGrab) {
+ lastGrab = img;
+ stableSceneTimer.start(SCENE_STABLE_TIME);
+ }
+ isGrabbing = false;
+ }
+
+ void sceneStabilized()
+ {
+#ifdef GRABBERDEBUG
+ printf("...sceneStabilized IN\n");
+#endif
+ if (ofile == "-") { // Write to stdout
+ QFile of;
+ if (!of.open(1, QIODevice::WriteOnly) || !lastGrab.save(&of, "ppm")) {
+ qWarning() << "Error: failed to write grabbed image to stdout.";
+ QGuiApplication::exit(2);
+ return;
+ }
+ } else {
+ if (!lastGrab.save(ofile)) {
+ qWarning() << "Error: failed to store grabbed image to" << ofile;
+ QGuiApplication::exit(2);
+ return;
+ }
+ }
+
+ QGuiApplication::exit(0);
+#ifdef GRABBERDEBUG
+ printf("...sceneStabilized OUT\n");
+#endif
+ }
+
+ void timedOut()
+ {
+ qWarning() << "Error: timed out waiting for scene to stabilize." << frames << "frame(s) received. Last grab was" << (lastGrab.isNull() ? "invalid." : "valid.");
+ QGuiApplication::exit(3);
+ }
+
+private:
+ QImage lastGrab;
+ QTimer stableSceneTimer;
+ QString ofile;
+ int frames;
+ bool isGrabbing;
+};
+
+
+extern uint qt_qhash_seed;
+
+int main(int argc, char *argv[])
+{
+ qt_qhash_seed = 0;
+
+ QGuiApplication a(argc, argv);
+
+ // Parse command line
+ QString ifile, ofile;
+ bool noText = false;
+ QStringList args = a.arguments();
+ int i = 0;
+ bool argError = false;
+ while (++i < args.size()) {
+ QString arg = args.at(i);
+ if ((arg == "-o") && (i < args.size()-1)) {
+ ofile = args.at(++i);
+ }
+ else if (arg == "-notext") {
+ noText = true;
+ }
+ else if (arg == "--cache-distance-fields") {
+ ;
+ }
+ else if (ifile.isEmpty()) {
+ ifile = arg;
+ }
+ else {
+ argError = true;
+ break;
+ }
+ }
+ if (argError || ifile.isEmpty() || ofile.isEmpty()) {
+ qWarning() << "Usage:" << args.at(0).toLatin1().constData() << "[-notext] <qml-infile> -o <outfile or - for ppm on stdout>";
+ return 1;
+ }
+
+ QFileInfo ifi(ifile);
+ if (!ifi.exists() || !ifi.isReadable() || !ifi.isFile()) {
+ qWarning() << args.at(0).toLatin1().constData() << " error: unreadable input file" << ifile;
+ return 1;
+ }
+ // End parsing
+
+ GrabbingView v(ofile);
+ v.setSource(QUrl::fromLocalFile(ifile));
+
+ if (noText) {
+ QList<QQuickItem*> items = v.rootObject()->findChildren<QQuickItem*>();
+ foreach (QQuickItem *item, items) {
+ if (QByteArray(item->metaObject()->className()).contains("Text"))
+ item->setVisible(false);
+ }
+ }
+
+ v.show();
+
+ int retVal = a.exec();
+#ifdef GRABBERDEBUG
+ printf("...retVal=%i\n", retVal);
+#endif
+
+ return retVal;
+}
+
+#include "main.moc"
diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro b/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro
new file mode 100644
index 0000000000..24f0f8a315
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro
@@ -0,0 +1,8 @@
+TARGET = qmlscenegrabber
+DESTDIR=..
+macx:CONFIG -= app_bundle
+CONFIG += console
+
+QT += quick
+
+SOURCES += main.cpp
diff --git a/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro
new file mode 100644
index 0000000000..24f4f18739
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/scenegraph/scenegraph.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase insignificant_test
+TARGET = tst_scenegraph
+DESTDIR=..
+macx:CONFIG -= app_bundle
+CONFIG += console
+
+SOURCES += tst_scenegraph.cpp
+
+# Include Lancelot protocol code to communicate with baseline server.
+# Assuming that we are in a normal Qt5 source code tree
+include(../../../../../qtbase/tests/baselineserver/shared/qbaselinetest.pri)
diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
new file mode 100644
index 0000000000..74845ab954
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp
@@ -0,0 +1,271 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qbaselinetest.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDirIterator>
+#include <QtCore/QDebug>
+#include <QtCore/QProcess>
+#include <QtGui/QImage>
+
+
+QString blockify(const QByteArray& s)
+{
+ const char* indent = "\n | ";
+ QByteArray block = s.trimmed();
+ block.replace('\n', indent);
+ block.prepend(indent);
+ block.append('\n');
+ return block;
+}
+
+
+class tst_Scenegraph : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_Scenegraph();
+
+private Q_SLOTS:
+ void initTestCase();
+ void cleanup();
+ void testNoTextRendering_data();
+ void testNoTextRendering();
+ void testRendering_data();
+ void testRendering();
+
+private:
+ void setupTestSuite(const QByteArray& filter = QByteArray());
+ void runTest(const QStringList& extraArgs = QStringList());
+ bool renderAndGrab(const QString& qmlFile, const QStringList& extraArgs, QImage *screenshot, QString *errMsg);
+ quint16 checksumFileOrDir(const QString &path);
+
+ int consecutiveErrors; // Not test failures (image mismatches), but system failures (so no image at all)
+ bool aborted; // This run given up because of too many system failures
+};
+
+
+tst_Scenegraph::tst_Scenegraph()
+ : consecutiveErrors(0), aborted(false)
+{
+}
+
+
+void tst_Scenegraph::initTestCase()
+{
+ QByteArray msg;
+ if (!QBaselineTest::connectToBaselineServer(&msg))
+ QSKIP(msg);
+}
+
+
+void tst_Scenegraph::cleanup()
+{
+ // Allow subsystems time to settle
+ if (!aborted)
+ QTest::qWait(200);
+}
+
+void tst_Scenegraph::testNoTextRendering_data()
+{
+ setupTestSuite("text/");
+ consecutiveErrors = 0;
+ aborted = false;
+}
+
+
+void tst_Scenegraph::testNoTextRendering()
+{
+ runTest(QStringList() << "-notext");
+}
+
+
+void tst_Scenegraph::testRendering_data()
+{
+ setupTestSuite();
+ consecutiveErrors = 0;
+ aborted = false;
+}
+
+
+void tst_Scenegraph::testRendering()
+{
+ runTest();
+}
+
+
+void tst_Scenegraph::setupTestSuite(const QByteArray& filter)
+{
+ QTest::addColumn<QString>("qmlFile");
+ int numItems = 0;
+
+ QString testSuiteDir = QLatin1String("data");
+ QString testSuiteLocation = QCoreApplication::applicationDirPath();
+ QString testSuitePath = testSuiteLocation + QDir::separator() + testSuiteDir;
+ QFileInfo fi(testSuitePath);
+ if (!fi.exists() || !fi.isDir() || !fi.isReadable())
+ QSKIP("Test suite data directory missing or unreadable: " + testSuitePath.toLatin1());
+
+ QStringList ignoreItems;
+ QFile ignoreFile(testSuitePath + "/Ignore");
+ if (ignoreFile.open(QIODevice::ReadOnly)) {
+ while (!ignoreFile.atEnd()) {
+ QByteArray line = ignoreFile.readLine().trimmed();
+ if (!line.isEmpty() && !line.startsWith('#'))
+ ignoreItems += line;
+ }
+ }
+
+ QStringList itemFiles;
+ QDirIterator it(testSuitePath, QDirIterator::Subdirectories);
+ while (it.hasNext()) {
+ QString fp = it.next();
+ if (fp.endsWith(".qml")) {
+ QString itemName = fp.mid(testSuitePath.length() + 1);
+ if (!ignoreItems.contains(itemName) && (filter.isEmpty() || !itemName.startsWith(filter)))
+ itemFiles.append(it.filePath());
+ }
+ }
+
+ qSort(itemFiles);
+ foreach (const QString &filePath, itemFiles) {
+ QByteArray itemName = filePath.mid(testSuitePath.length() + 1).toLatin1();
+ QBaselineTest::newRow(itemName, checksumFileOrDir(filePath)) << filePath;
+ numItems++;
+ }
+
+ if (!numItems)
+ QSKIP("No .qml test files found in " + testSuitePath.toLatin1());
+}
+
+
+void tst_Scenegraph::runTest(const QStringList& extraArgs)
+{
+ // qDebug() << "Rendering" << QTest::currentDataTag();
+
+ if (aborted)
+ QSKIP("System too unstable.");
+
+ QFETCH(QString, qmlFile);
+
+ QImage screenShot;
+ QString errorMessage;
+ if (renderAndGrab(qmlFile, extraArgs, &screenShot, &errorMessage)) {
+ consecutiveErrors = 0;
+ }
+ else {
+ if (++consecutiveErrors >= 3)
+ aborted = true; // Just give up if screen grabbing fails 3 times in a row
+ QFAIL(qPrintable("QuickView grabbing failed: " + errorMessage));
+ }
+
+ QBASELINE_TEST(screenShot);
+}
+
+
+bool tst_Scenegraph::renderAndGrab(const QString& qmlFile, const QStringList& extraArgs, QImage *screenshot, QString *errMsg)
+{
+ bool usePipe = true; // Whether to transport the grabbed image using temp. file or pipe. TBD: cmdline option
+ QProcess grabber;
+ QString cmd = QCoreApplication::applicationDirPath() + "/qmlscenegrabber";
+ QStringList args = extraArgs;
+ QString tmpfile = usePipe ? QString("-") : QString("/tmp/qmlscenegrabber-%1-out.ppm").arg(QCoreApplication::applicationPid());
+ args << qmlFile << "-o" << tmpfile;
+ grabber.start(cmd, args, QIODevice::ReadOnly);
+ grabber.waitForFinished(17000); //### hardcoded, must be larger than the scene timeout in qmlscenegrabber
+ if (grabber.state() != QProcess::NotRunning) {
+ grabber.terminate();
+ grabber.waitForFinished(3000);
+ }
+ QImage img;
+ bool res = usePipe ? img.load(&grabber, "ppm") : img.load(tmpfile);
+ if (!res || img.isNull()) {
+ if (errMsg) {
+ QString s("Failed to grab screen. qmlscenegrabber exitcode: %1. Process error: %2. Stderr:%3");
+ *errMsg = s.arg(grabber.exitCode()).arg(grabber.errorString()).arg(blockify(grabber.readAllStandardError()));
+ }
+ if (!usePipe)
+ QFile::remove(tmpfile);
+ return false;
+ }
+ if (screenshot)
+ *screenshot = img;
+ if (!usePipe)
+ QFile::remove(tmpfile);
+ return true;
+}
+
+
+quint16 tst_Scenegraph::checksumFileOrDir(const QString &path)
+{
+ QFileInfo fi(path);
+ if (!fi.exists() || !fi.isReadable())
+ return 0;
+ if (fi.isFile()) {
+ QFile f(path);
+ f.open(QIODevice::ReadOnly);
+ QByteArray contents = f.readAll();
+ return qChecksum(contents.constData(), contents.size());
+ }
+ if (fi.isDir()) {
+ static const QStringList nameFilters = QStringList() << "*.qml" << "*.cpp" << "*.png" << "*.jpg";
+ quint16 cs = 0;
+ foreach (QString item, QDir(fi.filePath()).entryList(nameFilters, QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot))
+ cs ^= checksumFileOrDir(path + "/" + item);
+ return cs;
+ }
+ return 0;
+}
+
+
+#define main _realmain
+QTEST_MAIN(tst_Scenegraph)
+#undef main
+
+int main(int argc, char *argv[])
+{
+ QBaselineTest::handleCmdLineArgs(&argc, &argv);
+ return _realmain(argc, argv);
+}
+
+#include "tst_scenegraph.moc"
diff --git a/tests/manual/scenegraph_lancelot/scenegraph_lancelot.pro b/tests/manual/scenegraph_lancelot/scenegraph_lancelot.pro
new file mode 100644
index 0000000000..55efdfcf21
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/scenegraph_lancelot.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS = scenegrabber scenegraph
diff --git a/tests/TestExpectations b/tests/manual/v4/TestExpectations
index b602e0816b..b602e0816b 100644
--- a/tests/TestExpectations
+++ b/tests/manual/v4/TestExpectations
diff --git a/tests/accessors.js b/tests/manual/v4/accessors.js
index 3874e4d329..3874e4d329 100644
--- a/tests/accessors.js
+++ b/tests/manual/v4/accessors.js
diff --git a/tests/array.1.js b/tests/manual/v4/array.1.js
index 015941c2dc..015941c2dc 100644
--- a/tests/array.1.js
+++ b/tests/manual/v4/array.1.js
diff --git a/tests/manual/v4/auto/auto.pro b/tests/manual/v4/auto/auto.pro
new file mode 100644
index 0000000000..3b189275b9
--- /dev/null
+++ b/tests/manual/v4/auto/auto.pro
@@ -0,0 +1,4 @@
+TEMPLATE=subdirs
+SUBDIRS=\
+ executableallocator
+
diff --git a/tests/auto/executableallocator/executableallocator.pro b/tests/manual/v4/auto/executableallocator/executableallocator.pro
index 196398020d..196398020d 100644
--- a/tests/auto/executableallocator/executableallocator.pro
+++ b/tests/manual/v4/auto/executableallocator/executableallocator.pro
diff --git a/tests/auto/executableallocator/tst_executableallocator.cpp b/tests/manual/v4/auto/executableallocator/tst_executableallocator.cpp
index 1d8617e4a2..1d8617e4a2 100644
--- a/tests/auto/executableallocator/tst_executableallocator.cpp
+++ b/tests/manual/v4/auto/executableallocator/tst_executableallocator.cpp
diff --git a/tests/crypto.js b/tests/manual/v4/crypto.js
index cd48bdb019..cd48bdb019 100644
--- a/tests/crypto.js
+++ b/tests/manual/v4/crypto.js
diff --git a/tests/exceptions.1.js b/tests/manual/v4/exceptions.1.js
index 5e4e152c19..5e4e152c19 100644
--- a/tests/exceptions.1.js
+++ b/tests/manual/v4/exceptions.1.js
diff --git a/tests/exceptions.2.js b/tests/manual/v4/exceptions.2.js
index 16b93b8940..16b93b8940 100644
--- a/tests/exceptions.2.js
+++ b/tests/manual/v4/exceptions.2.js
diff --git a/tests/fact.2.js b/tests/manual/v4/fact.2.js
index d8f750b5a1..d8f750b5a1 100644
--- a/tests/fact.2.js
+++ b/tests/manual/v4/fact.2.js
diff --git a/tests/fact.js b/tests/manual/v4/fact.js
index c00717d698..c00717d698 100644
--- a/tests/fact.js
+++ b/tests/manual/v4/fact.js
diff --git a/tests/for/for.1.js b/tests/manual/v4/for/for.1.js
index 9c1454dd31..9c1454dd31 100644
--- a/tests/for/for.1.js
+++ b/tests/manual/v4/for/for.1.js
diff --git a/tests/for/for.2.js b/tests/manual/v4/for/for.2.js
index f403160dc8..f403160dc8 100644
--- a/tests/for/for.2.js
+++ b/tests/manual/v4/for/for.2.js
diff --git a/tests/for/for.3.js b/tests/manual/v4/for/for.3.js
index f745366d41..f745366d41 100644
--- a/tests/for/for.3.js
+++ b/tests/manual/v4/for/for.3.js
diff --git a/tests/for/for.4.js b/tests/manual/v4/for/for.4.js
index 6e282181f4..6e282181f4 100644
--- a/tests/for/for.4.js
+++ b/tests/manual/v4/for/for.4.js
diff --git a/tests/fun.1.js b/tests/manual/v4/fun.1.js
index 9d73cade94..9d73cade94 100644
--- a/tests/fun.1.js
+++ b/tests/manual/v4/fun.1.js
diff --git a/tests/fun.2.js b/tests/manual/v4/fun.2.js
index c3fb613ac6..c3fb613ac6 100644
--- a/tests/fun.2.js
+++ b/tests/manual/v4/fun.2.js
diff --git a/tests/fun.3.js b/tests/manual/v4/fun.3.js
index 5add270f35..5add270f35 100644
--- a/tests/fun.3.js
+++ b/tests/manual/v4/fun.3.js
diff --git a/tests/fun.4.js b/tests/manual/v4/fun.4.js
index b130acccd3..b130acccd3 100644
--- a/tests/fun.4.js
+++ b/tests/manual/v4/fun.4.js
diff --git a/tests/instanceof.1.js b/tests/manual/v4/instanceof.1.js
index d991574e66..d991574e66 100644
--- a/tests/instanceof.1.js
+++ b/tests/manual/v4/instanceof.1.js
diff --git a/tests/label.1.js b/tests/manual/v4/label.1.js
index 79921cb5aa..79921cb5aa 100644
--- a/tests/label.1.js
+++ b/tests/manual/v4/label.1.js
diff --git a/tests/label.2.js b/tests/manual/v4/label.2.js
index fcb3d3e0e9..fcb3d3e0e9 100644
--- a/tests/label.2.js
+++ b/tests/manual/v4/label.2.js
diff --git a/tests/label.3.js b/tests/manual/v4/label.3.js
index 9940a33aff..9940a33aff 100644
--- a/tests/label.3.js
+++ b/tests/manual/v4/label.3.js
diff --git a/tests/obj.1.js b/tests/manual/v4/obj.1.js
index de2bd6318e..de2bd6318e 100644
--- a/tests/obj.1.js
+++ b/tests/manual/v4/obj.1.js
diff --git a/tests/obj.2.js b/tests/manual/v4/obj.2.js
index e9b1be5be0..e9b1be5be0 100644
--- a/tests/obj.2.js
+++ b/tests/manual/v4/obj.2.js
diff --git a/tests/property_lookup.js b/tests/manual/v4/property_lookup.js
index ee45b65710..ee45b65710 100644
--- a/tests/property_lookup.js
+++ b/tests/manual/v4/property_lookup.js
diff --git a/tests/prototype.1.js b/tests/manual/v4/prototype.1.js
index 40db84a0a9..40db84a0a9 100644
--- a/tests/prototype.1.js
+++ b/tests/manual/v4/prototype.1.js
diff --git a/tests/prototype.2.js b/tests/manual/v4/prototype.2.js
index 860385d977..860385d977 100644
--- a/tests/prototype.2.js
+++ b/tests/manual/v4/prototype.2.js
diff --git a/tests/prototype.3.js b/tests/manual/v4/prototype.3.js
index b76f544ee3..b76f544ee3 100644
--- a/tests/prototype.3.js
+++ b/tests/manual/v4/prototype.3.js
diff --git a/tests/prototype.4.js b/tests/manual/v4/prototype.4.js
index 9e4facb540..9e4facb540 100644
--- a/tests/prototype.4.js
+++ b/tests/manual/v4/prototype.4.js
diff --git a/tests/regexp.1.js b/tests/manual/v4/regexp.1.js
index c508bd53bb..c508bd53bb 100644
--- a/tests/regexp.1.js
+++ b/tests/manual/v4/regexp.1.js
diff --git a/tests/simple.2.js b/tests/manual/v4/simple.2.js
index 4a9f966da1..4a9f966da1 100644
--- a/tests/simple.2.js
+++ b/tests/manual/v4/simple.2.js
diff --git a/tests/simple.js b/tests/manual/v4/simple.js
index 8a80bcb4d0..8a80bcb4d0 100644
--- a/tests/simple.js
+++ b/tests/manual/v4/simple.js
diff --git a/tests/string.1.js b/tests/manual/v4/string.1.js
index 8cc76bb82d..8cc76bb82d 100644
--- a/tests/string.1.js
+++ b/tests/manual/v4/string.1.js
diff --git a/tests/switch.1.js b/tests/manual/v4/switch.1.js
index ca29b5f5de..ca29b5f5de 100644
--- a/tests/switch.1.js
+++ b/tests/manual/v4/switch.1.js
diff --git a/tests/switch.2.js b/tests/manual/v4/switch.2.js
index 60d59c161b..60d59c161b 100644
--- a/tests/switch.2.js
+++ b/tests/manual/v4/switch.2.js
diff --git a/tests/test262 b/tests/manual/v4/test262
-Subproject 0b5af3dcec772bb06b4d685a20b2859cda59d18
+Subproject 0b5af3dcec772bb06b4d685a20b2859cda59d18
diff --git a/tests/test262.py b/tests/manual/v4/test262.py
index c255bea1fa..c255bea1fa 100755
--- a/tests/test262.py
+++ b/tests/manual/v4/test262.py
diff --git a/tests/manual/v4/tests.pro b/tests/manual/v4/tests.pro
new file mode 100644
index 0000000000..85e4f3a53d
--- /dev/null
+++ b/tests/manual/v4/tests.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS += auto
diff --git a/tests/typeof.1.js b/tests/manual/v4/typeof.1.js
index a24cfc6169..a24cfc6169 100644
--- a/tests/typeof.1.js
+++ b/tests/manual/v4/typeof.1.js
diff --git a/tests/v8-bench.js b/tests/manual/v4/v8-bench.js
index baa6274136..baa6274136 100644
--- a/tests/v8-bench.js
+++ b/tests/manual/v4/v8-bench.js
diff --git a/tests/with.js b/tests/manual/v4/with.js
index 91ab5a0cdc..91ab5a0cdc 100644
--- a/tests/with.js
+++ b/tests/manual/v4/with.js
diff --git a/tests/system/sys_animatedsprite.qtt b/tests/system/sys_animatedsprite.qtt
new file mode 100644
index 0000000000..fe3a205549
--- /dev/null
+++ b/tests/system/sys_animatedsprite.qtt
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=qtdeclarative
+
+testcase = {
+
+ basic_animated_sprite_usage: function()
+ {
+ // Test Meta-data
+ testTitle = "Using AnimatedSprite elements";
+ testBinary = "animatedsprite.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/animatedsprite";
+ testGoal = "Verify an AnimatedSprite can be used to display an animating character.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a teddy bear blinking and moving its head and arms |
+ | | Watching closely, note that after the bear points its paw, it will look right, then look left, then blink |
+ | Press the Reverse button | After the bear points its paw, it should blink, then look left, then look right |
+ | Press the FPS "+" button 10 times | The FPS label shows 15 |
+ | | The bear is animating quickly |
+ | Press the FPS "-" button 10 times | The FPS label shows 5 |
+ | | The bear is animating slowly |'));
+ },
+
+ changing_a_sprite_source: function()
+ {
+ // Test Meta-data
+ testTitle = "Changing a sprite source";
+ testBinary = "animatedsprite.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/animatedspriteadvance";
+ testGoal = "Verify an AnimatedSprite source property can be changed, redrawing the new sprite.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a teddy bear blinking and moving its head and arms |
+ | | The bear\'s eyes are brown |
+ | Press the blue button under the Eyes control | The bear\'s eyes are blue |
+ | Press the white button under the Body control | The bear is now a polar bear with blue eyes |
+ | Press the gray button under the Body control | The blue eyed polar bear\'s face and abdomen are now gray |
+ | | All of the items are still animating in sync |'));
+ },
+
+ changing_the_animation_timing_method: function()
+ {
+ // Test Meta-data
+ testTitle = "Changing the method used to animate a sprite";
+ testBinary = "animatedsprite.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/animatedsprite";
+ testGoal = "Verify an AnimatedSprite can be timed using application frame sync or a specified frame rate.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a teddy bear blinking and moving its head and arms |
+ | Press FrameSync | Rate should show FrameSync |
+ | | The bear should be animating very fast and the FPS counter should still be 5 |
+ | Press FrameSync | The bear should be again animating slowly, Rate should show FrameRate |
+ | Press the FPS "-" button 5 times | FPS should show 0 |
+ | | The bear should be not moving |
+ | Press the FPS "-" button | The FPS label should show -1 |
+ | | The bear should be not moving |
+ | Press the FPS "+" button twice | FPS should show 1 |
+ | | The bear should be animating slowly |'));
+ }
+}
diff --git a/tests/system/sys_elements.qtt b/tests/system/sys_elements.qtt
new file mode 100644
index 0000000000..8703e5063b
--- /dev/null
+++ b/tests/system/sys_elements.qtt
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=qtdeclarative
+
+testcase = {
+
+ pre_existing_elements_data: {
+ Rectangle: ["Rectangle"],
+ Image: ["Image"],
+ AnimatedImage: ["AnimatedImage"],
+ BorderImage: ["BorderImage"],
+ SystemPalette: ["SystemPalette"],
+ Text: ["Text"],
+ TextInput: ["TextInput"],
+ TextEdit: ["TextEdit"],
+ FontLoader: ["FontLoader"],
+ Flipable: ["Flipable"],
+ Flickable: ["Flickable"],
+ IntValidator: ["IntValidator"],
+ DoubleValidator: ["DoubleValidator"],
+ RegExpValidator: ["RegExpValidator"],
+ Column: ["Column"],
+ Row: ["Row"],
+ Flow: ["Flow"],
+ Grid: ["Grid"],
+ Repeater: ["Repeater"],
+ ListView: ["ListView"],
+ Keys: ["Keys"],
+ MouseArea: ["MouseArea"],
+ SequentialAnimation: ["SequentialAnimation"],
+ ParallelAnimation: ["ParallelAnimation"],
+ XmlListModel: ["XmlListModel"],
+ Scale: ["Scale"]
+ },
+
+ pre_existing_elements: function(name) {
+ // Test Meta-data
+ testTitle = name+ " Element";
+ testBinary = "qmlscene tests/testapplications/elements/elements.qml";
+ testGoal = "Verify the "+name+" element is shown correctly";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | Select the '+name+' list item | Verify that the '+name+' application is displayed |
+ | Follow the instructions in the in-app test | Verify all steps are completed successfully |'));
+ },
+
+ new_elements_data: {
+ ParticleSystem: ["ParticleSystem"],
+ ImageParticle: ["ImageParticle"],
+ Emitter: ["Emitter"],
+ Affector: ["Affector"],
+ Shape: ["Shape",],
+ TrailEmitter: ["TrailEmitter"],
+ Direction: ["Direction"]
+ },
+
+ new_elements: function(name) {
+ // Test Meta-data
+ testTitle = name+ " Element";
+ testBinary = "qmlscene tests/testapplications/elements/elements.qml";
+ testGoal = "Verify the "+name+" element is shown correctly";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | Select the '+name+' list item | Verify that the '+name+' application is displayed |
+ | Follow the instructions in the in-app test | Verify all steps are completed successfully |'));
+ }
+}
diff --git a/tests/system/sys_listview.qtt b/tests/system/sys_listview.qtt
new file mode 100644
index 0000000000..51b62032ee
--- /dev/null
+++ b/tests/system/sys_listview.qtt
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=qtdeclarative
+
+testcase = {
+
+ using_section_delegates: function()
+ {
+ // Test Meta-data
+ testTitle = "Using and changing section delegate properties";
+ testBinary = "sections.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify that a Component can be set as a section header, using various properties for different collections.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | | The view shows a single character section header for each element |
+ | Press the Criteria button | The section headers now show the full name of each item |
+ | Press Property | The section headers now show the id value for the items |
+ | Press Criteria | The section headers now only show i - the first character of id |
+ | Press Property | The section headers show the first character of the item names |'));
+ },
+
+ updating_sections: function()
+ {
+ // Test Meta-data
+ testTitle = "Updating Collected Sections";
+ testBinary = "sections.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify that a section is updated when items are added.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | | The view shows a single character section header for each element |
+ | Press the + button | A duplicate of every name is added |
+ | | Each duplicate is place in the same section as the original |'));
+ },
+
+ changing_section_delegates: function()
+ {
+ // Test Meta-data
+ testTitle = "Changing Section Delegates";
+ testBinary = "sections.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify that a section delegate can be changed.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | | The view shows a single character section header for each element |
+ | Press the Delegate button | The section headers now show as light blue rectangles |
+ | Press the Criteria button | The headers show as full names, still within light blue rectangles |'));
+ },
+
+ altering_listview_primary_properties: function()
+ {
+ // Test Meta-data
+ testTitle = "Altering ListView primary properties";
+ testBinary = "alteredViews.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify that the model and delegate for a ListView can be changed";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | | The view shows items named Model1_1 - 5, and the delegates are white with a black border |
+ | Press the Mod button | The view now shows items named Model2_1 - 5 |
+ | Press Del | The delegates are now golden with a black border |
+ | Press Mod, then Del | The view again shows items named Model1_1 - 5, and are white |'));
+ },
+
+ altering_listview_orientation: function()
+ {
+ // Test Meta-data
+ testTitle = "Altering ListView orientation";
+ testBinary = "alteredViews.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify that the orientation of a listview can be changed at runtime";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | | The view shows items named Model1_1 - 5, and the delegates are white with a black border |
+ | Press the Ori button | The view is now displayed in a horizontal orientation |
+ | | The delegates should have resized quickly and smoothly, and the text rotated anticlockwise (both animated) |
+ | Press Del | The delegates are now golden with a black border, still in horizontal orientation |
+ | Press Ori | The view again shows in a vertical orientation, with the golden delegates |'));
+ },
+
+ basic_view_transition: function()
+ {
+ // Test Meta-data
+ testTitle = "Basic View Transitions";
+ testBinary = "viewTransitions.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify a basic transition can be applied to a ListView action";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+ testRequirements = "QTBUG-21504: Enable transitions for add/move/remove operations on views";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | Press the Set A button | The Set A button shows green |
+ | Press Add | A new yellow item fades in after the currently selected item |
+ | | The other items slide down, with a slight delay for each item, giving it a flowing effect |
+ | Select the new item | |
+ | Press To Top | The item changes to light blue and moves to the top, curving out to the right of the ListView |
+ | Select an item near the top and press Remove | The selected item fades out |
+ | | The other items slide up, with a slight delay for each item, giving it a flowing effect |'));
+ },
+
+ switching_view_transition: function() {
+ // Test Meta-data
+ testTitle = "Switching View Transitions";
+ testBinary = "viewTransitions.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify a basic ListView transition can be changed to another";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+ testRequirements = "QTBUG-21504: Enable transitions for add/move/remove operations on views";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | Press the Set A button | The Set A button shows green |
+ | Press Add | A new yellow item fades in after the currently selected item |
+ | | The other items slide down, with a slight delay for each item, giving it a flowing effect |
+ | Select the new item | |
+ | Press To Top | The item changes to light blue and moves to the top, curving out to the right of the ListView |
+ | Select an item near the top and press Remove | The selected item fades out |
+ | | The other items slide up, with a slight delay for each item, giving it a flowing effect |
+ | Press the Set B button | The Set B button shows green |
+ | Press Add | A new yellow item pops in after the currently selected item |
+ | | The other items tumble down in a disorderly manner |
+ | Select the new item | |
+ | Press To Top | The item changes from red to light blue and curves out to the right of the ListView, bouncing in at the top |
+ | Select an item near the top and press Remove | The selected item pops out |
+ | | The other items slide up, with a slight delay for each item, giving it a flowing effect |'));
+ },
+
+ different_transitions_for_every_operation: function() {
+ // Test Meta-data
+ testTitle = "Different Transitions for all Operations";
+ testBinary = "viewTransitions.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify a different Transition can be applied to displacement from adding, moving and removing.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+ testRequirements = "QTBUG-21504: Enable transitions for add/move/remove operations on views";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | Press the Set C button | The Set C button shows green |
+ | Press Add | A new yellow item swoops in from the side |
+ | | The other items jitter down, with a slight delay for each item |
+ | Select the new item | |
+ | Press To Top | The item changes from red to light blue and moves to the top, curving out to the right of the ListView |
+ | | The other items bounce down in a solid block |
+ | Select an item near the top and press Remove | The selected item fades out in a flashing manner |
+ | | The other items snap up, with a slight delay for each item |
+ | Press the Append button a few times | Each added item swoops in from alternating sides | '));
+ },
+
+ delegates_and_effects: function() {
+ testTitle = "Delegates and effects";
+ testBinary = "viewTransitions.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify a delegate in transition can show effects.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+ testRequirements = "QTBUG-21504: Enable transitions for add/move/remove operations on views";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | Press the Set D button | The Set D button shows green |
+ | Select a lower item | The item is highlighted |
+ | Press To Top | The item fades to red particles, shifts to the top, and fades back to a normal delegate |
+ | | The other items shuffle down |'));
+ },
+
+ attached_onremove_property: function() {
+ testTitle = "Using the attached onRemove property";
+ testBinary = "onRemove.qml";
+ testSource: "$QTDIR/qtdeclarative/tests/system/listview";
+ testGoal = "Verify the onRemove attached property can be assigned.";
+ testPreconditions = "None";
+ testGroups = "BAT,QtQuick 2.0";
+ testRequirements = "QTBUG-21504: Enable transitions for add/move/remove operations on views";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run '+testBinary+' | Application has started, showing a ListView |
+ | Press the <b>-</b> button | The selected item disappears in a shower of sparks |'));
+ }
+}
diff --git a/tests/system/sys_text.qtt b/tests/system/sys_text.qtt
new file mode 100644
index 0000000000..bfdac229c2
--- /dev/null
+++ b/tests/system/sys_text.qtt
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=qtdeclarative
+
+testcase = {
+
+ text_formatting_data: {
+ // Text type, autotext, plain text, rich text, styled text
+ BasicText: ["Basic","plain, unformatted red text","plain, unformatted red text","plain, unformatted red text","plain, unformatted red text"],
+ Rich: ["Rich","bold style","surrounding b,/b tags and no formatting","bold style","bold style"]
+ },
+
+ text_formatting: function(texttype,autoformat,plainformat,richformat,styledformat) {
+ // Test Meta-data
+ testTitle = "Text Formats";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify that text shows correctly when displayed in different formats";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run ' + testBinary + ' | Verify that the Text application is displayed |
+ | Select Text: '+texttype+', Format: AutoText controls | A single line of text is shown |
+ | | Qt Quick should be rendered with '+autoformat+' |
+ | Select the Wrap: Word option | A block of text is shown |
+ | Select the Format: PlainText option | Qt Quick should be shown with '+plainformat+' |
+ | Select the Format: RichText option | Qt Quick should be shown with '+richformat+' |
+ | Select the Format: StyledText option | Qt Quick should be shown with '+styledformat+' |'));
+ },
+
+ text_wrapping_data: {
+ // Text type, No wrap, word wrap, wrap anywhere, auto wrap
+ Basic: ["Basic",
+ "two lines, wrapped at the newline (Qt Quick consists...)",
+ "many lines, with no broken words",
+ "many lines, words broken at the text boundary",
+ "many lines, with no broken words"],
+ Long: ["Long",
+ "one lone line",
+ "two lines, wrapped at the - (topboxesand...),",
+ "many lines, wrapped at the boundary",
+ "many lines, wrapped at the boundary, and specifically the - in set-top"],
+ Rich: ["Rich",
+ "two lines, wrapped at the break (Qt Quick consists...)",
+ "many lines, with no broken words",
+ "many lines, words broken at the text boundary",
+ "many lines, with no broken words"]
+ },
+
+ text_wrapping: function(texttype,noWrap,wordWrap,anywhereWrap,autoWrap) {
+ // Test Meta-data
+ testTitle = "Wrap Modes";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify that text wraps correctly with different wrap methods and text formats";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run ' + testBinary + ' | Verify that the Text application is displayed |
+ | Select Text: '+texttype+', Format: AutoText controls | Verify '+noWrap+' is displayed |
+ | Select the Wrap: Word option | Verify '+wordWrap+' is displayed |
+ | Select the Wrap: Anywhere option | Verify '+anywhereWrap+' is displayed |
+ | Select the Wrap: Auto option | Verify '+autoWrap+' is displayed |'));
+ },
+
+ text_styling_data: {
+ // Text type
+ Basic: ["Basic"],
+ Long: ["Long"],
+ Rich: ["Rich"]
+ },
+
+ text_styling: function(texttype) {
+ // Test Meta-data
+ testTitle = "Style Effects";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify that styling (underline, strikeout etc) works as intended";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run ' + testBinary + ' | Verify that the Text application is displayed |
+ | Select Text: '+texttype+', Wrap: WordWrap | Verify the text is displayed, wrapped if necessary |
+ | Select the U_Line: On option | Verify an underline is drawn under each character |
+ | Select the Strike: On option | Verify a strikethrough is drawn through each character |
+ | Select the Style: Outline option | Verify each character is red and has a green outline around it |
+ | Select the SColor: Blue option | Verify each character is red and has a blue outline around it |
+ | Select the Style: Raised option | Verify each character is red and has a blue shadow behind and below it |
+ | Select the Style: Sunken option | Verify each character is red and has a blue shadow behind and above it |'));
+ }
+} \ No newline at end of file
diff --git a/tests/system/sys_textedit.qtt b/tests/system/sys_textedit.qtt
new file mode 100644
index 0000000000..f5b938edec
--- /dev/null
+++ b/tests/system/sys_textedit.qtt
@@ -0,0 +1,218 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=qtdeclarative
+
+testcase = {
+
+ text_formatting_data: {
+ // Text type, autotext, plain text, rich text, styled text
+ BasicText: ["Basic","plain, unformatted red text","plain, unformatted red text","plain, unformatted red text","plain, unformatted red text"],
+ Rich: ["Rich","bold style","surrounding b,/b tags and no formatting","bold style","bold style"]
+ },
+
+ text_formatting: function(texttype,autoformat,plainformat,richformat,styledformat) {
+ // Test Meta-data
+ testTitle = "Text Formats";
+ testBinary = "qmlscene tests/testapplications/text/textedit.qml";
+ testGoal = "Verify that text shows correctly when displayed in different formats";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run ' + testBinary + ' | Verify that the Text application is displayed |
+ | Select Text: '+texttype+', Format: AutoText controls | A single line of text is shown |
+ | | Qt Quick should be rendered with '+autoformat+' |
+ | Select the Wrap: Word option | A block of text is shown |
+ | Select the Format: PlainText option | Qt Quick should be shown with '+plainformat+' |
+ | Select the Format: RichText option | Qt Quick should be shown with '+richformat+' |
+ | Select the Format: StyledText option | Qt Quick should be shown with '+styledformat+' |'));
+ },
+
+ text_wrapping_data: {
+ // Text type, No wrap, word wrap, wrap anywhere, auto wrap
+ Basic: ["Basic",
+ "two lines, wrapped at the newline (Qt Quick consists...)",
+ "many lines, with no broken words",
+ "many lines, words broken at the text boundary",
+ "many lines, with no broken words"],
+ Long: ["Long",
+ "one lone line",
+ "two lines, wrapped at the - (topboxesand...),",
+ "many lines, wrapped at the boundary",
+ "many lines, wrapped at the boundary, and specifically the - in set-top"],
+ Rich: ["Rich",
+ "two lines, wrapped at the break (Qt Quick consists...)",
+ "many lines, with no broken words",
+ "many lines, words broken at the text boundary",
+ "many lines, with no broken words"]
+ },
+
+ text_wrapping: function(texttype,noWrap,wordWrap,anywhereWrap,autoWrap) {
+ // Test Meta-data
+ testTitle = "Wrap Modes";
+ testBinary = "qmlscene tests/testapplications/text/textedit.qml";
+ testGoal = "Verify that text wraps correctly with different wrap methods and text formats";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run ' + testBinary + ' | Verify that the Text application is displayed |
+ | Select Text: '+texttype+', Format: AutoText controls | Verify '+noWrap+' is displayed |
+ | Select the Wrap: Word option | Verify '+wordWrap+' is displayed |
+ | Select the Wrap: Anywhere option | Verify '+anywhereWrap+' is displayed |
+ | Select the Wrap: Auto option | Verify '+autoWrap+' is displayed |'));
+ },
+
+ text_styling_data: {
+ // Text type
+ Basic: ["Basic"],
+ Long: ["Long"],
+ Rich: ["Rich"]
+ },
+
+ text_styling: function(texttype) {
+ // Test Meta-data
+ testTitle = "Style Effects";
+ testBinary = "qmlscene tests/testapplications/text/textedit.qml";
+ testGoal = "Verify that styling (underline, strikeout etc) works as intended";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+ | *Step* | *Verification* |
+ | Run ' + testBinary + ' | Verify that the Text application is displayed |
+ | Select Text: '+texttype+', Wrap: WordWrap | Verify the text is displayed, wrapped if necessary |
+ | Select the U_Line: On option | Verify an underline is drawn under each character |
+ | Select the Strike: On option | Verify a strikethrough is drawn through each character |'));
+ },
+
+ select_text: function()
+ {
+ // Test meta data
+ testTitle = "Text Selection";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify text can be selected via various methods";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Text: Short option | "Hello World" is shown |
+ | Press the Select Word button | World is selected |
+ | Press the Select All button | Hello World is selected |
+ | Press the Select None button | No text is selected |
+ | Select the Mouse: On option | |
+ | Drag over some text | Only that text is selected. On a touchscreen only device the virtual keyboard may show |
+ | Select the Mouse: Off option | |
+ | Press the Select None button | No text is selected |
+ | Drag over some text | No text is selected. On a touchscreen only device the virtual keyboard may show | '));
+ },
+
+ cut_copy_and_paste: function()
+ {
+ // Test meta data
+ testTitle = "Cut, copy and paste";
+ testBinary = "qmlscene tests/testapplications/text/textedit.qml";
+ testGoal = "Verify selected text can be copied/cut to the clipboard, and returned";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Text: Short option | "Hello World" is shown |
+ | Press the Select All button | Hello World is selected |
+ | Press the Copy Button | |
+ | Tap at the end of the text | Text is no longer selected, cursor is at the text end |
+ | Press the Paste Button | "Hello WorldHello World" is shown |
+ | Press the Select Word button | World is highlighted |
+ | Press the Cut button | World is removed from the text |
+ | Press the Paste button | "Hello WorldHello World" is shown | '));
+ },
+
+ activate_links: function()
+ {
+ // Test meta data
+ testTitle = "Link Activation";
+ testBinary = "qmlscene tests/testapplications/text/textedit.qml";
+ testGoal = "Verify http links in text can be activated";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Text: Links option | "This is a link..." is shown |
+ | Tap on the "Qt Docs" text | The border around the TextEdit will become red | '));
+ }
+
+}
diff --git a/tests/system/sys_textinput.qtt b/tests/system/sys_textinput.qtt
new file mode 100644
index 0000000000..9459b86d83
--- /dev/null
+++ b/tests/system/sys_textinput.qtt
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=qtdeclarative
+
+testcase = {
+
+ select_text: function()
+ {
+ // Test meta data
+ testTitle = "Text Selection";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify text can be selected via various methods";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Text: Short option | "Hello World" is shown |
+ | Press the Select Word button | World is selected |
+ | Press the Select All button | Hello World is selected |
+ | Press the Select None button | No text is selected |
+ | Select the Mouse: On option | |
+ | Drag over some text | Only that text is selected. On a touchscreen only device the virtual keyboard may show |
+ | Select the Mouse: Off option | |
+ | Press the Select None button | No text is selected |
+ | Drag over some text | No text is selected. On a touchscreen only device the virtual keyboard may show |'));
+ },
+
+ cut_copy_and_paste: function()
+ {
+ // Test meta data
+ testTitle = "Cut, copy and paste";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify selected text can be copied/cut to the clipboard, and returned";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Text: Short option | "Hello World" is shown |
+ | Press the Select All button | Hello World is selected |
+ | Press the Copy Button | |
+ | Press the Position End Button | Text is no longer selected, cursor is at the text end |
+ | Press the Paste Button | "Hello WorldHello World" is shown |
+ | Press the Select Word button | World is highlighted |
+ | Press the Cut button | World is removed from the text |
+ | Press the Paste button | "Hello WorldHello World" is shown |'));
+ },
+
+ password_echo_mode: function()
+ {
+ // Test meta data
+ testTitle = "Password Echo";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify password echo modes display text correctly";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Text: Short option | "Hello World" is shown |
+ | Select the Echo: Password option | Hello World is now a string of asterisks |
+ | Enter an exclamation mark | An asterisk is added to the string |
+ | Select the Echo: None option | No text is visible |
+ | Enter an exclamation mark | No text is shown |
+ | Select the Echo: OnEdit option | A string of asterisks is shown |
+ | Enter an exclamation mark | An exclamation mark appears at the end of the asterisks, but shortly becomes an asterisk |
+ | Select the Echo: Normal option | Hello World!!! is now displayed |'));
+ },
+
+ styling: function()
+ {
+ // Test meta data
+ testTitle = "Text Styling";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify text can be displayed using generic styling";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Text: Short option | "Hello World" is shown |
+ | Select the Bold: On option | Hello World is now in bold |
+ | Press the Italics: On option | Hello World is now in italics |
+ | Press the Strikeout: On option | Hello World now has a line passing through it |
+ | Press the Underline: On option | Hello World is now underlined | '));
+ },
+
+ cursor_behavior: function()
+ {
+ // Test meta data
+ testTitle = "Cursor Behavior";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify the text cursor displays correctly";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Enter enough text into the field such that it passes beyond the far right | The text scrolls to the left when the edge is reached |
+ | Select the Autoscroll: Off button | The far left edge shows the first character of the text |
+ | Select the Cursor: Off option | The cursor disappears |
+ | Select the Cursor: On option | The cursor appears | '));
+ },
+
+ capitalization: function()
+ {
+ // Test meta data
+ testTitle = "Capitalization";
+ testBinary = "qmlscene tests/testapplications/text/text.qml";
+ testGoal = "Verify character capitalization behaves correctly";
+ testPreconditions = "None";
+ testGroups = "BAT";
+
+ // Test Steps
+ prompt(twiki('---+++ ' + testTitle + '<br><br>
+ *Goal:* ' + testGoal + '<br>
+ *Pre-Requisites:* ' + testPreconditions + '<br>
+ *Tested Binary:* ' + testBinary + '<br>
+
+ | *Step* | *Verification* |
+ | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
+ | Select the Cap10n: Upper option | The text is converted to all upper case |
+ | Select the Cap10n: Lower option | The text is converted to all lower case |
+ | Select the Cap10n: SmallCaps option | The text is converted to all small sized upper case characters |
+ | Select the Cap10n: Capitals option | The text is shown with each first character of every word capitalized | '));
+ }
+} \ No newline at end of file
diff --git a/tests/testapplications/animatedsprite/animatedsprite.qml b/tests/testapplications/animatedsprite/animatedsprite.qml
new file mode 100644
index 0000000000..368b42d679
--- /dev/null
+++ b/tests/testapplications/animatedsprite/animatedsprite.qml
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+
+ property bool reversed: false
+ property real speed: 5
+ property bool framesync: false
+
+ width: 320
+ height: 480
+ color: "lightgray"
+
+ Column {
+ id: controls
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 30
+ width: parent.width - 10
+ spacing: 5
+ Text {
+ text: framesync ? "Rate: FrameSync" : "Rate: FrameRate"
+ width: controls.width
+ height: 50
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ MouseArea {
+ anchors.fill: parent
+ onClicked: framesync = !framesync
+ }
+ Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black"; radius: 5 }
+ }
+ Text {
+ text: reversed ? "Reverse" : "Forward"
+ width: controls.width
+ height: 50
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ MouseArea {
+ anchors.fill: parent
+ onClicked: reversed = !reversed
+ }
+ Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black"; radius: 5 }
+ }
+
+ Text {
+ text: "FPS: "+s1.frameRate
+ width: controls.width
+ height: 50
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ Rectangle {
+ height: parent.height
+ width: height
+ Text { anchors.centerIn: parent; text: "-" }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: speed = speed - 1
+ }
+ }
+ Rectangle {
+ height: parent.height
+ width: height
+ anchors.right: parent.right
+ Text { anchors.centerIn: parent; text: "+" }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: speed = speed + 1
+ }
+ }
+ Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black"; radius: 5 }
+ }
+ }
+
+ AnimatedSprite {
+ id: s1
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -80
+ running: true
+ height: 125
+ width: 125
+ frameCount: 13
+ frameDuration: 50
+ frameRate: speed
+ frameSync: framesync
+ reverse: reversed
+ interpolate: false
+ source: "bear_tiles.png"
+ }
+}
diff --git a/tests/testapplications/animatedsprite/animatedspriteadvance.qml b/tests/testapplications/animatedsprite/animatedspriteadvance.qml
new file mode 100644
index 0000000000..b9eab3098d
--- /dev/null
+++ b/tests/testapplications/animatedsprite/animatedspriteadvance.qml
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+
+ width: 320
+ height: 480
+ color: "lightgray"
+ Column {
+ Text { text: "Current frame: "+s1.currentFrame }
+ Text { text: "Delay: " + animcontroller.interval + "msec" }
+ }
+
+ Row {
+ height: parent.height / 3
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ spacing: 5
+ Column {
+ height: parent.height
+ width: 80
+ Text { id: bodytxt; width: parent.width; text: "Body"; horizontalAlignment: Text.AlignHCenter }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "white"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s1.source = "bear_polar.png" }
+ }
+ }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "black"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s1.source = "bear_black.png" }
+ }
+ }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "brown"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s1.source = "bear_brown.png" }
+ }
+ }
+ }
+ Column {
+ height: parent.height
+ width: 80
+ Text { id: eyestxt; width: parent.width; text: "Eyes"; horizontalAlignment: Text.AlignHCenter }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "brown"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s2.source = "bear_eyes_brown.png" }
+ }
+ }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "blue"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s2.source = "bear_eyes_blue.png" }
+ }
+ }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "green"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s2.source = "bear_eyes_green.png" }
+ }
+ }
+ }
+ Column {
+ height: parent.height
+ width: 80
+ Text { id: furtxt; width: parent.width; text: "Fur"; horizontalAlignment: Text.AlignHCenter }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "orange"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s3.source = "bear_fur_orange.png" }
+ }
+ }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "gray"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s3.source = "bear_fur_gray.png" }
+ }
+ }
+ Rectangle {
+ height: 30
+ width: parent.width
+ color: "magenta"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { s3.source = "bear_fur_pink.png" }
+ }
+ }
+ }
+ }
+
+ function advanceall() {
+ s1.advance();
+ s2.advance();
+ s3.advance();
+ if (s2.currentFrame!=s1.currentFrame || s3.currentFrame!=s1.currentFrame)
+ console.log("Frames out of sync!")
+ }
+
+ AnimatedSprite {
+ id: s1
+ x: 100
+ y: 100
+ running: true
+ paused: true
+ height: 125
+ width: 125
+ frameCount: 13
+ interpolate: false
+ source: "bear_brown.png"
+ }
+
+ AnimatedSprite {
+ id: s2
+ anchors.fill: s1
+ running: true
+ paused: s1.paused
+ frameCount: 13
+ interpolate: false
+ source: "bear_eyes_brown.png"
+ onSourceChanged: { currentFrame = s1.currentFrame }
+ }
+
+ AnimatedSprite {
+ id: s3
+ anchors.fill: s1
+ running: true
+ paused: s1.paused
+ frameCount: 13
+ interpolate: false
+ source: "bear_fur_orange.png"
+ onSourceChanged: { currentFrame = s1.currentFrame }
+ }
+
+ Timer { id: animcontroller; interval: 75; running: true; repeat: true; onTriggered: { advanceall(); } }
+}
diff --git a/tests/testapplications/animatedsprite/bear_black.png b/tests/testapplications/animatedsprite/bear_black.png
new file mode 100644
index 0000000000..d014132ef9
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_black.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_brown.png b/tests/testapplications/animatedsprite/bear_brown.png
new file mode 100644
index 0000000000..514d45650c
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_brown.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_eyes_blue.png b/tests/testapplications/animatedsprite/bear_eyes_blue.png
new file mode 100644
index 0000000000..aca9172cf6
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_eyes_blue.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_eyes_brown.png b/tests/testapplications/animatedsprite/bear_eyes_brown.png
new file mode 100644
index 0000000000..2790f81727
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_eyes_brown.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_eyes_green.png b/tests/testapplications/animatedsprite/bear_eyes_green.png
new file mode 100644
index 0000000000..31f49449cf
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_eyes_green.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_fur_gray.png b/tests/testapplications/animatedsprite/bear_fur_gray.png
new file mode 100644
index 0000000000..782b2443bb
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_fur_gray.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_fur_orange.png b/tests/testapplications/animatedsprite/bear_fur_orange.png
new file mode 100644
index 0000000000..5334fc7c88
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_fur_orange.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_fur_pink.png b/tests/testapplications/animatedsprite/bear_fur_pink.png
new file mode 100644
index 0000000000..efbde0d930
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_fur_pink.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_polar.png b/tests/testapplications/animatedsprite/bear_polar.png
new file mode 100644
index 0000000000..dab96b9d51
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_polar.png
Binary files differ
diff --git a/tests/testapplications/animatedsprite/bear_tiles.png b/tests/testapplications/animatedsprite/bear_tiles.png
new file mode 100644
index 0000000000..6bbb2a9b6d
--- /dev/null
+++ b/tests/testapplications/animatedsprite/bear_tiles.png
Binary files differ
diff --git a/tests/testapplications/elements/content/AffectorElement.qml b/tests/testapplications/elements/content/AffectorElement.qml
new file mode 100644
index 0000000000..194dc7fcb3
--- /dev/null
+++ b/tests/testapplications/elements/content/AffectorElement.qml
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: affectorelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ ParticleSystem {
+ id: particlesystem
+ anchors.fill: parent
+
+ ImageParticle {
+ id: imageparticle
+ source: "pics/star.png"
+ color: "blue"
+ entryEffect: ImageParticle.None
+ anchors.fill: parent
+ }
+
+ // Pipe
+ Rectangle {
+ id: pipe
+ x: 0; y: 300
+ border.color: "black"
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightgray" }
+ GradientStop { position: 1.0; color: "gray" }
+ }
+ height: 40; width: 40
+ }
+ Rectangle {
+ id: pipehead
+ anchors.left: pipe.right
+ anchors.verticalCenter: pipe.verticalCenter
+ border.color: "black"
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightgray" }
+ GradientStop { position: 1.0; color: "gray" }
+ }
+ height: 50; width: 10
+ }
+
+ Emitter {
+ id: emitterelement
+ anchors.left: pipe.left
+ anchors.leftMargin: 10
+ anchors.bottom: pipe.bottom
+ anchors.bottomMargin: 8
+ height: 5
+ emitRate: 100
+ lifeSpan: 10000
+ velocity: AngleDirection { angle: 0; magnitude: 30 }
+ }
+
+ // Affectors
+ Gravity {
+ id: gravity
+ x: pipe.width; y: pipe.y-100
+ enabled: false
+ height: 200
+ width: parent.width - pipe.width
+ angle: 90
+ acceleration: 30
+ }
+ Wander {
+ id: wander
+ enabled: false
+ anchors.verticalCenter: pipe.verticalCenter
+ anchors.left: pipe.right
+ height: pipe.height
+ width: 5
+ xVariance: 50
+ yVariance: 100
+ pace: 200
+ }
+ Turbulence {
+ id: turbulence
+ enabled: false
+ strength: 40
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 100
+ width: parent.width; height: 100
+ }
+ Friction {
+ id: friction
+ anchors.bottom: parent.bottom; width: parent.width; height: 100
+ enabled: false
+ factor: 2
+ }
+ Age {
+ id: age
+ anchors.bottom: parent.bottom; width: 360; height: 5
+ }
+
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: affectorelementtest
+ testtext: "This is a group of currently disabled Affector elements. "+
+ "A blue stream of particles should be flowing from a block to the left.\n"+
+ "Next, let's add some variance in direction when the particles leave the block." }
+ },
+ State { name: "spread"; when: statenum == 2
+ PropertyChanges { target: wander; enabled: true }
+ PropertyChanges { target: affectorelementtest
+ testtext: "The particles should be spreading out as they progress.\n"+
+ "Next, let's introduce gravity." }
+ },
+ State { name: "gravity"; when: statenum == 3
+ PropertyChanges { target: wander; enabled: true }
+ PropertyChanges { target: gravity; enabled: true }
+ PropertyChanges { target: affectorelementtest
+ testtext: "The particles should now be dropping.\n"+
+ "Also, no particles should be visible below the bounds of the application, "+
+ "i.e. the white panel.\n"+
+ "Next, let's introduce some friction at the bottom of the display." }
+ },
+ State { name: "friction"; when: statenum == 4
+ PropertyChanges { target: wander; enabled: true }
+ PropertyChanges { target: gravity; enabled: true }
+ PropertyChanges { target: friction; enabled: true }
+ PropertyChanges { target: affectorelementtest
+ testtext: "The particles should now be decelerating suddenly at the bottom.\n"+
+ "Next, let's add some turbulence to the flow." }
+ },
+ State { name: "turbulence"; when: statenum == 5
+ PropertyChanges { target: wander; enabled: true }
+ PropertyChanges { target: gravity; enabled: true }
+ PropertyChanges { target: friction; enabled: true }
+ PropertyChanges { target: turbulence; enabled: true }
+ PropertyChanges { target: affectorelementtest
+ testtext: "The particles should now be turbulent.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/testapplications/elements/content/AnimatedImageElement.qml b/tests/testapplications/elements/content/AnimatedImageElement.qml
new file mode 100644
index 0000000000..c0497b6ad1
--- /dev/null
+++ b/tests/testapplications/elements/content/AnimatedImageElement.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: animatedimageelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Item {
+ id: animatedimageelementcontainer
+ height: 100; width: 100
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ AnimatedImage { id: animatedimageelement; anchors.fill: parent; source: "pics/cat.gif" }
+ Behavior on height { NumberAnimation { duration: 1000 } }
+ Behavior on width { NumberAnimation { duration: 1000 } }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: animatedimageelementtest
+ testtext: "This is an AnimatedImage element. It should be small and showing an animated cat.\n"+
+ "Next, it should animatedly increase to twice its size" }
+ },
+ State { name: "large"; when: statenum == 2
+ PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
+ PropertyChanges { target: animatedimageelementtest
+ testtext: "It should be large and still showing the cat, but slightly stretched.\n"+
+ "Next, let's change it to preserve its aspect ratio" }
+ },
+ State { name: "largefit"; when: statenum == 3
+ PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
+ PropertyChanges { target: animatedimageelement; fillMode: Image.PreserveAspectFit }
+ PropertyChanges { target: animatedimageelementtest
+ testtext: "It should be large and now showing the cat normally (square).\n"+
+ "Next, it will change its aspect ratio to fit, but cropping the sides" }
+ },
+ State { name: "largecrop"; when: statenum == 4
+ PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
+ PropertyChanges { target: animatedimageelement; fillMode: Image.PreserveAspectCrop }
+ PropertyChanges { target: animatedimageelementtest
+ testtext: "It should be large and now showing the cat with the sides removed.\n"+
+ "Next, let's change the image to tile the square" }
+ },
+ State { name: "largetile"; when: statenum == 5
+ PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
+ PropertyChanges { target: animatedimageelement; fillMode: Image.Tile; }
+ PropertyChanges { target: animatedimageelementtest
+ testtext: "The image should be repeated both horizontally and vertically.\n"+
+ "Next, let's change the image to tile the square vertically" }
+ },
+ State { name: "largetilevertical"; when: statenum == 6
+ PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
+ PropertyChanges { target: animatedimageelement; fillMode: Image.TileVertically; }
+ PropertyChanges { target: animatedimageelementtest
+ testtext: "The image should be repeated only vertically.\n"+
+ "Next, let's change the image to tile the square horizontally" }
+ },
+ State { name: "largetilehorizontal"; when: statenum == 7
+ PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 }
+ PropertyChanges { target: animatedimageelement; fillMode: Image.TileHorizontally; }
+ PropertyChanges { target: animatedimageelementtest
+ testtext: "The image should be repeated only horizontally.\n"+
+ "The next step will return the image to a small, stretched state" }
+ }
+ ]
+}
diff --git a/tests/testapplications/elements/content/AppContainer.qml b/tests/testapplications/elements/content/AppContainer.qml
new file mode 100644
index 0000000000..0eabc3f943
--- /dev/null
+++ b/tests/testapplications/elements/content/AppContainer.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+
+ property string qmlfile: ""
+ height: parent.height *.95; width: parent.width *.95; anchors.centerIn: parent; radius: 5
+
+ onQmlfileChanged: { qmlapp.source = qmlfile; if (qmlfile != "") { starttimer.start(); } }
+
+ Loader {
+ id: qmlapp
+ property int statenum: 0
+ property int statecount
+ statecount: qmlfile != "" ? children[0].states.length : 0
+ anchors.fill: parent; focus: true
+ function advance() { statenum = statenum == statecount ? 1 : ++statenum; }
+ }
+
+ Timer { id: starttimer; interval: 500; onTriggered: { qmlapp.advance(); } }
+
+ Rectangle {
+ anchors { top: parent.top; right: parent.right; topMargin: 3; rightMargin: 3 }
+ height: 30; width: 30; color: "red"; radius: 5
+ Text { text: "X"; anchors.centerIn: parent; font.pointSize: 12 }
+ MouseArea { anchors.fill: parent; onClicked: { elementsapp.qmlfiletoload = "" } }
+ }
+
+ Text { anchors.centerIn: parent; visible: qmlapp.status == Loader.Error; text: qmlfile+" failed to load.\n"; }
+
+}
diff --git a/tests/testapplications/elements/content/BorderImageElement.qml b/tests/testapplications/elements/content/BorderImageElement.qml
new file mode 100644
index 0000000000..1818babecd
--- /dev/null
+++ b/tests/testapplications/elements/content/BorderImageElement.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: borderimageelementtest
+ anchors.fill: parent
+ property int bordervalue: 30
+ property string testtext: ""
+
+ BorderImage {
+ id: borderimageelement
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ width: 100; height: 100
+ source: "pics/qml-borderimage.png"
+ border { left: bordervalue; top: bordervalue; right: bordervalue; bottom: bordervalue }
+ Rectangle {
+ height: parent.height-70; width: parent.width-70; anchors.centerIn: parent
+ color: "gray"; radius: 5; border.color: "black"; opacity: .5
+ }
+ Behavior on height { NumberAnimation { duration: 1000 } }
+ Behavior on width { NumberAnimation { duration: 1000 } }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: borderimageelementtest
+ testtext: "This is a BorderImage element. It should be small and be showing a frame.\n"+
+ "Next, it should animatedly increase to twice its size" }
+ },
+ State { name: "large"; when: statenum == 2
+ PropertyChanges { target: borderimageelement; height: 200; width: 200 }
+ PropertyChanges { target: borderimageelementtest
+ testtext: "It should be large and still showing the border frame.\n"+
+ "Next, it will change the sides repeat mode to tile" }
+ },
+ State { name: "largetile"; when: statenum == 3
+ PropertyChanges { target: borderimageelement; height: 200; width: 200;
+ verticalTileMode: BorderImage.Repeat; horizontalTileMode: BorderImage.Repeat }
+ PropertyChanges { target: borderimageelementtest
+ testtext: "The sides of the border should now be repeated.\n"+
+ "Next, it will change the sides repeat mode to repeated, but not cropped at the side" }
+ },
+ State { name: "largecrop"; when: statenum == 4
+ PropertyChanges { target: borderimageelement; height: 200; width: 200;
+ verticalTileMode: BorderImage.Round; horizontalTileMode: BorderImage.Round }
+ PropertyChanges { target: borderimageelementtest
+ testtext: "It should now show the borders repeated but scaled to fit uniformly.\n"+
+ "The next step will show the BorderImage return to the defaults" }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/BugPanel.qml b/tests/testapplications/elements/content/BugPanel.qml
new file mode 100644
index 0000000000..61d07ef77a
--- /dev/null
+++ b/tests/testapplications/elements/content/BugPanel.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ property string urltext
+ urltext: "<a href=\"" + bugreports + bugnumber + "\">QTBUG-" + bugnumber + "</a>"
+ property string bugnumber: ""
+ property string bugreports: "http://bugreports.qt-project.org/browse/QTBUG-"
+ visible: opacity != 0
+ opacity: bugnumber == "" ? 0 : 1
+ Behavior on opacity { NumberAnimation { duration: 1500 } }
+ height: buglist.paintedHeight; width: 200; radius: 5; border.color: "lightgray"
+ anchors { bottom: parent.bottom; left: parent.left; leftMargin: 15; bottomMargin: 15 }
+ Text { id: buglist; text: urltext; textFormat: Text.RichText; visible: bugnumber != ""
+ anchors.centerIn: parent; onLinkActivated: { Qt.openUrlExternally(link); }
+ }
+}
diff --git a/tests/testapplications/elements/content/ColumnElement.qml b/tests/testapplications/elements/content/ColumnElement.qml
new file mode 100644
index 0000000000..e513b11226
--- /dev/null
+++ b/tests/testapplications/elements/content/ColumnElement.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: columnelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Column {
+ id: columnelement
+ width: 200
+ spacing: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ Rectangle { id: gr; color: "green"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+ Rectangle { id: re; color: "red"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+ Rectangle {
+ id: bl
+ color: "blue"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; radius: 5; clip: true
+ opacity: 0; visible: opacity != 0
+ }
+ Rectangle { id: bk; color: "black"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+
+ move: Transition { NumberAnimation { properties: "y"; duration: 500; easing.type: Easing.OutBounce } }
+ add: Transition { NumberAnimation { properties: "y"; duration: 1000; easing.type: Easing.OutBounce } }
+
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: columnelementtest
+ testtext: "This is a Column element. At present it should be showing three rectangles - green, red and black.\n"+
+ "Next, let's add a rectangle to the Column - it should drop in from the top and the black rectangle should move to give it space" }
+ },
+ State { name: "back"; when: statenum == 2
+ PropertyChanges { target: bl; opacity: .9 }
+ PropertyChanges { target: columnelementtest
+ testtext: "Column should now be showing four rectangles - green, red, blue and black.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+}
diff --git a/tests/testapplications/elements/content/DirectionElement.qml b/tests/testapplications/elements/content/DirectionElement.qml
new file mode 100644
index 0000000000..8cc9126b1e
--- /dev/null
+++ b/tests/testapplications/elements/content/DirectionElement.qml
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: directionelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ ParticleSystem {
+ id: particlesystem
+ anchors.fill: parent
+ Item {
+ id: targetbox
+ x: 50
+ y: 300
+ Rectangle {
+ id: targeticon
+ color: "brown"
+ height: 0; width: 0; radius: 20
+ anchors.centerIn: parent
+ Behavior on height { NumberAnimation { duration: 500; easing.type: Easing.OutBounce } }
+ Behavior on width { NumberAnimation { duration: 500; easing.type: Easing.OutBounce } }
+ }
+ }
+ ImageParticle {
+ id: imgparticle
+ source: "pics/star.png"
+ color: "red"
+ entryEffect: ImageParticle.None
+ }
+ Emitter {
+ id: emitter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ emitRate: 50
+ lifeSpan: 4000
+ size: 20
+ velocity: angledirectionelement
+ AngleDirection { id: angledirectionelement; angle: -75; angleVariation: 5; magnitude: 150 }
+ TargetDirection { id: targetdirectionelement; targetItem: targetbox; targetVariation: 10; magnitude: 150 }
+ PointDirection { id: pointdirectionelement; y: -100; xVariation: 10; yVariation: 10; }
+ PointDirection { id: pointdirectionelementdownward; y: 200 }
+ CumulativeDirection {
+ id: cumulativedirectionelement
+ PointDirection { y: -200 }
+ AngleDirection { angle: 270; angleVariation: 45; magnitude: 100; magnitudeVariation: 10; }
+ }
+ }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: directionelementtest
+ testtext: "This is an Emitter with the direction set by an AngleDirection.\n"+
+ "The particles should be firing at a -75 degree (to the top right) .\n"+
+ "Next, let's change the Emitter to target an item." }
+ },
+ State { name: "ontarget"; when: statenum == 2
+ PropertyChanges { target: emitter; velocity: targetdirectionelement }
+ PropertyChanges { target: targeticon; height: 50; width: 50 }
+ PropertyChanges { target: directionelementtest
+ testtext: "The particles should be directed at the rectangle.\n"+
+ "Next, let's set an arbritary point to direct the particles to." }
+ },
+ State { name: "onpoint"; when: statenum == 3
+ PropertyChanges { target: emitter; velocity: pointdirectionelement }
+ PropertyChanges { target: directionelementtest
+ testtext: "The particles should be directed upwards with a small amount of spread.\n"+
+ "Next, let's create a fountain with CumulativeDirection and a downward PointDirection" }
+ },
+ State { name: "cumulative"; when: statenum == 4
+ PropertyChanges { target: emitter; emitRate: 200; velocity: cumulativedirectionelement
+ acceleration: pointdirectionelementdownward }
+ PropertyChanges { target: imgparticle; color: "aqua"; colorVariation: .2 }
+ PropertyChanges { target: directionelementtest
+ testtext: "The particles should be flowing upwards and falling in a fountain effect.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/testapplications/elements/content/DoubleValidatorElement.qml b/tests/testapplications/elements/content/DoubleValidatorElement.qml
new file mode 100644
index 0000000000..989eb185f0
--- /dev/null
+++ b/tests/testapplications/elements/content/DoubleValidatorElement.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: doublevalidatorelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ DoubleValidator {
+ id: doublevalidatorelement
+ top: 30.06; bottom: 30.02
+ //Behavior on top { NumberAnimation { duration: 1000 } }
+ }
+
+ Rectangle {
+ id: doublevalidatorelementbackground
+ color: doublevalidatorelementinput.acceptableInput ? "green" : "red"; height: 50; width: parent.width *.8
+ border.color: "gray"; opacity: 0.7; radius: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+
+ TextInput {
+ id: doublevalidatorelementinput
+ font.pointSize: 12; width: parent.width; text: "0"; horizontalAlignment: Text.AlignHCenter; validator: doublevalidatorelement
+ anchors.centerIn: parent
+ Behavior on font.pointSize { NumberAnimation { duration: 1000 } }
+ Behavior on color { ColorAnimation { duration: 1000 } }
+ }
+ }
+
+ Text{
+ anchors.top: doublevalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter
+ text: "Top: " + doublevalidatorelement.top + " Bottom: " + doublevalidatorelement.bottom
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: doublevalidatorelementinput; text: "30.03" }
+ PropertyChanges { target: doublevalidatorelementtest
+ testtext: "This is a TextInput element using an DoubleValidator for input masking. At present it should be indicating 30.03.\n"+
+ "Next, let's attempt to enter a number smaller than the lowest allowable value: 30.01" }
+ },
+ State { name: "lowerthan"; when: statenum == 2
+ PropertyChanges { target: doublevalidatorelementinput; text: "30.01" }
+ PropertyChanges { target: doublevalidatorelementtest
+ testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
+ "Next, let's enter a value equal to the lowest allowable value: 30.02." }
+ },
+ State { name: "equaltobottom"; when: statenum == 3
+ PropertyChanges { target: doublevalidatorelementinput; text: "30.02" }
+ PropertyChanges { target: doublevalidatorelementtest
+ testtext: "The TextInput background should be showing green - input is acceptable.\n"+
+ "Next, let's attempt to enter a number greater than the highest allowable value: 30.08" }
+ },
+ State { name: "greaterthan"; when: statenum == 4
+ PropertyChanges { target: doublevalidatorelementinput; text: "30.08" }
+ PropertyChanges { target: doublevalidatorelementtest
+ testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
+ "Next, let's change the value of top to be greater than the entered number." }
+ },
+ State { name: "increasedtop"; when: statenum == 5
+ PropertyChanges { target: doublevalidatorelementinput; text: "30.08" }
+ PropertyChanges { target: doublevalidatorelement; top: 30.09 }
+ PropertyChanges { target: doublevalidatorelementtest
+ testtext: "The highest value should have increased to 30.09, thus making the number valid and turning the input background green.\n"+
+ "Next, let's change the value of bottom to be greater than the entered number." }
+ PropertyChanges { target: bugpanel; bugnumber: "19956" }
+ },
+ State { name: "increasedbottom"; when: statenum == 6
+ PropertyChanges { target: doublevalidatorelementinput; text: "30.08" }
+ PropertyChanges { target: doublevalidatorelement; top: 30.09; bottom: 40.05 }
+ PropertyChanges { target: doublevalidatorelementtest
+ testtext: "The lowest value should have increased to 36, thus making the validator invalid and turning the input background red.\n"+
+ "Press advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/EmitterElement.qml b/tests/testapplications/elements/content/EmitterElement.qml
new file mode 100644
index 0000000000..c33ceda854
--- /dev/null
+++ b/tests/testapplications/elements/content/EmitterElement.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: emitterelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ ParticleSystem {
+ id: particlesystem
+ anchors.fill: parent
+ ImageParticle {
+ id: imageparticle
+ source: "pics/smile.png"
+ color: "red"
+ Behavior on color { ColorAnimation { duration: 3000 } }
+ }
+ Emitter {
+ id: emitterelement
+ anchors.centerIn: parent
+ property int emitvelocity: 10
+ emitRate: 5
+ lifeSpan: 1000
+ velocity: AngleDirection { angle: 0; angleVariation: 360; magnitude: emitterelement.emitvelocity }
+ }
+ }
+
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: emitterelementtest
+ testtext: "This is an Emitter element, visualized by an ImageParticle. It should be emitting particles "+
+ "slowly from the center of the display.\n"+
+ "Next, let's change the emission velocity of the particles." }
+ },
+ State { name: "fast"; when: statenum == 2
+ PropertyChanges { target: emitterelement; emitvelocity: 50 }
+ PropertyChanges { target: emitterelementtest
+ testtext: "The particles emitted should be moving more quickly.\n"+
+ "Next, let's increase the number of particles emitted." }
+ },
+ State { name: "many"; when: statenum == 3
+ PropertyChanges { target: emitterelement; emitvelocity: 50; emitRate: 100 }
+ PropertyChanges { target: emitterelementtest
+ testtext: "The particles should now be quick and numerous.\n"+
+ "Next, let's allow them to survive longer." }
+ },
+ State { name: "enduring"; when: statenum == 4
+ PropertyChanges { target: emitterelement; emitvelocity: 50; emitRate: 100; lifeSpan: 3000 }
+ PropertyChanges { target: emitterelementtest
+ testtext: "The particles should now be enduring to the edges of the display.\n"+
+ "Next, let's have them changing their size." }
+ },
+ State { name: "sized"; when: statenum == 5
+ PropertyChanges { target: emitterelement; emitvelocity: 50; emitRate: 100; lifeSpan: 3000; size: 20; endSize: 5 }
+ PropertyChanges { target: emitterelementtest
+ testtext: "The particles should now be starting large and ending small.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/testapplications/elements/content/FlickableElement.qml b/tests/testapplications/elements/content/FlickableElement.qml
new file mode 100644
index 0000000000..6c5fce7e5f
--- /dev/null
+++ b/tests/testapplications/elements/content/FlickableElement.qml
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: flickableelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property int sidelength: 1500
+
+ Rectangle {
+ id: flickableelementbox
+ color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .1
+ height: 250; width: parent.width *.8
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+
+ Flickable {
+ id: flickableelement
+ anchors.fill: parent
+ contentHeight: sidelength; contentWidth: sidelength; contentX: (sidelength/2)-125; contentY: (sidelength/2)-125
+ onAtYBeginningChanged: {
+ if (flicking && atYBeginning && statenum == 1) { advance(); }
+ else if (flicking && atYBeginning && atXBeginning && statenum == 4) { advance(); }
+ }
+ onAtXEndChanged: {
+ if (atYEnd && atXEnd && statenum == 2) {
+ if (flicking){ advance();
+ } else {
+ testtext = "The view must be flicked into the bottom left corner. Move the grid away slightly and try again"
+ }
+ }
+ }
+ onAtXBeginningChanged: {
+ if (atYEnd && atXBeginning && statenum == 3) {
+ if (!flicking) { advance(); } else { testtext = "Drag - do not flick. Move the grid away slightly and try again" }
+ }
+ }
+
+ Row {
+ width: sidelength; height: sidelength
+ Repeater {
+ model: 30
+ Column {
+ Repeater {
+ id: griprep
+ height: flickableelement.contentHeight; width: 50; model: 30
+ Rectangle { height: 50; width: 50; color: "gray"; border.color: "black" }
+ }
+ }
+ }
+ }
+ Text { anchors.centerIn: parent; text: "Center" }
+ }
+ }
+ Text { anchors.left: flickableelementbox.left; anchors.top: flickableelementbox.bottom; anchors.topMargin: 5;
+ text: "Dragging"; color: !flickableelement.flicking && flickableelement.moving ? "Green" : "Red"
+ }
+ Text { anchors.right: flickableelementbox.right; anchors.top: flickableelementbox.bottom; anchors.topMargin: 5;
+ text: "Flicking"; color: flickableelement.flicking ? "Green" : "Red"
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ StateChangeScript { script: { flickableelement.contentX = (sidelength/2)-125; flickableelement.contentY = (sidelength/2)-125 } }
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: flickableelementtest
+ testtext: "This is a Flickable element. At present it should be displaying a grid,\n"+
+ "with the center marked and in the center of the view.\n"+
+ "Next, please flick the view to the top" }
+ },
+ State { name: "top"; when: statenum == 2
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: flickableelementtest; testtext: "Good. Now flick to the bottom right hand corner." }
+ },
+ State { name: "bottomright"; when: statenum == 3
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: flickableelementtest; testtext: "Great. Now drag, not flick, the view to the bottom left." }
+ },
+ State { name: "bottomleft"; when: statenum == 4
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: flickableelementtest; testtext: "Almost there. Flick to the top left" }
+ },
+ State { name: "sections"; when: statenum == 5
+ PropertyChanges { target: helpbubble; showadvance: true }
+ PropertyChanges { target: flickableelementtest
+ testtext: "Excellent.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/FlipableElement.qml b/tests/testapplications/elements/content/FlipableElement.qml
new file mode 100644
index 0000000000..35174d8e42
--- /dev/null
+++ b/tests/testapplications/elements/content/FlipableElement.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: flipableelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Flipable {
+ id: flipableelement
+ height: 250; width: 250
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ front: Rectangle { color: "green"; anchors.fill: parent; border.color: "gray"; border.width: 3; opacity: .9; radius: 20; clip: true }
+ back: Rectangle { color: "red"; anchors.fill: parent; border.color: "gray"; border.width: 3; opacity: .9; radius: 20; clip: true }
+ transform: Rotation {
+ id: rotation
+ origin.x: flipableelement.width/2
+ origin.y: flipableelement.height/2
+ axis.x: 0; axis.y: 1; axis.z: 0
+ angle: 0
+ }
+
+ }
+ transitions: Transition {
+ NumberAnimation { target: rotation; property: "angle"; duration: 2000 }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: flipableelementtest
+ testtext: "This is a Flipable element. At present it should be showing a green rectangle.\n"+
+ "Next, let's flip the Flipable horizontally to show the back" }
+ },
+ State { name: "back"; when: statenum == 2
+ PropertyChanges { target: rotation; angle: 180 }
+ //FIXED PropertyChanges { target: bugpanel; bugnumber: "19901" }
+ PropertyChanges { target: flipableelementtest
+ testtext: "Flipable should now be showing a red rectangle.\n"+
+ "Next, let's flip the Flipable to again show the front." }
+ },
+ State { name: "front"; when: statenum == 3
+ PropertyChanges { target: flipableelementtest
+ testtext: "Flipable should have flipped and now be showing a green rectangle.\n"+
+ "Next, let's flip vertically." }
+ },
+ State { name: "backvertical"; when: statenum == 4
+ PropertyChanges { target: rotation; axis.y: 0; axis.x: 1; angle: 180 }
+ //FIXED PropertyChanges { target: bugpanel; bugnumber: "19901" }
+ PropertyChanges { target: flipableelementtest
+ testtext: "Flipable should have flipped vertically and now be showing a red rectangle.\n"+
+ "Next, let's flip back." }
+ },
+ State { name: "frontvertical"; when: statenum == 5
+ PropertyChanges { target: rotation; axis.y: 0; axis.x: 1; angle: 0 }
+ PropertyChanges { target: flipableelementtest
+ testtext: "Flipable should have flipped vertically and now be showing a green rectangle.\n"+
+ "Next, let's restart the test." }
+ }
+ ]
+}
diff --git a/tests/testapplications/elements/content/FlowElement.qml b/tests/testapplications/elements/content/FlowElement.qml
new file mode 100644
index 0000000000..0041f14b55
--- /dev/null
+++ b/tests/testapplications/elements/content/FlowElement.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: flowelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Rectangle { anchors.fill: flowelement; color: "lightsteelblue"; radius: 5 }
+
+ Flow {
+ id: flowelement
+ height: 110; width: 110
+ spacing: 5; flow: Flow.LeftToRight
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ Rectangle { id: gr; color: "green"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { anchors.centerIn: parent; text: "1" }
+ }
+ Rectangle { id: re; color: "red"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { anchors.centerIn: parent; text: "2" }
+ }
+ Rectangle { id: bl; color: "blue"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true; visible: false
+ Text { anchors.centerIn: parent; text: "3" }
+ }
+ Rectangle { id: bk; color: "black"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { anchors.centerIn: parent; text: "4"; color: "lightgray" }
+ }
+
+ move: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.OutBounce } }
+ add: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.OutBounce } }
+
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: flowelementtest
+ testtext: "This is a Flow element. At present it should be showing three rectangles - green, red and black.\n"+
+ "Next, let's add a rectangle to the Flow - it should slide in from the left and the black rectangle should move to give it space" }
+ },
+ State { name: "added"; when: statenum == 2
+ PropertyChanges { target: bl; visible: true }
+ PropertyChanges { target: flowelementtest
+ testtext: "Flow should now be showing four rectangles - green, red, blue and black.\n"+
+ "Next let's change the direction of the flow to vertical." }
+ },
+ State { name: "vertical"; when: statenum == 3
+ PropertyChanges { target: bl; visible: true }
+ PropertyChanges { target: flowelement; flow: Flow.TopToBottom }
+ PropertyChanges { target: flowelementtest
+ testtext: "Flow should now be showing four rectangles - green, blue, red and black.\n"+
+ "Next, let's flip the layout direction to RightToLeft." }
+ },
+ State { name: "rtlvertical"; when: statenum == 4
+ PropertyChanges { target: bl; visible: true }
+ PropertyChanges { target: flowelement; flow: Flow.TopToBottom; layoutDirection: Qt.RightToLeft }
+ PropertyChanges { target: flowelementtest
+ testtext: "Flow should now be showing the four rectangles aligned to the right and in a column order flowing to the left"+
+ "Advance to restart the test." }
+ }
+ ]
+}
diff --git a/tests/testapplications/elements/content/FocusScopeElement.qml b/tests/testapplications/elements/content/FocusScopeElement.qml
new file mode 100644
index 0000000000..dd3e8ada3a
--- /dev/null
+++ b/tests/testapplications/elements/content/FocusScopeElement.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: focusscopeelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ FocusScope {
+ id: firstfocusscopeelement
+ }
+ FocusScope {
+ id: secondfocusscopeelement
+ }
+
+ BugPanel { id: bugpanel }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: focusscopeelementtest
+ testtext: "This test uses a FocusScope element. There should be two boxes, "+
+ "the first showing a red border to represent it having focus.\n"+
+ "Next, let's press a key to see which has focus." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/FontLoaderElement.qml b/tests/testapplications/elements/content/FontLoaderElement.qml
new file mode 100644
index 0000000000..b4042be69c
--- /dev/null
+++ b/tests/testapplications/elements/content/FontLoaderElement.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "font"
+
+Item {
+ id: fontloaderelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property int currentfont: 0
+ property variant availablefonts
+ Component.onCompleted: { availablefonts = Qt.fontFamilies(); }
+
+ Rectangle { anchors.fill: textitem; color: "lightsteelblue"; radius: 5 }
+ FontLoader { id: fontloaderelement; name: availablefonts[currentfont] }
+
+ Text {
+ id: textitem
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ height: 100; width: 250; text: fontloaderelement.name; font: fontloaderelement.name
+ horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: fontloaderelementtest
+ testtext: "This is a Text item with the font defined via the FontLoader element.\n"+
+ "Presently it should be indicating the font "+fontloaderelement.name+", displayed in said font.\n"+
+ "Next, let's change the font to something else." }
+ },
+ State { name: "changefont"; when: statenum == 2
+ PropertyChanges { target: fontloaderelementtest
+ currentfont: 1;
+ testtext: "FontLoader should now be displaying the text in "+fontloaderelement.name+".\n"+
+ "Next let's repeatedly change the font." }
+ },
+ State { name: "switch"; when: statenum == 3
+ PropertyChanges { target: fontticker; running: true }
+ PropertyChanges { target: fontloaderelementtest
+ testtext: "FontLoader should now be cycling between different fonts available on the system.\n"+
+ "Next let's use a locally stored font." }
+ },
+ State { name: "uselocal"; when: statenum == 4
+ PropertyChanges { target: fontticker; running: false }
+ PropertyChanges { target: bugpanel; bugnumber: "20268" }
+ PropertyChanges { target: fontloaderelement; source: "font/Vera.ttf"; name: "Bitstream Vera Sans"; }
+ PropertyChanges { target: fontloaderelementtest
+ testtext: "FontLoader should now be displaying the Bitstream Vera Sans font.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+ Timer { id: fontticker; interval: 500; running: false; repeat: true; onTriggered: { currentfont = currentfont == availablefonts.length ? 0 : currentfont+1 } }
+}
diff --git a/tests/testapplications/elements/content/GradientElement.qml b/tests/testapplications/elements/content/GradientElement.qml
new file mode 100644
index 0000000000..b4f4ebd160
--- /dev/null
+++ b/tests/testapplications/elements/content/GradientElement.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: gradientelement
+ property real gradstop: 0.25
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "red" }
+ GradientStop { position: gradstop; color: "yellow" }
+ GradientStop { position: 1.0; color: "green" }
+ }
+ MouseArea { anchors.fill: parent; enabled: qmlfiletoload == ""; hoverEnabled: true
+ onEntered: { helptext = "The gradient should show a trio of colors - red, yellow and green"+
+ " - with a slow movement of the yellow up and down the view" }
+ onExited: { helptext = "" }
+ }
+ // Animate the background gradient
+ SequentialAnimation { id: gradanim; running: true; loops: Animation.Infinite
+ NumberAnimation { target: gradientelement; property: "gradstop"; to: 0.88; duration: 10000; easing.type: Easing.InOutQuad }
+ NumberAnimation { target: gradientelement; property: "gradstop"; to: 0.22; duration: 10000; easing.type: Easing.InOutQuad }
+ }
+}
diff --git a/tests/testapplications/elements/content/GridElement.qml b/tests/testapplications/elements/content/GridElement.qml
new file mode 100644
index 0000000000..39e954c476
--- /dev/null
+++ b/tests/testapplications/elements/content/GridElement.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: gridelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Grid {
+ id: gridelement
+ height: 120; width: 120; spacing: 5; columns: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+
+ Rectangle { id: gr; color: "green"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+ Rectangle { id: re; color: "red"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+ Rectangle {
+ id: bl
+ color: "blue"; height: 50; width: 50; border.color: "gray"; border.width: 3; radius: 5; clip: true
+ opacity: 0; visible: opacity != 0
+ }
+ Rectangle { id: bk; color: "black"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+
+ move: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } }
+ add: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } }
+
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: gridelementtest
+ testtext: "This is a Grid element. At present it should be showing three rectangles - green, red and black, two "+
+ "in the top row.\n"+
+ "Next, let's add a rectangle to the Grid - it should drop in from the top and the black rectangle should move to give it space" }
+ },
+ State { name: "added"; when: statenum == 2
+ PropertyChanges { target: bl; opacity: .9 }
+ PropertyChanges { target: gridelementtest
+ testtext: "The Grid should now be showing four rectangles - green, red, blue and black.\n"+
+ "Next, lets alter the Grid to form a single column" }
+ },
+ State { name: "singlecolumn"; when: statenum == 3
+ PropertyChanges { target: bl; opacity: .9 }
+ PropertyChanges { target: gridelement; columns: 1 }
+ PropertyChanges { target: gridelementtest
+ testtext: "The Grid should now be showing four rectangles - green, red, blue and black.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/GridViewElement.qml b/tests/testapplications/elements/content/GridViewElement.qml
new file mode 100644
index 0000000000..f42e8e90cc
--- /dev/null
+++ b/tests/testapplications/elements/content/GridViewElement.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: gridviewelement; radius: 5; clip: true
+ property int cellsize
+ cellsize: Math.floor(elementview.width / 3)
+
+ GridView {
+ id: elementview
+ height: parent.height * .98; width: parent.width * .98
+ anchors.centerIn: parent
+ delegate: griddelegate; model: elements; visible: { qmlfiletoload == "" }
+ highlightFollowsCurrentItem: true; highlightRangeMode: ListView.StrictlyEnforceRange
+ cellWidth: cellsize; cellHeight: cellsize
+ }
+
+ // Delegates for the launcher grid
+ Component {
+ id: griddelegate
+ Item {
+ height: cellsize; width: cellsize
+ Column { anchors.fill: parent; spacing: 2
+ Rectangle {
+ height: parent.height * .8; width: height
+ color: "lightgray"; radius: 5; smooth: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ Image {
+ height: parent.height*.75; width: height
+ anchors.centerIn: parent
+ source: "pics/logo.png"; fillMode: Image.PreserveAspectFit
+ }
+ }
+ Text {
+ height: parent.height * .8; width: parent.width
+ anchors.horizontalCenter: parent.horizontalCenter; text: model.label; elide: Text.ElideRight
+ horizontalAlignment: Text.AlignHCenter
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true // For desktop testing
+ onClicked: { runapp(model.label+"Element.qml"); }
+ onEntered: { helptext = model.help }
+ onExited: { helptext = "" }
+ }
+ }
+ }
+
+ // Elements list
+ ListModel {
+ id: elements
+ ListElement { label: "Rectangle"; help: "The Rectangle item provides a filled rectangle with an optional border." }
+ ListElement { label: "Image"; help: "The Image element displays an image in a declarative user interface" }
+ ListElement { label: "AnimatedImage"; help: "An image element that supports animations" }
+ ListElement { label: "BorderImage"; help: "The BorderImage element provides an image that can be used as a border." }
+ ListElement { label: "SystemPalette"; help: "The SystemPalette element provides access to the Qt palettes." }
+ ListElement { label: "Text"; help: "The Text item allows you to add formatted text to a scene." }
+ ListElement { label: "FontLoader"; help: "The FontLoader element allows fonts to be loaded by name or URL." }
+ ListElement { label: "TextInput"; help: "The TextInput item displays an editable line of text." }
+ ListElement { label: "TextEdit"; help: "The TextEdit item displays multiple lines of editable formatted text." }
+ ListElement { label: "ListView"; help: "The ListView item provides a list view of items provided by a model." }
+ ListElement { label: "Flipable"; help: "The Flipable item provides a surface that can be flipped" }
+ ListElement { label: "Column"; help: "The Column item arranges its children vertically." }
+ ListElement { label: "Row"; help: "The Row item arranges its children horizontally." }
+ ListElement { label: "Grid"; help: "The Grid item positions its children in a grid." }
+ ListElement { label: "Flow"; help: "The Flow item arranges its children side by side, wrapping as necessary." }
+ ListElement { label: "Repeater"; help: "The Repeater element allows you to repeat an Item-based component using a model." }
+ ListElement { label: "IntValidator"; help: "This element provides a validator for integer values." }
+ ListElement { label: "DoubleValidator"; help: "This element provides a validator for non-integer values." }
+ ListElement { label: "RegExpValidator"; help: "This element provides a validator, which counts as valid any string which matches a specified regular expression." }
+ ListElement { label: "Flickable"; help: "The Flickable item provides a surface that can be \"flicked\"." }
+ ListElement { label: "Keys"; help: "The Keys attached property provides key handling to Items." }
+ ListElement { label: "MouseArea"; help: "The MouseArea item enables simple mouse handling." }
+ ListElement { label: "SequentialAnimation"; help: "The SequentialAnimation element allows animations to be run sequentially." }
+ ListElement { label: "ParallelAnimation"; help: "The ParallelAnimation element allows animations to be run in parallel." }
+ ListElement { label: "XmlListModel"; help: "The XmlListModel element is used to specify a read-only model using XPath expressions." }
+ ListElement { label: "Scale"; help: "The Scale element provides a way to scale an Item." }
+ ListElement { label: "ParticleSystem"; help: "The ParticleSystem brings together ParticlePainter, Emitter and Affector elements." }
+ ListElement { label: "ImageParticle"; help: "The ImageParticle element visualizes logical particles using an image." }
+ ListElement { label: "Emitter"; help: "The Emitter element allows you to emit logical particles." }
+ ListElement { label: "Affector"; help: "Affector elements can alter the attributes of logical particles at any point in their lifetime." }
+ ListElement { label: "Shape"; help: "The Shape element allows you to specify an area for affectors and emitter." }
+ ListElement { label: "TrailEmitter"; help: "The TrailEmitter element allows you to emit logical particles from other logical particles." }
+ ListElement { label: "Direction"; help: "The Direction elements allow you to specify a vector space." }
+ ListElement { label: "SpriteSequence"; help: "The SpriteSequence element plays stochastic sprite animations." }
+ }
+}
diff --git a/tests/testapplications/elements/content/Help.qml b/tests/testapplications/elements/content/Help.qml
new file mode 100644
index 0000000000..1e1e26e26c
--- /dev/null
+++ b/tests/testapplications/elements/content/Help.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ anchors.fill: parent
+
+ Text { textFormat: Text.RichText; anchors.fill: parent; anchors.margins: 5; wrapMode: Text.WordWrap
+ text: "<b>QtQuick 2 System Testing</b><br><br>"+
+ "Each system test qml \"application\" provides a basic visual element affected by one or more non-visual (functional) elements.<br>"+
+ "Simply select the element you wish to test, and follow the instructions. Use the arrow to advance the test.<br>"
+ }
+}
diff --git a/tests/testapplications/elements/content/HelpDesk.qml b/tests/testapplications/elements/content/HelpDesk.qml
new file mode 100644
index 0000000000..9a381283de
--- /dev/null
+++ b/tests/testapplications/elements/content/HelpDesk.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+
+ Rectangle {
+ id: helpbutton; anchors { right: parent.right; bottom: parent.bottom }
+ height: 30; width: 30; color: "lightgray"; radius: 5; visible: qmlfiletoload == ""
+ Text { text: "?"; anchors.centerIn: parent; font.pointSize: 12 }
+ MouseArea { anchors.fill: parent; onClicked: { elementsapp.qmlfiletoload = "Help.qml" } }
+ }
+
+ Rectangle {
+ width: parent.width - (20 + helpbutton.width); height: infotext.height; radius: 5; opacity: .7; visible: infotext.text != ""
+ anchors { right: helpbutton.left; bottom: parent.bottom; rightMargin: 5; bottomMargin: 20 }
+ Text { id: infotext; text: elementsapp.helptext; width: parent.width - 10; anchors.centerIn: parent; wrapMode: Text.WordWrap }
+ }
+}
diff --git a/tests/testapplications/elements/content/ImageElement.qml b/tests/testapplications/elements/content/ImageElement.qml
new file mode 100644
index 0000000000..296da9018e
--- /dev/null
+++ b/tests/testapplications/elements/content/ImageElement.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: imageelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Item {
+ id: imageelementcontainer
+ height: 100; width: 100; clip: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ Behavior on height { NumberAnimation { duration: 1000 } }
+ Behavior on width { NumberAnimation { duration: 1000 } }
+ Image {
+ id: imageelement
+ anchors.fill: parent
+ source: "pics/nokialogo.gif"; sourceSize.width: 60; sourceSize.height: 80
+ }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: imageelementtest
+ testtext: "This is an Image element. It should be small and be showing the Nokia logo, but slightly stretched.\n"+
+ "Next, it should animatedly increase to twice its size" }
+ },
+ State { name: "large"; when: statenum == 2
+ PropertyChanges { target: imageelementcontainer; height: 200; width: 200 }
+ PropertyChanges { target: imageelementtest
+ testtext: "It should be large and still showing the slightly stretched Nokia logo.\n"+
+ "Next, it will change to preserve its aspect ratio" }
+ },
+ State { name: "largefit"; when: statenum == 3
+ PropertyChanges { target: imageelementcontainer; height: 200; width: 200 }
+ PropertyChanges { target: imageelement; fillMode: Image.PreserveAspectFit }
+ PropertyChanges { target: imageelementtest
+ testtext: "It should be large and now showing the Nokia logo normally (longer horizontally).\n"+
+ "Next, it will change its aspect ratio to fit, but cropping the sides" }
+ },
+ State { name: "largecrop"; when: statenum == 4
+ PropertyChanges { target: imageelementcontainer; height: 200; width: 200 }
+ PropertyChanges { target: imageelement; fillMode: Image.PreserveAspectCrop }
+ PropertyChanges { target: imageelementtest
+ testtext: "It should be large and now showing the Nokia logo with the sides removed.\n"+
+ "Next, let's change the image to tile the square" }
+ },
+ State { name: "largetile"; when: statenum == 5
+ PropertyChanges { target: imageelementcontainer; height: 200; width: 200 }
+ PropertyChanges { target: imageelement; fillMode: Image.Tile; }
+ PropertyChanges { target: imageelementtest
+ testtext: "The image should be repeated both horizontally and vertically.\n"+
+ "Next, let's change the image to tile the square vertically" }
+ },
+ State { name: "largetilevertical"; when: statenum == 6
+ PropertyChanges { target: imageelementcontainer; height: 200; width: 200 }
+ PropertyChanges { target: imageelement; fillMode: Image.TileVertically; }
+ PropertyChanges { target: imageelementtest
+ testtext: "The image should be repeated only vertically.\n"+
+ "Next, let's change the image to tile the square horizontally" }
+ },
+ State { name: "largetilehorizontal"; when: statenum == 7
+ PropertyChanges { target: imageelementcontainer; height: 200; width: 200 }
+ PropertyChanges { target: imageelement; fillMode: Image.TileHorizontally; }
+ PropertyChanges { target: imageelementtest
+ testtext: "The image should be repeated only horizontally.\n"+
+ "The next step will return the image to a small, stretched state" }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/ImageParticleElement.qml b/tests/testapplications/elements/content/ImageParticleElement.qml
new file mode 100644
index 0000000000..b80b454d89
--- /dev/null
+++ b/tests/testapplications/elements/content/ImageParticleElement.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: imageparticleelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ ParticleSystem {
+ id: particlesystemelement
+ anchors.fill: parent
+ ImageParticle {
+ id: imageparticle
+ source: "pics/smile.png"
+ color: "red"
+ Behavior on color { ColorAnimation { duration: 3000 } }
+ }
+ Emitter {
+ id: particleemitter
+ anchors.centerIn: parent
+ emitRate: 50
+ lifeSpan: 3000
+ velocity: AngleDirection { angle: 0; angleVariation: 360; magnitude: 60 }
+ }
+ }
+
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: imageparticleelementtest
+ testtext: "This is an ImageParticle element. It should be emitting particles "+
+ "from the center of the display.\n"+
+ "Next, let's change the color of the particles." }
+ },
+ State { name: "green"; when: statenum == 2
+ PropertyChanges { target: imageparticle; color: "lightgreen" }
+ PropertyChanges { target: imageparticleelementtest
+ testtext: "The particles should now be green.\n"+
+ "Next, let's get them spinning." }
+ },
+ State { name: "spinning"; when: statenum == 3
+ PropertyChanges { target: imageparticle; color: "lightgreen"; rotation: 360; rotationVelocity: 100 }
+ PropertyChanges { target: imageparticleelementtest
+ testtext: "The particles should now be green and spinning.\n"+
+ "Next, let's get them popping in and out." }
+ },
+ State { name: "scaling"; when: statenum == 4
+ PropertyChanges { target: imageparticle; color: "lightgreen"; rotation: 360; rotationVelocity: 100; entryEffect: ImageParticle.Scale }
+ PropertyChanges { target: imageparticleelementtest
+ testtext: "The particles should now be scaling in and out.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/testapplications/elements/content/IntValidatorElement.qml b/tests/testapplications/elements/content/IntValidatorElement.qml
new file mode 100644
index 0000000000..a8baea5ad2
--- /dev/null
+++ b/tests/testapplications/elements/content/IntValidatorElement.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: intvalidatorelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ IntValidator { id: intvalidatorelement; top: 30; bottom: -50 //top: 20; bottom: -50
+ //Behavior on top { NumberAnimation { duration: 1000 } }
+ }
+
+ Rectangle {
+ id: intvalidatorelementbackground
+ color: intvalidatorelementinput.acceptableInput ? "green" : "red"
+ height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0.7; radius: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+
+ TextInput {
+ id: intvalidatorelementinput
+ font.pointSize: 12; width: parent.width; text: "0"; horizontalAlignment: Text.AlignHCenter; validator: intvalidatorelement
+ anchors.centerIn: parent
+ Behavior on font.pointSize { NumberAnimation { duration: 1000 } }
+ Behavior on color { ColorAnimation { duration: 1000 } }
+ }
+ }
+
+ Text{
+ anchors.top: intvalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter
+ text: "Top: " + intvalidatorelement.top + " Bottom: " + intvalidatorelement.bottom
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: intvalidatorelementinput; text: "0" }
+ PropertyChanges { target: intvalidatorelementtest
+ testtext: "This is a TextInput element using an IntValidator for input masking. At present it should be indicating 0.\n"+
+ "Next, let's attempt to enter a number smaller than the lowest allowable value: -80" }
+ },
+ State { name: "lowerthan"; when: statenum == 2
+ PropertyChanges { target: intvalidatorelementinput; text: "-80" }
+ PropertyChanges { target: intvalidatorelementtest
+ testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
+ "Next, let's enter a value equal to the lowest allowable value: -50." }
+ },
+ State { name: "equaltobottom"; when: statenum == 3
+ PropertyChanges { target: intvalidatorelementinput; text: "-50" }
+ PropertyChanges { target: intvalidatorelementtest
+ testtext: "The TextInput background should be showing green - input is acceptable.\n"+
+ "Next, let's attempt to enter a number greater than the highest allowable value: 35" }
+ },
+ State { name: "greaterthan"; when: statenum == 4
+ PropertyChanges { target: intvalidatorelementinput; text: "35" }
+ PropertyChanges { target: intvalidatorelementtest
+ testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
+ "Next, let's change the value of top to be greater than the entered number." }
+ },
+ State { name: "increasedtop"; when: statenum == 5
+ PropertyChanges { target: intvalidatorelementinput; text: "35" }
+ PropertyChanges { target: intvalidatorelement; top: 35 }
+ PropertyChanges { target: intvalidatorelementtest
+ testtext: "The highest value should have increased to 35, thus making the number valid and turning the input background green.\n"+
+ "Next, let's change the value of bottom to be greater than the entered number." }
+ PropertyChanges { target: bugpanel; bugnumber: "19956" }
+ },
+ State { name: "increasedbottom"; when: statenum == 6
+ PropertyChanges { target: intvalidatorelementinput; text: "35" }
+ PropertyChanges { target: intvalidatorelement; top: 35; bottom: 36 }
+ PropertyChanges { target: intvalidatorelementtest
+ testtext: "The lowest value should have increased to 36, thus making the validator invalid and turning the input background red.\n"+
+ "Press advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/KeysElement.qml b/tests/testapplications/elements/content/KeysElement.qml
new file mode 100644
index 0000000000..ea8aaf9069
--- /dev/null
+++ b/tests/testapplications/elements/content/KeysElement.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: keyselementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property int sidelength: 1500
+ focus: true
+
+ Rectangle {
+ id: keyselementbox
+ color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .7
+ height: 250; width: parent.width *.8
+ anchors.centerIn: parent
+ focus: true
+ Keys.enabled: true
+ Keys.onLeftPressed: { if (statenum == 2) { advance(); } }
+ Keys.onRightPressed: { if (statenum == 1) { advance(); } }
+ Keys.onUpPressed: { if (statenum == 3) { advance(); } }
+ Keys.onDownPressed: { if (statenum == 4) { advance(); } }
+ Keys.onPressed: {
+ if ((event.key == Qt.Key_Space) && (event.modifiers & Qt.ControlModifier) && (event.modifiers & Qt.AltModifier)) {
+ if (statenum == 5) { advance(); }
+ }
+ }
+ Rectangle { id: leftone; height: 50; width: 50; color: "green"; anchors{ left: parent.left; verticalCenter: parent.verticalCenter } }
+ Rectangle { id: rightone; height: 50; width: 50; color: "green"; anchors{ right: parent.right; verticalCenter: parent.verticalCenter } }
+ Rectangle { id: topone; height: 50; width: 50; color: "green"; anchors{ top: parent.top; horizontalCenter: parent.horizontalCenter } }
+ Rectangle { id: bottomone; height: 50; width: 50; color: "green"; anchors{ bottom: parent.bottom; horizontalCenter: parent.horizontalCenter } }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: keyselementtest
+ testtext: "This is a Keys element. At present there should be four squares\n"+
+ "Next, please press the right button on the keypad/board" }
+ },
+ State { name: "right"; when: statenum == 2
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: rightone; color: "orange" }
+ PropertyChanges { target: keyselementtest; testtext: "Good. Now press left." }
+ },
+ State { name: "left"; when: statenum == 3
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: leftone; color: "orange" }
+ PropertyChanges { target: keyselementtest; testtext: "Press up." }
+ },
+ State { name: "up"; when: statenum == 4
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: topone; color: "orange" }
+ PropertyChanges { target: keyselementtest; testtext: "And then press down" }
+ },
+ State { name: "down"; when: statenum == 5
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: bottomone; color: "orange" }
+ PropertyChanges { target: keyselementtest; testtext: "Excellent. Now hold Ctrl+Alt and press Space" }
+ },
+ State { name: "modifiers"; when: statenum == 6
+ PropertyChanges { target: helpbubble; showadvance: true }
+ PropertyChanges { target: keyselementbox; color: "orange" }
+ PropertyChanges { target: keyselementtest
+ testtext: "Test has completed\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/ListViewElement.qml b/tests/testapplications/elements/content/ListViewElement.qml
new file mode 100644
index 0000000000..146b924541
--- /dev/null
+++ b/tests/testapplications/elements/content/ListViewElement.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: listviewelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property bool hivis: false
+
+ Rectangle {
+ id: listviewelementbackground
+ color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .1
+ height: listviewelement.height + 10; width: listviewelement.width + 10
+ anchors.centerIn: listviewelement
+ }
+
+ ListView {
+ id: listviewelement
+ height: 250; width: parent.width *.8; clip: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ model: devices
+ highlightFollowsCurrentItem: true
+ highlight: highlightrect
+ delegate: delegaterect
+ section.property: "os"
+ section.delegate: sectiondelegaterect
+ header: headerrect
+ footer: footerrect
+ spacing: 0
+ Behavior on spacing { NumberAnimation { duration: 200 } }
+ }
+
+ Component { id: delegaterect
+ Item {
+ width: listviewelement.width - 4; height: 30
+ Rectangle { color: "blue"; anchors.fill: parent; radius: 5; border.color: "black"; opacity: .1 }
+ Text { text: model.name; anchors.centerIn: parent }
+ }
+ }
+
+ Component { id: sectiondelegaterect
+ Item {
+ width: listviewelement.width - 4; height: 30
+ Rectangle { color: "green"; anchors.fill: parent; radius: 5; border.color: "black"; opacity: .5 }
+ Text { text: section; anchors.verticalCenter: parent.verticalCenter; anchors.left: parent.left; anchors.leftMargin: 5 }
+ }
+ }
+
+ Component { id: highlightrect
+ Rectangle {
+ id: coloredbox; color: "yellow"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5; visible: hivis
+ SequentialAnimation on color { loops: Animation.Infinite; running: coloredbox.visible
+ ColorAnimation { to: "green"; duration: 2000 }
+ ColorAnimation { to: "yellow"; duration: 2000 }
+ }
+ }
+ }
+
+ Component { id: headerrect
+ Rectangle { id: hdr; color: "brown"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5
+ Text { anchors.centerIn: parent; text: "Nokia Devices" }
+ }
+ }
+
+ Component { id: footerrect
+ Rectangle { id: ftr; color: "brown"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5
+ Text { anchors.centerIn: parent; text: "Nokia pty ltd." }
+ }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: listviewelementtest
+ testtext: "This is a ListView element. At present it should be displaying the names of a few Nokia devices, ordered by Operating System.\n"+
+ "Next, let's view the end of the list" }
+ },
+ State { name: "end"; when: statenum == 2
+ StateChangeScript { script: listviewelement.positionViewAtEnd(); }
+ PropertyChanges { target: listviewelementtest
+ testtext: "The end of the list should now be visible.\nNext, let's add a highlight." }
+ },
+ State { name: "highlight"; when: statenum == 3
+ PropertyChanges { target: listviewelement; currentIndex: 0 }
+ StateChangeScript { script: listviewelement.positionViewAtBeginning(); }
+ PropertyChanges { target: listviewelementtest; hivis: true }
+ PropertyChanges { target: listviewelementtest
+ testtext: "The ListView should now be showing a highlight on the first item.\n"+
+ "Next, let's move to an item down the list." }
+ },
+ State { name: "highlight7"; when: statenum == 4
+ PropertyChanges { target: listviewelement; currentIndex: 6 }
+ PropertyChanges { target: listviewelementtest; hivis: true }
+ PropertyChanges { target: listviewelementtest
+ testtext: "The ListView should now be showing the highlight over item 7 - the N95\n"+
+ "Next let's add some space between them." }
+ },
+ State { name: "sections"; when: statenum == 5
+ PropertyChanges { target: listviewelement; currentIndex: 6 }
+ PropertyChanges { target: listviewelement; spacing: 5 }
+ PropertyChanges { target: listviewelementtest; hivis: true }
+ PropertyChanges { target: listviewelementtest
+ testtext: "The ListView should now be showing a space between each list item,\n"+
+ "but not after the header and sections, or before the footer.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+ ListModel {
+ id: devices
+ ListElement { name: "N900"; os: "Maemo" }
+ ListElement { name: "N810"; os: "Maemo" }
+ ListElement { name: "N9"; os: "Meego" }
+ ListElement { name: "N-Gage QD"; os: "S60 1.2" }
+ ListElement { name: "E90"; os: "S60 2nd" }
+ ListElement { name: "E72"; os: "S60 3.2" }
+ ListElement { name: "N95"; os: "S60 5.0" }
+ ListElement { name: "X6"; os: "S60 5.0" }
+ ListElement { name: "N97"; os: "Symbian^1" }
+ ListElement { name: "5800"; os: "Symbian^1" }
+ ListElement { name: "E7"; os: "Symbian^3" }
+ ListElement { name: "N8"; os: "Symbian^3" }
+ ListElement { name: "C7"; os: "Symbian^3" }
+ ListElement { name: "X7"; os: "Symbian Anna" }
+ }
+
+}
diff --git a/tests/testapplications/elements/content/MouseAreaElement.qml b/tests/testapplications/elements/content/MouseAreaElement.qml
new file mode 100644
index 0000000000..f673ba7f4e
--- /dev/null
+++ b/tests/testapplications/elements/content/MouseAreaElement.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: mouseareaelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ focus: true
+
+ Rectangle {
+ id: mouseareaelementbox
+ color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .7; height: 200; width: 200
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ MouseArea {
+ id: mouseareaelement
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ Rectangle {
+ id: topleft
+ height: 50; width: 50; color: metopleft.containsMouse ? "green" : "blue"
+ anchors { top: mouseareaelementbox.top; left: mouseareaelementbox.left; margins: 5 }
+ MouseArea {
+ id: metopleft
+ hoverEnabled: true
+ anchors.fill: parent
+ onContainsMouseChanged: { if (containsMouse && statenum == 1) { advance(); } }
+ }
+ }
+ Rectangle {
+ id: topright
+ height: 50; width: 50; color: metopright.containsMouse ? "green" : "blue"
+ anchors { top: mouseareaelementbox.top; right: mouseareaelementbox.right; topMargin: 5; rightMargin: 5 }
+ MouseArea {
+ id: metopright
+ hoverEnabled: true
+ anchors.fill: parent
+ onContainsMouseChanged: { if (containsMouse && statenum == 4) { advance(); } }
+ }
+ }
+ Rectangle {
+ id: bottomleft
+ height: 50; width: 50; color: mebottomleft.containsMouse ? "green" : "blue"
+ anchors { bottom: mouseareaelementbox.bottom; left: mouseareaelementbox.left; bottomMargin: 5; leftMargin: 5 }
+ MouseArea {
+ id: mebottomleft
+ hoverEnabled: true
+ anchors.fill: parent
+ onContainsMouseChanged: { if (containsMouse && statenum == 3) { advance(); } }
+ }
+ }
+ Rectangle {
+ id: bottomright
+ height: 50; width: 50; color: mebottomright.containsMouse ? "green" : "blue"
+ anchors { bottom: mouseareaelementbox.bottom; right: mouseareaelementbox.right; bottomMargin: 5; rightMargin: 5 }
+ MouseArea {
+ id: mebottomright
+ hoverEnabled: true
+ anchors.fill: parent
+ onContainsMouseChanged: { if (containsMouse && statenum == 2) { advance(); } }
+ }
+ }
+
+ Rectangle {
+ height: 10; width: 10; radius: 5; x: mouseareaelement.mouseX; y: mouseareaelement.mouseY; color: "red"
+ }
+
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: mouseareaelementtest
+ testtext: "This test contains a number of MouseArea elements. At present there should be four rectangles\n"+
+ "Next, move the pointer to the top left of the square" }
+ },
+ State { name: "topleft"; when: statenum == 2
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: topleft; color: "yellow" }
+ PropertyChanges { target: mouseareaelementtest; testtext: "Good. Now move it down to the bottom right." }
+ },
+ State { name: "bottomright"; when: statenum == 3
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: bottomright; color: "yellow" }
+ PropertyChanges { target: mouseareaelementtest; testtext: "To the bottom left." }
+ },
+ State { name: "bottomleft"; when: statenum == 4
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: bottomleft; color: "yellow" }
+ PropertyChanges { target: mouseareaelementtest; testtext: "Then to top right" }
+ },
+ State { name: "topright"; when: statenum == 5
+ PropertyChanges { target: helpbubble; showadvance: false }
+ PropertyChanges { target: topright; color: "yellow" }
+ PropertyChanges { target: mouseareaelementtest
+ testtext: "Excellent.\n"+
+ "Modifiers test not yet defined." }
+ },
+ State { name: "modifiers"; when: statenum == 6
+ PropertyChanges { target: helpbubble; showadvance: true }
+ PropertyChanges { target: mouseareaelementtest
+ testtext: "Test has completed\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/ParallelAnimationElement.qml b/tests/testapplications/elements/content/ParallelAnimationElement.qml
new file mode 100644
index 0000000000..dfefef429e
--- /dev/null
+++ b/tests/testapplications/elements/content/ParallelAnimationElement.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: parallelanimationelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property int firstduration: 1000
+ property int secondduration: 3000
+ property int firstY
+ firstY: parent.height * .6
+ property int secondY
+ secondY: parent.height * .8
+
+ Timer { id: startanimationtimer; interval: 1000; onTriggered: parallelanimationelement.start() }
+
+ ParallelAnimation {
+ id: parallelanimationelement
+ running: false
+ NumberAnimation { id: movement; target: animatedrect; properties: "y"; to: secondY; duration: firstduration }
+ ColorAnimation { id: recolor; target: animatedrect; properties: "color"; to: "green"; duration: secondduration }
+ }
+
+ Rectangle {
+ id: animatedrect
+ width: 50; height: 50; color: "blue"; y: firstY
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: animatedrect; color: "blue"; y: firstY }
+ PropertyChanges { target: parallelanimationelementtest
+ testtext: "This square will have two properties animated simultaneously.\n"+
+ "The next step will see it move quickly down the display, and slowly change its color to green, at the same time";
+ }
+ },
+ State { name: "firstchange"; when: statenum == 2
+ StateChangeScript { script: { firstduration = 1000; secondduration = 3000; startanimationtimer.start() } }
+ PropertyChanges { target: parallelanimationelementtest
+ testtext: "The square should have moved quickly, and recolored slowly\n"+
+ "Next, it will recolor quickly and move slowly back to it's original position"
+ }
+ },
+ State { name: "secondchange"; when: statenum == 3
+ StateChangeScript { script: { firstduration = 3000; secondduration = 1000; startanimationtimer.start() } }
+ PropertyChanges { target: movement; to: firstY }
+ PropertyChanges { target: recolor; to: "blue" }
+ PropertyChanges { target: parallelanimationelementtest
+ testtext: "The square should have simultaneously moved slowly and recolored quickly.\n"+
+ "Advance to restart the test"
+ }
+ }
+ ]
+}
diff --git a/tests/testapplications/elements/content/ParticleSystemElement.qml b/tests/testapplications/elements/content/ParticleSystemElement.qml
new file mode 100644
index 0000000000..c8a0a7229c
--- /dev/null
+++ b/tests/testapplications/elements/content/ParticleSystemElement.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: particlesystemelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ Rectangle { x: 50; y: 200; height: 300; width: 260; color: "transparent"; border.color: "lightgray" }
+ ParticleSystem {
+ id: particlesystemelement
+ anchors.fill: parent
+ ImageParticle { source: "pics/star.png"; color: "red" }
+ Emitter {
+ id: particleemitter
+ x: 50; y: 200
+ emitRate: 100
+ velocity: AngleDirection { angle: 0; angleVariation: 360; magnitude: 100 }
+ Rectangle { anchors.centerIn: parent; height: 1; width: 1; color: "black" }
+ SequentialAnimation {
+ running: true; paused: particlesystemelement.paused; loops: Animation.Infinite
+ NumberAnimation { target: particleemitter; properties: "x"; to: 310; duration: 3000 }
+ NumberAnimation { target: particleemitter; properties: "y"; to: 500; duration: 3000 }
+ NumberAnimation { target: particleemitter; properties: "x"; to: 50; duration: 3000 }
+ NumberAnimation { target: particleemitter; properties: "y"; to: 200; duration: 3000 }
+ }
+ }
+ }
+
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: particlesystemelementtest
+ testtext: "This is an ParticleSystem element. It is represented by an ImageParticle, "+
+ "tracing around the display.\n"+
+ "Next, it should pause simulation." }
+ },
+ State { name: "paused"; when: statenum == 2
+ PropertyChanges { target: particlesystemelement; paused: true }
+ PropertyChanges { target: particlesystemelementtest
+ testtext: "The simulation should now be paused.\n"+
+ "Advance to resume simulation." }
+ },
+ State { name: "resumed"; when: statenum == 3
+ // PropertyChanges { target: bugpanel; bugnumber: "21539" } FIXED
+ PropertyChanges { target: particlesystemelement; paused: false }
+ PropertyChanges { target: particlesystemelementtest
+ testtext: "The simulation should now be active.\n"+
+ "Advance to restart the test" }
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/testapplications/elements/content/RectangleElement.qml b/tests/testapplications/elements/content/RectangleElement.qml
new file mode 100644
index 0000000000..f67c918c46
--- /dev/null
+++ b/tests/testapplications/elements/content/RectangleElement.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item { id: rectangleelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Rectangle {
+ id: rectangleelement
+ height: 100; width: 100; color: "blue"; border.width: 2; border.color: "red"; smooth: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ Behavior on height { NumberAnimation { duration: 1000 } }
+ Behavior on width { NumberAnimation { duration: 1000 } }
+ Behavior on radius { NumberAnimation { duration: 1000 } }
+ Behavior on color { ColorAnimation { duration: 1000 } }
+ Behavior on border.color { ColorAnimation { duration: 1000 } }
+ Behavior on border.width { NumberAnimation { duration: 1000 } }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: rectangleelementtest
+ testtext: "This is a Rectangle element. It should be small and blue, with a thin, red border.\n"+
+ "Next, it will animatedly increase to twice its size" }
+ },
+ State { name: "large"; when: statenum == 2
+ PropertyChanges { target: rectangleelement; height: 200; width: 200 }
+ PropertyChanges { target: rectangleelementtest; testtext: "It should now be large and blue, with a thin, red border.\n"+
+ "Next, a radius will be added to round the corners" }
+ },
+ State { name: "largerounded"; when: statenum == 3
+ PropertyChanges { target: rectangleelement; height: 200; width: 200; radius: 20 }
+ PropertyChanges { target: rectangleelementtest; testtext: "The borders should now be rounded.\n"+
+ "Next, it will change the color to green" }
+ },
+ State { name: "largeroundedgreen"; when: statenum == 4
+ PropertyChanges { target: rectangleelement; height: 200; width: 200; radius: 20; color: "green" }
+ PropertyChanges { target: rectangleelementtest; testtext: "The rectangle should now be green.\n"+
+ "Next, the border width will be increased" }
+ },
+ State { name: "largeroundedgreenthick"; when: statenum == 5
+ PropertyChanges { target: rectangleelement; height: 200; width: 200; radius: 20; color: "green"; border.width: 10 }
+ PropertyChanges { target: rectangleelementtest; testtext: "The border width should have increased significantly.\n"+
+ "Advance to restart the test - everything should animate at once" }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/RegExpValidatorElement.qml b/tests/testapplications/elements/content/RegExpValidatorElement.qml
new file mode 100644
index 0000000000..aa1b30498c
--- /dev/null
+++ b/tests/testapplications/elements/content/RegExpValidatorElement.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: regexpvalidatorelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property variant regexp: /[a-z]{3}/
+
+ RegExpValidator { id: regexpvalidatorelement; regExp: regexp }
+
+ Rectangle {
+ id: regexpvalidatorelementbackground
+ color: regexpvalidatorelementinput.acceptableInput ? "green" : "red"; height: 50; width: parent.width *.8
+ border.color: "gray"; opacity: 0.7; radius: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+
+ TextInput {
+ id: regexpvalidatorelementinput
+ font.pointSize: 12; width: parent.width; text: "0"; horizontalAlignment: Text.AlignHCenter; validator: regexpvalidatorelement
+ anchors.centerIn: parent
+ Behavior on font.pointSize { NumberAnimation { duration: 1000 } }
+ Behavior on color { ColorAnimation { duration: 1000 } }
+ }
+ }
+
+ Text{
+ anchors.top: regexpvalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter
+ text: "Regular Expression: " + regexp
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: regexpvalidatorelementinput; text: "abc" }
+ PropertyChanges { target: regexpvalidatorelementtest
+ testtext: "This is a TextInput element using an RegExpValidator for input masking. At present it should be indicating abc.\n"+
+ "The regExp value will only match to a value that has three alpha characters\n"+
+ "Next, let's attempt to enter text that does not match the regular expression: 123" }
+ },
+ State { name: "notmatch"; when: statenum == 2
+ PropertyChanges { target: regexpvalidatorelementinput; text: "123" }
+ PropertyChanges { target: regexpvalidatorelementtest
+ testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
+ "Next, let's enter a word with not enough characters to match: aa." }
+ },
+ State { name: "notenough"; when: statenum == 3
+ PropertyChanges { target: regexpvalidatorelementinput; text: "aa" }
+ PropertyChanges { target: regexpvalidatorelementtest
+ testtext: "The TextInput background should be showing red - input is not acceptable.\n"+
+ "Next, let's attempt to enter a word with too many characters to match: abcd" }
+ },
+ State { name: "toomany"; when: statenum == 4
+ PropertyChanges { target: regexpvalidatorelementinput; text: "abcd" }
+ PropertyChanges { target: regexpvalidatorelementtest
+ testtext: "The TextInput background should still be showing red - input is not acceptable.\n"+
+ "Next, let's change the regex to accept the new value." }
+ },
+ State { name: "changedregex"; when: statenum == 5
+ PropertyChanges { target: regexpvalidatorelementinput; text: "abcd" }
+ PropertyChanges { target: regexpvalidatorelementtest; regexp: /[a-z]{4}/
+ testtext: "The regular expression should have changed to match four characters, "+
+ "thus making the text valid and turning the input background green.\n"+
+ "Press advance to restart the test." }
+ PropertyChanges { target: bugpanel; bugnumber: "19956" }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/RepeaterElement.qml b/tests/testapplications/elements/content/RepeaterElement.qml
new file mode 100644
index 0000000000..30109cf780
--- /dev/null
+++ b/tests/testapplications/elements/content/RepeaterElement.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: repeaterelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property bool showme: true
+
+ Column {
+ id: container
+ height: 200; width: 250
+ spacing: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ Repeater { id: repeaterelement; model: repeatermodel }
+ Rectangle { height: 50; width: 150; color: "green" }
+ move: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } }
+ add: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } }
+
+ }
+
+ VisualItemModel {
+ id: repeatermodel
+ Rectangle { color: "blue"; height: 40; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { text: "I am Thing 1"; anchors.centerIn: parent } }
+ Rectangle { color: "blue"; height: 40; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { text: "I am Thing 2"; anchors.centerIn: parent } }
+ Rectangle { visible: repeaterelementtest.showme;
+ color: "blue"; height: 40; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { text: "I am Thing 3"; anchors.centerIn: parent } }
+ Rectangle { color: "blue"; height: 40; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { text: "I am Thing 4"; anchors.centerIn: parent } }
+ Rectangle { color: "blue"; height: 40; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true
+ Text { text: "I am Thing 5"; anchors.centerIn: parent } }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: repeaterelementtest
+ testtext: "This is a Repeater element. At present it should be showing five blue rectangles in a column, with"+
+ "a green rectangle at the bottom.\n"+
+ "Next, let's remove one of the rectangles from the column - the column should bounce when they are removed." }
+ },
+ State { name: "back"; when: statenum == 2
+ PropertyChanges { target: repeaterelementtest; showme: false }
+ PropertyChanges { target: repeaterelementtest
+ testtext: "Repeater should now be showing a total of five rectangles.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/RowElement.qml b/tests/testapplications/elements/content/RowElement.qml
new file mode 100644
index 0000000000..c08867ba33
--- /dev/null
+++ b/tests/testapplications/elements/content/RowElement.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: rowelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Row {
+ id: rowelement
+ height: 50; width: 250; spacing: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ Rectangle { id: gr; color: "green"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+ Rectangle { id: re; color: "red"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+ Rectangle {
+ id: bl
+ color: "blue"; height: 50; width: 50; border.color: "gray"; border.width: 3; radius: 5; clip: true
+ opacity: 0; visible: opacity != 0
+ }
+ Rectangle { id: bk; color: "black"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true }
+
+ move: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.OutBounce } }
+ add: Transition { NumberAnimation { properties: "x"; duration: 1000; easing.type: Easing.OutBounce } }
+
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: rowelementtest
+ testtext: "This is a Row element. At present it should be showing three rectangles - green, red and black.\n"+
+ "Next, let's add a rectangle to the Row - it should slide in from the left and the black rectangle should move to give it space" }
+ },
+ State { name: "back"; when: statenum == 2
+ PropertyChanges { target: bl; opacity: .9 }
+ PropertyChanges { target: rowelementtest
+ testtext: "Row should now be showing four rectangles - green, red, blue and black.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/ScaleElement.qml b/tests/testapplications/elements/content/ScaleElement.qml
new file mode 100644
index 0000000000..7ad339e5aa
--- /dev/null
+++ b/tests/testapplications/elements/content/ScaleElement.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: scaleelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Rectangle {
+ id: scaletarget
+ color: "green"; height: 100; width: 100; border.color: "gray"; opacity: 0.7; radius: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ transform: Scale {
+ id: scaleelement
+ property alias originx: scaleelement.origin.x
+ property alias originy: scaleelement.origin.y
+ origin.x: 50; origin.y: 50
+ Behavior on xScale { NumberAnimation { duration: 500 } }
+ Behavior on yScale { NumberAnimation { duration: 500 } }
+ // QTBUG-20827 Behavior on origin.x { NumberAnimation { duration: 500 } }
+ // QTBUG-20827 Behavior on origin.y { NumberAnimation { duration: 500 } }
+
+ }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: scaleelementtest
+ testtext: "This is a Rectangle that will be transformed using a Scale element.\n"+
+ "Next, it will be scaled to 2x size." }
+ },
+ State { name: "scaleup"; when: statenum == 2
+ PropertyChanges { target: scaleelement; xScale: 2; yScale: 2 }
+ PropertyChanges { target: scaleelementtest
+ testtext: "It should be scaled to 2x.\nNext, it will shift to the right." }
+ },
+ State { name: "shiftright"; when: statenum == 3
+ PropertyChanges { target: scaleelement; xScale: 2; yScale: 2; origin.x: 0; origin.y: 50 }
+ PropertyChanges { target: scaleelementtest
+ testtext: "It should be on the right, still scaled to 2x.\nNext, it will shift to the left" }
+ },
+ State { name: "shiftleft"; when: statenum == 4
+ PropertyChanges { target: scaleelement; xScale: 2; yScale: 2; origin.x: 100; origin.y: 50 }
+ PropertyChanges { target: scaleelementtest
+ testtext: "It should be on the left, still scaled to 2x.\nAdvance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/SequentialAnimationElement.qml b/tests/testapplications/elements/content/SequentialAnimationElement.qml
new file mode 100644
index 0000000000..89965f71aa
--- /dev/null
+++ b/tests/testapplications/elements/content/SequentialAnimationElement.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: sequentialanimationelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property int firstduration: 1000
+ property int secondduration: 3000
+ property int firstY
+ firstY: parent.height * .6
+ property int secondY
+ secondY: parent.height * .8
+
+ Timer { id: startanimationtimer; interval: 1000; onTriggered: sequentialanimationelement.start() }
+
+ SequentialAnimation {
+ id: sequentialanimationelement
+ running: false
+ NumberAnimation { id: movement; target: animatedrect; properties: "y"; to: secondY; duration: firstduration }
+ ColorAnimation { id: recolor; target: animatedrect; properties: "color"; to: "green"; duration: secondduration }
+ }
+
+ Rectangle {
+ id: animatedrect
+ width: 50; height: 50; color: "blue"; y: firstY
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: animatedrect; color: "blue"; y: firstY }
+ PropertyChanges { target: sequentialanimationelementtest
+ testtext: "This square will be animated in a sequence.\n"+
+ "The next step will see it move quickly down the display, then slowly change its color to green";
+ }
+ },
+ State { name: "firstchange"; when: statenum == 2
+ StateChangeScript { script: { firstduration = 1000; secondduration = 3000; startanimationtimer.start() } }
+ PropertyChanges { target: sequentialanimationelementtest
+ testtext: "The square should have moved quickly and then recolored slowly\n"+
+ "Next, it will move slowly and recolor to blue, in sequence."
+ }
+ },
+ State { name: "secondchange"; when: statenum == 3
+ StateChangeScript { script: { firstduration = 3000; secondduration = 1000; startanimationtimer.start() } }
+ PropertyChanges { target: movement; to: firstY }
+ PropertyChanges { target: recolor; to: "blue" }
+ PropertyChanges { target: sequentialanimationelementtest
+ testtext: "The square should have moved slowly and then recolored quickly\n"+
+ "Advance to restart the test"
+ }
+ }
+ ]
+}
diff --git a/tests/testapplications/elements/content/ShapeElement.qml b/tests/testapplications/elements/content/ShapeElement.qml
new file mode 100644
index 0000000000..2e12aebaf0
--- /dev/null
+++ b/tests/testapplications/elements/content/ShapeElement.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: shapeelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ ParticleSystem {
+ id: particlesystem
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 20
+ height: 300
+ width: 300
+
+ ImageParticle {
+ id: imageparticle
+ source: "pics/star.png"
+ color: "red"
+ }
+
+ Emitter {
+ id: emitter
+ property real magn: 0.1
+ anchors.fill: parent
+ emitRate: 500
+ lifeSpan: 2000
+ velocity: TargetDirection {
+ targetX: particlesystem.width/2
+ targetY: particlesystem.height/2
+ proportionalMagnitude: true
+ magnitude: emitter.magn
+ magnitudeVariation: emitter.magn
+ }
+ shape: rectangleshapeelement
+ }
+ Emitter {
+ id: emitter2
+ enabled: false
+ anchors.fill: parent
+ emitRate: 200
+ lifeSpan: 1000
+ velocity: TargetDirection {
+ targetX: particlesystem.width/2
+ targetY: particlesystem.height/2
+ proportionalMagnitude: true
+ magnitude: 0
+ magnitudeVariation: 0
+ }
+ shape: lineshapeelement2
+ }
+ // Shapes
+ EllipseShape {
+ id: ellipseshapeelement
+ fill: false
+ }
+ RectangleShape {
+ id: rectangleshapeelement
+ fill: false
+ }
+ LineShape {
+ id: lineshapeelement
+ }
+ LineShape {
+ id: lineshapeelement2
+ mirrored: true
+ }
+ MaskShape {
+ id: maskshapeelement
+ source: "pics/logo-hollowed.png"
+ }
+ }
+
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: shapeelementtest
+ testtext: "This is an Shape element, used by Emitter. There should be a rectangle "+
+ "shape emitting into its center.\n"+
+ "Next, let's change the shape to an ellipse." }
+ },
+ State { name: "ellipse"; when: statenum == 2
+ PropertyChanges { target: emitter; shape: ellipseshapeelement }
+ PropertyChanges { target: shapeelementtest
+ testtext: "The particles should now be emitted in a circular shape.\n"+
+ "Next, let's change the shape to a line." }
+ },
+ State { name: "line"; when: statenum == 3
+ PropertyChanges { target: emitter; shape: lineshapeelement; lifeSpan: 1000; emitRate: 200; }
+ PropertyChanges { target: emitter2; enabled: true }
+ PropertyChanges { target: shapeelementtest
+ testtext: "The particles should now be emitted from two lines, creating an X shape.\n"+
+ "Next, let's change the shape to an image." }
+ },
+ State { name: "enduring"; when: statenum == 4
+ PropertyChanges { target: emitter; shape: maskshapeelement; lifeSpan: 1000; emitRate: 1000; magn: 0 }
+ PropertyChanges { target: shapeelementtest
+ testtext: "The particles should now be sparkling, stationary within a 'Qt' text image.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/testapplications/elements/content/SpriteSequenceElement.qml b/tests/testapplications/elements/content/SpriteSequenceElement.qml
new file mode 100644
index 0000000000..4df7d275e8
--- /dev/null
+++ b/tests/testapplications/elements/content/SpriteSequenceElement.qml
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: spriteimageelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ SpriteSequence {
+ id: spriteimage
+ sprites: [Sprite {
+ name: "happy"
+ source: "pics/squarefacesprite2.png"
+ frameCount: 6
+ frameDuration: 120
+ to: {"silly": 1, "sad":0}
+ }, Sprite {
+ name: "silly"
+ source: "pics/squarefacesprite.png"
+ frameCount: 6
+ frameDuration: 120
+ to: {"happy": 1, "sad": 0}
+ }, Sprite {
+ name: "sad"
+ source: "pics/squarefacesprite3.png"
+ frameCount: 6
+ frameDuration: 120
+ to: {"evil": 0.5, "sad": 1, "cyclops" : 0}
+ }, Sprite {
+ name: "cyclops"
+ source: "pics/squarefacesprite4.png"
+ frameCount: 6
+ frameDuration: 120
+ to: {"love": 0.1, "boggled": 0.1, "cyclops" : 0.1}
+ }, Sprite {
+ name: "evil"
+ source: "pics/squarefacesprite5.png"
+ frameCount: 6
+ frameDuration: 120
+ to: {"sad": 1.0, "cyclops" : 0}
+ }, Sprite {
+ name: "love"
+ source: "pics/squarefacesprite6.png"
+ frameCount: 6
+ frameDuration: 120
+ to: {"love": 0.1, "boggled": 0.1, "cyclops" : 0.1}
+ }, Sprite {
+ name: "boggled"
+ source: "pics/squarefacesprite7.png"
+ frameCount: 6
+ frameDuration: 120
+ to: {"love": 0.1, "boggled": 0.1, "cyclops" : 0.1, "dying":0}
+ }, Sprite {
+ name: "dying"
+ source: "pics/squarefacespriteX.png"
+ frameCount: 4
+ frameDuration: 120
+ to: {"dead":1.0}
+ }, Sprite {
+ name: "dead"
+ source: "pics/squarefacespriteXX.png"
+ frameCount: 1
+ frameDuration: 10000
+ }]
+
+ width: 300
+ height: 300
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ StateChangeScript { script: spriteimage.jumpTo("happy"); }
+ PropertyChanges { target: spriteimageelementtest
+ testtext: "This is a SpriteSequence element. It should be animating currently."+
+ "It should alternate between winking and sticking out its tongue." }
+ },
+ State { name: "stochastic2"; when: statenum == 2
+ StateChangeScript { script: spriteimage.jumpTo("sad"); }
+ PropertyChanges { target: spriteimageelementtest
+ testtext: "The sprite should now be animating between frowning and being evil."+
+ "This should not be alternating, but mostly frowning with the occasional evil eyes."+
+ "After an evil eyes animation, it should return to frowning at least once." }
+ },
+ State { name: "stochastic3"; when: statenum == 3
+ StateChangeScript { script: spriteimage.jumpTo("cyclops"); }
+ PropertyChanges { target: spriteimageelementtest
+ testtext: "The sprite should now be animating fairly randomly between three animations where it does silly things with its eyes.\n"+
+ "Next the sprite will animate into a static 'dead' state."+
+ "When it does, it should first animate to and play through the 'big eyes' animation (if it is not currently playing that animation) before it enters the dying animation."}
+ },
+ State { name: "dead"; when: statenum == 4
+ PropertyChanges { target: spriteimage; goalSprite: "dead" }
+ PropertyChanges { target: spriteimageelementtest
+ testtext: "After a brief dying animation, the image should now be static.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+}
diff --git a/tests/testapplications/elements/content/SystemPaletteElement.qml b/tests/testapplications/elements/content/SystemPaletteElement.qml
new file mode 100644
index 0000000000..21d9dc590f
--- /dev/null
+++ b/tests/testapplications/elements/content/SystemPaletteElement.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: systempaletteelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ SystemPalette { id: syspal; colorGroup: SystemPalette.Inactive }
+ Rectangle {
+ height: parent.height *.8; width: parent.width *.8; border.width: 6; radius: 4
+ anchors.centerIn: parent
+ color: syspal.base; border.color: syspal.window
+ Rectangle {
+ height: 20; width: parent.width; border.color: "black"; color: syspal.window; radius: 4
+ Text { text: "File"; color: syspal.windowText; font.pointSize: 9
+ anchors { left: parent.left; leftMargin: 5; verticalCenter: parent.verticalCenter }
+ }
+ Rectangle {
+ id: shadow
+ height: button.height; width: button.width; color: syspal.shadow; radius: 5; opacity: .5
+ anchors { left: button.left; top: button.top; leftMargin: 2; topMargin: 2 }
+ }
+ Rectangle {
+ id: button
+ width: 150; height: 50; radius: 5; border.color: "black"; color: clicky.pressed ? syspal.highlight : syspal.button
+ Behavior on color { ColorAnimation { duration: 500 } }
+ anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 30 }
+ Text { anchors.centerIn: parent; text: "Button"; color: syspal.buttonText }
+ MouseArea { id: clicky; anchors.fill: parent
+ onPressed: { shadow.anchors.topMargin = 1; shadow.anchors.leftMargin = 1 }
+ onReleased: { shadow.anchors.topMargin = 2; shadow.anchors.leftMargin = 2 }
+ }
+ }
+ }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: systempaletteelementtest
+ testtext: "This is an mock application shaded with the help of the SystemPalette element.\n"+
+ "The colors of the menu bar, menu text and button should mimic that of the OS it is running on.\n"+
+ "Pressing the labelled button should shade it to the system highlight color." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/SystemTestHelp.qml b/tests/testapplications/elements/content/SystemTestHelp.qml
new file mode 100644
index 0000000000..a7a5948b95
--- /dev/null
+++ b/tests/testapplications/elements/content/SystemTestHelp.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: helpbubble
+ visible: false
+ property bool showtext: false
+ property bool showadvance: true
+ onShowadvanceChanged: { advancearrow.visible = showadvance; }
+
+ width: 300; radius: 15; color: "white"; border.color: "black"; border.width: 3
+ height: showadvance ? bubbletext.height + advancearrow.height + 25 : bubbletext.height + 25
+ Behavior on height {
+ SequentialAnimation {
+ ScriptAction { script: { bubbletext.visible = false; advancearrow.visible = false } }
+ NumberAnimation { duration: 200 }
+ ScriptAction { script: { bubbletext.visible = true; advancearrow.visible = showadvance && true } }
+ }
+ }
+ Behavior on width {
+ SequentialAnimation {
+ ScriptAction { script: { bubbletext.visible = false; advancearrow.visible = false } }
+ NumberAnimation { duration: 200 }
+ ScriptAction { script: { bubbletext.visible = true; advancearrow.visible = true } }
+ }
+ }
+ Text { id: bubbletext; width: parent.width - 30; text: testtext; wrapMode: Text.WordWrap
+ anchors { top: parent.top; topMargin: 15; left: parent.left; leftMargin: 20 }
+ }
+ Image { id: advancearrow; source: "pics/arrow.png"; height: 30; width: 30; visible: showadvance
+ anchors { right: parent.right; bottom: parent.bottom; rightMargin: 5; bottomMargin: 5 }
+ MouseArea { enabled: showadvance; anchors.fill: parent; onClicked: { advance(); } }
+ }
+}
diff --git a/tests/testapplications/elements/content/TextEditElement.qml b/tests/testapplications/elements/content/TextEditElement.qml
new file mode 100644
index 0000000000..64c49f52ed
--- /dev/null
+++ b/tests/testapplications/elements/content/TextEditElement.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: texteditelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property string wraptext: "Set this property to wrap the text to the TextEdit item's width. The text will only wrap if an explicit width has been set."
+
+ Rectangle {
+ id: texteditelementbackground
+ color: "green"; height: 150; width: parent.width *.8; border.color: "gray"; opacity: 0.7; radius: 5; clip: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: secondarybackground.top
+ anchors.bottomMargin: 10
+
+ TextEdit {
+ id: texteditelement
+ font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignLeft
+ anchors.centerIn: parent
+ Behavior on font.pointSize { NumberAnimation { duration: 1000 } }
+ Behavior on color { ColorAnimation { duration: 1000 } }
+ }
+ }
+
+ Rectangle {
+ id: secondarybackground
+ color: "lightgray"; border.color: "gray"; opacity: 0.7; radius: 5; height: 50; width: parent.width *.8
+ anchors { bottom: parent.bottom; bottomMargin: 15; horizontalCenter: parent.horizontalCenter }
+
+ TextEdit {
+ id: secondary
+ property string ignoretext: "Nothing to see here"
+ font.pointSize: 12; width: parent.width; text: ""; opacity: text == ignoretext ? .3 : 1; horizontalAlignment: Text.AlignLeft
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ id: shadowrect
+ color: "lightgray"; height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0; radius: 5
+ anchors.horizontalCenter: texteditelementbackground.horizontalCenter;
+ anchors.verticalCenter: texteditelementbackground.verticalCenter;
+
+ Text {
+ id: shadowtext
+ font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignLeft
+ anchors.centerIn: parent
+ }
+ }
+ transitions: Transition {
+ AnchorAnimation { targets: shadowrect; duration: 1000 }
+ }
+
+ SequentialAnimation { id: copypaste
+ ScriptAction { script: { secondary.text = ""; shadowtext.text = texteditelement.selectedText; texteditelement.copy(); } }
+ NumberAnimation { target: shadowrect; property: "opacity"; to: 0.5; duration: 100 }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: { secondary.paste(); } }
+ NumberAnimation { target: shadowrect; property: "opacity"; to: 0; duration: 100 }
+ NumberAnimation { target: shadowrect; property: "x"; to: texteditelementbackground.x; duration: 0 }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ StateChangeScript {
+ script: {
+ texteditelement.text = "Hello, my name is TextEdit"
+ secondary.text = "Nothing to see here";
+ }
+ }
+ PropertyChanges { target: texteditelementtest
+ testtext: "This is a TextEdit element. At present it should be saying hello.\n"+
+ "Next, the TextEdit portion of the displayed text will be selected" }
+ },
+ State { name: "highlight"; when: statenum == 2
+ StateChangeScript { script: texteditelement.select(18, 26); }
+ PropertyChanges { target: texteditelementtest
+ testtext: "TextEdit should now be highlighted.\nNext, it will be copied this to the other TextEdit." }
+ },
+ State { name: "copypaste"; when: statenum == 3
+ PropertyChanges { target: copypaste; running: true }
+ AnchorChanges { target: shadowrect; anchors.verticalCenter: secondarybackground.verticalCenter }
+ PropertyChanges { target: texteditelementtest
+ testtext: "The second TextEdit should now be showing the selected text of the top TextEdit.\n"+
+ "Next, a larger amount of text will be entered." }
+ },
+ State { name: "largetextnowrap"; when: statenum == 4
+ PropertyChanges { target: texteditelement; text: wraptext }
+ PropertyChanges { target: texteditelementtest
+ testtext: "The TextEdit should now be showing a line of text, chopped off by the edge of the rectangle.\n"+
+ "Next, the TextEdit will set wrapping to fix that." }
+ },
+ State { name: "largetextwrap"; when: statenum == 5
+ PropertyChanges { target: texteditelement; text: wraptext; wrapMode: TextEdit.WordWrap }
+ PropertyChanges { target: texteditelementtest
+ testtext: "The TextEdit should now be showing a block of text.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/TextElement.qml b/tests/testapplications/elements/content/TextElement.qml
new file mode 100644
index 0000000000..665a81580a
--- /dev/null
+++ b/tests/testapplications/elements/content/TextElement.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: textelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Text {
+ id: textelement
+ property int pseudopointsize: 12
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 15
+ height: 200; width: parent.width *.8; wrapMode: Text.WordWrap; font.pointSize: 12
+ text: "Hello, my name is Text"; horizontalAlignment: Text.AlignHCenter; textFormat: Text.PlainText
+ Behavior on font.pointSize { NumberAnimation { duration: 1000 } }
+ Behavior on color { ColorAnimation { duration: 1000 } }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: textelementtest
+ testtext: "This is a Text element. At present it should be saying hello.\n"+
+ "Next, it will animatedly increase the text to twice its size" }
+ },
+ State { name: "fontlarge"; when: statenum == 2
+ PropertyChanges { target: textelement; font.pointSize: 24 }
+ PropertyChanges { target: textelementtest
+ testtext: "The font should have increased in size, and wrapped once too large for the screen width.\n"+
+ "Next, let's change the color to blue." }
+ PropertyChanges { target: bugpanel; bugnumber: "19848" }
+ },
+ State { name: "fontlargeblue"; when: statenum == 3
+ PropertyChanges { target: textelement; font.pointSize: 24; color: "blue" }
+ PropertyChanges { target: textelementtest
+ testtext: "The font should now be blue.\n"+
+ "Next, let's add some formatting." }
+ },
+ State { name: "fontlargeblueitalicsbold"; when: statenum == 4
+ PropertyChanges { target: textelement; font.pointSize: 24; color: "blue"; font.bold: true; font.italic: true }
+ PropertyChanges { target: textelementtest
+ testtext: "The font should now be blue, bold and italic.\n"+
+ "Next, let's use rich text." }
+ PropertyChanges { target: bugpanel; bugnumber: "19848" }
+ },
+ State { name: "fontlargerichtext"; when: statenum == 5
+ PropertyChanges {
+ target: textelement; font.pointSize: 24; color: "blue"; font.bold: true; font.italic: true
+ text: "<font color=\"green\">I</font> am <font color=\"green\">now</font> multicolored!"; textFormat: Text.RichText
+ }
+ PropertyChanges { target: textelementtest
+ testtext: "The font should now be bold and italic, and alternating in color.\n"+
+ "The test will now return to the start." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/TextInputElement.qml b/tests/testapplications/elements/content/TextInputElement.qml
new file mode 100644
index 0000000000..7d31ed33cf
--- /dev/null
+++ b/tests/testapplications/elements/content/TextInputElement.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: textinputelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ Rectangle {
+ id: textinputelementbackground
+ color: "green"; height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0.7; radius: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: secondarybackground.top
+ anchors.bottomMargin: 10
+ TextInput {
+ id: textinputelement
+ font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignHCenter
+ anchors.centerIn: parent
+ Behavior on font.pointSize { NumberAnimation { duration: 1000 } }
+ Behavior on color { ColorAnimation { duration: 1000 } }
+ }
+ }
+
+ Rectangle {
+ id: secondarybackground
+ color: "lightgray"; border.color: "gray"; opacity: 0.7; radius: 5; height: 50; width: parent.width *.8
+ anchors { bottom: parent.bottom; bottomMargin: 15; horizontalCenter: parent.horizontalCenter }
+
+ TextInput {
+ id: secondary
+ property string ignoretext: "Nothing to see here"
+ font.pointSize: 12; text: ""; opacity: text == ignoretext ? .3 : 1; horizontalAlignment: Text.AlignHCenter
+ anchors.centerIn: parent; width: parent.width
+ }
+ }
+ Rectangle {
+ id: shadowrect
+ color: "lightgray"; height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0; radius: 5
+ anchors.horizontalCenter: textinputelementbackground.horizontalCenter;
+ anchors.verticalCenter: textinputelementbackground.verticalCenter;
+ Text {
+ id: shadowtext
+ font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignHCenter
+ anchors.centerIn: parent
+ }
+ }
+ transitions: Transition {
+ AnchorAnimation { targets: shadowrect; duration: 1000 }
+ }
+
+ SequentialAnimation { id: copypaste
+ ScriptAction { script: { secondary.text = ""; shadowtext.text = textinputelement.selectedText; textinputelement.copy(); } }
+ NumberAnimation { target: shadowrect; property: "opacity"; to: 0.5; duration: 100 }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: { secondary.paste(); } }
+ NumberAnimation { target: shadowrect; property: "opacity"; to: 0; duration: 100 }
+ NumberAnimation { target: shadowrect; property: "x"; to: textinputelementbackground.x; duration: 0 }
+ }
+
+ BugPanel { id: bugpanel }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ StateChangeScript {
+ script: {
+ textinputelement.text = "Hello, my name is TextInput"
+ secondary.text = "Nothing to see here";
+ }
+ }
+ PropertyChanges { target: textinputelementtest
+ testtext: "This is a TextInput element. At present it should be saying hello.\n"+
+ "Next, it will select the TextInput portion of the displayed text" }
+ },
+ State { name: "highlight"; when: statenum == 2
+ StateChangeScript { script: textinputelement.select(18, 27); }
+ PropertyChanges { target: textinputelementtest
+ testtext: "TextInput should now be highlighted.\nNext, copy this to the other TextInput." }
+ },
+ State { name: "copypaste"; when: statenum == 3
+ PropertyChanges { target: copypaste; running: true }
+ AnchorChanges { target: shadowrect; anchors.verticalCenter: secondarybackground.verticalCenter }
+ PropertyChanges { target: textinputelementtest
+ testtext: "The second TextInput should now be showing the selected text of the top TextInput.\n"+
+ "Next, let's change the way the entered text is displayed." }
+ },
+ State { name: "passwordmode"; when: statenum == 4
+ StateChangeScript { script: textinputelement.deselect(); }
+ PropertyChanges { target: textinputelement; echoMode: TextInput.Password }
+ PropertyChanges { target: textinputelementtest
+ testtext: "The TextInput should now be showing asterisks (*) for every character in the top TextInput - all "+
+ textinputelement.text.length+" of them.\n"+
+ "Next, let's return to the start." }
+ }
+ ]
+
+
+}
diff --git a/tests/testapplications/elements/content/TrailEmitterElement.qml b/tests/testapplications/elements/content/TrailEmitterElement.qml
new file mode 100644
index 0000000000..1d2ff67a73
--- /dev/null
+++ b/tests/testapplications/elements/content/TrailEmitterElement.qml
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: trailemitterelementtest
+ anchors.fill: parent
+ property string testtext: ""
+
+ ParticleSystem {
+ id: particlesystem
+ anchors.fill: parent
+ Image {
+ id: backgroundpic
+ anchors.fill: parent
+ source: "pics/logo.png"
+ opacity: 0
+ Behavior on opacity { NumberAnimation { duration: 1000 } }
+ }
+ ImageParticle {
+ id: omissile
+ source: "pics/star.png"
+ color: "orange"
+ entryEffect: ImageParticle.None
+ groups: ["orangemissile"]
+ }
+ ImageParticle {
+ id: gmissile
+ source: "pics/star.png"
+ color: "green"
+ entryEffect: ImageParticle.None
+ groups: ["greenmissile"]
+ }
+ ImageParticle {
+ id: sparks
+ source: "pics/star.png"
+ color: "red"
+ colorVariation: .5
+ entryEffect: ImageParticle.None
+ groups: ["sparks"]
+ }
+ Emitter {
+ id: emitter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ emitRate: 1
+ lifeSpan: 3000
+ size: 20
+ velocity: AngleDirection { angle: 270; angleVariation: 25; magnitude: 150 }
+ group: "orangemissile"
+ }
+ Emitter {
+ id: emitter2
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ emitRate: 1
+ lifeSpan: 3000
+ size: 20
+ velocity: AngleDirection { angle: 270; angleVariation: 25; magnitude: 150 }
+ group: "greenmissile"
+ }
+ Gravity {
+ anchors.fill: parent
+ angle: 90
+ acceleration: 30
+ }
+ TrailEmitter {
+ id: trailemitterelement
+ follow: "orangemissile"
+ group:"sparks"
+ anchors.fill: parent
+ emitRatePerParticle: 50
+ lifeSpan: 1000
+ velocityFromMovement: .2
+ velocity: AngleDirection { angle: 0; angleVariation: 360; magnitude: 5 }
+ maximumEmitted: 500
+ shape: basicshape
+ }
+
+ RectangleShape { id: basicshape }
+
+ MaskShape {
+ id: maskshape
+ source: "pics/logo-hollowed.png"
+ }
+
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: trailemitterelementtest
+ testtext: "This is a TrailEmitter, with particles following the orange particles.\n"+
+ "The green particles should not be followed by other particles.\n"+
+ "Next, let's change the sparks to follow the green particles." }
+ },
+ State { name: "followgreen"; when: statenum == 2
+ PropertyChanges { target: trailemitterelement; follow: "greenmissile" }
+ PropertyChanges { target: trailemitterelementtest
+ testtext: "The particles should be following the green particles.\n"+
+ "Next, let's add a shape to emit within." }
+ },
+ State { name: "onlyinshape"; when: statenum == 3
+ PropertyChanges { target: trailemitterelement; follow: "greenmissile"; shape: maskshape }
+ PropertyChanges { target: backgroundpic; opacity: .5 }
+ PropertyChanges { target: trailemitterelementtest
+ testtext: "The particles should now be only emitted when they pass through the 'Qt' text.\n"+
+ "Next, let's create small Qt missiles." }
+ },
+ State { name: "emittingashape"; when: statenum == 4
+ PropertyChanges { target: trailemitterelement; follow: "greenmissile"; shape: basicshape
+ emitHeight: 60; emitWidth: 60; emitRatePerParticle: 1500; emitShape: maskshape; maximumEmitted: 1500; lifeSpan: 50
+ }
+ PropertyChanges { target: trailemitterelementtest
+ testtext: "The particles should now be Qt text shaped particles.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/testapplications/elements/content/XmlListModelElement.qml b/tests/testapplications/elements/content/XmlListModelElement.qml
new file mode 100644
index 0000000000..9a85a65cdf
--- /dev/null
+++ b/tests/testapplications/elements/content/XmlListModelElement.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+Item {
+ id: xmllistmodelelementtest
+ anchors.fill: parent
+ property string testtext: ""
+ property string modelxml: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
+ "<cookbook><recipe id=\"MushroomSoup\">"+
+ "<title>Hot chocolate</title>"+
+ "<ingredient name=\"Milk\" quantity=\"1\" unit=\"cup\"/>"+
+ "<time quantity=\"2\" unit=\"minutes\"/>"+
+ "<method><step>1. Place the cup of milk in the microwave for 1 minute.</step>"+
+ "<step>2. Stir in 2 teaspoons of drinking chocolate.</step></method></recipe></cookbook>"
+
+ XmlListModel { id: xmllistmodelelement
+ source: "cookbook.xml"
+ query: "/cookbook/recipe"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "xmlid"; query: "@id/string()" }
+ XmlRole { name: "method"; query: "method/string()" }
+ XmlRole { name: "time"; query: "time/@quantity/number()" }
+ }
+
+ ListView {
+ id: recipeview
+ model: xmllistmodelelement; height: 300; width: 300; clip: true
+ anchors.centerIn: parent
+ delegate: Component {
+ Rectangle { id: delbox; height: 50; width: 296; color: "orange"; border.color: "black"; state: "closed"; clip: true; radius: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ Text {
+ id: recipetitle
+ text: model.title; font.pointSize: 12; font.bold: true
+ anchors.horizontalCenter: parent.horizontalCenter; y: 20;
+ }
+
+ Text {
+ id: recipetime
+ width: parent.width; height: 20; text: "<b>Time: </b>" +model.time + " minutes"; visible: opacity != 0
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.top: recipetitle.bottom
+ Behavior on opacity { NumberAnimation { duration: 250 } }
+ }
+
+ // Sub XmlListModel
+ XmlListModel { id: subxmllistmodelelement
+ source: "cookbook.xml"
+ query: "/cookbook/recipe[@id = '"+model.xmlid+"']/ingredient"
+ XmlRole { name: "ingredientname"; query: "@name/string()" }
+ XmlRole { name: "ingredientquantity"; query: "@quantity/string()" }
+ XmlRole { name: "ingredientunit"; query: "@unit/string()" }
+ }
+
+ ListView {
+ id: ingredientlist
+ model: subxmllistmodelelement
+ height: 20 * count; width: parent.width
+ visible: opacity != 0
+ Behavior on opacity { NumberAnimation { duration: 250 } }
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.top: recipetime.bottom; anchors.topMargin: 10
+ header: Text { text: "<b>Ingredients:</b>" }
+ delegate: Text {
+ text: ingredientquantity + " " + ingredientunit + " of " + ingredientname; height: 20;
+ }
+ }
+
+ Text {
+ id: recipemethod
+ property string methodtext: ""
+ width: parent.width; wrapMode: Text.WordWrap; visible: opacity != 0; text: methodtext
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.top: ingredientlist.bottom
+ Behavior on opacity { NumberAnimation { duration: 250 } }
+ Component.onCompleted: { methodtext = model.method; }
+ }
+ MouseArea { anchors.fill: parent; onClicked: delbox.state = delbox.state == "open" ? "closed" : "open" }
+ Behavior on height { NumberAnimation { duration: 250 } }
+ states: [
+ State { name: "closed"
+ PropertyChanges { target: delbox; height: 50 }
+ PropertyChanges { target: recipemethod; opacity: 0 }
+ PropertyChanges { target: recipetime; opacity: 0 }
+ PropertyChanges { target: ingredientlist; opacity: 0 }
+ },
+ State { name: "open"
+ PropertyChanges { target: delbox; height: recipemethod.height+recipetime.height+ingredientlist.height+50 }
+ PropertyChanges { target: recipemethod; opacity: 1 }
+ StateChangeScript { script: { recipeview.positionViewAtIndex(model.index, ListView.Beginning); } }
+ }
+ ]
+ }
+ }
+ }
+
+ SystemTestHelp { id: helpbubble; visible: statenum != 0
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 }
+ }
+ BugPanel { id: bugpanel }
+
+ states: [
+ State { name: "start"; when: statenum == 1
+ PropertyChanges { target: xmllistmodelelementtest
+ testtext: "This is a ListView populated by an XmlListModel. Clicking on an item will show the recipe details.\n"+
+ "Next we will change to source of the model data to a local string" }
+ },
+ State { name: "xmlstring"; when: statenum == 2
+ PropertyChanges { target: xmllistmodelelement; source: "" }
+ PropertyChanges { target: xmllistmodelelement; xml: modelxml }
+ PropertyChanges { target: xmllistmodelelementtest
+ testtext: "The list should now only contain a Hot chocolate recipe.\n"+
+ "Advance to restart the test." }
+ }
+ ]
+
+}
diff --git a/tests/testapplications/elements/content/cookbook.xml b/tests/testapplications/elements/content/cookbook.xml
new file mode 100644
index 0000000000..33dd91a5de
--- /dev/null
+++ b/tests/testapplications/elements/content/cookbook.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cookbook>
+ <recipe id="MushroomSoup">
+ <title>Quick and Easy Mushroom Soup</title>
+ <ingredient name="Fresh mushrooms"
+ quantity="7"
+ unit="pieces"/>
+ <ingredient name="Garlic"
+ quantity="1"
+ unit="cloves"/>
+ <ingredient name="Olive oil"
+ quantity="2"
+ unit="tablespoons"/>
+ <ingredient name="Milk"
+ quantity="200"
+ unit="milliliters"/>
+ <ingredient name="Water"
+ quantity="200"
+ unit="milliliters"/>
+ <ingredient name="Cream"
+ quantity="100"
+ unit="milliliters"/>
+ <ingredient name="Vegetable soup cube"
+ quantity="1/2"
+ unit="cubes"/>
+ <ingredient name="Ground black pepper"
+ quantity="1/2"
+ unit="teaspoons"/>
+ <ingredient name="Dried parsley"
+ quantity="1"
+ unit="teaspoons"/>
+ <time quantity="20"
+ unit="minutes"/>
+ <method>
+ <step>1. Slice mushrooms and garlic.</step>
+ <step>2. Fry mushroom slices and garlic with olive oil.</step>
+ <step>3. Once mushrooms are cooked, add milk, cream water. Stir.</step>
+ <step>4. Add vegetable soup cube.</step>
+ <step>5. Reduce heat, add pepper and parsley.</step>
+ <step>6. Turn off the stove before the mixture boils.</step>
+ <step>7. Blend the mixture.</step>
+ </method>
+ </recipe>
+ <recipe id="CheeseOnToast">
+ <title>Cheese on Toast</title>
+ <ingredient name="Bread"
+ quantity="2"
+ unit="slices"/>
+ <ingredient name="Cheese"
+ quantity="2"
+ unit="slices"/>
+ <time quantity="3"
+ unit="minutes"/>
+ <method>
+ <step>1. Slice the bread and cheese.</step>
+ <step>2. Grill one side of each slice of bread.</step>
+ <step>3. Turn over the bread and place a slice of cheese on each piece.</step>
+ <step>4. Grill until the cheese has started to melt.</step>
+ <step>5. Serve and enjoy!</step>
+ </method>
+ </recipe>
+</cookbook>
diff --git a/tests/testapplications/elements/content/elements.js b/tests/testapplications/elements/content/elements.js
new file mode 100644
index 0000000000..d14930459c
--- /dev/null
+++ b/tests/testapplications/elements/content/elements.js
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var newcomponent = Qt.createComponent("AppContainer.qml");
+var appfile;
+var demoapp;
+
+
+function setapp(appname,par) {
+ appfile = appname;
+ demoapp = newcomponent.createObject(par);
+ demoapp.qmlfile = appfile;
+}
+
+
+function removeApp() {
+ demoapp.destroy();
+}
diff --git a/tests/testapplications/elements/content/font/Vera.ttf b/tests/testapplications/elements/content/font/Vera.ttf
new file mode 100644
index 0000000000..58cd6b5e61
--- /dev/null
+++ b/tests/testapplications/elements/content/font/Vera.ttf
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/animatednokialogo.gif b/tests/testapplications/elements/content/pics/animatednokialogo.gif
new file mode 100644
index 0000000000..7d5df1f3e8
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/animatednokialogo.gif
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/arrow.png b/tests/testapplications/elements/content/pics/arrow.png
new file mode 100644
index 0000000000..70faf7f9ce
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/arrow.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/cat.gif b/tests/testapplications/elements/content/pics/cat.gif
new file mode 100644
index 0000000000..ea9987d0f3
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/cat.gif
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/logo-hollowed.png b/tests/testapplications/elements/content/pics/logo-hollowed.png
new file mode 100644
index 0000000000..ca2acb3651
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/logo-hollowed.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/logo.png b/tests/testapplications/elements/content/pics/logo.png
new file mode 100644
index 0000000000..d75936b007
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/logo.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/nokialogo.gif b/tests/testapplications/elements/content/pics/nokialogo.gif
new file mode 100644
index 0000000000..7a30f6916b
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/nokialogo.gif
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/qml-borderimage.png b/tests/testapplications/elements/content/pics/qml-borderimage.png
new file mode 100644
index 0000000000..8035c79f37
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/qml-borderimage.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/smile.png b/tests/testapplications/elements/content/pics/smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/smile.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/speech-bubble.png b/tests/testapplications/elements/content/pics/speech-bubble.png
new file mode 100644
index 0000000000..e6811ca899
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/speech-bubble.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacesprite.png b/tests/testapplications/elements/content/pics/squarefacesprite.png
new file mode 100644
index 0000000000..f9a5d5fcce
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacesprite.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacesprite2.png b/tests/testapplications/elements/content/pics/squarefacesprite2.png
new file mode 100644
index 0000000000..7106a520a4
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacesprite2.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacesprite3.png b/tests/testapplications/elements/content/pics/squarefacesprite3.png
new file mode 100644
index 0000000000..f4e6f26856
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacesprite3.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacesprite4.png b/tests/testapplications/elements/content/pics/squarefacesprite4.png
new file mode 100644
index 0000000000..1e094eed4a
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacesprite4.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacesprite5.png b/tests/testapplications/elements/content/pics/squarefacesprite5.png
new file mode 100644
index 0000000000..1cfc5c7f8c
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacesprite5.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacesprite6.png b/tests/testapplications/elements/content/pics/squarefacesprite6.png
new file mode 100644
index 0000000000..b040139a9e
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacesprite6.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacesprite7.png b/tests/testapplications/elements/content/pics/squarefacesprite7.png
new file mode 100644
index 0000000000..b1e5e4e339
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacesprite7.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacespriteX.png b/tests/testapplications/elements/content/pics/squarefacespriteX.png
new file mode 100644
index 0000000000..93a0181dd0
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacespriteX.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/squarefacespriteXX.png b/tests/testapplications/elements/content/pics/squarefacespriteXX.png
new file mode 100644
index 0000000000..3159efe246
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/squarefacespriteXX.png
Binary files differ
diff --git a/tests/testapplications/elements/content/pics/star.png b/tests/testapplications/elements/content/pics/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/tests/testapplications/elements/content/pics/star.png
Binary files differ
diff --git a/tests/testapplications/elements/elements.qml b/tests/testapplications/elements/elements.qml
new file mode 100644
index 0000000000..fbdee6cb98
--- /dev/null
+++ b/tests/testapplications/elements/elements.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content/elements.js" as Elements
+import "content"
+
+Item {
+ id: elementsapp; height: 640; width: 360
+
+ property string qmlfiletoload: ""
+ property string helptext: ""
+
+ GradientElement { anchors.fill: parent }
+
+ GridViewElement { height: parent.height * .95; width: parent.width * .95; anchors.centerIn: parent; }
+
+ HelpDesk { width: parent.width; height: 200; anchors { bottom: parent.bottom; right: parent.right; bottomMargin: 3; rightMargin: 3 } }
+
+ // Start or remove an .qml when the qmlfiletoload property changes
+ onQmlfiletoloadChanged: {
+ if (qmlfiletoload == "") {
+ Elements.removeApp();
+ } else {
+ Elements.setapp(qmlfiletoload,elementsapp);
+ }
+ }
+
+ // Set the qmlfiletoload property with a script function
+ function runapp(qmlfile) {
+ console.log("Starting ",qmlfile);
+ qmlfiletoload = qmlfile;
+ }
+}
diff --git a/tests/testapplications/listview/alteredViews.qml b/tests/testapplications/listview/alteredViews.qml
new file mode 100644
index 0000000000..202a0ba345
--- /dev/null
+++ b/tests/testapplications/listview/alteredViews.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 300
+ height: 400
+
+ ListView {
+ id: listview
+ model: model1
+ delegate: delegate1
+ anchors.fill: parent
+ anchors.margins: 20
+ }
+
+ Component {
+ id: delegate1
+ Rectangle {
+ height: listview.orientation == ListView.Horizontal ? 260 : 50
+ Behavior on height { NumberAnimation { duration: 500 } }
+ width: listview.orientation == ListView.Horizontal ? 50 : 260
+ Behavior on width { NumberAnimation { duration: 500 } }
+ border.color: "black"
+ Text {
+ anchors.centerIn: parent; color: "black"; text: model.name
+ rotation: listview.orientation == ListView.Horizontal ? -90 : 0
+ Behavior on rotation { NumberAnimation { duration: 500 } }
+
+ }
+ }
+ }
+
+ Component {
+ id: delegate2
+ Rectangle {
+ height: listview.orientation == ListView.Horizontal ? 260 : 50
+ Behavior on height { NumberAnimation { duration: 500 } }
+ width: listview.orientation == ListView.Horizontal ? 50 : 260
+ Behavior on width { NumberAnimation { duration: 500 } }
+ color: "goldenrod"; border.color: "black"
+ Text {
+ anchors.centerIn: parent; color: "royalblue"; text: model.name
+ rotation: listview.orientation == ListView.Horizontal ? -90 : 0
+ Behavior on rotation { NumberAnimation { duration: 1500 } }
+ }
+ }
+
+ }
+
+ Column {
+ Rectangle {
+ height: 50
+ width: 50
+ color: "blue"
+ border.color: "orange"
+ Text {
+ anchors.centerIn: parent
+ text: "Mod"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: listview.model = listview.model == model2 ? model1 : model2
+ }
+ }
+
+ Rectangle {
+ height: 50
+ width: 50
+ color: "blue"
+ border.color: "orange"
+ Text {
+ anchors.centerIn: parent
+ text: "Del"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: listview.delegate = listview.delegate == delegate2 ? delegate1 : delegate2
+ }
+ }
+
+ Rectangle {
+ height: 50
+ width: 50
+ color: "blue"
+ border.color: "orange"
+ Text {
+ anchors.centerIn: parent
+ text: "Ori"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: listview.orientation = listview.orientation == ListView.Horizontal ? ListView.Vertical : ListView.Horizontal
+ }
+ }
+ }
+
+ ListModel {
+ id: model1
+ ListElement { name: "model1_1" }
+ ListElement { name: "model1_2" }
+ ListElement { name: "model1_3" }
+ ListElement { name: "model1_4" }
+ ListElement { name: "model1_5" }
+ }
+
+ ListModel {
+ id: model2
+ ListElement { name: "model2_1" }
+ ListElement { name: "model2_2" }
+ ListElement { name: "model2_3" }
+ ListElement { name: "model2_4" }
+ ListElement { name: "model2_5" }
+ }
+}
diff --git a/tests/testapplications/listview/onRemove.qml b/tests/testapplications/listview/onRemove.qml
new file mode 100644
index 0000000000..4875751655
--- /dev/null
+++ b/tests/testapplications/listview/onRemove.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+Item {
+ id: root
+ width: 450; height: 600
+
+ Component {
+ id: viewDelegate
+
+ Rectangle {
+ id: item
+ signal boom
+ Connections {
+ target: item
+ onBoom: emitter.burst(1000)
+ }
+
+ width: 225; height: 40
+ border.width: ListView.isCurrentItem ? 3 : 1
+ z: ListView.isCurrentItem ? 100 : 1
+ color: original ? "lightsteelblue" : "yellow"
+ objectName: name
+ Text { x: 10; text: name; font.pixelSize: 20 }
+ MouseArea { anchors.fill: parent; onClicked: listview.currentIndex = index }
+
+ Emitter {
+ id: emitter
+ system: ps
+ anchors.fill: parent
+ enabled: false
+ velocity: AngleDirection {
+ angle: 0
+ angleVariation: 360
+ magnitude: 50
+ magnitudeVariation: 50
+ }
+ lifeSpan: 2000
+ }
+
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: item; property: "ListView.delayRemove"; value: true }
+ PropertyAction { target: item; property: "opacity"; value: 0 }
+ ScriptAction { script: item.boom() }
+ PauseAnimation { duration: 1000 }
+ PropertyAction { target: item; property: "ListView.delayRemove"; value: false }
+ }
+ }
+ }
+
+
+ ListView {
+ id: listview
+ width: 225; height: 500
+ anchors.centerIn: parent
+ delegate: viewDelegate
+ header: Rectangle {
+ height: 50; width: 225
+ color: "blue"
+ Text { anchors.centerIn: parent; text: "Transitions!"; color: "goldenrod" }
+ }
+ model: ListModel {
+ id: a_model
+ ListElement { name: "Item A"; original: true }
+ ListElement { name: "Item B"; original: true }
+ ListElement { name: "Item C"; original: true }
+ ListElement { name: "Item D"; original: true }
+ ListElement { name: "Item E"; original: true }
+ ListElement { name: "Item F"; original: true }
+ }
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ border.color: "black"
+ }
+
+ }
+
+ ParticleSystem {
+ id: ps
+ ImageParticle {
+ id: imageparticle
+ source: "star.png"
+ color: "blue"
+ }
+ }
+ Column {
+ spacing: 2
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "+"; font.pixelSize: 25; font.bold: true }
+ MouseArea { anchors.fill: parent; onClicked: listview.model.insert(listview.currentIndex+1, {"name": "New item", "original": false } ) }
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "-"; font.pixelSize: 25; font.bold: true }
+ MouseArea { anchors.fill: parent; onClicked: listview.model.remove(listview.currentIndex) }
+ }
+ }
+}
+
+
+
diff --git a/tests/testapplications/listview/sections.qml b/tests/testapplications/listview/sections.qml
new file mode 100644
index 0000000000..72ea875a86
--- /dev/null
+++ b/tests/testapplications/listview/sections.qml
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ height: 400
+ width: 300
+ property int sets: 1
+
+ ListModel {
+ id: listmodel
+ Component.onCompleted: addNames()
+ }
+
+ ListView {
+ id: listview
+ model: listmodel
+ height: 300
+ width: 200
+ clip: true
+ anchors.centerIn: parent
+
+ section.delegate: del1
+ section.criteria: ViewSection.FirstCharacter
+ section.property: "name"
+ delegate: Rectangle {
+ height: 50
+ width: 200
+ color: "gold"
+ border.color: "black"
+ Text {
+ anchors.centerIn: parent
+ text: model.name+" ["+model.id+"]"
+ color: "black"
+ font.bold: true
+ }
+ }
+ }
+
+ function addNames() {
+ var names = ["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot",
+ "Golf","Hotel","India","Juliet","Kilo","Lima","Mike",
+ "November","Oscar","Papa","Quebec","Romeo","Sierra","Tango",
+ "Uniform","Victor","Whiskey","XRay","Yankee","Zulu"];
+ for (var i=0;i<names.length;++i)
+ listmodel.insert(sets*i, {"name":names[i], "id": "id"+i});
+ sets++;
+ }
+
+ Component {
+ id: del1
+ Rectangle {
+ height: 50
+ width: 200
+ color: "white"
+ border.color: "black"
+ border.width: 3
+ Text {
+ anchors.centerIn: parent
+ text: section
+ }
+ }
+ }
+
+ Component {
+ id: del2
+ Rectangle {
+ height: 50
+ width: 200
+ color: "lightsteelblue"
+ border.color: "orange"
+ Text {
+ anchors.centerIn: parent
+ text: section
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.fill: listview
+ color: "transparent"
+ border.color: "green"
+ border.width: 3
+ }
+
+ Row {
+ spacing: 3
+ Rectangle {
+ height: 40
+ width: 70
+ color: "blue"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "Criteria"
+ }
+ radius: 5
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ listview.section.criteria = listview.section.criteria == ViewSection.FirstCharacter ?
+ ViewSection.FullString : ViewSection.FirstCharacter
+ }
+ }
+ }
+ Rectangle {
+ height: 40
+ width: 70
+ color: "blue"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "Property"
+ }
+ radius: 5
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ listview.section.property = listview.section.property == "name" ? "id" : "name";
+ console.log(listview.section.property)
+ }
+ }
+ }
+ Rectangle {
+ height: 40
+ width: 75
+ color: "blue"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "Delegate"
+ }
+ radius: 5
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ console.log("Change delegate")
+ listview.section.delegate = listview.section.delegate == del1 ? del2 : del1
+ }
+ }
+ }
+ Rectangle {
+ height: 40
+ width: 40
+ color: "blue"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "+"
+ font.bold: true
+ }
+ radius: 5
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { addNames(); }
+ }
+ }
+ }
+}
diff --git a/tests/testapplications/listview/star.png b/tests/testapplications/listview/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/tests/testapplications/listview/star.png
Binary files differ
diff --git a/tests/testapplications/listview/viewTransitions.qml b/tests/testapplications/listview/viewTransitions.qml
new file mode 100644
index 0000000000..b4e62a4344
--- /dev/null
+++ b/tests/testapplications/listview/viewTransitions.qml
@@ -0,0 +1,479 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+Item {
+ id: root
+ width: 450; height: 600
+
+ property int currentSet: 0
+ property bool useStock: false
+
+ Component {
+ id: viewDelegate
+
+ Rectangle {
+ id: item
+ property bool movn: false
+ property int parts: 0
+
+ width: 225; height: 40
+ border.width: ListView.isCurrentItem ? 3 : 1
+ z: ListView.isCurrentItem ? 100 : 1
+ color: original ? "lightsteelblue" : "yellow"
+ objectName: name
+ Text { x: 10; text: name; font.pixelSize: 20 }
+ MouseArea { anchors.fill: parent; onClicked: listview.currentIndex = index }
+
+ Emitter {
+ id: emitter
+ system: ps
+ anchors.fill: parent
+ enabled: false
+ velocity: AngleDirection {
+ angle: 0
+ angleVariation: 360
+ magnitude: 50
+ magnitudeVariation: 50
+ }
+ }
+ Emitter {
+ id: emitter2
+ system: ps
+ anchors.fill: parent
+ enabled: item.movn
+ emitRate: parts
+ velocity: AngleDirection {
+ angle: 0
+ angleVariation: 360
+ magnitude: 2
+ magnitudeVariation: 5
+ }
+ }
+ }
+ }
+
+ ListView {
+ id: listview
+ width: 225; height: 500
+ anchors.centerIn: parent
+ delegate: viewDelegate
+ header: Rectangle {
+ height: 50; width: 225
+ color: "blue"
+ Text { anchors.centerIn: parent; text: "Transitions!"; color: "goldenrod" }
+ }
+ model: ListModel {
+ id: a_model
+ ListElement { name: "Item A"; original: true }
+ ListElement { name: "Item B"; original: true }
+ ListElement { name: "Item C"; original: true }
+ ListElement { name: "Item D"; original: true }
+ ListElement { name: "Item E"; original: true }
+ ListElement { name: "Item F"; original: true }
+ }
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ border.color: "black"
+ }
+
+ }
+
+ ParticleSystem {
+ id: ps
+ ImageParticle {
+ id: imageparticle
+ source: "star.png"
+ color: "red"
+ }
+ }
+
+
+ /* States (Selected operation Transitions) */
+ states: [
+ State {
+ name: "setA"
+ when: currentSet == 0
+ PropertyChanges {
+ target: listview
+ add: a_add
+ move: a_move
+ remove: a_remove
+ displaced: a_displaced
+ }
+ },
+ State {
+ name: "setB"
+ when: currentSet == 1
+ PropertyChanges {
+ target: listview
+ add: b_add
+ move: b_move
+ remove: b_remove
+ displaced: b_displaced
+ }
+ },
+ State {
+ name: "setC"
+ when: currentSet == 2
+ PropertyChanges {
+ target: listview
+ add: c_add
+ move: c_move
+ remove: c_remove
+ addDisplaced: c_addDisplaced
+ moveDisplaced: c_moveDisplaced
+ removeDisplaced: c_removeDisplaced
+ }
+ },
+ State {
+ name: "setD"
+ when: currentSet == 3
+ PropertyChanges {
+ target: listview
+ move: d_move
+ moveDisplaced: d_moveDisplaced
+ }
+ PropertyChanges {
+ target: root
+ useStock: true
+ }
+ }
+ ]
+
+ /* Transitions */
+ Transition {
+ id: a_add
+ ParallelAnimation {
+ NumberAnimation { target: a_add.ViewTransition.item; properties: "opacity"; from: 0; to: 1; duration: 1000 }
+ }
+ }
+ Transition {
+ id: a_remove
+ SequentialAnimation {
+ NumberAnimation { target: a_remove.ViewTransition.item; properties: "opacity"; from: 1; to: 0; duration: 1000 }
+ }
+ }
+ Transition {
+ id: a_move
+ ColorAnimation { target: a_move.ViewTransition.item; properties: "color"; to: "lightsteelblue"; duration: 1000 }
+ PathAnimation {
+ duration: 1000
+ target: a_move.ViewTransition.item
+ path: Path {
+ PathCurve { x: a_move.ViewTransition.destination.x + 150; y: a_move.ViewTransition.destination.y + 100 }
+ PathCurve { x: a_move.ViewTransition.destination.x + 150; y: a_move.ViewTransition.destination.y }
+ PathCurve { x: a_move.ViewTransition.destination.x; y: a_move.ViewTransition.destination.y }
+ }
+ }
+ }
+ Transition {
+ id: a_displaced
+ PropertyAction { target: a_displaced.ViewTransition.item; property: "color"; value: "lightsteelblue" }
+ ParallelAnimation {
+ NumberAnimation { target: a_displaced.ViewTransition.item; property: "opacity"; to: 1; duration: 250 }
+ SequentialAnimation {
+ PauseAnimation { duration: a_displaced.ViewTransition.index * 200 }
+ NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutQuad }
+ }
+ }
+ }
+
+
+ Transition {
+ id: b_add
+ SequentialAnimation {
+ NumberAnimation { target: b_add.ViewTransition.item; properties: "scale"; from: 1; to: 1.3; duration: 100 }
+ NumberAnimation { target: b_add.ViewTransition.item; properties: "scale"; from: 1.3; to: 1; duration: 500; easing.type: Easing.OutBounce }
+ }
+ }
+ Transition {
+ id: b_move
+ SequentialAnimation {
+ PauseAnimation { duration: b_move.ViewTransition.index * 100 }
+ ParallelAnimation {
+ ColorAnimation { target: b_move.ViewTransition.item; properties: "color"; from: "red"; to: "lightsteelblue"; duration: 2000 }
+ SequentialAnimation {
+ PathAnimation {
+ duration: 1000
+ target: b_move.ViewTransition.item
+ path: Path {
+ PathCurve { x: b_move.ViewTransition.destination.x + 150; y: b_move.ViewTransition.destination.y + 100 }
+ PathCurve { relativeX: 30; relativeY: -100 }
+ }
+ }
+ NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce }
+ }
+ }
+ }
+ }
+ Transition {
+ id: b_remove
+ SequentialAnimation {
+ NumberAnimation { target: b_remove.ViewTransition.item; properties: "opacity"; from: 1; to: 0; duration: 1000 }
+ }
+ }
+ Transition {
+ id: b_displaced
+ PropertyAction { target: b_displaced.ViewTransition.item; property: "color"; value: "lightsteelblue" }
+ SequentialAnimation {
+ PauseAnimation { duration: b_displaced.ViewTransition.item.x == 0 ? b_displaced.ViewTransition.index * 200 : 0 }
+ NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce }
+ }
+ }
+
+
+ Transition {
+ id: c_add
+ NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 }
+ NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 }
+ property int xoff
+ xoff: c_add.ViewTransition.index % 2 == 0 ? 200 : -200
+ PathAnimation {
+ duration: 1000
+ path: Path {
+ startX: c_add.ViewTransition.destination.x + c_add.xoff
+ startY: c_add.ViewTransition.destination.y + 200
+ PathCurve { relativeX: -100; relativeY: -50 }
+ PathCurve { relativeX: 50; relativeY: -150 }
+ PathCurve {
+ x: c_add.ViewTransition.destination.x
+ y: c_add.ViewTransition.destination.y
+ }
+ }
+ }
+ }
+ Transition {
+ id: c_move
+ ColorAnimation { target: c_move.ViewTransition.item; properties: "color"; from: "red"; to: "lightsteelblue"; duration: 1000 }
+ PathAnimation {
+ duration: 1000
+ target: c_move.ViewTransition.item
+ path: Path {
+ PathCurve { x: c_move.ViewTransition.destination.x + 150; y: c_move.ViewTransition.destination.y + 100 }
+ PathCurve { x: c_move.ViewTransition.destination.x + 150; y: c_move.ViewTransition.destination.y }
+ PathCurve { x: c_move.ViewTransition.destination.x; y: c_move.ViewTransition.destination.y }
+ }
+ }
+ }
+ Transition {
+ id: c_remove
+ PropertyAnimation { target: c_remove.ViewTransition.item; properties: "opacity"; to: 0; duration: 3000; easing.type: Easing.OutInBounce }
+ }
+ Transition {
+ id: c_addDisplaced
+
+ PropertyAction { property: "color"; value: "lightsteelblue" }
+ PropertyAction { property: "opacity"; value: 1.0 }
+ PropertyAction { property: "scale"; value: 1.0 }
+ SequentialAnimation {
+ PauseAnimation { duration: c_addDisplaced.ViewTransition.index * 200 }
+ NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutElastic }
+ }
+
+ }
+ Transition {
+ id: c_moveDisplaced
+
+ PropertyAction { property: "color"; value: "lightsteelblue" }
+ PropertyAction { property: "opacity"; value: 1.0 }
+ PropertyAction { property: "scale"; value: 1.0 }
+ SequentialAnimation {
+ NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce }
+ }
+
+ }
+ Transition {
+ id: c_removeDisplaced
+
+ PropertyAction { property: "color"; value: "lightsteelblue" }
+ PropertyAction { property: "opacity"; value: 1.0 }
+ PropertyAction { property: "scale"; value: 1.0 }
+ SequentialAnimation {
+ PauseAnimation { duration: (c_removeDisplaced.ViewTransition.index * 200) + 3000 }
+ NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutElastic }
+ }
+
+ }
+ Transition {
+ id: d_move
+ SequentialAnimation {
+ PropertyAction { target: d_move.ViewTransition.item; property: "movn"; value: true }
+ ParallelAnimation {
+ NumberAnimation { target: d_move.ViewTransition.item; properties: "opacity"; to: 0; duration: 2000 }
+ NumberAnimation { target: d_move.ViewTransition.item; properties: "parts"; to: 500; duration: 2000 }
+ }
+ NumberAnimation { properties: "x,y"; duration: 1000*(d_move.ViewTransition.index+1) }
+ ParallelAnimation {
+ NumberAnimation { target: d_move.ViewTransition.item; properties: "opacity"; to: 1; duration: 2000 }
+ NumberAnimation { target: d_move.ViewTransition.item; properties: "parts"; to: 0; duration: 2000 }
+ }
+ PropertyAction { target: d_move.ViewTransition.item; property: "movn"; value: false }
+ }
+ }
+
+ Transition {
+ id: d_moveDisplaced
+ PropertyAction { target: d_moveDisplaced.ViewTransition.item; property: "color"; value: "lightsteelblue" }
+ SequentialAnimation {
+ PauseAnimation { duration: 500*(d_moveDisplaced.ViewTransition.index+1) }
+ NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutQuad }
+ }
+ }
+
+ /* Buttons */
+ Column {
+ spacing: 2
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "To Top" }
+ MouseArea { anchors.fill: parent; onClicked: listview.model.move(listview.currentIndex, 0, 1) }
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "Add" }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: listview.model.insert(listview.currentIndex+1, {"name": "New item", "original": false } )
+ }
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "Remove" }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: listview.model.remove(listview.currentIndex)
+ }
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "Append" }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: listview.model.append({"name": "New item", "original": false })
+ }
+ }
+ }
+ Column {
+ spacing: 2
+ anchors.right: parent.right
+ anchors.rightMargin: 2
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: currentSet == 0 ? "green" : "lightgray"
+ ColorAnimation on color { duration: 1000 }
+ }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "Set A" }
+ MouseArea { anchors.fill: parent; onClicked: { currentSet = 0 } }
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: currentSet == 1 ? "green" : "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "Set B" }
+ MouseArea { anchors.fill: parent; onClicked: { currentSet = 1 } }
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: currentSet == 2 ? "green" : "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "Set C" }
+ MouseArea { anchors.fill: parent; onClicked: { currentSet = 2 } }
+ }
+ Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "darkgray" }
+ GradientStop { position: 0.5; color: currentSet == 3 ? "green" : "lightgray" }
+ GradientStop { position: 1.0; color: "darkgray" }
+ }
+ radius: 6
+ border.color: "black"
+ height: 50; width: 80
+ Text { anchors.centerIn: parent; text: "Set D" }
+ MouseArea { anchors.fill: parent; onClicked: { currentSet = 3 } }
+ }
+ }
+}
diff --git a/tests/testapplications/qsgimage/ImageNG.qml b/tests/testapplications/qsgimage/ImageNG.qml
new file mode 100644
index 0000000000..f5717042d5
--- /dev/null
+++ b/tests/testapplications/qsgimage/ImageNG.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ property bool explicitSize: true
+ property alias label: lb.text
+
+ width: explicitSize ? 200 : undefined; height: explicitSize ? 150 : undefined
+ smooth: true
+
+ Rectangle {
+ border.color: "red"; color: "transparent"
+ anchors.fill: parent
+ }
+
+ Text {
+ id: lb
+ anchors.top: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.topMargin: 4
+ }
+}
diff --git a/tests/testapplications/qsgimage/img-align.qml b/tests/testapplications/qsgimage/img-align.qml
new file mode 100644
index 0000000000..2d7bfc1356
--- /dev/null
+++ b/tests/testapplications/qsgimage/img-align.qml
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 800; height: 600
+ focus: true
+ color: "#eeeeee"
+
+ property variant hAlign: Image.AlignHCenter
+ property variant vAlign: Image.AlignVCenter
+ property bool mirror: false
+ property string source: "qt-logo.png"
+
+ Flow {
+ anchors.fill: parent
+ anchors { topMargin: 20; leftMargin: 20; rightMargin: 20 }
+ spacing: 30
+
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ mirror: main.mirror; source: main.source
+ explicitSize: false
+ label: "implicit size"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ mirror: main.mirror; source: main.source
+ label: "explicit size"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.Pad
+ mirror: main.mirror; source: main.source
+ label: "padding"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.Tile
+ mirror: main.mirror; source: main.source
+ label: "tile"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.TileHorizontally
+ mirror: main.mirror; source: main.source
+ label: "tile horizontally"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.TileVertically
+ mirror: main.mirror; source: main.source
+ label: "tile vertically"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectFit
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect fit"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectFit
+ width: 150; height: 200
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect fit"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectCrop
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect crop"
+ }
+ ImageNG {
+ horizontalAlignment: main.hAlign; verticalAlignment: main.vAlign
+ fillMode: Image.PreserveAspectCrop
+ width: 150; height: 200
+ mirror: main.mirror; source: main.source
+ label: "preserve aspect crop"
+ }
+ }
+
+ Keys.onUpPressed: vAlign = Image.AlignTop
+ Keys.onDownPressed: vAlign = Image.AlignBottom
+ Keys.onLeftPressed: hAlign = Image.AlignLeft
+ Keys.onRightPressed: hAlign = Image.AlignRight
+ Keys.onPressed: {
+ if (event.key == Qt.Key_H)
+ hAlign = Image.AlignHCenter
+ else if (event.key == Qt.Key_V)
+ vAlign = Image.AlignVCenter
+ }
+}
diff --git a/tests/testapplications/qsgimage/qt-logo.png b/tests/testapplications/qsgimage/qt-logo.png
new file mode 100644
index 0000000000..14ddf2a028
--- /dev/null
+++ b/tests/testapplications/qsgimage/qt-logo.png
Binary files differ
diff --git a/tests/testapplications/text/Button.qml b/tests/testapplications/text/Button.qml
new file mode 100644
index 0000000000..c3025b752b
--- /dev/null
+++ b/tests/testapplications/text/Button.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+MouseArea {
+ property string buttontext: ""
+ width: parent.width / 4
+ height: parent.height - 4
+ Rectangle {
+ anchors.fill: parent
+ radius: 5
+ color: "lightgray"
+ border.color: "black"
+ }
+ Text {
+ anchors.centerIn: parent
+ text: buttontext
+ color: "black"
+ }
+} \ No newline at end of file
diff --git a/tests/testapplications/text/ControlView.qml b/tests/testapplications/text/ControlView.qml
new file mode 100644
index 0000000000..e931eac9de
--- /dev/null
+++ b/tests/testapplications/text/ControlView.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListView {
+ id: controlviewitem
+ property string controlname: ""
+ property variant controlvalue
+ signal reset
+ height: 40; width: 200; highlightRangeMode: ListView.StrictlyEnforceRange
+ orientation: ListView.Horizontal; snapMode: ListView.SnapOneItem
+ preferredHighlightBegin: 50; preferredHighlightEnd: 150;
+ delegate: Rectangle { height: 40; width: 100; border.color: "black"
+ Text { anchors.centerIn: parent; width: parent.width; text: model.name; elide: Text.ElideRight; horizontalAlignment: Text.AlignHCenter } }
+ header: headfoot
+ footer: headfoot
+ Component {
+ id: headfoot
+ Rectangle {
+ MouseArea { id: resetbutton; anchors.fill: parent; onClicked: { reset(); } }
+ color: "lightgray"; height: 40; width: 50; border.color: "gray"
+ Text { id: headertext; anchors.centerIn: parent; wrapMode: Text.WrapAnywhere
+ rotation: -40; text: controlviewitem.controlname; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter }
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/testapplications/text/text.qml b/tests/testapplications/text/text.qml
new file mode 100644
index 0000000000..56ca825d0a
--- /dev/null
+++ b/tests/testapplications/text/text.qml
@@ -0,0 +1,310 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ height: 360; width: 640
+
+ Connections { target: pointvalue; onReset: { textelement.font.pointSize = 12 } }
+
+ Item {
+ id: textpanel
+
+ anchors.fill: parent
+ anchors.rightMargin: controlpanel.width
+
+ Text {
+ id: textelement
+ height: parent.height - 20; width: parent.width - 20
+ anchors.centerIn: parent
+ anchors.fill: parent;
+ anchors.margins: 10
+
+ text: { textvalue.model.get(textvalue.currentIndex).value }
+ textFormat: { formatvalue.model.get(formatvalue.currentIndex).value }
+ color: { colorvalue.model.get(colorvalue.currentIndex).value }
+ elide: { elidevalue.model.get(elidevalue.currentIndex).value }
+ font.bold: { boldvalue.model.get(boldvalue.currentIndex).value }
+ font.italic: { italicsvalue.model.get(italicsvalue.currentIndex).value }
+ font.capitalization: { capsvalue.model.get(capsvalue.currentIndex).value }
+ font.family: { familyvalue.model.get(familyvalue.currentIndex).value }
+ font.strikeout: strikeoutvalue.currentIndex
+ font.underline: underlinevalue.currentIndex
+ font.letterSpacing: { lspacingvalue.model.get(lspacingvalue.currentIndex).value }
+ font.wordSpacing: { wspacingvalue.model.get(wspacingvalue.currentIndex).value }
+ font.weight: { weightvalue.model.get(weightvalue.currentIndex).value }
+ font.pointSize: { pointvalue.model.get(pointvalue.currentIndex).value }
+ font.pixelSize: { pixelvalue.model.get(pixelvalue.currentIndex).value }
+ horizontalAlignment: { halignvalue.model.get(halignvalue.currentIndex).value }
+ verticalAlignment: { valignvalue.model.get(valignvalue.currentIndex).value }
+ wrapMode: { wrapvalue.model.get(wrapvalue.currentIndex).value }
+ maximumLineCount: { maxlinevalue.model.get(maxlinevalue.currentIndex).value }
+ lineHeight: { lineheightvalue.model.get(lineheightvalue.currentIndex).value }
+ lineHeightMode: { lineheightmodevalue.model.get(lineheightmodevalue.currentIndex).value }
+ smooth: { smoothvalue.model.get(smoothvalue.currentIndex).value }
+ style: { stylevalue.model.get(stylevalue.currentIndex).value }
+ styleColor: { stylecolorvalue.model.get(stylecolorvalue.currentIndex).value }
+ fontSizeMode : { fontsizemodevalue.model.get(fontsizemodevalue.currentIndex).value }
+ minimumPointSize : { minimumpointsizevalue.model.get(minimumpointsizevalue.currentIndex).value }
+
+ Rectangle{ color: "transparent"; border.color: "green"; anchors.fill: parent }
+ }
+
+ Text {
+ id: infopanel
+ anchors { left: parent.left; leftMargin: 10; bottom: parent.bottom }
+ height: 150; color: "black"; width: 150
+ function elidename() {
+ switch (textelement.elide) {
+ case Text.ElideNone: return "None";
+ case Text.ElideLeft: return "Left";
+ case Text.ElideMiddle: return "Middle";
+ case Text.ElideRight: return "Right";
+ }
+ }
+ text:
+ "LineCount: "+textelement.lineCount+" of "+textelement.maximumLineCount+
+ "\nPaintedHeight/Width: "+textelement.paintedHeight+"/"+textelement.paintedWidth+
+ "\nPointSize: "+textelement.font.pointSize+
+ "\nPixelSize: "+textelement.font.pixelSize+
+ "\nTruncated: "+textelement.truncated+
+ "\nElide: "+ elidename()
+
+ }
+ }
+
+ Item {
+ id: controlpanel
+ width: 200; height: parent.height
+ anchors.right: parent.right
+ Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
+ ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
+ VisualItemModel {
+ id: controlsmodel
+ ControlView {
+ id: textvalue
+ controlname: "Text"
+ model: textmodel
+ ListModel { id: textmodel }
+ Component.onCompleted: {
+ textmodel.append({ "name": "Basic",
+ "value": "Qt Quick is a collection of technologies that are designed to help developers create the kind of intuitive, "+
+ "modern, fluid user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
+ "portable devices.\n"+
+ "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
+ "and a language runtime. "+
+ "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
+ textmodel.append({ "name": "Short",
+ "value": "Button Text."});
+ textmodel.append({ "name": "Long",
+ "value": "QtQuickisacollectionoftechnologiesthataredesignedtohelpdeveloperscreatethekindofintuitive,"+
+ "modern,fluiduserinterfacesthatareincreasinglyusedonmobilephones,mediaplayers,set-topboxesandother"+
+ "portabledevices."});
+ textmodel.append({ "name": "Rich",
+ "value": "<b>Qt Quick</b> is a collection of technologies that are designed to help developers create the kind of <i>intuitive, "+
+ "modern, fluid</i> user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
+ "portable devices.<br>"+
+ "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
+ "and a language runtime. "+
+ "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
+ }
+ }
+ ControlView {
+ id: formatvalue
+ controlname: "Format"
+ model: ListModel { ListElement { name: "Auto"; value: Text.AutoText } ListElement { name: "Plain"; value: Text.PlainText }
+ ListElement { name: "Rich"; value: Text.RichText } ListElement { name: "Styled"; value: Text.StyledText } } }
+ ControlView {
+ id: colorvalue
+ controlname: "Color"
+ model: ListModel { ListElement { name: "Red"; value: "red" }
+ ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } }
+ }
+ ControlView {
+ id: elidevalue
+ controlname: "Elide"
+ model: ListModel { ListElement { name: "None"; value: Text.ElideNone } ListElement { name: "Left"; value: Text.ElideLeft }
+ ListElement { name: "Middle"; value: Text.ElideMiddle } ListElement { name: "Right"; value: Text.ElideRight } }
+ }
+ ControlView {
+ id: boldvalue
+ controlname: "Bold"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
+ }
+ ControlView {
+ id: italicsvalue
+ controlname: "Italic"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
+ }
+ ControlView {
+ id: capsvalue
+ controlname: "Cap10n"
+ model: ListModel {
+ ListElement { name: "Mixed"; value: Font.MixedCase } ListElement { name: "Upper"; value: Font.AllUppercase }
+ ListElement { name: "Lower"; value: Font.AllLowercase } ListElement { name: "SmallCaps"; value: Font.SmallCaps }
+ ListElement { name: "Capitals"; value: Font.Capitalize }
+ }
+ }
+ ControlView {
+ id: familyvalue
+ controlname: "Font"
+ property variant fontfamilies
+ function setModel() {
+ familiesmodel.clear();
+ for (var i = 0; i < fontfamilies.length; ++i) {
+ familiesmodel.append({ "name": fontfamilies[i], "value": fontfamilies[i] });
+ }
+ familyvalue.currentIndex = 0;
+ }
+ model: familiesmodel
+ ListModel { id: familiesmodel }
+ Component.onCompleted: { fontfamilies = Qt.fontFamilies(); setModel(); }
+ }
+ ControlView {
+ id: lspacingvalue
+ controlname: "LSpacing"
+ model: ListModel { ListElement { name: "0"; value: 0 } ListElement { name: "1"; value: 1 } ListElement { name: "2.5"; value: 2.5 } } }
+ ControlView {
+ id: wspacingvalue
+ controlname: "WSpacing"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
+ ControlView {
+ id: pixelvalue
+ controlname: "Pixel"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } ListElement { name: "50"; value: 20 } } }
+ ControlView {
+ id: pointvalue
+ controlname: "Point"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } ListElement { name: "50"; value: 20 } } }
+ ControlView {
+ id: strikeoutvalue
+ controlname: "Strike"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: underlinevalue
+ controlname: "U_line"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: weightvalue
+ controlname: "Weight"
+ model: ListModel { ListElement { name: "Light"; value: Font.Light } ListElement { name: "Normal"; value: Font.Normal }
+ ListElement { name: "DemiBold"; value: Font.DemiBold } ListElement { name: "Bold"; value: Font.Bold }
+ ListElement { name: "Black"; value: Font.Black } }
+ Component.onCompleted: { currentIndex = 1 } // set to default
+ }
+ ControlView {
+ id: halignvalue
+ controlname: "HAlign"
+ model: ListModel { ListElement { name: "Left"; value: Text.AlignLeft } ListElement { name: "Right"; value: Text.AlignRight }
+ ListElement { name: "Center"; value: Text.AlignHCenter } ListElement { name: "Justify"; value: Text.AlignJustify } } }
+ ControlView {
+ id: valignvalue
+ controlname: "VAlign"
+ model: ListModel { ListElement { name: "Top"; value: Text.AlignTop } ListElement { name: "Bottom"; value: Text.AlignBottom }
+ ListElement { name: "Center"; value: Text.AlignVCenter } } }
+ ControlView {
+ id: maxlinevalue
+ controlname: "Lines"
+ model: ListModel { ListElement { name: "Max"; value: 2147483647 } ListElement { name: "1"; value: 1 }
+ ListElement { name: "2"; value: 2 } ListElement { name: "10"; value: 10 }} }
+ ControlView {
+ id: lineheightvalue
+ controlname: "LHeight"
+ model: ListModel { ListElement { name: "1"; value: 1.0 } ListElement { name: "2"; value: 2.0 } ListElement { name: "30"; value: 30.0 }} }
+ ControlView {
+ id: lineheightmodevalue
+ controlname: "LHMode"
+ model: ListModel {
+ ListElement { name: "Multiply"; value: Text.ProportionalHeight } ListElement { name: "Fixed"; value: Text.FixedHeight } } }
+ ControlView {
+ id: smoothvalue
+ controlname: "Smooth"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: stylevalue
+ controlname: "Style"
+ model: ListModel { ListElement { name: "Normal"; value: Text.Normal } ListElement { name: "Outline"; value: Text.Outline }
+ ListElement { name: "Raised"; value: Text.Raised } ListElement { name: "Sunken"; value: Text.Sunken } } }
+ ControlView {
+ id: stylecolorvalue
+ controlname: "SColor"
+ model: ListModel { ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } } }
+ ControlView {
+ id: wrapvalue
+ controlname: "Wrap"
+ model: ListModel { ListElement { name: "None"; value: Text.NoWrap } ListElement { name: "Word"; value: Text.WordWrap }
+ ListElement { name: "Anywhere"; value: Text.WrapAnywhere } ListElement { name: "Wrap"; value: Text.Wrap } } }
+ ControlView {
+ id: fontsizemodevalue
+ controlname: "FontSize"
+ model: ListModel { ListElement { name: "FixedSize"; value: Text.FixedSize } ListElement { name: "Horizontal"; value: Text.HorizontalFit }
+ ListElement { name: "Vertical"; value: Text.VerticalFit } ListElement { name: "Fit"; value: Text.Fit } } }
+ ControlView {
+ id: minimumpixelsizevalue
+ controlname: "MinPixelSize"
+ model: ListModel { ListElement { name: "8"; value: 8 } ListElement { name: "12"; value: 12 }
+ ListElement { name: "24"; value: 24 } ListElement { name: "32"; value: 32 } } }
+ ControlView {
+ id: minimumpointsizevalue
+ controlname: "MinPointSize"
+ model: ListModel { ListElement { name: "8"; value: 8 } ListElement { name: "12"; value: 12 }
+ ListElement { name: "24"; value: 24 } ListElement { name: "32"; value: 32 } } }
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/testapplications/text/textedit.qml b/tests/testapplications/text/textedit.qml
new file mode 100644
index 0000000000..e0d7dbdde4
--- /dev/null
+++ b/tests/testapplications/text/textedit.qml
@@ -0,0 +1,273 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Rectangle {
+ height: 360; width: 640
+ property int intmax: 2147483647
+
+ Connections { target: pointvalue; onReset: { texteditelement.font.pointSize = 12 } }
+
+ Item {
+ id: textpanel
+ height: 360
+ width: 440
+ TextEdit {
+ id: texteditelement
+ height: parent.height - 20; width: parent.width - 20
+ anchors.centerIn: parent
+
+ text: { textvalue.model.get(textvalue.currentIndex).value }
+ textFormat: { formatvalue.model.get(formatvalue.currentIndex).value }
+ color: { colorvalue.model.get(colorvalue.currentIndex).value }
+ font.bold: { boldvalue.model.get(boldvalue.currentIndex).value }
+ font.italic: { italicsvalue.model.get(italicsvalue.currentIndex).value }
+ font.capitalization: { capsvalue.model.get(capsvalue.currentIndex).value }
+ font.family: { familyvalue.model.get(familyvalue.currentIndex).value }
+ font.strikeout: strikeoutvalue.currentIndex
+ font.underline: underlinevalue.currentIndex
+ font.letterSpacing: { lspacingvalue.model.get(lspacingvalue.currentIndex).value }
+ font.wordSpacing: { wspacingvalue.model.get(wspacingvalue.currentIndex).value }
+ font.weight: { weightvalue.model.get(weightvalue.currentIndex).value }
+ font.pointSize: { pointvalue.model.get(pointvalue.currentIndex).value }
+ font.pixelSize: { pixelvalue.model.get(pixelvalue.currentIndex).value }
+ horizontalAlignment: { halignvalue.model.get(halignvalue.currentIndex).value }
+ verticalAlignment: { valignvalue.model.get(valignvalue.currentIndex).value }
+ wrapMode: { wrapvalue.model.get(wrapvalue.currentIndex).value }
+ smooth: { smoothvalue.model.get(smoothvalue.currentIndex).value }
+ selectByMouse: { mousevalue.model.get(mousevalue.currentIndex).value }
+ selectByKeyboard: { keyboardvalue.model.get(keyboardvalue.currentIndex).value }
+ onLinkActivated: { bordercolor.border.color = "red" }
+ Rectangle { id: bordercolor; color: "transparent"; border.color: "green"; anchors.fill: parent }
+ }
+
+ Text {
+ id: infopanel
+ anchors { left: parent.left; leftMargin: 10; bottom: parent.bottom }
+ height: 150; color: "black"; width: 150
+ text:
+ "LineCount: "+texteditelement.lineCount+
+ "\nPaintedHeight/Width: "+texteditelement.paintedHeight+"/"+texteditelement.paintedWidth+
+ "\nPointSize: "+texteditelement.font.pointSize+"\nPixelSize: "+texteditelement.font.pixelSize+
+ "\nCan Paste: "+texteditelement.canPaste
+ }
+ Row {
+ id: selectionbuttons
+ height:40
+ width: 300
+ anchors.right: texteditelement.right; anchors.bottom: texteditelement.bottom
+ Button { buttontext: "Select Word"; width: parent.width/3; onClicked: { texteditelement.selectWord() } }
+ Button { buttontext: "Select All"; width: parent.width/3; onClicked: { texteditelement.selectAll() } }
+ Button { buttontext: "Select None"; width: parent.width/3; onClicked: { texteditelement.deselect() } }
+ }
+ Row {
+ height:40
+ width: 300
+ anchors.right: texteditelement.right; anchors.bottom: selectionbuttons.top
+ Button { buttontext: "Cut"; width: parent.width/3; onClicked: { texteditelement.cut() } }
+ Button { buttontext: "Copy"; width: parent.width/3; onClicked: { texteditelement.copy() } }
+ Button { buttontext: "Paste"; width: parent.width/3; onClicked: { texteditelement.paste() } }
+ }
+ }
+
+ Item {
+ id: controlpanel
+ width: 200; height: parent.height
+ anchors.right: parent.right
+ Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
+ ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
+ VisualItemModel {
+ id: controlsmodel
+ ControlView {
+ id: textvalue
+ controlname: "Text"
+ model: textmodel
+ ListModel { id: textmodel }
+ Component.onCompleted: {
+ textmodel.append({ "name": "Basic",
+ "value": "Qt Quick is a collection of technologies that are designed to help developers create the kind of intuitive, "+
+ "modern, fluid user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
+ "portable devices."+texteditelement.newline+
+ "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
+ "and a language runtime.\n"+
+ "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
+ textmodel.append({ "name": "Short",
+ "value": "Hello World"});
+ textmodel.append({ "name": "Long",
+ "value": "QtQuickisacollectionoftechnologiesthataredesignedtohelpdeveloperscreatethekindofintuitive,"+
+ "modern,fluiduserinterfacesthatareincreasinglyusedonmobilephones,mediaplayers,set-topboxesandother"+
+ "portabledevices."});
+ textmodel.append({ "name": "Rich",
+ "value": "<b>Qt Quick</b> is a collection of technologies that are designed to help developers create the kind of <i>intuitive, "+
+ "modern, fluid</i> user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
+ "portable devices.<br>"+
+ "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
+ "and a language runtime. "+
+ "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
+ textmodel.append({ "name": "Links",
+ "value": "This is a link - <a href=\"http://doc.qt.nokia.com\">Qt Docs</a>"});
+ }
+ }
+ ControlView {
+ id: formatvalue
+ controlname: "Format"
+ model: ListModel { ListElement { name: "Auto"; value: Text.AutoText } ListElement { name: "Plain"; value: Text.PlainText }
+ ListElement { name: "Rich"; value: Text.RichText } ListElement { name: "Styled"; value: Text.StyledText } } }
+ ControlView {
+ id: colorvalue
+ controlname: "Color"
+ model: ListModel { ListElement { name: "Red"; value: "red" }
+ ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } }
+ }
+ ControlView {
+ id: boldvalue
+ controlname: "Bold"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
+ }
+ ControlView {
+ id: italicsvalue
+ controlname: "Italic"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
+ }
+ ControlView {
+ id: capsvalue
+ controlname: "Cap10n"
+ model: ListModel {
+ ListElement { name: "Mixed"; value: Font.MixedCase } ListElement { name: "Upper"; value: Font.AllUppercase }
+ ListElement { name: "Lower"; value: Font.AllLowercase } ListElement { name: "SmallCaps"; value: Font.SmallCaps }
+ ListElement { name: "Capitals"; value: Font.Capitalize }
+ }
+ }
+ ControlView {
+ id: familyvalue
+ controlname: "Font"
+ property variant fontfamilies
+ function setModel() {
+ familiesmodel.clear();
+ for (var i = 0; i < fontfamilies.length; ++i) {
+ familiesmodel.append({ "name": fontfamilies[i], "value": fontfamilies[i] });
+ }
+ familyvalue.currentIndex = 0;
+ }
+ model: familiesmodel
+ ListModel { id: familiesmodel }
+ Component.onCompleted: { fontfamilies = Qt.fontFamilies(); setModel(); }
+ }
+ ControlView {
+ id: lspacingvalue
+ controlname: "LSpacing"
+ model: ListModel { ListElement { name: "0"; value: 0 } ListElement { name: "1"; value: 1 } ListElement { name: "2.5"; value: 2.5 } } }
+ ControlView {
+ id: wspacingvalue
+ controlname: "WSpacing"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
+ ControlView {
+ id: pixelvalue
+ controlname: "Pixel"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
+ ControlView {
+ id: pointvalue
+ controlname: "Point"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
+ ControlView {
+ id: strikeoutvalue
+ controlname: "Strike"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: underlinevalue
+ controlname: "U_line"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: weightvalue
+ controlname: "Weight"
+ model: ListModel { ListElement { name: "Light"; value: Font.Light } ListElement { name: "Normal"; value: Font.Normal }
+ ListElement { name: "DemiBold"; value: Font.DemiBold } ListElement { name: "Bold"; value: Font.Bold }
+ ListElement { name: "Black"; value: Font.Black } }
+ Component.onCompleted: { currentIndex = 1 } // set to default
+ }
+ ControlView {
+ id: mousevalue
+ controlname: "Mouse"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: keyboardvalue
+ controlname: "Keyboard"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: halignvalue
+ controlname: "HAlign"
+ model: ListModel { ListElement { name: "Left"; value: Text.AlignLeft } ListElement { name: "Right"; value: Text.AlignRight }
+ ListElement { name: "Center"; value: Text.AlignHCenter } ListElement { name: "Justify"; value: Text.AlignJustify } } }
+ ControlView {
+ id: valignvalue
+ controlname: "VAlign"
+ model: ListModel { ListElement { name: "Top"; value: Text.AlignTop } ListElement { name: "Bottom"; value: Text.AlignBottom }
+ ListElement { name: "Center"; value: Text.AlignVCenter } } }
+ ControlView {
+ id: smoothvalue
+ controlname: "Smooth"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: wrapvalue
+ controlname: "Wrap"
+ model: ListModel { ListElement { name: "None"; value: Text.NoWrap } ListElement { name: "Word"; value: Text.WordWrap }
+ ListElement { name: "Anywhere"; value: Text.WrapAnywhere } ListElement { name: "Wrap"; value: Text.Wrap } } }
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/testapplications/text/textinput.qml b/tests/testapplications/text/textinput.qml
new file mode 100644
index 0000000000..556771bcb5
--- /dev/null
+++ b/tests/testapplications/text/textinput.qml
@@ -0,0 +1,345 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ height: 360; width: 640
+
+ Connections { target: pointvalue; onReset: { textinputelement.font.pointSize = 12 } }
+
+ Item {
+ id: textpanel
+ height: 360
+ width: 440
+ MouseArea { anchors.fill: parent; onClicked: textinputelement.focus = false }
+ TextInput {
+ id: textinputelement
+ height: 50; width: parent.width - 20
+ anchors.centerIn: parent
+ focus: true
+ property int validatorval
+ validatorval: { validvalue.model.get(validvalue.currentIndex).value }
+ text: { textvalue.model.get(textvalue.currentIndex).value }
+ autoScroll: { autoscrollvalue.model.get(autoscrollvalue.currentIndex).value }
+ color: { colorvalue.model.get(colorvalue.currentIndex).value }
+ font.bold: { boldvalue.model.get(boldvalue.currentIndex).value }
+ font.italic: { italicsvalue.model.get(italicsvalue.currentIndex).value }
+ font.capitalization: { capsvalue.model.get(capsvalue.currentIndex).value }
+ font.family: { familyvalue.model.get(familyvalue.currentIndex).value }
+ font.strikeout: strikeoutvalue.currentIndex
+ font.underline: underlinevalue.currentIndex
+ font.letterSpacing: { lspacingvalue.model.get(lspacingvalue.currentIndex).value }
+ font.wordSpacing: { wspacingvalue.model.get(wspacingvalue.currentIndex).value }
+ font.weight: { weightvalue.model.get(weightvalue.currentIndex).value }
+ font.pointSize: { pointvalue.model.get(pointvalue.currentIndex).value }
+ font.pixelSize: { pixelvalue.model.get(pixelvalue.currentIndex).value }
+ horizontalAlignment: { halignvalue.model.get(halignvalue.currentIndex).value }
+ verticalAlignment: { valignvalue.model.get(valignvalue.currentIndex).value }
+ wrapMode: { wrapvalue.model.get(wrapvalue.currentIndex).value }
+ smooth: { smoothvalue.model.get(smoothvalue.currentIndex).value }
+ selectByMouse: { mousevalue.model.get(mousevalue.currentIndex).value }
+ echoMode: { echovalue.model.get(echovalue.currentIndex).value }
+ cursorVisible: { cursorvisiblevalue.model.get(cursorvisiblevalue.currentIndex).value }
+ cursorDelegate: cursordelegate
+ onValidatorvalChanged: {
+ //console.log(validatorval);
+ if (validatorval == 0)
+ validator = intval;
+ else if (validatorval == 1)
+ validator = dubval;
+ else if (validatorval == 2)
+ validator = regval;
+ else
+ validator = noval;
+ }
+ IntValidator { id: intval; top: 30; bottom: 12 }
+ DoubleValidator { id: dubval; top: 30; bottom: 12 }
+ RegExpValidator { id: regval; regExp: /Qt/ }
+ RegExpValidator { id: noval; regExp: /.*/ }
+ Rectangle{ color: "transparent"; border.color: "green"; anchors.fill: parent }
+ }
+
+ Row {
+ id: buttonrow
+ height: 40
+ width: parent.width - 20
+ anchors.left: textinputelement.left
+ anchors.bottom: buttonrow2.top; anchors.bottomMargin: 2
+ Button { buttontext: "Select Word"; onClicked: { textinputelement.selectWord() } }
+ Button { buttontext: "Select All"; onClicked: { textinputelement.selectAll() } }
+ Button { buttontext: "Select to 5"; onClicked: { textinputelement.moveCursorSelection(5) } }
+ Button { buttontext: "Select None"; onClicked: { textinputelement.deselect() } }
+ }
+ Row {
+ id: buttonrow2
+ height: 40
+ width: parent.width - 20
+ anchors.left: textinputelement.left
+ anchors.bottom: buttonrow3.top; anchors.bottomMargin: 2
+ Button { buttontext: "Cut"; onClicked: { textinputelement.cut() } }
+ Button { buttontext: "Copy"; onClicked: { textinputelement.copy() } }
+ Button { buttontext: "Paste"; onClicked: { textinputelement.paste() } }
+ }
+ Row {
+ id: buttonrow3
+ height: 40
+ width: parent.width - 20
+ anchors.left: textinputelement.left
+ anchors.bottom: textinputelement.top; anchors.bottomMargin: 2
+ Button { buttontext: "Position 12px"; onClicked: { textinputelement.cursorPosition = textinputelement.positionAt(12) } }
+ Button { buttontext: "Select 3-6"; onClicked: { textinputelement.select(3,6) } }
+ Button { buttontext: "Position End"; onClicked: { textinputelement.cursorPosition = textinputelement.text.length } }
+ }
+ Component {
+ id: cursordelegate
+ Rectangle {
+ id: cursordelegaterect
+ height: 48; width: 3; color: "red"; visible: parent.cursorVisible
+ SequentialAnimation on opacity { running: true; loops: Animation.Infinite
+ NumberAnimation { to: 0; duration: 1000 }
+ NumberAnimation { to: 1; duration: 1000 }
+ }
+ }
+ }
+
+ Text {
+ id: infopanel
+ anchors { left: parent.left; leftMargin: 10; bottom: parent.bottom }
+ height: 150; color: "black"; width: 150
+ text:
+ "\nPointSize: "+textinputelement.font.pointSize+
+ "\nPixelSize: "+textinputelement.font.pixelSize+
+ "\nAcceptable Input: "+textinputelement.acceptableInput+
+ "\nCan Paste: "+textinputelement.canPaste+
+ "\nCursor Position: "+textinputelement.cursorPosition+
+ "\nRight to Left: "+textinputelement.isRightToLeft(0,textinputelement.text.length);
+ }
+ }
+
+ Item {
+ id: controlpanel
+ width: 200; height: parent.height
+ anchors.right: parent.right
+ Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
+ ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
+ VisualItemModel {
+ id: controlsmodel
+ ControlView {
+ id: textvalue
+ controlname: "Text"
+ model: textmodel
+ ListModel { id: textmodel }
+ Component.onCompleted: {
+ textmodel.append({ "name": "Basic", "value": "The TextInput item displays an editable line of text."});
+ textmodel.append({ "name": "Short", "value": "Hello World"});
+ textmodel.append({ "name": "Long",
+ "value": "Qt Quick is a collection of technologies that are designed to help developers create the kind of intuitive, "+
+ "modern, fluid user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
+ "portable devices. "+
+ "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
+ "and a language runtime. "+
+ "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
+ }
+ }
+ ControlView {
+ id: autoscrollvalue
+ controlname: "AutoScroll"
+ model: ListModel { ListElement { name: "On"; value: true } ListElement { name: "Off"; value: false } }
+ }
+ ControlView {
+ id: colorvalue
+ controlname: "Color"
+ model: ListModel { ListElement { name: "Red"; value: "red" }
+ ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } }
+ }
+ ControlView {
+ id: elidevalue
+ controlname: "Elide"
+ model: ListModel { ListElement { name: "None"; value: Text.ElideNone } ListElement { name: "Left"; value: Text.ElideLeft }
+ ListElement { name: "Middle"; value: Text.ElideMiddle } ListElement { name: "Right"; value: Text.ElideRight } }
+ }
+ ControlView {
+ id: boldvalue
+ controlname: "Bold"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
+ }
+ ControlView {
+ id: italicsvalue
+ controlname: "Italic"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
+ }
+ ControlView {
+ id: capsvalue
+ controlname: "Cap10n"
+ model: ListModel {
+ ListElement { name: "Mixed"; value: Font.MixedCase } ListElement { name: "Upper"; value: Font.AllUppercase }
+ ListElement { name: "Lower"; value: Font.AllLowercase } ListElement { name: "SmallCaps"; value: Font.SmallCaps }
+ ListElement { name: "Capitals"; value: Font.Capitalize }
+ }
+ }
+ ControlView {
+ id: cursorvisiblevalue
+ controlname: "Cursor"
+ model: ListModel { ListElement { name: "On"; value: true } ListElement { name: "Off"; value: false } }
+ }
+ ControlView {
+ id: echovalue
+ controlname: "Echo"
+ model: ListModel { ListElement { name: "Normal"; value: TextInput.Normal } ListElement { name: "Password"; value: TextInput.Password }
+ ListElement { name: "None"; value: TextInput.NoEcho } ListElement { name: "OnEdit"; value: TextInput.PasswordEchoOnEdit } } }
+ ControlView {
+ id: familyvalue
+ controlname: "Font"
+ property variant fontfamilies
+ function setModel() {
+ familiesmodel.clear();
+ for (var i = 0; i < fontfamilies.length; ++i) {
+ familiesmodel.append({ "name": fontfamilies[i], "value": fontfamilies[i] });
+ }
+ familyvalue.currentIndex = 0;
+ }
+ model: familiesmodel
+ ListModel { id: familiesmodel }
+ Component.onCompleted: { fontfamilies = Qt.fontFamilies(); setModel(); }
+ }
+ ControlView {
+ id: lspacingvalue
+ controlname: "LSpacing"
+ model: ListModel { ListElement { name: "0"; value: 0 } ListElement { name: "1"; value: 1 } ListElement { name: "2.5"; value: 2.5 } } }
+ ControlView {
+ id: wspacingvalue
+ controlname: "WSpacing"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
+ ControlView {
+ id: pixelvalue
+ controlname: "Pixel"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
+ ControlView {
+ id: pointvalue
+ controlname: "Point"
+ model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
+ ControlView {
+ id: strikeoutvalue
+ controlname: "Strike"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: underlinevalue
+ controlname: "U_line"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: weightvalue
+ controlname: "Weight"
+ model: ListModel { ListElement { name: "Light"; value: Font.Light } ListElement { name: "Normal"; value: Font.Normal }
+ ListElement { name: "DemiBold"; value: Font.DemiBold } ListElement { name: "Bold"; value: Font.Bold }
+ ListElement { name: "Black"; value: Font.Black } }
+ Component.onCompleted: { currentIndex = 1 } // set to default
+ }
+ ControlView {
+ id: halignvalue
+ controlname: "HAlign"
+ model: ListModel { ListElement { name: "Left"; value: Text.AlignLeft } ListElement { name: "Right"; value: Text.AlignRight }
+ ListElement { name: "Center"; value: Text.AlignHCenter } ListElement { name: "Justify"; value: Text.AlignJustify } } }
+ ControlView {
+ id: valignvalue
+ controlname: "VAlign"
+ model: ListModel { ListElement { name: "Top"; value: Text.AlignTop } ListElement { name: "Bottom"; value: Text.AlignBottom }
+ ListElement { name: "Center"; value: Text.AlignVCenter } } }
+ ControlView {
+ id: maxlinevalue
+ controlname: "Lines"
+ model: ListModel { ListElement { name: "Unset"; value: 1 } ListElement { name: "2"; value: 2 } ListElement { name: "10"; value: 10 }} }
+ ControlView {
+ id: lineheightvalue
+ controlname: "LHeight"
+ model: ListModel { ListElement { name: "1"; value: 1.0 } ListElement { name: "2"; value: 2.0 } ListElement { name: "30"; value: 30.0 }} }
+ ControlView {
+ id: lineheightmodevalue
+ controlname: "LHMode"
+ model: ListModel {
+ ListElement { name: "Multiply"; value: Text.ProportionalHeight } ListElement { name: "Fixed"; value: Text.FixedHeight } } }
+ ControlView {
+ id: mousevalue
+ controlname: "Mouse"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: smoothvalue
+ controlname: "Smooth"
+ model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
+ ControlView {
+ id: stylevalue
+ controlname: "Style"
+ model: ListModel { ListElement { name: "Normal"; value: Text.Normal } ListElement { name: "Outline"; value: Text.Outline }
+ ListElement { name: "Raised"; value: Text.Raised } ListElement { name: "Sunken"; value: Text.Sunken } } }
+ ControlView {
+ id: stylecolorvalue
+ controlname: "SColor"
+ model: ListModel { ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } } }
+ ControlView {
+ id: wrapvalue
+ controlname: "Wrap"
+ model: ListModel { ListElement { name: "None"; value: Text.NoWrap } ListElement { name: "Word"; value: Text.WordWrap }
+ ListElement { name: "Anywhere"; value: Text.WrapAnywhere } ListElement { name: "Wrap"; value: Text.Wrap } } }
+ ControlView {
+ id: validvalue
+ controlname: "Valid"
+ model: ListModel { ListElement { name: "None"; value: -1 } ListElement { name: "Int"; value: 0 }
+ ListElement { name: "Double"; value: 1 } ListElement { name: "RegExp"; value: 2 } } }
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/testapplications/textlayout/styledtext-layout.qml b/tests/testapplications/textlayout/styledtext-layout.qml
new file mode 100644
index 0000000000..aaf18f0ba0
--- /dev/null
+++ b/tests/testapplications/textlayout/styledtext-layout.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 1024; height: 1024
+ focus: true
+
+ property real offset: 0
+ property real margin: 15
+
+ Keys.onLeftPressed: myText.horizontalAlignment = Text.AlignLeft
+ Keys.onUpPressed: myText.horizontalAlignment = Text.AlignHCenter
+ Keys.onRightPressed: myText.horizontalAlignment = Text.AlignRight
+ Keys.onDownPressed: myText.horizontalAlignment = Text.AlignJustify
+
+ Text {
+ id: myText
+ anchors.fill: parent
+ anchors.margins: 20
+ wrapMode: Text.WordWrap
+ font.family: "Times New Roman"
+ font.pixelSize: 18
+ textFormat: Text.StyledText
+ horizontalAlignment: Text.AlignJustify
+
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer at ante dui sed eu egestas est facilis <a href=\"www.nokia.com\">www.nokia.com</a>.<br/>Curabitur ante est, pulvinar quis adipiscing a, iaculis id ipsum. Phasellus id neque id velit facilisis cursus ac sit amet nibh. Donec enim arcu, pharetra non semper nec, iaculis eget elit. Nunc blandit condimentum odio vel egestas.<br><ul type=\"bullet\"><li>Coffee<ol type=\"a\"><li>Espresso<li><b>Cappuccino</b><li><i>Flat White</i><li>Latte</ol><li>Juice<ol type=\"1\"><li>Orange</li><li>Apple</li><li>Pineapple</li><li>Tomato</li></ol></li></ul><p><font color=\"#434343\"><i>Proin consectetur <b>sapien</b> in ipsum lacinia sit amet mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis, sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac leo eget ipsum ultricies viverra sit amet eu orci. Praesent et tortor risus, viverra accumsan sapien. Sed faucibus eleifend lectus, sed euismod urna porta eu. Aenean ultricies lectus ut orci dictum quis convallis nisi ultrices. Nunc elit mi, iaculis a porttitor rutrum, venenatis malesuada nisi. Suspendisse turpis quam, euismod non imperdiet et, rutrum nec ligula. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam semper tristique metus eu sodales. Integer eget risus ipsum. Quisque ut risus ut nulla tristique volutpat at sit amet nisl. Aliquam pulvinar auctor diam nec bibendum. Quisque luctus sapien id arcu volutpat pharetra. Praesent pretium imperdiet euismod. Integer fringilla rhoncus condimentum. Quisque sit amet ornare nulla. Cras sapien augue, sagittis a dictum id, suscipit et nunc. Cras vitae augue in enim elementum venenatis sed nec risus. Sed nisi quam, mollis quis auctor ac, vestibulum in neque. Vivamus eu justo risus. Suspendisse vel mollis est. Vestibulum gravida interdum mi, in molestie neque gravida in.</i></font><br><br> Donec nibh odio, mattis facilisis vulputate et, scelerisque ut felis. Sed ornare eros nec odio aliquam eu varius augue adipiscing. Vivamus sit amet massa dapibus sapien pulvinar consectetur a sit amet felis. Cras non mi id libero dictum iaculis id dignissim eros. Praesent eget enim dui, sed bibendum neque. Ut interdum nisl id leo malesuada ornare.<br><br>Pellentesque id nisl eu odio volutpat posuere et at massa. Pellentesque nec lorem justo. Integer sem urna, pharetra sed sagittis vitae, condimentum ac felis. Ut vitae sapien ac tortor adipiscing pharetra. Cras tristique urna tempus ante volutpat eleifend non eu ligula. Mauris sodales nisl et lorem tristique sodales. Mauris arcu orci, vehicula semper cursus ac, dapibus ut mi. Cras orci ligula, lacinia non laoreet non, feugiat eget lorem. Duis commodo urna nunc. Ut eu diam quis magna volutpat auctor. Duis non nibh non leo aliquet gravida. <font color=\"green\">Aenean diam velit, eleifend sed porta eu, malesuada sed erat.</font> In hac habitasse platea dictumst. Ut nulla ligula, tincidunt ac volutpat nec, accumsan at risus. Donec eget ipsum sit amet nulla tempus auctor ut non massa. Donec enim purus, consectetur viverra congue vitae, vehicula eu sapien. Ut aliquam iaculis metus, a bibendum nisi fringilla ut. Maecenas ut libero augue, vitae tristique diam. Vivamus nec rhoncus ipsum. Maecenas rutrum, libero sit amet ultrices cursus, elit massa laoreet odio, in luctus elit quam eu quam. Sed non diam urna. Maecenas fringilla feugiat malesuada. In tellus nibh, gravida vitae cursus mollis, tincidunt eu urna. Cras turpis lorem, dictum in feugiat id, gravida eu nulla. In ultricies nisl in sapien consectetur eu ultricies nisl facilisis. Nam id mauris a leo pretium facilisis eget quis est. Fusce fermentum quam in metus facilisis semper."
+
+
+ onLineLaidOut: {
+ line.width = width / 2 - (2 * margin)
+ if (line.number === 40) {
+ main.offset = line.y
+ }
+ if (line.number >= 40) {
+ line.x = width / 2 + margin
+ line.y -= main.offset
+ }
+ if ((line.y + line.height) > rect.y && line.y < (rect.y + rect.height)) {
+ if (line.number < 40)
+ line.width = Math.min((rect.x - line.x), line.width)
+ else {
+ line.x = Math.max((rect.x + rect.width), width / 2 + margin)
+ line.width = Math.min((width - margin - line.x), line.width)
+ }
+ }
+ }
+
+ Item {
+ id: rect
+ x: 280; y: 200
+ width: 300; height: 300
+
+ Rectangle {
+ anchors { fill: parent; leftMargin: 15; rightMargin: 15 }
+ color: "lightsteelblue"; opacity: 0.3
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: rect
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: mouse.button == Qt.RightButton ? myText.font.pixelSize -= 1 : myText.font.pixelSize += 1
+ onPositionChanged: myText.doLayout()
+ }
+ }
+ }
+
+}